From 1c5ff8ed4e534cb44fd9b8d9e716b24b5f7727fa Mon Sep 17 00:00:00 2001 From: savagex Date: Mon, 7 Nov 2005 19:52:16 +0000 Subject: [PATCH] git-svn-id: svn://svn.icculus.org/nexuiz/trunk@544 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- menu/.cvsignore | 4 - menu/A little todo list.txt | 2 - menu/background.menu | 61 - menu/cursor.qc | 123 -- menu/cursor.qh | 58 - menu/graphic.qc | 254 --- menu/graphic.qh | 72 - menu/main.menu | 163 -- menu/mbuiltin.qc | 190 --- menu/mcontrols.qc | 1155 ------------- menu/mcontrols.qh | 193 --- menu/mcustom.qc | 1475 ----------------- menu/mcustom.qh | 153 -- menu/menu.qc | 138 -- menu/menu.qh | 26 - menu/mfuncs.qc | 468 ------ menu/mfuncs.qh | 71 - menu/mmanager.qc | 972 ----------- menu/mmanager.qh | 185 --- menu/msys.qc | 251 --- menu/normal.menu | 230 --- menu/options.menu | 1247 -------------- menu/progs.src | 36 - menu/sound.qc | 61 - menu/sound.qh | 32 - menu/video.menu | 97 -- menu/xplayer.menu | 638 ------- qcsrc/Makefile | 6 - qcsrc/Nexuiz.dsp | 281 ---- qcsrc/Nexuiz.dsw | 29 - qcsrc/Nexuiz.opt | Bin 60928 -> 0 bytes qcsrc/bot/bot.qc | 1237 -------------- qcsrc/bot/bot_ai.qc | 1010 ----------- qcsrc/bot/bot_ed.qc | 1367 --------------- qcsrc/bot/bot_fight.qc | 458 ----- qcsrc/bot/bot_misc.qc | 777 --------- qcsrc/bot/bot_move.qc | 512 ------ qcsrc/bot/bot_phys.qc | 678 -------- qcsrc/bot/bot_way.qc | 1001 ----------- qcsrc/bot/maps/map_mattrye1_nex.qc | 50 - qcsrc/bot/maps/map_mattrye2.qc | 51 - qcsrc/bot/maps/map_nexdm1.qc | 50 - qcsrc/default.cfg | 400 ----- qcsrc/gamec/GameC.dsp | 333 ---- qcsrc/gamec/GameC.dsw | 29 - qcsrc/gamec/GameC.opt | Bin 58880 -> 0 bytes qcsrc/gamec/Makefile | 5 - qcsrc/gamec/builtins.h | 65 - qcsrc/gamec/cl_client.c | 808 --------- qcsrc/gamec/cl_impulse.c | 64 - qcsrc/gamec/cl_physics.c | 247 --- qcsrc/gamec/cl_player.c | 334 ---- qcsrc/gamec/cl_weaponanimations.c | 25 - qcsrc/gamec/cl_weapons.c | 202 --- qcsrc/gamec/cl_weaponsystem.c | 282 ---- qcsrc/gamec/clientcommands.c | 224 --- qcsrc/gamec/constants.h | 189 --- qcsrc/gamec/ctf.c | 557 ------- qcsrc/gamec/defs.h | 203 --- qcsrc/gamec/domination.c | 562 ------- qcsrc/gamec/extensions.h | 995 ----------- qcsrc/gamec/g_casings.c | 91 - qcsrc/gamec/g_damage.c | 383 ----- qcsrc/gamec/g_decors.c | 246 --- qcsrc/gamec/g_hook.c | 205 --- qcsrc/gamec/g_lights.c | 120 -- qcsrc/gamec/g_subs.c | 411 ----- qcsrc/gamec/g_tetris.c | 746 --------- qcsrc/gamec/g_triggers.c | 420 ----- qcsrc/gamec/g_violence.c | 65 - qcsrc/gamec/g_world.c | 644 ------- qcsrc/gamec/mauvebot.c | 574 ------- qcsrc/gamec/miscfunctions.c | 5 - qcsrc/gamec/runematch.c | 705 -------- qcsrc/gamec/sv_main.c | 130 -- qcsrc/gamec/sv_stats.c | 5 - qcsrc/gamec/sys.h | 145 -- qcsrc/gamec/t_halflife.c | 58 - qcsrc/gamec/t_items.c | 186 --- qcsrc/gamec/t_jumppads.c | 98 -- qcsrc/gamec/t_plats.c | 1248 -------------- qcsrc/gamec/t_quake.c | 45 - qcsrc/gamec/t_quake3.c | 18 - qcsrc/gamec/t_teleporters.c | 113 -- qcsrc/gamec/teamplay.c | 1049 ------------ qcsrc/gamec/w_common.c | 648 -------- qcsrc/gamec/w_crylink.c | 114 -- qcsrc/gamec/w_electro.c | 254 --- qcsrc/gamec/w_grenadelauncher.c | 115 -- qcsrc/gamec/w_hagar.c | 123 -- qcsrc/gamec/w_laser.c | 101 -- qcsrc/gamec/w_nex.c | 103 -- qcsrc/gamec/w_rocketlauncher.c | 132 -- qcsrc/gamec/w_shotgun.c | 94 -- qcsrc/gamec/w_uzi.c | 93 -- qcsrc/progdefs.h | 143 -- qcsrc/progs.src | 66 - qcsrc/todo.txt | 1 - scmenu/constants.menu | 94 -- scmenu/creategame.menu | 63 - scmenu/creategame/basic.menu | 156 -- scmenu/creategame/game.menu | 56 - scmenu/creategame/gamemodes/ctf.menu | 60 - scmenu/creategame/gamemodes/domination.menu | 70 - scmenu/creategame/gamemodes/gamemisc.menu | 268 --- scmenu/creategame/gamemodes/runematch.menu | 263 --- scmenu/creategame/gamemodes/teamplay.menu | 68 - scmenu/creategame/management.menu | 90 - scmenu/creategame/maplist.menu | 91 - scmenu/creategame/weapon.menu | 382 ----- scmenu/credits.menu | 85 - scmenu/data.menu | 26 - scmenu/data/color.menu | 124 -- scmenu/data/effects.menu | 95 -- scmenu/data/game.menu | 13 - scmenu/data/gamemodes/ctf.menu | 79 - scmenu/data/gamemodes/domination.menu | 92 - scmenu/data/gamemodes/gamemisc.menu | 294 ---- scmenu/data/gamemodes/runematch.menu | 300 ---- scmenu/data/gamemodes/teamplay.menu | 80 - scmenu/data/input.menu | 37 - scmenu/data/key.menu | 161 -- scmenu/data/management.menu | 46 - scmenu/data/player.menu | 91 - scmenu/data/server.menu | 249 --- scmenu/data/serverlist.menu | 17 - scmenu/data/sound.menu | 34 - scmenu/data/video.menu | 35 - scmenu/data/weapon.menu | 469 ------ scmenu/ingame.menu | 4 - scmenu/joingame.menu | 200 --- scmenu/main.menu | 57 - scmenu/menu | 17 - scmenu/messagebox.menu | 82 - scmenu/normal.menu | 85 - scmenu/options.menu | 75 - scmenu/options/color.menu | 107 -- scmenu/options/effects.menu | 102 -- scmenu/options/game.menu | 9 - scmenu/options/input.menu | 45 - scmenu/options/key.menu | 373 ----- scmenu/options/player.menu | 138 -- scmenu/options/sound.menu | 50 - scmenu/options/video.menu | 61 - scmenu/quit.menu | 76 - scmenu/source/base/cursor.qc | 96 -- scmenu/source/base/cursor.qh | 32 - scmenu/source/base/gfx.qc | 194 --- scmenu/source/base/gfx.qh | 51 - scmenu/source/base/hostcache.qc | 39 - scmenu/source/base/hostcache.qh | 26 - scmenu/source/base/key.qc | 80 - scmenu/source/base/key.qh | 16 - scmenu/source/base/snd.qc | 32 - scmenu/source/base/snd.qh | 8 - scmenu/source/base/timer.qc | 22 - scmenu/source/base/timer.qh | 11 - scmenu/source/control/_fx/float.qc | 55 - scmenu/source/control/_fx/fx.qh | 61 - scmenu/source/control/_fx/interpol.qc | 12 - scmenu/source/control/_fx/vector.qc | 71 - .../source/control/automation/automation.qc | 13 - .../source/control/automation/automation.qh | 30 - scmenu/source/control/automation/foreach.qc | 23 - scmenu/source/control/automation/job.qc | 22 - scmenu/source/control/cinematic.qc | 49 - scmenu/source/control/constants.qh | 13 - scmenu/source/control/container.qc | 7 - scmenu/source/control/custom.qc | 22 - scmenu/source/control/data/altstring.qc | 25 - scmenu/source/control/data/base.qc | 224 --- scmenu/source/control/data/container.qc | 38 - scmenu/source/control/data/cvar.qc | 99 -- scmenu/source/control/data/data.qh | 137 -- scmenu/source/control/data/fastresync.qc | 35 - scmenu/source/control/data/router.qc | 32 - scmenu/source/control/data/text.qc | 32 - scmenu/source/control/data/textswitch.qc | 70 - scmenu/source/control/data/texttime.qc | 74 - scmenu/source/control/data/textvalue.qc | 33 - scmenu/source/control/data/value.qc | 82 - scmenu/source/control/data/valueswitch.qc | 59 - scmenu/source/control/fx/base.qc | 69 - scmenu/source/control/fx/fx.qh | 21 - scmenu/source/control/items.qh | 99 -- scmenu/source/control/link.qc | 63 - scmenu/source/control/visual/button.qc | 190 --- scmenu/source/control/visual/editbox.qc | 189 --- scmenu/source/control/visual/floating.qc | 54 - scmenu/source/control/visual/label.qc | 64 - scmenu/source/control/visual/list.qc | 147 -- scmenu/source/control/visual/multilabel.qc | 110 -- scmenu/source/control/visual/picture.qc | 36 - scmenu/source/control/visual/rect.qc | 18 - scmenu/source/control/visual/scrollbar.qc | 158 -- scmenu/source/control/visual/slider.qc | 146 -- scmenu/source/control/visual/switchbutton.qc | 43 - scmenu/source/control/visual/valuebutton.qc | 31 - scmenu/source/control/visual/visual.qh | 210 --- scmenu/source/control/window/arrangement.qc | 76 - scmenu/source/control/window/eventwindow.qc | 13 - scmenu/source/control/window/frame.qc | 9 - scmenu/source/control/window/layout.qc | 66 - scmenu/source/control/window/reference.qc | 68 - scmenu/source/control/window/scroll.qc | 57 - scmenu/source/control/window/window.qc | 58 - scmenu/source/control/window/windows.qh | 52 - scmenu/source/custom/color.qm | 12 - scmenu/source/custom/creategame.qm | 424 ----- scmenu/source/custom/creategame/creategame.qh | 76 - scmenu/source/custom/creategame/filelist.qc | 100 -- scmenu/source/custom/creategame/maps.qc | 715 -------- scmenu/source/custom/creategame/mods.qc | 84 - scmenu/source/custom/credits.qc | 26 - scmenu/source/custom/credits.qh | 7 - scmenu/source/custom/credits.qm | 67 - scmenu/source/custom/custom.qh | 5 - scmenu/source/custom/globalkey.qm | 32 - scmenu/source/custom/joingame.qc | 113 -- scmenu/source/custom/joingame.qh | 31 - scmenu/source/custom/joingame.qm | 231 --- scmenu/source/custom/key.qc | 162 -- scmenu/source/custom/key.qh | 13 - scmenu/source/custom/key.qm | 65 - scmenu/source/custom/messagebox.qc | 79 - scmenu/source/custom/messagebox.qh | 5 - scmenu/source/custom/option.qm | 113 -- scmenu/source/custom/player.qm | 64 - scmenu/source/custom/player/avatar.qc | 236 --- scmenu/source/custom/player/color.qc | 72 - scmenu/source/custom/player/name.qc | 65 - scmenu/source/custom/player/player.qh | 31 - scmenu/source/custom/quit.qm | 45 - scmenu/source/custom/stresstest.qm | 14 - scmenu/source/custom/util.qm | 29 - scmenu/source/custom/video.qc | 67 - scmenu/source/custom/video.qh | 9 - scmenu/source/custom/video.qm | 10 - scmenu/source/custom/visible.qc | 14 - scmenu/source/custom/visible.qm | 96 -- scmenu/source/mbuiltin.qc | 250 --- scmenu/source/menu.qc | 151 -- scmenu/source/menu.qh | 35 - scmenu/source/msys.qc | 278 ---- scmenu/source/progdefs.h | 13 - scmenu/source/progs.src | 180 -- scmenu/source/system/debug.qc | 179 -- scmenu/source/system/debug.qh | 80 - scmenu/source/system/event_helper.qc | 290 ---- scmenu/source/system/events.qc | 458 ----- scmenu/source/system/events.qh | 56 - scmenu/source/system/events_.qc | 419 ----- scmenu/source/system/gc.qc | 72 - scmenu/source/system/gc.qh | 14 - scmenu/source/system/history.qc | 81 - scmenu/source/system/history.qh | 23 - scmenu/source/system/isframe.qc | 335 ---- scmenu/source/system/isframe.qh | 57 - scmenu/source/system/item.qh | 126 -- scmenu/source/system/mgfx.qc | 158 -- scmenu/source/system/mgfx.qh | 36 - scmenu/source/system/parser.qc | 569 ------- scmenu/source/system/parser.qh | 82 - scmenu/source/system/structure.qc | 599 ------- scmenu/source/system/structure.qh | 88 - scmenu/source/todo | 75 - scmenu/source/util/altstring.qc | 314 ---- scmenu/source/util/altstring.qh | 17 - scmenu/source/util/nfunction.qc | 9 - scmenu/source/util/property.qc | 275 --- scmenu/source/util/property.qh | 27 - scmenu/source/util/rect.qc | 189 --- scmenu/source/util/rect.qh | 27 - scmenu/source/util/string.qc | 134 -- scmenu/source/util/string.qh | 23 - scmenu/source/util/text.qc | 59 - scmenu/source/util/text.qh | 7 - scmenu/source/util/uid.qc | 33 - scmenu/source/util/uid.qh | 7 - scmenu/source/util/util.qh | 22 - scmenu/templates.menu | 269 --- scmenu/test.menu | 21 - 282 files changed, 49773 deletions(-) delete mode 100644 menu/.cvsignore delete mode 100644 menu/A little todo list.txt delete mode 100644 menu/background.menu delete mode 100644 menu/cursor.qc delete mode 100644 menu/cursor.qh delete mode 100644 menu/graphic.qc delete mode 100644 menu/graphic.qh delete mode 100644 menu/main.menu delete mode 100644 menu/mbuiltin.qc delete mode 100644 menu/mcontrols.qc delete mode 100644 menu/mcontrols.qh delete mode 100644 menu/mcustom.qc delete mode 100644 menu/mcustom.qh delete mode 100644 menu/menu.qc delete mode 100644 menu/menu.qh delete mode 100644 menu/mfuncs.qc delete mode 100644 menu/mfuncs.qh delete mode 100644 menu/mmanager.qc delete mode 100644 menu/mmanager.qh delete mode 100644 menu/msys.qc delete mode 100644 menu/normal.menu delete mode 100644 menu/options.menu delete mode 100644 menu/progs.src delete mode 100644 menu/sound.qc delete mode 100644 menu/sound.qh delete mode 100644 menu/video.menu delete mode 100644 menu/xplayer.menu delete mode 100644 qcsrc/Makefile delete mode 100644 qcsrc/Nexuiz.dsp delete mode 100644 qcsrc/Nexuiz.dsw delete mode 100644 qcsrc/Nexuiz.opt delete mode 100644 qcsrc/bot/bot.qc delete mode 100644 qcsrc/bot/bot_ai.qc delete mode 100644 qcsrc/bot/bot_ed.qc delete mode 100644 qcsrc/bot/bot_fight.qc delete mode 100644 qcsrc/bot/bot_misc.qc delete mode 100644 qcsrc/bot/bot_move.qc delete mode 100644 qcsrc/bot/bot_phys.qc delete mode 100644 qcsrc/bot/bot_way.qc delete mode 100644 qcsrc/bot/maps/map_mattrye1_nex.qc delete mode 100644 qcsrc/bot/maps/map_mattrye2.qc delete mode 100644 qcsrc/bot/maps/map_nexdm1.qc delete mode 100755 qcsrc/default.cfg delete mode 100644 qcsrc/gamec/GameC.dsp delete mode 100644 qcsrc/gamec/GameC.dsw delete mode 100644 qcsrc/gamec/GameC.opt delete mode 100644 qcsrc/gamec/Makefile delete mode 100644 qcsrc/gamec/builtins.h delete mode 100644 qcsrc/gamec/cl_client.c delete mode 100644 qcsrc/gamec/cl_impulse.c delete mode 100644 qcsrc/gamec/cl_physics.c delete mode 100644 qcsrc/gamec/cl_player.c delete mode 100644 qcsrc/gamec/cl_weaponanimations.c delete mode 100644 qcsrc/gamec/cl_weapons.c delete mode 100644 qcsrc/gamec/cl_weaponsystem.c delete mode 100644 qcsrc/gamec/clientcommands.c delete mode 100644 qcsrc/gamec/constants.h delete mode 100644 qcsrc/gamec/ctf.c delete mode 100644 qcsrc/gamec/defs.h delete mode 100644 qcsrc/gamec/domination.c delete mode 100644 qcsrc/gamec/extensions.h delete mode 100644 qcsrc/gamec/g_casings.c delete mode 100644 qcsrc/gamec/g_damage.c delete mode 100644 qcsrc/gamec/g_decors.c delete mode 100644 qcsrc/gamec/g_hook.c delete mode 100644 qcsrc/gamec/g_lights.c delete mode 100644 qcsrc/gamec/g_subs.c delete mode 100644 qcsrc/gamec/g_tetris.c delete mode 100644 qcsrc/gamec/g_triggers.c delete mode 100644 qcsrc/gamec/g_violence.c delete mode 100644 qcsrc/gamec/g_world.c delete mode 100644 qcsrc/gamec/mauvebot.c delete mode 100644 qcsrc/gamec/miscfunctions.c delete mode 100644 qcsrc/gamec/runematch.c delete mode 100644 qcsrc/gamec/sv_main.c delete mode 100644 qcsrc/gamec/sv_stats.c delete mode 100644 qcsrc/gamec/sys.h delete mode 100644 qcsrc/gamec/t_halflife.c delete mode 100644 qcsrc/gamec/t_items.c delete mode 100644 qcsrc/gamec/t_jumppads.c delete mode 100644 qcsrc/gamec/t_plats.c delete mode 100644 qcsrc/gamec/t_quake.c delete mode 100644 qcsrc/gamec/t_quake3.c delete mode 100644 qcsrc/gamec/t_teleporters.c delete mode 100644 qcsrc/gamec/teamplay.c delete mode 100644 qcsrc/gamec/w_common.c delete mode 100644 qcsrc/gamec/w_crylink.c delete mode 100644 qcsrc/gamec/w_electro.c delete mode 100644 qcsrc/gamec/w_grenadelauncher.c delete mode 100644 qcsrc/gamec/w_hagar.c delete mode 100644 qcsrc/gamec/w_laser.c delete mode 100644 qcsrc/gamec/w_nex.c delete mode 100644 qcsrc/gamec/w_rocketlauncher.c delete mode 100644 qcsrc/gamec/w_shotgun.c delete mode 100644 qcsrc/gamec/w_uzi.c delete mode 100644 qcsrc/progdefs.h delete mode 100644 qcsrc/progs.src delete mode 100644 qcsrc/todo.txt delete mode 100644 scmenu/constants.menu delete mode 100644 scmenu/creategame.menu delete mode 100644 scmenu/creategame/basic.menu delete mode 100644 scmenu/creategame/game.menu delete mode 100644 scmenu/creategame/gamemodes/ctf.menu delete mode 100644 scmenu/creategame/gamemodes/domination.menu delete mode 100644 scmenu/creategame/gamemodes/gamemisc.menu delete mode 100644 scmenu/creategame/gamemodes/runematch.menu delete mode 100644 scmenu/creategame/gamemodes/teamplay.menu delete mode 100644 scmenu/creategame/management.menu delete mode 100644 scmenu/creategame/maplist.menu delete mode 100644 scmenu/creategame/weapon.menu delete mode 100644 scmenu/credits.menu delete mode 100644 scmenu/data.menu delete mode 100644 scmenu/data/color.menu delete mode 100644 scmenu/data/effects.menu delete mode 100644 scmenu/data/game.menu delete mode 100644 scmenu/data/gamemodes/ctf.menu delete mode 100644 scmenu/data/gamemodes/domination.menu delete mode 100644 scmenu/data/gamemodes/gamemisc.menu delete mode 100644 scmenu/data/gamemodes/runematch.menu delete mode 100644 scmenu/data/gamemodes/teamplay.menu delete mode 100644 scmenu/data/input.menu delete mode 100644 scmenu/data/key.menu delete mode 100644 scmenu/data/management.menu delete mode 100644 scmenu/data/player.menu delete mode 100644 scmenu/data/server.menu delete mode 100644 scmenu/data/serverlist.menu delete mode 100644 scmenu/data/sound.menu delete mode 100644 scmenu/data/video.menu delete mode 100644 scmenu/data/weapon.menu delete mode 100644 scmenu/ingame.menu delete mode 100644 scmenu/joingame.menu delete mode 100644 scmenu/main.menu delete mode 100644 scmenu/menu delete mode 100644 scmenu/messagebox.menu delete mode 100644 scmenu/normal.menu delete mode 100644 scmenu/options.menu delete mode 100644 scmenu/options/color.menu delete mode 100644 scmenu/options/effects.menu delete mode 100644 scmenu/options/game.menu delete mode 100644 scmenu/options/input.menu delete mode 100644 scmenu/options/key.menu delete mode 100644 scmenu/options/player.menu delete mode 100644 scmenu/options/sound.menu delete mode 100644 scmenu/options/video.menu delete mode 100644 scmenu/quit.menu delete mode 100644 scmenu/source/base/cursor.qc delete mode 100644 scmenu/source/base/cursor.qh delete mode 100644 scmenu/source/base/gfx.qc delete mode 100644 scmenu/source/base/gfx.qh delete mode 100644 scmenu/source/base/hostcache.qc delete mode 100644 scmenu/source/base/hostcache.qh delete mode 100644 scmenu/source/base/key.qc delete mode 100644 scmenu/source/base/key.qh delete mode 100644 scmenu/source/base/snd.qc delete mode 100644 scmenu/source/base/snd.qh delete mode 100644 scmenu/source/base/timer.qc delete mode 100644 scmenu/source/base/timer.qh delete mode 100644 scmenu/source/control/_fx/float.qc delete mode 100644 scmenu/source/control/_fx/fx.qh delete mode 100644 scmenu/source/control/_fx/interpol.qc delete mode 100644 scmenu/source/control/_fx/vector.qc delete mode 100644 scmenu/source/control/automation/automation.qc delete mode 100644 scmenu/source/control/automation/automation.qh delete mode 100644 scmenu/source/control/automation/foreach.qc delete mode 100644 scmenu/source/control/automation/job.qc delete mode 100644 scmenu/source/control/cinematic.qc delete mode 100644 scmenu/source/control/constants.qh delete mode 100644 scmenu/source/control/container.qc delete mode 100644 scmenu/source/control/custom.qc delete mode 100644 scmenu/source/control/data/altstring.qc delete mode 100644 scmenu/source/control/data/base.qc delete mode 100644 scmenu/source/control/data/container.qc delete mode 100644 scmenu/source/control/data/cvar.qc delete mode 100644 scmenu/source/control/data/data.qh delete mode 100644 scmenu/source/control/data/fastresync.qc delete mode 100644 scmenu/source/control/data/router.qc delete mode 100644 scmenu/source/control/data/text.qc delete mode 100644 scmenu/source/control/data/textswitch.qc delete mode 100644 scmenu/source/control/data/texttime.qc delete mode 100644 scmenu/source/control/data/textvalue.qc delete mode 100644 scmenu/source/control/data/value.qc delete mode 100644 scmenu/source/control/data/valueswitch.qc delete mode 100644 scmenu/source/control/fx/base.qc delete mode 100644 scmenu/source/control/fx/fx.qh delete mode 100644 scmenu/source/control/items.qh delete mode 100644 scmenu/source/control/link.qc delete mode 100644 scmenu/source/control/visual/button.qc delete mode 100644 scmenu/source/control/visual/editbox.qc delete mode 100644 scmenu/source/control/visual/floating.qc delete mode 100644 scmenu/source/control/visual/label.qc delete mode 100644 scmenu/source/control/visual/list.qc delete mode 100644 scmenu/source/control/visual/multilabel.qc delete mode 100644 scmenu/source/control/visual/picture.qc delete mode 100644 scmenu/source/control/visual/rect.qc delete mode 100644 scmenu/source/control/visual/scrollbar.qc delete mode 100644 scmenu/source/control/visual/slider.qc delete mode 100644 scmenu/source/control/visual/switchbutton.qc delete mode 100644 scmenu/source/control/visual/valuebutton.qc delete mode 100644 scmenu/source/control/visual/visual.qh delete mode 100644 scmenu/source/control/window/arrangement.qc delete mode 100644 scmenu/source/control/window/eventwindow.qc delete mode 100644 scmenu/source/control/window/frame.qc delete mode 100644 scmenu/source/control/window/layout.qc delete mode 100644 scmenu/source/control/window/reference.qc delete mode 100644 scmenu/source/control/window/scroll.qc delete mode 100644 scmenu/source/control/window/window.qc delete mode 100644 scmenu/source/control/window/windows.qh delete mode 100644 scmenu/source/custom/color.qm delete mode 100644 scmenu/source/custom/creategame.qm delete mode 100644 scmenu/source/custom/creategame/creategame.qh delete mode 100644 scmenu/source/custom/creategame/filelist.qc delete mode 100644 scmenu/source/custom/creategame/maps.qc delete mode 100644 scmenu/source/custom/creategame/mods.qc delete mode 100644 scmenu/source/custom/credits.qc delete mode 100644 scmenu/source/custom/credits.qh delete mode 100644 scmenu/source/custom/credits.qm delete mode 100644 scmenu/source/custom/custom.qh delete mode 100644 scmenu/source/custom/globalkey.qm delete mode 100644 scmenu/source/custom/joingame.qc delete mode 100644 scmenu/source/custom/joingame.qh delete mode 100644 scmenu/source/custom/joingame.qm delete mode 100644 scmenu/source/custom/key.qc delete mode 100644 scmenu/source/custom/key.qh delete mode 100644 scmenu/source/custom/key.qm delete mode 100644 scmenu/source/custom/messagebox.qc delete mode 100644 scmenu/source/custom/messagebox.qh delete mode 100644 scmenu/source/custom/option.qm delete mode 100644 scmenu/source/custom/player.qm delete mode 100644 scmenu/source/custom/player/avatar.qc delete mode 100644 scmenu/source/custom/player/color.qc delete mode 100644 scmenu/source/custom/player/name.qc delete mode 100644 scmenu/source/custom/player/player.qh delete mode 100644 scmenu/source/custom/quit.qm delete mode 100644 scmenu/source/custom/stresstest.qm delete mode 100644 scmenu/source/custom/util.qm delete mode 100644 scmenu/source/custom/video.qc delete mode 100644 scmenu/source/custom/video.qh delete mode 100644 scmenu/source/custom/video.qm delete mode 100644 scmenu/source/custom/visible.qc delete mode 100644 scmenu/source/custom/visible.qm delete mode 100644 scmenu/source/mbuiltin.qc delete mode 100644 scmenu/source/menu.qc delete mode 100644 scmenu/source/menu.qh delete mode 100644 scmenu/source/msys.qc delete mode 100644 scmenu/source/progdefs.h delete mode 100644 scmenu/source/progs.src delete mode 100644 scmenu/source/system/debug.qc delete mode 100644 scmenu/source/system/debug.qh delete mode 100644 scmenu/source/system/event_helper.qc delete mode 100644 scmenu/source/system/events.qc delete mode 100644 scmenu/source/system/events.qh delete mode 100644 scmenu/source/system/events_.qc delete mode 100644 scmenu/source/system/gc.qc delete mode 100644 scmenu/source/system/gc.qh delete mode 100644 scmenu/source/system/history.qc delete mode 100644 scmenu/source/system/history.qh delete mode 100644 scmenu/source/system/isframe.qc delete mode 100644 scmenu/source/system/isframe.qh delete mode 100644 scmenu/source/system/item.qh delete mode 100644 scmenu/source/system/mgfx.qc delete mode 100644 scmenu/source/system/mgfx.qh delete mode 100644 scmenu/source/system/parser.qc delete mode 100644 scmenu/source/system/parser.qh delete mode 100644 scmenu/source/system/structure.qc delete mode 100644 scmenu/source/system/structure.qh delete mode 100644 scmenu/source/todo delete mode 100644 scmenu/source/util/altstring.qc delete mode 100644 scmenu/source/util/altstring.qh delete mode 100644 scmenu/source/util/nfunction.qc delete mode 100644 scmenu/source/util/property.qc delete mode 100644 scmenu/source/util/property.qh delete mode 100644 scmenu/source/util/rect.qc delete mode 100644 scmenu/source/util/rect.qh delete mode 100644 scmenu/source/util/string.qc delete mode 100644 scmenu/source/util/string.qh delete mode 100644 scmenu/source/util/text.qc delete mode 100644 scmenu/source/util/text.qh delete mode 100644 scmenu/source/util/uid.qc delete mode 100644 scmenu/source/util/uid.qh delete mode 100644 scmenu/source/util/util.qh delete mode 100644 scmenu/templates.menu delete mode 100644 scmenu/test.menu diff --git a/menu/.cvsignore b/menu/.cvsignore deleted file mode 100644 index 37128d1e7..000000000 --- a/menu/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -progdefs.h -frikqcc.cfg -frikgui.exe -error.log \ No newline at end of file diff --git a/menu/A little todo list.txt b/menu/A little todo list.txt deleted file mode 100644 index 76e689a52..000000000 --- a/menu/A little todo list.txt +++ /dev/null @@ -1,2 +0,0 @@ -- Replace the next/prev with arrow graphics- Add "Player" options to the options menu. Which could show a selection screen alike to map selection, but this time load the pictures files from the "zym" files in the /models/player/ folder like you do with the bsp files. Once the picture is selected, show a larger version of the picture above the player selection table. And also, load a txt file from the same directory that shows info on the model for the user to see.- Add a "player name:" option to the player options menu.- Replace "Max Bots" with just "Bots"- Add the current game/effects options from the darkplaces menu to the nexuiz menu -bug: the singleplayer menu's text boxes do not accept backspace \ No newline at end of file diff --git a/menu/background.menu b/menu/background.menu deleted file mode 100644 index d81dd21c5..000000000 --- a/menu/background.menu +++ /dev/null @@ -1,61 +0,0 @@ -/* -Property of Alientrap - -Background description -*/ -// background of the normal menu -{ - type ITEM_WINDOW - name background - origin "0 0 0" -} -{ - type ITEM_WINDOW - name background_rect_wnd - parent background -} -{ - type ITEM_RECTANGLE - name background_rect - parent background_rect_wnd - pos "0 0 0" - size "1024 768 0" - //color "0.5 0.5 0.5" - //drawflag 2 // DRAWFLAG_2XMODULATE - color "0 0 0" - alpha 0.7 -} -{ - type ITEM_PICTURE - name background_pic - parent background - picture "gfx/m_background" - size "1024 768 0" - pos "0 0 0" - drawflag 0 -} -// developer stuff -{ - type ITEM_TEXT - name background_x - parent background - orderpos 100 - pos "954 748" - font_size "10 10 0" - text "000" - refresh nex_text_cur_x - alignment 2 // TEXT_ALIGN_RIGHT - flag 2080 -} -{ - type ITEM_TEXT - name background_y - parent background - orderpos 101 - pos "994 748" - font_size "10 10 0" - text "000" - refresh nex_text_cur_y - alignment 2 // TEXT_ALIGN_RIGHT - flag 2080 -} \ No newline at end of file diff --git a/menu/cursor.qc b/menu/cursor.qc deleted file mode 100644 index e7141d988..000000000 --- a/menu/cursor.qc +++ /dev/null @@ -1,123 +0,0 @@ -/////////////////////////////////////////////// -// Cursor Source File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all cursor specific functions -/////////////////////////////////////////////// - -void(void) cursor_reset = -{ - cursor_x = rint(GFX_WIDTH /2); - cursor_y = rint(GFX_HEIGHT /2); - - cursor_rel = '0 0 0'; - - cursor_last_frame_time = time; - cursor_color = CURSOR_COLOR; - cursor_transparency = CURSOR_TRANSPARENCY; - cursor_type = CT_NORMAL; -}; - -void(void) cursor_toggle = -{ - cursor_x = rint(GFX_WIDTH /2); - cursor_y = rint(GFX_HEIGHT /2); - cursor_type = CT_NORMAL; -}; - -void(void) cursor_init = -{ - // load the images - if(CF_NORMAL != "") - CF_NORMAL = gfx_loadpic(CF_NORMAL, CURSOR_ENFORCELOADING); - - if(CF_NORMAL == "") - CF_NORMAL = gfx_loadpic("ui/mousepointer.tga", true); // always - - if(CF_PULSE_0 != "") - CF_PULSE_0 = gfx_loadpic(CF_PULSE_0, CURSOR_ENFORCELOADING); - if(CF_PULSE_1 != "") - CF_PULSE_1 = gfx_loadpic(CF_PULSE_1, CURSOR_ENFORCELOADING); - if(CF_PULSE_2 != "") - CF_PULSE_2 = gfx_loadpic(CF_PULSE_2, CURSOR_ENFORCELOADING); - if(CF_PULSE_3 != "") - CF_PULSE_3 = gfx_loadpic(CF_PULSE_3, CURSOR_ENFORCELOADING); - if(CF_PULSE_4 != "") - CF_PULSE_4 = gfx_loadpic(CF_PULSE_4, CURSOR_ENFORCELOADING); - if(CF_PULSE_5 != "") - CF_PULSE_5 = gfx_loadpic(CF_PULSE_5, CURSOR_ENFORCELOADING); - if(CF_PULSE_6 != "") - CF_PULSE_6 = gfx_loadpic(CF_PULSE_6, CURSOR_ENFORCELOADING); - - // init the values - cursor_reset(); -}; - -void(void) cursor_shutdown = -{ - if(CF_NORMAL != "") - gfx_unloadpic(CF_NORMAL); - if(CF_PULSE_0 != "") - gfx_unloadpic(CF_PULSE_0); - if(CF_PULSE_1 != "") - gfx_unloadpic(CF_PULSE_1); - if(CF_PULSE_2 != "") - gfx_unloadpic(CF_PULSE_2); - if(CF_PULSE_3 != "") - gfx_unloadpic(CF_PULSE_3); - if(CF_PULSE_4 != "") - gfx_unloadpic(CF_PULSE_4); - if(CF_PULSE_5 != "") - gfx_unloadpic(CF_PULSE_5); - if(CF_PULSE_6 != "") - gfx_unloadpic(CF_PULSE_6); -}; - -void(void) cursor_frame = -{ - // update cursor animations - - if(cursor_type > CT_LAST_PULSE || cursor_type < CT_FIRST_PULSE) - cursor_last_frame_time = time; - else if(cursor_last_frame_time + CA_PULSE_SPEED <= time) - { - cursor_type = CT_FIRST_PULSE + - mod((time - cursor_last_frame_time) / CA_PULSE_SPEED, CT_LAST_PULSE - CT_FIRST_PULSE +1); - - cursor_last_frame_time += rint((time - cursor_last_frame_time) / CA_PULSE_SPEED) * CA_PULSE_SPEED; - } - - // update cursor position - cursor_rel = getmousepos(); - cursor_rel = gfx_converttogfx(cursor_rel); - // cursor speed, etc - cursor_rel = cursor_rel * CURSOR_SPEED; - cursor = cursor + cursor_rel; - - cursor_x = bound(0, cursor_x, GFX_WIDTH); - cursor_y = bound(0, cursor_y, GFX_HEIGHT); -}; - -void(void) cursor_draw = -{ - string pic; - - if(cursor_type == CT_FIRST_PULSE + 0 && CF_PULSE_0 != "") - pic = CF_PULSE_0; - else if(cursor_type == CT_FIRST_PULSE + 1 && CF_PULSE_1 != "") - pic = CF_PULSE_1; - else if(cursor_type == CT_FIRST_PULSE + 2 && CF_PULSE_2 != "") - pic = CF_PULSE_2; - else if((cursor_type == CT_FIRST_PULSE + 3 || cursor_type == CT_GLOW) && CF_PULSE_3 != "") - pic = CF_PULSE_3; - else if(cursor_type == CT_FIRST_PULSE + 4 && CF_PULSE_4 != "") - pic = CF_PULSE_4; - else if(cursor_type == CT_FIRST_PULSE + 5 && CF_PULSE_5 != "") - pic = CF_PULSE_5; - else if(cursor_type == CT_FIRST_PULSE + 6 && CF_PULSE_6 != "") - pic = CF_PULSE_6; - else // if(cursor_tpye = CT_NORMAL) - pic = CF_NORMAL; - - gfx_drawpic(cursor,pic, gfx_getimagesize(pic) * CURSOR_SCALE, cursor_color, cursor_transparency, 0); -}; \ No newline at end of file diff --git a/menu/cursor.qh b/menu/cursor.qh deleted file mode 100644 index f6d66dbc7..000000000 --- a/menu/cursor.qh +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////// -// Cursor Header File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all cursor specific constants as the pulse initialization list -//////////////////////////////// - -// cursor constants (cursor type) -const float CT_NORMAL = 0; -const float CT_PULSE = 1; -const float CT_FIRST_PULSE = 1; // pulse frames 0 - 6 -const float CT_LAST_PULSE = 7; -const float CT_GLOW = 8; - -const float CURSOR_SCALE = 1; - -const vector CURSOR_COLOR = '1 1 1'; -const float CURSOR_TRANSPARENCY = 1; - -// cursor speed -const float CURSOR_SPEED = 0.75; - -// cursor animation -const float CA_PULSE_SPEED = 0.14257142 ; // = 1 / 7 -> 1 secs total time - -// cursor filenames -var string CF_NORMAL = "ui/mousepointer.tga"; - -// enforce loading everything else qc will break -const float CURSOR_ENFORCELOADING = false; - -// pulse animation -var string CF_PULSE_0 = "", - CF_PULSE_1 = "", - CF_PULSE_2 = "", - CF_PULSE_3 = "", - CF_PULSE_4 = "", - CF_PULSE_5 = "", - CF_PULSE_6 = ""; - -// global ui vars -vector cursor; -vector cursor_rel; -vector cursor_color; -float cursor_transparency; -float cursor_type; -float cursor_last_frame_time; - -vector cursor_speed; - -// function prototypes - -void(void) cursor_init; -void(void) cursor_reset; -void(void) cursor_toggle; -void(void) cursor_frame; -void(void) cursor_draw; -void(void) cursor_shutdown; diff --git a/menu/graphic.qc b/menu/graphic.qc deleted file mode 100644 index 88344c345..000000000 --- a/menu/graphic.qc +++ /dev/null @@ -1,254 +0,0 @@ -/////////////////////////////////////////////// -// Graphic Source File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all graphic functions -/////////////////////////////////////////////// - -void(void) gfx_init = -{ - vid_conwidth = cvar("vid_conwidth"); - vid_conheight = cvar("vid_conheight"); -}; - -void(void) gfx_frame = -{ - vid_conwidth = cvar("vid_conwidth"); - vid_conheight = cvar("vid_conheight"); -}; - -void(void) gfx_toggle = -{ -}; - -void(float keynr, float ascii) gfx_keydown = -{ -}; - -void(void) gfx_draw = -{ -}; - -void(void) gfx_shutdown = -{ -}; - -string(string pic_name, float complain) gfx_loadpic = -{ - string c; - c = precache_pic(pic_name); - - if(c == "" && complain) - error("Couldnt precache ", pic_name, " !\n"); - if(c == "") - dprint("Couldnt precache ", pic_name, " !\n"); - return c; -}; - -void(string pic_name) gfx_unloadpic = -{ - // FIXME: gfx_unloadpic is a bit buggy in dp at the moment - restart the menu a few times - // and you get an access violation - //gfx_unloadpic(pic_name); -}; - -void(vector position, float character, vector scale, vector rgb, float alpha, float flag) -gfx_drawchar = -{ - float ret; - - position = gfx_converttocon(position); - scale = gfx_converttocon(scale); - - if(scale == '0 0 0') - return; - - ret = drawcharacter(position, character, scale, rgb, alpha, flag); - - if(ret == 1) - return; - if(ret == ERR_NULLSTRING) - error("Null character !\n"); - if(ret == ERR_BADDRAWFLAG) - error("Bad draw flag !\n"); - if(ret == ERR_BADSCALE) - error("Bad scale !\n"); - error("Unknown error code !\n"); -}; - -void(vector position, string str, vector scale, vector rgb, float alpha, float flag) -gfx_drawstring = -{ - float ret; - - position = gfx_converttocon(position); - scale = gfx_converttocon(scale); - - if(scale == '0 0 0') - return; - - ret = drawstring(position, str, scale, rgb, alpha, flag); - - if(ret == 1) - return; - if(ret == ERR_NULLSTRING) - error("Null string !\n"); - if(ret == ERR_BADDRAWFLAG) - error("Bad draw flag !\n"); - if(ret == ERR_BADSCALE) - error("Bad scale !\n"); - error("Unknown error code !\n"); -}; - -void(vector position, string pic_name, vector size, vector rgb, float alpha, float flag) -gfx_drawpic = -{ - float ret; - - if(size == '0 0 0') - size = gfx_getimagesize(pic_name); - - // for FrikQCC - position = gfx_converttocon(position); - size = gfx_converttocon(size); - - ret = drawpic(position, pic_name, size, rgb, alpha, flag); - - if(ret == 1) - return; - if(ret == ERR_NULLSTRING) - error("Null string !\n"); - if(ret == ERR_BADDRAWFLAG) - error("Bad draw flag !\n"); - if(ret == ERR_BADSIZE) - error("Bad size !\n"); - if(ret == ERR_NOTCACHED) - error("Picture ", pic_name, " was not precached !\n"); - error("Unknown error code !\n"); -}; - -void(vector position, vector size, vector rgb, float alpha, float flag) -gfx_fillarea = -{ - float ret; - - position = gfx_converttocon(position); - size = gfx_converttocon(size); - - if(size == '0 0 0') - return; - - ret = drawfill(position, size, rgb, alpha, flag); - - if(ret == 1) - return; - if(ret == ERR_BADDRAWFLAG) - error("Bad draw flag !\n"); - error("Unknown error code !\n"); -}; - -void(vector position, vector size) gfx_setcliparea = -{ - position = gfx_converttocon(position); - size = gfx_converttocon(size); - drawsetcliparea(position_x, position_y, size_x, size_y); -}; - -void(void) gfx_resetcliparea = -{ - drawresetcliparea(); -}; - -void(vector position, float character, vector scale, vector rgb, float alpha, float flag) -menu_drawchar = -{ - position = gfx_conmentogfx(position); - gfx_drawchar(position, character, scale, rgb, alpha, flag); -}; - -void(vector position, string str, vector scale, vector rgb, float alpha, float flag) -menu_drawstring = -{ - position = gfx_conmentogfx(position); - gfx_drawstring(position, str, scale, rgb, alpha, flag); -} - -void(vector position, string pic_name, vector size, vector rgb, float alpha, float flag) -menu_drawpic = -{ - position = gfx_conmentogfx(position); - gfx_drawpic(position, pic_name, size, rgb, alpha, flag); -}; - -void(vector position, vector size, vector rgb, float alpha, float flag) -menu_fillarea = -{ - position = gfx_conmentogfx(position); - gfx_fillarea(position, size, rgb, alpha, flag); -}; - - -void(vector position, vector size) menu_setcliparea = -{ - position = gfx_conmentogfx(position); - gfx_setcliparea(position, size); -}; - - -void(void) menu_resetcliparea = -{ - gfx_resetcliparea(); -}; - -vector(string pic_name) gfx_getimagesize = -{ - return drawgetimagesize(pic_name); -} - -vector(vector vec) gfx_converttogfx = -{ - vector v; - v_x = vec_x * (GFX_WIDTH / vid_conwidth); - v_y = vec_y * (GFX_HEIGHT / vid_conheight); - return v; -}; - -vector(vector vec) gfx_converttocon = -{ - vector v; - v_x = vec_x * (vid_conwidth / GFX_WIDTH); - v_y = vec_y * (vid_conheight / GFX_HEIGHT); - return v; -}; - -vector(vector vec) gfx_conmentogfx = -{ - return (vec + menu_localorigin); -}; - -vector(vector vec) gfx_congfxtomen = -{ - return (vec - menu_localorigin); -}; - -void(vector position, vector size, float width, vector rgb, float alpha, float flag) -menu_drawoutline = -{ - local vector p, s; - - s_x = size_x; - s_y = width; - menu_fillarea( position, s, rgb, alpha, flag ); - - p_x = position_x; - p_y = position_y + size_y - width; - menu_fillarea( p, s, rgb, alpha, flag ); - - s_x = width; - s_y = size_y; - menu_fillarea( position, s, rgb, alpha, flag ); - - p_x = position_x + size_x - width; - p_y = position_y; - menu_fillarea( p, s, rgb, alpha, flag ); -}; diff --git a/menu/graphic.qh b/menu/graphic.qh deleted file mode 100644 index b6a971759..000000000 --- a/menu/graphic.qh +++ /dev/null @@ -1,72 +0,0 @@ -/////////////////////////////////////////////// -// Graphic Header File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all gfx prototypes, etc. -/////////////////////////////////////////////// - -const float GFX_WIDTH = 1024; -const float GFX_HEIGHT = 768; - -float vid_conwidth; -float vid_conheight; - -//////////////// -// prototypes -/// - -void(void) gfx_init; -void(void) gfx_frame; -void(void) gfx_toggle; -void(float keynr, float ascii) gfx_keydown;// perhaps we want to do some special fx for specail keys -void(void) gfx_draw; -void(void) gfx_shutdown; - -// convert from menu coords to gfx coords -vector(vector vec) gfx_conmentogfx; -// convert from gfx coords to console coords -vector(vector vec) gfx_converttocon; -// convert from console coords to gfx coords -vector(vector vec) gfx_converttogfx; -// convert to menu coords -vector(vector vec) gfx_congfxtomen; - -string(string pic_name, float complain) gfx_loadpic; -void(string pic_name) gfx_unloadpic; - -void(vector position, float character, vector scale, vector rgb, float alpha, float flag) -gfx_drawchar; - -void(vector position, string text, vector scale, vector rgb, float alpha, float flag) -gfx_drawstring; - -void(vector position, string pic_name, vector size, vector rgb, float alpha, float flag) -gfx_drawpic; - -void(vector position, vector size, vector rgb, float alpha, float flag) -gfx_fillarea; - -void(vector position, vector size) gfx_setcliparea; - -void(void) gfx_resetcliparea; - -void(vector position, float character, vector scale, vector rgb, float alpha, float flag) -menu_drawchar; - -void(vector position, string text, vector scale, vector rgb, float alpha, float flag) -menu_drawstring; - -void(vector position, string pic_name, vector size, vector rgb, float alpha, float flag) -menu_drawpic; - -void(vector position, vector size, vector rgb, float alpha, float flag) -menu_fillarea; - -void(vector position, vector size) menu_setcliparea; - -void(void) menu_resetcliparea; - -vector(string pic_name) gfx_getimagesize; - -void(vector position, vector size, float width, vector rgb, float alpha, float flag) -menu_drawoutline; diff --git a/menu/main.menu b/menu/main.menu deleted file mode 100644 index 1e5fc3b54..000000000 --- a/menu/main.menu +++ /dev/null @@ -1,163 +0,0 @@ -/* -Property of Alientrap - -Main frame -*/ -/* -template - -// nnn -{ - type ITEM_BUTTON - name mainframe_nnn - parent mainframe - pos "0 0" - size "185 58" - picture "gfx/m_top_nnn" - picture_selected "gfx/m_top_sel_nnn" - picture_pressed "gfx/m_top_sel_nnn" - drawflag_pressed 1 // DRAWFLAG_ADD -} -*/ -// singleplayer -{ - type ITEM_BUTTON - name mainmenu_singleplayer - parent mainmenu - //pos "201 17" - pos "0 0" - size "185 58" - picture "gfx/m_top_singleplayer" - picture_selected "gfx/m_top_sel_singleplayer" - picture_pressed "gfx/m_top_sel_singleplayer" - drawflag_pressed 0 - action nex_display_singleplayer -} -// multiplayer -{ - type ITEM_BUTTON - name mainmenu_multiplayer - parent mainmenu - pos "185 0" - size "170 58" - picture "gfx/m_top_multiplayer" - picture_selected "gfx/m_top_sel_multiplayer" - picture_pressed "gfx/m_top_sel_multiplayer" - drawflag_pressed 0 - action nex_display_multiplayer -} -// options -{ - type ITEM_BUTTON - name mainmenu_options - parent mainmenu - pos "355 0" - size "113 58" - picture "gfx/m_top_options" - picture_selected "gfx/m_top_sel_options" - picture_pressed "gfx/m_top_sel_options" - drawflag_pressed 0 - action nex_display_options -} -// video -{ - type ITEM_BUTTON - name mainmenu_video - parent mainmenu - pos "469 0" - size "84 58" - picture "gfx/m_top_video" - picture_selected "gfx/m_top_sel_video" - picture_pressed "gfx/m_top_sel_video" - drawflag_pressed 0 - action nex_display_video -} -// quit -{ - type ITEM_BUTTON - name mainmenu_quit - parent mainmenu - pos "553 0" - size "67 58" - picture "gfx/m_top_quit" - picture_selected "gfx/m_top_sel_quit" - picture_pressed "gfx/m_top_sel_quit" - drawflag_pressed 0 - action nex_quit -} -// quit window -{ - type ITEM_WINDOW - name quitbox -} -// nice hack so I dont have to change the menu manager -{ - type ITEM_REFERENCE - name quitbox_ref - parent quitbox - flag 1024 // FLAG_CHILDDRAWONLY -} -// quit stuff -{ - type ITEM_WINDOW - name quitbox_wnd - parent quitbox - origin "407 344" -} -// quit box -{ - type ITEM_RECTANGLE - name quitbox_wnd_bg - parent quitbox_wnd - color "0.0 0.0 0.1" - alpha 0.5 - drawflag 0 // DRAWFLAG_MODULATE - size "210 80" -}/* -{ - type ITEM_TEXT - name quitbox_wnd_text1 - parent quitbox_wnd - pos "10 10" -} -{ - type ITEM_TEXT - name quitbox_wnd_text2 - parent quitbox_wnd - pos "10 30" -}*/ -{ - type ITEM_TEXT - name quitbox_wnd_text - parent quitbox_wnd - text "Exit Game ?" - size "200 13" - font_size "13 13" - alignment 1 - pos "10 10" -} -// yes -{ - type ITEM_TEXTBUTTON - name quitbox_wnd_yes - parent quitbox_wnd - pos "10 50" - text "Yes" - action nex_quit_yes - key nex_quit_key - orderpos 101 -} -// no -{ - type ITEM_TEXTBUTTON - name quitbox_wnd_no - parent quitbox_wnd - pos "180 50" - text "No" - action nex_quit_no - key nex_quit_key - orderpos 100 -} - - - diff --git a/menu/mbuiltin.qc b/menu/mbuiltin.qc deleted file mode 100644 index 4d4a27e76..000000000 --- a/menu/mbuiltin.qc +++ /dev/null @@ -1,190 +0,0 @@ -////////////////////////////////////////////////// -// common cmd -////////////////////////////////////////////////// -// AK FIXME: Create perhaps a special builtin file for the common cmds - -void checkextension(string ext) = #1; - -// error cmds -void error(string err,...) = #2; -void objerror(string err,...) = #3; - -// print - -void print(string text,...) = #4; -void bprint(string text,...) = #5; -void sprint(float clientnum, string text,...) = #6; -void centerprint(string text,...) = #7; - -// vector stuff - -vector normalize(vector v) = #8; -float vlen(vector v) = #9; -float vectoyaw(vector v) = #10; -vector vectoangles(vector v) = #11; - -float random(void) = #12; - -void cmd(string command) = #13; - -// cvar cmds - -float cvar(string name) = #14; -const string str_cvar(string name) = #71; -void cvar_set(string name, string value) = #15; - -void dprint(string text,...) = #16; - -// conversion functions - -string ftos(float f) = #17; -float fabs(float f) = #18; -string vtos(vector v) = #19; -string etos(entity e) = #20; - -float stof(string val,...) = #21; - -entity spawn(void) = #22; -void remove(entity e) = #23; - -entity findstring(entity start, .string _field, string match) = #24; -entity findfloat(entity start, .float _field, float match) = #25; -entity findentity(entity start, .entity _field, entity match) = #25; - -entity findchainstring(.string _field, string match) = #26; -entity findchainfloat(.float _field, float match) = #27; -entity findchainentity(.entity _field, entity match) = #27; - -string precache_file(string file) = #28; -string precache_sound(string sample) = #29; - -void crash(void) = #72; -void coredump(void) = #30; -void stackdump(void) = #73; -void traceon(void) = #31; -void traceoff(void) = #32; - -void eprint(entity e) = #33; -float rint(float f) = #34; -float floor(float f) = #35; -float ceil(float f) = #36; -entity nextent(entity e) = #37; -float sin(float f) = #38; -float cos(float f) = #39; -float sqrt(float f) = #40; -vector randomvec(void) = #41; - -float registercvar(string name, string value, float flags) = #42; // returns 1 if success -float min(float f,...) = #43; -float max(float f,...) = #44; -float bound(float min,float value, float max) = #45; -float pow(float a, float b) = #46; -void copyentity(entity src, entity dst) = #47; - -float fopen(string filename, float mode) = #48; -void fclose(float fhandle) = #49; -string fgets(float fhandle) = #50; -void fputs(float fhandle, string s) = #51; - -float strlen(string s) = #52; -//string strcat(string s1,string s2,...) = #53; -string strcat(string s1, ...) = #53; -string substring(string s, float start, float length) = #54; - -vector stov(string s) = #55; - -string strzone(string s) = #56; -void strunzone(string s) = #57; - -float tokenize(string s) = #58 -string argv(float n) = #59; - -float isserver(void) = #60; -float clientcount(void) = #61; -float clientstate(void) = #62; -void clientcommand(float client, string s) = #63; -void changelevel(string map) = #64; -void localsound(string sample) = #65; -vector getmousepos(void) = #66; -float gettime(void) = #67; -void loadfromdata(string data) = #68; -void loadfromfile(string file) = #69; - -float mod(float val, float m) = #70; - -float search_begin(string pattern, float caseinsensitive, float quiet) = #74; -void search_end(float handle) = #75; -float search_getsize(float handle) = #76; -string search_getfilename(float handle, float num) = #77; - -string chr(float ascii) = #78; - -float etof(entity ent) = #79; -entity ftoe(float num) = #80; - -float validstring(string str) = #81; - -float altstr_count(string str) = #82; -string altstr_prepare(string str) = #83; -string altstr_get(string str, float num) = #84; - -///////////////////////////////////////////////// -// Write* Functions -///////////////////////////////////////////////// -void WriteByte(float data, float dest, float desto) = #401; -void WriteChar(float data, float dest, float desto) = #402; -void WriteShort(float data, float dest, float desto) = #403; -void WriteLong(float data, float dest, float desto) = #404; -void WriteAngle(float data, float dest, float desto) = #405; -void WriteCoord(float data, float dest, float desto) = #406; -void WriteString(string data, float dest, float desto)= #407; -void WriteEntity(entity data, float dest, float desto) = #408; - -////////////////////////////////////////////////// -// Draw funtions -////////////////////////////////////////////////// - -float iscachedpic(string name) = #451; -string precache_pic(string name) = #452; -void freepic(string name) = #453; - -float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454; - -float drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455; - -float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456; - -float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457; - -void drawsetcliparea(float x, float y, float width, float height) = #458; - -void drawresetcliparea(void) = #459; - -vector drawgetimagesize(string pic) = #460; - -float cin_open(string file, string name) = #461; -void cin_close(string name) = #462; -void cin_setstate(string name, float type) = #463; -float cin_getstate(string name) = #464; - -//////////////////////////////////////////////// -// Menu functions -//////////////////////////////////////////////// - -void setkeydest(float dest) = #601; -float getkeydest(void) = #602; - -void setmousetarget(float trg) = #603; -float getmousetarget(void) = #604; - -float isfunction(string function_name) = #607; -void callfunction(...) = #605; -void writetofile(float fhandle, entity ent) = #606; -vector getresolution(float number) = #608; -string keynumtostring(float keynum) = #609; -string findkeysforcommand(string command) = #610; - -float gethostcachevalue(float type) = #611; -string gethostcachestring(float type, float hostnr) = #612; - -void parseentitydata(entity ent, string data) = #613; diff --git a/menu/mcontrols.qc b/menu/mcontrols.qc deleted file mode 100644 index 373a68e86..000000000 --- a/menu/mcontrols.qc +++ /dev/null @@ -1,1155 +0,0 @@ -/////////////////////////////////////////////// -// Controls/Item Source File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all item specific stuff -//////////////////////////////////////////////// - -//////////////// -// ITEM_WINDOW -// - -void(void) ITEM_WINDOW = -{ - self.flag = self.flag | FLAG_NOSELECT | FLAG_DRAWONLY; - - item_init( - defct_reinit, - defct_destroy, - defct_key, - defct_draw, - defct_mouse_enter, - defct_mouse_leave, - defct_action, - defct_refresh); - - ctcall_init(); -}; - -////////////////// -// ITEM_REFERENCE -/// - -void(void) ITEM_REFERENCE = -{ - self.flag = self.flag | FLAG_NOSELECT | FLAG_DRAWONLY; - - // if there is no link, this is a dynamic reference - if(self.link != "") - { - self._child = menu_getitem(self.link); - if(self._child == null_entity) - { - print(self.name, " removed, cause link ", self.link, " not found\n"); - remove(self); // no need to call terminate - return; - } - } - - item_init( - defct_reinit, - defct_destroy, - defct_key, - defct_draw, - defct_mouse_enter, - defct_mouse_leave, - defct_action, - defct_refresh); - - ctcall_init(); -}; - -//////////////// -// ITEM_CUSTOM -//// - -void(void) ITEM_CUSTOM = -{ - item_init(defct_reinit, defct_destroy, defct_key, defct_draw, defct_mouse_enter, defct_mouse_leave, defct_action, defct_refresh); - ctcall_init(); -}; - -///////////////// -// ITEM_PICTURE -/// - -// ITEM_PICTURE has a special draw function -void(void) ITEM_PICTURE_DRAW = -{ - menu_drawpic(self.pos, self.picture, self.size, self.color, self.alpha, self.drawflag); - - ctcall_draw(); -}; - -void(void) ITEM_PICTURE_DESTROY = -{ - gfx_unloadpic(self.picture); - - ctcall_destroy(); -}; - -void(void) ITEM_PICTURE = -{ - if(self.picture == "") - // a picture has to have a picture - remove(self); // no need to call terminate - - // load the picture if it isnt loaded already - gfx_loadpic(self.picture, MENU_ENFORCELOADING); - - // if flag wasnt set yet, then set it to FLAG_DRAWONLY - if(self.flag == 0) - self.flag = FLAG_DRAWONLY; - - if(self.color == '0 0 0') - self.color = ITEM_PICTURE_NORMAL_COLOR; - if(self.alpha == 0) - self.alpha = ITEM_PICTURE_NORMAL_ALPHA; - - item_init( - defct_reinit, - ITEM_PICTURE_DESTROY, - defct_key, - ITEM_PICTURE_DRAW, - defct_mouse_enter, - defct_mouse_leave, - defct_action, - defct_refresh); - - ctcall_init(); -}; - -///////////// -// ITEM_TEXT -/// - -void(void) ITEM_TEXT_REFRESH = -{ - // first do own refresh, *then* call the default refresh ! - if(self.size == '0 0 0') - { - if(self.font_size == '0 0 0') - self.font_size = ITEM_TEXT_FONT_SIZE; - - self.size_x = self.font_size_x * strlen(self.text); - self.size_y = self.font_size_y; - } else if(self.font_size == '0 0 0') - { - self.font_size_x = self.size_x / strlen(self.text); - self.font_size_y = self.size_y; - } - - def_refresh(); - ctcall_refresh(); -}; - -void(void) ITEM_TEXT_DRAW = -{ - if(self.text != "") - { - // align to the rect pos - (pos + size) - vector alignpos; - // now check the alignement - if(self.alignment & TEXT_ALIGN_CENTER) - alignpos_x = self.pos_x + (self.size_x - strlen(self.text) * self.font_size_x) / 2; - else if(self.alignment & TEXT_ALIGN_RIGHT) - alignpos_x = self.pos_x + self.size_x - strlen(self.text) * self.font_size_x; - else - alignpos_x = self.pos_x; - alignpos_y = self.pos_y; - - menu_drawstring(alignpos, self.text, self.font_size, self.color, self.alpha, self.drawflag); - } - ctcall_draw(); -}; - -void(void) ITEM_TEXT = -{ - if(self.flag == 0) - self.flag = FLAG_DRAWONLY; - - if(self.color == '0 0 0') - self.color = ITEM_TEXT_NORMAL_COLOR; - if(self.alpha == 0) - self.alpha = ITEM_TEXT_NORMAL_ALPHA; - - ITEM_TEXT_REFRESH(); - if(self.alignment & TEXT_ALIGN_CENTERPOS) - { - self.pos_x = self.pos_x - self.size_x / 2; - } else if(self.alignment & TEXT_ALIGN_LEFTPOS) - { - self.pos_x = self.pos_x - self.size_x; - } - - item_init( - defct_reinit, - defct_destroy, - defct_key, - ITEM_TEXT_DRAW, - defct_mouse_enter, - defct_mouse_leave, - defct_action, - ITEM_TEXT_REFRESH); - - ctcall_init(); -}; - -///////////////// -// ITEM_RECTANLE -/// - -void(void) ITEM_RECTANGLE_DRAW = -{ - menu_fillarea(self.pos, self.size, self.color, self.alpha, self.drawflag); -}; - -void(void) ITEM_RECTANGLE = -{ - if(self.flag == 0) - self.flag = FLAG_DRAWONLY; - - item_init( - defct_reinit, - defct_destroy, - defct_key, - ITEM_RECTANGLE_DRAW, - defct_mouse_enter, - defct_mouse_leave, - defct_action, - defct_refresh); - - ctcall_init(); -}; - -//////////////// -// ITEM_BUTTON -/// - -void(void) ITEM_BUTTON_DRAW = -{ - if(self._button_state == BUTTON_NORMAL) - menu_drawpic(self.pos, self.picture, self.size, self.color, self.alpha, self.drawflag); - else if(self._button_state == BUTTON_SELECTED) - menu_drawpic(self.pos, self.picture_selected, self.size, self.color_selected, self.alpha_selected, self.drawflag_selected); - else - menu_drawpic(self.pos, self.picture_pressed, self.size, self.color_pressed, self.alpha_pressed, self.drawflag_pressed); - - ctcall_draw(); -}; - -void(void) ITEM_BUTTON_REFRESH = -{ - if( self.hold_pressed + self._press_time < time ) - { - if( menu_selected != self && self._button_state != BUTTON_NORMAL ) - self._button_state = BUTTON_NORMAL; - else if( menu_selected == self && self._button_state != BUTTON_SELECTED) - { - self._button_state = BUTTON_SELECTED; - if(self.sound_selected != "" && menu_automatedselection == false) - snd_play(self.sound_selected); - } - } - - def_refresh(); - ctcall_refresh(); -}; - -void(float keynr, float ascii) ITEM_BUTTON_KEY = -{ - if(ctcall_key(keynr, ascii)) - return; - - if(keynr == K_ENTER || keynr == K_MOUSE1) - { - self._action(); - } else - def_keyevent(keynr, ascii); -}; - -void(void) ITEM_BUTTON_ACTION = -{ - self._press_time = time; - self._button_state = BUTTON_PRESSED; - if(self.sound_pressed) - snd_play(self.sound_pressed); - - ctcall_action(); -}; -void(void) ITEM_BUTTON_REINIT = -{ - self._button_state = BUTTON_NORMAL; - - ctcall_reinit(); -}; - -void(void) ITEM_BUTTON_DESTROY = -{ - gfx_unloadpic(self.picture); - gfx_unloadpic(self.picture_selected); - gfx_unloadpic(self.picture_pressed); - - ctcall_destroy(); -}; - -void(void) ITEM_BUTTON = -{ - if(self.picture == "" || self.picture_selected == "" || self.picture_pressed == "") - // a picture has to have pictures - remove(self); // no need to call terminate - - // load the picture if it isnt loaded already - gfx_loadpic(self.picture, MENU_ENFORCELOADING); - gfx_loadpic(self.picture_selected, MENU_ENFORCELOADING); - gfx_loadpic(self.picture_pressed, MENU_ENFORCELOADING); - - if(self.sound_selected != "") - snd_loadsound(self.sound_selected, SOUND_ENFORCELOADING); - else - self.sound_selected = SOUND_SELECT; - - if(self.sound_pressed != "") - snd_loadsound(self.sound_pressed, SOUND_ENFORCELOADING); - else - self.sound_pressed = SOUND_ACTION; - - // if flag wasnt set yet, then set it to FLAG_DRAWONLY - if(self.flag == 0) - self.flag = FLAG_AUTOSETCLICK; - - if(self.color == '0 0 0') - self.color = ITEM_PICTURE_NORMAL_COLOR; - if(self.alpha == 0) - self.alpha = ITEM_PICTURE_NORMAL_ALPHA; - if(self.color_selected == '0 0 0') - self.color_selected = ITEM_PICTURE_SELECTED_COLOR; - if(self.alpha_selected == 0) - self.alpha_selected = ITEM_PICTURE_SELECTED_ALPHA; - if(self.color_pressed == '0 0 0') - self.color_pressed = ITEM_PICTURE_PRESSED_COLOR; - if(self.alpha_pressed == 0) - self.alpha_pressed = ITEM_PICTURE_PRESSED_ALPHA; - - if(self.hold_pressed == 0) - self.hold_pressed = ITEM_BUTTON_HOLD_PRESSED; - - item_init( - ITEM_BUTTON_REINIT, - ITEM_BUTTON_DESTROY, - ITEM_BUTTON_KEY, - ITEM_BUTTON_DRAW, - defct_mouse_enter, - defct_mouse_leave, - ITEM_BUTTON_ACTION, - ITEM_BUTTON_REFRESH); - - ctcall_init(); -}; - -//////////////////// -// ITEM_TEXTBUTTON -/// - -void(void) ITEM_TEXTBUTTON_REFRESH = -{ - // first do own refresh, *then* call the default refresh ! - if(self.size == '0 0 0') - { - if(self.font_size == '0 0 0') - self.font_size = ITEM_TEXT_FONT_SIZE; - - self.size_x = self.font_size_x * strlen(self.text); - self.size_y = self.font_size_y; - } else if(self.font_size == '0 0 0') - { - self.font_size_x = self.size_x / strlen(self.text); - self.font_size_y = self.size_y; - } - - /*if((self.hold_pressed + self._press_time < time && self._button_state == BUTTON_PRESSED) || (menu_selected != self && self._button_state == BUTTON_SELECTED)) - { - self._button_state = BUTTON_NORMAL; - } - if(menu_selected == self && self._button_state == BUTTON_NORMAL) - { - self._button_state = BUTTON_SELECTED; - if(self.sound_selected != "" && menu_automatedselection == false) - snd_play(self.sound_selected); - }*/ - /*if( self.hold_pressed + self._press_time < time ) - { - if( menu_selected != self && self._button_state != BUTTON_NORMAL ) - self._button_state = BUTTON_NORMAL; - else if( menu_selected == self && self._button_state != BUTTON_SELECTED) - { - self._button_state = BUTTON_SELECTED; - if(self.sound_selected != "" && menu_automatedselection == false) - snd_play(self.sound_selected); - } - }*/ - if( self._button_state == BUTTON_PRESSED ) { - if( self.hold_pressed + self._press_time < time ) - if( menu_selected == self ) - self._button_state = BUTTON_SELECTED; - else - self._button_state = BUTTON_NORMAL; - } else if( self._button_state == BUTTON_NORMAL && menu_selected == self ) { - self._button_state = BUTTON_SELECTED; - if( self.sound_selected != "" && menu_automatedselection == false ) - snd_play( self.sound_selected ); - } else if( menu_selected != self ) - self._button_state = BUTTON_NORMAL; - - def_refresh(); - ctcall_refresh(); -}; - -void(void) ITEM_TEXTBUTTON_DRAW = -{ - if(self.text == "") - return; - - // align to the rect pos - (pos + size) - vector alignpos; - // now check the alignement - if(self.alignment & TEXT_ALIGN_CENTER) - alignpos_x = self.pos_x + (self.size_x - strlen(self.text) * self.font_size_x) / 2; - else if(self.alignment & TEXT_ALIGN_RIGHT) - alignpos_x = self.pos_x + self.size_x - strlen(self.text) * self.font_size_x; - else - alignpos_x = self.pos_x; - alignpos_y = self.pos_y; - - if(self.style == TEXTBUTTON_STYLE_OUTLINE && self._button_state != BUTTON_NORMAL) - { - vector p,s; - // left - p_x = self.pos_x; - p_y = self.pos_y; - s_x = TEXTBUTTON_OUTLINE_WIDTH; - s_y = self.size_y; - if(self._button_state == BUTTON_PRESSED) - { - menu_fillarea(p, s, self.color_pressed, self.alpha_pressed, self.drawflag_pressed); - } - else if(self._button_state == BUTTON_SELECTED) - { - menu_fillarea(p, s, self.color_selected, self.alpha_selected, self.drawflag_selected); - } - // right - p_x = self.pos_x + self.size_x - TEXTBUTTON_OUTLINE_WIDTH; - p_y = self.pos_y; - s_x = TEXTBUTTON_OUTLINE_WIDTH; - s_y = self.size_y; - if(self._button_state == BUTTON_PRESSED) - { - menu_fillarea(p, s, self.color_pressed, self.alpha_pressed, self.drawflag_pressed); - } - else if(self._button_state == BUTTON_SELECTED) - { - menu_fillarea(p, s, self.color_selected, self.alpha_selected, self.drawflag_selected); - } - // top - p_x = self.pos_x; - p_y = self.pos_y; - s_y = TEXTBUTTON_OUTLINE_WIDTH; - s_x = self.size_x; - if(self._button_state == BUTTON_PRESSED) - { - menu_fillarea(p, s, self.color_pressed, self.alpha_pressed, self.drawflag_pressed); - } - else if(self._button_state == BUTTON_SELECTED) - { - menu_fillarea(p, s, self.color_selected, self.alpha_selected, self.drawflag_selected); - } - // bottom - p_x = self.pos_x; - p_y = self.pos_y + self.size_y - TEXTBUTTON_OUTLINE_WIDTH; - s_y = TEXTBUTTON_OUTLINE_WIDTH; - s_x = self.size_x; - if(self._button_state == BUTTON_PRESSED) - { - menu_fillarea(p, s, self.color_pressed, self.alpha_pressed, self.drawflag_pressed); - } - else if(self._button_state == BUTTON_SELECTED) - { - menu_fillarea(p, s, self.color_selected, self.alpha_selected, self.drawflag_selected); - } - } else if(self.style == TEXTBUTTON_STYLE_BOX) - { - if(self._button_state == BUTTON_PRESSED) - { - menu_fillarea(alignpos, self.size, self.color_pressed, self.alpha_pressed, self.drawflag_pressed); - } - else if(self._button_state == BUTTON_SELECTED) - { - menu_fillarea(alignpos, self.size, self.color_selected, self.alpha_selected, self.drawflag_selected); - } - } - - if(self._button_state == BUTTON_NORMAL || self.style == TEXTBUTTON_STYLE_BOX || self.style == TEXTBUTTON_STYLE_OUTLINE) - menu_drawstring(alignpos, self.text, self.font_size, self.color, self.alpha, self.drawflag); - - if(self.style == TEXTBUTTON_STYLE_TEXT) - { - if(self._button_state == BUTTON_PRESSED) - { - menu_drawstring(alignpos, self.text, self.font_size, self.color_pressed, self.alpha_pressed, self.drawflag_pressed); - } - else if(self._button_state == BUTTON_SELECTED) - { - menu_drawstring(alignpos, self.text, self.font_size, self.color_selected, self.alpha_selected, self.drawflag_selected); - } - } - - ctcall_draw(); -}; - -void(void) ITEM_TEXTBUTTON_ACTION = -{ - self._press_time = time; - self._button_state = BUTTON_PRESSED; - if(self.sound_pressed) - snd_play(self.sound_pressed); - - ctcall_action(); -}; - -void(float keynr, float ascii) ITEM_TEXTBUTTON_KEY = -{ - if(ctcall_key(keynr, ascii)) - return; - - if(keynr == K_ENTER || keynr == K_MOUSE1) - { - self._action(); - } else - def_keyevent(keynr, ascii); -}; - -void(void) ITEM_TEXTBUTTON_REINIT = -{ - self._button_state = BUTTON_NORMAL; - - ctcall_reinit(); -}; - -void(void) ITEM_TEXTBUTTON = -{ - if(self.flag == 0) - self.flag = FLAG_AUTOSETCLICK; - - if(self.color == '0 0 0') - self.color = ITEM_TEXT_NORMAL_COLOR; - if(self.alpha == 0) - self.alpha = ITEM_TEXT_NORMAL_ALPHA; - if(self.color_selected == '0 0 0') - self.color_selected = ITEM_TEXT_SELECTED_COLOR; - if(self.alpha_selected == 0) - self.alpha_selected = ITEM_TEXT_SELECTED_ALPHA; - if(self.color_pressed == '0 0 0') - self.color_pressed = ITEM_TEXT_PRESSED_COLOR; - if(self.alpha_pressed == 0) - self.alpha_pressed = ITEM_TEXT_PRESSED_ALPHA; - - if(self.hold_pressed == 0) - self.hold_pressed = ITEM_BUTTON_HOLD_PRESSED; - - if(self.sound_selected != "") - snd_loadsound(self.sound_selected, SOUND_ENFORCELOADING); - else - self.sound_selected = SOUND_SELECT; - - if(self.sound_pressed != "") - snd_loadsound(self.sound_pressed, SOUND_ENFORCELOADING); - else - self.sound_pressed = SOUND_ACTION; - - ITEM_TEXTBUTTON_REFRESH(); - if(self.alignment & TEXT_ALIGN_CENTERPOS) - { - self.pos_x = self.pos_x - self.size_x / 2; - } else if(self.alignment & TEXT_ALIGN_LEFTPOS) - { - self.pos_x = self.pos_x - self.size_x; - } - - item_init( - ITEM_TEXTBUTTON_REINIT, - defct_destroy, - ITEM_TEXTBUTTON_KEY, - ITEM_TEXTBUTTON_DRAW, - defct_mouse_enter, - defct_mouse_leave, - ITEM_TEXTBUTTON_ACTION, - ITEM_TEXTBUTTON_REFRESH); - - ctcall_init(); -}; - -// ITEM_SLIDER - -void(void) ITEM_SLIDER_DRAW = -{ - vector slider_pos; - - // draw the bar - if(self.picture_bar != "") - { - menu_drawpic(self.pos, self.picture_bar, self.size, self.color, self.alpha, self.drawflag); - } - else - { - menu_fillarea(self.pos, self.size, self.color, self.alpha, self.drawflag); - } - - // draw the slider - slider_pos = self.pos; - slider_pos_x = slider_pos_x + self.left_margin + ((self.size_x - self.slider_size_x - self.left_margin - self.right_margin) / (self.max_value - self.min_value)) * (self.value - self.min_value); - if(self.picture != "") - { - menu_drawpic(slider_pos, self.picture, self.slider_size, self.color, self.alpha, self.drawflag); - } - else - { - menu_fillarea(slider_pos, self.slider_size, self.color + ITEM_SLIDER_BAR_COLOR_DELTA, self.alpha, self.drawflag); - } -}; - -void(void) ITEM_SLIDER_UPDATESLIDER = -{ - self.value = bound(self.min_value, self.value, self.max_value); - if(self.slidermove) - self.slidermove(); -}; - -void(float keynr, float ascii) ITEM_SLIDER_KEY = -{ - float old; - old = self.value; - - if(ctcall_key(keynr, ascii)) - return; - - if(keynr == K_LEFTARROW) - { - self.value = (rint(self.value / self.step) - 1) * self.step; - } - else if(keynr == K_RIGHTARROW) - { - self.value = (rint(self.value / self.step) + 1)* self.step; - } - else if(keynr == K_MOUSE1) - { - if(inrect(menu_cursor, self.pos, self.size)) - { - if(menu_cursor_x - self.pos_x <= self.left_margin) - { - self.value = (rint(self.value / self.step) - 1)* self.step; - } - else if(menu_cursor_x - self.pos_x >= self.size_x - self.right_margin) - { - self.value = (rint(self.value / self.step) + 1)* self.step; - } - else - { - self.value = self.min_value + ((menu_cursor_x - self.slider_size_x / 2) - self.pos_x - self.left_margin) * ((self.max_value - self.min_value) / (self.size_x - self.slider_size_x - self.left_margin - self.right_margin)); - } - } - } - else - { - def_keyevent(keynr, ascii); - return; - } - // play sound - if(old < self.value) - { - snd_play(self.sound_increase); - } - else if(self.value < old) - { - snd_play(self.sound_decrease); - } - - ITEM_SLIDER_UPDATESLIDER(); - ctcall_action(); -}; - -void(void) ITEM_SLIDER_DESTROY = -{ - if(self.picture != "" && self.picture != ITEM_SLIDER_DEFAULT_SLIDER) - gfx_unloadpic(self.picture); - if(self.picture_bar != "" && self.picture_bar != ITEM_SLIDER_DEFAULT_BAR) - gfx_unloadpic(self.picture); - if(self.sound_increase != SOUND_INCREASE) - snd_unloadsound(self.sound_decrease); - if(self.sound_increase != SOUND_INCREASE) - snd_unloadsound(self.sound_increase); - - ctcall_destroy(); -}; - -void(void) ITEM_SLIDER = -{ - if(self.picture != "") - self.picture = gfx_loadpic(self.picture, MENU_ENFORCELOADING); - if(self.picture == "") - self.picture = gfx_loadpic(ITEM_SLIDER_DEFAULT_SLIDER, MENU_ENFORCELOADING); - if(self.picture_bar != "") - self.picture_bar = gfx_loadpic(self.picture_bar, MENU_ENFORCELOADING); - if(self.picture_bar == "") - self.picture_bar = gfx_loadpic(ITEM_SLIDER_DEFAULT_BAR, MENU_ENFORCELOADING); - if(self.sound_decrease == "") - self.sound_decrease = SOUND_DECREASE; - else - snd_loadsound(self.sound_decrease, MENU_ENFORCELOADING); - if(self.sound_increase == "") - self.sound_increase = SOUND_INCREASE; - else - snd_loadsound(self.sound_increase, MENU_ENFORCELOADING); - - if(self.color == '0 0 0') - self.color = ITEM_SLIDER_COLOR; - if(self.alpha == 0) - self.alpha = ITEM_SLIDER_ALPHA; - if(self.step == 0) - self.step = ITEM_SLIDER_STEP; - if(self.slider_size == '0 0 0') - { - /*if(self.picture != "") - self.slider_size = gfx_getimagesize(self.picture); - else*/ - self.slider_size = ITEM_SLIDER_SIZE; - } - if(self.left_margin == 0) - self.left_margin = ITEM_SLIDER_LEFT_MARGIN; - if(self.right_margin == 0) - self.right_margin = ITEM_SLIDER_RIGHT_MARGIN; - - item_init( - defct_reinit, - defct_destroy, - ITEM_SLIDER_KEY, - ITEM_SLIDER_DRAW, - defct_mouse_enter, - defct_mouse_leave, - defct_action, - defct_refresh); - - ctcall_init(); -}; - -// ITEM_TEXTSWITCH - -void(void) ITEM_TEXTSWITCH_DRAW = -{ - string temp; - - // get the current text - temp = self.text; - self.text = getaltstring(self.value, self.text); - // call ITEM_TEXT - ITEM_TEXT_DRAW(); - self.text = temp; -}; - -void(void) ITEM_TEXTSWITCH_REFRESH = -{ - string temp; - - temp = self.text; - self.text = getaltstring(self.value, self.text); - - ITEM_TEXT_REFRESH(); - - self.text = temp; -}; - -void(float keynr, float ascii) ITEM_TEXTSWITCH_KEY = -{ - float dir; - if(ctcall_key(keynr, ascii)) - return; - - if(keynr == K_LEFTARROW || keynr == K_MOUSE2) - { - dir = 1; - self.value = self.value - 1; - if(self.value < 0) - self.value = getaltstringcount(self.text) - 1; - } - else if(keynr == K_RIGHTARROW || keynr == K_MOUSE1 || keynr == K_ENTER) - { - dir = -1; - self.value = self.value + 1; - if(self.value > getaltstringcount(self.text) - 1) - self.value = 0; - } else - { - def_keyevent(keynr, ascii); - return; - } - // play sound - if( dir == -1 ) - snd_play(self.sound_increase); - else if( dir == 1 ) - snd_play(self.sound_decrease); - - if(self.switchchange) - self.switchchange(); -}; - -void(void) ITEM_TEXTSWITCH_DESTROY = -{ - if(self.sound_increase != SOUND_INCREASE) - snd_unloadsound(self.sound_decrease); - if(self.sound_increase != SOUND_INCREASE) - snd_unloadsound(self.sound_increase); -} - -void(void) ITEM_TEXTSWITCH = -{ - string temp; - - if(self.sound_decrease == "") - self.sound_decrease = SOUND_DECREASE; - else - snd_loadsound(self.sound_decrease, MENU_ENFORCELOADING); - if(self.sound_increase == "") - self.sound_increase = SOUND_INCREASE; - else - snd_loadsound(self.sound_increase, MENU_ENFORCELOADING); - - temp = self.text; - self.text = getaltstring(self.value, self.text); - ITEM_TEXT(); - self.text = temp; - - item_init( - defct_reinit, - ITEM_TEXTSWITCH_DESTROY, - ITEM_TEXTSWITCH_KEY, - ITEM_TEXTSWITCH_DRAW, - defct_mouse_enter, - defct_mouse_leave, - defct_action, - ITEM_TEXTSWITCH_REFRESH); - - ctcall_init(); -}; - -// ITEM_EDITBOX - -void(void) ITEM_EDITBOX_REINIT = -{ - self._cursorpos = 0; - self._button_state = BUTTON_NORMAL; -}; - -void(void) ITEM_EDITBOX_DRAW = -{ - vector csize, cpos; - - if(self.text != "") - ITEM_TEXT_DRAW(); - - if(self._button_state == BUTTON_NORMAL || mod(time * 1000, 1000 / EDITBOX_CURSOR_FREQ) > 500 / EDITBOX_CURSOR_FREQ) - return; - - csize_x = 1.5; - csize_y = self.font_size_y; - csize_z = 0; - cpos = self.pos; - cpos_x = cpos_x + self._cursorpos * self.font_size_x; - - menu_fillarea(cpos, csize, self.color_selected, self.alpha_selected, self.drawflag_selected); -}; - -void(float ascii) ITEM_EDITBOX_INSERT = -{ - string firsthalf, secondhalf; - float len; - - if(self._cursorpos > strlen(self.text)) - return; - - if(self.format == "") - { - // no format stuff, so lets have fun - firsthalf = substring(self.text, 0, self._cursorpos); - secondhalf = substring(self.text, self._cursorpos, strlen(self.text) - self._cursorpos); - strunzone(self.text); - self.text = strcat(firsthalf, chr(ascii)); - self.text = strcat(self.text, secondhalf); - if(self.maxlen >= 0 && strlen(self.text) > self.maxlen) - { - // remove the last char(s) - self.text = substring(self.text, 0, self.maxlen); - } - // move the cursor forward - if(strlen(self.text) >= self._cursorpos) - self._cursorpos = self._cursorpos + 1; - - self.text = strzone(self.text); - } - else // here begins the funny part - { - // TODO: add wildcard support :-/ - // move the cursor to the next space - len = strlen(self.format); - while(substring(self.format, self._cursorpos, 1) != " " && len > self._cursorpos) - { - self._cursorpos = self._cursorpos + 1; - } - if(self._cursorpos >= len) - return; - - firsthalf = substring(self.text, 0, self._cursorpos); - secondhalf = substring(self.text, self._cursorpos + 1 , strlen(self.text) - self._cursorpos - 1); - strunzone(self.text); - self.text = strcat(firsthalf, chr(ascii), secondhalf); - self.text = strzone(self.text); - } -}; - -void(void) ITEM_EDITBOX_LEFT = -{ - if(self._cursorpos > 0) - self._cursorpos = self._cursorpos - 1; -}; - -void(void) ITEM_EDITBOX_RIGHT = -{ - if(self._cursorpos < strlen(self.text)) - self._cursorpos = self._cursorpos + 1; -}; - -void(float keynr, float ascii) ITEM_EDITBOX_KEY = -{ - if(ctcall_key(keynr, ascii)) - return; - - if(ascii >= 30 && ascii <= 126) - { - ITEM_EDITBOX_INSERT(ascii); - } else if(keynr == K_BACKSPACE) - { - if(self.format == "") - { - string firsthalf, secondhalf; - - firsthalf = substring(self.text,0, self._cursorpos - 1); - secondhalf = substring(self.text,self._cursorpos, strlen(self.text) - self._cursorpos); - strunzone(self.text); - self.text = strcat(firsthalf, secondhalf); - self.text = strzone(self.text); - - ITEM_EDITBOX_LEFT(); - } - } else if(keynr == K_ENTER) - { - self._action(); - //snd_play(self.sound_action); - } else if(keynr == K_LEFTARROW) - { - ITEM_EDITBOX_LEFT(); - } - else if(keynr == K_RIGHTARROW) - { - ITEM_EDITBOX_RIGHT(); - } - else - def_keyevent(keynr, ascii); - - snd_play(self.sound_pressed); -}; - -void(void) ITEM_EDITBOX_REFRESH = -{ - if(menu_selected != self && menu_selected != self._parent) - self._button_state = BUTTON_NORMAL; - else if(self._button_state == BUTTON_NORMAL) - { - self._button_state = BUTTON_SELECTED; - - if(self.sound_selected != "" && menu_automatedselection == false) - snd_play(self.sound_selected); - } - - if(self._cursorpos > strlen(self.text)) - self._cursorpos = strlen(self.text); - - // hack: we want the text to scroll if possible - // self.clip_pos holds the normal value - if( self._cursorpos >= self.size_x / self.font_size_x - 1.5 && self.maxlen > self.size_x / self.font_size_x ) - self.pos_x = self.clip_pos_x -(self._cursorpos - floor( self.size_x / self.font_size_x - 1.5)) * self.font_size_x; - else - self.pos_x = self.clip_pos_x; - - ITEM_TEXT_REFRESH(); -}; - -void(void) ITEM_EDITBOX = -{ - if(self.sound_selected != "") - snd_loadsound(self.sound_selected, SOUND_ENFORCELOADING); - else - self.sound_selected = SOUND_SELECT; - - if(self.sound_pressed != "") - snd_loadsound(self.sound_pressed, SOUND_ENFORCELOADING); - else - self.sound_pressed = SOUND_ACTION; - - // if flag wasnt set yet, then set it to FLAG_DRAWONLY - if(self.flag == 0) - self.flag = FLAG_AUTOSETCLICK; - - //init clip_pos - self.clip_pos = self.pos; - - if(self.color == '0 0 0') - self.color = ITEM_PICTURE_NORMAL_COLOR; - if(self.alpha == 0) - self.alpha = ITEM_PICTURE_NORMAL_ALPHA; - if(self.color_selected == '0 0 0') - self.color_selected = ITEM_PICTURE_SELECTED_COLOR; - if(self.alpha_selected == 0) - self.alpha_selected = ITEM_PICTURE_SELECTED_ALPHA; - - self.text = strzone(self.text); - - ITEM_TEXT_REFRESH(); - if(self.alignment & TEXT_ALIGN_CENTERPOS) - { - self.pos_x = self.pos_x - self.size_x / 2; - } else if(self.alignment & TEXT_ALIGN_LEFTPOS) - { - self.pos_x = self.pos_x - self.size_x; - } - - item_init( - defct_reinit, - defct_destroy, - ITEM_EDITBOX_KEY, - ITEM_EDITBOX_DRAW, - defct_mouse_enter, - defct_mouse_leave, - defct_action, - ITEM_EDITBOX_REFRESH); - - ctcall_init(); -}; - -/* -///////////////////////////////////////////////////////////////////////// -// The "actual" funtions - -void(void) ctinit_picture = -{ - -}; - -// draws a text (uses the std. way) -void(string text, vector pos, vector size, float alignment, float style, float state) ctdrawtext = -{ - vector alignpos; - - if(text == "") - return; - - // align to the rect pos - (pos + size) - - // now check the alignement - if(alignment & TEXT_ALIGN_CENTER) - alignpos_x = pos_x + (size_x - strlen(text) * self.font_size_x) / 2; - else if(alignment & TEXT_ALIGN_RIGHT) - alignpos_x = pos_x + size_x - strlen(text) * self.font_size_x; - else - alignpos_x = pos_x; - alignpos_y = pos_y; - - if(style == TEXTBUTTON_STYLE_OUTLINE && state != BUTTON_NORMAL) - { - vector p,s; - // left - p_x = pos_x; - p_y = pos_y; - s_x = TEXTBUTTON_OUTLINE_WIDTH; - s_y = size_y; - if(state == BUTTON_PRESSED) - { - menu_fillarea(p, s, self.color_pressed, self.alpha_pressed, self.drawflag_pressed); - } - else if(state == BUTTON_SELECTED) - { - menu_fillarea(p, s, self.color_selected, self.alpha_selected, self.drawflag_selected); - } - // right - p_x = pos_x + size_x - TEXTBUTTON_OUTLINE_WIDTH; - p_y = pos_y; - s_x = TEXTBUTTON_OUTLINE_WIDTH; - s_y = size_y; - if(state == BUTTON_PRESSED) - { - menu_fillarea(p, s, self.color_pressed, self.alpha_pressed, self.drawflag_pressed); - } - else if(state == BUTTON_SELECTED) - { - menu_fillarea(p, s, self.color_selected, self.alpha_selected, self.drawflag_selected); - } - // top - p_x = pos_x; - p_y = pos_y; - s_y = TEXTBUTTON_OUTLINE_WIDTH; - s_x = size_x; - if(state == BUTTON_PRESSED) - { - menu_fillarea(p, s, self.color_pressed, self.alpha_pressed, self.drawflag_pressed); - } - else if(self._button_state == BUTTON_SELECTED) - { - menu_fillarea(p, s, self.color_selected, self.alpha_selected, self.drawflag_selected); - } - // bottom - p_x = pos_x; - p_y = pos_y + size_y - TEXTBUTTON_OUTLINE_WIDTH; - s_y = TEXTBUTTON_OUTLINE_WIDTH; - s_x = size_x; - if(state == BUTTON_PRESSED) - { - menu_fillarea(p, s, self.color_pressed, self.alpha_pressed, self.drawflag_pressed); - } - else if(state == BUTTON_SELECTED) - { - menu_fillarea(p, s, self.color_selected, self.alpha_selected, self.drawflag_selected); - } - } else if(style == TEXTBUTTON_STYLE_BOX) - { - if(state == BUTTON_PRESSED) - { - menu_fillarea(alignpos, size, self.color_pressed, self.alpha_pressed, self.drawflag_pressed); - } - else if(self._button_state == BUTTON_SELECTED) - { - menu_fillarea(alignpos, size, self.color_selected, self.alpha_selected, self.drawflag_selected); - } - } - - if(state == BUTTON_NORMAL || style == TEXTBUTTON_STYLE_BOX || style == TEXTBUTTON_STYLE_OUTLINE) - menu_drawstring(alignpos, text, self.font_size, self.color, self.alpha, self.drawflag); - - if(style == TEXTBUTTON_STYLE_TEXT) - { - if(state == BUTTON_PRESSED) - { - menu_drawstring(alignpos, text, self.font_size, self.color_pressed, self.alpha_pressed, self.drawflag_pressed); - } - else if(state == BUTTON_SELECTED) - { - menu_drawstring(alignpos, text, self.font_size, self.color_selected, self.alpha_selected, self.drawflag_selected); - } - } -};*/ diff --git a/menu/mcontrols.qh b/menu/mcontrols.qh deleted file mode 100644 index 6389043ea..000000000 --- a/menu/mcontrols.qh +++ /dev/null @@ -1,193 +0,0 @@ -/////////////////////////////////////////////// -// Controls/Item Header File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all item specific stuff -//////////////////////////////////////////////// -// constants -/* -Items/Controls: - -This control is supported/required by the menu manager : -ITEM_WINDOW -(ITEM_REFERENCE) - -The rest is not required: -ITEM_CUSTIOM - -ITEM_PICTURE - -ITEM_TEXT - -ITEM_BUTTON -ITEM_TEXTBUTTON - -ITEM_RECTANGLE - -ITEM_SLIDER - -ITEM_TEXTSWITCH -*/ - -// item constants - -// colors - -// text colors -const vector ITEM_TEXT_NORMAL_COLOR = '1 1 1'; -const float ITEM_TEXT_NORMAL_ALPHA = 1; - -const vector ITEM_TEXT_SELECTED_COLOR = '0 0 1'; -const float ITEM_TEXT_SELECTED_ALPHA = 1; - -const vector ITEM_TEXT_PRESSED_COLOR = '1 0 0'; -const float ITEM_TEXT_PRESSED_ALPHA = 1; - - -// pitures -const vector ITEM_PICTURE_NORMAL_COLOR = '1 1 1'; -const float ITEM_PICTURE_NORMAL_ALPHA = 1; - -const vector ITEM_PICTURE_SELECTED_COLOR = '1 1 1'; -const float ITEM_PICTURE_SELECTED_ALPHA = 1; - -const vector ITEM_PICTURE_PRESSED_COLOR = '1 1 1'; -const float ITEM_PICTURE_PRESSED_ALPHA = 1; - -// slider color -const vector ITEM_SLIDER_COLOR = '1 1 1'; -const float ITEM_SLIDER_ALPHA = 1; - -// ITEM_SLIDER -const float ITEM_SLIDER_STEP = 1; -const float ITEM_SLIDER_LEFT_MARGIN = 7; -const float ITEM_SLIDER_RIGHT_MARGIN = 7; - -const string ITEM_SLIDER_DEFAULT_BAR = "gfx/m_sliderbar"; -const string ITEM_SLIDER_DEFAULT_SLIDER = "gfx/m_slider"; - -// used only in non-picture mode -const vector ITEM_SLIDER_BAR_COLOR_DELTA = '-0.8 -0.8 0'; - -const vector ITEM_SLIDER_SIZE = '10 10 0'; - -// ITEM_BUTTON/ITEM_TEXTBUTTON - -const float ITEM_BUTTON_HOLD_PRESSED = 0.2; - -const float TEXTBUTTON_STYLE_BOX = 2; -const float TEXTBUTTON_STYLE_OUTLINE = 1; -const float TEXTBUTTON_STYLE_TEXT = 0; - -const float TEXTBUTTON_OUTLINE_WIDTH = 1.0; - -//ITEM_TEXT -const vector ITEM_TEXT_FONT_SIZE = '11 11 0'; - -const float TEXT_ALIGN_LEFT = 0; -const float TEXT_ALIGN_CENTER = 1; -const float TEXT_ALIGN_RIGHT = 2; -const float TEXT_ALIGN_RIGHTPOS = 4; // |text - actually this isnt necessary -const float TEXT_ALIGN_CENTERPOS = 8; // te|xt -const float TEXT_ALIGN_LEFTPOS = 16; // text| - -// ITEM_BUTTON/ITEM_TEXTBUTTON states -const float BUTTON_NORMAL = 0; -const float BUTTON_SELECTED = 1; -const float BUTTON_PRESSED = 2; - -// ITEM_EDITBOX constantes -const float EDITBOX_CURSOR_FREQ = 1; - -// flags constant - -const float FLAG_STANDARD = 1; // use this flag if you want the standard behavior and not what the control recommends -const float FLAG_HIDDEN = 2; // events wont be called and it wont be drawn, etc. -const float FLAG_NOSELECT = 4; // cant be selected (but events will be called) -const float FLAG_CONNECTEDONLY = 8; // only if connected (i.e. playing) -const float FLAG_SERVERONLY = 16; // only displayed if server -const float FLAG_DEVELOPERONLY = 32; // only displayed if developer -const float _FLAG_MOUSEINAREA = 64; // used to determine wheter to call mouse_enter/_leave -const float FLAG_DRAWONLY = 128; // only the draw event will be called -const float FLAG_AUTOSETCLICK = 256; // used to make click_pos and click_size always the same as pos and size -const float FLAG_AUTOSETCLIP = 512; // used to make clip_pos/_size always the same like pos and size -const float FLAG_CHILDDRAWONLY = 1024; // used to make the children only drawable -const float FLAG_DRAWREFRESHONLY= 2048; // only the draw and refresh event get called -const float FLAG_CHILDDRAWREFRESHONLY = 4096; - -// control fields -// fields used by multiple items -.vector color; -.float alpha; -.float drawflag; - -// ITEM_REFERENCE -.string link; // window link - -// ITEM_PICTURE -.string picture; -.vector pos; -.vector size; - -// ITEM_TEXT -.string text; -.vector font_size; -.float alignment; - -// ITEM_BUTTON -.string picture_selected; -.string picture_pressed; -.string sound_selected; -.string sound_pressed; - -.vector color_selected; -.vector color_pressed; -.float alpha_selected; -.float alpha_pressed; -.float drawflag_selected; -.float drawflag_pressed; - -.float _press_time; -.float hold_pressed; - -.float _button_state; - -// ITEM_TEXTBUTTON -//.string text; -//.vector font_size; -//.float alignment; -.float style; - -// ITEM_SLIDER -//.string picture_slider; = picture -.string picture_bar; -.string sound_increase; -.string sound_decrease; - -.float min_value; -.float max_value; -.float value; - -.float step; - -.vector slider_size; -.float left_margin; -.float right_margin; - -.void(void) slidermove; - -// ITEM_TEXTSWITCH (derived from ITEM_TEXT mostly) -//.string text; // like above -//.float value; // the current displayed/selected text - -.void(void) switchchange; - -// ITEM_EDITBOX (derived from ITEM_TEXT mostly) -.string format; // //wildcards are * for each letter except the next after it - \* for * and */ space ' ' for one letter e.g. " . . . " for an ip field -.float maxlen; // -1 for infinite -.float _cursorpos; -// functions - -/*void(void) ctinit_picture; -void(void) ctinit_button; -void(void) ctinit_textbutton;*/ diff --git a/menu/mcustom.qc b/menu/mcustom.qc deleted file mode 100644 index f9651c40f..000000000 --- a/menu/mcustom.qc +++ /dev/null @@ -1,1475 +0,0 @@ -/////////////////////////////////////////////// -// Custom Menu Source File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains menu specific stuff that is made especially for dpmod -// AK this file is used e.g. for defining some special event functions -//////////////////////////////////////////////// - -//////////////// -// global stuff -/// - -void() nex_setposition = -{ - self.pos_x = 0; - self.pos_y = (self.font_size_y + 5) * self.orderpos; - self.pos_z = 0; - - self.origin = self.pos; -}; - -void(entity item) nex_makeonlyvisible = -{ - local entity node; - - if( item.flag & FLAG_HIDDEN ) - item.flag = item.flag - FLAG_HIDDEN; - for( node = item._next ; node ; node = node._next ) - node.flag = item.flag | FLAG_HIDDEN; - for( node = item._prev ; node ; node = node._prev ) - node.flag = item.flag | FLAG_HIDDEN; -}; - -void(void) nex_linkrelhack = -{ - self._child._parent = self; -}; - -void(void) nex_maketextzone = -{ - self.text = strzone(self.text); -}; - -void(void) nex_slidertext = -{ - entity ent; - if(self.link == "") - { - print("No link specified\n"); - eprint(self); - self.init = null_function; - return; - } - - ent = menu_getitem(self.link); - if(ent == null_entity) - { - objerror("No link found for ", self.link,"\n"); - } - - self._link = ent; - - self.flag = self.flag | FLAG_DRAWREFRESHONLY; - - self.refresh = _nex_slidertext_refresh; -}; - -void(void) _nex_slidertext_refresh = -{ - self.text = ftos(self._link.value); - if(self.maxlen > 0) - self.text = substring(self.text,0, self.maxlen); - // reset the size, so its set - self.size = '0 0 0'; -}; - -float(float keynr, float ascii) nex_redirect_key = -{ - if((ascii>=20 && ascii <= 126) || keynr == K_BACKSPACE || keynr == K_ENTER || keynr == K_LEFTARROW || keynr == K_RIGHTARROW || (keynr >= K_MOUSE1 && keynr <= K_MOUSE10)) - { - raise_key(self._child, keynr, ascii); - return true; - } - return false; -}; - -void(void) nex_cvar_slider = -{ - self.value = cvar(self.cvarname); - self.slidermove = self.switchchange = _nex_cvar_slider; - self.refresh = _nex_cvar_slider_refresh; -}; - -void(void) _nex_cvar_slider_refresh = -{ - if(self.cvartype == CVAR_INT || self.cvartype == CVAR_FLOAT || self.cvartype == CVAR_STEP) - self.value = cvar(self.cvarname); -}; - -void(void) _nex_cvar_slider = -{ - if(self.cvarname == "") - return; - if(self.cvartype == CVAR_INT) // || self.cvartype == CVAR_STRING) - self.value = rint(self.value); - if(self.cvartype == CVAR_STEP) - self.value = rint(self.value / self.step) * self.step; - if(self.cvartype == CVAR_INT || self.cvartype == CVAR_FLOAT || self.cvartype == CVAR_STEP) - cvar_set(self.cvarname, ftos(self.value)); - /*if(cvartype == CVAR_STRING) - { - string s; - s = getaltstring(self.value, self.cvarvalues); - cvar_set(self.cvarname, s); - } - */ -}; - -////////////// -// main.menu -/// - -void(void) nex_makeselfonlyvisible = -{ - nex_makeonlyvisible( self ); -}; - -// quit menu - -void(void) nex_quit_choose = -{ - entity e; - // because of the missing support for real array, we have to do it the stupid way - // (we also have to use strzone for the text, cause it the temporary strings wont work - // for it) - if(nex_quitrequest == 0) - { - e = menu_getitem("quit_msg_0"); - e.text = getaltstring(0,nex_quitmsg_0); - } - if(nex_quitrequest == 1) - { - e = menu_getitem("quit_msg_0"); - e.text = getaltstring(0,nex_quitmsg_1); - } - if(nex_quitrequest == 2) - { - e = menu_getitem("quit_msg_0"); - e.text = getaltstring(0,nex_quitmsg_2); - } - if(nex_quitrequest == 3) - { - e = menu_getitem("quit_msg_0"); - e.text = getaltstring(0,nex_quitmsg_3); - } - e.text = strzone(e.text); - - if(nex_quitrequest == 0) - { - e = menu_getitem("quit_msg_1"); - e.text = getaltstring(1,nex_quitmsg_0); - } - if(nex_quitrequest == 1) - { - e = menu_getitem("quit_msg_1"); - e.text = getaltstring(1,nex_quitmsg_1); - } - if(nex_quitrequest == 2) - { - e = menu_getitem("quit_msg_1"); - e.text = getaltstring(1,nex_quitmsg_2); - } - if(nex_quitrequest == 3) - { - e = menu_getitem("quit_msg_1"); - e.text = getaltstring(1,nex_quitmsg_3); - } - e.text = strzone(e.text); - - nex_quitrequest = nex_quitrequest + 1; - if(nex_quitrequest == DPMOD_QUIT_MSG_COUNT) - nex_quitrequest = 0; -}; - -void(void) nex_quit = -{ -/* entity ent; - // choose a quit message - nex_quit_choose(); - - // change the flags - ent = menu_getitem("main"); - ent.flag = ent.flag | FLAG_CHILDDRAWONLY; - ent = menu_getitem("quit"); - ent.flag = FLAG_NOSELECT; - menu_jumptowindow(ent, false);*/ - entity ent; - - // change the flags - ent = menu_getitem("quitbox_ref"); - ent._child = menu_activewindow; - ent = menu_getitem("quitbox"); - menu_jumptowindow(ent, true); -}; - -void(void) nex_quit_yes = -{ - cmd("quit\n"); -}; - -void(void) nex_quit_no = -{ -/* entity ent; - - ent = menu_getitem("quit_msg_0"); - strunzone(ent.text); - - ent = menu_getitem("quit_msg_1"); - strunzone(ent.text); - - ent = menu_getitem("quit"); - ent.flag = FLAG_HIDDEN; - ent = menu_getitem("main"); - ent.flag = ent.flag - FLAG_CHILDDRAWONLY; - menu_selectup();*/ - menu_selectup(); -}; - -float(float keynr, float ascii) nex_quit_key = -{ - if(keynr == K_LEFTARROW) - return false; - if(keynr == K_RIGHTARROW) - return false; - if(keynr == K_ENTER) - return false; - if(keynr == K_MOUSE1) - return false; - if(ascii == 'Y' || ascii == 'y') - nex_quit_yes(); - if(ascii == 'N' || ascii == 'n' || keynr == K_ESCAPE) - nex_quit_no(); - return true; -}; - -// options menu - -void(void) nex_display_options = -{ - entity ent; - - ent = menu_getitem( "options" ); - - nex_makeonlyvisible( ent ); - menu_jumptowindow( ent, false ); -}; - -///////////////// -// video.menu - -void(void) nex_display_video = -{ - nex_makeonlyvisible( menu_getitem( "video" ) ); - menu_jumptowindow( menu_getitem( "video" ), false ); -}; - -void(void) nex_video_bpp_reinit = -{ - if(cvar("vid_bitsperpixel") == 32) - self.value = 1; - else - self.value = 0; -}; - -void(void) nex_video_fullscreen_reinit = -{ - self.value = cvar("vid_fullscreen"); -}; - -string nex_video_resolutions; - -void(void) nex_video_resolution_switch_reinit = -{ - float c, i; - float pos86; - - c = getaltstringcount(nex_video_resolutions); - for(i = 0; i < c; i=i+1) - { - string s; - vector t; - s = getaltstring(i,nex_video_resolutions); - s = strcat("'",s,"'"); - t = stov(s); - if(t_x == cvar("vid_width") && t_y == cvar("vid_height")) - { - self.value = i; - return; - } - if(t == '800 600 0') - pos86 = i; - } - - self.value = pos86; -}; - -void(void) nex_video_resolution_switch = -{ - var float pos86 = 0; - var float counter = 0; - vector t; - - nex_video_resolutions = ""; - self.text = ""; - self.value = -1; - - while((t = getresolution(counter)) != '0 0 0') - { - if(t == '800 600 0') - pos86 = counter; - if(t_x == cvar("vid_width") && t_y == cvar("vid_height")) - { - self.value = counter; - } - counter = counter + 1; - self.text = strcat(self.text,"'",ftos(t_x),"x"); - self.text = strcat(self.text,ftos(t_y),"'"); - nex_video_resolutions = strcat(nex_video_resolutions,vtos(t)); - } - - if(self.value == -1) - self.value = pos86; - - self.text = strzone(self.text); - nex_video_resolutions = strzone(nex_video_resolutions); - - self.reinit = nex_video_resolution_switch; -}; - -void(void) nex_video_apply = -{ - vector set, res; - float changed; - entity tmp; - - changed = false; - - // resolution test - res_x = cvar("vid_width"); - res_y = cvar("vid_height"); - res_z = 0; - - tmp = menu_getitem("video_resolution_switch"); - set = stov(getaltstring(tmp.value, nex_video_resolutions)); - if(set != res) - { - cvar_set("vid_width",ftos(set_x)); - cvar_set("vid_height",ftos(set_y)); - changed = true; - } - // bpp test - tmp = menu_getitem("video_bpp_switch"); - if((tmp.value+1)*16 != cvar("vid_bitsperpixel")) - { - cvar_set("vid_bitsperpixel",ftos((tmp.value+1)*16)); - changed = true; - } - // fullscreen changed - tmp = menu_getitem("video_fullscreen_switch"); - if(tmp.value != cvar("vid_fullscreen")) - { - cvar_set("vid_fullscreen",ftos(tmp.value)); - changed = true; - } - - if(changed) - { - cmd("vid_restart\n"); - } -}; - -///////////////// -// xplayer.menu -/// - -float maxfrags; -float maxtime; -float maxbots; -float skilllevel; -string hostname; -float maxclients; -float publicserver; -float gamemode; - -entity maps_list; -entity maps_current; - -// text = info text -// picture = picture filename -// name = map name -void(entity node) _nex_xp_remove = -{ - strunzone( node.picture ); - strunzone( node.text ); - strunzone( node.name ); - remove( node ); -} - -void(void) _nex_xp_update = -{ - entity item; - - item = menu_getitem( "creategame_map_name" ); - item.text = maps_current.name; - - item = menu_getitem( "creategame_map_picture" ); - item.picture = maps_current.picture; - - item = menu_getitem( "creategame_map_info" ); - item.text = maps_current.text; -}; - -void(void) nex_xp_enummaps = -{ - float count; - float searchhandle; - float counter; - - // remove the old list - if( maps_list ) { - entity node; - - node = maps_list; - while( node._next ) { - node = node._next; - _nex_xp_remove( node._prev ); - } - _nex_xp_remove( node ); - } - maps_list = maps_current = null_entity; - - searchhandle = search_begin( "maps/*.bsp", true, true ); - if( searchhandle == -1 ) { - print( "menu: No maps found!\n" ); - return; - } else if( searchhandle == -2) - return; - - maps_list = maps_current = spawn(); - count = search_getsize( searchhandle ); - for( counter = 0 ; counter < count ; counter = counter + 1 ) { - float file; - string fname; - - fname = search_getfilename( searchhandle, counter ); - fname = substring( fname, 0, strlen( fname ) - 4 ); - fname = strzone( fname ); - - //try to find the information text - file = fopen( strcat( fname, ".txt" ), FILE_READ ); - if( file == -1 ) - maps_current.text = strzone( "--NO INFORMATION AVAILABLE--" ); - else { - string temp, old; - maps_current.text = strzone( "" ); - do { - old = maps_current.text; - temp = fgets( file ); - maps_current.text = strzone( strcat( old, temp, "\n" ) ); - strunzone( old ); - } while( validstring( temp ) ); - fclose( file ); - } - - //try to find the picture - file = search_begin( strcat( fname, ".jpg" ), true, true ); - if( file == -1 ) - maps_current.picture = strzone( "gfx/m_nomap" ); - else { - maps_current.picture = strzone( strcat( fname, ".jpg" ) ); - search_end( file ); - } - - maps_current.name = strzone( substring( fname, 5, strlen( fname ) - 5 ) ); // remove the 'maps/' - strunzone( fname ); - - // create next item and link it with the list - maps_current._next = spawn(); - maps_current._next._prev = maps_current; - maps_current = maps_current._next; - } - // remove the last item - maps_current = maps_current._prev; - remove( maps_current._next ); - maps_current._next = null_entity; - - search_end( searchhandle ); - - maps_current = maps_list; - _nex_xp_update(); -}; - -void(void) nex_xp_prev = -{ - if( maps_current._prev ) - maps_current = maps_current._prev; - _nex_xp_update(); -}; - -void(void) nex_xp_next = -{ - if( maps_current._next ) - maps_current = maps_current._next; - _nex_xp_update(); -}; - - -void(void) nex_display_creategame = -{ - nex_makeonlyvisible( menu_getitem( "creategame" ) ); - menu_jumptowindow( menu_getitem( "creategame" ), false ); -}; - -void(void) nex_xp_maxfrags = -{ - float x; - x = stof(self.text); - maxfrags = rint(x); - - strunzone(self.text); - self.text = ftos(x); - self.text = strzone(self.text); -}; - -void(void) nex_xp_maxbots = -{ - float x; - x = stof(self.text); - maxbots = min( fabs(rint(x)), maxclients - 1, 16 ); // 16 is currently max in frikbot - see below - - strunzone(self.text); - self.text = ftos(x); - self.text = strzone(self.text); -}; - -void(void) nex_xp_maxtime = -{ - float x; - x = stof(self.text); - maxtime = rint(x); - - strunzone(self.text); - self.text = ftos(maxtime); - self.text = strzone(self.text); -}; - -void(void) nex_xp_hostname = -{ - hostname = self.text; -}; - -void(void) nex_xp_maxclients = -{ - local float i; - i = stof(self.text); - maxclients = rint(i); - - strunzone(self.text); - self.text = strzone(ftos(maxclients)); -}; - -void(void) nex_xp_publicserv = -{ - publicserver = self.value; -}; - -void(void) nex_xp_gamemode = -{ - gamemode = self.value; -}; - -void(void) nex_xp_skilllevel = -{ - skilllevel = self.value; -} - -void(void) nex_xp_start = -{ - cvar_set( "fraglimit", ftos( maxfrags ) ); - cvar_set( "timelimit", ftos( maxtime ) ); - cvar_set( "deathmatch", "1" ); - - cmd( "maxplayers " ); - cmd( ftos( maxclients ) ); - cmd( "\n" ); - - cvar_set( "sv_public", ftos( publicserver ) ); - cvar_set( "hostname", hostname ); - - // see bot/bot.qc: BotInit - cvar_set( "saved1", "1" ); - cvar_set( "scratch1", ftos( pow( 2, maxbots ) - 1 ) ); - cvar_set( "scratch2", ftos( skilllevel * (pow(4, min(maxbots, 8)) - 1) / 3) ); - cvar_set( "scratch3", ftos( skilllevel * (pow(4, min(maxbots - 8, 8)) - 1) / 3) ); - - cmd( "map " ); - cmd( maps_current.name ); - cmd( "\n" ); - cmd( "togglemenu\n" ); -}; - -void(void) nex_goto_createserver = -{ - menu_jumptowindow( menu_getitem( "multiplayer_frame"), false ); -} - -void(void) nex_draw_text = -{ - local vector drawpos; - local float cpos, end; - - cpos = 0; - drawpos = self.pos; - drawpos_y = drawpos_y + self.font_size_y; - do { - local string l; - local float i; - - end = strlen( self.text ); - i = cpos; - do { - l = substring( self.text, i, 1 ); - - if( l == "\n" ) { - end = i; - break; - } - - i = i + 1; - } while( l != "" ); - - l = substring( self.text, cpos, end - cpos ); - if( l != "" ) - menu_drawstring( drawpos, l, self.font_size, self.color, self.alpha, self.drawflag ); - drawpos_y = drawpos_y + self.font_size_y; - - cpos = end + 1; - } while( end != strlen( self.text ) ); -} - -// server list -var float slist_selected = 0; -var float slist_start = 0; -float slist_estimatedsize; - -void(void) nex_display_serverlist = -{ - if(menu_activewindow.name == "serverlist") - return; - menu_jumptowindow(menu_getitem("serverlist"),true); - cmd("net_slist\n"); -}; - -// use a ITEM_TEXT as base item for this -// we need another item to clip the slist -// (another reason for a new menu qc!) -void(void) slist_draw = -{ - float c; - vector pos; - float listsize; - - //print("slist drawing...", ftos(listsize), "\n"); - - pos = '0 0 0'; // the upper item sets the origin - listsize = gethostcachevalue(SLIST_HOSTCACHECOUNT); - if(!listsize) - { - menu_drawstring(pos, "No Servers", self.font_size, self.color, self.alpha, self.drawflag); - return; - } - - for(c = 0; c < slist_estimatedsize + 1; c = c + 1) - { - string line; - - if(listsize <= slist_start + c) - break; - - //print("drawing ", ftos(c),"\n"); - - if(slist_selected - slist_start == c) - { - vector s; - s = self.size; - s_y = self.font_size_y * 2; - - menu_fillarea(pos, s, self.color_selected, self.alpha_selected * (sin(time * 9) + 1) / 2, self.drawflag_selected); - } - - line = gethostcachestring(SLIST_LINE1, slist_start + c); - - if( !line || line == "" ) - line = strzone( "Empty" ); - else - line = strzone( strcat( chr(127), line ) ); - - menu_drawstring(pos, line, self.font_size, self.color, self.alpha, self.drawflag); - - pos_y = pos_y + self.font_size_y; - - strunzone( line ); - line = gethostcachestring(SLIST_LINE2, slist_start + c); - - if( !line || line == "" ) - line = strzone( "Empty" ); - else - line = strzone( strcat( chr(127), line ) ); - - menu_drawstring(pos, line, self.font_size, self.color, self.alpha, self.drawflag); - pos_y = pos_y + self.font_size_y; - - strunzone( line ); - } -}; - -void(void) slist_init = -{ - self.size = self._parent.size; - slist_estimatedsize = self.size_y / self.font_size_y / 2; -}; - -void(void) slist_refresh = -{ - float hostcachesize; - - hostcachesize = gethostcachevalue(SLIST_HOSTCACHECOUNT); - if(slist_start >= hostcachesize) - slist_start = ceil(hostcachesize - slist_estimatedsize); - if(slist_start < 0) - slist_start = 0; - if(slist_selected >= hostcachesize) - slist_selected = hostcachesize; -}; - -void(void) slist_join = -{ - string cname; - cname = gethostcachestring(SLIST_CNAME, slist_selected); - - if(cname != "") - { - cmd("connect "); - cmd(cname); - cmd(" ;togglemenu\n"); - } -}; - -float(float keynr, float ascii ) slist_key = -{ - float listsize; - - if(keynr == K_UPARROW) - { - if(slist_selected > 0) - slist_selected = slist_selected - 1; - if(slist_start > slist_selected) - slist_start = slist_selected; - return TRUE; - } else if(keynr == K_DOWNARROW) - { - listsize = gethostcachevalue(SLIST_HOSTCACHECOUNT); - if(slist_selected < listsize - 1) - slist_selected = slist_selected + 1; - if(slist_start + slist_estimatedsize - 0.5 < slist_selected) - slist_start = ceil(slist_selected - slist_estimatedsize + 0.5); - return TRUE; - } else if(keynr == K_ENTER) - { - slist_join(); - return TRUE; - } else if(keynr == K_SPACE) - { - cmd("net_slist\n"); - return TRUE; - } else if(keynr == K_MOUSE1) - { - float pos; - - listsize = gethostcachevalue(SLIST_HOSTCACHECOUNT); - pos = floor(menu_cursor_y / self.font_size_y / 2); - - if(pos + slist_start == slist_selected) - slist_join(); - else if(pos + slist_start < listsize) - slist_selected = pos; - return TRUE; - } - return FALSE; -}; - -void(void) slist_info1 = -{ - float query, reply; - string temp; - - query = gethostcachevalue(SLIST_MASTERQUERYCOUNT); - reply = gethostcachevalue(SLIST_MASTERREPLYCOUNT); - - if( self.text ) - strunzone(self.text); - - temp = strcat(ftos(reply), "/"); - temp = strcat(temp, ftos(query), " Master Servers"); - - self.text = strzone(temp); -}; - -void(void) slist_info2 = -{ - float query, reply; - string temp; - - query = gethostcachevalue(SLIST_SERVERQUERYCOUNT); - reply = gethostcachevalue(SLIST_SERVERREPLYCOUNT); - - if( self.text ) - strunzone(self.text); - - temp = strcat(ftos(reply), "/"); - temp = strcat(temp, ftos(query), " Game Servers"); - - self.text = strzone(temp); -}; - -///////////////// -// options.menu -/// - -// player options -var entity mlist_list = null_entity; -entity mlist_current; -string mlist_saved; - -string player_name; - -string player_model_cvar = "_cl_playermodel"; -string player_name_cvar = "_cl_name"; -string player_skin_cvar = "_cl_playerskin"; -string player_fov_cvar = "player_fov"; - -void() nex_player_init = -{ - local entity lEntity; - - mlist_saved = strzone( str_cvar( player_model_cvar ) ); - - lEntity = menu_getitem( "options_player_opt_playername_switch" ); - lEntity.text = strzone( str_cvar( player_name_cvar ) ); - -}; - -void(void) nex_player_reinit = -{ - entity ent; - - strunzone( mlist_saved ); - mlist_saved = strzone( str_cvar( player_model_cvar ) ); - - ent = menu_getitem( "options_player_opt_playername_switch" ); - strunzone( ent.text ); - ent.text = strzone( str_cvar( player_name_cvar ) ); -}; - -void(void) nex_player_name = -{ - player_name = self.text; -}; - -void(void) nex_player_apply = -{ - cmd( strcat( "playermodel \"", mlist_current.picture_selected, "\"\n" ) ); - cmd( strcat( "playerskin \"", mlist_current.picture_pressed, "\"\n" ) ); - cmd( strcat( "name ", player_name, "\n" ) ); -}; - -// name = name -// picture_selected = model name -// picture_pressed = skin name -// picture = picture -// text = desc text -void(entity e) _nex_player_remove = -{ - strunzone( e.name ); - strunzone( e.picture_selected ); - strunzone( e.picture_pressed ); - strunzone( e.picture ); - strunzone( e.text ); - - remove( e ); -}; - -void() _nex_player_model_update = -{ - entity item; - - if( !mlist_list ) - return; - - item = menu_getitem( "options_player_model_name" ); - item.text = mlist_current.name; - - item = menu_getitem( "options_player_model_picture" ); - item.picture = mlist_current.picture; - - item = menu_getitem( "options_player_model_info" ); - item.text = mlist_current.text; -}; - -/* -.mdef file format -name -picture\n -skin filename\n -model filename\n -rest text*/ -void(void) nex_player_buildlist = -{ - local float shandle; - local float count; - local float counter; - local float loaded; - local entity hit; - - // remove the old player list - if( mlist_list ) { - local entity node; - - // save the old selected model - mlist_saved = strzone( mlist_current.name ); - - node = mlist_list; - while( node._next ) { - node = node._next; - _nex_player_remove( node._prev ); - } - _nex_player_remove( node ); - - mlist_list = mlist_current = null_entity; - } - - shandle = search_begin( "models/player/*.txt", false, true ); - if( shandle < 0 ) - return; - - count = search_getsize( shandle ); - mlist_list = mlist_current = spawn(); - hit = null_entity; - loaded = 0; - for ( counter = 0 ; counter < count ; counter = counter + 1 ) { - local string dname; - local string dpicture; - local string dskin; - local string dmodel; - local string dtext; - - local float handle; - - handle = fopen( search_getfilename( handle, counter ), FILE_READ ); - - if( handle < 0 ) - continue; - - dname = strzone( fgets( handle ) ); - dpicture = strzone( fgets( handle ) ); - dskin = strzone( fgets( handle ) ); - dmodel = strzone( fgets( handle ) ); - { - local string ltemp, lold; - dtext = strzone( "" ); - do { - lold = dtext; - ltemp = fgets( handle ); - dtext = strzone( strcat( lold, ltemp, "\n" ) ); - strunzone( lold ); - } while( validstring( ltemp ) ); - } - - if( !dname || !dpicture || !dskin || !dmodel || !dtext ) { - print( "Bad model definition file '", search_getfilename( shandle, counter ), "'\n" ); - - strunzone( dname ); - strunzone( dpicture ); - strunzone( dskin ); - strunzone( dmodel ); - //strunzone( dtext ); - - fclose( handle ); - continue; - } - - // is this the previous selected model? - if( dname == mlist_saved ) - hit = mlist_current; - - mlist_current.name = dname; - mlist_current.picture = dpicture; - mlist_current.picture_pressed = dskin; - mlist_current.picture_selected = dmodel; - mlist_current.text = dtext; - - loaded = loaded + 1; - - mlist_current._next = spawn(); - mlist_current._next._prev = mlist_current; - mlist_current = mlist_current._next; - - fclose( handle ); - } - mlist_current._prev._next = null_entity; - remove( mlist_current ); - - search_end( shandle ); - - if( loaded == 0 ) { - print( "No model description files found in models/player\n" ); - mlist_list = mlist_current = null_entity; - } else - print( ftos( loaded ), " model description files loaded from models/player\n" ); - - if( hit ) - mlist_current = hit; - else - mlist_current = mlist_list; - - _nex_player_model_update(); -}; - -void(void) nex_player_model_next = -{ - if( mlist_current._next ) - mlist_current = mlist_current._next; - _nex_player_model_update(); -}; - -void(void) nex_player_model_prev = -{ - if( mlist_current._prev ) - mlist_current = mlist_current._prev; - _nex_player_model_update(); -}; - -void(void) nex_player = -{ - entity ent; - ent = menu_getitem("options_player"); - nex_makeonlyvisible( ent ); - menu_jumptowindow(ent, false); -}; - -// old/other options - -void(void) nex_options_alwaysrun_switchchange = -{ - if(self.value) - { - cvar_set("cl_forwardspeed","400"); - cvar_set("cl_backspeed","400"); - } - else - { - cvar_set("cl_forwardspeed","200"); - cvar_set("cl_backspeed","200"); - } -}; - -void(void) nex_options_alwaysrun_refresh = -{ - if(cvar("cl_forwardspeed") > 200) - self.value = 1; - else - self.value = 0; -}; - -void(void) nex_options_invmouse_switchchange = -{ - float old; - old = 0 - cvar("m_pitch"); - cvar_set("m_pitch",ftos(old)); -}; - -void(void) nex_options_invmouse_refresh = -{ - if(cvar("m_pitch") > 0) - self.value = 0; - else - self.value = 1; -}; - -void(void) nex_snd = -{ - entity ent; - ent = menu_getitem("options_sound"); - nex_makeonlyvisible( ent ); - menu_jumptowindow(ent, false); -} - -void(void) nex_snd_cd_init = -{ - if(cvar("cdaudioinitialized")) - { - self.flag = FLAG_AUTOSETCLICK; - self.color = ITEM_TEXT_NORMAL_COLOR; - } - else - { - self.flag = FLAG_NOSELECT | FLAG_DRAWONLY | FLAG_CHILDDRAWONLY; - self.color = '0.5 0.5 0.5'; - } -}; - -void(void) nex_snd_snd_init = -{ - if(cvar("snd_initialized")) - { - self.flag = FLAG_AUTOSETCLICK; - self.color = ITEM_TEXT_NORMAL_COLOR; - } - else - { - self.flag = FLAG_NOSELECT | FLAG_DRAWONLY | FLAG_CHILDDRAWONLY; - self.color = '0.5 0.5 0.5'; - } -}; - -void(void) nex_cc = -{ - entity ent; - ent = menu_getitem("options_cc"); - nex_makeonlyvisible( ent ); - menu_jumptowindow(ent, false); -} - -void(void) nex_cc_reset = -{ - cmd( - "v_hwgamma 1;" - "v_gamma 1;" - "v_contrast 1;" - "v_brightness 0;" - "v_color_enable 0;" - "v_color_black_r 0;" - "v_color_black_g 0;" - "v_color_black_b 0;" - "v_color_grey_r 0;" - "v_color_grey_g 0;" - "v_color_grey_b 0;" - "v_color_white_r 1;" - "v_color_white_g 1;" - "v_color_white_b 1;" - "\n"); -}; - -void(void) nex_cc_check_hwgamma = -{ - if(cvar("vid_hardwaregammasupported")) - { - self.flag = FLAG_AUTOSETCLICK; - self.color = ITEM_TEXT_NORMAL_COLOR; - } - else - { - self.flag = FLAG_NOSELECT; - self.color = '0.5 0.5 0.5'; - } -}; - -void(void) nex_cc_check_gamma = // used in key -- BADBAD HACKHACK -{ - if(cvar("v_hwgamma") && cvar("vid_hardwaregammasupported") && !cvar("v_color_enable")) - { - self.flag = FLAG_AUTOSETCLICK; - self.color = ITEM_TEXT_NORMAL_COLOR; - } - else - { - self.flag = FLAG_NOSELECT; - self.color = '0.5 0.5 0.5'; - } -}; - -void(void) nex_cc_check_grey = // used in key -- BADBAD HACKHACK -{ - if(cvar("v_hwgamma") && cvar("vid_hardwaregammasupported") && cvar("v_color_enable")) - { - self.flag = FLAG_AUTOSETCLICK; - self.color = ITEM_TEXT_NORMAL_COLOR; - } - else - { - self.flag = FLAG_NOSELECT; - self.color = '0.5 0.5 0.5'; - } -}; - -void(void) nex_cc_check_ncolor_enable = -{ - if(!cvar("v_color_enable")) - { - self.flag = FLAG_AUTOSETCLICK; - self.color = ITEM_TEXT_NORMAL_COLOR; - } - else - { - self.flag = FLAG_NOSELECT; - self.color = '0.5 0.5 0.5'; - } -}; - -void(void) nex_cc_check_color_enable = -{ - if(cvar("v_color_enable")) - { - self.flag = FLAG_AUTOSETCLICK; - self.color = ITEM_TEXT_NORMAL_COLOR; - } - else - { - self.flag = FLAG_NOSELECT; - self.color = '0.5 0.5 0.5'; - } -}; - -void(void) nex_cc_color_enable = -{ - cvar_set("v_color_enable","1"); -}; - -void(void) nex_cc_ncolor_enable = -{ - cvar_set("v_color_enable","0"); -}; - -void(void) nex_cc_grey_refresh = -{ - self.value = cvar(strcat(self.cvarname,"_r")); - self.value = self.value + cvar(strcat(self.cvarname,"_g")); - self.value = self.value + cvar(strcat(self.cvarname,"_b")); - self.value = self.value / 3; -}; - - -void(void) nex_cc_grey_move = -{ - string tmp; - tmp = ftos(self.value); - cvar_set(strcat(self.cvarname,"_r"), tmp); - cvar_set(strcat(self.cvarname,"_g"), tmp); - cvar_set(strcat(self.cvarname,"_b"), tmp); -}; - -void(void) nex_cc_grey = -{ - self.refresh = nex_cc_grey_refresh; - self.slidermove = nex_cc_grey_move; -}; - -// key control stuff -void(void) nex_cntrl = -{ - entity ent; - ent = menu_getitem("options_control"); - nex_makeonlyvisible( ent ); - menu_jumptowindow(ent, false); -} - -const float NUMKEYS = 2; // visible key count (first and secondary key) -string bindcommand; - -void(float keynr, float ascii) nex_con_keyhook = -{ - entity ent; - - //dprint("nex_con_keyhook called !\n"); - - if(keynr != K_ESCAPE) - { - string tmp; - tmp = bind_getkeylist(bindcommand); - // remove the binds if we need more space - bind_limitbinds(NUMKEYS - 1, bindcommand); - // bind the new key - bind_bindkey(bind_getstringforkey(keynr), bindcommand); - } - - ent = menu_getitem("options_control_statemsg1"); - ent.value = 0; - - ent = menu_getitem("options_control_statemsg2"); - ent.value = 0; - - menu_keyhook = null_function; -}; - -void(void) nex_con_action_key = -{ - entity ent; - - bindcommand = self.link; - - //dprint("action called"); - - menu_keyhook = nex_con_keyhook; - - ent = menu_getitem("options_control_statemsg1"); - ent.value = 1; - - ent = menu_getitem("options_control_statemsg2"); - ent.value = 1; -}; - -float(float keynr, float ascii) nex_con_key = -{ - if(keynr == K_DEL) - { - // the user wants to unbind this action - //dprint("Removing binds for '", self.link,"'\n"); - bind_limitbinds(0, self.link); - return true; - } - - return false; -}; - -void(void) nex_con_update_keys = -{ - entity ent; - string keystr; - float num; - - if(!self._child) - return; - - keystr = strzone(bind_getkeylist(self.link)); - - num = 0; - - for(ent = self._child; ent != null_entity; ent = ent._next) - { - float keynr; - - keynr = stof(getaltstring(num, keystr)); - - strunzone(ent.text); - - if(keynr == -1 ) - ent.text = strzone("-"); - else - ent.text = strzone(bind_getstringforkey(keynr)); - - num = num + 1; - } - - strunzone(keystr); -}; - -var float numkey = 0; -void(void) CONTROL_KEY = -{ - entity key1, key2, desc; - entity temp_desc, temp_key; - - temp_desc = menu_getitem("control_desc_template"); - temp_key = menu_getitem("control_key_template"); - - desc = spawn(); - copyentity(temp_desc, desc); - - key1 = spawn(); - copyentity(temp_key, key1); - - key2 = spawn(); - copyentity(temp_key, key2); - - desc.name = self.text; - key1.name = strzone(strcat(self.text, " key1")); - key2.name = strzone(strcat(self.text, " key2")); - - desc.pos_y = key1.pos_y = key2.pos_y = temp_desc.pos_y * numkey; - key2.pos_x = 2 * key2.pos_x; - - desc.text = self.text; - desc.link = self.link; - - key1.text = strzone("-"); - key2.text = strzone("-"); - - desc.alignment = 0; - - // set the parents - desc.parent = "options_control"; - desc._parent = menu_getitem("options_control"); - - key1.parent = key2.parent = desc.name; - key1._parent = key2._parent = desc; - - //eprint(key1); - //eprint(key2); - //eprint(desc); - - numkey = numkey + 1; -}; - -//////////////////////////////////////////////////// -// Test Stuff -/// -void(void) initbrightness = -{ - self.value = cvar("scr_conbrightness"); -}; - -void(void) setbrightness = -{ - cvar_set("scr_conbrightness",ftos(self.value)); -}; - -void(void) nex_main_exit = -{ - entity e; - e = menu_getitem("MAIN_MENU"); - e.flag = FLAG_NOSELECT + FLAG_CHILDDRAWONLY; - e = menu_getitem("MAIN_EXIT_MENU"); - e.flag = FLAG_NOSELECT; - menu_jumptowindow(e, false); -}; - -void(void) nex_main_exit_no = -{ - entity e; - e = menu_getitem("MAIN_EXIT_MENU"); - e.flag = FLAG_NOSELECT + FLAG_HIDDEN; - e = menu_getitem("MAIN_MENU"); - e.flag = FLAG_NOSELECT; - menu_selectup(); -}; - -void(void) nex_main_exit_yes = -{ - cmd("quit\n"); -}; - -float(float keynr, float ascii) nex_main_exit_key = -{ - if(keynr == K_ESCAPE) - { - nex_main_exit_no(); - return true; - } - return false; -} - -void(void) dorestart = -{ - cmd("menu_restart\n"); -}; - -void(void) nex_text_cur_x = -{ - self.text = ftos(rint(cursor_x)); -}; - -void(void) nex_text_cur_y = -{ - self.text = ftos(rint(cursor_y)); -}; \ No newline at end of file diff --git a/menu/mcustom.qh b/menu/mcustom.qh deleted file mode 100644 index 06dea5bb9..000000000 --- a/menu/mcustom.qh +++ /dev/null @@ -1,153 +0,0 @@ -/////////////////////////////////////////////// -// Custom Menu Header File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains menu specific stuff that is made especially for dpmod -// AK this file is used e.g. for defining some special event functions -/////////////////////////////////////////////// - -/*Templates - -Sliders with text and description: ----------------------------------- - -Template Params: - -cccc - Name of the text (on the left of the menu) -nnn - Name of the object group -ppp - Parent of the object group -ccvv - Name of the cvar -yypp - y position - -////// -// cccc -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name ppp_nnn_text - parent ppp - text "cccc" - pos "0 yypp 0" - origin "0 yypp 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child -} -// Slider -{ - type ITEM_SLIDER - name ppp_nnn_slider - parent ppp_nnn_text - //pos "10 yypp 0" - pos "10 0 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "ccvv" - cvartype 1 // CVAR_INT - min_value 240 - max_value 1536 - step 25.92 - init nex_cvar_slider -} -// Text -{ - type ITEM_TEXT - name ppp_nnn_slidertext - parent ppp_nnn_text - link ppp_nnn_slider - //pos "120 yypp 0" - pos "120 0 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} - -Text switch with text : - -cccc - name of it (and caption of the text) -ppp - parent -nnn - name of the object group -yypp - y position of the object group -ccvv - name of the cvar -ssss - switches 'No' 'Yes' - -////// -// cccc -//// -// Text -{ - type ITEM_TEXTBUTTON - name ppp_nnn_text - parent ppp - text "cccc" - pos "0 yypp 0" - origin "0 yypp 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_TEXTSWITCH - name ppp_nnn_switch - parent ppp_nnn_text - //pos "10 yypp 0" - pos "10 0 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - text "ssss" - cvarname "ccvv" - cvartype 1 // CVAR_INT - reinit nex_cvar_slider // can use it also here -} - -*/ - -// global stuff - -.string cvarname; -.float cvartype; -//.string cvarvalues; - -const float CVAR_FLOAT = 0; -const float CVAR_INT = 1; -//const float CVAR_STRING = 2; -const float CVAR_STEP = 4; - -.entity _link; -//.float maxlen; // <- ITEM_EDITBOX -void(void) nex_cvar_slider; // set reinit to this -void(void) _nex_cvar_slider_refresh; -void(void) _nex_cvar_slider; - -float(float keynr, float ascii) nex_redirect_key; - -void(void) nex_slidertext; -void(void) _nex_slidertext_refresh; - -// option menu stuff -void(void) nex_options_alwaysrun_switchchange; -void(void) nex_options_alwaysrun_refresh; - -void(void) nex_options_invmouse_switchchange; -void(void) nex_options_invmouse_refresh; - -// quit message stuff -const float DPMOD_QUIT_MSG_COUNT = 4; - -string nex_quitmsg_0 = "'Tired of fragging''already ?'", - nex_quitmsg_1 = "'Quit now and forfeit''your bodycount ?'", - nex_quitmsg_2 = "'Are you sure you''want to quit ?'", - nex_quitmsg_3 = "'Off to do something''constructive ?'"; - -float nex_quitrequest; - -void(void) nex_quit_choose; -void(void) nex_quit; -void(void) nex_quit_yes; -void(void) nex_quit_no; -float(float keynr, float ascii) nex_quit_key; diff --git a/menu/menu.qc b/menu/menu.qc deleted file mode 100644 index 317058376..000000000 --- a/menu/menu.qc +++ /dev/null @@ -1,138 +0,0 @@ -/////////////////////////////////////////////// -// Menu Source File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all menu functions (especially the required ones) -/////////////////////////////////////////////// - -void(void) m_init = -{ - // init graphic - gfx_init(); - - // init sound - snd_init(); - - // init cursor - cursor_init(); - - // init menu - menu_init(); - - // init editor - //editor_init(); -}; - -// required menu functions -void(float keynr, float ascii) m_keydown = -{ - if(!menu_active) - return; - - // let also the gfx and sound know - gfx_keydown(keynr, ascii); - snd_keydown(keynr, ascii); - - // actually only the menu may react on keydown messages - menu_keydown(keynr, ascii); - - // let the editor also know - //editor_keydown(keynr, ascii); -}; - -void(void) m_frame = -{ - // graphic frame - gfx_frame(); - - // sound frame - snd_frame(); - - // cursor frame - cursor_frame(); - - // menu frame - menu_frame(); - - // editor frame - //editor_frame(); -}; - -void(void) m_draw = -{ - if(!menu_active) - return; - - // call m_frame cause draw is the only menu function called once per frame - m_frame(); - - // now the drawing code - menu_draw(); - - // editor drawing code - //editor_draw(); - - // draw the cursor on top of the menu - cursor_draw(); - - // and now the gfx drawing code (for special fx) - gfx_draw(); -}; - -void(void) m_toggle = -{ - if(!menu_active) - { - menu_active = true; - - // update isserver and clientstate - gamestatus = 0; - if(isserver()) - gamestatus = gamestatus | GAME_ISSERVER; - if(clientstate() == CS_CONNECTED) - gamestatus = gamestatus | GAME_CONNECTED; - if(cvar("developer")) - gamestatus = gamestatus | GAME_DEVELOPER; - - // redirect keyboard input - setkeydest(KEY_MENU); - // stop the client getting mouse coords - setmousetarget(MT_MENU); - - // let also the snd and gfx know (perhaps for sfx) - gfx_toggle(); - snd_toggle(); - - cursor_toggle(); - - // let the menu manager know - menu_performreinit(); - } else - { - setkeydest(KEY_GAME); - setmousetarget(MT_CLIENT); - menu_active = false; - } -}; - -void(void) m_shutdown = -{ - // shutdown editor - //editor_shutdown(); - - // shutdown menu - menu_shutdown(); - - // shutdown cursor - cursor_shutdown(); - - // shutdown sound - snd_shutdown(); - - // shutdown graphic - gfx_shutdown(); - - // make sure everything is reset - setkeydest(KEY_GAME); - setmousetarget(MT_CLIENT); -}; \ No newline at end of file diff --git a/menu/menu.qh b/menu/menu.qh deleted file mode 100644 index 9497deeb7..000000000 --- a/menu/menu.qh +++ /dev/null @@ -1,26 +0,0 @@ -/////////////////////////////////////////////// -// Menu Header File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all common constants, etc. -/////////////////////////////////////////////// -// constants - -float GAME_ISSERVER = 1; -float GAME_CONNECTED = 2; -float GAME_DEVELOPER = 4; - -// global vars - -float time; // important for animations, etc. -float menu_active; // is set when the menu is active - -// updated every time toggle is called -float gamestatus; - -// constants - -void(void) null_function = {}; // FIXME - -// prototypes - diff --git a/menu/mfuncs.qc b/menu/mfuncs.qc deleted file mode 100644 index 84518fd6a..000000000 --- a/menu/mfuncs.qc +++ /dev/null @@ -1,468 +0,0 @@ -/////////////////////////////////////////////// -// Functions Source File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all menu controlling stuff (sub-menus) -/////////////////////////////////////////////// - -// raise function -/* template - -void(entity ent) raise_x = -{ - entity old; - if(!ent._x) - return; - - old = self; - self = ent; - self._x(); - self = old; -}; -*/ - -void(entity ent) raise_reinit = -{ - entity old; - if(!ent._reinit) - return; - - old = self; - self = ent; - self._reinit(); - self = old; -}; - -void(entity ent) raise_destroy = -{ - entity old; - if(!ent._destroy) - return; - - old = self; - self = ent; - self._destroy(); - self = old; -}; - -void(entity ent, float keynr, float ascii) raise_key = -{ - entity old; - if(!ent._key) - return; - - old = self; - self = ent; - self._key(keynr, ascii); - self = old; -}; - -void(entity ent) raise_draw = -{ - entity old; - if(!ent._draw) - return; - - old = self; - self = ent; - self._draw(); - self = old; -}; - -void(entity ent) raise_mouse_enter = -{ - entity old; - if(!ent._mouse_enter) - return; - - old = self; - self = ent; - self._mouse_enter(); - self = old; -}; - -void(entity ent) raise_mouse_leave = -{ - entity old; - if(!ent._mouse_leave) - return; - - old = self; - self = ent; - self._mouse_leave(); - self = old; -}; - -void(entity ent) raise_action = -{ - entity old; - if(!ent._action) - return; - - old = self; - self = ent; - self._action(); - self = old; -}; - -void(entity ent) raise_refresh = -{ - entity old; - if(!ent._refresh) - return; - - old = self; - self = ent; - self._refresh(); - self = old; -}; - -// safe call control function functions -// default control functions -/* template - -void(void) ctcall_x = -{ - if(self.x) - self.x(); -}; - -*/ -void(void) ctcall_init = -{ - if(self.init) - self.init(); -}; - -void(void) ctcall_reinit = -{ - if(self.reinit) - self.reinit(); -}; - -void(void) ctcall_destroy = -{ - if(self.destroy) - self.destroy(); -}; - -float(float keynr, float ascii) ctcall_key = -{ - if(self.key) - return self.key(keynr, ascii); - else - return false; -}; - -void(void) ctcall_draw = -{ - if(self.draw) - self.draw(); -}; - -void(void) ctcall_mouse_enter = -{ - if(self.mouse_enter) - self.mouse_enter(); -}; - -void(void) ctcall_mouse_leave = -{ - if(self.mouse_leave) - self.mouse_leave(); -}; - -void(void) ctcall_action = -{ - if(self.action) - self.action(); -}; - -void(void) ctcall_refresh = -{ - if(self.refresh) - self.refresh(); -} - -// default control functions -/* template (expect defct_key) - -void(void) defct_x = -{ - ctcall_x(); -}; - -*/ -// defct_init not needed cause its the same like the type function - -void(void) defct_reinit = -{ - ctcall_reinit(); -}; - -void(void) defct_destroy = -{ - ctcall_destroy(); -}; - -void(float keynr, float ascii) defct_key = -{ - if(!ctcall_key(keynr, ascii)) - def_keyevent(keynr, ascii); -}; - -void(void) defct_draw = -{ - ctcall_draw(); -}; - -void(void) defct_mouse_enter = -{ - ctcall_mouse_enter(); -}; - -void(void) defct_mouse_leave = -{ - ctcall_mouse_leave(); -}; - -void(void) defct_action = -{ - ctcall_action(); -}; - -void(void) defct_refresh = -{ - // do first the own fresh stuff and *then* call refresh - def_refresh(); - ctcall_refresh(); -} - -// default refresh function -void(void) def_refresh = -{ - // refresh stuff - if(self.flag & FLAG_AUTOSETCLICK) - { - self.click_pos = self.pos; - self.click_size = self.size; - } - if(self.flag & FLAG_AUTOSETCLIP) - { - self.clip_pos = self.pos; - self.clip_size = self.size; - } -}; - -// default key function -void(float keynr, float ascii) def_keyevent = -{ - if(keynr == K_ESCAPE) - { - // move up to the parent - menu_selectup(); - } else if(keynr == K_LEFTARROW || keynr == K_UPARROW) - { - // move to the previous element - menu_loopprev(); - - if(menu_selected == self) - { - if(self._prev) - { - menu_selected = self._prev; - menu_selectdown(); - if(menu_selected != self._prev) - { - return; - } - } - menu_selected = self; - } - } else if(keynr == K_RIGHTARROW || keynr == K_DOWNARROW) - { - // move to the next element - menu_loopnext(); - - if(menu_selected == self) - { - if(self._next) - { - menu_selected = self._next; - menu_selectdown(); - if(menu_selected != self._next) - { - return; - } - } - menu_selected = self; - } - } else if(keynr == K_ENTER || keynr == K_MOUSE1) - { - if(self._action) - self._action(); - // move to the child menu - menu_selectdown(); - } -}; - -// a rect is described by the top-left point and its size -float(vector point, vector r_pos, vector r_size) inrect = -{ - if(point_x < r_pos_x) - return false; - if(point_y < r_pos_y) - return false; - if(point_x > (r_pos_x + r_size_x)) - return false; - if(point_y > (r_pos_y + r_size_y)) - return false; - return true; -}; - -vector(vector r_pos, vector r_size, vector c_pos, vector c_size) cliprectpos = -{ - vector v; - - // clip r_pos only - v_x = max(c_pos_x, r_pos_x); - v_y = max(c_pos_y, r_pos_y); - - return v; -}; - -vector(vector r_pos, vector r_size, vector c_pos, vector c_size) cliprectsize = -{ - vector v; - // safe version - //r_size_x = bound(c_pos_x, r_pos_x + r_size_x, c_pos_x + c_size_x) - bound(c_pos_x, r_pos_x, c_pos_x + c_size_x); - //r_size_y = bound(c_pos_y, r_pos_y + r_size_y, c_pos_y + c_size_y) - bound(c_pos_y, r_pos_y, c_pos_y + c_size_y); - v_x = min(c_pos_x + c_size_x, r_pos_x + r_size_x) - max(c_pos_x, r_pos_x); - v_y = min(c_pos_y + c_size_y, r_pos_y + r_size_y) - max(c_pos_y, r_pos_y); - - if(v_x <= 0 || v_y <= 0) - v = '0 0 0'; - - return v; -} - -void(void(void) reinitevent, void(void) destroyevent, void(float key, float ascii) keyevent, void(void) drawevent, void(void) mouse_enterevent, void(void) mouse_leaveevent, void(void) actionevent, void(void) refreshevent) - item_init = -{ - self._reinit = reinitevent; - self._destroy = destroyevent; - - self._key = keyevent; - self._draw = drawevent; - self._mouse_enter = mouse_enterevent; - self._mouse_leave = mouse_leaveevent; - self._action = actionevent; - self._refresh = refreshevent; -}; - -float(float tfactor) getflicker = -{ - // TODO: use tfactor to vary the result - return (sin(tfactor * time) + 1)/2; -}; - -float(string s) getaltstringcount = -{ - float len; - float count; - float pos; - - len = strlen(s); - count = 0; - for(pos = 0; pos < len; pos = pos + 1) - { - if(substring(s,pos,1) == "'") - count = count + 1; - } - - if(mod(count,2) == 1) - return 0; // bad string - - return (count / 2); -}; - -string(float n, string s) getaltstring = -{ - float start, length; - float tmp; - - n = rint(n); - - if(n >= getaltstringcount(s) || n < 0) - return ""; - - // go to the beginning of the altstring - tmp = 0; - for(start = 0;tmp <= n * 2 ; start = start + 1) - { - if(substring(s, start, 1) == "'") - tmp = tmp + 1; - } - - for(length = 0; substring(s, start + length, 1) != "'"; length = length + 1) - { - } - - return substring(s, start, length); -}; - -void(string key) bind_unbindkey = -{ - cmd(strcat("unbind ",key,"\n")); -}; - -void(string key, string command) bind_bindkey = -{ - cmd(strcat("bind ",key," ",command,"\n")); -}; - -string(float keynum) bind_getstringforkey = -{ - return keynumtostring(keynum); -}; - -string(string command) bind_getkeylist = -{ - return findkeysforcommand(command); -}; - -void(float num, string command) bind_limitbinds = -{ - float maxnum; - float counter; - string keystr; - - keystr = strzone(bind_getkeylist(command)); - - maxnum = getaltstringcount(keystr); - if(num > maxnum) - num = maxnum; - - //dprint("num = ", ftos(num),"\n"); - //dprint("maxnum = ", ftos(maxnum), "\n"); - - counter = 0; - while(counter < maxnum) - { - float keynum; - - keynum = stof(getaltstring(counter, keystr)); - - //dprint(ftos(keynum),"\n"); - - if(keynum == -1) - break; - - if(counter >= num) - bind_unbindkey(bind_getstringforkey(keynum)); - - counter = counter + 1; - } - - strunzone(keystr); -}; diff --git a/menu/mfuncs.qh b/menu/mfuncs.qh deleted file mode 100644 index 961728377..000000000 --- a/menu/mfuncs.qh +++ /dev/null @@ -1,71 +0,0 @@ -/////////////////////////////////////////////// -// Functions Header File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all menu controlling stuff (sub-menus) -/////////////////////////////////////////////// - -//////////////// -// prototypes -/// - -// some gfx helper functions -float(float tfactor) getflicker; - -void(void) def_refresh; -void(float keynr, float ascii) def_keyevent; - -// default control functions - assign only to the _* event functions -// (assigning to the 'normal' event functions will crash the vm !) -// are used by ITEM_CUSTOM and can be used to test new ITEMs easily -void(void) defct_reinit; -void(void) defct_destroy; -void(float keynr, float ascii) defct_key; -void(void) defct_draw; -void(void) defct_mouse_enter; -void(void) defct_mouse_leave; -void(void) defct_action; -void(void) defct_refresh; - -// use this to raise an event from another item or function -void(entity ent) raise_reinit; -void(entity ent) raise_destroy; -void(entity ent, float keynr, float ascii) raise_key; -void(entity ent) raise_draw; -void(entity ent) raise_mouse_enter; -void(entity ent) raise_mouse_leave; -void(entity ent) raise_action; -void(entity ent) raise_refresh; - -// safe call the normal control functions (only used by the mcontrols function) -void(void) ctcall_init; -void(void) ctcall_reinit; -void(void) ctcall_destroy; -float(float keynr, float ascii) ctcall_key; -void(void) ctcall_draw; -void(void) ctcall_mouse_enter; -void(void) ctcall_mouse_leave; -void(void) ctcall_action; -void(void) ctcall_refresh; - -// bind stuff -void(string key) bind_unbindkey; -string(float keynr) bind_getstringforkey; -string(string command) bind_getkeylist; // returns altstring containing keynrs -void(float num, string command) bind_limitbinds; -void(string key, string command) bind_bindkey; - -// control event function initializer -void(void(void) reinitevent, void(void) destroyevent, void(float key, float ascii) keyevent, void(void) drawevent, void(void) mouse_enterevent, void(void) mouse_leaveevent, void(void) actionevent, void(void) refreshevent) - item_init; - -float(vector point, vector r_xy, vector r_size) inrect; - -// clips are rectangle against a clip area -// cliprectsize returns '0 0 0' if it is clipped totally -vector(vector r_pos, vector r_size, vector c_pos, vector c_size) cliprectpos; -vector(vector r_pos, vector r_size, vector c_pos, vector c_size) cliprectsize; - -// used to extract 'string' strings from a normal string -float(string s) getaltstringcount; -string(float c, string s) getaltstring; diff --git a/menu/mmanager.qc b/menu/mmanager.qc deleted file mode 100644 index d6b578d21..000000000 --- a/menu/mmanager.qc +++ /dev/null @@ -1,972 +0,0 @@ -/////////////////////////////////////////////// -// Menu Manager Source File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains the manager code -/////////////////////////////////////////////// - -void(void) menu_init = -{ - //registercvar("menu_reloadlist","0"); - - menu_load(); -}; - -void(void) menu_load = -{ - // load the menu files - float count, i; - - count = tokenize(MENU_FILENAME_LIST); - - for(i = 0; i < count; i = i + 1) - { - menu_loadmenu(argv(i)); - dprint(argv(i), " loaded !\n"); - } - - menu_linkwindows(); -}; - -void(string file) menu_addfiletolist = -{ - float count, i; - - count = tokenize(MENU_FILENAME_LIST); - - for(i = 0; i < count; i = i + 1) - { - if(argv(i) == file) - { - return; - } - } - - MENU_FILENAME_LIST = strcat(MENU_FILENAME_LIST," ",file); -}; - -void(void) menu_restart = -{ - // actually we empty the ent list and load everything one more time, thats it - entity ent; - float selfused; - string oldself; - string oldactive; - string oldselected; - - // we backup the active window name and the name of the selected item - oldactive = menu_activewindow.name; - oldselected = menu_selected.name; - // backup self's name - if(self != null_entity) - { - oldself = self.name; - selfused = true; - } - else - { - selfused = false; - } - - // first clear the history - menu_clearhistory(); - - // we remove all items - ent = null_entity; - while((ent = nextent(ent)) != null_entity) - { - menu_removeitem(ent); - } - - // FIXME: here's a "little" hack (so PRVM_ED_Alloc replaces the items instead of creating new ones) - time = time + 1.0; - - // now call menu_load - menu_load(); - - time = time - 1.0; // we cant use gettime cause that always returns time :-/ - - // perform the init - menu_performreinit(); - - ent = menu_getitem(oldactive); - if(ent) - { - menu_activewindow = ent; - ent = menu_getitem(oldselected); - if(ent) - { - menu_selected = ent; - } - } - - if(selfused) - { - ent = menu_getitem(oldself); - if(ent) - { - self = ent; - } else // we have no current self... - { - error("Reloaded menu files, but the former self (", oldself ,") item is missing !\n"); - } - } -}; -void(string file) menu_loadmenu = -{ - loadfromfile(file); -}; - -entity(entity start, .entity find1, entity match, .float find2, float match2) findef = -{ - while(1) - { - start = findentity(start, find1, match); - if(start == null_entity) - break; - if(start.find2 == match2) - break; - } - - return start; - /*while((start = findentity(start,find1,match))!=null_entity) - if(start.find2 == match2) - break; - return start;*/ -}; - -void(void) menu_linkwindows = -{ - // first verify that MENU_NORMAL_NAME and MENU_INGAME_NAME exist - // if not add the default strings - entity ent; - float x, opos; - - dprint("Loading defaults if necessary\n"); - - ent = findstring(null_entity,name, MENU_NORMAL_NAME); - if(ent == null_entity) - loadfromdata(MENU_NORMAL_DEFAULT); - - // verify again if MENI_INGAME_NAME is there now - ent = findstring(null_entity,name, MENU_NORMAL_NAME); - if(ent == null_entity) - error("Bad MENU_NORMAL_DEFAULT !\n"); - - ent = findstring(null_entity,name, MENU_INGAME_NAME); - if(ent == null_entity) - loadfromdata(MENU_INGAME_DEFAULT); - - // verify again if MENI_INGAME_NAME is there now - ent = findstring(null_entity,name, MENU_INGAME_NAME); - if(ent == null_entity) - error("Bad MENU_INGAME_DEFAULT !\n"); - - dprint("Verifying that each name is used only once\n"); - - // verify that every name is only used *once* - ent = null_entity; - while((ent = nextent(ent)) != null_entity) - { - self = ent; - while((self = findstring(self, name, ent.name)) != null_entity) - { - if(self != null_entity) - { - objerror("Name ", ent.name, " already used !\n"); - } - } - } - - dprint("Verification/Setting of: type, parent, next, prev and child fields\n"); - - // now we have to : - // set the parent field with parent_name - // set the next and prev fields - // set the child field - // check the type field - self = null_entity; - while((self = nextent(self)) != null_entity) - { - if(self.name == "") - { - objerror("Name is missing !\n"); - continue; - } - - if(self.type == "") - { - objerror("Type is missing !\n"); - continue; - } - - if(!isfunction(self.type)) - { - objerror("Control ", self.type, " not found !\n"); - continue; - } - - // find parent - // if parent_name is "" do nothing else set parent - if(self.parent != "") - { - ent = findstring(null_entity, name, self.parent); - - if(ent == null_entity) - { - objerror("Item ", self.parent, " not found !\n"); - continue; - } - - self._parent = ent; - } - else - { - self._parent = null_entity; - } - } - - dprint("Calling the type functions\n"); - - // call the type functions (former classname functions) - ent = null_entity; - while((ent = nextent(ent)) != null_entity) - { - self = ent; - //dprint("Calling ",self.type," (", etos(self),")\n"); - callfunction(self.type); - } - - dprint("Orderpos is verified or set\n"); - - // now auto-set all ents with orderpos 0 - self = null_entity; - while((self = findfloat(self,orderpos, 0)) != null_entity) - { - if(self.parent == "") - continue; - - // now go through all orderpos' beginning from 1 - opos = 1; - while((ent = findef(null_entity, _parent, self._parent, orderpos, opos)) != null_entity) - { - opos = opos + 1; - } - - self.orderpos = opos; - } - - dprint("Set the _child, _prev and _next fields\n"); - - self = null_entity; - while((self = nextent(self)) != null_entity) - { - // find first child - // orderpos starts with 1 - ent = findef(null_entity, _parent, self, orderpos, 1); - - if(ent == null_entity) - { - if(findentity(ent, _parent, self) != null_entity) - { - objerror("Order pos 1 is missing in the child list of ", self.name, " !\n"); - continue; - } - //else doesnt have any chilren - } - else - self._child = ent; - - // add to next, previous list - // find orderpos - x (starting with x = 1) - x = self.orderpos; - - while(x > 1) - { - x = x - 1; - - ent = findef(null_entity, _parent, self._parent, orderpos, x); - if(ent != null_entity) - { - self._prev = ent; - ent._next = self; - break; - } - } - - // find orderpos + x (starting with x = 1 until x == self.oderpos + 100) - x = self.orderpos; - - while(x < self.orderpos + 100) - { - x = x + 1; - - ent = findef(null_entity, _parent, self._parent, orderpos, x); - if(ent != null_entity) - { - self._next = ent; - ent._prev = self; - break; - } - } - } - - dprint("Linking windows finished.\n"); -}; - -void(void) menu_toggle = -{ - // only let the qc toggle the menu if we are ingame or a developer - if(gamestatus & GAME_CONNECTED || cvar("developer")) - { - // then allow toggling - m_toggle(); - }// else do nothing -}; - -void(void) menu_performreinit = -{ - // clear history - menu_clearhistory(); - - // reset the key hook (if necessary at all) - menu_keyhook = null_function; - - // and reinit all menu items - self = null_entity; - while((self = nextent(self)) != null_entity) - { - if(self.parent == "") - self._parent = null_entity; - //else actually this shouldnt happen - else if(self._parent.name != self.parent) - objerror("Parent (should be ", self.parent, ") of non-menu item ", self.name, " changed to ", self._parent.name, " !\n"); - - raise_reinit(self); // always call reinit - } - - // choose which menu to display - if(MENU_ALLOWINGAME && (gamestatus & GAME_CONNECTED)) - menu_activewindow = findstring(null_entity, name, MENU_INGAME_NAME); - else - menu_activewindow = findstring(null_entity, name, MENU_NORMAL_NAME); - - // set the selected item - menu_selected = menu_activewindow; - - // find first child that can be selected - menu_selectdown(); -}; - -void(entity par, float selectstate) menu_processmouse = -{ - // self is parent - // loop through all childs - // and try to find an object whose click rect fits to the mouse coords - entity ent; - vector old_cursor, local_cursor; - vector old_c_size, old_c_pos, clipped_size; - - ent = par._child; - if(ent == null_entity) - return; - - if(menu_clip_size != '0 0 0') - { - clipped_size = cliprectsize(gfx_conmentogfx(par.clip_pos),par.clip_size, menu_clip_pos, menu_clip_size); - } - else - { - clipped_size = par.clip_size; - } - - if(clipped_size != '0 0 0') - { - // do clip the clip area - // save the old - old_c_pos = menu_clip_pos; - old_c_size = menu_clip_size; - - // clip the position - menu_clip_pos = cliprectpos(gfx_conmentogfx(par.clip_pos), par.clip_size, menu_clip_pos, menu_clip_size); - menu_clip_size = clipped_size; - } - - menu_localorigin = menu_localorigin + par.origin; - - old_cursor = menu_cursor; - local_cursor = gfx_congfxtomen(cursor); - - //print(vtos(cursor)," ");print(vtos(menu_clip_pos)," ");print(vtos(menu_clip_size),"\n"); - - if(inrect(cursor, menu_clip_pos, menu_clip_size) || menu_clip_size == '0 0 0') - { - do - { - // if not visible, continue to the next item - if(menu_isvisible(ent)) - { - old_cursor = menu_cursor; - menu_cursor = local_cursor; - if(inrect(local_cursor, ent.click_pos, ent.click_size)) - { - // call mouse_enter event ? - if(!(ent.flag & _FLAG_MOUSEINAREA) && menu_hasevents(ent)) - { - raise_mouse_enter(ent); - - ent.flag = ent.flag | _FLAG_MOUSEINAREA; - } - - // select it ? - if(menu_selectable(ent) && selectstate != MENU_SELECT_NEVER) - { - menu_selected = ent; - } - else if(selectstate == MENU_SELECT_ALWAYS) - { - if(menu_hasevents(ent)) - { - menu_selected = ent; - } - } - } - else - { - // call mouse_leave event ? - if((ent.flag & _FLAG_MOUSEINAREA) && menu_hasevents(ent)) - { - raise_mouse_leave(ent); - - // this only works if _FLAG_MOUSEINAREA is set - ent.flag = ent.flag - _FLAG_MOUSEINAREA; - } - } - - if(menu_selected != ent) - menu_cursor = old_cursor; - - - // if ent has children recurse through them - if(ent._child != null_entity) - { - if((ent.flag & FLAG_CHILDDRAWONLY) || (ent.flag & FLAG_CHILDDRAWREFRESHONLY)) - { - menu_processmouse(ent, MENU_SELECT_NEVER); - } - else - { - menu_processmouse(ent, selectstate); - } - } - } - } while((ent = ent._next) != null_entity); - } - - menu_localorigin = menu_localorigin - par.origin; - - // restore the old menu_clip vars if necessary - if(clipped_size != '0 0 0') - { - menu_clip_size = old_c_size; - menu_clip_pos = old_c_pos; - } -}; - -void(void) menu_frame = -{ - /* - // this is only for debugging purposes - // thus its unstable and *won't* work any more when Ive changed dp's behavior with - // the builtin list (the precache functions will only work for menu_init) - if(cvar("menu_reloadlist")) - { - cvar_set("menu_reloadlist","0"); - menu_restart(); - }*/ - menu_automatedselection = false; - // if mouse moved, process it - if(cursor_rel != '0 0 0') - { - menu_processmouse(menu_activewindow, MENU_SELECT_SELECTABLE); - } - -} - -void(entity menu) menu_drawwindow = -{ - // loop through all children and draw them - entity ent; - vector old_c_pos, old_c_size, clipped_size, clipped_pos; - - // set the clipping area - // is this necessary at all ? - if(menu_clip_size != '0 0 0') - { - clipped_size = cliprectsize(gfx_conmentogfx(menu.clip_pos),menu.clip_size, menu_clip_pos, menu_clip_size); - } - else - { - clipped_size = menu.clip_size; - } - - if(clipped_size != '0 0 0') - { - // do clip the clip area - // save the old - old_c_pos = menu_clip_pos; - old_c_size = menu_clip_size; - - // clip the position - menu_clip_pos = cliprectpos( gfx_conmentogfx(menu.clip_pos) , menu.clip_size, menu_clip_pos, menu_clip_size); - menu_clip_size = clipped_size; - gfx_setcliparea(menu_clip_pos, menu_clip_size); - } - - // set the localorigin (the clipping position wont be affected) - menu_localorigin = menu_localorigin + menu.origin; - - ent = menu._child; - do - { - // if it's not visible continue - if(menu_isvisible(ent)) - { - self = ent; - if(menu_hasevents(ent)) - { - raise_refresh(ent); - } else if(ent.flag & FLAG_DRAWREFRESHONLY) - { - raise_refresh(ent); - } else if(ent.flag & FLAG_DRAWONLY) - { - // TODO: find a better solution for this hack - } else if(ent._parent) - { - if(ent._parent.flag & FLAG_CHILDDRAWREFRESHONLY) - raise_refresh(ent); - } - - raise_draw(ent); - - if(ent._child != null_entity) - { - menu_drawwindow(ent); - } - - } - } while((ent = ent._next) != null_entity); - - menu_localorigin = menu_localorigin - menu.origin; - - // restore the old menu_clip vars if necessary - if(clipped_size != '0 0 0') - { - menu_clip_size = old_c_size; - menu_clip_pos = old_c_pos; - } - - // reset the clip area of the old menu - if(menu_clip_size != '0 0 0') - gfx_setcliparea(menu_clip_pos, menu_clip_size); - else - gfx_resetcliparea(); -} - -void(void) menu_draw = -{ - // if menu_activewindow is visible loop though it - if(menu_isvisible(menu_activewindow)) - { - //menu_setcliparea('100 100 0', '400 400 0'); - menu_drawwindow(menu_activewindow); - menu_localorigin = '0 0 0'; - menu_clip_pos = '0 0 0'; - menu_clip_size = '0 0 0'; - menu_resetcliparea(); - } -} - -float(entity e) menu_hasevents = -{ - if(e.flag & FLAG_DRAWONLY) - return false; - if(e.flag & FLAG_DRAWREFRESHONLY) - return false; - if(e._parent) - { - if(e._parent.flag & FLAG_CHILDDRAWONLY) - return false; - if(e._parent.flag & FLAG_CHILDDRAWREFRESHONLY) - return false; - } - if(menu_isvisible(e)) - return true; - return false; -}; - -float(entity e) menu_isvisible = -{ - if(e.flag & FLAG_HIDDEN) - return false; - - if((e.flag & FLAG_SERVERONLY) && !(gamestatus & GAME_ISSERVER)) - return false; - - if((e.flag & FLAG_DEVELOPERONLY) && !(gamestatus & GAME_DEVELOPER)) - return false; - - return true; -}; - -float(entity e) menu_selectable = -{ - if(!menu_hasevents(e)) - return false; - if(e.flag & FLAG_NOSELECT) - return false; - - //if(e == menu_getitem("quit")) - // crash(); - - return true; -}; - -void(void) menu_shutdown = -{ - // call the terminate event for each object - self = null_entity; - while((self = nextent(self)) != null_entity) - { - raise_destroy(self); - } -}; - -void(float keynr, float ascii) menu_keydown = -{ - // is a keyhook set ? - if(menu_keyhook != null_function) - { - // call it - menu_keyhook(keynr, ascii); - return; - } - // before calling the current keydown functions, process the mouse again - // so only the correct item is called - // (except mouse wheel up and down) - // if the mouse doesnt point to an item, there wont be a reaction on the clicking - if(K_MOUSE1 <= keynr && keynr <= K_MOUSE10) - { - entity key_selected; - key_selected = menu_selected; - menu_selected = null_entity; - menu_processmouse(menu_activewindow, MENU_SELECT_ALWAYS); - - // if we find anything, we give it the key event, perhaps it can use it - if(menu_selected != key_selected) - { - // pass the keyevent - if(menu_selected != null_entity) - { - raise_key(menu_selected, keynr, ascii); - } - - // if it is selectable the user perhaps wanted to reselect it - if(menu_selectable(menu_selected) == false || menu_selected == null_entity) - { - menu_selected = key_selected; - } - - return; - } - // go on - } - - // call current selected keydown function - // if nothing is selected -> window has no items -> call window key - if(menu_selected == null_entity) - { - // call window keydown - raise_key(menu_activewindow, keynr, ascii); - } - else if(menu_hasevents(menu_selected)) - { - raise_key(menu_selected, keynr, ascii); - } -}; - -void(void) menu_selectprev = -{ - entity temp; - - temp = menu_selected; - // loop backward through the list until one item is selectable - while((temp = temp._prev) != null_entity) - if(menu_selectable(temp)) - break; - - if(temp != null_entity) - menu_selected = temp; -}; - -void(void) menu_selectnext = -{ - entity temp; - - temp = menu_selected; - // loop forward through the list until one item is selectable - while((temp = temp._next) != null_entity) - if(menu_selectable(temp)) - break; - - if(temp != null_entity) - menu_selected = temp; -}; - -void(void) menu_loopnext = -{ - entity old; - old = menu_selected; - - menu_selectnext(); - if(menu_selected == old) - { - menu_selected = old._parent._child; - if(!menu_selectable(menu_selected)) - menu_selectnext(); - } -}; - -void(void) menu_loopprev = -{ - entity old; - old = menu_selected; - menu_selectprev(); - if(menu_selected == old) - { - while(old._next != null_entity) - { - old = old._next; - } - - menu_selected = old; - if(!menu_selectable(old)) - { - menu_selectprev(); - } - } -} - -void(void) menu_selectdown = -{ - // move down a level, then search for a selectable child - // if none is found, then search for a sub-menu - // if one is found, recurse through it, else keep the old menu_selected - // (while recursing set the history) - - entity ent, old_selected; - - // if there is no child, return - if(menu_selected._child == null_entity) - { - return; - } - - // loop through the children till a selectable is found - ent = menu_selected._child; - do - { - if(menu_selectable(ent)) - { - // found one -> break - menu_selected = ent; - return; - } - } while((ent = ent._next) != null_entity); - - // we found no selectable child, thus we loop through the children once again - // and recurse - ent = menu_selected._child; - old_selected = menu_selected; - do - { - if(ent._child != null_entity) - { - if(!(ent.flag & FLAG_CHILDDRAWONLY) && !(ent.flag & FLAG_CHILDDRAWREFRESHONLY)) - { - // give it a try - menu_selected = ent; - menu_selectdown(); - - // found one ? - if(menu_selected != ent) - { - return; - } - } - - - } - } while((ent = ent._next) != null_entity); - - // we didnt find anything - menu_selected = old_selected; -} - - -void(void) menu_selectup = -{ - // if we try to up from the current activewindow pop the history. - // else move up in the hierarchy and try to select and item. - - //print( "Check whether menu_selected == menu_activewindow\n" ); - if( menu_selected == menu_activewindow ) { - //print( "Pop history\n" ); - if( menu_history == null_entity ) { - //print( "History empty!\n" ); - menu_toggle(); - menu_reselect(); - } - menu_pophistory(); - return; - } - - //print( "Check whether parent exists\n" ); - if( menu_selected._parent == null_entity ) - return; - - //print( "Try to select the parent\n" ); - menu_selected = menu_selected._parent; - if( menu_selectable( menu_selected ) ) - return; - - //print( "Try to select an item after the parent\n" ); - menu_selectnext(); - if( menu_selectable( menu_selected ) ) - return; - - //print( "Try to select an item before the parent\n" ); - menu_selectprev(); - if( menu_selectable( menu_selected ) ) - return; - - //print( "Try to select the parent of the parent\n" ); - menu_selectup(); - - //print( "Selected:\n" ); - //eprint( menu_selected ); -}; - -void(void) menu_reselect = -{ - menu_selected = menu_activewindow; - menu_selectdown(); -}; - -void(entity menu, float setactive) menu_jumptowindow = -{ - // only jump to windows - if(menu.type != "ITEM_WINDOW" && menu.type != "ITEM_REFERENCE") - error("Cant jump to ", menu.name, " !\n"); - - // add a history point - if(setactive) { - menu_pushhistory(menu); - menu_activewindow = menu; - } - - // now set the selected to the first selectable child - menu_selected = menu; - menu_automatedselection = true; - menu_selectdown(); -}; - -entity(string item_name) menu_getitem = -{ - entity item; - - item = findstring(null_entity, name, item_name); - if( item == null_entity ) - error( "Couldn't find item '", item_name, "'!" ); - - return item; -}; - -void(entity ent) menu_removeitem = -{ - // raise the destroy event - raise_destroy(ent); - remove(ent); -}; - - -// history stuff - -void(entity ent) menu_pushhistory = -{ - entity his; - - /* - // dont create multiple histories for the same 'trigger' - if(menu_history) - { - if(menu_history._next == ent) - return; - }*/ - - menu_keyhook = null_function; - - his = spawn(); - - his.type = "MMANAGER_HISTORY"; - his._prev = menu_history; - his._child = menu_selected; - his._parent = menu_activewindow; - his._next = ent; // "used for" - - menu_history = his; -}; - -void(void) menu_pophistory = -{ - entity tmp; - - if(menu_history == null_entity) - { - return; - } - - menu_keyhook = null_function; - - menu_selected = menu_history._child; - menu_activewindow = menu_history._parent; - - tmp = menu_history; - menu_history = menu_history._prev; - - remove(tmp); -}; - -float(entity ent) menu_verifyhistory = -{ - if(menu_history == null_entity) - return false; - - if(menu_history._next == ent) - return true; - return false; -}; - -void(void) menu_clearhistory = -{ - entity ent; - - ent = null_entity; - while((ent = findstring(ent, type, "MMANAGER_HISTORY")) != null_entity) - { - remove(ent); - } - - menu_history = null_entity; -}; diff --git a/menu/mmanager.qh b/menu/mmanager.qh deleted file mode 100644 index e3d058745..000000000 --- a/menu/mmanager.qh +++ /dev/null @@ -1,185 +0,0 @@ -/////////////////////////////////////////////// -// Menu Manager Source File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all manager constants, etc. -/////////////////////////////////////////////// -// constants - -// menu_processmous states -const float MENU_SELECT_SELECTABLE = 0; -const float MENU_SELECT_ALWAYS = 1; -const float MENU_SELECT_NEVER = 2; - -const float MENU_NORMAL = 0; -const float MENU_INGAME = 1; - -const float MENU_ENFORCELOADING = false; - -// define these menus in the menu def files or dont -// if not defined there will be added default items -const string MENU_NORMAL_NAME = "normal"; -const string MENU_INGAME_NAME = "ingame"; - -const string MENU_NORMAL_DEFAULT = -"// default normal menu\n" -"{\n" -" \"type\" \"ITEM_WINDOW\"\n" -" \"name\" \"normal\"\n" -"}"; - -const string MENU_INGAME_DEFAULT = -"// default ingame menu\n" -"{\n" -" \"type\" \"ITEM_WINDOW\"\n" -" \"name\" \"ingame\"\n" -"}"; - -// insert the files here -var string MENU_FILENAME_LIST = -"menu/normal.menu menu/background.menu menu/video.menu menu/options.menu menu/xplayer.menu"; - -const float MENU_ALLOWINGAME = FALSE; - -// globals - -entity menu_activewindow; - -// points to the lowest selected menu item (that has no child item selected) -entity menu_selected; - -// used to build up the local coord system -vector menu_localorigin; - -vector menu_clip_pos, menu_clip_size; // global clip area - -// local coord cursor -vector menu_cursor; - -float menu_automatedselection; - -/////////// -// fields -/// - -// controly type -.string type; - -// managing stuff -.entity _parent; -.string parent; - -//.entity _history; // used to set up the history -> selectdown prefers _history over _parent - -.string name; - -.entity _next, _prev; // point to the next, respectively, the previous item - -.entity _child; // points to the first child - -// updating stuff -.vector click_pos, click_size; - -.float orderpos; // if FLAG_NOSELECT or FLAG_HIDDEN is set, it cant be selected - // has to be set always to a correct value or to 0 then it is set -.float flag; - -// drawing -// the clip_* are only used by menu's (at the moment) -.vector clip_pos, clip_size; // set clip_size_x or clip_size_y to 0 to disable clipping - -.vector origin; - -// function pointers -.void(void) init; // called once at object creation -.void(void) reinit; -.void(void) destroy; -.void(void) mouse_enter; -.void(void) mouse_leave; -.void(void) refresh; -.void(void) action; -.void(void) draw; -.float(float keynr, float ascii) key; // if it returns TRUE, the key was processed by the function - -// hidden function pointers - actually these are called by the manager -// and they call the normal ones (used to make controls more generic -.void(void) _reinit; // called in performreinit -.void(void) _destroy; // called when the item is removed -> menu_removeitem -.void(void) _mouse_enter; -.void(void) _mouse_leave; -.void(void) _refresh; -.void(void) _action; -.void(void) _draw; -.void(float keynr, float ascii) _key; - -/////////////// -// prototypes -/// - -// used for global managing -void(void) menu_init; -// used to reload everything mmanager related -void(void) menu_restart; -// loads all files the file lists consists of -void(void) menu_load; -// used to reset the menu states everytime the menu is activated -void(void) menu_performreinit; - -// decide whether to toggle the menu -void(void) menu_toggle; - -// use this to add a file to the file list -void(string file) menu_addfiletolist; -// these 2 functions are pretty private, so dont call them ! -void(string file) menu_loadmenu; -void(void) menu_linkwindows; - -void(void) menu_frame; -void(void) menu_draw; -void(float keynr, float ascii) menu_keydown; -void(void) menu_shutdown; - -// used for menu handling -void(void) menu_loopnext; -void(void) menu_loopprev; -void(void) menu_selectnext; -void(void) menu_selectprev; -void(void) menu_selectup; -void(void) menu_selectdown; -void(void) menu_reselect; - -void(entity menu, float setactive) menu_jumptowindow; -void(entity menu) menu_drawwindow; - -// when selectalways is true, you can use menu_processmouse to return the last object in the -// menu list whose click rectangle fits to the cursor pos (although it only returns an item -// if that item allows events -void(entity par, float selectalways) menu_processmouse; - -float(entity e) menu_hasevents; -float(entity e) menu_isvisible; -float(entity e) menu_selectable; - -entity(string item_name) menu_getitem; - -void(entity ent) menu_removeitem; - -// history stuff -// MMANAGER_HISTORY -//.entity _prev; <- points to the previous history element -//.entity _child; <- points to the old/calling selected item -//.entity _parent; <- points to the old active window -//.entity _next; <- points to the item which the history is used for - -// points to the last element of the history -entity menu_history; - -void(entity ent) menu_pushhistory; -void(void) menu_pophistory; -float(entity ent) menu_verifyhistory; -void(void) menu_clearhistory; - -// key hook - only as long as there is no history change or the menu is closed -var void(float keynr, float ascii) menu_keyhook; - - diff --git a/menu/msys.qc b/menu/msys.qc deleted file mode 100644 index fa795bc97..000000000 --- a/menu/msys.qc +++ /dev/null @@ -1,251 +0,0 @@ -////////////////////////////////////////////////////////// -// sys globals - -entity self; - -///////////////////////////////////////////////////////// -void end_sys_globals; -///////////////////////////////////////////////////////// -// sys fields - -///////////////////////////////////////////////////////// -void end_sys_fields; -///////////////////////////////////////////////////////// -// sys functions - -void() m_init; -void(float keynr, float ascii) m_keydown; -void() m_draw; -void() m_toggle; -void() m_shutdown; - -///////////////////////////////////////////////////////// -// sys constants -/////////////////////////// -// key constants - -// -// these are the key numbers that should be passed to Key_Event -// -float K_TAB = 9; -float K_ENTER = 13; -float K_ESCAPE = 27; -float K_SPACE = 32; - -// normal keys should be passed as lowercased ascii - -float K_BACKSPACE = 127; -float K_UPARROW = 128; -float K_DOWNARROW = 129; -float K_LEFTARROW = 130; -float K_RIGHTARROW = 131; - -float K_ALT = 132; -float K_CTRL = 133; -float K_SHIFT = 134; -float K_F1 = 135; -float K_F2 = 136; -float K_F3 = 137; -float K_F4 = 138; -float K_F5 = 139; -float K_F6 = 140; -float K_F7 = 141; -float K_F8 = 142; -float K_F9 = 143; -float K_F10 = 144; -float K_F11 = 145; -float K_F12 = 146; -float K_INS = 147; -float K_DEL = 148; -float K_PGDN = 149; -float K_PGUP = 150; -float K_HOME = 151; -float K_END = 152; - -float K_KP_HOME = 160; -float K_KP_UPARROW = 161; -float K_KP_PGUP = 162; -float K_KP_LEFTARROW = 163; -float K_KP_5 = 164; -float K_KP_RIGHTARROW = 165; -float K_KP_END = 166; -float K_KP_DOWNARROW = 167; -float K_KP_PGDN = 168; -float K_KP_ENTER = 169; -float K_KP_INS = 170; -float K_KP_DEL = 171; -float K_KP_SLASH = 172; -float K_KP_MINUS = 173; -float K_KP_PLUS = 174; - -float K_PAUSE = 255; - -// -// joystick buttons -// -float K_JOY1 = 768; -float K_JOY2 = 769; -float K_JOY3 = 770; -float K_JOY4 = 771; - -// -// aux keys are for multi-buttoned joysticks to generate so they can use -// the normal binding process -// -float K_AUX1 = 772; -float K_AUX2 = 773; -float K_AUX3 = 774; -float K_AUX4 = 775; -float K_AUX5 = 776; -float K_AUX6 = 777; -float K_AUX7 = 778; -float K_AUX8 = 779; -float K_AUX9 = 780; -float K_AUX10 = 781; -float K_AUX11 = 782; -float K_AUX12 = 783; -float K_AUX13 = 784; -float K_AUX14 = 785; -float K_AUX15 = 786; -float K_AUX16 = 787; -float K_AUX17 = 788; -float K_AUX18 = 789; -float K_AUX19 = 790; -float K_AUX20 = 791; -float K_AUX21 = 792; -float K_AUX22 = 793; -float K_AUX23 = 794; -float K_AUX24 = 795; -float K_AUX25 = 796; -float K_AUX26 = 797; -float K_AUX27 = 798; -float K_AUX28 = 799; -float K_AUX29 = 800; -float K_AUX30 = 801; -float K_AUX31 = 802; -float K_AUX32 = 803; - -// -// mouse buttons generate virtual keys -// -float K_MOUSE1 = 512; -float K_MOUSE2 = 513; -float K_MOUSE3 = 514; -float K_MOUSE4 = 515; -float K_MOUSE5 = 516; -float K_MOUSE6 = 517; -float K_MOUSE7 = 518; -float K_MOUSE8 = 519; -float K_MOUSE9 = 520; -float K_MOUSE10 = 521; - -float K_MWHEELDOWN = K_MOUSE4; -float K_MWHEELUP = K_MOUSE5; - -/////////////////////////// -// key dest constants - -float KEY_GAME = 0; -float KEY_MENU = 2; -float KEY_UNKNOWN = 3; - -/////////////////////////// -// file constants - -float FILE_READ = 0; -float FILE_APPEND = 1; -float FILE_WRITE = 2; - -/////////////////////////// -// logical constants (just for completeness) - -float TRUE = 1; -float FALSE = 0; - -/////////////////////////// -// boolean constants - -float true = 1; -float false = 0; - -/////////////////////////// -// msg constants - -float MSG_BROADCAST = 0; // unreliable to all -float MSG_ONE = 1; // reliable to one (msg_entity) -float MSG_ALL = 2; // reliable to all -float MSG_INIT = 3; // write to the init string - -///////////////////////////// -// mouse target constants - -float MT_MENU = 1; -float MT_CLIENT = 2; - -///////////////////////// -// client state constants - -float CS_DEDICATED = 0; -float CS_DISCONNECTED = 1; -float CS_CONNECTED = 2; - -/////////////////////////// -// blend flags - -float DRAWFLAG_NORMAL = 0; -float DRAWFLAG_ADDITIVE = 1; -float DRAWFLAG_MODULATE = 2; -float DRAWFLAG_2XMODULATE = 3; - - -/////////////////////////// -// cvar constants - -float CVAR_SAVE = 1; -float CVAR_NOTIFY = 2; -float CVAR_READONLY = 4; - -/////////////////////////// -// server list constants - -float SLIST_CNAME = 0; -float SLIST_LINE1 = 1024; -float SLIST_LINE2 = 1025; - -float SLIST_HOSTCACHECOUNT = 0; -float SLIST_MASTERQUERYCOUNT = 2; -float SLIST_MASTERREPLYCOUNT = 3; -float SLIST_SERVERQUERYCOUNT = 4; -float SLIST_SERVERREPLYCOUNT = 5; - -/////////////////////////// -// null entity (actually it is the same like the world entity) - -entity null_entity; - -/////////////////////////// -// error constants - -// file handling -float ERR_CANNOTOPEN = -1; // fopen -float ERR_NOTENOUGHFILEHANDLES = -2; // fopen -float ERR_INVALIDMODE = -3; // fopen -float ERR_BADFILENAME = -4; // fopen - -// drawing functions - -float ERR_NULLSTRING = -1; -float ERR_BADDRAWFLAG = -2; -float ERR_BADSCALE = -3; -float ERR_BADSIZE = ERR_BADSCALE; -float ERR_NOTCACHED = -4; - -/* not supported at the moment -/////////////////////////// -// os constants - -float OS_WINDOWS = 0; -float OS_LINUX = 1; -float OS_MAC = 2; -*/ - diff --git a/menu/normal.menu b/menu/normal.menu deleted file mode 100644 index 49921457a..000000000 --- a/menu/normal.menu +++ /dev/null @@ -1,230 +0,0 @@ -/* -Property of Alientrap - -Normal main menu -*/ -{ - type ITEM_WINDOW - name main - parent normal - origin "0 0 0" -} -{ - type ITEM_WINDOW - name background - parent main - origin "0 0 0" -} -// main menu -{ - type ITEM_WINDOW - name mainmenu - parent main - origin "201 42" -} -{ - type ITEM_WINDOW - name mainframe - parent mainmenu - origin "-201 -42" - orderpos 1 -} -/* -template - -// nnn -{ - type ITEM_BUTTON - name mainframe_nnn - parent mainframe - pos "0 0" - size "185 58" - picture "gfx/m_top_nnn" - picture_selected "gfx/m_top_sel_nnn" - picture_pressed "gfx/m_top_sel_nnn" - drawflag_pressed 1 // DRAWFLAG_ADD -} -*/ -// singleplayer -{ - type ITEM_BUTTON - name mainmenu_creategame - parent mainmenu - //pos "201 17" - pos "0 0" - size "185 58" - //text "Create Game" - picture "gfx/m_top_singleplayer" - picture_selected "gfx/m_top_sel_singleplayer" - picture_pressed "gfx/m_top_sel_singleplayer" - drawflag_pressed 0 - action nex_display_creategame - sound_pressed "misc/menu2.wav" -} -// multiplayer -{ - type ITEM_BUTTON - name mainmenu_joingame - parent mainmenu - pos "185 0" - size "170 58" - //text "Join Game" - picture "gfx/m_top_multiplayer" - picture_selected "gfx/m_top_sel_multiplayer" - picture_pressed "gfx/m_top_sel_multiplayer" - drawflag_pressed 0 - //action nex_display_multiplayer - action nex_display_serverlist - sound_pressed "misc/menu2.wav" -} -// options -{ - type ITEM_BUTTON - name mainmenu_options - parent mainmenu - pos "355 0" - size "113 58" - picture "gfx/m_top_options" - picture_selected "gfx/m_top_sel_options" - picture_pressed "gfx/m_top_sel_options" - drawflag_pressed 0 - action nex_display_options - sound_pressed "misc/menu2.wav" -} -// video -{ - type ITEM_BUTTON - name mainmenu_video - parent mainmenu - pos "469 0" - size "84 58" - picture "gfx/m_top_video" - picture_selected "gfx/m_top_sel_video" - picture_pressed "gfx/m_top_sel_video" - drawflag_pressed 0 - action nex_display_video - sound_pressed "misc/menu2.wav" -} -// quit -{ - type ITEM_BUTTON - name mainmenu_quit - parent mainmenu - pos "553 0" - size "67 58" - picture "gfx/m_top_quit" - picture_selected "gfx/m_top_sel_quit" - picture_pressed "gfx/m_top_sel_quit" - drawflag_pressed 0 - action nex_quit -} -// frame windows -{ - type ITEM_PICTURE - name main_strength - parent mainframe - picture "gfx/m_strength" - pos "220 72 0" - size "577 533 0" - drawflag 1 - reinit nex_makeselfonlyvisible -} -{ - type ITEM_WINDOW - name singleplayer - parent mainframe - origin "500 175" -} -{ - type ITEM_WINDOW - name creategame - parent mainframe - //origin "350 100" - origin "210 155" -} -{ - type ITEM_WINDOW - name options - parent mainframe -} -{ - type ITEM_WINDOW - name video - parent mainframe - origin "512 200" -} -// quit window -{ - type ITEM_WINDOW - name quitbox -} -// nice hack so I dont have to change the menu manager -{ - type ITEM_REFERENCE - name quitbox_ref - parent quitbox - flag 1024 // FLAG_CHILDDRAWONLY -} -// quit stuff -{ - type ITEM_WINDOW - name quitbox_wnd - parent quitbox - origin "407 344" -} -// quit box -{ - type ITEM_RECTANGLE - name quitbox_wnd_bg - parent quitbox_wnd - color "0.0 0.0 0.1" - alpha 0.5 - drawflag 0 // DRAWFLAG_MODULATE - size "210 80" -}/* -{ - type ITEM_TEXT - name quitbox_wnd_text1 - parent quitbox_wnd - pos "10 10" -} -{ - type ITEM_TEXT - name quitbox_wnd_text2 - parent quitbox_wnd - pos "10 30" -}*/ -{ - type ITEM_TEXT - name quitbox_wnd_text - parent quitbox_wnd - text "Exit Game ?" - size "200 13" - font_size "13 13" - alignment 1 - pos "10 10" -} -// yes -{ - type ITEM_TEXTBUTTON - name quitbox_wnd_yes - parent quitbox_wnd - pos "10 50" - text "Yes" - action nex_quit_yes - key nex_quit_key - orderpos 101 -} -// no -{ - type ITEM_TEXTBUTTON - name quitbox_wnd_no - parent quitbox_wnd - pos "180 50" - text "No" - action nex_quit_no - key nex_quit_key - orderpos 100 -} - - diff --git a/menu/options.menu b/menu/options.menu deleted file mode 100644 index 5a3bdedde..000000000 --- a/menu/options.menu +++ /dev/null @@ -1,1247 +0,0 @@ -/* -Property of Alientrap - -Option menus -*/ -// side panel -{ - type ITEM_WINDOW - name opt_panel - parent options - origin "200 145" -} -// side panel entries -{ - type ITEM_TEXTBUTTON - name opt_panel_game - parent opt_panel - text "Game" - pos "0 0" -} -{ - type ITEM_TEXTBUTTON - name opt_panel_player - parent opt_panel - text "Player" - pos "0 15" - action nex_player -} -{ - type ITEM_TEXTBUTTON - name opt_panel_controls - parent opt_panel - text "Controls" - pos "0 30" - action nex_cntrl -}{ - type ITEM_TEXTBUTTON - name opt_panel_sound - parent opt_panel - text "Sound" - pos "0 45" - action nex_snd -} -{ - type ITEM_TEXTBUTTON - name opt_panel_effects - parent opt_panel - text "Effects" - pos "0 60" -} -{ - type ITEM_TEXTBUTTON - name opt_panel_colctrl - parent opt_panel - text "Color Control" - pos "0 75" - action nex_cc -} -{ - type ITEM_WINDOW - name opt_frame - parent opt_panel - origin "400 30" -} -// sub windows -{ - type ITEM_WINDOW - name options_empty - parent opt_frame - reinit nex_makeselfonlyvisible -} -// player -{ - type ITEM_WINDOW - name options_player - parent opt_frame - origin "-250 0" - init nex_player_init - reinit nex_player_reinit -} -// sound -{ - type ITEM_WINDOW - name options_sound - parent opt_frame -} -//controls -{ - type ITEM_WINDOW - name options_control - parent opt_frame - origin "-40 40" // balance out the -40 for the info texts -} -{ - type ITEM_WINDOW - name options_cc - parent opt_frame -} -// player panel -{ - type ITEM_WINDOW - name options_player_model - parent options_player - origin "0 0 0" - clip_pos "0 0 0" - clip_size "200 400" - reinit nex_player_buildlist -} -{ - type ITEM_WINDOW - name options_player_opt - parent options_player - origin "350 0" - clip_pos "200 0" - clip_size "600 400" -} -{ - type ITEM_PICTURE - name options_player_model_picture - parent options_player_model - picture "gfx/m_nomap" //TODO: rename m_nomap somewhen - pos "0 0" - //size "200 252" - size "200 263" -} -{ - type ITEM_RECTANGLE - name options_player_model_backgroundlayer - parent options_player_model - pos "0 252" - size "200 11" - color "0.6 0.6 0.6" - drawflag 2 -} -{ - type ITEM_TEXTBUTTON - name options_player_model_prev - parent options_player_model - text "<<" - pos "0 252" - action nex_player_model_prev -} -{ - type ITEM_TEXT - name options_player_model_name - parent options_player_model - pos "100.5 252" - clip_pos "22 252" - clip_size "157 263" - alignment 1 -} -{ - type ITEM_TEXTBUTTON - name options_player_model_next - parent options_player_model - text ">>" - pos "179 252" - action nex_player_model_next -} -// info box -{ - type ITEM_CUSTOM - name options_player_model_info - parent options_player_model - clip_pos "0 253" - clip_size "200 147" - pos "0 253" - size "200 147" - flag 4 // no select - drawflag 0 - color "1 1 1" - alpha 1 - font_size "9 9" - draw nex_draw_text -} -// player name -{ - type ITEM_TEXTBUTTON - name options_player_opt_playername - parent options_player_opt - text "Player Name" - pos "0 0 0" - clip_pos "10 0 0" - clip_size "154 20 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_EDITBOX - name options_player_opt_playername_switch - parent options_player_opt_playername - pos "10 0 0" - size "154 11 0" - font_size "11 11 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - text "NexuizPlayer" - maxlen 32 - refresh nex_player_name -} -// Apply (Changes) -{ - type ITEM_TEXTBUTTON - name options_player_opt_apply - parent options_player_opt - pos "20 378" - text "Apply Changes" - flag 256 - action nex_player_apply -} -////// -// CD Music Volume -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_sound_cdvolume_text - parent options_sound - text "CD Music Volume" - pos "0 0 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - reinit nex_snd_cd_init - refresh nex_snd_cd_init -} -// Slider -{ - type ITEM_SLIDER - name options_sound_cdvolume_slider - parent options_sound_cdvolume_text - pos "10 0 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "bgmvolume" - cvartype 4 // CVAR_STEP - min_value 0 - max_value 1 - step 0.1 - init nex_cvar_slider -} -// Text -{ - type ITEM_TEXT - name options_sound_cdvolume_slidertext - parent options_sound_cdvolume_text - link options_sound_cdvolume_slider - pos "120 0 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// Sound Volume -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_sound_svolume_text - parent options_sound - text "Sound Volume" - pos "0 15 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_snd_snd_init -} -// Slider -{ - type ITEM_SLIDER - name options_sound_svolume_slider - parent options_sound_svolume_text - pos "10 15 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "volume" - cvartype 4 // CVAR_STEP - min_value 0 - max_value 1 - step 0.1 - init nex_cvar_slider -} -// Text -{ - type ITEM_TEXT - name options_sound_svolume_slidertext - parent options_sound_svolume_text - link options_sound_svolume_slider - pos "120 15 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// Ambient Volume -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_sound_avolume_text - parent options_sound - text "Ambient Volume" - pos "0 30 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_snd_snd_init -} -// Slider -{ - type ITEM_SLIDER - name options_sound_avolume_slider - parent options_sound_avolume_text - pos "10 30 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "snd_staticvolume" - cvartype 4 // CVAR_STEP - min_value 0 - max_value 1 - step 0.1 - init nex_cvar_slider -} -// Text -{ - type ITEM_TEXT - name options_sound_avolume_slidertext - parent options_sound_avolume_text - link options_sound_avolume_slider - pos "120 30 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} - -// color control -{ - type ITEM_TEXTBUTTON - name options_cc_reset - parent options_cc - text "Reset to defaults" - pos "0 0" - alignment 16 - action nex_cc_reset -} -////// -// Hardware Gamma Control -//// -// Text -{ - type ITEM_TEXTBUTTON - name options_cc_hwgamma_text - parent options_cc - text "Hardware Gamma Control" - pos "0 15 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key - reinit nex_cc_check_hwgamma -} -// Switch -{ - type ITEM_TEXTSWITCH - name options_cc_hwgamma_switch - parent options_cc_hwgamma_text - pos "10 15 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - text "'Off''On'" - cvarname "v_hwgamma" - cvartype 1 // CVAR_INT - reinit nex_cvar_slider // can use it also here -} -////// -// Gamma -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_gamma_text - parent options_cc - text "Gamma" - pos "0 30 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_gamma -} -// Slider -{ - type ITEM_SLIDER - name options_cc_gamma_slider - parent options_cc_gamma_text - pos "10 30 0" - size "100 10 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_gamma" - cvartype 4 // CVAR_STEP - min_value 1 - max_value 5 - step 0.125 - init nex_cvar_slider - action nex_cc_ncolor_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_gamma_slidertext - parent options_cc_gamma_text - link options_cc_gamma_slider - pos "120 30 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// Contrast -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_contrast_text - parent options_cc - text "Contrast" - pos "0 45 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_ncolor_enable -} -// Slider -{ - type ITEM_SLIDER - name options_cc_contrast_slider - parent options_cc_contrast_text - pos "10 45 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_contrast" - cvartype 4 // CVAR_STEP - min_value 1 - max_value 5 - step 0.125 - init nex_cvar_slider - action nex_cc_ncolor_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_contrast_slidertext - parent options_cc_contrast_text - link options_cc_contrast_slider - pos "120 45 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// Brightness -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_brightness_text - parent options_cc - text "Brightness" - pos "0 60 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_ncolor_enable -} -// Slider -{ - type ITEM_SLIDER - name options_cc_brightness_slider - parent options_cc_brightness_text - pos "10 60 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_brightness" - cvartype 4 // CVAR_STEP - min_value 0 - max_value 0.8 - step 0.05 - init nex_cvar_slider - action nex_cc_ncolor_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_brightness_slidertext - parent options_cc_brightness_text - link options_cc_brightness_slider - pos "120 60 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// Color Level Controls -//// -// Text -{ - type ITEM_TEXTBUTTON - name options_cc_color_level_controls_text - parent options_cc - text "Color Level Controls" - pos "0 75 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_TEXTSWITCH - name options_cc_color_level_controls_switch - parent options_cc_color_level_controls_text - pos "10 75 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - text "'Off''On'" - cvarname "v_color_enable" - cvartype 1 // CVAR_INT - reinit nex_cvar_slider // can use it also here -} -////// -// Black: Red -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_black_red_text - parent options_cc - text "Black: Red " - pos "0 90 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_color_enable -} -// Slider -{ - type ITEM_SLIDER - name options_cc_black_red_slider - parent options_cc_black_red_text - pos "10 90 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_color_black_r" - cvartype 4 // CVAR_STEP - min_value 0 - max_value 1 - step 0.125 - init nex_cvar_slider - action nex_cc_color_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_black_red_slidertext - parent options_cc_black_red_text - link options_cc_black_red_slider - pos "120 90 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// Black: Green -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_black_green_text - parent options_cc - text "Black: Green" - pos "0 105 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_color_enable -} -// Slider -{ - type ITEM_SLIDER - name options_cc_black_green_slider - parent options_cc_black_green_text - pos "10 105 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_color_black_g" - cvartype 4 // CVAR_STEO - min_value 0 - max_value 1 - step 0.125 - init nex_cvar_slider - action nex_cc_color_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_black_green_slidertext - parent options_cc_black_green_text - link options_cc_black_green_slider - pos "120 105 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// Black: Blue -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_black_blue_text - parent options_cc - text "Black: Blue " - pos "0 120 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_color_enable -} -// Slider -{ - type ITEM_SLIDER - name options_cc_black_blue_slider - parent options_cc_black_blue_text - pos "10 120 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_color_black_b" - cvartype 4 // CVAR_STEP - min_value 0 - max_value 1 - step 0.125 - init nex_cvar_slider - action nex_cc_color_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_black_blue_slidertext - parent options_cc_black_blue_text - link options_cc_black_blue_slider - pos "120 120 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// Black: Grey -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_black_grey_text - parent options_cc - text "Black: Grey " - pos "0 135 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_color_enable -} -// Slider -{ - type ITEM_SLIDER - name options_cc_black_grey_slider - parent options_cc_black_grey_text - pos "10 135 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_color_black" - cvartype 1 // CVAR_INT - min_value 0 - max_value 1 - step 0.125 - init nex_cc_grey - action nex_cc_color_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_black_grey_slidertext - parent options_cc_black_grey_text - link options_cc_black_grey_slider - pos "120 135 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// Grey: Red -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_grey_red_text - parent options_cc - text "Grey: Red " - pos "0 150 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_grey -} -// Slider -{ - type ITEM_SLIDER - name options_cc_grey_red_slider - parent options_cc_grey_red_text - pos "10 150 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_color_grey_r" - cvartype 4 // CVAR_STEP - min_value 0 - max_value 1 - step 0.125 - init nex_cvar_slider - action nex_cc_color_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_grey_red_slidertext - parent options_cc_grey_red_text - link options_cc_grey_red_slider - pos "120 150 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// Grey: Green -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_grey_green_text - parent options_cc - text "Grey: Green" - pos "0 165 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_grey -} -// Slider -{ - type ITEM_SLIDER - name options_cc_grey_green_slider - parent options_cc_grey_green_text - pos "10 165 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_color_grey_g" - cvartype 4 // CVAR_STEO - min_value 0 - max_value 1 - step 0.125 - init nex_cvar_slider - action nex_cc_color_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_grey_green_slidertext - parent options_cc_grey_green_text - link options_cc_grey_green_slider - pos "120 165 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// Grey: Blue -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_grey_blue_text - parent options_cc - text "Grey: Blue " - pos "0 180 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_grey -} -// Slider -{ - type ITEM_SLIDER - name options_cc_grey_blue_slider - parent options_cc_grey_blue_text - pos "10 180 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_color_grey_b" - cvartype 4 // CVAR_STEP - min_value 0 - max_value 1 - step 0.125 - init nex_cvar_slider - action nex_cc_color_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_grey_blue_slidertext - parent options_cc_grey_blue_text - link options_cc_grey_blue_slider - pos "120 180 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// Grey: Grey -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_grey_grey_text - parent options_cc - text "Grey: Grey " - pos "0 195 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_grey -} -// Slider -{ - type ITEM_SLIDER - name options_cc_grey_grey_slider - parent options_cc_grey_grey_text - pos "10 195 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_color_grey" - cvartype 1 // CVAR_INT - min_value 0 - max_value 1 - step 0.125 - init nex_cc_grey - action nex_cc_color_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_grey_grey_slidertext - parent options_cc_grey_grey_text - link options_cc_grey_grey_slider - pos "120 195 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// White: Red -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_white_red_text - parent options_cc - text "White: Red " - pos "0 210 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_color_enable -} -// Slider -{ - type ITEM_SLIDER - name options_cc_white_red_slider - parent options_cc_white_red_text - pos "10 210 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_color_white_r" - cvartype 4 // CVAR_STEP - min_value 0 - max_value 1 - step 0.125 - init nex_cvar_slider - action nex_cc_color_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_white_red_slidertext - parent options_cc_white_red_text - link options_cc_white_red_slider - pos "120 210 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// White: Green -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_white_green_text - parent options_cc - text "White: Green" - pos "0 225 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_color_enable -} -// Slider -{ - type ITEM_SLIDER - name options_cc_white_green_slider - parent options_cc_white_green_text - pos "10 225 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_color_white_g" - cvartype 4 // CVAR_STEO - min_value 0 - max_value 1 - step 0.125 - init nex_cvar_slider - action nex_cc_color_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_white_green_slidertext - parent options_cc_white_green_text - link options_cc_white_green_slider - pos "120 225 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// White: Blue -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_white_blue_text - parent options_cc - text "White: Blue " - pos "0 240 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_color_enable -} -// Slider -{ - type ITEM_SLIDER - name options_cc_white_blue_slider - parent options_cc_white_blue_text - pos "10 240 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_color_white_b" - cvartype 4 // CVAR_STEP - min_value 0 - max_value 1 - step 0.125 - init nex_cvar_slider - action nex_cc_color_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_white_blue_slidertext - parent options_cc_white_blue_text - link options_cc_white_blue_slider - pos "120 240 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -////// -// White: Grey -//// -// Menu Button -{ - type ITEM_TEXTBUTTON - name options_cc_white_grey_text - parent options_cc - text "White: Grey " - pos "0 255 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_LEFTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key // redirects input to the child - refresh nex_cc_check_color_enable -} -// Slider -{ - type ITEM_SLIDER - name options_cc_white_grey_slider - parent options_cc_white_grey_text - pos "10 255 0" - size "100 8 0" - //size "100 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - cvarname "v_color_white" - cvartype 1 // CVAR_INT - min_value 0 - max_value 1 - step 0.125 - init nex_cc_grey - action nex_cc_color_enable -} -// Text -{ - type ITEM_TEXT - name options_cc_white_grey_slidertext - parent options_cc_white_grey_text - link options_cc_white_grey_slider - pos "120 255 0" - //font_size "10 10 0" - maxlen 4 - init nex_slidertext -} -// dither pattern -{ - type ITEM_PICTURE - name options_cc_pattern_pic - parent options_cc - picture "gfx/m_cc_pattern" - pos "-243.75 270" - //size "487.5 137.5" - size "501.76 143.36" -} -// control menu -// we use a special type called CONTROL_KEY -// which uses the fields : -// name has to be unique -// text description -// link command, e.g. "+attack" -// template -{ - type ITEM_TEXTBUTTON - name control_desc_template - //parent options_control - text "Template Desc" - pos "0 15" - alignment 16 // TEXT_ALIGN_RIGHT - flag 256 // FLAG_AUTOSETCLICK - refresh nex_con_update_keys - action nex_con_action_key - key nex_con_key -} -{ - type ITEM_TEXT - name control_key_template - //parent options_control - pos "100 15" - alignment 1 -} -// state message - "Press a key or mouse button to set the new bind", etc. -{ - type ITEM_TEXTSWITCH - name options_control_statemsg1 - parent options_control - text "'[Enter] Assign a new binding''Press the desired key'" - pos "-100 -40" - size "200 0" - font_size "11 11" - alignment 1 -} -{ - type ITEM_TEXTSWITCH - name options_control_statemsg2 - parent options_control - text "'[Del] Remove all bindings''[Escape] to abort'" - pos "-100 -25" - size "200 0" - font_size "11 11" - alignment 1 -} -{ - type CONTROL_KEY - name key_forward - text "Move forward" - link "+forward" -} -{ - type CONTROL_KEY - name key_back - text "Move back" - link "+back" -} -{ - type CONTROL_KEY - name key_moveright - text "Move right" - link "+moveright" -} -{ - type CONTROL_KEY - name key_moveleft - text "Move left" - link "+moveleft" -} -{ - type CONTROL_KEY - name key_attack - text "Fire Weapon" - link "+attack" -} -{ - type CONTROL_KEY - name key_SecondaryAttack - text "Secondary Attack" - link "+button3" -} -{ - type CONTROL_KEY - name key_jump - text "Jump" - link "+jump" -} -{ - type CONTROL_KEY - name key_crouch - text "Crouch" - link "+shift" -} -{ - type CONTROL_KEY - name key_weapnext - text "Next Weapon" - link "weapnext" -} -{ - type CONTROL_KEY - name key_weapprev - text "Prev Weapon" - link "weapprev" -} -{ - type CONTROL_KEY - name key_showscores - text "Show Scores" - link "+showscores" -} -{ - type CONTROL_KEY - name key_weapon1 - text "Select Laser" - link "impulse 1" -} -{ - type CONTROL_KEY - name key_weapon2 - text "Select Uzi" - link "impulse 2" -} -{ - type CONTROL_KEY - name key_weapon3 - text "Select Shotgun" - link "impulse 3" -} -{ - type CONTROL_KEY - name key_weapon4 - text "Select Grenade" - link "impulse 4" -} -{ - type CONTROL_KEY - name key_weapon5 - text "Select Electro" - link "impulse 5" -} -{ - type CONTROL_KEY - name key_weapon6 - text "Select Crylink" - link "impulse 6" -} -{ - type CONTROL_KEY - name key_weapon7 - text "Select Nexgun" - link "impulse 7" -} -{ - type CONTROL_KEY - name key_weapon8 - text "Select Hagar" - link "impulse 8" -} -{ - type CONTROL_KEY - name key_weapon9 - text "Select Rocket" - link "impulse 9" -} \ No newline at end of file diff --git a/menu/progs.src b/menu/progs.src deleted file mode 100644 index 5ddce1b93..000000000 --- a/menu/progs.src +++ /dev/null @@ -1,36 +0,0 @@ -/////////////////////////////////////////////// -// Progs file -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all file names which should be included into menu.dat -// this is absolutly beta -/////////////////////////////////////////////// -// menu.dat destination path -../data/menu.dat - -// these are the default qc header files -msys.qc -mbuiltin.qc - -//////////////////////////// -// dpmod-specific menu files -/// -// header files -menu.qh -cursor.qh -mmanager.qh -mfuncs.qh -mcontrols.qh -sound.qh -graphic.qh -mcustom.qh - -// source files -cursor.qc -menu.qc -mmanager.qc -mcontrols.qc -mfuncs.qc -sound.qc -graphic.qc -mcustom.qc // contains all custom functions especially made for 1 or 2 items diff --git a/menu/sound.qc b/menu/sound.qc deleted file mode 100644 index b46a867ed..000000000 --- a/menu/sound.qc +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////// -// Sound Source File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all manager constants, etc. -/////////////////////////////////////////////// - -void(void) snd_init = -{ - snd_loadsound(SOUND_SELECT, SOUND_ENFORCELOADING); - snd_loadsound(SOUND_INCREASE, SOUND_ENFORCELOADING); - snd_loadsound(SOUND_DECREASE, SOUND_ENFORCELOADING); - snd_loadsound(SOUND_ACTION, SOUND_ENFORCELOADING); - snd_loadsound(SOUND_STARTGAME, SOUND_ENFORCELOADING); - snd_loadsound(SOUND_ENDGAME, SOUND_ENFORCELOADING); -}; - -void(void) snd_frame = -{ -}; - -void(void) snd_toggle = -{ -}; - -void(float keynr, float ascii) snd_keydown = -{ -}; - -void(void) snd_shutdown = -{ - snd_unloadsound(SOUND_SELECT); - snd_unloadsound(SOUND_INCREASE); - snd_unloadsound(SOUND_DECREASE); - snd_unloadsound(SOUND_ACTION); - snd_unloadsound(SOUND_STARTGAME); - snd_unloadsound(SOUND_ENDGAME); -}; - -void(string sound_name) snd_play = -{ - localsound(sound_name); -}; - -string(string sound_name, float complain) snd_loadsound = -{ - string c; - - c = precache_sound(sound_name); - - if(c == "" && complain) - error("Couldn't load ", sound_name, " !\n"); - return c; -}; - -void(string sound_name) snd_unloadsound = -{ - // FIXME: there is now free/unload sound at the moment - // at least non that works the way it should -}; - diff --git a/menu/sound.qh b/menu/sound.qh deleted file mode 100644 index b9ad58a13..000000000 --- a/menu/sound.qh +++ /dev/null @@ -1,32 +0,0 @@ -/////////////////////////////////////////////// -// Sound Header File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all manager constants, etc. -/////////////////////////////////////////////// -// constants - -// complain if the vm is unable to load a file ? -const float SOUND_ENFORCELOADING = false; - -// file names -const string SOUND_SELECT = "misc/menu1.wav"; -const string SOUND_INCREASE = "misc/increasevalue.wav"; -const string SOUND_DECREASE = "misc/decreasevalue.wav"; -const string SOUND_ACTION = "misc/mouseclick.wav"; -const string SOUND_STARTGAME = "misc/startgame.wav"; -const string SOUND_ENDGAME = "misc/endgame.wav"; - -// prototypes - -void(void) snd_init; -void(void) snd_toggle; -void(float keynr, float ascii)snd_keydown; -void(void) snd_frame; -void(void) snd_shutdown; - -void(string sound_name) snd_play; - -string(string sound_name, float complain) snd_loadsound; -void(string sound_name) snd_unloadsound; - diff --git a/menu/video.menu b/menu/video.menu deleted file mode 100644 index 42de38d0f..000000000 --- a/menu/video.menu +++ /dev/null @@ -1,97 +0,0 @@ -/* -Property of Alientrap - -Video menu -*/ -////// -// Resolution -//// -// Text -{ - type ITEM_TEXTBUTTON - name video_resolution_text - parent video - text "Resolution" - pos "0 0 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_TEXTSWITCH - name video_resolution_switch - parent video_resolution_text - pos "10 0 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - init nex_video_resolution_switch -} -////// -// Bits per pixel -//// -// Text -{ - type ITEM_TEXTBUTTON - name video_bpp_text - parent video - text "Bits per pixel" - pos "0 15 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_TEXTSWITCH - name video_bpp_switch - parent video_bpp_text - pos "10 15 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - text "'16''32'" - reinit nex_video_bpp_reinit -} -////// -// Fullscreen -//// -// Text -{ - type ITEM_TEXTBUTTON - name video_fullscreen_text - parent video - text "Fullscreen" - pos "0 30 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_TEXTSWITCH - name video_fullscreen_switch - parent video_fullscreen_text - pos "10 30 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - text "'Off''On'" - reinit nex_video_fullscreen_reinit -} -///// -// Apply -/// -{ - type ITEM_TEXTBUTTON - name video_apply - parent video - pos "10 60 0" - //font_size "10 10 0" - flag 256 // FLAG_AUTOSETCLICK - text "Apply" - action nex_video_apply -} - - diff --git a/menu/xplayer.menu b/menu/xplayer.menu deleted file mode 100644 index e6dd4d9c2..000000000 --- a/menu/xplayer.menu +++ /dev/null @@ -1,638 +0,0 @@ -/* -Property of Alientrap - -Singleplayer & Multiplayer menu -*/ -/* -template for map selection -*/ -///////////////////////// -// map selection window -// frame -/*{ - type ITEM_WINDOW - name mapselection - origin "0 30" // to allow easy editing of the posititons -} -{ - type ITEM_WINDOW - name mapselection_frame - parent mapselection - origin "50 0" - clip_pos "50 0" - clip_size "500 1" - init nex_xp_build_maplist -} -// label -{ - type ITEM_TEXT - name mapselection_label - parent mapselection - pos "50 -30" - text "Map Selection" -} -// prev button -{ - type ITEM_BUTTON - name mapselection_prev - parent mapselection - picture "gfx/m_arrow" - picture_selected "gfx/m_arrow" - picture_pressed "gfx/m_arrow" - color_selected "0.5 0.5 1" - color_pressed "1 0.2 0.2" - pos "0 43.5" - size "50 50" - action nex_xp_prev -} -// next button -{ - type ITEM_BUTTON - name mapselection_next - parent mapselection - picture "gfx/m_arrow_i" - picture_selected "gfx/m_arrow_i" - picture_pressed "gfx/m_arrow_i" - color_selected "0.5 0.5 1" - color_pressed "1 0.2 0.2" - pos "550 43.5" - size "50 50" - action nex_xp_next -} -// template used to create the different pictures -{ - type ITEM_PICTURE - name mapselection_template_picture - parent mapselection_frame - picture "gfx/m_nomap" - size "125 125" - pos "-166 0 0" - flag 256 - action nex_xp_click -} -{ - type ITEM_TEXT - name mapselection_template_text - parent mapselection_frame - text template - alignment 1 - font_size "13 13 0" - pos "-110 0 0" - flag 256 - action nex_xp_click - //size "100 13 0" -} -{ - type ITEM_RECTANGLE - name mapselection_selsquare - parent mapselection_frame - color "0.9 0.9 0.6" //"^1 0.5 0.5" - drawflag 2 - //color "0.9 0.9 0" - //alpha "0.2" - size "1 1" -} -////////////////////// -// create game -// multiplayer options (spawn server) -{ - type ITEM_WINDOW - name multiplayer_frame - parent multiplayer - origin "150 250" - order 1 -} -// map selection -{ - type ITEM_REFERENCE - name multiplayer_mapselection - parent multiplayer_frame - link mapselection - origin "-300 -225" - draw nex_linkrelhack -} -// game name -{ - type ITEM_TEXTBUTTON - name multiplayer_gamename_text - parent multiplayer_frame - text "Server Name" - pos "0 0 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_EDITBOX - name multiplayer_gamename_switch - parent multiplayer_gamename_text - pos "10 0 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - text "xxx-game (.)(.)" - maxlen -1 - refresh nex_mp_hostname -} -// max frags -{ - type ITEM_TEXTBUTTON - name multiplayer_maxfrag_text - parent multiplayer_frame - text "Frag Limit" - pos "0 15 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_EDITBOX - name multiplayer_maxfrag_switch - parent multiplayer_maxfrag_text - pos "10 15 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - maxlen 3 - text "0" - refresh nex_xp_maxfrags -} -// max time -{ - type ITEM_TEXTBUTTON - name multiplayer_maxtime_text - parent multiplayer_frame - text "Time Limit" - pos "0 30 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_EDITBOX - name multiplayer_maxtime_switch - parent multiplayer_maxtime_text - pos "10 30 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - maxlen 3 - text "0" - refresh nex_xp_maxtime -} -// max clients -{ - type ITEM_TEXTBUTTON - name multiplayer_maxclients_text - parent multiplayer_frame - text "Max Clients" - pos "0 45 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_EDITBOX - name multiplayer_maxclients_switch - parent multiplayer_maxclients_text - pos "10 45 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - maxlen 2 - text "16" - refresh nex_mp_maxclients -} -// max bots -{ - type ITEM_TEXTBUTTON - name multiplayer_maxbots_text - parent multiplayer_frame - text "Max Bots" - pos "0 60 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_EDITBOX - name multiplayer_maxbots_switch - parent multiplayer_maxbots_text - pos "10 60 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - maxlen 2 - text "0" - refresh nex_xp_maxbots -} -////// -// Public Server -//// -// Text -{ - type ITEM_TEXTBUTTON - name multiplayer_publicserv_text - parent multiplayer_frame - text "Public Server" - pos "0 75 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_TEXTSWITCH - name multiplayer_publicserv_switch - parent multiplayer_publicserv_text - pos "10 75 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - text "'No''Yes'" - value 1 - switchchange nex_mp_publicserv -} -// start -{ - type ITEM_TEXTBUTTON - name multiplayer_start - parent multiplayer_frame - pos "0 105" - flag 256 // FLAG_AUTOSETCLICK - alignment 8 - text "Start Game" - action nex_mp_start -}*/ -// creategame map frame -{ - type ITEM_WINDOW - name creategame_map - parent creategame - clip_pos "0 0" - clip_size "270 445" - reinit nex_xp_enummaps -} -// << -{ - type ITEM_TEXTBUTTON - name creategame_map_prev - parent creategame_map - pos "0 0" - size "22 11" - text "<<" - action nex_xp_prev -} -// map name -{ - type ITEM_TEXT - name creategame_map_name - parent creategame_map - pos "27 0" - clip_pos "27 0" - size "216 11" - clip_size "216 11" - font_size "11 11" - text "Test" - alignment 1 // ALIGN_CENTER -} -// >> -{ - type ITEM_TEXTBUTTON - name creategame_map_next - parent creategame_map - pos "248 0" - size "22 11" - text ">>" - action nex_xp_next -} -// map picture -{ - type ITEM_PICTURE - name creategame_map_picture - parent creategame_map - pos "0 11" - size "270 232" - picture "gfx/m_nomap" -} -// info box -{ - type ITEM_CUSTOM - name creategame_map_info - parent creategame_map - clip_pos "0 243" - clip_size "270 202" - pos "0 243" - size "270 202" - flag 4 // no select - drawflag 0 - color "1 1 1" - alpha 1 - font_size "9 9" - draw nex_draw_text -} - -// creategame options frame -{ - type ITEM_WINDOW - name creategame_opt - parent creategame - origin "436 0" //270+175 - clip_pos "270 0" - clip_size "350 445" -} -////// -// Server Name -//// -// Text -{ - type ITEM_TEXTBUTTON - name creategame_opt_server_name_text - parent creategame_opt - text "Server Name" - pos "0 0 0" - origin "0 0 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Editbox -{ - type ITEM_EDITBOX - name creategame_opt_server_name_edit - parent creategame_opt_server_name_text - //pos "10 0 0" - pos "10 0 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - text "xxx-game (.)(.)" //please remove this somewhen - I dont have the power to ^_^ - maxlen 15 - refresh nex_xp_hostname -} -////// -// Game Mode -//// -// Text -{ - type ITEM_TEXTBUTTON - name creategame_opt_gamemode_text - parent creategame_opt - text "Game Mode" - pos "0 15 0" - origin "0 15 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_TEXTSWITCH - name creategame_opt_gamemode_switch - parent creategame_opt_gamemode_text - //pos "10 15 0" - pos "10 0 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - text "'Deathmatch' 'Instagib' 'DarkArena' 'HeadHunter' 'SlowMo' 'Speedy' 'GrapplingHook'" - value 0 - switchchange nex_xp_gamemode -} -// max frags -{ - type ITEM_TEXTBUTTON - name creategame_opt_maxfrag_text - parent creategame_opt - text "Frag Limit" - pos "0 30 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_EDITBOX - name creategame_opt_maxfrag_switch - parent creategame_opt_maxfrag_text - pos "10 30 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - maxlen 3 - text "0 " - refresh nex_xp_maxfrags -} -// max time -{ - type ITEM_TEXTBUTTON - name creategame_opt_maxtime_text - parent creategame_opt - text "Time Limit" - pos "0 45 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_EDITBOX - name creategame_opt_maxtime_switch - parent creategame_opt_maxtime_text - pos "10 45 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - maxlen 3 - text "0 " - refresh nex_xp_maxtime -} -// max bots -{ - type ITEM_TEXTBUTTON - name creategame_opt_maxbots_text - parent creategame_opt - text "Bot Count" - pos "0 60 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_EDITBOX - name creategame_opt_maxbots_switch - parent creategame_opt_maxbots_text - pos "10 60 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - maxlen 2 - text "0 " - refresh nex_xp_maxbots -} -////// -// Skill Level -//// -// Text -{ - type ITEM_TEXTBUTTON - name creategame_opt_skilllevel_text - parent creategame_opt - text "Skill Level" - pos "0 75 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_TEXTSWITCH - name creategame_opt_skilllevel_switch - parent creategame_opt_skilllevel_text - pos "10 75 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - text "'N00b' 'Normal' 'Hard' 'Masochist'" - value 1 - switchchange nex_xp_skilllevel - init nex_xp_skilllevel -} -// max clients -{ - type ITEM_TEXTBUTTON - name creategame_opt_maxclients_text - parent creategame_opt - text "Max Clients" - pos "0 90 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_EDITBOX - name creategame_opt_maxclients_switch - parent creategame_opt_maxclients_text - pos "10 90 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - maxlen 2 - text "16" - refresh nex_xp_maxclients -} -////// -// Public Server -//// -// Text -{ - type ITEM_TEXTBUTTON - name creategame_opt_publicserv_text - parent creategame_opt - text "Public Server" - pos "0 105 0" - //font_size "10 10 0" - alignment 16 // TEXT_ALIGN_RIGHTPOS - flag 256 // FLAG_AUTOSETCLICK - key nex_redirect_key -} -// Switch -{ - type ITEM_TEXTSWITCH - name creategame_opt_publicserv_switch - parent creategame_opt_publicserv_text - pos "10 105 0" - //font_size "10 10 0" - flag 260 // FLAG_AUTOSETCLICK | FLAG_NOSELECT - text "'No''Yes'" - value 1 - switchchange nex_xp_publicserv -} -// start -{ - type ITEM_TEXTBUTTON - name creategame_opt_start - parent creategame_opt - pos "0 130" - flag 256 // FLAG_AUTOSETCLICK - alignment 8 - text "Start Game" - action nex_xp_start -} - -// multiplayer server list -{ - type ITEM_WINDOW - name serverlist -} -// link the background_rect -{ - type ITEM_PICTURE - name serverlist_background - picture "gfx/m_slist_bg" - parent serverlist -} -// info text 1 -{ - type ITEM_TEXT - name serverlist_info1 - parent serverlist - text "" // "INFO TEXT 1" - pos "0 20" - size "1024 11" - font_size "11 11" - alignment 1 - refresh slist_info1 - flag 0 -} -{ - type ITEM_TEXT - name serverlist_info2 - parent serverlist - text "" //"INFO TEXT 2" - pos "0 32" - font_size "11 11" - size "1024 11" - alignment 1 - refresh slist_info2 - flag 0 -} -// clip rect for the slist -{ - type ITEM_WINDOW - name serverlist_cliprect - parent serverlist - flag 512 - size "940 600" - origin "50 50" -} -{ - type ITEM_CUSTOM - name serverlist_slist - parent serverlist_cliprect - draw slist_draw - init slist_init - key slist_key - refresh slist_refresh - flag 256 //FLAG_AUTOSETCLICK - - font_size "11 11" - - // this specifies the text bar drawing behavior - color "1 1 1" - alpha 1 - drawflag 0 - - //this specifies the selection bar drawing behavior - color_selected "1 0 0" - alpha_selected 0.2 - drawflag_selected 0 -} - diff --git a/qcsrc/Makefile b/qcsrc/Makefile deleted file mode 100644 index 25c71afe4..000000000 --- a/qcsrc/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -.PHONY: ../../data/progs.dat -../../data/progs.dat: - frikqcc /O2 -warn 2 || true - -clean: - rm -f ../../data/progs.dat progdefs.h error.log diff --git a/qcsrc/Nexuiz.dsp b/qcsrc/Nexuiz.dsp deleted file mode 100644 index 45fe4d757..000000000 --- a/qcsrc/Nexuiz.dsp +++ /dev/null @@ -1,281 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Game code" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Game code - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "GameC.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "GameC.mak" CFG="Game code - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Game code - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Game code - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Game code - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Game_code___Win32_Release" -# PROP BASE Intermediate_Dir "Game_code___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Game_code___Win32_Release" -# PROP Intermediate_Dir "Game_code___Win32_Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAMECODE_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAMECODE_EXPORTS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 - -!ELSEIF "$(CFG)" == "Game code - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAMECODE_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAMECODE_EXPORTS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Game code - Win32 Release" -# Name "Game code - Win32 Debug" -# Begin Group "Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\builtins.h -# End Source File -# Begin Source File - -SOURCE=.\constants.h -# End Source File -# Begin Source File - -SOURCE=.\defs.h -# End Source File -# Begin Source File - -SOURCE=.\extensions.h -# End Source File -# Begin Source File - -SOURCE=.\sys.h -# End Source File -# End Group -# Begin Group "Source Files" - -# PROP Default_Filter "" -# Begin Group "client" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\cl_aliases.c -# End Source File -# Begin Source File - -SOURCE=.\cl_client.c -# End Source File -# Begin Source File - -SOURCE=.\cl_impulse.c -# End Source File -# Begin Source File - -SOURCE=.\cl_physics.c -# End Source File -# Begin Source File - -SOURCE=.\cl_player.c -# End Source File -# Begin Source File - -SOURCE=.\cl_weaponanimations.c -# End Source File -# Begin Source File - -SOURCE=.\cl_weaponsystem.c -# End Source File -# End Group -# Begin Group "server" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\sv_main.c -# End Source File -# Begin Source File - -SOURCE=.\sv_stats.c -# End Source File -# End Group -# Begin Group "frikbot" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\bot.c -# End Source File -# Begin Source File - -SOURCE=.\bot_ai.c -# End Source File -# Begin Source File - -SOURCE=.\bot_ed.c -# End Source File -# Begin Source File - -SOURCE=.\bot_fight.c -# End Source File -# Begin Source File - -SOURCE=.\bot_maps.c -# End Source File -# Begin Source File - -SOURCE=.\bot_misc.c -# End Source File -# Begin Source File - -SOURCE=.\bot_move.c -# End Source File -# Begin Source File - -SOURCE=.\bot_phys.c -# End Source File -# Begin Source File - -SOURCE=.\bot_way.c -# End Source File -# End Group -# Begin Group "game" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\g_casings.c -# End Source File -# Begin Source File - -SOURCE=.\g_damage.c -# End Source File -# Begin Source File - -SOURCE=.\g_decors.c -# End Source File -# Begin Source File - -SOURCE=.\g_subs.c -# End Source File -# Begin Source File - -SOURCE=.\g_tetris.c -# End Source File -# Begin Source File - -SOURCE=.\g_triggers.c -# End Source File -# Begin Source File - -SOURCE=.\g_violence.c -# End Source File -# Begin Source File - -SOURCE=.\g_world.c -# End Source File -# End Group -# Begin Group "map" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\t_halflife.c -# End Source File -# Begin Source File - -SOURCE=.\t_items.c -# End Source File -# Begin Source File - -SOURCE=.\t_jumppads.c -# End Source File -# Begin Source File - -SOURCE=.\t_plats.c -# End Source File -# Begin Source File - -SOURCE=.\t_quake.c -# End Source File -# Begin Source File - -SOURCE=.\t_quake3.c -# End Source File -# Begin Source File - -SOURCE=.\t_teleporters.c -# End Source File -# End Group -# Begin Group "weapons" - -# PROP Default_Filter "" -# End Group -# End Group -# Begin Source File - -SOURCE=..\progs.src -# End Source File -# Begin Source File - -SOURCE=..\todo.txt -# End Source File -# End Target -# End Project diff --git a/qcsrc/Nexuiz.dsw b/qcsrc/Nexuiz.dsw deleted file mode 100644 index 80c73ac6f..000000000 --- a/qcsrc/Nexuiz.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Game code"=.\gamec\GameC.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/qcsrc/Nexuiz.opt b/qcsrc/Nexuiz.opt deleted file mode 100644 index 283583a32e803543f0fcc2e09c03527df5ac1996..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 60928 zcmeHQS!^81c^*>7Qpf6A?V&w;C9Rg)9db!Zt6gc2>~N+@jXazg&kRK|X54Phw1zFs zK~MK+sNHN}7zyG>=go)#!$BVWX25`vw>%~f&O@?5-sAYuPXPkt0Fo%*U)|M5O*cg; zy=ob$B7Rm+U4PZzb$1N z2T?epZ{WEES^r31=;}p0qENx4fGw54%!4Y zK`oF0x(#ZBwm>H64(KkZ1L}f$pgw3D^j**ZWPxnZ5JdUdtEnNSK4K~;c@Op=a~~<} z-MoMr!+A|UB-&?R6$by*_?rpJ9}l_)?gNz0LTPkJ!9Y&x$cGLhSv<@rnMqbhsqRuf z9u}VbSw5+N~+n>Elcac>EhvYE#tP?Gn9gwFXd{gRwP5)mo*h)*9Y zTs60>77KMJNKA>4UPH|{w54J>SJLv8a=lSo%{L;lhcXx8x$Y#FRkqDmR=LOi_vrC< zM{ir>8R5~inp&@{*7A`e8w*q{L`ko%){42(uH~sWa*bjh%$&^b$~7)*H1nH9bxorv ztMzHi*6pFS6kX!AazR6Nsn@61daXRwrgCIuqHuVNYHd7lR;dikc3gD4D;2M5WhGaJ zn6irXdA{H6>b+J_`X#EOs#aLVYb}-=YHcY8+4nc8VX#bPmDW)2utz_hN_nr8%cv5? zN?Aj7ZA^FiO&(79Qt4_t=g#>~A1Sv7rqOFDtR5=2LVjNRp=853Ni=D%e95JH3lc;5 zYn8lOuWO}BK2-0rirF%Hw$r8*W5+fIJtenvODmvTQ1%qdm(8t)RxjtO#qx?;UPawA z1Mji8QZ1=)Z#d#pYqd(PSYE1xU*y0vTXoj0`EN21bG@8fDdq#sCaY}fmZ7m%CiDxT zX!)9oI`pU!D zq?t5IjrD3+0A|ZtwTwaI{Y$II z)GARA@v&c>J`FUFkGzUrU9G9gC(4}X5L@dT*Nb)KUf*naLCHn)f7O1P{ffrw%mmEj z#8hTou?P2+FT4=>TqA!yBy!^-I&m!-^)PzA~1w6E!kb zf26Bm5Q$;I165fVfgShMnC}?xus356kr5TcO}S1ZuG1#8a;2bBKOdPRFSHZb3meLr z7f4J}$YN}`xV$bEOBfp?Gv<1Q^5M7%Oao~|NMohG9GN`1hth_FkT8!Lk!oe}22FHn z?kzS2*DI8^<0d2@NF#y+W=px~YU=oe(q~RW@_qtQsbfYTnS1ox)v#R1MNFEG9uA{() z2W3mP@!qdqEPo@iFw7&IK7xvg^Vm`OXH&vPrBYhV)ry5^CPJ7nzp$ssI_%4mkI2Pp z6*F2@TP;TNcYNU)V(i5cSbFYp%yM~}Y**aAC9Cv?U17}fLU4wY82$+l`QZ=$aboJk z-%hYmjE55VbLTkr828oXN^RZscNR2!u;hM1nnIkh(UGcjU5)N_xF0VI%e(6+u;D?e z7Ag_13H~>W1@y|hjQ2c@8${$9j6cpj=o=?LXEbuxr7RHErkh1e#qy|UVX`B<%y9Tn zenMVCZbE)>c?qmxS*Mo0FE9@T2yyn^fp9pJqTsyJnGbn`dQ7iSDAubq5p;zh^7gz# zoVjZ(UmhT?%<4^ACq@_7@eA=|PO;4V#3HI2^YpvEG2#0D;~Xj4?p(cuBRKmjeW#rJ z{4YAR9+3DSM=Ghukoe!a#Q!Az_gH|X#QzHG

y00G@pG$OjHRbS{9iWL=O{;(rV? zl=vTgRdZ%?5vaGs|0Mp$KfQ94F&bFGY9qY(goChNpdc~xbbqq%pm)yXId-KW@jrr; z1K6F2qe=Wv;(rcU7}MbRswA?ZN&L@IHgS49XKrm?dalJlIUq$%7 zfe+GB|4-`wc^c7Uif0o4llp&B|Ib;sd75|uEj*@6xOXtmQ$O5$6pyRa|8q1LCH}`2 zGO>Dn0z4WUE^e72@xM69`09HiFzWb(7DLQQco%*G5sNOG(MRHD%p;sOf{ID=*fA-4 zT6<$zM?|Ur7x&8jMX>PIV0`sUF2YOkVn@6biT_FcKeqRf26$@XT#Zob|IuElpqgPs z>k%-zafm7qAk=mG?y=CAA0)0<2qAUjygly_XYLxymj{UB>O*$pEFHfPKjsw6%ug&r zy3Et-ykfYG_kdos-MM-RM{pMP|DyI^uVF`W5Brj7U-ZMwS?oWivjUvm$9vm<{3a#p z?msSK7kv@C;g_-FyUTWeH^H~Hr@h~l%&XYV&3W&2|MR;M{K@HY%;Cr2|2{Et%b&-t zejU5dEu0!)qST{|g0ll2N&b&q{@)Am--rF*hiLmY+xvZp?QXki8lwXrtCiZP!T%?{ zP|h|e!*YD%+^3ezj^QVztn~+Xt!=$&C~ue9uJX69Df5cE(|p>xc-&9_Hey;wuN!*H z7$}sCb=29N>HIj@>|n>NeGt0{?-_$|mcJ zg`aIY86J0eXx@Ty5Xyy-MehF=_KM5>-*W%A)c=(FpV%%a_kYtC_uyd%{FDQ^|6ANU z?jf-f|K+>pDsum~H8Fe17C+yDL|_kYtz5Q2*YsF8uhG3rX> zC-Gmo|2v{%3h&t#J0iLNTkiiRrL&;MauAr6`@iY1kulv<56BJSvD`Hl9OVHd{)?0B zm=Jcd-}$Yh`1zubzRf6WX7AF1QZP1$ZH5iHM>|es=)5XA|1K`{nekL=M#sQeTLd}A z#iH{ketUq_PstpdI$f_X)}W4hB$IFGgSKH8ZKE3(IS?g;7*62WT9)1AL4UaICVF7% zbm7KY2uzF&=OT=eeoh)L__#|5j!W(mgh7_O_!FABi#G>4cM0NTHuztj|A>XRJpa)@ zg^X6+{#PMrP$Z+UD)B#w|4IDMJ*-pWe|tGQQsRH&`Vg8D>}<%;JlAy;@ChC?2BP4b zxW_rj{ofM*llWiw5Cn<;;UHCc{v+whc^k-u{x(XzRN{Z~{6}_Pv`|;joyhYa{V_)B ze|n0XE(#|eaOwMpW`3S?EX3)Bh{HJjl|D@ref%%__8QXXgjSuz|Hd#xiT~j?AG!Zq z?*ERvutws4691Fizjp49*27wLHDUUK*!zyJBc1Ez16@8DA2R=v~T^fv{Qh8?@wS?d3hVxrXl^KSE& z_@Bi8B>oq^>E6G_MdE)F|C9Ki#Q%b4%16xlgNl11uEPC7ppEM&05?3S)c+%`9eMvV z`@AolsVDJ2N8dsa3)|WoYGP9VPwM}DjIBbRE z$oro|2Q$k3zjFWYj&kj5#QzF7b8s^=%(U@mWCn!wJ(4-~80R0}AP(;NhXtJW*aUw% z`>~g?aSr06nbSCbatcunfcAR+V}n=}=wCACQO}=DhO3{-|Aqfy-2dYkF1`Kud2mg) zn_KhzVSztf;t!WOciOe>?-rN)zkP&Q?*DE%D&PD@^_xX?jj4>T)~797w}<%Dptmjm z1{5A}4Lg$arChx}z1C~76G_WJ5u(G@SMlY2JaAU249s?1bh-cAlKa0m=^zVMyRyo_ zG+WLIvwkfL0lB%AVm@>m_a3hCmiVv4eE#yEHd&&x?jb5v|$gg)c5${_x6`s~;9-E?-p_XXfYgOEZg0m#@ss z&E;})bC>h;3+lp`nM~GAgpf*(l>QeUegh)EYoMP11RdZQ%DI$f@R!KTUxQu_*mz{- zxu6Vgo9!)JXp@K#{us&s9Q1Fl5Z+5!2vk}HbTnY&k(n2{5NyrH!J^y!fo%+ustt=^ zu?G63D~MS^5aoW4onz``1si}@{pc@Cp~cAeKzIdQ+^cC3jrIC%$(-Mx3w+3bGu{SHWKOzI0r6;cb@_&@H~lj zcueTuOG*afnDEZ;iVU{5&>E8I3~oW#Ht1JwYq*%Q48D!L{2^#AVB?XQlYVP3aZYqn zA`q*=bjl*2q7%{7fZMG6u*d#7I1u{5{^3qh9+f;rso(yd5yF>l1aVepCAj;sar$7dD`RGLu zx2gPO0^I_WK|&(vA?ZH@{o3sr&!;Q`D)xEM>j4{&%mhTR-O=r&dPZ@*a4uyL97kba zb&Jex_ov?y*uv4Ynh8|{o<5%_olRK=JU>ykR}Dx8BmI6tBA}V+YoH&vE#b|SML^Yn z=v2VQBQsuy*v7Ka9+*irg+-(uTrnys%fKyeq;-N%655(I+)PRWoK+vS;4YSpZ=@^% z>IaFGfQ?6H0=1xJH2aC+2I83Tddf1e@E&$RG&SJ1D}s!-b~JWuqi318Cpn=N^q+&p z-+_)ofsnAY*HV@OFL9LZwFT-Dbu*zJQIx=|DNA4mMPCG+3D{g39-7$Jn!087fFvce zbQEU?uLweT(jXcYm=uI*Sl~9fkvTlOVfS18S$oG$1W9#LMfG=w#FvG#KWPl@TN9bg zAA!hl+xZ3kYkxSvfY@#)2cwEB=QAlw;dvC9ki>TaHkX1oHyQy-YwJlZm}x{HI);is zVCqXLi{MSSqL;Oz^5)YHQ+XW zGIN}_hLP4Yb`lZ*EtiS@!xg{_DGOi~d1O{YByTg+y3xEn+1pfc0Gb28j^eg%3;>z+oNU6X1Z;w*A1Wf`2sWNsEj-yzASStU1~nif#jgsK1y zmcb7$&!k*@Dk{P3WVr483VeY^73k__Qe!1go`Z}Bp8^r^Jc+h9R<`yL8s5|qqXa(0-%ku(;hn)D%+=`Q+y0b=fa4)DAAybq zY%T<^DtJR>l3ikOSlE}c6zH={0n`fETngRL@}ilPSyKU$B5U$(p5a za~XJ;ds`dz2c1^JJp!LSPoyjYLYZjJ_({O#BJdhRTf1lWJ4UaWR7K$ZBA0?QN#lGo znJ4`Tion*9%bwdjH^F|f*)fgYqs|gg!PxON; time) - return; - self.switch_wallhug = 0; - - b_temp2 = nextent(world); - cno = 0; - - while (cno < max_clients) - { - if ((!b_temp2.ishuman) && (active_clients & ClientBitFlag(cno))) - UpdateClient(b_temp2); - cno = cno + 1; - b_temp2 = nextent(b_temp2); - } -}; - -void() ClientInRankings = -{ - local float cno; - if (player_head) - player_head._last = self; - - self._next = player_head; - self._last = world; - player_head = self; - - if (!self.phys_obj) - { - b_temp2 = phys_head; - while (b_temp2 != world && b_temp2.owner != self) - b_temp2 = b_temp2._next; - self.phys_obj = b_temp2; - } - - if (self.ishuman == 2) - { - self.ishuman = FALSE; - return; - } - cno = self.colormap - 1; - BotInvalidClientNo (cno); - active_clients = active_clients | ClientBitFlag(cno); - - self.b_clientno = cno; - self.ishuman = TRUE; - self.switch_wallhug = time + 1; -}; - - -void() ClientDisconnected = -{ - if (player_head == self) - player_head = self._next; - if (self._next) - self._next._last = self._last; - if (self._last) - self._last._next = self._next; - - active_clients = active_clients - active_clients & ClientBitFlag(self.b_clientno); -}; -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -BotPreFrame & BotPostFrame, used to make the -bot easier to install - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ -float () BotPreFrame = -{ - if (self.b_clientno == -1) - return TRUE; - if (self.ishuman) - { - if (self.switch_wallhug) - ClientFixRankings(); - if (self.classname == "botcam") - return TRUE; - } - if (self.b_frags != self.frags) - { - - if (self.b_frags > self.frags) - { - if (pointcontents(self.origin) == CONTENT_LAVA) - bot_start_topic(10); - else - bot_start_topic(9); - } - else - bot_start_topic(2); - self.b_frags = self.frags; - } - DynamicWaypoint(); - return FALSE; -}; -float () BotPostFrame = -{ - if (self.b_clientno == -1) - return TRUE; - if (self.ishuman) - { - - if (waypoint_mode > WM_LOADED) - bot_menu_display(); - - BotImpulses(); - - if (botcam()) - return TRUE; - } - return FALSE; -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Bot Chat code - -The rest of this code is in bot_misc.qc - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ -void(string h) BotSay = // simulate talking by composing a 'chat' message -{ - WriteByte(MSG_ALL, 8); - WriteByte(MSG_ALL, 1); - WriteString(MSG_ALL, self.netname); - WriteByte(MSG_ALL, 8); - WriteByte(MSG_ALL, 2); - WriteString(MSG_ALL, h); -}; -void() BotSayInit = -{ - WriteByte(MSG_ALL, 8); - WriteByte(MSG_ALL, 1); - WriteString(MSG_ALL, self.netname); -}; -void(string h) BotSay2 = -{ - WriteByte(MSG_ALL, 8); - WriteByte(MSG_ALL, 2); - WriteString(MSG_ALL, h); -}; -void(string h) BotSayTeam = -{ - local entity t; - if (!teamplay) - return; - t = player_head; - while(t) - { - if (t.team == self.team) - { - msg_entity = t; - WriteByte(MSG_ONE, 8); - WriteByte(MSG_ONE, 1); - WriteByte(MSG_ONE, 40); - WriteString(MSG_ONE, self.netname); - WriteByte(MSG_ONE, 8); - WriteByte(MSG_ONE, 2); - WriteByte(MSG_ONE, 41); - WriteString(MSG_ONE, h); - } - t = t._next; - } -}; -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -BotInit - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - - -void() BotInit = -{ - local entity ent, fisent; - local float numents; - - // spawn entities for the physics - ent = nextent(world); - max_clients = 0; - - while(ent != world) - { - max_clients = max_clients + 1; - ent = nextent(ent); - } - if (max_clients > 16) - max_clients = 16; - - ent = nextent(world); - fisent = world; - while (numents < max_clients) - { - - phys_head = spawn(); - if (fisent) - fisent._next = phys_head; - phys_head._last = fisent; - fisent = phys_head; - ent.phys_obj = phys_head; - phys_head.classname = "phys_obj"; - phys_head.owner = ent; - numents = numents + 1; - ent = nextent(ent); - } - precache_model("progs/s_light.spr"); - precache_model("progs/s_bubble.spr"); - // the bots return! - b_options = cvar("saved1"); - if (coop || (b_options & OPT_SAVEBOTS)) - { - saved_bots = cvar("scratch1"); - saved_skills1 = cvar("scratch2"); - saved_skills2 = cvar("scratch3"); - } - cvar_set ("saved4", "0"); - if (max_clients > 1) - { - localcmd("exec maps/"); - localcmd(mapname); - localcmd(".way\n"); - waypoint_mode = WM_DYNAMIC; - bot_map_load(); - } - else - waypoint_mode = WM_LOADED; - -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Rankings 'utilities'. Written by Alan Kivlin, -this code just fools clients by sending precisely -the same network messages as when a real player -signs on to the server. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - - -void(entity who) UpdateClient = -{ - WriteByte (MSG_ALL, SVC_UPDATENAME); - WriteByte (MSG_ALL, who.b_clientno); - WriteString (MSG_ALL, who.netname); - WriteByte (MSG_ALL, SVC_UPDATECOLORS); - WriteByte (MSG_ALL, who.b_clientno); - WriteByte (MSG_ALL, who.b_shirt * 16 + who.b_pants); - WriteByte (MSG_ALL, SVC_UPDATEFRAGS); - WriteByte (MSG_ALL, who.b_clientno); - WriteShort (MSG_ALL, who.frags); -}; - -float(float clientno) ClientBitFlag = -{ - // bigger, but faster - if (clientno == 0) - return 1; - else if (clientno == 1) - return 2; - else if (clientno == 2) - return 4; - else if (clientno == 3) - return 8; - else if (clientno == 4) - return 16; - else if (clientno == 5) - return 32; - else if (clientno == 6) - return 64; - else if (clientno == 7) - return 128; - else if (clientno == 8) - return 256; - else if (clientno == 9) - return 512; - else if (clientno == 10) - return 1024; - else if (clientno == 11) - return 2048; - else if (clientno == 12) - return 4096; - else if (clientno == 13) - return 8192; - else if (clientno == 14) - return 16384; - else if (clientno == 15) - return 32768; - return 0; -}; - -float() ClientNextAvailable = -{ - local float clientno; - - clientno = max_clients; - while(clientno > 0) - { - clientno = clientno - 1; - - if(!(active_clients & ClientBitFlag(clientno))) - return clientno; - } - - return -1; -}; - - -void(entity e1, entity e2, float flag) DeveloperLightning = -{ - // used to show waypoint links for debugging - WriteByte (MSG_BROADCAST, 23); - if (flag) - WriteByte (MSG_BROADCAST, 6); - else - WriteByte (MSG_BROADCAST, 13); - WriteEntity (MSG_BROADCAST, e2); - WriteCoord (MSG_BROADCAST, e1.origin_x); - WriteCoord (MSG_BROADCAST, e1.origin_y); - WriteCoord (MSG_BROADCAST, e1.origin_z); - WriteCoord (MSG_BROADCAST, e2.origin_x); - WriteCoord (MSG_BROADCAST, e2.origin_y); - WriteCoord (MSG_BROADCAST, e2.origin_z); -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Find Another Color - -Team finding code - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -float(float tcolor) FindAnotherColor = -{ - local float bestbet, scolor, pcount, bestp; - bestbet = -1; - bestp = 16; - while(scolor < 14) - { - if (scolor != tcolor) - { - b_temp2 = player_head; - pcount = 0; - while(b_temp2 != world) - { - if (b_temp2.team == scolor + 1) - pcount = pcount + 1; - b_temp2 = b_temp2._next; - } - if ((pcount < bestp) && pcount) - { - bestbet = scolor; - bestp = pcount; - } - } - scolor = scolor + 1; - } - if (bestbet < 0) - { - bestbet = tcolor; - while (bestbet == tcolor) - { - bestbet = floor(random() * 13); - } - } - return bestbet; -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -BotConnect and related functions. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ -entity(float num) GetClientEntity = -{ - local entity upsy; - upsy = world; - num = num + 1; - while (num > 0) - { - num = num - 1; - upsy = nextent(upsy); - } - return upsy; -}; - -void(float whichteam, float whatbot, float whatskill) BotConnect = -{ - local float f; - local string h; - local entity uself; - - f = ClientNextAvailable(); - uself = self; - if(f == -1) - { - bprint("Unable to connect a bot, server is full.\n"); - return; - } - - // chat thing - - active_clients = active_clients | ClientBitFlag(f); - bot_count = bot_count + 1; - self = GetClientEntity(f); - if (!saved_bots) - bot_start_topic(1); - self.b_clientno = f; - self.colormap = f + 1; - if (whatbot) - self.netname = BotName(whatbot); - else - self.netname = PickARandomName(); - - - // players can set skill all weird, so leave these checks in - whatskill = rint(whatskill); - if (whatskill > 3) - whatskill = 3; - else if (whatskill < 0) - whatskill = 0; - self.b_skill = whatskill; - - if (teamplay && !coop) - { - if (whichteam) - self.b_pants = FindAnotherColor(uself.team - 1); - else - self.b_pants = uself.team - 1; - self.b_shirt = self.b_pants; - } - - self.team = self.b_pants + 1; - UpdateClient(self); - SetNewParms(); - self.ishuman = 2; - ClientConnect(); - PutClientInServer(); - - // this is risky... could corrupt .way files if done wrong - // If you're not the gambling type, comment this out - - f = ClientBitFlag(self.b_num - 1); - current_bots = current_bots | f; - - if (self.b_num <= 8) - saved_skills1 = (saved_skills1 & (65536 - (3 * f)) | (self.b_skill * f)); - else - { - f = ClientBitFlag(self.b_num - 9); - saved_skills2 = (saved_skills2 & (65536 - (3 * f)) | (self.b_skill * f)); - } - - h = ftos(current_bots); - cvar_set("scratch1", h); - h = ftos(saved_skills1); - cvar_set("scratch2", h); - h = ftos(saved_skills2); - cvar_set("scratch3", h); - self = uself; - -}; - -void(entity bot) BotDisconnect = -{ - local string h; - local entity uself; - uself = self; - self = bot; - - bot_count = bot_count - 1; - current_bots = current_bots - (current_bots & ClientBitFlag(self.b_num - 1)); - h = ftos(current_bots); - cvar_set("scratch1", h); - - - ClientDisconnect(); - - if (self.b_clientno != -1) - { - // the bot's client number is not in use by a real player so we - // must remove it's entry in the rankings - // Quake engine sets all fields to 0, can only do the most important here - self.b_frags = self.frags = 0; - self.netname = ""; - self.classname = ""; - self.health = 0; - self.items = 0; - self.armorvalue = 0; - self.weaponmodel = ""; - self.b_pants = 0; - self.b_shirt = 0; - self.ammo_shells = self.ammo_nails = self.ammo_rockets = self.ammo_cells = 0; - UpdateClient(self); - active_clients = active_clients - (active_clients & ClientBitFlag(self.b_clientno)); - self.b_clientno = -1; - } - self = uself; -}; -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -BotInvalidClientNo -kicks a bot if a player connects and takes the bot's space - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void(float clientno) BotInvalidClientNo = -{ - local entity bot; - - bot = GetClientEntity(clientno); - if(bot.b_clientno > 0) - { - if (!bot.ishuman) - { - bot.b_clientno = -1; - BotDisconnect(bot); - active_clients = active_clients | ClientBitFlag(self.b_clientno); - BotConnect(0, bot.b_num, bot.b_skill); - return; - } - } -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Waypoint Loading from file - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ -void() LoadWaypoint = -{ - local vector org; - local entity tep; - local float r; - org_x = cvar("saved1"); - org_y = cvar("saved2"); - org_z = cvar("saved3"); - - tep = make_waypoint(org); - - r = cvar("saved4"); - - tep.b_aiflags = floor(r / 4); - tep.b_pants = cvar("scratch1"); - tep.b_skill = cvar("scratch2"); - tep.b_shirt = cvar("scratch3"); - tep.b_frags = cvar("scratch4"); -}; - -void() bot_return = -{ - if (time > 2) - { - if ((waypoint_mode == WM_DYNAMIC) || (waypoint_mode == WM_LOADED)) - { - // minor precaution - - if (saved_bots & 1) BotConnect(0, 1, saved_skills1 & 3); - if (saved_bots & 2) BotConnect(0, 2, (saved_skills1 & 12) / 4); - if (saved_bots & 4) BotConnect(0, 3, (saved_skills1 & 48) / 16); - if (saved_bots & 8) BotConnect(0, 4, (saved_skills1 & 192) / 64); - if (saved_bots & 16) BotConnect(0, 5, (saved_skills1 & 768) / 256); - if (saved_bots & 32) BotConnect(0, 6, (saved_skills1 & 3072) / 1024); - if (saved_bots & 64) BotConnect(0, 7, (saved_skills1 & 12288) / 4096); - if (saved_bots & 128) BotConnect(0, 8, (saved_skills1 & 49152) / 16384); - if (saved_bots & 256) BotConnect(0, 9, saved_skills2 & 3); - if (saved_bots & 512) BotConnect(0, 10, (saved_skills2 & 12) / 4); - if (saved_bots & 1024) BotConnect(0, 11, (saved_skills2& 48) / 16); - if (saved_bots & 2048) BotConnect(0, 12, (saved_skills2 & 192) / 64); - if (saved_bots & 4096) BotConnect(0, 13, (saved_skills2 & 768) / 256); - if (saved_bots & 8192) BotConnect(0, 14, (saved_skills2 & 3072) / 1024); - if (saved_bots & 16384) BotConnect(0, 15, (saved_skills2 & 12288) / 4096); - if (saved_bots & 32768) BotConnect(0, 16, (saved_skills2 & 49152) / 16384); - saved_bots = 0; - } - } -}; - - -void() WaypointWatch = -{ - // Waypoint Baywatch - local float bigboobs; - local string h; - - if (max_clients < 2) - return; - if (waypoint_mode != WM_UNINIT) - { - bigboobs = cvar("saved4"); - if (bigboobs != 0) - { - if ((bigboobs & 3) == 1) - ClearAllWays(); - else if ((bigboobs & 3) == 3) - { - FixWaypoints(); - h = ftos(b_options); - cvar_set("saved1", h); - cvar_set("saved4", "0"); - cvar_set("scratch1", "0"); - waypoint_mode = WM_LOADED; - return; - } - LoadWaypoint(); - waypoint_mode = WM_LOADING; - cvar_set("saved4", "0"); - } - } -}; -void() BotFrame = -{ - local float num; - - // for the sake of speed - sv_maxspeed = cvar("sv_maxspeed"); - sv_gravity = cvar("sv_gravity"); - sv_friction = cvar("sv_friction"); - sv_accelerate = cvar("sv_accelerate"); - sv_stopspeed = cvar("sv_stopspeed"); - real_frametime = frametime; // in NQ this is alright - - self = nextent(world); - num = 0; - while (num < max_clients) - { - if (self.ishuman == FALSE) - { - if (active_clients & ClientBitFlag(num)) - { - frik_obstacles(); - CL_KeyMove(); - SV_ClientThink(); - SV_Physics_Client(); - } - } - self = nextent(self); - num = num + 1; - } - WaypointWatch(); - - if (saved_bots) - bot_return(); -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Bot Impulses. Allows the player to perform bot -related functions. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void() BotImpulses = -{ - local float f; - if (self.impulse == 100) - { - f = cvar("skill"); - BotConnect(0, 0, f); - } - if (self.impulse == 101) - { - f = cvar("skill"); - BotConnect(1, 0, f); - } - else if (self.impulse == 102) - KickABot(); - else if (self.impulse == 103) - botcam_u(); - else if (self.impulse == 104) - bot_way_edit(); - else - return; - - self.impulse = 0; -}; - - - diff --git a/qcsrc/bot/bot_ai.qc b/qcsrc/bot/bot_ai.qc deleted file mode 100644 index cf617e31c..000000000 --- a/qcsrc/bot/bot_ai.qc +++ /dev/null @@ -1,1010 +0,0 @@ -/*********************************************** -* * -* FrikBot General AI * -* "The I'd rather be playing Quake AI" * -* * -***********************************************/ - -/* - -This program is in the Public Domain. My crack legal -team would like to add: - -RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS" -AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE -ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR -FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN -NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY -GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL, -EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC" -SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES. - -You accept this software on the condition that you -indemnify and hold harmless Ryan "FrikaC" Smith from -any and all liability or damages to third parties, -including attorney fees, court costs, and other -related costs and expenses, arising out of your use -of this software irrespective of the cause of said -liability. - -The export from the United States or the subsequent -reexport of this software is subject to compliance -with United States export control and munitions -control restrictions. You agree that in the event you -seek to export this software, you assume full -responsibility for obtaining all necessary export -licenses and approvals and for assuring compliance -with applicable reexport restrictions. - -Any reproduction of this software must contain -this notice in its entirety. - -*/ - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -target_onstack - -checks to see if an entity is on the bot's stack - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -float(entity scot) target_onstack = -{ - if (scot == world) - return FALSE; - else if (self.target1 == scot) - return 1; - else if (self.target2 == scot) - return 2; - else if (self.target3 == scot) - return 3; - else if (self.target4 == scot) - return 4; - else - return FALSE; -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -target_add - -adds a new entity to the stack, since it's a -LIFO stack, this will be the bot's new target1 - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void(entity ent) target_add = -{ - if (ent == world) - return; - if (target_onstack(ent)) - return; - self.target4 = self.target3; - self.target3 = self.target2; - self.target2 = self.target1; - self.target1 = ent; - self.search_time = time + 5; -}; - - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -target_drop - -Removes an entity from the bot's target stack. -The stack will empty everything up to the object -So if you have target2 item_health, target1 -waypoint, and you drop the health, the waypoint -is gone too. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void(entity ent) target_drop = -{ - local float tg; - - tg = target_onstack(ent); - if (tg == 1) - { - self.target1 = self.target2; - self.target2 = self.target3; - self.target3 = self.target4; - self.target4 = world; - } - else if (tg == 2) - { - self.target1 = self.target3; - self.target2 = self.target4; - self.target3 = self.target4 = world; - } - else if (tg == 3) - { - self.target1 = self.target4; - self.target2 = self.target3 = self.target4 = world; - } - else if (tg == 4) - self.target1 = self.target2 = self.target3 = self.target4 = world; - self.search_time = time + 5; -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -bot_lost - -Bot has lost its target. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void(entity targ, float success) bot_lost = -{ - if (!targ) - return; - - target_drop(targ); - if (targ.classname == "waypoint") - targ.b_sound = targ.b_sound - (targ.b_sound & ClientBitFlag(self.b_clientno)); - - // find a new route - if (!success) - { - self.target1 = self.target2 = self.target3 = self.target4 = world; - self.last_way = FindWayPoint(self.current_way); - ClearMyRoute(); - self.b_aiflags = 0; - } - else - { - if (targ.classname == "item_artifact_invisibility") - if (self.items & 524288) - bot_start_topic(3); - - if (targ.flags & FL_ITEM) - { - if (targ.model == string_null) - targ._last = world; - else - targ._last = self; - } - } - - - if (targ.classname != "player") - targ.search_time = time + 5; -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -bot_check_lost - -decide if my most immediate target should be -removed. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ -void(entity targ) bot_check_lost = -{ - local vector dist; - dist = realorigin(targ) - self.origin; - dist_z = 0; - if (targ == world) - return; - - // waypoints and items are lost if you get close enough to them - - else if (targ.flags & FL_ITEM) - { - if (vlen(targ.origin - self.origin) < 32) - bot_lost(targ, TRUE); - else if (targ.model == string_null) - bot_lost(targ, TRUE); - } - else if (targ.classname == "waypoint") - { - if (!(self.b_aiflags & (AI_SNIPER | AI_AMBUSH))) - { - if (self.b_aiflags & AI_RIDE_TRAIN) - { - if (vlen(targ.origin - self.origin) < 48) - bot_lost(targ, TRUE); - } - else if (self.b_aiflags & AI_PRECISION) - { - if (vlen(targ.origin - self.origin) < 24) - bot_lost(targ, TRUE); - } - else if (vlen(targ.origin - self.origin) < 32) - bot_lost(targ, TRUE); - else if (self.b_aiflags & AI_CARELESS) // Electro - better for jumppads - { - if (vlen(targ.origin - self.origin) < 128) - bot_lost(targ, TRUE); - } - } - } - else if (targ.classname == "temp_waypoint") - { - if (vlen(targ.origin - self.origin) < 32) - bot_lost(targ, TRUE); - } - else if (targ.classname == "player") - { - if (targ.health <= 0) - bot_lost(targ, TRUE); - else if ((coop) || (teamplay && targ.team == self.team)) - { - if (targ.target1.classname == "player") - { - if (!targ.target1.ishuman) - bot_lost(targ, TRUE); - } - else if (targ.teleport_time > time) - { - // try not to telefrag teammates - self.keys = self.keys & 960; - } - else if (vlen(targ.origin - self.origin) < 128) - { - if (vlen(targ.origin - self.origin) < 48) - frik_walkmove(self.origin - targ.origin); - else - { - self.keys = self.keys & 960; - bot_start_topic(4); - } - self.search_time = time + 5; // never time out - } - else if (!fisible(targ)) - bot_lost(targ, FALSE); - } - else if (waypoint_mode > WM_LOADED) - { - if (vlen(targ.origin - self.origin) < 128) - { - bot_lost(targ, TRUE); - } - } - } - - // buttons are lost of their frame changes - else if (targ.classname == "func_button") - { - if (targ.frame) - { - bot_lost(targ, TRUE); - if (self.enemy == targ) - self.enemy = world; - //if (self.target1) - // bot_get_path(self.target1, TRUE); - - } - } - // trigger_multiple style triggers are lost if their thinktime changes - else if ((targ.movetype == MOVETYPE_NONE) && (targ.solid == SOLID_TRIGGER)) - { - if (targ.nextthink >= time) - { - bot_lost(targ, TRUE); - //if (self.target1) - // bot_get_path(self.target1, TRUE); - } - } - // lose any target way above the bot's head - // FIXME: if the bot can fly in your mod.. - if ((targ.origin_z - self.origin_z) > 64) - { - dist = targ.origin - self.origin; - dist_z = 0; - if (vlen(dist) < 32) - if (self.flags & FL_ONGROUND) - if(!frik_recognize_plat(FALSE)) - bot_lost(targ, FALSE); - } - else if (targ.classname == "train") - { - if (frik_recognize_plat(FALSE)) - bot_lost(targ, TRUE); - } - // targets are lost if the bot's search time has expired - if (time > self.search_time) - bot_lost(targ, FALSE); -}; - - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -bot_handle_ai - -This is a 0.10 addition. Handles any action -based b_aiflags. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void() bot_handle_ai = -{ - local entity newt; - local vector v; - - // handle ai flags -- note, not all aiflags are handled - // here, just those that perform some sort of action - - // wait is used by the ai to stop the bot until his search time expires / or route changes - - if (self.b_aiflags & AI_WAIT) - self.keys = self.keys & 960; - - if (self.b_aiflags & AI_DOORFLAG) // was on a door when spawned - { - b_temp3 = self; - self = self.last_way; - if (!frik_recognize_plat(FALSE)) // if there is nothing there now - { - newt = FindThing("door"); // this is likely the door responsible (crossfingers) - self = b_temp3; - - if (self.b_aiflags & AI_DOOR_NO_OPEN) - { - if (newt.nextthink) - self.keys = self.keys & 960; // wait until it closes - else - { - bot_lost(self.last_way, FALSE); - } - } - else - { - if (newt.targetname) - { - newt = find(world, target, newt.targetname); - if (newt.health > 0) - { - self.enemy = newt; - bot_weapon_switch(1); - } - else - { - // target_drop(self.last_way); - target_add(newt); - // bot_get_path(newt, TRUE); - } - } - self.b_aiflags = self.b_aiflags - AI_DOORFLAG; - } - } - else - self = b_temp3; - } - - if (self.b_aiflags & AI_JUMP) - { - if (self.flags & FL_ONGROUND) - { - bot_jump(); - self.b_aiflags = self.b_aiflags - AI_JUMP; - } - } - else if (self.b_aiflags & AI_SUPER_JUMP) - { - if (self.weapon != 32) - self.impulse = 7; - else if (self.flags & FL_ONGROUND) - { - self.b_aiflags = self.b_aiflags - AI_SUPER_JUMP; - if (bot_can_rj(self)) - { - bot_jump(); - self.v_angle_x = self.b_angle_x = 80; - self.button0 = TRUE; - } - else - bot_lost(self.target1, FALSE); - - } - } - if (self.b_aiflags & AI_SURFACE) - { - if (self.waterlevel > 2) - { - self.keys = KEY_MOVEUP; - self.button2 = TRUE; // swim! - } - else - self.b_aiflags = self.b_aiflags - AI_SURFACE; - } - if (self.b_aiflags & AI_RIDE_TRAIN) - { - // simple, but effective - // this can probably be used for a lot of different - // things, not just trains (door elevators come to mind) - b_temp3 = self; - self = self.last_way; - - if (!frik_recognize_plat(FALSE)) // if there is nothing there now - { - self = b_temp3; - self.keys = self.keys & 960; - } - else - { - self = b_temp3; - if (frik_recognize_plat(FALSE)) - { - v = realorigin(trace_ent) + trace_ent.origin - self.origin; - v_z = 0; - if (vlen(v) < 24) - self.keys = self.keys & 960; - else - { - self.b_aiflags = self.b_aiflags | AI_PRECISION; - self.keys = frik_KeysForDir(v); - } - } - } - } - if (self.b_aiflags & AI_PLAT_BOTTOM) - { - newt = FindThing("plat"); - if (newt.state != 1) - { - v = self.origin - realorigin(newt); - v_z = 0; - if (vlen(v) > 96) - self.keys = self.keys & 960; - else - frik_walkmove(v); - } - else - self.b_aiflags = self.b_aiflags - AI_PLAT_BOTTOM; - } - if (self.b_aiflags & AI_DIRECTIONAL) - { - if ((normalize(self.last_way.origin - self.origin) * self.b_dir) > 0.4) - { - self.b_aiflags = self.b_aiflags - AI_DIRECTIONAL; - bot_lost(self.target1, TRUE); - } - } - if (self.b_aiflags & AI_SNIPER) - { - self.b_aiflags = (self.b_aiflags | AI_WAIT | AI_PRECISION) - AI_SNIPER; - // FIXME: Add a switch to wep command - // FIXME: increase delay? - } - if (self.b_aiflags & AI_AMBUSH) - { - self.b_aiflags = (self.b_aiflags | AI_WAIT) - AI_AMBUSH; - // FIXME: Add a switch to wep command - // FIXME: increase delay? - } - -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -bot_path - -Bot will follow a route generated by the -begin_route set of functions in bot_way.qc. -This code, while it works pretty well, can get -confused - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void() bot_path = -{ - - local entity jj, tele; - //local vector org; - - bot_check_lost(self.target1); - if (!self.target1) - { - self.keys=0; - return; - } - if (target_onstack(self.last_way)) - return; // old waypoint still being hunted - - jj = FindRoute(self.last_way); - if (!jj) - { - // this is an ugly hack - if (self.target1.current_way != self.last_way) - { - if (self.target1.classname != "temp_waypoint") - if (self.target1.classname != "player") - bot_lost(self.target1, FALSE); - } - - return; - } - - // update the bot's special ai features - - // Readahed types are AI conditions to perform while heading to a waypoint - // point types are AI flags that should be executed once reaching a waypoint - - self.b_aiflags = (jj.b_aiflags & AI_READAHEAD_TYPES) | (self.last_way.b_aiflags & AI_POINT_TYPES); - target_add(jj); - if (self.last_way) - { - if (CheckLinked(self.last_way, jj) == 2) // waypoints are telelinked - { - tele = FindThing("trigger_teleport"); // this is probbly the teleport responsible - target_add(tele); - } - traceline(self.last_way.origin, jj.origin, FALSE, self); // check for blockage - if (trace_fraction != 1) - { - if (trace_ent.classname == "door" && !(self.b_aiflags & AI_DOOR_NO_OPEN)) // a door blocks the way - { - // linked doors fix - if (trace_ent.owner) - trace_ent = trace_ent.owner; - if ((trace_ent.health > 0) && (self.enemy == world)) - { - self.enemy = trace_ent; - bot_weapon_switch(1); - self.b_aiflags = self.b_aiflags | AI_BLIND; // nick knack paddy hack - } - else if (trace_ent.targetname) - { - tele = find(world, target, trace_ent.targetname); - if (tele.health > 0) - { - self.enemy = tele; - bot_weapon_switch(1); - } - else - { - // target_drop(jj); - target_add(tele); - // bot_get_path(tele, TRUE); - self.b_aiflags = self.b_aiflags | AI_BLIND; // give a bot a bone - return; - } - } - } - else if (trace_ent.classname == "func_wall") - { - // give up - bot_lost(self.target1, FALSE); - return; - } - } - } - // this is used for AI_DRIECTIONAL - self.b_dir = normalize(jj.origin - self.last_way.origin); - - self.last_way = jj; -}; - - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Bot Priority Look. What a stupid name. This is where -the bot finds things it wants to kill/grab. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ -// priority scale -// 0 - 10 virtually ignore -// 10 - 30 normal item range -// 30 - 50 bot will consider this a target worth changing course for -// 50 - 90 bot will hunt these as vital items - -// *!* Make sure you add code to bot_check_lost to remove the target *!* - -float(entity thing) priority_for_thing = -{ - local float thisp; - thisp = 0; - // This is the most executed function in the bot. Careful what you do here. - - if (thing.flags & FL_ITEM && thing.model != string_null && thing.search_time < time) - { - // ugly hack - if (thing._last != self) - thisp = 20; - else if (thing.classname == "item_strength") // IT_STRENGTH - thisp = 65; - else if (thing.classname == "item_invincible") // IT_INVINCIBLE - thisp = 65; - else if (thing.classname == "item_speed") // IT_SPEED - thisp = 65; - else if (thing.classname == "item_slowmo") // IT_SLOWMO - thisp = 65; - else if (thing.classname == "item_health") - { - if (thing.spawnflags & 2) - thisp = 55; - if (self.health < 40) - thisp = thisp + 50; - } - else if (thing.model == "progs/armor.mdl") - { - if (self.armorvalue < 200) - { - if (thing.skin == 2) - thisp = 60; - else if (self.armorvalue < 100) - thisp = thisp + 25; - } - } - else if (thing.classname == "weapon_shotgun") - { - if (!(self.items & IT_SHOTGUN)) - thisp = 25; - } - else if (thing.classname == "weapon_uzi") - { - if (!(self.items & IT_UZI)) - thisp = 30; - } - else if (thing.classname == "weapon_electro") - { - if (!(self.items & IT_ELECTRO)) - thisp = 35; - } - else if (thing.classname == "weapon_grenadelauncher") - { - if (!(self.items & IT_GRENADE_LAUNCHER)) - thisp = 45; - } - else if (thing.classname == "weapon_crylink") - { - if (!(self.items & IT_CRYLINK)) - thisp = 60; - } - else if (thing.classname == "weapon_nex") - { - if (!(self.items & IT_NEX)) // IT_LIGHTNING - thisp = 50; - } - else if (thing.classname == "weapon_hagar") - { - if (!(self.items & IT_HAGAR)) - thisp = 45; - } - else if (thing.classname == "weapon_rocketlauncher") - { - if (!(self.items & IT_ROCKET_LAUNCHER)) - thisp = 50; - } - } - else if (thing.classname == "player") - { - if (thing.health > 0) - { - if (thing == self) - return 0; - else - { - if (coop) - { - thisp = 100; - if (thing.target1.classname == "player") - if (!thing.target1.ishuman) - return 0; - } - else if (teamplay && thing.team == self.team) - { - thisp = 100; - if (thing.target1.classname == "player") - return 0; - } - else thisp = 30; - } - } - } - else if (thing.classname == "waypoint") - { - if (thing.b_aiflags & AI_SNIPER) - thisp = 30; - else if (thing.b_aiflags & AI_AMBUSH) - thisp = 30; - } - if (pointcontents(thing.origin) < -3) - return 0; - if (thisp) - { - if (thing.current_way) - { - // check to see if it's unreachable - if (thing.current_way.items == -1) - return 0; - else - thisp = thisp + (13000 - thing.current_way.items) * 0.05; - - } - } - return thisp; -}; - -void(float scope) bot_look_for_crap = -{ - local entity foe, best; - local float thatp, bestp, dist; - - if (scope == 1) - foe = findradius(self.origin, 13000); - else - foe = findradius(self.origin, 500); - - bestp = 1; - while(foe) - { - thatp = priority_for_thing(foe); - if (thatp) - if (!scope) - if (!sisible(foe)) - thatp = 0; - if (thatp > bestp) - { - bestp = thatp; - best = foe; - dist = vlen(self.origin - foe.origin); - } - foe = foe.chain; - } - if (best == world) - return; - if (!target_onstack(best)) - { - target_add(best); - if (scope) - { - bot_get_path(best, FALSE); - self.b_aiflags = self.b_aiflags | AI_WAIT; - } - } -}; - - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -bot_angle_set - -Sets the bots look keys & b_angle to point at -the target - used for fighting and just -generally making the bot look good. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void() bot_angle_set = -{ - local float h; - local vector view; - - if (self.enemy) - { - if (self.enemy.items & 524288) - if (random() > 0.2) - return; - if (self.missile_speed == 0) - self.missile_speed = 10000; - if (self.enemy.solid == SOLID_BSP) - { - view = (((self.enemy.absmin + self.enemy.absmax) * 0.5) - self.origin); - } - else - { - h = vlen(self.enemy.origin - self.origin) / self.missile_speed; - if (self.enemy.flags & FL_ONGROUND) - view = self.enemy.velocity * h; - else - view = (self.enemy.velocity - (sv_gravity * '0 0 1') * h) * h; - view = self.enemy.origin + view; - // FIXME: ? - traceline(self.enemy.origin, view, FALSE, self); - view = trace_endpos; - - if (self.weapon == 32) - view = view - '0 0 22'; - - view = normalize(view - self.origin); - } - view = vectoangles(view); - view_x = view_x * -1; - self.b_angle = view; - } - else if (self.target1) - { - view = realorigin(self.target1); - if (self.target1.flags & FL_ITEM) - view = view + '0 0 48'; - view = view - (self.origin + self.view_ofs); - view = vectoangles(view); - view_x = view_x * -1; - self.b_angle = view; - } - else - self.b_angle_x = 0; - // HACK HACK HACK HACK - // The bot falls off ledges a lot because of "turning around" - // so let the bot use instant turn around when not hunting a player - if (self.b_skill == 3) - { - self.keys = self.keys & 63; - self.v_angle = self.b_angle; - while (self.v_angle_x < -180) - self.v_angle_x = self.v_angle_x + 360; - while (self.v_angle_x > 180) - self.v_angle_x = self.v_angle_x - 360; - - } - else if ((self.enemy == world || self.enemy.movetype == MOVETYPE_PUSH) && self.target1.classname != "player") - { - self.keys = self.keys & 63; - self.v_angle = self.b_angle; - while (self.v_angle_x < -180) - self.v_angle_x = self.v_angle_x + 360; - while (self.v_angle_x > 180) - self.v_angle_x = self.v_angle_x - 360; - } - else if (self.b_skill < 2) // skill 2 handled in bot_phys - { - if (self.b_angle_x > 180) - self.b_angle_x = self.b_angle_x - 360; - self.keys = self.keys & 63; - - if (angcomp(self.b_angle_y, self.v_angle_y) > 10) - self.keys = self.keys | KEY_LOOKLEFT; - else if (angcomp(self.b_angle_y, self.v_angle_y) < -10) - self.keys = self.keys | KEY_LOOKRIGHT; - if (angcomp(self.b_angle_x, self.v_angle_x) < -10) - self.keys = self.keys | KEY_LOOKUP; - else if (angcomp(self.b_angle_x, self.v_angle_x) > 10) - self.keys = self.keys | KEY_LOOKDOWN; - } -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -BotAI - -This is the main ai loop. Though called every -frame, the ai_time limits it's actual updating - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ -float stagger_think; - -void() BotAI = -{ - // am I dead? Fire randomly until I respawn - // health < 1 is used because fractional healths show up as 0 on normal player - // status bars, and the mod probably already compensated for that - - if (self.health < 1) - { - self.button0 = floor(random() * 2); - self.button2 = 0; - self.keys = 0; - self.b_aiflags = 0; - ClearMyRoute(); - self.target1 = self.target2 = self.target3 = self.target4 = self.enemy = world; - self.last_way = world; - return; - } - - // stagger the bot's AI out so they all don't think at the same time, causing game - // 'spikes' - if (self.b_skill < 2) - { - if (self.ai_time > time) - return; - - self.ai_time = time + 0.05; - if (bot_count > 0) - { - if ((time - stagger_think) < (0.1 / bot_count)) - self.ai_time = self.ai_time + 0.1 / (2 * bot_count); - } - else - return; - } - if (self.view_ofs == '0 0 0') - bot_start_topic(7); - stagger_think = time; - - // shut the bot's buttons off, various functions will turn them on by AI end - - self.button2 = 0; - self.button0 = 0; - - - // target1 is like goalentity in normal Quake monster AI. - // it's the bot's most immediate target - if (route_table == self) - { - if (busy_waypoints <= 0) - { - if (waypoint_mode < WM_EDITOR) - bot_look_for_crap(TRUE); - } - self.b_aiflags = 0; - self.keys = 0; - } - else if (self.target1) - { - frik_movetogoal(); - bot_path(); - } - else - { - if (waypoint_mode < WM_EDITOR) - { - if(self.route_failed) - { - frik_bot_roam(); - self.route_failed = 0; - } - else if(!begin_route()) - { - bot_look_for_crap(FALSE); - } - self.keys = 0; - } - else - { - self.b_aiflags = AI_WAIT; - self.keys = 0; - } - } - - // bot_angle_set points the bot at it's goal (self.enemy or target1) - - bot_angle_set(); - - // fight my enemy. Enemy is probably a field QC coders will most likely use a lot - // for their own needs, since it's unused on a normal player - // FIXME - if (self.enemy) - bot_fight_style(); - else if (random() < 0.2) - if (random() < 0.2) - bot_weapon_switch(-1); - bot_dodge_stuff(); - - // checks to see if bot needs to start going up for air -/* if (self.waterlevel > 2) - { - if (time > (self.air_finished - 2)) - { - traceline (self.origin, self.origin + '0 0 6800', TRUE, self); - if (trace_inopen) - { - self.keys = KEY_MOVEUP; - self.button2 = TRUE; // swim! - return; // skip ai flags for now - this is life or death - } - } - } -*/ - // b_aiflags handling - - - if (self.b_aiflags) - bot_handle_ai(); - else - bot_chat(); // don't want chat to screw him up if he's rjing or something -}; diff --git a/qcsrc/bot/bot_ed.qc b/qcsrc/bot/bot_ed.qc deleted file mode 100644 index 22948ca0c..000000000 --- a/qcsrc/bot/bot_ed.qc +++ /dev/null @@ -1,1367 +0,0 @@ -/*********************************************** -* * -* FrikBot Waypoint Editor * -* "The 'wtf is this doing in my mod' code" * -* * -***********************************************/ - -/* - -This program is in the Public Domain. My crack legal -team would like to add: - -RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS" -AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE -ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR -FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN -NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY -GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL, -EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC" -SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES. - -You accept this software on the condition that you -indemnify and hold harmless Ryan "FrikaC" Smith from -any and all liability or damages to third parties, -including attorney fees, court costs, and other -related costs and expenses, arising out of your use -of this software irrespective of the cause of said -liability. - -The export from the United States or the subsequent -reexport of this software is subject to compliance -with United States export control and munitions -control restrictions. You agree that in the event you -seek to export this software, you assume full -responsibility for obtaining all necessary export -licenses and approvals and for assuring compliance -with applicable reexport restrictions. - -Any reproduction of this software must contain -this notice in its entirety. - -*/ - -float saved1, saved2, saved3, scratch1, scratch2, scratch3, scratch4; -float bytecounter, filecount; - -float MENU_MAIN = 1; -float MENU_WAYPOINTS = 2; -float MENU_LINKS = 3; -float MENU_FLAGS = 4; -float MENU_FLAGS2 = 5; -float MENU_BOTS = 6; -float MENU_WAYLIST = 7; -// 8 = link way -// 9 = telelink way -// 10 = delete link -// 11 = create link X2 -// 12 = delete link x2 -// 13 = confirmation of delete all -// 14 = Teleport to way -// 15 = confirmation of delete point - -void() BSPDumpWaypoints; -void() QCDumpWaypoints; -void() DumpWaypoints; -/* -// source for the menu strings... - --- Main Menu --\n -[1] >>Waypoint Management\n -[2] >>Link Management \n -[3] >>AI Flag Management \n -[4] >>Bot Management \n -[5] >>Waylist Management \n -[6] [#] Noclip \n -[7] [#] Godmode \n -[8] [#] Hold Select \n -[9] Teleport to Way # \n -[0] Close Menu \n - -// missing from main is show way info -// iffy on the teleport to way thing being on main...seems like either a bot or way list thing - --- Waypoint Management --\n -[1] Move Waypoint \n -[2] Delete Waypoint \n -[3] Make Waypoint \n -[4] Make Way + Link \n -[5] Make Way + Link X2 \n -[6] Make Way + Telelink \n -[7] Show waypoint info \n -[8] >>Link Management \n -[9] >>AI Flag Management \n -[0] >>Main Menu \n - --- Link Management --\n -[1] Unlink Waypoint \n -[2] Create Link \n -[3] Create Telelink \n -[4] Delete Link \n -[5] Create Link X2 \n -[6] Delete Link X2 \n -[7] >Make Waypoint \n -[8] >>Waypoint Management\n -[9] >>AI Flag Management \n -[0] >>Main Menu \n - -// Ai flags...ugh - --- AI Flag Management --\n -[1] [#] Door Flag \n -[2] [#] Precision \n -[3] [#] Surface for air \n -[4] [#] Blind mode \n -[5] [#] Jump \n -[6] [#] Dark \n -[7] [#] Super Jump \n -\n -[9] >>AI Flags page 2 \n -[0] >>Main Menu \n - --- AI Flags pg. 2--\n -[1] [#] Difficult \n -[2] [#] Wait for plat \n -[3] [#] Ride train \n -[4] [#] Door flag no open\n -[5] [#] Ambush \n -[6] [#] Snipe \n -[7] [#] Trace Test \n -\n -[9] >>AI Flag Management \n -[0] >>Main Menu \n - --- Bot Management --\n -[1] Add a Test Bot \n -[2] Order Test Bot here \n -[3] Remove Test Bot \n -[4] Stop Test Bot \n -[5] Teleport Bot here \n -[6] Teleport to Way # \n -\n -\n -\n -[0] >>Main Menu \n - --- Waylist Management --\n -[1] Delete ALL Waypoints \n -[2] Dump Waypoints \n -[3] Check For Errors \n -[4] Save Waypoints \n -[5] [#] Dynamic Mode \n -[6] [#] Dynamic Link \n -[7] [#] WAY output \n -[8] [#] QC output \n -[9] [#] BSP ents output \n -[0] Main Menu \n - -*/ - -void() bot_menu_display = -{ -// build options - local string s1, s2, s3, s4, s5, s6, s7, h; - local entity t; - -// check impulses - if (self.impulse > 0 && self.impulse < 11 && self.b_menu) - { - if (self.b_menu == MENU_MAIN) - { - if (self.impulse == 1) - { - self.b_menu = MENU_WAYPOINTS; - self.b_menu_time = time; - } - else if (self.impulse == 2) - { - self.b_menu = MENU_LINKS; - self.b_menu_time = time; - } - else if (self.impulse == 3) - { - self.b_menu = MENU_FLAGS; - self.b_menu_time = time; - } - else if (self.impulse == 4) - { - self.b_menu = MENU_BOTS; - self.b_menu_time = time; - } - else if (self.impulse == 5) - { - self.b_menu = MENU_WAYLIST; - self.b_menu_time = time; - } - else if (self.impulse == 6) - { - if (self.movetype == MOVETYPE_NOCLIP) - self.movetype = MOVETYPE_WALK; - else - self.movetype = MOVETYPE_NOCLIP; - self.b_menu_time = time; - - } - else if (self.impulse == 7) - { - if (self.flags & FL_GODMODE) - self.flags = self.flags - FL_GODMODE; - else - self.flags = self.flags | FL_GODMODE; - self.b_menu_time = time; - - } - else if (self.impulse == 8) - { - if (self.b_aiflags & AI_HOLD_SELECT) - self.b_aiflags = self.b_aiflags - AI_HOLD_SELECT; - else - self.b_aiflags = self.b_aiflags | AI_HOLD_SELECT; - self.b_menu_time = time; - } - else if (self.impulse == 9) - { - self.b_menu = 14; - self.b_menu_time = time; - } - else if (self.impulse == 10) - bot_way_edit(); - } - else if (self.b_menu == MENU_WAYPOINTS) - { - if (self.impulse == 1) - { - if (self.current_way) - setorigin(self.current_way, self.origin + self.view_ofs); - } - else if (self.impulse == 2) - { - if (self.current_way) - { - self.b_menu = 15; - self.b_menu_time = time; - self.last_way = self.current_way; - } - } - else if (self.impulse == 3) - { - make_waypoint(self.origin + self.view_ofs); - } - else if (self.impulse == 4) - { - t = make_waypoint(self.origin + self.view_ofs); - if (!LinkWays(self.current_way, t)) - sprint(self, "Unable to link them\n"); - } - else if (self.impulse == 5) - { - t = make_waypoint(self.origin + self.view_ofs); - if (!LinkWays(self.current_way, t)) - sprint(self, "Unable to link old to new\n"); - LinkWays(t, self.current_way); - } - else if (self.impulse == 6) - { - t = make_waypoint(self.origin + self.view_ofs); - if (!TeleLinkWays(self.current_way, t)) - sprint(self, "Unable to link them\n"); - } - else if (self.impulse == 7) - { - if (self.current_way) - { - sprint(self, "\nwaypoint info for waypoint #"); - h = ftos(self.current_way.count); - sprint(self, h); - sprint(self, "\nAI Flag value: "); - h = ftos(self.current_way.b_aiflags); - sprint(self, h); - - if (self.current_way.target1) - { - h = ftos(self.current_way.target1.count); - if (self.current_way.b_aiflags & AI_TELELINK_1) - sprint(self, "\nTelelink1 to:"); - else - sprint(self, "\nLink1 to:"); - sprint(self, h); - } - if (self.current_way.target2) - { - h = ftos(self.current_way.target2.count); - if (self.current_way.b_aiflags & AI_TELELINK_2) - sprint(self, "\nTelelink2 to:"); - else - sprint(self, "\nLink2 to:"); - sprint(self, h); - } - if (self.current_way.target3) - { - h = ftos(self.current_way.target3.count); - if (self.current_way.b_aiflags & AI_TELELINK_3) - sprint(self, "\nTelelink3 to:"); - else - sprint(self, "\nLink3 to:"); - sprint(self, h); - } - if (self.current_way.target4) - { - h = ftos(self.current_way.target4.count); - if (self.current_way.b_aiflags & AI_TELELINK_4) - sprint(self, "\nTelelink4 to:"); - else - sprint(self, "\nLink4 to:"); - sprint(self, h); - } - sprint(self, "\n\n"); - } - - } - if (self.impulse == 8) - { - self.b_menu = MENU_LINKS; - self.b_menu_time = time; - } - else if (self.impulse == 9) - { - self.b_menu = MENU_FLAGS; - self.b_menu_time = time; - } - else if (self.impulse == 10) - { - self.b_menu = MENU_MAIN; - self.b_menu_time = time; - } - } - else if (self.b_menu == MENU_LINKS) - { - if (self.impulse == 1) - { - if (self.current_way) - self.current_way.target1 = self.current_way.target2 = self.current_way.target3 = self.current_way.target4 = world; - } - else if (self.impulse == 2) - { - self.b_menu = 8; - self.b_menu_time = time; - self.last_way = self.current_way; - } - else if (self.impulse == 3) - { - self.b_menu = 9; - self.b_menu_time = time; - self.last_way = self.current_way; - } - else if (self.impulse == 4) - { - self.b_menu = 10; - self.b_menu_time = time; - self.last_way = self.current_way; - } - else if (self.impulse == 5) - { - self.b_menu = 11; - self.b_menu_time = time; - self.last_way = self.current_way; - } - else if (self.impulse == 6) - { - self.b_menu = 12; - self.b_menu_time = time; - self.last_way = self.current_way; - } - else if (self.impulse == 7) - make_waypoint(self.origin + self.view_ofs); - else if (self.impulse == 8) - { - self.b_menu = MENU_WAYPOINTS; - self.b_menu_time = time; - } - else if (self.impulse == 9) - { - self.b_menu = MENU_FLAGS; - self.b_menu_time = time; - } - else if (self.impulse == 10) - { - self.b_menu = MENU_MAIN; - self.b_menu_time = time; - } - } - else if (self.b_menu == MENU_FLAGS) - { - - if (self.current_way) - { - if (self.impulse == 1) - { - if (self.current_way.b_aiflags & AI_DOORFLAG) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_DOORFLAG); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_DOORFLAG; - - self.b_menu_time = time; - } - else if (self.impulse == 2) - { - if (self.current_way.b_aiflags & AI_PRECISION) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_PRECISION); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_PRECISION; - self.b_menu_time = time; - } - else if (self.impulse == 3) - { - if (self.current_way.b_aiflags & AI_SURFACE) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_SURFACE); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_SURFACE; - self.b_menu_time = time; - } - else if (self.impulse == 4) - { - if (self.current_way.b_aiflags & AI_BLIND) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_BLIND); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_BLIND; - self.b_menu_time = time; - } - else if (self.impulse == 5) - { - if (self.current_way.b_aiflags & AI_JUMP) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_JUMP); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_JUMP; - self.b_menu_time = time; - } - else if (self.impulse == 6) - { - if (self.current_way.b_aiflags & AI_DIRECTIONAL) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_DIRECTIONAL); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_DIRECTIONAL; - self.b_menu_time = time; - } - else if (self.impulse == 7) - { - if (self.current_way.b_aiflags & AI_SUPER_JUMP) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_SUPER_JUMP); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_SUPER_JUMP; - self.b_menu_time = time; - } - else if (self.impulse == 8) - { - if (self.current_way.b_aiflags & AI_CARELESS) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_CARELESS); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_CARELESS; - self.b_menu_time = time; - } - } - if (self.impulse == 9) - { - self.b_menu = MENU_FLAGS2; - self.b_menu_time = time; - } - else if (self.impulse == 10) - { - self.b_menu = MENU_MAIN; - self.b_menu_time = time; - } - } - else if (self.b_menu == MENU_FLAGS2) - { - - if (self.current_way) - { - if (self.impulse == 1) - { - if (self.current_way.b_aiflags & AI_DIFFICULT) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_DIFFICULT); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_DIFFICULT; self.b_menu_time = time; - } - else if (self.impulse == 2) - { - if (self.current_way.b_aiflags & AI_PLAT_BOTTOM) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_PLAT_BOTTOM); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_PLAT_BOTTOM; - self.b_menu_time = time; - } - else if (self.impulse == 3) - { - if (self.current_way.b_aiflags & AI_RIDE_TRAIN) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_RIDE_TRAIN); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_RIDE_TRAIN; - self.b_menu_time = time; - } - else if (self.impulse == 4) - { - if (self.current_way.b_aiflags & AI_DOOR_NO_OPEN) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_DOOR_NO_OPEN); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_DOOR_NO_OPEN; - self.b_menu_time = time; - } - else if (self.impulse == 5) - { - if (self.current_way.b_aiflags & AI_AMBUSH) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_AMBUSH); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_AMBUSH; - self.b_menu_time = time; - } - else if (self.impulse == 6) - { - if (self.current_way.b_aiflags & AI_SNIPER) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_SNIPER); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_SNIPER; - self.b_menu_time = time; - } - else if (self.impulse == 7) - { - if (self.current_way.b_aiflags & AI_TRACE_TEST) - self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_TRACE_TEST); - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_TRACE_TEST; - self.b_menu_time = time; - } - - } - if (self.impulse == 9) - { - self.b_menu = MENU_FLAGS; - self.b_menu_time = time; - } - else if (self.impulse == 10) - { - self.b_menu = MENU_MAIN; - self.b_menu_time = time; - } - } - - else if (self.b_menu == MENU_BOTS) - { - if (self.impulse == 1) - { - self.impulse = 100; - return; - } - else if (self.impulse == 2) - { - b_temp3 = self; - self = player_head; - while(self) - { - if (!self.ishuman) - { - target_add(b_temp3); - bot_get_path(b_temp3, TRUE); - self = world; - } - else - self = self._next; - } - self = b_temp3; - } - else if (self.impulse == 3) - { - self.impulse = 102; - return; - } - else if (self.impulse == 4) - { - b_temp1 = self; - self = player_head; - while(self) - { - if (!self.ishuman) - { - self.target1 = self.target2 = self.target3 = self.target4 = world; - route_table = world; - } - self = self._next; - } - self = b_temp1; - } - else if (self.impulse == 5) - { - if (self.current_way) - { - b_temp1 = self; - self = player_head; - while(self) - { - if (!self.ishuman) - { - setorigin(self, b_temp1.current_way.origin); - } - self = self._next; - } - self = b_temp1; - } - else - sprint(self, "select a waypoint first\n"); - } - else if (self.impulse == 6) - { - self.b_menu = 14; - self.b_menu_time = time; - } - else if (self.impulse == 10) - { - self.b_menu = MENU_MAIN; - self.b_menu_time = time; - } - } - else if (self.b_menu == MENU_WAYLIST) - { - if (self.impulse == 1) - { - self.b_menu = 13; - self.b_menu_time = time; - } - else if (self.impulse == 2) - { - if (dump_mode == 0) - DumpWaypoints(); - else if (dump_mode == 1) - QCDumpWaypoints(); - else if (dump_mode == 2) - BSPDumpWaypoints(); - } - else if (self.impulse == 3) - { - t = way_head; - while(t) - { - if ((t.target1 == world) && (t.target2 == world) && (t.target3 == world) && (t.target4 == world)) - { - sprint(self, "Waypoint #"); - h = ftos(t.count); - sprint(self, h); - sprint(self, " has no outbound links\n"); - } - if ((t.target1 == t) || (t.target2 == t) || (t.target3 == t) || (t.target4 == t)) - { - sprint(self, "Waypoint #"); - h = ftos(t.count); - sprint(self, h); - sprint(self, " links to itself (??)\n"); - } - t = t._next; - } - sprint(self, "Error check complete\n"); - } - else if (self.impulse == 4) - { - sprint(self, "not in this version (FBX 0.10.0)\n"); - } - else if (self.impulse == 5) - { - if (waypoint_mode == WM_EDITOR_DYNAMIC) - waypoint_mode = WM_EDITOR; - else - waypoint_mode = WM_EDITOR_DYNAMIC; - self.b_menu_time = time; - - } - else if (self.impulse == 6) - { - if (waypoint_mode == WM_EDITOR_DYNLINK) - waypoint_mode = WM_EDITOR; - else - waypoint_mode = WM_EDITOR_DYNLINK; - self.b_menu_time = time; - } - else if (self.impulse == 7) - { - dump_mode = 0; - self.b_menu_time = time; - } - else if (self.impulse == 8) - { - dump_mode = 1; - self.b_menu_time = time; - } - else if (self.impulse == 9) - { - dump_mode = 2; - self.b_menu_time = time; - } - else if (self.impulse == 10) - { - self.b_menu = MENU_MAIN; - self.b_menu_time = time; - } - } - else if (self.b_menu == 8) - { - if (self.impulse == 1) - { - if (self.current_way) - { - if (!LinkWays(self.last_way, self.current_way)) - sprint(self, "Unable to link them\n"); - self.b_menu = MENU_LINKS; - self.b_menu_time = time; - } - } - else if (self.impulse == 2) - { - self.b_menu = MENU_LINKS; - self.b_menu_time = time; - } - } - else if (self.b_menu == 9) - { - if (self.impulse == 1) - { - if (self.current_way) - { - if (!TeleLinkWays(self.last_way, self.current_way)) - sprint(self, "Unable to link them\n"); - self.b_menu = MENU_LINKS; - self.b_menu_time = time; - } - } - else if (self.impulse == 2) - { - self.b_menu = MENU_LINKS; - self.b_menu_time = time; - } - } - else if (self.b_menu == 10) - { - if (self.impulse == 1) - { - if (self.current_way) - { - UnlinkWays(self.last_way, self.current_way); - self.b_menu = MENU_LINKS; - self.b_menu_time = time; - } - } - else if (self.impulse == 2) - { - self.b_menu = MENU_LINKS; - self.b_menu_time = time; - } - } - else if (self.b_menu == 11) - { - if (self.impulse == 1) - { - if (self.current_way) - { - if (!LinkWays(self.last_way, self.current_way)) - sprint(self, "Unable to link 1 to 2\n"); - if (!LinkWays(self.current_way, self.last_way)) - sprint(self, "Unable to link 2 to 1\n"); - self.b_menu = MENU_LINKS; - self.b_menu_time = time; - } - } - else if (self.impulse == 2) - { - self.b_menu = MENU_LINKS; - self.b_menu_time = time; - } - } - else if (self.b_menu == 12) - { - if (self.impulse == 1) - { - if (self.current_way) - { - UnlinkWays(self.last_way, self.current_way); - UnlinkWays(self.current_way, self.last_way); - self.b_menu = MENU_LINKS; - self.b_menu_time = time; - } - } - else if (self.impulse == 2) - { - self.b_menu = MENU_LINKS; - self.b_menu_time = time; - } - } - else if (self.b_menu == 13) - { - if (self.impulse == 1) - { - ClearAllWays(); - self.b_menu = MENU_WAYLIST; - self.b_menu_time = time; - } - else if (self.impulse == 2) - { - self.b_menu = MENU_WAYLIST; - self.b_menu_time = time; - } - } - else if (self.b_menu == 14) - { - if (self.impulse == 10) - self.impulse = 0; - self.b_menu_value = self.b_menu_value * 10 + self.impulse; - self.b_menu_time = 0; - } - else if (self.b_menu == 15) - { - if (self.impulse == 1) - { - delete_waypoint(self.last_way); - self.b_menu = MENU_WAYPOINTS; - self.b_menu_time = time; - } - else if (self.impulse == 2) - { - self.b_menu = MENU_WAYPOINTS; - self.b_menu_time = time; - } - } - self.impulse = 0; - - } - if (self.b_menu_time < time) - { - if (self.b_menu == MENU_MAIN) - { - s1 = "-- Main Menu --\n[1] >>Waypoint Management\n[2] >>Link Management \n[3] >>AI Flag Management \n[4] >>Bot Management \n[5] >>Waylist Management \n"; - if (self.movetype == MOVETYPE_NOCLIP) - s2 = "[6] [#] Noclip \n"; - else - s2 = "[6] [ ] Noclip \n"; - - if (self.flags & FL_GODMODE) - s3 = "[7] [#] Godmode \n"; - else - s3 = "[7] [ ] Godmode \n"; - if (self.b_aiflags & AI_HOLD_SELECT) - s4 = "[8] [#] Hold Select \n"; - else - s4 = "[8] [ ] Hold Select \n"; - s5 = "[9] Teleport to Way # \n[0] Close Menu \n"; - } - else if (self.b_menu == MENU_WAYPOINTS) - { - s1 = "-- Waypoint Management --\n[1] Move Waypoint \n[2] Delete Waypoint \n[3] Make Waypoint \n[4] Make Way + Link \n[5] Make Way + Link X2 \n[6] Make Way + Telelink \n[7] Show waypoint info \n[8] >>Link Management \n[9] >>AI Flag Management \n[0] >>Main Menu \n"; - } - else if (self.b_menu == MENU_LINKS) - { - s1 = "-- Link Management --\n[1] Unlink Waypoint \n[2] Create Link \n[3] Create Telelink \n[4] Delete Link \n[5] Create Link X2 \n[6] Delete Link X2 \n[7] >Make Waypoint \n[8] >>Waypoint Management\n[9] >>AI Flag Management \n[0] >>Main Menu \n"; - } - else if (self.b_menu == MENU_FLAGS) - { - if (self.current_way.b_aiflags & AI_DOORFLAG) - s1 = "-- AI Flag Management --\n[1] [#] Door Flag \n"; - else - s1 = "-- AI Flag Management --\n[1] [ ] Door Flag \n"; - - if (self.current_way.b_aiflags & AI_PRECISION) - s2 = "[2] [#] Precision \n"; - else - s2 = "[2] [ ] Precision \n"; - - if (self.current_way.b_aiflags & AI_SURFACE) - s3 = "[3] [#] Surface for air \n"; - else - s3 = "[3] [ ] Surface for air \n"; - - if (self.current_way.b_aiflags & AI_BLIND) - s4 = "[4] [#] Blind mode \n"; - else - s4 = "[4] [ ] Blind mode \n"; - - if (self.current_way.b_aiflags & AI_JUMP) - s5 = "[5] [#] Jump \n"; - else - s5 = "[5] [ ] Jump \n"; - - if (self.current_way.b_aiflags & AI_DIRECTIONAL) - s6 = "[6] [#] Directional \n"; - else - s6 = "[6] [ ] Directional \n"; - - // Electro - eww - if ( (self.current_way.b_aiflags & AI_SUPER_JUMP) && (self.current_way.b_aiflags & AI_CARELESS) ) - s7 = "[7] [#] Super Jump \n[8] [#] Careless \n[9] >>AI Flags page 2 \n[0] >>Main Menu \n"; - else if ( (self.current_way.b_aiflags & AI_SUPER_JUMP) && (!(self.current_way.b_aiflags & AI_CARELESS)) ) - s7 = "[7] [#] Super Jump \n[8] [ ] Careless \n[9] >>AI Flags page 2 \n[0] >>Main Menu \n"; - else if ( (!(self.current_way.b_aiflags & AI_SUPER_JUMP)) && (self.current_way.b_aiflags & AI_CARELESS) ) - s7 = "[7] [ ] Super Jump \n[8] [#] Careless \n[9] >>AI Flags page 2 \n[0] >>Main Menu \n"; - else if ( (!(self.current_way.b_aiflags & AI_SUPER_JUMP)) && (!(self.current_way.b_aiflags & AI_CARELESS)) ) - s7 = "[7] [ ] Super Jump \n[8] [ ] Careless \n[9] >>AI Flags page 2 \n[0] >>Main Menu \n"; - } - else if (self.b_menu == MENU_FLAGS2) - { - if (self.current_way.b_aiflags & AI_DIFFICULT) - s1 = "-- AI Flags pg. 2--\n[1] [#] Difficult \n"; - else - s1 = "-- AI Flags pg. 2--\n[1] [ ] Difficult \n"; - - if (self.current_way.b_aiflags & AI_PLAT_BOTTOM) - s2 = "[2] [#] Wait for plat \n"; - else - s2 = "[2] [ ] Wait for plat \n"; - - if (self.current_way.b_aiflags & AI_RIDE_TRAIN) - s3 = "[3] [#] Ride train \n"; - else - s3 = "[3] [ ] Ride train \n"; - - if (self.current_way.b_aiflags & AI_DOOR_NO_OPEN) - s4 = "[4] [#] Door flag no open\n"; - else - s4 = "[4] [ ] Door flag no open\n"; - - if (self.current_way.b_aiflags & AI_AMBUSH) - s5 = "[5] [#] Ambush \n"; - else - s5 = "[5] [ ] Ambush \n"; - - if (self.current_way.b_aiflags & AI_SNIPER) - s6 = "[6] [#] Snipe \n"; - else - s6 = "[6] [ ] Snipe \n"; - - if (self.current_way.b_aiflags & AI_TRACE_TEST) - s7 = "[7] [#] Trace Test \n\n[9] >>AI Flag Management \n[0] >>Main Menu \n"; - else - s7 = "[7] [ ] Trace Test \n\n[9] >>AI Flag Management \n[0] >>Main Menu \n"; - - } - else if (self.b_menu == MENU_BOTS) - { - s1 = "-- Bot Management --\n[1] Add a Test Bot \n[2] Order Test Bot here \n[3] Remove Test Bot \n[4] Stop Test Bot \n[5] Teleport Bot here \n[6] Teleport to Way # \n\n\n\n[0] >>Main Menu \n"; - } - else if (self.b_menu == MENU_WAYLIST) - { - s1 = "-- Waylist Management --\n[1] Delete ALL Waypoints \n[2] Dump Waypoints \n[3] Check For Errors \n[4] Save Waypoints \n"; - - if (waypoint_mode == WM_EDITOR_DYNAMIC) - s2 = "[5] [#] Dynamic Mode \n[6] [#] Dynamic Link \n"; - else if (waypoint_mode == WM_EDITOR_DYNLINK) - s2 = "[5] [ ] Dynamic Mode \n[6] [#] Dynamic Link \n"; - else - s2 = "[5] [ ] Dynamic Mode \n[6] [ ] Dynamic Link \n"; - if (dump_mode == 0) - s3 = "[7] [#] WAY output \n[8] [ ] QC output \n[9] [ ] BSP ents output \n[0] Main Menu \n"; - else if (dump_mode == 1) - s3 = "[7] [ ] WAY output \n[8] [#] QC output \n[9] [ ] BSP ents output \n[0] Main Menu \n"; - else if (dump_mode == 2) - s3 = "[7] [ ] WAY output \n[8] [ ] QC output \n[9] [#] BSP ents output \n[0] Main Menu \n"; - - } - else if (self.b_menu == 8) - s1 = "-- Link Ways --\n\nSelect another way and push 1\nor press 2 to cancel"; - else if (self.b_menu == 9) - s1 = "-- Telelink Ways --\n\nSelect another way and push 1\nor press 2 to cancel"; - else if (self.b_menu == 10) - s1 = "-- Delete Link --\n\nSelect another way and push 1\nor press 2 to cancel"; - else if (self.b_menu == 11) - s1 = "-- Create Link X2 --\n\nSelect another way and push 1\nor press 2 to cancel"; - else if (self.b_menu == 12) - s1 = "-- Delete Link X2 --\n\nSelect another way and push 1\nor press 2 to cancel"; - else if (self.b_menu == 13) - s1 = "-- Delete ALL Ways --\n\nAre you sure? Push 1 to go\nthrough with it, 2 to cancel"; - else if (self.b_menu == 14) - { - s1 = "-- Teleport to Way # --\n\nEnter way number and press\nimpulse 104 to warp\n\nWaypoint #"; - s2 = ftos(self.b_menu_value); - - } - else if (self.b_menu == 15) - s1 = "-- Delete Waypoint --\n\nAre you sure? Push 1 to go\nthrough with it, 2 to cancel"; - frik_big_centerprint(self, s1, s2, s3, s4, s5, s6, s7); - self.b_menu_time = time + 1.25; - } -}; - - -// engage menu -void() bot_way_edit = -{ - local entity t; - local float f; - if (self.b_menu_value) - { - if (self.b_menu == 14) - { - t = WaypointForNum(self.b_menu_value); - if (t) - setorigin(self, t.origin - self.view_ofs); - else - sprint(self, "No waypoint with that number\n"); - - self.b_menu = MENU_MAIN; - self.b_menu_time = time; - } - self.b_menu_value = 0; - return; - } - if (waypoint_mode < WM_EDITOR) - { - self.b_menu = MENU_MAIN; - waypoint_mode = WM_EDITOR; - self.b_menu_time = 0; - cvar_set("saved2", "0"); - WriteByte(MSG_ALL, 8); - WriteByte(MSG_ALL, 1); - WriteString(MSG_ALL, "MAKE SURE THE FOLLOWING LINE CONTAINS -CONDEBUG BEFORE PROCEEDING\n"); - localcmd("cmdline\n"); - t = way_head; - while (t) - { - setmodel(t, "progs/s_bubble.spr"); // show the waypoints - t = t._next; - } - if (self.current_way) - setmodel(self.current_way, "progs/s_light.spr"); - } - else - { - saved2 = cvar("saved2"); - if (saved2 != 0) - { - f = self.b_menu; - self.b_menu = floor(saved2/16); - self.impulse = saved2 & 15; - bot_menu_display(); - self.b_menu = f; - cvar_set("saved2", "0"); - return; - } - self.b_menu = 0; - waypoint_mode = WM_LOADED; - t = way_head; - while (t) - { - setmodel(t, string_null); // hide the waypoints - t = t._next; - } - } -}; - - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Waypoint Saving to file. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - - -// bytecount is really iffy -// since there is no true way to determine the length of an ftos -// it uses an approximate of 5 -// various other things are guesses, but I don't cut it at the absolute -// max so it should be okay - -void() PrintWaypoint = -{ - local entity t; - local float needcolon; - local string h; - - if (self.enemy == world) - t = way_head; - else - t = self.enemy._next; - if (bytecounter >= 8000) - { - bprint("exec maps/"); - bprint(mapname); - bprint(".wa"); - h = ftos(filecount); - bprint(h); - filecount = filecount + 1; - bprint("\n// **** break here **** \n"); - bytecounter = 26; - } - if (t == world) - { - remove(self); - fixer = world; - bprint("saved4 3\n// end waypoint dump\n"); - bytecounter = bytecounter + 27; - return; - } - if ((t.origin_x != saved1) || (t.count == 1)) - { - bprint("saved1 "); - h = ftos(t.origin_x); - bprint(h); - saved1 = t.origin_x; - bytecounter = bytecounter + 12; - needcolon = TRUE; - } - if ((t.origin_y != saved2) || (t.count == 1)) - { - if (needcolon) - { - bprint("; "); - bytecounter = bytecounter + 2; - } - else - needcolon = TRUE; - bprint("saved2 "); - h = ftos(t.origin_y); - bprint(h); - bytecounter = bytecounter + 12; - saved2 = t.origin_y; - } - if ((t.origin_z != saved3) || (t.count == 1)) - { - if (needcolon) - { - bprint("; "); - bytecounter = bytecounter + 2; - } - else - needcolon = TRUE; - bprint("saved3 "); - h = ftos(t.origin_z); - bprint(h); - bytecounter = bytecounter + 12; - saved3 = t.origin_z; - } - bytecounter = bytecounter + 1; - bprint("\n"); - needcolon = FALSE; - if ((scratch1 != t.target1.count) || t.count == 1) - { - needcolon = TRUE; - bprint("scratch1 "); - bytecounter = bytecounter + 14; - h = ftos(t.target1.count); - bprint(h); - scratch1 = t.target1.count; - } - if ((scratch2 != t.target2.count) || t.count == 1) - { - if (needcolon) - { - bprint("; "); - bytecounter = bytecounter + 2; - } - else - needcolon = TRUE; - bprint("scratch2 "); - bytecounter = bytecounter + 14; - h = ftos(t.target2.count); - bprint(h); - scratch2 = t.target2.count; - } - if ((scratch3 != t.target3.count) || t.count == 1) - { - if (needcolon) - { - bprint("; "); - bytecounter = bytecounter + 2; - } - else - needcolon = TRUE; - bprint("scratch3 "); - bytecounter = bytecounter + 14; - h = ftos(t.target3.count); - bprint(h); - scratch3 = t.target3.count; - } - if ((scratch4 != t.target4.count) || t.count == 1) - { - if (needcolon) - { - bprint("; "); - bytecounter = bytecounter + 2; - } - else - needcolon = TRUE; - bprint("scratch4 "); - bytecounter = bytecounter + 14; - h = ftos(t.target4.count); - bprint(h); - scratch4 = t.target4.count; - } - bprint("\nsaved4 "); - bytecounter = bytecounter + 19; - if (t.count != 1) - h = ftos(t.b_aiflags * 4 + 2); - else - h = ftos(t.b_aiflags * 4 + 1); - bprint(h); - bprint ("; wait\n"); - self.nextthink = time + 0.01; - self.enemy = t; -}; - -// to allow for 100+ waypoints, we need to trick the runaway loop counter -void() DumpWaypoints = -{ - bytecounter = 50; - filecount = 1; - - bprint("// "); - bprint(world.message); - bprint("- maps/"); - bprint(mapname); - bprint(".way\n"); - bprint("// Ways by "); - bprint(self.netname); - bprint("\n"); - if (!fixer) - { - fixer = spawn(); - fixer.nextthink = time + 0.01; - fixer.think = PrintWaypoint; - fixer.enemy = world; - } -}; - -void() PrintQCWaypoint = -{ - local entity t; - local string h; - - if (self.enemy == world) - t = way_head; - else - t = self.enemy._next; - - if (t == world) - { - remove(self); - fixer = world; - bprint("};\n\n// End dump\n"); - return; - } - bprint(" make_way("); - h = vtos(t.origin); - bprint(h); - bprint(", '"); - h = ftos(t.target1.count); - bprint(h); - bprint(" "); - h = ftos(t.target2.count); - bprint(h); - bprint(" "); - h = ftos(t.target3.count); - bprint(h); - bprint("', "); - h = ftos(t.target4.count); - bprint(h); - bprint(", "); - h = ftos(t.b_aiflags); - bprint(h); - bprint(");\n"); - self.nextthink = time + 0.01; - self.enemy = t; - -}; -void() QCDumpWaypoints = -{ - bprint("/* QC Waypoint Dump - src/frikbot/map_"); - - bprint(mapname); - bprint(".qc\nFor instructions please read the\nreadme.html that comes with FrikBot */\n\nvoid(vector org, vector bit1, float bit4, float flargs) make_way;\n"); - bprint("// Ways by "); - bprint(self.netname); - bprint("\n\n"); - - bprint("void() map_"); - bprint(mapname); - bprint(" =\n{\n"); - - - if (!fixer) - { - fixer = spawn(); - fixer.nextthink = time + 0.01; - fixer.think = PrintQCWaypoint; - fixer.enemy = world; - } -}; - -void() PrintBSPWaypoint = -{ - local entity t; - local string h; - - if (self.enemy == world) - t = way_head; - else - t = self.enemy._next; - - if (t == world) - { - bprint("\n\n// End dump\n"); - remove(self); - fixer = world; - return; - } - bprint("{\n\"classname\" \"waypoint\"\n\"origin\" \""); - h = ftos(t.origin_x); - bprint(h); - bprint(" "); - h = ftos(t.origin_y); - bprint(h); - bprint(" "); - h = ftos(t.origin_z); - bprint(h); - if (t.target1.count) - { - bprint("\"\n\"b_pants\" \""); - h = ftos(t.target1.count); - bprint(h); - } - if (t.target2.count) - { - bprint("\"\n\"b_skill\" \""); - h = ftos(t.target2.count); - bprint(h); - } - if (t.target3.count) - { - bprint("\"\n\"b_shirt\" \""); - h = ftos(t.target3.count); - bprint(h); - } - if (t.target4.count) - { - bprint("\"\n\"b_frags\" \""); - h = ftos(t.target4.count); - bprint(h); - } - if (t.b_aiflags) - { - bprint("\"\n\"b_aiflags\" \""); - h = ftos(t.b_aiflags); - bprint(h); - } - bprint("\"\n}\n"); - self.nextthink = time + 0.01; - self.enemy = t; - -}; -void() BSPDumpWaypoints = -{ - bprint("/* BSP entities Dump - maps/"); - - bprint(mapname); - bprint(".ent\nFor instructions please read the\nreadme.html that comes with FrikBot */\n\n\n"); - - if (!fixer) - { - fixer = spawn(); - fixer.nextthink = time + 0.01; - fixer.think = PrintBSPWaypoint; - fixer.enemy = world; - } -}; diff --git a/qcsrc/bot/bot_fight.qc b/qcsrc/bot/bot_fight.qc deleted file mode 100644 index aca3ad8bf..000000000 --- a/qcsrc/bot/bot_fight.qc +++ /dev/null @@ -1,458 +0,0 @@ -/*********************************************** -* * -* FrikBot Fight Code * -* "Because I ain't no Ghandi code" * -* * -***********************************************/ - -/* - -This program is in the Public Domain. My crack legal -team would like to add: - -RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS" -AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE -ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR -FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN -NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY -GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL, -EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC" -SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES. - -You accept this software on the condition that you -indemnify and hold harmless Ryan "FrikaC" Smith from -any and all liability or damages to third parties, -including attorney fees, court costs, and other -related costs and expenses, arising out of your use -of this software irrespective of the cause of said -liability. - -The export from the United States or the subsequent -reexport of this software is subject to compliance -with United States export control and munitions -control restrictions. You agree that in the event you -seek to export this software, you assume full -responsibility for obtaining all necessary export -licenses and approvals and for assuring compliance -with applicable reexport restrictions. - -Any reproduction of this software must contain -this notice in its entirety. - -*/ - -.entity avoid; - -float(entity e) bot_size_player = -{ - local float sz; - - sz = e.health + e.armorvalue * e.armortype; - if (e.weapon == 32) - sz = sz + 60; - else if (e.weapon == 64) - sz = sz + 60; - else if (e.weapon == 16) - sz = sz + 50; - else if (e.weapon == 8) - sz = sz + 50; - else if (e.weapon == 4) - sz = sz + 40; - else if (e.weapon == 2) - sz = sz + 40; - else if (e.weapon == 1) - sz = sz + 10; - else if (e.weapon == 4096) - sz = sz - 50; - if (e.items & 4194304) // Quad - sz = sz + 200; - if (e.items & 1048576) // Invul - sz = sz + 300; - if (e.items & 524288) // Invis - sz = sz + 250; - return sz; -}; - -void() bot_dodge_stuff = -{ - local entity foe; - local float foedist, avdist, /*scandist, */foesz, flen, tsz; - local vector v; - - if (waypoint_mode > WM_LOADED) - return; - - self.avoid = world; - - - if (self.enemy) - { - v = self.origin - realorigin(self.enemy); - foedist = vlen(v); - foesz = bot_size_player(self.enemy); - } - else - { - foedist = 3000; - foesz = 9999999; - } - avdist = 256; - - foe = find(world, classname, "grenade"); - while(foe) - { - flen = vlen(foe.origin - self.origin); - if (flen < avdist) - { - avdist = flen; - self.avoid = foe; - } - foe = find(foe, classname, "grenade"); - } - if (!self.avoid) - { - foe = find(world, classname, "missile"); - while(foe) - { - if (foe.owner != self) - { - flen = vlen(foe.origin - self.origin); - if (flen < avdist) - { - avdist = flen; - self.avoid = foe; - } - } - foe = find(foe, classname, "missile"); - } - if (!self.avoid) - { - foe = find(world, classname, "spike"); - while(foe) - { - if (foe.owner != self) - { - flen = vlen(foe.origin - self.origin); - if (flen < avdist) - { - avdist = flen; - self.avoid = foe; - } - } - foe = find(foe, classname, "spike"); - } - } - } - if (coop) - { - if (!self.enemy) - { - foe = findradius(self.origin, foedist); - while(foe) - { - if(foe.flags & FL_MONSTER) - { - if(foe.health > 0) - { - flen = vlen(foe.origin - self.origin); - if (flen < foedist) - { - tsz = bot_size_player(foe); - if (tsz < foesz) - { - if (fisible(foe)) - { - self.enemy = foe; - foedist = flen; - foesz = tsz; - } - } - } - } - } - foe = foe.chain; - } - } - } - else - { - foe = player_head; - while(foe) - { - if(foe != self) - { - if (foe.modelindex != 0) - { - if (foe.health > 0) - { - if (!(teamplay && self.team == foe.team)) - { - flen = vlen(foe.origin - self.origin); - if (flen < foedist) - { - tsz = bot_size_player(foe); - if (tsz < foesz) - { - if (fov(foe) || foe.b_sound > time || self.b_skill == 3) - { - if (fisible(foe)) - { - self.enemy = foe; - foedist = vlen(foe.origin - self.origin); - } - } - } - } - } - } - } - } - foe = foe._next; - } - } -}; - - - - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -weapon_range - -_x "sweet spot range" - try to maintain this range if possible -_y minimum range bot can be to be effective (rl/gl) (move away) -_z maximum range bot can be to be effective (lg/axe) (move in) --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -vector(float wep) weapon_range = -{ - if (wep == 4096) // IT_AXE - return '48 0 64'; - else if (wep == 1) // IT_SHOTGUN - return '128 0 99999'; - else if (wep == 2) // IT_SUPER_SHOTGUN - return '128 0 99999'; - else if (wep == 4) // IT_NAILGUN - return '180 0 3000'; - else if (wep == 8) // IT_SUPER_NAILGUN - return '180 0 3000'; - else if (wep == 16) // IT_GRENADE_LAUNCHER - return '180 48 3000'; - else if (wep == 32) // IT_ROCKET_LAUNCHER - return '180 48 3000'; - else if (wep == 64) // IT_LIGHTNING - return '350 0 512'; -}; -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -bot_weapon_switch - -Pick a weapon based on range / ammo - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void(float brange) bot_weapon_switch = -{ - local float it, flag, pulse; - local vector v; - - it = self.items & 127; - - while(it) - { - if ((self.ammo_rockets >= 1) && (it & 32)) - { - flag = 32; - pulse = 7; - } - else if (self.waterlevel <= 1 && self.ammo_cells >= 1 && (it & 64)) - { - flag = 64; - pulse = 8; - } - else if(self.ammo_nails >= 2 && (it & 8)) - { - flag = 8; - pulse = 5; - } - else if ((self.ammo_rockets >= 1) && (it & 16)) - { - flag = 16; - pulse = 6; - } - else if(self.ammo_shells >= 2 && (it & 2)) - { - flag = 2; - pulse = 3; - } - else if(self.ammo_nails >= 1 && (it & 4)) - { - flag = 4; - pulse = 4; - } - else if(self.ammo_shells >= 1 && (it & 1)) - { - flag = 1; - pulse = 2; - } - else - { - if (pulse) - self.impulse = pulse; - return; - } - - if (brange == -1) - { - if (pulse) - self.impulse = pulse; - return; - } - - v = weapon_range(flag); - if (brange < v_y || brange > v_z) - it = it - flag; - else - { - if (pulse) - self.impulse = pulse; - return; - } - } -}; - -void() bot_shoot = -{ - // quick little function to stop making him shoot the wrong way ! Argh - local float g; - g = angcomp(self.v_angle_x, self.b_angle_x); - if (fabs(g) > 30) - return; // argh, too far away - g = angcomp(self.v_angle_y, self.b_angle_y); - if (fabs(g) > 30) - return; // not again! - self.button0 = TRUE; -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Bot_fight_style - -This is the core of the bot's thinking when -attacking an enemy. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void() bot_fight_style = -{ - local vector v, v1, v2, org; - local float foedist, mysz, foesz; - - - if (self.enemy.health <= 0) - { - self.enemy = world; - return; - } - else if (!self.enemy.takedamage) - { - self.enemy = world; - return; - } - else if (!fisible(self.enemy)) - { - self.enemy = world; - return; - } - - org = realorigin(self.enemy); - makevectors(self.v_angle); - - // decide if I should shoot - - foedist = vlen(org - self.origin); - v = weapon_range(self.weapon); - if (foedist > v_y && foedist < v_z) - { - traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * v_z, FALSE, self); - if (vlen(trace_endpos - (self.origin + self.view_ofs)) >= v_y) - { - // try to avoid shooting teammates - if (trace_ent.classname == "player") - if ((trace_ent.team == self.team && teamplay) || (coop)) - return; - bot_shoot(); - } - } - else - bot_weapon_switch(foedist); - - if (!(self.b_aiflags & (AI_PRECISION | AI_BLIND | AI_OBSTRUCTED))) - { - foesz = bot_size_player(self.enemy); - mysz = bot_size_player(self) + 5; - - if (foesz > mysz) - { - if (teamplay) - { - if (random() < 0.02) - { - bot_start_topic(5); - self.b_chattime = 1; - } - } - - return; - } - else if (mysz < 140) - return; - else if (self.avoid) - { - if (self.avoid.velocity) - v = self.avoid.velocity; - else - v = normalize(self.avoid.origin - self.origin); - v1_x = v_y; - v1_y = v_y * -1; - v2_x = v_y; - v2_y = v_y * -1; - foedist = vlen(self.avoid.origin - (self.origin + v1)); - if (foedist < vlen(self.avoid.origin - (self.origin + v2))) - frik_walkmove(v2); - else - frik_walkmove(v1); - } - else if (!self.enemy.flags & FL_MONSTER) - { - if (foedist + 32 < v_x) - frik_walkmove(self.origin - org); - else if (foedist - 32 > v_x) - frik_walkmove(org - self.origin); - else if (self.wallhug) - frik_walkmove(v_right); - else - frik_walkmove(v_right * -1); - } - } - else - { - foesz = bot_size_player(self.enemy); - mysz = bot_size_player(self) + 5; - - if (foesz > mysz) - return; - else if (mysz < 140) - return; - self.keys = self.keys & 960; - } -}; - - diff --git a/qcsrc/bot/bot_misc.qc b/qcsrc/bot/bot_misc.qc deleted file mode 100644 index 31d37e2a2..000000000 --- a/qcsrc/bot/bot_misc.qc +++ /dev/null @@ -1,777 +0,0 @@ -/*********************************************** -* * -* FrikBot Misc Code * -* "Because you can't name it anything else" * -* * -***********************************************/ - -/* -This program is in the Public Domain. My crack legal -team would like to add: - -RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS" -AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE -ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR -FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN -NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY -GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL, -EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC" -SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES. - -You accept this software on the condition that you -indemnify and hold harmless Ryan "FrikaC" Smith from -any and all liability or damages to third parties, -including attorney fees, court costs, and other -related costs and expenses, arising out of your use -of this software irrespective of the cause of said -liability. - -The export from the United States or the subsequent -reexport of this software is subject to compliance -with United States export control and munitions -control restrictions. You agree that in the event you -seek to export this software, you assume full -responsibility for obtaining all necessary export -licenses and approvals and for assuring compliance -with applicable reexport restrictions. - -Any reproduction of this software must contain -this notice in its entirety. - -*/ - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -BotName - -Sets bot's name and colors - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ -string(float r) BotName = -{ - self.b_num = r; - if (r == 1) - { - self.b_pants = 11; - self.b_shirt = 0; - return "Vincent"; - } - else if (r == 2) - { - self.b_pants = 1; - self.b_shirt = 3; - return "Bishop"; - } - else if (r == 3) - { - self.b_pants = 13; - self.b_shirt = 2; - return "Nomad"; - } - else if (r == 4) - { - self.b_pants = 7; - self.b_shirt = 6; - return "Hudson"; - } - else if (r == 5) - { - self.b_pants = 12; - self.b_shirt = 6; - return "Lore"; - } - else if (r == 6) - { - self.b_pants = 4; - self.b_shirt = 4; - return "Servo"; - } - else if (r == 7) - { - self.b_pants = 2; - self.b_shirt = 5; - return "Gort"; - } - else if (r == 8) - { - self.b_pants = 10; - self.b_shirt = 3; - return "Kryten"; - } - else if (r == 9) - { - self.b_pants = 9; - self.b_shirt = 4; - return "Pimp Bot"; - } - else if (r == 10) - { - self.b_pants = 4; - self.b_shirt = 7; - return "Max"; - } - else if (r == 11) - { - self.b_pants = 3; - self.b_shirt = 11; - return "Marvin"; - } - else if (r == 12) - { - self.b_pants = 13; - self.b_shirt = 12; - return "Erwin"; - } - else if (r == 13) - { - self.b_pants = 11; - self.b_shirt = 2; - return "FrikBot"; - } - else if (r == 14) - { - self.b_pants = 0; - self.b_shirt = 2; - return "Krosis"; - } - else if (r == 15) - { - self.b_pants = 8; - self.b_shirt = 9; - return "Gypsy"; - } - else if (r == 16) - { - self.b_pants = 5; - self.b_shirt = 10; - return "Hal"; - } -}; -string () PickARandomName = -{ - if (bot_count > 16) - return "player"; - - local float y, test; - local string h; - local entity t; - y = TRUE; - while(y) - { - test = ceil(random() * 16); - h = BotName(test); - t = find(world, netname, h); - if (t == world) - y = FALSE; - } - return h; -}; - - - -// I didn't like the old code so this is very stripped down - -entity b_originator; -float b_topic; -/* FBX Topics - -b_originator == self - 1 - sign on - 2 - killed targ - 3 - team message "friendly eyes" - 4 - team message "on your back" - 5 - team message "need back up" - 6 - excuses - ---- - 7 - gameover - ---- - 8 - welcoming someone onto server - 9 - ridicule lost frag (killed self?) - 10 - ridicule lost frag (lava) - 11 - lag -b_originator == targ - - -*/ -void(float tpic) bot_start_topic = -{ - if (random() < 0.2) - { - b_topic = tpic; - b_originator = self; - } - else - b_topic = 0; -}; - -void() bot_chat = -{ - local float r; - if (b_options & OPT_NOCHAT) - return; - r = ceil (random() * 6); - - if (self.b_chattime > time) - { - if (self.b_skill < 2) - self.keys = self.button0 = self.button2 = 0; - return; - } - else if (self.b_chattime) - { - if (b_topic == 1) - { - if (b_originator == self) - { - if (r == 1) - { - BotSay(": lo all\n"); - bot_start_topic(8); - } - else if (r == 2) - { - BotSay(": hey everyone\n"); - bot_start_topic(8); - } - else if (r == 3) - { - BotSay(": prepare to be fragged!\n"); - bot_start_topic(0); - } - else if (r == 4) - { - BotSay(": boy this is laggy\n"); - bot_start_topic(11); - } - else if (r == 5) - { - BotSay(": #mm getting some lag here\n"); - bot_start_topic(11); - } - else - { - BotSay(": hi everyone\n"); - bot_start_topic(8); - } - } - } - else if (b_topic == 2) - { - if (b_originator == self) - { - if (r == 1) - BotSay(": take that\n"); - else if (r == 2) - BotSay(": yehaww!\n"); - else if (r == 3) - BotSay(": wh00p\n"); - else if (r == 4) - BotSay(": j00_sawk();\n"); - else if (r == 5) - BotSay(": i rule\n"); - else - BotSay(": eat that\n"); - bot_start_topic(0); - } - } - else if (b_topic == 3) - { - if (b_originator == self) - { - if (r < 3) - BotSayTeam(": friendly eyes\n"); - else - BotSayTeam(": team eyes\n"); - bot_start_topic(0); - } - } - else if (b_topic == 4) - { - if (b_originator == self) - { - if (r < 3) - BotSayTeam(": on your back\n"); - else - BotSayTeam(": I'm with you\n"); - bot_start_topic(0); - } - } - else if (b_topic == 5) - { - if (b_originator == self) - { - if (r < 3) - BotSayTeam(": I need help\n"); - else - BotSayTeam(": need backup\n"); - bot_start_topic(0); - } - } - else if (b_topic == 6) - { - if (b_originator == self) - { - if (r == 1) - { - BotSay(": sun got in my eyes\n"); - bot_start_topic(0); - } - else if (r == 2) - { - BotSay(": mouse needs cleaning\n"); - bot_start_topic(0); - } - else if (r == 3) - { - BotSay(": i meant to do that\n"); - bot_start_topic(0); - } - else if (r == 4) - { - BotSay(": lag\n"); - bot_start_topic(11); - } - else if (r == 5) - { - BotSay(": killer lag\n"); - bot_start_topic(11); - } - else - { - BotSay(": 100% lag\n"); - bot_start_topic(11); - } - } - } - else if (b_topic == 7) - { - if (r == 1) - BotSay(": gg\n"); - else if (r == 2) - BotSay(": gg all\n"); - else if (r == 3) - BotSay(": that was fun\n"); - else if (r == 4) - BotSay(": good game\n"); - else if (r == 5) - BotSay(": pah\n"); - else - BotSay(": hrm\n"); - bot_start_topic(0); - } - else if (b_topic == 8) - { - if (b_originator != self) - { - if (r == 1) - { - BotSay(": heya\n"); - bot_start_topic(0); - } - else if (r == 2) - { - BotSay(": welcome\n"); - bot_start_topic(0); - } - else if (r == 3) - { - BotSayInit(); - BotSay2(": hi "); - BotSay2(b_originator.netname); - BotSay2("\n"); - bot_start_topic(0); - } - else if (r == 4) - { - BotSayInit(); - BotSay2(": hey "); - BotSay2(b_originator.netname); - BotSay2("\n"); - bot_start_topic(0); - } - else if (r == 5) - { - BotSay(": howdy\n"); - bot_start_topic(0); - } - else - { - BotSay(": lo\n"); - bot_start_topic(0); - } - } - } - - else if (b_topic == 9) - { - if (b_originator != self) - { - if (r == 1) - BotSay(": hah\n"); - else if (r == 2) - BotSay(": heheh\n"); - else if (r == 3) - { - BotSayInit(); - BotSay2(": good work "); - BotSay2(b_originator.netname); - BotSay2("\n"); - } - else if (r == 4) - { - BotSayInit(); - BotSay2(": nice1 "); - BotSay2(b_originator.netname); - BotSay2("\n"); - } - else if (r == 5) - BotSay(": lol\n"); - else - BotSay(": :)\n"); - b_topic = 6; - } - } - else if (b_topic == 10) - { - if (b_originator != self) - { - if (r == 1) - BotSay(": have a nice dip?\n"); - else if (r == 2) - BotSay(": bah I hate levels with lava\n"); - else if (r == 3) - { - BotSayInit(); - BotSay2(": good job "); - BotSay2(b_originator.netname); - BotSay2("\n"); - } - else if (r == 4) - { - BotSayInit(); - BotSay2(": nice backflip "); - BotSay2(b_originator.netname); - BotSay2("\n"); - } - else if (r == 5) - BotSay(": watch your step\n"); - else - BotSay(": hehe\n"); - b_topic = 6; - } - } - - else if (b_topic == 11) - { - if (b_originator != self) - { - if (r == 1) - { - BotSayInit(); - BotSay2(": yeah right "); - BotSay2(b_originator.netname); - BotSay2("\n"); - bot_start_topic(0); - } - else if (r == 2) - { - BotSay(": ping\n"); - bot_start_topic(0); - } - else if (r == 3) - { - BotSay(": shuddup, you're an lpb\n"); - bot_start_topic(0); - } - else if (r == 4) - { - BotSay(": lag my eye\n"); - bot_start_topic(0); - } - else if (r == 5) - { - BotSay(": yeah\n"); - bot_start_topic(11); - } - else - { - BotSay(": totally\n"); - bot_start_topic(11); - } - } - } - self.b_chattime = 0; - } - else if (b_topic) - { - if (random() < 0.5) - { - if (self == b_originator) - { - if (b_topic <= 7) - self.b_chattime = time + 2; - } - else - { - if (b_topic >= 7) - self.b_chattime = time + 2; - } - } - } -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Kick A Bot. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void() KickABot = -{ - local entity ty; - ty = find(world, classname, "player"); - while (ty != world) - { - if (!(ty.ishuman)) - { - - BotDisconnect(ty); - ty.ishuman = TRUE; - ty = world; - } - else - ty = find(ty, classname, "player"); - } - -}; - - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Simplified origin checking. - -God, I wish I had inline - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -vector(entity ent) realorigin = -{ -// even more simplified... - return (ent.absmin + ent.absmax) * 0.5; -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -fisible - -a version of visible that checks for corners -of the bounding boxes - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -float (entity targ) fisible = -{ - local vector spot1, org; - local float thruwater, pc1, pc2; - - org = realorigin(targ); - spot1 = self.origin + self.view_ofs; - - if (targ.solid == SOLID_BSP) - { - traceline (spot1, org, TRUE, self); - if (trace_ent == targ) - return TRUE; - else if (trace_fraction == 1) - return TRUE; - return FALSE; - } - else - { - pc1 = pointcontents(org); - pc2 = pointcontents(spot1); - if (targ.classname == "player") - thruwater = FALSE; - else if (pc1 == CONTENT_LAVA) - return FALSE; - else - thruwater = TRUE; - } - - if (pc1 < -1) // targ's origin is in water or other liquid - { - if (pc2 != pc1) - { - // look for their head - traceline (spot1, org + targ.mins, TRUE, self); - // cross the water check - if (trace_inopen) - if (trace_inwater) - if (!thruwater) - return FALSE; - if (trace_ent == targ) - return TRUE; - else if (trace_fraction == 1) - return TRUE; - return FALSE; - } - } - else - { - if (pc2 != pc1) - { - traceline (spot1, org + targ.maxs, TRUE, self); - if (trace_inopen) - if (trace_inwater) - if (!thruwater) - return FALSE; - if (trace_ent == targ) - return TRUE; - else if (trace_fraction == 1) - return TRUE; - return FALSE; - } - } - traceline (spot1, org, TRUE, self); - if (trace_ent == targ) - return TRUE; - else if (trace_fraction == 1) - return TRUE; - traceline (spot1, org + targ.maxs, TRUE, self); - if (trace_ent == targ) - return TRUE; - else if (trace_fraction == 1) - return TRUE; - traceline (spot1, org + targ.mins, TRUE, self); - if (trace_ent == targ) - return TRUE; - else if (trace_fraction == 1) - return TRUE; - return FALSE; -}; - - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Wisible - -goes through movable brushes/entities, used -for waypoints - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -// this is used for waypoint stuff.... -float (entity targ1, entity targ2) wisible = -{ - local vector spot1, spot2; - local entity ignore; - - spot1 = targ1.origin; - spot2 = realorigin(targ2); - - ignore = self; - do - { - traceline (spot1, spot2, TRUE, ignore); - spot1 = realorigin(trace_ent); - ignore = trace_ent; - } while ((trace_ent != world) && (trace_fraction != 1)); - if (trace_endpos == spot2) - return TRUE; - else - return FALSE; -}; - - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -sisible - -Now this is getting ridiculous. Simple visible, -used when we need just a simple traceline nothing else - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -float (entity targ) sisible = -{ - traceline (self.origin, targ.origin, TRUE, self); - if (trace_ent == targ) - return TRUE; - else if (trace_fraction == 1) - return TRUE; -}; -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -angcomp - -subtracts one angle from another - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -float (float y1, float y2) angcomp = -{ - y1 = frik_anglemod(y1); - y2 = frik_anglemod(y2); - - local float answer; - answer = y1 - y2; - if (answer > 180) - answer = (360 - answer) * -1; - else if (answer < -180) - answer = answer + 360; - return answer; -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -fov - -is the entity in the bot's field of view - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ -float (entity targ) fov = -{ - local vector yawn; - local float g; - yawn = realorigin(targ); - yawn = (yawn + targ.view_ofs) - (self.origin + self.view_ofs); - yawn = normalize(yawn); - yawn = vectoangles(yawn); - g = angcomp(self.v_angle_x, yawn_x); - if (fabs(g) > 45) - return FALSE; - g = angcomp(self.v_angle_y, yawn_y); - if (fabs(g) > 60) - return FALSE; - - return TRUE; -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -frik_anglemod - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ -float(float v) frik_anglemod = -{ - return v - floor(v/360) * 360; -}; \ No newline at end of file diff --git a/qcsrc/bot/bot_move.qc b/qcsrc/bot/bot_move.qc deleted file mode 100644 index 1ac0d32b8..000000000 --- a/qcsrc/bot/bot_move.qc +++ /dev/null @@ -1,512 +0,0 @@ -/*********************************************** -* * -* FrikBot Movement AI * -* "The slightly better movement AI" * -* * -***********************************************/ - -/* - -This program is in the Public Domain. My crack legal -team would like to add: - -RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS" -AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE -ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR -FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN -NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY -GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL, -EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC" -SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES. - -You accept this software on the condition that you -indemnify and hold harmless Ryan "FrikaC" Smith from -any and all liability or damages to third parties, -including attorney fees, court costs, and other -related costs and expenses, arising out of your use -of this software irrespective of the cause of said -liability. - -The export from the United States or the subsequent -reexport of this software is subject to compliance -with United States export control and munitions -control restrictions. You agree that in the event you -seek to export this software, you assume full -responsibility for obtaining all necessary export -licenses and approvals and for assuring compliance -with applicable reexport restrictions. - -Any reproduction of this software must contain -this notice in its entirety. - -*/ - -void() bot_jump = -{ - // TODO check for precision, etc. - self.button2 = TRUE; -}; - -float(entity e) bot_can_rj = -{ - // this returns true of the bot can rocket/superjump/hook - // if your mod doesn't have an RL you can just return FALSE all the time - // if it has a hook or some other means for the bot to get to high places - // you can check here for that capability - - // am I dumb? - if (e.b_skill == 0) - return FALSE; - - // quad = bad - if (e.items & 4194304) - return FALSE; - - // do I have rockets & RL? - if (!((e.items & 32) && (e.ammo_rockets > 0))) - return FALSE; - - // do I have pent? - if (e.items & 1048576) - return TRUE; - - if (e.health > 50) - return TRUE; - else - return FALSE; -}; - -float(float flag) frik_recognize_plat = -{ - if ((self.classname != "waypoint") && !(self.flags & FL_ONGROUND)) - return FALSE; - traceline(self.origin, self.origin - '0 0 64', TRUE, self); - if (trace_ent != world) - { - if (flag) // afect bot movement too - { - if (self.keys & KEY_MOVEUP) - { - if (trace_ent.velocity_z > 0) - self.keys = self.keys & 960; // 960 is all view keys - } - else if (self.keys & KEY_MOVEDOWN) - { - if (trace_ent.velocity_z < 0) - self.keys = self.keys & 960; - } - } - return TRUE; - } - else - return FALSE; -}; - -float(vector sdir) frik_KeysForDir = -{ - - local vector keydir; - local float outkeys, tang; - outkeys = 0; - if (sdir_x || sdir_y) - { - // Everything is tested against 60 degrees, - // this allows the bot to overlap the keys - // 30 degrees on each diagonal 45 degrees - // might look more realistic - - keydir = vectoangles(sdir); - tang = angcomp(keydir_y, self.v_angle_y); - if ((tang <= 150) && (tang >= 30)) - outkeys = outkeys + KEY_MOVELEFT; - else if ((tang >= -150) && (tang <= -30)) - outkeys = outkeys + KEY_MOVERIGHT; - if (fabs(tang) <= 60) - outkeys = outkeys + KEY_MOVEFORWARD; - else if (fabs(tang) >= 120) - outkeys = outkeys + KEY_MOVEBACK; - } - if (sdir_z > 0.7) - outkeys = outkeys + KEY_MOVEUP; - else if (sdir_z < 0.7) - outkeys = outkeys + KEY_MOVEDOWN; - return outkeys; - -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -frik_obstructed - -Bot has hit a ledge or wall that he should -manuever around. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void(vector whichway, float danger) frik_obstructed = -{ - local float dist; - local vector disway, org; -// TODO: something - if (self.b_aiflags & AI_BLIND) - return; - org = realorigin(self.target1); - - if (danger) - { - self.b_aiflags = self.b_aiflags | AI_DANGER; - self.keys = frik_KeysForDir('0 0 0' - whichway); - } - if (self.b_aiflags & AI_PRECISION) - return; - - - if (self.target1) - { - if (self.b_aiflags & AI_OBSTRUCTED) - { - if (!(self.b_aiflags & AI_DANGER)) - { - self.b_aiflags = self.b_aiflags - AI_OBSTRUCTED; - return; - } - else if (!danger) - return; - } - self.obs_dir = whichway; - disway_x = whichway_y * -1; - disway_y = whichway_x; - dist = vlen(org - (self.origin + disway)); - disway_x = whichway_y; - disway_y = whichway_x * -1; - self.wallhug = vlen(org - (self.origin + disway)) > dist; - self.b_aiflags = self.b_aiflags | AI_OBSTRUCTED; - - } - else - { - disway_x = whichway_y * -1; - disway_y = whichway_x; - dist = vlen(disway - self.obs_dir); - disway_x = whichway_y; - disway_y = whichway_x * -1; - self.wallhug = vlen(disway - self.obs_dir) < dist; - self.obs_dir = whichway; - - self.b_aiflags = self.b_aiflags | AI_OBSTRUCTED; - } -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -frik_obstacles - -Detects small bumps the bot needs to jump over -or ledges the bot should avoid falling in. - -Also responsible for jumping gaps. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void() frik_obstacles = -{ - local vector start, stop, ang; - local float test, conts, dist, hgt; - - if (!(self.flags & FL_ONGROUND)) - return; - if (self.b_aiflags & AI_BLIND) - return; - - ang = normalize(self.velocity); - ang_z = 0; - start = self.origin + ang * 32; // ahem - start_z = self.origin_z + self.maxs_z; - stop = start; - stop_z = self.origin_z + self.mins_z; - traceline(start, stop - '0 0 256', TRUE, self); - if (trace_allsolid || trace_startsolid) - return; - hgt = trace_endpos_z - stop_z; - - if (hgt > 18) - { - bot_jump(); - return; - } - if (hgt >= 0) - return; - - conts = pointcontents(trace_endpos + '0 0 4'); - start = stop - '0 0 8'; - stop = start + ang * 256; - traceline(start, stop, TRUE, self); - test = vlen(trace_endpos - start); - if (test <= 20) - return; // it's a walkable gap, do nothing - ang_x = self.velocity_y * -1; - ang_y = self.velocity_x; - ang = normalize(ang); - traceline(start - (ang * 10), start + (ang * 10), TRUE, self); - if ((trace_fraction != 1) || trace_startsolid) - return; // gap is only 20 wide, walkable - ang = self.velocity; - ang_z = 0; - dist = ((540 / sv_gravity) * vlen(ang))/* + 32*/; - if (test > dist) // I can't make it - { - if (conts < -3) // bad stuff down dare - { - frik_obstructed(ang, TRUE); - return; - } - else - { - if (self.target1) - { - stop = realorigin(self.target1); - if ((stop_z - self.origin_z) < -32) - return; // safe to fall - } - frik_obstructed(ang, FALSE); - return; - } - } - else - { - ang = normalize(ang); - //look for a ledge - traceline(self.origin, self.origin + (ang * (test + 20)), TRUE, self); - if (trace_fraction != 1) - { - if (conts < -3) // bad stuff down dare - { - frik_obstructed(ang, TRUE); - return; - } - else - { - if (self.target1) - { - stop = realorigin(self.target1); - if ((stop_z - self.origin_z) < -32) - return; // safe to fall - } - frik_obstructed(ang, FALSE); - return; - } - } - - if (self.target1) - { - // getting furter away from my target? - test = vlen(self.target1.origin - (ang + self.origin)); - if (test > vlen(self.target1.origin - self.origin)) - { - if (conts < -3) // bad stuff down dare - { - frik_obstructed(ang, TRUE); - return; - } - else - { - frik_obstructed(ang, FALSE); - return; - } - } - } - } - if (hgt < -18) - { - if (self.target1) - { - stop = realorigin(self.target1); - if ((stop_z - self.origin_z) < -32) - return; // safe to fall - } - bot_jump(); - } - // go for it - -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -After frik_obstructed, the bot uses the -following funtion to move "around" the obstacle - -I have no idea how well it will work - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void() frik_dodge_obstruction = -{ - local vector way, org; - local float oflags, yaw; - - if (!(self.b_aiflags & AI_OBSTRUCTED)) - return; - if ((self.b_aiflags & (AI_BLIND | AI_PRECISION)) || !(self.flags & FL_ONGROUND)) - { - self.b_aiflags = self.b_aiflags - AI_OBSTRUCTED; - return; - } - - // perform a walkmove check to see if the obs_dir is still obstructed - // walkmove is less forgiving than frik_obstacles, so I dunno - // how well this will work - - oflags = self.flags; - org = self.origin; - - yaw = vectoyaw(self.obs_dir); - if (walkmove(yaw, 32)) - self.b_aiflags = self.b_aiflags - AI_OBSTRUCTED; - else - { - if (self.b_aiflags & AI_DANGER) - { - way = '0 0 0' - self.obs_dir; - } - else if (self.wallhug) - { - way_x = self.obs_dir_y * -1; - way_y = self.obs_dir_x; - } - else - { - way_x = self.obs_dir_y; - way_y = self.obs_dir_x * -1; - } - self.keys = self.keys & 960 + frik_KeysForDir(way); - } - - // fix the bot - - self.origin = org; - self.flags = oflags; -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -movetogoal and walkmove replacements - -blah - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void() frik_movetogoal = -{ - local vector way/*, start, stop, ang*/; - local float g; - - if (self.target1 == world) - { - makevectors(self.v_angle); - frik_walkmove(v_forward); - return; - } - way = realorigin(self.target1) - self.origin; - if (vlen(way) < 25) - { - self.keys = self.keys & 960; - return; - } - - way = normalize(way); - self.keys = self.keys & 960 + frik_KeysForDir(way); - - frik_dodge_obstruction(); - frik_recognize_plat(TRUE); - - if (self.b_aiflags & AI_PRECISION) - { - g = angcomp(self.v_angle_x, self.b_angle_x); - if (fabs(g) > 10) - self.keys = self.keys & 960; - g = angcomp(self.v_angle_y, self.b_angle_y); - if (fabs(g) > 10) - self.keys = self.keys & 960; - } -}; - -float(vector weird) frik_walkmove = -{ - // okay so it's not walkmove - // sue me - self.keys = self.keys & 960 + frik_KeysForDir(weird); - - frik_dodge_obstruction(); - frik_recognize_plat(TRUE); - if (self.b_aiflags & AI_OBSTRUCTED) - return FALSE; - else - return TRUE; -}; - - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -The "hook" method of navigation. This nav -system is copyrighted 1999 by Ryan "Frika C" -Smith, keep that in mind when you steal it. - -I brought this back because normal roaming -won't work - the bot gets distracted by it's -own waypoints. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void() frik_bot_roam = -{ - local vector org, ang, org1; - local float loopcount, flag, dist; - - loopcount = 26; - flag = FALSE; - while((loopcount > 0) && !flag) - { - loopcount = loopcount - 1; - org = self.origin + self.view_ofs; - ang = self.angles; - ang_y = frik_anglemod(ang_y - 90 + (random() * 180)); - ang_x = 0; // avoid upward sloping - makevectors(ang); - traceline(org, org + v_forward * 2300, TRUE, self); - if (trace_fraction != 1) - { - org1 = trace_endpos; - ang = normalize(trace_plane_normal); - ang_z = 0; // avoid upward sloping - traceline(org1, org1 + (ang * 2300), TRUE, self); - if ((trace_fraction != 1) && (vlen(trace_endpos - org1) >= 64)) - { - org = trace_endpos; - traceline(org, self.origin + self.view_ofs, TRUE, self); - if (trace_fraction != 1) - { - dist = vlen(org1 - org) /2; - org = org1 + (ang * dist); - traceline(org, org - '0 0 48', TRUE, self); - if (trace_fraction != 1) - { - SpawnTempWaypoint(org); - flag = TRUE; - } - } - } - } - } - self.b_angle_y = self.v_angle_y + 10; -}; diff --git a/qcsrc/bot/bot_phys.qc b/qcsrc/bot/bot_phys.qc deleted file mode 100644 index 597c485af..000000000 --- a/qcsrc/bot/bot_phys.qc +++ /dev/null @@ -1,678 +0,0 @@ -/*********************************************** -* * -* FrikBot Physics * -* The near-perfect emulation of * -* Client movement * -* * -* Special Thanks to: Asdf, Frog * -* Alan "Strider" Kivlin * -* * -* * -***********************************************/ - -/* - -This program is in the Public Domain. My crack legal -team would like to add: - -RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS" -AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE -ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR -FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN -NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY -GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL, -EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC" -SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES. - -You accept this software on the condition that you -indemnify and hold harmless Ryan "FrikaC" Smith from -any and all liability or damages to third parties, -including attorney fees, court costs, and other -related costs and expenses, arising out of your use -of this software irrespective of the cause of said -liability. - -The export from the United States or the subsequent -reexport of this software is subject to compliance -with United States export control and munitions -control restrictions. You agree that in the event you -seek to export this software, you assume full -responsibility for obtaining all necessary export -licenses and approvals and for assuring compliance -with applicable reexport restrictions. - -Any reproduction of this software must contain -this notice in its entirety. - -*/ - -/* -========================================= - -Stuff mimicking cl_input.c code - -========================================= -*/ -float(float key) CL_KeyState = -{ - return ((self.keys & key) > 0); -}; - -void() CL_KeyMove = // CL_BaseMove + CL_AdjustAngles -{ - local float anglespeed; - local vector view; - if (self.keys != self.oldkeys) - { - self.movement = '0 0 0'; - self.movement_y = self.movement_y + (350 * CL_KeyState(KEY_MOVERIGHT)); - // 350 is the default cl_sidespeed - self.movement_y = self.movement_y - (350 * CL_KeyState(KEY_MOVELEFT)); - // 350 is the default cl_sidespeed - self.movement_x = self.movement_x + (200 * CL_KeyState(KEY_MOVEFORWARD)); - // 200 is the default cl_forwardspeed - self.movement_x = self.movement_x - (200 * CL_KeyState(KEY_MOVEBACK)); - // 200 is the default cl_backspeed - self.movement_z = self.movement_z + (200 * CL_KeyState(KEY_MOVEUP)); - // 200 is the default cl_upspeed - self.movement_z = self.movement_z - (200 * CL_KeyState(KEY_MOVEDOWN)); - // 200 is the default cl_upspeed - if (!self.b_aiflags & AI_PRECISION) - self.movement = self.movement * 2; - // 2 is the default cl_movespeedkey & bot always has +speed - } - self.oldkeys = self.keys; - - if (self.b_skill != 2) // use mouse emulation - { - anglespeed = 1.5 * real_frametime; - // 1.5 is the default cl_anglespeedkey & bot always has +speed - self.v_angle_y = self.v_angle_y + anglespeed * CL_KeyState(KEY_LOOKLEFT) * 140; - // 140 is default cl_yawspeed - self.v_angle_y = self.v_angle_y - anglespeed * CL_KeyState(KEY_LOOKRIGHT) * 140; - // 140 is default cl_yawspeed - self.v_angle_x = self.v_angle_x - anglespeed * CL_KeyState(KEY_LOOKUP) * 150; - // 150 is default cl_pitchspeed - self.v_angle_x = self.v_angle_x + anglespeed * CL_KeyState(KEY_LOOKDOWN) * 150; - // 150 is default cl_pitchspeed - } - else - { - view_x = angcomp(self.b_angle_x, self.v_angle_x); - view_y = angcomp(self.b_angle_y, self.v_angle_y); - if (vlen(view) > 30) - { - self.mouse_emu = self.mouse_emu + (view * 30); - if (vlen(self.mouse_emu) > 180) - self.mouse_emu = normalize(self.mouse_emu) * 180; - } - else - self.mouse_emu = view * (1 / real_frametime); - self.v_angle = self.v_angle + self.mouse_emu * real_frametime; - - - } - if (self.v_angle_x > 80) - self.v_angle_x = 80; - else if (self.v_angle_x < -70) - self.v_angle_x = -70; - - if (self.v_angle_z > 50) - self.v_angle_z = 50; - else if (self.v_angle_z < -50) - self.v_angle_z = -50; - self.v_angle_y = frik_anglemod(self.v_angle_y); - -}; - -/* -========================================= - -Stuff mimicking sv_user.c - -========================================= -*/ -void() SV_UserFriction = -{ - local vector vel, start, stop; - local float sped, friction, newspeed; - - vel = self.velocity; - vel_z =0; - sped = vlen(vel); - vel = self.velocity; - - if (!sped) - return; - -// if the leading edge is over a dropoff, increase friction - - start_x = stop_x = self.origin_x + vel_x / (sped * 16); - start_y = stop_y = self.origin_y + vel_y / (sped * 16); - start_z = self.origin_z + self.mins_z; - stop_z = start_z - 34; - - traceline(start, stop, TRUE, self); - - if (trace_fraction == 1) - friction = sv_friction * 2; // 2 is default edgefriction, removed for QW compatability - else - friction = sv_friction; - if (sped < sv_stopspeed) - newspeed = sped - real_frametime * sv_stopspeed * friction; - else - newspeed = sped - real_frametime * sped * friction; - - if (newspeed < 0) - newspeed = 0; - newspeed = newspeed / sped; - - self.velocity_y = vel_y * newspeed; - self.velocity_x = vel_x * newspeed; -}; -void() SV_WaterJump = -{ - if (time > self.teleport_time || !self.waterlevel) - { - self.flags = self.flags - (self.flags & FL_WATERJUMP); - self.teleport_time = 0; - } - self.velocity_x = self.movedir_x; - self.velocity_y = self.movedir_y; -}; - -void() DropPunchAngle = -{ - local float len; - len = vlen(self.punchangle); - self.punchangle = normalize(self.punchangle); - len = len - 10 * real_frametime; - if (len < 0) - len = 0; - self.punchangle = self.punchangle * len; -}; - - -void(vector wishvel) SV_AirAccelerate = -{ - local float addspeed, wishspd, accelspeed, currentspeed; - - wishspd = vlen(wishvel); - wishvel = normalize(wishvel); - if (wishspd > 30) - wishspd = 30; - currentspeed = self.velocity * wishvel; - addspeed = wishspd - currentspeed; - if (addspeed <= 0) - return; - accelspeed = 10 * sv_accelerate * wishspd * real_frametime; - if (accelspeed > addspeed) - accelspeed = addspeed; - - self.velocity = self.velocity + accelspeed * wishvel; -}; - -void(vector wishvel) SV_Accelerate = -{ - local float addspeed, wishspd, accelspeed, currentspeed; - - wishspd = vlen(wishvel); - wishvel = normalize(wishvel); - - currentspeed = self.velocity * wishvel; - addspeed = wishspd - currentspeed; - if (addspeed <= 0) - return; - accelspeed = sv_accelerate * wishspd * real_frametime; - if (accelspeed > addspeed) - accelspeed = addspeed; - - self.velocity = self.velocity + accelspeed * wishvel; -}; -void() SV_WaterMove = -{ - local vector wishvel; - local float wishspeed, addspeed, cspeed, newspeed; - makevectors(self.v_angle); - wishvel = v_right * self.movement_y + v_forward * self.movement_x; - - if (self.movement == '0 0 0') - wishvel_z = wishvel_z - 60; - else - wishvel_z = wishvel_z + self.movement_z; - wishspeed = vlen(wishvel); - - if (wishspeed > sv_maxspeed) - { - wishvel = (sv_maxspeed / wishspeed) * wishvel; - wishspeed = sv_maxspeed; - } - wishspeed = wishspeed * 0.7; - cspeed = vlen(self.velocity); - if (cspeed) - { - newspeed = cspeed - (real_frametime * cspeed * sv_friction); - if (newspeed < 0) - newspeed = 0; - self.velocity = self.velocity * (newspeed / cspeed); - - } - else - newspeed = 0; - - if (!wishspeed) - return; - addspeed = wishspeed - newspeed; - if (addspeed <= 0) - return; - wishvel = normalize(wishvel); - cspeed = sv_accelerate * wishspeed * real_frametime; - if (cspeed > addspeed) - cspeed = addspeed; - self.velocity = self.velocity + cspeed * wishvel; -}; -void() SV_AirMove = -{ - local vector wishvel, vangle; - - vangle = self.v_angle; - vangle_x = vangle_z = 0; - makevectors(vangle); - if (time < self.teleport_time && (self.movement_x < 0)) - self.movement_x = 0; - wishvel = v_right * self.movement_y + v_forward * self.movement_x; - - - if (self.movetype != MOVETYPE_WALK) - wishvel_z = self.movement_z; - else - wishvel_z = 0; - if (vlen(wishvel) > sv_maxspeed) - wishvel = normalize(wishvel) * sv_maxspeed; - if (self.movetype == MOVETYPE_NOCLIP) - self.velocity = wishvel; - else if (self.flags & FL_ONGROUND) - { - SV_UserFriction(); - SV_Accelerate(wishvel); - } - else - SV_AirAccelerate (wishvel); -}; - -void() SV_ClientThink = -{ - local vector vangle; - - if (self.movetype == MOVETYPE_NONE) - return; - DropPunchAngle(); - if (self.health <= 0) - return; - self.v_angle_z = 0; // V_CalcRoll removed, sucks - self.angles_z = self.v_angle_z * 4; - vangle = self.v_angle + self.punchangle; - if (!self.fixangle) - { - self.angles_x = (vangle_x / -3); - self.angles_y = vangle_y; - } else - { - self.v_angle = self.angles; - self.fixangle = 0; - } - if (self.flags & FL_WATERJUMP) - { - SV_WaterJump(); - return; - } - if ((self.waterlevel >= 2) && (self.movetype != MOVETYPE_NOCLIP)) - { - SV_WaterMove(); - return; - } - SV_AirMove(); - -}; -/* -========================================= - -Stuff mimicking sv_phys.c - -========================================= -*/ - -float() SV_RunThink = -{ - local float thinktime, bkuptime; - thinktime = self.nextthink; - bkuptime = time; - if (thinktime <= 0 || thinktime > (time + real_frametime)) - return TRUE; - if (thinktime < time) - thinktime = time; - self.nextthink = 0; - time = thinktime; - other = world; - makevectors(self.v_angle); // hack - self.think(); - time = bkuptime; - return TRUE; -}; - -void(float scale) SV_AddGravity = -{ - self.velocity_z = self.velocity_z - (scale * sv_gravity * real_frametime); -}; - -float() SV_CheckWater = -{ - local vector point; - local float cont; - - point_x = self.origin_x; - point_y = self.origin_y; - self.waterlevel = 0; - self.watertype = CONTENT_EMPTY; - point_z = self.origin_z + self.mins_z + 1; - cont = pointcontents(point); - if (cont <= CONTENT_WATER) - { - self.watertype = cont; - self.waterlevel = 1; - point_z = self.origin_z + (self.mins_z + self.maxs_z) * 0.5; - cont = pointcontents(point); - if (cont <= CONTENT_WATER) - { - self.waterlevel = 2; - point_z = self.origin_z + self.view_ofs_z; - cont = pointcontents(point); - if (cont <= CONTENT_WATER) - self.waterlevel = 3; - } - } - return (self.waterlevel > 1); - -}; -void() RemoveThud = // well sometimes -{ - local entity oself; - if (other == world) - { - if (self.flags & FL_ONGROUND) - { - self.flags = self.flags - FL_ONGROUND; - } - } - else - { - if (other.solid == SOLID_BSP && (self.flags & FL_ONGROUND)) - { - // RM: Does this break anything? - // If not, then some more thuds have been removed. - self.flags = self.flags - FL_ONGROUND; - } - if (other == self.owner) - return; - if (self.owner.solid == SOLID_NOT) - return; - oself = other; - other = self.owner; - self = oself; - if (self.solid == SOLID_BSP) - if (self.touch) - self.touch(); - } - -}; -void() SV_CheckOnGround = -{ - local vector org, v; - org = self.origin; - local float currentflags; - currentflags = self.flags; - self.flags = self.flags | FL_ONGROUND | FL_PARTIALGROUND; - walkmove(0,0); // perform C touch function - self.flags = currentflags | FL_ONGROUND; - if ((org_x != self.origin_x) || (org_y != self.origin_y)) - org = self.origin; - else - self.origin = org; - v = org; - v_z = self.maxs_z + org_z + 1; - traceline (org, v, TRUE, self); - if ((self.waterlevel == 3) && (self.movetype == MOVETYPE_WALK)) - self.flags = self.flags - FL_ONGROUND; - else if ((trace_plane_normal_z <= 0.7) && (trace_fraction != 1)) - self.flags = self.flags - FL_ONGROUND; - else if (!droptofloor(0,0)) - self.flags = self.flags - FL_ONGROUND; - else if (org_z - self.origin_z < 2) - self.flags = self.flags | FL_ONGROUND; - else - self.flags = self.flags - FL_ONGROUND; - setorigin(self, org); -}; -// Thanks to Alan Kivlin for this function -// modified heavily by me -float(vector dir) botCheckForStep = -{ - local vector currentorigin, v; - local float currentflags, yaw, stepdistance, movedistance; - currentorigin = self.origin; - currentflags = self.flags; - self.flags = FL_ONGROUND | FL_PARTIALGROUND; - dir = normalize(dir); - dir_z = 0; - yaw = vectoyaw(dir); - if(walkmove(yaw, 3)) - { - if(droptofloor(0,0)) - { - stepdistance = self.origin_z - currentorigin_z; - v = self.origin - currentorigin; - v_z = 0; - movedistance = vlen(v); - if((stepdistance > 0 && stepdistance <= 16) && movedistance != 0) - { - self.flags = currentflags | FL_PARTIALGROUND; - return 1; - } - } - } - self.flags = currentflags; - setorigin(self, currentorigin); - return 0; -}; -// this is merely here to fix a problem with e3m5 -void(vector dir) BruteForceStep = -{ - local vector currentorigin; - local float currentflags, i, len; - - currentorigin = self.origin; - currentflags = self.flags; - len = vlen(dir); - if (len > 16) - dir = normalize(dir) * 16; - - setorigin(self, currentorigin + dir); - - while(i < 18 && !walkmove(0, 0)) - { - self.origin_z = currentorigin_z + i; - i = i + 2; - } - self.flags = currentflags; - if (i >=18) - setorigin(self, currentorigin); -}; - -void() PostPhysics = -{ - local vector obstr, org; - local float back, dst,cflags; - - self = self.owner; - - self.velocity = self.velocity - self.phys_obj.dest1 + self.phys_obj.velocity; - if (self.phys_obj.dest2 == self.origin) - { - setorigin(self, self.phys_obj.origin); - // might've been moved during other person's physics - // (teleporters / plats) - - if (self.movetype == MOVETYPE_WALK) - { - - if (self.phys_obj.dest1_x || self.phys_obj.dest1_y) - { - if ((self.flags & FL_ONGROUND) || (self.waterlevel <= 2)) - { - obstr = self.phys_obj.movedir - self.origin; - obstr_z = 0; - if (vlen(obstr) > 0.1) - { - dst = vlen(obstr); - back = vectoyaw(obstr); - cflags = self.flags; - self.flags = self.flags | FL_PARTIALGROUND; - if(walkmove(back, dst)) - { - self.flags = cflags; - self.phys_obj.dest1_z = 0; - self.velocity = self.velocity + self.phys_obj.dest1 - self.phys_obj.velocity; - } - else - { - if (dst > 1) - frik_obstructed(obstr, FALSE); - - org = self.origin; - self.flags = cflags; - obstr = self.phys_obj.dest1; - obstr_x = 0; - if (!botCheckForStep(obstr)) - { - obstr = self.phys_obj.dest1; - obstr_y = 0; - if (!botCheckForStep(obstr)) - { - // if no steps were found, bot is really obstucted - BruteForceStep(self.phys_obj.dest1); - } - } - } - } - } - } - } - } - - SV_CheckOnGround(); - - PlayerPostThink(); - BotAI(); - self.dmg_take = self.dmg_save = 0; - -}; -// Avoid calling BotAI and the physics at the same time -// Can trip the runaway loop counter - -void() SV_FlyMove = -{ - // This is nothing like the Quake function. - - if (self.phys_obj == world) - { - self.phys_obj = find(world,classname,"phys_obj"); - while (self.phys_obj.owner != self) - { - self.phys_obj = find(self.phys_obj,classname,"phys_obj"); - if (self.phys_obj == world) - { - error("No physics entity spawned!\nMake sure BotInit was called\n"); - } - } - } - - setmodel (self.phys_obj, string_null); - self.phys_obj.movetype = MOVETYPE_STEP; - - self.phys_obj.solid = SOLID_TRIGGER; - self.phys_obj.touch = RemoveThud; - setsize(self.phys_obj, self.mins, self.maxs); - self.phys_obj.dest2 = self.phys_obj.origin = self.origin; - self.phys_obj.watertype = 0; - self.phys_obj.movedir = self.origin + real_frametime * self.velocity; - self.phys_obj.dest1 = self.phys_obj.velocity = self.velocity; - self.phys_obj.velocity_z = self.phys_obj.velocity_z + sv_gravity * real_frametime; - self.phys_obj.flags = 0; - self.phys_obj.think = PostPhysics; - self.phys_obj.nextthink = time; -}; - - -void() SV_Physics_Toss = -{ - if (!SV_RunThink()) - return; - if (self.flags & FL_ONGROUND) - { - self.velocity = '0 0 0'; - BotAI(); - return; - } - if (self.movetype != MOVETYPE_FLY) - SV_AddGravity(1); - self.angles = self.angles + real_frametime * self.avelocity; - SV_FlyMove(); - -}; -void() SV_Physics_Client = -{ - - PlayerPreThink(); - - if (self.movetype == MOVETYPE_NONE) - { - if (!SV_RunThink()) - return; - PlayerPostThink(); - BotAI(); - - } - else if ((self.movetype == MOVETYPE_WALK) || (self.movetype == MOVETYPE_STEP)) - { - if (!SV_RunThink()) - return; - if (!(SV_CheckWater()) && (!(self.flags & FL_WATERJUMP))) - SV_AddGravity(1); - SV_FlyMove(); - } - else if ((self.movetype == MOVETYPE_TOSS) || (self.movetype == MOVETYPE_BOUNCE)) - { - SV_Physics_Toss(); - } - else if (self.movetype == MOVETYPE_FLY) - { - if (!SV_RunThink()) - return; - SV_FlyMove(); - } - else if (self.movetype == MOVETYPE_NOCLIP) - { - if (!SV_RunThink()) - return; - self.origin = self.origin + real_frametime * self.velocity; - - PlayerPostThink(); - BotAI(); - } - else - error ("SV_Physics_Client: Bad Movetype (BOT)"); - -}; - - diff --git a/qcsrc/bot/bot_way.qc b/qcsrc/bot/bot_way.qc deleted file mode 100644 index c00078060..000000000 --- a/qcsrc/bot/bot_way.qc +++ /dev/null @@ -1,1001 +0,0 @@ - /*********************************************** -* * -* FrikBot Waypoints * -* "The better than roaming AI" * -* * -***********************************************/ - -/* - -This program is in the Public Domain. My crack legal -team would like to add: - -RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS" -AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE -ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR -FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN -NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY -GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL, -EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC" -SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES. - -You accept this software on the condition that you -indemnify and hold harmless Ryan "FrikaC" Smith from -any and all liability or damages to third parties, -including attorney fees, court costs, and other -related costs and expenses, arising out of your use -of this software irrespective of the cause of said -liability. - -The export from the United States or the subsequent -reexport of this software is subject to compliance -with United States export control and munitions -control restrictions. You agree that in the event you -seek to export this software, you assume full -responsibility for obtaining all necessary export -licenses and approvals and for assuring compliance -with applicable reexport restrictions. - -Any reproduction of this software must contain -this notice in its entirety. - -*/ - - - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Waypoint Linking code - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - - -float (entity e1, entity e2) CheckLinked = -{ - if ((e1 == e2) || (e2 == world) || (e1 == world)) - return FALSE; - else if (e1.target1 == e2) - { - if (e1.b_aiflags & AI_TELELINK_1) - return 2; - else return TRUE; - } - else if (e1.target2 == e2) - { - if (e1.b_aiflags & AI_TELELINK_2) - return 2; - else return TRUE; - } - else if (e1.target3 == e2) - { - if (e1.b_aiflags & AI_TELELINK_3) - return 2; - else return TRUE; - } - else if (e1.target4 == e2) - { - if (e1.b_aiflags & AI_TELELINK_4) - return 2; - else return TRUE; - } - - else return FALSE; -}; - - -float (entity e1, entity e2) LinkWays = -{ - if ((e1 == e2) || (e2 == world) || (e1 == world)) - return FALSE; - else if (CheckLinked(e1, e2)) - return FALSE; // already linked!!! - - if (e1.target1 == world) - { - e1.target1 = e2; - return TRUE; - } - else if (e1.target2 == world) - { - e1.target2 = e2; - return TRUE; - } - else if (e1.target3 == world) - { - e1.target3 = e2; - return TRUE; - } - else if (e1.target4 == world) - { - e1.target4 = e2; - return TRUE; - } - else return FALSE; - -}; -// Link Ways part 2, used only for teleporters - -float (entity e1, entity e2) TeleLinkWays = -{ - if ((e1 == e2) || (e2 == world) || (e1 == world)) - return FALSE; - else if (CheckLinked(e1, e2)) - return FALSE; // already linked!!! - - if (e1.target1 == world) - { - e1.target1 = e2; - e1.b_aiflags = e1.b_aiflags | AI_TELELINK_1; - return TRUE; - } - else if (e1.target2 == world) - { - e1.target2 = e2; - e1.b_aiflags = e1.b_aiflags | AI_TELELINK_2; - return TRUE; - } - else if (e1.target3 == world) - { - e1.target3 = e2; - e1.b_aiflags = e1.b_aiflags | AI_TELELINK_3; - return TRUE; - } - else if (e1.target4 == world) - { - e1.target4 = e2; - e1.b_aiflags = e1.b_aiflags | AI_TELELINK_4; - return TRUE; - } - else - return FALSE; - -}; - -void (entity e1, entity e2) UnlinkWays = -{ - if ((e1 == e2) || (e2 == world) || (e1 == world)) - return; - else if (!CheckLinked(e1, e2)) - return; - - if (e1.target1 == e2) - { - e1.b_aiflags = e1.b_aiflags - (e1.b_aiflags & AI_TELELINK_1); - e1.target1 = world; - } - if (e1.target2 == e2) - { - e1.b_aiflags = e1.b_aiflags - (e1.b_aiflags & AI_TELELINK_2); - e1.target2 = world; - } - if (e1.target3 == e2) - { - e1.b_aiflags = e1.b_aiflags - (e1.b_aiflags & AI_TELELINK_3); - e1.target3 = world; - } - if (e1.target4 == e2) - { - e1.b_aiflags = e1.b_aiflags - (e1.b_aiflags & AI_TELELINK_4); - e1.target4 = world; - } - -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -FindWaypoint - -This is used quite a bit, by many different -functions big lag causer - -Finds the closest, fisible, waypoint to e - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -entity(entity start) FindWayPoint = -{ - local entity t; - local vector org; - local float dst, tdst; - local entity best; - - org = realorigin(self); - - t = way_head; - if (start != world) - { - dst = vlen(start.origin - org); - best = start; - } - else - { - dst = 100000; - best = world; - } - while(t) - { - // real players cut through ignore types - if (dst < 20) - return best; - if (!(t.b_aiflags & AI_IGNORE_TYPES) || self.ishuman) - { - tdst = vlen(t.origin - org); - if (tdst < dst) - { - if (sisible(t)) - { - dst = tdst; - best = t; - } - } - } - t = t._next; - } - return best; -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Waypoint Spawning Code - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -entity way_foot; // Ugh. Do I need a foot for this or not? - -entity(vector org) make_waypoint = -{ - local entity point; - point = spawn(); - point.classname = "waypoint"; - point.search_time = time; // don't double back for me; - point.solid = SOLID_TRIGGER; - point.movetype = MOVETYPE_NONE; - point.items = -1; - setorigin(point, org); - - setsize(point, PL_MIN, PL_MAX); - waypoints = waypoints + 1; - if (!way_head) - { - way_head = point; - way_foot = point; - } - else - { - way_foot._next = point; - point._last = way_foot; - way_foot = point; - } - - point.count = waypoints; - if (waypoint_mode > WM_LOADED) // editor modes - setmodel(point, "progs/s_bubble.spr"); - return point; -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Dynamic Waypoint spawning and linking. Not -very good all things considered. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void() DynamicWaypoint = -{ - local entity t; - local float dist, dynlink, dynpoint, editor; - - if (self.teleport_time > self.portal_time) - { - if (!self.flags & FL_WATERJUMP) - { - self.dyn_flags = 2; - if (!self.ishuman) - { - bot_lost(self.target1, TRUE); - self.enemy = world; - } - } - self.portal_time = self.teleport_time; - } -// stacking everything on waypoint_mode might've been good for the editor, -// but it sucks to beat hell for this code. - - -// convert waypoint_mode to something more usable.. - if (waypoint_mode > WM_LOADED) - { - if (self.ishuman) - { - if (waypoint_mode == WM_EDITOR_DYNLINK) - dynlink = 1; - else if (waypoint_mode == WM_EDITOR_DYNAMIC) - dynlink = dynpoint = 1; - editor = 1; - } - } - else if (waypoint_mode == WM_DYNAMIC) - dynlink = dynpoint = 1; - -// if there's nothing for dynamic to do.. - if (!dynpoint) - { - if (!editor) - return; - } -// for speed sake, I won't have bots dynamic waypoint in coop - if (!self.ishuman) - if (coop) - return; - -// don't waypoint in single player - if (max_clients < 2) - return; -// if you're dead - else if (self.health <= 0) - { - if (dynpoint) - { - if (self.current_way) - { - if (pointcontents(self.origin) < -4) - { - if (self.current_way.b_aiflags & AI_BLIND) - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_PRECISION; - else - self.current_way.b_aiflags = self.current_way.b_aiflags | AI_BLIND; - } - } - } - self.dyn_dest = '0 0 0'; - self.current_way = world; - self.dyn_flags = 0; - return; - } - -// you shouldn't be making waypoints mid air - if (dynpoint) - { - if (!((self.flags & FL_ONGROUND) || self.waterlevel == 3)) - { - if (self.dyn_flags != 2) - { - self.dyn_flags = 1; - } - return; - } - } -// keep from doing the rest of this every frame - if (self.dyn_time > time) - return; - self.dyn_time = time + 0.2; - -// display the links for editor mode - if (editor) - { - if (self.current_way) - { - if (self.current_way.target1) - DeveloperLightning(self.current_way, self.current_way.target1, self.current_way.b_aiflags & AI_TELELINK_1); - if (self.current_way.target2) - DeveloperLightning(self.current_way, self.current_way.target2, self.current_way.b_aiflags & AI_TELELINK_2); - if (self.current_way.target3) - DeveloperLightning(self.current_way, self.current_way.target3, self.current_way.b_aiflags & AI_TELELINK_3); - if (self.current_way.target4) - DeveloperLightning(self.current_way, self.current_way.target4, self.current_way.b_aiflags & AI_TELELINK_4); - } - if (self.b_aiflags & AI_HOLD_SELECT) - return; - } - - t = FindWayPoint(self.current_way); - if (t) - { - dist = vlen(self.origin - t.origin); - if (dist < 192) - { - if (dist < 64) - { - - if (t != self.current_way) - { - if (dynlink) - { - if (!self.dyn_flags) - { - if (wisible(t, self.current_way)) - LinkWays(t, self.current_way); - } - if (self.dyn_flags == 2) - TeleLinkWays(self.current_way, t); - else if (wisible(t, self.current_way)) - LinkWays(self.current_way, t); - } - if (editor) - { - setmodel(t, "progs/s_light.spr"); - if (self.current_way) - setmodel(self.current_way, "progs/s_bubble.spr"); - } - } - self.current_way = t; - self.dyn_flags = 0; - } - self.dyn_dest = self.origin + self.view_ofs; - return; - } - } - - if (frik_recognize_plat(FALSE)) - { - if (vlen(trace_ent.velocity) > 0) - { - if (self.dyn_plat) - return; - self.dyn_plat = TRUE; - if (!self.dyn_flags) - self.dyn_flags = 1; - //bprint("on a plat!!!!!\n"); - } - else - self.dyn_plat = FALSE; - } - else - self.dyn_plat = FALSE; - - if (self.dyn_flags == 2) - self.dyn_dest = self.origin + self.view_ofs; - else if (self.dyn_dest == '0 0 0') - self.dyn_dest = self.origin + self.view_ofs; - if (!dynpoint) - return; - t = make_waypoint(self.dyn_dest); - - if (!self.dyn_flags) - { - if (wisible(t, self.current_way)) - LinkWays(t, self.current_way); - } - if (self.dyn_flags == 2) - TeleLinkWays(self.current_way, t); - else if (wisible(t, self.current_way)) - LinkWays(self.current_way, t); - - if (editor) - { - setmodel(t, "progs/s_light.spr"); - if (self.current_way) - setmodel(self.current_way, "progs/s_bubble.spr"); - } - self.current_way = t; - self.dyn_flags = 0; - - self.dyn_dest = self.origin + self.view_ofs; - - if (frik_recognize_plat(FALSE)) - { - if (trace_ent.classname == "door") - t.b_aiflags = t.b_aiflags | AI_DOORFLAG; - } -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Waypoint Loading from file - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void() ClearAllWays = -{ - - local entity t, n; - t = way_head; - while(t) - { - n = t._next; - remove(t); - t = n; - } - way_head = world; - way_foot = world; - waypoints = 0; -}; - -entity(float num) WaypointForNum = -{ - local entity t; - if (!num) - return world; - - t = way_head; - while (t) - { - if (t.count == num) - return t; - t = t._next; - } - return world; -}; - -void() FixThisWaypoint = -{ - self.enemy.target1 = WaypointForNum(self.enemy.b_pants); - self.enemy.target2 = WaypointForNum(self.enemy.b_skill); - self.enemy.target3 = WaypointForNum(self.enemy.b_shirt); - self.enemy.target4 = WaypointForNum(self.enemy.b_frags); - self.enemy = self.enemy._next; - self.nextthink = time; - if (self.enemy == world) - { - remove(self); - fixer = world; - } -}; - -void() FixWaypoints = -{ - if (!fixer) - fixer = spawn(); - fixer.nextthink = time; - fixer.think = FixThisWaypoint; - fixer.enemy = way_head; -}; - - - -void(entity what) delete_waypoint = -{ - local entity t; - - if (way_head == what) - way_head = what._next; - if (way_foot == what) - way_foot = what._last; - if (what._last) - what._last._next = what._next; - if (what._next) - what._next._last = what._last; - waypoints = 0; - t = way_head; - while(t) - { - t.count = waypoints = waypoints + 1; - if (CheckLinked(t, what)) - UnlinkWays(t, what); - t = t._next; - } - if (self.current_way == what) - self.current_way = world; - remove(what); -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -FindRoute & FindThing used by the pathing code -in bot_ai.qc - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - - -entity(string s) FindThing = -{ - local entity t; - local float tdst, dst; - local entity best; - dst = 100000; - best = world; - t = find (world, classname, s); - while (t != world) - { - tdst = vlen(((t.absmin + t.absmax) * 0.5) - self.origin); - if (tdst < dst) - { - dst = tdst; - best = t; - } - t = find(t, classname, s); - } - return best; -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -FindRoute, this is a key function in the -pathing. The name is a bit misleading, this -code finds the closest waypoint that is part -of a route calculated by the begin_route and -end_route routines This is a definite path to -an object. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -entity(entity lastone) FindRoute = -{ - // kinda like FindWaypoint, only of this bots route though - local entity t, best; - local float dst, tdst, flag; - flag = ClientBitFlag(self.b_clientno); - t = way_head; - dst = 100000; - best = world; - while(t) - { - tdst = vlen(t.origin - self.origin); - if ((tdst < dst) && (t.b_sound & flag)) - { - if ((lastone == world) || (CheckLinked(lastone, t))) - { - dst = tdst; - best = t; - } - } - t = t._next; - } - return best; -}; -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Route & path table management - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void() ClearRouteTable = -{ - // cleans up route table - - local entity t; - t = way_head; - while (t) - { - t. keys = FALSE; - t.enemy = world; - t.items = -1; // not in table - t = t._next; - } -}; - -void() ClearMyRoute = -{ - local float flag; - local entity t; - - flag = ClientBitFlag(self.b_clientno); - - t = way_head; - while (t) - { - t.b_sound = t.b_sound - (t.b_sound & flag); - t = t._next; - } -}; - - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Mark_path - -After the route has been found, mark it with -bitflags so the table can be used for a -different bot. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - - -void(entity this) mark_path = -{ - local entity t, oself; - local float flag; - - ClearMyRoute(); - - oself = self; - self = this; - t = FindWayPoint(this.current_way); - self = oself; - // FIXME - // ugh, better way to find players please!!! - if (this.classname != "player") - this.current_way = t; - - if (t.enemy == world) - { - bot_lost(this, FALSE); - if (waypoint_mode == WM_DYNAMIC) - self.route_failed = TRUE; - return; - } - - flag = ClientBitFlag(self.b_clientno); - - while(t) - { - if (t.b_sound & flag) - return; - if (t == self.last_way) - return; - t.b_sound = t.b_sound | flag; - t = t.enemy; - } -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -WaypointThink - -Calculates the routes. We use thinks to avoid -tripping the runaway loop counter - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void(entity e2, float b_bit) FollowLink = -{ - local float dist; - - if (self.b_aiflags & b_bit) - dist = self.items; - else - dist = vlen(self.origin - e2.origin) + self.items; - - // check if this is an RJ link - if (e2.b_aiflags & AI_SUPER_JUMP) - { - if (!bot_can_rj(route_table)) - return; - } - if (e2.b_aiflags & AI_DIFFICULT) - dist = dist + 1000; - - dist = dist + random() * 100; // add a little chaos - - if ((dist < e2.items) || (e2.items == -1)) - { - if (!e2.keys) - busy_waypoints = busy_waypoints + 1; - e2.keys = TRUE; - e2.items = dist; - e2.think = WaypointThink; - e2.nextthink = time; - e2.enemy = self; - } -}; - -void() WaypointThink = -{ - local entity oself; - - if (self.items == -1) - return; - // can you say ugly? - if (self.b_aiflags & AI_TRACE_TEST) - { - if (self.target1) - { - traceline(self.origin, self.target1.origin, TRUE, self); - if (trace_fraction == 1) - FollowLink(self.target1, AI_TELELINK_1); - } - if (self.target2) - { - traceline(self.origin, self.target2.origin, TRUE, self); - if (trace_fraction == 1) - FollowLink(self.target2, AI_TELELINK_2); - } - if (self.target3) - { - traceline(self.origin, self.target3.origin, TRUE, self); - if (trace_fraction == 1) - FollowLink(self.target3, AI_TELELINK_3); - } - if (self.target4) - { - traceline(self.origin, self.target4.origin, TRUE, self); - if (trace_fraction == 1) - FollowLink(self.target4, AI_TELELINK_4); - } - } - else - { - if (self.target1) - FollowLink(self.target1, AI_TELELINK_1); - if (self.target2) - FollowLink(self.target2, AI_TELELINK_2); - if (self.target3) - FollowLink(self.target3, AI_TELELINK_3); - if (self.target4) - FollowLink(self.target4, AI_TELELINK_4); - } - - busy_waypoints = busy_waypoints - 1; - self.keys = FALSE; - - if (busy_waypoints <= 0) - { - if (direct_route) - { - oself = self; - self = route_table; - bot_get_path(self.target1, FALSE); - self = oself; - direct_route = FALSE; - } - } -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -begin_route and bot_get_path - -PLEASE NOTE: bot_get_path replaces the old -calls to begin_route. - -Routing isn't done all at once now, but in two -stages, the bot will calc a route *THEN* -choose a target, *THEN* mark a path. - -Boy it's confusing. - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -float() begin_route = -{ - if (busy_waypoints > 0) - return FALSE; - - if (route_table != world) - { - if (!route_table.ishuman) - { - if (route_table.b_clientno != -1) - return FALSE; - } - } - - route_table = self; - ClearRouteTable(); - self.last_way = FindWayPoint(self.current_way); - - if (self.last_way != world) - { - self.last_way.items = vlen(self.last_way.origin - self.origin); - self.last_way.nextthink = time; - self.last_way.think = WaypointThink; - self.last_way.keys = TRUE; - busy_waypoints = 1; - return TRUE; - } - else - { - route_table = world; - busy_waypoints = 0; - return FALSE; - } -}; - -void(entity this, float direct) bot_get_path = -{ - if (this == world) - return; - - if (route_table == self) - { - if (busy_waypoints <= 0) - { - route_table = world; - mark_path(this); - } - return; - } - if (direct) - { - if(begin_route()) - direct_route = TRUE; - else - bot_lost(this, FALSE); - return; - } -}; - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -BSP/QC Waypoint loading - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void() waypoint = -{ - self.search_time = time; - self.solid = SOLID_TRIGGER; - self.movetype = MOVETYPE_NONE; - setorigin(self, self.origin); - - setsize(self, PL_MIN, PL_MAX); - waypoints = waypoints + 1; - if (!way_head) - { - way_head = self; - way_foot = self; - } - else - { - way_foot._next = self; - self._last = way_foot; - way_foot = self; - } - - self.count = waypoints; - waypoint_mode = WM_LOADED; - if (self.count == 1) - { - self.think = FixWaypoints; // wait until all bsp loaded points are spawned - self.nextthink = time; - } -}; - -void(vector org, vector bit1, float bit4, float flargs) make_way = -{ - local entity y; - waypoint_mode = WM_LOADED; - y = make_waypoint(org); - y.b_aiflags = flargs; - y.b_pants = bit1_x; - y.b_skill = bit1_y; - y.b_shirt = bit1_z; - y.b_frags = bit4; - if (y.count == 1) - { - y.think = FixWaypoints; // wait until all qc loaded points are spawned - y.nextthink = time; - } -}; - - -/* --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= - -Temporary Marker code - --=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -*/ - -void(vector org) SpawnTempWaypoint = -{ - local entity tep; - - if (!self.temp_way) - self.temp_way = tep = spawn(); - else - tep = self.temp_way; - - tep.classname = "temp_waypoint"; - tep.search_time = 0; - tep.solid = SOLID_TRIGGER; - tep.movetype = MOVETYPE_NOCLIP; - setorigin(tep, org); - target_add(tep); - setsize(tep, PL_MIN, PL_MAX); // FIXME: convert these to numerical -}; \ No newline at end of file diff --git a/qcsrc/bot/maps/map_mattrye1_nex.qc b/qcsrc/bot/maps/map_mattrye1_nex.qc deleted file mode 100644 index 596088a3e..000000000 --- a/qcsrc/bot/maps/map_mattrye1_nex.qc +++ /dev/null @@ -1,50 +0,0 @@ -void(vector org, vector bit1, float bit4, float flargs) make_way; -// Ways by Electro - -void() map_mattrye1_nex = -{ - make_way('655.3 370.1 -34.0', '2 43 0', 0, 0); - make_way('214.7 338.9 -34.0', '1 3 0', 0, 0); - make_way('-70.7 197.7 -34.0', '2 4 5', 0, 0); - make_way('-263.8 27.5 -34.0', '3 5 6', 10, 0); - make_way('-263.8 199.7 -34.0', '4 6 3', 0, 0); - make_way('-394.6 201.2 -34.0', '5 7 4', 0, 0); - make_way('-617.8 260.5 -34.0', '6 8 0', 0, 0); - make_way('-644.1 428.5 -34.0', '7 9 0', 0, 0); - make_way('-642.2 727.9 -34.0', '8 0 0', 0, 0); - make_way('-259.3 -187.2 -34.0', '4 11 12', 0, 0); - make_way('-26.8 -384.2 -34.0', '10 12 32', 0, 0); - make_way('-254.3 -368.7 -34.0', '10 11 13', 0, 0); - make_way('-453.0 -380.6 -34.0', '12 14 0', 0, 0); - make_way('-634.6 -436.6 -34.0', '13 15 0', 0, 0); - make_way('-724.5 -730.3 -34.0', '14 16 0', 0, 0); - make_way('-1118.6 -771.6 -34.0', '15 17 0', 0, 0); - make_way('-1509.0 -737.1 62.0', '16 18 0', 0, 0); - make_way('-1519.2 -374.8 182.0', '17 19 41', 0, 0); - make_way('-1035.7 -196.8 182.0', '18 20 39', 41, 0); - make_way('-749.3 -135.9 182.0', '19 21 0', 0, 0); - make_way('-576.4 -26.8 182.0', '20 22 0', 0, 0); - make_way('-404.1 -18.0 182.0', '21 23 12', 0, 0); - make_way('-123.2 -18.2 182.0', '22 24 10', 12, 0); - make_way('102.6 -27.2 182.0', '23 25 0', 0, 0); - make_way('106.8 -383.1 182.0', '24 26 36', 0, 0); - make_way('-232.4 -342.7 278.0', '25 27 13', 0, 0); - make_way('-245.5 -20.1 374.0', '26 28 29', 21, 0); - make_way('107.1 6.3 374.0', '27 25 0', 0, 0); - make_way('-277.8 554.4 374.0', '27 30 0', 0, 0); - make_way('-520.5 574.9 374.0', '29 31 9', 8, 0); - make_way('-768.3 574.9 374.0', '30 8 9', 0, 0); - make_way('465.9 -423.7 -34.0', '11 33 0', 0, 0); - make_way('543.3 -660.4 -34.0', '32 34 0', 0, 0); - make_way('537.0 -955.6 -34.0', '33 35 0', 0, 0); - make_way('165.7 -926.3 86.0', '34 36 0', 0, 0); - make_way('138.8 -740.6 155.8', '35 25 33', 0, 0); - make_way('581.8 195.7 -21.1', '38 0 0', 0, 262144); - make_way('847.0 120.2 191.0', '28 0 0', 0, 262144); - make_way('-1101.5 176.0 182.0', '19 40 0', 0, 0); - make_way('-1584.0 173.6 182.0', '39 0 0', 0, 0); - make_way('-1295.4 -37.8 148.2', '18 42 19', 0, 0); - make_way('-1362.7 -55.6 -221.2', '41 0 0', 0, 0); - make_way('769.2 196.2 -34.0', '1 44 0', 0, 0); - make_way('633.1 193.1 -34.0', '43 37 0', 0, 256); -}; diff --git a/qcsrc/bot/maps/map_mattrye2.qc b/qcsrc/bot/maps/map_mattrye2.qc deleted file mode 100644 index 32fdfc135..000000000 --- a/qcsrc/bot/maps/map_mattrye2.qc +++ /dev/null @@ -1,51 +0,0 @@ -void(vector org, vector bit1, float bit4, float flargs) make_way; -// Ways by Electro - -void() map_mattrye2 = -{ - make_way('-652.5 -1043.9 511.0', '4 0 0', 0, 0); - make_way('-992.5 -617.0 415.0', '3 7 0', 0, 0); - make_way('-953.0 -50.2 351.0', '6 8 0', 0, 0); - make_way('-647.0 77.1 351.0', '7 9 0', 0, 0); - make_way('-698.8 764.0 239.0', '8 10 0', 0, 0); - make_way('-1054.6 766.4 239.0', '9 11 0', 0, 0); - make_way('-1357.9 786.5 239.0', '10 12 0', 0, 0); - make_way('-1373.6 1502.7 127.0', '11 13 0', 0, 0); - make_way('-1110.3 1625.0 127.0', '12 14 0', 0, 0); - make_way('-985.9 2144.7 127.0', '13 15 0', 0, 0); - make_way('-495.4 2230.9 127.0', '14 16 17', 0, 0); - make_way('-47.4 2158.4 127.0', '15 40 0', 0, 0); - make_way('-501.6 2626.1 127.0', '15 18 0', 0, 0); - make_way('346.4 2679.1 223.0', '17 19 20', 0, 0); - make_way('433.6 2248.8 223.0', '18 20 0', 0, 0); - make_way('550.4 2675.8 223.0', '19 18 21', 0, 0); - make_way('876.8 2671.6 271.0', '20 22 0', 0, 0); - make_way('837.9 2263.6 319.0', '21 19 23', 0, 0); - make_way('925.9 1798.9 319.0', '22 24 0', 0, 0); - make_way('1644.3 1772.2 351.0', '23 25 0', 0, 0); - make_way('1628.4 1068.5 351.0', '24 26 0', 0, 0); - make_way('1409.9 965.9 351.0', '25 27 0', 0, 0); - make_way('1073.8 789.9 351.0', '26 28 44', 45, 0); - make_way('1408.4 645.5 416.0', '27 29 26', 0, 0); - make_way('1653.5 624.0 479.0', '28 30 0', 0, 0); - make_way('1662.9 317.8 479.0', '29 31 45', 0, 0); - make_way('1637.0 28.1 479.0', '30 32 0', 0, 0); - make_way('1060.8 -48.7 479.0', '31 33 0', 0, 0); - make_way('996.9 -484.3 479.0', '32 34 0', 0, 0); - make_way('550.8 -491.1 479.0', '33 35 37', 39, 0); - make_way('542.9 -914.0 479.0', '34 36 37', 39, 0); - make_way('712.4 -1089.3 511.0', '35 0 0', 0, 0); - make_way('-13.4 -289.6 479.0', '34 39 35', 3, 0); - make_way('-97.3 -677.8 479.0', '2 4 3', 0, 0); - make_way('144.7 -679.1 479.0', '35 37 34', 0, 0); - make_way('2.3 1824.9 127.0', '16 41 0', 0, 0); - make_way('6.0 1232.9 127.0', '40 42 0', 0, 0); - make_way('10.5 768.3 127.0', '41 43 0', 0, 0); - make_way('5.0 375.1 127.0', '42 44 0', 0, 0); - make_way('875.6 378.7 351.0', '43 45 27', 0, 0); - make_way('1090.9 453.8 351.0', '44 27 0', 0, 0); - make_way('-560.0 1269.1 351.0', '0 0 0', 0, 0); - make_way('-434.0 1282.5 127.0', '41 40 42', 0, 0); - make_way('602.4 1275.2 351.0', '0 0 0', 0, 0); - make_way('430.0 1282.1 127.0', '41 42 40', 0, 0); -}; diff --git a/qcsrc/bot/maps/map_nexdm1.qc b/qcsrc/bot/maps/map_nexdm1.qc deleted file mode 100644 index 596088a3e..000000000 --- a/qcsrc/bot/maps/map_nexdm1.qc +++ /dev/null @@ -1,50 +0,0 @@ -void(vector org, vector bit1, float bit4, float flargs) make_way; -// Ways by Electro - -void() map_mattrye1_nex = -{ - make_way('655.3 370.1 -34.0', '2 43 0', 0, 0); - make_way('214.7 338.9 -34.0', '1 3 0', 0, 0); - make_way('-70.7 197.7 -34.0', '2 4 5', 0, 0); - make_way('-263.8 27.5 -34.0', '3 5 6', 10, 0); - make_way('-263.8 199.7 -34.0', '4 6 3', 0, 0); - make_way('-394.6 201.2 -34.0', '5 7 4', 0, 0); - make_way('-617.8 260.5 -34.0', '6 8 0', 0, 0); - make_way('-644.1 428.5 -34.0', '7 9 0', 0, 0); - make_way('-642.2 727.9 -34.0', '8 0 0', 0, 0); - make_way('-259.3 -187.2 -34.0', '4 11 12', 0, 0); - make_way('-26.8 -384.2 -34.0', '10 12 32', 0, 0); - make_way('-254.3 -368.7 -34.0', '10 11 13', 0, 0); - make_way('-453.0 -380.6 -34.0', '12 14 0', 0, 0); - make_way('-634.6 -436.6 -34.0', '13 15 0', 0, 0); - make_way('-724.5 -730.3 -34.0', '14 16 0', 0, 0); - make_way('-1118.6 -771.6 -34.0', '15 17 0', 0, 0); - make_way('-1509.0 -737.1 62.0', '16 18 0', 0, 0); - make_way('-1519.2 -374.8 182.0', '17 19 41', 0, 0); - make_way('-1035.7 -196.8 182.0', '18 20 39', 41, 0); - make_way('-749.3 -135.9 182.0', '19 21 0', 0, 0); - make_way('-576.4 -26.8 182.0', '20 22 0', 0, 0); - make_way('-404.1 -18.0 182.0', '21 23 12', 0, 0); - make_way('-123.2 -18.2 182.0', '22 24 10', 12, 0); - make_way('102.6 -27.2 182.0', '23 25 0', 0, 0); - make_way('106.8 -383.1 182.0', '24 26 36', 0, 0); - make_way('-232.4 -342.7 278.0', '25 27 13', 0, 0); - make_way('-245.5 -20.1 374.0', '26 28 29', 21, 0); - make_way('107.1 6.3 374.0', '27 25 0', 0, 0); - make_way('-277.8 554.4 374.0', '27 30 0', 0, 0); - make_way('-520.5 574.9 374.0', '29 31 9', 8, 0); - make_way('-768.3 574.9 374.0', '30 8 9', 0, 0); - make_way('465.9 -423.7 -34.0', '11 33 0', 0, 0); - make_way('543.3 -660.4 -34.0', '32 34 0', 0, 0); - make_way('537.0 -955.6 -34.0', '33 35 0', 0, 0); - make_way('165.7 -926.3 86.0', '34 36 0', 0, 0); - make_way('138.8 -740.6 155.8', '35 25 33', 0, 0); - make_way('581.8 195.7 -21.1', '38 0 0', 0, 262144); - make_way('847.0 120.2 191.0', '28 0 0', 0, 262144); - make_way('-1101.5 176.0 182.0', '19 40 0', 0, 0); - make_way('-1584.0 173.6 182.0', '39 0 0', 0, 0); - make_way('-1295.4 -37.8 148.2', '18 42 19', 0, 0); - make_way('-1362.7 -55.6 -221.2', '41 0 0', 0, 0); - make_way('769.2 196.2 -34.0', '1 44 0', 0, 0); - make_way('633.1 193.1 -34.0', '43 37 0', 0, 256); -}; diff --git a/qcsrc/default.cfg b/qcsrc/default.cfg deleted file mode 100755 index 17a522af9..000000000 --- a/qcsrc/default.cfg +++ /dev/null @@ -1,400 +0,0 @@ -// Nexuiz version - -set g_nexuizversion 1.2.1 - -// team aliases -alias team_red "color 4" -alias team_blue "color 13" -alias team_green "color 3" -alias team_yellow "color 12" - -// other aliases - -alias "+scores" "+showscores; ping" -alias "-scores" "-showscores" - -alias "bsp" "ls maps/*.bsp" -alias "mapcfg" "ls maps/*.mapcfg" -alias "chmap" "exec $exit_cfg; exec game_reset.cfg; exec maps/$1.mapcfg" - -alias "dem" "ls demos/*.dem" -alias "rec" "record demos/$1" -alias "ply" "playdemo demos/$1" - -alias "ccl" "cmd clogin $1" -alias "cc" "cmd ccmd $*" - -// player defaults -_cl_color 0 -_cl_name Player -_cl_playermodel models/player/marine.zym -_cl_playerskin 0 -crosshair 5 -fov 90 -freelook 1 -sensitivity 6 -v_gamma 1.125000 -viewsize 110 -bgmvolume 1 -volume 0.5 -// fullscreen 1024x768x32bit -vid_bitsperpixel "32" -vid_fullscreen "1" -vid_width "1024" -vid_height "768" -// 2D resolution 640x480 -vid_conwidth "640" -vid_conheight "480" -scr_conforcewhiledisconnected "0" - -// server settings -hostname "Nexuiz Server" -sv_maxrate 10000 - -// disable rcon-like clientcommands to avoid server being open with default password -seta sv_clientcommands 0 -seta sv_clientcommands_password "hackme" - -seta g_viewweapon_bobintensity 1 -seta g_viewweapon_q1pitching 1 -seta nex_numbots 0 -cl_forwardspeed 480 -cl_backspeed 480 -cl_sidespeed 480 -cl_upspeed 400 -cl_movement 1 -cl_movement_accelerate 5.5 -cl_movement_edgefriction 0 -cl_movement_friction 5 -cl_movement_jumpvelocity 300 -cl_movement_maxairspeed 50 -cl_movement_maxspeed 400 -cl_movement_stepheight 34 -cl_stairsmoothspeed 200 -edgefriction 0 -set g_balance_jumpheight 300 -set sv_maxairspeed 50 -sv_accelerate 5.5 -sv_friction 5 -sv_maxspeed 400 -sv_stepheight 34 -pausable 0 -set bot_number 0 // number of bots in server -set g_start_weapon_laser 1 -set g_start_weapon_shotgun 1 -set g_start_weapon_uzi 0 -set g_start_weapon_grenadelauncher 0 -set g_start_weapon_electro 0 -set g_start_weapon_crylink 0 -set g_start_weapon_nex 0 -set g_start_weapon_hagar 0 -set g_start_weapon_rocketlauncher 0 -set g_start_ammo_shells 50 -set g_start_ammo_nails 0 -set g_start_ammo_rockets 0 -set g_start_ammo_cells 0 -set g_use_ammunition 1 -set g_pickup_items 1 -set g_instagib 0 -set g_rocketarena 0 -set g_vampire 0 -set g_midair 0 -set g_fullbrightplayers 0 -set g_fullbrightitems 0 -set g_casings 0 -seta "g_maplist" "dm_nexdm01 dm_nexdm02 dm_nexdm03 dm_nexdm04 dm_nexdm05 dm_nexdm06 dm_nexdm07 dm_nexdm08 dm_nexdm09 dm_nexdm10 dm_nexdm11 dm_nexdm12 dm_nexdm13 dm_nexdm14 dm_nexdm15 dm_nexdm16 dm_nexdm17 dm_nexdmextra1 dom_nexdm01 dom_nexdm02 dom_nexdm03 dom_nexdm04 dom_nexdm05 dom_nexdm06 dom_nexdm07 dom_nexdm08 dom_nexdm09 dom_nexdm10 dom_nexdm11 dom_nexdm12 dom_nexdm13 dom_nexdm14 dom_nexdm15 dom_nexdm16 dom_nexdm17 dom_nexdmextra1 rune_nexdm01 rune_nexdm02 rune_nexdm03 rune_nexdm04 rune_nexdm05 rune_nexdm06 rune_nexdm07 rune_nexdm08 rune_nexdm09 rune_nexdm10 rune_nexdm11 rune_nexdm12 rune_nexdm13 rune_nexdm14 rune_nexdm15 rune_nexdm16 rune_nexdm17 rune_nexdmextra1 tdm_nexdm01 tdm_nexdm02 tdm_nexdm03 tdm_nexdm04 tdm_nexdm05 tdm_nexdm06 tdm_nexdm07 tdm_nexdm08 tdm_nexdm09 tdm_nexdm10 tdm_nexdm11 tdm_nexdm12 tdm_nexdm13 tdm_nexdm14 tdm_nexdm15 tdm_nexdm16 tdm_nexdm17 tdm_nexdmextra1 tdm_tznex01 ctf_nexctf01 ctf_tznex01 ctf_nexdm13" -seta g_maplist_index 0 // this is used internally for saving position in maplist cycle -// timeout for kill credit when your damage knocks someone into a death trap -set g_maxpushtime 8.0 - -set welcome_message_time 8 - -set exit_cfg "" -alias clearmap "disconnect; exec $exit_cfg" - -seta g_grappling_hook 0 -seta g_balance_grapplehook_speed_fly 1200 -seta g_balance_grapplehook_speed_pull 1000 - -// "This means that timelimit can be overwritten globally and fraglimit can be overwritten for each game mode: DM/TDM, Domination, CTF, and Runematch." -set timelimit_override -1 -set fraglimit_override -1 -set g_ctf_capture_limit -1 -set g_domination_point_limit -1 -set g_runematch_point_limit -1 - -// common team values -set g_tdm 0 -seta teamplay_default 3 // default teamplay setting in team games -set deathmatch_force_teamplay 0 // always play TDM on dm maps -seta g_balance_teams 1 // automatically balance out players entering -seta g_balance_teams_force 0 // automatically balance out teams when players move or disconnect -seta g_balance_teams_prevent_imbalance 0 // prevent players from changing to larger teams -seta g_tdm_teams 2 // how many teams are in team deathmatch -set g_changeteam_banned 0 // not allowed to change team -set g_changeteam_fragtransfer 80 // % of frags you get to keep when you change teams (rounded down) - -// ctf -set g_ctf 0 -set g_ctf_flag_returntime 30 -set g_ctf_flagscore_capture 5 -set g_ctf_flagscore_capture_team 20 -set g_ctf_flagscore_pickup 1 -set g_ctf_flagscore_return 5 -set g_ctf_flagscore_return_rogue 10 - -// runematch -set g_runematch 0 -set g_runematch_pointrate 5 -set g_runematch_pointamt 1 -set g_runematch_shuffletime 30 // how often runes change position -set g_runematch_respawntime 15 // how soon after being dropped to respawn -set g_runematch_frags_killedby_runeholder 4 -set g_runematch_frags_killed_runeholder 5 -set g_runematch_frags_norune 0 -set g_runematch_drop_runes_max 2 // only drop up to 2 runes, the rest should respawn -set g_runematch_allow_same 0 // allow matching rune-curse pairs -set g_runematch_rune_alpha 0.78 -set g_runematch_rune_effects 544 // EF_ADDITIVE + EF_FULLBRIGHT -set g_runematch_rune_glow_size 0 -set g_runematch_rune_glow_color 0 -set g_runematch_rune_color_strength 1.0 //1.5 -// strength/weakness -set g_balance_rune_strength_damage 2.0 //1.5 -set g_balance_rune_strength_force 1.5 -set g_balance_curse_weak_damage 0.5 //0.6 -set g_balance_curse_weak_force 0.5 //0.6 -set g_balance_rune_strength_combo_damage 0.9 -set g_balance_rune_strength_combo_force 1.0 -// defense/vulner -set g_balance_rune_defense_takedamage 0.5 -set g_balance_curse_vulner_takedamage 2.0 -set g_balance_rune_defense_combo_takedamage 1.0 -// vampire/empathy -set g_balance_rune_vampire_absorb 0.5 -set g_balance_curse_empathy_takedamage -0.6 -set g_balance_rune_vampire_combo_absorb -0.2 -// regen/venom -set g_balance_rune_regen_hpmod 1.75 -set g_balance_curse_venom_hpmod 0.6 -set g_balance_rune_regen_combo_hpmod 0.9 -set g_balance_rune_regen_regenrate 3.0 -set g_balance_curse_venom_rotrate 3.0//2 -set g_balance_rune_regen_combo_regenrate 0.5 -set g_balance_rune_regen_combo_rotrate 1.5 -// speed/slow -set g_balance_rune_speed_atkrate 0.6 -set g_balance_curse_slow_atkrate 1.75 -set g_balance_rune_speed_combo_atkrate 1.2 -set g_balance_rune_speed_moverate 1.5 -set g_balance_curse_slow_moverate 0.75 -set g_balance_rune_speed_combo_moverate 0.9 -set g_balance_rune_speed_jumpheight 2.0 -set g_balance_curse_slow_jumpheight 1.0 -set g_balance_rune_speed_combo_jumpheight 1.0 - -// domination -set g_domination 0 -set g_domination_default_teams 2 // default number of teams for maps that aren't domination-specific -set g_domination_disable_frags 0 // players can't get frags normally; only get points from kills -set g_domination_point_amt 0 // override: how many points to get per ping -set g_domination_point_rate 0 // override: how often to give those points -set g_domination_point_capturetime 0.1 // how long it takes to capture a point (given no interference) -set g_domination_point_glow 0 // domination point glow (warning, slow) -//seta g_domination_balance_team_points 1 // # of points received is based on team sizes - -// server game balance settings -set g_balance_armor_regen 0 -set g_balance_armor_rot 0.1 -set g_balance_armor_stable 100 -set g_balance_armor_start 0 -set g_balance_armor_blockpercent 0.6 -set g_balance_health_regen 0.1 -set g_balance_health_rot 0.1 -set g_balance_health_stable 100 -set g_balance_health_start 150 -set g_balance_selfdamagepercent 0.6 -set g_balance_weaponswitchdelay 0.3 -// powerup balance settings -set g_balance_powerup_invincible_takedamage 0.2 -set g_balance_powerup_invincible_time 30 -set g_balance_powerup_strength_damage 3 -set g_balance_powerup_strength_force 4 -set g_balance_powerup_strength_time 30 -// weapon balance settings -set g_balance_laser_damage 35 -set g_balance_laser_edgedamage 10 -set g_balance_laser_force 400 -set g_balance_laser_radius 70 -set g_balance_laser_speed 9000 -set g_balance_laser_refire 0.7 -set g_balance_shotgun_bullets 10 -set g_balance_shotgun_damage 6 -set g_balance_shotgun_damage2 6 -set g_balance_shotgun_spread 0.07 -set g_balance_shotgun_refire 0.5 -set g_balance_shotgun_refire2 1.5 -set g_balance_shotgun_refire3 0.2 -set g_balance_uzi_damage 16 -set g_balance_uzi_refire 0.1 -set g_balance_uzi_spread 0.05 -set g_balance_uzi_damage2 30 -set g_balance_uzi_refire2 0.2 -set g_balance_uzi_spread2 0.01 -set g_balance_grenadelauncher_damage 65 -set g_balance_grenadelauncher_edgedamage 35 -set g_balance_grenadelauncher_force 400 -set g_balance_grenadelauncher_radius 140 -set g_balance_grenadelauncher_speed 2000 -set g_balance_grenadelauncher_speed2 1400 -set g_balance_grenadelauncher_speed2_up 200 -set g_balance_grenadelauncher_speed_up 200 -set g_balance_grenadelauncher_refire 0.7 -set g_balance_grenadelauncher_refire2 0.6 -set g_balance_electro_ballspeed 900 -set g_balance_electro_ballspeed_up 200 -set g_balance_electro_damage 90 -set g_balance_electro_edgedamage 0 -set g_balance_electro_force 200 -set g_balance_electro_radius 150 -set g_balance_electro_refire 0.9 -set g_balance_electro_refire3 0.05 -set g_balance_electro_speed 2000 -set g_balance_crylink_damage 20 -set g_balance_crylink_edgedamage 0 -set g_balance_crylink_force 55 -set g_balance_crylink_radius 3 -set g_balance_crylink_refire 0.8 -set g_balance_crylink_speed 6000 -set g_balance_crylink_spread 0.10 -set g_balance_crylink_shots 7 -set g_balance_nex_damage 175 -set g_balance_nex_refire 1 -set g_balance_hagar_damage 40 -set g_balance_hagar_edgedamage 15 -set g_balance_hagar_force 100 -set g_balance_hagar_radius 70 -set g_balance_hagar_spread 0.025 -set g_balance_hagar_speed 3000 -set g_balance_hagar_speed2 1400 -set g_balance_hagar_speed2_up 100 -set g_balance_rocketlauncher_damage 130 -set g_balance_rocketlauncher_edgedamage 50 -set g_balance_rocketlauncher_force 600 -set g_balance_rocketlauncher_radius 170 -set g_balance_rocketlauncher_speed 850 -set g_balance_rocketlauncher_refire 1 -//set g_balance_falldamage_deadminspeed 100 -//set g_balance_falldamage_minspeed 600 -//set g_balance_falldamage_factor 0.05 -//set g_balance_falldamage_maxdamage 50 -set g_balance_falldamage_deadminspeed 150 -set g_balance_falldamage_minspeed 1400 -set g_balance_falldamage_factor 0.15 -set g_balance_falldamage_maxdamage 25 - -// effects -cl_decals 1 -cl_particles 1 -cl_stainmaps 0 -gl_flashblend 0 -r_bloom 1 -r_coronas 1 -r_dynamic 1 -r_shadow_bumpscale_basetexture 5 -r_shadow_realtime_world 1 -r_shadow_realtime_world_lightmaps 1 -r_shadow_glsl_offsetmapping 0 -r_shadow_realtime_world_shadows 0 -r_shadow_realtime_dlight_shadows 0 -r_shadow_realtime_world_dlightshadows 0 - -// disable watershader. Only affects NVidia cards. -// turned off to avoid fullbright water -r_watershader 0 - -// misc -host_maxfps 1000 -host_minfps 10 -scr_conbrightness 0 -scr_screenshot_jpeg 1 -scr_screenshot_jpeg_quality 0.9 -sv_maxvelocity 1000000000 - -// aliases: -alias +attack2 +button3 -alias -attack2 -button3 -alias +zoom +button4 -alias -zoom -button4 -alias +crouch +button5 -alias -crouch -button5 -alias weapnext "impulse 10" -alias weapprev "impulse 12" -alias bot_add "impulse 100" -alias bot_add2 "impulse 101" -alias bot_kick "impulse 102" -alias bot_cam "impulse 102" -alias bot_wayedit "impulse 102" - -// movement -bind w +forward -bind a +moveleft -bind s +back -bind d +moveright -bind UPARROW +forward -bind LEFTARROW +moveleft -bind DOWNARROW +back -bind RIGHTARROW +moveright -bind SHIFT +crouch -bind ENTER +jump -bind SPACE +jump - -// weapons -bind 1 "impulse 1" -bind 2 "impulse 2" -bind 3 "impulse 3" -bind 4 "impulse 4" -bind 5 "impulse 5" -bind 6 "impulse 6" -bind 7 "impulse 7" -bind 8 "impulse 8" -bind 9 "impulse 9" -bind 0 "impulse 210" -bind MOUSE1 +attack -bind MOUSE2 +attack2 -bind MOUSE3 +zoom -bind MWHEELUP weapnext -bind MWHEELDOWN weapprev - -// misc -bind - sizedown -bind = sizeup -bind ` toggleconsole -bind ~ toggleconsole -bind TAB +showscores -bind ESCAPE togglemenu -bind r messagemode2 -bind t messagemode -bind y messagemode2 -bind PAUSE pause -bind F10 quit -bind F12 screenshot - -// these commands can be voted -set sv_vote_allowed "restart timelimit fraglimit chmap g_grappling_hook" -// set to 1 to allow to change you vote/mind -set sv_vote_change "0" -// set to 1 to count votes once after timeout or to 0 to count with every vote -set sv_vote_singlecount "0" -// a vote will timeout after this many seconds -set sv_vote_timeout "60" -// a player can not call a vote again for this many seconds -set sv_vote_wait "120" -alias vhelp "cmd vote help" -alias vstatus "cmd vote status" -alias vcall "cmd vote call $*" -alias vstop "cmd vote stop" -alias vyes "echo voted YES;cmd vote yes" -alias vno "echo voted NO;cmd vote no" -bind F1 vyes -bind F2 vno diff --git a/qcsrc/gamec/GameC.dsp b/qcsrc/gamec/GameC.dsp deleted file mode 100644 index 2f498cfb5..000000000 --- a/qcsrc/gamec/GameC.dsp +++ /dev/null @@ -1,333 +0,0 @@ -# Microsoft Developer Studio Project File - Name="Game code" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=Game code - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "GameC.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "GameC.mak" CFG="Game code - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "Game code - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "Game code - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "Game code - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Game_code___Win32_Release" -# PROP BASE Intermediate_Dir "Game_code___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Game_code___Win32_Release" -# PROP Intermediate_Dir "Game_code___Win32_Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAMECODE_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAMECODE_EXPORTS" /YX /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "NDEBUG" -# ADD RSC /l 0x419 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 - -!ELSEIF "$(CFG)" == "Game code - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAMECODE_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GAMECODE_EXPORTS" /YX /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x419 /d "_DEBUG" -# ADD RSC /l 0x419 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "Game code - Win32 Release" -# Name "Game code - Win32 Debug" -# Begin Group "Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\builtins.h -# End Source File -# Begin Source File - -SOURCE=.\constants.h -# End Source File -# Begin Source File - -SOURCE=.\defs.h -# End Source File -# Begin Source File - -SOURCE=.\extensions.h -# End Source File -# Begin Source File - -SOURCE=.\sys.h -# End Source File -# End Group -# Begin Group "Source Files" - -# PROP Default_Filter "" -# Begin Group "client" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\cl_client.c -# End Source File -# Begin Source File - -SOURCE=.\cl_impulse.c -# End Source File -# Begin Source File - -SOURCE=.\cl_physics.c -# End Source File -# Begin Source File - -SOURCE=.\cl_player.c -# End Source File -# Begin Source File - -SOURCE=.\cl_weaponanimations.c -# End Source File -# Begin Source File - -SOURCE=.\cl_weapons.c -# End Source File -# Begin Source File - -SOURCE=.\cl_weaponsystem.c -# End Source File -# End Group -# Begin Group "server" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\sv_main.c -# End Source File -# Begin Source File - -SOURCE=.\sv_stats.c -# End Source File -# End Group -# Begin Group "frikbot" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\bot.c -# End Source File -# Begin Source File - -SOURCE=.\bot_ai.c -# End Source File -# Begin Source File - -SOURCE=.\bot_ed.c -# End Source File -# Begin Source File - -SOURCE=.\bot_fight.c -# End Source File -# Begin Source File - -SOURCE=.\bot_maps.c -# End Source File -# Begin Source File - -SOURCE=.\bot_misc.c -# End Source File -# Begin Source File - -SOURCE=.\bot_move.c -# End Source File -# Begin Source File - -SOURCE=.\bot_phys.c -# End Source File -# Begin Source File - -SOURCE=.\bot_way.c -# End Source File -# End Group -# Begin Group "game" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ctf.c -# End Source File -# Begin Source File - -SOURCE=.\domination.c -# End Source File -# Begin Source File - -SOURCE=.\g_casings.c -# End Source File -# Begin Source File - -SOURCE=.\g_damage.c -# End Source File -# Begin Source File - -SOURCE=.\g_decors.c -# End Source File -# Begin Source File - -SOURCE=.\g_lights.c -# End Source File -# Begin Source File - -SOURCE=.\g_subs.c -# End Source File -# Begin Source File - -SOURCE=.\g_tetris.c -# End Source File -# Begin Source File - -SOURCE=.\g_triggers.c -# End Source File -# Begin Source File - -SOURCE=.\g_violence.c -# End Source File -# Begin Source File - -SOURCE=.\g_world.c -# End Source File -# End Group -# Begin Group "map" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\t_halflife.c -# End Source File -# Begin Source File - -SOURCE=.\t_items.c -# End Source File -# Begin Source File - -SOURCE=.\t_jumppads.c -# End Source File -# Begin Source File - -SOURCE=.\t_plats.c -# End Source File -# Begin Source File - -SOURCE=.\t_quake.c -# End Source File -# Begin Source File - -SOURCE=.\t_quake3.c -# End Source File -# Begin Source File - -SOURCE=.\t_teleporters.c -# End Source File -# End Group -# Begin Group "weapons" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\w_common.c -# End Source File -# Begin Source File - -SOURCE=.\w_crylink.c -# End Source File -# Begin Source File - -SOURCE=.\w_electro.c -# End Source File -# Begin Source File - -SOURCE=.\w_grenadelauncher.c -# End Source File -# Begin Source File - -SOURCE=.\w_hagar.c -# End Source File -# Begin Source File - -SOURCE=.\w_laser.c -# End Source File -# Begin Source File - -SOURCE=.\w_nex.c -# End Source File -# Begin Source File - -SOURCE=.\w_rocketlauncher.c -# End Source File -# Begin Source File - -SOURCE=.\w_shotgun.c -# End Source File -# Begin Source File - -SOURCE=.\w_uzi.c -# End Source File -# End Group -# End Group -# Begin Source File - -SOURCE=..\progs.src -# End Source File -# Begin Source File - -SOURCE=..\todo.txt -# End Source File -# End Target -# End Project diff --git a/qcsrc/gamec/GameC.dsw b/qcsrc/gamec/GameC.dsw deleted file mode 100644 index cfdee20ad..000000000 --- a/qcsrc/gamec/GameC.dsw +++ /dev/null @@ -1,29 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "Game code"=.\GameC.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/qcsrc/gamec/GameC.opt b/qcsrc/gamec/GameC.opt deleted file mode 100644 index 74a16e503b04fb2d1ddd81364d61bea6b1717130..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 58880 zcmeI*4VV=5eFyN_x#M2oct76pxPZI~citT*c!3K0VlgAnR{9*pr2#83ow0c|*9 z1Y#tj7%>W=rW=FtSj0HQc*F$6M8su?62v5gnr;cklMz!8mm{VkrXi*yW*}xFu0W`1 zXJcH3C`Vk0s6bRAst|J!)d)4+T#V--u13@#<|D2_EI?d~Scp*5EyB1KQHQ8UG$0xg zO^C&a>k(=?6`#lBWr!OP%MmLOD-ky$Rw0@ZYPvNTuSK*VZbEzku@2FSa3j_uZbq~r zHXuBRc7zwvfiMuA2p^&g;YV~MdJq9b5D`Lz5xt0w2({cx9adpZVJ)VWqU0frBid%n z@xq7E*ki0^>*smd%I#5tJ^9(s-~H46I2r*29BP+v0pfsivp) zQMK=?^*G=3>iN`qs+|=>9hM%}5?H>0M;AW~({xu3Ugknv=<J4`o)eZCAA)_zu-=aqCM$F@mhT{>h z5rq@ch}YeWP?LMzi}8Pbc}KKY%|gFi?flxSiHg!!61S~M>hs7C!z;-L;68E^zKc9y zZBl=coDaWD9uL1kE`xtUUIPzS713OuAUu`)B-~2g3-^$3Y)R^csuG*8Z-xhv4fry0 zA6!BH3-~7TJ~%{v9o|L$5&Wm*sq2#ZQFZVzmp>i;5qU2B4tWXeQU@Ay`i<~R^6hX9 z`D^e7@*cRId;snvzX{(%{$F@6xv4d&pC+$`hp2;|xjqx!N&Wle68JE=3O+$@gin!! z@KkjGHRpF6-c5cReuR7)-bWt3KB<3)Tm!#LUIFK;gR?pRZg?_z3tUBh9`=*>!ad|y z;jQGu@O|Xd@ILbBo0IzY$hW}N>O^6#&zIoq$$DE--%s8Im#dSCIsKjRLh=##e)7M< zUnai`KTXcvkktQ{JR5$STnC>dx56Vg*vs#Mr;s0qzd(KxZYA%BBjiKyPV)QkGvq;@ zr2Zesgtz%yc;ei?|>JO zAAwhs55YUhzlNV9Pv}VMZ<1%h|3Q8U-lQ%N%;o>UNb2{dPLS#HjO!Pk)=fR~YH5CZcft$F&%&ML*WhjB+1;p*av&fIZ zE#!mncJlZhoL|X}@G0^dc(A%CHRt~%+)925UQgZ+N63fZo#gl7XUKyCN&O$l?eKVY z0cTZiPpxi)(ZKyWs1{--LtYvIP@pS&NAkPpN6k>7`(A?snBFUTX|gXB8+BsmJt zQXev`_ZMy@?}dBFKZL(R{x|pm@;mTX$*$g{{%!J1_{Zc%_!RkOc(nS!W3EpRJcWD< zTur_oUQGTwcnkRr_-^vJjd*{^6W}+=mGIBW4e&?g0DQUnFlMgb4tN21Y$T~C$<^?G zk(=Q`sgD5Z@z&uj|Bv8W@>hnBF})2kypY6+wJx1giFYMa0U4;coF%1_!;uA;pfP?JFtG_V)&oQ3*i4DuZD|u z*z5BUyd2K4ztM5wS;_yI*Kd;lll-6L|Lo(1 z`9HfpNd8aqf0F;R>x1O~B>yM*Kf69;Oa89_8NeHsEnS8+llV+B0SAV*cVc;b!|0=a0bNTgX)$c*;^C<2b;76$wS}E=w za8cX;qRW3BEk6hCzYA3}?o`|F!uo(G8eQu*5(5@Au2{8j_{Yzbdet*VH2wE;Kl^E~ zDroWt414C2TEdZ@Xs^d>lul1IB%eONw6e4}67DvkUtb5h+!3 zi54}d+N7tE=MDIcP%JNML^c_b{LYBKr#&3Y^`TffK~Haf!tnHlL*}~YC)&`iz1*8F z!zVQmFKY|>qh9Oj^h6meuG+Ut`)_IgE$zS6fh65tMB0B#`)_IgZPy2B|1IsmrTw>E zAEf=awEvd&-*$bF_TSR}TiSoy^+DQyOZ#tW|83WY-&OnX4JXn+{2XH^+saB?{GmBj zr42@V+?UD?nzwi?(CSyFvvZ#|^|;@j%PJ#ac%rF0jeXjybQJr<0QK`zHRKf(H#gU< z!p~6$Y4xi;5uXuT5;KCI_F{U;ClZ7%+_pBgx{D*>c&|Cr0R_bkOItpXJ3Q-jWi3V*|BLkhBK^PE=YQ${Mf!h{{$K3+ApO5c|1Z-2 zi(Mb2{}<{1Mf!iS>x1+Sh>!_xncy*;G=AL;)` z`v0-(gY^F+{r^b+KX!eP{(q$ZAL;+ct`E}xkM#c|{r}kYLHhrZ{(q$ZAGu7Uv$WhB&>;sT8c611T-POTvROYaE1U7MqRuT$k8 zjrm@NxXUd6)P63%D(fi3Vj8QzsiC;sooI`My*)-O;E9L4T}H&Ay&$tXT%HA6AzkL* z{(q3#3SAzb$Em_wi?FJ|lzuM!Hk_~2ZaEWSjjeSoQib=1gTZjfp|@V0BU1NzXRM0U(CAKF}HPcRF<@$UGB%F5AoB9S`>QdODms0Petseire8`Tmz?arsg8 zV{Lxi2;8Z{XCC(^WqaX!1D=>uh2M>L{UD+U*Wc7(&>r^=pr!XKN( zWyb}duWge*956!O&+5oOCX36D3m#uvA{+^Hd`1WU(OF#hRJHH$1U){d-uldI{ZUz8 zdczxb?2MOry;q#YrOz*SqZ@9AcKXay{m3jXIF9zJ|8c{q3ZHqNACbjnM}=2qR|!6c z-ucW5KRk;|k7KU#oy^bqG%y|=ERLr7|cklGmB&*fJ~;W3CSXl$+HNcwswx;cvMmP7SFvkDaT z^G2`=e713VCrE$C<iWk|v&5nJiV{K+D!!=A;KD4+o$Y;wofeF5iXDQ#T?l@nHS9k8Jj1Yej1`K9OM2#%#W|do%wl4=FX9y z#idur4*Vb><_Y1e0cVPz`R3Ya7$9FWE3$J?K1LwejB zi-aAza>)G9n487LAEk=#ix?qKhvD$AA~FvGIa$0JQoo7_;1b%YUqxhIJ?Z^i_~odR zn-Sw_Y*o`jwGYI%_&=lF-__4Ww~BeTajN!5yTUPF+^LVwnMo5Zi;JIn=W)q+k?%Y{ z5~kX`XZ|WQ^CQ#Qwz&LFwt#E_*#dt!Ti|q#D^JH4@55FebuAitRQ+6D2H66#1!N1z X7LY9= badspotnum) - return spot; - spawn_badspots = spawn_badspots + 1; - } - else - { - if (spawn_goodspots >= goodspotnum) - return spot; - spawn_goodspots = spawn_goodspots + 1; - } - spot = find(spot, classname, "info_player_deathmatch"); - } - return firstspot; -} - -entity Spawn_FurthestPoint(entity firstspot, entity playerlist) -{ - local entity best, spot, player; - local float bestrating, rating; - best = world; - bestrating = -1000000; - spot = firstspot; - while (spot) - { - rating = 1000000000; - player = playerlist; - while (player) - { - if (player != self) - rating = min(rating, vlen(player.origin - spot.origin)); - player = player.chain; - } - rating = rating + random() * 16; - if (bestrating < rating) - { - best = spot; - bestrating = rating; - } - spot = find(spot, classname, "info_player_deathmatch"); - } - return best; -} - -/* -============= -SelectSpawnPoint - -Finds a point to respawn -============= -*/ -entity SelectSpawnPoint (float anypoint) -{ - local entity spot, firstspot, playerlist; - string spotname; - - spot = find (world, classname, "testplayerstart"); - if (spot) - return spot; - - spotname = "info_player_deathmatch"; - - if(!anypoint && cvar("g_ctf") ) - { - if(self.team == 5)//4) - spotname = "info_player_team1"; - if(self.team == 14)//13) - spotname = "info_player_team2"; - if(self.team == 4)//3) - spotname = "info_player_team3"; - if(self.team == 13)//12) - spotname = "info_player_team4"; - } - - playerlist = findchain(classname, "player"); - firstspot = find(world, classname, spotname); - Spawn_ClassifyPoints(firstspot, playerlist, 100, 1000000, 1000000); - // first check if there are ANY good spots - if (spawn_goodspots > 0) - { - // good spots exist, there is 50/50 chance of choosing a random good - // spot or the furthest spot - // (this means that roughly every other spawn will be furthest, so you - // usually won't get fragged at spawn twice in a row) - if (random() > 0.5) - spot = Spawn_ClassifyPoints(firstspot, playerlist, 100, min(floor(random() * spawn_goodspots), spawn_goodspots - 1), 1000000); - else - spot = Spawn_FurthestPoint(firstspot, playerlist); - } - else - { - // no good spots exist, pick a random bad spot - spot = Spawn_ClassifyPoints(firstspot, playerlist, 100, 1000000, min(floor(random() * spawn_badspots), spawn_badspots - 1)); - } - - if (!spot) - { - if(anypoint) - error ("PutClientInServer: no start points on level"); - else // try again with deathmatch spots - spot = SelectSpawnPoint(TRUE); - } - - return spot; -} - -/* -============= -CheckPlayerModel - -Checks if the argument string can be a valid playermodel. -Returns a valid one in doubt. -============= -*/ -string CheckPlayerModel(string plyermodel) { - if( substring(plyermodel,0,14) != "models/player/") plyermodel = "models/player/marine.zym"; - - /* Possible Fixme: Check if server can open the model? - This would kill custom models, however. */ - - return plyermodel; -} - - -/* -============= -PutClientInServer - -Called when a client spawns in the server -============= -*/ -void PutClientInServer (void) -{ - entity spot; - - spot = SelectSpawnPoint (FALSE); - - RemoveGrapplingHook(self); // Wazat's Grappling Hook - - self.classname = "player"; - self.iscreature = TRUE; - self.movetype = MOVETYPE_WALK; - self.solid = SOLID_SLIDEBOX; - self.flags = FL_CLIENT; - self.takedamage = DAMAGE_AIM; - self.effects = 0; - self.health = cvar("g_balance_health_start"); - self.armorvalue = cvar("g_balance_armor_start"); - self.pauserotarmor_finished = time + 10; - self.pauserothealth_finished = time + 10; - self.pauseregen_finished = 0; - self.damageforcescale = 2; - self.death_time = 0; - self.dead_time = 0; - self.dead_frame = 0; - self.die_frame = 0; - self.alpha = 0; - self.scale = 0; - self.fade_time = 0; - self.pain_frame = 0; - self.pain_finished = 0; - self.strength_finished = 0; - self.invincible_finished = 0; - self.pushltime = 0; - //self.speed_finished = 0; - //self.slowmo_finished = 0; - self.vote_finished = 0; - // players have no think function - self.think = SUB_Null; - self.nextthink = 0; - - self.hook_time = 0; - - self.runes = 0; - - self.deadflag = DEAD_NO; - - self.angles = spot.angles; - - self.angles_z = 0; // never spawn tilted even if the spot says to - self.fixangle = TRUE; // turn this way immediately - self.velocity = '0 0 0'; - self.avelocity = '0 0 0'; - self.punchangle = '0 0 0'; - self.punchvector = '0 0 0'; - self.oldvelocity = self.velocity; - - self.viewzoom = 0.6; - - - self.playermodel = CheckPlayerModel(self.playermodel); - - precache_model (self.playermodel); - setmodel (self, self.playermodel); - self.skin = stof(self.playerskin); - self.crouch = FALSE; - self.view_ofs = PL_VIEW_OFS; - setsize (self, PL_MIN, PL_MAX); - setorigin (self, spot.origin + '0 0 1' * (1 - self.mins_z - 24)); - // don't reset back to last position, even if new position is stuck in solid - self.oldorigin = self.origin; - - if (cvar("g_use_ammunition")) { - self.ammo_shells = cvar("g_start_ammo_shells"); - self.ammo_nails = cvar("g_start_ammo_nails"); - self.ammo_rockets = cvar("g_start_ammo_rockets"); - self.ammo_cells = cvar("g_start_ammo_cells"); - } else { - self.ammo_shells = 999; - self.ammo_nails = 999; - self.ammo_rockets = 999; - self.ammo_cells = 999; - } - - self.items = 0; - if (cvar("g_start_weapon_laser")) - { - self.items = self.items | IT_LASER; - self.switchweapon = WEP_LASER; - } - if (cvar("g_start_weapon_shotgun")) - { - self.items = self.items | IT_SHOTGUN; - self.switchweapon = WEP_SHOTGUN; - } - if (cvar("g_start_weapon_uzi")) - { - self.items = self.items | IT_UZI; - self.switchweapon = WEP_UZI; - } - if (cvar("g_start_weapon_grenadelauncher")) - { - self.items = self.items | IT_GRENADE_LAUNCHER; - self.switchweapon = WEP_GRENADE_LAUNCHER; - } - if (cvar("g_start_weapon_electro")) - { - self.items = self.items | IT_ELECTRO; - self.switchweapon = WEP_ELECTRO; - } - if (cvar("g_start_weapon_crylink")) - { - self.items = self.items | IT_CRYLINK; - self.switchweapon = WEP_CRYLINK; - } - if (cvar("g_start_weapon_nex")) - { - self.items = self.items | IT_NEX; - self.switchweapon = WEP_NEX; - } - if (cvar("g_start_weapon_hagar")) - { - self.items = self.items | IT_HAGAR; - self.switchweapon = WEP_HAGAR; - } - if (cvar("g_start_weapon_rocketlauncher")) - { - self.items = self.items | IT_ROCKET_LAUNCHER; - self.switchweapon = WEP_ROCKET_LAUNCHER; - } - - self.event_damage = PlayerDamage; - - self.statdraintime = time + 5; - self.button0 = self.button1 = self.button2 = self.button3 = 0; - - /* - W_UpdateWeapon(); - W_UpdateAmmo(); - */ - CL_SpawnWeaponentity(); - - //stuffcmd(self, "chase_active 0"); -} - -/* -============= -SetNewParms -============= -*/ -void SetNewParms (void) -{ - -} - -/* -============= -SetChangeParms -============= -*/ -void SetChangeParms (void) -{ - -} - -/* -============= -ClientKill - -Called when a client types 'kill' in the console -============= -*/ -void ClientKill (void) -{ - Damage(self, self, self, 100000, DEATH_KILL, self.origin, '0 0 0'); -} - -/* -============= -ClientConnect - -Called when a client connects to the server -============= -*/ -string ColoredTeamName(float t); -//void dom_player_join_team(entity pl); -void ClientConnect (void) -{ - self.classname = "player_joining"; - - //if(cvar("g_domination")) - // dom_player_join_team(self); - - JoinBestTeam(self, FALSE); - - self.classname = "player"; - - - - bprint ("^4",self.netname); - bprint (" connected"); - - if(cvar("g_domination") || cvar("g_ctf")) - { - bprint(" and joined the "); - bprint(ColoredTeamName(self.team)); - } - - bprint("\n"); - - self.welcomemessage_time = time + cvar("welcome_message_time"); - self.welcomemessage_time2 = 0; - - - stuffcmd(self, strcat("exec maps/", mapname, ".cfg\n")); - // send prediction settings to the client - stuffcmd(self, strcat("cl_movement_maxspeed ", ftos(cvar("sv_maxspeed")), "\n")); - stuffcmd(self, strcat("cl_movement_maxairspeed ", ftos(cvar("sv_maxairspeed")), "\n")); - stuffcmd(self, strcat("cl_movement_accelerate ", ftos(cvar("sv_accelerate")), "\n")); - stuffcmd(self, strcat("cl_movement_friction ", ftos(cvar("sv_friction")), "\n")); - stuffcmd(self, strcat("cl_movement_stopspeed ", ftos(cvar("sv_stopspeed")), "\n")); - stuffcmd(self, strcat("cl_movement_jumpvelocity ", ftos(cvar("g_balance_jumpheight")), "\n")); - stuffcmd(self, strcat("cl_movement_stepheight ", ftos(cvar("sv_stepheight")), "\n")); - stuffcmd(self, strcat("cl_movement_edgefriction 0\n")); - - // Wazat's grappling hook - SetGrappleHookBindings(); -} - -/* -============= -ClientDisconnect - -Called when a client disconnects from the server -============= -*/ -.entity chatbubbleentity; -void ClientDisconnect (void) -{ - bprint ("^4",self.netname); - bprint (" disconnected\n"); - - if (self.chatbubbleentity) - { - remove (self.chatbubbleentity); - self.chatbubbleentity = world; - } - DropAllRunes(self); -} - -.float buttonchat; -void() ChatBubbleThink = -{ - self.nextthink = time; - if (!self.owner.modelindex || self.owner.chatbubbleentity != self) - { - remove(self); - return; - } - setorigin(self, self.owner.origin + '0 0 15' + self.owner.maxs_z * '0 0 1'); - if (self.owner.buttonchat && !self.owner.deadflag) - self.model = self.mdl; - else - self.model = ""; -}; - -void() UpdateChatBubble = -{ - if (!self.modelindex) - return; - // spawn a chatbubble entity if needed - if (!self.chatbubbleentity) - { - self.chatbubbleentity = spawn(); - self.chatbubbleentity.owner = self; - self.chatbubbleentity.exteriormodeltoclient = self; - self.chatbubbleentity.think = ChatBubbleThink; - self.chatbubbleentity.nextthink = time; - setmodel(self.chatbubbleentity, "models/misc/chatbubble.spr"); - setorigin(self.chatbubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1'); - self.chatbubbleentity.mdl = self.chatbubbleentity.model; - self.chatbubbleentity.model = ""; - } -} - -// LordHavoc: this hack will be removed when proper _pants/_shirt layers are -// added to the model skins -void() UpdateColorModHack = -{ - local float c; - c = self.clientcolors & 15; - // LordHavoc: only bothering to support white, green, red, yellow, blue - if (teamplay == 0) self.colormod = '0 0 0'; - else if (c == 0) self.colormod = '1.00 1.00 1.00'; - else if (c == 3) self.colormod = '0.10 1.73 0.10'; - else if (c == 4) self.colormod = '1.73 0.10 0.10'; - else if (c == 12) self.colormod = '1.22 1.22 0.10'; - else if (c == 13) self.colormod = '0.10 0.10 1.73'; - else self.colormod = '1 1 1'; -}; - -/* -============= -PlayerJump - -When you press the jump key -============= -*/ -void PlayerJump (void) -{ - float mjumpheight; - - mjumpheight = cvar("g_balance_jumpheight"); - if (self.waterlevel >= 2) - { - if (self.watertype == CONTENT_WATER) - self.velocity_z = 200; - else if (self.watertype == CONTENT_SLIME) - self.velocity_z = 80; - else - self.velocity_z = 50; - - return; - } - - - if (!(self.flags & FL_ONGROUND)) - return; - - if (!(self.flags & FL_JUMPRELEASED)) - return; - - if(cvar("g_runematch")) - { - if(self.runes & RUNE_SPEED) - { - if(self.runes & CURSE_SLOW) - mjumpheight = mjumpheight * cvar("g_balance_rune_speed_combo_jumpheight"); - else - mjumpheight = mjumpheight * cvar("g_balance_rune_speed_jumpheight"); - } - else if(self.runes & CURSE_SLOW) - { - mjumpheight = mjumpheight * cvar("g_balance_curse_slow_jumpheight"); - } - } - - self.velocity_z = self.velocity_z + mjumpheight; - self.oldvelocity_z = self.velocity_z; - - self.flags = self.flags - FL_ONGROUND; - self.flags = self.flags - FL_JUMPRELEASED; -} - -void() CheckWaterJump = -{ - local vector start, end; - -// check for a jump-out-of-water - makevectors (self.angles); - start = self.origin; - start_z = start_z + 8; - v_forward_z = 0; - normalize(v_forward); - end = start + v_forward*24; - traceline (start, end, TRUE, self); - if (trace_fraction < 1) - { // solid at waist - start_z = start_z + self.maxs_z - 8; - end = start + v_forward*24; - self.movedir = trace_plane_normal * -50; - traceline (start, end, TRUE, self); - if (trace_fraction == 1) - { // open at eye level - self.flags = self.flags | FL_WATERJUMP; - self.velocity_z = 225; - self.flags = self.flags - (self.flags & FL_JUMPRELEASED); - self.teleport_time = time + 2; // safety net - return; - } - } -}; - - -void respawn(void) -{ - CopyBody(1); - PutClientInServer(); -} - -void player_powerups (void) -{ - self.effects = self.effects - (self.effects & (EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT)); - if (self.items & IT_STRENGTH) - { - self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT); - if (time > self.strength_finished) - { - self.items = self.items - (self.items & IT_STRENGTH); - sprint(self, "^3Strength has worn off\n"); - } - } - else - { - if (time < self.strength_finished) - { - self.items = self.items | IT_STRENGTH; - sprint(self, "^3Strength infuses your weapons with devestating power\n"); - } - } - if (self.items & IT_INVINCIBLE) - { - self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT); - if (time > self.invincible_finished) - { - self.items = self.items - (self.items & IT_INVINCIBLE); - sprint(self, "^3Shield has worn off\n"); - } - } - else - { - if (time < self.invincible_finished) - { - self.items = self.items | IT_INVINCIBLE; - sprint(self, "^3Shield surrounds you\n"); - } - } - - if (cvar("g_fullbrightplayers")) - self.effects = EF_FULLBRIGHT; - -} - -void player_regen (void) -{ - float maxh, maxa, max_mod, regen_mod, rot_mod; - maxh = cvar("g_balance_health_stable"); - maxa = cvar("g_balance_armor_stable"); - - if(cvar("g_runematch")) - { - max_mod = regen_mod = rot_mod = 1; - if (self.runes & RUNE_REGEN) - { - if (self.runes & CURSE_VENOM) // do we have both rune/curse? - { - regen_mod = cvar("g_balance_rune_regen_combo_regenrate"); - max_mod = cvar("g_balance_rune_regen_combo_hpmod"); - } - else - { - regen_mod = cvar("g_balance_rune_regen_regenrate"); - max_mod = cvar("g_balance_rune_regen_hpmod"); - } - } - else if (self.runes & CURSE_VENOM) - { - max_mod = cvar("g_balance_curse_venom_hpmod"); - if (self.runes & RUNE_REGEN) // do we have both rune/curse? - rot_mod = cvar("g_balance_rune_regen_combo_rotrate"); - else - rot_mod = cvar("g_balance_curse_venom_rotrate"); - //if (!self.runes & RUNE_REGEN) - // rot_mod = cvar("g_balance_curse_venom_rotrate"); - } - maxh = maxh * max_mod; - //maxa = maxa * max_mod; - - if (time > self.pauserotarmor_finished) - { - if (self.armorvalue > maxa) - self.armorvalue = bound(0, self.armorvalue + (maxa - self.armorvalue) * cvar("g_balance_armor_rot") * frametime, 1000); - } - if (time > self.pauserothealth_finished) - { - if (self.health > maxh) - self.health = bound(0, self.health + (maxh - self.health) * rot_mod*cvar("g_balance_health_rot") * frametime, 1000); - } - if (time > self.pauseregen_finished) - { - if (self.health < maxh) - self.health = bound(0, self.health + (maxh- self.health) * regen_mod*cvar("g_balance_health_regen") * frametime, 1000); - if (self.armorvalue < maxa) - self.armorvalue = bound(0, self.armorvalue + (maxa - self.armorvalue) * cvar("g_balance_armor_regen") * frametime, 1000); - } - } - else - { - if (time > self.pauserothealth_finished) - if (self.health > maxh) - self.health = bound(0, self.health + (maxh - self.health) * cvar("g_balance_health_rot") * frametime, 1000); - if (time > self.pauserotarmor_finished) - if (self.armorvalue > maxa) - self.armorvalue = bound(0, self.armorvalue + (maxa - self.armorvalue) * cvar("g_balance_armor_rot") * frametime, 1000); - if (time > self.pauseregen_finished) - { - if (self.health < maxh) - self.health = bound(0, self.health + (maxh- self.health) * cvar("g_balance_health_regen") * frametime, 1000); - if (self.armorvalue < maxa) - self.armorvalue = bound(0, self.armorvalue + (maxa - self.armorvalue) * cvar("g_balance_armor_regen") * frametime, 1000); - } - } -} - -/* -============= -PlayerPreThink - -Called every frame for each client before the physics are run -============= -*/ -void PlayerPreThink (void) -{ - local vector m1, m2; - -// MauveBot_AI(); - -// if(self.netname == "Wazat") -// bprint(strcat(self.classname, "\n")); - - CheckRules_Player(); - - if (intermission_running) - { - IntermissionThink (); // otherwise a button could be missed between - return; // the think tics - } - - if (self.deadflag != DEAD_NO) - { - player_anim(); - weapon_freeze(); - if (self.deadflag == DEAD_DYING) - { - if (time > self.dead_time) - self.deadflag = DEAD_DEAD; - } - else if (self.deadflag == DEAD_DEAD) - { - if (!self.button0 && !self.button2 && !self.button3) - self.deadflag = DEAD_RESPAWNABLE; - } - else if (self.deadflag == DEAD_RESPAWNABLE) - { - if (self.button0 || self.button2 || self.button3 || self.button4) - respawn(); - } - return; - } - - if (self.button5) - { - if (!self.crouch) - { - self.crouch = TRUE; - self.view_ofs = PL_CROUCH_VIEW_OFS; - setsize (self, PL_CROUCH_MIN, PL_CROUCH_MAX); - } - } - else - { - if (self.crouch) - { - tracebox(self.origin, PL_MIN, PL_MAX, self.origin, FALSE, self); - if (!trace_startsolid) - { - self.crouch = FALSE; - self.view_ofs = PL_VIEW_OFS; - setsize (self, PL_MIN, PL_MAX); - } - } - } - - if (self.playermodel != self.model) - { - self.playermodel = CheckPlayerModel(self.playermodel); - m1 = self.mins; - m2 = self.maxs; - precache_model (self.playermodel); - setmodel (self, self.playermodel); - setsize (self, m1, m2); - } - - // Savage: Check for nameless players - if (strlen(self.netname) < 1) { - self.netname = "Player"; - stuffcmd(self, "name Player\n"); - } - - if (self.skin != stof(self.playerskin)) - self.skin = stof(self.playerskin); - - GrapplingHookFrame(); - - W_WeaponFrame(); - - if (self.button4 || (self.weapon == WEP_NEX && self.button3)) - { - if (self.viewzoom > 0.4) - self.viewzoom = max (0.4, self.viewzoom - frametime * 2); - } - else if (self.viewzoom < 1.0) - self.viewzoom = min (1.0, self.viewzoom + frametime); - - - if (self.button2) - PlayerJump (); - else - self.flags = self.flags | FL_JUMPRELEASED; - - if (self.vote_finished > 0 // this player has called a vote - && time > self.vote_finished) // time is up - { - VoteCount(); - } - - player_powerups(); - player_regen(); - player_anim(); - - //self.angles_y=self.v_angle_y + 90; // temp - - if (self.waterlevel == 2) - CheckWaterJump (); - - //if (TetrisPreFrame()) return; -} - -/* -============= -PlayerPostThink - -Called every frame for each client after the physics are run -============= -*/ -void PlayerPostThink (void) -{ - CheckRules_Player(); - UpdateChatBubble(); - UpdateColorModHack(); - if (self.deadflag == DEAD_NO) - if (self.impulse) - ImpulseCommands (); - if (intermission_running) - return; // intermission or finale - - PrintWelcomeMessage(self); - //if (TetrisPostFrame()) return; -} diff --git a/qcsrc/gamec/cl_impulse.c b/qcsrc/gamec/cl_impulse.c deleted file mode 100644 index c656653d2..000000000 --- a/qcsrc/gamec/cl_impulse.c +++ /dev/null @@ -1,64 +0,0 @@ -void CopyBody(float keepvelocity); - -// changes by LordHavoc on 03/30/04 -// cleaned up dummy code -// dummies are now removed eventually after being gibbed (norespawn = TRUE) -// dummy impulse now checks sv_cheats to prevent players from overwhelming server with dummies -// dummies now use player code where possible - -void player_anim (void); -void DummyThink(void) -{ - self.think = DummyThink; - self.nextthink = time; - SV_PlayerPhysics(); - PlayerPreThink(); - //player_anim(); - PlayerPostThink(); -} - -void ImpulseCommands (void) -{ - if (self.impulse >= 1 && self.impulse <= 9) - W_SwitchWeapon (self.impulse); - else if (self.impulse == 10) - W_NextWeapon (); - else if (self.impulse == 12) - W_PreviousWeapon (); - else if (self.impulse == 13 && cvar("sv_cheats")) - { - makevectors (self.v_angle); - self.velocity = self.velocity + v_forward * 300; - CopyBody(1); - self.velocity = self.velocity - v_forward * 300; - } - else if (self.impulse == 14 && cvar("sv_cheats")) - CopyBody(0); - else if (self.impulse == 15 && cvar("sv_cheats")) - { - sprint(self, strcat("origin = ", vtos(self.origin), "\n")); - } - else if (self.impulse == 16 && cvar("sv_cheats")) - { - float i; - string s; - i=1; - while(i <= 10) - { - s = ftos(i); - sprint(self, strcat(s, ": ^", s, "color\n")); - i = i + 1; - } - sprint(self, strcat("origin = ", vtos(self.origin), "\n")); - } - else if (self.impulse == 99 && cvar("sv_cheats")) - { - self.items = IT_LASER | IT_UZI | IT_SHOTGUN | IT_GRENADE_LAUNCHER | IT_ELECTRO | IT_CRYLINK | IT_NEX | IT_HAGAR | IT_ROCKET_LAUNCHER; - self.ammo_shells = 999; - self.ammo_nails = 999; - self.ammo_rockets = 999; - self.ammo_cells = 999; - } - //TetrisImpulses(); - self.impulse = 0; -} \ No newline at end of file diff --git a/qcsrc/gamec/cl_physics.c b/qcsrc/gamec/cl_physics.c deleted file mode 100644 index fe725be95..000000000 --- a/qcsrc/gamec/cl_physics.c +++ /dev/null @@ -1,247 +0,0 @@ -float sv_accelerate; -float sv_maxairspeed; -float sv_friction; -float sv_maxspeed; -float sv_stopspeed; -float sv_gravity; -.float ladder_time; -.entity ladder_entity; -.float gravity; - -void SV_PlayerPhysics() -{ - local vector wishvel, wishdir, v; - local float wishspeed, f, maxspd_mod, spd, maxairspd, airaccel; - string temps; - - MauveBot_AI(); - - if (self.movetype == MOVETYPE_NONE) - return; - - if (self.punchangle != '0 0 0') - { - f = vlen(self.punchangle) - 10 * frametime; - if (f > 0) - self.punchangle = normalize(self.punchangle) * f; - else - self.punchangle = '0 0 0'; - } - - if (self.punchvector != '0 0 0') - { - f = vlen(self.punchvector) - 30 * frametime; - if (f > 0) - self.punchvector = normalize(self.punchvector) * f; - else - self.punchvector = '0 0 0'; - } - - maxspd_mod = 1; - - if(cvar("g_runematch")) - { - if(self.runes & RUNE_SPEED) - { - if(self.runes & CURSE_SLOW) - maxspd_mod = maxspd_mod * cvar("g_balance_rune_speed_combo_moverate"); - else - maxspd_mod = maxspd_mod * cvar("g_balance_rune_speed_moverate"); - } - else if(self.runes & CURSE_SLOW) - { - maxspd_mod = maxspd_mod * cvar("g_balance_curse_slow_moverate"); - } - } - - spd = sv_maxspeed * maxspd_mod; - - if(self.speed != spd) - { - self.speed = spd; - temps = ftos(spd); - stuffcmd(self, strcat("cl_forwardspeed ", temps, "\n")); - stuffcmd(self, strcat("cl_backspeed ", temps, "\n")); - stuffcmd(self, strcat("cl_sidespeed ", temps, "\n")); - stuffcmd(self, strcat("cl_upspeed ", temps, "\n")); - - temps = ftos(sv_accelerate * maxspd_mod); - stuffcmd(self, strcat("cl_movement_accelerate ", temps, "\n")); - } - - // if dead, behave differently - if (self.deadflag) - return; - - if (!self.fixangle) - { - self.angles_x = 0; - self.angles_y = self.v_angle_y; - self.angles_z = 0; - } - - if (self.flags & FL_WATERJUMP ) - { - self.velocity_x = self.movedir_x; - self.velocity_y = self.movedir_y; - if (time > self.teleport_time || self.waterlevel == 0) - { - self.flags = self.flags - (self.flags & FL_WATERJUMP); - self.teleport_time = 0; - } - } - else if (self.movetype == MOVETYPE_NOCLIP || self.movetype == MOVETYPE_FLY) - { - // noclipping or flying - self.flags = self.flags - (self.flags & FL_ONGROUND); - - self.velocity = self.velocity * (1 - frametime * 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; - // acceleration - wishdir = normalize(wishvel); - wishspeed = vlen(wishvel); - if (wishspeed > sv_maxspeed*maxspd_mod) - wishspeed = sv_maxspeed*maxspd_mod; - if (time >= self.teleport_time) - { - f = wishspeed - (self.velocity * wishdir); - if (f > 0) - self.velocity = self.velocity + wishdir * min(f, sv_accelerate*maxspd_mod * frametime * wishspeed); - } - } - else if (self.waterlevel >= 2) - { - // swimming - self.flags = self.flags - (self.flags & FL_ONGROUND); - - 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; - if (wishvel == '0 0 0') - wishvel = '0 0 -60'; // drift towards bottom - - wishdir = normalize(wishvel); - wishspeed = vlen(wishvel); - if (wishspeed > sv_maxspeed*maxspd_mod) - wishspeed = sv_maxspeed*maxspd_mod; - wishspeed = wishspeed * 0.7; - - // water friction - self.velocity = self.velocity * (1 - frametime * sv_friction); - - // water acceleration - f = wishspeed - (self.velocity * wishdir); - if (f > 0) - self.velocity = self.velocity + wishdir * min(f, sv_accelerate*maxspd_mod * frametime * wishspeed); - } - else if (time < self.ladder_time) - { - // on a func_ladder or swimming in func_water - self.flags = self.flags - (self.flags & FL_ONGROUND); - - self.velocity = self.velocity * (1 - frametime * 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; - if (self.gravity) - self.velocity_z = self.velocity_z + self.gravity * sv_gravity * frametime; - else - self.velocity_z = self.velocity_z + sv_gravity * frametime; - if (self.ladder_entity.classname == "func_water") - { - f = vlen(wishvel); - if (f > self.ladder_entity.speed) - wishvel = wishvel * (self.ladder_entity.speed / f); - - self.watertype = self.ladder_entity.skin; - f = self.ladder_entity.origin_z + self.ladder_entity.maxs_z; - if ((self.origin_z + self.view_ofs_z) < f) - self.waterlevel = 3; - else if ((self.origin_z + (self.mins_z + self.maxs_z) * 0.5) < f) - self.waterlevel = 2; - else if ((self.origin_z + self.mins_z + 1) < f) - self.waterlevel = 1; - else - { - self.waterlevel = 0; - self.watertype = CONTENT_EMPTY; - } - } - // acceleration - wishdir = normalize(wishvel); - wishspeed = vlen(wishvel); - if (wishspeed > sv_maxspeed) - wishspeed = sv_maxspeed; - if (time >= self.teleport_time) - { - f = wishspeed - (self.velocity * wishdir); - if (f > 0) - self.velocity = self.velocity + wishdir * min(f, sv_accelerate*maxspd_mod * frametime * wishspeed); - } - } - else if (self.flags & FL_ONGROUND) - { - // walking - makevectors(self.v_angle_y * '0 1 0'); - wishvel = v_forward * self.movement_x + v_right * self.movement_y; - // friction - if (self.velocity_x || self.velocity_y) - { - v = self.velocity; - v_z = 0; - f = vlen(v); - if (f < sv_stopspeed) - f = 1 - frametime * (sv_stopspeed / f) * sv_friction; - else - f = 1 - frametime * sv_friction; - if (f > 0) - self.velocity = self.velocity * f; - else - self.velocity = '0 0 0'; - } - // acceleration - wishdir = normalize(wishvel); - wishspeed = vlen(wishvel); - if (wishspeed > sv_maxspeed*maxspd_mod) - wishspeed = sv_maxspeed*maxspd_mod; - if (self.button5) // crouch - wishspeed = wishspeed * 0.5; - if (time >= self.teleport_time) - { - f = wishspeed - (self.velocity * wishdir); - if (f > 0) - self.velocity = self.velocity + wishdir * min(f, sv_accelerate*maxspd_mod * frametime * wishspeed); - } - } - else - { - if(maxspd_mod < 1) - { - maxairspd = sv_maxairspeed*maxspd_mod; - airaccel = sv_accelerate*maxspd_mod; - } - else - { - maxairspd = sv_maxairspeed; - airaccel = sv_accelerate; - } - // airborn - makevectors(self.v_angle_y * '0 1 0'); - wishvel = v_forward * self.movement_x + v_right * self.movement_y; - // acceleration - wishdir = normalize(wishvel); - wishspeed = vlen(wishvel); - if (wishspeed > maxairspd) - wishspeed = maxairspd; - if (self.button5) // crouch - wishspeed = wishspeed * 0.5; - if (time >= self.teleport_time) - { - f = wishspeed;// - (self.velocity * wishdir); - if (f > 0) - self.velocity = self.velocity + wishdir * min(f, airaccel * frametime * wishspeed); - } - } -}; diff --git a/qcsrc/gamec/cl_player.c b/qcsrc/gamec/cl_player.c deleted file mode 100644 index 32b01f3be..000000000 --- a/qcsrc/gamec/cl_player.c +++ /dev/null @@ -1,334 +0,0 @@ -$frame die1 die2 draw duck duckwalk duckjump duckidle idle -$frame jump pain1 pain2 shoot taunt run runbackwards -$frame strafeleft straferight dead1 dead2 forwardright -$frame forwardleft backright backleft - -// changes by LordHavoc on 03/29/04 and 03/30/04 at Vermeulen's request -// merged player_run and player_stand to player_anim -// added death animations to player_anim -// can now spawn thrown weapons from anywhere, not just from players -// thrown weapons now fade out after 20 seconds -// created PlayerGib function -// PlayerDie no longer uses hitloc or damage -// PlayerDie now supports dying animations as well as gibbing -// cleaned up PlayerDie a lot -// added CopyBody - -.entity pusher; -.float pushltime; - -void CopyBody(float keepvelocity) -{ - local entity oldself; - if (self.effects & EF_NODRAW) - return; - oldself = self; - self = spawn(); - self.iscreature = oldself.iscreature; - self.angles = oldself.angles; - self.avelocity = oldself.avelocity; - self.classname = "body"; - self.damageforcescale = oldself.damageforcescale; - self.effects = oldself.effects; - self.event_damage = oldself.event_damage; - self.frame = oldself.frame; - self.health = oldself.health; - self.armorvalue = oldself.armorvalue; - self.armortype = oldself.armortype; - self.model = oldself.model; - self.modelindex = oldself.modelindex; - self.movetype = oldself.movetype; - self.nextthink = oldself.nextthink; - self.skin = oldself.skin; - self.solid = oldself.solid; - self.takedamage = oldself.takedamage; - self.think = oldself.think; - if (keepvelocity == 1) - self.velocity = oldself.velocity; - self.oldvelocity = self.velocity; - self.fade_time = oldself.fade_time; - self.fade_rate = oldself.fade_rate; - //self.weapon = oldself.weapon; - setorigin(self, oldself.origin); - setsize(self, oldself.mins, oldself.maxs);//'-16 -16 -24', '16 16 5'); - self.oldorigin = oldself.origin; - self = oldself; -} - -void player_anim (void) -{ - if (self.deadflag != DEAD_NO) - { - if (time > self.dead_time) - { - if (self.maxs_z > 5) - setsize(self, '-16 -16 -24', '16 16 5'); - self.frame = self.dead_frame; - } - else - self.frame = self.die_frame; - return; - } - - - if (self.crouch) - { - if (self.movement_x * self.movement_x + self.movement_y * self.movement_y > 20) - self.frame = $duckwalk; - else - self.frame = $duckidle; - } - else if ((self.movement_x * self.movement_x + self.movement_y * self.movement_y) > 20) - { - if (self.movement_x > 0 && self.movement_y == 0) - self.frame = $run; - else if (self.movement_x < 0 && self.movement_y == 0) - self.frame = $runbackwards; - else if (self.movement_x == 0 && self.movement_y > 0) - self.frame = $straferight; - else if (self.movement_x == 0 && self.movement_y < 0) - self.frame = $strafeleft; - else if (self.movement_x > 0 && self.movement_y > 0) - self.frame = $forwardright; - else if (self.movement_x > 0 && self.movement_y < 0) - self.frame = $forwardleft; - else if (self.movement_x < 0 && self.movement_y > 0) - self.frame = $backright; - else if (self.movement_x < 0 && self.movement_y < 0) - self.frame = $backleft; - else - self.frame = $run; - } - else if (self.pain_finished > time) - self.frame = self.pain_frame; - else if (self.attack_finished > time) - self.frame = $shoot; - else - self.frame = $idle; - - if (!(self.flags & FL_ONGROUND)) - self.frame = $jump; -} -//End change by Supajoe on 11:44 PM EST 11/16/03 (Subject: Player animations) - -void SpawnThrownWeapon (vector org, float w) -{ - local entity oldself; - - if (!cvar("g_pickup_items")) - return; - if (w == IT_LASER) - return; - - oldself = self; - self = spawn(); - // this will cause it to be removed later - self.classname = "droppedweapon"; - - setorigin(self, org); - self.velocity = randomvec() * 100 + '0 0 200'; - SUB_SetFade(self, time + 20, 1); - - if (w == WEP_UZI) - weapon_uzi (); - else if (w == WEP_SHOTGUN) - weapon_shotgun (); - else if (w == WEP_GRENADE_LAUNCHER) - weapon_grenadelauncher (); - else if (w == WEP_ELECTRO) - weapon_electro (); - else if (w == WEP_CRYLINK) - weapon_crylink (); - else if (w == WEP_NEX) - weapon_nex (); - else if (w == WEP_HAGAR) - weapon_hagar (); - else if (w == WEP_ROCKET_LAUNCHER) - weapon_rocketlauncher (); - - // making absolutely sure... - self.classname = "droppedweapon"; - - self = oldself; -} - -void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) -{ - local float take, save; - te_blood (hitloc, force, damage); - // damage resistance (ignore most of the damage from a bullet or similar) - damage = max(damage - 5, 1); - - save = bound(0, damage * cvar("g_balance_armor_blockpercent"), self.armorvalue); - take = bound(0, damage - save, damage); - - if (save > 10) - sound (self, CHAN_IMPACT, "misc/armorimpact.wav", 1, ATTN_NORM); - else if (take > 30) - sound (self, CHAN_IMPACT, "misc/bodyimpact2.wav", 1, ATTN_NORM); - else if (take > 10) - sound (self, CHAN_IMPACT, "misc/bodyimpact1.wav", 1, ATTN_NORM); - - if (take > 50) - TossGib (world, "models/gibs/chunk.mdl", hitloc, force * -0.1,1); - if (take > 100) - TossGib (world, "models/gibs/chunk.mdl", hitloc, force * -0.2,1); - - if (!(self.flags & FL_GODMODE)) - { - self.armorvalue = self.armorvalue - save; - self.health = self.health - take; - // pause regeneration for 5 seconds - self.pauseregen_finished = max(self.pauseregen_finished, time + 5); - } - self.dmg_save = self.dmg_save + save;//max(save - 10, 0); - self.dmg_take = self.dmg_take + take;//max(take - 10, 0); - self.dmg_inflictor = inflictor; - - if (self.health <= -50) - { - // don't use any animations as a gib - self.frame = 0; - self.dead_frame = 0; - self.die_frame = 0; - // view just above the floor - self.view_ofs = '0 0 4'; - - // make a juicy mess - te_bloodshower (self.origin + self.mins, self.origin + self.maxs, 800, 1000); - te_bloodshower (self.origin + self.mins, self.origin + self.maxs, 400, 1000); - - // make a meaty mess - TossGib (self, "models/gibs/eye.md3", self.origin, self.velocity,0); - TossGib (world, "models/gibs/bloodyskull.md3", self.origin, '0 0 600',0); - - TossGib (world, "models/gibs/gib1.md3", self.origin, self.velocity,0); - TossGib (world, "models/gibs/gib2.md3", self.origin, self.velocity,0); - TossGib (world, "models/gibs/gib3.md3", self.origin, self.velocity,0); - TossGib (world, "models/gibs/gib4.md3", self.origin, self.velocity,0); - - // these destory on impact - TossGib (world, "models/gibs/gib5.md3", self.origin, '-500 0 450',1); - TossGib (world, "models/gibs/gib6.md3", self.origin, '0 500 450',1); - TossGib (world, "models/gibs/chunk.mdl", self.origin, '0 -500 450',1); - TossGib (world, "models/gibs/chunk.mdl", self.origin, '500 0 450',1); - TossGib (world, "models/gibs/chunk.mdl", self.origin, self.velocity,1); - TossGib (world, "models/gibs/chunk.mdl", self.origin, '0 0 450',1); - - sound (trace_ent, CHAN_VOICE, "misc/gib.wav", 1, ATTN_NORM); - } -} - -void DropAllRunes(entity pl); - - -void PlayerDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) -{ - local float take, save; - - te_blood (hitloc, force, damage); - if (self.pain_finished < time) //Don't switch pain sequences like crazy - { - if (random() > 0.5) - self.pain_frame = $pain1; - else - self.pain_frame = $pain2; - self.pain_finished = time + 0.5; //Supajoe - } - - save = bound(0, damage * cvar("g_balance_armor_blockpercent"), self.armorvalue); - take = bound(0, damage - save, damage); - - if (save > 10) - sound (self, CHAN_IMPACT, "misc/armorimpact.wav", 1, ATTN_NORM); - else if (take > 30) - sound (self, CHAN_IMPACT, "misc/bodyimpact2.wav", 1, ATTN_NORM); - else if (take > 10) - sound (self, CHAN_IMPACT, "misc/bodyimpact1.wav", 1, ATTN_NORM); - - if (take > 50) - TossGib (world, "models/gibs/chunk.mdl", hitloc, force * -0.1,1); - if (take > 100) - TossGib (world, "models/gibs/chunk.mdl", hitloc, force * -0.2,1); - - if (!(self.flags & FL_GODMODE)) - { - self.armorvalue = self.armorvalue - save; - self.health = self.health - take; - // pause regeneration for 5 seconds - self.pauseregen_finished = max(self.pauseregen_finished, time + 5); - } - self.dmg_save = self.dmg_save + save;//max(save - 10, 0); - self.dmg_take = self.dmg_take + take;//max(take - 10, 0); - self.dmg_inflictor = inflictor; - - if(attacker == self) - { - // don't reset pushltime for self damage as it may be an attempt to - // escape a lava pit or similar - //self.pushltime = 0; - } - else if(attacker.classname == "player" || attacker.classname == "gib") - { - self.pusher = attacker; - self.pushltime = time + cvar("g_maxpushtime"); - } - else if(time < self.pushltime) - { - attacker = self.pusher; - self.pushltime = max(self.pushltime, time + 0.6); - } - else - self.pushltime = 0; - - if (self.health <= 2) - { - DropAllRunes(self); - - // throw a weapon - SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.weapon); - // print an obituary message - Obituary (attacker, self, deathtype); - // make the corpse upright (not tilted) - self.angles_x = 0; - self.angles_z = 0; - // don't spin - self.avelocity = '0 0 0'; - // no weapon when dead - self.weaponmodel = ""; - w_clear(); - // view from the floor - self.view_ofs = '0 0 -8'; - // toss the corpse - self.movetype = MOVETYPE_TOSS; - // shootable corpse - self.solid = SOLID_CORPSE; - // don't stick to the floor - self.flags = self.flags - (self.flags & FL_ONGROUND); - // dying animation - self.deadflag = DEAD_DYING; - // when to allow respawn - self.death_time = time + 0.5; - // when to switch to the dead_frame - self.dead_time = time + 2; - if (random() < 0.5) - { - self.die_frame = $die1; - self.dead_frame = $dead1; - } - else - { - self.die_frame = $die2; - self.dead_frame = $dead2; - } - // start the animation - player_anim(); - // set damage function to corpse damage - self.event_damage = PlayerCorpseDamage; - // call the corpse damage function just in case it wants to gib - self.event_damage(inflictor, attacker, 0, deathtype, hitloc, force); - // set up to fade out later - SUB_SetFade (self, time + 12 + random () * 4, 1); - } -} - diff --git a/qcsrc/gamec/cl_weaponanimations.c b/qcsrc/gamec/cl_weaponanimations.c deleted file mode 100644 index 0e5898b42..000000000 --- a/qcsrc/gamec/cl_weaponanimations.c +++ /dev/null @@ -1,25 +0,0 @@ -$frame fire fire2 idle run - -// VorteX: static frame globals -float WFRAME_FIRE1 = 0; -float WFRAME_FIRE2 = 1; -float WFRAME_IDLE = 2; -float WFRAME_RUN = 3; - -// changes by LordHavoc on 03/30/04 -// cleaned up code formatting a bit -// renamed to weapon_anim -void weapon_anim () -{ - if (self.attack_finished > time) - self.weaponframe = $fire; - else if (self.movement_x || self.movement_y) - self.weaponframe = $run; - else - self.weaponframe = $idle; -} -void weapon_freeze () -{ - if (self.weaponentity) - self.weaponentity.frame = WFRAME_IDLE; -} \ No newline at end of file diff --git a/qcsrc/gamec/cl_weapons.c b/qcsrc/gamec/cl_weapons.c deleted file mode 100644 index b6b2c9875..000000000 --- a/qcsrc/gamec/cl_weapons.c +++ /dev/null @@ -1,202 +0,0 @@ -// generic weapons table -// add new weapons here -void(float wpn, float wrequest) weapon_action = -{ - if (wpn == WEP_LASER) - w_laser(wrequest); - else if (wpn == WEP_SHOTGUN) - w_shotgun(wrequest); - else if (wpn == WEP_UZI) - w_uzi(wrequest); - else if (wpn == WEP_GRENADE_LAUNCHER) - w_glauncher(wrequest); - else if (wpn == WEP_ELECTRO) - w_electro(wrequest); - else if (wpn == WEP_CRYLINK) - w_crylink(wrequest); - else if (wpn == WEP_NEX) - w_nex(wrequest); - else if (wpn == WEP_HAGAR) - w_hagar(wrequest); - else if (wpn == WEP_ROCKET_LAUNCHER) - w_rlauncher(wrequest); -}; - -// switch between weapons -void(float imp) W_SwitchWeapon -{ - weapon_hasammo = TRUE; - if (!client_hasweapon(self, imp, TRUE)) - { - if (!weapon_hasammo) - sprint(self, "You don't have any ammo for that weapon\n"); - else - sprint(self, "You don't own that weapon\n"); - } - else - self.switchweapon = imp; -}; - -// next weapon -void() W_NextWeapon = -{ - local float weaponwant; - - weaponwant = self.switchweapon + 1; - if (weaponwant < WEP_FIRST) - weaponwant = WEP_LAST; - if (weaponwant > WEP_LAST) - weaponwant = WEP_FIRST; - weapon_hasammo = TRUE; - while(!client_hasweapon(self, weaponwant, TRUE)) - { - weaponwant = weaponwant + 1; - if (weaponwant < WEP_FIRST) - weaponwant = WEP_LAST; - if (weaponwant > WEP_LAST) - weaponwant = WEP_FIRST; - } - self.switchweapon = weaponwant; -}; - -// prev weapon -void() W_PreviousWeapon = -{ - local float weaponwant; - - weaponwant = self.switchweapon - 1; - if (weaponwant < WEP_FIRST) - weaponwant = WEP_LAST; - if (weaponwant > WEP_LAST) - weaponwant = WEP_FIRST; - weapon_hasammo = TRUE; - while(!client_hasweapon(self, weaponwant, TRUE)) - { - weaponwant = weaponwant - 1; - if (weaponwant < WEP_FIRST) - weaponwant = WEP_LAST; - if (weaponwant > WEP_LAST) - weaponwant = WEP_FIRST; - } - self.switchweapon = weaponwant; -}; - -// Bringed back weapon frame -void() W_WeaponFrame = -{ - if (!self.weaponentity || self.health <= 0) - return; // Dead player can't use weapons and injure impulse commands - - if (cvar("g_antilag")) - { - // if aiming at a player and the original trace won't hit that player - // anymore, try aiming at the player's new position - if (self.cursor_trace_ent) - { - if (self.cursor_trace_ent.takedamage) - { - traceline(self.origin + self.view_ofs, self.cursor_trace_endpos, FALSE, self); - if (trace_ent != self.cursor_trace_ent) - { - traceline(self.origin + self.view_ofs, self.cursor_trace_ent.origin + (self.cursor_trace_ent.mins + self.cursor_trace_ent.maxs) * 0.5, FALSE, self); - if (trace_ent == self.cursor_trace_ent) - self.cursor_trace_endpos = trace_endpos; - } - } - } - self.v_angle = vectoangles(self.cursor_trace_endpos - (self.origin + self.view_ofs)); - self.v_angle_x = 0 - self.v_angle_x; - } - - makevectors(self.v_angle); - - // Change weapon - if (self.weapon != self.switchweapon) - { - if (self.weaponentity.state == WS_CLEAR) - { - self.weaponentity.state = WS_RAISE; - weapon_action(self.switchweapon, WR_SETUP); - // VorteX: add player model weapon select frame here - // setcustomframe(PlayerWeaponRaise); - weapon_action(self.weapon, WR_UPDATECOUNTS); - weapon_action(self.weapon, WR_RAISE); - } - else if (self.weaponentity.state == WS_READY) - { - sound (self, CHAN_WEAPON, "weapons/weapon_switch.wav", 1, ATTN_NORM); - self.weaponentity.state = WS_DROP; - // VorteX: add player model weapon deselect frame here - // setcustomframe(PlayerWeaponDrop); - weapon_action(self.weapon, WR_DROP); - } - } - - if (self.button0) - weapon_action(self.weapon, WR_FIRE1); - if (self.button3) - weapon_action(self.weapon, WR_FIRE2); - - // do weapon think - if (time >= self.weapon_nextthink) - if (self.weapon_nextthink > 0) - self.weapon_think(); - - // weapon bobbing and script actions - local float bobintensity, q1pitching, framespeed, diff; - local vector vel, realorg, layer1, boblayer; - - bobintensity = cvar("g_viewweapon_bobintensity"); // weapon bob intensity - q1pitching = fabs(cvar("g_viewweapon_q1pitching")); // q1 style of "bob" when looking up and down - - realorg = self.weaponentity.origin + self.weaponentity.view_ofs; - realorg = realorg - self.weaponentity.finaldest; // finaldest is last bob position - - // VorteX: actually this is needed for weapon screen offset - if (q1pitching) - { - self.weaponentity.view_ofs_x = q1pitching*bound(-5.5, self.v_angle_x/45, 5.5); - self.weaponentity.view_ofs_z = q1pitching*bound(-1.5, self.v_angle_x/60, 1.5); - } - - // weapon origin interpolation, layer 1 - if (realorg != self.weaponentity.pos1) - { - framespeed = frametime*self.weaponentity.lip*10; // lip is speed of origin changing (of layer1) - diff = vlen(realorg - self.weaponentity.pos1); - // VorteX: add speed modifier (haste)? - layer1 = frametime*10*self.weaponentity.lip*normalize(self.weaponentity.pos1 - realorg); - if (diff <= vlen(layer1)) - layer1 = normalize(self.weaponentity.pos1 - realorg)*diff; - } - - // weapon bobbing (q3-style) - if (self.flags & FL_ONGROUND && self.waterlevel < 2) - { - // VorteX: only xy velocity matters - vel_x = self.velocity_x; - vel_y = self.velocity_y; - framespeed = vlen(vel); - // Y axis - diff = bobintensity*framespeed/300; - self.weaponentity.destvec_y = self.weaponentity.destvec_y + frametime*10; - boblayer_y = diff*cos(self.weaponentity.destvec_y + 90); - // Z axis - diff = bobintensity*framespeed/540; - self.weaponentity.destvec_z = self.weaponentity.destvec_z + frametime*20; - boblayer_z = diff*cos(self.weaponentity.destvec_z); - self.weaponentity.finaldest = boblayer; - } - else if (self.waterlevel > 0) - {// swim, all velocity matters - // X axis - framespeed = vlen(self.velocity); - diff = bobintensity*framespeed/100; - self.weaponentity.destvec_x = self.weaponentity.destvec_x + frametime*6; - boblayer_x = diff*cos(self.weaponentity.destvec_x); - self.weaponentity.finaldest = boblayer; - } - else - self.weaponentity.finaldest = '0 0 0'; - self.weaponentity.origin = realorg + boblayer + layer1 - self.weaponentity.view_ofs; -}; \ No newline at end of file diff --git a/qcsrc/gamec/cl_weaponsystem.c b/qcsrc/gamec/cl_weaponsystem.c deleted file mode 100644 index ade939f41..000000000 --- a/qcsrc/gamec/cl_weaponsystem.c +++ /dev/null @@ -1,282 +0,0 @@ -/* -=========================================================================== - - CLIENT WEAPONSYSTEM CODE - Bring back W_Weaponframe - -=========================================================================== -*/ - -void() CL_Weaponentity_Think = -{ - self.nextthink = time; - if (self.owner.weaponentity != self) - { - remove(self); - return; - } - self.effects = self.owner.effects; - self.alpha = self.owner.alpha; -}; - -void() CL_ExteriorWeaponentity_Think = -{ - self.nextthink = time; - if (self.owner.exteriorweaponentity != self) - { - remove(self); - return; - } - if (self.cnt != self.owner.weaponentity.modelindex || self.dmg != self.owner.modelindex || self.deadflag != self.owner.deadflag) - { - self.cnt = self.owner.weaponentity.modelindex; - self.dmg = self.owner.modelindex; - self.deadflag = self.owner.deadflag; - if (self.owner.deadflag) self.model = ""; - else if (self.owner.weapon == WEP_LASER) setmodel(self, "models/weapons/v_laser.md3"); - else if (self.owner.weapon == WEP_SHOTGUN) setmodel(self, "models/weapons/v_shotgun.md3"); - else if (self.owner.weapon == WEP_UZI) setmodel(self, "models/weapons/v_uzi.md3"); - else if (self.owner.weapon == WEP_GRENADE_LAUNCHER) setmodel(self, "models/weapons/v_gl.md3"); - else if (self.owner.weapon == WEP_ELECTRO) setmodel(self, "models/weapons/v_electro.md3"); - else if (self.owner.weapon == WEP_CRYLINK) setmodel(self, "models/weapons/v_crylink.md3"); - else if (self.owner.weapon == WEP_NEX) setmodel(self, "models/weapons/v_nex.md3"); - else if (self.owner.weapon == WEP_HAGAR) setmodel(self, "models/weapons/v_hagar.md3"); - else if (self.owner.weapon == WEP_ROCKET_LAUNCHER) setmodel(self, "models/weapons/v_rl.md3"); - setattachment(self, self.owner, "bip01 r hand"); - // if that didn't find a tag, hide the exterior weapon model - if (!self.tag_index) - self.model = ""; - } - self.effects = self.owner.weaponentity.effects; -}; - -// spawning weaponentity for client -void() CL_SpawnWeaponentity = -{ - if (self.weaponentity) - { - w_clear(); - return; - } - self.weaponentity = spawn(); - self.weaponentity.solid = SOLID_NOT; - self.weaponentity.owner = self; - self.weaponentity.weaponentity = self.weaponentity; - setmodel(self.weaponentity, ""); - self.weaponentity.origin = '0 0 0'; - self.weaponentity.angles = '0 0 0'; - self.weaponentity.viewmodelforclient = self; - self.weaponentity.flags = 0; - self.weaponentity.think = CL_Weaponentity_Think; - self.weaponentity.nextthink = time; - - self.exteriorweaponentity = spawn(); - self.exteriorweaponentity.solid = SOLID_NOT; - self.exteriorweaponentity.exteriorweaponentity = self.exteriorweaponentity; - self.exteriorweaponentity.owner = self; - self.exteriorweaponentity.origin = '0 0 0'; - self.exteriorweaponentity.angles = '0 0 0'; - self.exteriorweaponentity.think = CL_ExteriorWeaponentity_Think; - self.exteriorweaponentity.nextthink = time; -}; - -// convertion from index (= impulse) to flag in .items -float(float index) weapon_translateindextoflag = -{ - if (index == WEP_LASER) - return IT_LASER; - else if (index == WEP_SHOTGUN) - return IT_SHOTGUN; - else if (index == WEP_UZI) - return IT_UZI; - else if (index == WEP_GRENADE_LAUNCHER) - return IT_GRENADE_LAUNCHER; - else if (index == WEP_ELECTRO) - return IT_ELECTRO; - else if (index == WEP_CRYLINK) - return IT_CRYLINK; - else if (index == WEP_NEX) - return IT_NEX; - else if (index == WEP_HAGAR) - return IT_HAGAR; - else if (index == WEP_ROCKET_LAUNCHER) - return IT_ROCKET_LAUNCHER; - return IT_LASER; -}; - -float(entity cl, float wpn, float andammo) client_hasweapon = -{ - local float itemcode; - local entity oldself; - - weapon_hasammo = TRUE; - if (wpn < WEP_FIRST || wpn > WEP_LAST) - return FALSE; - itemcode = weapon_translateindextoflag(wpn); - if (cl.items & itemcode) - { - if (andammo) - { - oldself = self; - self = cl; - weapon_action(wpn, WR_CHECKAMMO); - self = oldself; - if (weapon_hasammo) - return TRUE; - return FALSE; - } - return TRUE; - } - return FALSE; -}; - -// Weapon subs -void() w_clear = -{ - weapon_action(self.weapon, WR_CLEAR); - if (self.weapon != -1) - self.weapon = 0; - if (self.weaponentity) - { - self.weaponentity.state = WS_CLEAR; - setmodel(self.weaponentity, ""); - self.weaponentity.effects = 0; - } -}; - -void() w_ready = -{ - self.weaponentity.state = WS_READY; - weapon_action(self.weapon, WR_IDLE); -}; - -// FIXME: add qw-style client-custom weaponrating (cl_weaponrating)? -float(entity e) w_getbestweapon -{// add new weapons here - if (client_hasweapon(e, WEP_ROCKET_LAUNCHER, TRUE)) - return WEP_ROCKET_LAUNCHER; - else if (client_hasweapon(e, WEP_NEX, TRUE)) - return WEP_NEX; - else if (client_hasweapon(e, WEP_HAGAR, TRUE)) - return WEP_HAGAR; - else if (client_hasweapon(e, WEP_GRENADE_LAUNCHER, TRUE)) - return WEP_GRENADE_LAUNCHER; - else if (client_hasweapon(e, WEP_ELECTRO, TRUE)) - return WEP_ELECTRO; - else if (client_hasweapon(e, WEP_CRYLINK, TRUE)) - return WEP_CRYLINK; - else if (client_hasweapon(e, WEP_UZI, TRUE)) - return WEP_UZI; - else if (client_hasweapon(e, WEP_SHOTGUN, TRUE)) - return WEP_SHOTGUN; - else - { - weapon_hasammo = TRUE; - return WEP_LASER; - } -}; - -// Setup weapon for client (after this raise frame will be launched) -void(float windex, string wmodel, float hudammo) weapon_setup = -{ - local string weaponmdl; - - self.items = self.items - (self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS)); - self.items = self.items | hudammo; - - self.weapon = windex; - - if (wmodel != "") - { - weaponmdl = strzone(strcat("models/weapons/", wmodel)); - setmodel(self.weaponentity, weaponmdl); - } - // VorteX: update visible weapon - // CL_ViswepUpdate(); -}; - -// shot direction -float WEAPON_MAXRELX = 14; // if more, shot can be spawned after wall surface (in empty worldspace) or inside other entity if client stands close to it -void(float x, float y, float z) weapon_shotdir = -{ - makevectors(self.v_angle); - self.shotorg = self.origin + self.view_ofs + v_forward*bound(0, x, WEAPON_MAXRELX) + v_right*(y + self.weaponentity.view_ofs_y) + v_up*z; - self.shotdir = aim(self, 1000); -}; - -// perform weapon to attack (weaponstate and attack_finished check is here) -void(float() checkfunc1, float() checkfunc2, void() firefunc, float atktime) weapon_prepareattack = -{ - if (!checkfunc1()) - { - if (!checkfunc2()) - self.switchweapon = w_getbestweapon(self); - return; - } - // Don't do shot if previos attack not finished - if (time < self.attack_finished) - return; - // Can't do shot if changing weapon - if (self.weaponentity.state != WS_READY) - return; - - self.attack_finished = time + atktime; - firefunc(); -}; - -// perform weapon attack -void(float() checkfunc1, float() checkfunc2, void() firefunc) weapon_doattack -{ - if (!checkfunc1()) - { - if (!checkfunc2()) - self.switchweapon = w_getbestweapon(self); - return; - } - self.weaponentity.state = WS_INUSE; - firefunc(); - weapon_action(self.weapon, WR_UPDATECOUNTS); // update ammo now -}; - -void(entity ent, float recoil) weapon_recoil = -{ - ent.punchangle = (randomvec() + '-1 0 0')*recoil; - ent.punchangle_z = 0; // don't want roll - if (recoil > 3) // push back if large recoil - ent.velocity = ent.velocity - normalize(ent.shotdir)*recoil*25; -}; - -void(float fr, float t, void() func) weapon_thinkf = -{ - if (fr >= 0) - { - if (self.weaponentity != world) - self.weaponentity.frame = fr; - } - - if(cvar("g_runematch")) - { - if(self.runes & RUNE_SPEED) - { - if(self.runes & CURSE_SLOW) - t = t * cvar("g_balance_rune_speed_combo_atkrate"); - else - t = t * cvar("g_balance_rune_speed_atkrate"); - } - else if(self.runes & CURSE_SLOW) - { - t = t * cvar("g_balance_curse_slow_atkrate"); - } - } - - // VorteX: haste can be added here - self.weapon_nextthink = time + t; - self.weapon_think = func; -}; - -void(float spd, vector org) weapon_boblayer1 = -{ - // VorteX: haste can be added here - self.weaponentity.pos1 =org; - self.weaponentity.lip = spd; -}; diff --git a/qcsrc/gamec/clientcommands.c b/qcsrc/gamec/clientcommands.c deleted file mode 100644 index a3e63731b..000000000 --- a/qcsrc/gamec/clientcommands.c +++ /dev/null @@ -1,224 +0,0 @@ -void SV_ParseClientCommand(string s) { - local float index; - - tokenize(s); - - if(argv(0) == "clogin") { - if(cvar("sv_clientcommands")) { - if(self.adminstatus < -5) { - sprint(self, "Too many unsuccessful tries.\n"); - } else if(argv(1) == cvar_string("sv_clientcommands_password")) { - self.adminstatus = 1; - sprint(self, "You now have remote admin status.\n"); - } else { - sprint(self, "Wrong password.\n"); - // use of -- produces compiler warning in the if() line??? - self.adminstatus = self.adminstatus - 1; - if(self.adminstatus == 0) - sprint(self, "You lost remote admin status.\n"); - } - } else { - sprint(self, "Clientside commands NOT allowed.\n"); - } - } else if(argv(0) == "ccmd") { - if(cvar("sv_clientcommands")) { - if(self.adminstatus > 0) { - local string command; - command = argv(1); - index = 2; - while(argv(index) != "") { - command = strcat(command, " ", argv(index)); - index++; - } - localcmd(command); - } else - sprint(self, "You don't have remote admin status.\n"); - } else { - sprint(self, "Clientside commands NOT allowed.\n"); - } - } else if(argv(0) == "vote") { - if(argv(1) == "help") { - sprint(self, "^1You can use voting with \"^2cmd vote help^1\" \"^2cmd vote status^1\" \"^2cmd vote call ^3COMMAND ARGUMENTS^1\" \"^2cmd vote stop^1\" \"^2cmd vote yes^1\" \"^2cmd vote no^1\".\n"); - sprint(self, "^1Or if your version is up to date you can use these aliases \"^2vhelp^1\" \"^2vstatus^1\" \"^2vcall ^3COMMAND ARGUMENTS^1\" \"^2vstop^1\" \"^2vyes^1\" \"^2vno^1\".\n"); - sprint(self, "^1\"^2help^1\" shows this info.\n"); - sprint(self, "^1\"^2status^1\" shows if there is a vote called and who called it.\n"); - sprint(self, "^1\"^2call^1\" is used to call a vote. See the list of allowed commands.\n"); - sprint(self, "^1If more then 50% of the players vote yes the vote is executed.\n"); - sprint(self, "^1If more then 50% of the players vote no the vote fails.\n"); - sprint(self, "^1\"^2stop^1\" can be used by the vote caller to stop a vote and maybe correct it.\n"); - sprint(self, "^1\"^2yes^1\" and \"^2no^1\" to make your vote.\n"); - sprint(self, "^1You can call a vote with these commands:\n"); - sprint(self, strcat("^1\"^2vcall^1\" ^3", cvar_string("sv_vote_allowed"), "^1 and further ^3arguments^1\n")); - } else if(argv(1) == "status") { - if(votecalled == "") { - sprint(self, "^1No vote called.\n"); - } else { - sprint(self, strcat("^7Vote for \"^1", votecalled, "^7\" called by \"", votecaller.netname, "^7\".\n")); - } - } else if(argv(1) == "call") { - if(votecalled == "") { - local string vote; - vote = argv(2); - index = 3; - while(argv(index) != "") { - vote = strcat(vote, " ", argv(index)); - index++; - } - - // necessary for some of the string operations - vote = strzone(vote); - - // now we remove some things that could be misused - index = 0; - local float found; - found = FALSE; - local float votelength; - votelength = strlen(vote); - while(!found && index < votelength) - { - local string badchar; - badchar = substring(vote, index, 1); - if(badchar == ";" - || badchar == "\n") - { - found = TRUE; - } else { - index++; - } - } - vote = substring(vote, 0, index); - - if(vote == "") { - sprint(self, "^1You have to vote for something.\n"); - } else if(time < self.vote_next) { - sprint(self, strcat("^1You have to wait ^2", ftos(self.vote_next - time), "^1 seconds before you can again call a vote.\n")); - } else if(VoteAllowed(strcat(argv(2)))) { // strcat seems to be necessary - votecalled = strzone(vote); - votecaller = self; // remember who called the vote - self.vote_vote = 1; // of course you vote yes - self.vote_finished = time + cvar("sv_vote_timeout"); - self.vote_next = time + cvar("sv_vote_wait"); - bprint(strcat("^3Vote for \"^1", votecalled, "^3\" called by \"", self.netname, "^3\".\n")); - VoteCount(); // needed if you are the only one - } else { - sprint(self, "^1This vote is not ok. See help for more info.\n"); - } - } else { - sprint(self, "^1There is already a vote called.\n"); - } - } else if(argv(1) == "stop") { - if(votecalled == "") { - sprint(self, "^1No vote called.\n"); - } else if(votecaller == self - || self.adminstatus > 0) { // the votecaller and admins can stop a vote - if(votecaller == self) { - // disable next votetimer so you can correct your vote - self.vote_next = 0; - } - VoteTimeout(votecaller); - } else { - sprint(self, "^1You are not allowed to stop that Vote.\n"); - } - } else if(argv(1) == "yes") { - if(votecalled == "") { - sprint(self, "^1No vote called.\n"); - } else if(self.vote_vote == 0 - || cvar("sv_vote_change")) { - self.vote_vote = 1; - if(!cvar("sv_vote_singlecount")) { - VoteCount(); - } - } else { - sprint(self, "^1You have already voted.\n"); - } - } else if(argv(1) == "no") { - if(votecalled == "") { - sprint(self, "^1No vote called.\n"); - } else if(self.vote_vote == 0 - || cvar("sv_vote_change")) { - self.vote_vote = -1; - if(!cvar("sv_vote_singlecount")) { - VoteCount(); - } - } else { - sprint(self, "^1You have already voted.\n"); - } - } else { - // ignore this? - sprint(self, "^1Unknown vote command.\n"); - } - } else { - clientcommand(self,s); - } -} - -float VoteAllowed(string votecommand) { - tokenize(cvar_string("sv_vote_allowed")); - local float index; - index = 0; - while(argv(index) != "") { - local string allowed; - allowed = argv(index); - if(votecommand == allowed) { - return TRUE; - } - index++; - } - return FALSE; -} - -void VoteCount() { - local float playercount; - playercount = 0; - local float yescount; - yescount = 0; - local float nocount; - nocount = 0; - local entity player; - local entity voter; - player = find(player, classname, "player"); - while(player) - { - if(player.vote_vote < 0) { - nocount++; - } else if(player.vote_vote > 0) { - yescount++; - } - - if(self.vote_finished > 0) { - voter = player; - } - - playercount++; - player = find(player, classname, "player"); - } - - if((playercount / 2) < yescount) { // vote passed - VoteDo(voter); - } else if((playercount / 2) < nocount) { // vote rejected - VoteTimeout(voter); - } // else still running -} - -void VoteDo(entity voter) { - bprint(strcat("^2The vote for \"^1", votecalled, "^2\" from \"", voter.netname, "^2\" DID PASS.\n")); - localcmd(votecalled); - VoteReset(); -} - -void VoteTimeout(entity voter) { - bprint(strcat("^5The vote for \"^1", votecalled, "^5\" from \"", voter.netname, "^5\" did NOT pass.\n")); - VoteReset(); -} - -void VoteReset() { - local entity player; - player = find(player, classname, "player"); - while(player) - { - player.vote_vote = 0; - player.vote_finished = 0; - player = find(player, classname, "player"); - } - votecalled = ""; -} diff --git a/qcsrc/gamec/constants.h b/qcsrc/gamec/constants.h deleted file mode 100644 index c03994017..000000000 --- a/qcsrc/gamec/constants.h +++ /dev/null @@ -1,189 +0,0 @@ - -float FALSE = 0; -float TRUE = 1; - -float FL_FLY = 1; -float FL_SWIM = 2; -float FL_CLIENT = 8; -float FL_INWATER = 16; -float FL_MONSTER = 32; -float FL_GODMODE = 64; -float FL_NOTARGET = 128; -float FL_ITEM = 256; -float FL_ONGROUND = 512; -float FL_PARTIALGROUND = 1024; -float FL_WATERJUMP = 2048; -float FL_JUMPRELEASED = 4096; -float FL_WEAPON = 8192; -float FL_POWERUP = 16384; - -float MOVETYPE_NONE = 0; -float MOVETYPE_ANGLENOCLIP = 1; -float MOVETYPE_ANGLECLIP = 2; -float MOVETYPE_WALK = 3; -float MOVETYPE_STEP = 4; -float MOVETYPE_FLY = 5; -float MOVETYPE_TOSS = 6; -float MOVETYPE_PUSH = 7; -float MOVETYPE_NOCLIP = 8; -float MOVETYPE_FLYMISSILE = 9; -float MOVETYPE_BOUNCE = 10; -//float MOVETYPE_BOUNCEMISSILE = 11; // Like bounce but doesn't lose speed on bouncing -//float MOVETYPE_FOLLOW = 12; // 'Attaches' the entity to its aim_ent - -float SOLID_NOT = 0; -float SOLID_TRIGGER = 1; -float SOLID_BBOX = 2; -float SOLID_SLIDEBOX = 3; -float SOLID_BSP = 4; -//float SOLID_CORPSE = 5; // Unobstructed by CORPSE or SLIDEBOX - -float DEAD_NO = 0; -float DEAD_DYING = 1; -float DEAD_DEAD = 2; -float DEAD_RESPAWNABLE = 3; - -float DAMAGE_NO = 0; -float DAMAGE_YES = 1; -float DAMAGE_AIM = 2; - -float CONTENT_EMPTY = -1; -float CONTENT_SOLID = -2; -float CONTENT_WATER = -3; -float CONTENT_SLIME = -4; -float CONTENT_LAVA = -5; -float CONTENT_SKY = -6; - -float SVC_BAD = 0; -float SVC_NOP = 1; -float SVC_DISCONNECT = 2; -float SVC_UPDATESTAT = 3; -float SVC_VERSION = 4; -float SVC_SETVIEW = 5; -float SVC_SOUND = 6; -float SVC_TIME = 7; -float SVC_PRINT = 8; -float SVC_STUFFTEXT = 9; -float SVC_SETANGLE = 10; -float SVC_SERVERINFO = 11; -float SVC_LIGHTSTYLE = 12; -float SVC_UPDATENAME = 13; -float SVC_UPDATEFRAGS = 14; -float SVC_CLIENTDATA = 15; -float SVC_STOPSOUND = 16; -float SVC_UPDATECOLORS = 17; -float SVC_PARTICLE = 18; -float SVC_DAMAGE = 19; -float SVC_SPAWNSTATIC = 20; -float SVC_SPAWNBINARY = 21; -float SVC_SPAWNBASELINE = 22; -float SVC_TEMPENTITY = 23; -float SVC_SETPAUSE = 24; -float SVC_SIGNONNUM = 25; -float SVC_CENTERPRINT = 26; -float SVC_KILLEDMONSTER = 27; -float SVC_FOUNDSECRET = 28; -float SVC_SPAWNSTATICSOUND = 29; -float SVC_INTERMISSION = 30; -float SVC_FINALE = 31; -float SVC_CDTRACK = 32; -float SVC_SELLSCREEN = 33; -float SVC_CUTSCENE = 34; - -float TE_SPIKE = 0; -float TE_SUPERSPIKE = 1; -float TE_GUNSHOT = 2; -float TE_EXPLOSION = 3; -float TE_TAREXPLOSION = 4; -float TE_LIGHTNING1 = 5; -float TE_LIGHTNING2 = 6; -float TE_WIZSPIKE = 7; -float TE_KNIGHTSPIKE = 8; -float TE_LIGHTNING3 = 9; -float TE_LAVASPLASH = 10; -float TE_TELEPORT = 11; - -float CHAN_AUTO = 0; -float CHAN_WEAPON = 1; -float CHAN_VOICE = 2; -float CHAN_ITEM = 3; -float CHAN_BODY = 4; -float CHAN_IMPACT = 5; - -float ATTN_NONE = 0; -float ATTN_NORM = 0.5; -float ATTN_IDLE = 2; -float ATTN_STATIC = 3; - -float UPDATE_GENERAL = 0; -float UPDATE_STATIC = 1; -float UPDATE_BINARY = 2; -float UPDATE_TEMP = 3; - -float EF_BRIGHTFIELD = 1; -float EF_MUZZLEFLASH = 2; -float EF_BRIGHTLIGHT = 4; -float EF_DIMLIGHT = 8; - -float MSG_BROADCAST = 0; -float MSG_ONE = 1; -float MSG_ALL = 2; -float MSG_INIT = 3; - -// Deathtypes (weapon deathtypes are the IT_* constants below) -float DEATH_FALL = 10000; -float DEATH_TELEFRAG = 10001; -float DEATH_DROWN = 10002; -float DEATH_HURTTRIGGER = 10003; -float DEATH_LAVA = 10004; -float DEATH_SLIME = 10005; -float DEATH_KILL = 10006; - -float IT_LASER = 4096; -float IT_SHOTGUN = 1; -float IT_UZI = 2; -float IT_GRENADE_LAUNCHER = 4; -float IT_ELECTRO = 8; -float IT_CRYLINK = 16; -float IT_NEX = 32; -float IT_HAGAR = 64; -float IT_ROCKET_LAUNCHER = 128; - -float IT_SHELLS = 256; -float IT_NAILS = 512; -float IT_ROCKETS = 1024; -float IT_CELLS = 2048; - -float IT_STRENGTH = 8192; -float IT_INVINCIBLE = 16384; -//float IT_SPEED = 32768; -//float IT_SLOWMO = 65536; - -float IT_KEY1 = 131072; -float IT_KEY2 = 262144; - -vector PL_VIEW_OFS = '0 0 35'; -vector PL_MIN = '-16 -16 -24'; -vector PL_MAX = '16 16 45'; -vector PL_CROUCH_VIEW_OFS = '0 0 15'; -vector PL_CROUCH_MIN = '-16 -16 -24'; -vector PL_CROUCH_MAX = '16 16 25'; - -// Sajt - added these, just as constants. Not sure how you want them actually put in the game, but I just -// did this so at least they worked -// NOTE: instagib IS NOT compatible with rocket-arena, so make sure to prevent selecting both in a menu -//float GAME_INSTAGIB = 1; /// everyone gets the nex gun with infinite ammo, and one shot kills -//float GAME_ROCKET_ARENA = 16; /// Everyone starts with a rocket launcher -//float GAME_FULLBRIGHT_PLAYERS = 64; /// makes the players model fullbright -//float GAME_TEAMS = 128; /// Teams, red/green/yellow/blue - -float game; // set to "gamecfg" on worldspawn - - -//float POWERUP_STRENGTH_DAMAGE = 2; // damage multiplier for strength powerup -//float POWERUP_STRENGTH_FORCE = 4; // force multiplier for strength powerup - -//float POWERUP_INVINCIBLE_TAKEDAMAGE = 0.2; // received damage multiplier for invincible powerup - - -float TE_BEAM = 13; // grappling hook diff --git a/qcsrc/gamec/ctf.c b/qcsrc/gamec/ctf.c deleted file mode 100644 index a56c731e6..000000000 --- a/qcsrc/gamec/ctf.c +++ /dev/null @@ -1,557 +0,0 @@ - -.entity flagcarried; - -//float FLAGSCORE_PICKUP = 1; -//float FLAGSCORE_RETURN = 5; // returned by owner team -//float FLAGSCORE_RETURNROGUE = 10; // returned by rogue team -//float FLAGSCORE_CAPTURE = 5; -//float FLAGSCORE_CAPTURE_TEAM = 20; - -float FLAG_BASE = 1; -float FLAG_CARRY = 2; -float FLAG_DROPPED = 3; - -void() FlagThink; -void() FlagTouch; - -void() place_flag = -{ - if(!self.t_width) - self.t_width = 0.1; // frame animation rate - if(!self.t_length) - self.t_length = 119; // maximum frame - - self.mdl = self.model; - self.flags = FL_ITEM; - self.solid = SOLID_TRIGGER; - self.movetype = MOVETYPE_TOSS; - self.velocity = '0 0 0'; - self.origin_z = self.origin_z + 6; - self.think = FlagThink; - self.touch = FlagTouch; - self.nextthink = time + 0.1; - self.cnt = FLAG_BASE; - self.mangle = self.angles; - //self.effects = self.effects | EF_DIMLIGHT; - if (!droptofloor(0, 0)) - { - dprint("Flag fell out of level at ", vtos(self.origin), "\n"); - remove(self); - return; - } - self.oldorigin = self.origin; -}; - -void(entity e) RegenFlag = -{ - e.movetype = MOVETYPE_TOSS; - e.solid = SOLID_TRIGGER; - // TODO: play a sound here - sound (e, CHAN_AUTO, self.noise3, 1, ATTN_NONE); - setorigin(e, e.oldorigin); - e.angles = e.mangle; - e.cnt = FLAG_BASE; - e.owner = world; - e.flags = FL_ITEM; // clear FL_ONGROUND and any other junk -}; - -void(entity e) ReturnFlag = -{ - if (e.owner) - if (e.owner.flagcarried == e) - e.owner.flagcarried = world; - e.owner = world; - RegenFlag(e); -}; - -void(entity e) DropFlag = -{ - local entity p; - - if (!e.owner) - { - dprint("FLAG: drop - no owner?!?!\n"); - return; - } - p = e.owner; - if (p.flagcarried != e) - { - dprint("FLAG: drop - owner is not carrying this flag??\n"); - return; - } - bprint(p.netname); - if (e.team == 5) - bprint(" lost the RED flag\n"); - else - bprint(" lost the BLUE flag\n"); - if (p.flagcarried == e) - p.flagcarried = world; - e.owner = world; - - e.flags = FL_ITEM; // clear FL_ONGROUND and any other junk - e.solid = SOLID_TRIGGER; - e.movetype = MOVETYPE_TOSS; - // setsize(e, '-16 -16 0', '16 16 74'); - setorigin(e, p.origin - '0 0 24'); - e.cnt = FLAG_DROPPED; - e.velocity = '0 0 300'; - e.pain_finished = time + cvar("g_ctf_flag_returntime");//30; -}; - -void AnimateFlag() -{ - if(self.delay > time) - return; - self.delay = time + self.t_width; - if(self.nextthink > self.delay) - self.nextthink = self.delay; - - self.frame = self.frame + 1; - if(self.frame > self.t_length) - self.frame = 0; -} - -void() FlagThink = -{ - local entity e; - local vector v; - local float f; - - self.nextthink = time + 0.1; - - AnimateFlag(); - - if (self.cnt == FLAG_BASE) - return; - - if (self.cnt == FLAG_DROPPED) - { - if (time > self.pain_finished) - { - if (self.team == 5) - bprint("The RED flag has returned to base\n"); - else - bprint("The BLUE flag has returned to base\n"); - ReturnFlag(self); - } - return; - } - - e = self.owner; - if (e.classname != "player" || (e.deadflag) || (e.flagcarried != self)) - { - DropFlag(self); - return; - } - - // borrowed from threewave CTF, because it would be way too much work - - makevectors (e.angles); - v = v_forward; - v_z = 0 - v_z; // reverse z - - f = 14; - /* - if (e.frame >= 29 && e.frame <= 40) - { - if (e.frame >= 29 && e.frame <= 34) - { - //axpain - if (e.frame == 29) f = f + 2; - else if (e.frame == 30) f = f + 8; - else if (e.frame == 31) f = f + 12; - else if (e.frame == 32) f = f + 11; - else if (e.frame == 33) f = f + 10; - else if (e.frame == 34) f = f + 4; - } - else if (e.frame >= 35 && e.frame <= 40) - { - // pain - if (e.frame == 35) f = f + 2; - else if (e.frame == 36) f = f + 10; - else if (e.frame == 37) f = f + 10; - else if (e.frame == 38) f = f + 8; - else if (e.frame == 39) f = f + 4; - else if (e.frame == 40) f = f + 2; - } - } - else if (e.frame >= 103 && e.frame <= 118) - { - if (e.frame >= 103 && e.frame <= 104) f = f + 6; //nailattack - else if (e.frame >= 105 && e.frame <= 106) f = f + 6; //light - else if (e.frame >= 107 && e.frame <= 112) f = f + 7; //rocketattack - else if (e.frame >= 112 && e.frame <= 118) f = f + 7; //shotattack - } - */ - self.angles = e.angles + '0 0 -45'; - setorigin (self, e.origin + '0 0 0' - f*v + v_right * 22); - self.nextthink = time + 0.01; -}; - -float flagcaptimerecord; -.float flagpickuptime; - -void() FlagTouch = -{ - local float t; - local entity head; - local entity player; - if (other.classname != "player") - return; - if (other.health < 1) // ignore dead players - return; - - if (self.cnt == FLAG_CARRY) - return; - - if (self.cnt == FLAG_BASE) - if (other.team == self.team) - if (other.flagcarried) // he's got a flag - if (other.flagcarried.team != self.team) // capture - { - t = time - other.flagpickuptime; - if (flagcaptimerecord == 0) - { - if (other.flagcarried.team == 5) - bprint(other.netname, " captured the RED flag in ", ftos(t), " seconds\n"); - else - bprint(other.netname, " captured the BLUE flag in ", ftos(t), " seconds\n"); - flagcaptimerecord = t; - } - else if (t < flagcaptimerecord) - { - if (other.flagcarried.team == 5) - bprint(other.netname, " captured the RED flag in ", ftos(t), ", breaking the previous record of", ftos(flagcaptimerecord), " seconds\n"); - else - bprint(other.netname, " captured the BLUE flag in ", ftos(t), ", breaking the previous record of", ftos(flagcaptimerecord), " seconds\n"); - flagcaptimerecord = t; - } - else - { - if (other.flagcarried.team == 5) - bprint(other.netname, " captured the RED flag in ", ftos(t), ", failing to break the previous record of", ftos(flagcaptimerecord), " seconds\n"); - else - bprint(other.netname, " captured the BLUE flag in ", ftos(t), ", failing to break the previous record of", ftos(flagcaptimerecord), " seconds\n"); - } - other.frags = other.frags + cvar("g_ctf_flagscore_capture");//FLAGSCORE_CAPTURE; - head = find(head, classname, "player"); - while (head) - { - if (head.team == self.team) - head.frags = head.frags + cvar("g_ctf_flagscore_capture_team");//FLAGSCORE_CAPTURE_TEAM; - head = find(head, classname, "player"); - } - sound (self, CHAN_AUTO, self.noise2, 1, ATTN_NONE); - ReturnFlag(other.flagcarried); - } - if (self.cnt == FLAG_BASE) - if (other.team == 5 || other.team == 14) // only red and blue team can steal flags - if (other.team != self.team) - if (!other.flagcarried) - { - // pick up - other.flagpickuptime = time; // used for timing runs - self.solid = SOLID_NOT; - setorigin(self, self.origin); // relink - self.owner = other; - other.flagcarried = self; - self.cnt = FLAG_CARRY; - if (other.flagcarried.team == 5) - bprint(other.netname, " got the RED flag\n"); - else - bprint(other.netname, " got the BLUE flag\n"); - other.frags = other.frags + cvar("g_ctf_flagscore_pickup");//FLAGSCORE_PICKUP; - sound (self, CHAN_AUTO, self.noise, 1, ATTN_NONE); - - player = find(world, classname, "player"); - while(player) { - if(player.team == self.team) centerprint(player, "The enemy got your flag! Retrieve it!"); - player = find(player, classname, "player"); - } - - return; - } - - if (self.cnt == FLAG_DROPPED) - { - self.flags = FL_ITEM; // clear FL_ONGROUND and any other junk - if (other.team == self.team || (other.team != 5 && other.team != 14)) - { - // return flag - if (self.team == 5) - bprint(other.netname, " returned the RED flag\n"); - else - bprint(other.netname, " returned the BLUE flag\n"); - if (other.team == 5 || other.team == 14) - other.frags = other.frags + cvar("g_ctf_flagscore_return");//FLAGSCORE_RETURN; - else - other.frags = other.frags + cvar("g_ctf_flagscore_return_rogue");//FLAGSCORE_RETURNROGUE; - sound (self, CHAN_AUTO, self.noise1, 1, ATTN_NONE); - ReturnFlag(self); - } - else if (!other.flagcarried) - { - // pick up - other.flagpickuptime = time; // used for timing runs - self.solid = SOLID_NOT; - setorigin(self, self.origin); // relink - self.owner = other; - other.flagcarried = self; - self.cnt = FLAG_CARRY; - if (self.team == 5) - bprint(other.netname, " picked up the RED flag\n"); - else - bprint(other.netname, " picked up the BLUE flag\n"); - other.frags = other.frags + cvar("g_ctf_flagscore_pickup");//FLAGSCORE_PICKUP; - sound (self, CHAN_AUTO, self.noise, 1, ATTN_NONE); - - player = find(world, classname, "player"); - while(player) { - if(player.team == self.team) centerprint(player, "The enemy got your flag! Retrieve it!"); - player = find(player, classname, "player"); - } - } - } -}; - -/*QUAKED info_player_team1 (1 0 0) (-16 -16 -24) (16 16 24) -CTF Starting point for a player -in team one (Red). - -Keys: -"angle" - viewing angle when spawning -*/ -void() info_player_team1 = -{ - if(!cvar("g_ctf")) - self.classname = "info_player_deathmatch"; -}; -//self.team = 4;self.classname = "info_player_start";info_player_start();}; - -/*QUAKED info_player_team2 (1 0 0) (-16 -16 -24) (16 16 24) -CTF Starting point for a player in -team two (Blue). - -Keys: -"angle" - viewing angle when spawning -*/ -void() info_player_team2 = -{ - if(!cvar("g_ctf")) - self.classname = "info_player_deathmatch"; -}; -//self.team = 13;self.classname = "info_player_start";info_player_start();}; - -/*QUAKED info_player_team3 (1 0 0) (-16 -16 -24) (16 16 24) -CTF Starting point for a player in -team three (Green). - -Keys: -"angle" - viewing angle when spawning -*/ -void() info_player_team3 = -{ - if(!cvar("g_ctf")) - self.classname = "info_player_deathmatch"; -}; - - -/*QUAKED info_player_team4 (1 0 0) (-16 -16 -24) (16 16 24) -CTF Starting point for a player in -team four (Magenta). - -Keys: -"angle" - viewing angle when spawning -*/ -void() info_player_team4 = -{ - if(!cvar("g_ctf")) - self.classname = "info_player_deathmatch"; -}; - - - - -/*QUAKED item_flag_team1 (0 0.5 0.8) (-48 -48 -37) (48 48 37) -CTF flag for team one (Red). -Multiple are allowed. - -Keys: -"angle" - Angle the flag will point -(minus 90 degrees) -"model" - model to use, note this needs red and blue as skins 0 and 1 - (default models/ctf/flag.md3) -"noise" - sound played when flag is picked up - (default ctf/take.wav) -"noise1" - sound played when flag is returned by a teammate - (default ctf/return.wav) -"noise2" - sound played when flag is captured - (default ctf/capture.wav) -"noise3" - sound played when flag is lost in the field and respawns itself - (default ctf/respawn.wav) -*/ - -void() item_flag_team1 = -{ - if (!cvar("g_ctf")) - return; - //if(!cvar("teamplay")) - // cvar_set("teamplay", "3"); - - self.team = 5; // color 4 team (red) - self.items = IT_KEY2; // gold key (redish enough) - self.skin = 0; - if (!self.model) - self.model = "models/ctf/flag_red.md3"; - if (!self.noise) - self.noise = "ctf/take.wav"; - if (!self.noise1) - self.noise1 = "ctf/return.wav"; - if (!self.noise2) - self.noise2 = "ctf/capture.wav"; - if (!self.noise3) - self.noise3 = "ctf/respawn.wav"; - precache_model (self.model); - setmodel (self, self.model); - precache_sound (self.noise); - precache_sound (self.noise1); - precache_sound (self.noise2); - precache_sound (self.noise3); - setsize(self, '-16 -16 -37', '16 16 37'); - setorigin(self, self.origin + '0 0 37'); - self.nextthink = time + 0.2; // start after doors etc - self.think = place_flag; - - if(!self.scale) - self.scale = 0.6; - //if(!self.glow_size) - // self.glow_size = 50; - - self.effects = self.effects | EF_FULLBRIGHT | EF_LOWPRECISION; -}; - -/*QUAKED item_flag_team2 (0 0.5 0.8) (-48 -48 -24) (48 48 64) -CTF flag for team two (Blue). -Multiple are allowed. - -Keys: -"angle" - Angle the flag will point -(minus 90 degrees) - -*/ - -void() item_flag_team2 = -{ - if (!cvar("g_ctf")) - return; - //if(!cvar("teamplay")) - // cvar_set("teamplay", "3"); - - self.team = 14; // color 13 team (blue) - self.items = IT_KEY1; // silver key (bluish enough) - self.skin = 1; - if (!self.model) - self.model = "models/ctf/flag_blue.md3"; - if (!self.noise) - self.noise = "ctf/take.wav"; - if (!self.noise1) - self.noise1 = "ctf/return.wav"; - if (!self.noise2) - self.noise2 = "ctf/capture.wav"; - if (!self.noise3) - self.noise3 = "ctf/respawn.wav"; - precache_model (self.model); - setmodel (self, self.model); - precache_sound (self.noise); - precache_sound (self.noise1); - precache_sound (self.noise2); - precache_sound (self.noise3); - setsize(self, '-16 -16 -37', '16 16 37'); - setorigin(self, self.origin + '0 0 37'); - self.nextthink = time + 0.2; // start after doors etc - self.think = place_flag; - - if(!self.scale) - self.scale = 0.6; - //if(!self.glow_size) - // self.glow_size = 50; - - self.effects = self.effects | EF_FULLBRIGHT | EF_LOWPRECISION; -}; - - -/*QUAKED ctf_team (0 .5 .8) (-16 -16 -24) (16 16 32) -Team declaration for CTF gameplay, this allows you to decide what team -names and control point models are used in your map. - -Note: If you use ctf_team entities you must define at least 2! However, unlike -domination, you don't need to make a blank one too. - -Keys: -"netname" - Name of the team (for example Red, Blue, Green, Yellow, Life, Death, Offense, Defense, etc) -"cnt" - Scoreboard color of the team (for example 4 is red and 13 is blue) - -*/ - -void() ctf_team = -{ - self.classname = "ctf_team"; - self.team = self.cnt + 1; -}; - -// code from here on is just to support maps that don't have control point and team entities -void ctf_spawnteam (string teamname, float teamcolor) -{ - local entity oldself; - oldself = self; - self = spawn(); - self.classname = "ctf_team"; - self.netname = teamname; - self.cnt = teamcolor; - - ctf_team(); - - self = oldself; -}; - -// spawn some default teams if the map is not set up for ctf -void() ctf_spawnteams = -{ - float numteams; - - numteams = 2;//cvar("g_ctf_default_teams"); - - ctf_spawnteam("Red", 4); - ctf_spawnteam("Blue", 13); -}; - -void() ctf_delayedinit = -{ - self.think = SUB_Remove; - self.nextthink = time; - // if no teams are found, spawn defaults - if (find(world, classname, "ctf_team") == world) - ctf_spawnteams(); -}; - -void() ctf_init = -{ - local entity e; - e = spawn(); - e.think = ctf_delayedinit; - e.nextthink = time + 0.1; -}; - diff --git a/qcsrc/gamec/defs.h b/qcsrc/gamec/defs.h deleted file mode 100644 index f8f9036ec..000000000 --- a/qcsrc/gamec/defs.h +++ /dev/null @@ -1,203 +0,0 @@ - -// Globals - -entity activator; -string string_null; - -//entity casing; -entity dest; - -// Fields - -.void(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) event_damage; - -//.string wad; -//.string map; - -// is this client a remote administrator? -.float adminstatus; - -//.float worldtype; -.float delay; -.float wait; -.float lip; -//.float light_lev; -.float speed; -//.float style; -//.float skill; - -.string killtarget; - -.vector pos1, pos2; -.vector mangle; - -.float attack_finished; -.float pain_finished; //Added by Supajoe -.float pain_frame; //" -.float statdraintime; // record the one-second intervals between draining health and armour when they're over 100 -.float crouch; // Crouching or not? - -.float strength_finished; -//.float speed_finished; -.float invincible_finished; -//.float slowmo_finished; - -.vector finaldest, finalangle; //plat.qc stuff -.void() think1; -.float state; -.float t_length, t_width; - -.vector destvec; // for rain -.float cnt; // for rain -.float count; -//.float cnt2; - -.float death_time; -.float dead_time; -.float dead_frame; -.float die_frame; -.float fade_time; -.float fade_rate; - -.string mdl; - -.string playermodel; -.string playerskin; - -.float respawntime; -//.float chasecam; - -.float electrocount; -//.float crylinkcount; - -.float damageforcescale; - -//.float gravity; - -.float dmg; - -// for railgun damage (hitting multiple enemies) -.float railgunhit; -.float railgunhitsolidbackup; -.vector railgunhitloc; - -.float air_finished; -.float dmgtime; - -.float killcount; - -.float watersound_finished; -.float iscreature; -.vector oldvelocity; - -.float pauseregen_finished; -.float pauserothealth_finished; -.float pauserotarmor_finished; -.float attack_finished; - -// definistions for weaponsystem - -.entity weaponentity; -.entity exteriorweaponentity; -.float switchweapon; -void(float wpn, float wrequest) weapon_action; -float(entity cl, float wpn, float andammo) client_hasweapon; -void() w_clear; -// VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies) -.float weapon_nextthink; -.void() weapon_think; -.vector shotdir, shotorg; // new generic aiming system for all weapons (not finished yet, can be removed) -float weapon_hasammo; // sets by WR_CHECKAMMO request - -//float PLAYER_WEAPONSELECTION_DELAY = ); -float PLAYER_WEAPONSELECTION_SPEED = 18; -vector PLAYER_WEAPONSELECTION_RANGE = '0 20 -40'; - -// weapon states (self.weaponentity.state) -float WS_CLEAR = 0; // no weapon selected -float WS_RAISE = 1; // raise frame -float WS_DROP = 2; // deselecting frame -float WS_INUSE = 3; // fire state -float WS_READY = 4; // idle frame - -// weapon requests -float WR_SETUP = 1; // setup weapon data -float WR_UPDATECOUNTS = 2; // update ammo display -float WR_IDLE = 3; // idle frame -float WR_DROP = 4; // deselect frame -float WR_RAISE = 5; // select frame -float WR_FIRE1 = 6; // primary fire frame -float WR_FIRE2 = 7; // secondary fire -float WR_FIRE3 = 8; // third fire -float WR_CHECKAMMO = 9; // checks ammo for weapon -float WR_CLEAR = 10; // runs afted deselecting frames, remove weapon parts (if presented). This useful for quake3-style chaingun - -// Weapon indexes -float WEP_LASER = 1; // float IT_LASER = 4096; -float WEP_SHOTGUN = 2; // float IT_SHOTGUN = 1; -float WEP_UZI = 3; // float IT_UZI = 2; -float WEP_GRENADE_LAUNCHER = 4; // float IT_GRENADE_LAUNCHER = 4; -float WEP_ELECTRO = 5; // float IT_ELECTRO = 8; -float WEP_CRYLINK = 6; // float IT_CRYLINK = 16; -float WEP_NEX = 7; // float IT_NEX = 32; -float WEP_HAGAR = 8; // float IT_HAGAR = 64; -float WEP_ROCKET_LAUNCHER = 9; // float IT_ROCKET_LAUNCHER = 128; - -// For weapon cycling commands -float WEP_FIRST = 1; -float WEP_LAST = 9; - -void(entity e, float chan, string samp, float vol, float atten) sound = #8; -void(entity client, string s) stuffcmd = #21; -void(entity client, string s) sprint = #24; -vector(entity e, float sped) aim = #44; -void(entity client, string s) centerprint = #73; -void(entity e) setspawnparms = #78; -void(float to, float f) WriteByte = #52; -void(float to, float f) WriteChar = #53; -void(float to, float f) WriteShort = #54; -void(float to, float f) WriteLong = #55; -void(float to, float f) WriteCoord = #56; -void(float to, float f) WriteAngle = #57; -void(float to, string s) WriteString = #58; -void(float to, entity s) WriteEntity = #59; -.vector dest1, dest2; -void(entity clent) dropclient = #453; - -float gameover; -float intermission_running; -float intermission_exittime; -float alreadychangedlevel; - - -.float isbot; // true if this client is actually a bot - -.float runes; - - -.float welcomemessage_time; -.float welcomemessage_time2; - -// stahl's voting -string votecalled; -entity votecaller; -.float vote_finished; -.float vote_next; -.float vote_vote; -float VoteAllowed(string vote); -void VoteCount(); -void VoteDo(entity voter); -void VoteTimeout(entity voter); -void VoteReset(); - -// Wazat's grappling hook -.entity hook; -void GrapplingHookFrame(); -void RemoveGrapplingHook(entity pl); -void SetGrappleHookBindings(); -// hook impulses -float GRAPHOOK_FIRE = 20; -float GRAPHOOK_RELEASE = 21; -// (note: you can change the hook impulse #'s to whatever you please) -.float hook_time; - diff --git a/qcsrc/gamec/domination.c b/qcsrc/gamec/domination.c deleted file mode 100644 index 979388403..000000000 --- a/qcsrc/gamec/domination.c +++ /dev/null @@ -1,562 +0,0 @@ - -/* -Domination as a plugin for netquake mods -by LordHavoc (lordhavoc@ghdigital.com) - -How to add domination points to a mod: -1. Add this line to progs.src above world.qc: -domination.qc -2. Comment out all lines in ClientObituary in client.qc that begin with targ.frags or attacker.frags. -3. Add this above worldspawn in world.qc: -void() dom_init; -4. Add this line to the end of worldspawn in world.qc: -dom_init(); - -Note: The only teams who can use dom control points are identified by dom_team entities (if none exist these default to red and blue and use only quake models/sounds). -*/ - - -void() dom_spawnteams; - -void dompoint_captured () -{ - local entity head; - - head = self.enemy; - - self.cnt = -1; - - self.goalentity = head; - self.model = head.mdl; - self.modelindex = head.dmg; - self.skin = head.skin; - - //bprint(head.message); - //bprint("\n"); - - //bprint(^3head.netname); - //bprint(head.netname); - //bprint(self.message); - //bprint("\n"); - - bprint(strcat("^3", head.netname, self.message, "\n")); - - if (head.noise != "") - sound(self, CHAN_BODY, head.noise, 1, ATTN_NORM); - if (head.noise1 != "") - sound(self, CHAN_VOICE, head.noise1, 1, ATTN_NONE); - - //self.nextthink = time + cvar("g_domination_point_rate"); - //self.think = dompointthink; - self.delay = time + cvar("g_domination_point_rate"); -}; - -void AnimateDomPoint() -{ - if(self.pain_finished > time) - return; - self.pain_finished = time + self.t_width; - if(self.nextthink > self.pain_finished) - self.nextthink = self.pain_finished; - - self.frame = self.frame + 1; - if(self.frame > self.t_length) - self.frame = 0; -} - -void() dompointthink = -{ - local entity head; - float waittime; - float fragamt; - - self.nextthink = time + 0.1; - - //self.frame = self.frame + 1; - //if(self.frame > 119) - // self.frame = 0; - AnimateDomPoint(); - - // give points - - if (gameover) // game has ended, don't keep giving points - return; - - if(self.delay > time) - return; - - if(self.state == 1) - { - self.state = 0; - dompoint_captured(); - return; - } - - waittime = cvar("g_domination_point_rate"); - if(!waittime) - waittime = self.wait; - self.delay = time + waittime; - - if (!self.goalentity.netname) - return; - - - fragamt = cvar("g_domination_point_amt"); - if(!fragamt) - fragamt = self.frags; - - head = find(head, classname, "player"); - while (head) - { - if (head.team == self.goalentity.team) - head.frags = head.frags + fragamt; - head = find(head, classname, "player"); - } - self.goalentity.frags = self.goalentity.frags + fragamt; -}; - -void() dompointtouch = -{ - local entity head; - if (other.classname != "player") - return; - if (other.health < 1) - return; - if(self.cnt > 0 && self.cnt == other.team) - return; - - // only valid teams can claim it - head = find(world, classname, "dom_team"); - while (head && head.team != other.team) - head = find(head, classname, "dom_team"); - if (!head || head.netname == "" || head == self.goalentity) - return; - - // delay capture - - self.cnt = other.team; - self.enemy = head; - - self.state = 1; - self.delay = time + cvar("g_domination_point_capturetime"); - //self.nextthink = time + cvar("g_domination_point_capturetime"); - //self.think = dompoint_captured; - // go to neutral team in the mean time - - head = find(world, classname, "dom_team"); - while (head && head.netname != "") - head = find(head, classname, "dom_team"); - if(head == world) - return; - - self.goalentity = head; - self.model = head.mdl; - self.modelindex = head.dmg; - self.skin = head.skin; -}; - -/*QUAKED dom_team (0 .5 .8) (-32 -32 -24) (32 32 32) -Team declaration for Domination gameplay, this allows you to decide what team -names and control point models are used in your map. - -Note: If you use dom_team entities you must define at least 3 and only two -can have netname set! The nameless team owns all control points at start. - -Keys: -"netname" - Name of the team (for example Red Team, Blue Team, Green Team, Yellow Team, Life, Death, etc) -"cnt" - Scoreboard color of the team (for example 4 is red and 13 is blue) -"model" - Model to use for control points owned by this team (for example - "progs/b_g_key.mdl" is a gold keycard, and "progs/b_s_key.mdl" is a silver - keycard) -"skin" - Skin of the model to use (for team skins on a single model) -"noise" - Sound to play when this team captures a point. - (this is a localized sound, like a small alarm or other effect) -"noise1" - Narrator speech to play when this team captures a point. - (this is a global sound, like "Red team has captured a control point") -*/ - -void() dom_team = -{ - precache_model(self.model); - if (self.noise != "") - precache_sound(self.noise); - if (self.noise1 != "") - precache_sound(self.noise1); - self.classname = "dom_team"; - setmodel(self, self.model); - self.mdl = self.model; - self.dmg = self.modelindex; - self.model = ""; - self.modelindex = 0; - // this would have to be changed if used in quakeworld - self.team = self.cnt + 1; -}; - -void() dom_controlpoint_setup = -{ - local entity head; - // find the dom_team representing unclaimed points - head = find(world, classname, "dom_team"); - while(head && head.netname != "") - head = find(head, classname, "dom_team"); - if (!head) - objerror("no dom_team with netname \"\" found\n"); - - // copy important properties from dom_team entity - self.goalentity = head; - setmodel(self, head.mdl); - self.skin = head.skin; - - self.cnt = -1; - - if(!self.message) - self.message = " has captured a control point"; - - if(!self.frags) - self.frags = 1; - if(!self.wait) - self.wait = 5; - - if(!self.t_width) - self.t_width = 0.1; // frame animation rate - if(!self.t_length) - self.t_length = 119; // maximum frame - - self.think = dompointthink; - self.nextthink = time; - self.touch = dompointtouch; - self.solid = SOLID_TRIGGER; - setsize(self, '-32 -32 -24', '32 32 32'); - setorigin(self, self.origin + '0 0 20'); - droptofloor(0, 0); -}; - - - -// player has joined game, get him on a team -// depreciated -/*void dom_player_join_team(entity pl) -{ - entity head; - float c1, c2, c3, c4, totalteams, smallestteam, smallestteam_count, selectedteam; - float balance_teams, force_balance, balance_type; - - balance_teams = cvar("g_balance_teams"); - balance_teams = cvar("g_balance_teams_force"); - - c1 = c2 = c3 = c4 = -1; - totalteams = 0; - - // first find out what teams are allowed - head = find(world, classname, "dom_team"); - while(head) - { - if(head.netname != "") - { - //if(head.team == pl.team) - // selected = head; - if(head.team == COLOR_TEAM1) - { - c1 = 0; - } - if(head.team == COLOR_TEAM2) - { - c2 = 0; - } - if(head.team == COLOR_TEAM3) - { - c3 = 0; - } - if(head.team == COLOR_TEAM4) - { - c4 = 0; - } - } - head = find(head, classname, "dom_team"); - } - - // make sure there are at least 2 teams to join - if(c1 >= 0) - totalteams = totalteams + 1; - if(c2 >= 0) - totalteams = totalteams + 1; - if(c3 >= 0) - totalteams = totalteams + 1; - if(c4 >= 0) - totalteams = totalteams + 1; - - if(totalteams <= 1) - error("dom_player_join_team: Too few teams available for domination\n"); - - // whichever teams that are available are set to 0 instead of -1 - - // if we don't care what team he ends up on, put him on whatever team he entered as. - // if he's not on a valid team, then put him on the smallest team - if(!balance_teams && !force_balance) - { - if( c1 >= 0 && pl.team == COLOR_TEAM1) - selectedteam = pl.team; - else if(c2 >= 0 && pl.team == COLOR_TEAM2) - selectedteam = pl.team; - else if(c3 >= 0 && pl.team == COLOR_TEAM3) - selectedteam = pl.team; - else if(c4 >= 0 && pl.team == COLOR_TEAM4) - selectedteam = pl.team; - else - selectedteam = -1; - if(selectedteam > 0) - { - SetPlayerColors(pl, selectedteam - 1); - return; - } - // otherwise end up on the smallest team (handled below) - } - - // now count how many players are on each team already - - head = find(world, classname, "player"); - while(head) - { - //if(head.netname != "") - { - if(head.team == COLOR_TEAM1) - { - if(c1 >= 0) - c1 = c1 + 1; - } - if(head.team == COLOR_TEAM2) - { - if(c2 >= 0) - c2 = c2 + 1; - } - if(head.team == COLOR_TEAM3) - { - if(c3 >= 0) - c3 = c3 + 1; - } - if(head.team == COLOR_TEAM4) - { - if(c4 >= 0) - c4 = c4 + 1; - } - } - head = find(head, classname, "player"); - } - - // c1...c4 now have counts of each team - // figure out which is smallest, giving priority to the team the player is already on as a tie-breaker - - smallestteam = 0; - smallestteam_count = 999; - - // 2 gives priority to what team you're already on, 1 goes in order - balance_type = 1; - - if(balance_type == 1) - { - if(c1 >= 0 && c1 < smallestteam_count) - { - smallestteam = 1; - smallestteam_count = c1; - } - if(c2 >= 0 && c2 < smallestteam_count) - { - smallestteam = 2; - smallestteam_count = c2; - } - if(c3 >= 0 && c3 < smallestteam_count) - { - smallestteam = 3; - smallestteam_count = c3; - } - if(c4 >= 0 && c4 < smallestteam_count) - { - smallestteam = 4; - smallestteam_count = c4; - } - } - else - { - if(c1 >= 0 && (c1 < smallestteam_count || - (c1 == smallestteam_count && self.team == COLOR_TEAM1) ) ) - { - smallestteam = 1; - smallestteam_count = c1; - } - if(c2 >= 0 && c2 < (c2 < smallestteam_count || - (c2 == smallestteam_count && self.team == COLOR_TEAM2) ) ) - { - smallestteam = 2; - smallestteam_count = c2; - } - if(c3 >= 0 && c3 < (c3 < smallestteam_count || - (c3 == smallestteam_count && self.team == COLOR_TEAM3) ) ) - { - smallestteam = 3; - smallestteam_count = c3; - } - if(c4 >= 0 && c4 < (c4 < smallestteam_count || - (c4 == smallestteam_count && self.team == COLOR_TEAM4) ) ) - { - smallestteam = 4; - smallestteam_count = c4; - } - } - - if(smallestteam == 1) - { - selectedteam = COLOR_TEAM1 - 1; - } - if(smallestteam == 2) - { - selectedteam = COLOR_TEAM2 - 1; - } - if(smallestteam == 3) - { - selectedteam = COLOR_TEAM3 - 1; - } - if(smallestteam == 4) - { - selectedteam = COLOR_TEAM4 - 1; - } - - SetPlayerColors(pl, selectedteam); -} -*/ -/*QUAKED dom_controlpoint (0 .5 .8) (-16 -16 -24) (16 16 32) -Control point for Domination gameplay. -*/ -void() dom_controlpoint = -{ - if(!cvar("g_domination")) - { - remove(self); - return; - } - self.think = dom_controlpoint_setup; - self.nextthink = time + 0.1; - - if(!self.scale) - self.scale = 0.6; - - //if(!self.glow_size) - // self.glow_size = cvar("g_domination_point_glow"); - self.effects = self.effects | EF_FULLBRIGHT; -}; - -// code from here on is just to support maps that don't have control point and team entities -void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float pointskin, string capsound, string capnarration, string capmessage) -{ - local entity oldself; - oldself = self; - self = spawn(); - self.classname = "dom_team"; - self.netname = teamname; - self.cnt = teamcolor; - self.model = pointmodel; - self.skin = pointskin; - self.noise = capsound; - self.noise1 = capnarration; - self.message = capmessage; - - // this code is identical to dom_team - setmodel(self, self.model); - self.mdl = self.model; - self.dmg = self.modelindex; - self.model = ""; - self.modelindex = 0; - // this would have to be changed if used in quakeworld - self.team = self.cnt + 1; - - //eprint(self); - self = oldself; -}; - -void(vector org) dom_spawnpoint = -{ - local entity oldself; - oldself = self; - self = spawn(); - self.classname = "dom_controlpoint"; - self.think = dom_controlpoint; - self.nextthink = time; - self.origin = org; - dom_controlpoint(); - self = oldself; -}; - -// spawn some default teams if the map is not set up for domination -void() dom_spawnteams = -{ - float numteams; - - numteams = cvar("g_domination_default_teams"); - // LordHavoc: edit this if you want to change defaults - dom_spawnteam("Red", 4, "models/domination/dom_red.md3", 0, "domination/claim.wav", "", "Red team has captured a control point"); - dom_spawnteam("Blue", 13, "models/domination/dom_blue.md3", 0, "domination/claim.wav", "", "Blue team has captured a control point"); - if(numteams > 2) - dom_spawnteam("Green", 3, "models/domination/dom_green.md3", 0, "domination/claim.wav", "", "Green team has captured a control point"); - if(numteams > 3) - dom_spawnteam("Yellow", 12, "models/domination/dom_yellow.md3", 0, "domination/claim.wav", "", "Yellow team has captured a control point"); - dom_spawnteam("", 0, "models/domination/dom_unclaimed.md3", 0, "", "", ""); -}; - -void() dom_delayedinit = -{ - local entity head; - - self.think = SUB_Remove; - self.nextthink = time; - // if no teams are found, spawn defaults - if (find(world, classname, "dom_team") == world) - dom_spawnteams(); - // if no control points are found, spawn defaults - if (find(world, classname, "dom_controlpoint") == world) - { - // here follow default domination points for each map - /* - if (world.model == "maps/e1m1.bsp") - { - dom_spawnpoint('0 0 0'); - } - else - */ - { - // if no supported map was found, make every deathmatch spawn a point - head = find(world, classname, "info_player_deathmatch"); - while (head) - { - dom_spawnpoint(head.origin); - head = find(head, classname, "info_player_deathmatch"); - } - } - } -}; - -void() dom_init = -{ - local entity e; - // we have to precache default models/sounds even if they might not be - // used because worldspawn is executed before any other entities are read, - // so we don't even know yet if this map is set up for domination... - precache_model("models/domination/dom_red.md3"); - precache_model("models/domination/dom_blue.md3"); - precache_model("models/domination/dom_green.md3"); - precache_model("models/domination/dom_yellow.md3"); - precache_model("models/domination/dom_unclaimed.md3"); - precache_sound("domination/claim.wav"); - e = spawn(); - e.think = dom_delayedinit; - e.nextthink = time + 0.1; - - // teamplay is always on in domination, defaults to hurt self but not teammates - //if(!cvar("teamplay")) - // cvar_set("teamplay", "3"); -}; - diff --git a/qcsrc/gamec/extensions.h b/qcsrc/gamec/extensions.h deleted file mode 100644 index 0f926decd..000000000 --- a/qcsrc/gamec/extensions.h +++ /dev/null @@ -1,995 +0,0 @@ - -//DarkPlaces supported extension list, draft version 1.04 - -//checkextension function -//idea: expected by almost everyone -//darkplaces implementation: LordHavoc -float(string s) checkextension = #99; -//description: -//check if (cvar("pr_checkextension")) before calling this, this is the only -//guarenteed extension to be present in the extension system, it allows you -//to check if an extension is available, by name, to check for an extension -//use code like this: -//// (it is recommended this code be placed in worldspawn or a worldspawn called function somewhere) -//if (cvar("pr_checkextension")) -//if (checkextension("DP_SV_SETCOLOR")) -// ext_setcolor = TRUE; -//from then on you can check ext_setcolor to know if that extension is available - -//DP_QC_CVAR_STRING -//idea: Paul Timofeyev -//DarkPlaces implementation: Paul Timofeyev, LordHavoc -//builtin definitions: -string(string s) cvar_string = #448; -//description: -//returns the value of a cvar, as a tempstring. - -//DP_QC_TRACE_MOVETYPES -//idea: LordHavoc -//darkplaces implementation: id Software -//constant definitions: -float MOVE_NORMAL = 0; // same as FALSE -float MOVE_NOMONSTERS = 1; // same as TRUE -float MOVE_MISSILE = 2; // save as movement with .movetype == MOVETYPE_FLYMISSILE -//description: -//this extension does nothing (do not check for it), it only documents existing MOVE_ values that were never defined in defs.qc, these are passed as the 'nomonsters' parameter to traceline/tracebox - -//DP_QC_TRACE_MOVETYPE_WORLDONLY -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//constant definitions: -float MOVE_WORLDONLY = 3; -//description: -//allows traces to hit only world (see DP_QC_TRACE_MOVETYPES for how to use this) - -//DP_QC_TRACE_MOVETYPE_HITMODEL -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//constant definitions: -float MOVE_HITMODEL = 4; -//description: -//allows traces to hit alias models (not sprites!) instead of entity boxes (see DP_QC_TRACE_MOVETYPES for how to use this) - -// LordHavoc: HIGHLY experimental, do not implement this in other engines -//DP_CGAME -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//SVC definitions: -float svc_cgame = 50; // [short] length [bytes] data -//description: -//contains network messages to client gamecode. - -//DP_CL_LOADSKY -//idea: Nehahra, LordHavoc -//darkplaces implementation: LordHavoc -//client console commands: -//"loadsky" (parameters: "basename", example: "mtnsun_" would load "mtnsun_up.tga" and "mtnsun_rt.tga" and similar names, use "" to revert to quake sky, note: this is the same as Quake2 skybox naming) -//description: -//sets global skybox for the map for this client (can be stuffed to a client by QC), does not hurt much to repeatedly execute this command, please don't use this in mods if it can be avoided (only if changing skybox is REALLY needed, otherwise please use DP_GFX_SKYBOX). - -//DP_EF_ADDITIVE -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//effects bit: -float EF_ADDITIVE = 32; -//description: -//additive blending when this object is rendered - -//DP_EF_BLUE -//idea: id Software -//darkplaces implementation: LordHavoc -//effects bit: -float EF_BLUE = 64; -//description: -//entity emits blue light (used for quad) - -//DP_EF_FLAME -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//effects bit: -float EF_FLAME = 1024; -//description: -//entity is on fire - -//DP_EF_FULLBRIGHT -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//effects bit: -float EF_FULLBRIGHT = 512; -//description: -//entity is always brightly lit - -//DP_EF_NODRAW -//idea: id Software -//darkplaces implementation: LordHavoc -//effects bit: -float EF_NODRAW = 16; -//description: -//prevents server from sending entity to client (forced invisible, even if it would have been a light source or other such things) - -//DP_EF_RED -//idea: id Software -//darkplaces implementation: LordHavoc -//effects bit: -float EF_RED = 128; -//description: -//entity emits red light (used for invulnerability) - -//DP_EF_STARDUST -//idea: MythWorks Inc -//darkplaces implementation: LordHavoc -//effects bit: -float EF_STARDUST = 2048; -//description: -//entity emits bouncing sparkles in every direction - -//entity attributes used for rendering/networking: -//idea: Nehahra -//darkplaces implementation: LordHavoc -//DP_ENT_ALPHA -//field definition: -.float alpha; -//description: -//controls opacity of the entity, 0.0 is forced to be 1.0 (otherwise everything would be invisible), use -1 if you want to make something invisible, 1.0 is solid (like normal). - -//DP_ENT_COLORMOD -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//field definition: -.vector colormod; -//description: -//controls color of the entity, '0 0 0', is forced to be '1 1 1' (otherwise everything would be black), used for tinting objects, for instance using '1 0.6 0.4' on an ogre would give you an orange ogre (order is red green blue), note the colors can go up to '8 8 8' (8x as bright as normal). - -//DP_ENT_CUSTOMCOLORMAP -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//description: -//if .colormap is set to 1024 + pants + shirt * 16, those colors will be used for colormapping the entity, rather than looking up a colormap by player number. - -/* -//NOTE: no longer supported by darkplaces because all entities are delta compressed now -//DP_ENT_DELTACOMPRESS // no longer supported -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//effects bit: -float EF_DELTA = 8388608; -//description: -//(obsolete) applies delta compression to the network updates of the entity, making updates smaller, this might cause some unreliable behavior in packet loss situations, so it should only be used on numerous (nails/plasma shots/etc) or unimportant objects (gibs/shell casings/bullet holes/etc). -*/ - -//DP_ENT_EXTERIORMODELTOCLIENT -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//fields: -.entity exteriormodeltoclient; -//description: -//the entity is visible to all clients with one exception: if the specified client is using first person view (not using chase_active) the entity will not be shown. - -//DP_ENT_GLOW -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//field definitions: -.float glow_color; -.float glow_size; -.float glow_trail; -//description: -//customizable glowing light effect on the entity, glow_color is a paletted (8bit) color in the range 0-255 (note: 0 and 254 are white), glow_size is 0 or higher (up to the engine what limit to cap it to, darkplaces imposes a 1020 limit), if glow_trail is true it will leave a trail of particles of the same color as the light. - -//DP_ENT_LOWPRECISION -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//effects bit: -float EF_LOWPRECISION = 4194304; -//description: -//uses low quality origin coordinates, reducing network traffic compared to the default high precision, intended for numerous objects (projectiles/gibs/bullet holes/etc). - -//DP_ENT_SCALE -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//field definitions: -.float scale; -//description: -//controls rendering scale of the object, 0 is forced to be 1, darkplaces uses 1/16th accuracy and a limit of 15.9375, can be used to make an object larger or smaller. - -//DP_ENT_VIEWMODEL -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//field definitions: -.entity viewmodelforclient; -//description: -//this is a very special capability, attachs the entity to the view of the client specified, origin and angles become relative to the view of that client, all effects can be used (multiple skins on a weapon model etc)... the entity is not visible to any other client. - -//DP_GFX_FOG -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//worldspawn fields: -//"fog" (parameters: "density red green blue", example: "0.1 0.3 0.3 0.3") -//description: -//global fog for the map, can not be changed by QC - -//DP_GFX_SKYBOX -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//worldspawn fields: -//"sky" (parameters: "basename", example: "mtnsun_" would load "mtnsun_up.tga" and "mtnsun_rt.tga" and similar names, note: "sky" is also used the same way by Quake2) -//description: -//global skybox for the map, can not be changed by QC - -//DP_GFX_EXTERNALTEXTURES -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//description: -//loads external textures found in various directories (tenebrae compatible)... -/* -in all examples .tga is merely the base texture, it can be any of these: -.tga (base texture) -_glow.tga (fullbrights or other glowing overlay stuff, NOTE: this is done using additive blend, not alpha) -_pants.tga (pants overlay for colormapping on models, this should be shades of grey (it is tinted by pants color) and black wherever the base texture is not black, as this is an additive blend) -_shirt.tga (same idea as pants, but for shirt color) -_diffuse.tga (this may be used instead of base texture for per pixel lighting) -_gloss.tga (specular texture for per pixel lighting, note this can be in color (tenebrae only supports greyscale)) -_norm.tga (normalmap texture for per pixel lighting) -_bump.tga (bumpmap, converted to normalmap at load time, supported only for reasons of tenebrae compatibility) -_luma.tga (same as _glow but supported only for reasons of tenebrae compatibility) - -due to glquake's incomplete Targa(r) loader, this section describes -required Targa(r) features support: -types: -type 1 (uncompressed 8bit paletted with 24bit/32bit palette) -type 2 (uncompressed 24bit/32bit true color, glquake supported this) -type 3 (uncompressed 8bit greyscale) -type 9 (RLE compressed 8bit paletted with 24bit/32bit palette) -type 10 (RLE compressed 24bit/32bit true color, glquake supported this) -type 11 (RLE compressed 8bit greyscale) -attribute bit 0x20 (Origin At Top Left, top to bottom, left to right) - -image formats guarenteed to be supported: tga, pcx, lmp -image formats that are optional: png, jpg - -mdl/spr/spr32 examples: -skins are named _A (A being a number) and skingroups are named like _A_B -these act as suffixes on the model name... -example names for skin _2_1 of model "progs/armor.mdl": -game/override/progs/armor.mdl_2_1.tga -game/textures/progs/armor.mdl_2_1.tga -game/progs/armor.mdl_2_1.tga -example names for skin _0 of the model "progs/armor.mdl": -game/override/progs/armor.mdl_0.tga -game/textures/progs/armor.mdl_0.tga -game/progs/armor.mdl_0.tga -note that there can be more skins files (of the _0 naming) than the mdl -contains, this is only useful to save space in the .mdl file if classic quake -compatibility is not a concern. - -bsp/md2/md3 examples: -example names for the texture "quake" of model "maps/start.bsp": -game/override/quake.tga -game/textures/quake.tga -game/progs/quake.tga - -sbar/menu/console textures: for example the texture "conchars" (console font) in gfx.wad -game/override/gfx/conchars.tga -game/textures/gfx/conchars.tga -game/gfx/conchars.tga -*/ - -//DP_GFX_QUAKE3MODELTAGS -//idea: id Software -//darkplaces implementation: LordHavoc -//field definitions: -.entity tag_entity; // entity this is attached to (call setattachment to set this) -.float tag_index; // which tag on that entity (0 is relative to the entity, > 0 is an index into the tags on the model if it has any) (call setattachment to set this) -//builtin definitions: -void(entity e, entity tagentity, string tagname) setattachment = #443; // attachs e to a tag on tagentity (note: use "" to attach to entity origin/angles instead of a tag) -//description: -//allows entities to be visually attached to model tags (which follow animations perfectly) on other entities, for example attaching a weapon to a player's hand, or upper body attached to lower body, allowing it to change angles and frame separately (note: origin and angles are relative to the tag, use '0 0 0' for both if you want it to follow exactly, this is similar to viewmodelforclient's behavior). -//note 2: if the tag is not found, it defaults to "" (attach to origin/angles of entity) -//note 3: attaching to world turns off attachment -//note 4: the entity that this is attached to must be visible for this to work - -//DP_GFX_SKINFILES -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//description: -//alias models (mdl, md2, md3) can have .skin files to replace conventional texture naming, these have a naming format such as: -//progs/test.md3_0.skin -//progs/test.md3_1.skin -//... -// -//these files contain replace commands (replace meshname shadername), example: -//replace "helmet" "progs/test/helmet1.tga" // this is a mesh shader replacement -//replace "teamstripes" "progs/test/redstripes.tga" -//replace "visor" "common/nodraw" // this makes the visor mesh invisible -////it is not possible to rename tags using this format -// -//Or the Quake3 syntax (100% compatible with Quake3's .skin files): -//helmet,progs/test/helmet1.tga // this is a mesh shader replacement -//teamstripes,progs/test/redstripes.tga -//visor,common/nodraw // this makes the visor mesh invisible -//tag_camera, // this defines that the first tag in the model is called tag_camera -//tag_test, // this defines that the second tag in the model is called tag_test -// -//any names that are not replaced are automatically show up as a grey checkerboard to indicate the error status, and "common/nodraw" is a special case that is invisible. -//this feature is intended to allow multiple skin sets on md3 models (which otherwise only have one skin set). -//other commands might be added someday but it is not expected. - -//DP_HALFLIFE_MAP -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//description: -//simply indicates that the engine supports HalfLife maps (BSP version 30, NOT the QER RGBA ones which are also version 30). - -//DP_HALFLIFE_MAP_CVAR -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//cvars: -//halflifebsp 0/1 -//description: -//engine sets this cvar when loading a map to indicate if it is halflife format or not. - -//DP_INPUTBUTTONS -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//field definitions: -.float button3; -.float button4; -.float button5; -.float button6; -.float button7; -.float button8; -//description: -//set to the state of the +button3, +button4, +button5, +button6, +button7, and +button8 buttons from the client, this does not involve protocol changes (the extra 6 button bits were simply not used). - -//DP_MONSTERWALK -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//description: -//MOVETYPE_WALK is permitted on non-clients, so bots can move smoothly, run off ledges, etc, just like a real player. - -//DP_MOVETYPEBOUNCEMISSILE -//idea: id Software -//darkplaces implementation: id Software -//movetype definitions: -float MOVETYPE_BOUNCEMISSILE = 11; -//description: -//MOVETYPE_BOUNCE but without gravity, and with full reflection (no speed loss like grenades have), in other words - bouncing laser bolts. - -//DP_MOVETYPEFOLLOW -//idea: id Software, LordHavoc (redesigned) -//darkplaces implementation: LordHavoc -//movetype definitions: -float MOVETYPE_FOLLOW = 12; -//description: -//MOVETYPE_FOLLOW implemented, this uses existing entity fields in unusual ways: -//aiment - the entity this is attached to. -//punchangle - the original angles when the follow began. -//view_ofs - the relative origin (note that this is un-rotated by punchangle, and that is actually the only purpose of punchangle). -//v_angle - the relative angles. -//here's an example of how you would set a bullet hole sprite to follow a bmodel it was created on, even if the bmodel rotates: -//hole.movetype = MOVETYPE_FOLLOW; // make the hole follow -//hole.solid = SOLID_NOT; // MOVETYPE_FOLLOW is always non-solid -//hole.aiment = bmodel; // make the hole follow bmodel -//hole.punchangle = bmodel.angles; // the original angles of bmodel -//hole.view_ofs = hole.origin - bmodel.origin; // relative origin -//hole.v_angle = hole.angles - bmodel.angles; // relative angles - -//DP_QC_CHANGEPITCH -//idea: id Software -//darkplaces implementation: id Software -//field definitions: -.float idealpitch; -.float pitch_speed; -//builtin definitions: -void(entity ent) changepitch = #63; -//description: -//equivilant to changeyaw, ent is normally self. (this was a Q2 builtin) - -//DP_QC_COPYENTITY -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(entity from, entity to) copyentity = #400; -//description: -//copies all data in the entity to another entity. - -//DP_QC_ETOS -//idea: id Software -//darkplaces implementation: id Software -//builtin definitions: -string(entity ent) etos = #65; -//description: -//lists all of the entity's fields into a string (similar to edict command in console). (this was a Q2 builtin) - -//DP_QC_FINDCHAIN -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -entity(.string fld, string match) findchain = #402; -//description: -//similar to find() but returns a chain of entities like findradius. - -//DP_QC_FINDCHAINFLOAT -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -entity(.entity fld, entity match) findchainentity = #403; -entity(.float fld, float match) findchainfloat = #403; -//description: -//similar to findentity()/findfloat() but returns a chain of entities like findradius. - -//DP_QC_FINDFLOAT -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -entity(entity start, .entity fld, entity match) findentity = #98; -entity(entity start, .float fld, float match) findfloat = #98; -//description: -//finds an entity or float field value, similar to find(), but for entity and float fields. - -//DP_QC_GETLIGHT -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -vector(vector org) getlight = #92; -//description: -//returns the lighting at the requested location (in color), 0-255 range (can exceed 255). - -//DP_QC_GETSURFACE -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -float(entity e, float s) getsurfacenumpoints = #434; -vector(entity e, float s, float n) getsurfacepoint = #435; -vector(entity e, float s) getsurfacenormal = #436; -string(entity e, float s) getsurfacetexture = #437; -float(entity e, vector p) getsurfacenearpoint = #438; -vector(entity e, float s, vector p) getsurfaceclippedpoint = #439; -//description: -//functions to query surface information. - -//DP_QC_MINMAXBOUND -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -float(float a, float b) min = #94; -float(float a, float b, float c) min3 = #94; -float(float a, float b, float c, float d) min4 = #94; -float(float a, float b, float c, float d, float e) min5 = #94; -float(float a, float b, float c, float d, float e, float f) min6 = #94; -float(float a, float b, float c, float d, float e, float f, float g) min7 = #94; -float(float a, float b, float c, float d, float e, float f, float g, float h) min8 = #94; -float(float a, float b) max = #95; -float(float a, float b, float c) max3 = #95; -float(float a, float b, float c, float d) max4 = #95; -float(float a, float b, float c, float d, float e) max5 = #95; -float(float a, float b, float c, float d, float e, float f) max6 = #95; -float(float a, float b, float c, float d, float e, float f, float g) max7 = #95; -float(float a, float b, float c, float d, float e, float f, float g, float h) max8 = #95; -float(float minimum, float val, float maximum) bound = #96; -//description: -//min returns the lowest of all the supplied numbers. -//max returns the highest of all the supplied numbers. -//bound clamps the value to the range and returns it. - -//DP_QC_RANDOMVEC -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -vector() randomvec = #91; -//description: -//returns a vector of length < 1, much quicker version of this QC: do {v_x = random();v_y = random();v_z = random();} while(vlen(v) > 1) - -//DP_QC_SINCOSSQRTPOW -//idea: id Software, LordHavoc -//darkplaces implementation: id Software, LordHavoc -//builtin definitions: -float(float val) sin = #60; -float(float val) cos = #61; -float(float val) sqrt = #62; -float(float a, float b) pow = #97; -//description: -//useful math functions, sine of val, cosine of val, square root of val, and raise a to power b, respectively. - -//DP_QC_TRACEBOX -//idea: id Software -//darkplaces implementation: id Software -//builtin definitions: -void(vector v1, vector min, vector max, vector v2, float nomonsters, entity forent) tracebox = #90; -//description: -//similar to traceline but much more useful, traces a box of the size specified (technical note: currently the hull size can only be one of the sizes used in the map for bmodel collisions, entity collisions will pay attention to the exact size specified however, this is a collision code limitation in quake itself, and will be fixed eventually). - -//DP_QC_TRACETOSS -//idea: id Software -//darkplaces implementation: id Software -//builtin definitions: -void(entity ent, entity ignore) tracetoss = #64; -//description: -//simulates movement of the entity as if it is MOVETYPE_TOSS and starting with it's current state (location, velocity, etc), returns relevant trace_ variables (trace_fraction is always 0, all other values are supported - trace_ent, trace_endpos, trace_plane_normal), does not actually alter the entity. - -//DP_QC_VECTORVECTORS -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(vector dir) vectorvectors = #432; -//description: -//creates v_forward, v_right, and v_up vectors given a forward vector, similar to makevectors except it takes a forward direction vector instead of angles. - -//DP_QUAKE2_MODEL -//idea: quake community -//darkplaces implementation: LordHavoc -//description: -//shows that the engine supports Quake2 .md2 files. - -//DP_QUAKE3_MODEL -//idea: quake community -//darkplaces implementation: LordHavoc -//description: -//shows that the engine supports Quake3 .md3 files. - -//DP_REGISTERCVAR -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -float(string name, string value) registercvar = #93; -//description: -//adds a new console cvar to the server console (in singleplayer this is the player's console), the cvar exists until the mod is unloaded or the game quits. - -//DP_SOLIDCORPSE -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//solid definitions: -float SOLID_CORPSE = 5; -//description: -//the entity will not collide with SOLID_CORPSE and SOLID_SLIDEBOX entities (and likewise they will not collide with it), this is useful if you want dead bodies that are shootable but do not obstruct movement by players and monsters, note that if you traceline with a SOLID_SLIDEBOX entity as the ignoreent, it will ignore SOLID_CORPSE entities, this is desirable for visibility and movement traces, but not for bullets, for the traceline to hit SOLID_CORPSE you must temporarily force the player (or whatever) to SOLID_BBOX and then restore to SOLID_SLIDEBOX after the traceline. - -//DP_SPRITE32 -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//description: -//the engine supports .spr32 sprites. - -//DP_SV_BOTCLIENT -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//constants: -float CLIENTTYPE_DISCONNECTED = 0; -float CLIENTTYPE_REAL = 1; -float CLIENTTYPE_BOT = 2; -float CLIENTTYPE_NOTACLIENT = 3; -//builtin definitions: -entity() spawnclient = #454; // like spawn but for client slots (also calls relevant connect/spawn functions), returns world if no clients available -float(entity clent) clienttype = #455; // returns one of the CLIENTTYPE_* constants -//description: -//spawns a client with no network connection, to allow bots to use client slots with no hacks. -//How to use: -/* - // to spawn a bot - local entity oldself; - oldself = self; - self = spawnclient(); - if (!self) - { - bprint("Can not add bot, server full.\n"); - self = oldself; - return; - } - self.netname = "Yoyobot"; - self.clientcolors = 12 * 16 + 4; // yellow (12) shirt and red (4) pants - ClientConnect(); - PutClientInServer(); - self = oldself; - - // to remove all bots - local entity head; - head = find(world, classname, "player"); - while (head) - { - if (clienttype(head) == CLIENTTYPE_BOT) - dropclient(head); - head = find(head, classname, "player"); - } - - // to identify if a client is a bot (for example in PlayerPreThink) - if (clienttype(self) == CLIENTTYPE_BOT) - botthink(); -*/ -//see also DP_SV_CLIENTCOLORS DP_SV_CLIENTNAME DP_SV_DROPCLIENT -//How it works: -//creates a new client, calls SetNewParms and stores the parms, and returns the client. -//this intentionally does not call SV_SendServerinfo to allow the QuakeC a chance to set the netname and clientcolors fields before actually spawning the bot by calling ClientConnect and PutClientInServer manually -//on level change ClientConnect and PutClientInServer are called by the engine to spawn in the bot (this is why clienttype() exists to tell you on the next level what type of client this is). -//parms work the same on bot clients as they do on real clients, and do carry from level to level - -//DP_SV_CLIENTCOLORS -//idea: LordHavoc -//darkplaces implementation: LordHavoc -.float clientcolors; // colors of the client (format: pants + shirt * 16) -//description: -//allows qc to read and modify the client colors associated with a client entity (not particularly useful on other entities), and automatically sends out any appropriate network updates if changed - -//DP_SV_CLIENTNAME -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//allows qc to modify the client's .netname, and automatically sends out any appropriate network updates if changed - -//DP_SV_DRAWONLYTOCLIENT -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//field definitions: -.entity drawonlytoclient; -//description: -//the entity is only visible to the specified client. - -//DP_SV_EFFECT -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(vector org, string modelname, float startframe, float endframe, float framerate) effect = #404; -//SVC definitions: -//float svc_effect = #52; // [vector] org [byte] modelindex [byte] startframe [byte] framecount [byte] framerate -//float svc_effect2 = #53; // [vector] org [short] modelindex [byte] startframe [byte] framecount [byte] framerate -//description: -//clientside playback of simple custom sprite effects (explosion sprites, etc). - -//DP_SV_NODRAWTOCLIENT -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//field definitions: -.entity nodrawtoclient; -//description: -//the entity is not visible to the specified client. - -//DP_SV_PLAYERPHYSICS -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//field definitions: -.vector movement; -//engine-called QC prototypes: -//void() SV_PlayerPhysics; -//description: -//.movement vector contains the movement input from the player, allowing QC to do as it wishs with the input, and SV_PlayerPhysics will completely replace the player physics if present (works for all MOVETYPE's), see darkplaces mod source for example of this function (in playermovement.qc, adds HalfLife ladders support, as well as acceleration/deceleration while airborn (rather than the quake sudden-stop while airborn), and simplifies the physics a bit) - -//DP_SV_SETCOLOR -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(entity ent, float colors) setcolor = #401; -//engine called QC functions (optional): -//void(float color) SV_ChangeTeam; -//description: -//setcolor sets the color on a client and updates internal color information accordingly (equivilant to stuffing a "color" command but immediate) -//SV_ChangeTeam is called by the engine whenever a "color" command is recieved, it may decide to do anything it pleases with the color passed by the client, including rejecting it (by doing nothing), or calling setcolor to apply it, preventing team changes is one use for this. -//the color format is pants + shirt * 16 (0-255 potentially) - -//DP_SV_SLOWMO -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//cvars: -//"slowmo" (0+, default 1) -//description: -//sets the time scale of the server, mainly intended for use in singleplayer by the player, however potentially useful for mods, so here's an extension for it. -//range is 0 to infinite, recommended values to try are 0.1 (very slow, 10% speed), 1 (normal speed), 5 (500% speed). - -//DP_TE_BLOOD -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(vector org, vector velocity, float howmany) te_blood = #405; -//temp entity definitions: -float TE_BLOOD = 50; -//protocol: -//vector origin -//byte xvelocity (-128 to +127) -//byte yvelocity (-128 to +127) -//byte zvelocity (-128 to +127) -//byte count (0 to 255, how much blood) -//description: -//creates a blood effect. - -//DP_TE_BLOODSHOWER -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(vector mincorner, vector maxcorner, float explosionspeed, float howmany) te_bloodshower = #406; -//temp entity definitions: -//float TE_BLOODSHOWER = 52; -//protocol: -//vector mins (minimum corner of the cube) -//vector maxs (maximum corner of the cube) -//coord explosionspeed (velocity of blood particles flying out of the center) -//short count (number of blood particles) -//description: -//creates an exploding shower of blood, for making gibbings more convincing. - -//DP_TE_CUSTOMFLASH -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(vector org, float radius, float lifetime, vector color) te_customflash = #417; -//temp entity definitions: -//float TE_CUSTOMFLASH = 73; -//protocol: -//vector origin -//byte radius ((MSG_ReadByte() + 1) * 8, meaning 8-2048 unit radius) -//byte lifetime ((MSG_ReadByte() + 1) / 256.0, meaning approximately 0-1 second lifetime) -//byte red (0.0 to 1.0 converted to 0-255) -//byte green (0.0 to 1.0 converted to 0-255) -//byte blue (0.0 to 1.0 converted to 0-255) -//description: -//creates a customized light flash. - -//DP_TE_EXPLOSIONRGB -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(vector org, vector color) te_explosionrgb = #407; -//temp entity definitions: -//float TE_EXPLOSIONRGB = 53; -//protocol: -//vector origin -//byte red (0.0 to 1.0 converted to 0 to 255) -//byte green (0.0 to 1.0 converted to 0 to 255) -//byte blue (0.0 to 1.0 converted to 0 to 255) -//description: -//creates a colored explosion effect. - -//DP_TE_FLAMEJET -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//temp entity definitions: -float TE_FLAMEJET = 74; -//protocol: -//vector origin -//vector velocity -//byte count (0 to 255, how many flame particles) -//description: -//creates a single puff of flame particles. (not very useful really) - -//DP_TE_PARTICLECUBE -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(vector mincorner, vector maxcorner, vector vel, float howmany, float color, float gravityflag, float randomveljitter) te_particlecube = #408; -//temp entity definitions: -//float TE_PARTICLECUBE = 54; -//protocol: -//vector mins (minimum corner of the cube) -//vector maxs (maximum corner of the cube) -//vector velocity -//short count -//byte color (palette color) -//byte gravity (TRUE or FALSE, FIXME should this be a scaler instead?) -//coord randomvel (how much to jitter the velocity) -//description: -//creates a cloud of particles, useful for forcefields but quite customizable. - -//DP_TE_PARTICLERAIN -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlerain = #409; -//temp entity definitions: -//float TE_PARTICLERAIN = 55; -//protocol: -//vector mins (minimum corner of the cube) -//vector maxs (maximum corner of the cube) -//vector velocity (velocity of particles) -//short count (number of particles) -//byte color (8bit palette color) -//description: -//creates a shower of rain, the rain will appear either at the top (if falling down) or bottom (if falling up) of the cube. - -//DP_TE_PARTICLESNOW -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(vector mincorner, vector maxcorner, vector vel, float howmany, float color) te_particlesnow = #410; -//temp entity definitions: -//float TE_PARTICLERAIN = 56; -//protocol: -//vector mins (minimum corner of the cube) -//vector maxs (maximum corner of the cube) -//vector velocity (velocity of particles) -//short count (number of particles) -//byte color (8bit palette color) -//description: -//creates a shower of snow, the snow will appear either at the top (if falling down) or bottom (if falling up) of the cube, low velocities are advisable for convincing snow. - -//DP_TE_QUADEFFECTS1 -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(vector org) te_gunshotquad = #412; -void(vector org) te_spikequad = #413; -void(vector org) te_superspikequad = #414; -void(vector org) te_explosionquad = #415; -//temp entity definitions: -//float TE_GUNSHOTQUAD = 57; // [vector] origin -//float TE_SPIKEQUAD = 58; // [vector] origin -//float TE_SUPERSPIKEQUAD = 59; // [vector] origin -//float TE_EXPLOSIONQUAD = 70; // [vector] origin -//protocol: -//vector origin -//description: -//all of these just take a location, and are equivilant in function (but not appearance :) to the original TE_GUNSHOT, etc. - -//DP_TE_SMALLFLASH -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(vector org) te_smallflash = #416; -//temp entity definitions: -//float TE_SMALLFLASH = 72; -//protocol: -//vector origin -//description: -//creates a small light flash (radius 200, time 0.2). - -//DP_TE_SPARK -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(vector org, vector vel, float howmany) te_spark = #411; -//temp entity definitions: -//float TE_SPARK = 51; -//protocol: -//vector origin -//byte xvelocity (-128 to 127) -//byte yvelocity (-128 to 127) -//byte zvelocity (-128 to 127) -//byte count (number of sparks) -//description: -//creates a shower of sparks and a smoke puff. - -//DP_TE_STANDARDEFFECTBUILTINS -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(vector org) te_gunshot = #418; -void(vector org) te_spike = #419; -void(vector org) te_superspike = #420; -void(vector org) te_explosion = #421; -void(vector org) te_tarexplosion = #422; -void(vector org) te_wizspike = #423; -void(vector org) te_knightspike = #424; -void(vector org) te_lavasplash = #425; -void(vector org) te_teleport = #426; -void(vector org, float color) te_explosion2 = #427; -void(entity own, vector start, vector end) te_lightning1 = #428; -void(entity own, vector start, vector end) te_lightning2 = #429; -void(entity own, vector start, vector end) te_lightning3 = #430; -void(entity own, vector start, vector end) te_beam = #431; -//description: -//to make life easier on mod coders. - -//DP_TE_PLASMABURN -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//builtin definitions: -void(vector org) te_plasmaburn = #433; -//temp entity definitions: -//float TE_PLASMABURN = 75; -//protocol: -//vector origin -//description: -//creates a small light flash (radius 200, time 0.2) and marks the walls. - -//DP_VIEWZOOM -//idea: LordHavoc -//darkplaces implementation: LordHavoc -//field definitions: -.float viewzoom; -//description: -//scales fov and sensitivity of player, valid range is 0 to 1 (intended for sniper rifle zooming, and such) - -//FRIK_FILE -//idea: FrikaC -//darkplaces implementation: LordHavoc -//builtin definitions: -float(string s) stof = #81; // get numerical value from a string -float(string filename, float mode) fopen = #110; // opens a file inside quake/gamedir/data/ (mode is FILE_READ, FILE_APPEND, or FILE_WRITE), returns fhandle >= 0 if successful, or fhandle < 0 if unable to open file for any reason -void(float fhandle) fclose = #111; // closes a file -string(float fhandle) fgets = #112; // reads a line of text from the file and returns as a tempstring -void(float fhandle, string s) fputs = #113; // writes a line of text to the end of the file -float(string s) strlen = #114; // returns how many characters are in a string -string(string s1, ...) strcat = #115; // concatenates two strings (for example "abc", "def" would return "abcdef") and returns as a tempstring -string(string s, float start, float length) substring = #116; // returns a section of a string as a tempstring -vector(string s) stov = #117; // returns vector value from a string -string(string s) strzone = #118; // makes a copy of a string into the string zone and returns it, this is often used to keep around a tempstring for longer periods of time (tempstrings are replaced often) -void(string s) strunzone = #119; // removes a copy of a string from the string zone (you can not use that string again or it may crash!!!) -//constants: -float FILE_READ = 0; -float FILE_APPEND = 1; -float FILE_WRITE = 2; -//cvars: -//pr_zone_min_strings : default 64 (64k), min 64 (64k), max 8192 (8mb) -//description: -//provides text file access functions and string manipulation functions, note that you may want to set pr_zone_min_strings in the worldspawn function if 64k is not enough string zone space. - -//KRIMZON_SV_PARSECLIENTCOMMAND -//idea: KrimZon -//darkplaces implementation: KrimZon, LordHavoc -//engine-called QC prototypes: -//void(string s) SV_ParseClientCommand; -//builtin definitions: -void(entity e, string s) clientcommand = #440; -float(string s) tokenize = #441; -string(float n) argv = #442; -//description: -//provides QC the ability to completely control server interpretation of client commands ("say" and "color" for example, clientcommand is necessary for this and substring (FRIK_FILE) is useful) as well as adding new commands (tokenize, argv, and stof (FRIK_FILE) are useful for this)), whenever a clc_stringcmd is received the QC function is called, and it is up to the QC to decide what (if anything) to do with it - -//NEH_RESTOREGAME -//idea: Nehahra -//darkplaces implementation: LordHavoc -//engine-called QC prototypes: -//void() RestoreGame; -//description: -//when a savegame is loaded, this function is called - -//NEH_CMD_PLAY2 -//idea: Nehahra -//darkplaces implementation: LordHavoc -//description: -//shows that the engine supports the "play2" console command (plays a sound without spatialization). - -//PRYDON_CLIENTCURSOR -//idea: FrikaC -//darkplaces implementation: LordHavoc -//effects bit: -float EF_SELECTABLE = 16384; // allows cursor to highlight entity (brighten) -//field definitions: -.float cursor_active; // true if cl_prydoncursor mode is on -.vector cursor_screen; // screen position of cursor as -1 to +1 in _x and _y (_z unused) -.vector cursor_trace_start; // position of camera -.vector cursor_trace_endpos; // position of cursor in world (as traced from camera) -.entity cursor_trace_ent; // entity the cursor is pointing at (server forces this to world if the entity is currently free at time of receipt) -//cvar definitions: -//cl_prydoncursor (0/1+, default 0, 1 and above use cursors named gfx/prydoncursor%03i.lmp - or .tga and such if DP_GFX_EXTERNALTEXTURES is implemented) -//description: -//shows that the engine supports the cl_prydoncursor cvar, this puts a clientside mouse pointer on the screen and feeds input to the server for the QuakeC to use as it sees fit. -//the mouse pointer triggers button4 if cursor is at left edge of screen, button5 if at right edge of screen, button6 if at top edge of screen, button7 if at bottom edge of screen. -//the clientside trace skips transparent entities (except those marked EF_SELECTABLE). -//the selected entity highlights only if EF_SELECTABLE is set, a typical selection method would be doubling the brightness of the entity by some means (such as colormod[] *= 2). -//intended to be used by Prydon Gate. - -//TENEBRAE_GFX_DLIGHTS -//idea: Tenebrae -//darkplaces implementation: LordHavoc -//fields: -.float light_lev; // radius (does not affect brightness), typical value 350 -.vector color; // color (does not affect radius), typical value '1 1 1' (bright white), can be up to '255 255 255' (nuclear blast) -.float style; // light style (like normal light entities, flickering torches or switchable, etc) -.float pflags; // flags (see PFLAGS_ constants) -.vector angles; // orientation of the light -.float skin; // cubemap filter number, can be 1-255 (0 is assumed to be none, and tenebrae only allows 16-255), this selects a projective light filter, a value of 1 loads cubemaps/1posx.tga and cubemaps/1negx.tga and posy, negy, posz, and negz, similar to skybox but some sides need to be rotated or flipped -//constants: -float PFLAGS_NOSHADOW = 1; // light does not cast shadows -float PFLAGS_CORONA = 2; // light has a corona flare -float PFLAGS_FULLDYNAMIC = 128; // light enable (without this set no light is produced!) -//description: -//more powerful dynamic light settings -//warning: it is best not to use cubemaps on a light entity that has a model, as using a skin number that a model does not have will cause issues in glquake, and produce warnings in darkplaces (use developer 1 to see them) -//changes compared to tenebrae (because they're too 'leet' for standards): -//EF_FULLDYNAMIC effects flag replaced by PFLAGS_FULLDYNAMIC flag (EF_FULLDYNAMIC conflicts with EF_NODRAW) - -//TW_SV_STEPCONTROL -//idea: Transfusion -//darkplaces implementation: LordHavoc -//cvars: -//sv_jumpstep (0/1, default 1) -//sv_stepheight (default 18) -//description: -//sv_jumpstep allows stepping up onto stairs while airborn, sv_stepheight controls how high a single step can be. - -// NEXUIZ_PLAYERMODEL -// NEXUIZ_PLAYERSKIN -//idea: -//darkplaces implementation: Black -.string playermodel; // contains the name of the model set by a client with playermodel -.string playerskin; // contains the name of the skin set by a client with playerskin - -//unassigned stuff: (need to write up specs but haven't yet) -.vector punchvector; // DP_SV_PUNCHVECTOR -.float ping; // DP_SV_PING - - diff --git a/qcsrc/gamec/g_casings.c b/qcsrc/gamec/g_casings.c deleted file mode 100644 index 4fd5233c9..000000000 --- a/qcsrc/gamec/g_casings.c +++ /dev/null @@ -1,91 +0,0 @@ -void() casingtouch = -{ - if (other.solid == SOLID_BSP) - if (vlen(self.velocity) >= 50) - if (time >= self.attack_finished) - sound (self, CHAN_IMPACT, "weapons/tink1.wav", 0.5, ATTN_NORM); - self.attack_finished = time + 0.2; - //self.touch = SUB_Null; // one tink is enough - //self.dest = self.origin - self.groundentity.origin; -}; - -void() casingthink = -{ - local float p; - self.nextthink = time + 0.1; - if (self.flags & FL_ONGROUND) - { - // just keep the yaw angle - self.angles_x = 0; - self.angles_z = 0; - self.flags = self.flags - FL_ONGROUND; - self.nextthink = time + 0.5; - } - p = pointcontents(self.origin); - if (p == CONTENT_SOLID || p == CONTENT_LAVA || p == CONTENT_SKY) - { - removedecor(self); - return; - } - if (time > self.cnt) - { - self.nextthink = time; - self.alpha = self.alpha - frametime; - if (self.alpha < 0.0625) - removedecor(self); - } -}; - -// knock loose the casing when disturbed -void() casingknockedloosefunc = -{ - self.movetype = MOVETYPE_BOUNCE; - self.flags = self.flags - (self.flags & FL_ONGROUND); - self.avelocity = randomvec() * 300; - self.nextthink = time + 0.1; - self.touch = casingtouch; -}; - -void(vector org, vector vel, float randomvel, vector ang, vector avel, float randomavel, float casingtype) SpawnCasing = -{ - local entity e; - if (cvar("temp1") & 2048) - return; - - e = newdecor(); - //e.isdecor = TRUE; - e.alpha = 1; - //e.forcescale = 15; - e.movetype = MOVETYPE_BOUNCE; - e.solid = SOLID_TRIGGER; - e.velocity = vel + randomvec() * randomvel; - e.angles = ang; - e.avelocity = avel + randomvec() * randomavel; - e.nextthink = time; - e.think = casingthink; - e.touch = casingtouch; - //e.knockedloosefunc = casingknockedloosefunc; - e.effects = EF_LOWPRECISION; - e.createdtime = time; - if (casingtype == 1) - { - setmodel (e, "models/casing_shell.mdl"); - e.cnt = time + 30; - // bias to make these be considered more important than other things - e.createdtime = time + 1; - } - else if (casingtype == 2) - { - setmodel (e, "models/casing_steel.mdl"); - e.cnt = time + 10; - } - else - { - setmodel (e, "models/casing_bronze.mdl"); - e.cnt = time + 10; - } - if (maxclients == 1) - e.cnt = time + 3000; - setsize (e, '0 0 -1', '0 0 -1'); - setorigin (e, org); -}; diff --git a/qcsrc/gamec/g_damage.c b/qcsrc/gamec/g_damage.c deleted file mode 100644 index 51511445c..000000000 --- a/qcsrc/gamec/g_damage.c +++ /dev/null @@ -1,383 +0,0 @@ - -float checkrules_firstblood; - -void GiveFrags (entity attacker, entity targ, float f) -{ - if(f > 0 && cvar("g_domination") && cvar("g_domination_disable_frags")) - return; - else if(f > 0 && cvar("g_runematch")) - f = RunematchHandleFrags(attacker, targ, f); - - if(f) - attacker.frags = attacker.frags + f; -} - -void Obituary (entity attacker, entity targ, float deathtype) -{ - string s; - - if (targ.classname == "player" || targ.classname == "corpse") - { - if (targ.classname == "corpse") - s = "A corpse"; - else - s = targ.netname; - - if (targ == attacker) - { - if (deathtype == IT_GRENADE_LAUNCHER) - bprint ("^1",s, " detonated\n"); - else if (deathtype == IT_ELECTRO) - bprint ("^1",s, " played with plasma\n"); - else if (deathtype == IT_ROCKET_LAUNCHER) - bprint ("^1",s, " exploded\n"); - else if (deathtype == DEATH_KILL) - bprint ("^1",s, " couldn't take it anymore\n"); - else - bprint ("^1",s, " couldn't resist the urge to self-destruct\n"); - GiveFrags(attacker, targ, -1); - //targ.frags = targ.frags - 1; - if (targ.killcount > 2) - bprint ("^1",s," ended it all with a ",ftos(targ.killcount)," kill spree\n"); - } - else if (teamplay && attacker.team == targ.team) - { - bprint ("^1", attacker.netname, " mows down a teammate\n"); - GiveFrags(attacker, targ, -1); - //attacker.frags = attacker.frags - 1; - if (targ.killcount > 2) - bprint ("^1",s,"'s ",ftos(targ.killcount)," kill spree was endeded by a teammate!\n"); - if (attacker.killcount > 2) - bprint ("^1",attacker.netname," ended a ",ftos(attacker.killcount)," kill spree by killing a teammate\n"); - attacker.killcount = 0; - } - else if (attacker.classname == "player" || attacker.classname == "gib") - { - if (!checkrules_firstblood) - { - checkrules_firstblood = TRUE; - //sound(world, CHAN_AUTO, "announcer/firstblood.wav", 1, ATTN_NONE); - bprint("^1",attacker.netname, " drew first blood", "\n"); - } - - if (deathtype == IT_LASER) - bprint ("^1",s, " was blasted by ", attacker.netname, "\n"); - else if (deathtype == IT_UZI) - bprint ("^1",s, " was riddled full of holes by ", attacker.netname, "\n"); - else if (deathtype == IT_SHOTGUN) - bprint ("^1",s, " was gunned by ", attacker.netname, "\n"); - else if (deathtype == IT_GRENADE_LAUNCHER) - bprint ("^1", s, " was blasted by ", attacker.netname, "\n"); - else if (deathtype == IT_ELECTRO) - bprint ("^1",s, " was blasted by ", attacker.netname, "\n"); - else if (deathtype == IT_CRYLINK) - bprint ("^1",s, " was blasted by ", attacker.netname, "\n"); - else if (deathtype == IT_NEX) - bprint ("^1",s, " has been vaporized by ", attacker.netname, "\n"); - else if (deathtype == IT_HAGAR) - bprint ("^1",s, " was pummeled by ", attacker.netname, "\n"); - else if (deathtype == IT_ROCKET_LAUNCHER) - bprint ("^1",s, " was blasted by ", attacker.netname, "\n"); - else if (deathtype == DEATH_TELEFRAG) - bprint ("^1",s, " was telefragged by ", attacker.netname, "\n"); - else if (deathtype == DEATH_DROWN) - bprint ("^1",s, " was drowned by ", attacker.netname, "\n"); - else if (deathtype == DEATH_SLIME) - bprint ("^1",s, " was slimed by ", attacker.netname, "\n"); - else if (deathtype == DEATH_LAVA) - bprint ("^1",s, " was cooked by ", attacker.netname, "\n"); - else if (deathtype == DEATH_FALL) - bprint ("^1",s, " was grounded by ", attacker.netname, "\n"); - else if (deathtype == DEATH_HURTTRIGGER) - bprint ("^1",s, " was thrown into a world of hurt by ", attacker.netname, "\n"); - else - bprint ("^1",s, " was killed by ", attacker.netname, "\n"); - - GiveFrags(attacker, targ, 1); - //attacker.frags = attacker.frags + 1; - if (targ.killcount > 2) - bprint ("^1",s,"'s ", ftos(targ.killcount), " kill spree was ended by ", attacker.netname, "\n"); - attacker.killcount = attacker.killcount + 1; - if (attacker.killcount > 2) - bprint ("^1",attacker.netname," has ",ftos(attacker.killcount)," kills in a row\n"); - } - else - { - if (deathtype == DEATH_HURTTRIGGER && attacker.message != "") - bprint ("^1",s, " ", attacker.message, "\n"); - else if (deathtype == DEATH_DROWN) - bprint ("^1",s, " drowned\n"); - else if (deathtype == DEATH_SLIME) - bprint ("^1",s, " was slimed\n"); - else if (deathtype == DEATH_LAVA) - bprint ("^1",s, " turned into hot slag\n"); - else if (deathtype == DEATH_FALL) - bprint ("^1",s, " hit the ground with a crunch\n"); - else - bprint ("^1",s, " died\n"); - GiveFrags(targ, targ, -1); - //targ.frags = targ.frags - 1; - if (targ.killcount > 2) - bprint ("^1",s," died with a ",ftos(targ.killcount)," kill spree\n"); - } - // FIXME: this should go in PutClientInServer - if (targ.killcount) - targ.killcount = 0; - } -} - -// these are updated by each Damage call for use in button triggering and such -entity damage_targ; -entity damage_inflictor; -entity damage_attacker; - -void Damage (entity targ, entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) -{ - local entity oldself; - oldself = self; - self = targ; - damage_targ = targ; - damage_inflictor = inflictor; - damage_attacker = attacker; - // nullify damage if teamplay is on - if (teamplay) - if (attacker.team) - if (attacker.team == targ.team) - if (teamplay == 1 || (teamplay == 3 && attacker != targ)) - damage = 0; - - // midair gamemode: damage only while in the air - if (cvar("g_midair") - && self.classname == "player" // e.g. grenades take damage - && self.flags & FL_ONGROUND) { - damage = 0; - } - - // apply strength multiplier - if (attacker.items & IT_STRENGTH) - { - damage = damage * cvar("g_balance_powerup_strength_damage"); - force = force * cvar("g_balance_powerup_strength_force"); - } - // apply invincibility multiplier - if (targ.items & IT_INVINCIBLE) - damage = damage * cvar("g_balance_powerup_invincible_takedamage"); - - - if(cvar("g_runematch")) - { - // apply strength rune - if (attacker.runes & RUNE_STRENGTH) - { - if(attacker.runes & CURSE_WEAK) // have both curse & rune - { - damage = damage * cvar("g_balance_rune_strength_combo_damage"); - force = force * cvar("g_balance_rune_strength_combo_force"); - } - else - { - damage = damage * cvar("g_balance_rune_strength_damage"); - force = force * cvar("g_balance_rune_strength_force"); - } - } - else if (attacker.runes & CURSE_WEAK) - { - damage = damage * cvar("g_balance_curse_weak_damage"); - force = force * cvar("g_balance_curse_weak_force"); - } - - // apply defense rune - if (targ.runes & RUNE_DEFENSE) - { - if (targ.runes & CURSE_VULNER) // have both curse & rune - damage = damage * cvar("g_balance_rune_defense_combo_takedamage"); - else - damage = damage * cvar("g_balance_rune_defense_takedamage"); - } - else if (targ.runes & CURSE_VULNER) - damage = damage * cvar("g_balance_curse_vulner_takedamage"); - } - - // apply push - if (self.damageforcescale) - { - self.velocity = self.velocity + self.damageforcescale * force; - self.flags = self.flags - (self.flags & FL_ONGROUND); - } - // apply damage - if (self.event_damage) - self.event_damage (inflictor, attacker, damage, deathtype, hitloc, force); - self = oldself; - - if(targ.classname == "player" && attacker.classname == "player" && attacker != targ && attacker.health > 2) - { - // Savage: vampire mode - if(cvar("g_vampire")) - { - attacker.health += damage; - } - if(cvar("g_runematch")) - { - if (attacker.runes & RUNE_VAMPIRE) - { - // apply vampire rune - if (attacker.runes & CURSE_EMPATHY) // have the curse too - { - //attacker.health = attacker.health + damage * cvar("g_balance_rune_vampire_combo_absorb"); - attacker.health = bound( - 3, - attacker.health + damage * cvar("g_balance_rune_vampire_combo_absorb"), - 1000); - } - else - { - //attacker.health = attacker.health + damage * cvar("g_balance_rune_vampire_absorb"); - attacker.health = bound( - 3, - attacker.health + damage * cvar("g_balance_rune_vampire_absorb"), - 1000); - } - } - // apply empathy curse - else if (attacker.runes & CURSE_EMPATHY) - { - attacker.health = bound( - 3, - attacker.health + damage * cvar("g_balance_curse_empathy_takedamage"), - attacker.health); - } - } - } -} - -void RadiusDamage (entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity ignore, float forceintensity, float deathtype) -{ - entity targ; - float finaldmg; - float power; - vector blastorigin; - vector force; - vector m1; - vector m2; - vector nearest; - vector diff; - - blastorigin = (inflictor.origin + (inflictor.mins + inflictor.maxs) * 0.5); - - targ = findradius (blastorigin, rad); - while (targ) - { - if (targ != inflictor) - if (ignore != targ) - { - // LordHavoc: measure distance to nearest point on target (not origin) - // (this guarentees 100% damage on a touch impact) - nearest = blastorigin; - m1 = targ.origin + targ.mins; - m2 = targ.origin + targ.maxs; - if (nearest_x < m1_x) nearest_x = m1_x; - if (nearest_y < m1_y) nearest_y = m1_y; - if (nearest_z < m1_z) nearest_z = m1_z; - if (nearest_x > m2_x) nearest_x = m2_x; - if (nearest_y > m2_y) nearest_y = m2_y; - if (nearest_z > m2_z) nearest_z = m2_z; - diff = nearest - blastorigin; - // round up a little on the damage to ensure full damage on impacts - // and turn the distance into a fraction of the radius - power = 1 - ((vlen (diff) - 2) / rad); - //bprint(" "); - //bprint(ftos(power)); - if (power > 0) - { - if (power > 1) - power = 1; - finaldmg = coredamage * power + edgedamage * (1 - power); - if (finaldmg > 0) - { - force = normalize((m1 + m2) * 0.5 - blastorigin) * (finaldmg / coredamage) * forceintensity; - if (targ == attacker) - finaldmg = finaldmg * cvar("g_balance_selfdamagepercent"); // Partial damage if the attacker hits himself - Damage (targ, inflictor, attacker, finaldmg, deathtype, inflictor.origin, force); - } - } - } - targ = targ.chain; - } -} - -/* -entity multi_ent; -float multi_damage; -vector multi_force; - -void ClearMultiDamage (void) -{ - multi_ent = world; - multi_damage = 0; - multi_force = '0 0 0'; -} - -void ApplyMultiDamage (void) -{ - if (!multi_ent) - return; - - Damage (self, multi_ent.origin, multi_ent, 0, multi_damage, multi_force); -} - -void AddMultiDamage (entity hit, float damage, vector force) -{ - if (!hit) - return; - - if (hit != multi_ent) - { - ApplyMultiDamage (); - ClearMultiDamage (); - multi_ent = hit; - } - multi_damage = multi_damage + damage; - multi_force = multi_force + force; -} - -void FireBullets (float shotcount, vector dir, vector spread, float deathtype) -{ - vector direction; - vector source; - vector vel; - vector org; - - makevectors (self.v_angle); - - source = self.origin + v_forward * 10; // FIXME - source_x = self.absmin_z + self.size_z * 0.7; // ??? whaddabout view_ofs - - // LordHavoc: better to use normal damage - //ClearMultiDamage (); - while (shotcount > 0) - { - direction = dir + crandom () * spread_x * v_right + crandom () * spread_y * v_up; - - traceline (source, source + direction * 2048, FALSE, self); - if (trace_fraction != 1.0) - { - vel = normalize (direction + v_up * crandom () + v_right * crandom ()); - vel = vel + 2 * trace_plane_normal; - vel = vel * 200; - - org = trace_endpos - direction * 4; - - if (!trace_ent.takedamage) - te_gunshot (org); - // LordHavoc: better to use normal damage - //AddMultiDamage (trace_ent, 4, direction * 4); - Damage (trace_ent, self, self, 4, deathtype, trace_endpos, direction * 4); - } - - shotcount = shotcount + 1; - } - - // LordHavoc: better to use normal damage - //ApplyMultiDamage (); -} -*/ diff --git a/qcsrc/gamec/g_decors.c b/qcsrc/gamec/g_decors.c deleted file mode 100644 index 5b5c1fb85..000000000 --- a/qcsrc/gamec/g_decors.c +++ /dev/null @@ -1,246 +0,0 @@ - -float maxclients; // set by worldspawn code -float numdecors; -float maxdecors; -.float createdtime; - -//void(vector org, entity en, vector dir, float splattype, float importance) newbloodsplat; -//void(vector org, float bodydamage, float armordamage, vector vel, float damgtype) genericbleedfunc; - -// removes the oldest decors each frame to maintain a certain maximum decors -void() decorframe = -{ - local entity estart, e, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10; - local float bt1, bt2, bt3, bt4, bt5, bt6, bt7, bt8, bt9, bt10, iterations; - - // numdecors is allowed to be bogus as long as it is >= the real number of decors - // (but perfection is clearly preferable) - if (numdecors <= maxdecors) - return; - - // recount all the decors - numdecors = 0; - estart = e = findchain(classname, "decor"); - while(e) - { - numdecors = numdecors + 1; - e = e.chain; - } - if (numdecors <= maxdecors) - return; // nothing to do - - // limit it to considering 10000 entities per frame, - // otherwise it can cause a runaway loop error - iterations = 0; - while (numdecors > maxdecors && iterations < 10000) - { - iterations = iterations + 1; - // find and remove the oldest decors (upto 10 at once) - b1 = b2 = b3 = b4 = b5 = b6 = b7 = b8 = b9 = b10 = world; - bt1 = bt2 = bt3 = bt4 = bt5 = bt6 = bt7 = bt8 = bt9 = bt10 = time + 10000; - if (iterations > 0) - estart = findchain(classname, "decor"); - e = estart; - while(e) - { - iterations = iterations + 1; - if (e.createdtime < bt10) - { - if (e.createdtime < bt9) - { - if (e.createdtime < bt8) - { - if (e.createdtime < bt7) - { - if (e.createdtime < bt6) - { - if (e.createdtime < bt5) - { - if (e.createdtime < bt4) - { - if (e.createdtime < bt3) - { - if (e.createdtime < bt2) - { - if (e.createdtime < bt1) - { - b10=b9;bt10=bt9; - b9=b8;bt9=bt8; - b8=b7;bt8=bt7; - b7=b6;bt7=bt6; - b6=b5;bt6=bt5; - b5=b4;bt5=bt4; - b4=b3;bt4=bt3; - b3=b2;bt3=bt2; - b2=b1;bt2=bt1; - b1=e;bt1=e.createdtime; - } - else - { - b10=b9;bt10=bt9; - b9=b8;bt9=bt8; - b8=b7;bt8=bt7; - b7=b6;bt7=bt6; - b6=b5;bt6=bt5; - b5=b4;bt5=bt4; - b4=b3;bt4=bt3; - b3=b2;bt3=bt2; - b2=e;bt2=e.createdtime; - } - } - else - { - b10=b9;bt10=bt9; - b9=b8;bt9=bt8; - b8=b7;bt8=bt7; - b7=b6;bt7=bt6; - b6=b5;bt6=bt5; - b5=b4;bt5=bt4; - b4=b3;bt4=bt3; - b3=e;bt3=e.createdtime; - } - } - else - { - b10=b9;bt10=bt9; - b9=b8;bt9=bt8; - b8=b7;bt8=bt7; - b7=b6;bt7=bt6; - b6=b5;bt6=bt5; - b5=b4;bt5=bt4; - b4=e;bt4=e.createdtime; - } - } - else - { - b10=b9;bt10=bt9; - b9=b8;bt9=bt8; - b8=b7;bt8=bt7; - b7=b6;bt7=bt6; - b6=b5;bt6=bt5; - b5=e;bt5=e.createdtime; - } - } - else - { - b10=b9;bt10=bt9; - b9=b8;bt9=bt8; - b8=b7;bt8=bt7; - b7=b6;bt7=bt6; - b6=e;bt6=e.createdtime; - } - } - else - { - b10=b9;bt10=bt9; - b9=b8;bt9=bt8; - b8=b7;bt8=bt7; - b7=e;bt7=e.createdtime; - } - } - else - { - b10=b9;bt10=bt9; - b9=b8;bt9=bt8; - b8=e;bt8=e.createdtime; - } - } - else - { - b10=b9;bt10=bt9; - b9=e;bt9=e.createdtime; - } - } - else - { - b10=e;bt10=e.createdtime; - } - } - // failed all 10 slots - e = e.chain; - } - // remove the oldest decors - if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b1);} - if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b2);} - if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b3);} - if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b4);} - if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b5);} - if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b6);} - if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b7);} - if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b8);} - if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b9);} - if (numdecors > maxdecors) {numdecors = numdecors - 1;remove(b10);} - } -}; - -entity() newdecor = -{ - local entity e; - numdecors++; - e = spawn(); - e.classname = "decor"; - return e; -}; - -void(entity e) removedecor = -{ - numdecors--; - remove(e); -}; - - -void(vector org, vector vel, float amount) blood = -{ - te_blood(org, vel, amount); -}; - -void(vector org, vector vel, float amount) spark = -{ - te_spark(org, vel, amount); -}; - -void(vector m1, vector m2, float vel, float amount) bloodshower = -{ - te_bloodshower(m1, m2, vel, amount); -}; - -void(vector org, float quad) bulletpuff = -{ - if (quad) - te_gunshotquad(org); - else - te_gunshot(org); -}; - -void(vector org, float quad) nailpuff = -{ - if (quad) - te_superspikequad(org); - else - te_superspike(org); -}; - -// used for various little bouncing debris to avoid getting stuck in the air -void() DecorThink = -{ - self.nextthink = time; - self.flags = self.flags - (self.flags & FL_ONGROUND); - if (pointcontents(self.origin) == CONTENT_SOLID) - removedecor(self); -}; - -.float createdtime; - -void() InitDecors = -{ - // different number of decors in multi-player (to avoid lag on modems) - if (maxclients > 1) - maxdecors = 32; - else - maxdecors = 100; - // overridable by saved2 cvar on server console - if (cvar("decors")) - maxdecors = cvar("decors"); - if (maxdecors < 1) - maxdecors = 1; -}; diff --git a/qcsrc/gamec/g_hook.c b/qcsrc/gamec/g_hook.c deleted file mode 100644 index fd7d5f31b..000000000 --- a/qcsrc/gamec/g_hook.c +++ /dev/null @@ -1,205 +0,0 @@ -/*============================================ - - Wazat's Nexuiz Grappling Hook - - Contact: Wazat1@gmail.com - - -Installation instructions: --------------------------- - -1. Place hook.c in your gamec source directory with the other source files. - -2. Add this line to the bottom of progs.src: - -gamec/hook.c - -3. Open defs.h and add these lines to the very bottom: - -// Wazat's grappling hook -.entity hook; -void GrapplingHookFrame(); -void RemoveGrapplingHook(entity pl); -void SetGrappleHookBindings(); -// hook impulses -float GRAPHOOK_FIRE = 20; -float GRAPHOOK_RELEASE = 21; -// (note: you can change the hook impulse #'s to whatever you please) - -4. Open client.c and add this to the top of PutClientInServer(): - - RemoveGrapplingHook(self); // Wazat's Grappling Hook - -5. Find ClientConnect() (in client.c) and add these lines to the bottom: - - // Wazat's grappling hook - SetGrappleHookBindings(); - -6. Still in client.c, find PlayerPreThink and add this line just above the call to W_WeaponFrame: - - GrapplingHookFrame(); - -7. Build and test the mod. You'll want to bind a key to "+hook" like this: -bind ctrl "+hook" - -And you should be done! - - -============================================*/ - -void RemoveGrapplingHook(entity pl) -{ - if(pl.hook == world) - return; - remove(pl.hook); - pl.hook = world; - if(pl.movetype == MOVETYPE_FLY) - pl.movetype = MOVETYPE_WALK; - - pl.hook_time = time + 0.0; -} - -void GrapplingHookThink() -{ - float spd, dist, minlength, pullspeed; - vector dir, org, end; - if(self.owner.health <= 0 || self.owner.hook != self) // how did that happen? - { // well, better fix it anyway - remove(self); - return; - } - - self.nextthink = time + 0.1; - - makevectors(self.owner.v_angle); - org = self.owner.origin + self.owner.view_ofs + v_forward * 15 - v_right * 5 + v_up * -12; - - if(self.state == 1) - { - pullspeed = cvar("g_balance_grapplehook_speed_pull");//1000; - minlength = 50; - dir = self.origin - org; - dist = vlen(dir); - dir = normalize(dir); - - end = self.origin - dir*minlength; - - dist = vlen(end - org); - - if(dist < 200) - spd = dist * (pullspeed / 200); - else - spd = pullspeed; - if(spd < 50) - spd = 0; - - self.owner.velocity = dir*spd; - self.owner.movetype = MOVETYPE_FLY; - self.owner.flags = self.owner.flags - (self.owner.flags & FL_ONGROUND); - - org = org + dir*50; // get the beam out of the player's eyes - } - - WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte (MSG_BROADCAST, TE_BEAM); - WriteEntity (MSG_BROADCAST, self); - WriteCoord (MSG_BROADCAST, self.origin_x); - WriteCoord (MSG_BROADCAST, self.origin_y); - WriteCoord (MSG_BROADCAST, self.origin_z); - WriteCoord (MSG_BROADCAST, org_x); - WriteCoord (MSG_BROADCAST, org_y); - WriteCoord (MSG_BROADCAST, org_z); -} - -void GrapplingHookTouch (void) -{ - if (other == self.owner) - return; - else if (pointcontents (self.origin) == CONTENT_SKY) - { - RemoveGrapplingHook(self.owner); - return; - } - - self.event_damage = SUB_Null; // fixme: ability to dislodge a player by damaging hook? - sound (self, CHAN_BODY, "weapons/laserimpact.wav", 1, ATTN_NORM); - - self.state = 1; - self.think = GrapplingHookThink; - self.nextthink = time + 0.1; - self.touch = SUB_Null; - self.velocity = '0 0 0'; - self.movetype = MOVETYPE_NONE; -} - -void FireGrapplingHook (void) -{ - local entity missile; - local vector org; - - makevectors(self.v_angle); - - sound (self, CHAN_WEAPON, "weapons/lasergun_fire.wav", 1, ATTN_NORM); - org = self.origin + self.view_ofs + v_forward * 15 - v_right * 5 + v_up * -12; - te_customflash(org, 160, 0.2, '1 0 0'); - - missile = spawn (); - missile.owner = self; - self.hook = missile; - missile.classname = "laserbolt"; - - missile.movetype = MOVETYPE_FLY; - missile.solid = SOLID_BBOX; - - setmodel (missile, "models/ebomb.mdl");//laser.mdl"); - setsize (missile, '0 0 0', '0 0 0'); - setorigin (missile, org); - - missile.state = 0; // not latched onto anything - - missile.velocity = v_forward * cvar("g_balance_grapplehook_speed_fly"); - missile.angles = vectoangles (missile.velocity); - //missile.glow_color = 250; // 244, 250 - //missile.glow_size = 120; - missile.touch = GrapplingHookTouch; - missile.think = GrapplingHookThink; - missile.nextthink = time + 0.1; - - missile.effects = EF_FULLBRIGHT | EF_ADDITIVE | EF_LOWPRECISION; -} - -void GrapplingHookFrame() -{ - // if I have no hook or it's not pulling yet, make sure I'm not flying! - if((self.hook == world || !self.hook.state) && self.movetype == MOVETYPE_FLY) - { - self.movetype = MOVETYPE_WALK; - } - if(self.impulse == GRAPHOOK_FIRE && self.hook_time <= time && cvar("g_grappling_hook")) - { - // fire hook - FireGrapplingHook(); - return; - } - else if(self.impulse == GRAPHOOK_RELEASE) - { - // remove hook, reset movement type - RemoveGrapplingHook(self); - return; - } - /*else // make sure the player's movetype is correct - { - //if(self.hook == world && self.movetype == MOVETYPE_FLY) - if((self.hook == world || !self.hook.state) && self.movetype == MOVETYPE_FLY) - { - self.movetype = MOVETYPE_WALK; - } - }*/ - // note: The hook entity does the actual pulling -} - -void SetGrappleHookBindings() -{ - stuffcmd(self, strcat("alias +hook \"impulse ", ftos(GRAPHOOK_FIRE), "\"\n")); - stuffcmd(self, strcat("alias -hook \"impulse ", ftos(GRAPHOOK_RELEASE), "\"\n")); -} diff --git a/qcsrc/gamec/g_lights.c b/qcsrc/gamec/g_lights.c deleted file mode 100644 index 3f71bcde0..000000000 --- a/qcsrc/gamec/g_lights.c +++ /dev/null @@ -1,120 +0,0 @@ -float LOOP = 1; - -float DNOSHADOW = 2; -float DFOLLOW = 4; -.float light_lev; -.float lefty; -.vector color; -.string dtagname; - -/*QUAKED dynlight (0 1 0) (-8 -8 -8) (8 8 8) START_OFF NOSHADOW FOLLOW -Dynamic light. -Can do one of these things: sit still and be just a silly light, travel along a path, follow an entity around, attach to a tag on an entity. -It can spin around it's own axis in all the above cases. -If targeted, it will toggle between on or off. -keys: -"light_lev" light radius, default 200 -"color" light color in rgb and brightness, 1 1 1 produces bright white, up to 255 255 255 (nuclear blast), recommended values up to 1 1 1, default 1 1 1 -"style" lightstyle, same as for static lights -"angles" initial orientation -"avelocity" a vector value, the direction and speed it rotates in -"skin" cubemap number, must be 16 or above -"dtagname" will attach to this tag on the entity which "targetname" matches "target". If the "target" is either not an md3 model or is missing tags, it will attach to the targets origin. Note that the "target" must be visible to the light -"targetname" will toggle on and off when triggered -"target" if issued with a target, preferrably path_corner, it will move along the path. If also issued with the FOLLOW spawnflag, then this is the entity it will follow. If issued with the "tagname" key it will attach it to this targets tag called "tagname", does not work together with FOLLOW or path movement -"speed" the speed it will travel along the path, default 100 -flags: -"START_OFF" light will be in off state until targeted -"NOSHADOW" will not cast shadows in realtime lighting mode -"FOLLOW" will follow the entity which "targetname" matches "target" -*/ -void() dynlight_think = -{ - if(!self.owner) - remove(self); - - self.nextthink = 0.1; -}; -void() dynlight_find_aiment = -{ - local entity targ; - - targ = find(world, targetname, self.target); - self.movetype = MOVETYPE_FOLLOW; - self.aiment = targ; - self.owner = targ; - self.punchangle = targ.angles; - self.view_ofs = self.origin - targ.origin; - self.v_angle = self.angles - targ.angles; - self.nextthink = 0.1; - self.think = dynlight_think; -}; -void() dynlight_find_path = -{ - local entity targ; - - targ = find(world, targetname, self.target); - self.target = targ.target; - setorigin (self, targ.origin); - self.nextthink = self.ltime + 0.1; - self.think = train_next; -}; -void() dynlight_use = -{ - if (self.light_lev == 0) - self.light_lev = self.lefty; - else - self.light_lev = 0; -}; -void() dynlight = -{ - local entity targ; - - if (!self.light_lev) - self.light_lev = 200; - if (!self.color) - self.color = '1 1 1'; - self.lefty = self.light_lev; - self.use = dynlight_use; - setsize (self, '0 0 0', '0 0 0'); - setorigin (self, self.origin); - //self.pflags = PFLAGS_FULLDYNAMIC; - self.solid = SOLID_NOT; - //self.blocked = SUB_Null; - //if (self.spawnflags & DNOSHADOW) - // self.pflags = self.pflags + PFLAGS_NOSHADOW; - //if (self.spawnflags & START_OFF) - // self.light_lev = 0; - -//tag attaching - if (self.dtagname) - { - if (!self.target) - objerror ("dynlight: no target to follow"); - targ = find(world, targetname, self.target); - setattachment(self, targ, self.dtagname); - self.owner = targ; - self.think = dynlight_think; - return; - } - -// entity following - if (self.spawnflags & DFOLLOW) - { - if (!self.target) - objerror ("dynlight: no target to follow"); - self.nextthink = time + 0.1; - self.think = dynlight_find_aiment; - return; - } -// path following - if (self.target) -// if (!(self.spawnflags & DFOLLOW)) - { - self.movetype = MOVETYPE_PUSH; - if (!self.speed) - self.speed = 100; - self.nextthink = self.ltime + 0.1; - self.think = dynlight_find_path; - } -}; \ No newline at end of file diff --git a/qcsrc/gamec/g_subs.c b/qcsrc/gamec/g_subs.c deleted file mode 100644 index bb3c129fb..000000000 --- a/qcsrc/gamec/g_subs.c +++ /dev/null @@ -1,411 +0,0 @@ -void() SUB_Null = {}; - -void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove; -void() SUB_CalcMoveDone; -void() SUB_CalcAngleMoveDone; -//void() SUB_UseTargets; -void() SUB_Remove; - -void info_null (void) -{ -} - -/* -================== -SUB_Remove - -Remove self -================== -*/ -void SUB_Remove (void) -{ - remove (self); -} - -/* -================== -SUB_VanishOrRemove - -Makes client invisible or removes non-client -================== -*/ -void SUB_VanishOrRemove (entity ent) -{ - if (ent.flags & FL_CLIENT) - { - // vanish - ent.model = ""; - ent.effects = 0; - ent.glow_size = 0; - ent.pflags = 0; - } - else - { - // remove - remove (ent); - } -} - -void SUB_SetFade_Think (void) -{ - self.think = SUB_SetFade_Think; - self.nextthink = self.fade_time; - self.alpha = 1 - (time - self.fade_time) * self.fade_rate; - if (self.alpha < 0.01) - SUB_VanishOrRemove(self); - self.alpha = bound(0.01, self.alpha, 1); -} - -/* -================== -SUB_SetFade - -Fade 'ent' out when time >= 'when' -================== -*/ -void SUB_SetFade (entity ent, float when, float fadetime) -{ - //if (ent.flags & FL_CLIENT) // && ent.deadflag != DEAD_NO) - // return; - //ent.alpha = 1; - ent.fade_rate = 1/fadetime; - ent.fade_time = when; - ent.think = SUB_SetFade_Think; - ent.nextthink = when; -} - -/* -============= -SUB_CalcMove - -calculate self.velocity and self.nextthink to reach dest from -self.origin traveling at speed -=============== -*/ -void SUB_CalcMoveDone (void) -{ - // After moving, set origin to exact final destination - - setorigin (self, self.finaldest); - self.velocity = '0 0 0'; - self.nextthink = -1; - if (self.think1) - self.think1 (); -} - -void SUB_CalcMove (vector tdest, float tspeed, void() func) -{ - vector delta; - float traveltime; - - if (!tspeed) - objerror ("No speed is defined!"); - - self.think1 = func; - self.finaldest = tdest; - self.think = SUB_CalcMoveDone; - - if (tdest == self.origin) - { - self.velocity = '0 0 0'; - self.nextthink = self.ltime + 0.1; - return; - } - - delta = tdest - self.origin; - traveltime = vlen (delta) / tspeed; - - if (traveltime < 0.1) - { - self.velocity = '0 0 0'; - self.nextthink = self.ltime + 0.1; - return; - } - - self.velocity = delta * (1/traveltime); // QuakeC doesn't allow vector/float division - - self.nextthink = self.ltime + traveltime; -} - -void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeed, void() func) -{ - entity oldself; - - oldself = self; - self = ent; - - SUB_CalcMove (tdest, tspeed, func); - - self = oldself; -} - -/* -============= -SUB_CalcAngleMove - -calculate self.avelocity and self.nextthink to reach destangle from -self.angles rotating - -The calling function should make sure self.think is valid -=============== -*/ -void SUB_CalcAngleMoveDone (void) -{ - // After rotating, set angle to exact final angle - self.angles = self.finalangle; - self.avelocity = '0 0 0'; - self.nextthink = -1; - if (self.think1) - self.think1 (); -} - -void SUB_CalcAngleMove (vector destangle, float tspeed, void() func) -{ - vector delta; - float traveltime; - - if (!tspeed) - objerror ("No speed is defined!"); - - delta = destangle = self.angles; - traveltime = vlen (delta) / tspeed; - - self.avelocity = delta * (1 / traveltime); - - self.think1 = func; - self.finalangle = destangle; - - self.think = SUB_CalcAngleMoveDone; - self.nextthink = self.ltime + traveltime; -} - -void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeed, void() func) -{ - entity oldself; - - oldself = self; - self = ent; - - SUB_CalcAngleMove (destangle, tspeed, func); - - self = oldself; -} - -/* -================== -main - -unused but required by the engine -================== -*/ -void main (void) -{ - -} - -// Sound functions - -/* -================== -PointSound - -Play a sound at the given location -================== -*/ -void PointSound (vector org, string snd, float vol, float attn) -{ - entity speaker; - - speaker = spawn (); - setorigin (speaker, org); - sound (speaker, CHAN_BODY, snd, vol, attn); - remove (speaker); -} - -// Misc - -/* -================== -traceline_hitcorpse - -A version of traceline that must be used by SOLID_SLIDEBOX things that want to hit SOLID_CORPSE things with a trace attack -================== -*/ -void traceline_hitcorpse (entity source, vector v1, vector v2, float nomonst, entity forent) -{ - float oldsolid; - - oldsolid = source.solid; - source.solid = SOLID_BBOX; - - traceline (v1, v2, nomonst, forent); - - source.solid = oldsolid; -} - -/* -================== -findbetterlocation - -Returns a point at least 12 units away from walls -(useful for explosion animations, although the blast is performed where it really happened) -Ripped from DPMod -================== -*/ -vector findbetterlocation (vector org) -{ - vector loc; - - traceline (org, org - '12 0 0', TRUE, world); - if (trace_fraction < 1) - { - loc = trace_endpos; - traceline (loc, loc + '12 0 0', TRUE, world); - if (trace_fraction >= 1) - org = loc + '12 0 0'; - } - - traceline (org, org - '-12 0 0', TRUE, world); - if (trace_fraction < 1) - { - loc = trace_endpos; - traceline (loc, loc + '-12 0 0', TRUE, world); - if (trace_fraction >= 1) - org = loc + '-12 0 0'; - } - - traceline (org, org - '0 12 0' , TRUE, world); - if (trace_fraction < 1) - { - loc = trace_endpos; - traceline (loc, loc + '0 12 0', TRUE, world); - if (trace_fraction >= 1) - org = loc + '0 12 0'; - } - - traceline (org, org - '0 -12 0', TRUE, world); - if (trace_fraction < 1) - { - loc = trace_endpos; - traceline (loc, loc + '0 -12 0', TRUE, world); - if (trace_fraction >= 1) - org = loc + '0 -12 0'; - } - - traceline (org, org - '0 0 12' , TRUE, world); - if (trace_fraction < 1) - { - loc = trace_endpos; - traceline (loc, loc + '0 0 12', TRUE, world); - if (trace_fraction >= 1) - org = loc + '0 0 12'; - } - - traceline (org, org - '0 0 -12', TRUE, world); - if (trace_fraction < 1) - { - loc = trace_endpos; - traceline (loc, loc + '0 0 -12', TRUE, world); - if (trace_fraction >= 1) - org = loc + '0 0 -12'; - } - - return org; -} - -/* -================== -crandom - -Returns a random number between -1.0 and 1.0 -================== -*/ -float crandom (void) -{ - return 2 * (random () - 0.5); -} - -/* -================== -Angc used for animations -================== -*/ - - -float angc (float a1, float a2) -{ - float a; - - while (a1 > 180) - a1 = a1 - 360; - while (a1 < -179) - a1 = a1 + 360; - - while (a2 > 180) - a2 = a2 - 360; - while (a2 < -179) - a2 = a2 + 360; - - a = a1 - a2; - while (a > 180) - a = a - 360; - while (a < -179) - a = a + 360; - - return a; -} - - -/* -================ -InitTrigger -================ -*/ - -void() SetMovedir = -{ - if (self.movedir != '0 0 0') - self.movedir = normalize(self.movedir); - else - { - if (self.angles == '0 -1 0') - self.movedir = '0 0 1'; - else if (self.angles == '0 -2 0') - self.movedir = '0 0 -1'; - else - { - makevectors (self.angles); - self.movedir = v_forward; - } - } - - self.angles = '0 0 0'; -}; - -void() InitTrigger = -{ -// trigger angles are used for one-way touches. An angle of 0 is assumed -// to mean no restrictions, so use a yaw of 360 instead. - if (self.movedir == '0 0 0') - if (self.angles != '0 0 0') - SetMovedir (); - self.solid = SOLID_TRIGGER; - setmodel (self, self.model); // set size and link into world - self.movetype = MOVETYPE_NONE; - self.modelindex = 0; - self.model = ""; -}; - -void() InitSolidBSPTrigger = -{ -// trigger angles are used for one-way touches. An angle of 0 is assumed -// to mean no restrictions, so use a yaw of 360 instead. - if (self.movedir == '0 0 0') - if (self.angles != '0 0 0') - SetMovedir (); - self.solid = SOLID_BSP; - setmodel (self, self.model); // set size and link into world - self.movetype = MOVETYPE_PUSH; -// self.modelindex = 0; - self.model = ""; -}; diff --git a/qcsrc/gamec/g_tetris.c b/qcsrc/gamec/g_tetris.c deleted file mode 100644 index e7e362ddd..000000000 --- a/qcsrc/gamec/g_tetris.c +++ /dev/null @@ -1,746 +0,0 @@ -/* - -Installation: - -in weapons.qc add TetrisImpulses(); to ImpulseCommands - -in progs.src add tetris.qc after subs.qc -in client.qc add if (TetrisPreFrame()) return; to PlayerPreThink -in client.qc add if (TetrisPostFrame()) return; to PlayerPostThink - -*/ - -.vector tet_org; - -.float tetris_on, tet_time, tet_autodown; -.vector piece_pos; -.float piece_type, next_piece, tet_score, tet_lines; - -var float tet_high_score = 0; - -float TET_LINES = 20; -float TET_WIDTH = 10; -//character values -float TET_BORDER = 132; -float TET_BLOCKS = 132; // +1 = first color, +2, +3; -float TET_SPACE = 32; // blankness - - - -float TETKEY_UP = 1; -float TETKEY_DOWN = 2; -float TETKEY_LEFT = 4; -float TETKEY_RIGHT = 8; -float TETKEY_ROTLEFT = 16; -float TETKEY_ROTRIGHT = 32; - -float PIECES = 7; - -.float line1, line2, line3, line4, line5, line6, line7, -line8, line9, line10, line11, line12, line13, line14, line15, -line16, line17, line18, line19, line20; - - -float SVC_CENTERPRINTa = 26; - - -/* -********************************* - -Library Functions - -********************************* -*/ -void (float ln, float vl) SetLine = -{ - if (ln == 1) - self.line1 = vl; - else if (ln == 2) - self.line2 = vl; - else if (ln == 3) - self.line3 = vl; - else if (ln == 4) - self.line4 = vl; - else if (ln == 5) - self.line5 = vl; - else if (ln == 6) - self.line6 = vl; - else if (ln == 7) - self.line7 = vl; - else if (ln == 8) - self.line8 = vl; - else if (ln == 9) - self.line9 = vl; - else if (ln == 10) - self.line10 = vl; - else if (ln == 11) - self.line11 = vl; - else if (ln == 12) - self.line12 = vl; - else if (ln == 13) - self.line13 = vl; - else if (ln == 14) - self.line14 = vl; - else if (ln == 15) - self.line15 = vl; - else if (ln == 16) - self.line16 = vl; - else if (ln == 17) - self.line17 = vl; - else if (ln == 18) - self.line18 = vl; - else if (ln == 19) - self.line19 = vl; - else if (ln == 20) - self.line20 = vl; -}; - -float (float ln) GetLine = -{ - if (ln == 1) - return self.line1; - else if (ln == 2) - return self.line2; - else if (ln == 3) - return self.line3; - else if (ln == 4) - return self.line4; - else if (ln == 5) - return self.line5; - else if (ln == 6) - return self.line6; - else if (ln == 7) - return self.line7; - else if (ln == 8) - return self.line8; - else if (ln == 9) - return self.line9; - else if (ln == 10) - return self.line10; - else if (ln == 11) - return self.line11; - else if (ln == 12) - return self.line12; - else if (ln == 13) - return self.line13; - else if (ln == 14) - return self.line14; - else if (ln == 15) - return self.line15; - else if (ln == 16) - return self.line16; - else if (ln == 17) - return self.line17; - else if (ln == 18) - return self.line18; - else if (ln == 19) - return self.line19; - else if (ln == 20) - return self.line20; - else - return 0; -}; - -float(float x, float dat) GetXBlock = -{ - if (x == 1) - return dat & 3; - else if (x == 2) - return (dat & 12) / 4; - else if (x == 3) - return (dat & 48) / 16; - else if (x == 4) - return (dat & 192) / 64; - else if (x == 5) - return (dat & 768) / 256; - else if (x == 6) - return (dat & 3072) / 1024; - else if (x == 7) - return (dat & 12288) / 4096; - else if (x == 8) - return (dat & 49152) / 16384; - else if (x == 9) - return (dat & 196608) / 65536; - else if (x == 10) - return (dat & 786432) / 262144; - else - return 0; -}; - -float(float x, float dat, float new) SetXBlock = -{ - if (x == 1) - return (dat - (dat & 3)) | new; - else if (x == 2) - return (dat - (dat & 12)) | (new*4); - else if (x == 3) - return (dat - (dat & 48)) | (new*16); - else if (x == 4) - return (dat - (dat & 192)) | (new*64); - else if (x == 5) - return (dat - (dat & 768)) | (new*256); - else if (x == 6) - return (dat - (dat & 3072)) | (new*1024); - else if (x == 7) - return (dat - (dat & 12288)) | (new*4096); - else if (x == 8) - return (dat - (dat & 49152)) | (new*16384); - else if (x == 9) - return (dat - (dat & 196608)) | (new*65536); - else if (x == 10) - return (dat - (dat & 786432)) | (new*262144); - else - return dat; -}; - - -float(float x, float y) GetSquare = -{ - return GetXBlock(x, GetLine(y)); -}; - -void (float x, float y, float val) SetSquare = -{ - float dat; - - dat = GetLine(y); - dat = SetXBlock(x, dat, val & 3); - SetLine(y, dat); -}; - - - -vector(float pc) PieceShape = -{ - -/* -1 = - ## - ## -*/ - if (pc == 1) - return '20 20 0'; // 1 * 4 + 1 * 16 -/* -2 = - -#### -*/ - else if (pc == 2) - return '85 0 0'; - -/* -3 = - -### -# -*/ - else if (pc == 3) - return '21 1 0'; -/* -4 = - -# -### -*/ - else if (pc == 4) - return '1 21 0'; -/* -5 = -## - ## -*/ - else if (pc == 5) - return '5 20 0'; - -/* -6 = - ## -## -*/ - else if (pc == 6) - return '20 5 0'; - -/* -7 = - # -### -*/ - else if (pc == 7) - return '4 21 0'; - - - else - return '0 0 0'; - -} - -// do x 1..4 and y 1..4 in case of rotation -float(float x, float y, float rot, float pc) PieceMetric = -{ - float t; - vector piece_dat; - - // return bits of a piece - if (rot == 1) // 90 degrees - { - t = y; - y = x; - x = 5 - t; - } - else if (rot == 2)//180 - { - x = 5 - x; - y = 3 - y; - } - else if (rot == 3) // 270 - { - t = y; - y = 5 - x; - x = t; - } - if (x < 1 || y < 1 || x > 4 || y > 2) - return 0; - piece_dat = PieceShape(pc); - if (y == 1) - return GetXBlock(x, piece_dat_x); // first row - else if (y == 2) - return GetXBlock(x, piece_dat_y); // second row - else if (y == 3) - return GetXBlock(x, piece_dat_z); // third row (doesn't exist) - else - return 0; // illegal parms -}; -/* -********************************* - -Draw - -********************************* -*/ - - -/* some prydon gate functions to make life easier.... - -somewhat modified because we don't need all the fanciness Prydon Gate is capable of - -*/ - -void(float c1, float c2, float c3, float c4, float c5, float c6) p6 = -{ - WriteChar(MSG_ONE, c1); - WriteChar(MSG_ONE, c2); - WriteChar(MSG_ONE, c3); - WriteChar(MSG_ONE, c4); - WriteChar(MSG_ONE, c5); - WriteChar(MSG_ONE, c6); -}; - -float(float num, float dig) pnum = -{ - local float f, i; - if (num < 0) - { - WriteChar(MSG_ONE, 45); - num = 0 - num; - } - f = floor(num / 10); - num = num - (f * 10); - if (f) - dig = pnum(f, dig+1); - else - { - // pad to 6 - for (i = 0; i < (5 - dig); i = i + 1) - WriteChar(MSG_ONE, TET_SPACE); - } - WriteChar(MSG_ONE, 48 + num); - return dig; -}; - -void (float ln) DrawLine = -{ - float x, d; - WriteChar(MSG_ONE, TET_BORDER); - - for (x = 1; x <= TET_WIDTH; x = x + 1) - { - d = GetSquare(x, ln); - if (d) - WriteChar(MSG_ONE, TET_BLOCKS + d); - else - WriteChar(MSG_ONE, TET_SPACE); - } - WriteChar(MSG_ONE, TET_BORDER); -} - -void (float pc, float ln) DrawPiece = -{ - float x, d, piece_ln, color; - vector piece_dat; - color = pc & 3; - if (color == 0) // 4 - color = 1; - WriteChar(MSG_ONE, TET_SPACE); // pad to 6 - - piece_dat = PieceShape(pc); - if (ln == 1) - piece_ln = piece_dat_x; - else - piece_ln = piece_dat_y; - for (x = 1; x <= 4; x = x + 1) - { - d = GetXBlock(x, piece_ln) * color; - if (d) - WriteChar(MSG_ONE, TET_BLOCKS + d); - else - WriteChar(MSG_ONE, TET_SPACE); - } - WriteChar(MSG_ONE, TET_SPACE); // pad to 6 -} -void() Draw_Tetris = -{ - float i; - msg_entity = self; - WriteChar(MSG_ONE, SVC_CENTERPRINTa); - // decoration - for (i = 1; i <= (TET_WIDTH + 2); i = i + 1) - WriteChar(MSG_ONE, TET_BORDER); - p6(' ', ' ', ' ', ' ', ' ', ' '); - WriteChar(MSG_ONE, 10); - for (i = 1; i <= TET_LINES; i = i + 1) - { - DrawLine(i); - if (i == 1) - p6(' ', 'N', 'E', 'X', 'T', ' '); - else if (i == 3) - DrawPiece(self.next_piece, 1); - else if (i == 4) - DrawPiece(self.next_piece, 2); - else if (i == 6) - p6(' ', 'L', 'I', 'N', 'E', 'S'); - else if (i == 7) - pnum(self.tet_lines, 0); - else if (i == 9) - p6(' ', 'S', 'C', 'O', 'R', 'E'); - else if (i == 10) - pnum(self.tet_score, 0); - else if (i == 12) - p6(' ', 'H', 'I', 'G', 'H', ' '); - else if (i == 13) - p6(' ', 'S', 'C', 'O', 'R', 'E'); - else if (i == 14) - pnum(tet_high_score, 0); - else if (i == 16) - p6(' ', 'L', 'E', 'V', 'E', 'L'); - else if (i == 17) - pnum(floor(self.tet_lines / 20)+ 1, 0); - else - p6(' ', ' ', ' ', ' ', ' ', ' '); - WriteChar(MSG_ONE, 10); - } - // decoration - - for (i = 1; i <= (TET_WIDTH + 2); i = i + 1) - WriteChar(MSG_ONE, TET_BORDER); - p6(' ', ' ', ' ', ' ', ' ', ' '); - WriteChar(MSG_ONE, 10); - WriteChar(MSG_ONE, 0); -} -/* -********************************* - -Game Functions - -********************************* -*/ - -// reset the game -void() ResetTetris = -{ - float i; - - for (i=1; i<=TET_LINES; i = i + 1) - SetLine(i, 0); - self.piece_pos = '0 0 0'; - self.piece_type = 0; - self.next_piece = self.tet_lines = self.tet_score = 0; - -}; - -void () Tet_GameOver = -{ - centerprint(self, "Game Over"); - self.tetris_on = 0; - ResetTetris(); - self.movetype = MOVETYPE_WALK; -}; - - - -/* -********************************* - -Game Mechanics - -********************************* -*/ -float() RandomPiece = -{ - return floor(random() * PIECES) + 1; -}; - -void(float n) TetAddScore = -{ - self.tet_score = self.tet_score + n; - if (self.tet_score > tet_high_score) - tet_high_score = self.tet_score; -}; -float CheckMetrics(float piece, float orgx, float orgy, float rot) = -{ - // check to see if the piece, if moved to the locations will overlap - - float x, y; - // why did I start counting from 1, damnit - orgx = orgx - 1; - orgy = orgy - 1; - - for (y = 1; y < 5; y = y + 1) - { - for (x = 1; x < 5; x = x + 1) - { - if (PieceMetric(x, y, rot, piece)) - { - if (GetSquare(x + orgx, y + orgy)) - return FALSE; // uhoh, gonna hit something. - if (x+orgx<1 || x+orgx > TET_WIDTH || y+orgy<1 || y+orgy> TET_LINES) - return FALSE; // ouside the level - } - } - } - return TRUE; -} - -void ClearPiece(float piece, float orgx, float orgy, float rot) = -{ - - float x, y; - // why did I start counting from 1, damnit - orgx = orgx - 1; - orgy = orgy - 1; - - for (y = 1; y < 5; y = y + 1) - { - for (x = 1; x < 5; x = x + 1) - { - if (PieceMetric(x, y, rot, piece)) - { - SetSquare(x + orgx, y + orgy, 0); - } - } - } -} -void CementPiece(float piece, float orgx, float orgy, float rot) = -{ - float color; - float x, y; - // why did I start counting from 1, damnit - orgx = orgx - 1; - orgy = orgy - 1; - - color = piece & 3; - if (color == 0) // 4 - color = 1; - - for (y = 1; y < 5; y = y + 1) - { - for (x = 1; x < 5; x = x + 1) - { - if (PieceMetric(x, y, rot, piece)) - { - SetSquare(x + orgx, y + orgy, color); - } - } - } -} - -float LINE_LOW = 349525; -float LINE_HIGH = 699050; // above number times 2 - -void() CompletedLines = -{ - float y, cleared, ln; - - cleared = 0; - y = TET_LINES; - while(y >= 1) - { - ln = GetLine(y); - if (((ln & LINE_LOW) | ((ln & LINE_HIGH)/2)) == LINE_LOW) - cleared = cleared + 1; - else - y = y - 1; - ln = GetLine(y - cleared); - SetLine(y, ln); - } - self.tet_lines = self.tet_lines + cleared; - TetAddScore(cleared * cleared * 10); -}; - -void(float keyss) HandleGame = -{ - - // first off, we need to see if we need a new piece - vector check_pos; - float brand_new; - brand_new = 0; - if (self.tet_time > time) - return; - self.tet_time = time + 0.1; - - - if (self.piece_type == 0) - { - self.piece_pos = '5 1 0'; // that's about middle top, we count from 1 ARGH - if (self.next_piece) - self.piece_type = self.next_piece; - else - self.piece_type = RandomPiece(); - self.next_piece = RandomPiece(); - keyss = 0; // no movement first frame - self.tet_autodown = time + 0.2; - brand_new = 1; - } - else - ClearPiece(self.piece_type, self.piece_pos_x, self.piece_pos_y, self.piece_pos_z); - - // next we need to check the piece metrics against what's on the level - // based on the key order - - check_pos = self.piece_pos; - - if (keyss & TETKEY_RIGHT) - check_pos_x = check_pos_x + 1; - else if (keyss & TETKEY_LEFT) - check_pos_x = check_pos_x - 1; - else if (keyss & TETKEY_ROTRIGHT) - check_pos_z = check_pos_z + 1; - else if (keyss & TETKEY_ROTLEFT) - check_pos_z = check_pos_z - 1; - // bounds check - if (check_pos_z > 3) - check_pos_z = 0; - else if (check_pos_z < 0) - check_pos_z = 3; - - // reality check - if (CheckMetrics(self.piece_type, check_pos_x, check_pos_y, check_pos_z)) - self.piece_pos = check_pos; - else if (brand_new) - Tet_GameOver(); - check_pos = self.piece_pos; - if (keyss & TETKEY_DOWN) - check_pos_y = check_pos_y + 1; - else if (self.tet_autodown < time) - { - check_pos_y = check_pos_y + 1; - self.tet_autodown = time + 1 / (floor(self.tet_lines / 20) + 1); - } - if (CheckMetrics(self.piece_type, check_pos_x, check_pos_y, check_pos_z)) - self.piece_pos = check_pos; - else - { - CementPiece(self.piece_type, self.piece_pos_x, self.piece_pos_y, self.piece_pos_z); - TetAddScore(1); - CompletedLines(); - self.piece_type = 0; - return; - } - CementPiece(self.piece_type, self.piece_pos_x, self.piece_pos_y, self.piece_pos_z); -}; - -/* -********************************* - -Important Linking Into Quake stuff - -********************************* -*/ - - -void() TetrisImpulses = -{ - if (self.impulse == 200) - { - self.tetris_on = 1; - ResetTetris(); - self.tet_org = self.origin; - self.movetype = MOVETYPE_NOCLIP; - stuffcmd(self, "cl_bob 0\ncl_rollangle 0\n"); - } -}; - - -float() TetrisPreFrame = -{ - if (!self.tetris_on) - return 0; - - self.tet_org = self.origin; - if (self.tet_time > time) - return 1; - Draw_Tetris(); - return 1; - -}; -float(float v) frik_anglemoda = -{ - return v - floor(v/360) * 360; -}; -float (float y1, float y2) angcompa = -{ - y1 = frik_anglemoda(y1); - y2 = frik_anglemoda(y2); - - local float answer; - answer = y1 - y2; - if (answer > 180) - answer = answer - 360; - else if (answer < -180) - answer = answer + 360; - return answer; -}; - - -float() TetrisPostFrame = -{ - vector mov; - float keysa, norm; - - keysa = 0; - - if (!self.tetris_on) - return 0; - if (self.origin != self.tet_org) - { - mov = vectoangles(self.origin - self.tet_org); - self.origin = self.tet_org; - - norm = angcompa(self.v_angle_y, mov_y); - - if (norm > -80 && norm < 80) - keysa = keysa | TETKEY_UP; - if (norm > 10 && norm < 170) - keysa = keysa | TETKEY_RIGHT; - if (norm > 100 || norm < -260) - keysa = keysa | TETKEY_DOWN; - if (norm > -170 && norm < -10) - keysa = keysa | TETKEY_LEFT; - } - if (self.button0) - keysa = keysa | TETKEY_ROTRIGHT; - if (self.button2) - keysa = keysa | TETKEY_ROTLEFT; - HandleGame(keysa); - return 1; -}; - diff --git a/qcsrc/gamec/g_triggers.c b/qcsrc/gamec/g_triggers.c deleted file mode 100644 index ba9cb0fea..000000000 --- a/qcsrc/gamec/g_triggers.c +++ /dev/null @@ -1,420 +0,0 @@ - -void() SUB_UseTargets; - -void() DelayThink = -{ - activator = self.enemy; - SUB_UseTargets (); - remove(self); -}; - -/* -============================== -SUB_UseTargets - -the global "activator" should be set to the entity that initiated the firing. - -If self.delay is set, a DelayedUse entity will be created that will actually -do the SUB_UseTargets after that many seconds have passed. - -Centerprints any self.message to the activator. - -Removes all entities with a targetname that match self.killtarget, -and removes them, so some events can remove other triggers. - -Search for (string)targetname in all entities that -match (string)self.target and call their .use function - -============================== -*/ -void() SUB_UseTargets = -{ - local entity t, stemp, otemp, act; - -// -// check for a delay -// - if (self.delay) - { - // create a temp object to fire at a later time - t = spawn(); - t.classname = "DelayedUse"; - t.nextthink = time + self.delay; - t.think = DelayThink; - t.enemy = activator; - t.message = self.message; - t.killtarget = self.killtarget; - t.target = self.target; - return; - } - - -// -// print the message -// - if (activator.classname == "player" && self.message != "") - { - centerprint (activator, self.message); - if (!self.noise) - sound (activator, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM); - } - -// -// kill the killtagets -// - if (self.killtarget) - { - t = world; - do - { - t = find (t, targetname, self.killtarget); - if (!t) - return; - remove (t); - } while ( 1 ); - } - -// -// fire targets -// - if (self.target) - { - act = activator; - t = world; - do - { - t = find (t, targetname, self.target); - if (!t) - { - return; - } - stemp = self; - otemp = other; - self = t; - other = stemp; - if (self.use) - self.use (); - self = stemp; - other = otemp; - activator = act; - } while ( 1 ); - } - - -}; - - - -void() trigger_reactivate = -{ - self.solid = SOLID_TRIGGER; -}; - -//============================================================================= - -float SPAWNFLAG_NOMESSAGE = 1; -float SPAWNFLAG_NOTOUCH = 1; - -// the wait time has passed, so set back up for another activation -void() multi_wait = -{ - if (self.max_health) - { - self.health = self.max_health; - self.takedamage = DAMAGE_YES; - self.solid = SOLID_BBOX; - } -}; - - -// the trigger was just touched/killed/used -// self.enemy should be set to the activator so it can be held through a delay -// so wait for the delay time before firing -void() multi_trigger = -{ - if (self.nextthink > time) - { - return; // allready been triggered - } - - if (self.classname == "trigger_secret") - { - if (self.enemy.classname != "player") - return; - found_secrets = found_secrets + 1; - WriteByte (MSG_ALL, SVC_FOUNDSECRET); - } - - if (self.noise) - sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM); - -// don't trigger again until reset - self.takedamage = DAMAGE_NO; - - activator = self.enemy; - - SUB_UseTargets(); - - if (self.wait > 0) - { - self.think = multi_wait; - self.nextthink = time + self.wait; - } - else - { // we can't just remove (self) here, because this is a touch function - // called wheil C code is looping through area links... - self.touch = SUB_Null; - - self.nextthink = time + 0.1; - self.think = SUB_Remove; - } -}; - -void() multi_use = -{ - self.enemy = activator; - multi_trigger(); -}; - -void() multi_touch = -{ - if (other.classname != "player") - return; - -// if the trigger has an angles field, check player's facing direction - if (self.movedir != '0 0 0') - { - makevectors (other.angles); - if (v_forward * self.movedir < 0) - return; // not facing the right way - } - - self.enemy = other; - multi_trigger (); -}; - -void multi_eventdamage (vector hitloc, float damage, entity inflictor, entity attacker, float deathtype) -{ - if (!self.takedamage) - return; - self.health = self.health - damage; - if (self.health <= 0) - { - self.enemy = attacker; - multi_trigger(); - } -} - -/*QUAKED trigger_multiple (.5 .5 .5) ? notouch -Variable sized repeatable trigger. Must be targeted at one or more entities. If "health" is set, the trigger must be killed to activate each time. -If "delay" is set, the trigger waits some time after activating before firing. -"wait" : Seconds between triggerings. (.2 default) -If notouch is set, the trigger is only fired by other entities, not by touching. -NOTOUCH has been obsoleted by trigger_relay! -sounds -1) secret -2) beep beep -3) large switch -4) -set "message" to text string -*/ -void() trigger_multiple = -{ - if (self.sounds == 1) - { - precache_sound ("misc/secret.wav"); - self.noise = "misc/secret.wav"; - } - else if (self.sounds == 2) - { - precache_sound ("misc/talk.wav"); - self.noise = "misc/talk.wav"; - } - else if (self.sounds == 3) - { - precache_sound ("misc/trigger1.wav"); - self.noise = "misc/trigger1.wav"; - } - - if (!self.wait) - self.wait = 0.2; - self.use = multi_use; - - InitTrigger (); - - if (self.health) - { - if (self.spawnflags & SPAWNFLAG_NOTOUCH) - objerror ("health and notouch don't make sense\n"); - self.max_health = self.health; - self.event_damage = multi_eventdamage; - self.takedamage = DAMAGE_YES; - self.solid = SOLID_BBOX; - setorigin (self, self.origin); // make sure it links into the world - } - else - { - if ( !(self.spawnflags & SPAWNFLAG_NOTOUCH) ) - { - self.touch = multi_touch; - } - } -}; - - -/*QUAKED trigger_once (.5 .5 .5) ? notouch -Variable sized trigger. Triggers once, then removes itself. You must set the key "target" to the name of another object in the level that has a matching -"targetname". If "health" is set, the trigger must be killed to activate. -If notouch is set, the trigger is only fired by other entities, not by touching. -if "killtarget" is set, any objects that have a matching "target" will be removed when the trigger is fired. -if "angle" is set, the trigger will only fire when someone is facing the direction of the angle. Use "360" for an angle of 0. -sounds -1) secret -2) beep beep -3) large switch -4) -set "message" to text string -*/ -void() trigger_once = -{ - self.wait = -1; - trigger_multiple(); -}; - -//============================================================================= - -/*QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8) -This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages. -*/ -void() trigger_relay = -{ - self.use = SUB_UseTargets; -}; - - -//============================================================================= - - -void() counter_use = -{ - self.count = self.count - 1; - if (self.count < 0) - return; - - if (self.count != 0) - { - if (activator.classname == "player" - && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) - { - if (self.count >= 4) - centerprint (activator, "There are more to go..."); - else if (self.count == 3) - centerprint (activator, "Only 3 more to go..."); - else if (self.count == 2) - centerprint (activator, "Only 2 more to go..."); - else - centerprint (activator, "Only 1 more to go..."); - } - return; - } - - if (activator.classname == "player" - && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) - centerprint(activator, "Sequence completed!"); - self.enemy = activator; - multi_trigger (); -}; - -/*QUAKED trigger_counter (.5 .5 .5) ? nomessage -Acts as an intermediary for an action that takes multiple inputs. - -If nomessage is not set, t will print "1 more.. " etc when triggered and "sequence complete" when finished. - -After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself. -*/ -void() trigger_counter = -{ - self.wait = -1; - if (!self.count) - self.count = 2; - - self.use = counter_use; -}; - -.float triggerhurttime; -void() hurt_touch = -{ - if (other.takedamage) - if (other.triggerhurttime < time) - { - other.triggerhurttime = time + 1; - Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0'); - } - - return; -}; - -/*QUAKED trigger_hurt (.5 .5 .5) ? -Any object touching this will be hurt -set dmg to damage amount -defalt dmg = 5 -*/ -void() trigger_hurt = -{ - InitTrigger (); - self.touch = hurt_touch; - if (!self.dmg) - self.dmg = 1000; - if (!self.message) - self.message = "was in the wrong place."; -}; - -//void() target_speaker_use = {sound(self, CHAN_VOICE, self.noise, 1, 1);} -//void() target_speaker = {self.use = target_speaker_use;} - -void() target_speaker = -{ -if(self.noise) { - precache_sound (self.noise); - ambientsound (self.origin, self.noise, 1, ATTN_STATIC); -} -//remove(self); -}; - - -/* -void() sparksthink = -{ - self.nextthink = time + 0.1; - - if(random() < self.wait) { - te_spark(self.origin,'0 0 -1',self.cnt); - } -} - - -void() func_sparks = -{ - self.think = sparksthink; - self.nextthink = time + 0.2; - - // self.cnt is the amount of sparks that one burst will spawn - if(self.cnt < 1) { - self.cnt = 25.0; // nice default value - } - - // self.wait is the probability that a sparkthink will spawn a spark shower - // range: 0 - 1, but 0 makes little sense, so... - if(self.wait < 0.05) { - self.wait = 0.25; // nice default value - } - - // sound - if(self.noise) { - precache_sound (self.noise); - ambientsound (self.origin, self.noise, 1, ATTN_STATIC); - } -} -*/ - - diff --git a/qcsrc/gamec/g_violence.c b/qcsrc/gamec/g_violence.c deleted file mode 100644 index bc042f3e2..000000000 --- a/qcsrc/gamec/g_violence.c +++ /dev/null @@ -1,65 +0,0 @@ -void GibDamage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) -{ - float r; - r = random (); - if (r < 0.60) - sound (self, CHAN_IMPACT, "misc/gib_splat01.wav", 1, ATTN_NORM); - else if (r < 0.65) - sound (self, CHAN_IMPACT, "misc/gib_splat02.wav", 1, ATTN_NORM); - else if (r < 0.70) - sound (self, CHAN_IMPACT, "misc/gib_splat03.wav", 1, ATTN_NORM); - else if (r < 0.75) - sound (self, CHAN_IMPACT, "misc/gib_splat04.wav", 1, ATTN_NORM); - te_blood (self.origin + '0 0 1', '0 0 30', 10); - self.health = self.health - damage; - if (self.health <= -200) - { - self.event_damage = SUB_Null; - SUB_VanishOrRemove (self); - } -} - - -void GibTouch () -{ - GibDamage (other, other, 1000, 0, self.origin, '0 0 0'); -} - -// changes by LordHavoc on 03/30/04 -// TossGib now takes a gib entity so it can be used for tossing heads -// gib.velocity now uses randomvec() instead of a bunch of manual random calls -// merged Gib() into PlayerGib() -void TossGib (entity gib, string mdlname, vector org, vector v, float destroyontouch) -{ - if (gib == world) - { - gib = spawn (); - gib.deadflag = DEAD_DEAD; - } - - // don't set his classname to something else or it'll screw up a lot of stuff - if(gib.classname != "player") - gib.classname = "gib"; - gib.iscreature = TRUE; - gib.movetype = MOVETYPE_BOUNCE; - gib.solid = SOLID_CORPSE; - gib.skin = 0; - gib.effects = 0; - - setmodel (gib, mdlname); - setsize (gib, '-8 -8 -8', '8 8 8'); - setorigin (gib, org); - - gib.health = -1; - gib.takedamage = DAMAGE_YES; - gib.damageforcescale = 3.5; - gib.event_damage = GibDamage; - if (destroyontouch == 1) - gib.touch = GibTouch; - - gib.velocity = v + randomvec() * 450; - gib.avelocity = randomvec() * 300; - gib.oldvelocity = gib.velocity; - - SUB_SetFade (gib, time + 12 + random () * 4, 1); -} diff --git a/qcsrc/gamec/g_world.c b/qcsrc/gamec/g_world.c deleted file mode 100644 index f5915b97c..000000000 --- a/qcsrc/gamec/g_world.c +++ /dev/null @@ -1,644 +0,0 @@ - -void worldspawn (void) -{ - - // Precache all player models - // Workaround for "invisible players" - precache_model("models/player/carni.zym"); - precache_model("models/player/crash.zym"); - precache_model("models/player/grunt.zym"); - precache_model("models/player/headhunter.zym"); - precache_model("models/player/insurrectionist.zym"); - precache_model("models/player/jeandarc.zym"); - precache_model("models/player/lurk.zym"); - precache_model("models/player/lycanthrope.zym"); - precache_model("models/player/marine.zym"); - precache_model("models/player/nexus.zym"); - precache_model("models/player/pyria.zym"); - precache_model("models/player/shock.zym"); - precache_model("models/player/skadi.zym"); - precache_model("models/player/specop.zym"); - precache_model("models/player/visitant.zym"); - - //precache_model ("progs/beam.mdl"); - precache_model ("models/bullet.mdl"); - precache_model ("models/casing_bronze.mdl"); - precache_model ("models/casing_shell.mdl"); - precache_model ("models/casing_steel.mdl"); - precache_model ("models/ebomb.mdl"); - precache_model ("models/elaser.mdl"); - precache_model ("models/flash.md3"); - precache_model ("models/gibs/bloodyskull.md3"); - precache_model ("models/gibs/chunk.mdl"); - precache_model ("models/gibs/eye.md3"); - precache_model ("models/gibs/gib1.md3"); - precache_model ("models/gibs/gib2.md3"); - precache_model ("models/gibs/gib3.md3"); - precache_model ("models/gibs/gib4.md3"); - precache_model ("models/gibs/gib5.md3"); - precache_model ("models/gibs/gib6.md3"); - precache_model ("models/grenademodel.md3"); - precache_model ("models/hagarmissile.mdl"); - precache_model ("models/items/a_bullets.mdl"); - precache_model ("models/items/a_cells.md3"); - precache_model ("models/items/a_rockets.md3"); - precache_model ("models/items/a_shells.md3"); - precache_model ("models/items/g_a1.md3"); - precache_model ("models/items/g_a25.md3"); - precache_model ("models/items/g_h1.md3"); - precache_model ("models/items/g_h25.md3"); - precache_model ("models/items/g_h100.md3"); - precache_model ("models/items/g_invincible.md3"); - precache_model ("models/items/g_strength.md3"); - precache_model ("models/laser.mdl"); - precache_model ("models/misc/chatbubble.spr"); - precache_model ("models/nexflash.md3"); - precache_model ("models/plasma.mdl"); - precache_model ("models/plasmatrail.mdl"); - precache_model ("models/rocket.md3"); - precache_model ("models/sprites/grenadeexplosion.spr32"); - precache_model ("models/sprites/hagarexplosion.spr32"); - precache_model ("models/sprites/muzzleflash.spr32"); - //precache_model ("models/sprites/plasmahitwall.spr32"); - //precache_model ("models/sprites/plasmashot.spr32"); - precache_model ("models/sprites/rocketexplosion.spr32"); - precache_model ("models/tracer.mdl"); - precache_model ("models/uziflash.md3"); - precache_model ("models/weapons/g_crylink.md3"); - precache_model ("models/weapons/g_electro.md3"); - precache_model ("models/weapons/g_gl.md3"); - precache_model ("models/weapons/g_hagar.md3"); - precache_model ("models/weapons/g_nex.md3"); - precache_model ("models/weapons/g_rl.md3"); - precache_model ("models/weapons/g_shotgun.md3"); - precache_model ("models/weapons/g_uzi.md3"); - precache_model ("models/weapons/v_crylink.md3"); - precache_model ("models/weapons/v_electro.md3"); - precache_model ("models/weapons/v_gl.md3"); - precache_model ("models/weapons/v_hagar.md3"); - precache_model ("models/weapons/v_laser.md3"); - precache_model ("models/weapons/v_nex.md3"); - precache_model ("models/weapons/v_rl.md3"); - precache_model ("models/weapons/v_shotgun.md3"); - precache_model ("models/weapons/v_uzi.md3"); - precache_model ("models/weapons/w_crylink.zym"); - precache_model ("models/weapons/w_electro.zym"); - precache_model ("models/weapons/w_gl.zym"); - precache_model ("models/weapons/w_hagar.zym"); - precache_model ("models/weapons/w_laser.zym"); - precache_model ("models/weapons/w_nex.zym"); - precache_model ("models/weapons/w_rl.zym"); - precache_model ("models/weapons/w_shotgun.zym"); - precache_model ("models/weapons/w_uzi.zym"); - precache_sound ("announcer/1fragleft.wav"); - precache_sound ("announcer/1minuteremains.wav"); - precache_sound ("announcer/2fragsleft.wav"); - precache_sound ("announcer/3fragsleft.wav"); - precache_sound ("announcer/welcometonexuiz.wav"); - precache_sound ("misc/armor1.wav"); - precache_sound ("misc/armor25.wav"); - precache_sound ("misc/armorimpact.wav"); - precache_sound ("misc/bodyimpact1.wav"); - precache_sound ("misc/bodyimpact2.wav"); - precache_sound ("misc/gib.wav"); - precache_sound ("misc/gib_splat01.wav"); - precache_sound ("misc/gib_splat02.wav"); - precache_sound ("misc/gib_splat03.wav"); - precache_sound ("misc/gib_splat04.wav"); - //precache_sound ("misc/h2ohit.wav"); - precache_sound ("misc/hit.wav"); - precache_sound ("misc/hitground1.wav"); - precache_sound ("misc/hitground2.wav"); - precache_sound ("misc/hitground3.wav"); - precache_sound ("misc/hitground4.wav"); - precache_sound ("misc/itempickup.wav"); - precache_sound ("misc/itemrespawn.wav"); - precache_sound ("misc/jumppad.wav"); - precache_sound ("misc/mediumhealth.wav"); - precache_sound ("misc/megahealth.wav"); - precache_sound ("misc/minihealth.wav"); - precache_sound ("misc/powerup.wav"); - precache_sound ("misc/talk.wav"); - precache_sound ("misc/teleport.wav"); - precache_sound ("plats/medplat1.wav"); - precache_sound ("plats/medplat2.wav"); - precache_sound ("player/lava.wav"); - precache_sound ("player/slime.wav"); - precache_sound ("weapons/crylink.wav"); - precache_sound ("weapons/crylink2.wav"); - precache_sound ("weapons/electro_fire.wav"); - precache_sound ("weapons/electro_fly.wav"); - precache_sound ("weapons/electro_impact.wav"); - precache_sound ("weapons/grenade_bounce.wav"); - precache_sound ("weapons/grenade_fire.wav"); - precache_sound ("weapons/grenade_impact.wav"); - precache_sound ("weapons/hagar_fire.wav"); - precache_sound ("weapons/hagexp1.wav"); - precache_sound ("weapons/hagexp2.wav"); - precache_sound ("weapons/hagexp3.wav"); - precache_sound ("weapons/lasergun_fire.wav"); - precache_sound ("weapons/laserimpact.wav"); - precache_sound ("weapons/nexfire.wav"); - precache_sound ("weapons/neximpact.wav"); - precache_sound ("weapons/ric1.wav"); - precache_sound ("weapons/ric2.wav"); - precache_sound ("weapons/ric3.wav"); - precache_sound ("weapons/rocket_fire.wav"); - precache_sound ("weapons/rocket_fly.wav"); - precache_sound ("weapons/rocket_impact.wav"); - precache_sound ("weapons/shotgun_fire.wav"); - precache_sound ("weapons/tink1.wav"); - precache_sound ("weapons/uzi_fire.wav"); - precache_sound ("weapons/weapon_switch.wav"); - precache_sound ("weapons/weaponpickup.wav"); - - - - // plays music for the level if there is any - if (self.noise) - { - precache_sound (self.noise); - ambientsound ('0 0 0', self.noise, 1.00, ATTN_NONE); - } - - // 0 normal - lightstyle(0, "m"); - - // 1 FLICKER (first variety) - lightstyle(1, "mmnmmommommnonmmonqnmmo"); - - // 2 SLOW STRONG PULSE - lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"); - - // 3 CANDLE (first variety) - lightstyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg"); - - // 4 FAST STROBE - lightstyle(4, "mamamamamama"); - - // 5 GENTLE PULSE 1 - lightstyle(5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj"); - - // 6 FLICKER (second variety) - lightstyle(6, "nmonqnmomnmomomno"); - - // 7 CANDLE (second variety) - lightstyle(7, "mmmaaaabcdefgmmmmaaaammmaamm"); - - // 8 CANDLE (third variety) - lightstyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa"); - - // 9 SLOW STROBE (fourth variety) - lightstyle(9, "aaaaaaaazzzzzzzz"); - - // 10 FLUORESCENT FLICKER - lightstyle(10, "mmamammmmammamamaaamammma"); - - // 11 SLOW PULSE NOT FADE TO BLACK - lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba"); - - // styles 32-62 are assigned by the light program for switchable lights - - // 63 testing - lightstyle(63, "a"); - - InitGameplayMode(); - //if (cvar("g_domination")) - // dom_init(); -} - -void light (void) -{ - makestatic (self); -} - - -// reads and alters data/maplist.cfg (sliding it one line), and returns a -// strzoned string containing the next map -string() Nex_RotateMapList = -{ - local float lHandle; - local string lNextMap; - local string lCurrentMap; - local string lBuffer; - - lHandle = fopen( "maplist.cfg", FILE_READ ); - if( lHandle < 0 ) { - fclose( lHandle ); - // restart the current map if no other map is not found - return strzone( mapname ); - } - - // get the first line that will be moved to the end later - lCurrentMap = strzone( fgets( lHandle ) ); - if( !lCurrentMap ) { - fclose( lHandle ); - // restart the current map if no other map is not found - return strzone( mapname ); - } - - // now get the second line which is the map that should be loaded next - lBuffer = fgets( lHandle ); - // if there isnt a second line, nothing needs to be rotated - if( !lBuffer ) { - fclose( lHandle ); - strunzone( lCurrentMap ); - // restart the current map if no other map is not found - return strzone( mapname ); - } - - // since lBuffer holds the next map, it is assigned to nextmap - lNextMap = strzone( lBuffer ); - - // since fgets uses its own buffer we need to move lBuffer to a tempstring - // before reading the next line (or lBuffer will be lost) - lBuffer = strcat( lBuffer ); - - // read in the rest of the list - while( 1 ) { - local string lLine; - - lLine = fgets( lHandle ); - if( !lLine ) { - break; - } - - lBuffer = strcat( lBuffer, "\n", lLine ); - } - // rotate the list - lBuffer = strcat( lBuffer, "\n", lCurrentMap ); - - // dismiss lCurrentmap now - strunzone( lCurrentMap ); - - // and close the file handle - fclose( lHandle ); - - // open the maplist for output this one - lHandle = fopen( "maplist.cfg", FILE_WRITE ); - if( lHandle < 0 ) { - // this shouldnt happen! - // print a warning/error message - dprint( "Couldn't open ", "maplist.cfg", " for output!\n" ); - - strunzone( lNextMap ); - - // we return the currently running map - return strzone( mapname ); - } - - fputs( lHandle, lBuffer ); - - fclose( lHandle ); - - return lNextMap; -}; - -void() GotoNextMap = -{ - //local string nextmap; - //local float n, nummaps; - //local string s; - string exit_cfg; - if (alreadychangedlevel) - return; - alreadychangedlevel = TRUE; - - // if an exit cfg is defined by exiting map, exec it. - exit_cfg = cvar_string("exit_cfg"); - if(exit_cfg != "") - localcmd(strcat("exec \"", exit_cfg, "\"\n")); - - ResetGameCvars(); - - - if (cvar("samelevel")) // if samelevel is set, stay on same level - { - localcmd(strcat("exec \"maps/", mapname, ".mapcfg\"\n")); - //changelevel (mapname); - } - else - { - // method 0 - local float lCurrent; - local float lSize; - - lSize = tokenize( cvar_string( "g_maplist" ) ); - lCurrent = cvar( "g_maplist_index" ); - - lCurrent = lCurrent + 1; - if( lCurrent >= lSize ) { - lCurrent = 0; - } - - cvar_set( "g_maplist_index", ftos( lCurrent ) ); - - - localcmd(strcat("exec \"maps/", argv( lCurrent ), ".mapcfg\"\n")); - //changelevel( argv( lCurrent ) ); - - - /* - // method 1 - - //local entity pos; - local float fh; - local string line; - - // restart current map if no cycle is found - nextmap = strzone(mapname); - fh = fopen("maplist.cfg", FILE_READ); - if (fh >= 0) - { - while (1) - { - line = fgets(fh); - if (nextmap == mapname) - { - strunzone(nextmap); - nextmap = strzone(line); - } - if (!line) - break; - if (line == mapname) - { - line = fgets(fh); - if (!line) - break; - strunzone(nextmap); - nextmap = strzone(line); - break; - } - } - fclose(fh); - } - changelevel (nextmap); - strunzone(nextmap);*/ - - // method 2 - //nextmap = Nex_RotateMapList(); - //changelevel (nextmap); - //strunzone (nextmap); - // method 3 - /* - s = cvar_string("g_maplist"); - nummaps = tokenize(s); - // if no map list, restart current one - nextmap = mapname; - if (nummaps >= 1) - { - n = 0; - while (n < nummaps) - { - if (argv(n) == mapname) - break; - n = n + 1; - } - n = n + 1; - if (n >= nummaps) - n = 0; - nextmap = argv(n); - } - changelevel (nextmap); - */ - } -}; - - -/* -============ -IntermissionThink - -When the player presses attack or jump, change to the next level -============ -*/ -void() IntermissionThink = -{ - if (time < intermission_exittime) - return; - - if (time < intermission_exittime + 10 && !self.button0 && !self.button1 && !self.button2 && !self.button3) - return; - - GotoNextMap (); -}; - -/* -============ -FindIntermission - -Returns the entity to view from -============ -*/ -/* -entity() FindIntermission = -{ - local entity spot; - local float cyc; - -// look for info_intermission first - spot = find (world, classname, "info_intermission"); - if (spot) - { // pick a random one - cyc = random() * 4; - while (cyc > 1) - { - spot = find (spot, classname, "info_intermission"); - if (!spot) - spot = find (spot, classname, "info_intermission"); - cyc = cyc - 1; - } - return spot; - } - -// then look for the start position - spot = find (world, classname, "info_player_start"); - if (spot) - return spot; - -// testinfo_player_start is only found in regioned levels - spot = find (world, classname, "testplayerstart"); - if (spot) - return spot; - -// then look for the start position - spot = find (world, classname, "info_player_deathmatch"); - if (spot) - return spot; - - //objerror ("FindIntermission: no spot"); - return world; -}; -*/ - -/* -=============================================================================== - -RULES - -=============================================================================== -*/ - -/* -go to the next level for deathmatch -only called if a time or frag limit has expired -*/ -void() NextLevel = -{ - gameover = TRUE; - - intermission_running = 1; - -// enforce a wait time before allowing changelevel - intermission_exittime = time + 5; - - WriteByte (MSG_ALL, SVC_CDTRACK); - WriteByte (MSG_ALL, 3); - WriteByte (MSG_ALL, 3); - - //pos = FindIntermission (); - - other = find (world, classname, "player"); - while (other != world) - { - //other.nextthink = time + 0.5; - other.takedamage = DAMAGE_NO; - other.solid = SOLID_NOT; - other.movetype = MOVETYPE_NONE; - other.angles = other.v_angle; - other.angles_x = other.angles_x * -1; - /* - if (pos != world); - { - other.modelindex = 0; - other.weaponentity = world; // remove weapon model - other.view_ofs = '0 0 0'; - other.angles = other.v_angle = pos.mangle; - if (!other.angles) - { - other.angles = other.v_angle = pos.angles; - other.v_angle_x = other.v_angle_x * -1; - } - other.fixangle = TRUE; // turn this way immediately - setorigin (other, pos.origin); - } - */ - other = find (other, classname, "player"); - } - - WriteByte (MSG_ALL, SVC_INTERMISSION); -}; - -/* -============ -CheckRules_Player - -Exit deathmatch games upon conditions -============ -*/ -void() CheckRules_Player = -{ - local float fraglimit; - - if (gameover) // someone else quit the game already - return; - - // fixme: don't check players; instead check dom_team and ctf_team entities - - fraglimit = cvar("fraglimit"); - - if(cvar("g_domination")) - { - // fixme: check team frags, not players! - if (fraglimit && self.frags >= fraglimit) - { - NextLevel (); - return; - } - } - else - { - if (fraglimit && self.frags >= fraglimit) - { - NextLevel (); - return; - } - } -}; - -float checkrules_oneminutewarning; -float checkrules_leaderfrags; -entity checkrules_leader; - -/* -============ -CheckRules_World - -Exit deathmatch games upon conditions -============ -*/ -void() CheckRules_World = -{ - local float timelimit; - local float fraglimit; - local float checkrules_oldleaderfrags; - local entity checkrules_oldleader; - local entity head; - - if (intermission_running) - if (time >= intermission_exittime + 60) - { - GotoNextMap(); - return; - } - - if (gameover) // someone else quit the game already - return; - - timelimit = cvar("timelimit") * 60; - fraglimit = cvar("fraglimit"); - - if (timelimit && time >= timelimit) - { - NextLevel (); - return; - } - - if (!checkrules_oneminutewarning && timelimit && time > timelimit - 60) - { - checkrules_oneminutewarning = TRUE; - sound(world, CHAN_AUTO, "announcer/1minuteremains.wav", 1, ATTN_NONE); - } - - checkrules_oldleader = checkrules_leader; - checkrules_oldleaderfrags = checkrules_leaderfrags; - checkrules_leaderfrags = 0; - checkrules_leader = world; - head = findchain(classname, "player"); - while (head) - { - if (checkrules_leaderfrags < head.frags) - { - checkrules_leaderfrags = head.frags; - checkrules_leader = head; - } - head = head.chain; - } - if (checkrules_leaderfrags <= 0) - { - checkrules_leader = world; - checkrules_leaderfrags = 0; - } - checkrules_leaderfrags = floor(checkrules_leaderfrags); - if (checkrules_leaderfrags != checkrules_oldleaderfrags) - { - if (checkrules_leaderfrags == fraglimit - 1) - sound(world, CHAN_AUTO, "announcer/1fragleft.wav", 1, ATTN_NONE); - else if (checkrules_leaderfrags == fraglimit - 2) - sound(world, CHAN_AUTO, "announcer/2fragsleft.wav", 1, ATTN_NONE); - else if (checkrules_leaderfrags == fraglimit - 3) - sound(world, CHAN_AUTO, "announcer/3fragsleft.wav", 1, ATTN_NONE); - } -// if (checkrules_leader != checkrules_oldleader)// && checkrules_leaderfrags > checkrules_oldleaderfrags) -// bprint("^1",checkrules_leader.netname, " has taken the lead with ", ftos(checkrules_leaderfrags), " frags\n"); -}; diff --git a/qcsrc/gamec/mauvebot.c b/qcsrc/gamec/mauvebot.c deleted file mode 100644 index 42caf98a7..000000000 --- a/qcsrc/gamec/mauvebot.c +++ /dev/null @@ -1,574 +0,0 @@ -/* -MauveBot v1.0 for Nexuiz -*/ - -float intermission_running; - -.float skill_level; - -.float ai_time; -.float threat; -.entity dodgeent; - -float THREAT_UNFLAGGED = 0; -float THREAT_IGNORE = -1; - -float DODGE_DIST = 500; -float SEARCH_DIST = 1000; - -.float search_time; - -float bot_number; - -string(float r) BotName = -{ - if (r == 1) - { - self.playermodel = "models/player/visitant.zym"; - self.playerskin = "0"; - return "Visitant"; - } - else if (r == 2) - { - self.playermodel = "models/player/marine.zym"; - self.playerskin = "0"; - return "Marine"; - } - else if (r == 3) - { - self.playermodel = "models/player/specop.zym"; - self.playerskin = "0"; - return "Specop"; - } - else if (r == 4) - { - self.playermodel = "models/player/nexus.zym"; - self.playerskin = "0"; - return "Nexus"; - } - else if (r == 5) - { - self.playermodel = "models/player/skadi.zym"; - self.playerskin = "0"; - return "Skadi"; - } - else if (r == 6) - { - self.playermodel = "models/player/lurk.zym"; - self.playerskin = "0"; - return "Lurk"; - } - else if (r == 7) - { - self.playermodel = "models/player/headhunter.zym"; - self.playerskin = "0"; - return "HeadHunter"; - } - else if (r == 8) - { - self.playermodel = "models/player/carni.zym"; - self.playerskin = "0"; - return "Carni"; - } - else if (r == 9) - { - self.playermodel = "models/player/grunt.zym"; - self.playerskin = "0"; - return "Grunt"; - } - else if (r == 10) - { - self.playermodel = "models/player/insurrectionist.zym"; - self.playerskin = "0"; - return "Insurrectionist"; - } - else if (r == 11) - { - self.playermodel = "models/player/jeandarc.zym"; - self.playerskin = "0"; - return "Jeandarc"; - } - else if (r == 12) - { - self.playermodel = "models/player/lycanthrope.zym"; - self.playerskin = "0"; - return "Lycanthrope"; - } - else if (r == 13) - { - self.playermodel = "models/player/pyria.zym"; - self.playerskin = "0"; - return "Pyria"; - } - else if (r == 14) - { - self.playermodel = "models/player/shock.zym"; - self.playerskin = "0"; - return "Shock"; - } - else if (r == 15) - { - self.playermodel = "models/player/marine.zym"; - self.playerskin = "1"; - return "Private"; - } - else if (r == 16) - { - self.playermodel = "models/player/nexus.zym"; - self.playerskin = "1"; - return "Mulder"; - } - else if (r == 17) - { - self.playermodel = "models/player/skadi.zym"; - self.playerskin = "1"; - return "Elite"; - } - else if (r == 18) - { - self.playermodel = "models/player/lurk.zym"; - self.playerskin = "1"; - return "Reptile"; - } - else if (r == 19) - { - self.playermodel = "models/player/crash.zym"; - self.playerskin = "2"; - return "mechanical"; - } - else if (r == 20) - { - self.playermodel = "models/player/crash.zym"; - self.playerskin = "1"; - return "Quark"; - } - else if (r == 21) - { - self.playermodel = "models/player/insurrectionist.zym"; - self.playerskin = "1"; - return "Anarchist"; - } - else if (r == 22) - { - self.playermodel = "models/player/jeandarc.zym"; - self.playerskin = "1"; - return "Heroine"; - } - else if (r == 23) - { - self.playermodel = "models/player/lycanthrope.zym"; - self.playerskin = "1"; - return "Wolf"; - } - else if (r == 24) - { - self.playermodel = "models/player/pyria.zym"; - self.playerskin = "1"; - return "Soldier"; - } - else if (r == 25) - { - self.playermodel = "models/player/shock.zym"; - self.playerskin = "1"; - return "Rebel"; - } - else - { - self.playermodel = "models/player/crash.zym"; - self.playerskin = "0"; - return "Crash"; - } - -}; - -string () PickARandomName = -{ - local float y, test; - local string h; - local entity t; - - t = find(world, classname, "player"); - while(t) - { - if (clienttype(self) == CLIENTTYPE_BOT) - y = y + 1; - t = find(t, classname, "player"); - } - - if (y > 25) - { - self.playermodel = "models/player/marine.zym"; - self.playerskin = "0"; - return "EJP_Tank"; - } - - y = TRUE; - while(y) - { - test = ceil(random() * 25); - h = BotName(test); - t = find(world, netname, h); - if (t == world) - y = FALSE; - } - return h; -}; - -// Adds a bot to the server -void() add_MauveBot = -{ - local entity oldself; - local float flo; - local string str; - - oldself = self; - self = spawnclient(); - if (!self) - { - bprint("Can not add bot, server full.\n"); - str = ftos(bot_number); - cvar_set("bot_number", str); - self = oldself; - return; - } - - flo = floor(random() * 5); - if (flo == 0) - self.clientcolors = 0; - else if (flo == 1) - self.clientcolors = 3; - else if (flo == 2) - self.clientcolors = 4; - else if (flo == 3) - self.clientcolors = 12; - else if (flo == 4) - self.clientcolors = 13; - self.clientcolors = self.clientcolors + self.clientcolors * 16; - - self.netname = PickARandomName(); - - ClientConnect(); - PutClientInServer(); - self.skill_level = cvar("skill"); - if (self.skill_level > 10) - self.skill_level = 10; - if (self.skill_level < 1) - self.skill_level = 1; - self = oldself; - - bot_number = bot_number + 1; -}; - -void() remove_MauveBot = -{ - local float flo, i; - local entity ent; - - flo = floor(random() * bot_number); - - ent = find(world, classname, "player"); - - while(ent) - { - if (clienttype(ent) == CLIENTTYPE_BOT) - { - if (flo == i) - { - dropclient(ent); - if (bot_number > 0) - bot_number = bot_number - 1; - return; - } - i = i + 1; - } - ent = find(ent, classname, "player"); - } -}; - -float (entity targ) visible = -{ - local vector start, end, org; - -// if (self.skill_level < 3) -// if (random() > self.skill_level / 10) -// return FALSE; - - org = targ.origin; - if (org == '0 0 0') - org = (targ.absmin + targ.absmax) * 0.5; - - start = self.origin + self.view_ofs; - end = org; - traceline (start, end, TRUE, self); - if (!(trace_inopen && trace_inwater)) - if (trace_fraction == 1) - return TRUE; - return FALSE; -}; - -void(entity ent) bot_set_angle = -{ - local vector view; - local float flo; - if (ent != world) - { - view = ent.origin; - if (view == '0 0 0') - view = (ent.absmin + ent.absmax) * 0.5; - - if (self.skill_level < 6) - view = view - ent.velocity * (0.5 / self.skill_level); - - flo = vlen(ent.origin - self.origin) / (self.skill_level * 4); - - view_x = view_x + (random() * flo * 2) - flo; - view_y = view_y + (random() * flo * 2) - flo; - view_z = view_z + (random() * flo * 2) - flo; - - view = view - (self.origin + self.view_ofs); - self.v_angle = vectoangles(view); - self.v_angle_x = self.v_angle_x * -1; - self.angles = self.v_angle; - self.angles_x = self.angles_x * -1; - if (self.angles_x > 180) - self.angles_x = self.angles_x - 360; - if (self.angles_x != 0) - self.angles_x = self.angles_x / 6; - } - else - self.angles_x = 0;// hack! -}; - -void() MauveToGoal = -{ - local vector vec, en, diff, dir; - - vec = self.origin; - movetogoal(20); - en = self.origin; - self.origin = vec; - - diff = en - self.origin; - if (diff == '0 0 0') - diff = self.goalentity.origin - self.origin; - - if (self.search_time < time) - { - self.goalentity.search_time = time + 20; - self.goalentity = world; - return; - } - - dir = normalize(diff); - dir = dir * cvar("sv_maxspeed");// - (self.velocity - dir * (self.velocity * dir)); - - makevectors(self.v_angle); - self.movement_x = dir * v_forward; - self.movement_y = dir * v_right; - self.movement_z = dir * v_up; -}; - -void() look_for_stuff = -{ - local entity item, best, best2, best3; - local float dist, tdist, dist2, topthreat; - - item = findradius(self.origin, 1000); - - if (self.search_time < time) - self.enemy = world; - - if (self.enemy.health < 0) - self.enemy = world; - - if (self.enemy.deadflag) - self.enemy = world; - - dist = dist2 = SEARCH_DIST; - topthreat = 0; - - while(item) - { - if (item.flags & FL_CLIENT) - { - if (item != self && !(cvar("teamplay") && (item.clientcolors == self.clientcolors))) - { - if ((item.health > 0) && (!item.deadflag)) - { - if (visible(item)) - { - tdist = vlen(item.origin - self.origin); - if (tdist < dist) - { - best = item; - dist = tdist; - } - } - } - } - } - else if (( (item.flags & FL_ITEM) && item.model != string_null) && (item.search_time < time)) - { - if (visible(item)) - { - tdist = vlen(item.origin - self.origin); - if (tdist < dist2) - { - best2 = item; - dist2 = tdist; - } - } - } - if (item.threat == THREAT_UNFLAGGED) - { - if (item.classname == "missile") - item.threat = 100; - else if (item.classname == "laserbolt") - item.threat = 10; - else if (item.classname == "grenade") - item.threat = 50; - else if (item.classname == "plasma") - item.threat = 60; - else if (item.classname == "spike") - item.threat = 30; - else - item.threat = THREAT_IGNORE; - } - if (item.threat > 0) - { - if ((item.owner != self) || (item.velocity == '0 0 0')) - { - tdist = vlen(item.origin - self.origin); - if (tdist < DODGE_DIST) - { - if (item.threat / tdist > topthreat) - { - topthreat = item.threat / tdist; - best3 = item; - } - } - } - } - item = item.chain; - } - if ((best != self.enemy) && (best != world)) - self.enemy = best; - if ((best2 != self.goalentity) && (best2 != world)) - { - self.goalentity = best2; - self.search_time = time + 5; - } - self.dodgeent = best3; -}; - -void() DodgeProjectile = -{ - local vector vec; - - vec = vectoangles(self.dodgeent.origin - self.origin); - makevectors(vec); - - self.goalentity = spawn(); - - if (self.dodgeent.velocity != '0 0 0') - setorigin(self.goalentity, self.origin + v_right * 50); - else - setorigin(self.goalentity, self.origin - v_forward * 50); - - MauveToGoal(); - - remove(self.goalentity); - self.goalentity = world; -}; - -void() MauveBot_AI = -{ - - if (clienttype(self) != CLIENTTYPE_BOT) - { - local float flo; - - if (time >= 3) - { - float botnumbercvar; - botnumbercvar = cvar("bot_number"); - flo = rint(botnumbercvar); - if(flo != botnumbercvar) - cvar_set("bot_number", ftos(flo)); - - if (flo > bot_number) - add_MauveBot(); - else if (flo < bot_number) - remove_MauveBot(); - } - else - remove_MauveBot(); - return; - } - - self.button0 = 0; - self.button2 = 0; - self.button3 = 0; - - self.movement = '0 0 0'; - - if (self.deadflag == DEAD_RESPAWNABLE) - { - self.button0 = 1; - return; - } - else if (self.deadflag) - return; - - if (self.goalentity.model == string_null) - self.goalentity = world; - - if (time > self.ai_time) - { - self.ai_time = time + (0.5 / self.skill_level) + (random() * (1 / self.skill_level)); - - look_for_stuff(); - - if (self.enemy) - { - bot_set_angle(self.enemy); - if (visible(self.enemy)) - { - self.button0 = 1; - self.search_time = 100000; - } - else if (self.search_time == 100000) - self.search_time = time + 5; - if (self.goalentity == world) - { - if (self.enemy) - { - self.goalentity = self.enemy; - if (vlen(self.enemy.origin - self.origin) < 300) - self.dodgeent = self.enemy; - } - } - } - else if (self.goalentity) - bot_set_angle(self.goalentity); - - if (random() < 0.03) - self.button2 = 1; - } - else - { - if (self.skill_level > 3) - { - if (visible(self.enemy)) - { - self.button0 = 1; - self.search_time = 100000; - } - } - } - - if (self.dodgeent != world) - DodgeProjectile(); - else if (self.goalentity != world) - MauveToGoal(); -}; diff --git a/qcsrc/gamec/miscfunctions.c b/qcsrc/gamec/miscfunctions.c deleted file mode 100644 index 5c2c4f531..000000000 --- a/qcsrc/gamec/miscfunctions.c +++ /dev/null @@ -1,5 +0,0 @@ -float math_mod(float a, float b) -{ - return a - (floor(a / b) * b); -} - diff --git a/qcsrc/gamec/runematch.c b/qcsrc/gamec/runematch.c deleted file mode 100644 index 5ea070cda..000000000 --- a/qcsrc/gamec/runematch.c +++ /dev/null @@ -1,705 +0,0 @@ - -float RUNE_FIRST = 1; -float RUNE_STRENGTH = 1; -float RUNE_DEFENSE = 2; -float RUNE_REGEN = 4; -float RUNE_SPEED = 8; -float RUNE_VAMPIRE = 16; -float RUNE_LAST = 16; - -float CURSE_FIRST = 8192; -float CURSE_WEAK = 8192; -float CURSE_VULNER = 16384; -float CURSE_VENOM = 32768; -float CURSE_SLOW = 65536; -float CURSE_EMPATHY = 131072; -float CURSE_LAST = 131072; - -/* rune ideas: - - Doom/Death - Rune: When you damage enemies, you have a slight chance of instant-killing them (porportional to damage dealt / their health) - Curse: When you are damaged, you have a chance of being instant-killed - - Vengence/Slothful - Rune: The lower your health below 100, the more damage you deal (does not decrease your damage if you're above 100) - Curse: The higher your health (up to 100), the less damage you deal (at 100 hp deal 1/5th damage) - -*/ - -/*QUAKED runematch_spawn_point (1 0 0) (-16 -16 -24) (16 16 24) -spawn point for runes in runematch -*/ - -void runematch_spawn_point() -{ - if(!cvar("g_runematch")) - remove(self); -} - -string RuneName(float r) -{ - if(r == RUNE_STRENGTH) - return "^1Strength^7"; - if(r == RUNE_DEFENSE) - return "^4Defense^7"; - if(r == RUNE_REGEN) - return "^2Vitality^7"; - if(r == RUNE_SPEED) - return "^3Speed^7"; - if(r == RUNE_VAMPIRE) - return "^6Vampire^7"; - - if(r == CURSE_WEAK) - return "^1Weakness^7"; - if(r == CURSE_VULNER) - return "^4Vulnerability^7"; - if(r == CURSE_VENOM) - return "^2Venom^7"; - if(r == CURSE_SLOW) - return "^3Slow^7"; - if(r == CURSE_EMPATHY) - return "^6Empathy^7"; - return strcat("^8[unnamed", ftos(r), "]^7"); -} - -vector RuneColormod(float r) -{ - vector color; - if(r == RUNE_STRENGTH) - color = '255 0 0'; - if(r == RUNE_DEFENSE) - color = '0 0 255';//'0 102 255';// - if(r == RUNE_REGEN) - color = '0 204 0';//'0 255 0'; - if(r == RUNE_SPEED) - color = 0.35*'185 185 0';//255 230 0';//'255 255 0'; - if(r == RUNE_VAMPIRE) - color = '64 0 128';//'108 0 217';//'128 0 255';//'179 0 204';// - - if(r == CURSE_WEAK) - color = '255 0 0'; - if(r == CURSE_VULNER) - color = '0 0 255';//'0 102 255';// - if(r == CURSE_VENOM) - color = '0 204 0';//'0 255 0'; - if(r == CURSE_SLOW) - color = 0.5*'185 185 0';//'255 255 0'; - if(r == CURSE_EMPATHY) - color = '179 0 204';//'128 0 255'; - - return color * (1 / 255) * cvar("g_runematch_rune_color_strength"); -} - -float count_rune_spawnpoints() -{ - float num; - entity e; - num = 0; - do - { - e = find(e, classname, "runematch_spawn_point"); - if(!e) - break; - num = num + 1; - - }while(e); - - return num; -} - -entity rune_find_spawnpoint(float num, float r) -{ - entity e; - e = world; - do - { - e = find(e, classname, "runematch_spawn_point"); - if(!e) - e = find(e, classname, "runematch_spawn_point"); - if(!e) - break; - - if(r < 0) - { - return e; // emergency: prevent crash - } - - if(e.owner != world)//e.wait > time) // already taken - continue; - - if(r <= 1) - { - return e; - } - - r = r - 1; - - }while(e); - return world; -} - -void rune_respawn(); - -void RuneCarriedThink() -{ - float rcount, rnum; - vector ang; - entity rune; - - if(self.owner.classname != "player") - { - rune_respawn(); - return; - } - - self.nextthink = time + 0.1; - - // count runes my owner holds - rcount = 0; - rune = find(world, classname, "rune"); - while(rune) - { - if(rune.owner == self.owner) - rcount = rcount + 1; - if(rune == self) - rnum = rcount; - rune = find(rune, classname, "rune"); - } - - ang_y = rnum*(360 / rcount) + math_mod(time, 360)*45;//180; - - makevectors(ang); - - //setorigin(self, v_forward*32); - self.view_ofs = v_forward*32; -} - -void rune_touch() -{ - if(other.classname != "player" || other.health < 2) - return; - if(self.wait > time) - return; // "notouch" time isn't finished - - // detach from the spawn point you're on - if(self.owner.classname == "runematch_spawn_point") - { - self.owner.owner = world; - self.owner = world; - } - - self.owner = other; - self.enemy.owner = other; - //setattachment(self, other, ""); - setattachment(self, world, ""); - - self.movetype = MOVETYPE_FOLLOW; - self.aiment = other; - self.view_ofs = other.origin; - - setorigin(self, '0 0 0'); - other.runes = other.runes | self.runes | self.enemy.runes; - - //self.think = SUB_Null; - //self.nextthink = 0; - self.think = RuneCarriedThink; - self.nextthink = time; - self.touch = SUB_Null; - - self.solid = SOLID_NOT; - setorigin(self, self.origin); - - //sprint(other, strcat("^3You have picked up ", - // RuneName(self.runes & (RUNE_LAST*2-1)), " and ")); - //sprint(other, strcat(RuneName(self.enemy.runes & (CURSE_WEAK | CURSE_VULNER | CURSE_VENOM | CURSE_SLOW | CURSE_EMPATHY)), "\n")); - - bprint(strcat("^3", other.netname, "^7 has picked up ", - RuneName(self.runes & (RUNE_LAST*2-1)), "^7 and ")); - bprint(strcat(RuneName(self.enemy.runes & (CURSE_WEAK | CURSE_VULNER | CURSE_VENOM | CURSE_SLOW | CURSE_EMPATHY)), "\n")); -} - -void rune_respawn() -{ - float num, r; - entity spot; - num = count_rune_spawnpoints(); - r = ceil(random()*num); - - if(self.owner.classname == "runematch_spawn_point") - { - self.owner.owner = world; - self.owner = world; - } - - - spot = rune_find_spawnpoint(num, r); - if(!spot) - { - bprint("Warning: couldn't find spawn spot for rune respawn\n"); - return; - } - - self.solid = SOLID_TRIGGER; - - setorigin(self, spot.origin); - self.owner = spot; - spot.owner = self; - - self.touch = rune_touch; - - self.think = rune_respawn; - self.nextthink = time + cvar("g_runematch_shuffletime");//30 + random()*5; // fixme: cvar -} - -entity FindRune(entity own, string clname, float r) -{ - entity rune; - float count, c; - - c = count = 0; - rune = world; - - do - { - rune = find(rune, classname, clname); - if(!rune) - rune = find(rune, classname, clname); - if(!rune) - break; - if(rune.owner == own) - { - count = count + 1; - if(count >= r) - return rune; - if(r <= 1) - return rune; - } - c = c + 1; - }while(c < 30); - return world; -} - - -void DropRune(entity pl, entity e) -{ - //entity pl; - - //pl = e.owner; - // detach from player - setattachment(e, world, ""); - e.owner = world; - e.enemy.owner = world; - // don't instantly touch player again - e.wait = time + 1; // "notouch" time - e.movetype = MOVETYPE_TOSS; - e.solid = SOLID_TRIGGER; - // reposition itself if not picked up soon - e.think = rune_respawn; - e.nextthink = time + cvar("g_runematch_respawntime");//15 + random()*5; // fixme: cvar - e.touch = rune_touch; - - pl.runes = pl.runes - (pl.runes & (e.runes | e.enemy.runes)); - - // toss from player - setorigin(e, pl.origin + '0 0 10'); - e.velocity = '0 0 200' + '0 100 0'*crandom() + '100 0 0'*crandom(); - - - bprint(strcat("^3", pl.netname, "^7 has lost ", - RuneName(e.runes & (RUNE_LAST*2-1)), "^7 and ")); - bprint(strcat(RuneName(e.enemy.runes & (CURSE_WEAK | CURSE_VULNER | CURSE_VENOM | CURSE_SLOW | CURSE_EMPATHY)), "\n")); -} - -float RuneMatchesCurse(float r, float c) -{ - float cr; - if(r & RUNE_STRENGTH) - cr = CURSE_WEAK; - else if(r & RUNE_DEFENSE) - cr = CURSE_VULNER; - else if(r & RUNE_REGEN) - cr = CURSE_VENOM; - else if(r & RUNE_SPEED) - cr = CURSE_SLOW; - else if(r & RUNE_VAMPIRE) - cr = CURSE_EMPATHY; - else return FALSE; // fixme: error? - - if(c & cr) - return TRUE; - return FALSE; -} - -// player died, drop runes -// each rune should pair up with a random curse and then be tossed from the player -void DropAllRunes(entity pl) -{ - entity rune, curse; - float rcount, ccount, r, c, rand, prevent_same, numtodrop, tries; - - entity c1, r1, c2, r2; - - rune = curse = world; - rcount = ccount = r = c = 0; - rune = find(rune, classname, "rune"); - while(rune) - { - if(rune.owner == pl) - rcount = rcount + 1; - rune = find(rune, classname, "rune"); - } - curse = find(curse, classname, "curse"); - while(curse) - { - if(curse.owner == pl) - ccount = ccount + 1; - curse = find(curse, classname, "curse"); - } - - numtodrop = cvar("g_runematch_drop_runes_max"); - prevent_same = !cvar("g_runematch_allow_same"); - - rune = curse = world; - do - { - rune = find(rune, classname, "rune"); - if(!rune) - break; - if(rune.owner != pl) - continue; - - - // find a random curse - tries = 15; - if(ccount > 1 && prevent_same) - { - // avoid pairing runes and curses that match each other - do{ - rand = ceil(random()*ccount); - curse = FindRune(pl, "curse", rand); - tries = tries - 1; - }while(RuneMatchesCurse(rune.runes, curse.runes) && tries > 0); - if(tries <= 0) - { - bprint("warning: couldn't prevent same rune\n"); - } - } - else - { - rand = ceil(random()*ccount); - curse = FindRune(pl, "curse", rand); - } - - if(!curse) - error("Couldn't fine curse to bind rune to\n"); - - // pair rune and curse - - r1 = rune; - c1 = curse; - r2 = c1.enemy; - c2 = r1.enemy; - - if(r1 != r2) // not already attached to each other - { - r1.enemy = c1; - c1.enemy = r1; - setattachment(c1, r1, ""); - r2.enemy = c2; - c2.enemy = r2; - setattachment(c2, r2, ""); - //DropRune(pl, r2); - //ccount = ccount - 1; - //rcount = rcount - 1; - } - DropRune(pl, r1); - - if(numtodrop <=0) - { - r1.think = rune_respawn; - r1.nextthink = time; - } - - numtodrop = numtodrop - 1; - - ccount = ccount - 1; - rcount = rcount - 1; - - }while(rune); -} - -void spawn_default_runespawnpoints() -{ - entity spot, e; - spot = find(world, classname, "info_player_deathmatch"); - while(spot) - { - e = spawn(); - e.classname = "runematch_spawn_point"; - e.origin = spot.origin; - spot = find(spot, classname, "info_player_deathmatch"); - } -} - -void spawn_runes() -{ - float r, num, max_num, rn, cs, numrunes, runes_left, curses_left, tries, prevent_same; - entity e, spot; - - if(self) - remove(self); - - // fixme: instead of placing them all now, why not - // simply create them all and let them call rune_respawn() as their think? - - runes_left = RUNE_STRENGTH | RUNE_DEFENSE | RUNE_REGEN | RUNE_SPEED | RUNE_VAMPIRE; - curses_left = CURSE_WEAK | CURSE_VULNER | CURSE_VENOM | CURSE_SLOW | CURSE_EMPATHY; - numrunes = 5; - max_num = num = count_rune_spawnpoints(); - - if(num < numrunes) - { - spawn_default_runespawnpoints(); - } - - prevent_same = !cvar("g_runematch_allow_same"); - - max_num = num = count_rune_spawnpoints(); - - if(num < numrunes) - error(strcat("not enough spawn points for runematch, need ", ftos(numrunes), " but found ", ftos(num), "\n")); - - while(numrunes > 0) - { - r = ceil(random()*numrunes); - if(r == 1) - rn = RUNE_STRENGTH; - else if(r == 2) - rn = RUNE_DEFENSE; - else if(r == 3) - rn = RUNE_REGEN; - else if(r == 4) - rn = RUNE_SPEED; - else - rn = RUNE_VAMPIRE; - - if(curses_left > 1 && prevent_same) - { - tries = 15; - // avoid pairing runes and curses that match each other - do{ - r = ceil(random()*numrunes); - if(r == 1) - cs = CURSE_WEAK; - else if(r == 2) - cs = CURSE_VULNER; - else if(r == 3) - cs = CURSE_VENOM; - else if(r == 4) - cs = CURSE_SLOW; - else - cs = CURSE_EMPATHY; - tries = tries - 1; - }while(RuneMatchesCurse(rn, cs) && tries > 0); - if(tries <= 0) - { - bprint("warning: couldn't prevent same rune\n"); - } - } - else - { - r = ceil(random()*numrunes); - if(r == 1) - cs = CURSE_WEAK; - else if(r == 2) - cs = CURSE_VULNER; - else if(r == 3) - cs = CURSE_VENOM; - else if(r == 4) - cs = CURSE_SLOW; - else - cs = CURSE_EMPATHY; - } - - - - if(num <= 1) - r = 1; - else - r = ceil(random()*num*1.25); - - spot = rune_find_spawnpoint(num, r); - - if(spot == world) - { - error("failed to find runematch spawnpoint!\n"); - } - - // choose and spawn rune - -/* //rn = RUNE_FIRST; - while(!runes_left & rn && rn <= RUNE_LAST) - rn = rn * 2; - if(rn > RUNE_LAST) - error("couldn't select rune\n"); - runes_left = runes_left - rn; - - //cs = CURSE_FIRST; - while(!curses_left & cs && cs <= CURSE_LAST) - cs = cs * 2; - if(cs > CURSE_LAST) - error("couldn't select rune\n"); - curses_left = curses_left - cs; -*/ - while(!runes_left & rn) - { - rn = rn * 2; - if(rn > RUNE_LAST) - rn = RUNE_FIRST; - } - runes_left = runes_left - rn; - - while(!curses_left & cs) - { - cs = cs * 2; - if(cs > CURSE_LAST) - cs = CURSE_FIRST; - } - curses_left = curses_left - cs; - - e = spawn(); - e.runes = rn; - e.classname = "rune"; - e.touch = rune_touch; - e.think = rune_respawn; - e.nextthink = time + random(); - e.movetype = MOVETYPE_TOSS; - e.solid = SOLID_TRIGGER; - e.flags = FL_ITEM; - setmodel(e, "models/runematch/rune.mdl"); - setorigin(e, spot.origin); - - e.enemy = spawn(); - e.enemy.enemy = e; - e.enemy.classname = "curse"; - e.enemy.runes = cs; - //e.enemy.avelocity = '300 500 200'; - setmodel(e.enemy, "models/runematch/curse.mdl"); - setorigin(e, '0 0 0'); - setattachment(e.enemy, e, ""); - - - e.colormod = RuneColormod(rn); - e.enemy.colormod = RuneColormod(cs); - - e.alpha = e.enemy.alpha = cvar("g_runematch_rune_alpha");//0.78; - e.effects = e.enemy.effects = cvar("g_runematch_rune_effects");//EF_ADDITIVE;// | EF_FULLBRIGHT; - - // Savage: Save some bandwidth - self.effects |= EF_LOWPRECISION; - - //e.glow_size = e.enemy.glow_size = cvar("g_runematch_rune_glow_size"); - //e.glow_color = e.enemy.glow_color = cvar("g_runematch_rune_glow_color"); - - // this spot is taken - spot.owner = e; - e.owner = spot; - - - //rn = RUNE_FIRST; - //cs = CURSE_FIRST; - - numrunes = numrunes - 1; - num = num - 1; - } -} - -void runematch_init() -{ - if(!cvar("g_runematch")) - return; - precache_model("models/runematch/rune.mdl"); - precache_model("models/runematch/curse.mdl"); - - entity e; - e = spawn(); - e.think = spawn_runes; - e.nextthink = time + 0.1; -} - - -float runematch_point_time; - -// give points to players who are holding runes -void RuneMatchGivePoints() -{ - entity rune; - - if(gameover) - return; - - if(runematch_point_time > time) - return; - if(!cvar("g_runematch") || !cvar("g_runematch_pointamt")) - return; - - runematch_point_time = time + cvar("g_runematch_pointrate"); - - rune = world; - do - { - rune = find(rune, classname, "rune"); - if(!rune) - return; - - if(rune.owner.classname == "player") - { - rune.owner.frags = rune.owner.frags + cvar("g_runematch_pointamt"); - } - }while(rune); -} - -float RunematchHandleFrags(entity attacker, entity targ, float f) -{ - entity head; - float arunes, trunes, newfrags; - - if(f <= 0) - return f; - if(attacker == targ) - return f; - - arunes = trunes = 0; - - head = find(world, classname, "rune"); - while(head) - { - if(head.owner == attacker) - { - arunes = arunes + 1; - } - else if(head.owner == targ) - { - trunes = trunes + 1; - } - - head = find(head, classname, "rune"); - } - - if(!arunes && !trunes) - return f - 1 + cvar("g_runematch_frags_norune"); // don't give points to players when no runes are involved. - - if(arunes) - { // got a kill while holding runes - newfrags = newfrags + cvar("g_runematch_frags_killedby_runeholder");//5; - } - if(trunes) - { // killed an enemy holding runes - newfrags = newfrags + cvar("g_runematch_frags_killed_runeholder");//5; - } - if(newfrags) - f = f - 1 + newfrags; - - return f; -} diff --git a/qcsrc/gamec/sv_main.c b/qcsrc/gamec/sv_main.c deleted file mode 100644 index 0aac2a1b7..000000000 --- a/qcsrc/gamec/sv_main.c +++ /dev/null @@ -1,130 +0,0 @@ - -void CreatureFrame (void) -{ - local entity oldself; - local float dm; - oldself = self; - self = findfloat(world, iscreature, TRUE); - while (self) - { - if (self.movetype != MOVETYPE_NOCLIP) - { - if (self.waterlevel) - { - if (!(self.flags & FL_INWATER)) - { - //if (self.watertype == CONTENT_LAVA) - // sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM); - //if (self.watertype == CONTENT_WATER) - // sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM); - //if (self.watertype == CONTENT_SLIME) - // sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM); - self.flags = self.flags + FL_INWATER; - self.dmgtime = 0; - } - if (self.waterlevel != 3) - { - self.air_finished = time + 12; - self.dmg = 2; - } - else if (self.air_finished < time) - { // drown! - if (!self.deadflag) - if (self.pain_finished < time) - { - Damage (self, world, world, 5, DEATH_DROWN, self.origin, '0 0 0'); - self.pain_finished = time + 0.5; - } - } - if (self.dmgtime < time) - { - self.dmgtime = time + 0.1; - if (self.watertype == CONTENT_LAVA) - { - if (self.watersound_finished < time) - { - self.watersound_finished = time + 0.5; - sound (self, CHAN_BODY, "player/lava.wav", 1, ATTN_NORM); - } - Damage (self, world, world, 6 * self.waterlevel, DEATH_LAVA, self.origin, '0 0 0'); - } - else if (self.watertype == CONTENT_SLIME) - { - if (self.watersound_finished < time) - { - self.watersound_finished = time + 0.5; - sound (self, CHAN_BODY, "player/slime.wav", 1, ATTN_NORM); - } - Damage (self, world, world, 2 * self.waterlevel, DEATH_SLIME, self.origin, '0 0 0'); - } - } - } - else - { - if (self.flags & FL_INWATER) - { - // play leave water sound - self.flags = self.flags - FL_INWATER; - self.dmgtime = 0; - } - self.air_finished = time + 12; - self.dmg = 2; - } - // check for falling damage - if(!self.hook.state) - { - dm = vlen(self.velocity - self.oldvelocity); - if (self.deadflag) - dm = (dm - cvar("g_balance_falldamage_deadminspeed")) * cvar("g_balance_falldamage_factor"); - else - { - if (self.oldvelocity_z < self.velocity_z - 100) - { - local float soundrandom; - soundrandom = random() * 4; - if (soundrandom < 1) - sound (self, CHAN_BODY, "misc/hitground1.wav", 1, ATTN_NORM); - else if (soundrandom < 2) - sound (self, CHAN_BODY, "misc/hitground2.wav", 1, ATTN_NORM); - else if (soundrandom < 3) - sound (self, CHAN_BODY, "misc/hitground3.wav", 1, ATTN_NORM); - else if (soundrandom < 4) - sound (self, CHAN_BODY, "misc/hitground4.wav", 1, ATTN_NORM); - } - dm = min((dm - cvar("g_balance_falldamage_minspeed")) * cvar("g_balance_falldamage_factor"), cvar("g_balance_falldamage_maxdamage")); - } - if (dm > 0) - Damage (self, world, world, dm, DEATH_FALL, self.origin, '0 0 0'); - } - self.oldvelocity = self.velocity; - } - self = findfloat(self, iscreature, TRUE); - } - self = oldself; -} - - -/* -============= -StartFrame - -Called before each frame by the server -============= -*/ -void RuneMatchGivePoints(); -void StartFrame (void) -{ - sv_maxairspeed = cvar("sv_maxairspeed"); - sv_maxspeed = cvar ("sv_maxspeed"); - sv_friction = cvar ("sv_friction"); - sv_accelerate = cvar ("sv_accelerate"); - sv_stopspeed = cvar ("sv_stopspeed"); - teamplay = cvar ("teamplay"); - - CreatureFrame (); - CheckRules_World (); - - AuditTeams(); - - RuneMatchGivePoints(); -} diff --git a/qcsrc/gamec/sv_stats.c b/qcsrc/gamec/sv_stats.c deleted file mode 100644 index 0924cbac2..000000000 --- a/qcsrc/gamec/sv_stats.c +++ /dev/null @@ -1,5 +0,0 @@ - -// Accuracy -//.float shots; -//.float hits; - diff --git a/qcsrc/gamec/sys.h b/qcsrc/gamec/sys.h deleted file mode 100644 index e6e007eb3..000000000 --- a/qcsrc/gamec/sys.h +++ /dev/null @@ -1,145 +0,0 @@ - -// DO NOT modify the contents of this file, or you will risk incompatibility with the game engine. - -entity self; -entity other; -entity world; - -float time; -float frametime; -float force_retouch; -string mapname; -float deathmatch; -float coop; -float teamplay; -float serverflags; -float total_secrets; -float total_monsters; -float found_secrets; -float killed_monsters; -float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16; -vector v_forward, v_up, v_right; -float trace_allsolid; -float trace_startsolid; -float trace_fraction; -vector trace_endpos; -vector trace_plane_normal; -float trace_plane_dist; -entity trace_ent; -float trace_inopen; -float trace_inwater; - -entity msg_entity; - -void main (void); -void StartFrame (void); -void PlayerPreThink (void); -void PlayerPostThink (void); -void ClientKill (void); -void ClientConnect (void); -void PutClientInServer (void); -void ClientDisconnect (void); -void SetNewParms (void); -void SetChangeParms (void); - -///////////////////////////////////////////////////////// -void end_sys_globals; -///////////////////////////////////////////////////////// - -.float modelindex; - -.vector absmin, absmax; - -.float ltime; -.float movetype; -.float solid; - -.vector origin; -.vector oldorigin; -.vector velocity; -.vector angles; -.vector avelocity; -.vector punchangle; - -.string classname; -.string model; - -.float frame; -.float skin; -.float effects; - -.vector mins, maxs; -.vector size; - -.void() touch; -.void() use; -.void() think; -.void() blocked; - -.float nextthink; - -.entity groundentity; - -.float health; -.float frags; - -.float weapon; -.string weaponmodel; -.float weaponframe; - -.float currentammo; -.float ammo_shells, ammo_nails, ammo_rockets, ammo_cells; -.float items; - -.float takedamage; - -.entity chain; - -.float deadflag; - -.vector view_ofs; - -.float button0; -.float button1; -.float button2; -.float impulse; -.float fixangle; -.vector v_angle; -.float idealpitch; - -.string netname; -.entity enemy; - -.float flags; -.float colormap; -.float team; -.float max_health; -.float teleport_time; -.float armortype; -.float armorvalue; -.float waterlevel; -.float watertype; -.float ideal_yaw; -.float yaw_speed; - -.entity aiment; -.entity goalentity; - -.float spawnflags; - -.string target; -.string targetname; - -.float dmg_take; -.float dmg_save; -.entity dmg_inflictor; - -.entity owner; -.vector movedir; -.string message; -.float sounds; -.string noise, noise1, noise2, noise3; - -///////////////////////////////////////////////////////// -void end_sys_fields; -///////////////////////////////////////////////////////// diff --git a/qcsrc/gamec/t_halflife.c b/qcsrc/gamec/t_halflife.c deleted file mode 100644 index 4825d316e..000000000 --- a/qcsrc/gamec/t_halflife.c +++ /dev/null @@ -1,58 +0,0 @@ - -.float roomtype; -.float radius; -.float pitch; -.float renderamt; -.float rendermode; -.vector rendercolor; - -void() weapon_crossbow = {}; -void() weapon_handgrenade = {}; -void() ammo_crossbow = {}; -void() ammo_9mmclip = {}; -void() ammo_gaussclip = {}; -void() weapon_rpg = {}; -void() weapon_357 = {}; -void() ammo_ARgrenades = {}; -void() item_battery = {}; -void() ammo_rpgclip = {}; -void() weapon_9mmAR = {}; -void() weapon_tripmine = {}; -void() weapon_snark = {}; -void() ammo_buckshot = {}; -void() ammo_9mmAR = {}; -void() ammo_357 = {}; -void() weapon_gauss = {}; -void() weapon_hornetgun = {}; -//void() weapon_shotgun = {}; -void() item_healthkit = {}; -void() item_longjump = {}; -void() item_antidote = {}; -void() func_recharge = {}; -void() info_node = {}; -void() env_sound = {}; -void() light_spot = {}; -void() func_healthcharger = {}; - - -void() func_ladder_touch = -{ - if (other.classname != "player") - return; - other.ladder_time = time + 0.1; - other.ladder_entity = self; -}; - -void() func_ladder = -{ - InitTrigger (); - self.touch = func_ladder_touch; -}; - -void() func_water = -{ - self.solid = SOLID_TRIGGER; - setmodel (self, self.model); // set size and link into world - self.touch = func_ladder_touch; -}; - diff --git a/qcsrc/gamec/t_items.c b/qcsrc/gamec/t_items.c deleted file mode 100644 index 67a61085a..000000000 --- a/qcsrc/gamec/t_items.c +++ /dev/null @@ -1,186 +0,0 @@ -void Item_ClearRespawnEffect (void) { - self.effects = self.effects - (self.effects & EF_STARDUST); -} - -void Item_Respawn (void) -{ - self.model = self.mdl; // restore original model - self.solid = SOLID_TRIGGER; // allow it to be touched again - sound (self, CHAN_VOICE, "misc/itemrespawn.wav", 1, ATTN_NORM); // play respawn sound - setorigin (self, self.origin); - - // Savage: Add simple Respawn effect and make sure it gets removed - self.effects = EF_STARDUST; - self.think = Item_ClearRespawnEffect; - self.nextthink = time + 0.1; -} - -void Item_Touch (void) -{ - - local entity oldself; - local float _switchweapon; - - if (other.classname != "player") - return; - if (other.deadflag) - return; - if (self.solid != SOLID_TRIGGER) - return; - if (self.health && other.health >= other.max_health) - return; - // Savage: Remove the respawn effect if still present - self.effects = self.effects - (self.effects & EF_STARDUST); - - sound (self, CHAN_BODY, self.noise, 1, ATTN_NORM); - - // if the player is using their best weapon before items are given, they - // probably want to switch to an even better weapon after items are given - _switchweapon = other.switchweapon == w_getbestweapon(other); - - if (self.ammo_shells) - other.ammo_shells = min (other.ammo_shells + self.ammo_shells, 999); - if (self.ammo_nails) - other.ammo_nails = min (other.ammo_nails + self.ammo_nails, 999); - if (self.ammo_rockets) - other.ammo_rockets = min (other.ammo_rockets + self.ammo_rockets, 999); - if (self.ammo_cells) - other.ammo_cells = min (other.ammo_cells + self.ammo_cells, 999); - - if (self.items & IT_UZI) W_GiveWeapon (other, IT_UZI, "Machine gun"); - if (self.items & IT_SHOTGUN) W_GiveWeapon (other, IT_SHOTGUN, "Shotgun"); - if (self.items & IT_GRENADE_LAUNCHER) W_GiveWeapon (other, IT_GRENADE_LAUNCHER, "Mortar"); - if (self.items & IT_ELECTRO) W_GiveWeapon (other, IT_ELECTRO, "Electro"); - if (self.items & IT_NEX) W_GiveWeapon (other, IT_NEX, "Nex"); - if (self.items & IT_HAGAR) W_GiveWeapon (other, IT_HAGAR, "Hagar"); - if (self.items & IT_ROCKET_LAUNCHER) W_GiveWeapon (other, IT_ROCKET_LAUNCHER, "Rocket Launcher"); - if (self.items & IT_CRYLINK) W_GiveWeapon (other, IT_CRYLINK, "Crylink"); - - if (self.strength_finished) - other.strength_finished = max(other.strength_finished, time) + cvar("g_balance_powerup_strength_time"); - if (self.invincible_finished) - other.invincible_finished = max(other.invincible_finished, time) + cvar("g_balance_powerup_invincible_time"); - //if (self.speed_finished) - // other.speed_finished = max(other.speed_finished, time) + cvar("g_balance_powerup_speed_time"); - //if (self.slowmo_finished) - // other.slowmo_finished = max(other.slowmo_finished, time) + (cvar("g_balance_powerup_slowmo_time") * cvar("g_balance_powerup_slowmo_speed")); - - if (self.max_health) - { - other.health = other.health + self.max_health; - other.pauserothealth_finished = max(other.pauserothealth_finished, time + 5); - } - if (self.health && other.health < other.max_health) - other.health = min(other.health + self.health, other.max_health); - if (self.armorvalue) - { - other.armorvalue = other.armorvalue + self.armorvalue; - other.pauserotarmor_finished = max(other.pauserotarmor_finished, time + 5); - } - - oldself = self; - self = other; - - if (_switchweapon) - self.switchweapon = w_getbestweapon(self); - - //W_UpdateWeapon (); - //W_UpdateAmmo (); - weapon_action(self.weapon, WR_UPDATECOUNTS); - - self = oldself; - - if (self.classname == "droppedweapon") - remove (self); - else - { - self.solid = SOLID_NOT; - self.model = string_null; - self.nextthink = time + self.respawntime; - self.think = Item_Respawn; - setorigin (self, self.origin); - } -} - -// Savage: used for item garbage-collection -// TODO: perhaps nice special effect? -void RemoveItem(void) = { - remove(self); -} - - -void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, string itemname, float itemid, float itemflags) -{ - if (!cvar("g_pickup_items")) - { - remove (self); - return; - } - self.mdl = itemmodel; - self.noise = pickupsound; - // let mappers override respawntime - if (!self.respawntime) - self.respawntime = defaultrespawntime; - self.netname = itemname; - self.items = itemid; - self.flags = FL_ITEM | itemflags; - setmodel (self, self.mdl); - if (itemflags & FL_WEAPON) - { - setorigin (self, self.origin + '0 0 22'); - setsize (self, '-12 -12 -12', '12 12 12'); - } - else - { - setorigin (self, self.origin + '0 0 15'); - // setsize (self, '-8 -8 -5', '8 8 8'); - } - self.movetype = MOVETYPE_TOSS; - self.solid = SOLID_TRIGGER; - self.touch = Item_Touch; - - // Savage: remove thrown items after a certain period of time ("garbage collection") - if (self.classname == "droppedweapon") - { - self.think = RemoveItem; - self.nextthink = time + 60; - } - - if (cvar("g_fullbrightitems")) - self.effects = self.effects | EF_FULLBRIGHT; - -} - -void weapon_uzi (void) {self.ammo_nails = 120;StartItem ("models/weapons/g_uzi.md3", "weapons/weaponpickup.wav", 15, "Uzi", IT_UZI, FL_WEAPON);} -void weapon_shotgun (void) {self.ammo_shells = 15;StartItem ("models/weapons/g_shotgun.md3", "weapons/weaponpickup.wav", 15, "Shotgun", IT_SHOTGUN, FL_WEAPON);} -void weapon_grenadelauncher (void) {self.ammo_rockets = 15;StartItem ("models/weapons/g_gl.md3", "weapons/weaponpickup.wav", 15, "Grenade Launcher", IT_GRENADE_LAUNCHER, FL_WEAPON);} -void weapon_electro (void) {self.ammo_cells = 25;StartItem ("models/weapons/g_electro.md3", "weapons/weaponpickup.wav", 15, "Electro", IT_ELECTRO, FL_WEAPON);} -void weapon_crylink (void) {self.ammo_cells = 25;StartItem ("models/weapons/g_crylink.md3", "weapons/weaponpickup.wav", 15, "Crylink", IT_CRYLINK, FL_WEAPON);} -void weapon_nex (void) {self.ammo_cells = 25;StartItem ("models/weapons/g_nex.md3", "weapons/weaponpickup.wav", 15, "Nex Gun", IT_NEX, FL_WEAPON);} -void weapon_hagar (void) {self.ammo_rockets = 15;StartItem ("models/weapons/g_hagar.md3", "weapons/weaponpickup.wav", 15, "Hagar", IT_HAGAR, FL_WEAPON);} -void weapon_rocketlauncher (void) {self.ammo_rockets = 15;StartItem ("models/weapons/g_rl.md3", "weapons/weaponpickup.wav", 15, "Rocket Launcher", IT_ROCKET_LAUNCHER, FL_WEAPON);} - -void item_rockets (void) {self.ammo_rockets = 15;StartItem ("models/items/a_rockets.md3", "misc/itempickup.wav", 15, "rockets", IT_ROCKETS, 0);} -void item_bullets (void) {self.ammo_nails = 120;StartItem ("models/items/a_bullets.mdl", "misc/itempickup.wav", 15, "bullets", IT_NAILS, 0);} -void item_cells (void) {self.ammo_cells = 25;StartItem ("models/items/a_cells.md3", "misc/itempickup.wav", 15, "cells", IT_CELLS, 0);} -void item_shells (void) {self.ammo_shells = 15;StartItem ("models/items/a_shells.md3", "misc/itempickup.wav", 15, "shells", IT_SHELLS, 0);} - -void item_armor1 (void) {self.armorvalue = 5;StartItem ("models/items/g_a1.md3", "misc/armor1.wav", 15, "Armor Shard", 0, 0);} -void item_armor25 (void) {self.armorvalue = 100;StartItem ("models/items/g_a25.md3", "misc/armor25.wav", 30, "Armor", 0, 0);} -void item_health1 (void) {self.max_health = 5;StartItem ("models/items/g_h1.md3", "misc/minihealth.wav", 15, "5 Health", 0, 0);} -void item_health25 (void) {self.max_health = 25;StartItem ("models/items/g_h25.md3", "misc/mediumhealth.wav", 15, "25 Health", 0, 0);} -void item_health100 (void) {self.max_health = 100;StartItem ("models/items/g_h100.md3", "misc/megahealth.wav", 30, "100 Health", 0, 0);} - -void item_strength (void) {self.strength_finished = 30;self.effects = EF_ADDITIVE;StartItem ("models/items/g_strength.md3", "misc/powerup.wav", 120, "Strength Powerup", IT_STRENGTH, FL_POWERUP);} -void item_invincible (void) {self.invincible_finished = 30;self.effects = EF_ADDITIVE;StartItem ("models/items/g_invincible.md3", "misc/powerup.wav", 120, "Invulnerability", IT_INVINCIBLE, FL_POWERUP);} -//void item_speed (void) {self.speed_finished = 30;StartItem ("models/items/g_speed.md3", "misc/powerup.wav", 120, "Speed Powerup", IT_SPEED, FL_POWERUP);} -//void item_slowmo (void) {self.slowmo_finished = 30;StartItem ("models/items/g_slowmo.md3", "misc/powerup.wav", 120, "Slow Motion", IT_SLOWMO, FL_POWERUP);} - -void misc_models (void) -{ - precache_model (self.model); - setmodel (self, self.model); - setsize (self, self.mins, self.maxs); -} - - diff --git a/qcsrc/gamec/t_jumppads.c b/qcsrc/gamec/t_jumppads.c deleted file mode 100644 index 5674aece3..000000000 --- a/qcsrc/gamec/t_jumppads.c +++ /dev/null @@ -1,98 +0,0 @@ -float PUSH_ONCE = 1; -float PUSH_SILENT = 2; - -.float pushltime; -void() trigger_push_touch = -{ - local float flighttime, dist, grav; - local vector org; - - if (other.classname != "player" && other.classname != "corpse" && other.classname != "body" && other.classname != "gib" && other.classname != "missile" && other.classname != "casing" && other.classname != "grenade" && other.classname != "plasma") - return; - - if (!self.target) - { - other.velocity = self.movedir; - other.flags = other.flags - (other.flags & FL_ONGROUND); - return; - } - - org = other.origin; - - if (other.classname == "player") - sound (other, CHAN_ITEM, "misc/jumppad.wav", 1, ATTN_NORM); - - // figure out how long it will take to hit the point considering gravity - grav = cvar("sv_gravity"); - flighttime = sqrt((self.enemy.origin_z - org_z) / (0.5 * grav)); - if (!flighttime) - return; - - // how far in X and Y to move - self.movedir = (self.enemy.origin - org); - self.movedir_z = 0; - dist = vlen(self.movedir); - - // finally calculate the velocity - self.movedir = normalize(self.movedir) * (dist / flighttime); - self.movedir_z = flighttime * grav; - - other.flags = other.flags - (other.flags & FL_ONGROUND); - // reset tracking of oldvelocity for impact damage (sudden velocity changes) - other.oldvelocity = other.velocity = self.movedir; - // reset tracking of who pushed you into a hazard (for kill credit) - other.pushltime = 0; - - if (other.classname == "missile") - other.angles = vectoangles (other.velocity); - - if (self.spawnflags & PUSH_ONCE) - { - self.touch = SUB_Null; - self.think = SUB_Remove; - self.nextthink = time; - } -}; - -void() trigger_push_findtarget = -{ - // find the target - self.enemy = find(world, targetname, self.target); - if (!self.enemy) - { - objerror("trigger_push: target not found\n"); - remove(self); - } -}; - -void() trigger_push = -{ - if (self.angles != '0 0 0') - SetMovedir (); - - self.solid = SOLID_TRIGGER; - setmodel (self, self.model); - self.movetype = MOVETYPE_NONE; - self.modelindex = 0; - self.model = ""; - - self.touch = trigger_push_touch; - - // check if this is a jump pad - if (self.target) - { - self.think = trigger_push_findtarget; - self.nextthink = time + 0.2; - } - else - { - // normal push setup - if (!self.speed) - self.speed = 1000; - self.movedir = self.movedir * self.speed * 10; - } -}; - -void() target_push = {}; -void() info_notnull = {}; -void() target_position = {}; diff --git a/qcsrc/gamec/t_plats.c b/qcsrc/gamec/t_plats.c deleted file mode 100644 index 9dc274567..000000000 --- a/qcsrc/gamec/t_plats.c +++ /dev/null @@ -1,1248 +0,0 @@ - -float STATE_TOP = 0; -float STATE_BOTTOM = 1; -float STATE_UP = 2; -float STATE_DOWN = 3; - -.entity trigger_field; - -void() plat_center_touch; -void() plat_outside_touch; -void() plat_trigger_use; -void() plat_go_up; -void() plat_go_down; -void() plat_crush; -float PLAT_LOW_TRIGGER = 1; - -void() plat_spawn_inside_trigger = -{ - local entity trigger; - local vector tmin, tmax; - - trigger = spawn(); - trigger.touch = plat_center_touch; - trigger.movetype = MOVETYPE_NONE; - trigger.solid = SOLID_TRIGGER; - trigger.enemy = self; - - tmin = self.mins + '25 25 0'; - tmax = self.maxs - '25 25 -8'; - tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8); - if (self.spawnflags & PLAT_LOW_TRIGGER) - tmax_z = tmin_z + 8; - - if (self.size_x <= 50) - { - tmin_x = (self.mins_x + self.maxs_x) / 2; - tmax_x = tmin_x + 1; - } - if (self.size_y <= 50) - { - tmin_y = (self.mins_y + self.maxs_y) / 2; - tmax_y = tmin_y + 1; - } - - setsize (trigger, tmin, tmax); -}; - -void() plat_hit_top = -{ - sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM); - self.state = 1; - self.think = plat_go_down; - self.nextthink = self.ltime + 3; -}; - -void() plat_hit_bottom = -{ - sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM); - self.state = 2; -}; - -void() plat_go_down = -{ - sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM); - self.state = 3; - SUB_CalcMove (self.pos2, self.speed, plat_hit_bottom); -}; - -void() plat_go_up = -{ - sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM); - self.state = 4; - SUB_CalcMove (self.pos1, self.speed, plat_hit_top); -}; - -void() plat_center_touch = -{ - if (other.classname != "player") - return; - - if (other.health <= 0) - return; - - self = self.enemy; - if (self.state == 2) - plat_go_up (); - else if (self.state == 1) - self.nextthink = self.ltime + 1; // delay going down -}; - -void() plat_outside_touch = -{ - if (other.classname != "player") - return; - - if (other.health <= 0) - return; - - self = self.enemy; - if (self.state == 1) - plat_go_down (); -}; - -void() plat_trigger_use = -{ - if (self.think) - return; // allready activated - plat_go_down(); -}; - - -void() plat_crush = -{ - if (self.state == 4) - plat_go_down (); - else if (self.state == 3) - plat_go_up (); - else - objerror ("plat_crush: bad self.state\n"); -}; - -void() plat_use = -{ - self.use = SUB_Null; - if (self.state != 4) - objerror ("plat_use: not in up state"); - plat_go_down(); -}; - - -.string sound1, sound2; - -void() func_plat = -{ - if (!self.t_length) - self.t_length = 80; - if (!self.t_width) - self.t_width = 10; - - if (self.sounds == 0) - self.sounds = 2; - - if (self.sounds == 1) - { - precache_sound ("plats/plat1.wav"); - precache_sound ("plats/plat2.wav"); - self.noise = "plats/plat1.wav"; - self.noise1 = "plats/plat2.wav"; - } - - if (self.sounds == 2) - { - precache_sound ("plats/medplat1.wav"); - precache_sound ("plats/medplat2.wav"); - self.noise = "plats/medplat1.wav"; - self.noise1 = "plats/medplat2.wav"; - } - - if (self.sound1) - { - precache_sound (self.sound1); - self.noise = self.sound1; - } - if (self.sound2) - { - precache_sound (self.sound2); - self.noise1 = self.sound2; - } - - self.mangle = self.angles; - self.angles = '0 0 0'; - - self.classname = "plat"; - self.solid = SOLID_BSP; - self.movetype = MOVETYPE_PUSH; - setorigin (self, self.origin); - setmodel (self, self.model); - setsize (self, self.mins , self.maxs); - - self.blocked = plat_crush; - if (!self.speed) - self.speed = 150; - self.pos1 = self.origin; - self.pos2 = self.origin; - self.pos2_z = self.origin_z - self.size_z + 8; - - self.use = plat_trigger_use; - - plat_spawn_inside_trigger (); // the "start moving" trigger - - if (self.targetname) - { - self.state = 4; - self.use = plat_use; - } - else - { - setorigin (self, self.pos2); - self.state = 2; - } -}; - - -/* -void() train_next; -void() func_train_find; - -void() train_blocked = -{ - if (time < self.attack_finished) - return; - self.attack_finished = time + 0.5; -}; -void() train_use = -{ - if (self.think != func_train_find) - return; - train_next(); -}; - -void() train_wait = -{ - if (self.wait) - { - self.nextthink = self.ltime + self.wait; - sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM); - } - else - self.nextthink = self.ltime + 0.1; - - self.think = train_next; -}; - -void() train_next = -{ - local entity targ; - - targ = find (world, targetname, self.target); - self.target = targ.target; - if (!self.target) - objerror ("train_next: no next target"); - if (targ.wait) - self.wait = targ.wait; - else - self.wait = 0; - sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM); - SUB_CalcMove (targ.origin - self.mins, self.speed, train_wait); -}; - -void() func_train_find = -{ - local entity targ; - - targ = find (world, targetname, self.target); - self.target = targ.target; - setorigin (self, targ.origin - self.mins); - if (!self.targetname) - { // not triggered, so start immediately - self.nextthink = self.ltime + 0.1; - self.think = train_next; - } -}; - - -void() func_train = -{ - if (!self.speed) - self.speed = 100; - if (!self.target) - objerror ("func_train without a target"); - - if (self.sounds == 0) - { - self.noise = ("misc/null.wav"); - precache_sound ("misc/null.wav"); - self.noise1 = ("misc/null.wav"); - precache_sound ("misc/null.wav"); - } - - if (self.sounds == 1) - { - self.noise = ("plats/train2.wav"); - precache_sound ("plats/train2.wav"); - self.noise1 = ("plats/train1.wav"); - precache_sound ("plats/train1.wav"); - } - - self.solid = SOLID_BSP; - self.movetype = MOVETYPE_PUSH; - self.blocked = train_blocked; - self.use = train_use; - self.classname = "train"; - - setmodel (self, self.model); - setsize (self, self.mins , self.maxs); - setorigin (self, self.origin); - self.nextthink = self.ltime + 0.1; - self.think = func_train_find; -}; -*/ - -void() train_next; -void() train_wait = -{ - self.think = train_next; - self.nextthink = self.ltime + self.wait; -}; - -void() train_next = -{ - local entity targ; - targ = find(world, targetname, self.target); - self.target = targ.target; - if (!self.target) - objerror("train_next: no next target"); - self.wait = targ.wait; - if (!self.wait) - self.wait = 0.1; - if (targ.speed) - SUB_CalcMove(targ.origin - self.mins, targ.speed, train_wait); - else - SUB_CalcMove(targ.origin - self.mins, self.speed, train_wait); -}; - -void() func_train_find = -{ - local entity targ; - targ = find(world, targetname, self.target); - self.target = targ.target; - setorigin(self, targ.origin - self.mins); - self.nextthink = self.ltime + 1; - self.think = train_next; -}; - -/*QUAKED func_train (0 .5 .8) ? -Ridable platform, targets path_corner path to follow. -speed : speed the train moves (can be overridden by each path_corner) -target : targetname of first path_corner (starts here) -*/ -void() func_train = -{ - if (!self.target) - objerror("func_train without a target"); - if (!self.speed) - self.speed = 100; - - self.solid = SOLID_BSP; - self.movetype = MOVETYPE_PUSH; - - setmodel(self, self.model); - setsize(self, self.mins, self.maxs); - setorigin(self, self.origin); - - // wait for targets to spawn - self.nextthink = self.ltime + 0.1; - self.think = func_train_find; -}; - -/*QUAKED func_rotating (0 .5 .8) ? - - X_AXIS Y_AXIS -Brush model that spins in place on one axis (default Z). -speed : speed to rotate (in degrees per second) -noise : path/name of looping .wav file to play. -*/ -void() func_rotating = -{ - if (self.noise) - { - precache_sound(self.noise); - ambientsound(self.origin, self.noise, 1, ATTN_IDLE); - } - if (!self.speed) - self.speed = 100; - // FIXME: test if this turns the right way, then remove this comment (negate as needed) - if (self.spawnflags & 4) // X (untested) - self.avelocity = '0 0 1' * self.speed; - // FIXME: test if this turns the right way, then remove this comment (negate as needed) - else if (self.spawnflags & 8) // Y (untested) - self.avelocity = '1 0 0' * self.speed; - // FIXME: test if this turns the right way, then remove this comment (negate as needed) - else // Z - self.avelocity = '0 1 0' * self.speed; - - self.solid = SOLID_BSP; - self.movetype = MOVETYPE_PUSH; - - setmodel(self, self.model); - setsize(self, self.mins, self.maxs); - setorigin(self, self.origin); - - // wait for targets to spawn - self.nextthink = self.ltime + 999999999; - self.think = SUB_Null; -}; - -.float height; -.float phase; -void() func_bobbing_controller_think = -{ - local vector v; - self.nextthink = time + 0.1; - // calculate sinewave using makevectors - makevectors((time * self.owner.cnt + self.owner.phase) * '0 1 0'); - v = self.owner.destvec + self.owner.movedir * v_forward_y; - // * 10 so it will arrive in 0.1 sec - self.owner.velocity = (v - self.owner.origin) * 10; -}; - -/*QUAKED func_bobbing (0 .5 .8) ? X_AXIS Y_AXIS -Brush model that moves back and forth on one axis (default Z). -speed : how long one cycle takes in seconds (default 4) -height : how far the cycle moves (default 32) -phase : cycle timing adjustment (0-1 as a fraction of the cycle, default 0) -noise : path/name of looping .wav file to play. -*/ -void() func_bobbing = -{ - local entity controller; - if (self.noise) - { - precache_sound(self.noise); - ambientsound(self.origin, self.noise, 1, ATTN_IDLE); - } - if (!self.speed) - self.speed = 4; - if (!self.height) - self.height = 32; - // center of bobbing motion - self.destvec = self.origin; - // time scale to get degrees - self.cnt = 360 / self.speed; - // how far to bob - if (self.spawnflags & 1) // X - self.movedir = '1 0 0' * self.height; - else if (self.spawnflags & 2) // Y - self.movedir = '0 1 0' * self.height; - else // Z - self.movedir = '0 0 1' * self.height; - - self.solid = SOLID_BSP; - self.movetype = MOVETYPE_PUSH; - - setmodel(self, self.model); - setsize(self, self.mins, self.maxs); - setorigin(self, self.origin); - - // wait for targets to spawn - controller = spawn(); - controller.classname = "func_bobbing_controller"; - controller.owner = self; - controller.nextthink = time + 1; - controller.think = func_bobbing_controller_think; - self.nextthink = self.ltime + 999999999; - self.think = SUB_Null; - - // Savage: Reduce bandwith, critical on e.g. nexdm02 - self.effects |= EF_LOWPRECISION; -}; - -// button and multiple button - -void() button_wait; -void() button_return; - -void() button_wait = -{ - self.state = STATE_TOP; - self.nextthink = self.ltime + self.wait; - self.think = button_return; - activator = self.enemy; - SUB_UseTargets(); - self.frame = 1; // use alternate textures -}; - -void() button_done = -{ - self.state = STATE_BOTTOM; -}; - -void() button_return = -{ - self.state = STATE_DOWN; - SUB_CalcMove (self.pos1, self.speed, button_done); - self.frame = 0; // use normal textures - if (self.health) - self.takedamage = DAMAGE_YES; // can be shot again -}; - - -void() button_blocked = -{ - // do nothing, just don't come all the way back out -}; - - -void() button_fire = -{ - self.health = self.max_health; - self.takedamage = DAMAGE_NO; // will be reset upon return - - if (self.state == STATE_UP || self.state == STATE_TOP) - return; - - if (self.noise != "") - sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM); - - self.state = STATE_UP; - SUB_CalcMove (self.pos2, self.speed, button_wait); -}; - - -void() button_use = -{ -// if (activator.classname != "player") -// { -// dprint(activator.classname); -// dprint(" triggered a button\n"); -// } - self.enemy = activator; - button_fire (); -}; - -void() button_touch = -{ -// if (activator.classname != "player") -// { -// dprint(activator.classname); -// dprint(" touched a button\n"); -// } - if (!other.classname != "player") - return; - self.enemy = other; - if (other.owner) - self.enemy = other.owner; - button_fire (); -}; - -void(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) button_damage = -{ - self.health = self.health - damage; - if (self.health <= 0) - { - // if (activator.classname != "player") - // { - // dprint(activator.classname); - // dprint(" killed a button\n"); - // } - self.enemy = damage_attacker; - button_fire (); - } -}; - - -/*QUAKED func_button (0 .5 .8) ? -When a button is touched, it moves some distance in the direction of it's angle, triggers all of it's targets, waits some time, then returns to it's original position where it can be triggered again. - -"angle" determines the opening direction -"target" all entities with a matching targetname will be used -"speed" override the default 40 speed -"wait" override the default 1 second wait (-1 = never return) -"lip" override the default 4 pixel lip remaining at end of move -"health" if set, the button must be killed instead of touched -"sounds" -0) steam metal -1) wooden clunk -2) metallic click -3) in-out -*/ -void() func_button = -{ - SetMovedir (); - - self.movetype = MOVETYPE_PUSH; - self.solid = SOLID_BSP; - setmodel (self, self.model); - - self.blocked = button_blocked; - self.use = button_use; - -// if (self.health == 0) // all buttons are now shootable -// self.health = 10; - if (self.health) - { - self.max_health = self.health; - self.event_damage = button_damage; - self.takedamage = DAMAGE_YES; - } - else - self.touch = button_touch; - - if (!self.speed) - self.speed = 40; - if (!self.wait) - self.wait = 1; - if (!self.lip) - self.lip = 4; - - self.state = STATE_BOTTOM; - - self.pos1 = self.origin; - self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip); -}; - - -float DOOR_START_OPEN = 1; -float DOOR_DONT_LINK = 4; -float DOOR_TOGGLE = 32; - -/* - -Doors are similar to buttons, but can spawn a fat trigger field around them -to open without a touch, and they link together to form simultanious -double/quad doors. - -Door.owner is the master door. If there is only one door, it points to itself. -If multiple doors, all will point to a single one. - -Door.enemy chains from the master door through all doors linked in the chain. - -*/ - -/* -============================================================================= - -THINK FUNCTIONS - -============================================================================= -*/ - -void() door_go_down; -void() door_go_up; - -void() door_blocked = -{ - //T_Damage (other, self, self, self.dmg, self.dmg, self.deathtype, DT_IMPACT, (self.absmin + self.absmax) * 0.5, '0 0 0', Obituary_Generic); - -// if a door has a negative wait, it would never come back if blocked, -// so let it just squash the object to death real fast - if (self.wait >= 0) - { - if (self.state == STATE_DOWN) - door_go_up (); - else - door_go_down (); - } -}; - - -void() door_hit_top = -{ - if (self.noise1 != "") - sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM); - self.state = STATE_TOP; - if (self.spawnflags & DOOR_TOGGLE) - return; // don't come down automatically - self.think = door_go_down; - self.nextthink = self.ltime + self.wait; -}; - -void() door_hit_bottom = -{ - if (self.noise1 != "") - sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM); - self.state = STATE_BOTTOM; -}; - -void() door_go_down = -{ - if (self.noise2 != "") - sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM); - if (self.max_health) - { - self.takedamage = DAMAGE_YES; - self.health = self.max_health; - } - - self.state = STATE_DOWN; - SUB_CalcMove (self.pos1, self.speed, door_hit_bottom); -}; - -void() door_go_up = -{ - if (self.state == STATE_UP) - return; // allready going up - - if (self.state == STATE_TOP) - { // reset top wait time - self.nextthink = self.ltime + self.wait; - return; - } - - if (self.noise2 != "") - sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM); - self.state = STATE_UP; - SUB_CalcMove (self.pos2, self.speed, door_hit_top); - - SUB_UseTargets(); -}; - - -/* -============================================================================= - -ACTIVATION FUNCTIONS - -============================================================================= -*/ - -void() door_fire = -{ - local entity oself; - local entity starte; - - if (self.owner != self) - objerror ("door_fire: self.owner != self"); - - self.message = ""; // no more message - oself = self; - - if (self.spawnflags & DOOR_TOGGLE) - { - if (self.state == STATE_UP || self.state == STATE_TOP) - { - starte = self; - do - { - door_go_down (); - self = self.enemy; - } while ( (self != starte) && (self != world) ); - self = oself; - return; - } - } - -// trigger all paired doors - starte = self; - do - { - door_go_up (); - self = self.enemy; - } while ( (self != starte) && (self != world) ); - self = oself; -}; - - -void() door_use = -{ - local entity oself; - - //dprint("door_use (model: ");dprint(self.model);dprint(")\n"); - self.message = ""; // door message are for touch only - if (self.owner) - self.owner.message = ""; - if (self.enemy) - self.enemy.message = ""; - if (self.owner) - { - oself = self; - self = self.owner; - door_fire (); - self = oself; - } -}; - - -void() door_trigger_touch = -{ - if (other.health < 1) - return; - - if (time < self.attack_finished) - return; - self.attack_finished = time + 1; - - activator = other; - - self = self.owner; - door_use (); -}; - - -void(entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) door_damage = -{ - local entity oself; - self.health = self.health - damage; - if (self.health <= 0) - { - oself = self; - self = self.owner; - self.health = self.max_health; - self.takedamage = DAMAGE_NO; // wil be reset upon return - door_use (); - self = oself; - } -}; - - -/* -================ -door_touch - -Prints messages -================ -*/ -void() door_touch = -{ - if (other.classname != "player") - return; - if (self.owner.attack_finished > time) - return; - - self.owner.attack_finished = time + 2; - - if (self.owner.message != "") - { - if (other.flags & FL_CLIENT) - centerprint (other, self.owner.message); - sound (other, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM); - } -}; - -/* -============================================================================= - -SPAWNING FUNCTIONS - -============================================================================= -*/ - - -entity(vector fmins, vector fmaxs) spawn_field = -{ - local entity trigger; - local vector t1, t2; - - trigger = spawn(); - trigger.classname = "doortriggerfield"; - trigger.movetype = MOVETYPE_NONE; - trigger.solid = SOLID_TRIGGER; - trigger.owner = self; - trigger.touch = door_trigger_touch; - - t1 = fmins; - t2 = fmaxs; - setsize (trigger, t1 - '60 60 8', t2 + '60 60 8'); - return (trigger); -}; - - -float (entity e1, entity e2) EntitiesTouching = -{ - if (e1.mins_x > e2.maxs_x) - return FALSE; - if (e1.mins_y > e2.maxs_y) - return FALSE; - if (e1.mins_z > e2.maxs_z) - return FALSE; - if (e1.maxs_x < e2.mins_x) - return FALSE; - if (e1.maxs_y < e2.mins_y) - return FALSE; - if (e1.maxs_z < e2.mins_z) - return FALSE; - return TRUE; -}; - - -/* -============= -LinkDoors - - -============= -*/ -void() LinkDoors = -{ - local entity t, starte; - local vector cmins, cmaxs; - - if (self.enemy) - return; // already linked by another door - if (self.spawnflags & 4) - { - self.owner = self.enemy = self; - return; // don't want to link this door - } - - cmins = self.mins; - cmaxs = self.maxs; - - starte = self; - t = self; - - do - { - self.owner = starte; // master door - - if (self.health) - starte.health = self.health; - if (self.targetname) - starte.targetname = self.targetname; - if (self.message != "") - starte.message = self.message; - - t = find(t, classname, self.classname); - if (!t) - { - self.enemy = starte; // make the chain a loop - - // shootable, or triggered doors just needed the owner/enemy links, - // they don't spawn a field - - self = self.owner; - - if (self.health) - return; - if (self.targetname) - return; - if (self.items) - return; - - self.owner.trigger_field = spawn_field(cmins, cmaxs); - - return; - } - - if (EntitiesTouching(self,t)) - { - if (t.enemy) - objerror ("cross connected doors"); - - self.enemy = t; - self = t; - - if (t.mins_x < cmins_x) - cmins_x = t.mins_x; - if (t.mins_y < cmins_y) - cmins_y = t.mins_y; - if (t.mins_z < cmins_z) - cmins_z = t.mins_z; - if (t.maxs_x > cmaxs_x) - cmaxs_x = t.maxs_x; - if (t.maxs_y > cmaxs_y) - cmaxs_y = t.maxs_y; - if (t.maxs_z > cmaxs_z) - cmaxs_z = t.maxs_z; - } - } while (1 ); - -}; - - -/*QUAKED func_door (0 .5 .8) ? START_OPEN x DOOR_DONT_LINK x x TOGGLE -if two doors touch, they are assumed to be connected and operate as a unit. - -TOGGLE causes the door to wait in both the start and end states for a trigger event. - -START_OPEN causes the door to move to its destination when spawned, and operate in reverse. It is used to temporarily or permanently close off an area when triggered (not usefull for touch or takedamage doors). - -"message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet -"angle" determines the opening direction -"targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door. -"health" if set, door must be shot open -"speed" movement speed (100 default) -"wait" wait before returning (3 default, -1 = never return) -"lip" lip remaining at end of move (8 default) -"dmg" damage to inflict when blocked (2 default) -"sounds" -0) no sound -1) stone -2) base -3) stone chain -4) screechy metal -*/ - -void() func_door = -{ - //if (!self.deathtype) // map makers can override this - // self.deathtype = " got in the way"; - SetMovedir (); - - self.max_health = self.health; - self.solid = SOLID_BSP; - self.movetype = MOVETYPE_PUSH; - setorigin (self, self.origin); - setmodel (self, self.model); - self.classname = "door"; - - self.blocked = door_blocked; - self.use = door_use; - - if (!self.speed) - self.speed = 100; - if (!self.wait) - self.wait = 3; - if (!self.lip) - self.lip = 8; - if (!self.dmg) - self.dmg = 2; - - self.pos1 = self.origin; - self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip); - -// DOOR_START_OPEN is to allow an entity to be lighted in the closed position -// but spawn in the open position - if (self.spawnflags & DOOR_START_OPEN) - { - setorigin (self, self.pos2); - self.pos2 = self.pos1; - self.pos1 = self.origin; - } - - self.state = STATE_BOTTOM; - - if (self.health) - { - self.takedamage = DAMAGE_YES; - self.event_damage = door_damage; - } - - if (self.items) - self.wait = -1; - - self.touch = door_touch; - -// LinkDoors can't be done until all of the doors have been spawned, so -// the sizes can be detected properly. - self.think = LinkDoors; - self.nextthink = self.ltime + 0.1; -}; - -/* -============================================================================= - -SECRET DOORS - -============================================================================= -*/ - -void() fd_secret_move1; -void() fd_secret_move2; -void() fd_secret_move3; -void() fd_secret_move4; -void() fd_secret_move5; -void() fd_secret_move6; -void() fd_secret_done; - -float SECRET_OPEN_ONCE = 1; // stays open -float SECRET_1ST_LEFT = 2; // 1st move is left of arrow -float SECRET_1ST_DOWN = 4; // 1st move is down from arrow -float SECRET_NO_SHOOT = 8; // only opened by trigger -float SECRET_YES_SHOOT = 16; // shootable even if targeted - - -void () fd_secret_use = -{ - local float temp; - - self.health = 10000; - //self.havocattack = TRUE; - - // exit if still moving around... - if (self.origin != self.oldorigin) - return; - - self.message = ""; // no more message - - SUB_UseTargets(); // fire all targets / killtargets - - self.velocity = '0 0 0'; - - // Make a sound, wait a little... - - if (self.noise1 != "") - sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NORM); - self.nextthink = self.ltime + 0.1; - - temp = 1 - (self.spawnflags & SECRET_1ST_LEFT); // 1 or -1 - makevectors(self.mangle); - - if (!self.t_width) - { - if (self.spawnflags & SECRET_1ST_DOWN) - self.t_width = fabs(v_up * self.size); - else - self.t_width = fabs(v_right * self.size); - } - - if (!self.t_length) - self.t_length = fabs(v_forward * self.size); - - if (self.spawnflags & SECRET_1ST_DOWN) - self.dest1 = self.origin - v_up * self.t_width; - else - self.dest1 = self.origin + v_right * (self.t_width * temp); - - self.dest2 = self.dest1 + v_forward * self.t_length; - SUB_CalcMove(self.dest1, self.speed, fd_secret_move1); - if (self.noise2 != "") - sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM); -}; - -// Wait after first movement... -void () fd_secret_move1 = -{ - self.nextthink = self.ltime + 1.0; - self.think = fd_secret_move2; - if (self.noise3 != "") - sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM); -}; - -// Start moving sideways w/sound... -void () fd_secret_move2 = -{ - if (self.noise2 != "") - sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM); - SUB_CalcMove(self.dest2, self.speed, fd_secret_move3); -}; - -// Wait here until time to go back... -void () fd_secret_move3 = -{ - if (self.noise3 != "") - sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM); - if (!(self.spawnflags & SECRET_OPEN_ONCE)) - { - self.nextthink = self.ltime + self.wait; - self.think = fd_secret_move4; - } -}; - -// Move backward... -void () fd_secret_move4 = -{ - if (self.noise2 != "") - sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM); - SUB_CalcMove(self.dest1, self.speed, fd_secret_move5); -}; - -// Wait 1 second... -void () fd_secret_move5 = -{ - self.nextthink = self.ltime + 1.0; - self.think = fd_secret_move6; - if (self.noise3 != "") - sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM); -}; - -void () fd_secret_move6 = -{ - if (self.noise2 != "") - sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM); - SUB_CalcMove(self.oldorigin, self.speed, fd_secret_done); -}; - -void () fd_secret_done = -{ - if (!self.targetname || self.spawnflags&SECRET_YES_SHOOT) - { - self.health = 10000; - self.takedamage = DAMAGE_YES; - //self.th_pain = fd_secret_use; - } - if (self.noise3 != "") - sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM); -}; - -void () secret_blocked = -{ - if (time < self.attack_finished) - return; - self.attack_finished = time + 0.5; - //T_Damage (other, self, self, self.dmg, self.dmg, self.deathtype, DT_IMPACT, (self.absmin + self.absmax) * 0.5, '0 0 0', Obituary_Generic); -}; - -/* -============== -secret_touch - -Prints messages -================ -*/ -void() secret_touch = -{ - if (activator.classname != "player") - return; - if (self.attack_finished > time) - return; - - self.attack_finished = time + 2; - - if (self.message) - { - if (other.flags & FL_CLIENT) - centerprint (other, self.message); - sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM); - } -}; - - -/*QUAKED func_door_secret (0 .5 .8) ? open_once 1st_left 1st_down no_shoot always_shoot -Basic secret door. Slides back, then to the side. Angle determines direction. -wait = # of seconds before coming back -1st_left = 1st move is left of arrow -1st_down = 1st move is down from arrow -always_shoot = even if targeted, keep shootable -t_width = override WIDTH to move back (or height if going down) -t_length = override LENGTH to move sideways -"dmg" damage to inflict when blocked (2 default) - -If a secret door has a targetname, it will only be opened by it's botton or trigger, not by damage. -"sounds" -1) medieval -2) metal -3) base -*/ - -void () func_door_secret = -{ - /*if (!self.deathtype) // map makers can override this - self.deathtype = " got in the way";*/ - - if (!self.dmg) - self.dmg = 2; - - // Magic formula... - self.mangle = self.angles; - self.angles = '0 0 0'; - self.solid = SOLID_BSP; - self.movetype = MOVETYPE_PUSH; - self.classname = "door"; - setmodel (self, self.model); - setorigin (self, self.origin); - - self.touch = secret_touch; - self.blocked = secret_blocked; - self.speed = 50; - self.use = fd_secret_use; - if ( !self.targetname || self.spawnflags&SECRET_YES_SHOOT) - { - self.health = 10000; - self.takedamage = DAMAGE_YES; - self.event_damage = fd_secret_use; - } - self.oldorigin = self.origin; - if (!self.wait) - self.wait = 5; // 5 seconds before closing -}; - diff --git a/qcsrc/gamec/t_quake.c b/qcsrc/gamec/t_quake.c deleted file mode 100644 index c8b0ef667..000000000 --- a/qcsrc/gamec/t_quake.c +++ /dev/null @@ -1,45 +0,0 @@ -//*********************** -//QUAKE 1 ENTITIES - So people can play quake1 maps with the nexuiz weapons -//*********************** -void weapon_nailgun (void) {weapon_electro();} -void weapon_supernailgun (void) {weapon_hagar();} -void weapon_supershotgun (void) {weapon_uzi();} - -void item_spikes (void) {item_bullets();} -void item_armor2 (void) {item_armor25();} -void item_armorInv (void) {item_armor25();} -void item_health (void) {if (self.spawnflags & 2) item_health100();else item_health25();} - -//item_spikes -//item_health - - - -// garbage function to reduce warnings in compiling about unused variables -void junk_function () -{ - self.exteriormodeltoclient = world; - self.glow_trail = 0; - self.tag_entity = world; - self.button6 = 0; - self.button7 = 0; - self.button8 = 0; - self.pitch_speed = 0; - self.drawonlytoclient = world; - self.nodrawtoclient = world; - self.cursor_active = 0; - self.cursor_screen = '0 0 0'; - self.cursor_trace_start = '0 0 0'; - self.ping = 0; - self.roomtype = 0; - self.radius = 0; - self.pitch = 0; - self.renderamt = 0; - self.rendermode = 0; - self.rendercolor = '0 0 0'; - self.light_lev = 0; - self.color = '0 0 0'; - self.style = 0; - bprint(ftos(sv_maxairspeed), "\n"); -} - diff --git a/qcsrc/gamec/t_quake3.c b/qcsrc/gamec/t_quake3.c deleted file mode 100644 index bac208d1b..000000000 --- a/qcsrc/gamec/t_quake3.c +++ /dev/null @@ -1,18 +0,0 @@ -//*********************** -//QUAKE 3 ENTITIES - So people can play quake3 maps with the nexuiz weapons -//*********************** -void weapon_machinegun (void) {weapon_uzi();} -void weapon_plasmagun (void) {weapon_electro();} -void weapon_lightning (void) {weapon_crylink();} -void weapon_railgun (void) {weapon_nex();} -void weapon_bfg (void) {weapon_hagar();} -void item_slugs (void) {item_cells();} -void item_lightning (void) {item_cells();} -void item_armorshard (void) {item_armor1();} -void item_armorbody (void) {item_armor25();} -void item_armor_shard (void) {item_armor1();} -void item_armor_body (void) {item_armor25();} -void item_armor_combat (void) {item_armor25();} -void item_health_small (void) {item_health1();} -void item_health_large (void) {item_health25();} -void item_health_mega (void) {item_health100();} diff --git a/qcsrc/gamec/t_teleporters.c b/qcsrc/gamec/t_teleporters.c deleted file mode 100644 index c194a321d..000000000 --- a/qcsrc/gamec/t_teleporters.c +++ /dev/null @@ -1,113 +0,0 @@ -void Damage (entity targ, entity inflictor, entity attacker, float -damage, float deathtype, vector hitloc, vector force); - -void() tdeath_touch = -{ - if (other == self.owner) - return; - // so teleporting shots etc can't telefrag - if (!self.owner.takedamage) - return; - if (!other.takedamage) - return; - - if ((self.owner.classname == "player") && (self.owner.health >= 1)) - Damage (other, self, self.owner, 10000, DEATH_TELEFRAG, other.origin, '0 0 0'); - else if (other.health < 1) // corpses gib - Damage (other, self, self.owner, 10000, DEATH_TELEFRAG, other.origin, '0 0 0'); - else // dead bodies and monsters gib themselves instead of telefragging - Damage (self.owner, self, self.owner, 10000, DEATH_TELEFRAG, self.owner.origin, '0 0 0'); -}; - -// org2 is where they will return to if the teleport fails -void(vector org, entity death_owner, vector org2) spawn_tdeath = -{ - local entity death; - - death = spawn(); -// death.classname = "teledeath"; - death.movetype = MOVETYPE_NONE; - death.solid = SOLID_TRIGGER; - death.angles = '0 0 0'; - death.dest2 = org2; - setsize (death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1'); - setorigin (death, org); - death.touch = tdeath_touch; - death.nextthink = time + 0.2; - death.think = SUB_Remove; - death.owner = death_owner; - - force_retouch = 2; // make sure even still objects get hit -}; - -void Teleport_Touch (void) -{ - if (other.health < 1) - return; - if (other.classname != "player") // FIXME: Make missiles firable through the teleport too - return; - - // Make teleport effect where the player left - sound (other, CHAN_ITEM, "misc/teleport.wav", 1, ATTN_NORM); - te_teleport (other.origin); - - dest = find (world, targetname, self.target); - if (!dest) - objerror ("Teleporter with nonexistant target"); - - // Make teleport effect where the player arrived - sound (other, CHAN_ITEM, "misc/teleport.wav", 1, ATTN_NORM); - makevectors (dest.mangle); - te_teleport (dest.origin + v_forward * 32); - - spawn_tdeath(dest.origin, other, other.origin); - - // Relocate the player - //setorigin (other, dest.origin); - setorigin (other, dest.origin + '0 0 1' * (1 - other.mins_z - 24)); - other.angles = dest.mangle; - other.fixangle = TRUE; - - other.velocity = '0 0 0'; - - other.flags = other.flags - (other.flags & FL_ONGROUND); - // reset tracking of oldvelocity for impact damage (sudden velocity changes) - other.oldvelocity = other.velocity; - // reset tracking of who pushed you into a hazard (for kill credit) - other.pushltime = 0; -} - -void info_teleport_destination (void) -{ - self.mangle = self.angles; - self.angles = '0 0 0'; - - //setorigin (self, self.origin + '0 0 27'); // To fix a mappers' habit as old as Quake - setorigin (self, self.origin); - - if (!self.targetname) - objerror ("Teleport destination without a targetname"); -} - -void misc_teleporter_dest (void) -{ - info_teleport_destination(); -} - -void trigger_teleport (void) -{ - self.angles = '0 0 0'; - - self.solid = SOLID_TRIGGER; - self.movetype = MOVETYPE_NONE; - - setmodel (self, self.model); - - self.model = ""; - self.modelindex = 0; - - self.touch = Teleport_Touch; - - if (!self.target) - objerror ("Teleporter with no target"); -} \ No newline at end of file diff --git a/qcsrc/gamec/teamplay.c b/qcsrc/gamec/teamplay.c deleted file mode 100644 index 36af96e89..000000000 --- a/qcsrc/gamec/teamplay.c +++ /dev/null @@ -1,1049 +0,0 @@ -float COLOR_TEAM1 = 5; // red -float COLOR_TEAM2 = 14; // blue -float COLOR_TEAM3 = 4; // green -float COLOR_TEAM4 = 13; // yellow - - -float GAME_DEATHMATCH = 1; -float GAME_TEAM_DEATHMATCH = 2; -float GAME_DOMINATION = 3; -float GAME_CTF = 4; -float GAME_RUNEMATCH = 5; - -// client counts for each team -float c1, c2, c3, c4; -// # of bots on those teams -float cb1, cb2, cb3, cb4; - - -float g_domination, g_ctf, g_tdm; - -float audit_teams_time; - - -string TeamName(float t) -{ - // fixme: Search for team entities and get their .netname's! - if(t == COLOR_TEAM1) - return "Red Team"; - if(t == COLOR_TEAM2) - return "Blue Team"; - if(t == COLOR_TEAM3) - return "Green Team"; - if(t == COLOR_TEAM4) - return "Yellow Team"; - return "Neutral Team"; -} -string ColoredTeamName(float t) -{ - // fixme: Search for team entities and get their .netname's! - if(t == COLOR_TEAM1) - return "^1Red Team^7"; - if(t == COLOR_TEAM2) - return "^4Blue Team^7"; - if(t == COLOR_TEAM3) - return "^2Green Team^7"; - if(t == COLOR_TEAM4) - return "^3Yellow Team^7"; - return "Neutral Team"; -} -string TeamNoName(float t) -{ - // fixme: Search for team entities and get their .netname's! - if(t == 1) - return "Red Team"; - if(t == 2) - return "Blue Team"; - if(t == 3) - return "Green Team"; - if(t == 4) - return "Yellow Team"; - return "Neutral Team"; -} - -void dom_init(); -void ctf_init(); -void runematch_init(); -void tdm_init(); - - -void ResetGameCvars() -{ - cvar_set("g_tdm", "0"); - cvar_set("g_domination", "0"); - cvar_set("g_ctf", "0"); - cvar_set("g_runematch", "0"); - cvar_set("teamplay", "0"); - - - cvar_set("exit_cfg", ""); -} - -void ActivateTeamplay() -{ - float teamplay_default; - teamplay_default = cvar("teamplay_default"); - - if(teamplay_default) - cvar_set("teamplay", ftos(teamplay_default)); - else - cvar_set("teamplay", "3"); -} - -string gamemode_name; -float teams_matter; - -void InitGameplayMode() -{ - float fraglimit_override, timelimit_override; - - game = cvar ("gamecfg"); // load game options - - // game cvars get reset before map changes - // then map's cfg sets them as desired - - // FIXME: also set a message or game mode name to print to players when the join - - // set both here, gamemode can override it later - timelimit_override = cvar("timelimit_override"); - fraglimit_override = cvar("fraglimit_override"); - - if(game == GAME_DOMINATION || cvar("g_domination")) - { - game = GAME_DOMINATION; - cvar_set("g_domination", "1"); - - ActivateTeamplay(); - - fraglimit_override = cvar("g_domination_point_limit"); - - gamemode_name = "Domination"; - teams_matter = 1; - } - else if(game == GAME_CTF || cvar("g_ctf")) - { - game = GAME_CTF; - cvar_set("g_ctf", "1"); - - ActivateTeamplay(); - - fraglimit_override = cvar("g_ctf_capture_limit"); - - gamemode_name = "Capture the Flag"; - teams_matter = 1; - } - else if(game == GAME_RUNEMATCH || cvar("g_runematch")) - { - game = GAME_RUNEMATCH; - cvar_set("g_runematch", "1"); - - if(cvar("deathmatch_force_teamplay")) - ActivateTeamplay(); - - fraglimit_override = cvar("g_runematch_point_limit"); - - gamemode_name = "Rune Match"; - if(cvar("teamplay")) - teams_matter = 1; - else - teams_matter = 0; - } - else if(game == GAME_DEATHMATCH || game == GAME_TEAM_DEATHMATCH || cvar("g_tdm")) - { - if(!cvar("deathmatch")) - cvar_set("deathmatch", "1"); - - - if(game == GAME_TEAM_DEATHMATCH || cvar("g_tdm") || cvar("deathmatch_force_teamplay")) - { - game = GAME_TEAM_DEATHMATCH; - gamemode_name = "Team Deathmatch"; - ActivateTeamplay(); - teams_matter = 1; - } - else - { - game = GAME_DEATHMATCH; - gamemode_name = "Deathmatch"; - teams_matter = 0; - } - - fraglimit_override = cvar("fraglimit_override"); - } - else - { - // we can only assume... - gamemode_name = "Deathmatch"; - teams_matter = 0; - } -/* else if(game == GAME_TEAM_DEATHMATCH) - { - if(!cvar("deathmatch")) - cvar_set("deathmatch", "1"); - - //if(!cvar("teamplay")) - // cvar_set("teamplay", "3"); - ActivateTeamplay(); - - fraglimit_override = cvar("fraglimit_override"); - }*/ - - // enforce the server's universal frag/time limits - if(fraglimit_override >= 0) - cvar_set("fraglimit", ftos(fraglimit_override)); - if(timelimit_override >= 0) - cvar_set("timelimit", ftos(timelimit_override)); - - if (game == GAME_DOMINATION)//cvar("g_domination")) - dom_init(); - else if (game == GAME_CTF)//cvar("g_ctf")) - ctf_init(); - else if (game == GAME_RUNEMATCH)//cvar("g_runematch")) - runematch_init(); - else if (game == GAME_TEAM_DEATHMATCH)//cvar("g_runematch")) - tdm_init(); - - // be backwards compatible - if (cvar("g_instagib")) { - cvar_set("g_start_weapon_laser", ftos(FALSE)); - cvar_set("g_start_weapon_shotgun", ftos(FALSE)); - cvar_set("g_start_weapon_uzi", ftos(FALSE)); - cvar_set("g_start_weapon_grenadelauncher", ftos(FALSE)); - cvar_set("g_start_weapon_electro", ftos(FALSE)); - cvar_set("g_start_weapon_crylink", ftos(FALSE)); - cvar_set("g_start_weapon_nex", ftos(TRUE)); - cvar_set("g_start_weapon_hagar", ftos(FALSE)); - cvar_set("g_start_weapon_rocketlauncher", ftos(FALSE)); - cvar_set("g_pickup_items", ftos(FALSE)); - cvar_set("g_use_ammunition", ftos(FALSE)); - } - if (cvar("g_rocketarena")) { - cvar_set("g_start_weapon_laser", ftos(FALSE)); - cvar_set("g_start_weapon_shotgun", ftos(FALSE)); - cvar_set("g_start_weapon_uzi", ftos(FALSE)); - cvar_set("g_start_weapon_grenadelauncher", ftos(FALSE)); - cvar_set("g_start_weapon_electro", ftos(FALSE)); - cvar_set("g_start_weapon_crylink", ftos(FALSE)); - cvar_set("g_start_weapon_nex", ftos(FALSE)); - cvar_set("g_start_weapon_hagar", ftos(FALSE)); - cvar_set("g_start_weapon_rocketlauncher", ftos(TRUE)); - cvar_set("g_pickup_items", ftos(FALSE)); - cvar_set("g_use_ammunition", ftos(FALSE)); - } -} - -void PrintWelcomeMessage(entity pl) -{ - string s, grap_msg, temp; - float colored; - - if(self.welcomemessage_time < time) - return; - if(self.welcomemessage_time2 > time) - return; - self.welcomemessage_time2 = time + 0.8; - - colored = 1; - if(colored) - { - if(cvar("g_grappling_hook")) - grap_msg = strzone("\n\nBind a key to ^1+hook^8 to use the grappling hook\n"); - - s = strcat("\n\nThis is Nexuiz ", cvar_string("g_nexuizversion"), "\n\nMatch type is ^1", gamemode_name, "^8\n"); - s = strzone(s); - - temp = strcat( - "\n\n\n^8Welcome, ", pl.netname, "\n", - s - ); - temp = strzone(temp); - - if(teams_matter) - { - s = strcat(temp, - "You are on ", ColoredTeamName(pl.team), "^8\n\n", - "Go to ^1Menu->Options->Player^8 to change your name, model & team\n", - grap_msg - ); - } - else - { - s = strcat(temp, - "Go to ^1Menu->Options->Player^8 to change your name & model\n", - grap_msg - ); - } - } - else - { - if(cvar("g_grappling_hook")) - grap_msg = strzone("\n\nBind a key to +hook to use the grappling hook\n"); - - s = strcat("Match type is ", gamemode_name, "\n"); - s = strzone(s); - - temp = strcat( - "\n\n\nWelcome, ", pl.netname, "\n", - s - ); - temp = strzone(temp); - - if(teams_matter) - { - s = strcat(temp, - "You are on ", TeamName(pl.team), "\n\n", - "Go to Menu->Options->Player to\nchange your name, model & team\n", - grap_msg - ); - } - else - { - s = strcat(temp, - "Go to Menu->Options->Player to change your name & model\n", - grap_msg - ); - } - } - - centerprint(pl, s); - //sprint(pl, s); - - strunzone(temp); -} - - -void SetPlayerColors(entity pl, float color) -{ - /*string s; - s = ftos(cl); - stuffcmd(pl, strcat("color ", s, " ", s, "\n") ); - pl.team = cl + 1; - //pl.clientcolors = pl.clientcolors - (pl.clientcolors & 15) + cl; - pl.clientcolors = 16*cl + cl;*/ - - setcolor(pl, 16*color + color); -} - -void SetPlayerTeam(entity pl, float t, float s, float noprint) -{ - float color; - if(t == 4) - color = COLOR_TEAM4 - 1; - else if(t == 3) - color = COLOR_TEAM3 - 1; - else if(t == 2) - color = COLOR_TEAM2 - 1; - else - color = COLOR_TEAM1 - 1; - setcolor(pl, 16*color + color); - - if(!noprint && t != s) - { - //bprint(strcat(pl.netname, " has changed to ", TeamNoName(t), "\n")); - bprint(strcat(pl.netname, " has changed from ", TeamNoName(s), " to ", TeamNoName(t), "\n")); - } -} - - - - - - -// set c1...c4 to show what teams are allowed -void CheckAllowedTeams () -{ - string teament_name; - float dm; - entity head; - -// if(!dom && !ctf) -// dm = 1; - - c1 = c2 = c3 = c4 = -1; - cb1 = cb2 = cb3 = cb4 = 0; - - if(g_domination) - teament_name = "dom_team"; - else if(g_ctf) - teament_name = "ctf_team"; - else if(g_tdm) - teament_name = "tdm_team"; - else - { - // cover anything else by treating it like tdm with no teams spawned - dm = cvar("g_tdm_teams"); - if(dm < 2) - error("g_tdm_teams < 2, not enough teams to play team deathmatch\n"); - - if(dm >= 4) - { - c1 = c2 = c3 = c4 = 0; - } - else if(dm >= 3) - { - c1 = c2 = c3 = 0; - } - else// if(dm >= 2) - { - c1 = c2 = 0; - } - return; - } - - // first find out what teams are allowed - head = find(world, classname, teament_name); - while(head) - { - if(!(g_domination && head.netname == "")) - { - if(head.team == COLOR_TEAM1) - { - c1 = 0; - } - if(head.team == COLOR_TEAM2) - { - c2 = 0; - } - if(head.team == COLOR_TEAM3) - { - c3 = 0; - } - if(head.team == COLOR_TEAM4) - { - c4 = 0; - } - } - head = find(head, classname, teament_name); - } -} - -// c1...c4 should be set to -1 (not allowed) or 0 (allowed). -// teams that are allowed will now have their player counts stored in c1...c4 -void GetTeamCounts(entity ignore) -{ - entity head; - // now count how many players are on each team already - - // FIXME: also find and memorize the lowest-scoring bot on each team (in case players must be shuffled around) - // also remember the lowest-scoring player - - head = find(world, classname, "player"); - while(head) - { - if(head != ignore)// && head.netname != "") - { - if(head.team == COLOR_TEAM1) - { - if(c1 >= 0) - { - c1 = c1 + 1; - cb1 = cb1 + 1; - } - } - if(head.team == COLOR_TEAM2) - { - if(c2 >= 0) - { - c2 = c2 + 1; - cb2 = cb2 + 1; - } - } - if(head.team == COLOR_TEAM3) - { - if(c3 >= 0) - { - c3 = c3 + 1; - cb3 = cb3 + 1; - } - } - if(head.team == COLOR_TEAM4) - { - if(c4 >= 0) - { - c4 = c4 + 1; - cb4 = cb4 + 1; - } - } - } - head = find(head, classname, "player"); - } -} - -// returns # of smallest team (1, 2, 3, 4) -// NOTE: Assumes CheckAllowedTeams has already been called! -float FindSmallestTeam(entity pl, float ignore_pl) -{ - float totalteams, smallestteam, smallestteam_count, balance_type; - totalteams = 0; - - // find out what teams are available - //CheckAllowedTeams(); - - // make sure there are at least 2 teams to join - if(c1 >= 0) - totalteams = totalteams + 1; - if(c2 >= 0) - totalteams = totalteams + 1; - if(c3 >= 0) - totalteams = totalteams + 1; - if(c4 >= 0) - totalteams = totalteams + 1; - - if(totalteams <= 1) - { - if(g_domination) - error("Too few teams available for domination\n"); - else if(g_ctf) - error("Too few teams available for ctf\n"); - else - error("Too few teams available for team deathmatch\n"); - } - - - // count how many players are in each team - if(ignore_pl) - GetTeamCounts(world); - else - GetTeamCounts(pl); - - - - // c1...c4 now have counts of each team - // figure out which is smallest, giving priority to the team the player is already on as a tie-breaker - - smallestteam = 0; - smallestteam_count = 999; - - // 2 gives priority to what team you're already on, 1 goes in order - // 2 doesn't seem to work though... - balance_type = 1; - - if(balance_type == 1) - { - if(c1 >= 0 && c1 < smallestteam_count) - { - smallestteam = 1; - smallestteam_count = c1; - } - if(c2 >= 0 && c2 < smallestteam_count) - { - smallestteam = 2; - smallestteam_count = c2; - } - if(c3 >= 0 && c3 < smallestteam_count) - { - smallestteam = 3; - smallestteam_count = c3; - } - if(c4 >= 0 && c4 < smallestteam_count) - { - smallestteam = 4; - smallestteam_count = c4; - } - } - else - { - if(c1 >= 0 && (c1 < smallestteam_count || - (c1 == smallestteam_count && self.team == COLOR_TEAM1) ) ) - { - smallestteam = 1; - smallestteam_count = c1; - } - if(c2 >= 0 && c2 < (c2 < smallestteam_count || - (c2 == smallestteam_count && self.team == COLOR_TEAM2) ) ) - { - smallestteam = 2; - smallestteam_count = c2; - } - if(c3 >= 0 && c3 < (c3 < smallestteam_count || - (c3 == smallestteam_count && self.team == COLOR_TEAM3) ) ) - { - smallestteam = 3; - smallestteam_count = c3; - } - if(c4 >= 0 && c4 < (c4 < smallestteam_count || - (c4 == smallestteam_count && self.team == COLOR_TEAM4) ) ) - { - smallestteam = 4; - smallestteam_count = c4; - } - } - - return smallestteam; -} - -float JoinBestTeam(entity pl, float only_return_best) -{ - float smallest, selectedteam; - - g_domination = cvar("g_domination"); - g_ctf = cvar("g_ctf"); - - // don't join a team if we're not playing a team game - if(!cvar("teamplay") && !g_domination && !g_ctf) - return 0; - - // find out what teams are available - CheckAllowedTeams(); - - // if we don't care what team he ends up on, put him on whatever team he entered as. - // if he's not on a valid team, then let other code put him on the smallest team - if(!cvar("balance_teams") && !cvar("force_balance")) - { - if( c1 >= 0 && pl.team == COLOR_TEAM1) - selectedteam = pl.team; - else if(c2 >= 0 && pl.team == COLOR_TEAM2) - selectedteam = pl.team; - else if(c3 >= 0 && pl.team == COLOR_TEAM3) - selectedteam = pl.team; - else if(c4 >= 0 && pl.team == COLOR_TEAM4) - selectedteam = pl.team; - else - selectedteam = -1; - if(selectedteam > 0) - { - if(!only_return_best) - SetPlayerColors(pl, selectedteam - 1); - return selectedteam; - } - // otherwise end up on the smallest team (handled below) - } - - smallest = FindSmallestTeam(pl, TRUE); - - - if(!only_return_best) - { - if(smallest == 1) - { - SetPlayerColors(pl, COLOR_TEAM1 - 1); - } - else if(smallest == 2) - { - SetPlayerColors(pl, COLOR_TEAM2 - 1); - } - else if(smallest == 3) - { - SetPlayerColors(pl, COLOR_TEAM3 - 1); - } - else if(smallest == 4) - { - SetPlayerColors(pl, COLOR_TEAM4 - 1); - } - else - error("smallest team: invalid team\n"); - } - - return smallest; -} - - -void SV_ChangeTeam(float color) -{ - float scolor, dcolor, steam, dteam, dbotcount, scount, dcount; - - scolor = self.clientcolors & 15; - dcolor = color & 15; - - if(scolor == COLOR_TEAM1 - 1) - steam = 1; - else if(scolor == COLOR_TEAM2 - 1) - steam = 2; - else if(scolor == COLOR_TEAM3 - 1) - steam = 3; - else if(scolor == COLOR_TEAM4 - 1) - steam = 4; - if(dcolor == COLOR_TEAM1 - 1) - dteam = 1; - else if(dcolor == COLOR_TEAM2 - 1) - dteam = 2; - else if(dcolor == COLOR_TEAM3 - 1) - dteam = 3; - else if(dcolor == COLOR_TEAM4 - 1) - dteam = 4; - - // not changing teams - if(scolor == dcolor) - { - //setcolor(self, 16*color + color); - //bprint("same team change\n"); - SetPlayerTeam(self, dteam, steam, TRUE); - return; - } - - if(cvar("teamplay")) - { - if(cvar("g_changeteam_banned")) - { - sprint(self, "Team changes not allowed\n"); - return; // changing teams is not allowed - } - - if(cvar("g_balance_teams_prevent_imbalance")) - { - // only allow changing to a smaller or equal size team - - // find out what teams are available - CheckAllowedTeams(); - // count how many players on each team - GetTeamCounts(world); - - // get desired team - if(dteam == 1 && c1 >= 0)//dcolor == COLOR_TEAM1 - 1) - { - dcount = c1; - dbotcount = cb1; - } - else if(dteam == 2 && c2 >= 0)//dcolor == COLOR_TEAM2 - 1) - { - dcount = c2; - dbotcount = cb2; - } - else if(dteam == 3 && c3 >= 0)//dcolor == COLOR_TEAM3 - 1) - { - dcount = c3; - dbotcount = cb3; - } - else if(dteam == 4 && c4 >= 0)//dcolor == COLOR_TEAM4 - 1) - { - dcount = c4; - dbotcount = cb4; - } - else - { - sprint(self, "Cannot change to an invalid team\n"); - - return; - } - - // get starting team - if(steam == 1)//scolor == COLOR_TEAM1 - 1) - scount = c1; - else if(steam == 2)//scolor == COLOR_TEAM2 - 1) - scount = c2; - else if(steam == 3)//scolor == COLOR_TEAM3 - 1) - scount = c3; - else if(steam == 4)//scolor == COLOR_TEAM4 - 1) - scount = c4; - - if(scount) // started at a valid, nonempty team - { - // check if we're trying to change to a larger team that doens't have bots to swap with - if(dcount >= scount && dbotcount <= 0) - { - sprint(self, "Cannot change to a larger team\n"); - return; // can't change to a larger team - } - } - } - } - - // reduce frags during a team change - self.frags = floor(self.frags * (cvar("g_changeteam_fragtransfer") / 100)); - -// bprint(strcat("allow change teams from ", ftos(steam), " to ", ftos(dteam), "\n")); - - SetPlayerTeam(self, dteam, steam, FALSE); - //setcolor(self, 16*dcolor + dcolor); -} - - -void ShufflePlayerOutOfTeam (float source_team) -{ - float smallestteam, smallestteam_count, steam; - float lowest_bot_score, lowest_player_score; - entity head, lowest_bot, lowest_player, selected; - - smallestteam = 0; - smallestteam_count = 999; - - if(c1 >= 0 && c1 < smallestteam_count) - { - smallestteam = 1; - smallestteam_count = c1; - } - if(c2 >= 0 && c2 < smallestteam_count) - { - smallestteam = 2; - smallestteam_count = c2; - } - if(c3 >= 0 && c3 < smallestteam_count) - { - smallestteam = 3; - smallestteam_count = c3; - } - if(c4 >= 0 && c4 < smallestteam_count) - { - smallestteam = 4; - smallestteam_count = c4; - } - - if(!smallestteam) - { - bprint("warning: no smallest team\n"); - return; - } - - if(source_team == 1) - steam = COLOR_TEAM1; - else if(source_team == 2) - steam = COLOR_TEAM2; - else if(source_team == 3) - steam = COLOR_TEAM3; - else if(source_team == 4) - steam = COLOR_TEAM4; - - lowest_bot = world; - lowest_bot_score = 9999; - lowest_player = world; - lowest_player_score = 9999; - - // find the lowest-scoring player & bot of that team - head = find(world, classname, "player"); - while(head) - { - if(head.team == steam) - { - if(head.isbot) - { - if(head.frags < lowest_bot_score) - { - lowest_bot = head; - lowest_bot_score = head.frags; - } - } - else - { - if(head.frags < lowest_player_score) - { - lowest_player = head; - lowest_player_score = head.frags; - } - } - } - head = find(head, classname, "player"); - } - - // prefers to move a bot... - if(lowest_bot != world) - selected = lowest_bot; - // but it will move a player if it has to - else - selected = lowest_player; - // don't do anything if it couldn't find anyone - if(!selected) - { - bprint("warning: couldn't find a player to move from team\n"); - return; - } - - // smallest team gains a member - if(smallestteam == 1) - { - c1 = c1 + 1; - } - else if(smallestteam == 2) - { - c2 = c2 + 1; - } - else if(smallestteam == 3) - { - c3 = c3 + 1; - } - else if(smallestteam == 4) - { - c4 = c4 + 1; - } - else - { - bprint("warning: destination team invalid\n"); - return; - } - // source team loses a member - if(source_team == 1) - { - c1 = c1 + 1; - } - else if(source_team == 2) - { - c2 = c2 + 2; - } - else if(source_team == 3) - { - c3 = c3 + 3; - } - else if(source_team == 4) - { - c4 = c4 + 4; - } - else - { - bprint("warning: source team invalid\n"); - return; - } - - // move the player to the new team - SetPlayerTeam(selected, smallestteam, source_team, FALSE); -} - -// part of g_balance_teams_force -// occasionally perform an audit of the teams to make -// sure they're more or less balanced in player count. -void AuditTeams() -{ - float numplayers, numteams, average; - if(!cvar("g_balance_teams_force")) - return; - if(!cvar("teamplay")) - return; - - if(audit_teams_time > time) - return; - - audit_teams_time = time + 4 + random(); - -// bprint("Auditing teams\n"); - - CheckAllowedTeams(); - GetTeamCounts(world); - - - numteams = numplayers = 0; - if(c1 >= 0) - { - numteams = numteams + 1; - numplayers = numplayers + c1; - } - if(c2 >= 0) - { - numteams = numteams + 1; - numplayers = numplayers + c2; - } - if(c3 >= 0) - { - numteams = numteams + 1; - numplayers = numplayers + c3; - } - if(c4 >= 0) - { - numteams = numteams + 1; - numplayers = numplayers + c4; - } - - if(numplayers <= 0) - return; // no players to move around - if(numteams < 2) - return; // don't bother shuffling if for some reason there aren't any teams - - average = ceil(numplayers / numteams); - - if(average <= 0) - return; // that's weird... - - if(c1 && c1 > average) - { - bprint("Rebalancing Teams\n"); - //bprint("Shuffle from team 1\n"); - ShufflePlayerOutOfTeam(1); - } - if(c2 && c2 > average) - { - bprint("Rebalancing Teams\n"); - //bprint("Shuffle from team 2\n"); - ShufflePlayerOutOfTeam(2); - } - if(c3 && c3 > average) - { - bprint("Rebalancing Teams\n"); - //bprint("Shuffle from team 3\n"); - ShufflePlayerOutOfTeam(3); - } - if(c4 && c4 > average) - { - bprint("Rebalancing Teams\n"); - //bprint("Shuffle from team 4\n"); - ShufflePlayerOutOfTeam(4); - } - - // if teams are still unbalanced, balance them further in the next audit, - // which will happen sooner (keep doing rapid audits until things are in order) - audit_teams_time = time + 0.7 + random()*0.3; -} - - - -/*void(entity e, float first) UpdateTeamScore = -{ - clientno = e.FIXME; - if(first) - { - WriteByte (MSG_ALL, SVC_UPDATENAME); - WriteByte (MSG_ALL, clientno); - WriteString (MSG_ALL, e.netname); - - WriteByte (MSG_ALL, SVC_UPDATECOLORS); - WriteByte (MSG_ALL, clientno); - WriteByte (MSG_ALL, e.b_shirt * 16 + who.b_pants); - } - - WriteByte (MSG_ALL, SVC_UPDATEFRAGS); - WriteByte (MSG_ALL, clientno); - WriteShort (MSG_ALL, e.frags + 10000); -}; - -*/ - - - - - -void() tdm_team = -{ - self.classname = "tdm_team"; - self.team = self.cnt + 1; -}; - -// code from here on is just to support maps that don't have team entities -void tdm_spawnteam (string teamname, float teamcolor) -{ - local entity oldself; - oldself = self; - self = spawn(); - self.classname = "tdm_team"; - self.netname = teamname; - self.cnt = teamcolor; - - tdm_team(); - - self = oldself; -}; - -// spawn some default teams if the map is not set up for tdm -void() tdm_spawnteams = -{ - float numteams; - - numteams = cvar("g_tdm_teams"); - - tdm_spawnteam("Red", 4); - tdm_spawnteam("Blue", 13); -}; - -void() tdm_delayedinit = -{ - self.think = SUB_Remove; - self.nextthink = time; - // if no teams are found, spawn defaults - if (find(world, classname, "tdm_team") == world) - tdm_spawnteams(); -}; - -void() tdm_init = -{ - local entity e; - e = spawn(); - e.think = tdm_delayedinit; - e.nextthink = time + 0.1; -}; - - diff --git a/qcsrc/gamec/w_common.c b/qcsrc/gamec/w_common.c deleted file mode 100644 index 87d94c76f..000000000 --- a/qcsrc/gamec/w_common.c +++ /dev/null @@ -1,648 +0,0 @@ - -// increments sprite frame, loops when end is hit.. simple - -float TE_SMOKE =77; -void (vector vec) WriteVec = -{ - WriteCoord (MSG_BROADCAST, vec_x); - WriteCoord (MSG_BROADCAST, vec_y); - WriteCoord (MSG_BROADCAST, vec_z); -} -void (vector org, vector dir, float counts) W_Smoke = -{ - WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte (MSG_BROADCAST, TE_SMOKE); - WriteVec (org); - WriteVec (dir); - WriteByte (MSG_BROADCAST, counts); -} - -// increments sprite frame, loops when end is hit.. simple -void animate_sprite (float startframe, float frame_count) -{ - if ((self.frame - startframe) >= (frame_count - 1 )) - self.frame = startframe; - else - self.frame = self.frame + 1; -} - -void W_UpdateAmmo (void) -{ - /* - self.items = self.items - (self.items & (IT_NAILS | IT_SHELLS | IT_ROCKETS | IT_CELLS)); - - if (self.weapon == IT_LASER) - self.currentammo = 1; - else if (self.weapon == IT_SHOTGUN) - { - self.currentammo = self.ammo_shells; - self.items = self.items | IT_SHELLS; - } - else if (self.weapon == IT_UZI) - { - self.currentammo = self.ammo_nails; - self.items = self.items | IT_NAILS; - } - else if (self.weapon == IT_GRENADE_LAUNCHER || self.weapon == IT_HAGAR || self.weapon == IT_ROCKET_LAUNCHER) - { - self.currentammo = self.ammo_rockets; - self.items = self.items | IT_ROCKETS; - } - else if (self.weapon == IT_ELECTRO || self.weapon == IT_NEX || self.weapon == IT_CRYLINK) - { - self.currentammo = self.ammo_cells; - self.items = self.items | IT_CELLS; - } - */ -} - -void W_UpdateWeapon (void) -{ - /* - if (self.weapon == IT_LASER) - self.weaponmodel = "models/weapons/w_laser.zym"; - else if (self.weapon == IT_SHOTGUN) - self.weaponmodel = "models/weapons/w_shotgun.zym"; - else if (self.weapon == IT_UZI) - self.weaponmodel = "models/weapons/w_uzi.zym"; - else if (self.weapon == IT_GRENADE_LAUNCHER) - self.weaponmodel = "models/weapons/w_gl.zym"; - else if (self.weapon == IT_ELECTRO) - self.weaponmodel = "models/weapons/w_electro.zym"; - else if (self.weapon == IT_CRYLINK) - self.weaponmodel = "models/weapons/w_crylink.zym"; - else if (self.weapon == IT_NEX) - self.weaponmodel = "models/weapons/w_nex.zym"; - else if (self.weapon == IT_HAGAR) - self.weaponmodel = "models/weapons/w_hagar.zym"; - else if (self.weapon == IT_ROCKET_LAUNCHER) - self.weaponmodel = "models/weapons/w_rl.zym"; - else - objerror ("Illegal weapon - please register your guns please!"); - */ -} - -float W_GetBestWeapon (entity e) -{ - /* - if ((e.items & IT_ROCKET_LAUNCHER) && e.ammo_rockets) - return IT_ROCKET_LAUNCHER; - else if ((e.items & IT_NEX) && e.ammo_cells) - return IT_NEX; - else if ((e.items & IT_HAGAR) && e.ammo_rockets) - return IT_HAGAR; - else if ((e.items & IT_GRENADE_LAUNCHER) && e.ammo_rockets) - return IT_GRENADE_LAUNCHER; - else if ((e.items & IT_ELECTRO) && e.ammo_cells) - return IT_ELECTRO; - else if ((e.items & IT_CRYLINK) && e.ammo_cells) - return IT_CRYLINK; - else if ((e.items & IT_UZI) && e.ammo_nails) - return IT_UZI; - else if ((e.items & IT_SHOTGUN) && e.ammo_shells) - return IT_SHOTGUN; - else - - */ - return IT_LASER; -} - -void W_GiveWeapon (entity e, float wep, string name) -{ - entity oldself; - - if (!wep) - return; - - e.items = e.items | wep; - - oldself = self; - self = e; - - weapon_action(self.weapon, WR_UPDATECOUNTS); - - if (other.classname == "player") - { - sprint (other, "You got the ^2"); - sprint (other, name); - sprint (other, "\n"); - } - - -/* - W_UpdateWeapon (); - W_UpdateAmmo (); -*/ - self = oldself; -} -/* -void W_SwitchWeapon (float wep) -{ - float nextwep; - var float noammo = FALSE; - - if (wep == 1) - nextwep = IT_LASER; - else if (wep == 2) - { - nextwep = IT_SHOTGUN; - if (!self.ammo_shells) - noammo = TRUE; - } - else if (wep == 3) - { - nextwep = IT_UZI; - if (!self.ammo_nails) - noammo = TRUE; - } - else if (wep == 4) - { - nextwep = IT_CRYLINK; - if (!self.ammo_cells) - noammo = TRUE; - } - else if (wep == 5) - { - nextwep = IT_ELECTRO; - if (!self.ammo_cells) - noammo = TRUE; - } - else if (wep == 6) - { - nextwep = IT_GRENADE_LAUNCHER; - if (!self.ammo_rockets) - noammo = TRUE; - } - else if (wep == 7) - { - nextwep = IT_HAGAR; - if (!self.ammo_rockets) - noammo = TRUE; - } - else if (wep == 8) - { - nextwep = IT_NEX; - if (!self.ammo_cells) - noammo = TRUE; - } - else if (wep == 9) - { - nextwep = IT_ROCKET_LAUNCHER; - if (!self.ammo_rockets) - noammo = TRUE; - } - - - if (!(self.items & nextwep)) - { - sprint (self, "You don't own that weapon\n"); - return; - } - else if (noammo) - { - sprint (self, "You don't have any ammo for that weapon\n"); - return; - } - - self.weapon = nextwep; - W_UpdateWeapon (); - W_UpdateAmmo (); - self.attack_finished = time + 0.2; - if (self.viewzoom != 1) - self.viewzoom = 1; -} - -void W_NextWeapon (void) -{ - float noammo; - - while (TRUE) - { - noammo = FALSE; - - if (self.weapon == IT_ROCKET_LAUNCHER) - self.weapon = IT_LASER; - else if (self.weapon == IT_LASER) - { - self.weapon = IT_SHOTGUN; - if (!self.ammo_shells) - noammo = TRUE; - } - else if (self.weapon == IT_SHOTGUN) - { - self.weapon = IT_UZI; - if (!self.ammo_nails) - noammo = TRUE; - } - else if (self.weapon == IT_UZI) - { - self.weapon = IT_CRYLINK; - if (!self.ammo_cells) - noammo = TRUE; - } - else if (self.weapon == IT_CRYLINK) - { - self.weapon = IT_ELECTRO; - if (!self.ammo_cells) - noammo = TRUE; - } - else if (self.weapon == IT_ELECTRO) - { - self.weapon = IT_GRENADE_LAUNCHER; - if (!self.ammo_cells) - noammo = TRUE; - } - else if (self.weapon == IT_GRENADE_LAUNCHER) - { - self.weapon = IT_HAGAR; - if (!self.ammo_rockets) - noammo = TRUE; - } - else if (self.weapon == IT_HAGAR) - { - self.weapon = IT_NEX; - if (!self.ammo_rockets) - noammo = TRUE; - } - else if (self.weapon == IT_NEX) - { - self.weapon = IT_ROCKET_LAUNCHER; - if (!self.ammo_cells) - noammo = TRUE; - } - - if ((self.items & self.weapon) && !noammo) - { - W_UpdateWeapon (); - W_UpdateAmmo (); - return; - } - } -} - -void W_PreviousWeapon (void) -{ - float noammo; - - while (TRUE) - { - noammo = FALSE; - - if (self.weapon == IT_SHOTGUN) - self.weapon = IT_LASER; - else if (self.weapon == IT_UZI) - { - self.weapon = IT_SHOTGUN; - if (!self.ammo_shells) - noammo = TRUE; - } - else if (self.weapon == IT_CRYLINK) - { - self.weapon = IT_UZI; - if (!self.ammo_nails) - noammo = TRUE; - } - else if (self.weapon == IT_ELECTRO) - { - self.weapon = IT_CRYLINK; - if (!self.ammo_cells) - noammo = TRUE; - } - else if (self.weapon == IT_GRENADE_LAUNCHER) - { - self.weapon = IT_ELECTRO; - if (!self.ammo_cells) - noammo = TRUE; - } - else if (self.weapon == IT_HAGAR) - { - self.weapon = IT_GRENADE_LAUNCHER; - if (!self.ammo_rockets) - noammo = TRUE; - } - else if (self.weapon == IT_NEX) - { - self.weapon = IT_HAGAR; - if (!self.ammo_rockets) - noammo = TRUE; - } - else if (self.weapon == IT_ROCKET_LAUNCHER) - { - self.weapon = IT_NEX; - if (!self.ammo_cells) - noammo = TRUE; - } - else if (self.weapon == IT_LASER) - { - self.weapon = IT_ROCKET_LAUNCHER; - if (!self.ammo_rockets) - noammo = TRUE; - } - - if ((self.items & self.weapon) && !noammo) - { - W_UpdateWeapon (); - W_UpdateAmmo (); - return; - } - } -} -*/ -float W_CheckAmmo (void) -{ - if (!cvar("g_use_ammunition")) - return TRUE; - - W_UpdateAmmo (); - if (self.weapon == IT_LASER) - return TRUE; - else if (self.currentammo) - return TRUE; - - self.weapon = W_GetBestWeapon (self); - W_UpdateWeapon (); - - return FALSE; -} - -/* -void FireRailgunBullet (vector src, float bdamage, vector dir, float spread, float deathtype) -{ - vector v, lastpos; - entity saveself, last; - vector org; - org = self.origin + self.view_ofs; - if (bdamage < 1) - return; - - last = self; - lastpos = src; - - while (bdamage > 0) - { - traceline_hitcorpse (self, org, org + v_forward * 4096 + v_right * crandom () * spread + v_up * crandom () * spread, FALSE, self); - last = trace_ent; - lastpos = trace_endpos; - if (trace_fraction != 1.0) - { - if (pointcontents(trace_endpos - dir*4) == CONTENT_SKY) - return; - - if (trace_ent.takedamage || trace_ent.classname == "case") - { - if (trace_ent.classname == "player" || trace_ent.classname == "corpse" || trace_ent.classname == "gib") - te_blood (trace_endpos, dir * bdamage * 16, bdamage); - Damage (trace_ent, self, self, bdamage, deathtype, trace_endpos, dir * bdamage); - } - } - if (last.solid == SOLID_BSP) - bdamage = 0; - } -} -*/ - -void FireRailgunBullet (vector start, vector end, float bdamage, float deathtype) -{ - local vector hitloc, force; - local entity ent; - //local entity explosion; - - force = normalize(end - start) * 800; //(bdamage * 10); - - // find how far the beam can go until it hits a wall - traceline (start, end, TRUE, self); - // go a little bit into the wall because we need to hit this wall later - end = trace_endpos + normalize(end - start); - - // trace multiple times until we hit a wall, each obstacle will be made - // non-solid so we can hit the next, while doing this we spawn effects and - // note down which entities were hit so we can damage them later - while (1) - { - traceline_hitcorpse (self, start, end, FALSE, self); - - // if it is world we can't hurt it so stop now - if (trace_ent == world || trace_fraction == 1) - break; - - // make the entity non-solid so we can hit the next one - trace_ent.railgunhit = TRUE; - trace_ent.railgunhitloc = trace_endpos; - trace_ent.railgunhitsolidbackup = trace_ent.solid; - - // stop if this is a wall - if (trace_ent.solid == SOLID_BSP) - break; - - // make the entity non-solid - trace_ent.solid = SOLID_NOT; - } - - // find all the entities the railgun hit and restore their solid state - ent = findfloat(world, railgunhit, TRUE); - while (ent) - { - // restore their solid type - ent.solid = ent.railgunhitsolidbackup; - ent = findfloat(ent, railgunhit, TRUE); - } - - // spawn a temporary explosion entity for RadiusDamage calls - //explosion = spawn(); - - // find all the entities the railgun hit and hurt them - ent = findfloat(world, railgunhit, TRUE); - while (ent) - { - // get the details we need to call the damage function - hitloc = ent.railgunhitloc; - ent.railgunhitloc = '0 0 0'; - ent.railgunhitsolidbackup = SOLID_NOT; - ent.railgunhit = FALSE; - - // apply the damage - if (ent.takedamage || ent.classname == "case") - Damage (ent, self, self, bdamage, deathtype, hitloc, force); - - // create a small explosion to throw gibs around (if applicable) - //setorigin (explosion, hitloc); - //RadiusDamage (explosion, self, 10, 0, 50, world, 300, deathtype); - - // advance to the next entity - ent = findfloat(ent, railgunhit, TRUE); - } - - // we're done with the explosion entity, remove it - //remove(explosion); -} - -void fireBullet (vector start, vector dir, float spread, float damage, float dtype, float tracer) -{ - vector end; - float r; - local entity e; - - // use traceline_hitcorpse to make sure it can hit gibs and corpses too - dir = dir + randomvec() * spread; - end = start + dir * 4096; - traceline_hitcorpse (self, start, end, FALSE, self); - - if (tracer) - { - e = spawn(); - e.owner = self; - e.movetype = MOVETYPE_FLY; - e.solid = SOLID_NOT; - e.think = SUB_Remove; - e.nextthink = time + vlen(trace_endpos - start) / 6000; - e.velocity = dir * 6000; - e.angles = vectoangles(e.velocity); - setmodel (e, "models/tracer.mdl"); - setsize (e, '0 0 0', '0 0 0'); - setorigin (e, start); - e.effects = e.effects | EF_ADDITIVE | EF_FULLBRIGHT; - } - - // FIXME - causes excessive 'tinking'. Hopefully remove "tink1.wav" from the ricochets with csqc - if ((trace_fraction != 1.0) && (pointcontents (trace_endpos) != CONTENT_SKY)) - { - if (trace_ent.solid == SOLID_BSP) - { - pointcontents (self.origin); - te_gunshot (trace_endpos); - r = random (); - if (r < 0.10) - PointSound (trace_endpos, "weapons/ric1.wav", 1, ATTN_NORM); - else if (r < 0.20) - PointSound (trace_endpos, "weapons/ric2.wav", 1, ATTN_NORM); - else if (r < 0.30) - PointSound (trace_endpos, "weapons/ric3.wav", 1, ATTN_NORM); - } - else if (trace_ent.classname == "player" || trace_ent.classname == "corpse" || trace_ent.classname == "gib") - sound (self, CHAN_BODY, "misc/hit.wav", 1, ATTN_NORM); - Damage (trace_ent, self, self, damage, dtype, trace_endpos, dir * damage * 5); - } -} - -/* -void W_Attack (void) -{ - if (self.deadflag != DEAD_NO) - { - if (self.death_time < time) - PutClientInServer(); - - return; - } - - if (!W_CheckAmmo ()) - return; - - makevectors (self.v_angle); - //if (self.weapon == IT_LASER) - // W_Laser_Attack (); - //if (self.weapon == IT_SHOTGUN) - //W_Shotgun_Attack (); - //else if (self.weapon == IT_UZI) - //W_Uzi_Attack (); - if (self.weapon == IT_CRYLINK) - W_Crylink_Attack (); - else if (self.weapon == IT_ELECTRO) - { - W_Electro_Attack (self.electrocount); - self.electrocount = self.electrocount + 1; - if (self.electrocount == 3) - self.electrocount = 0; - } - else if (self.weapon == IT_GRENADE_LAUNCHER) - W_Grenade_Attack (); - else if (self.weapon == IT_HAGAR) - W_Hagar_Attack (); - else if (self.weapon == IT_NEX) - W_Nex_Attack (); - //else if (self.weapon == IT_ROCKET_LAUNCHER) - // W_Rocket_Attack (); - - W_UpdateAmmo (); -} - -void W_SecondaryAttack (void) -{ - if (self.deadflag != DEAD_NO) - { - if (self.death_time < time) - PutClientInServer(); - - return; - } - - if (!W_CheckAmmo ()) - return; - - makevectors (self.v_angle); - //if (self.weapon == IT_LASER) - //W_Laser_Attack2 (); - //if (self.weapon == IT_SHOTGUN) - //W_Shotgun_Attack2 (); - //else if (self.weapon == IT_UZI) - //W_Uzi_Attack2 (); - else if (self.weapon == IT_CRYLINK) - W_Crylink_Attack2 (); - else if (self.weapon == IT_ELECTRO) { - W_Electro_Attack2 (self.electrocount); - self.electrocount = self.electrocount + 1; - if (self.electrocount == 3) - self.electrocount = 0; - } - else if (self.weapon == IT_GRENADE_LAUNCHER) - W_Grenade_Attack2 (); - else if (self.weapon == IT_HAGAR) - W_Hagar_Attack2 (); - else if (self.weapon == IT_NEX) - W_Nex_Attack2 (); - //else if (self.weapon == IT_ROCKET_LAUNCHER) - //W_Rocket_Attack2 (); - - W_UpdateAmmo (); -} - -void W_ThirdAttack (void) -{ - if (self.deadflag != DEAD_NO) - { - if (self.death_time < time) - PutClientInServer(); - - return; - } - - if (!W_CheckAmmo ()) - return; - - makevectors (self.v_angle); - //if (self.weapon == IT_LASER) - //W_Laser_Attack2 (); - //if (self.weapon == IT_SHOTGUN) - //W_Shotgun_Attack2 (); - //else if (self.weapon == IT_UZI) - //W_Uzi_Attack3 (); - else if (self.weapon == IT_CRYLINK) - W_Crylink_Attack2 (); - else if (self.weapon == IT_ELECTRO) { - W_Electro_Attack3 (self.electrocount); - self.electrocount = self.electrocount + 1; - if (self.electrocount == 3) - self.electrocount = 0; - } - else if (self.weapon == IT_GRENADE_LAUNCHER) - W_Grenade_Attack3 (); - else if (self.weapon == IT_HAGAR) - W_Hagar_Attack3 (); - else if (self.weapon == IT_NEX) - W_Nex_Attack2 (); - //else if (self.weapon == IT_ROCKET_LAUNCHER) - //W_Rocket_Attack3 (); - - W_UpdateAmmo (); -} -*/ diff --git a/qcsrc/gamec/w_crylink.c b/qcsrc/gamec/w_crylink.c deleted file mode 100644 index eed84f1f1..000000000 --- a/qcsrc/gamec/w_crylink.c +++ /dev/null @@ -1,114 +0,0 @@ -void() crylink_ready_01; -void() crylink_fire1_01; -void() crylink_deselect_01; -void() crylink_select_01; - -.float gravity; - -float() crylink_check = -{ - if (self.ammo_cells >= 1) - return TRUE; - return FALSE; -}; - -void(float req) w_crylink = -{ - if (req == WR_IDLE) - crylink_ready_01(); - else if (req == WR_FIRE1 || req == WR_FIRE2) - weapon_prepareattack(crylink_check, crylink_check, crylink_fire1_01, cvar("g_balance_crylink_refire")); - else if (req == WR_RAISE) - crylink_select_01(); - else if (req == WR_UPDATECOUNTS) - self.currentammo = self.ammo_cells; - else if (req == WR_DROP) - crylink_deselect_01(); - else if (req == WR_SETUP) - weapon_setup(WEP_CRYLINK, "w_crylink.zym", IT_CELLS); - else if (req == WR_CHECKAMMO) - weapon_hasammo = crylink_check(); -}; - -.entity realowner; -void W_Crylink_Touch (void) -{ - RadiusDamage (self, self.realowner, cvar("g_balance_crylink_damage"), cvar("g_balance_crylink_edgedamage"), cvar("g_balance_crylink_radius"), world, cvar("g_balance_crylink_force"), IT_CRYLINK); - //te_smallflash(self.origin); - if (other.takedamage == DAMAGE_AIM) - { - remove (self); - return; - } - self.owner = world; - self.touch = SUB_Null; - setmodel (self, "models/plasma.mdl"); - setsize (self, '0 0 0', '0 0 0'); - self.gravity = 1; - self.glow_size = 0; - self.glow_color = 0; - self.think = SUB_Remove; - self.movetype = MOVETYPE_NONE; - self.effects = EF_FULLBRIGHT | EF_LOWPRECISION; - SUB_SetFade(self, time, 1); - //remove (self); -} - -void W_Crylink_Attack (void) -{ - local float counter, shots; - local vector org; - local entity proj; - - sound (self, CHAN_WEAPON, "weapons/crylink.wav", 1, ATTN_NORM); - if (cvar("g_use_ammunition")) - self.ammo_cells = self.ammo_cells - 1; - self.punchangle_x = -2; - org = self.origin + self.view_ofs + v_forward * 10 + v_right * 5 + v_up * -14; - te_smallflash(org); - - shots = cvar("g_balance_crylink_shots"); - if (!shots) - shots = 5; - while (counter < shots) - { - proj = spawn (); - proj.realowner = proj.owner = self; - proj.classname = "spike"; - - proj.movetype = MOVETYPE_BOUNCE; - proj.solid = SOLID_BBOX; - proj.gravity = 0.001; - - setmodel (proj, "models/plasmatrail.mdl"); - setsize (proj, '0 0 0', '0 0 0'); - setorigin (proj, org); - - if (self.button3) - proj.velocity = (v_forward + ((counter / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_spread")) * cvar("g_balance_crylink_speed"); - else - proj.velocity = (v_forward + randomvec() * cvar("g_balance_crylink_spread")) * cvar("g_balance_crylink_speed"); - proj.touch = W_Crylink_Touch; - proj.think = SUB_Remove; - proj.nextthink = time + 9; - - proj.angles = vectoangles (proj.velocity); - - //proj.glow_size = 20; - - proj.effects = EF_FULLBRIGHT | EF_LOWPRECISION; - counter = counter + 1; - } -} - - -// weapon frames -void() crylink_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, crylink_ready_01); self.weaponentity.state = WS_READY;}; -void() crylink_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');}; -void() crylink_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);}; -void() crylink_fire1_01 = -{ - weapon_doattack(crylink_check, crylink_check, W_Crylink_Attack); - weapon_thinkf(WFRAME_FIRE1, 0.15, crylink_ready_01); -}; - diff --git a/qcsrc/gamec/w_electro.c b/qcsrc/gamec/w_electro.c deleted file mode 100644 index f8c759ecb..000000000 --- a/qcsrc/gamec/w_electro.c +++ /dev/null @@ -1,254 +0,0 @@ -void() electro_ready_01; -void() electro_fire1_01; -void() electro_fire2_01; -void() electro_deselect_01; -void() electro_select_01; - -float() electro_check = -{ - if (self.ammo_cells > 2) - return TRUE; - return FALSE; -}; - -void(float req) w_electro = -{ - if (req == WR_IDLE) - electro_ready_01(); - else if (req == WR_FIRE1) - weapon_prepareattack(electro_check, electro_check, electro_fire1_01, cvar("g_balance_electro_refire")); - else if (req == WR_FIRE2) - weapon_prepareattack(electro_check, electro_check, electro_fire2_01, cvar("g_balance_electro_refire")); - else if (req == WR_RAISE) - electro_select_01(); - else if (req == WR_UPDATECOUNTS) - self.currentammo = self.ammo_cells; - else if (req == WR_DROP) - electro_deselect_01(); - else if (req == WR_SETUP) - weapon_setup(WEP_ELECTRO, "w_electro.zym", IT_CELLS); - else if (req == WR_CHECKAMMO) - weapon_hasammo = electro_check(); -}; - -void W_Plasma_Explode (void) -{ - WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte (MSG_BROADCAST, 79); - WriteCoord (MSG_BROADCAST, self.origin_x); - WriteCoord (MSG_BROADCAST, self.origin_y); - WriteCoord (MSG_BROADCAST, self.origin_z); - WriteCoord (MSG_BROADCAST, 0); // SeienAbunae: groan... Useless clutter - WriteCoord (MSG_BROADCAST, 0); - WriteCoord (MSG_BROADCAST, 0); - WriteByte (MSG_BROADCAST, 155); - - self.event_damage = SUB_Null; - if (self.movetype == MOVETYPE_BOUNCE) - RadiusDamage (self, self.owner, cvar("g_balance_electro_damage") * 0.33, cvar("g_balance_electro_edgedamage") * 0.33, cvar("g_balance_electro_radius"), world, cvar("g_balance_electro_force") * 0.33, IT_ELECTRO); - else - RadiusDamage (self, self.owner, cvar("g_balance_electro_damage"), cvar("g_balance_electro_edgedamage"), cvar("g_balance_electro_radius"), world, cvar("g_balance_electro_force"), IT_ELECTRO); - sound (self, CHAN_BODY, "weapons/electro_impact.wav", 1, ATTN_NORM); - - remove (self); -} - -void W_Plasma_Touch (void) -{ - if (other.takedamage == DAMAGE_AIM) - W_Plasma_Explode (); - else - sound (self, CHAN_IMPACT, "weapons/grenade_bounce.wav", 1, ATTN_NORM); -} - -void W_Plasma_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) -{ - self.health = self.health - damage; - if (self.health <= 0) - W_Plasma_Explode (); -} - -void() W_Electro_Attack -{ - local entity proj; - local vector org; - local float postion; - - postion = self.electrocount; - sound (self, CHAN_WEAPON, "weapons/electro_fire.wav", 1, ATTN_NORM); - - self.punchangle_x = -2; - - if (cvar("g_use_ammunition")) - self.ammo_cells = self.ammo_cells - 2; - - if (self.electrocount == 0) - { - self.electrocount = 1; - org = self.origin + self.view_ofs + v_forward * 15 + v_right * 5 + v_up * -14; - } - else if (self.electrocount == 1) - { - self.electrocount = 2; - org = self.origin + self.view_ofs + v_forward * 15 + v_right * 10 + v_up * -12; - } - else - { - self.electrocount = 0; - org = self.origin + self.view_ofs + v_forward * 15 + v_right * 15 + v_up * -14; - } - - proj = spawn (); - proj.classname = "plasma"; - proj.owner = self; - proj.think = W_Plasma_Explode; - proj.nextthink = time + 2; - proj.solid = SOLID_BBOX; - setorigin(proj, org); - - /* - if (self.button3) - { - self.ammo_cells = self.ammo_cells - 1; - proj.effects = EF_FULLBRIGHT; - proj.movetype = MOVETYPE_BOUNCE; - proj.velocity = v_forward * cvar("g_balance_electro_ballspeed") + v_up * cvar("g_balance_electro_ballspeed_up"); - proj.touch = W_Plasma_Touch; - setmodel(proj, "models/ebomb.mdl"); - setsize(proj, '-6 -6 -3', '6 6 3'); - proj.takedamage = DAMAGE_YES; - proj.damageforcescale = 4; - proj.health = 5; - proj.event_damage = W_Plasma_Damage; - } - else - */ - { - if (cvar("g_use_ammunition")) - self.ammo_cells = self.ammo_cells - 2; - proj.effects = EF_BRIGHTFIELD | EF_FULLBRIGHT; - proj.movetype = MOVETYPE_FLY; - proj.velocity = v_forward * cvar("g_balance_electro_speed"); - proj.angles = vectoangles(proj.velocity); - proj.touch = W_Plasma_Explode; - setmodel(proj, "models/elaser.mdl"); - setsize(proj, '0 0 0', '0 0 0'); - } - sound (proj, CHAN_BODY, "weapons/electro_fly.wav", 1, ATTN_NORM); -} - -void() W_Electro_Attack2 -{ - local entity proj; - local vector org; - local float postion; - - postion = self.electrocount; - sound (self, CHAN_WEAPON, "weapons/electro_fire.wav", 1, ATTN_NORM); - - self.punchangle_x = -2; - - if (self.electrocount == 0) - { - self.electrocount = 1; - org = self.origin + self.view_ofs + v_forward * 15 + v_right * 5 + v_up * -14; - } - else if (self.electrocount == 1) - { - self.electrocount = 2; - org = self.origin + self.view_ofs + v_forward * 15 + v_right * 10 + v_up * -12; - } - else - { - self.electrocount = 0; - org = self.origin + self.view_ofs + v_forward * 15 + v_right * 15 + v_up * -14; - } - - proj = spawn (); - proj.classname = "plasma"; - proj.owner = self; - proj.think = W_Plasma_Explode; - proj.nextthink = time + 2; - proj.solid = SOLID_BBOX; - setorigin(proj, org); - - //if (self.button3) - { - if (cvar("g_use_ammunition")) - self.ammo_cells = self.ammo_cells - 1; - proj.effects = EF_FULLBRIGHT; - proj.movetype = MOVETYPE_BOUNCE; - proj.velocity = v_forward * cvar("g_balance_electro_ballspeed") + v_up * cvar("g_balance_electro_ballspeed_up"); - proj.touch = W_Plasma_Touch; - setmodel(proj, "models/ebomb.mdl"); - setsize(proj, '-6 -6 -3', '6 6 3'); - proj.takedamage = DAMAGE_YES; - proj.damageforcescale = 4; - proj.health = 5; - proj.event_damage = W_Plasma_Damage; - } - //else - /* - { - self.ammo_cells = self.ammo_cells - 2; - proj.effects = EF_BRIGHTFIELD | EF_FULLBRIGHT; - proj.movetype = MOVETYPE_FLY; - proj.velocity = v_forward * cvar("g_balance_electro_speed"); - proj.angles = vectoangles(proj.velocity); - proj.touch = W_Plasma_Explode; - setmodel(proj, "models/elaser.mdl"); - setsize(proj, '0 0 0', '0 0 0'); - } - */ - sound (proj, CHAN_BODY, "weapons/electro_fly.wav", 1, ATTN_NORM); -} - -// weapon frames - -void() electro_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, electro_ready_01); self.weaponentity.state = WS_READY;}; -void() electro_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');}; -void() electro_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);}; -/* -void() electro_fire1_01 = -{ - weapon_doattack(electro_check, electro_check, W_Electro_Attack); - weapon_thinkf(WFRAME_FIRE1, 0.3, electro_ready_01); -}; -*/ -/* -void() electro_fire1_03 = -{ - weapon_doattack(electro_check, electro_check, W_Electro_Attack); - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_refire3"), electro_ready_01); -} -void() electro_fire1_02 = -{ - weapon_doattack(electro_check, electro_check, W_Electro_Attack); - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_refire3"), electro_fire1_03); -} -void() electro_fire1_01 = -{ - weapon_doattack(electro_check, electro_check, W_Electro_Attack); - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_refire3"), electro_fire1_02); -} -*/ -void() electro_fire1_01 = -{ - weapon_doattack(electro_check, electro_check, W_Electro_Attack); - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_refire3"), electro_ready_01); -}; -void() electro_fire2_03 = -{ - weapon_doattack(electro_check, electro_check, W_Electro_Attack2); - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_refire3"), electro_ready_01); -} -void() electro_fire2_02 = -{ - weapon_doattack(electro_check, electro_check, W_Electro_Attack2); - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_refire3"), electro_fire2_03); -} -void() electro_fire2_01 = -{ - weapon_doattack(electro_check, electro_check, W_Electro_Attack2); - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_electro_refire3"), electro_fire2_02); -} diff --git a/qcsrc/gamec/w_grenadelauncher.c b/qcsrc/gamec/w_grenadelauncher.c deleted file mode 100644 index cac961bc9..000000000 --- a/qcsrc/gamec/w_grenadelauncher.c +++ /dev/null @@ -1,115 +0,0 @@ -void() glauncher_ready_01; -void() glauncher_fire1_01; -void() glauncher_deselect_01; -void() glauncher_select_01; - -float() glauncher_check = -{ - if (self.ammo_rockets >= 2) - return TRUE; - return FALSE; -}; - -void(float req) w_glauncher = -{ - if (req == WR_IDLE) - glauncher_ready_01(); - else if (req == WR_FIRE1) - weapon_prepareattack(glauncher_check, glauncher_check, glauncher_fire1_01, cvar("g_balance_grenadelauncher_refire")); - else if (req == WR_FIRE2) - weapon_prepareattack(glauncher_check, glauncher_check, glauncher_fire1_01, cvar("g_balance_grenadelauncher_refire2")); - else if (req == WR_RAISE) - glauncher_select_01(); - else if (req == WR_UPDATECOUNTS) - self.currentammo = self.ammo_rockets; - else if (req == WR_DROP) - glauncher_deselect_01(); - else if (req == WR_SETUP) - weapon_setup(WEP_GRENADE_LAUNCHER, "w_gl.zym", IT_ROCKETS); - else if (req == WR_CHECKAMMO) - weapon_hasammo = glauncher_check(); -}; - -void W_Grenade_Explode (void) -{ - vector org2; - org2 = findbetterlocation (self.origin); - te_explosion (org2); - effect (org2, "models/sprites/grenadeexplosion.spr32", 0, 20, 30); - sound (self, CHAN_BODY, "weapons/grenade_impact.wav", 1, ATTN_NORM); - - self.event_damage = SUB_Null; - RadiusDamage (self, self.owner, cvar("g_balance_grenadelauncher_damage"), cvar("g_balance_grenadelauncher_edgedamage"), cvar("g_balance_grenadelauncher_radius"), world, cvar("g_balance_grenadelauncher_force"), IT_GRENADE_LAUNCHER); - - remove (self); -} - -void W_Grenade_Touch (void) -{ - if (other.takedamage == DAMAGE_AIM) - W_Grenade_Explode (); - else - sound (self, CHAN_IMPACT, "weapons/grenade_bounce.wav", 1, ATTN_NORM); -} - -void W_Grenade_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) -{ - self.health = self.health - damage; - if (self.health <= 0) - W_Grenade_Explode(); -} - -void W_Grenade_Attack (void) -{ - local entity gren; - local vector org; - - sound (self, CHAN_WEAPON, "weapons/grenade_fire.wav", 1, ATTN_NORM); - self.punchangle_x = -4; - if (cvar("g_use_ammunition")) - self.ammo_rockets = self.ammo_rockets - 2; - org = self.origin + self.view_ofs + v_forward * 15 + v_right * 5 + v_up * -12; - - gren = spawn (); - gren.owner = self; - gren.classname = "grenade"; - gren.movetype = MOVETYPE_BOUNCE; - gren.solid = SOLID_BBOX; - setmodel(gren, "models/grenademodel.md3"); - setsize(gren, '-6 -6 -3', '6 6 3'); - setorigin(gren, org); - - if (self.button3) - { - gren.nextthink = time + 2.5; - gren.think = W_Grenade_Explode; - gren.touch = W_Grenade_Touch; - gren.takedamage = DAMAGE_YES; - gren.health = 10; - gren.damageforcescale = 4; - gren.event_damage = W_Grenade_Damage; - gren.velocity = v_forward * cvar("g_balance_grenadelauncher_speed2") + v_up * cvar("g_balance_grenadelauncher_speed2_up"); - gren.avelocity = '100 150 100'; - } - else - { - gren.nextthink = time + 30; - gren.think = W_Grenade_Explode; - gren.touch = W_Grenade_Explode; - gren.velocity = v_forward * cvar("g_balance_grenadelauncher_speed") + v_up * cvar("g_balance_grenadelauncher_speed_up"); - gren.avelocity_x = random () * -500 - 500; - } - - gren.angles = vectoangles (gren.velocity); -} - -// weapon frames - -void() glauncher_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, glauncher_ready_01); self.weaponentity.state = WS_READY;}; -void() glauncher_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');}; -void() glauncher_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);}; -void() glauncher_fire1_01 = -{ - weapon_doattack(glauncher_check, glauncher_check, W_Grenade_Attack); - weapon_thinkf(WFRAME_FIRE1, 0.3, glauncher_ready_01); -}; diff --git a/qcsrc/gamec/w_hagar.c b/qcsrc/gamec/w_hagar.c deleted file mode 100644 index 26d9af041..000000000 --- a/qcsrc/gamec/w_hagar.c +++ /dev/null @@ -1,123 +0,0 @@ -void() hagar_ready_01; -void() hagar_fire1_01; -void() hagar_deselect_01; -void() hagar_select_01; - -float() hagar_check = -{ - if (self.ammo_rockets >= 1) - return TRUE; - return FALSE; -}; - -void(float req) w_hagar = -{ - if (req == WR_IDLE) - hagar_ready_01(); - else if (req == WR_FIRE1 || req == WR_FIRE2) - weapon_prepareattack(hagar_check, hagar_check, hagar_fire1_01, cvar("g_balance_hagar_refire")); - else if (req == WR_RAISE) - hagar_select_01(); - else if (req == WR_UPDATECOUNTS) - self.currentammo = self.ammo_rockets; - else if (req == WR_DROP) - hagar_deselect_01(); - else if (req == WR_SETUP) - weapon_setup(WEP_HAGAR, "w_hagar.zym", IT_ROCKETS); - else if (req == WR_CHECKAMMO) - weapon_hasammo = hagar_check(); -}; - -void W_Hagar_Explode (void) -{ - vector org2; - float b; - org2 = findbetterlocation (self.origin); - effect (org2, "models/sprites/hagarexplosion.spr32", 0, 19, 30); - b = crandom(); - if (b<-0.7) - sound (self, CHAN_BODY, "weapons/hagexp1.wav", 1, ATTN_NORM); - else if (b<0.4) - sound (self, CHAN_BODY, "weapons/hagexp2.wav", 1, ATTN_NORM); - else if (b<1) - sound (self, CHAN_BODY, "weapons/hagexp3.wav", 1, ATTN_NORM); - - self.event_damage = SUB_Null; - RadiusDamage (self, self.owner, cvar("g_balance_hagar_damage"), cvar("g_balance_hagar_edgedamage"), cvar("g_balance_hagar_radius"), world, cvar("g_balance_hagar_force"), IT_HAGAR); - - remove (self); -} - -void W_Hagar_Touch (void) -{ - if (other == self.owner) - return; - else if (pointcontents (self.origin) == CONTENT_SKY) - { - remove (self); - return; - } - - W_Hagar_Explode (); -} - -void W_Hagar_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) -{ - self.health = self.health - damage; - if (self.health <= 0) - W_Hagar_Explode(); -} - -void W_Hagar_Attack (void) -{ - local entity missile; - local vector org; - - sound (self, CHAN_WEAPON, "weapons/hagar_fire.wav", 1, ATTN_NORM); - if (cvar("g_use_ammunition")) - self.ammo_rockets = self.ammo_rockets - 1; - self.punchangle_x = -2; - org = self.origin + self.view_ofs + v_forward * 15 + v_right * 5 + v_up * -8; - - missile = spawn (); - missile.owner = self; - missile.classname = "missile"; - missile.touch = W_Hagar_Touch; - missile.think = W_Hagar_Explode; - missile.nextthink = time + 10; - missile.solid = SOLID_BBOX; - missile.scale = 0.4; // BUG: the model is too big - setorigin (missile, org); - setmodel (missile, "models/hagarmissile.mdl"); - setsize (missile, '0 0 0', '0 0 0'); - //missile.takedamage = DAMAGE_YES; - //missile.damageforcescale = 4; - //missile.health = 10; - //missile.event_damage = W_Hagar_Damage; - missile.effects = EF_LOWPRECISION; - - if (self.button3) - { - missile.movetype = MOVETYPE_TOSS; - missile.velocity = v_forward * cvar("g_balance_hagar_speed2") + v_up * cvar("g_balance_hagar_speed2_up"); - missile.avelocity = '100 10 10'; - } - else - { - missile.movetype = MOVETYPE_FLY; - missile.velocity = (v_forward + randomvec() * cvar("g_balance_hagar_spread")) * cvar("g_balance_hagar_speed"); - } - - missile.angles = vectoangles (missile.velocity); -} - -// weapon frames -void() hagar_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, hagar_ready_01); self.weaponentity.state = WS_READY;}; -void() hagar_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');}; -void() hagar_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);}; -void() hagar_fire1_01 = -{ - weapon_doattack(hagar_check, hagar_check, W_Hagar_Attack); - weapon_thinkf(WFRAME_FIRE1, 0.15, hagar_ready_01); -}; - diff --git a/qcsrc/gamec/w_laser.c b/qcsrc/gamec/w_laser.c deleted file mode 100644 index 7c91632b4..000000000 --- a/qcsrc/gamec/w_laser.c +++ /dev/null @@ -1,101 +0,0 @@ -void() laser_ready_01; -void() laser_fire1_01; -void() laser_deselect_01; -void() laser_select_01; - -float() laser_check = {return TRUE;}; - -void(float req) w_laser = -{ - if (req == WR_IDLE) - laser_ready_01(); - else if (req == WR_FIRE1) - weapon_prepareattack(laser_check, laser_check, laser_fire1_01, cvar("g_balance_laser_refire")); - else if (req == WR_RAISE) - laser_select_01(); - else if (req == WR_UPDATECOUNTS) - self.currentammo = 1; - else if (req == WR_DROP) - laser_deselect_01(); - else if (req == WR_SETUP) - weapon_setup(WEP_LASER, "w_laser.zym", 0); - else if (req == WR_CHECKAMMO) - weapon_hasammo = laser_check(); -}; - -void W_Laser_Touch (void) -{ - vector dir; - - if (other == self.owner) - return; - else if (pointcontents (self.origin) == CONTENT_SKY) - { - remove (self); - return; - } - - dir = normalize (self.owner.origin - self.origin); - - WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte (MSG_BROADCAST, TE_FLAMEJET); - WriteCoord (MSG_BROADCAST, self.origin_x); - WriteCoord (MSG_BROADCAST, self.origin_y); - WriteCoord (MSG_BROADCAST, self.origin_z); - WriteCoord (MSG_BROADCAST, 0); // SeienAbunae: groan... Useless clutter - WriteCoord (MSG_BROADCAST, 0); - WriteCoord (MSG_BROADCAST, 0); - WriteByte (MSG_BROADCAST, 155); - - te_customflash(self.origin, 160, 0.2, '1 0 0'); - - - self.event_damage = SUB_Null; - RadiusDamage (self, self.owner, cvar("g_balance_laser_damage"), cvar("g_balance_laser_edgedamage"), cvar("g_balance_laser_radius"), world, cvar("g_balance_laser_force"), IT_LASER); - sound (self, CHAN_BODY, "weapons/laserimpact.wav", 1, ATTN_NORM); - - remove (self); -} - -void W_Laser_Attack (void) -{ - local entity missile; - local vector org; - - sound (self, CHAN_WEAPON, "weapons/lasergun_fire.wav", 1, ATTN_NORM); - org = self.origin + self.view_ofs + v_forward * 15 + v_right * 5 + v_up * -12; - //te_customflash(org, 160, 0.2, '1 0 0'); - - missile = spawn (); - missile.owner = self; - missile.classname = "laserbolt"; - - missile.movetype = MOVETYPE_FLY; - missile.solid = SOLID_BBOX; - - setmodel (missile, "models/laser.mdl"); - setsize (missile, '0 0 0', '0 0 0'); - setorigin (missile, org); - - missile.velocity = v_forward * cvar("g_balance_laser_speed"); - missile.angles = vectoangles (missile.velocity); - //missile.glow_color = 250; // 244, 250 - //missile.glow_size = 120; - missile.touch = W_Laser_Touch; - missile.think = SUB_Remove; - missile.nextthink = time + 9; - - missile.effects = EF_FULLBRIGHT | EF_FULLBRIGHT | EF_LOWPRECISION; -} - -// weapon frames - -void() laser_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, laser_ready_01); self.weaponentity.state = WS_READY;}; -void() laser_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');}; -void() laser_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);}; -void() laser_fire1_01 = -{ - weapon_doattack(laser_check, laser_check, W_Laser_Attack); - weapon_thinkf(WFRAME_FIRE1, 0.3, laser_ready_01); -}; - diff --git a/qcsrc/gamec/w_nex.c b/qcsrc/gamec/w_nex.c deleted file mode 100644 index 58f341ab8..000000000 --- a/qcsrc/gamec/w_nex.c +++ /dev/null @@ -1,103 +0,0 @@ -void() nex_ready_01; -void() nex_fire1_01; -void() nex_deselect_01; -void() nex_select_01; - -float() nex_check = -{ - if (self.ammo_cells >= 5) - return TRUE; - return FALSE; -}; - -void(float req) w_nex = -{ - if (req == WR_IDLE) - nex_ready_01(); - else if (req == WR_FIRE1) - weapon_prepareattack(nex_check, nex_check, nex_fire1_01, cvar("g_balance_nex_refire")); - else if (req == WR_RAISE) - nex_select_01(); - else if (req == WR_UPDATECOUNTS) - self.currentammo = self.ammo_cells; - else if (req == WR_DROP) - nex_deselect_01(); - else if (req == WR_SETUP) - weapon_setup(WEP_NEX, "w_nex.zym", IT_CELLS); - else if (req == WR_CHECKAMMO) - weapon_hasammo = nex_check(); -}; - - -void W_Nex_Attack (void) -{ - local vector org; - local vector end; - local entity flash; - - sound (self, CHAN_WEAPON, "weapons/nexfire.wav", 1, ATTN_NORM); - self.punchangle_x = -5; - org = self.origin + self.view_ofs + v_forward * 5 + v_right * 14 + v_up * -7; - end = self.origin + self.view_ofs + v_forward * 4096; - - FireRailgunBullet (org, end, cvar("g_balance_nex_damage"), IT_NEX); - - // trace as if shot started inside gun - traceline (org, end, TRUE, self); - // show as if shot started outside of gun - org = self.origin + self.view_ofs + v_forward * 28 + v_right * 14 + v_up * -7; - // muzzleflash light - te_smallflash (org); - // beam effect - WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte (MSG_BROADCAST, 76); - WriteCoord (MSG_BROADCAST, org_x); - WriteCoord (MSG_BROADCAST, org_y); - WriteCoord (MSG_BROADCAST, org_z); - WriteCoord (MSG_BROADCAST, trace_endpos_x); - WriteCoord (MSG_BROADCAST, trace_endpos_y); - WriteCoord (MSG_BROADCAST, trace_endpos_z); - WriteCoord (MSG_BROADCAST, 0); - WriteCoord (MSG_BROADCAST, 0); - WriteCoord (MSG_BROADCAST, 0); - // flash and burn the wall - te_plasmaburn (trace_endpos); - /* - // flame effect at impact - dir = trace_plane_normal * 100; - WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); - WriteByte (MSG_BROADCAST, TE_FLAMEJET); - WriteCoord (MSG_BROADCAST, trace_endpos_x); - WriteCoord (MSG_BROADCAST, trace_endpos_y); - WriteCoord (MSG_BROADCAST, trace_endpos_z); - WriteCoord (MSG_BROADCAST, dir_x); - WriteCoord (MSG_BROADCAST, dir_y); - WriteCoord (MSG_BROADCAST, dir_z); - WriteByte (MSG_BROADCAST, 255); - */ - // play a sound - PointSound (trace_endpos, "weapons/neximpact.wav", 1, ATTN_NORM); - - if (cvar("g_use_ammunition")) - self.ammo_cells = self.ammo_cells - 5; - - flash = spawn (); - org = self.origin + self.view_ofs + v_forward * 33 + v_right * 14 + v_up * -7; - setorigin (flash, org); - setmodel (flash, "models/nexflash.md3"); - flash.velocity = v_forward * 20; - flash.angles = vectoangles (flash.velocity); - SUB_SetFade (flash, time, 0.4); - flash.effects = flash.effects | EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; -} - -// weapon frames -void() nex_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, nex_ready_01); self.weaponentity.state = WS_READY;}; -void() nex_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');}; -void() nex_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);}; -void() nex_fire1_01 = -{ - weapon_doattack(nex_check, nex_check, W_Nex_Attack); - weapon_thinkf(WFRAME_FIRE1, 0.3, nex_ready_01); -}; - diff --git a/qcsrc/gamec/w_rocketlauncher.c b/qcsrc/gamec/w_rocketlauncher.c deleted file mode 100644 index 6bdb10d07..000000000 --- a/qcsrc/gamec/w_rocketlauncher.c +++ /dev/null @@ -1,132 +0,0 @@ -void() rlauncher_ready_01; -void() rlauncher_fire1_01; -void() rlauncher_deselect_01; -void() rlauncher_select_01; - -float() rlauncher_check = -{ - if (self.ammo_rockets >= 3) - return TRUE; - return FALSE; -}; - -void(float req) w_rlauncher = -{ - if (req == WR_IDLE) - rlauncher_ready_01(); - else if (req == WR_FIRE1) - weapon_prepareattack(rlauncher_check, rlauncher_check, rlauncher_fire1_01, cvar("g_balance_rocketlauncher_refire")); - else if (req == WR_RAISE) - rlauncher_select_01(); - else if (req == WR_UPDATECOUNTS) - self.currentammo = self.ammo_rockets; - else if (req == WR_DROP) - rlauncher_deselect_01(); - else if (req == WR_SETUP) - weapon_setup(WEP_ROCKET_LAUNCHER, "w_rl.zym", IT_ROCKETS); - else if (req == WR_CHECKAMMO) - weapon_hasammo = rlauncher_check(); -}; - - -void W_Rocket_Explode (void) -{ - vector org2; - org2 = findbetterlocation (self.origin); - te_explosion (org2); - effect (org2, "models/sprites/rocketexplosion.spr32", 0, 26, 30); - sound (self, CHAN_BODY, "weapons/rocket_impact.wav", 1, ATTN_NORM); - - self.event_damage = SUB_Null; - RadiusDamage (self, self.owner, cvar("g_balance_rocketlauncher_damage"), cvar("g_balance_rocketlauncher_edgedamage"), cvar("g_balance_rocketlauncher_radius"), world, cvar("g_balance_rocketlauncher_force"), IT_ROCKET_LAUNCHER); - - remove (self); -} - -void W_Rocket_Think (void) -{ - self.nextthink = time; - if (time > self.cnt) - { - W_Rocket_Explode (); - return; - } - if (self.owner.weapon == WEP_ROCKET_LAUNCHER) - if (self.owner.button3) - W_Rocket_Explode (); -} - -void W_Rocket_Touch (void) -{ - if (pointcontents (self.origin) == CONTENT_SKY) - { - remove (self); - return; - } - else - W_Rocket_Explode (); -} - -void W_Rocket_Damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector force) -{ - self.health = self.health - damage; - if (self.health <= 0) - W_Rocket_Explode(); -} - -void W_Rocket_Attack (void) -{ - local entity missile; - local entity flash; - local vector org; - sound (self, CHAN_WEAPON, "weapons/rocket_fire.wav", 1, ATTN_NORM); - if (cvar("g_use_ammunition")) - self.ammo_rockets = self.ammo_rockets - 3; - self.punchangle_x = -4; - org = self.origin + self.view_ofs + v_forward * 15 + v_right * 3 + v_up * -11; - te_smallflash(org); - - missile = spawn (); - missile.owner = self; - missile.classname = "missile"; - - missile.takedamage = DAMAGE_YES; - missile.damageforcescale = 4; - missile.health = 30; - missile.event_damage = W_Rocket_Damage; - - missile.movetype = MOVETYPE_FLY; - missile.solid = SOLID_BBOX; - setmodel (missile, "models/rocket.md3"); - setsize (missile, '0 0 0', '0 0 0'); - - setorigin (missile, org); - missile.velocity = v_forward * cvar("g_balance_rocketlauncher_speed"); - missile.angles = vectoangles (missile.velocity); - - missile.touch = W_Rocket_Touch; - missile.think = W_Rocket_Think; - missile.nextthink = time; - missile.cnt = time + 9; - sound (missile, CHAN_BODY, "weapons/rocket_fly.wav", 0.4, ATTN_NORM); - - flash = spawn (); - setorigin (flash, org); - setmodel (flash, "models/flash.md3"); - flash.velocity = v_forward * 20; - flash.angles = vectoangles (flash.velocity); - SUB_SetFade (flash, time, 0.4); - flash.effects = flash.effects | EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; -} - -// weapon frames - -void() rlauncher_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, rlauncher_ready_01); self.weaponentity.state = WS_READY;}; -void() rlauncher_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');}; -void() rlauncher_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);}; -void() rlauncher_fire1_01 = -{ - weapon_doattack(rlauncher_check, rlauncher_check, W_Rocket_Attack); - weapon_thinkf(WFRAME_FIRE1, 0.3, rlauncher_ready_01); -}; - diff --git a/qcsrc/gamec/w_shotgun.c b/qcsrc/gamec/w_shotgun.c deleted file mode 100644 index ab10d1fdd..000000000 --- a/qcsrc/gamec/w_shotgun.c +++ /dev/null @@ -1,94 +0,0 @@ -void() shotgun_ready_01; -void() shotgun_fire1_01; -void() shotgun_fire2_01; -void() shotgun_deselect_01; -void() shotgun_select_01; - -float() shotgun_check = -{ - if (self.ammo_shells >= 1) - return TRUE; - return FALSE; -}; - -void(float req) w_shotgun = -{ - if (req == WR_IDLE) - shotgun_ready_01(); - else if (req == WR_FIRE1) - weapon_prepareattack(shotgun_check, shotgun_check, shotgun_fire1_01, cvar("g_balance_shotgun_refire")); - else if (req == WR_FIRE2) - weapon_prepareattack(shotgun_check, shotgun_check, shotgun_fire2_01, cvar("g_balance_shotgun_refire2")); - else if (req == WR_RAISE) - shotgun_select_01(); - else if (req == WR_UPDATECOUNTS) - self.currentammo = self.ammo_shells; - else if (req == WR_DROP) - shotgun_deselect_01(); - else if (req == WR_SETUP) - weapon_setup(WEP_SHOTGUN, "w_shotgun.zym", IT_SHELLS); - else if (req == WR_CHECKAMMO) - weapon_hasammo = shotgun_check(); -}; - -void W_Shotgun_Attack (void) -{ - local vector org; - float sc; - float bullets; - float d; - float spread; - - sound (self, CHAN_WEAPON, "weapons/shotgun_fire.wav", 1, ATTN_NORM); - bullets = cvar("g_balance_shotgun_bullets"); - if (self.button3) - d = cvar("g_balance_shotgun_damage2"); - else - d = cvar("g_balance_shotgun_damage"); - - org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 5); - spread = cvar("g_balance_shotgun_spread"); - for (sc = 0;sc < bullets;sc = sc + 1) - fireBullet (org, v_forward, spread, d, IT_SHOTGUN, sc < 3); - if (cvar("g_use_ammunition")) - self.ammo_shells = self.ammo_shells - 1; - - // casing code - if (cvar("g_casings") >= 1) - { - org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 10); - SpawnCasing (org, ((random () * 50 + 50) * v_right) - ((random () * 25 + 25) * v_forward) - ((random () * 5 + 10) * v_up), 2, v_forward,'0 250 0', 100, 1); - } - - org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 20); - W_Smoke(org, v_forward, 12); - //te_smallflash(org); - - self.punchangle_x = -5; -} - -// weapon frames - -void() shotgun_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, shotgun_ready_01); self.weaponentity.state = WS_READY;}; -void() shotgun_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');}; -void() shotgun_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);}; -void() shotgun_fire1_01 = -{ - weapon_doattack(shotgun_check, shotgun_check, W_Shotgun_Attack); - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_refire3"), shotgun_ready_01); -}; -void() shotgun_fire2_03 = -{ - weapon_doattack(shotgun_check, shotgun_check, W_Shotgun_Attack); - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_refire3"), shotgun_ready_01); -} -void() shotgun_fire2_02 = -{ - weapon_doattack(shotgun_check, shotgun_check, W_Shotgun_Attack); - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_refire3"), shotgun_fire2_03); -} -void() shotgun_fire2_01 = -{ - weapon_doattack(shotgun_check, shotgun_check, W_Shotgun_Attack); - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_refire3"), shotgun_fire2_02); -} diff --git a/qcsrc/gamec/w_uzi.c b/qcsrc/gamec/w_uzi.c deleted file mode 100644 index 98f000a4b..000000000 --- a/qcsrc/gamec/w_uzi.c +++ /dev/null @@ -1,93 +0,0 @@ -void() uzi_ready_01; -void() uzi_fire1_01; -void() uzi_deselect_01; -void() uzi_select_01; - -float() uzi_check = -{ - if (self.ammo_nails >= 1) - return TRUE; - return FALSE; -}; - -void(float req) w_uzi = -{ - if (req == WR_IDLE) - uzi_ready_01(); - else if (req == WR_FIRE1 || req == WR_FIRE2) - weapon_prepareattack(uzi_check, uzi_check, uzi_fire1_01, cvar("g_balance_uzi_refire")); - else if (req == WR_RAISE) - uzi_select_01(); - else if (req == WR_UPDATECOUNTS) - self.currentammo = self.ammo_nails; - else if (req == WR_DROP) - uzi_deselect_01(); - else if (req == WR_SETUP) - weapon_setup(WEP_UZI, "w_uzi.zym", IT_NAILS); - else if (req == WR_CHECKAMMO) - weapon_hasammo = uzi_check(); -}; - -.float uzi_bulletcounter; -void W_Uzi_Attack (void) -{ - local vector org; - entity flash; - sound (self, CHAN_WEAPON, "weapons/uzi_fire.wav", 1, ATTN_NORM); - if (cvar("g_use_ammunition")) - self.ammo_nails = self.ammo_nails - 1; - self.punchangle_x = random () - 0.5; - self.punchangle_y = random () - 0.5; - org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 15); - - // this attack_finished just enforces a cooldown at the end of a burst - self.attack_finished = time + cvar("g_balance_uzi_refire2"); - - if (self.uzi_bulletcounter == 1) - fireBullet (org, v_forward, cvar("g_balance_uzi_spread2"), cvar("g_balance_uzi_damage2"), IT_UZI, (self.uzi_bulletcounter & 3) == 0); - else - fireBullet (org, v_forward, cvar("g_balance_uzi_spread"), cvar("g_balance_uzi_damage"), IT_UZI, (self.uzi_bulletcounter & 3) == 0); - - // casing code - if (cvar("g_casings") >= 2) - { - org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 8) + (v_forward * 10); - SpawnCasing (org, ((random () * 50 + 50) * v_right) - ((random () * 25 + 25) * v_forward) - ((random () * 5 + 10) * v_up), 2, v_forward,'0 250 0', 100, 2); - } - - flash = spawn (); - org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 10) + (v_forward * 40); - setorigin (flash, org); - setmodel (flash, "models/uziflash.md3"); - flash.velocity = v_forward * 20; - flash.angles = vectoangles (flash.velocity); - flash.angles_z=flash.v_angle_z + random () * 180; - flash.scale = 0.75; - flash.alpha = 0.5; - SUB_SetFade (flash, time, 0.2); - flash.effects = flash.effects | EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION; - -} -// weapon frames - -void() uzi_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, uzi_ready_01); self.weaponentity.state = WS_READY;}; -void() uzi_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');}; -void() uzi_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);}; -void() uzi_fire1_02 = -{ - if (self.button0) - { - self.uzi_bulletcounter = self.uzi_bulletcounter + 1; - weapon_doattack(uzi_check, uzi_check, W_Uzi_Attack); - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_refire"), uzi_fire1_02); - } - else - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_refire"), uzi_ready_01); -}; -void() uzi_fire1_01 = -{ - self.uzi_bulletcounter = 1; - weapon_doattack(uzi_check, uzi_check, W_Uzi_Attack); - weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_refire"), uzi_fire1_02); -}; - diff --git a/qcsrc/progdefs.h b/qcsrc/progdefs.h deleted file mode 100644 index eb15c45c6..000000000 --- a/qcsrc/progdefs.h +++ /dev/null @@ -1,143 +0,0 @@ - -/* file generated by qcc, do not modify */ - -typedef struct -{ int pad[28]; - int self; - int other; - int world; - float time; - float frametime; - float force_retouch; - string_t mapname; - float deathmatch; - float coop; - float teamplay; - float serverflags; - float total_secrets; - float total_monsters; - float found_secrets; - float killed_monsters; - float parm1; - float parm2; - float parm3; - float parm4; - float parm5; - float parm6; - float parm7; - float parm8; - float parm9; - float parm10; - float parm11; - float parm12; - float parm13; - float parm14; - float parm15; - float parm16; - vec3_t v_forward; - vec3_t v_up; - vec3_t v_right; - float trace_allsolid; - float trace_startsolid; - float trace_fraction; - vec3_t trace_endpos; - vec3_t trace_plane_normal; - float trace_plane_dist; - int trace_ent; - float trace_inopen; - float trace_inwater; - int msg_entity; - func_t main; - func_t StartFrame; - func_t PlayerPreThink; - func_t PlayerPostThink; - func_t ClientKill; - func_t ClientConnect; - func_t PutClientInServer; - func_t ClientDisconnect; - func_t SetNewParms; - func_t SetChangeParms; -} globalvars_t; - -typedef struct -{ - float modelindex; - vec3_t absmin; - vec3_t absmax; - float ltime; - float movetype; - float solid; - vec3_t origin; - vec3_t oldorigin; - vec3_t velocity; - vec3_t angles; - vec3_t avelocity; - vec3_t punchangle; - string_t classname; - string_t model; - float frame; - float skin; - float effects; - vec3_t mins; - vec3_t maxs; - vec3_t size; - func_t touch; - func_t use; - func_t think; - func_t blocked; - float nextthink; - int groundentity; - float health; - float frags; - float weapon; - string_t weaponmodel; - float weaponframe; - float currentammo; - float ammo_shells; - float ammo_nails; - float ammo_rockets; - float ammo_cells; - float items; - float takedamage; - int chain; - float deadflag; - vec3_t view_ofs; - float button0; - float button1; - float button2; - float impulse; - float fixangle; - vec3_t v_angle; - float idealpitch; - string_t netname; - int enemy; - float flags; - float colormap; - float team; - float max_health; - float teleport_time; - float armortype; - float armorvalue; - float waterlevel; - float watertype; - float ideal_yaw; - float yaw_speed; - int aiment; - int goalentity; - float spawnflags; - string_t target; - string_t targetname; - float dmg_take; - float dmg_save; - int dmg_inflictor; - int owner; - vec3_t movedir; - string_t message; - float sounds; - string_t noise; - string_t noise1; - string_t noise2; - string_t noise3; -} entvars_t; - -#define PROGHEADER_CRC 5927 diff --git a/qcsrc/progs.src b/qcsrc/progs.src deleted file mode 100644 index 3d82506c4..000000000 --- a/qcsrc/progs.src +++ /dev/null @@ -1,66 +0,0 @@ -../progs.dat - -gamec/sys.h -gamec/builtins.h -gamec/constants.h -gamec/defs.h // Should rename this, it has fields and globals - -gamec/extensions.h - -gamec/miscfunctions.c - -gamec/mauvebot.c - -gamec/g_subs.c - -gamec/runematch.c - -gamec/cl_physics.c - - -gamec/teamplay.c - -gamec/g_world.c -gamec/g_decors.c -gamec/g_casings.c - -gamec/t_jumppads.c -gamec/t_teleporters.c - -gamec/sv_main.c -gamec/sv_stats.c - -gamec/g_violence.c -gamec/g_damage.c - -gamec/g_triggers.c - -gamec/cl_weaponsystem.c -gamec/cl_weaponanimations.c -gamec/w_common.c -gamec/w_laser.c -gamec/w_shotgun.c -gamec/w_uzi.c -gamec/w_grenadelauncher.c -gamec/w_electro.c -gamec/w_crylink.c -gamec/w_nex.c -gamec/w_hagar.c -gamec/w_rocketlauncher.c -gamec/cl_weapons.c - -gamec/t_items.c -gamec/t_halflife.c -gamec/t_quake3.c -gamec/t_quake.c -//gamec/g_tetris.c -gamec/cl_impulse.c -gamec/cl_player.c -gamec/cl_client.c -gamec/t_plats.c - -gamec/ctf.c -gamec/domination.c -gamec/g_hook.c - -gamec/clientcommands.c diff --git a/qcsrc/todo.txt b/qcsrc/todo.txt deleted file mode 100644 index 417100879..000000000 --- a/qcsrc/todo.txt +++ /dev/null @@ -1 +0,0 @@ -http://savage747.sa.funpic.de/wiki/pmwiki.php?n=Main.Development \ No newline at end of file diff --git a/scmenu/constants.menu b/scmenu/constants.menu deleted file mode 100644 index e87afee2c..000000000 --- a/scmenu/constants.menu +++ /dev/null @@ -1,94 +0,0 @@ -// Property of Alientrap -// -// Constants - -// Item flags -// TODO: keep this always in sync with its control/items.qh counterpart -#define FlagTemplate "1" // this is a template do not touch, do not draw - actually dont do anything with it -#define FlagEmbedded "2" // the item cant be selected and all its children are embedded into its parent -#define FlagHidden "4" // events wont be called and it wont be drawn, etc. -#define FlagNoSelect "8" // cant be selected (but events will be called) -#define FlagConnected "16" // only if connected (i.e. playing) -#define FlagServer "32" // only displayed if server -#define FlagDeveloper "64" // only displayed if developer -#define FlagDraw "128" // only the draw event will be called -#define FlagChildDraw "256" // used to make the children only drawable -#define FlagDrawUpdate "512" // only the draw and update event get called -#define FlagChildDrawUpdate "1024" // only the draw and refresh events are called for children -#define FlagSealOffMouse "2048" // used to seal all items under the item with this flag off from mouse events - -#define InfiniteFloat "10000000.0" -#define InfiniteVector "10000000.0 10000000.0 10000000.0" - -// Alignment constants -#define AlignLeft "0" -#define AlignCenter "1" -#define AlignRight "2" -#define AlignFixLeft "4" // |text - actually this isnt necessary -#define AlignFixCenter "8" // te|xt -#define AlignFixRight "16" // text| -#define AlignFirst "32" // for layouts: item| ... | being the origin - -// DrawFlag constants -#define DrawFlagNormal "0" -#define DrawFlagAdditive "1" -#define DrawFlagModulate "2" -#define DrawFlag2xModulate "3" - -// Item constants -#define DefaultFontSize "11 11 0" - -// Text constants -#define DefaultTextColor "0 0 0" -#define DefaultTextAlpha "1" -#define DefaultTextDrawFlag [DrawFlagNormal] - -#define DefaultSelTextColor "0 0 1" -#define DefaultSelTextAlpha "1" -#define DefaultSelTextDrawFlag [DrawFlagNormal] - -#define DefaultPreTextColor "1 0 0" -#define DefaultPreTextAlpha "1" -#define DefaultPreTextDrawFlag [DrawFlagNormal] - -#define DefaultInaTextColor "0.1 0.1 0.5" -#define DefaultInaTextAlpha "1" -#define DefaultInaTextDrawFlag [DrawFlagNormal] - -// Picture constants -#define DefaultPicColor "1 1 1" -#define DefaultPicAlpha "1" -#define DefaultPicDrawFlag [DrawFlagNormal] - -#define DefaultSelPicColor "0.2 0.2 1" -#define DefaultSelPicAlpha "1" -#define DefaultSelPicDrawFlag [DrawFlagNormal] - -#define DefaultPrePicColor "1 0.2 0.2" -#define DefaultPrePicAlpha "1" -#define DefaultPrePicDrawFlag [DrawFlagNormal] - -// Sound constants -#define DefaultSelectSound "misc/menu1.wav" -#define DefaultPressSound "misc/mouseclick.wav" - -#define DefaultIncreaseSound "misc/increasevalue.wav" -#define DefaultDecreaseSound "misc/decreasevalue.wav" - -#define DefaultStartSound "misc/startgame.wav" -#define DefaultEndSound "misc/endgame.wav" - -// Slider -#define DefaultSliderBar "gfx/m_sliderbar" -#define DefaultSlider "gfx/m_slider" -#define DefaultSliderBarSize "144 12" -#define DefaultSliderSize "12 12" -#define DefaultProportions "0.073107 0.853785 0.073107" -#define DefaultDirection "0.5 0.5" - -// EditBoxs -#define DefaultCursorSize "1.375 12 0" -#define DefaultCursorFlashSize "1.375 12 0" -#define DefaultCursorColor "0 0 0" -#define DefaultCursorFlashColor "0 0 0" - diff --git a/scmenu/creategame.menu b/scmenu/creategame.menu deleted file mode 100644 index 60cccbd7b..000000000 --- a/scmenu/creategame.menu +++ /dev/null @@ -1,63 +0,0 @@ -// Property of Alientrap/AK -// -// creategame.menu -Item Layout CreateGame -{ - size '900 630' - alignment [AlignLeft] - direction [Nex_DefaultVertDirection] - - Item Layout Bar - { - size '900 20' - alignment [AlignLeft] - direction '32 0 0' - - Derive TextButton BasicOptions - { - normal "Basic Options" - - init Nex_Action_JumpToPage - target "Panel::Basic" - } - Derive TextButton MapList - { - normal "Map List" - - init Nex_Action_JumpToPage - target "Panel::MapList" - } - Derive TextButton GameSettings - { - normal "Game Settings" - - init Nex_Action_JumpToPage - target "Panel::Game" - } - Derive TextButton WeaponSettings - { - normal "Weapon Settings" - - init Nex_Action_JumpToPage - target "Panel::Weapon" - } - Derive TextButton Management - { - normal "Management" - - init Nex_Action_JumpToPage - target "Panel::Management" - } - } - Item EventWindow Panel - { - size '900 585' - reinit Nex_Action_MakeFirstVisible - - #include "menu/creategame/basic.menu" - #include "menu/creategame/maplist.menu" - #include "menu/creategame/game.menu" - #include "menu/creategame/weapon.menu" - #include "menu/creategame/management.menu" - } -} diff --git a/scmenu/creategame/basic.menu b/scmenu/creategame/basic.menu deleted file mode 100644 index 2cc3d6628..000000000 --- a/scmenu/creategame/basic.menu +++ /dev/null @@ -1,156 +0,0 @@ -// Property of Alientrap/AK -// -// creategame/basic.menu -Item Window Basic -{ - size '900 585' - - Item Window Map - { - DeriveTemplate Nex_Composition Nex_Option_MapType - { - DeriveTemplate Nex_Automation_Option_Switch Automation - {} - DeriveTemplate TextButton Description - {} - DeriveTemplate SwitchButton Switch - { - size '200 12' - action Nex_Action_Maplist_ChangeMapType - } - } - - size '400 585' - flag [FlagEmbedded] - - Derive Picture Table3 - { - picture "gfx/table2" - pos '0 0' - size '400 585' - } - Derive Picture Picture - { - picture "gfx/m_white" - size '350 300' - pos '20 40' - } - Derive MultiLabel Description - { - pos '20 340' - size '350 285' - wrap 31 - fontSize '11 11 0' - } - Derive TextButton Prev - { - normal "<<" - pos '20 25' - action Nex_Action_MapSelector_Prev - } - Derive Label Name - { - alignment [AlignCenter] - size '306 14' - pos '44 24' - } - Derive TextButton Next - { - normal ">>" - pos '348 25' - - action Nex_Action_MapSelector_Next - } - Derive Nex_Option_MapType MapType - { - pos '50 5' - text "Filter" - target "Data::Server::Map::Query::Switch" - } - Item Task_Job UpdateJob - { - update Nex_MapSelector_UpdateMap - } - } - Item Layout Settings - { - pos '400 0' - size '500 585' - origin '250 0' - alignment [AlignFirst] - direction [Nex_DefaultVertDirection] - flag [FlagEmbedded] - - DeriveTemplate Nex_Composition Option_EditBox - { - DeriveTemplate Nex_Automation_Option_EditBox Automation - {} - DeriveTemplate TextButton Description - {} - DeriveTemplate EditBox EditBox - { - size '200 12' - action Nex_Action_TestOnChange - select Nex_Action_TestOnSelect - } - } - - Derive Option_EditBox Hostname - { - text "Server Name" - target "Data::Server::Hostname::Text" - } - //Derive Nex_Option_Switch GameMode - //{ - // text "Game Mode" - // target "::Data::Server::GameMode::Switch" - //} - Derive Nex_Option_Switch GameType - { - text "Mod" - target "Data::Server::ServerProgs::Switch" - } - Derive Nex_Option_Switch PublicServer - { - text "Public Server" - target "Data::Server::PublicServer::Switch" - } - Derive Option_EditBox MaxPlayer - { - text "Max Players" - target "Data::Server::MaxPlayers::Text" - } - Derive Nex_Line Seperator1 - {} - Derive Option_EditBox NumBots - { - text "Bot Count" - target "Data::Server::NumBots::Text" - } - Derive Nex_Option_Switch BotSkill - { - text "Skill Level" - target "Data::Server::BotSkill::Switch" - } - Derive Nex_Line Seperator2 - {} - Derive Option_EditBox ServerFrameTime - { - text "Server Frame Time" - target "Data::Server::ServerFrameTime::Text" - } - Derive Option_EditBox ServerMaxRate - { - text "Server Max Rate" - target "Data::Server::ServerMaxRate::Text" - } - Derive Nex_Void Seperator3 - {} - Derive PictureButton Start - { - normal "$gfx/m_start" - - action Nex_Action_Map_Start - } - } -} diff --git a/scmenu/creategame/game.menu b/scmenu/creategame/game.menu deleted file mode 100644 index 2c3647298..000000000 --- a/scmenu/creategame/game.menu +++ /dev/null @@ -1,56 +0,0 @@ -Item Layout Game -{ - direction '20 0' - - Item Arrangement Menu - { - direction '0 10' - - Derive TextButton Teamplay - { - normal "DM & Teamplay" - - init Nex_Action_JumpToPage - target "Panel::Teamplay" - } - Derive TextButton CTF - { - normal "CTF" - - init Nex_Action_JumpToPage - target "Panel::CTF" - } - Derive TextButton Domination - { - normal "Domination" - - init Nex_Action_JumpToPage - target "Panel::Domination" - } - Derive TextButton Runematch - { - normal "Rune Match" - - init Nex_Action_JumpToPage - target "Panel::Runematch" - } - Derive TextButton GameMisc - { - normal "Misc" - - init Nex_Action_JumpToPage - target "Panel::Misc" - } - } - Item EventWindow Panel - { - size '760 800' - reinit Nex_Action_MakeFirstVisible - - #include "menu/creategame/gamemodes/gamemisc.menu" - #include "menu/creategame/gamemodes/teamplay.menu" - #include "menu/creategame/gamemodes/ctf.menu" - #include "menu/creategame/gamemodes/domination.menu" - #include "menu/creategame/gamemodes/runematch.menu" - } -} \ No newline at end of file diff --git a/scmenu/creategame/gamemodes/ctf.menu b/scmenu/creategame/gamemodes/ctf.menu deleted file mode 100644 index ba0d76a36..000000000 --- a/scmenu/creategame/gamemodes/ctf.menu +++ /dev/null @@ -1,60 +0,0 @@ -Item Layout CTF -{ - direction [Nex_DefaultVertDirection] - size '900 585' - origin '450 0' - alignment [AlignFirst] - - Derive Nex_Option_EditBox TimeLimit - { - text "Time Limit Override (disable: -1)" - // use the same one from the basic menu - target "Data::Server::TimeLimit::Text" - } - Derive Nex_Option_EditBox CaptureLimit - { - text "CTF Point Limit Override (disable: -1)" - target "Data::Game::CTF::CaptureLimit::Text" - } - Derive Nex_Option_EditBox FlagReturnTime - { - text "Flag Return Time" - target "::Data::Game::CTF::FlagReturnTime::Text" - } - Derive Nex_Option_EditBox FragsCapture - { - text "Capture Points (player)" - target "Data::Game::CTF::FragsCapture::Text" - } - Derive Nex_Option_EditBox FragsCaptureTeam - { - text "Capture Points (team)" - target "::Data::Game::CTF::FragsCaptureTeam::Text" - } - Derive Nex_Option_EditBox FragsPickup - { - text "Flag Pickup Points" - target "Data::Game::CTF::FragsPickup::Text" - } - Derive Nex_Option_EditBox FragsReturn - { - text "Return Flag Points (ally)" - target "::Data::Game::CTF::FragsReturn::Text" - } - Derive Nex_Option_EditBox FragsReturnRogue - { - text "Return Flag Points (rogue team)" - target "::Data::Game::CTF::FragsReturnRogue::Text" - } - - - - Derive Nex_Line Seperator - {} - Derive TextButton Reset - { - normal "Reset to default" - init Nex_Action_ResetData - target "::Data::Game::CTF" - } -} diff --git a/scmenu/creategame/gamemodes/domination.menu b/scmenu/creategame/gamemodes/domination.menu deleted file mode 100644 index f13427bf9..000000000 --- a/scmenu/creategame/gamemodes/domination.menu +++ /dev/null @@ -1,70 +0,0 @@ -Item Layout Domination -{ - direction [Nex_DefaultVertDirection] - size '900 585' - origin '450 0' - alignment [AlignFirst] - - //Derive Nex_Option_Switch Domination_Active - //{ - // text "Play Domination" - // target "::Data::Game::Domination::Domination_Active::Switch" - //} - Derive Nex_Option_EditBox TimeLimit - { - text "Time Limit Override (disable: -1)" - // use the same one from the basic menu - target "Data::Server::TimeLimit::Text" - } - Derive Nex_Option_EditBox DomFragLimit - { - text "Score Limit Override (disable: -1)" - target "Data::Game::Domination::DomFragLimit::Text" - } - - Derive Nex_Option_Switch DisableFrags - { - text "No Scores From Kills" - target "::Data::Game::Domination::DisableFrags::Switch" - } - //Derive Nex_Option_Switch BalanceTeamPoints - //{ - // text "Team Size Affects Points" - // target "::Data::Game::Domination::BalanceTeamPoints::Switch" - //} - Derive Nex_Option_EditBox PointAmt - { - text "Domination Score Amount" - target "Data::Game::Domination::PointAmt::Text" - } - Derive Nex_Option_EditBox PointRate - { - text "Score Frequency" - target "Data::Game::Domination::PointRate::Text" - } - Derive Nex_Option_EditBox CaptureTime - { - text "DomPoint Capture Delay" - target "::Data::Game::Domination::CaptureTime::Text" - } - //Derive Nex_Option_EditBox DefaultNumTeams - //{ - // text "Default # of Teams on Non-Domination Maps (2-4)" - // target "::Data::Game::Domination::DefaultNumTeams::Text" - //} - Derive Nex_Option_Switch DefaultNumTeams - { - text "Default # of teams" - target "Data::Game::Domination::DefaultNumTeams::Switch" - } - - - Derive Nex_Line Seperator - {} - Derive TextButton Reset - { - normal "Reset to default" - init Nex_Action_ResetData - target "::Data::Game::Domination" - } -} diff --git a/scmenu/creategame/gamemodes/gamemisc.menu b/scmenu/creategame/gamemodes/gamemisc.menu deleted file mode 100644 index 5118f074f..000000000 --- a/scmenu/creategame/gamemodes/gamemisc.menu +++ /dev/null @@ -1,268 +0,0 @@ -// Property of Alientrap/AK -// -// creategame/game.menu -Item Layout Misc -{ - size '800 585' - flag [FlagEmbedded] - - Item ScrollWindow ScrollWindow - { - size '780 585' - flag [FlagEmbedded] - - Item Arrangement Arrangement - { - direction [Nex_DefaultVertDirection] - alignment [AlignFirst] - flag [FlagEmbedded] - - // hack to make the arrangement have a set width - Item Window FixWidth - { - size '800 0' - Derive Nex_Void Left - { - pos '0 0' - size '400 0' - } - Derive Nex_Void Right - { - pos '400 0' - size '400 0' - } - } - - - Derive Nex_Option_EditBox JoinMessageTime - { - text "Join Message Display Time" - target "Data::Game::Misc::JoinMessageTime::Text" - } - Derive Nex_Option_Switch Grapple - { - text "Grappling Hook Enabled" - target "::Data::Game::Misc::Grapple::Switch" - } - Derive Nex_Option_EditBox GrappleFireSpeed - { - text "Grappling Hook Fire Speed" - target "Data::Game::Misc::GrappleFireSpeed::Text" - } - Derive Nex_Option_EditBox GrapplePullSpeed - { - text "Grappling Hook Pull Speed" - target "Data::Game::Misc::GrapplePullSpeed::Text" - } - Derive Nex_Line SeperatorWeapons - {} - Derive Nex_Option_Switch StartLaser - { - text "Start with Laser" - target "::Data::Game::Misc::StartLaser::Switch" - } - Derive Nex_Option_Switch StartShotgun - { - text "Start with Shotgun" - target "::Data::Game::Misc::StartShotgun::Switch" - } - Derive Nex_Option_Switch StartUzi - { - text "Start with Machinegun" - target "::Data::Game::Misc::StartUzi::Switch" - } - Derive Nex_Option_Switch StartGrenadelauncher - { - text "Start with Grenadelauncher" - target "::Data::Game::Misc::StartGrenadelauncher::Switch" - } - Derive Nex_Option_Switch StartElectro - { - text "Start with Electro" - target "::Data::Game::Misc::StartElectro::Switch" - } - Derive Nex_Option_Switch StartCrylink - { - text "Start with Crylink" - target "::Data::Game::Misc::StartCrylink::Switch" - } - Derive Nex_Option_Switch StartNex - { - text "Start with Nex" - target "::Data::Game::Misc::StartNex::Switch" - } - Derive Nex_Option_Switch StartHagar - { - text "Start with Hagar" - target "::Data::Game::Misc::StartHagar::Switch" - } - Derive Nex_Option_Switch StartRocketlauncher - { - text "Start with Rocketlauncher" - target "::Data::Game::Misc::StartRocketlauncher::Switch" - } - Derive Nex_Line SeperatorAmmo - {} - Derive Nex_Option_EditBox StartShells - { - text "Starting Shells" - target "::Data::Game::Misc::StartShells::Text" - } - Derive Nex_Option_EditBox StartNails - { - text "Starting Bullets" - target "::Data::Game::Misc::StartNails::Text" - } - Derive Nex_Option_EditBox StartRockets - { - text "Starting Rockets" - target "::Data::Game::Misc::StartRockets::Text" - } - Derive Nex_Option_EditBox StartCells - { - text "Starting Cells" - target "::Data::Game::Misc::StartCells::Text" - } - Derive Nex_Line SeperatorItems - {} - Derive Nex_Option_Switch UseAmmunition - { - text "Use ammunition" - target "::Data::Game::Misc::UseAmmunition::Switch" - } - Derive Nex_Option_Switch PickupItems - { - text "Pickup items" - target "::Data::Game::Misc::PickupItems::Switch" - } - Derive Nex_Line SeperatorGamemodes - {} - Derive Nex_Option_Switch Instagib - { - text "Instagib (better use above)" - target "::Data::Game::Misc::Instagib::Switch" - } - Derive Nex_Option_Switch Rocketarena - { - text "Rocket Arena (better use above)" - target "::Data::Game::Misc::RocketArena::Switch" - } - Derive Nex_Option_Switch Vampire - { - text "Vampire Mode" - target "::Data::Game::Misc::Vampire::Switch" - } - Derive Nex_Option_Switch MidAir - { - text "MidAir" - target "::Data::Game::Misc::MidAir::Switch" - } - Derive Nex_Line SeperatorOthers - {} - Derive Nex_Option_Switch Casings - { - text "Bullet Casings" - target "::Data::Game::Misc::Casings::Switch" - } - Derive Nex_Option_EditBox HealthStart - { - text "Starting Health" - target "Data::Game::Misc::HealthStart::Text" - } - Derive Nex_Option_EditBox HealthRot - { - text "Health Rot" - target "Data::Game::Misc::HealthRot::Text" - } - Derive Nex_Option_EditBox HealthStable - { - text "Health Stable" - target "Data::Game::Misc::HealthStable::Text" - } - Derive Nex_Option_EditBox Gravity - { - text "Level Gravity" - target "Data::Game::Misc::Gravity::Text" - } - Derive Nex_Option_EditBox Maxspeed - { - text "Player Maxspeed" - target "Data::Game::Misc::MaxSpeed::Text" - } - Derive Nex_Option_EditBox Gamespeed - { - text "Game Speed" - target "Data::Game::Misc::GameSpeed::Text" - } - Derive Nex_Option_EditBox Maxairspeed - { - text "Max Air Speed" - target "Data::Game::Misc::MaxAirSpeed::Text" - } - Derive Nex_Option_EditBox JumpHeight - { - text "Jump height" - target "Data::Game::Misc::JumpHeight::Text" - } - Derive Nex_Option_EditBox HealthRegeneration - { - text "Health Regeneration Speed" - target "Data::Game::Misc::HealthRegeneration::Text" - } - Derive Nex_Option_EditBox ArmorRott - { - text "Armor Rot Speed" - target "Data::Game::Misc::ArmorRott::Text" - } - Derive Nex_Option_EditBox ArmorRegen - { - text "Armor Regeneration Speed" - target "Data::Game::Misc::ArmorRegen::Text" - } - Derive Nex_Option_EditBox ArmorStable - { - text "Armor Stable" - target "Data::Game::Misc::ArmorStable::Text" - } - Derive Nex_Option_EditBox ArmorStart - { - text "Armor Start" - target "Data::Game::Misc::ArmorStart::Text" - } - Derive Nex_Option_EditBox SelfDamagePercent - { - text "Self Damage Percent" - target "Data::Game::Misc::SelfDamagePercent::Text" - } - Derive Nex_Option_EditBox WeaponSwitchDelay - { - text "Weapon Switch Delay" - target "Data::Game::Misc::WeaponSwitchDelay::Text" - } - Derive Nex_Option_EditBox Friction - { - text "Player Friction" - target "Data::Game::Misc::Friction::Text" - } - Derive Nex_Option_EditBox Accelerate - { - text "Player Accelerate" - target "Data::Game::Misc::Accelerate::Text" - } - Derive Nex_Line Seperator - {} - Derive TextButton Reset - { - normal "Reset to default" - init Nex_Action_ResetData - target "::Data::Game::Misc" - } - } - } - Item VScrollBar Scroller - { - pos '780 0' - size '20 100' - target "##prev" - } -} diff --git a/scmenu/creategame/gamemodes/runematch.menu b/scmenu/creategame/gamemodes/runematch.menu deleted file mode 100644 index b6ef9618c..000000000 --- a/scmenu/creategame/gamemodes/runematch.menu +++ /dev/null @@ -1,263 +0,0 @@ -Item Layout Runematch -{ - size '800 585' - flag [FlagEmbedded] - - Item ScrollWindow ScrollWindow - { - size '780 585' - flag [FlagEmbedded] - - Item Arrangement Arrangement - { - direction [Nex_DefaultVertDirection] - alignment [AlignFirst] - flag [FlagEmbedded] - - // hack to make the arrangement have a set width - Item Window FixWidth - { - size '800 0' - Derive Nex_Void Left - { - pos '0 0' - size '400 0' - } - Derive Nex_Void Right - { - pos '400 0' - size '400 0' - } - } - - Derive Nex_Option_EditBox TimeLimit - { - text "Time Limit Override (disable: -1)" - // use the same one from the basic menu - target "Data::Server::TimeLimit::Text" - } - Derive Nex_Option_EditBox RunematchFragLimit - { - text "Score Limit Override (disable: -1)" - target "Data::Game::Runematch::RunematchFragLimit::Text" - } - - Derive Nex_Option_EditBox PointAmt - { - text "Score per Rune" - target "Data::Game::Runematch::PointAmt::Text" - } - Derive Nex_Option_EditBox PointRate - { - text "Rune Score Frequency" - target "Data::Game::Runematch::PointRate::Text" - } - Derive Nex_Option_EditBox RuneRespawnTime - { - text "Rune Respawn Timer After Dropped" - target "Data::Game::Runematch::RuneRespawnTime::Text" - } - Derive Nex_Option_EditBox RuneShuffleTime - { - text "Rune Position Change Timer" - target "Data::Game::Runematch::RuneShuffleTime::Text" - } - Derive Nex_Option_EditBox FragsKilledbyRuneholder - { - text "Frags When Holding Runes" - target "Data::Game::Runematch::FragsKilledbyRuneholder::Text" - } - Derive Nex_Option_EditBox FragsKilledRuneholder - { - text "Frags for Killing Rune Holders" - target "Data::Game::Runematch::FragsKilledRuneholder::Text" - } - Derive Nex_Option_EditBox FragsKillNoRunes - { - text "Other Frags (for non-rune kills)" - target "Data::Game::Runematch::FragsKillNoRunes::Text" - } - Derive Nex_Option_EditBox MaxRunesToDrop - { - text "Max Runes to Drop on Death" - target "Data::Game::Runematch::MaxRunesToDrop::Text" - } - - Derive Nex_Line SeperatorStrength - {} - Derive Nex_Option_EditBox StrengthDamage - { - text "Strength Damage" - target "Data::Game::Runematch::StrengthDamage::Text" - } - Derive Nex_Option_EditBox StrengthForce - { - text "Strength Force" - target "Data::Game::Runematch::StrengthForce::Text" - } - Derive Nex_Option_EditBox WeaknessDamage - { - text "Weakness Damage" - target "Data::Game::Runematch::WeaknessDamage::Text" - } - Derive Nex_Option_EditBox WeaknessForce - { - text "Weakness Force" - target "Data::Game::Runematch::WeaknessForce::Text" - } - Derive Nex_Option_EditBox StrengthComboDamage - { - text "Combined Damage" - target "Data::Game::Runematch::StrengthComboDamage::Text" - } - Derive Nex_Option_EditBox StrengthComboForce - { - text "Combined Force" - target "Data::Game::Runematch::StrengthComboForce::Text" - } - - - Derive Nex_Line SeperatorDefense - {} - Derive Nex_Option_EditBox DefenseDamage - { - text "Defense TakeDamage" - target "Data::Game::Runematch::DefenseDamage::Text" - } - Derive Nex_Option_EditBox VulnerDamage - { - text "Vulnerability TakeDamage" - target "Data::Game::Runematch::VulnerDamage::Text" - } - Derive Nex_Option_EditBox DefenseComboDamage - { - text "Combined TakeDamage" - target "Data::Game::Runematch::DefenseComboDamage::Text" - } - - - Derive Nex_Line SeperatorVampire - {} - Derive Nex_Option_EditBox VampireDamage - { - text "Vampire Damage Absorb" - target "Data::Game::Runematch::VampireDamage::Text" - } - Derive Nex_Option_EditBox EmpathyDamage - { - text "Empathy Damage Take" - target "Data::Game::Runematch::EmpathyDamage::Text" - } - Derive Nex_Option_EditBox VampireComboDamage - { - text "Combined Absorb or Take" - target "Data::Game::Runematch::VampireComboDamage::Text" - } - - - Derive Nex_Line SeperatorRegen - {} - Derive Nex_Option_EditBox RegenHP - { - text "Vitality Health" - target "Data::Game::Runematch::RegenHP::Text" - } - Derive Nex_Option_EditBox VenomHP - { - text "Venom Health" - target "Data::Game::Runematch::VenomHP::Text" - } - Derive Nex_Option_EditBox RegenComboHP - { - text "Combined Health" - target "Data::Game::Runematch::RegenComboHP::Text" - } - Derive Nex_Option_EditBox RegenSpeed - { - text "Vitality Regenerate Speed" - target "Data::Game::Runematch::RegenSpeed::Text" - } - Derive Nex_Option_EditBox VenomSpeed - { - text "Venom Degenerate Speed" - target "Data::Game::Runematch::VenomSpeed::Text" - } - Derive Nex_Option_EditBox RegenComboRegenSpeed - { - text "Combined Regenerate Speed" - target "Data::Game::Runematch::RegenComboRegenSpeed::Text" - } - Derive Nex_Option_EditBox RegenComboDegenSpeed - { - text "Combined Degenerate Speed" - target "Data::Game::Runematch::RegenComboDegenSpeed::Text" - } - - - Derive Nex_Line SeperatorSpeed - {} - Derive Nex_Option_EditBox SpeedMoverate - { - text "Speed Move Rate" - target "Data::Game::Runematch::SpeedMoverate::Text" - } - Derive Nex_Option_EditBox SlowMoverate - { - text "Slow Move Rate" - target "Data::Game::Runematch::SlowMoverate::Text" - } - Derive Nex_Option_EditBox SpeedComboMoverate - { - text "Combined Move Rate" - target "Data::Game::Runematch::SpeedComboMoverate::Text" - } - Derive Nex_Option_EditBox SpeedAtkrate - { - text "Speed Attack Rate" - target "Data::Game::Runematch::SpeedAtkrate::Text" - } - Derive Nex_Option_EditBox SlowAtkrate - { - text "Slow Attack Rate" - target "Data::Game::Runematch::SlowAtkrate::Text" - } - Derive Nex_Option_EditBox SpeedComboAtkrate - { - text "Combined Attack Rate" - target "Data::Game::Runematch::SpeedComboAtkrate::Text" - } - Derive Nex_Option_EditBox SpeedJumpHeight - { - text "Speed Jump Height" - target "Data::Game::Runematch::SpeedJumpHeight::Text" - } - Derive Nex_Option_EditBox SlowJumpHeight - { - text "Slow Jump Height" - target "Data::Game::Runematch::SlowJumpHeight::Text" - } - Derive Nex_Option_EditBox SpeedComboJumpHeight - { - text "Combined Jump Height" - target "Data::Game::Runematch::SpeedComboJumpHeight::Text" - } - - - - Derive Nex_Line Seperator - {} - Derive TextButton Reset - { - normal "Reset to default" - init Nex_Action_ResetData - target "::Data::Game::Runematch" - } - } - } - Item VScrollBar Scroller - { - pos '780 0' - size '20 100' - target "##prev" - } -} diff --git a/scmenu/creategame/gamemodes/teamplay.menu b/scmenu/creategame/gamemodes/teamplay.menu deleted file mode 100644 index a06a63374..000000000 --- a/scmenu/creategame/gamemodes/teamplay.menu +++ /dev/null @@ -1,68 +0,0 @@ -Item Layout Teamplay -{ - direction [Nex_DefaultVertDirection] - size '900 585' - origin '450 0' - alignment [AlignFirst] - - Derive Nex_Option_EditBox TimeLimit - { - text "Time Limit Override (disable: -1)" - target "Data::Server::TimeLimit::Text" - } - Derive Nex_Option_EditBox FragLimit - { - text "Frag Limit Override (disable: -1)" - target "Data::Server::FragLimit::Text" - } - Derive Nex_Option_Switch DMForceTeamplay - { - text "Force Teamplay (TDM) in Deathmatch maps" - target "::Data::Game::Teamplay::DMForceTeamplay::Switch" - } - Derive Nex_Option_Switch TeamPlay - { - text "Teamplay Friendly Fire" - target "::Data::Game::Teamplay::TeamPlay::Switch" - } - Derive Nex_Option_Switch BalanceTeams - { - text "Auto-Balance Teams on Join" - target "::Data::Game::Teamplay::BalanceTeams::Switch" - } - Derive Nex_Option_Switch ForceBalanceTeams - { - text "Force Balanced Teams" - target "::Data::Game::Teamplay::ForceBalanceTeams::Switch" - } - Derive Nex_Option_Switch PreventTeamImbalance - { - text "Prevent Team-Imbalancing Switch" - target "::Data::Game::Teamplay::PreventTeamImbalance::Switch" - } - Derive Nex_Option_Switch BanChangeTeams - { - text "Changing team not allowed" - target "::Data::Game::Teamplay::BanChangeTeams::Switch" - } - Derive Nex_Option_Switch TDM_NumTeams - { - text "Team Deathmatch (TDM) # of teams" - target "Data::Game::Teamplay::TDM_NumTeams::Switch" - } - Derive Nex_Option_EditBox ChangeTeamFragTransfer - { - text "Score Transfer % on Change Team" - target "Data::Game::Teamplay::ChangeTeamFragTransfer::Text" - } - - - Derive Nex_Line Seperator - {} - Derive TextButton Reset - { - normal "Reset to default" - init Nex_Action_ResetData - target "::Data::Game::Teamplay" - } -} diff --git a/scmenu/creategame/management.menu b/scmenu/creategame/management.menu deleted file mode 100644 index 2e06fe44f..000000000 --- a/scmenu/creategame/management.menu +++ /dev/null @@ -1,90 +0,0 @@ -// Property of Alientrap/AK -// -// creategame/management.menu -Item Layout Management -{ - size '900 585' - flag [FlagEmbedded] - alignment [AlignCenter] - direction '0 20' - origin '450 0' - - Item Arrangement ConfigType - { - flag [FlagEmbedded] - direction '20 0' - - Derive TextButton WeaponConfigs - { - normal "Weapons" - action Nex_Action_Management_TypeWeapon - } - Derive TextButton GameConfigs - { - normal "Game" - action Nex_Action_Management_TypeGame - } - Derive TextButton Maplists - { - normal "Maplists" - action Nex_Action_Management_TypeMapList - } - } - - Item Task_Job SyncCategory - { - update Nex_Update_Management_SyncData - } - - Derive List FileList - { - size '300 340' - target "::Data::Management::FileList::Weapon" - - action Nex_Action_CopyToFilename - } - - Item Arrangement Filename - { - flag [FlagEmbedded] - direction [Nex_DefaultHorzDirection] - - Derive TextButton Label - { - normal "Config Name :" - link "##next" - } - Derive EditBox Name - { - //size '260 11' - target "::Data::Management::Filename::Text" - - action Nex_Action_TestOnChange - select Nex_Action_TestOnSelect - } - } - - Item Arrangement Controls - { - flag [FlagEmbedded] - direction [Nex_DefaultHorzDirection] - - Derive TextButton Save - { - normal "Save" - action Nex_Action_Management_Save - } - - Derive TextButton Load - { - normal "Load" - action Nex_Action_Management_Load - } - - Derive TextButton Refresh - { - normal "Refresh" - action Nex_Action_Management_Refresh - } - } -} diff --git a/scmenu/creategame/maplist.menu b/scmenu/creategame/maplist.menu deleted file mode 100644 index c7580dc92..000000000 --- a/scmenu/creategame/maplist.menu +++ /dev/null @@ -1,91 +0,0 @@ -// Property of Alientrap/AK -// -// creategame/maplist.menu -Item Window MapList -{ - size '900 585' - - DeriveTemplate Nex_Composition Nex_Option_MapType - { - DeriveTemplate Nex_Automation_Option_Switch Automation - {} - DeriveTemplate TextButton Description - {} - DeriveTemplate SwitchButton Switch - { - size '200 12' - action Nex_Action_Maplist_ChangeMapType - } - } - Derive Nex_Option_MapType MapQuery - { - pos '0 0' - size '900 20' - text "Map Type:" - target "Data::Server::Map::Query::Switch" - } - Derive Label MapsLabel - { - pos '0 20' - text "Map List:" - } - Derive List Maps - { - pos '0 40' - size '425 500' - - target "::Data::Server::Map::List" - action Nex_Action_Cycle_Add - } - Derive Label CycleLabel - { - pos '475 20' - text "Cycle List:" - } - Derive List Cycle - { - pos '475 40' - size '425 450' - - target "::Data::Server::Map::Cycle" - action Nex_Action_Cycle_Remove - } - Item Layout Panel - { - pos '475 470' - size '425 30' - direction [Nex_DefaultHorzDirection] - flag [FlagEmbedded] - - Derive TextButton Add - { - normal "Add" - - action Nex_Action_Cycle_Add - } - Derive TextButton Remove - { - normal "Remove" - - action Nex_Action_Cycle_Remove - } - Derive TextButton MoveUp - { - normal "Move Up" - - action Nex_Action_Cycle_MoveUp - } - Derive TextButton MoveDown - { - normal "Move Down" - - action Nex_Action_Cycle_MoveDown - } - Derive TextButton Clear - { - normal "Clear" - - action Nex_Action_Cycle_Clear - } - } -} diff --git a/scmenu/creategame/weapon.menu b/scmenu/creategame/weapon.menu deleted file mode 100644 index 0c49188a4..000000000 --- a/scmenu/creategame/weapon.menu +++ /dev/null @@ -1,382 +0,0 @@ -// Property of Alientrap/AK -// -// creategame/weapon.menu -Item Window Weapon -{ - size '900 585' - flag [FlagEmbedded] - - Item ScrollWindow ScrollWindow - { - size '880 585' - flag [FlagEmbedded] - - Item Arrangement Arrangement - { - direction [Nex_DefaultVertDirection] - alignment [AlignFirst] - flag [FlagEmbedded] - - // hack to make the arrangement have a set width - Item Window FixWidth - { - size '900 0' - Derive Nex_Void Left - { - pos '0 0' - size '450 0' - } - Derive Nex_Void Right - { - pos '450 0' - size '450 0' - } - } - - Derive Nex_Option_EditBox InvincibleTakeDamage - { - text "Invincible Take Damage" - target "Data::Weapon::InvincibleTakeDamage::Text" - } - Derive Nex_Option_EditBox InvincibleTime - { - text "Invincible Time" - target "Data::Weapon::InvincibleTime::Text" - } - Derive Nex_Option_EditBox StrengthDamage - { - text "Strength Damage" - target "Data::Weapon::StrengthDamage::Text" - } - Derive Nex_Option_EditBox StrengthForce - { - text "Strength Force" - target "Data::Weapon::StrengthForce::Text" - } - Derive Nex_Option_EditBox StrengthTime - { - text "Strength Time" - target "Data::Weapon::StrengthTime::Text" - } - Derive Nex_Option_EditBox LaserDamage - { - text "Laser Damage" - target "Data::Weapon::LaserDamage::Text" - } - Derive Nex_Option_EditBox LaserEdgeDamage - { - text "Laser edge damage" - target "Data::Weapon::LaserEdgeDamage::Text" - } - Derive Nex_Option_EditBox LaserForce - { - text "Laser Push Force" - target "Data::Weapon::LaserForce::Text" - } - Derive Nex_Option_EditBox LaserRadius - { - text "Laser Radius" - target "Data::Weapon::LaserRadius::Text" - } - Derive Nex_Option_EditBox LaserSpeed - { - text "Laser Speed" - target "Data::Weapon::LaserSpeed::Text" - } - Derive Nex_Option_EditBox Laserrefire - { - text "Laser Refire" - target "Data::Weapon::Laserrefire::Text" - } - Derive Nex_Option_EditBox ShotgunDamage - { - text "Shotgun Damage" - target "Data::Weapon::ShotgunDamage::Text" - } - Derive Nex_Option_EditBox ShotgunDamage2 - { - text "Shotgun Damage 2" - target "Data::Weapon::ShotgunDamage2::Text" - } - Derive Nex_Option_EditBox ShotgunBullets - { - text "Shotgun Bullets" - target "Data::Weapon::ShotgunBullets::Text" - } - Derive Nex_Option_EditBox ShotgunSpread - { - text "Shotgun Spread" - target "Data::Weapon::ShotgunSpread::Text" - } - Derive Nex_Option_EditBox ShotgunRefire - { - text "Shotgun Refire" - target "Data::Weapon::ShotgunRefire::Text" - } - Derive Nex_Option_EditBox ShotgunRefire2 - { - text "Shotgun Refire2" - target "Data::Weapon::ShotgunRefire2::Text" - } - Derive Nex_Option_EditBox ShotgunRefire3 - { - text "Shotgun Refire3" - target "Data::Weapon::ShotgunRefire3::Text" - } - Derive Nex_Option_EditBox UziDamage - { - text "Uzi Damage" - target "Data::Weapon::UziDamage::Text" - } - Derive Nex_Option_EditBox UziSpread - { - text "Uzi Spread" - target "Data::Weapon::UziSpread::Text" - } - Derive Nex_Option_EditBox UziSpread2 - { - text "Uzi Spread2" - target "Data::Weapon::UziSpread2::Text" - } - Derive Nex_Option_EditBox UziRefire - { - text "Uzi Refire" - target "Data::Weapon::UziRefire::Text" - } - Derive Nex_Option_EditBox UziRefire2 - { - text "Uzi Refire2" - target "Data::Weapon::UziRefire2::Text" - } - Derive Nex_Option_EditBox UziDamage2 - { - text "Uzi Damage2" - target "Data::Weapon::UziDamage2::Text" - } - Derive Nex_Option_EditBox GrenadeLauncherDamage - { - text "Grenade Launcher Damage" - target "Data::Weapon::GrenadeLauncherDamage::Text" - } - Derive Nex_Option_EditBox GrenadeLauncherEdgeDamage - { - text "GL Edge Damage" - target "Data::Weapon::GrenadeLauncherEdgeDamage::Text" - } - Derive Nex_Option_EditBox GrenadeLauncherForce - { - text "Grenade Launcher Force" - target "Data::Weapon::GrenadeLauncherForce::Text" - } - Derive Nex_Option_EditBox GrenadeLauncherRadius - { - text "Grenade Launcher Radius" - target "Data::Weapon::GrenadeLauncherRadius::Text" - } - Derive Nex_Option_EditBox GrenadeLauncherSpeed - { - text "Grenade Launcher Speed" - target "Data::Weapon::GrenadeLauncherSpeed::Text" - } - Derive Nex_Option_EditBox GrenadeLauncherSpeedUp - { - text "Grenade Launcher Speedup" - target "Data::Weapon::GrenadeLauncherSpeedUp::Text" - } - Derive Nex_Option_EditBox GrenadeLauncherSpeed2 - { - text "Grenade Launcher Speed2" - target "Data::Weapon::GrenadeLauncherSpeed2::Text" - } - Derive Nex_Option_EditBox GrenadeLauncherSpeed2Up - { - text "Grenade Launcher Speed2up" - target "Data::Weapon::GrenadeLauncherSpeed2Up::Text" - } - Derive Nex_Option_EditBox GrenadeLauncherRefire - { - text "Grenade Launcher Refire" - target "Data::Weapon::GrenadeLauncherRefire::Text" - } - Derive Nex_Option_EditBox GrenadeLauncherRefire2 - { - text "Grenade Launcher Refire2" - target "Data::Weapon::GrenadeLauncherRefire2::Text" - } - Derive Nex_Option_EditBox ElectroDamage - { - text "Electro Damage" - target "Data::Weapon::ElectroDamage::Text" - } - Derive Nex_Option_EditBox ElectroEdgeDamage - { - text "Electro Edgedamage" - target "Data::Weapon::ElectroEdgeDamage::Text" - } - Derive Nex_Option_EditBox ElectroForce - { - text "Electro Force" - target "Data::Weapon::ElectroForce::Text" - } - Derive Nex_Option_EditBox ElectroRadius - { - text "Electro Radius" - target "Data::Weapon::ElectroRadius::Text" - } - Derive Nex_Option_EditBox ElectroRefire - { - text "Electro Refire" - target "Data::Weapon::ElectroRefire::Text" - } - Derive Nex_Option_EditBox ElectroSpeed - { - text "Electro Speed" - target "Data::Weapon::ElectroSpeed::Text" - } - Derive Nex_Option_EditBox ElectroBallSpeed - { - text "Electroball Speed" - target "Data::Weapon::ElectroBallSpeed::Text" - } - Derive Nex_Option_EditBox ElectroBallSpeedUp - { - text "Electroball Speed up" - target "Data::Weapon::ElectroBallSpeedUp::Text" - } - Derive Nex_Option_EditBox CryLinkDamage - { - text "CryLink Damage" - target "Data::Weapon::CryLinkDamage::Text" - } - Derive Nex_Option_EditBox CryLinkEdgeDamage - { - text "CryLink Edgedamage" - target "Data::Weapon::CryLinkEdgeDamage::Text" - } - Derive Nex_Option_EditBox CryLinkForce - { - text "CryLink Force" - target "Data::Weapon::CryLinkForce::Text" - } - Derive Nex_Option_EditBox CryLinkRadius - { - text "CryLink Radius" - target "Data::Weapon::CryLinkRadius::Text" - } - Derive Nex_Option_EditBox CryLinkSpeed - { - text "CryLink Speed" - target "Data::Weapon::CryLinkSpeed::Text" - } - Derive Nex_Option_EditBox CryLinkSpread - { - text "CryLink Spread" - target "Data::Weapon::CryLinkSpread::Text" - } - Derive Nex_Option_EditBox CryLinkRefire - { - text "CryLink Refire" - target "Data::Weapon::CryLinkRefire::Text" - } - Derive Nex_Option_EditBox CryLinkShots - { - text "CryLink Shots" - target "Data::Weapon::CryLinkShots::Text" - } - Derive Nex_Option_EditBox NexDamage - { - text "Nex Damage" - target "Data::Weapon::NexDamage::Text" - } - Derive Nex_Option_EditBox NexRefire - { - text "Nex Refire" - target "Data::Weapon::Nexrefire::Text" - } - Derive Nex_Option_EditBox HagarDamage - { - text "Hagar Damage" - target "Data::Weapon::HagarDamage::Text" - } - Derive Nex_Option_EditBox HagarEdgeDamage - { - text "Hagar Edge Damage" - target "Data::Weapon::HagarEdgeDamage::Text" - } - Derive Nex_Option_EditBox HagarForce - { - text "Hagar Force" - target "Data::Weapon::HagarForce::Text" - } - Derive Nex_Option_EditBox HagarRadius - { - text "Hagar Radius" - target "Data::Weapon::HagarRadius::Text" - } - Derive Nex_Option_EditBox HagarSpeed - { - text "Hagar Speed" - target "Data::Weapon::HagarSpeed::Text" - } - Derive Nex_Option_EditBox HagarSpeed2 - { - text "Hagar Speed2" - target "Data::Weapon::HagarSpeed2::Text" - } - Derive Nex_Option_EditBox HagarSpeed2Up - { - text "Hagar Speed2 up" - target "Data::Weapon::HagarSpeed2Up::Text" - } - Derive Nex_Option_EditBox HagarSpread - { - text "Hagar Spread" - target "Data::Weapon::HagarSpread::Text" - } - Derive Nex_Option_EditBox RocketLauncherDamage - { - text "Rocket Launcher Damage" - target "Data::Weapon::RocketLauncherDamage::Text" - } - Derive Nex_Option_EditBox RocketLauncherEdgeDamage - { - text "RL Edge Damage" - target "Data::Weapon::RocketLauncherEdgeDamage::Text" - } - Derive Nex_Option_EditBox RocketLauncherForce - { - text "Rocket Launcher Force" - target "Data::Weapon::RocketLauncherForce::Text" - } - Derive Nex_Option_EditBox RocketLauncherRadius - { - text "Rocket Launcher Radius" - target "Data::Weapon::RocketLauncherRadius::Text" - } - Derive Nex_Option_EditBox RocketLauncherSpeed - { - text "Rocket Launcher Speed" - target "Data::Weapon::RocketLauncherSpeed::Text" - } - Derive Nex_Option_EditBox RocketLauncherRefire - { - text "Rocket Launcher Refire" - target "Data::Weapon::RocketLauncherrefire::Text" - } - Derive Nex_Line Seperator - {} - Derive TextButton Reset - { - normal "Reset to default" - init Nex_Action_ResetData - target "::Data::Weapon" - } - } - } - Item VScrollBar Scroller - { - pos '880 0' - size '20 100' - target "##prev" - } -} diff --git a/scmenu/credits.menu b/scmenu/credits.menu deleted file mode 100644 index b6a7c63b3..000000000 --- a/scmenu/credits.menu +++ /dev/null @@ -1,85 +0,0 @@ -// Property of Alientrap/AK -// -// credits.menu -Item Window CreditsWnd -{ - pos '300 300' - size '400 400' - flag [FlagHidden] - - Derive Rect Background - { - flag [FlagSealOffMouse] - color '0.0 0.0 0.0' - alpha 0.8 - Ignore - { - color '0.1 0.1 0.1' - drawFlag [DrawFlagModulate] - - Derive Rect Layer - { - color '0.3 0.3 0.3' - drawFlag [DrawFlagAdditive] - } - } - } - Item Layout Layout - { - origin '200 0' - direction [Nex_DefaultVertDirection] - flag [FlagEmbedded] - alignment [AlignCenter] - - Item FloatingArea Title - { - size '400 13' - target "##up up" - Derive Rect Background - { - //color '0.5 0.5 0.5' - color '0.05 0.05 0.05' - } - Derive TextButton Caption - { - color '1.0 1.0 1.0' - size '400 11' - alignment [AlignCenter] - normal "Credits" - link "##up" - } - } - Item Arrangement Items - { - direction [Nex_DefaultVertDirection] - key Nex_Credits_Key - alignment [AlignCenter] - - Item Window Scroller - { - size '400 350' - - Item Task_Job Job - { - direction '0 50' - reinit Nex_Credits_SetSizeX - update Nex_Credits_Scroll - } - - Derive Nex_Credits Credits - { - color '1.0 1.0 1.0' - alignment [AlignCenter] - target "betacredits.txt" - } - } - - Derive TextButton Close - { - color '1.0 1.0 1.0' - normal "Close" - action Nex_Credits_Toggle - } - } - } -} diff --git a/scmenu/data.menu b/scmenu/data.menu deleted file mode 100644 index d62d59ab0..000000000 --- a/scmenu/data.menu +++ /dev/null @@ -1,26 +0,0 @@ -// Property of Alientrap -// -// Cvar Definitions -Item DataContainer Data -{ -#define DataLink_ZeroOneValue Derive "::DataLink_ZeroOneValue" Value {} -#define DataLink_OnOffSwitch Derive "::DataLink_OnOffSwitch" Switch {} -#define DataLink_Setting Derive "::DataLink_SettingValue" Value {} \ - Derive "::DataLink_SettingText" Text {} - - #include "menu/data/player.menu" - #include "menu/data/color.menu" - #include "menu/data/video.menu" - #include "menu/data/effects.menu" - #include "menu/data/input.menu" - #include "menu/data/key.menu" - #include "menu/data/sound.menu" - - #include "menu/data/serverlist.menu" - - #include "menu/data/server.menu" - #include "menu/data/game.menu" - #include "menu/data/weapon.menu" - #include "menu/data/management.menu" - -} diff --git a/scmenu/data/color.menu b/scmenu/data/color.menu deleted file mode 100644 index bb34bafaa..000000000 --- a/scmenu/data/color.menu +++ /dev/null @@ -1,124 +0,0 @@ -// Property of Alientrap -// -// data/color.menu - -// v_color prefix and other color controlling cvars -Item DataContainer Color -{ - // normal options - Item Data_Cvar Gamma - { - cvarName "v_gamma" - defValue 1.0 - Item DataLink_Value Value - { - minValue 0.0 - maxValue 4.0 - stepValue 0.05 - link "##up" - } - } - Item Data_Cvar Brightness - { - cvarName "v_brightness" - defValue 0.0 - Item DataLink_Value Value - { - minValue 0.0 - maxValue 3.0 - stepValue 0.05 - link "##up" - } - } - Item Data_Cvar Contrast - { - cvarName "v_contrast" - defValue 1.0 - Item DataLink_Value Value - { - minValue 0.0 - maxValue 3.0 - stepValue 0.05 - link "##up" - } - } - Item Data_Cvar HWGamma // read-only - { - cvarName "v_hwgamma" - defValue 1.0 - [DataLink_OnOffSwitch] - } - // extended options - Item DataContainer Extended - { - Item Data_Cvar Active - { - cvarName "v_color_enable" - defValue 0.0 - [DataLink_OnOffSwitch] - } - Item Container Low - { - Item Data_Cvar Red - { - cvarName "v_color_black_r" - defValue 0.0 - [DataLink_ZeroOneValue] - } - Item Data_Cvar Green - { - cvarName "v_color_black_g" - defValue 0.0 - [DataLink_ZeroOneValue] - } - Item Data_Cvar Blue - { - cvarName "v_color_black_b" - defValue 0.0 - [DataLink_ZeroOneValue] - } - } - Item Container Mid - { - Item Data_Cvar Red - { - cvarName "v_color_grey_r" - defValue 0.5 - [DataLink_ZeroOneValue] - } - Item Data_Cvar Green - { - cvarName "v_color_grey_g" - defValue 0.5 - [DataLink_ZeroOneValue] - } - Item Data_Cvar Blue - { - cvarName "v_color_grey_b" - defValue 0.5 - [DataLink_ZeroOneValue] - } - } - Item Container High - { - Item Data_Cvar Red - { - cvarName "v_color_white_r" - defValue 1.0 - [DataLink_ZeroOneValue] - } - Item Data_Cvar Green - { - cvarName "v_color_white_g" - defValue 1.0 - [DataLink_ZeroOneValue] - } - Item Data_Cvar Blue - { - cvarName "v_color_white_b" - defValue 1.0 - [DataLink_ZeroOneValue] - } - } - } -} diff --git a/scmenu/data/effects.menu b/scmenu/data/effects.menu deleted file mode 100644 index 9372dc3e0..000000000 --- a/scmenu/data/effects.menu +++ /dev/null @@ -1,95 +0,0 @@ -// Property of Alientrap/AK -// -// data/effects.menu - -Item DataContainer Effects -{ - Item Data_Cvar Particles - { - cvarName "cl_particles" - defValue 1 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar ParticleQuality - { - cvarName "cl_particles_quality" - defValue 1 - Item DataLink_Value Value - { - minValue 0.0 - maxValue 4.0 - stepValue 1 - link "##up" - } - } - Item Data_Cvar Decals - { - cvarName "cl_decals" - defValue 1 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar Bloom - { - cvarName "r_bloom" - defValue 1 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar Coronas - { - cvarName "r_coronas" - defValue 1 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar RealtimeLights - { - cvarName "r_shadow_realtime_world" - defValue 1 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar RealtimeDLights - { - cvarName "r_shadow_realtime_dlight" - defValue 1 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar RealtimeShadows - { - cvarName "r_shadow_realtime_world_shadows" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar RealtimeDLightShadows - { - cvarName "r_shadow_realtime_world_dlightshadows" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar GLSL - { - cvarName "r_shadow_glsl" - defValue 1 - [DataLink_OnOffSwitch] - } - Item Data_Cvar Gloss - { - cvarName "r_shadow_gloss" - defValue 1 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar ShowFPS - { - cvarName "showfps" - defValue "0" - - [DataLink_OnOffSwitch] - } -} diff --git a/scmenu/data/game.menu b/scmenu/data/game.menu deleted file mode 100644 index 0789db26d..000000000 --- a/scmenu/data/game.menu +++ /dev/null @@ -1,13 +0,0 @@ -// Property of Alientrap -// -// data/game.menu - -Item DataContainer Game -{ - // game modes - #include "menu/data/gamemodes/gamemisc.menu" - #include "menu/data/gamemodes/teamplay.menu" - #include "menu/data/gamemodes/ctf.menu" - #include "menu/data/gamemodes/domination.menu" - #include "menu/data/gamemodes/runematch.menu" -} diff --git a/scmenu/data/gamemodes/ctf.menu b/scmenu/data/gamemodes/ctf.menu deleted file mode 100644 index 47154088d..000000000 --- a/scmenu/data/gamemodes/ctf.menu +++ /dev/null @@ -1,79 +0,0 @@ -// Property of Alientrap -// -// data/ctf.menu - -Item DataContainer CTF -{ - //Item Data_Cvar CTF_Active - //{ - // cvarName "g_ctf" - // defValue 0 - // [DataLink_OnOffSwitch] - //} - Item Data_Cvar CaptureLimit - { - cvarName "g_ctf_capture_limit" - defValue -1 - - Item DataLink_Value Value - { - minValue -1 - maxValue 9999.0 - stepValue 1 - link "##up" - } - Item DataLink_Text Text - { - maxValue 8 - link "##down" - - Item DataLink_TextValue TextValue - { - link "##up prev" - } - } - } - Item Data_Cvar FlagReturnTime - { - cvarName "g_ctf_flag_returntime" - defValue 20 - - [DataLink_Setting] - } - Item Data_Cvar FragsCapture - { - cvarName "g_ctf_flagscore_capture" - defValue 5 - - [DataLink_Setting] - } - Item Data_Cvar FragsCaptureTeam - { - cvarName "g_ctf_flagscore_capture_team" - defValue 20 - - [DataLink_Setting] - } - Item Data_Cvar FragsPickup - { - cvarName "g_ctf_flagscore_pickup" - defValue 1 - - [DataLink_Setting] - } - Item Data_Cvar FragsReturn - { - cvarName "g_ctf_flagscore_return" - defValue 5 - - [DataLink_Setting] - } - Item Data_Cvar FragsReturnRogue - { - cvarName "g_ctf_flagscore_return_rogue" - defValue 10 - - [DataLink_Setting] - } - -} diff --git a/scmenu/data/gamemodes/domination.menu b/scmenu/data/gamemodes/domination.menu deleted file mode 100644 index 96b864310..000000000 --- a/scmenu/data/gamemodes/domination.menu +++ /dev/null @@ -1,92 +0,0 @@ -// Property of Alientrap -// -// data/ctf.menu - -Item DataContainer Domination -{ - //Item Data_Cvar Domination_Active - //{ - // cvarName "g_domination" - // defValue 0 - // [DataLink_OnOffSwitch] - //} - Item Data_Cvar DomFragLimit - { - cvarName "g_domination_point_limit" - defValue -1 - - Item DataLink_Value Value - { - minValue -1 - maxValue 9999.0 - stepValue 1 - link "##up" - } - Item DataLink_Text Text - { - maxValue 8 - link "##down" - - Item DataLink_TextValue TextValue - { - link "##up prev" - } - } - } - Item Data_Cvar DisableFrags - { - cvarName "g_domination_disable_frags" - defValue 0 - - [DataLink_OnOffSwitch] - } - //Item Data_Cvar BalanceTeamPoints - //{ - // cvarName "g_domination_balance_team_points" - // defValue 0 - - // [DataLink_OnOffSwitch] - //} - Item Data_Cvar PointAmt - { - cvarName "g_domination_point_amt" - defValue 1 - - [DataLink_Setting] - } - Item Data_Cvar PointRate - { - cvarName "g_domination_point_rate" - defValue 5 - - [DataLink_Setting] - } - Item Data_Cvar CaptureTime - { - cvarName "g_domination_point_capturetime" - defValue 0.1 - - [DataLink_Setting] - } - //Item Data_Cvar DefaultNumTeams - //{ - // cvarName "g_domination_default_teams" - // defValue 2 - // [DataLink_Setting] - //} - Item Data_Cvar DefaultNumTeams - { - cvarName "g_domination_default_teams" - defValue 2 - - Item DataLink_ValueSwitch Switch - { - minValue 2 - stepValue 1 - maxValue 4 - descList "'Two''Three''Four'" - - link "##up" - } - } -} diff --git a/scmenu/data/gamemodes/gamemisc.menu b/scmenu/data/gamemodes/gamemisc.menu deleted file mode 100644 index 57fb598a1..000000000 --- a/scmenu/data/gamemodes/gamemisc.menu +++ /dev/null @@ -1,294 +0,0 @@ -// Property of Alientrap -// -// data/gamemisc.menu - -Item DataContainer Misc -{ - Item Data_Cvar JoinMessageTime - { - cvarName "welcome_message_time" - defValue 8 - - [DataLink_Setting] - } - Item Data_CvarCreateSave Grapple - { - cvarName "g_grappling_hook" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_CvarCreateSave GrappleFireSpeed - { - cvarName "g_balance_grapplehook_speed_fly" - defValue 1200 - - [DataLink_Setting] - } - Item Data_CvarCreateSave GrapplePullSpeed - { - cvarName "g_balance_grapplehook_speed_pull" - defValue 1000 - - [DataLink_Setting] - } - Item Data_Cvar StartLaser - { - cvarName "g_start_weapon_laser" - defValue 1 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar StartShotgun - { - cvarName "g_start_weapon_shotgun" - defValue 1 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar StartUzi - { - cvarName "g_start_weapon_uzi" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar StartGrenadelauncher - { - cvarName "g_start_weapon_grenadelauncher" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar StartElectro - { - cvarName "g_start_weapon_electro" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar StartCrylink - { - cvarName "g_start_weapon_crylink" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar StartNex - { - cvarName "g_start_weapon_nex" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar StartHagar - { - cvarName "g_start_weapon_hagar" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar StartRocketlauncher - { - cvarName "g_start_weapon_rocketlauncher" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar StartShells - { - cvarName "g_start_ammo_shells" - defValue 50 - - [DataLink_Setting] - } - Item Data_Cvar StartNails - { - cvarName "g_start_ammo_nails" - defValue 0 - - [DataLink_Setting] - } - Item Data_Cvar StartRockets - { - cvarName "g_start_ammo_rockets" - defValue 0 - - [DataLink_Setting] - } - Item Data_Cvar StartCells - { - cvarName "g_start_ammo_cells" - defValue 0 - - [DataLink_Setting] - } - Item Data_Cvar UseAmmunition - { - cvarName "g_use_ammunition" - defValue 1 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar PickupItems - { - cvarName "g_pickup_items" - defValue 1 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar Instagib - { - cvarName "g_instagib" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar RocketArena - { - cvarName "g_rocketarena" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar Vampire - { - cvarName "g_vampire" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar MidAir - { - cvarName "g_midair" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar Casings - { - cvarName "g_casings" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar HealthStart - { - cvarName "g_balance_health_start" - defValue 150 - - [DataLink_Setting] - } - Item Data_Cvar HealthRot - { - cvarName "g_balance_health_rot" - defValue 0.1 - - [DataLink_Setting] - } - Item Data_Cvar HealthStable - { - cvarName "g_balance_health_stable" - defValue 100 - - [DataLink_Setting] - } - Item Data_Cvar Gravity - { - cvarName "sv_gravity" - defValue 800 - - [DataLink_Setting] - } - Item Data_Cvar MaxSpeed - { - cvarName "sv_maxspeed" - defValue 400 - - [DataLink_Setting] - } - Item Data_Cvar GameSpeed - { - cvarName "slowmo" - defValue 1 - - [DataLink_Setting] - } - Item Data_Cvar MaxAirSpeed - { - cvarName "sv_maxairspeed" - defValue 50 - - [DataLink_Setting] - } - Item Data_Cvar JumpHeight - { - cvarName "g_balance_jumpheight" - defValue 300 - - [DataLink_Setting] - } - Item Data_Cvar HealthRegeneration - { - cvarName "g_balance_health_regen" - defValue 0.1 - - [DataLink_Setting] - } - Item Data_Cvar ArmorRott - { - cvarName "g_balance_armor_rot" - defValue 0.1 - - [DataLink_Setting] - } - Item Data_Cvar ArmorRegen - { - cvarName "g_balance_armor_regen" - defValue 0 - - [DataLink_Setting] - } - Item Data_Cvar ArmorStable - { - cvarName "g_balance_armor_stable" - defValue 100 - - [DataLink_Setting] - } - Item Data_Cvar ArmorStart - { - cvarName "g_balance_armor_start" - defValue 0 - - [DataLink_Setting] - } - Item Data_Cvar SelfDamagePercent - { - cvarName "g_balance_selfdamagepercent" - defValue 0.6 - - [DataLink_Setting] - } - Item Data_Cvar WeaponSwitchDelay - { - cvarName "g_balance_weaponswitchdelay" - defValue 0.3 - - [DataLink_Setting] - } - Item Data_Cvar Friction - { - cvarName "sv_friction" - defValue 5 - - [DataLink_Setting] - } - Item Data_Cvar Accelerate - { - cvarName "sv_accelerate" - defValue 5.5 - - [DataLink_Setting] - } -} diff --git a/scmenu/data/gamemodes/runematch.menu b/scmenu/data/gamemodes/runematch.menu deleted file mode 100644 index e39c54357..000000000 --- a/scmenu/data/gamemodes/runematch.menu +++ /dev/null @@ -1,300 +0,0 @@ -// Property of Alientrap -// -// data/ctf.menu - -Item DataContainer Runematch -{ - Item Data_Cvar RunematchFragLimit - { - cvarName "g_runematch_point_limit" - defValue -1 - - Item DataLink_Value Value - { - minValue -1 - maxValue 9999.0 - stepValue 1 - link "##up" - } - Item DataLink_Text Text - { - maxValue 8 - link "##down" - - Item DataLink_TextValue TextValue - { - link "##up prev" - } - } - } - Item Data_Cvar PointAmt - { - cvarName "g_runematch_pointamt" - defValue 1 - - [DataLink_Setting] - } - Item Data_Cvar PointRate - { - cvarName "g_runematch_pointrate" - defValue 5 - - [DataLink_Setting] - } - Item Data_Cvar RuneRespawnTime - { - cvarName "g_runematch_respawntime" - defValue 15 - - [DataLink_Setting] - } - Item Data_Cvar RuneShuffleTime - { - cvarName "g_runematch_shuffletime" - defValue 30 - - [DataLink_Setting] - } - - Item Data_Cvar FragsKilledbyRuneholder - { - cvarName "g_runematch_frags_killedby_runeholder" - defValue 4 - - [DataLink_Setting] - } - Item Data_Cvar FragsKilledRuneholder - { - cvarName "g_runematch_frags_killed_runeholder" - defValue 5 - - [DataLink_Setting] - } - Item Data_Cvar FragsKillNoRunes - { - cvarName "g_runematch_frags_norune" - defValue 0 - - [DataLink_Setting] - } - Item Data_Cvar MaxRunesToDrop - { - cvarName "g_runematch_drop_runes_max" - defValue 2 - - [DataLink_Setting] - } - - - Item Data_Cvar StrengthDamage - { - cvarName "g_balance_rune_strength_damage" - defValue 2.0 - [DataLink_Setting] - } - Item Data_Cvar StrengthForce - { - cvarName "g_balance_rune_strength_force" - defValue 1.5 - [DataLink_Setting] - } - Item Data_Cvar WeaknessDamage - { - cvarName "g_balance_curse_weak_damage" - defValue 0.5 - [DataLink_Setting] - } - Item Data_Cvar WeaknessForce - { - cvarName "g_balance_curse_weak_force" - defValue 0.5 - [DataLink_Setting] - } - Item Data_Cvar StrengthComboDamage - { - cvarName "g_balance_rune_strength_combo_damage" - defValue 0.9 - [DataLink_Setting] - } - Item Data_Cvar StrengthComboForce - { - cvarName "g_balance_rune_strength_combo_force" - defValue 1.0 - [DataLink_Setting] - } - - - Item Data_Cvar DefenseDamage - { - cvarName "g_balance_rune_defense_takedamage" - defValue 0.5 - [DataLink_Setting] - } - Item Data_Cvar VulnerDamage - { - cvarName "g_balance_curse_vulner_takedamage" - defValue 2.0 - [DataLink_Setting] - } - Item Data_Cvar DefenseComboDamage - { - cvarName "g_balance_rune_defense_combo_takedamage" - defValue 1.0 - [DataLink_Setting] - } - - - Item Data_Cvar VampireDamage - { - cvarName "g_balance_rune_vampire_absorb" - defValue 0.5 - [DataLink_Setting] - } - Item Data_Cvar EmpathyDamage - { - cvarName "g_balance_curse_empathy_takedamage" - defValue -0.6 - - Item DataLink_Value Value - { - minValue -1 - maxValue 0 - stepValue 0.01 - link "##up" - } - Item DataLink_Text Text - { - maxValue 8 - link "##down" - - Item DataLink_TextValue TextValue - { - link "##up prev" - } - } - } - Item Data_Cvar VampireComboDamage - { - cvarName "g_balance_rune_vampire_combo_absorb" - defValue -0.2 - - Item DataLink_Value Value - { - minValue -1 - maxValue 0 - stepValue 0.01 - link "##up" - } - Item DataLink_Text Text - { - maxValue 8 - link "##down" - - Item DataLink_TextValue TextValue - { - link "##up prev" - } - } - } - - - Item Data_Cvar RegenHP - { - cvarName "g_balance_rune_regen_hpmod" - defValue 1.75 - [DataLink_Setting] - } - Item Data_Cvar VenomHP - { - cvarName "g_balance_curse_venom_hpmod" - defValue 0.6 - [DataLink_Setting] - } - Item Data_Cvar RegenComboHP - { - cvarName "g_balance_rune_regen_combo_hpmod" - defValue 0.9 - [DataLink_Setting] - } - Item Data_Cvar RegenSpeed - { - cvarName "g_balance_rune_regen_regenrate" - defValue 3.0 - [DataLink_Setting] - } - Item Data_Cvar VenomSpeed - { - cvarName "g_balance_curse_venom_rotrate" - defValue 3.0 - [DataLink_Setting] - } - Item Data_Cvar RegenComboRegenSpeed - { - cvarName "g_balance_rune_regen_combo_regenrate" - defValue 0.5 - [DataLink_Setting] - } - Item Data_Cvar RegenComboDegenSpeed - { - cvarName "g_balance_rune_regen_combo_rotrate" - defValue 1.5 - [DataLink_Setting] - } - - - Item Data_Cvar SpeedMoverate - { - cvarName "g_balance_rune_speed_moverate" - defValue 1.5 - [DataLink_Setting] - } - Item Data_Cvar SlowMoverate - { - cvarName "g_balance_curse_slow_moverate" - defValue 0.6 - [DataLink_Setting] - } - Item Data_Cvar SpeedComboMoverate - { - cvarName "g_balance_rune_speed_combo_moverate" - defValue 0.9 - [DataLink_Setting] - } - Item Data_Cvar SpeedAtkrate - { - cvarName "g_balance_rune_speed_atkrate" - defValue 0.6 - [DataLink_Setting] - } - Item Data_Cvar SlowAtkrate - { - cvarName "g_balance_curse_slow_atkrate" - defValue 1.75 - [DataLink_Setting] - } - Item Data_Cvar SpeedComboAtkrate - { - cvarName "g_balance_rune_speed_combo_atkrate" - defValue 1.2 - [DataLink_Setting] - } - Item Data_Cvar SpeedJumpHeight - { - cvarName "g_balance_rune_speed_jumpheight" - defValue 2.5 - [DataLink_Setting] - } - Item Data_Cvar SlowJumpHeight - { - cvarName "g_balance_curse_slow_jumpheight" - defValue 1.0 - [DataLink_Setting] - } - Item Data_Cvar SpeedComboJumpHeight - { - cvarName "g_balance_rune_speed_combo_jumpheight" - defValue 1.0 - [DataLink_Setting] - } - -} diff --git a/scmenu/data/gamemodes/teamplay.menu b/scmenu/data/gamemodes/teamplay.menu deleted file mode 100644 index 6f4bf4273..000000000 --- a/scmenu/data/gamemodes/teamplay.menu +++ /dev/null @@ -1,80 +0,0 @@ -// Property of Alientrap -// -// data/teamplay.menu - -Item DataContainer Teamplay -{ - Item Data_Cvar DMForceTeamplay - { - cvarName "deathmatch_force_teamplay" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar TeamPlay - { - cvarName "teamplay_default" - defValue 1 - - Item DataLink_ValueSwitch Switch - { - minValue 1 - stepValue 1 - maxValue 3 - descList "'Self Fire, No Friendly' 'Friendly Fire' 'No Friendly Fire'" - - link "##up" - } - } - Item Data_Cvar BalanceTeams - { - cvarName "g_balance_teams" - defValue 1 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar ForceBalanceTeams - { - cvarName "g_balance_teams_force" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar PreventTeamImbalance - { - cvarName "g_balance_teams_prevent_imbalance" - defValue 0 - - [DataLink_OnOffSwitch] - } - Item Data_Cvar BanChangeTeams - { - cvarName "g_changeteam_banned" - defValue 0 - - [DataLink_OnOffSwitch] - } - - Item Data_Cvar TDM_NumTeams - { - cvarName "g_tdm_teams" - defValue 2 - - Item DataLink_ValueSwitch Switch - { - minValue 2 - stepValue 1 - maxValue 4 - descList "'Two''Three''Four'" - - link "##up" - } - } - Item Data_Cvar ChangeTeamFragTransfer - { - cvarName "g_changeteam_fragtransfer" - defValue 80 - - [DataLink_Setting] - } -} diff --git a/scmenu/data/input.menu b/scmenu/data/input.menu deleted file mode 100644 index e2241094e..000000000 --- a/scmenu/data/input.menu +++ /dev/null @@ -1,37 +0,0 @@ -// Property of Alientrap -// -// data/input.menu -Item DataContainer Input -{ - Item Data_Cvar Sensitivity - { - cvarName "sensitivity" - defValue 6.0 - Item DataLink_Value Value - { - minValue 0.0 - maxValue 20.0 - stepValue 1 - link "##up" - } - } - Item Data_Cvar InvertMouse - { - cvarName "m_pitch" - defValue 'Off' - Item DataLink_ValueSwitch Switch - { - minValue -0.022 - maxValue 0.022 - descList "'On' 'Off'" - link "##up" - } - } - Item Data_Cvar MouseFilter - { - cvarName "m_filter" - defValue 0 - - [DataLink_OnOffSwitch] - } -} diff --git a/scmenu/data/key.menu b/scmenu/data/key.menu deleted file mode 100644 index 19a145cf3..000000000 --- a/scmenu/data/key.menu +++ /dev/null @@ -1,161 +0,0 @@ -// Property of Alientrap -// -// data/key.menu - -Item DataContainer Key -{ - Item Data_Nex_Key Forward - { - target "+forward" - defValue "'W' 'UpArrow'" - } - Item Data_Nex_Key Backward - { - target "+back" - defValue "'S' 'DownArrow'" - } - Item Data_Nex_Key StrafeLeft - { - target "+moveleft" - defValue "'A'" - } - Item Data_Nex_Key StrafeRight - { - target "+moveright" - defValue "'D'" - } - Item Data_Nex_Key Jump - { - target "+jump" - defValue "'Enter' 'Space'" - } - Item Data_Nex_Key Crouch - { - target "+crouch" - defValue "'Shift'" - - } - Item Data_Nex_Key FirePrimary - { - target "+attack" - defValue "'Ctrl' 'Mouse1'" - } - Item Data_Nex_Key FireSecondary - { - target "+attack2" - defValue "'Mouse2'" - } - Item Data_Nex_Key PrevWeapon - { - target "weapprev" - defValue "'MWHEELDOWN'" - } - Item Data_Nex_Key NextWeapon - { - target "weapnext" - defValue "'MWHEELUP'" - } - Item Data_Nex_Key Zoom - { - target "+zoom" - defValue "'Mouse3'" - } - Item Data_Nex_Key Hook - { - target "+hook" - defValue "''" - } - Item DataContainer Weapon - { - Item Data_Nex_Key Laser - { - target "impulse 1" - defValue "'1'" - } - Item Data_Nex_Key Shotgun - { - target "impulse 2" - defValue "'2'" - } - Item Data_Nex_Key Machinegun - { - target "impulse 3" - defValue "'3'" - } - Item Data_Nex_Key Mortar - { - target "impulse 4" - defValue "'4'" - } - Item Data_Nex_Key Electro - { - target "impulse 5" - defValue "'5'" - } - Item Data_Nex_Key CryLink - { - target "impulse 6" - defValue "'6'" - } - Item Data_Nex_Key NexGun - { - target "impulse 7" - defValue "'7' 'CapsLock'" - } - Item Data_Nex_Key Hagar - { - target "impulse 8" - defValue "'8'" - } - Item Data_Nex_Key Rocket - { - target "impulse 9" - defValue "'9'" - } - } - Item Data_Nex_Key ShowScores - { - target "+showscores" - defValue "'Tab'" - } - Item Data_Nex_Key ToggleConsole - { - target "toggleconsole" - defValue "" - } - Item Data_Nex_Key Message - { - target "messagemode" - defValue "'T'" - } - Item Data_Nex_Key TeamMessage - { - target "messagemode2" - defValue "'R' 'Y'" - } - Item Data_Nex_Key Pause - { - target "pause" - defValue "'Pause'" - } - Item Data_Nex_Key Screenshot - { - target "screenshot" - defValue "'F12'" - } - Item Data_Nex_Key Quit - { - target "quit" - defValue "'F10'" - } - Item Data_Nex_Key ViewSmaller - { - target "sizedown" - defValue "'-'" - } - Item Data_Nex_Key ViewBigger - { - target "sizeup" - defValue "'='" - } -} diff --git a/scmenu/data/management.menu b/scmenu/data/management.menu deleted file mode 100644 index 558cd48d3..000000000 --- a/scmenu/data/management.menu +++ /dev/null @@ -1,46 +0,0 @@ -// Property of Alientrap -// -// data/management.menu - -Item DataContainer Management -{ - Item Data_Container Filename - { - Item DataLink_Text Text - { - maxValue 26 - link "##up" - } - } - - Item Data_Container ConfigType - { - Item DataLink_ValueSwitch Switch - { - descList "'Weapon Config' 'Game Config' 'Maplist'" - link "##up" - } - } - - Item DataContainer FileList - { - Item DataLink_Nex_FileList Weapon - { - normal "cfg" - selected "data/config/weapon/" - } - - Item DataLink_Nex_FileList Game - { - normal "cfg" - selected "data/config/game/" - } - - Item DataLink_Nex_FileList MapList - { - normal "cfg" - selected "data/config/maplist/" - } - } -} - diff --git a/scmenu/data/player.menu b/scmenu/data/player.menu deleted file mode 100644 index 47b2b9c91..000000000 --- a/scmenu/data/player.menu +++ /dev/null @@ -1,91 +0,0 @@ -// Property of Alientrap -// -// data/player.menu - -Item DataContainer Player -{ - Item Data_Nex_Name Name - { - defValue "NexPlayer" - Item DataLink_Text Text - { - maxValue 32 - link "##up" - } - } - Item Data_Nex_Avatar Avatar - { - } - Item Data_Nex_Color TeamColor - { - defValue "4" // Red - - Item DataLink_TextSwitch TextSwitch - { - // Red Blue Green Yellow - valueList "'4' '13' '3' '12'" - descList "'$gfx/m_redsquare' '$gfx/m_bluesquare' '$gfx/m_greensquare' '$gfx/m_yellowsquare'" - - link "##up" - } - } - Item Data_Cvar FOV - { - cvarName "FOV" - defValue "90" - - Item DataLink_Value Value - { - minValue 60.0 - maxValue 150.0 - stepValue 1.0 - link "##up" - } - } - Item Data_Cvar ViewSize - { - cvarName "viewsize" - defValue "110" - - Item DataLink_Value Value - { - minValue 30.0 - maxValue 120.0 - stepValue 10 - link "##up" - } - } - Item DataContainer Crosshair - { - Item Data_Cvar Type - { - cvarName "crosshair" - defValue "1" - - Item DataLink_ValueSwitch Switch - { - minValue 0 - stepValue 1 - maxValue 5 - - descList "'' '$gfx/crosshair1.tga' '$gfx/crosshair2.tga' '$gfx/crosshair3.tga' '$gfx/crosshair4.tga' '$gfx/crosshair5.tga'" - - link "##up" - } - } - Item Data_Cvar Size - { - cvarName "crosshair_size" - defValue "1" - - Item DataLink_Value Value - { - minValue 1.0 - maxValue 5.0 - stepValue 0.25 - - link "##up" - } - } - } -} diff --git a/scmenu/data/server.menu b/scmenu/data/server.menu deleted file mode 100644 index ef33216e1..000000000 --- a/scmenu/data/server.menu +++ /dev/null @@ -1,249 +0,0 @@ -// Property of Alientrap -// -// data/server.menu - -Item DataContainer Server -{ - Item DataContainer Map - { - Item Data_Container Query - { - defValue "" - value "" - - Item DataLink_TextSwitch Switch - { - valueList "'' 'dm_' 'tdm_' 'dom_' 'ctf_' 'rune_'" - descList "'List All''Classic Deathmatch''Team Deathmatch''Domination''Capture The Flag''Rune Match'" - - link "##up" - } - } - Item Nex_MapDB DataBase - { - } - // for the < > map selection in the basic options - Item DataLink_Nex_MapList Selector - { - init Item_DataLink_Nex_MapList_InitWithMapList - } - // for the map list in map cycle - Item DataLink_Nex_MapList List - { - init Item_DataLink_Nex_MapList_InitWithMapList - } - Item DataLink_Nex_MapList Cycle - { - // creates x and x_index (CVAR_SAVE) - cvarName "g_maplist" - } - } - - Item Data_Cvar Hostname - { - cvarName "hostname" - defValue "Nexuiz Server" - - Item DataLink_Text Text - { - link "##up" - maxValue 64 - } - } - Item Data_CvarCreateSave MaxPlayers - { - cvarName "_nex_maxplayers" - defValue 8 - - Item DataLink_Value Value - { - link "##up" - minValue 1 - stepValue 1 - maxValue 32 - } - Item DataLink_Text Text - { - link "##down" - maxValue 5 - - Item DataLink_TextValue TextValue - { - link "##up prev" - } - } - } - Item Data_Cvar TimeLimit - { - cvarName "timelimit_override" - defValue -1 - - Item DataLink_Value Value - { - minValue -1 - maxValue 86400 - stepValue 1 - link "##up" - } - Item DataLink_Text Text - { - maxValue 8 - link "##down" - - Item DataLink_TextValue TextValue - { - link "##up prev" - } - } - } - Item Data_Cvar FragLimit - { - cvarName "fraglimit_override" - defValue -1 - - Item DataLink_Value Value - { - minValue -1 - maxValue 9999.0 - stepValue 1 - link "##up" - } - Item DataLink_Text Text - { - maxValue 8 - link "##down" - - Item DataLink_TextValue TextValue - { - link "##up prev" - } - } - } - Item Data_Cvar ServerProgs - { - cvarName "sv_progs" - defValue "progs.dat" - - Item DataLink_Nex_ModSwitch Switch - { - link "##up" - } - } - Item Data_Cvar GameMode - { - cvarName "gamecfg" - // from 1 to 4 - defValue 1 - - Item DataLink_ValueSwitch Switch - { - minValue 1 - stepValue 1 - maxValue 4 - descList "'Classic Deathmatch''Team Deathmatch''Domination''Capture The Flag'" - - link "##up" - } - } - Item Data_CvarCreateSave NumBots - { - cvarName "bot_number" - defValue 0 - - Item DataLink_Value Value - { - minValue 0 - stepValue 1 - maxValue 64 - - link "##up" - } - Item DataLink_Text Text - { - maxValue 5 - link "##down" - - Item DataLink_TextValue TextValue - { - link "##up prev" - } - } - } - Item Data_CvarCreateSave BotSkill - { - // TODO: add support for this in FrikQcc - cvarName "skill" - // from 0 to 10 - defValue 5 - - Item DataLink_ValueSwitch Switch - { - minValue 0 - stepValue 1 - maxValue 10 - descList "'Dumb, very''You will win''You can win''You might win''Beginner''Intermediate''Advanced''Expert''Assassin''Godlike'" - - link "##up" - } - } - Item Data_Cvar PublicServer - { - cvarName "sv_public" - defValue 1 - - Item DataLink_ValueSwitch Switch - { - maxValue 1 - descList "'Disabled''Enabled'" - - link "##up" - } - } - Item Data_Cvar ServerFrameTime - { - cvarName "sys_ticrate" - defValue "0.05" - - Item DataLink_Value Value - { - minValue 0.01 // 100 fps - maxValue 0.10 // 10 fps - stepValue 0.005 - link "##up" - } - Item DataLink_Text Text - { - maxValue 5 - link "##down" - - Item DataLink_TextValue TextValue - { - link "##up prev" - } - } - } - Item Data_Cvar ServerMaxRate - { - cvarName "sv_maxrate" - defValue "10000" - - Item DataLink_Value Value - { - minValue 1000.0 - maxValue 25000.0 - stepValue 1000.0 - - link "##up" - } - Item DataLink_Text Text - { - maxValue 5 - link "##down" - - Item DataLink_TextValue TextValue - { - link "##up prev" - } - } - } -} diff --git a/scmenu/data/serverlist.menu b/scmenu/data/serverlist.menu deleted file mode 100644 index 7350fd0c0..000000000 --- a/scmenu/data/serverlist.menu +++ /dev/null @@ -1,17 +0,0 @@ -// Property of Alientrap -// -// data/serverlist.menu - -Item DataContainer ServerList -{ - Item Data_CvarCreateSave QueryString - { - cvarName "scmenu_querystring" - - Item DataLink_Text Text - { - maxValue 1024 - link "##up" - } - } -} diff --git a/scmenu/data/sound.menu b/scmenu/data/sound.menu deleted file mode 100644 index 04228597c..000000000 --- a/scmenu/data/sound.menu +++ /dev/null @@ -1,34 +0,0 @@ -// Property of Alientrap -// -// data/sound.menu -Item DataContainer Sound -{ - Item Data_Cvar CDVolume - { - cvarName "bgmvolume" - defValue 1 - - [DataLink_ZeroOneValue] - } - Item Data_Cvar GameVolume - { - cvarName "volume" - defValue 1 - - [DataLink_ZeroOneValue] - } - Item Data_Cvar AmbientVolume - { - cvarName "snd_staticvolume" - defValue 0.5 - - [DataLink_ZeroOneValue] - } - Item Data_Cvar SwapStereo - { - cvarName "snd_swapstereo" - defValue 0 - - [DataLink_OnOffSwitch] - } -} diff --git a/scmenu/data/video.menu b/scmenu/data/video.menu deleted file mode 100644 index 6a8b7edee..000000000 --- a/scmenu/data/video.menu +++ /dev/null @@ -1,35 +0,0 @@ -// Property of Alientrap -// -// data/video.menu -Item DataContainer Video -{ - Item Data_Nex_Resolution Resolution - { - defValue "800 600" - - Item DataLink_TextSwitch Switch - { - valueList "'320 240' '640 480' '800 600' '1024 768' '1280 960' '1280 1024' '1600 900' '1600 1200' '2048 1536'" - descList "'320x240' '640x480' '800x600' '1024x768' '1280x960' '1280x1024' '1600x900' '1600x1200' '2048x1536' 'Custom'" - link "##up" - } - } - Item Data_Cvar BPP - { - cvarName "vid_bitsperpixel" - defValue "32" - - Item DataLink_TextSwitch Switch - { - valueList "'16' '32'" - descList "'16-bit' '32-bit'" - link "##up" - } - } - Item Data_Cvar Fullscreen - { - cvarName "vid_fullscreen" - - [DataLink_OnOffSwitch] - } -} diff --git a/scmenu/data/weapon.menu b/scmenu/data/weapon.menu deleted file mode 100644 index 3c94e5aa2..000000000 --- a/scmenu/data/weapon.menu +++ /dev/null @@ -1,469 +0,0 @@ -// Property of Alientrap -// -// data/weapon.menu - -Item DataContainer Weapon -{ - Item Data_Cvar InvincibleTakeDamage - { - cvarName "g_balance_powerup_invincible_takedamage" - defValue 0.2 - - [DataLink_Setting] - } - Item Data_Cvar InvincibleTime - { - cvarName "g_balance_powerup_invincible_time" - defValue 30 - - [DataLink_Setting] - } - Item Data_Cvar StrengthDamage - { - cvarName "g_balance_powerup_strength_damage" - defValue 3 - - [DataLink_Setting] - } - Item Data_Cvar StrengthForce - { - cvarName "g_balance_powerup_strength_force" - defValue 4 - - [DataLink_Setting] - } - Item Data_Cvar StrengthTime - { - cvarName "g_balance_powerup_strength_time" - defValue 30 - - [DataLink_Setting] - } - Item Data_Cvar LaserDamage - { - cvarName "g_balance_laser_damage" - defValue 35 - - [DataLink_Setting] - } - Item Data_Cvar LaserEdgeDamage - { - cvarName "g_balance_laser_edgedamage" - defValue 10 - - [DataLink_Setting] - } - Item Data_Cvar LaserForce - { - cvarName "g_balance_laser_force" - defValue 400 - - [DataLink_Setting] - } - Item Data_Cvar LaserRadius - { - cvarName "g_balance_laser_radius" - defValue 70 - - [DataLink_Setting] - } - Item Data_Cvar LaserSpeed - { - cvarName "g_balance_laser_speed" - defValue 9000 - - [DataLink_Setting] - } - Item Data_Cvar Laserrefire - { - cvarName "g_balance_laser_refire" - defValue 0.7 - - [DataLink_Setting] - } - Item Data_Cvar ShotgunDamage - { - cvarName "g_balance_shotgun_damage" - defValue 6 - - [DataLink_Setting] - } - Item Data_Cvar ShotgunDamage2 - { - cvarName "g_balance_shotgun_damage2" - defValue 6 - - [DataLink_Setting] - } - Item Data_Cvar ShotgunBullets - { - cvarName "g_balance_shotgun_bullets" - defValue 10 - - [DataLink_Setting] - } - Item Data_Cvar ShotgunSpread - { - cvarName "g_balance_shotgun_spread" - defValue 0.07 - - [DataLink_Setting] - } - Item Data_Cvar ShotgunRefire - { - cvarName "g_balance_shotgun_refire" - defValue 0.7 - - [DataLink_Setting] - } - Item Data_Cvar ShotgunRefire2 - { - cvarName "g_balance_shotgun_refire2" - defValue 1.5 - - [DataLink_Setting] - } - Item Data_Cvar ShotgunRefire3 - { - cvarName "g_balance_shotgun_refire3" - defValue 0.2 - - [DataLink_Setting] - } - Item Data_Cvar UziDamage - { - cvarName "g_balance_uzi_damage" - defValue 16 - - [DataLink_Setting] - } - Item Data_Cvar UziSpread - { - cvarName "g_balance_uzi_spread" - defValue 0.05 - - [DataLink_Setting] - } - Item Data_Cvar UziSpread2 - { - cvarName "g_balance_uzi_spread2" - defValue 0.01 - - [DataLink_Setting] - } - Item Data_Cvar UziRefire - { - cvarName "g_balance_uzi_refire" - defValue 0.1 - - [DataLink_Setting] - } - Item Data_Cvar UziDamage2 - { - cvarName "g_balance_uzi_damage2" - defValue 30 - - [DataLink_Setting] - } - Item Data_Cvar UziRefire2 - { - cvarName "g_balance_uzi_refire2" - defValue 0.2 - - [DataLink_Setting] - } - Item Data_Cvar GrenadeLauncherDamage - { - cvarName "g_balance_grenadelauncher_damage" - defValue 65 - - [DataLink_Setting] - } - Item Data_Cvar GrenadeLauncherEdgeDamage - { - cvarName "g_balance_grenadelauncher_edgedamage" - defValue 35 - - [DataLink_Setting] - } - Item Data_Cvar GrenadeLauncherForce - { - cvarName "g_balance_grenadelauncher_force" - defValue 400 - - [DataLink_Setting] - } - Item Data_Cvar GrenadeLauncherRadius - { - cvarName "g_balance_grenadelauncher_radius" - defValue 140 - - [DataLink_Setting] - } - Item Data_Cvar GrenadeLauncherSpeed - { - cvarName "g_balance_grenadelauncher_speed" - defValue 2000 - - [DataLink_Setting] - } - Item Data_Cvar GrenadeLauncherSpeedUp - { - cvarName "g_balance_grenadelauncher_speed_up" - defValue 200 - - [DataLink_Setting] - } - Item Data_Cvar GrenadeLauncherSpeed2 - { - cvarName "g_balance_grenadelauncher_speed2" - defValue 1400 - - [DataLink_Setting] - } - Item Data_Cvar GrenadeLauncherSpeed2Up - { - cvarName "g_balance_grenadelauncher_speed2_up" - defValue 200 - - [DataLink_Setting] - } - Item Data_Cvar GrenadeLauncherRefire - { - cvarName "g_balance_grenadelauncher_refire" - defValue 0.7 - - [DataLink_Setting] - } - Item Data_Cvar GrenadeLauncherRefire2 - { - cvarName "g_balance_grenadelauncher_refire2" - defValue 0.6 - - [DataLink_Setting] - } - Item Data_Cvar ElectroDamage - { - cvarName "g_balance_electro_damage" - defValue 90 - - [DataLink_Setting] - } - Item Data_Cvar ElectroEdgeDamage - { - cvarName "g_balance_electro_edgedamage" - defValue 0 - - [DataLink_Setting] - } - Item Data_Cvar ElectroForce - { - cvarName "g_balance_electro_force" - defValue 200 - - [DataLink_Setting] - } - Item Data_Cvar ElectroRadius - { - cvarName "g_balance_electro_radius" - defValue 150 - - [DataLink_Setting] - } - Item Data_Cvar ElectroRefire - { - cvarName "g_balance_electro_refire" - defValue 0.9 - - [DataLink_Setting] - } - Item Data_Cvar ElectroSpeed - { - cvarName "g_balance_electro_speed" - defValue 2000 - - [DataLink_Setting] - } - Item Data_Cvar ElectroBallSpeed - { - cvarName "g_balance_electro_ballspeed" - defValue 900 - - [DataLink_Setting] - } - Item Data_Cvar ElectroBallSpeedUp - { - cvarName "g_balance_electro_ballspeed_up" - defValue 200 - - [DataLink_Setting] - } - Item Data_Cvar CryLinkDamage - { - cvarName "g_balance_crylink_damage" - defValue 20 - - [DataLink_Setting] - } - Item Data_Cvar CryLinkEdgeDamage - { - cvarName "g_balance_crylink_edgedamage" - defValue 0 - - [DataLink_Setting] - } - Item Data_Cvar CryLinkForce - { - cvarName "g_balance_crylink_force" - defValue 55 - - [DataLink_Setting] - } - Item Data_Cvar CryLinkRadius - { - cvarName "g_balance_crylink_radius" - defValue 3 - - [DataLink_Setting] - } - Item Data_Cvar CryLinkSpeed - { - cvarName "g_balance_crylink_speed" - defValue 6000 - - [DataLink_Setting] - } - Item Data_Cvar CryLinkSpread - { - cvarName "g_balance_crylink_spread" - defValue 0.10 - - [DataLink_Setting] - } - Item Data_Cvar CryLinkRefire - { - cvarName "g_balance_crylink_refire" - defValue 0.8 - - [DataLink_Setting] - } - Item Data_Cvar CryLinkShots - { - cvarName "g_balance_crylink_shots" - defValue 7 - - [DataLink_Setting] - } - Item Data_Cvar NexDamage - { - cvarName "g_balance_nex_damage" - defValue 175 - - [DataLink_Setting] - } - Item Data_Cvar Nexrefire - { - cvarName "g_balance_nex_refire" - defValue 1 - - [DataLink_Setting] - } - Item Data_Cvar HagarDamage - { - cvarName "g_balance_hagar_damage" - defValue 40 - - [DataLink_Setting] - } - Item Data_Cvar HagarEdgeDamage - { - cvarName "g_balance_hagar_edgedamage" - defValue 15 - - [DataLink_Setting] - } - Item Data_Cvar HagarForce - { - cvarName "g_balance_hagar_force" - defValue 100 - - [DataLink_Setting] - } - Item Data_Cvar HagarRadius - { - cvarName "g_balance_hagar_radius" - defValue 70 - - [DataLink_Setting] - } - Item Data_Cvar HagarSpeed - { - cvarName "g_balance_hagar_speed" - defValue 3000 - - [DataLink_Setting] - } - Item Data_Cvar HagarSpeed2 - { - cvarName "g_balance_hagar_speed2" - defValue 1400 - - [DataLink_Setting] - } - Item Data_Cvar HagarSpeed2Up - { - cvarName "g_balance_hagar_speed2_up" - defValue 100 - - [DataLink_Setting] - } - Item Data_Cvar HagarSpread - { - cvarName "g_balance_hagar_spread" - defValue 0.025 - - [DataLink_Setting] - } - Item Data_Cvar RocketLauncherDamage - { - cvarName "g_balance_rocketlauncher_damage" - defValue 130 - - [DataLink_Setting] - } - Item Data_Cvar RocketLauncherEdgeDamage - { - cvarName "g_balance_rocketlauncher_edgedamage" - defValue 50 - - [DataLink_Setting] - } - Item Data_Cvar RocketLauncherForce - { - cvarName "g_balance_rocketlauncher_force" - defValue 600 - - [DataLink_Setting] - } - Item Data_Cvar RocketLauncherRadius - { - cvarName "g_balance_rocketlauncher_radius" - defValue 170 - - [DataLink_Setting] - } - Item Data_Cvar RocketLauncherSpeed - { - cvarName "g_balance_rocketlauncher_speed" - defValue 850 - - [DataLink_Setting] - } - Item Data_Cvar RocketLauncherrefire - { - cvarName "g_balance_rocketlauncher_refire" - defValue 1 - - [DataLink_Setting] - } -} diff --git a/scmenu/ingame.menu b/scmenu/ingame.menu deleted file mode 100644 index 17ce741de..000000000 --- a/scmenu/ingame.menu +++ /dev/null @@ -1,4 +0,0 @@ -// Property of Alientrap -// -// Ingame main menu - diff --git a/scmenu/joingame.menu b/scmenu/joingame.menu deleted file mode 100644 index b61d0bc49..000000000 --- a/scmenu/joingame.menu +++ /dev/null @@ -1,200 +0,0 @@ -// Property of Alientrap/AK -// -// joingame.menu - -Item Window JoinGame -{ - Derive Picture Table3 - { - picture "gfx/table3" - pos '0 0' - size '900 555' - } - Item Layout JoinGame - { - size '900 650' - direction '0 10' - alignment [AlignCenter] - origin '450 0' -#define SList_Ping '50 15' -#define SList_Name '492 15' -#define SList_Map '120 15' -#define SList_Players '60 15' -#define SList_Mod '120 15' -#define SList_Direction '2 0' - - Derive Nex_Composition Query - { - Derive TextButton Description - { - normal "Query String:" - - link "##next" - } - Derive EditBox EditBox - { - size '700 12' - target "::Data::ServerList::QueryString::Text" - - action Nex_Action_ExecuteQuery - } - } - - Item Layout TableDesc - { - direction [SList_Direction] - flag [FlagEmbedded] - size '900 15' - - DeriveTemplate Rect Theme - { - color '0.5 0.5 0.5' - alpha 0.5 - flag [FlagEmbedded] - } - Derive Theme Ping - { - size [SList_Ping] - Derive TextButton Text - { - normal "Ping" - - init Nex_Action_JoinGame_SortBy - target "ping" - } - } - Derive Theme Name - { - size [SList_Name] - Derive TextButton Text - { - normal "Server Name" - - init Nex_Action_JoinGame_SortBy - target "name" - } - } - Derive Theme Map - { - size [SList_Map] - Derive TextButton Text - { - normal "Map Name" - - init Nex_Action_JoinGame_SortBy - target "map" - } - } - Derive Theme Players - { - size [SList_Players] - Item Arrangement Glue - { - direction '0.001 0 0' - flag [FlagEmbedded] - - Derive TextButton NumPlayers - { - normal "NP" - - init Nex_Action_JoinGame_SortBy - target "numplayers" - } - Derive Label Slash - { - text "/" - } - Derive TextButton MaxPlayers - { - normal "MP" - - init Nex_Action_JoinGame_SortBy - target "maxplayers" - } - } - } - Derive Theme Mod - { - size [SList_Mod] - Derive TextButton Text - { - normal "Mod Name" - - init Nex_Action_JoinGame_SortBy - target "mod" - } - } - } - Item Window Scroll - { - flag [FlagEmbedded] - size '900 500' - - Item ScrollWindow ScrollArea - { - flag [FlagEmbedded] - size '870 500' - - Item Arrangement Slist - { - direction '0 1 0' - flag [FlagEmbedded] - - DeriveTemplate Nex_HostCache_Entry Entry - { - size '852 15' - action Nex_Action_EntryConnect - - DeriveTemplate Nex_HostCache_ValueField Ping - { - pos '0 0' - size [SList_Ping] - target "ping" - alignment [AlignRight] - } - DeriveTemplate Nex_HostCache_StringField Name - { - pos '52 0' - size [SList_Name] - target "name" - } - DeriveTemplate Nex_HostCache_StringField Map - { - pos '546 0' - size [SList_Map] - target "map" - } - DeriveTemplate Nex_HostCache_Players Players - { - pos '668 0' - size [SList_Players] - alignment [AlignRight] - } - DeriveTemplate Nex_HostCache_StringField Mod - { - pos '730 0' - size [SList_Mod] - target "mod" - } - } - Item Automation_Job Generator - { - action Nex_Automation_CreateEntries - } - } - } - Item VScrollBar Scroller - { - pos '870 0' - size '20 100' - target "##prev" - } - } - Derive PictureButton Refresh - { - normal "$gfx/m_refresh" - - action Nex_Action_RefreshSlist - } - } -} \ No newline at end of file diff --git a/scmenu/main.menu b/scmenu/main.menu deleted file mode 100644 index a2c4fbd72..000000000 --- a/scmenu/main.menu +++ /dev/null @@ -1,57 +0,0 @@ -// Property of Alientrap -// -// Main menu -Item Arrangement Main -{ - pos '29 30' - direction '10 0' - - DeriveTemplate PictureButton MainButton - { - soundPressed "misc/menu2.wav" - } - - Derive MainButton Join - { - //normal "Join Game" - normal "$gfx/m_top_joingame" - selected "$gfx/m_top_joingame" - - target "JoinGame" - action Nex_Action_JumpToJoinGame - } - Derive MainButton Create - { - //normal "Create Game" - normal "$gfx/m_top_creategame" - selected "$gfx/m_top_creategame" - - target "CreateGame" - init Nex_Action_SetNormalPanelLink - } - Derive MainButton Options - { - //normal "Options" - normal "$gfx/m_top_options" - selected "$gfx/m_top_options" - - target "Options" - init Nex_Action_SetNormalPanelLink - } - Derive MainButton Credits - { - //normal "Credits" - normal "$gfx/m_top_credits" - selected "$gfx/m_top_credits" - - action Nex_Credits_Action - } - Derive MainButton Quit - { - //normal "Quit" - normal "$gfx/m_top_quit" - selected "$gfx/m_top_quit" - - action Nex_Quit_Action - } -} diff --git a/scmenu/menu b/scmenu/menu deleted file mode 100644 index 116433819..000000000 --- a/scmenu/menu +++ /dev/null @@ -1,17 +0,0 @@ -// Property of Alientrap -// -// Menu -#include "menu/constants.menu" -#include "menu/templates.menu" -//#include "menu/test.menu" -//Ignore { -#include "menu/data.menu" - -#include "menu/creategame.menu" -#include "menu/options.menu" -#include "menu/joingame.menu" -#include "menu/normal.menu" - -#include "menu/ingame.menu" - -//} diff --git a/scmenu/messagebox.menu b/scmenu/messagebox.menu deleted file mode 100644 index 360e82886..000000000 --- a/scmenu/messagebox.menu +++ /dev/null @@ -1,82 +0,0 @@ -// Property of Alientrap -// -// message box window -// messagebox.menu - -// MessageBoxWnd::Layout::Title::Caption -// MessageBoxWnd::Layout::Text -// MessageBoxWnd::Layout::Buttons::Left -// MessageBoxWnd::Layout::Buttons::Right -Item Window MessageBoxWnd -{ - pos '300 300' - size '400 80' - flag [FlagHidden] - - Derive Rect Background - { - flag [FlagSealOffMouse] - color '0 0 0' - alpha 0.8 - Ignore { - color '0.1 0.1 0.1' - drawFlag [DrawFlagModulate] - - - Derive Rect Layer - { - color '0.3 0.3 0.3' - drawFlag [DrawFlagAdditive] - } - } - } - Item Layout Layout - { - origin '200 0' - direction '0.0 10' - flag [FlagEmbedded] - alignment [AlignCenter] - - Item FloatingArea Title - { - size '400 13' - target "##up up" - Derive Rect Background - { - //color '0.5 0.5 0.5' - color '0.05 0.05 0.05' - } - Derive TextButton Caption - { - color '1.0 1.0 1.0' - size '400 11' - alignment [AlignCenter] - //normal "Message Box Window" - link "##up" - } - } - Derive Label Text - { - color '1.0 1.0 1.0' - //text "MessageBox Text" - } - Item Arrangement Buttons - { - direction '40 0' - key Nex_MessageBox_Key - - Derive TextButton Left - { - color '1.0 1.0 1.0' - //normal "Left" - action Nex_MessageBox_LeftButton - } - Derive TextButton Right - { - color '1.0 1.0 1.0' - //normal "Right" - action Nex_MessageBox_RightButton - } - } - } -} diff --git a/scmenu/normal.menu b/scmenu/normal.menu deleted file mode 100644 index b2495dd63..000000000 --- a/scmenu/normal.menu +++ /dev/null @@ -1,85 +0,0 @@ -// Property of Alientrap -// -// Normal main menu -Item Task_Job WelcomeSound -{ - target "announcer/welcometonexuiz.wav" - reinit Nex_Action_PlaySoundOnce -} -Item Window Normal -{ - key Nex_Global_Key - size '1024 768' - - Derive Rect Modulate - { - color '0.6 0.6 0.7' - drawFlag [DrawFlagModulate] - } - Derive Rect AddLevel - { - color '0.3 0.3 0.3' - drawFlag [DrawFlagAdditive] - } - Derive Picture NexuizLogo - { - picture "gfx/m_background" - pos '0 0' - size '1024 768' - alpha 0.5 - -Ignore -{ - Item Effect_Float AlphaPulse - { - targetFloat alpha - startFloat 0.8 - endFloat 0.4 - time '2 2 -1' - interpolForward FX_SquareInterpolation - interpolBackward FX_SquareInterpolation - } - Item Effect_Vector ColorPulse - { - targetVector color - startVector "0 0 0" - endVector "0.1 0 0.05" - time '2 2 -1' - interpolForward FX_SquareInterpolation - interpolBackward FX_SquareInterpolation - } -} - } - - // Include the main menu as first sub window - #include "menu/main.menu" - - Item Task_Job PanelReinit - { - // this is a automation init function (dont change this to reinit!) - init Nex_Action_SetLinkOnReinit - target "Panel::NexuizLogo" - } - Item Reference Panel - { - pos '62 127' - size '938 650' - - // The first thing you should see is our cool logo! - Derive Picture NexuizLogo - { - picture "gfx/m_strength" - pos '100 30' - size '700 600' - } - } - -// global floating windows -#include "menu/credits.menu" -#include "menu/messagebox.menu" -#include "menu/quit.menu" -} - - - - diff --git a/scmenu/options.menu b/scmenu/options.menu deleted file mode 100644 index dab849997..000000000 --- a/scmenu/options.menu +++ /dev/null @@ -1,75 +0,0 @@ -// Property of Alientrap/AK -// Options menu - -Item Layout Options -{ - direction '20 0' - - Item Arrangement Menu - { - direction '0 10' - - Derive TextButton Player - { - normal "Player" - - init Nex_Action_JumpToPage - target "Panel::Player" - } - Derive TextButton Controls - { - normal "Controls" - - init Nex_Action_JumpToPage - target "Panel::KeyControl" - } - Derive TextButton Audio - { - normal "Audio" - - init Nex_Action_JumpToPage - target "Panel::Sound" - } - Derive TextButton Video - { - normal "Video" - - init Nex_Action_JumpToPage - target "Panel::Video" - } - Derive TextButton ColorControl - { - normal "Color Control" - - init Nex_Action_JumpToPage - target "Panel::ColorControl" - } - Derive TextButton Effects - { - normal "Effects" - - init Nex_Action_JumpToPage - target "Panel::Effects" - } - Derive TextButton Input - { - normal "Input" - - init Nex_Action_JumpToPage - target "Panel::Input" - } - } - Item EventWindow Panel - { - size '760 800' - reinit Nex_Action_MakeFirstVisible - - #include "menu/options/sound.menu" - #include "menu/options/video.menu" - #include "menu/options/key.menu" - #include "menu/options/player.menu" - #include "menu/options/color.menu" - #include "menu/options/effects.menu" - #include "menu/options/input.menu" - } -} \ No newline at end of file diff --git a/scmenu/options/color.menu b/scmenu/options/color.menu deleted file mode 100644 index 8a926aad4..000000000 --- a/scmenu/options/color.menu +++ /dev/null @@ -1,107 +0,0 @@ -// Property of Alientrap/AK -// options/color.menu -Item Window ColorControl -{ - size '600 600' - Derive Picture Table1 - { - picture "gfx/table1" - size '600 600' - } - - Item Layout Layout - { - direction [Nex_DefaultVertDirection] - size '600 600' - origin '300 50' - alignment [AlignFirst] - - Derive Nex_Option_Slider Brightness - { - text "Brightness" - target "::Data::Color::Brightness::Value" - } - Derive Nex_Option_Slider Contrast - { - text "Contrast" - target "::Data::Color::Contrast::Value" - } - Derive Nex_Option_Slider HWGamma - { - text "HW Gamma Support" - target "::Data::Color::HWGamma::Switch" - } - Derive Nex_Option_Slider Gamma - { - text "Gamma" - target "::Data::Color::Gamma::Value" - } - Derive Nex_Line Seperator1 - {} - Derive Nex_Option_Slider ExtendedControl - { - text "Color Control" - target "::Data::Color::Extended::Active::Switch" - } - // Low part - Derive Nex_Option_Slider DarkRed - { - text "Dark Red" - target "::Data::Color::Extended::Low::Red::Value" - } - Derive Nex_Option_Slider DarkGreen - { - text "Dark Green" - target "::Data::Color::Extended::Low::Green::Value" - } - Derive Nex_Option_Slider DarkBlue - { - text "Dark Blue" - target "::Data::Color::Extended::Low::Blue::Value" - } - // Mid part - Derive Nex_Option_Slider MidRed - { - text "Grey Red" - target "::Data::Color::Extended::Mid::Red::Value" - } - Derive Nex_Option_Slider MidGreen - { - text "Grey Green" - target "::Data::Color::Extended::Mid::Green::Value" - } - Derive Nex_Option_Slider MidBlue - { - text "Grey Blue" - target "::Data::Color::Extended::Mid::Blue::Value" - } - // High part - Derive Nex_Option_Slider HighRed - { - text "White Red" - target "::Data::Color::Extended::High::Red::Value" - } - Derive Nex_Option_Slider HighGreen - { - text "White Green" - target "::Data::Color::Extended::High::Green::Value" - } - Derive Nex_Option_Slider HighBlue - { - text "White Blue" - target "::Data::Color::Extended::High::Blue::Value" - } - Derive Nex_Line Seperator2 - {} - Derive TextButton Cancel - { - normal "Cancel changes" - action Nex_Action_Color_Cancel - } - Derive TextButton Reset - { - normal "Reset to default" - action Nex_Action_Color_Reset - } - } -} diff --git a/scmenu/options/effects.menu b/scmenu/options/effects.menu deleted file mode 100644 index b8948d3ff..000000000 --- a/scmenu/options/effects.menu +++ /dev/null @@ -1,102 +0,0 @@ -// Property of Alientrap/AK -// options/key.menu -Item Window Effects -{ - size '600 600' - - Derive Picture Table1 - { - picture "gfx/table1" - size '600 600' - } - - Derive MultiLabel Description - { - size '600 100' - text - "\n\n\n See the Nexiuz Readme for more infomation. \n Realtime lighting/Bloom features require \n high end computers to run fast." - } - - Item Layout Layout - { - direction [Nex_DefaultVertDirection] - size '600 600' - origin '300 80' - alignment [AlignFirst] - - Derive Nex_Option_Switch Particles - { - text "Particles" - target "::Data::Effects::Particles::Switch" - } - Derive Nex_Option_Slider ParticleQuality - { - text "Particle Quality" - target "::Data::Effects::ParticleQuality::Value" - } - Derive Nex_Option_Switch Decals - { - text "Decals" - target "::Data::Effects::Decals::Switch" - } - Derive Nex_Option_Switch Bloom - { - text "Bloom" - target "::Data::Effects::Bloom::Switch" - } - Derive Nex_Option_Switch Coronas - { - text "Coronas" - target "::Data::Effects::Coronas::Switch" - } - - Derive Nex_Line SeperatorRTLights - {} - Derive Nex_Option_Switch RealtimeLights - { - text "Realtime World Lights" - target "::Data::Effects::RealtimeLights::Switch" - } - Derive Nex_Option_Switch RealtimeShadows - { - text "Realtime World Shadows" - target "::Data::Effects::RealtimeShadows::Switch" - } - Derive Nex_Option_Switch RealtimeDLights - { - text "Realtime Dynamic Lights" - target "::Data::Effects::RealtimeDLights::Switch" - } - Derive Nex_Option_Switch RealtimeDLightShadows - { - text "Realt. Dyn. Lights Shad." - target "::Data::Effects::RealtimeDLightShadows::Switch" - } - - Derive Nex_Line SeperatorGFXFeatures - {} - Derive Nex_Option_Switch GLSL - { - text "OpenGL 2.0 Shaders" - target "::Data::Effects::GLSL::Switch" - } - Derive Nex_Option_Switch Gloss - { - text "Gloss" - target "::Data::Effects::Gloss::Switch" - } - Derive Nex_Option_Switch ShowFPS - { - text "Show FPS" - target "::Data::Effects::ShowFPS::Switch" - } - Derive Nex_Line SeperatorReset - {} - Derive TextButton Reset - { - normal "Reset to default" - init Nex_Action_ResetData - target "::Data::Effects" - } - } -} diff --git a/scmenu/options/game.menu b/scmenu/options/game.menu deleted file mode 100644 index 0c4905dcf..000000000 --- a/scmenu/options/game.menu +++ /dev/null @@ -1,9 +0,0 @@ -// Property of Alientrap/AK -// options/game.menu -Item Window Game -{ - direction [Nex_DefaultVertDirection] - size '600 600' - origin '300 0' - alignment [AlignFirst] -} diff --git a/scmenu/options/input.menu b/scmenu/options/input.menu deleted file mode 100644 index ac9eb0396..000000000 --- a/scmenu/options/input.menu +++ /dev/null @@ -1,45 +0,0 @@ -// Property of Alientrap/AK -// options/input.menu -Item Window Input -{ - size '600 600' - - Derive Picture Table1 - { - picture "gfx/table1" - size '600 600' - } - - Item Layout Layout - { - direction [Nex_DefaultVertDirection] - size '600 600' - origin '300 50' - alignment [AlignFirst] - - - Derive Nex_Option_Slider Sensitivity - { - text "Sensitivity" - target "::Data::Input::Sensitivity::Value" - } - Derive Nex_Option_Switch InvertMouse - { - text "Invert Mouse" - target "::Data::Input::InvertMouse::Switch" - } - Derive Nex_Option_Switch MouseFilter - { - text "Mouse Filter" - target "::Data::Input::MouseFilter::Switch" - } - Derive Nex_Line Seperator - {} - Derive TextButton Reset - { - normal "Reset to default" - init Nex_Action_ResetData - target "::Data::Input" - } - } -} diff --git a/scmenu/options/key.menu b/scmenu/options/key.menu deleted file mode 100644 index 24715897e..000000000 --- a/scmenu/options/key.menu +++ /dev/null @@ -1,373 +0,0 @@ -// Property of Alientrap/AK -// options/key.menu -Item Window KeyControl -{ - size '700 600' - - Derive Picture Table1 - { - picture "gfx/table1" - size '700 600' - } - - Item Layout Layout - { - pos '30 0' - size '700 600' - direction [Nex_DefaultVertDirection] - flag [FlagEmbedded] - - Derive MultiLabel Description - { - pos '0 50' - size '600 24' - text - "Press [Enter] or [Mouse1] to change a key binding.\nPress [Delete] to remove the binding." - } - - // table: name key1 key2 - Item Layout TableDesc - { - pos '0 0' - size '600 15' - direction '10 0' - - Derive Rect Action - { - size '200 15' - color '0.5 0.5 0.5' - alpha 0.5 - - Derive Label Label - { - text "Action" - } - } - Derive Rect Key1 - { - pos '210 0' - size '190 15' - color '0.5 0.5 0.5' - alpha 0.5 - - Derive Label Label - { - text "Key/Button 1" - } - } - Derive Rect Key2 - { - pos '410 0' - size '190 15' - color '0.5 0.5 0.5' - alpha 0.5 - - Derive Label Label - { - text "Key/Button 2" - } - } - } - Item Window Temp - { - size '700 500' - flag [FlagEmbedded] - - Item ScrollWindow Scroll - { - size '600 500' - flag [FlagEmbedded] - - Item Arrangement Keys - { - direction [Nex_DefaultVertDirection] - flag [FlagEmbedded] - - Template Layout Nex_Key_Template - { - size '600 12' - flag [FlagEmbedded] - direction '10 0' - - Template Automation_Job Job - { - action Nex_Automation_Key - } - Derive Label Action - { - size '200 12' - } - Template DataLink_AltString Link1 - { - flag [FlagHidden] - stepValue 0 - } - DeriveTemplate Nex_KeyButton Key1 - { - pos '210 0' - size '190 12' - target "##down" - action Nex_Action_KeyButton - - Item DataLink_FastResync Resync - { - link "Link1" - } - } - Template DataLink_AltString Link2 - { - flag [FlagHidden] - stepValue 1 - } - DeriveTemplate Nex_KeyButton Key2 - { - pos '410 0' - size '190 12' - target "##down" - action Nex_Action_KeyButton - - Item DataLink_FastResync Resync - { - link "Link2" - } - } - } - DeriveTemplate Label Title - { - fontSize '13 13' - color '0.5 0.3 0.3' - } - Derive Title GroupMovement - { - text "[Movement]" - } - Derive Nex_Key_Template Forward - { - text "Move Forward" - target "Data::Key::Forward" - } - Derive Nex_Key_Template Backward - { - text "Move Backward" - target "Data::Key::Backward" - } - Derive Nex_Key_Template Left - { - text "Strafe Left" - target "Data::Key::StrafeLeft" - } - Derive Nex_Key_Template Right - { - text "Strafe Right" - target "Data::Key::StrafeRight" - } - Derive Nex_Key_Template Jump - { - text "Jump" - target "Data::Key::Jump" - } - Derive Nex_Key_Template Crouch - { - text "Crouch" - target "Data::Key::Crouch" - } - Derive Nex_Key_Template Hook - { - text "Grappling Hook" - target "Data::Key::Hook" - } - Derive Nex_Void Seperator1 - {} - Derive Title GroupFight - { - text "[Fight]" - } - Derive Nex_Key_Template Primary - { - text "Primary Attack" - target "Data::Key::FirePrimary" - } - Derive Nex_Key_Template Secondary - { - text "Secondary Attack" - target "Data::Key::FireSecondary" - } - Derive Nex_Key_Template PrevWeapon - { - text "Previous Weapon" - target "Data::Key::PrevWeapon" - } - Derive Nex_Key_Template NextWeapon - { - text "Next Weapon" - target "Data::Key::NextWeapon" - } - Derive Nex_Key_Template Zoom - { - text "Zoom" - target "Data::Key::Zoom" - } - Derive Nex_Void Seperator2 - {} - Derive Title Weapons - { - text "[Weapon]" - } - Derive Nex_Key_Template Laser - { - text "Laser" - target "Data::Key::Weapon::Laser" - } - Derive Nex_Key_Template Shotgun - { - text "Shotgun" - target "Data::Key::Weapon::Shotgun" - } - Derive Nex_Key_Template Machingun - { - text "Machinegun" - target "Data::Key::Weapon::Machinegun" - } - - Derive Nex_Key_Template Mortar - { - text "Mortar" - target "Data::Key::Weapon::Mortar" - } - Derive Nex_Key_Template Electro - { - text "Electro" - target "Data::Key::Weapon::Electro" - } - Derive Nex_Key_Template CryLink - { - text "CryLink" - target "Data::Key::Weapon::CryLink" - } - Derive Nex_Key_Template NexGun - { - text "NexGun" - target "Data::Key::Weapon::NexGun" - } - Derive Nex_Key_Template Hagar - { - text "Hagar" - target "Data::Key::Weapon::Hagar" - } - Derive Nex_Key_Template Rocket - { - text "Rocket" - target "Data::Key::Weapon::Rocket" - } - Derive Nex_Void Seperator3 - {} - Derive Title Misc - { - text "[Miscellaneous]" - } - Derive Nex_Key_Template ShowScores - { - text "Show Scores" - target "Data::Key::ShowScores" - } - Derive Nex_Key_Template ToggleConsole - { - text "Toggle Console" - target "Data::Key::ToggleConsole" - } - Derive Nex_Key_Template Message - { - text "Message" - target "Data::Key::Message" - } - Derive Nex_Key_Template TeamMessage - { - text "Team Message" - target "Data::Key::TeamMessage" - } - Derive Nex_Key_Template Pause - { - text "Pause" - target "Data::Key::Pause" - } - Derive Nex_Key_Template Screenshot - { - text "Screenshot" - target "Data::Key::Screenshot" - } - Derive Nex_Key_Template Quit - { - text "Quit Nexuiz" - target "Data::Key::Quit" - } - Derive Nex_Key_Template ViewSmaller - { - text "Decrease Viewsize" - target "Data::Key::ViewSmaller" - } - Derive Nex_Key_Template ViewBigger - { - text "Increase Viewsize" - target "Data::Key::ViewBigger" - } - } - } - Item VScrollBar Scroller - { - pos '610 0' - size '20 100' - target "##prev" - } - } - - Item Arrangement Buttons - { - flag [FlagEmbedded] - Derive TextButton Reset - { - normal "Reset to default" - init Nex_Action_ResetData - target "::Data::Key" - } - } - } - - // info window - Item Window InfoWindow - { - size '300 50' - pos '150 200' - flag [FlagHidden] - - Derive Rect Background - { - color '0.1 0.1 0.1' - drawFlag [DrawFlagModulate] - flag [FlagSealOffMouse] - - Derive Rect Layer - { - color '0.2 0.2 0.2' - drawFlag [DrawFlagAdditive] - } - } - Item Window TextContainer - { - pos '2 2' - size '296 46' - Derive Rect Background - { - color '0.1 0.1 0.1' - drawFlag [DrawFlagAdditive] - } - Derive MultiLabel Info - { - pos '3 3' - wrap 24 - text "Now press the key you want to bind or press [Escape] to abort." - } - } - } -} - - diff --git a/scmenu/options/player.menu b/scmenu/options/player.menu deleted file mode 100644 index e063eb50a..000000000 --- a/scmenu/options/player.menu +++ /dev/null @@ -1,138 +0,0 @@ -// Property of Alientrap/AK -// options/player.menu -Item Window Player -{ - size '760 600' - - Derive Picture Table1 - { - picture "gfx/table1" - size '760 600' - } - - Item Window Avatar - { - size '300 600' - pos '20 20' - flag [FlagEmbedded] - - Derive Picture Picture - { - size '300 400' - picture "gfx/m_white" - } - Derive Rect Overlay - { - size '300 15' - drawFlag [DrawFlagAdditive] - alpha 0.4 - } - Derive MultiLabel Description - { - size '300 200' - pos '0 400' - wrap 27 - fontSize '11 11 0' - } - Derive TextButton Prev - { - pos '0 0' - normal "<<" - - action Nex_Action_Avatar_Prev - } - Derive Label Name - { - pos '24 0' - size '276 12' - alignment [AlignCenter] - } - Derive TextButton Next - { - pos '278 0' - normal ">>" - - action Nex_Action_Avatar_Next - } - Item Task_Job Job - { - init Nex_Automation_UpdateAvatar - } - } - Item Layout Settings - { - pos '320 20' - size '440 600' - origin '180 0' - flag [FlagEmbedded] - alignment [AlignFirst] - direction [Nex_DefaultVertDirection] - - Derive Nex_Composition Name - { - Derive TextButton Description - { - normal "Player name" - link "EditBox" - } - Derive EditBox EditBox - { - size '182 20' - target "Data::Player::Name::Text" - } - } - Derive Nex_Composition TeamColor - { - text "Team color" - target "::Data::Player::TeamColor::TextSwitch" - - Derive Nex_Automation_Option_Slider Automation - {} - Derive TextButton Description - {} - Derive Slider Slider - {} - Derive PictureValueButton Value - { - color "1.0 1.0 1.0" - colorPressed "1.0 1.0 1.0" - colorSelected "1.0 1.0 1.0" - } - } - Derive Nex_Option_Slider FOV - { - text "Field of View" - target "::Data::Player::FOV::Value" - } - Derive Nex_Option_Slider ViewSize - { - text "View Size" - target "::Data::Player::ViewSize::Value" - } - Derive Nex_Option_Slider CrosshairType - { - text "Crosshair Type" - target "::Data::Player::Crosshair::Type::Switch" - } - Derive Nex_Option_Slider CrosshairSize - { - text "Crosshair Size" - target "::Data::Player::Crosshair::Size::Value" - } - Derive Nex_Void Seperator1 - {} - Derive PictureButton Apply - { - normal "$gfx/m_apply" - - action Nex_Action_Player_Apply - } - Derive TextButton Reset - { - alignment [AlignRight] - normal "Reset" - init Nex_Action_ResetData - target "::Data::Player" - } - } -} diff --git a/scmenu/options/sound.menu b/scmenu/options/sound.menu deleted file mode 100644 index 01ed93b6f..000000000 --- a/scmenu/options/sound.menu +++ /dev/null @@ -1,50 +0,0 @@ -// Property of Alientrap/AK -// options/sound.menu -Item Window Sound -{ - size '600 600' - - Derive Picture Table1 - { - picture "gfx/table1" - size '600 600' - } - - Item Layout Layout - { - direction [Nex_DefaultVertDirection] - size '600 600' - origin '300 50' - alignment [AlignFirst] - - - Derive Nex_Option_Slider MusicVolume - { - text "Music Volume" - target "::Data::Sound::CDVolume::Value" - } - Derive Nex_Option_Slider GameVolume - { - text "Game Volume" - target "::Data::Sound::GameVolume::Value" - } - Derive Nex_Option_Slider AmbientVolume - { - text "Ambient Volume" - target "::Data::Sound::AmbientVolume::Value" - } - Derive Nex_Option_Switch SwapStereo - { - text "Swap Stereo" - target "::Data::Sound::SwapStereo::Switch" - } - Derive Nex_Void Seperator1 - {} - Derive TextButton Reset - { - normal "Reset to default" - init Nex_Action_ResetData - target "::Data::Sound" - } - } -} diff --git a/scmenu/options/video.menu b/scmenu/options/video.menu deleted file mode 100644 index a4643fd11..000000000 --- a/scmenu/options/video.menu +++ /dev/null @@ -1,61 +0,0 @@ -// Property of Alientrap/AK -// options/key.menu -Item Window Video -{ - size '600 600' - - Derive Picture Table1 - { - picture "gfx/table1" - size '600 600' - } - - Item Layout Layout - { - direction [Nex_DefaultVertDirection] - size '600 600' - origin '300 50' - alignment [AlignFirst] - - DeriveTemplate Composition Nex_Video_Option_Switch - { - direction [Nex_DefaultHorzDirection] - - DeriveTemplate Nex_Automation_Option_Switch Automation - {} - DeriveTemplate TextButton Description - {} - DeriveTemplate SwitchButton Switch - {} - } - Derive Nex_Video_Option_Switch Resolution - { - text "Resolution" - target "::Data::Video::Resolution::Switch" - } - Derive Nex_Video_Option_Switch Bpp - { - text "Bits Per Pixel" - target "::Data::Video::BPP::Switch" - } - Derive Nex_Video_Option_Switch Fullscreen - { - text "Fullscreen" - target "::Data::Video::Fullscreen::Switch" - } - Derive Nex_Void Seperator1 - {} - Derive PictureButton Apply - { - normal "$gfx/m_apply" - - action Nex_Action_Video_Apply - } - Derive TextButton Reset - { - normal "Reset to default" - init Nex_Action_ResetData - target "::Data::Video" - } - } -} diff --git a/scmenu/quit.menu b/scmenu/quit.menu deleted file mode 100644 index d7954ea94..000000000 --- a/scmenu/quit.menu +++ /dev/null @@ -1,76 +0,0 @@ -// Property of Alientrap -// -// Quit window -Item Window QuitWnd -{ - pos '300 300' - size '400 80' - flag [FlagHidden] - - Derive Rect Background - { - flag [FlagSealOffMouse] - color '0 0 0' - alpha 0.8 - Ignore { - color '0.1 0.1 0.1' - drawFlag [DrawFlagModulate] - - - Derive Rect Layer - { - color '0.3 0.3 0.3' - drawFlag [DrawFlagAdditive] - } - } - } - Item Layout Layout - { - origin '200 0' - direction '0.0 10' - flag [FlagEmbedded] - alignment [AlignCenter] - - Item FloatingArea Title - { - size '400 13' - target "##up up" - Derive Rect Background - { - //color '0.5 0.5 0.5' - color '0.05 0.05 0.05' - } - Derive TextButton Caption - { - color '1.0 1.0 1.0' - size '400 11' - alignment [AlignCenter] - normal "Quit Window" - link "##up" - } - } - Derive Label Text - { - color '1.0 1.0 1.0' - text "Do you really want to quit?" - } - Item Arrangement Buttons - { - direction '40 0' - key Nex_Quit_Key - - Derive TextButton Yes - { - color '1.0 1.0 1.0' - normal "Yes" - action Nex_Quit_Yes - } - Derive TextButton No - { - color '1.0 1.0 1.0' - normal "No" - action Nex_Quit_No - } - } - } -} diff --git a/scmenu/source/base/cursor.qc b/scmenu/source/base/cursor.qc deleted file mode 100644 index 221f561af..000000000 --- a/scmenu/source/base/cursor.qc +++ /dev/null @@ -1,96 +0,0 @@ -// NG-Menu -// base/cursor.qc - -void() Cursor_Init = -{ - // default cursor (embedded into DP): ui/mousepointer.tga - if( Gfx_Precache( CURSOR_PATH ) ) - Cursor_Current = CURSOR_PATH; - else { - Cursor_Current = "ui/mousepointer.tga"; - Gfx_Precache( Cursor_Current ); - } - - Cursor_Position = Cursor_Relative = '0 0 0'; - - Cursor_Animation = Cursor_DefaultAnimation; -}; - -void() Cursor_Quit = -{ -}; - -void() Cursor_Display = -{ - setmousetarget( MT_MENU ); -}; - -void() Cursor_Hide = -{ - setmousetarget( MT_CLIENT ); -}; - -void() Cursor_Draw = -{ - local vector lPos; - local vector lSize; - - lSize = Gfx_GetImageSize( Cursor_Current ) * Cursor_Scale; - lPos_x = Cursor_Position_x + lSize_x * Cursor_Offset_x; - lPos_y = Cursor_Position_y + lSize_y * Cursor_Offset_y; - lPos_z = 0.0; - - Gfx_DrawPic( lPos, Cursor_Current, lSize, Cursor_Color, Cursor_Transparency, Cursor_Flag ); -}; - -void() Cursor_Update = -{ - local vector lRelPos; - - lRelPos = getmousepos(); - lRelPos = Gfx_ConToMen( lRelPos ); - - Cursor_Relative_x = lRelPos_x * Cursor_Speed_x; - Cursor_Relative_y = lRelPos_y * Cursor_Speed_y; - - Cursor_Relative_x = bound( 0.0, Cursor_Position_x + Cursor_Relative_x, Gfx_Menu_Width ) - Cursor_Position_x; - Cursor_Relative_y = bound( 0.0, Cursor_Position_y + Cursor_Relative_y, Gfx_Menu_Height ) - Cursor_Position_y; - - Cursor_Position_x = Cursor_Position_x + Cursor_Relative_x; - Cursor_Position_y = Cursor_Position_y + Cursor_Relative_y; - Cursor_Position_z = 0.0; - - Cursor_Animation(); -}; - -void() Cursor_DefaultAnimation = -{ -}; - -void( vector pRelPos, string pText, vector pScale, vector pColor, float pAlpha, float pDrawFlag ) Cursor_PrintInfo = -{ - local vector lPosition; - local vector lSize; - - lSize = Gfx_GetImageSize( Cursor_Current ) * Cursor_Scale; - - if( pRelPos_x != 0 ) { - if( pRelPos_x > 0 ) // align it on the left - lPosition_x = Cursor_Position_x + lSize_x * (Cursor_Offset_x + 0.5 + pRelPos_x / 2) ; - else if( pRelPos_x < 0 ) // align it on the right - lPosition_x = Cursor_Position_x + lSize_x * (Cursor_Offset_x + 0.5 + pRelPos_x / 2) - - pScale_x * strlen( pText ); - lPosition_y = Cursor_Position_y + lSize_y * (Cursor_Offset_y + 0.5 + pRelPos_y / 2 ) - pScale_y / 2; - } else - lPosition_x = Cursor_Position_x + lSize_x * (Cursor_Offset_x + 0.5) - - pScale_x * strlen( pText ) / 2; - - if( pRelPos_y != 0 ) { - if( pRelPos_y > 0 ) - lPosition_y = Cursor_Position_y + lSize_y * (Cursor_Offset_y + 0.5 - pRelPos_y / 2) - pScale_y; - else if( pRelPos_y < 0 ) - lPosition_y = Cursor_Position_y + lSize_y * (Cursor_Offset_y + 0.5 - pRelPos_y / 2); - } - - Gfx_DrawString( lPosition, pText, pScale, pColor, pAlpha, pDrawFlag ); -}; diff --git a/scmenu/source/base/cursor.qh b/scmenu/source/base/cursor.qh deleted file mode 100644 index 6e4bd2ab3..000000000 --- a/scmenu/source/base/cursor.qh +++ /dev/null @@ -1,32 +0,0 @@ -// NG Menu -// cursor qh - -const string CURSOR_PATH = "gfx/m_cursor"; //"ui/mousepointer.tga"; - -string Cursor_Current; -var void() Cursor_Animation = __NULL__; - -vector Cursor_Relative; -vector Cursor_Position; -vector Cursor_Speed = '1 1 0'; - -vector Cursor_Position; // will be adjusted to be in the current origin - -float Cursor_Transparency = 1.0; -vector Cursor_Color = '1.0 1.0 1.0'; -float Cursor_Scale = 1.0; -float Cursor_Flag = 0; -vector Cursor_Offset = '-0.5 -0.5 0'; - -void() Cursor_Init; -void() Cursor_Quit; - -void() Cursor_Display; -void() Cursor_Hide; - -void() Cursor_Draw; -void() Cursor_Update; - -void() Cursor_DefaultAnimation; - -void( vector pRelPos, string pText, vector pScale, vector pColor, float pAlpha, float pDrawFlag ) Cursor_PrintInfo; diff --git a/scmenu/source/base/gfx.qc b/scmenu/source/base/gfx.qc deleted file mode 100644 index a35fc9b5a..000000000 --- a/scmenu/source/base/gfx.qc +++ /dev/null @@ -1,194 +0,0 @@ -// NG-Menu -// base/gfx.qc - -float _Gfx_FPS; -float _Gfx_LastTime; -float _Gfx_FrameCount; - -void() _Gfx_UpdateFPS = -{ - local float lDeltaTime; - - _Gfx_FrameCount = _Gfx_FrameCount + 1; - - lDeltaTime = Timer_Time - _Gfx_LastTime; - if( GFX_SHOWFPS_DURATION < lDeltaTime ) { - _Gfx_FPS = _Gfx_FrameCount / lDeltaTime; - _Gfx_LastTime = Timer_Time; - _Gfx_FrameCount = 0; - } -}; - -// cvar ngmenu_menu_height -void() _Gfx_UpdateRes = -{ - Gfx_Real_Width = cvar( "vid_conwidth" ); - Gfx_Real_Height = cvar( "vid_conheight" ); - Gfx_Menu_Width = cvar( CVAR_SCMENU_MENU_WIDTH ); - Gfx_Menu_Height = cvar( CVAR_SCMENU_MENU_HEIGHT ); - - if( Gfx_Menu_Width == 0.0 ) - Gfx_Menu_Width = GFX_MENU_DEFAULT_WIDTH; - if( Gfx_Menu_Height == 0.0 ) - Gfx_Menu_Height = GFX_MENU_DEFAULT_HEIGHT; -}; - -void() Gfx_Init = -{ - local string lWidth, lHeight; - - lWidth = ftos( GFX_MENU_DEFAULT_WIDTH ); - lHeight = ftos( GFX_MENU_DEFAULT_HEIGHT ); - - registercvar( CVAR_SCMENU_MENU_WIDTH, lWidth, CVAR_SAVE ); - registercvar( CVAR_SCMENU_MENU_HEIGHT, lHeight, CVAR_SAVE ); - - registercvar( CVAR_SCMENU_SHOWFPS, ftos( GFX_SHOWFPS_DEFAULT ), 0 ); - - _Gfx_UpdateRes(); -}; - -void() Gfx_Quit = -{ -}; - -void() Gfx_Display = -{ - Gfx_ResetClipArea(); -}; - -void() Gfx_Hide = -{ -}; - -void() Gfx_Update = -{ - _Gfx_UpdateRes(); - _Gfx_UpdateFPS(); -}; - -void() Gfx_Draw = -{ - if( cvar( CVAR_SCMENU_SHOWFPS ) ) { - local string lText; - local vector lScale; - local vector lPosition; - - lText = strcat( "FPS: ", ftos( floor( _Gfx_FPS ) ) ); - lScale = '15 15 0'; - - lPosition_x = 0; - lPosition_y = Gfx_Menu_Height - lScale_y - 5; - lPosition_z = 0; - - Gfx_DrawString( lPosition, lText, lScale, '1.0 1.0 1.0', 1.0, 0 ); - } -}; - -bool( string pPic ) Gfx_IsCached = -{ - return iscachedpic( pPic ); -}; - -bool( string pPic ) Gfx_Precache = -{ - if( pPic == "" ) - return false; - - if( iscachedpic( pPic ) ) - return true; - if( precache_pic( pPic ) == pPic ) - return true; - return false; -}; - -void( string pPic ) Gfx_Free -{ - // DO NOTHING UNTIL A REF COUNTER IS IMPLEMENTED -}; - -vector( string pPic ) Gfx_GetImageSize -{ - return drawgetimagesize( pPic ); -}; - -vector( vector pPos ) Gfx_ConToMen = -{ - pPos_x = pPos_x * Gfx_Menu_Width / Gfx_Real_Width; - pPos_y = pPos_y * Gfx_Menu_Height / Gfx_Real_Height; - pPos_z = 0.0; - - return pPos; -}; - -vector( vector pPos ) Gfx_MenToCon = -{ - pPos_x = pPos_x * Gfx_Real_Width / Gfx_Menu_Width; - pPos_y = pPos_y * Gfx_Real_Height / Gfx_Menu_Height; - pPos_z = 0.0; - - return pPos; -}; - -void() Gfx_ResetClipArea = -{ - drawresetcliparea(); -}; - -vector( vector pPosition ) _Gfx_FitCenter = -{ - return (pPosition + '0.375 0.375 0'); -}; - -float( vector pPosition, float pCharacter, vector pScale, vector pRGB, float pAlpha, float pFlag ) -Gfx_DrawCharacter = -{ - pPosition = _Gfx_FitCenter( Gfx_MenToCon( pPosition ) ); - pScale = Gfx_MenToCon( pScale ); - - return drawcharacter( pPosition, pCharacter, pScale, pRGB, pAlpha, pFlag ); -}; - -float( vector pPosition, string pText, vector pScale, vector pRGB, float pAlpha, float pFlag ) -Gfx_DrawString = -{ - pPosition = _Gfx_FitCenter( Gfx_MenToCon( pPosition ) ); - pScale = Gfx_MenToCon( pScale ); - - return drawstring( pPosition, pText, pScale, pRGB, pAlpha, pFlag ); -}; - -float( vector pPosition, string pPicture, vector pSize, vector pRGB, float pAlpha, float pFlag ) -Gfx_DrawPic = -{ - pPosition = _Gfx_FitCenter( Gfx_MenToCon( pPosition ) ); - pSize = Gfx_MenToCon( pSize ); - - return drawpic( pPosition, pPicture, pSize, pRGB, pAlpha, pFlag ); -}; - -float( vector pPosition, vector pSize, vector pRGB, float pAlpha, float pFlag ) -Gfx_Fill = -{ - pPosition = _Gfx_FitCenter( Gfx_MenToCon( pPosition ) ); - pSize = Gfx_MenToCon( pSize ); - - return drawfill( pPosition, pSize, pRGB, pAlpha, pFlag ); -}; - -void( float pX, float pY, float pWidth, float pHeight ) -Gfx_SetClipArea = -{ - local vector lPosition, lSize; - - lPosition_x = pX; - lPosition_y = pY; - - lSize_x = pWidth; - lSize_y = pHeight; - - lPosition = _Gfx_FitCenter( Gfx_MenToCon( lPosition ) ); - lSize = Gfx_MenToCon( lSize ) + '1 1 0'; - - drawsetcliparea( lPosition_x, lPosition_y, lSize_x, lSize_y ); -}; diff --git a/scmenu/source/base/gfx.qh b/scmenu/source/base/gfx.qh deleted file mode 100644 index 6a0f4b377..000000000 --- a/scmenu/source/base/gfx.qh +++ /dev/null @@ -1,51 +0,0 @@ -// NG-Menu -// base/gfx.h - -const float GFX_MENU_DEFAULT_WIDTH = 1024; -const float GFX_MENU_DEFAULT_HEIGHT = 768; - -const string CVAR_SCMENU_MENU_WIDTH = "scmenu_menu_width"; -const string CVAR_SCMENU_MENU_HEIGHT = "scmenu_menu_height"; - -// measurement block duration in seconds -const float GFX_SHOWFPS_DURATION = 1.000; - -const float GFX_SHOWFPS_DEFAULT = 0; -const string CVAR_SCMENU_SHOWFPS = "scmenu_showfps"; - -float Gfx_Menu_Width; -float Gfx_Menu_Height; -float Gfx_Real_Width; -float Gfx_Real_Height; - -void() Gfx_Init; -void() Gfx_Quit; -void() Gfx_Display; -void() Gfx_Hide; -void() Gfx_Update; -void() Gfx_Draw; - -bool( string pPic ) Gfx_IsCached; -bool( string pPic ) Gfx_Precache; -void( string pPic ) Gfx_Free; -vector( string pPic ) Gfx_GetImageSize; - -vector( vector pPos ) Gfx_ConToMen; -vector( vector pPos ) Gfx_MenToCon; - -void() Gfx_ResetClipArea; - -float( vector pPosition, float pCharacter, vector pScale, vector pRGB, float pAlpha, float pFlag ) -Gfx_DrawCharacter; - -float( vector pPosition, string pText, vector pScale, vector pRGB, float pAlpha, float pFlag ) -Gfx_DrawString; - -float( vector pPosition, string pPicture, vector pSize, vector pRGB, float pAlpha, float pFlag ) -Gfx_DrawPic; - -float( vector pPosition, vector pSize, vector pRGB, float pAlpha, float pFlag ) -Gfx_Fill; - -void( float pX, float pY, float pWidth, float pHeight ) -Gfx_SetClipArea; diff --git a/scmenu/source/base/hostcache.qc b/scmenu/source/base/hostcache.qc deleted file mode 100644 index ead053398..000000000 --- a/scmenu/source/base/hostcache.qc +++ /dev/null @@ -1,39 +0,0 @@ -// DP/Nex Menu -// base/hostcache.qc - -void() HostCache_Init = -{ - SLIST_FIELD_CNAME = gethostcacheindexforkey( "cname" ); - SLIST_FIELD_PING = gethostcacheindexforkey( "ping" ); - SLIST_FIELD_GAME = gethostcacheindexforkey( "game" ); - SLIST_FIELD_MOD = gethostcacheindexforkey( "mod" ); - SLIST_FIELD_MAP = gethostcacheindexforkey( "map" ); - SLIST_FIELD_NAME = gethostcacheindexforkey( "name" ); - SLIST_FIELD_MAXPLAYERS = gethostcacheindexforkey( "maxplayers" ); - SLIST_FIELD_NUMPLAYERS = gethostcacheindexforkey( "numplayers" ); - SLIST_FIELD_PROTOCOL = gethostcacheindexforkey( "protocol" ); -}; - -void() HostCache_Update = -{ - HostCache_ViewCount = gethostcachevalue( SLIST_HOSTCACHEVIEWCOUNT ); - HostCache_TotalCount = gethostcachevalue( SLIST_HOSTCACHETOTALCOUNT ); - HostCache_MasterQueryCount = gethostcachevalue( SLIST_MASTERQUERYCOUNT ); - HostCache_MasterReplyCount = gethostcachevalue( SLIST_MASTERREPLYCOUNT ); - HostCache_ServerQueryCount = gethostcachevalue( SLIST_SERVERQUERYCOUNT ); - HostCache_ServerReplyCount = gethostcachevalue( SLIST_SERVERREPLYCOUNT ); - HostCache_SortField = gethostcachevalue( SLIST_SORTFIELD ); - HostCache_SortDescending = gethostcachevalue( SLIST_SORTDESCENDING ); -}; - -void() HostCache_ResortViewSet = -{ - resorthostcache(); - HostCache_Update(); -}; - -void() HostCache_RefreshHostCache = -{ - refreshhostcache(); - HostCache_Update(); -}; diff --git a/scmenu/source/base/hostcache.qh b/scmenu/source/base/hostcache.qh deleted file mode 100644 index 9e8b3c77a..000000000 --- a/scmenu/source/base/hostcache.qh +++ /dev/null @@ -1,26 +0,0 @@ -// DP/Nex Menu -// base/hostcache.qh - -float SLIST_FIELD_CNAME; -float SLIST_FIELD_PING; -float SLIST_FIELD_GAME; -float SLIST_FIELD_MOD; -float SLIST_FIELD_MAP; -float SLIST_FIELD_NAME; -float SLIST_FIELD_MAXPLAYERS; -float SLIST_FIELD_NUMPLAYERS; -float SLIST_FIELD_PROTOCOL; - -float HostCache_ViewCount; -float HostCache_TotalCount; -float HostCache_MasterQueryCount; -float HostCache_MasterReplyCount; -float HostCache_ServerQueryCount; -float HostCache_ServerReplyCount; -float HostCache_SortField; -float HostCache_SortDescending; - -void() HostCache_Init; -void() HostCache_Update; -void() HostCache_ResortViewSet; -void() HostCache_RefreshHostCache; diff --git a/scmenu/source/base/key.qc b/scmenu/source/base/key.qc deleted file mode 100644 index 787d22312..000000000 --- a/scmenu/source/base/key.qc +++ /dev/null @@ -1,80 +0,0 @@ -// NG-Menu -// base/key.qc - -void() Key_Init = -{ -}; - -void() Key_Quit = -{ -}; - -void() Key_Display = -{ - setkeydest( KEY_MENU ); -}; - -void() Key_Update = -{ -#ifdef BRAVEMENU - // make sure that we have the input focus - setkeydest( KEY_MENU ); -#else - if( getkeydest() != KEY_MENU ) { - m_hide(); - } -#endif -}; - -void() Key_Hide = -{ - setkeydest( KEY_GAME ); -}; - -void( string pKey ) Key_Unbind = -{ - cmd( strcat( "unbind ", pKey, "\n" ) ); -}; - -string( float pKey ) Key_GetName = -{ - return keynumtostring( pKey ); -}; - -float( string pKey ) Key_GetNum = -{ - return stringtokeynum( pKey ); -}; - -string( string pCommand ) Key_GetBindList = -{ - return String_Zone( findkeysforcommand( pCommand ) ); -}; - -void(string pKey, string pCommand) Key_Bind = -{ - cmd( strcat( "bind \"", pKey, "\" \"", pCommand, "\"\n" ) ); -}; - -void(float pNum, string pCommand) Key_LimitBinds = -{ - local string lAltlist; - local float lCounter; - local float lMaxnum; - local float lValue; - - lAltlist = Key_GetBindList( pCommand ); - lMaxnum = Util_GetAltStringCount( lAltlist ); - - for( lCounter = 0 ; lCounter < lMaxnum ; lCounter = lCounter + 1 ) { - lValue = stof( String_Normal( Util_GetAltStringItem( lAltlist, lCounter ) ) ); - - if( lValue == -1 ) - break; - if( lCounter >= pNum ) - Key_Unbind( Key_GetName( lValue ) ); - } - - String_Free( lAltlist ); -}; - diff --git a/scmenu/source/base/key.qh b/scmenu/source/base/key.qh deleted file mode 100644 index 51902d0b1..000000000 --- a/scmenu/source/base/key.qh +++ /dev/null @@ -1,16 +0,0 @@ -// NG-Menu -// base/key.qh - -void() Key_Init; -void() Key_Quit; -void() Key_Update; -void() Key_Display; -void() Key_Hide; - -void( string pKey ) Key_Unbind; -string( float pKey ) Key_GetName; -float( string pKey ) Key_GetNum; -string( string pCommand ) Key_GetBindList; // returns altstring containing keynrs -void( float pNum, string pCommand) Key_LimitBinds; -void( string pKey, string pCommand) Key_Bind; - diff --git a/scmenu/source/base/snd.qc b/scmenu/source/base/snd.qc deleted file mode 100644 index 7c6d3452d..000000000 --- a/scmenu/source/base/snd.qc +++ /dev/null @@ -1,32 +0,0 @@ -// NG-Menu -// base/snd.qc - -void( string pText ) _Sound_DPrint = -{ - if( sys_debug_sound ) - print( pText ); -}; - -bool( string pSnd ) Sound_Precache = -{ - _Sound_DPrint( strcat( "Precaching sound '", pSnd, "'\n" ) ); - if( pSnd == "" ) - return false; - if( pSnd != precache_sound( pSnd ) ) - return false; - else - return true; -}; - -void( string pSnd ) Sound_Free = -{ -}; - -void( string pSnd) Sound_Play = -{ - if( pSnd != "" ) { - _Sound_DPrint( strcat( "Playing sound '", pSnd, "'\n" ) ); - localsound( pSnd ); - } -}; - diff --git a/scmenu/source/base/snd.qh b/scmenu/source/base/snd.qh deleted file mode 100644 index 84f7fe56e..000000000 --- a/scmenu/source/base/snd.qh +++ /dev/null @@ -1,8 +0,0 @@ -// NG-Menu -// base/snd.qh - -bool( string pSnd ) Sound_Precache; - -void( string pSnd ) Sound_Free; - -void( string pSnd ) Sound_Play; diff --git a/scmenu/source/base/timer.qc b/scmenu/source/base/timer.qc deleted file mode 100644 index 6886acbc1..000000000 --- a/scmenu/source/base/timer.qc +++ /dev/null @@ -1,22 +0,0 @@ -// NG-Menu -// base/timer.qc - -float _Timer_LastTime; - -void() Timer_Init = -{ - Timer_Time = gettime(); - Timer_Delta = 0.0; -}; - -void() Timer_Update = -{ - _Timer_LastTime = Timer_Time; - Timer_Time = gettime(); - Timer_Delta = Timer_Time - _Timer_LastTime; -}; - -void() Timer_Quit = -{ -}; - diff --git a/scmenu/source/base/timer.qh b/scmenu/source/base/timer.qh deleted file mode 100644 index 52e631a00..000000000 --- a/scmenu/source/base/timer.qh +++ /dev/null @@ -1,11 +0,0 @@ -// NG-Menu -// base/timer.qh - -// timer -float Timer_Time; // current time -float Timer_Delta; // time difference to the last cycle - -void() Timer_Init; -void() Timer_Update; -void() Timer_Quit; - diff --git a/scmenu/source/control/_fx/float.qc b/scmenu/source/control/_fx/float.qc deleted file mode 100644 index 965d54120..000000000 --- a/scmenu/source/control/_fx/float.qc +++ /dev/null @@ -1,55 +0,0 @@ -// DP/Nex Menu -// control/effect/float.qc - -////////////////////// -// Item_Effect_Float -/// - -void() Item_Effect_Float_Update = -{ - if( self._state == ITEM_STATE_FORWARD ) { - if( self._presstime + self.time_x < Timer_Time ) { - self._parent.self.targetFloat = self.endFloat; - self._presstime = Timer_Time; - self._state = ITEM_STATE_BACKWARD; - } else - self._parent.self.targetFloat = self.interpolForward( self.startFloat, - self.endFloat, self.time_x, Timer_Time - self._presstime, - self._parent.self.targetFloat ); - } else { - if( self._presstime + self.time_y < Timer_Time ) { - self._parent.self.targetFloat = self.startFloat; - self._presstime = Timer_Time; - self._state = ITEM_STATE_FORWARD; - } else - self._parent.self.targetFloat = self.interpolForward( self.endFloat, - self.startFloat, self.time_y, Timer_Time - self._presstime, - self._parent.self.targetFloat ); - } - - // Check the task state - if( ( self.time_y == -1 && self._state == ITEM_STATE_BACKWARD ) || - ( self.time_z >= 0 && self.time_z >= Timer_Time ) ) - if( self.time_z == -2 ) - self._runFlag = self._runFlag | RUNFLAG_CHILDDRAWONLY | FLAG_DRAWONLY; - else - Menu_DeleteAfterFrame( self ); -}; - -void() Item_Effect_Float_Reinit = -{ - self._parent.self.targetFloat = self.startFloat; - self._presstime = Timer_Time; - self._state = ITEM_STATE_FORWARD; - if( self.flag & FLAG_DRAWONLY ) - self.flag = self.flag - FLAG_DRAWONLY; -}; - -void() Item_Effect_Float_Spawn = -{ - self.flag = self.flag | FLAG_HIDDEN; - - self._update = Item_Effect_Float_Update; - self._reinit = Item_Effect_Float_Reinit; -}; - diff --git a/scmenu/source/control/_fx/fx.qh b/scmenu/source/control/_fx/fx.qh deleted file mode 100644 index abaae054f..000000000 --- a/scmenu/source/control/_fx/fx.qh +++ /dev/null @@ -1,61 +0,0 @@ -// DP/Nex Menu -// control/fx/fx.qh - -// [Item_Changer] - -// An effect always affects its parent -// There are two kinds of effects periodic/loop effects and task-effects -// The difference is that a task-effect will be finished somewhen and then deactivate/remove itself -// while a loop effect will restart -// A loop task will have deltaTime2 set - -enum { - ITEM_STATE_FORWARD, - ITEM_STATE_BACKWARD -}; - -// [Item_Effect] -// deltaTime2 = -1 for a task effect -// deltaTime2 = -2 for a persistent task effect -// endTime = -1 for a infinite loop effect -.vector time; // - -.union { - .vector targetVector; - .float targetFloat; -}; -/* -.union { - struct { - vector startVector; - float startFloat; - }; - struct { - vector endVector; - float endFloat; - }; -};*/ -.float startFloat; -.vector startVector; -.float endFloat; -.vector endVector; - -.float _state; -.float _presstime; - -// returns new value -typedef float( float pStart, float pEnd, float pDeltaTime, float pT, float pValue ) InterpolFunction; - -.InterpolFunction interpolForward; -.InterpolFunction interpolBackward; - -// Item_Effect_Float -// Item_Effect_Vector - -void() Item_Effect_Vector_Reinit; -void() Item_Effect_Vector_Update; -void() Item_Effect_Vector_Spawn; - -// Interpolation functions -float( float pStart, float pEnd, float pDeltaTime, float pT, float pValue ) FX_LinearInterpolation; -float( float pStart, float pEnd, float pDeltaTime, float pT, float pValue ) FX_SquareInterpolation; diff --git a/scmenu/source/control/_fx/interpol.qc b/scmenu/source/control/_fx/interpol.qc deleted file mode 100644 index feb046c69..000000000 --- a/scmenu/source/control/_fx/interpol.qc +++ /dev/null @@ -1,12 +0,0 @@ -// DP/Nex Menu -// control/fx/interpol.qc - -float( float pStart, float pEnd, float pDeltaTime, float pT, float pValue ) FX_LinearInterpolation = -{ - return pValue + ((pEnd - pStart) * Timer_Delta / pDeltaTime); -}; - -float( float pStart, float pEnd, float pDeltaTime, float pT, float pValue ) FX_SquareInterpolation = -{ - return pEnd - (pEnd - pStart) * (pDeltaTime - pT) * (pDeltaTime - pT) / pDeltaTime / pDeltaTime; -}; diff --git a/scmenu/source/control/_fx/vector.qc b/scmenu/source/control/_fx/vector.qc deleted file mode 100644 index 4bb9ff37f..000000000 --- a/scmenu/source/control/_fx/vector.qc +++ /dev/null @@ -1,71 +0,0 @@ -// DP/Nex Menu -// control/fx/vector.qc - -////////////////////// -// Item_Effect_Vector -/// - -void( InterpolFunction pFunction, bool pForward ) _IEV_Interpolate = -{ - local vector lCopy; - local float lT; - - lT = Timer_Time - self._presstime; - lCopy = self._parent.self.targetVector; - if( pForward ) { - lCopy_x = pFunction( self.startVector_x, self.endVector_x, self.time_x, lT, lCopy_x ); - lCopy_y = pFunction( self.startVector_y, self.endVector_y, self.time_x, lT, lCopy_y ); - lCopy_z = pFunction( self.startVector_z, self.endVector_z, self.time_x, lT, lCopy_z ); - } else { - lCopy_x = pFunction( self.endVector_x, self.startVector_x, self.time_y, lT, lCopy_x ); - lCopy_y = pFunction( self.endVector_y, self.startVector_y, self.time_y, lT, lCopy_y ); - lCopy_z = pFunction( self.endVector_z, self.startVector_z, self.time_y, lT, lCopy_z ); - } - self._parent.self.targetVector = lCopy; -}; - -void() Item_Effect_Vector_Update = -{ - if( self._state == ITEM_STATE_FORWARD ) { - if( self._presstime + self.time_x < Timer_Time ) { - self._parent.self.targetVector = self.endVector; - self._presstime = Timer_Time; - self._state = ITEM_STATE_BACKWARD; - } else - _IEV_Interpolate( self.interpolForward, true ); - } else { - if( self._presstime + self.time_y < Timer_Time ) { - self._parent.self.targetVector = self.startVector; - self._presstime = Timer_Time; - self._state = ITEM_STATE_FORWARD; - } else - _IEV_Interpolate( self.interpolBackward, false ); - } - - // Check the task state - if( ( self.time_y == -1 && self._state == ITEM_STATE_BACKWARD ) || - ( self.time_z >= 0 && self.time_z >= Timer_Time ) ) - if( self.time_z == -2 ) - self._runFlag = self._runFlag | RUNFLAG_CHILDDRAWONLY | FLAG_DRAWONLY; - else - Menu_DeleteAfterFrame( self ); - -}; - -void() Item_Effect_Vector_Reinit = -{ - self._parent.self.targetVector = self.startVector; - self._presstime = Timer_Time; - self._state = ITEM_STATE_FORWARD; - if( self.flag & FLAG_DRAWONLY ) - self.flag = self.flag - FLAG_DRAWONLY; -}; - -void() Item_Effect_Vector_Spawn = -{ - self.flag = self.flag | FLAG_HIDDEN; - - self._update = Item_Effect_Vector_Update; - self._reinit = Item_Effect_Vector_Reinit; -}; - diff --git a/scmenu/source/control/automation/automation.qc b/scmenu/source/control/automation/automation.qc deleted file mode 100644 index 54d2ed018..000000000 --- a/scmenu/source/control/automation/automation.qc +++ /dev/null @@ -1,13 +0,0 @@ -// DP/Nex Menu -// control/automation/factory.qc - -void() Item_Automation_Init = -{ - self.flag = FLAG_TEMPLATE; - Menu_DeleteAfterFrame( self ); -}; - -void() Item_Task_Init = -{ - self.flag = FLAG_HIDDEN; -}; diff --git a/scmenu/source/control/automation/automation.qh b/scmenu/source/control/automation/automation.qh deleted file mode 100644 index 18107aa9e..000000000 --- a/scmenu/source/control/automation/automation.qh +++ /dev/null @@ -1,30 +0,0 @@ -// DP/Nex Menu -// control/automation/automation.qh - -// [Item_Automation] -void() Item_Automation_Init; - -// Item_Automation_ForEach [Item_Automation] -.string target; // target type (with Item_) -.string link; // "" for current namespace, else path to objects -.entity _current; // current entity - -.event action; - -void() Item_Automation_ForEach_Spawn; - -// Item_Automation_Job [Item_Automation] -.event action; - -// [Item_Task] -void() Item_Task_Init; - -void() Item_Automation_Job_Spawn; - -// Item_Task_Job [Item_Task] -.event init; -.event reinit; -.event update; -.event destroy; - -void() Item_Task_Job_Spawn; diff --git a/scmenu/source/control/automation/foreach.qc b/scmenu/source/control/automation/foreach.qc deleted file mode 100644 index 78600e2f9..000000000 --- a/scmenu/source/control/automation/foreach.qc +++ /dev/null @@ -1,23 +0,0 @@ -// DP/Nex Menu -// control/automation/foreach.qc - -void() Item_Automation_ForEach_Spawn = -{ - local entity lLink; - - Item_Automation_Init(); - - if( self.link == "" ) - lLink = self._parent; - else - lLink = Menu_GetItem( self.link ); - if( !self.target || !isfunction( strcat( self.target, "_Spawn" ) ) ) { - objerror( "Bad target type!" ); - return; - } - - for( self._current = lLink._child ; self._current ; self._current = self._current._next ) - if( self._current.type == self.target ) - CtCall_Action(); -}; - diff --git a/scmenu/source/control/automation/job.qc b/scmenu/source/control/automation/job.qc deleted file mode 100644 index 6537ae3ff..000000000 --- a/scmenu/source/control/automation/job.qc +++ /dev/null @@ -1,22 +0,0 @@ -// DP/Nex Menu -// control/automation/job.qc - -void() Item_Automation_Job_Spawn = -{ - Item_Automation_Init(); - - //print( "AutoJob: ", self.name, "\n" ); - - CtCall_Action(); -}; - -void() Item_Task_Job_Spawn = -{ - Item_Task_Init(); - - self._reinit = CtCall_Reinit; - self._destroy = CtCall_Destroy; - self._update = CtCall_Update; - - CtCall_Init(); -}; diff --git a/scmenu/source/control/cinematic.qc b/scmenu/source/control/cinematic.qc deleted file mode 100644 index f0d3e47dc..000000000 --- a/scmenu/source/control/cinematic.qc +++ /dev/null @@ -1,49 +0,0 @@ -// DP/Nex Menu -// control/cinematic.qc - -///////////////////// -// [Item_Cinematic] -/// - -/* -=================== -Item_Cinematic_Destroy -=================== -*/ -void() Item_Cinematic_Destroy = -{ - // close the video stream - cin_close( self.normal ); - - String_EntityFree( self, link ); - String_EntityFree( self, normal ); -} - -/* -=================== -Item_Cinematic_Init -=================== -*/ -void() Item_Cinematic_Init = -{ - self.flag = self.flag | FLAG_HIDDEN; - - String_EntityZone( self, link ); - String_EntityZone( self, normal ); - - cin_open( self.link, self.normal ); - - self._destroy = Item_Cinematic_Destroy; -}; - -///////////////////////// -// Item_Cinematic_Loop -/// - -void() Item_Cinematic_Loop_Spawn = -{ - Item_Cinematic_Init(); - - cin_setstate( self.normal, CINE_LOOP ); -}; - diff --git a/scmenu/source/control/constants.qh b/scmenu/source/control/constants.qh deleted file mode 100644 index fa7353678..000000000 --- a/scmenu/source/control/constants.qh +++ /dev/null @@ -1,13 +0,0 @@ -// DP/Nex Menu -// control/constants.qh - -const string ITEM_SOUND_NOSELECT = "misc/temp.wav"; - -// Item_Button - -const float ITEM_BUTTON_ACTIONTIME = 0.2; - -// ITEM_EDITBOX constantes -const float ITEM_EDITBOX_CURSOR_FREQ = 2; -const float ITEM_EDITBOX_FLASHTIME = 0.1; -const float ITEM_EDITBOX_SCROLLDISTANCE = 1.5; diff --git a/scmenu/source/control/container.qc b/scmenu/source/control/container.qc deleted file mode 100644 index 1a1f19323..000000000 --- a/scmenu/source/control/container.qc +++ /dev/null @@ -1,7 +0,0 @@ -// DP/Nex Menu -// control/container.qc - -void() Item_Container_Spawn = -{ - self.flag = self.flag | FLAG_HIDDEN; -}; diff --git a/scmenu/source/control/custom.qc b/scmenu/source/control/custom.qc deleted file mode 100644 index 59ff1552f..000000000 --- a/scmenu/source/control/custom.qc +++ /dev/null @@ -1,22 +0,0 @@ -// DP/Nex Menu -// control/custom.qc - -//////////////// -// Item_Custom -/// -// TODO: Remove Item_Custom - No, it should be the only customizable item - -void() Item_Custom_Spawn = -{ - self._reinit = CtCall_Reinit; - self._destroy = CtCall_Destroy; - self._key = CtCall_Key; - self._draw = CtCall_Draw; - self._mouseEnter = CtCall_MouseEnter; - self._mouseLeave = CtCall_MouseLeave; - self._select = CtCall_Select; - self._update = CtCall_Update; - - CtCall_Init(); -}; - diff --git a/scmenu/source/control/data/altstring.qc b/scmenu/source/control/data/altstring.qc deleted file mode 100644 index 35d33610f..000000000 --- a/scmenu/source/control/data/altstring.qc +++ /dev/null @@ -1,25 +0,0 @@ -// DP/Nex Menu -// control/data/altstring.qc - -void( float pEvent ) Item_DataLink_AltString_DataEvent = -{ - Item_DataLink_Update(); - - if( !self._link ) - return; - if( pEvent == ITEM_DATALINK_SET ) { - self._link.value = Util_SetAltStringItem( self._link.value, self.stepValue, self.value ); - Raise_DataEvent( self._link, ITEM_DATALINK_SET ); - } else if( pEvent == ITEM_DATALINK_GET ) { - Raise_DataEvent( self._link, ITEM_DATALINK_GET ); - String_EntitySet( self, value, String_Normal( Util_GetAltStringItem( self._link.value, self.stepValue ) ) ); - } else - Raise_DataEvent( self._link, pEvent ); -}; - -void() Item_DataLink_AltString_Spawn = -{ - Item_DataLink_Init(); - - self._dataEvent = Item_DataLink_AltString_DataEvent; -}; diff --git a/scmenu/source/control/data/base.qc b/scmenu/source/control/data/base.qc deleted file mode 100644 index 7d52a5973..000000000 --- a/scmenu/source/control/data/base.qc +++ /dev/null @@ -1,224 +0,0 @@ -// DP/Nex Menu -// control/data/base.qc - -/* -=================== -Raise_DataEvent -=================== -*/ -void( entity pItem, float pEvent ) Raise_DataEvent = -{ - local entity lOld; - - if( !pItem._dataEvent ) - return; - - lOld = self; - self = pItem; - self._dataEvent( pEvent ); - self = lOld; -}; - -/* -=================== -Data_ExecString_BeginUse -=================== -*/ -void() Data_ExecString_BeginUse = -{ - Data_ExecString = String_Create(); -}; - -/* -=================== -Data_ExecString_EndUse -=================== -*/ -void() Data_ExecString_EndUse = -{ - String_Free( Data_ExecString); -}; - -///////////////////// -// [Item_Data] -/// - -/* -=================== -Item_Data_Destroy -=================== -*/ -void() Item_Data_Destroy = -{ - String_EntityFree( self, value ); - String_EntityFree( self, defValue ); - String_EntityFree( self, _syncValue ); -}; - -/* -=================== -Item_Data_Init -=================== -*/ -void() Item_Data_Init = -{ - String_EntityZone( self, value ); - String_EntityZone( self, defValue ); - String_EntityCreate( self, _syncValue ); - - self.flag = self.flag | FLAG_HIDDEN; - - self._destroy = Item_Data_Destroy; -}; - -//////////////////// -// [Item_DataLink] -/// - -/* -=================== -Item_DataLink_Update -=================== -*/ -void() Item_DataLink_Update = -{ - if( self.link == "" ) - self._link = null_entity; - else if( self.link != self._link.name ) - self._link = Menu_GetItem( self.link ); -}; - -/* -=================== -Item_DataLink_Destroy -=================== -*/ -void() Item_DataLink_Destroy = -{ - String_EntityFree( self, link ); - String_EntityFree( self, value ); -}; - -/* -=================== -Item_DataLink_Init -=================== -*/ -void() Item_DataLink_Init = -{ - self.flag = self.flag | FLAG_HIDDEN; - - String_EntityZone( self, link ); - String_EntityZone( self, value ); - Item_DataLink_Update(); - - self._destroy = Item_DataLink_Destroy; -}; - -//////////////////// -// [Item_DataLink_Switch] -/// - -/* -=================== -Item_DataLink_Switch_Destroy -=================== -*/ -void() Item_DataLink_Switch_Destroy = -{ - Item_DataLink_Destroy(); - String_EntityFree( self, descList ); -}; - -/* -=================== -Item_DataLink_Switch_Init -=================== -*/ -void() Item_DataLink_Switch_Init = -{ - Item_DataLink_Value_Spawn(); - String_EntityZone( self, descList ); - - self._destroy = Item_DataLink_Switch_Destroy; -}; - -/* -=================== -Item_GetOrdinal -=================== -*/ -float( entity pDataLink, float pValue ) DataLink_Switch_GetOrdinal = -{ - if( pDataLink.stepValue == 0.0 ) - return 0.0; - return (pValue - pDataLink.minValue) / pDataLink.stepValue; -}; - -//////////////////// -// [Item_DataUser] -/// - -/* -=================== -Item_DataUser_Update -=================== -*/ -void() Item_DataUser_Update = -{ - if( self.target == "" ) - self._target = null_entity; - else if( self.target != self._target.name ) - self._target = Menu_GetItem( self.target ); -}; - -/* -=================== -Item_DataUser_Destroy -=================== -*/ -void() Item_DataUser_Destroy = -{ - String_EntityFree( self, target ); -}; - -/* -=================== -Item_DataUser_Init -=================== -*/ -void() Item_DataUser_Init = -{ - String_EntityZone( self, target ); - - Item_DataUser_Update(); - - self._destroy = Item_DataUser_Destroy; -}; - -/* -=================== -Item_DataContainer_DataEvent -=================== -*/ -void( float pEvent ) Item_DataContainer_DataEvent = -{ - // no support for embedded stuff yet (isnt needed imho anyway) - local entity lItem; - - for( lItem = self._child ; lItem != null_entity ; lItem = lItem._next ) { - Raise_DataEvent( lItem, pEvent ); - } -}; - -/* -=================== -Item_DataContainer_Spawn -=================== -*/ -void() Item_DataContainer_Spawn = -{ - Item_Container_Spawn(); - - self._dataEvent = Item_DataContainer_DataEvent; -}; diff --git a/scmenu/source/control/data/container.qc b/scmenu/source/control/data/container.qc deleted file mode 100644 index 373be5584..000000000 --- a/scmenu/source/control/data/container.qc +++ /dev/null @@ -1,38 +0,0 @@ -// DP/Nex Menu -// control/data/container.qc - - -//////////////////////// -// Item_Data_Container -/// - -void() Item_Data_Container_Reinit = -{ - String_EntitySet( self, value, self._syncValue ); -}; - -void( float pEvent ) Item_Data_Container_DataEvent = -{ - switch( pEvent ) { - case ITEM_DATA_SYNC: - String_EntitySet( self, value, self._syncValue ); - break; - case ITEM_DATA_SEND: - String_EntitySet( self, _syncValue, self.value ); - break; - case ITEM_DATA_RESET: - String_EntitySet( self, value, self.defValue ); - String_EntitySet( self, _syncValue, self.defValue ); - break; - } -}; - -void() Item_Data_Container_Spawn = -{ - Item_Data_Init(); - - self._reinit = Item_Data_Container_Reinit; - self._dataEvent = Item_Data_Container_DataEvent; - - String_EntitySet( self, _syncValue, self.defValue ); -}; diff --git a/scmenu/source/control/data/cvar.qc b/scmenu/source/control/data/cvar.qc deleted file mode 100644 index 3a64acc40..000000000 --- a/scmenu/source/control/data/cvar.qc +++ /dev/null @@ -1,99 +0,0 @@ -// DP/Nex Menu -// control/data/cvar.qc - -/* -=================== -Item_Data_Cvar -=================== -*/ - -void() Item_Data_Cvar_Sync = -{ - String_EntitySet( self, _syncValue, cvar_string( self.cvarName ) ); - String_EntitySet( self, value, self._syncValue ); -}; - -void() Item_Data_Cvar_Send = -{ - cvar_set( self.cvarName, self.value ); - Item_Data_Cvar_Sync(); -}; - -void() Item_Data_Cvar_Reset = -{ - if( self.defValue ) { - String_EntitySet( self, value, self.defValue ); - } else { - String_EntitySet( self, value, cvar_defstring( self.cvarName ) ); - } - Item_Data_Cvar_Send(); -}; - -void() Item_Data_Cvar_Test_Start = -{ - cvar_set( self.cvarName, self.value ); -}; - -void() Item_Data_Cvar_Test_End = -{ - cvar_set( self.cvarName, self._syncValue ); -}; - -void() Item_Data_Cvar_Save_ExecString = { - Data_ExecString = String_Append( Data_ExecString, strcat( "set \"", self.cvarName, "\" \"", self.value, "\"\n" ) ); -}; - -void( float pEvent ) Item_Data_Cvar_DataEvent = -{ - switch( pEvent ) { - case ITEM_DATA_SYNC: - Item_Data_Cvar_Sync(); - break; - case ITEM_DATA_SEND: - Item_Data_Cvar_Send(); - break; - case ITEM_DATA_RESET: - Item_Data_Cvar_Reset(); - break; - case ITEM_DATA_TEST_START: - Item_Data_Cvar_Test_Start(); - break; - case ITEM_DATA_TEST_END: - Item_Data_Cvar_Test_End(); - break; - case ITEM_DATA_SAVE_EXECSTRING: - Item_Data_Cvar_Save_ExecString(); - break; - } -}; - -void() Item_Data_Cvar_Destroy = -{ - Item_Data_Destroy(); - String_EntityFree( self, cvarName ); -}; - -void() Item_Data_Cvar_Spawn = -{ - String_EntityZone( self, cvarName ); - Item_Data_Init(); - - self.flag = self.flag | FLAG_HIDDEN; - - self._dataEvent = Item_Data_Cvar_DataEvent; - self._reinit = Item_Data_Cvar_Sync; - self._destroy = Item_Data_Cvar_Destroy; -}; - -/* -=================== -Item_Data_CvarCreateSave -=================== -*/ - -void() Item_Data_CvarCreateSave_Spawn = -{ - Item_Data_Cvar_Spawn(); - - registercvar( self.cvarName, self.defValue, CVAR_SAVE ); -}; diff --git a/scmenu/source/control/data/data.qh b/scmenu/source/control/data/data.qh deleted file mode 100644 index 7d3ed4104..000000000 --- a/scmenu/source/control/data/data.qh +++ /dev/null @@ -1,137 +0,0 @@ -// DP/Nex Menu -// control/data/data.qh - -enum { - ITEM_DATA_SYNC, // sync with the engine or whatever else this is linked to - ITEM_DATA_SEND, // set it - ITEM_DATA_RESET, // use the default value - ITEM_DATA_TEST_START, // set it but dont sync our backup - ITEM_DATA_TEST_END, // set our backup - ITEM_DATA_SAVE_EXECSTRING, // stroes the value and the name in such a way in a string that executing it will restore the value and the state (if possible) - ITEM_DATALINK_SET, - ITEM_DATALINK_GET -}; - -void( entity pItem, float pEvent ) Raise_DataEvent; - -// ExecString used to store the data for the ITEM_DATA_SAVE_EXECSTRING event -string Data_ExecString; -void() Data_ExecString_BeginUse; -void() Data_ExecString_EndUse; - -// [Item_Data] -.string value; // current value in the menu -.string defValue; // default value (set for the menu) -.string _syncValue; // last value that is known from the real source - -.void( float pEvent ) _dataEvent; - -void() Item_Data_Init; -void() Item_Data_Destroy; - -// [Item_DataUser] -// In this case the target field points to a Item_Data* item -.string target; -.entity _target; - -void() Item_DataUser_Update; -void() Item_DataUser_Init; -void() Item_DataUser_Destroy; - -// [Item_DataLink] -// links to a [Item_Data] object -.string link; -.entity _link; -.string value; - -.void( float pEvent ) _dataEvent; - -void() Item_DataLink_Init; -void() Item_DataLink_Destroy; -void() Item_DataLink_Update; - -// Item_DataContainer [Item_Container] [implements the DATA events] -void( float pEvent ) Item_DataContainer_DataEvent; -void() Item_DataContainer_Spawn; - -// Item_Data_Container [Item_Data] -void() Item_Data_Container_Reinit; -void( float pEvent ) Item_Data_Container_DataEvent; - -void() Item_Data_Container_Spawn; - -// Item_Data_Cvar [Item_Data] -.string cvarName; - -void( float pEvent ) Item_Data_Cvar_DataEvent; -void() Item_Data_Cvar_Spawn; - -// Item_Data_CvarCreateSave Item_Data_Cvar -void() Item_Data_CvarCreateSave_Spawn; - -// Item_DataLink_Text [Item_DataLink] -.float maxValue; // max length of the string (-1 for infinity) -.string value; // text - -// Item_DataLink_Value [Item_DataLink] -// if maxValue <= minValue there is no max value clamping -.float minValue; -.float stepValue; -.float maxValue; -.float _realValue; - -.string value; // read-only is most cases, but supplies are version of the data that can be displayed - -void() Item_DataLink_Value_Clamp; -void() Item_DataLink_Value_Spawn; - -// [Item_DataLink_Switch] Item_DataLink_Value -.string descList; // a altstring containing description strings - -void() Item_DataLink_Switch_Init; -void() Item_DataLink_Switch_Destroy; - -float( entity pDataLink, float pValue ) DataLink_Switch_GetOrdinal; - -// Item_DataLink_ValueSwitch [Item_DataLink_Switch] -// to add support for a case when there is no value list match, add one more entry to desc list -// describing the case (i.g. 'Custom'), if you dont it will set the first desc/value entry as default -// the default value for stepValue is 1 -// maxValue is calculated if it is 0 - -void() Item_DataLink_ValueSwitch_Spawn; - -// Item_DataLink_TextSwitch [Item_DataLink_Switch] -// if you want a s -// minValue is 0, stepValue is 1, maxValue is the number of items in descList/valueList -.string valueList; // contains the values for the different - -void( float pEvent ) Item_DataLink_TextSwitch_DataEvent; -void() Item_DataLink_TextSwitch_Destroy; -void() Item_DataLink_TextSwitch_Spawn; - -// Item_DataLink_FastResync [Item_DataLink] -// "Fast" in the sense of total performance - the data is resynced -// at most once per frame -.float _presstime; // no more than once a frame? - -void() Item_DataLink_FastResync_Spawn; - -// Item_DataLink_TextValue [Item_DataLink] -// self: [string] -> link: [float] -void() Item_DataLink_TextValue_Spawn; - -// Item_DataLink_TextTime [Item_DataLink] -// self: [string] -> link: [float] -// hour:min:sec -void() Item_DataLink_TextTime_Spawn; - -// Item_DataLink_AltString [Item_DataLink] -// self: [string] -> link: [altstring item] -.float stepValue; // contains the index into link.value - -void() Item_DataLink_AltString_Spawn; - -// Item_DataLink_Splitter [Item_DataLink] -// sets value and _realValue of all children to the float value of self._realValue -void() Item_DataLink_Splitter_Spawn; diff --git a/scmenu/source/control/data/fastresync.qc b/scmenu/source/control/data/fastresync.qc deleted file mode 100644 index e4aaf2587..000000000 --- a/scmenu/source/control/data/fastresync.qc +++ /dev/null @@ -1,35 +0,0 @@ -// DP/Nex Menu -// control/data/fastresync.qc - -///////////////////////////// -// Item_DataLink_FastResync -//// - -void( float pEvent ) Item_DataLink_FastResync_DataEvent = -{ - if( pEvent == ITEM_DATALINK_GET ) { - if( self._presstime != Timer_Time ) { - Raise_DataEvent( self._link, ITEM_DATA_SYNC ); - self._presstime = Timer_Time; - } - Raise_DataEvent( self._link, ITEM_DATALINK_GET ); - String_EntitySet( self, value, self._link.value ); - self._realValue = self._link._realValue; - } else if( pEvent == ITEM_DATALINK_SET ) { - if( self._link ) { - String_EntitySet( self._link, value, self.value ); - self._link._realValue = self._realValue; - Raise_DataEvent( self._link, ITEM_DATALINK_SET ); - } - } else - Raise_DataEvent( self._link, pEvent ); -}; - -void() Item_DataLink_FastResync_Spawn = -{ - Item_DataLink_Init(); - - self._presstime = Timer_Time - 1; - - self._dataEvent = Item_DataLink_FastResync_DataEvent; -}; diff --git a/scmenu/source/control/data/router.qc b/scmenu/source/control/data/router.qc deleted file mode 100644 index 67174048f..000000000 --- a/scmenu/source/control/data/router.qc +++ /dev/null @@ -1,32 +0,0 @@ -// DP/Nex Menu -// control/data/router.qc - -void( float pEvent ) Item_DataLink_Splitter_DataEvent = -{ - local entity lChild; - - switch( pEvent ) { - case ITEM_DATALINK_SET: - for( lChild = self._child ; lChild ; lChild = lChild._next ) { - lChild._realValue = self._realValue; - Raise_DataEvent( lChild, ITEM_DATALINK_SET ); - } - case ITEM_DATALINK_GET: - if( self._child ) { - Raise_DataEvent( self._child, ITEM_DATALINK_GET ); - self._realValue = self._child._realValue; - } - break; - default: - for( lChild = self._child ; lChild ; lChild = lChild._next ) - Raise_DataEvent( lChild, pEvent ); - break; - } -}; - -void() Item_DataLink_Splitter_Spawn = -{ - Item_DataLink_Init(); - - self._dataEvent = Item_DataLink_Splitter_DataEvent; -}; diff --git a/scmenu/source/control/data/text.qc b/scmenu/source/control/data/text.qc deleted file mode 100644 index 7cbb32af5..000000000 --- a/scmenu/source/control/data/text.qc +++ /dev/null @@ -1,32 +0,0 @@ -// DP/Nex Menu -// control/data/text.qc - -void( float pEvent ) Item_DataLink_Text_DataEvent = -{ - Item_DataLink_Update(); - - if( pEvent == ITEM_DATALINK_SET ) { - if( self.maxValue >= 0 ) - String_EntitySet( self, value, substring( self.value, 0, self.maxValue ) ); - if( self._link ) { - String_EntitySet( self._link, value, self.value ); - Raise_DataEvent( self._link, ITEM_DATALINK_SET ); - } - } else if( !self._link ) - return; - else if( pEvent == ITEM_DATALINK_GET ) { - String_EntitySet( self, value, self._link.value ); - if( self.maxValue >= 0 ) { - Raise_DataEvent( self._link, ITEM_DATALINK_GET ); - String_EntitySet( self, value, substring( self.value, 0, self.maxValue ) ); - } - } else - Raise_DataEvent( self._link, pEvent ); -}; - -void() Item_DataLink_Text_Spawn = -{ - Item_DataLink_Init(); - - self._dataEvent = Item_DataLink_Text_DataEvent; -}; diff --git a/scmenu/source/control/data/textswitch.qc b/scmenu/source/control/data/textswitch.qc deleted file mode 100644 index f317a25fa..000000000 --- a/scmenu/source/control/data/textswitch.qc +++ /dev/null @@ -1,70 +0,0 @@ -// DP/Nex Menu -// control/data/textswitch.qc - - -void( float pEvent ) Item_DataLink_TextSwitch_DataEvent = -{ - Item_DataLink_Update(); - - if( pEvent == ITEM_DATALINK_SET ) { - Item_DataLink_Value_Clamp(); - if( self._link ) { - String_EntitySet( self._link, value, String_Normal( Util_GetAltStringItem( self.valueList, self._realValue ) ) ); - Raise_DataEvent( self._link, ITEM_DATALINK_SET ); - } - } else if( !self._link ) - return; - else if( pEvent == ITEM_DATALINK_GET ) { - local float lPos, lCount; - // sync _link.value - Raise_DataEvent( self._link, ITEM_DATALINK_GET ); - - // check if we need a full resync - // TODO: Remove this check since we actually dont want to support twice-defined entries - if( String_Normal( Util_GetAltStringItem( self.valueList, self._realValue ) ) == self._link.value ) { - String_EntitySet( self, value, String_Normal( Util_GetAltStringItem( self.descList, self._realValue ) ) ); - return; - } - - // resync _link.value - lCount = Util_GetAltStringCount( self.valueList ); - for( lPos = 0 ; lPos < lCount ; ++lPos ) - if( String_Normal( Util_GetAltStringItem( self.valueList, lPos ) ) == self._link.value ) - break; - - if( lPos > lCount ) { - // if there is no match test for a custom entry - if( Util_GetAltStringCount( self.descList ) > lCount ) { - lPos++; - } else { - lPos = 0; - } - } - self._realValue = lPos; - String_EntitySet( self, value, String_Normal( Util_GetAltStringItem( self.descList, lPos ) ) ); - } else - Raise_DataEvent( self._link, pEvent ); -}; - -void() Item_DataLink_TextSwitch_Destroy = -{ - String_EntityFree( self, valueList ); - Item_DataLink_Switch_Destroy(); -}; - -void() Item_DataLink_TextSwitch_Spawn = -{ - Item_DataLink_Switch_Init(); - String_EntityZone( self, valueList ); - - self.minValue = 0.0; - if( self.maxValue == 0.0 ) - self.maxValue = Util_GetAltStringCount( self.valueList ) - 1; - if( self.maxValue == 0.0 ) - self.stepValue = 0.0; - else - self.stepValue = 1.0; - - self._destroy = Item_DataLink_TextSwitch_Destroy; - self._dataEvent = Item_DataLink_TextSwitch_DataEvent; -}; diff --git a/scmenu/source/control/data/texttime.qc b/scmenu/source/control/data/texttime.qc deleted file mode 100644 index 5b15dcf8f..000000000 --- a/scmenu/source/control/data/texttime.qc +++ /dev/null @@ -1,74 +0,0 @@ -// DP/Nex Menu -// control/data/texttime.qc - -float() _IDLTT_ConvertTime = -{ - local float lTotal; - local float lCurrent; - local float lCount, lCounter; - - lTotal = 0; - - lCount = tokenize( self.value ); - for( lCounter = 0; lCounter < lCount; ++lCounter ) { - lCurrent = stof( argv( lCounter ) ); - lTotal = lTotal * 60 + lCurrent; - - if( argv( ++lCounter ) != ":" ) - break; - } - return rint( lTotal ); -}; - -string() _IDLTT_MakeString = -{ - local string lString; - local float lTotal; - local float lCurrent; - - lTotal = rint( self._realValue ); - lString = ""; - do { - lCurrent = mod( lTotal, 60 ); - - if( lString == "" ) - lString = String_Zone( ftos( lCurrent ) ); - else - lString = String_Set( lString, strcat( ftos( lCurrent ), ":", lString ) ); - - lTotal = floor( lTotal / 60 ); - } while( lTotal ); - - return lString; -}; - -void( float pEvent ) Item_DataLink_TextTime_DataEvent = -{ - Item_DataLink_Update(); - - if( pEvent == ITEM_DATALINK_SET ) { - self._link._realValue = _IDLTT_ConvertTime(); - Raise_DataEvent( self._link, ITEM_DATALINK_SET ); - self._realValue = self._link._realValue; - } else if( !self._link ) - return; - else if( pEvent == ITEM_DATALINK_GET ) { - Raise_DataEvent( self._link, ITEM_DATALINK_GET ); - if( self._link._realValue != self._realValue ) { - self._realValue = self._link._realValue; - String_EntitySet( self, value, String_Normal( _IDLTT_MakeString() ) ); - } - } else { - Raise_DataEvent( self._link, pEvent ); - self._realValue = self._link._realValue; - String_EntitySet( self, value, String_Normal( _IDLTT_MakeString() ) ); - } -}; - -void() Item_DataLink_TextTime_Spawn = -{ - Item_DataLink_Init(); - - self._dataEvent = Item_DataLink_TextTime_DataEvent; - self._realValue = self._link.minValue - 1; -}; diff --git a/scmenu/source/control/data/textvalue.qc b/scmenu/source/control/data/textvalue.qc deleted file mode 100644 index 921ea837a..000000000 --- a/scmenu/source/control/data/textvalue.qc +++ /dev/null @@ -1,33 +0,0 @@ -// DP/Nex Menu -// control/data/textvalue.qc - -void( float pEvent ) Item_DataLink_TextValue_DataEvent = -{ - Item_DataLink_Update(); - - if( pEvent == ITEM_DATALINK_SET ) { - self._link._realValue = stof( self.value ); - Raise_DataEvent( self._link, ITEM_DATALINK_SET ); - self._realValue = self._link._realValue; - } else if( !self._link ) - return; - else if( pEvent == ITEM_DATALINK_GET ) { - Raise_DataEvent( self._link, ITEM_DATALINK_GET ); - if( self._link._realValue != self._realValue ) { - self._realValue = self._link._realValue; - String_EntitySet( self, value, self._link.value ); - } - } else { - Raise_DataEvent( self._link, pEvent ); - self._realValue = self._link._realValue; - String_EntitySet( self, value, self._link.value ); - } -}; - -void() Item_DataLink_TextValue_Spawn = -{ - Item_DataLink_Init(); - - self._dataEvent = Item_DataLink_TextValue_DataEvent; - self._realValue = self._link.minValue - 1; -}; diff --git a/scmenu/source/control/data/value.qc b/scmenu/source/control/data/value.qc deleted file mode 100644 index 22096ee41..000000000 --- a/scmenu/source/control/data/value.qc +++ /dev/null @@ -1,82 +0,0 @@ -// DP/Nex Menu -// control/data/value.qc - -/* -=================== -Item_DataLink_Value_Clamp -=================== -*/ -void() Item_DataLink_Value_Clamp = -{ - if( self._realValue > self.maxValue && self.maxValue > self.minValue ) - self._realValue = self.maxValue; - else if( self._realValue < self.minValue ) - self._realValue = self.minValue; - else // clamp it to(?) stepValue - self._realValue = self.minValue + self.stepValue * rint( ( self._realValue - self.minValue ) / self.stepValue ); -}; - -/* -=================== -Item_DataLink_ClampText -=================== -*/ -string() Item_DataLink_ClampedValue = -{ - local float lLen; - local float lClampedStep; - local float lInverseClamped; - lClampedStep = self.stepValue - floor( self.stepValue ); - if( lClampedStep == 0.0 ) - return ftos( self._realValue ); - // get the integer length - lLen = strlen( ftos( floor( self._realValue ) ) ); - // Example data: 0.1 -> 10 - 1 = 9; 0.9 -> 1.^1 - 0.1 = 1.0^1 ; 0.01 -> 100 - 1 = 99 ; 0.09 -> 11.^1 - 0.1 = 10.0^1 - lInverseClamped = 1.0 / lClampedStep - 0.1; - // add the fraction length and 1 for the . - lLen += strlen( ftos( floor( lInverseClamped ) ) ) + 1; - return substring( ftos( self._realValue + 0.0001 ), 0, lLen ); -} - -/* -=================== -Item_DataLink_Value_DataEvent -=================== -*/ -void( float pEvent ) Item_DataLink_Value_DataEvent = -{ - Item_DataLink_Update(); - - if( pEvent == ITEM_DATALINK_SET ) { - Item_DataLink_Value_Clamp(); - if( self._link ) { - self._link._realValue = self._realValue; - String_EntitySet( self._link, value, ftos( self._realValue ) ); - Raise_DataEvent( self._link, ITEM_DATALINK_SET ); - } - } else if( !self._link ) - return; - else if( pEvent == ITEM_DATALINK_GET ) { - Raise_DataEvent( self._link, ITEM_DATALINK_GET ); - self._realValue = stof( self._link.value ); - String_EntitySet( self, value, Item_DataLink_ClampedValue() ); - Item_DataLink_Value_Clamp(); - } else - Raise_DataEvent( self._link, pEvent ); -}; - -/* -=================== -Item_DataLink_Value_Spawn -=================== -*/ -void() Item_DataLink_Value_Spawn = -{ - Item_DataLink_Init(); - - if( self.stepValue == 0.0 ) - self.stepValue = 1; - - self._dataEvent = Item_DataLink_Value_DataEvent; -}; - diff --git a/scmenu/source/control/data/valueswitch.qc b/scmenu/source/control/data/valueswitch.qc deleted file mode 100644 index 5b894c8a8..000000000 --- a/scmenu/source/control/data/valueswitch.qc +++ /dev/null @@ -1,59 +0,0 @@ -// DP/Nex Menu -// control/data/valueswitch.qc - -/* -=================== -Item_DataLink_ValueSwitch_DataEvent -=================== -*/ -void( float pEvent ) Item_DataLink_ValueSwitch_DataEvent = -{ - Item_DataLink_Update(); - - if( pEvent == ITEM_DATALINK_SET ) { - Item_DataLink_Value_Clamp(); - if( self._link ) { - self._link._realValue = self._realValue; - String_EntitySet( self._link, value, ftos( self._realValue ) ); - Raise_DataEvent( self._link, ITEM_DATALINK_SET ); - } - } else if( !self._link ) - return; - else if( pEvent == ITEM_DATALINK_GET ) { - local float lPos; - - Raise_DataEvent( self._link, ITEM_DATALINK_GET ); - - self._realValue = stof( self._link.value ); - Item_DataLink_Value_Clamp(); - - lPos = rint( (self._realValue - self.minValue) / self.stepValue ); - String_EntitySet( self, value, String_Normal( Util_GetAltStringItem( self.descList, lPos ) ) ); - } else - Raise_DataEvent( self._link, pEvent ); -}; - -/* -=================== -Item_DataLink_ValueSwitch_Spawn -=================== -*/ -void() Item_DataLink_ValueSwitch_Spawn = -{ - Item_DataLink_Switch_Init(); - - if( self.maxValue == 0.0 ) - self.maxValue = self.minValue + (Util_GetAltStringCount( self.descList ) - 1) * self.stepValue; - else { - local float lCount; - - lCount = Util_GetAltStringCount( self.descList ); - if( lCount ) - self.stepValue = (self.maxValue - self.minValue ) / (lCount - 1); - else - self.stepValue = 0; - } - - self._dataEvent = Item_DataLink_ValueSwitch_DataEvent; - self._destroy = Item_DataLink_Switch_Destroy; -}; diff --git a/scmenu/source/control/fx/base.qc b/scmenu/source/control/fx/base.qc deleted file mode 100644 index 56cafa905..000000000 --- a/scmenu/source/control/fx/base.qc +++ /dev/null @@ -1,69 +0,0 @@ -// DP/Nex Menu -// control/fx/base.qc - -///////////////////// -// [Item_Fx_Mutator] -/// - -bool() Item_Fx_Mutator_IsActive = -{ - if( self._parent.time_z >= 0 ) // < 0 stopped - self.time_z = (self._parent.time_z - self.time_y) / self.time_x; - else - self.time_z = -1; - if( self.time_z > 0 ) - return true; - return false; -}; - -void() Item_Fx_Mutator_UpdateTarget = -{ - if( !self.target ) - self._target = self._parent._target; - else if( self.target != self._target.name ) - self._target = Menu_GetItemEx( self._parent._target.parent, self.target, true ); -}; - -void() Item_Fx_Mutator_Destroy = -{ - String_EntityFree( self, target ); -}; - -void() Item_Fx_Mutator_Init = -{ - String_EntityZone( self, target ); - - self._destroy = Item_Fx_Destroy; -}; - - -////////////////// -// Item_Effect -//// - -void() Item_Fx_Effect_Update = -{ - if( !self.target ) { - self._target = null_entity; - self.time_z = -1; - return; - } - - if( self.target != self._target.name ) - self._target = Menu_GetItem( self._target ); - if( self.time_y <= Timer_Time && self.time_y + self.time_x <= Timer_Time ) - self.time_z = (Timer_Time - self.time_y) / self.time_x; - else - self.time_z = -1; -}; - -void() Item_Fx_Effect_Spawn = -{ - Item_Fx_Init(); - - self.time_y = -1; - - self.flag = self.flag | FLAG_HIDDEN; - - self._update = Item_Fx_Effect_Update; -}; diff --git a/scmenu/source/control/fx/fx.qh b/scmenu/source/control/fx/fx.qh deleted file mode 100644 index 9dbf0ab02..000000000 --- a/scmenu/source/control/fx/fx.qh +++ /dev/null @@ -1,21 +0,0 @@ -// DP/Nex Menu -// control/fx/fx.qh - -// Note: the time components are arranged this way because I want to be able to nest effects -// [Item_Fx_Mutator] -.vector time; // all values from 0 to 1, so the parent can vary in its length -.string target; -.entity _target; - -bool() Item_Fx_Mutator_IsActive; -void() Item_Fx_Destroy; -void() Item_Fx_Init; -void() Item_UpdateTarget; - -// Item_Fx_Effect [Item_Fx_Mutator] - -void() Item_Fx_Effect_Update; -void() Item_Fx_Effect_Spawn; - -// Item_Fx_Effect_Control - diff --git a/scmenu/source/control/items.qh b/scmenu/source/control/items.qh deleted file mode 100644 index 1fc3c4842..000000000 --- a/scmenu/source/control/items.qh +++ /dev/null @@ -1,99 +0,0 @@ -// DP/Nex Menu -// control/items.qh - -/* -Items/Controls: - -This control is supported/required by the menu manager : -Item_Window -Item_Reference - -Item_Layout - -The rest is not required: -Item_Custom - -Item_Picture - -Item_Text - -Item_Rect - -ITEM_BUTTON -ITEM_TEXTBUTTON - - - -ITEM_SLIDER - -ITEM_TEXTSWITCH -*/ - -// INFO: some information about the spawn functions -// INFO: Since I dont want another namespace clutching all spawn functions will have a nice and neat -// INFO: "_Spawn" suffix. - -// item constants - -const float ITEM_ALIGN_LEFT = 0; -enumflags { - ITEM_ALIGN_CENTER, - ITEM_ALIGN_RIGHT, - ITEM_ALIGN_FIX_RIGHT, // |text - actually this isnt necessary - ITEM_ALIGN_FIX_CENTER, // te|xt - ITEM_ALIGN_FIX_LEFT, // text| - ITEM_ALIGN_FIRST // for layouts: Item| ... with | being the origin -}; - -// flags constant - -enumflags { - FLAG_TEMPLATE, // this is a template do not touch, do not draw - actually dont do anything with it - FLAG_EMBEDDED, // the item cant be selected and all its children are embedded into its parent - FLAG_HIDDEN, // events wont be called and it wont be drawn, etc. - FLAG_NOSELECT, // cant be selected (but events will be called) - FLAG_CONNECTEDONLY, // only if connected (i.e. playing) - FLAG_SERVERONLY, // only displayed if server - FLAG_DEVELOPERONLY, // only displayed if developer - FLAG_DRAWONLY, // only the draw event will be called - FLAG_CHILDDRAWONLY, // used to make the children only drawable - FLAG_DRAWUPDATEONLY, // only the draw and update event get called - FLAG_CHILDDRAWUPDATEONLY, // only the draw and refresh events are called for children - FLAG_SEALOFFMOUSE // used to seal all items under the item with this flag off from mouse events - // TODO: real seal off all events (not only items not being selected) -}; - -// [Item_Link] [Item} -.entity _link; // item link - -void() Item_Link_Init; -void() Item_Link_Destroy; -void() Item_Link_Update; -bool( float pKey, float pAscii ) Item_Link_Key; -void() Item_Link_MouseEnter; - -bool() Item_Link_IsSelected; - -// [Item_Cinematic] -.string link; // full name of the video -.string normal; // normal name used with cachepic - -void() Item_Cinematic_Destroy; -void() Item_Cinematic_Init; - -// Item_Cinematic_Loop [Item_Cinematic] -void() Item_Cinematic_Loop_Spawn; - -// Item_Container -// used for non-visible, non-selectable data -void() Item_Container_Spawn; - -// Parser_Define -.string name; -.string value; - -/* -// ITEM_EDITBOX (derived from ITEM_TEXT mostly) -.string format; // //wildcards are * for each letter except the next after it - \* for * and * / space ' ' for one letter e.g. " . . . " for an ip field -.float maxlen; // -1 for infinite -.float _cursorpos;*/ diff --git a/scmenu/source/control/link.qc b/scmenu/source/control/link.qc deleted file mode 100644 index 05d68e126..000000000 --- a/scmenu/source/control/link.qc +++ /dev/null @@ -1,63 +0,0 @@ -// DP/Nex Menu -// control/link.qc - -//////////////// -// [Item_Link] -/// - -/* -The Link is only established if self.link is valid. -If it is valid, the item is made no selectable since the link should be selectable -*/ - -void() Item_Link_Update = -{ - if( self.link == "" ) - self._link = null_entity; - else if( self.link != self._link.name ) { - self._link = Menu_GetItem( self.link ); - self.flag = self.flag | FLAG_NOSELECT; - } -}; - -bool( float pKey, float pAscii ) Item_Link_Key = -{ - if( self._link ) - return Raise_Key( self._link, pKey, pAscii ); - - return false; -}; - -void() Item_Link_MouseEnter = -{ - if( self._link && Menu_IsSelectable( self._link ) ) - Menu_Select( self._link, true ); -}; - -bool() Item_Link_IsSelected = -{ - if( Menu_ActiveItem == self ) - return true; - - if( self._link ) - return (Menu_ActiveItem == self._link); - else - return false; -}; - -void() Item_Link_Destroy = -{ - String_EntityFree( self, link ); -}; - -void() Item_Link_Init = -{ - String_EntityZone( self, link ); - - Item_Link_Update(); - - self._destroy = Item_Link_Destroy; - self._key = Item_Link_Key; - self._mouseEnter = Item_Link_MouseEnter; - self._update = Item_Link_MouseEnter; -}; diff --git a/scmenu/source/control/visual/button.qc b/scmenu/source/control/visual/button.qc deleted file mode 100644 index 3dfd53c87..000000000 --- a/scmenu/source/control/visual/button.qc +++ /dev/null @@ -1,190 +0,0 @@ -// DP/Nex Menu -// control/visual/button.qc - -//////////////// -// Item_Button -/// - -bool( string pString ) _IB_IsPicture = -{ - return (substring( pString, 0, 1 ) == "$" ); -}; - -string( string pString ) _IB_GetPath = -{ - return substring( pString, 1, 1000 ); -}; - -// pString should be strzoned -vector( string pString ) _IB_GetSize = -{ - local vector lSize; - if( _IB_IsPicture( pString ) ) - return Gfx_GetImageSize( _IB_GetPath( pString ) ); - - lSize_x = strlen( pString ) * self.fontSize_x; - lSize_y = self.fontSize_y; - lSize_z = 0; - - return lSize; -}; - -vector() _IB_GetMaxSize = -{ - local vector lNormal, lSelected, lPressed, lSize; - - lNormal = _IB_GetSize( self.normal ); - lSelected = _IB_GetSize( self.selected ); - lPressed = _IB_GetSize( self.pressed ); - - lSize_x = max( lNormal_x, lSelected_x, lPressed_x ); - lSize_y = max( lNormal_y, lSelected_y, lPressed_y ); - lSize_z = 0; - - return lSize; -}; - -void( string pName, vector pColor, float pAlpha, float pDrawFlag ) _IB_Draw = -{ - local vector lSize; - local vector lPos; - local vector lMaxSize; - - // Calculate the real size of the current state - lSize = _IB_GetSize( pName ); - lMaxSize = _IB_GetMaxSize(); - if( _IB_IsPicture( pName ) ) { - lSize_x = lSize_x * ( self.size_x / lMaxSize_x ); - lSize_y = lSize_y * ( self.size_y / lMaxSize_y ); - } - - // Get the position - it depends on the alignment - //if( self.alignment == ITEM_ALIGN_LEFT ) // do nothing - lPos_y = self.pos_y; - if( self.alignment == ITEM_ALIGN_LEFT ) - lPos_x = self.pos_x; - if( self.alignment == ITEM_ALIGN_CENTER ) - lPos_x = self.pos_x + (self.size_x - lSize_x ) / 2; - else if( self.alignment == ITEM_ALIGN_RIGHT ) - lPos_x = self.pos_x + self.size_x - lSize_x; - else - lPos_x = self.pos_x; - - if( _IB_IsPicture( pName ) ) - Menu_DrawPicture( lPos, _IB_GetPath( pName ), lSize, pColor, pAlpha, pDrawFlag ); - else - Menu_DrawString( lPos, pName, self.fontSize, pColor, pAlpha, pDrawFlag ); -}; - -void() Item_Button_Draw = -{ - local string lText; - - if( self._state == ITEM_STATE_NORMAL ) - _IB_Draw( self.normal, self.color, self.alphas_x, self.drawFlags_x ); - else if( self._state == ITEM_STATE_SELECTED ) { - if( self.selected ) - lText = self.selected; - else - lText = self.normal; - _IB_Draw( lText, self.colorSelected, self.alphas_y, self.drawFlags_y ); - } else if( self._state == ITEM_STATE_PRESSED ) { - if( self.pressed ) - lText = self.pressed; - else if( self.selected ) - lText = self.selected; - else - lText = self.normal; - _IB_Draw( lText, self.colorPressed, self.alphas_z, self.drawFlags_z ); - } -}; - -void() _IB_Calc = -{ - if( self.size == '0 0 0' ) - self.size = _IB_GetMaxSize(); -}; - -void() Item_Button_Update = -{ - Item_Link_Update(); - - _IB_Calc(); - - if( self._presstime + ITEM_BUTTON_ACTIONTIME > Timer_Time ) - self._state = ITEM_STATE_PRESSED; - else if( Item_Link_IsSelected() ) - self._state = ITEM_STATE_SELECTED; - else - self._state = ITEM_STATE_NORMAL; -}; - -void( bool pSelect, bool pUser ) Item_Button_Select = -{ - if( pSelect && pUser ) - Sound_Play( self.soundSelected ); -}; - -bool( float pKey, float pAscii ) Item_Button_Key = -{ - if( Item_Link_Key( pKey, pAscii ) ) - return true; - - if( pKey == K_SPACE || pKey == K_ENTER || pKey == K_MOUSE1 ) { - Sound_Play( self.soundPressed ); - self._presstime = Timer_Time; - - CtCall_Action(); - return true; - } - return false; -}; - -void() Item_Button_Destroy = -{ - CtCall_Destroy(); - - String_EntityFree( self, normal ); - String_EntityFree( self, selected ); - String_EntityFree( self, pressed ); - String_EntityFree( self, soundSelected ); - String_EntityFree( self, soundPressed ); - - Item_Link_Destroy(); -}; - -void() Item_Button_Spawn = -{ - self._presstime = Timer_Time - 1 - ITEM_BUTTON_ACTIONTIME; - - // zone all the strings - String_EntityZone( self, normal ); - String_EntityZone( self, selected ); - String_EntityZone( self, pressed ); - String_EntityZone( self, soundSelected ); - String_EntityZone( self, soundPressed ); - - Item_Link_Init(); - - // set the defaults, etc - if( _IB_IsPicture( self.normal ) ) - Gfx_Precache( _IB_GetPath( self.normal ) ); - if( _IB_IsPicture( self.selected ) ) - Gfx_Precache( _IB_GetPath( self.selected ) ); - if( _IB_IsPicture( self.pressed ) ) - Gfx_Precache( _IB_GetPath( self.pressed ) ); - - Sound_Precache( self.soundSelected ); - Sound_Precache( self.soundPressed ); - - _IB_Calc(); - - self._reinit = CtCall_Reinit; - self._destroy = Item_Button_Destroy; - self._key = Item_Button_Key; - self._draw = Item_Button_Draw; - self._select = Item_Button_Select; - self._update = Item_Button_Update; - - CtCall_Init(); -}; diff --git a/scmenu/source/control/visual/editbox.qc b/scmenu/source/control/visual/editbox.qc deleted file mode 100644 index 7fdcaafa3..000000000 --- a/scmenu/source/control/visual/editbox.qc +++ /dev/null @@ -1,189 +0,0 @@ -// DP/Nex Menu -// control/visual/editbox.qc - -///////////////// -// Item_EditBox -/// - -void() Item_EditBox_Draw = -{ - local vector lCursor; - local float lAlpha; - - if( !self._target ) - return; - - Raise_DataEvent( self._target, ITEM_DATALINK_GET ); - - if( self._state == ITEM_STATE_NORMAL ) { - Menu_DrawString( self.pos + self.origin, self._target.value, self.fontSize, self.color, self.alphas_x, self.drawFlags_x ); - return; - } - - lCursor_x = self._cursorPos * self.fontSize_x; - lCursor_y = self.fontSize_y; - - if( mod( Timer_Time * 1000, 1000 / ITEM_EDITBOX_CURSOR_FREQ ) > 500 / ITEM_EDITBOX_CURSOR_FREQ ) - lAlpha = 1; - else - lAlpha = 0; - //lAlpha = 1.2 - fabs( 1 + floor( Timer_Time * ITEM_EDITBOX_CURSOR_FREQ / 2 ) * 2 - Timer_Time * ITEM_EDITBOX_CURSOR_FREQ ); - - if( self._state == ITEM_STATE_SELECTED ) { - lCursor_y = lCursor_y - self.sizeCursor_y; - Menu_DrawString( self.pos + self.origin, self._target.value, self.fontSize, self.colorSelected, self.alphas_y, self.drawFlags_y ); - Menu_Fill( self.pos + self.origin + lCursor, self.sizeCursor, self.colorCursor, self.alphasCursor_x * lAlpha, self.drawFlagsCursor_x ); - } else { - lCursor_y = lCursor_y - self.sizeCursorFlash_y; - Menu_DrawString( self.pos + self.origin, self._target.value, self.fontSize, self.colorPressed, self.alphas_z, self.drawFlags_z ); - Menu_Fill( self.pos + self.origin + lCursor, self.sizeCursorFlash, self.colorCursorFlash, self.alphasCursor_y * lAlpha, self.drawFlagsCursor_y ); - } -}; - -void() Item_EditBox_Update = -{ - Item_DataUser_Update(); - - if( self._presstime + ITEM_EDITBOX_FLASHTIME > Timer_Time ) - self._state = ITEM_STATE_PRESSED; - else if( Menu_ActiveItem == self ) - self._state = ITEM_STATE_SELECTED; - else - self._state = ITEM_STATE_NORMAL; - - if( !self._target ) - return; - - // clamp the cursor position if necessary - Raise_DataEvent( self._target, ITEM_DATALINK_GET ); - self._cursorPos = bound( 0, self._cursorPos, strlen( self._target.value ) ); - - // scroll the text if necessary - // save the scrolled position in origin - self.origin_y = 0; - if( ( self._cursorPos + ITEM_EDITBOX_SCROLLDISTANCE > self.size_x / self.fontSize_x ) - && ( self._target.maxValue - ITEM_EDITBOX_SCROLLDISTANCE > self.size_x / self.fontSize_x ) ) - self.origin_x = self.fontSize_x * ( floor( self.size_x / self.fontSize_x ) - self._cursorPos - ITEM_EDITBOX_SCROLLDISTANCE ); - else - self.origin_x = 0; -}; - -void() _IEB_RemoveChar = -{ - local string lTemp; - local string lValue; - - lValue = self._target.value; - // TODO: perhaps use strlen perhaps - // FIXME: FteQCC bug: lTemp = strcat( substring( lValue, 0, self._cursorPos ), substring( lValue, self._cursorPos + 1, 100000 ) ); - lTemp = strcat( substring( lValue, 0, self._cursorPos ) ); - lTemp = strcat( lTemp, substring( lValue, self._cursorPos + 1, 100000 ) ); - String_EntitySet( self._target, value, lTemp ); - Raise_DataEvent( self._target, ITEM_DATALINK_SET ); - - self._presstime = Timer_Time; - Sound_Play( self.soundKey ); -}; - -void( float pAscii ) _IEB_InsertChar = -{ - local string lValue; - local string lTemp; - - lValue = self._target.value; - lTemp = strcat( substring( lValue, 0, self._cursorPos ) , chr( pAscii ) ); - lTemp = strcat( lTemp, substring( lValue, self._cursorPos, 100000 ) ); - // FIXME: FTEQCC bug: lTemp = strcat( substring( lValue, 0, self._cursorPos ) , chr( pAscii ), substring( lValue, self._cursorPos, 100000 ) ); - String_EntitySet( self._target, value, lTemp ); - Raise_DataEvent( self._target, ITEM_DATALINK_SET ); - - self._cursorPos = self._cursorPos + 1; - - self._presstime = Timer_Time; - Sound_Play( self.soundKey ); -}; - -bool( float pKey, float pAscii ) Item_EditBox_Key = -{ - if( !self._target ) - return false; - else if( pKey == K_ENTER ) { - CtCall_Action(); - Sound_Play( self.soundKey ); - return true; - } else if( pKey == K_LEFTARROW ) { - if( self._cursorPos ) - self._cursorPos = self._cursorPos - 1; - Sound_Play( self.soundMove ); - return true; - } else if( pKey == K_RIGHTARROW ) { - if( self._cursorPos < strlen( self._target.value ) ) - self._cursorPos = self._cursorPos + 1; - Sound_Play( self.soundMove ); - return true; - } else if( pKey == K_BACKSPACE ) { - if( self._cursorPos > 0 ) { - self._cursorPos = self._cursorPos - 1; - _IEB_RemoveChar(); - } - return true; - } else if( pKey == K_DEL ) { - if( self._cursorPos < strlen( self._target.value ) ) - _IEB_RemoveChar(); - return true; - } else if( 30 <= pAscii && pAscii <= 126 ) { - _IEB_InsertChar( pAscii ); - return true; - } - return false; -}; - -void( bool pSelect, bool pUser ) Item_EditBox_Select = -{ - CtCall_Select( pSelect, pUser ); - if( pSelect && pUser ) - Sound_Play( self.soundSelected ); -}; - -void() Item_EditBox_Destroy = -{ - CtCall_Destroy(); - Item_DataUser_Destroy(); - - String_EntityFree( self, soundSelected ); - String_EntityFree( self, soundKey ); - String_EntityFree( self, soundMove ); -}; - -void() Item_EditBox_Reinit = -{ - self._cursorPos = 0; - CtCall_Reinit(); -}; - -void() Item_EditBox_Spawn = -{ - Item_DataUser_Init(); - - String_EntityZone( self, soundSelected ); - String_EntityZone( self, soundKey ); - String_EntityZone( self, soundMove ); - - Sound_Precache( self.soundSelected ); - Sound_Precache( self.soundKey ); - Sound_Precache( self.soundMove ); - - if( self.size == '0 0 0' && self._target && self._target.maxValue >= 0 ) { - self.size_x = self.fontSize_x * self._target.maxValue + max( self.sizeCursor_x, self.sizeCursorFlash ); - self.size_y = self.fontSize_y; - } - - self._reinit = Item_EditBox_Reinit; - self._destroy = Item_EditBox_Destroy; - self._key = Item_EditBox_Key; - self._draw = Item_EditBox_Draw; - self._select = Item_EditBox_Select; - self._update = Item_EditBox_Update; - - CtCall_Init(); -}; diff --git a/scmenu/source/control/visual/floating.qc b/scmenu/source/control/visual/floating.qc deleted file mode 100644 index a5d8128cb..000000000 --- a/scmenu/source/control/visual/floating.qc +++ /dev/null @@ -1,54 +0,0 @@ -// DP/Nex Menu -// control/visual/floating.qc - -bool( float pKey, float pAscii ) Item_FloatingArea_Key = -{ - if( pKey == K_MOUSE1 || pKey == K_ENTER ) { - if( self._state != ITEM_STATE_PRESSED ) - self._state = ITEM_STATE_PRESSED; - else - self._state = ITEM_STATE_NORMAL; - - return true; - } else if( pKey == K_ESCAPE ) - self._state = ITEM_STATE_NORMAL; - - return false; -}; - -void() Item_FloatingArea_Update = -{ - if( !self.target ) { - self._state = ITEM_STATE_NORMAL; - return; - } else if( self.target != self._target.name ) - self._target = Menu_GetItem( self.target ); - - if( self._state == ITEM_STATE_PRESSED ) - self._target.pos = self._target.pos + Cursor_Relative; - else if( Menu_ActiveItem == self ) - self._state = ITEM_STATE_SELECTED; -}; - -void() Item_FloatingArea_Destroy = -{ - String_EntityFree( self, target ); -}; - -void( bool pSelect, bool pUser ) Item_FloatingArea_Select = -{ - if( !pSelect && self._state == ITEM_STATE_PRESSED ) - Menu_CorrectSelection( self, false ); -}; - -void() Item_FloatingArea_Spawn = -{ - self.flag = self.flag | FLAG_CHILDDRAWUPDATEONLY; - - String_EntityZone( self, target ); - - self._update = Item_FloatingArea_Update; - self._key = Item_FloatingArea_Key; - self._destroy = Item_FloatingArea_Destroy; - self._select = Item_FloatingArea_Select; -}; diff --git a/scmenu/source/control/visual/label.qc b/scmenu/source/control/visual/label.qc deleted file mode 100644 index e5c5cb07b..000000000 --- a/scmenu/source/control/visual/label.qc +++ /dev/null @@ -1,64 +0,0 @@ -// DP/Nex Menu -// control/visual/label.qc - -////////////// -// Item_Label -/// - -void() _IL_Calc = -{ - // calculate the size if necessary - if( self.size == '0 0 0' ) { - self.size_x = self.fontSize_x * strlen( self.text ); - self.size_y = self.fontSize_y; - } else if( self.fontSize == '0 0 0' ) { - self.fontSize_x = self.size_x / strlen( self.text ); - self.fontSize_y = self.size_y; - } -}; - -void() Item_Label_Update = -{ - _IL_Calc(); -}; - -void() Item_Label_Draw = -{ - local vector lAligned; - // do we need to align the text? - if( self.alignment == ITEM_ALIGN_LEFT ) - lAligned_x = self.pos_x; - else if( self.alignment & ITEM_ALIGN_CENTER ) - lAligned_x = self.pos_x + (self.size_x - strlen( self.text ) * self.fontSize_x) / 2; - else if( self.alignment & ITEM_ALIGN_RIGHT ) - lAligned_x = self.pos_x + self.size_x - strlen( self.text ) * self.fontSize_x; - else - lAligned_x = self.pos_x; - lAligned_y = self.pos_y; - - Menu_DrawString( lAligned, self.text, self.fontSize, self.color, self.alpha, self.drawFlag ); -}; - -void() Item_Label_Destroy = -{ - String_EntityFree( self, text ); -}; - -void() Item_Label_Spawn = -{ - if( self.flag == 0 ) - self.flag = self.flag | FLAG_DRAWUPDATEONLY; - - String_EntityZone( self, text ); - - _IL_Calc(); - - if( self.alignment & ITEM_ALIGN_FIX_CENTER ) - self.pos_x = self.pos_x - self.size_x / 2; - else if( self.alignment & ITEM_ALIGN_FIX_LEFT ) - self.pos_x = self.pos_x - self.size_x; - - self._destroy = Item_Label_Destroy; - self._draw = Item_Label_Draw; - self._update = Item_Label_Update; -}; diff --git a/scmenu/source/control/visual/list.qc b/scmenu/source/control/visual/list.qc deleted file mode 100644 index 1448baff2..000000000 --- a/scmenu/source/control/visual/list.qc +++ /dev/null @@ -1,147 +0,0 @@ -// DP/Nex Menu -// control/visual/list.qc - -float() _IL_GetItemUnderCursor = -{ - local float lItem; - local float lStart; - local float lLines; - - lLines = floor( self.size_y / ( self.fontSize_y + 2 ) ); - lStart = max( 0, floor( DataLink_Switch_GetOrdinal( self._target, self._target._realValue ) - lLines / 2 ) ); - lItem = floor( ( Menu_Cursor_Position_y - self.pos_y ) / ( self.fontSize_y + 2 ) ); - lItem = min( lStart + lItem, DataLink_Switch_GetOrdinal( self._target, self._target.maxValue ) ); - - return lItem; -} - -void() Item_List_Draw = -{ - local float lStart; - local float lLines; - local float lLine; - local float lEnd; - local vector lPos; - local float lItemUnderCursor; - - if( !self._target ) - return; - - Raise_DataEvent( self._target, ITEM_DATALINK_GET ); - lLines = floor( self.size_y / ( self.fontSize_y + 2 ) ); - lStart = max( 0, floor( DataLink_Switch_GetOrdinal( self._target, self._target._realValue ) - lLines / 2 ) ); - lEnd = min( lStart + lLines, DataLink_Switch_GetOrdinal( self._target, self._target.maxValue ) ); - - if( self._state == ITEM_STATE_NORMAL ) { - lItemUnderCursor = -1; - } else { - lItemUnderCursor = _IL_GetItemUnderCursor(); - } - - lPos = '0 1 0' + self.pos; - for( lLine = lStart ; lLine <= lEnd ; lLine++ ) { - local string lText; - lText = Util_GetAltStringItem( self._target.descList, lLine ); - if( lLine == DataLink_Switch_GetOrdinal( self._target, self._target._realValue ) ) { - if( self._state == ITEM_STATE_SELECTED ) - Menu_DrawString( lPos, lText, self.fontSize, self.colorSelected, self.alphas_y, self.drawFlags_y ); - else if( self._state == ITEM_STATE_PRESSED ) - Menu_DrawString( lPos, lText, self.fontSize, self.colorPressed, self.alphas_z, self.drawFlags_z ); - else - Menu_DrawString( lPos, lText, self.fontSize, self.colorInactive, self.alphaInactive, self.drawFlagInactive ); - } else if( lLine == lItemUnderCursor ) { - Menu_DrawString( lPos, lText, self.fontSize, self.colorInactive, self.alphaInactive, self.drawFlagInactive ); - } else { - Menu_DrawString( lPos, lText, self.fontSize, self.color, self.alphas_x, self.drawFlags_x ); - } - - lPos_y = lPos_y + self.fontSize_y + 2; - - String_Free( lText ); - } -}; - -void() Item_List_Update = -{ - Item_DataUser_Update(); - - if( self._presstime + ITEM_BUTTON_ACTIONTIME > Timer_Time ) - self._state = ITEM_STATE_PRESSED; - else if( Menu_ActiveItem == self ) - self._state = ITEM_STATE_SELECTED; - else - self._state = ITEM_STATE_NORMAL; -}; - -void( bool pSelect, bool pUser ) Item_List_Select = -{ - if( pSelect && pUser ) - Sound_Play( self.soundSelected ); -}; - -bool( float pKey, float pAscii ) Item_List_Key = -{ - if( pKey == K_DOWNARROW ) { - Sound_Play( self.soundPressed ); - self._presstime = Timer_Time; - - self._target._realValue = self._target._realValue + 1; - Raise_DataEvent( self._target, ITEM_DATALINK_SET ); - - return true; - } else if( pKey == K_UPARROW ) { - Sound_Play( self.soundPressed ); - self._presstime = Timer_Time; - - self._target._realValue = self._target._realValue - 1; - Raise_DataEvent( self._target, ITEM_DATALINK_SET ); - - return true; - } else if( pKey == K_MOUSE1 ) { - local float lSelected; - Sound_Play( self.soundPressed ); - - lSelected = _IL_GetItemUnderCursor() * self._target.stepValue + self._target.minValue; - // double-click? - if( self._presstime + ITEM_BUTTON_ACTIONTIME > Timer_Time && lSelected == self._target._realValue ) { - CtCall_Action(); - } else { - self._presstime = Timer_Time; - - self._target._realValue = lSelected; - Raise_DataEvent( self._target, ITEM_DATALINK_SET ); - } - - return true; - } - return false; -}; - -void() Item_List_Destroy = -{ - CtCall_Destroy(); - - String_EntityFree( self, soundSelected ); - String_EntityFree( self, soundPressed ); - - Item_DataUser_Destroy(); -}; - -void() Item_List_Spawn = -{ - Item_DataUser_Init(); - - String_EntityZone( self, soundSelected ); - String_EntityZone( self, soundPressed ); - - Sound_Precache( self.soundSelected ); - Sound_Precache( self.soundPressed ); - - self._draw = Item_List_Draw; - self._update = Item_List_Update; - self._select = Item_List_Select; - self._key = Item_List_Key; - self._reinit = CtCall_Reinit; - - CtCall_Init(); -}; diff --git a/scmenu/source/control/visual/multilabel.qc b/scmenu/source/control/visual/multilabel.qc deleted file mode 100644 index 45791b9a8..000000000 --- a/scmenu/source/control/visual/multilabel.qc +++ /dev/null @@ -1,110 +0,0 @@ -// DP/Nex Menu -// control/visual/multilabel.qc - -/* -=================== -_IML_Calc -=================== -*/ -void() _IML_Calc = -{ - local float lMaxWidth; - local float lLineNumber; - local vector lLine; - - lMaxWidth = 0; - lLineNumber = 0; - lLine = '0 0 0'; - do { - if( self.wrap ) - lLine = Util_GetEndOfWrappedLine( self.text, lLine, self.wrap ); - else - lLine = Util_GetEndOfLine( self.text, lLine ); - - ++lLineNumber; - lMaxWidth = max( lMaxWidth, lLine_z ); - } while( lLine_x != lLine_y ); - - self.size_x = lMaxWidth * self.fontSize_x; - self.size_y = lLineNumber * self.fontSize_y; -}; - -/* -=================== -_IML_DrawLine -=================== -*/ -void( vector pPosition, string pText ) _IML_DrawLine = -{ - if( self.alignment == ITEM_ALIGN_CENTER ) - pPosition_x = self.pos_x + (self.size_x - strlen( pText ) * self.fontSize_x) / 2; - else if( self.alignment == ITEM_ALIGN_RIGHT ) - pPosition_x = self.pos_x + self.size_x - strlen( pText ) * self.fontSize_x; - else - pPosition_x = self.pos_x; - - Menu_DrawString( pPosition, pText, self.fontSize, self.color, self.alpha, self.drawFlag ); -}; - -/* -=================== -Item_MultiLable_Draw -=================== -*/ -void() Item_MultiLabel_Draw = -{ - local vector lPosition; - local vector lLine; - - lPosition_y = self.pos_y; - lLine = '0 0 0'; - do { - if( self.wrap ) - lLine = Util_GetEndOfWrappedLine( self.text, lLine, self.wrap ); - else - lLine = Util_GetEndOfLine( self.text, lLine ); - - _IML_DrawLine( lPosition, substring( self.text, lLine_x - lLine_z + 1, lLine_z ) ); - lPosition_y = lPosition_y + self.fontSize_y; - } while( lLine_x != lLine_y ); -}; - -/* -=================== -Item_MultiLabel_Update -=================== -*/ -void() Item_MultiLabel_Update = -{ - if( self.size == '0 0 0' ) - _IML_Calc(); -}; - -/* -=================== -Item_MultiLabel_Destroy -=================== -*/ -void() Item_MultiLabel_Destroy = -{ - String_EntityFree( self, text ); -}; - -/* -=================== -Item_MultiLabel_Spawn -=================== -*/ -void() Item_MultiLabel_Spawn = -{ - if( self.flag == 0 ) - self.flag = self.flag | FLAG_DRAWUPDATEONLY; - - String_EntityZone( self, text ); - - Item_MultiLabel_Update(); - - self._destroy = Item_MultiLabel_Destroy; - self._draw = Item_MultiLabel_Draw; - self._update = Item_MultiLabel_Update; -}; diff --git a/scmenu/source/control/visual/picture.qc b/scmenu/source/control/visual/picture.qc deleted file mode 100644 index b0beca409..000000000 --- a/scmenu/source/control/visual/picture.qc +++ /dev/null @@ -1,36 +0,0 @@ -// DP/Nex Menu -// control/visual/picture.qc - -///////////////// -// Item_Picture -/// - -void() Item_Picture_Draw = -{ - Menu_DrawPicture( self.pos, self.picture, self.size, self.color, self.alpha, self.drawFlag ); -}; - -void() Item_Picture_Destroy = -{ - String_EntityFree( self, picture ); -}; - -void() Item_Picture_Spawn = -{ - // this items needs a picture field - if( !self.picture ) { - Menu_DeleteAfterFrame( self ); - return; - } - - String_EntityZone( self, picture ); - - // load the picture if it isnt loaded already - Gfx_Precache( self.picture ); - - if( self.flag == 0 ) - self.flag = self.flag | FLAG_NOSELECT; - - self._destroy = Item_Picture_Destroy; - self._draw = Item_Picture_Draw; -}; diff --git a/scmenu/source/control/visual/rect.qc b/scmenu/source/control/visual/rect.qc deleted file mode 100644 index 0b2785366..000000000 --- a/scmenu/source/control/visual/rect.qc +++ /dev/null @@ -1,18 +0,0 @@ -// DP/Nex Menu -// control/visual/rect.qc - -/////////////// -// Item_Rect -/// - -void() Item_Rect_Draw = -{ - Menu_Fill( self.pos, self.size, self.color, self.alpha, self.drawFlag ); -}; - -void() Item_Rect_Spawn = -{ - self.flag = self.flag | FLAG_NOSELECT; - - self._draw = Item_Rect_Draw; -}; diff --git a/scmenu/source/control/visual/scrollbar.qc b/scmenu/source/control/visual/scrollbar.qc deleted file mode 100644 index 2e6b40ef4..000000000 --- a/scmenu/source/control/visual/scrollbar.qc +++ /dev/null @@ -1,158 +0,0 @@ -// DP/Nex Menu -// control/visual/scrollbar.qc - -const float _VSB_UP_HEIGHT = 20; -const float _VSB_DOWN_HEIGHT = 20; -const float _VSB_PRECISION = 5; -const float _VSB_MINHEIGHT = 10; - -const vector _VSB_CLICKAREA_COLOR = '1 1 1'; -const vector _VSB_SCOLLER_COLOR = '0.9 0.9 0.9'; -const vector _VSB_SCROLLAREA_COLOR = '0.3 0.3 0.3'; - -// scroller == scroll button -float() _IVSB_GetSizeOfScroller = { - local float lScrollerRange; - local float lVisibleSize; - local float lTotalSize; - local float lScrollerSize; - - lTotalSize = self._target._child.size_y; - lVisibleSize = self.size_y; - lScrollerRange = self.size_y - _VSB_DOWN_HEIGHT - _VSB_UP_HEIGHT; - - lScrollerSize = lVisibleSize * lScrollerRange / lTotalSize; - lScrollerSize = max( _VSB_MINHEIGHT, lScrollerSize ); - - return lScrollerSize; -} - -void() Item_VScrollBar_Draw = { - local vector lPosition; - local vector lSize; - - if( self._target == null_entity ) { - return; - } - - lPosition = self.pos; - lSize = self.size; - lSize_y = _VSB_UP_HEIGHT; - Menu_Fill( lPosition, lSize, _VSB_CLICKAREA_COLOR, 1.0, 0 ); - - lPosition_y = self.pos_y + _VSB_UP_HEIGHT; - lSize_y = self.size_y - _VSB_UP_HEIGHT - _VSB_DOWN_HEIGHT; - Menu_Fill( lPosition, lSize, _VSB_SCROLLAREA_COLOR, 1.0, 0 ); - - lPosition_y = self.pos_y + self.size_y - _VSB_DOWN_HEIGHT; - lSize_y = _VSB_DOWN_HEIGHT; - Menu_Fill( lPosition, lSize, _VSB_CLICKAREA_COLOR, 1.0, 0 ); - - lSize_y = _IVSB_GetSizeOfScroller(); - lPosition_y = self.pos_y + _VSB_UP_HEIGHT - self._target.origin_y * (self.size_y - _VSB_DOWN_HEIGHT - _VSB_UP_HEIGHT - lSize_y) / (self._target._child.size_y - self.size_y); - Menu_Fill( lPosition, lSize, _VSB_SCOLLER_COLOR, 1.0, 0 ); -}; - -void() _IVSB_RangeBound = { - self._target.origin_y = bound( - (self._target._child.size_y - self.size_y) , self._target.origin_y, 0 ); -}; - -void() _IVSB_ScrollUp = { - self._target.origin_y = self._target.origin_y + _VSB_PRECISION; - _IVSB_RangeBound(); -}; - -void() _IVSB_ScrollDown = { - self._target.origin_y = self._target.origin_y - _VSB_PRECISION; - _IVSB_RangeBound(); -}; - -void( float lLevel ) _IVSB_MouseSelect = { - local float lScrollerRange; - local float lVisibleSize; - local float lTotalSize; - local float lScrollerSize; - - lTotalSize = self._target._child.size_y; - lVisibleSize = self.size_y; - lScrollerRange = self.size_y - _VSB_DOWN_HEIGHT - _VSB_UP_HEIGHT; - lScrollerSize = _IVSB_GetSizeOfScroller(); - - lLevel = lLevel - _VSB_UP_HEIGHT - lScrollerSize / 2; - self._target.origin_y = - ( lLevel * (lTotalSize - lVisibleSize) / (lScrollerRange - lScrollerSize ) ); - _IVSB_RangeBound(); -}; - -bool( float pKey, float Ascii ) Item_VScrollBar_Key = { - if( self._target == null_entity ) { - return false; - } - - if( pKey == K_UPARROW ) { - _IVSB_ScrollUp(); - return true; - } else if( pKey == K_DOWNARROW ) { - _IVSB_ScrollDown(); - return true; - } else if( pKey == K_MOUSE1 ) { - local float lLevel; - - if( !Util_InRect( Menu_Cursor_Position, self.pos, self.size ) ) { - return false; - } - - lLevel = Menu_Cursor_Position_y - self.pos_y; - if( lLevel < _VSB_UP_HEIGHT ) { - _IVSB_ScrollUp(); - } else if( lLevel >= self.size_y - _VSB_DOWN_HEIGHT ) { - _IVSB_ScrollDown(); - } else { - _IVSB_MouseSelect( lLevel ); - } - return true; - } else if( pKey == K_MWHEELUP ) { - _IVSB_ScrollUp(); - return true; - } else if( pKey == K_MWHEELDOWN ) { - _IVSB_ScrollDown(); - return true; - } - return false; -}; - -void() Item_VScrollBar_Update = -{ - if( self.target == "" ) { - self._target = null_entity; - } else if( self.target != self._target.name ) { - self._target = Menu_GetItem( self.target ); - } - - if( self._target == null_entity ) { - return; - } - - // set size height to the height of the scrollwindow's parent - self.size_y = self._target.size_y; - - // if the scrollbar isnt needed it becomes invisible - if( self.size_y >= self._target._child.size_y ) { - self.flag = self.flag | FLAG_HIDDEN; - } else if( self.flag & FLAG_HIDDEN ) { - self.flag = self.flag - FLAG_HIDDEN; - } -}; - -void() Item_VScrollBar_Destroy = { - String_EntityFree( self, target ); -}; - -void() Item_VScrollBar_Spawn = { - String_EntityZone( self, target ); - Item_VScrollBar_Update(); - - self._update = Item_VScrollBar_Update; - self._key = Item_VScrollBar_Key; - self._draw = Item_VScrollBar_Draw; - self._destroy = Item_VScrollBar_Destroy; -}; diff --git a/scmenu/source/control/visual/slider.qc b/scmenu/source/control/visual/slider.qc deleted file mode 100644 index 02063f6a4..000000000 --- a/scmenu/source/control/visual/slider.qc +++ /dev/null @@ -1,146 +0,0 @@ -// DP/Nex Menu -// control/visual/slider.qc - -//////////////// -// Item_Slider -/// - -// returns a value in the range of 0..1 -float() _IS_GetValue = -{ - local float lValue; - local entity lLink; - - if( !self._target ) - return 0; - - lLink = self._target; - - Raise_DataEvent( lLink, ITEM_DATALINK_GET ); - - if( lLink.maxValue <= lLink.minValue ) - lValue = 0; - else - lValue = ( lLink._realValue - lLink.minValue ) / (lLink.maxValue - lLink.minValue); - return lValue; -}; - -void( bool pSelect, bool pUser ) Item_Slider_Select = -{ - if( pSelect & pUser ) - Sound_Play( self.soundSelected ); -}; - -void() Item_Slider_Draw = -{ - local float lValue; - local vector lSliderPos; - - lValue = _IS_GetValue(); - lSliderPos_x = self.pos_x + self.size_x * (self.proportions_x + lValue * self.proportions_y) - lValue * self.sizeSlider_x; - lSliderPos_y = self.pos_y + (self.size_y - self.sizeSlider_y) * (1 - (self.direction_y - self.direction_x) * lValue - self.direction_x); - - if( Menu_ActiveItem == self ) { - Menu_DrawPicture( self.pos, self.picture, self.size, self.colorSelected, self.alphas_y, self.drawFlags_y ); - Menu_DrawPicture( lSliderPos, self.pictureSlider, self.sizeSlider, self.colorSelected, self.alphas_y, self.drawFlags_y ); - } else { - Menu_DrawPicture( self.pos, self.picture, self.size, self.color, self.alphas_x, self.drawFlags_x ); - Menu_DrawPicture( lSliderPos, self.pictureSlider, self.sizeSlider, self.color, self.alphas_x, self.drawFlags_x ); - } -}; - -void( float pValue ) _IS_Change = -{ - if( pValue < 0 ) - Sound_Play( self.soundDecrease ); - else - Sound_Play( self.soundIncrease ); - - self._target._realValue = self._target._realValue + pValue; - // FIXME: self._target.realValue += pValue; FTEQCC BUG - Raise_DataEvent( self._target, ITEM_DATALINK_SET ); - - CtCall_Action(); -}; - -bool( float pKey, float pAscii ) Item_Slider_Key = -{ - if( !self._target ) - return false; - - switch( pKey ) { - case K_LEFTARROW: - _IS_Change( 0 - self._target.stepValue ); - return true; - break; - case K_RIGHTARROW: - _IS_Change( self._target.stepValue ); - return true; - break; - case K_MOUSE1: { - local float lPos; - - // test if it is within the slider area at all - // TODO: Check if this is necessary with the future composition implementations - if( !Util_InRect( Menu_Cursor_Position, self.pos, self.size ) ) - return false; - lPos = ( Menu_Cursor_Position_x - self.pos_x ) / self.size_x; - if( lPos <= self.proportions_x ) - _IS_Change( 0 - self._target.stepValue ); - else if( lPos <= self.proportions_x + self.proportions_y && self.proportions_y ) { - local float lValue; - - lValue = Menu_Cursor_Position_x - self.pos_x - self.sizeSlider_x / 2 - self.size_x * self.proportions_x; - lValue = lValue / (self.size_x * self.proportions_y - self.sizeSlider_x); - lValue = lValue * ( self._target.maxValue - self._target.minValue ) + self._target.minValue; - _IS_Change( lValue - self._target._realValue ); - } else - _IS_Change( self._target.stepValue ); - return true; - } - } - return false; -}; - -void() Item_Slider_Destroy = -{ - CtCall_Destroy(); - - Item_DataUser_Destroy(); - - String_EntityFree( self, picture ); - String_EntityFree( self, pictureSlider ); - String_EntityFree( self, soundSelected ); - String_EntityFree( self, soundIncrease ); - String_EntityFree( self, soundDecrease ); -}; - -void() Item_Slider_Spawn = -{ - String_EntityZone( self, picture ); - String_EntityZone( self, pictureSlider ); - String_EntityZone( self, soundSelected ); - String_EntityZone( self, soundIncrease ); - String_EntityZone( self, soundDecrease ); - Item_DataUser_Init(); - - Gfx_Precache( self.picture ); - Gfx_Precache( self.pictureSlider ); - Sound_Precache( self.soundSelected ); - Sound_Precache( self.soundIncrease ); - Sound_Precache( self.soundDecrease ); - - if( self.size == '0 0 0' ) - self.size = Gfx_GetImageSize( self.picture ); - if( self.sizeSlider == '0 0 0' ) - self.sizeSlider = Gfx_GetImageSize( self.pictureSlider ); - - self._reinit = CtCall_Reinit; - self._destroy = Item_Slider_Destroy; - self._key = Item_Slider_Key; - self._draw = Item_Slider_Draw; - self._select = Item_Slider_Select; - self._update = Item_DataUser_Update; - - CtCall_Init(); -}; diff --git a/scmenu/source/control/visual/switchbutton.qc b/scmenu/source/control/visual/switchbutton.qc deleted file mode 100644 index 30ce55aea..000000000 --- a/scmenu/source/control/visual/switchbutton.qc +++ /dev/null @@ -1,43 +0,0 @@ -// DP/Nex Menu -// control/visual/switchbutton.qc - -bool( float pKey, float pAscii ) Item_SwitchButton_Key = -{ - if( !self._target ) - return false; - - if( pKey == K_SPACE || pKey == K_ENTER || pKey == K_MOUSE1 || pKey == K_RIGHTARROW ) { - Sound_Play( self.soundPressed ); - self._presstime = Timer_Time; - - self._target._realValue = self._target._realValue + self._target.stepValue; - if( self._target._realValue > self._target.maxValue ) - self._target._realValue = self._target.minValue; - - Raise_DataEvent( self._target, ITEM_DATALINK_SET ); - - CtCall_Action(); - return true; - } else if( pKey == K_BACKSPACE || pKey == K_MOUSE2 || pKey == K_LEFTARROW ) { - Sound_Play( self.soundPressed ); - self._presstime = Timer_Time; - - self._target._realValue = self._target._realValue - self._target.stepValue; - if( self._target._realValue < self._target.minValue ) - self._target._realValue = self._target.maxValue; - - Raise_DataEvent( self._target, ITEM_DATALINK_SET ); - - CtCall_Action(); - return true; - } - - return false; -}; - -void() Item_SwitchButton_Spawn = -{ - Item_ValueButton_Spawn(); - - self._key = Item_SwitchButton_Key; -}; diff --git a/scmenu/source/control/visual/valuebutton.qc b/scmenu/source/control/visual/valuebutton.qc deleted file mode 100644 index 53a2e22c7..000000000 --- a/scmenu/source/control/visual/valuebutton.qc +++ /dev/null @@ -1,31 +0,0 @@ -// DP/Nex Menu -// control/visual/valuebutton.qc - -///////////////////// -// Item_ValueButton -/// - -void() Item_ValueButton_Update = -{ - Item_DataUser_Update(); - - Raise_DataEvent( self._target, ITEM_DATALINK_GET ); - String_EntitySet( self, normal, self._target.value ); - self.size = '0 0 0'; // FIXME: Do we really want this/need this? - Item_Button_Update(); -}; - -void() Item_ValueButton_Destroy = -{ - Item_DataUser_Destroy(); - Item_Button_Destroy(); -}; - -void() Item_ValueButton_Spawn = -{ - Item_DataUser_Init(); - Item_Button_Spawn(); - - self._destroy = Item_ValueButton_Destroy; - self._update = Item_ValueButton_Update; -}; diff --git a/scmenu/source/control/visual/visual.qh b/scmenu/source/control/visual/visual.qh deleted file mode 100644 index 2f784e19b..000000000 --- a/scmenu/source/control/visual/visual.qh +++ /dev/null @@ -1,210 +0,0 @@ -// DP/Nex Menu -// control/visual/visual.qh - -// Item states -enum { - ITEM_STATE_NORMAL, - ITEM_STATE_SELECTED, - ITEM_STATE_PRESSED -}; - -// Item_Picture -.string picture; -.vector color; -.float alpha; -.float drawFlag; - -void() Item_Picture_Draw; -void() Item_Picture_Destroy; -void() Item_Picture_Spawn; - -// Item_Rect -.vector color; -.float alpha; -.float drawFlag; - -void() Item_Rect_Draw; -void() Item_Rect_Spawn; - -// Item_Label -.vector color; -.float alpha; -.float drawFlag; -.string text; -.vector fontSize; -.float alignment; - -void() Item_Label_Draw; -void() Item_Label_Update; -void() Item_Label_Destroy; -void() Item_Label_Spawn; - -// Item_MultiLabel implements Item_Label -// multiline label -.vector color; -.float alpha; -.float drawFlag; -.string text; -.vector fontSize; -.float alignment; -.float wrap; // 0 for no wrapping - -void() Item_MultiLabel_Update; -void() Item_MultiLabel_Draw; -void() Item_MultiLabel_Destroy; -void() Item_MultiLabel_Spawn; - -// Item_Button [Item_Link] -// add $ to the text if you want to use pictures -// e.g. $gfx/menu_newgame -// if selected is "" then it falls back to normal -// if pressed is "" then it falls back to selected or normal (see above) -.vector fontSize; -.string normal; -.string selected; -.string pressed; -.vector color; -.vector colorSelected; -.vector colorPressed; -.vector drawFlags; // x = normal; y = selected; z = pressed -.vector alphas; -.string soundSelected; -.string soundPressed; -.float _presstime; -.float _state; - -// cevents supported by Item_Button -.event init; -.event reinit; -.event destroy; -.event action; - -void() Item_Button_Draw; -void() Item_Button_Update; -void( bool pSelect, bool pUser ) Item_Button_Select; -bool( float pKey, float pAscii ) Item_Button_Key; -void() Item_Button_Destroy; -void() Item_Button_Spawn; - -// Item_Slider [Item_DataUser] -// Item_Slider changes link's value when the slider is moved -// the slider is x-centered but not y -.vector proportions; // x is left margin, y is slider width and z is right margin (sum should be 1) -.string picture; // picture of the background -.string pictureSlider; // picture of the slider -.string soundSelected; -.string soundIncrease; -.string soundDecrease; -.vector sizeSlider; // size of the slider -.vector direction; // y values of the slider: _x for the start and _y for the end (as percentages of size_y) -// only has normal and selected -.vector color; -.vector colorSelected; -.vector drawFlags; -.vector alphas; - -// cevents supported by Item_Slider -.event init; -.event reinit; -.event action; // called when the slider is changed -.event destroy; - -void( bool pSelect, bool pUser ) Item_Slider_Select; -void() Item_Slider_Draw; -bool( float pKey, float pAscii ) Item_Slider_Key; -void() Item_Slider_Destroy; -void() Item_Slider_Spawn; - -// Item_EditBox [Item_DataUser] -.vector color; -.vector colorSelected; -.vector colorPressed; -.vector alphas; -.vector drawFlags; - -.vector colorCursor; -.vector colorCursorFlash; -.vector sizeCursor; -.vector sizeCursorFlash; -.vector alphasCursor; -.vector drawFlagsCursor; - -.string soundSelected; -.string soundKey; -.string soundMove; - -.float _presstime; -.float _state; -.float _cursorPos; - -// cevents supported by Item_EditBox -.event init; -.event reinit; -.event action; // called when the return key is pressed -.event destroy; -.selectEvent select; - -void() Item_EditBox_Draw; -void() Item_EditBox_Update; -bool( float pKey, float pAscii ) Item_EditBox_Key; -void( bool pSelect, bool pUser ) Item_EditBox_Select; -void() Item_EditBox_Destroy; -void() Item_EditBox_Reinit; -void() Item_EditBox_Spawn; - -// Item_ValueButton [Item_Button] [Item_DataUser] FIXME: actually this is bad practice - -void() Item_ValueButton_Update; -void() Item_ValueButton_Destroy; -void() Item_ValueButton_Spawn; - -// Item_SwitchButton Item_ValueButton -bool( float pKey, float pAscii ) Item_SwitchButton_Key; -void() Item_SwitchButton_Spawn; - -// Item_List [Item_DataUser] -.vector fontSize; -.vector colorSelected; -.vector colorPressed; -.vector colorInactive; -.vector drawFlags; // x = normal; y = selected; z = pressed -.float drawFlagInactive; -.vector alphas; -.float alphaInactive; -.string soundSelected; -.string soundPressed; -.float _presstime; -.float _state; - -// cevents supported by Item_List -.event init; -.event reinit; -.event destroy; -.event action; // called on double-click - -void() Item_List_Draw; -void() Item_List_Update; -void( bool pSelect, bool pUser ) Item_List_Select; -bool( float pKey, float pAscii ) Item_List_Key; -void() Item_List_Destroy; -void() Item_List_Spawn; - -// Item_FloatingArea -// When you click on the area, the target will move with the mouse cursor until you click again -.float _state; -.string target; -.entity _target; -bool( float pKey, float pAscii ) Item_FloatingArea_Key; -void() Item_FloatingArea_Update; -void() Item_FloatingArea_Spawn; - -// Item_VScrollBar -// target should point to a ScrollWindow -.string target; -.entity _target; - -void() Item_VScrollBar_Draw; -bool( float pKey, float Ascii ) Item_VScrollBar_Key; -void() Item_VScrollBar_Update; -void() Item_VScrollBar_Spawn; - diff --git a/scmenu/source/control/window/arrangement.qc b/scmenu/source/control/window/arrangement.qc deleted file mode 100644 index 5d75b7c5b..000000000 --- a/scmenu/source/control/window/arrangement.qc +++ /dev/null @@ -1,76 +0,0 @@ -// DP/Nex Menu -// control/window/composition.qc - -/* -=================== -Item_Arrangement_CalculateSize -=================== -*/ -void() Item_Arrangement_CalculateSize = -{ - local vector lMin; - local vector lMax; - local entity lChild; - - // TODO: this is garbage, fix this - lMax = '0 0 0'; - lMin_x = INFINITY; - lMin_y = INFINITY; - for( lChild = self._child ; lChild ; lChild = lChild._next ) { - if( Menu_HasRunFlag( lChild, RUNFLAG_HIDDEN ) ) - continue; - - lMin_x = min( lMin_x, lChild.pos_x ); - lMin_y = min( lMin_y, lChild.pos_y ); - lMax_x = max( lMax_x, lChild.pos_x + lChild.size_x ); - lMax_y = max( lMax_y, lChild.pos_y + lChild.size_y ); - } - self.size = lMax - lMin; -}; - -/* -=================== -Item_Arrangement_Update -=================== -*/ -void() Item_Arrangement_Update = -{ - Item_Layout_Update(); - - Item_Arrangement_CalculateSize(); - - if( self.direction_x ) { - if( self.alignment == ITEM_ALIGN_LEFT ) - self.origin_y = 0; - else if( self.alignment == ITEM_ALIGN_CENTER || self.alignment == ITEM_ALIGN_FIRST ) - self.origin_y = self.size_y / 2; - else - self.origin_y = self.size_y; - } else - self.origin_y = 0; - if( self.direction_y ) { - if( self.alignment == ITEM_ALIGN_LEFT ) - self.origin_x = 0; - else if( self.alignment == ITEM_ALIGN_CENTER || self.alignment == ITEM_ALIGN_FIRST ) - self.origin_x = self.size_x / 2; - else - self.origin_x = self.size_x; - } else - self.origin_x = 0; -}; - -/* -=================== -Item_Arrangement_Spawn -=================== -*/ -void() Item_Arrangement_Spawn = -{ - Item_Layout_Spawn(); - - Item_Arrangement_Update(); - - self._update = Item_Arrangement_Update; -}; - - diff --git a/scmenu/source/control/window/eventwindow.qc b/scmenu/source/control/window/eventwindow.qc deleted file mode 100644 index df2b87753..000000000 --- a/scmenu/source/control/window/eventwindow.qc +++ /dev/null @@ -1,13 +0,0 @@ -// DP/Nex Menu -// control/window/eventwindow.qc - -void() Item_EventWindow_Spawn = -{ - Item_Window_Spawn(); - - self._destroy = CtCall_Destroy; - self._reinit = CtCall_Reinit; - self._update = CtCall_Update; - - CtCall_Init(); -}; diff --git a/scmenu/source/control/window/frame.qc b/scmenu/source/control/window/frame.qc deleted file mode 100644 index 9b3dac31a..000000000 --- a/scmenu/source/control/window/frame.qc +++ /dev/null @@ -1,9 +0,0 @@ -// DP/Nex Menu -// control/window/frame.qc - -void() Item_Frame_Spawn = -{ - Item_Window_Spawn(); - - self.flag = self.flag - FLAG_NOSELECT; -}; diff --git a/scmenu/source/control/window/layout.qc b/scmenu/source/control/window/layout.qc deleted file mode 100644 index 04dcfec3c..000000000 --- a/scmenu/source/control/window/layout.qc +++ /dev/null @@ -1,66 +0,0 @@ -// DP/Nex Menu -// control/window/layout.qc - -//////////////// -// Item_Layout -/// - -/* -=================== -Item_Layout_Update -=================== -*/ -void() Item_Layout_Update = -{ - local entity lChild; - local vector lCurrent; - - lCurrent = '0.0 0.0 0.0'; - for( lChild = self._child ; lChild ; lChild = lChild._next ) { - if( Menu_HasRunFlag( lChild, RUNFLAG_HIDDEN ) ) - continue; - - if( self.direction_y ) { - if( self.alignment == ITEM_ALIGN_FIRST && lChild._child ) - lChild.pos_x = lCurrent_x - lChild._child.size_x; - else if( self.alignment == ITEM_ALIGN_LEFT ) - lChild.pos_x = lCurrent_x; - else if( self.alignment == ITEM_ALIGN_CENTER ) - lChild.pos_x = lCurrent_x - lChild.size_x / 2; - else - lChild.pos_x = lCurrent_x - lChild.size_x; - } else - lChild.pos_x = lCurrent_x; - - if( self.direction_x ) { - if( self.alignment == ITEM_ALIGN_LEFT ) - lChild.pos_y = lCurrent_y; - else if( self.alignment == ITEM_ALIGN_CENTER ) - lChild.pos_y = lCurrent_y - lChild.size_y / 2; - else if( self.alignment == ITEM_ALIGN_FIRST && lChild._child ) - lChild.pos_y = lCurrent_y - lChild._child.size_y; - else - lChild.pos_y = lCurrent_y - lChild.size_y; - } else - lChild.pos_y = lCurrent_y; - - if( self.direction_x ) - lCurrent_x += lChild.size_x + self.direction_x; - else if( self.direction_y ) - lCurrent_y += lChild.size_y + self.direction_y; - } -}; - -/* -=================== -Item_Layout_Spawn -=================== -*/ -void() Item_Layout_Spawn = -{ - Item_Window_Spawn(); - - Item_Layout_Update(); - - self._update = Item_Layout_Update; -}; diff --git a/scmenu/source/control/window/reference.qc b/scmenu/source/control/window/reference.qc deleted file mode 100644 index d33a1baa2..000000000 --- a/scmenu/source/control/window/reference.qc +++ /dev/null @@ -1,68 +0,0 @@ -// DP/Nex Menu -// control/window/reference.qc - -////////////////// -// Item_Reference -/// -// NOTE: You use have multiple links to the same window, only one should be visible per frame, -// NOTE: else the behavior would be unexpectable -// NOTE: FIXME: Atm only references to windows with no parents( thus top layer ) work - -/* -=================== -Item_Reference_Update -=================== -*/ -void() Item_Reference_Update = -{ - // update the link and the link's parent - if( self.link == "" ) { - self._child = null_entity; - return; - } - - if( self.link != self._link.name ) - self._link = Menu_GetItem( self.link ); - - self._child = self._link; - self._child._parent = self; -}; - -/* -=================== -Item_Reference_Draw -=================== -*/ -void() Item_Reference_Draw = -{ - if( sys_debug_ref ) - Menu_Fill( self.pos, self.size, '0 0 0.2', 1.0, DRAWFLAG_ADDITIVE ); -}; - -/* -=================== -Item_Reference_Destroy -=================== -*/ -void() Item_Reference_Destroy = -{ - String_EntityFree( self, link ); -}; - -/* -=================== -Item_Reference_Spawn -=================== -*/ -void() Item_Reference_Spawn = -{ - self.flag = self.flag | FLAG_NOSELECT | FLAG_EMBEDDED; - - String_EntityZone( self, link ); - - Item_Reference_Update(); - - self._destroy = Item_Reference_Destroy; - self._draw = Item_Reference_Draw; - self._update = Item_Reference_Update; -}; diff --git a/scmenu/source/control/window/scroll.qc b/scmenu/source/control/window/scroll.qc deleted file mode 100644 index 8316ae5a2..000000000 --- a/scmenu/source/control/window/scroll.qc +++ /dev/null @@ -1,57 +0,0 @@ -// DP/Nex Menu -// control/window/scroll.qc - -void() Item_ScrollWindow_Update = -{ - local float lLevel; - local float lOldLevel; - local entity lParent; - - // reset _link and return if the window isnt owner of the currently selected item - if( !Menu_IsVisible( self ) || !_Menu_IsEmbeddedParentOf( Menu_ActiveItem, self._child ) ) { - self._link = null_entity; - return; - } - // if the window has been selected just now, we set _link and scroll to its position - // if the selection has changed we also scroll down - // only if nothing has changed, we do nothing, too (this makes scrollbar support possible) - if( self._link == Menu_ActiveItem ) { - return; - } else { - self._link = Menu_ActiveItem; - } - - // find the lLevel - lLevel = Menu_ActiveItem.pos_y; - for( lParent = Menu_ActiveItem._parent; lParent != self ; lParent = lParent._parent ) - lLevel += lParent.origin_y + lParent.pos_y; - - // self.origin_y is negative to move everything up, -self.origin_y is the level - lOldLevel = -self.origin_y; - if( ( Menu_ActiveItem.size_y > self.size_y && lLevel + Menu_ActiveItem.size_y > lOldLevel && lLevel < self.size_y + lOldLevel ) - || ( lLevel >= lOldLevel && lLevel + Menu_ActiveItem.size_y < lOldLevel + self.size_y ) ) - return; - // adapt the origin - // TODO: make this a bit more flexible - if( lOldLevel < lLevel ) - self.origin_y = self.direction_x - lLevel; - else - self.origin_y = self.size_y - self.direction_x - lLevel; - - // now limit it - self.origin_y = bound( self.size_y - self._child.size_y, self.origin_y, 0 ); - //print( ftos( self.origin_y ), "\n" ); -}; - -void() Item_ScrollWindow_Reinit = -{ - self.origin_y = 0; -}; - -void() Item_ScrollWindow_Spawn = -{ - Item_Window_Spawn(); - - self._update = Item_ScrollWindow_Update; - self._reinit = Item_ScrollWindow_Reinit; -}; diff --git a/scmenu/source/control/window/window.qc b/scmenu/source/control/window/window.qc deleted file mode 100644 index b90f88e38..000000000 --- a/scmenu/source/control/window/window.qc +++ /dev/null @@ -1,58 +0,0 @@ -// DP/Nex Menu -// control/window/normal.qc - -//////////////// -// Item_Window -/// - -/* -=================== -Item_Window_Key -=================== -*/ -bool( float pKey, float pAscii ) Item_Window_Key = -{ - if( CtCall_Key( pKey, pAscii ) ) - return true; - - return false; -}; - -void() Item_Window_Draw = -{ - if( !sys_debug) - return; - if( Menu_HasRunFlag( self, RUNFLAG_MOUSEINAREA ) ) { - if( sys_debug_area ) { - local entity lChild; - Menu_Fill( self.pos, self.size, '0.2 0 0', 0.2, DRAWFLAG_NORMAL ); - - for( lChild = self._child ; lChild ; lChild = lChild._next ) { - local vector lColor; - - if( !Menu_IsVisible( lChild ) ) - continue; - - lColor_x = mod( fabs( lChild.orderPos ) + 5, 9 ) / 8; - lColor_y = mod( fabs( lChild.orderPos * 8 ), 9 ) / 8; - lColor_z = mod( fabs( lChild.orderPos * 7 ), 9 ) / 8; - Menu_Fill( self.pos + self.origin + lChild.pos, lChild.size, lColor, 0.2, DRAWFLAG_NORMAL ); - } - } - if( sys_debug_mouse ) - sys_debug_cursor_localpos = Menu_Cursor_Position - self.origin - self.pos; - } -}; - -/* -=================== -Item_Window_Spawn -=================== -*/ -void() Item_Window_Spawn = -{ - self.flag = self.flag | FLAG_NOSELECT; - - self._key = Item_Window_Key; - self._draw = Item_Window_Draw; -}; diff --git a/scmenu/source/control/window/windows.qh b/scmenu/source/control/window/windows.qh deleted file mode 100644 index bd0d6e1a4..000000000 --- a/scmenu/source/control/window/windows.qh +++ /dev/null @@ -1,52 +0,0 @@ -// DP/Nex Menu -// control/window/windows.qh - -// Item_Window -.keyEvent key; - -bool( float pKey, float pAscii ) Item_Window_Key; -void() Item_Window_Draw; -void() Item_Window_Spawn; - -// Item_Frame Item_Window -void() Item_Frame_Spawn; - -// Item_EventWindow Item_Window -// has a few events -.keyEvent key; -.event init; -.event reinit; -.event destroy; -.event update; - -void() Item_EventWindow_Spawn; - -// Item_Reference [Item] -.string link; // window link - -void() Item_Reference_Update; -void() Item_Reference_Draw; -void() Item_Reference_Destroy; -void() Item_Reference_Spawn; - -// Item_Layout Item_Window -.vector direction; // space between the items -.float alignment; - -void() Item_Layout_Spawn; -void() Item_Layout_Update; - -// Item_Arrangement Item_Layout - -void() Item_Arrangement_CalculateSize; -void() Item_Arrangement_Update; -void() Item_Arrangement_Spawn; - -// Item_ScrollWindow Item_Window -// It will adapt its origin to always make the currently selected item visible -// There always has to be only *one* child window, that has a valid size -.vector direction; // first is space between frame and item -.entity _link; // used to determine changes of the ActiveItem - -void() Item_ScrollWindow_Update; -void() Item_ScrollWindow_Spawn; diff --git a/scmenu/source/custom/color.qm b/scmenu/source/custom/color.qm deleted file mode 100644 index 336825dc3..000000000 --- a/scmenu/source/custom/color.qm +++ /dev/null @@ -1,12 +0,0 @@ -// Property of Alientrap/AK -// custom/color.qm - -void() Nex_Action_Color_Cancel = -{ - Raise_DataEvent( Menu_GetItem( "::Data::Color" ), ITEM_DATA_TEST_END ); -}; - -void() Nex_Action_Color_Reset = -{ - Raise_DataEvent( Menu_GetItem( "::Data::Color" ), ITEM_DATA_RESET ); -}; diff --git a/scmenu/source/custom/creategame.qm b/scmenu/source/custom/creategame.qm deleted file mode 100644 index 6fc2aea40..000000000 --- a/scmenu/source/custom/creategame.qm +++ /dev/null @@ -1,424 +0,0 @@ -// Property of Alientrap -// custom/creategame.qm - -// uses target and _target -// requires neighbors: Picture, Name, Description -void() Nex_MapSelector_UpdateMap = -{ - local entity lInfo; - local entity lItem; - local entity lSelector; - local float lIndex; - - lSelector = Menu_GetItem( "::Data::Server::Map::Selector" ); - Raise_DataEvent( lSelector, ITEM_DATALINK_GET ); - lIndex = lSelector._realValue; - lInfo = Nex_MapDB_GetFilteredByIndex( lIndex ); - - if( lInfo == null_entity ) { - lItem = Menu_GetItem( "Picture" ); - String_EntitySet( lItem, picture, "gfx/m_nomap" ); - - lItem = Menu_GetItem( "Name" ); - String_EntitySet( lItem, text, "No maps found" ); - - lItem = Menu_GetItem( "Description" ); - String_EntitySet( lItem, text, "---" ); - return; - } - - lItem = Menu_GetItem( "Picture" ); - String_EntitySet( lItem, picture, lInfo.picture ); - - lItem = Menu_GetItem( "Name" ); - String_EntitySet( lItem, text, lInfo.normal ); - - lItem = Menu_GetItem( "Description" ); - String_EntitySet( lItem, text, lInfo.text ); - - lItem = Menu_GetItem( "::Data::Server::Map::Cycle" ); - DataLink_Nex_MapList_SetFirst( lItem, lInfo.normal, lInfo.link ); -}; - -void() Nex_MapSelector_Synchronize = -{ - local entity lCycle; - local entity lSelector; - - lCycle = Menu_GetItem( "::Data::Server::Map::Cycle" ); - lSelector = Menu_GetItem( "::Data::Server::Map::Selector" ); - - if( lCycle.stepValue == 0.0 ) { - Raise_DataEvent( lCycle, ITEM_DATA_RESET ); - } else { - local string lPath; - local entity lMapInfo; - - lPath = Util_GetAltStringItem( lCycle.valueList, 0 ); - lMapInfo = Nex_MapDB_GetByPath( lPath ); - String_Free( lPath ); - - if( lMapInfo == null_entity ) { - Raise_DataEvent( lCycle, ITEM_DATA_RESET ); - } else { - lSelector._realValue = Nex_MapDB_GetFilteredIndex( lMapInfo ); - Raise_DataEvent( lSelector, ITEM_DATALINK_SET ); - } - } -}; - -// more concrete functions -void() Nex_Action_MapSelector_Next = -{ - local entity lItem; - - lItem = Menu_GetItem( "::Data::Server::Map::Selector" ); - Raise_DataEvent( lItem, ITEM_DATALINK_GET ); - lItem._realValue = lItem._realValue + 1; - Raise_DataEvent( lItem, ITEM_DATALINK_SET ); -}; - -void() Nex_Action_MapSelector_Prev = -{ - local entity lItem; - - lItem = Menu_GetItem( "::Data::Server::Map::Selector" ); - Raise_DataEvent( lItem, ITEM_DATALINK_GET ); - lItem._realValue = lItem._realValue - 1; - Raise_DataEvent( lItem, ITEM_DATALINK_SET ); -}; - -// TODO: Make MaxPlayers real Data items (no container with correct set behavior) -void() Nex_Action_Map_Start = -{ - local entity lItem; - local string exit_cfg; - - // Set maxplayers - lItem = Menu_GetItem( "::Data::Server::MaxPlayers" ); - cmd( "maxplayers \"" ); - cmd( lItem.value ); - cmd( "\"\n" ); - - lItem = Menu_GetItem( "::Data::Server::Map::Cycle" ); - Raise_DataEvent( lItem, ITEM_DATA_SEND ); - - // if an old exit cfg file was set up, exec it - // to reset old values before starting the server - exit_cfg = cvar_string("exit_cfg"); - if(exit_cfg) - { - cmd( "exec "); - cmd( exit_cfg ); - cmd( "\n" ); - } - // exec the game reset cfg and then the mapcfg - cmd( "exec game_reset.cfg \nwait \nexec \"maps/" ); - cmd( String_Normal( Util_GetAltStringItem( lItem.valueList, 0 ) ) ); - cmd( ".mapcfg\"\n"); - - // force the menu to hide - m_hide(); -}; - -// cycle list edit features -void() Nex_Action_Cycle_Add = -{ - local entity lList; - local entity lCycle; - local string lPath; - local string lName; - - lList = Menu_GetItem( "::Data::Server::Map::List" ); - lCycle = Menu_GetItem( "::Data::Server::Map::Cycle" ); - - lName = DataLink_Nex_MapList_GetCurrentName( lList ); - lPath = DataLink_Nex_MapList_GetCurrentPath( lList ); - - if( lCycle.stepValue == 1.0 ) { - DataLink_Nex_MapList_InsertEntryAfter( lCycle, lName, lPath ); - } else { - DataLink_Nex_MapList_SetFirst( lCycle, lName, lPath ); - } - - String_Free( lName ); - String_Free( lPath ); - - lCycle._realValue = lCycle._realValue + 1; - Raise_DataEvent( lCycle, ITEM_DATALINK_SET ); - - Nex_MapSelector_Synchronize(); -}; - -void() Nex_Action_Cycle_Remove = -{ - local entity lCycle; - - lCycle = Menu_GetItem( "::Data::Server::Map::Cycle" ); - DataLink_Nex_MapList_DeleteEntry( lCycle ); - - Nex_MapSelector_Synchronize(); -}; - -void() Nex_Action_Cycle_MoveUp = -{ - local entity lCycle; - - lCycle = Menu_GetItem( "::Data::Server::Map::Cycle" ); - DataLink_Nex_MapList_MoveEntryUp( lCycle ); - - lCycle._realValue = lCycle._realValue - 1; - Raise_DataEvent( lCycle, ITEM_DATALINK_SET ); - - Nex_MapSelector_Synchronize(); -}; - -void() Nex_Action_Cycle_MoveDown = -{ - local entity lCycle; - - lCycle = Menu_GetItem( "::Data::Server::Map::Cycle" ); - DataLink_Nex_MapList_MoveEntryDown( lCycle ); - - lCycle._realValue = lCycle._realValue + 1; - Raise_DataEvent( lCycle, ITEM_DATALINK_SET ); - - Nex_MapSelector_Synchronize(); -}; - -void() Nex_Action_Cycle_Clear = -{ - local entity lCycle; - - lCycle = Menu_GetItem( "::Data::Server::Map::Cycle" ); - DataLink_Nex_MapList_Clear( lCycle ); - - Nex_MapSelector_Synchronize(); -}; - - -void() Nex_Action_Maplist_ChangeMapType = { - local entity lMapQuery; - local entity lOldSelf; - - lMapQuery = Menu_GetItem( "::Data::Server::Map::Query" ); - - Raise_DataEvent( self._target, ITEM_DATALINK_SET ); - - Nex_MapDB_FilterMaps( lMapQuery.value ); - - // kind of a hack - self = Menu_GetItem( "::Data::Server::Map::Selector" ); - Item_DataLink_Nex_MapList_InitWithMapList(); - self = Menu_GetItem( "::Data::Server::Map::List" ); - Item_DataLink_Nex_MapList_InitWithMapList(); - self = lOldSelf; -}; - -// mangement - -entity( float pType ) Nex_Management_GetFileList = -{ - switch( pType ) { - case 0: - return Menu_GetItem( "::Data::Management::FileList::Weapon" ); - case 1: - return Menu_GetItem( "::Data::Management::FileList::Game" ); - case 2: - return Menu_GetItem( "::Data::Management::FileList::MapList" ); - } - crash(); - return null_entity; -}; - -entity( float pType ) Nex_Management_GetContainer = -{ - switch( pType ) { - case 0: - return Menu_GetItem( "::Data::Weapon" ); - case 1: - return Menu_GetItem( "::Data::Game" ); - case 2: - return Menu_GetItem( "::Data::Server::Map::Cycle" ); - } - crash(); - return null_entity; -}; - -float() Nex_Management_GetType = -{ - local entity lTypeData; - - lTypeData = Menu_GetItem( "::Data::Management::ConfigType" ); - return stof( lTypeData.value ); -}; - -string() Nex_Management_GetTypeName = -{ - local entity lTypeSwitch; - - lTypeSwitch = Menu_GetItem( "::Data::Management::ConfigType::Switch" ); - Raise_DataEvent( lTypeSwitch, ITEM_DATALINK_GET ); - return String_Zone( lTypeSwitch.value ); -}; - -void( float pType ) Nex_Management_SetType = -{ - local entity lItem; - local entity lList; - local entity lTypeData; - - lTypeData = Menu_GetItem( "::Data::Management::ConfigType" ); - String_EntitySet( lTypeData, value, ftos( pType ) ); - Raise_DataEvent( lTypeData, ITEM_DATALINK_SET ); - - // update the filename - /*lItem = Menu_GetItem( "::Data::Management::Filename::Text" ); - String_EntitySet( lItem, value, "" ); - Raise_DataEvent( lItem, ITEM_DATALINK_SET );*/ - - lItem = Menu_GetItem( "FileList" ); - lList = Nex_Management_GetFileList( pType ); - String_EntitySet( lItem, target, lList.name ); -}; - -void() Nex_Action_CopyToFilename = -{ - local entity lItem; - - if( !self._target ) { - return; - } - - Raise_DataEvent( self._target, ITEM_DATALINK_GET ); - - lItem = Menu_GetItem( "::Data::Management::Filename::Text" ); - String_EntitySet( lItem, value, self._target.value ); - Raise_DataEvent( lItem, ITEM_DATALINK_SET ); -}; - -void() Nex_Update_Management_SyncData = -{ - if( self._realValue < Timer_Time && self._realValue > 0.0 ) { - Raise_DataEvent( Nex_Management_GetContainer( Nex_Management_GetType() ), ITEM_DATA_SYNC ); - self._realValue = 0.0; - } -}; - -void() Nex_Action_Management_Refresh = -{ - local entity lItem; - - lItem = Menu_GetItem( "::Data::Management::FileList" ); - Raise_DataEvent( lItem, ITEM_DATA_SYNC ); -}; - -void() Nex_Action_Management_LoadConfig = -{ - local entity lFileList; - local entity lFilenameData; - local entity lSyncItem; - - lFileList = Nex_Management_GetFileList( Nex_Management_GetType() ); - lFilenameData = Menu_GetItem( "::Data::Management::Filename" ); - - cmd( strcat( "exec \"", lFileList.selected, lFilenameData.value, ".", lFileList.normal, "\"\n" ) ); - - lSyncItem = Menu_GetItem( "CreateGame::Panel::Management::SyncCategory" ); - lSyncItem._realValue = Timer_Time; -}; - -void() Nex_Action_Management_Load = -{ - local entity lItem; - local string lQuestion; - local string lTitle; - - lItem = Menu_GetItem( "::Data::Management::Filename" ); - if( lItem.value == "" ) { - Nex_MessageBox( "Loading", "You must specify a filename!", "Ok", "", Util_NullFunction, Util_NullFunction ); - return; - } - - lTitle = String_Zone( strcat( "Loading ", String_Normal( Nex_Management_GetTypeName() ) ) ); - lQuestion = String_Zone( strcat( "Do you want to load '", lItem.value, "'?" ) ); - Nex_MessageBox( lTitle, lQuestion, "Yes", "No", Nex_Action_Management_LoadConfig, Util_NullFunction ); - String_Free( lQuestion ); - String_Free( lTitle ); -}; - -void() Nex_Action_Management_SaveConfig = -{ - local float lType; - local entity lFileList; - local entity lFilename; - local entity lContainer; - local float lHandle; - - lType = Nex_Management_GetType(); - lFileList = Nex_Management_GetFileList( lType ); - lContainer = Nex_Management_GetContainer( lType ); - lFilename = Menu_GetItem( "::Data::Management::Filename" ); - if( lFilename.value == "" ) { - Nex_MessageBox( "Saving", "You must specify a filename!", "Ok", "", Util_NullFunction, Util_NullFunction ); - return; - } - lHandle = fopen( strcat( lFileList.selected, lFilename.value, ".", lFileList.normal ), FILE_WRITE ); - - if( lHandle < 0 ) { - return; - } - - Data_ExecString_BeginUse(); - Raise_DataEvent( lContainer, ITEM_DATA_SAVE_EXECSTRING ); - - fputs( lHandle, Data_ExecString ); - - Data_ExecString_EndUse(); - - fclose( lHandle ); - - Nex_Action_Management_Refresh(); -}; - -void() Nex_Action_Management_Save = -{ - local entity lFileList; - local entity lFilename; - local float lHandle; - - lFileList = Nex_Management_GetFileList( Nex_Management_GetType() ); - lFilename = Menu_GetItem( "::Data::Management::Filename" ); - - lHandle = fopen( strcat( lFileList.selected, "/", lFilename.value, ".", lFileList.normal ), FILE_READ ); - - if( lHandle == ERR_CANNOTOPEN ) { - Nex_Action_Management_SaveConfig(); - } else if( lHandle > 0 ) { - local string lQuestion; - local string lTitle; - - fclose( lHandle ); - - lTitle = String_Zone( strcat( "Saving ", String_Normal( Nex_Management_GetTypeName() ) ) ); - lQuestion = String_Zone( strcat( "Do you want to overwrite '", lFilename.value, "'?" ) ); - Nex_MessageBox( lTitle, lQuestion, "Yes", "No", Nex_Action_Management_SaveConfig, Util_NullFunction ); - String_Free( lQuestion ); - String_Free( lTitle ); - } -}; - -void() Nex_Action_Management_TypeWeapon = -{ - Nex_Management_SetType( 0 ); -}; - -void() Nex_Action_Management_TypeGame = -{ - Nex_Management_SetType( 1 ); -}; - -void() Nex_Action_Management_TypeMapList = -{ - Nex_Management_SetType( 2 ); -}; diff --git a/scmenu/source/custom/creategame/creategame.qh b/scmenu/source/custom/creategame/creategame.qh deleted file mode 100644 index 8bc9f5403..000000000 --- a/scmenu/source/custom/creategame/creategame.qh +++ /dev/null @@ -1,76 +0,0 @@ -// Property of Alientrap/AK -// custom/creategame/creategame.qh - -// Item_Nex_Map_Info -// its a valid item nevertheless -.string normal; // contains the map name -.string picture; // contains the picture that should be displayed -.string text; // contains the description text -.string link; // contains the path to the map - -void() Item_Nex_Map_Info_Destroy; -void() Item_Nex_Map_Info_Spawn; - -// Map ""database"" Singleton Item_Nex_MapDB - -// pRoot should be an item with no other children -void() Item_Nex_MapDB_EnumFiles; -void() Item_Nex_MapDB_Destroy; -void() Item_Nex_MapDB_Spawn; - -void( string pPrefix ) Nex_MapDB_FilterMaps; - -entity( string pPath ) Nex_MapDB_GetByPath; -//entity( float pIndex ) Nex_MapDB_GetByIndex; -entity( float pIndex ) Nex_MapDB_GetFilteredByIndex; -float( entity pItem ) Nex_MapDB_GetFilteredIndex; - -string() Nex_MapDB_GetFilteredPathAltString; -string() Nex_MapDB_GetFilteredNameAltString; - -string() Nex_MapDB_GetPathAltString; -string() Nex_MapDB_GetNameAltString; - -// see control/data/data.qh -// Item_Data_Nex_Name [Item_Data] -void( float pEvent ) Item_Data_Nex_Name_DataEvent; -void() Item_Data_Nex_Name_Spawn; - -// Item_DataLink_Nex_MapList [Item_DataLink_Switch] -// contains the full .bsp path in value and the text/map name in desc -// this is just a placeholder data item - it only keeps a set -.string cvarName; // name of the maplist cvar -.event init; // if you want to initialize it -void( float pEvent ) Item_DataLink_Nex_MapList_DataEvent; -void() Item_DataLink_Nex_MapList_Spawn; - -void() Item_DataLink_Nex_MapList_InitWithMapList; -void( entity pItem ) DataLink_Nex_MapList_UpdateRange; - -// MapList edit commands -// these functions work with the entry selected by _realValue -void( entity pItem, string pName, string pPath ) DataLink_Nex_MapList_InsertEntryAfter; -void( entity pItem ) DataLink_Nex_MapList_DeleteEntry; -void( entity pItem ) DataLink_Nex_MapList_MoveEntryUp; -void( entity pItem ) DataLink_Nex_MapList_MoveEntryDown; -// creates the first entry if necessary -void( entity pItem, string pName, string pPath ) DataLink_Nex_MapList_SetFirst; -void( entity pItem ) DataLink_Nex_MapList_Clear; - -// both functions return str zoned strings -string( entity pItem ) DataLink_Nex_MapList_GetCurrentName; -string( entity pItem ) DataLink_Nex_MapList_GetCurrentPath; - -// see control/data/data.qh -// Item_DataLink_Nex_ModSwitch Item_DataLink_TextSwitch - -void() Item_DataLink_Nex_ModSwitch_Spawn; - -//Item_DataLink_Nex_FileList [Item_DataLink_TextSwitch] -.string normal; // contains the file extension -.string selected; // contains the path -.string valueList; - -void( float pEvent ) Item_DataLink_Nex_FileList_DataEvent; -void() Item_DataLink_Nex_FileList_Destroy; -void() Item_DataLink_Nex_FileList_Spawn; diff --git a/scmenu/source/custom/creategame/filelist.qc b/scmenu/source/custom/creategame/filelist.qc deleted file mode 100644 index 998c08dff..000000000 --- a/scmenu/source/custom/creategame/filelist.qc +++ /dev/null @@ -1,100 +0,0 @@ -// Property of Alientrap/AK -// custom/creategame/filelist.qc - -//Item_DataLink_Nex_FileList [Item_DataLink_Switch] - -/* -=================== -IDLNFL_Sync -=================== -*/ -void() IDLNFL_Sync = { - local float lCount; - local float lHandle; - local float lMaskStart, lMaskedLength; - local float lCounter; - - lHandle = search_begin( strcat( self.selected, "*.", self.normal ), true, true ); - if( lHandle < 0 ) { - return; - } - lCount = search_getsize( lHandle ); - - String_EntitySet( self, valueList, "" ); - String_EntitySet( self, descList, "" ); - - lMaskStart = strlen( self.selected ); - lMaskedLength = lMaskStart + strlen( self.normal) + 1; // +1 because of the '.' - for( lCounter = 0 ; lCounter < lCount ; lCounter++ ) { - local string lFilename; - - lFilename = search_getfilename( lHandle, lCounter ); - self.valueList = Util_AltStringPushBack( self.valueList, lFilename ); - self.descList = Util_AltStringPushBack( self.descList, substring( lFilename, lMaskStart, strlen( lFilename ) - lMaskedLength ) ); - } - - self.minValue = 0.0; - if( lCount > 0 ) { - self.stepValue = 1.0; - self.maxValue = lCount - 1; - } else { - self.stepValue = 0.0; - self.maxValue = 0.0; - } -}; - -/* -=================== -Item_DataLink_Nex_FileList_Destroy -=================== -*/ -void() Item_DataLink_Nex_FileList_Destroy = -{ - String_EntityFree( self, valueList ); - String_EntityFree( self, normal ); - String_EntityFree( self, selected ); - - Item_DataLink_Switch_Destroy(); -}; - -/* -=================== -Item_DataLink_Nex_FileList_DataEvent -=================== -*/ -void( float pEvent ) Item_DataLink_Nex_FileList_DataEvent = -{ - switch( pEvent ) { - case ITEM_DATA_SYNC: - IDLNFL_Sync(); - break; - case ITEM_DATA_RESET: - IDLNFL_Sync(); - self._realValue = 0.0; - break; - case ITEM_DATALINK_SET: - Item_DataLink_Value_Clamp(); - break; - case ITEM_DATALINK_GET: - String_EntitySet( self, value, String_Normal( Util_GetAltStringItem( self.descList, self._realValue ) ) ); - break; - } -}; - -/* -=================== -Item_DataLink_Nex_FileList_Spawn -=================== -*/ -void() Item_DataLink_Nex_FileList_Spawn = -{ - Item_DataLink_Switch_Init(); - - String_EntityCreate( self, valueList ); - String_EntityZone( self, normal ); - String_EntityZone( self, selected ); - - self._reinit = IDLNFL_Sync; - self._destroy = Item_DataLink_Nex_FileList_Destroy; - self._dataEvent = Item_DataLink_Nex_FileList_DataEvent; -}; diff --git a/scmenu/source/custom/creategame/maps.qc b/scmenu/source/custom/creategame/maps.qc deleted file mode 100644 index c94452e47..000000000 --- a/scmenu/source/custom/creategame/maps.qc +++ /dev/null @@ -1,715 +0,0 @@ -// Property of Alientrap/AK -// custom/creategame/maps.qc - -/* -=================== -Item_Nex_Map_Info -=================== -*/ - -/* -=================== -Item_Nex_Map_Info_Destroy -=================== -*/ -void() Item_Nex_Map_Info_Destroy = -{ - String_EntityFree( self, link ); - String_EntityFree( self, picture ); - String_EntityFree( self, text ); - String_EntityFree( self, normal ); -}; - -/* -=================== -Item_Nex_Map_Info_Spawn -=================== -*/ -void() Item_Nex_Map_Info_Spawn = -{ - String_EntityZone( self, link ); - String_EntityZone( self, picture ); - String_EntityZone( self, text ); - String_EntityZone( self, normal ); - - Gfx_Precache( self.picture ); - - self._destroy = Item_Nex_Map_Info_Destroy; -}; - -/* -=================== -Item_Nex_MapDB -=================== -*/ -string _Nex_MapList_FullPath; -string _Nex_MapList_Name; -string _Nex_MapList_FilteredFullPath; -string _Nex_MapList_FilteredName; -string _Nex_MapList_Filter; -entity _Nex_MapList_Root; - -/* -=================== -Item_Nex_MapDB_EnumFiles -=================== -*/ -// map definition format -// name -// rest: description text -void() Item_Nex_MapDB_EnumFiles = -{ - local float lSearchHandle; - local float lSearchSize; - local float lSearchCounter; - local entity lMap; - - lSearchHandle = search_begin( "maps/*.mapcfg", true, true ); - if( lSearchHandle < 0 ) - return; - for( lSearchSize = search_getsize( lSearchHandle ), lSearchCounter = 0; - lSearchCounter < lSearchSize; ++lSearchCounter ) { - local float lHandle; - - local string lFilename; - local string lStripped; - local string lPic; - local string lName; - local string lDescription; - local string lTitle; - - lFilename = search_getfilename( lSearchHandle, lSearchCounter ); - lStripped = String_Zone( substring( lFilename, 0, strlen( lFilename ) - 7 ) ); - lName = String_Zone( substring( lStripped, 5, 100000 ) ); - - lHandle = fopen( strcat( lStripped, ".txt" ), FILE_READ ); - if( lHandle < 0 ) { - lTitle = String_Zone( lName ); - lDescription = String_Zone( strcat( "--NO INFORMATION AVAILABLE--\n", lFilename ) ); - } else { - // uncomment this line and comment the other if you have the old map info files - //lTitle = String_Zone( lName ); - lTitle = String_Zone( fgets( lHandle ) ); - lPic = fgets( lHandle ); // also get picture - if(lPic) - { - lStripped = String_Zone( lPic ); - } - - lDescription = String_Create(); - do { - local string lLine; - - lLine = fgets( lHandle ); - lDescription = String_Append( lDescription, strcat( lLine, "\n" ) ); - } while( validstring( lLine ) ); - - fclose( lHandle ); - } - - // save this in a new Map_Info - lMap = Menu_CreateItem( "Item_Nex_Map_Info", ftos( lSearchCounter ), self.name ); - - lMap.link = lName; - // check the picture - if( Gfx_Precache( lStripped ) ) { - lMap.picture = lStripped; - } else { - lMap.picture = "gfx/m_nomap"; - } - lMap.normal = lTitle; - lMap.text = lDescription; - - _Nex_MapList_FullPath = Util_AltStringPushBack( _Nex_MapList_FullPath, lName ); - _Nex_MapList_Name = Util_AltStringPushBack( _Nex_MapList_Name, lTitle ); - - Menu_LinkItem( lMap ); - - String_Free( lTitle ); - String_Free( lName ); - String_Free( lStripped ); - String_Free( lDescription ); - } - - search_end( lSearchHandle ); - - _Nex_MapList_FilteredFullPath = String_Set( _Nex_MapList_FilteredFullPath, _Nex_MapList_FullPath ); - _Nex_MapList_FilteredName = String_Set( _Nex_MapList_FilteredName, _Nex_MapList_Name ); - - Menu_LinkChildren( self ); - - self.minValue = 1; - self.stepValue = 1; - self.maxValue = fabs( lMap.orderPos ); -}; - -/* -=================== -Item_Nex_MapDB_Destroy -=================== -*/ -void() Item_Nex_MapDB_Destroy = -{ - String_Free( _Nex_MapList_FullPath ); - String_Free( _Nex_MapList_Name ); - String_Free( _Nex_MapList_FilteredFullPath ); - String_Free( _Nex_MapList_FilteredName ); - String_Free( _Nex_MapList_Filter ); - - _Nex_MapList_Root = null_entity; -}; - -/* -=================== -Item_Nex_MapDB_Spawn -=================== -*/ -void() Item_Nex_MapDB_Spawn = -{ - if( _Nex_MapList_Root ) - error( "There is already another Item_Nex_MapDB object!" ); - - _Nex_MapList_FullPath = String_Create(); - _Nex_MapList_Name = String_Create(); - _Nex_MapList_FilteredFullPath = String_Create(); - _Nex_MapList_FilteredName = String_Create(); - _Nex_MapList_Filter = String_Create(); - _Nex_MapList_Root = self; - - Item_Nex_MapDB_EnumFiles(); - - self._destroy = Item_Nex_MapDB_Destroy; -}; - -/* -=================== -Nex_MapDB_GetByName -=================== -*/ -entity( string pPath ) Nex_MapDB_GetByPath = -{ - local entity lNode; - - if( !_Nex_MapList_Root ) - error( "No Item_Nex_MapDB found!" ); - - for( lNode = _Nex_MapList_Root._child ; lNode ; lNode = lNode._next ) { - if( lNode.link == pPath ) { - return lNode; - } - } - - return null_entity; -}; - -/* -=================== -Nex_MapDB_GetFilteredByIndex -=================== -*/ -entity( float pIndex ) Nex_MapDB_GetFilteredByIndex = -{ - local entity lNode; - local float lFilteredIndex; - - if( !_Nex_MapList_Root ) - error( "No Item_Nex_MapDB found!" ); - - pIndex = fabs( pIndex ); - lFilteredIndex = 0; - for( lNode = _Nex_MapList_Root._child ; lNode ; lNode = lNode._next ) { - if( substring( lNode.link, 0, strlen( _Nex_MapList_Filter ) ) == _Nex_MapList_Filter ) { - ++lFilteredIndex; - } - if( pIndex == lFilteredIndex ) { - return lNode; - } - } - - return null_entity; -}; - -/* -=================== -Nex_MapDB_GetByIndex -=================== -*//* -entity( float pIndex ) Nex_MapDB_GetByIndex = -{ - local entity lNode; - - if( !_Nex_MapList_Root ) - error( "No Item_Nex_MapDB found!" ); - - pIndex = fabs( pIndex ); - for( lNode = _Nex_MapList_Root._child ; lNode ; lNode = lNode._next ) { - if( fabs( lNode.orderPos ) == pIndex ) { - return lNode; - } - } - - return null_entity; -};*/ - -/* -=================== -Nex_MapDB_FilterMaps -=================== -*/ -void( string pPrefix ) Nex_MapDB_FilterMaps = -{ - local float lPrefixLength; - local float lCounter; - local float lSize; - - _Nex_MapList_Filter = String_Set( _Nex_MapList_Filter, pPrefix ); - - _Nex_MapList_FilteredFullPath = String_Set( _Nex_MapList_FilteredFullPath, "" ); - _Nex_MapList_FilteredName = String_Set( _Nex_MapList_FilteredName, "" ); - - lPrefixLength = strlen( pPrefix ); - lSize = Util_GetAltStringCount( _Nex_MapList_FullPath ); - for( lCounter = 0 ; lCounter < lSize ; ++lCounter ) { - local string lPath; - - lPath = Util_GetAltStringItem( _Nex_MapList_FullPath, lCounter ); - if( substring( lPath, 0, lPrefixLength ) == pPrefix ) { - local string lName; - lName = Util_GetAltStringItem( _Nex_MapList_Name, lCounter ); - - _Nex_MapList_FilteredFullPath = Util_AltStringPushBack( _Nex_MapList_FilteredFullPath, lPath ); - _Nex_MapList_FilteredName = Util_AltStringPushBack( _Nex_MapList_FilteredName, lName ); - - String_Free( lName ); - } - - String_Free( lPath ); - } -}; - -/* -=================== -Nex_MapDB_GetFilteredPathAltString -=================== -*/ -string() Nex_MapDB_GetFilteredPathAltString = -{ - return _Nex_MapList_FilteredFullPath; -} - -/* -=================== -Nex_MapDB_GetFilteredNameAltString -=================== -*/ -string() Nex_MapDB_GetFilteredNameAltString = -{ - return _Nex_MapList_FilteredName; -}; - -/* -=================== -Nex_MapDB_GetPathAltString -=================== -*/ -string() Nex_MapDB_GetPathAltString = -{ - return _Nex_MapList_FullPath; -}; - -/* -=================== -Nex_MapDB_GetNameAltString -=================== -*/ -string() Nex_MapDB_GetNameAltString = -{ - return _Nex_MapList_Name; -}; - -/* -=================== -Nex_MapDB_GetFilteredIndex -=================== -*/ -float( entity pItem ) Nex_MapDB_GetFilteredIndex = -{ - local float lIndex; - local float lCount; - - lCount = Util_GetAltStringCount( _Nex_MapList_FilteredFullPath ); - for( lIndex = 0 ; lIndex < lCount ; ++lIndex ) { - local string lPath; - lPath = String_Normal( Util_GetAltStringItem( _Nex_MapList_FilteredFullPath, lIndex ) ); - if( lPath == pItem.link ) { - return lIndex + 1; - } - } - return 1; -}; - -/* -=================== -Item_DataLink_Nex_MapList_Save -=================== -*/ -void() Item_DataLink_Nex_MapList_Save = -{ - local float lCount; - local float lIndex; - local string lOutput; - - lOutput = String_Create(); - - lCount = Util_GetAltStringCount( self.valueList ); - for( lIndex = 0 ; lIndex < lCount ; lIndex++ ) { - lOutput = String_Append( lOutput, strcat( "\'", String_Normal( Util_GetAltStringItem( self.valueList, lIndex ) ), "\'" ) ); - } - - cvar_set( self.cvarName, lOutput ); - cvar_set( strcat( self.cvarName, "_index" ), "0" ); - - String_Free( lOutput ); -}; - -/* -=================== -Item_DataLink_Nex_MapList_Load -=================== -*/ -void() Item_DataLink_Nex_MapList_Load = -{ - local string lEntry; - local entity lMapInfo; - local float lCounter; - local float lCount; - - DataLink_Nex_MapList_Clear( self ); - - lCount = tokenize( cvar_string( self.cvarName ) ); - - lEntry = String_Create(); - for( lCounter = 0 ; lCounter < lCount ; lCounter++ ) { - lEntry = String_Set( lEntry, argv( lCounter ) ); - - lMapInfo = Nex_MapDB_GetByPath( lEntry ); - if( lMapInfo == null_entity ) { - print( self.cvarName, ": Map '", lEntry, "' not found in database - ignored\n" ); - continue; - } - - self.descList = Util_AltStringPushBack( self.descList, lMapInfo.normal ); - self.valueList = Util_AltStringPushBack( self.valueList, lMapInfo.link ); - } - String_Free( lEntry ); - - DataLink_Nex_MapList_UpdateRange( self ); - Nex_MapSelector_Synchronize(); -}; - -/* -=================== -Item_DataLink_Nex_MapList_ExecString -=================== -*/ -void() Item_DataLink_Nex_MapList_ExecString = -{ - local float lCount; - local float lIndex; - - Data_ExecString = String_Append( Data_ExecString, strcat( "set \"", self.cvarName, "_index\" \"0\"\nset \"", self.cvarName, "\" \"" ) ); - - lCount = Util_GetAltStringCount( self.valueList ); - for( lIndex = 0 ; lIndex < lCount ; lIndex++ ) { - Data_ExecString = String_Append( Data_ExecString, strcat( "\'", String_Normal( Util_GetAltStringItem( self.valueList, lIndex ) ), "\'" ) ); - } - - Data_ExecString = String_Append( Data_ExecString, "\"\n" ); -}; - -/* -=================== -Item_DataLink_Nex_MapList_DataEvent -=================== -*/ -void( float pEvent ) Item_DataLink_Nex_MapList_DataEvent = -{ - switch( pEvent ) { - case ITEM_DATA_SYNC: - if( self.cvarName != "" ) { - Item_DataLink_Nex_MapList_Load(); - } - break; - case ITEM_DATA_SEND: - if( self.cvarName != "" ) { - Item_DataLink_Nex_MapList_Save(); - } - break; - case ITEM_DATA_RESET: - self._realValue = 1.0; - break; - case ITEM_DATA_TEST_START: - break; - case ITEM_DATA_TEST_END: - break; - case ITEM_DATA_SAVE_EXECSTRING: - if( self.cvarName != "" ) { - Item_DataLink_Nex_MapList_ExecString(); - } - break; - case ITEM_DATALINK_SET: - case ITEM_DATALINK_GET: - self._realValue = floor( self._realValue ); - if( self._realValue < 1.0 ) { - self._realValue = 1.0; - } else if( self._realValue > self.maxValue ) { - self._realValue = self.maxValue; - } - - break; - } -}; - -/* -=================== -IDLNML_Reinit -=================== -*/ -void() IDLNML_Reinit = -{ - Raise_DataEvent( self, ITEM_DATA_SYNC ); -}; - -/* -=================== -Item_DataLink_Nex_MapList_Destroy -=================== -*/ -void() Item_DataLink_Nex_MapList_Destroy = -{ - String_EntityFree( self, valueList ); - String_EntityFree( self, cvarName ); - - Item_DataLink_Switch_Destroy(); -}; - -/* -=================== -Item_DataLink_Nex_MapList_Spawn -=================== -*/ -void() Item_DataLink_Nex_MapList_Spawn = -{ - Item_DataLink_Switch_Init(); - String_EntityZone( self, valueList ); - String_EntityZone( self, cvarName ); - - if( self.cvarName != "" ) { - registercvar( self.cvarName, "", CVAR_SAVE ); - registercvar( strcat( self.cvarName, "_index" ), "", CVAR_SAVE ); - } - - self.minValue = 1.0; - self.maxValue = 1.0; - self.stepValue = 0.0; - - self._reinit = IDLNML_Reinit; - self._dataEvent = Item_DataLink_Nex_MapList_DataEvent; - self._destroy = Item_DataLink_Nex_MapList_Destroy; - - CtCall_Init(); -}; - -/* -=================== -Item_DataLink_Nex_MapList_InitWithMapList -=================== -*/ -void() Item_DataLink_Nex_MapList_InitWithMapList = -{ - String_EntitySet( self, valueList, Nex_MapDB_GetFilteredPathAltString() ); - String_EntitySet( self, descList, Nex_MapDB_GetFilteredNameAltString() ); - - self._realValue = 1.0; - DataLink_Nex_MapList_UpdateRange( self ); -}; - -/* -=================== -DataLink_Nex_MapList_UpdateRange -=================== -*/ -void( entity pItem ) DataLink_Nex_MapList_UpdateRange = -{ - pItem.minValue = 1.0; - pItem.maxValue = Util_GetAltStringCount( pItem.descList ); - - if( pItem.maxValue >= 1 ) { - pItem.stepValue = 1.0; - } else { - pItem.maxValue = 1.0; - pItem.stepValue = 0.0; - } -}; - -/* -=================== -DataLink_Nex_MapList_InsertEntryAfter -=================== -*/ -void( entity pItem, string pName, string pPath ) DataLink_Nex_MapList_InsertEntryAfter = -{ - local float lIndex; - - Raise_DataEvent( pItem, ITEM_DATALINK_GET ); - // - 1, because minValue == 1 - lIndex = pItem._realValue - 1; - pItem.descList = Util_InsAltStringItem( pItem.descList, lIndex, pName ); - pItem.valueList = Util_InsAltStringItem( pItem.valueList, lIndex, pPath ); - - DataLink_Nex_MapList_UpdateRange( pItem ); -}; - -/* -=================== -DataLink_Nex_MapList_DeleteEntry -=================== -*/ -void( entity pItem ) DataLink_Nex_MapList_DeleteEntry = -{ - local float lIndex; - - if( pItem.stepValue == 0.0 ) - return; - - Raise_DataEvent( pItem, ITEM_DATALINK_GET ); - lIndex = pItem._realValue - 1; - pItem.descList = Util_DelAltStringItem( pItem.descList, lIndex ); - pItem.valueList = Util_DelAltStringItem( pItem.valueList, lIndex ); - - DataLink_Nex_MapList_UpdateRange( pItem ); -}; - -/* -=================== -DataLink_Nex_MapList_MoveEntryUp -=================== -*/ -void( entity pItem ) DataLink_Nex_MapList_MoveEntryUp = -{ - local string lName; - local string lPath; - local float lIndexNew; - local float lIndexOld; - - Raise_DataEvent( pItem, ITEM_DATALINK_GET ); - if( pItem._realValue == 1 ) - return; - - // map 1..n to 0..n-1 - lIndexOld = pItem._realValue - 1; - - // we want to insert it up by one, ie. insert it after up by two - lIndexNew = lIndexOld - 2; - - lName = Util_GetAltStringItem( pItem.descList, lIndexOld ); - lPath = Util_GetAltStringItem( pItem.valueList, lIndexOld ); - - pItem.descList = Util_InsAltStringItem( pItem.descList, lIndexNew, String_Normal( lName ) ); - pItem.valueList = Util_InsAltStringItem( pItem.valueList, lIndexNew, String_Normal( lPath ) ); - - // adjust lIndexOld for the entry that has been inserted before it - lIndexOld = lIndexOld + 1; - - pItem.descList = Util_DelAltStringItem( pItem.descList, lIndexOld ); - pItem.valueList = Util_DelAltStringItem( pItem.valueList, lIndexOld ); - - DataLink_Nex_MapList_UpdateRange( pItem ); -}; - -/* -=================== -DataLink_Nex_MapList_MoveEntryDown -=================== -*/ -void( entity pItem ) DataLink_Nex_MapList_MoveEntryDown = -{ - local string lName; - local string lPath; - local float lIndexNew; - local float lIndexOld; - - Raise_DataEvent( pItem, ITEM_DATALINK_GET ); - if( pItem._realValue == pItem.maxValue ) - return; - - // map 1..n to 0..n-1 - lIndexOld = pItem._realValue - 1; - - // we want to insert it down by one - lIndexNew = lIndexOld + 1; - - lName = Util_GetAltStringItem( pItem.descList, lIndexOld ); - lPath = Util_GetAltStringItem( pItem.valueList, lIndexOld ); - - pItem.descList = Util_InsAltStringItem( pItem.descList, lIndexNew, String_Normal( lName ) ); - pItem.valueList = Util_InsAltStringItem( pItem.valueList, lIndexNew, String_Normal( lPath ) ); - - pItem.descList = Util_DelAltStringItem( pItem.descList, lIndexOld ); - pItem.valueList = Util_DelAltStringItem( pItem.valueList, lIndexOld ); - - DataLink_Nex_MapList_UpdateRange( pItem ); -}; - -/* -=================== -DataLink_Nex_MapList_SetFirst -=================== -*/ -void( entity pItem, string pName, string pPath ) DataLink_Nex_MapList_SetFirst = -{ - if( pItem.stepValue == 0.0 ) { - pItem.descList = Util_AltStringPush( pItem.descList, pName ); - pItem.valueList = Util_AltStringPush( pItem.valueList, pPath ); - } else { - pItem.descList = Util_SetAltStringItem( pItem.descList, 0, pName ); - pItem.valueList = Util_SetAltStringItem( pItem.valueList, 0, pPath ); - } - - DataLink_Nex_MapList_UpdateRange( pItem ); -}; - -/* -=================== -DataLink_Nex_MapList_Clear -=================== -*/ -void( entity pItem ) DataLink_Nex_MapList_Clear = -{ - String_EntitySet( pItem, descList, "" ); - String_EntitySet( pItem, valueList, "" ); - - DataLink_Nex_MapList_UpdateRange( pItem ); -}; - -/* -=================== -DataLink_Nex_MapList_GetCurrentName -=================== -*/ -string( entity pItem ) DataLink_Nex_MapList_GetCurrentName = -{ - Raise_DataEvent( pItem, ITEM_DATALINK_GET ); - return Util_GetAltStringItem( pItem.descList, pItem._realValue - 1 ); -}; - -/* -=================== -DataLink_Nex_MapList_GetCurrentPath -=================== -*/ -string( entity pItem ) DataLink_Nex_MapList_GetCurrentPath = -{ - Raise_DataEvent( pItem, ITEM_DATALINK_GET ); - return Util_GetAltStringItem( pItem.valueList, pItem._realValue - 1 ); -}; diff --git a/scmenu/source/custom/creategame/mods.qc b/scmenu/source/custom/creategame/mods.qc deleted file mode 100644 index 91b97c634..000000000 --- a/scmenu/source/custom/creategame/mods.qc +++ /dev/null @@ -1,84 +0,0 @@ -// Property of Alientrap/AK -// custom/creategame/mods.qc - -/* -=================== -Item_DataLink_Nex_ModSwitch -=================== -*/ - -// first line filename -// second line mod name -// repeat -void() _IDLNMS_Build = -{ - local float lSearchHandle; - local float lSearchSize; - local float lSearchCounter; - - lSearchHandle = search_begin( "*.modinfo", true, true ); - if( lSearchHandle < 0 ) { - String_EntitySet( self, valueList, "'progs.dat'" ); - String_EntitySet( self, descList, "'Deathmatch'" ); - return; - } - - for( lSearchSize = search_getsize( lSearchHandle ), lSearchCounter = 0; - lSearchCounter < lSearchSize; ++lSearchCounter ) { - local float lHandle; - local string lFilename; - - local string lModName; - local string lModPath; - local string lLine; - - lFilename = search_getfilename( lSearchHandle, lSearchCounter ); - lHandle = fopen( lFilename, FILE_READ ); - if( lHandle < 0 ) { - print( "Menu: Couldn't open modinfo file '", lFilename, "'\n" ); - continue; - } - - lModPath = String_Create(); - lModName = String_Create(); - while( 1 ) { - lLine = fgets( lHandle ); - if( !validstring( lLine ) ) - break; - - lModPath = String_Set( lModPath, lLine ); - - lLine = fgets( lHandle ); - if( !validstring( lLine ) ) - break; - - lModName = String_Set( lModName, lLine ); - - String_EntitySet( self, valueList, strcat( self.valueList, lModPath, " " ) ); - String_EntitySet( self, descList, strcat( self.descList, lModName, " " ) ); - } - String_Free( lModPath ); - String_Free( lModName ); - - fclose( lHandle ); - } - - search_end( lSearchHandle ); -}; - -void() Item_DataLink_Nex_ModSwitch_Spawn = -{ - local string lTemp1, lTemp2; - - String_EntityCreate( self, valueList ); - String_EntityCreate( self, descList ); - - _IDLNMS_Build(); - - lTemp1 = self.descList; - lTemp2 = self.valueList; - Item_DataLink_TextSwitch_Spawn(); - String_Free( lTemp1 ); - String_Free( lTemp2 ); -}; - diff --git a/scmenu/source/custom/credits.qc b/scmenu/source/custom/credits.qc deleted file mode 100644 index 90a262f3a..000000000 --- a/scmenu/source/custom/credits.qc +++ /dev/null @@ -1,26 +0,0 @@ -// Property of Alientrap/AK -// custom/credits.qc - -void() Item_Nex_Credits_Spawn = -{ - local float lFile; - local string lText, lLine; - - lFile = fopen( self.target, FILE_READ ); - if( lFile < 0 ) { - // shut up - Menu_DeleteAfterToggle( self ); - return; - } - - lText = String_Create(); - do { - lLine = fgets( lFile ); - lText = String_Append( lText, strcat( lLine, "\n" ) ); - } while( validstring( lLine ) ); - self.text = lText; - fclose( lFile ); - - Item_MultiLabel_Spawn(); - String_Free( lText ); -}; diff --git a/scmenu/source/custom/credits.qh b/scmenu/source/custom/credits.qh deleted file mode 100644 index 972a3f303..000000000 --- a/scmenu/source/custom/credits.qh +++ /dev/null @@ -1,7 +0,0 @@ -// Property of Alientrap/AK -// custom/credits.qh - -// Item_Nex_Credits Item_MultiLabel -.string target; // filename - -void() Item_Nex_Credits_Spawn; diff --git a/scmenu/source/custom/credits.qm b/scmenu/source/custom/credits.qm deleted file mode 100644 index 36722d0b4..000000000 --- a/scmenu/source/custom/credits.qm +++ /dev/null @@ -1,67 +0,0 @@ -// Property of Alientrap/Ak -// custom/credits.qm - -void() Nex_Credits_SetSizeX = -{ - local entity lItem; - - lItem = Menu_GetItem( "Credits" ); - lItem.size_x = self._parent.size_x; -}; - -void() Nex_Credits_Scroll = -{ - local entity lItem, lTarget; - - lItem = Menu_GetItem( "Credits" ); - lTarget = self._parent; - - lTarget.origin = lTarget.origin - Timer_Delta * self.direction; - if( self.direction_x ) { - if( lTarget.origin_x < -lItem.size_x ) - lTarget.origin_x = lTarget.size_x; - if( lTarget.origin_x > lItem.size_x ) - lTarget.origin_x = -lItem.size_x; - } - if( self.direction_y ) { - if( lTarget.origin_y < -lItem.size_y ) - lTarget.origin_y = lTarget.size_y; - if( lTarget.origin_y > lItem.size_y ) - lTarget.origin_y = -lItem.size_y; - } -}; - -void() Nex_Credits_Toggle = -{ - local entity lEntity; - - lEntity = Menu_GetItem( "CreditsWnd" ); - if( lEntity.flag & FLAG_HIDDEN ) { - lEntity.flag = lEntity.flag - FLAG_HIDDEN; - Menu_Select( Menu_GetItem( "CreditsWnd::Layout::Items::Close" ), false ); - } else { - lEntity.flag = lEntity.flag + FLAG_HIDDEN; - Menu_Reselect( false ); - } -} - -bool( float pKey, float pAscii ) Nex_Credits_Key = -{ - if( pKey == K_ESCAPE ) { - Nex_Credits_Toggle(); - return true; - } - return false; -}; - -void() Nex_Credits_Action = -{ - local entity lEntity; - - lEntity = Menu_GetItem( "CreditsWnd" ); - if( lEntity.flag & FLAG_HIDDEN ) - lEntity.flag = lEntity.flag - FLAG_HIDDEN; - Menu_Select( Menu_GetItem( "CreditsWnd::Layout::Items::Close" ), false ); - lEntity = Menu_GetItem( "CreditsWnd::Layout::Items::Scroller" ); - lEntity.origin_y = lEntity.size_y; -} diff --git a/scmenu/source/custom/custom.qh b/scmenu/source/custom/custom.qh deleted file mode 100644 index 748ad193d..000000000 --- a/scmenu/source/custom/custom.qh +++ /dev/null @@ -1,5 +0,0 @@ -// Property of Alientrap/AK -// custom/custom.qh - -// Moves through all of pItem's neighbors and makes pItem the only visible item -void( entity pItem ) Nex_MakeOnlyVisible; diff --git a/scmenu/source/custom/globalkey.qm b/scmenu/source/custom/globalkey.qm deleted file mode 100644 index 826acac1f..000000000 --- a/scmenu/source/custom/globalkey.qm +++ /dev/null @@ -1,32 +0,0 @@ -// Property of Alientrap/AK -// custom/globalkey.qm - -bool( float pKey, float pAscii ) Nex_Global_Key = -{ - switch( pKey ) { - case K_UPARROW: - case K_KP_UPARROW: - case K_LEFTARROW: - case K_KP_LEFTARROW: - Menu_SelectPrev( true ); - break; - case K_DOWNARROW: - case K_KP_DOWNARROW: - case K_RIGHTARROW: - case K_KP_RIGHTARROW: - Menu_SelectNext( true ); - break; - case K_ESCAPE: - case K_MOUSE2: - Menu_SelectUp( true ); - break; - case K_ENTER: - if( !Menu_SelectDown( true ) ) - Sound_Play( ITEM_SOUND_NOSELECT ); - break; - default: - break; - } - return true; -}; - diff --git a/scmenu/source/custom/joingame.qc b/scmenu/source/custom/joingame.qc deleted file mode 100644 index 5cec662b9..000000000 --- a/scmenu/source/custom/joingame.qc +++ /dev/null @@ -1,113 +0,0 @@ -// Property of Alientrap/AK -// custom/joingame/joingame.qc - -//////////////////////////////////// -// Item_Nex_HostCache_Entry -////// - -void() Item_Nex_HostCache_Entry_Update = -{ - if( HostCache_ViewCount <= self.stepValue ) { - self.flag = self.flag | FLAG_HIDDEN; - return; - } else if( self.flag & FLAG_HIDDEN ) - self.flag = self.flag - FLAG_HIDDEN; - - if( Menu_HasRunFlag( self, RUNFLAG_CLIPPED ) ) - return; - - Item_Button_Update(); -}; - -void() Item_Nex_HostCache_Entry_Draw = -{ - Item_Window_Draw(); - Item_Button_Draw(); -}; - -void() Item_Nex_HostCache_Entry_Spawn = -{ - Item_Window_Spawn(); - Item_Button_Spawn(); - - self.flag = self.flag | FLAG_HIDDEN; // we dont want to get this bloody hostcachestring warning - if( self.flag & FLAG_NOSELECT ) - self.flag = self.flag - FLAG_NOSELECT; - self._draw = Item_Nex_HostCache_Entry_Draw; - self._update = Item_Nex_HostCache_Entry_Update; -}; - -//////////////////////////////////// -// Item_Nex_HostCache_StringField -//////// - -void() Item_Nex_HostCache_StringField_Update = -{ - local float lMaxLen; - local string lString; - - if( HostCache_ViewCount <= self._parent.stepValue ) - return; - lMaxLen = floor( self.size_x / self.fontSize_x ); - lString = gethostcachestring( self._realValue, self._parent.stepValue ); - if( lMaxLen < strlen( lString ) ) { - lString = strcat( substring( lString, 0, lMaxLen - 3 ), "..." ); - } - String_EntitySet( self, text, lString ); - - Item_Label_Update(); -}; - -void() Item_Nex_HostCache_StringField_Spawn = -{ - Item_Label_Spawn(); - - self._realValue = gethostcacheindexforkey( self.target ); - self._update = Item_Nex_HostCache_StringField_Update; -}; - -//////////////////////////////////// -// Item_Nex_HostCache_ValueField -//////// - -void() Item_Nex_HostCache_ValueField_Update = -{ - if( HostCache_ViewCount <= self._parent.stepValue ) - return; - String_EntitySet( self, text, ftos( gethostcachenumber( self._realValue, self._parent.stepValue ) ) ); - - Item_Label_Update(); -}; - -void() Item_Nex_HostCache_ValueField_Spawn = -{ - Item_Label_Spawn(); - - self._realValue = gethostcacheindexforkey( self.target ); - self._update = Item_Nex_HostCache_ValueField_Update; -}; - -////////////////////////////////// -// Item_Nex_HostCache_Players -/////// - -void() Item_Nex_HostCache_Players_Update = -{ - local string lNum, lMax; - - if( HostCache_ViewCount <= self._parent.stepValue ) - return; - lNum = ftos( gethostcachenumber( SLIST_FIELD_NUMPLAYERS, self._parent.stepValue ) ); - lMax = ftos( gethostcachenumber( SLIST_FIELD_MAXPLAYERS, self._parent.stepValue ) ); - - String_EntitySet( self, text, strcat( lNum, "/", lMax ) ); - - Item_Label_Update(); -}; - -void() Item_Nex_HostCache_Players_Spawn = -{ - Item_Label_Spawn(); - - self._update = Item_Nex_HostCache_Players_Update; -}; diff --git a/scmenu/source/custom/joingame.qh b/scmenu/source/custom/joingame.qh deleted file mode 100644 index ba0f3b9a0..000000000 --- a/scmenu/source/custom/joingame.qh +++ /dev/null @@ -1,31 +0,0 @@ -// Property of Alientrap -// custom/joingame/joingame.qh - -// Item_Nex_HostCache_Entry Item_Arrangement -.string soundSelected; -.vector color; -.float alpha; -.float drawFlag; -.float stepValue; // contains the entry number - -void() Item_Nex_HostCache_Entry_Update; -void() Item_Nex_HostCache_Entry_Spawn; - -// Item_Nex_HostCache_StringField Item_Label -.float _realValue; // contains the field number -.string target; // wont be zoned - -void() Item_Nex_HostCache_StringField_Update; -void() Item_Nex_HostCache_StringField_Spawn; - -// Item_Nex_HostCache_ValueField Item_Label -.float _realValue; // contains the field number -.string target; // wont be zoned - -void() Item_Nex_HostCache_ValueField_Update; -void() Item_Nex_HostCache_ValueField_Spawn; - -// Item_Nex_HostCache_Players Item_Label -void() Item_Nex_HostCache_Players_Update; -void() Item_Nex_HostCache_Players_Spawn; - diff --git a/scmenu/source/custom/joingame.qm b/scmenu/source/custom/joingame.qm deleted file mode 100644 index 010adb352..000000000 --- a/scmenu/source/custom/joingame.qm +++ /dev/null @@ -1,231 +0,0 @@ -// Property of Alientrap -// custom/joingame.qm - -// stepValue should contain the field name -void() Nex_Action_JoinGame_SortBy_Action = -{ - if( HostCache_SortField == self._realValue ) - sethostcachesort( self._realValue, !HostCache_SortDescending ); - else - sethostcachesort( self._realValue, true ); - HostCache_ResortViewSet(); -}; - -void() Nex_Action_JoinGame_SortBy = -{ - self._realValue = gethostcacheindexforkey( self.target ); - self.action = Nex_Action_JoinGame_SortBy_Action; -}; - -void() Nex_Automation_CreateEntries = -{ - local entity lTemplate; - local float lCounter; - - lTemplate = Menu_GetItem( "Entry" ); - for( lCounter = 0 ; lCounter < 64 ; ++lCounter ) { - local entity lEntry; - - lEntry = Menu_DeriveItem( lTemplate, strcat( "Entry", ftos( lCounter) ), self.parent, true ); - lEntry.stepValue = lCounter; - } - Menu_LinkItem( self._parent ); -}; - -void() Nex_Action_EntryConnect = -{ - cmd( "connect \"" ); - cmd( gethostcachestring( SLIST_FIELD_CNAME, self.stepValue ) ); - cmd( "\"\n" ); - - m_hide(); -}; - -void() Nex_Action_RefreshSlist = -{ - HostCache_RefreshHostCache(); -}; - -void() Nex_Action_JumpToJoinGame = -{ - local entity lItem; - - resethostcachemasks(); - sethostcachesort( SLIST_FIELD_PING, false ); - HostCache_RefreshHostCache(); - - lItem = Menu_GetItem( "Normal::Panel" ); - String_EntitySet( lItem, link, "JoinGame" ); - - Raise_Update( lItem ); - Menu_UpdateRunFlags(); - Menu_JumpToWindow( lItem._link, false, false ); -}; - -// mask parser -/* query string format: - two types: -1) Prefix "mask" Advanced query - Format: ( and|or TYPE OP MASK [...] )* - TYPE : one of the slist fields - OP: - <;<=;>=;==;!= normal arithmetic comparison operators (default <=) (= instead of == also supported) - $$ 'does contain' (default string op) - !$ 'does not contain' - : leads to default op - - On every occurence of AND or OR a new mask of the spec type is created. - E.g. or name: "WWClan" ping: 200 and protocol == 3 maxplayers > 5 - will create an or and an and mask -2) No prefix: - keyword * - - notempty - compatible (same net protocol version) - goodping (ping <= 150) - mediumping (ping <= 250) -*/ -#define GetNextToken if( ++lTokenNum > lTokenCount ) goto finish; else lToken = argv( lTokenNum ) -void() Nex_Action_ExecuteQuery = -{ - local float lAndPos, lOrPos; - local float lTokenNum, lTokenCount; - - resethostcachemasks(); - lAndPos = SLIST_MASK_AND; - lOrPos = SLIST_MASK_OR; - - lTokenCount = tokenize( self._target.value ); - - for( lTokenNum = 0 ; lTokenNum < lTokenCount ; ++lTokenNum ) { - local string lToken; - lToken = argv( lTokenNum ); - - if( lToken == "notempty" ) { - sethostcachemasknumber( lAndPos, SLIST_FIELD_NUMPLAYERS, 0, SLIST_TEST_NOTEQUAL ); - ++lAndPos; - } else if( lToken == "compatible" ) { - sethostcachemasknumber( lAndPos, SLIST_FIELD_PROTOCOL, NET_CURRENTPROTOCOL, SLIST_TEST_EQUAL ); - ++lAndPos; - } else if( lToken == "goodping" ) { - sethostcachemasknumber( lAndPos, SLIST_FIELD_PING, 150, SLIST_TEST_LESSEQUAL ); - ++lAndPos; - } else if( lToken == "mediumping" ) { - sethostcachemasknumber( lAndPos, SLIST_FIELD_PROTOCOL, 250, SLIST_TEST_LESSEQUAL ); - ++lAndPos; - } else if( lToken == "mask" ) { - // start the query loop - GetNextToken; - while( 1 ) { - local bool lAndMask; - - if( lToken == "or" ) - lAndMask = false; - else if( lToken == "and" ) - lAndMask = true; - else - goto finish; // abort the parsing - // now parse all condition fields - while( 1 ) { - local float lField; - local float lOperator; - local bool lIsStringArg; - - GetNextToken; - // now get the field number - if( lToken == "cname" ) { - lField = SLIST_FIELD_CNAME; - lIsStringArg = true; - } - else if( lToken == "ping" ) { - lField = SLIST_FIELD_PING; - lIsStringArg = false; - } - else if( lToken == "game" ) { - lField = SLIST_FIELD_GAME; - lIsStringArg = true; - } - else if( lToken == "mod" ) { - lField = SLIST_FIELD_MOD; - lIsStringArg = true; - } - else if( lToken == "map" ) { - lField = SLIST_FIELD_MAP; - lIsStringArg = true; - } - else if( lToken == "name" ) { - lField = SLIST_FIELD_NAME; - lIsStringArg = true; - } - else if( lToken == "maxplayers" ) { - lField = SLIST_FIELD_MAXPLAYERS; - lIsStringArg = false; - } - else if( lToken == "numplayers" ) { - lField = SLIST_FIELD_NUMPLAYERS; - lIsStringArg = false; - } - else if( lToken == "protocol" ) { - lField = SLIST_FIELD_PROTOCOL; - lIsStringArg = false; - } - else - { // increment the mask pos and let upper check for or or and - if( lAndMask ) - ++lAndPos; - else - ++lOrPos; - break; - } - // now lets determine the comparison operator - GetNextToken; - if( lToken == "$$" ) - lOperator = SLIST_TEST_CONTAINS; - else if( lToken == "!$" ) - lOperator = SLIST_TEST_NOTCONTAIN; - else if( lToken == "<" ) - lOperator = SLIST_TEST_LESS; - else if( lToken == "<=" ) - lOperator = SLIST_TEST_LESSEQUAL; - else if( lToken == "==" || lToken == "=" ) - lOperator = SLIST_TEST_EQUAL; - else if( lToken == ">" ) - lOperator = SLIST_TEST_GREATER; - else if( lToken == ">=" ) - lOperator = SLIST_TEST_GREATEREQUAL; - else if( lToken == "!=" ) - lOperator = SLIST_TEST_NOTEQUAL; - else if( lToken == ":" ) - if( lIsStringArg ) - lOperator = SLIST_TEST_CONTAINS; - else - lOperator = SLIST_TEST_LESSEQUAL; - else - goto finish; // abort the parsing - - GetNextToken; - if( lIsStringArg ) - if( lAndMask ) - sethostcachemaskstring( lAndPos, lField, lToken, lOperator ); - else - sethostcachemaskstring( lOrPos, lField, lToken, lOperator ); - else - if( lAndMask ) - sethostcachemasknumber( lAndPos, lField, stof( lToken ), lOperator ); - else - sethostcachemasknumber( lOrPos, lField, stof( lToken ), lOperator ); - } - } - } else { // lets have a try it with or and string contain - sethostcachemaskstring( lOrPos, SLIST_FIELD_MAP, lToken, SLIST_TEST_CONTAINS ); - lOrPos = lOrPos + 1; - sethostcachemaskstring( lOrPos, SLIST_FIELD_NAME, lToken, SLIST_TEST_CONTAINS ); - lOrPos = lOrPos + 1; - //sethostcachemasknumber( lOrPos, SLIST_FIELD_MOD, lToken, SLIST_TEST_CONTAINS ); - //lOrPos = lOrPos + 1; - } - } -:finish - HostCache_ResortViewSet(); -#undef GetNextToken() -}; diff --git a/scmenu/source/custom/key.qc b/scmenu/source/custom/key.qc deleted file mode 100644 index 646fbdd3a..000000000 --- a/scmenu/source/custom/key.qc +++ /dev/null @@ -1,162 +0,0 @@ -// Property of Alientrap/AK -// custom/key.qc - -void( float pEvent ) Item_Data_Nex_Key_DataEvent; - -void() _IDNK_Sync = -{ - String_EntitySet( self, value, String_Normal( Key_GetBindList( self.target ) ) ); - String_EntitySet( self, _syncValue, self.value ); -}; - -void() _IDNK_Set = -{ - local float lCount, lCounter; - - lCount = Util_GetAltStringCount( self.value ); - Key_LimitBinds( 0, self.target ); - - for( lCounter = 0 ; lCounter < lCount ; ++lCounter ) - Key_Bind( Key_GetName( stof( String_Normal( Util_GetAltStringItem( self.value, lCounter ) ) ) ), self.target ); -}; - -void() _IDNK_Send = -{ - _IDNK_Set(); - String_EntitySet( self, _syncValue, self.value ); -}; - -void() _IDNK_Reset = -{ - local float lCount, lCounter; - local string lKey; - // TODO: remove this - but we need this for testing purposes atm - // INFO: defValue should contain the key names used by DP not the key numbers! - if( !self.defValue ) - return; - - String_EntitySet( self, value, "" ); - - lCount = Util_GetAltStringCount( self.defValue ); - Key_LimitBinds( 0, self.target ); - - for( lCounter = 0 ; lCounter < lCount ; lCounter++ ) { - lKey = Util_GetAltStringItem( self.defValue, lCounter ); - Key_Bind( lKey, self.target ); - String_EntitySet( self, value, strcat( self.value, " '", Key_GetNum( lKey ), "'" ) ); - String_Free( lKey ); - } - - String_EntitySet( self, _syncValue, self.value ); -}; - -void() _IDNK_Test_Start = -{ - _IDNK_Set(); -}; - -void() _IDNK_Test_End = -{ - String_EntitySet( self, value, self._syncValue ); - _IDNK_Set(); -}; - -void( float pEvent ) Item_Data_Nex_Key_DataEvent = -{ - switch( pEvent ) { - case ITEM_DATA_SYNC: - _IDNK_Sync(); - break; - case ITEM_DATA_SEND: - _IDNK_Send(); - break; - case ITEM_DATA_RESET: - _IDNK_Reset(); - break; - case ITEM_DATA_TEST_START: - _IDNK_Test_Start(); - break; - case ITEM_DATA_TEST_END: - _IDNK_Test_End(); - break; - } -}; - -void() Item_Data_Nex_Key_Destroy = -{ - String_EntityFree( self, target ); - Item_Data_Destroy(); -}; - -void() Item_Data_Nex_Key_Spawn = -{ - Item_Data_Init(); - - String_EntityZone( self, target ); - - self._destroy = Item_Data_Nex_Key_Destroy; - self._reinit = _IDNK_Sync; - self._dataEvent = Item_Data_Nex_Key_DataEvent; -}; - - -/* -=================== -Item_Nex_KeyButton Item_Button -=================== -*/ - -bool( float pKey, float pAscii ) Item_Nex_KeyButton_Key = -{ - if( pKey == K_BACKSPACE ) { - local float lNum; - // unbind the key - Raise_DataEvent( self._target, ITEM_DATALINK_GET ); - lNum = stof( self._target.value ); - if( lNum >= 0 ) { - Key_Unbind( Key_GetName( lNum ) ); - Raise_DataEvent( self._target, ITEM_DATALINK_SET ); - } - return true; - } else if( pKey == K_UPARROW ) { - Menu_SelectPrev( false ); - Menu_SelectPrev( true ); - return true; - } else if( pKey == K_DOWNARROW ) { - Menu_SelectNext( false ); - Menu_SelectNext( true ); - return true; - } else - return Item_Button_Key( pKey, pAscii ); -}; - -void() Item_Nex_KeyButton_Update = -{ - local float lNum; - Item_DataUser_Update(); - - Raise_DataEvent( self._target, ITEM_DATALINK_GET ); - lNum = stof( self._target.value ); - if( lNum < 0 ) - String_EntitySet( self, normal, "-" ); - else - String_EntitySet( self, normal, Key_GetName( lNum ) ); - Item_Button_Update(); -}; - -void() Item_Nex_KeyButton_Destroy = -{ - Item_DataUser_Destroy(); - Item_Button_Destroy(); -}; - -void() Item_Nex_KeyButton_Spawn = -{ - Item_DataUser_Init(); - Item_Button_Spawn(); - - self._destroy = Item_Nex_KeyButton_Destroy; - self._update = Item_Nex_KeyButton_Update; - self._key = Item_Nex_KeyButton_Key; -}; - diff --git a/scmenu/source/custom/key.qh b/scmenu/source/custom/key.qh deleted file mode 100644 index 18ef4c621..000000000 --- a/scmenu/source/custom/key.qh +++ /dev/null @@ -1,13 +0,0 @@ -// Property of Alientrap/AK -// custom/key.qh - -// Item_Data_Nex_Key [Item_Data] -// value is an altstring which contains all assigned key names -// -.string target; // action name - -void( float pEvent ) Item_Data_Nex_Key_DataEvent; -void() Item_Data_Nex_Key_Spawn; - -// Item_Nex_KeyButton Item_Button -void() Item_Nex_KeyButton_Spawn; diff --git a/scmenu/source/custom/key.qm b/scmenu/source/custom/key.qm deleted file mode 100644 index 123ff46b5..000000000 --- a/scmenu/source/custom/key.qm +++ /dev/null @@ -1,65 +0,0 @@ -// Property of Alientrap -// custom/key.qm - -// link is the name of the datalink -.string target; -// text is the description text -.string text; - -/* -=================== -Nex_Automation_Key -=================== -*/ -// Embedded in a window with the following subitems: Action, Link1, Link2 -void() Nex_Automation_Key = -{ - local entity lAction, lLink1, lLink2; - - if( !self._parent.target ) { - objerror( "Bad target '", self._parent.target, "'" ); - return; - } - - // Get the children - lAction = Menu_GetItem( "Action" ); - lLink1 = Menu_GetItem( "Link1" ); - lLink2 = Menu_GetItem( "Link2" ); - - // Now set the properties - // (will be strzoned later by the Spawn functions) - lAction.text = self._parent.text; - - lLink1.link = self._parent.target; - lLink2.link = self._parent.target; -}; - -// more specific functions -// Menu_KeyHook_Target points to Link1/2 -void( float pKey, float pAscii ) Nex_Key_KeyHook = -{ - local entity lItem; - if( pKey != K_ESCAPE ) { - String_EntitySet( Menu_KeyHook_Target, value, ftos( pKey ) ); - Raise_DataEvent( Menu_KeyHook_Target, ITEM_DATALINK_SET ); - Raise_DataEvent( Menu_KeyHook_Target, ITEM_DATA_TEST_START ); - } - // hide the info window again - lItem = Menu_GetItemEx( Menu_KeyHook_Target, "InfoWindow", true ); - lItem.flag = lItem.flag | FLAG_HIDDEN; - - Menu_KeyHook = Util_NullFunction; -}; - -void() Nex_Action_KeyButton = -{ - local entity lItem; - - Menu_KeyHook_Target = self._target._link; - Menu_KeyHook = Nex_Key_KeyHook; - - // show the info window - lItem = Menu_GetItem( "InfoWindow" ); - lItem.flag = lItem.flag - (lItem.flag & FLAG_HIDDEN); -}; - diff --git a/scmenu/source/custom/messagebox.qc b/scmenu/source/custom/messagebox.qc deleted file mode 100644 index 62f90c802..000000000 --- a/scmenu/source/custom/messagebox.qc +++ /dev/null @@ -1,79 +0,0 @@ -// Property of Alientrap/AK -// custom/messagebox.qc - -var event Nex_MessageBox_LeftEvent = __NULL__; -var event Nex_MessageBox_RightEvent = __NULL__; - -void( string pTitle, string pText, string pLeftButton, string pRightButton, event pLeftEvent, event pRightEvent ) -Nex_MessageBox = -{ - local entity lItem; - - lItem = Menu_GetItem( "MessageBoxWnd::Layout::Title::Caption" ); - String_EntitySet( lItem, normal, pTitle ); - // reset its size since this one has to be centered and AlignCenter takes care of everything - //lItem.size = '0 0 0'; - - lItem = Menu_GetItem( "MessageBoxWnd::Layout::Text" ); - String_EntitySet( lItem, text, pText ); - lItem.size = '0 0 0'; - - lItem = Menu_GetItem( "MessageBoxWnd::Layout::Buttons::Left" ); - String_EntitySet( lItem, normal, pLeftButton ); - lItem.size = '0 0 0'; - - lItem = Menu_GetItem( "MessageBoxWnd::Layout::Buttons::Right" ); - String_EntitySet( lItem, normal, pRightButton ); - lItem.size = '0 0 0'; - if( strlen( pRightButton ) == 0 ) { - lItem.flag = lItem.flag | FLAG_HIDDEN; - } else if( lItem.flag & FLAG_HIDDEN ) { - lItem.flag = lItem.flag - FLAG_HIDDEN; - } - - Nex_MessageBox_LeftEvent = pLeftEvent; - Nex_MessageBox_RightEvent = pRightEvent; - - lItem = Menu_GetItem( "MessageBoxWnd" ); - if( lItem.flag & FLAG_HIDDEN ) - lItem.flag = lItem.flag - FLAG_HIDDEN; - - Menu_Select( Menu_GetItem( "MessageBoxWnd::Layout::Buttons::Right" ), false ); -}; - -void() Nex_MessageBox_Hide = -{ - local entity lEntity; - - lEntity = Menu_GetItem( "MessageBoxWnd" ); - if( !(lEntity.flag & FLAG_HIDDEN) ) { - lEntity.flag = lEntity.flag + FLAG_HIDDEN; - Menu_Reselect( false ); - } -} - -void() Nex_MessageBox_LeftButton = -{ - if( Nex_MessageBox_LeftEvent ) { - Nex_MessageBox_LeftEvent(); - } - Nex_MessageBox_Hide(); -}; - -void() Nex_MessageBox_RightButton = -{ - if( Nex_MessageBox_RightEvent ) { - Nex_MessageBox_RightEvent(); - } - Nex_MessageBox_Hide(); -}; - -bool( float pKey, float pAscii ) Nex_MessageBox_Key = -{ - if( pKey == K_ESCAPE ) { - // escape == right button! - Nex_MessageBox_RightButton(); - return true; - } - return false; -}; diff --git a/scmenu/source/custom/messagebox.qh b/scmenu/source/custom/messagebox.qh deleted file mode 100644 index 6683b748d..000000000 --- a/scmenu/source/custom/messagebox.qh +++ /dev/null @@ -1,5 +0,0 @@ -// Property of Alientrap/AK -// custom/messagebox.qh - -void( string pTitle, string pText, string pLeftButton, string pRightButton, event pLeftEvent, event pRightEvent ) -Nex_MessageBox; diff --git a/scmenu/source/custom/option.qm b/scmenu/source/custom/option.qm deleted file mode 100644 index a949375b4..000000000 --- a/scmenu/source/custom/option.qm +++ /dev/null @@ -1,113 +0,0 @@ -// Property of Alientrap -// custom/option.qm - -// uses .target to determine the target data item (or container) - -void() Nex_Action_ResetData_Destroy = -{ - String_EntityFree( self, target ); -}; - -void() Nex_Action_ResetData_Action = -{ - Raise_DataEvent( Menu_GetItem( self.target ), ITEM_DATA_RESET ); -}; - -void() Nex_Action_ResetData = -{ - String_EntityZone( self, target ); - - self.destroy = Nex_Action_ResetData_Destroy; - self.action = Nex_Action_ResetData_Action; -}; - - -// link is the name of the datalink -.string target; -// text is the description text -.string text; - -/* -=================== -Nex_Automation_Option_Slider -=================== -*/ -// Embedded in a window with the following subitems: Description, Slider, Value -void() Nex_Automation_Option_Slider = -{ - local entity lDescription, lSlider, lValue; - - if( !self._parent.target ) { - objerror( "Bad target '", self._parent.target, "'" ); - return; - } - - // Get the children - lDescription = Menu_GetItem( "Description" ); - lSlider = Menu_GetItem( "Slider" ); - lValue = Menu_GetItem( "Value" ); - - // Now set the properties - // (will be strzoned later by the Spawn functions) - lDescription.normal = self._parent.text; - lDescription.link = lSlider.name; - - lSlider.target = self._parent.target; - - lValue.target = self._parent.target; - lValue.link = lSlider.name; -}; - -/* -=================== -Nex_Automation_Option_EditBox -=================== -*/ -// Embedded in a window with the following subitems: Description, EditBox -void() Nex_Automation_Option_EditBox = -{ - local entity lDescription, lEditBox; - - if( !self._parent.target ) { - objerror( "Bad target '", self._parent.target, "'" ); - return; - } - - // Get the children - lDescription = Menu_GetItem( "Description" ); - lEditBox = Menu_GetItem( "EditBox" ); - - // Now set the properties - // (will be strzoned later by the Spawn functions) - lDescription.normal = self._parent.text; - lDescription.link = lEditBox.name; - - lEditBox.target = self._parent.target; -}; - -/* -=================== -Nex_Automation_Option_Switch -=================== -*/ -// Embedded in a window with the following subitems: Description, Switch -void() Nex_Automation_Option_Switch = -{ - local entity lDescription, lSwitch; - - if( !self._parent.target ) { - objerror( "Bad target '", self._parent.target, "'" ); - return; - } - - // Get the children - lDescription = Menu_GetItem( "Description" ); - lSwitch = Menu_GetItem( "Switch" ); - - // Now set the properties - // (will be strzoned later by the Spawn functions) - lDescription.normal = self._parent.text; - lDescription.link = lSwitch.name; - - lSwitch.target = self._parent.target; -}; diff --git a/scmenu/source/custom/player.qm b/scmenu/source/custom/player.qm deleted file mode 100644 index f4c734393..000000000 --- a/scmenu/source/custom/player.qm +++ /dev/null @@ -1,64 +0,0 @@ -// Property of Alientrap/AK -// custom/player/player.qm - -// uses target and _target -// requires neighbors: Picture, Name, Description -void() Nex_Automation_UpdateAvatar_Update = -{ - local entity lItem; - local entity lTarget; - - if( self._target.name != "Data::Player::Avatar" ) - self._target = Menu_GetItem( "Data::Player::Avatar" ); - - lTarget = self._target; - - lItem = Menu_GetItem( "Picture" ); - String_EntitySet( lItem, picture, lTarget._link.picture ); - - lItem = Menu_GetItem( "Name" ); - String_EntitySet( lItem, text, lTarget._link.normal ); - - lItem = Menu_GetItem( "Description" ); - String_EntitySet( lItem, text, lTarget._link.text ); -}; - -void() Nex_Automation_UpdateAvatar_Destroy = -{ - String_EntityFree( self, target ); -}; - -void() Nex_Automation_UpdateAvatar = -{ - String_EntityZone( self, target ); - - self._update = Nex_Automation_UpdateAvatar_Update; - self._destroy = Nex_Automation_UpdateAvatar_Destroy; -}; - -// more concrete functions -void() Nex_Action_Avatar_Next = -{ - local entity lItem; - - lItem = Menu_GetItem( "Data::Player::Avatar" ); - lItem._realValue = lItem._realValue + 1; - Raise_DataEvent( lItem, ITEM_DATALINK_SET ); -}; - -void() Nex_Action_Avatar_Prev = -{ - local entity lItem; - - lItem = Menu_GetItem( "Data::Player::Avatar" ); - lItem._realValue = lItem._realValue - 1; - Raise_DataEvent( lItem, ITEM_DATALINK_SET ); -}; - -void() Nex_Action_Player_Apply = -{ - local entity lItem; - - lItem = Menu_GetItem( "Data::Player" ); - Raise_DataEvent( lItem, ITEM_DATA_SEND ); -}; diff --git a/scmenu/source/custom/player/avatar.qc b/scmenu/source/custom/player/avatar.qc deleted file mode 100644 index 4c074fa62..000000000 --- a/scmenu/source/custom/player/avatar.qc +++ /dev/null @@ -1,236 +0,0 @@ -// Property of Alientrap/AK -// custom/player/avatar.qm - -/* -=================== -Item_Nex_Avatar_Info -=================== -*/ - -void() Item_Nex_Avatar_Info_Destroy = -{ - String_EntityFree( self, target ); - String_EntityFree( self, link ); - String_EntityFree( self, picture ); - String_EntityFree( self, text ); - String_EntityFree( self, normal ); -}; - -void() Item_Nex_Avatar_Info_Spawn = -{ - String_EntityZone( self, target ); - String_EntityZone( self, link ); - String_EntityZone( self, picture ); - String_EntityZone( self, text ); - String_EntityZone( self, normal ); - - Gfx_Precache( self.picture ); - - self._destroy = Item_Nex_Avatar_Info_Destroy; -}; - -/* -=================== -Item_Data_Nex_Avatar -=================== -*/ - - -// Nex_Action_Player_BuildAvatarList -// model definition format -// name -// picture\n -// skin filename\n -// model filename\n -// rest: description text -void() _IDNA_BuildList = -{ - local float lSearchHandle; - local float lSearchSize; - local float lSearchCounter; - local entity lAvatar; - - Menu_EmptyWindow( self ); - - // legacy mode - // TODO: - // FIXME: only accept *.mdef later - lSearchHandle = search_begin( "models/player/*.txt", true, true ); - if( lSearchHandle < 0 ) - return; - for( lSearchSize = search_getsize( lSearchHandle ), lSearchCounter = 0; - lSearchCounter < lSearchSize; ++lSearchCounter ) { - local string lFilename; - local float lHandle; - - local string lName; - local string lPicture; - local string lSkin; - local string lModel; - local string lDescription; - - lFilename = search_getfilename( lSearchHandle, lSearchCounter ); - lHandle = fopen( lFilename, FILE_READ ); - if( lHandle < 0 ) { - print( "Menu: Couldn't open model definition file '", lFilename, "'\n" ); - continue; - } - - lName = String_Zone( fgets( lHandle ) ); - lPicture = String_Zone( fgets( lHandle ) ); - lSkin = String_Zone( fgets( lHandle ) ); - lModel = String_Zone( fgets( lHandle ) ); - if( !lName || !lPicture || !lSkin || !lModel ) { - String_Free( lName ); - String_Free( lPicture ); - String_Free( lSkin ); - String_Free( lModel ); - print( "Menu: Couldn't parse model definition file '", - search_getfilename( lSearchHandle, lSearchCounter ), "'\n" ); - fclose( lHandle ); - continue; - } - lDescription = String_Create(); - do { - local string lLine; - - lLine = fgets( lHandle ); - lDescription = String_Append( lDescription, strcat( lLine, "\n" ) ); - } while( validstring( lLine ) ); - if( lDescription ) { // add this avatar_info - lAvatar = Menu_CreateItem( "Item_Nex_Avatar_Info", ftos( lSearchCounter ), self.name ); - - lAvatar.target = lModel; - lAvatar.link = lSkin; - lAvatar.picture = lPicture; - lAvatar.normal = lName; - lAvatar.text = lDescription; - - Menu_LinkItem( lAvatar ); - } - String_Free( lName ); - String_Free( lPicture ); - String_Free( lSkin ); - String_Free( lModel ); - String_Free( lDescription ); - fclose( lHandle ); - } - - search_end( lSearchHandle ); - - Menu_LinkChildren( self ); - - self.minValue = 1; - self.stepValue = 1; - self.maxValue = fabs( lAvatar.orderPos ); -}; - -void() _IDNA_Sync = -{ - local string lModel, lSkin; - local entity lMatch; - - lModel = String_Zone( cvar_string( "_cl_playermodel" ) ); - lSkin = String_Zone( cvar_string( "_cl_playerskin" ) ); - - for( lMatch = self._child ; lMatch._next ; lMatch = lMatch._next ) - if( lMatch.target == lModel && lMatch.link == lSkin ) - break; - - if( lMatch ) { - self._link = lMatch; - self._realValue = fabs( lMatch.orderPos ); - String_EntitySet( self, value, ftos( self._realValue ) ); - String_EntitySet( self, _syncValue, self.value ); - } - - String_Free( lModel ); - String_Free( lSkin ); -}; - -void() _IDNA_UpdateLink = -{ - local float lCurrent; - local float lTarget; - local entity lMatch; - - lCurrent = fabs( self._link.orderPos ); - lTarget = self._realValue; - if( lCurrent < lTarget ) - for( lMatch = self._link; lMatch._next && fabs( lMatch.orderPos ) != lTarget; lMatch = lMatch._next ); - else - for( lMatch = self._link; lMatch._prev && fabs( lMatch.orderPos ) != lTarget; lMatch = lMatch._prev ); - // lMatch always is valid if there are any children - self._link = lMatch; - - self._realValue = fabs( self._link.orderPos ); - String_EntitySet( self, value, ftos( self._realValue ) ); -}; - -void() _IDNA_RawSet = -{ - _IDNA_UpdateLink(); - - cmd( strcat( "playermodel \"", self._link.target, "\";" ) ); - cmd( strcat( "playerskin \"", self._link.link, "\"\n" ) ); -}; - -void() _IDNA_Send = -{ - _IDNA_RawSet(); - - String_EntitySet( self, _syncValue, self.value ); -}; - -void() _IDNA_Test_Start = -{ - _IDNA_RawSet(); -}; - -void() _IDNA_Test_End = -{ - String_EntitySet( self, value, self._syncValue ); - _IDNA_RawSet(); -}; - -void() _IDNA_Reset = -{ - String_EntitySet( self, value, self.defValue ); - _IDNA_Send(); -}; - -void( float pEvent ) Item_Data_Nex_Avatar_DataEvent = -{ - switch( pEvent ) { - case ITEM_DATA_SYNC: - _IDNA_Sync(); - break; - case ITEM_DATA_SEND: - _IDNA_Send(); - break; - case ITEM_DATA_RESET: - _IDNA_Reset(); - break; - case ITEM_DATA_TEST_START: - _IDNA_Test_Start(); - break; - case ITEM_DATA_TEST_END: - _IDNA_Test_End(); - break; - case ITEM_DATALINK_SET: - _IDNA_UpdateLink(); - break; - } -}; - -void() Item_Data_Nex_Avatar_Spawn = -{ - Item_Data_Init(); - - self.flag = self.flag | FLAG_HIDDEN; - - self._reinit = _IDNA_Sync; - self._dataEvent = Item_Data_Nex_Avatar_DataEvent; - - _IDNA_BuildList(); -}; diff --git a/scmenu/source/custom/player/color.qc b/scmenu/source/custom/player/color.qc deleted file mode 100644 index d8616fe47..000000000 --- a/scmenu/source/custom/player/color.qc +++ /dev/null @@ -1,72 +0,0 @@ -// Property of Alientrap/AK -// custom/player/color.qc - - -/* -=================== -Item_Data_Nex_Color -=================== -*/ - -void() _IDNC_Sync = -{ - local float lPants; - - // color = shirt * 16 + pants - lPants = cvar( "_cl_color" ) & 15; - - String_EntitySet( self, value, ftos( lPants ) ); - String_EntitySet( self, _syncValue, self.value ); -}; - -void() _IDNC_Send = -{ - cmd( strcat( "color \"", self.value, "\"\n" ) ); - String_EntitySet( self, _syncValue, self.value ); -}; - -void() _IDNC_Test_Start = -{ - cmd( strcat( "color \"", self.value, "\"\n" ) ); -}; - -void() _IDNC_Test_End = -{ - String_EntitySet( self, value, self._syncValue ); - cmd( strcat( "color \"", self.value, "\"\n" ) ); -}; - -void() _IDNC_Reset = -{ - String_EntitySet( self, value, self.defValue ); - _IDNN_Send(); -}; - -void( float pEvent ) Item_Data_Nex_Color_DataEvent = -{ - switch( pEvent ) { - case ITEM_DATA_SYNC: - _IDNC_Sync(); - break; - case ITEM_DATA_SEND: - _IDNC_Send(); - break; - case ITEM_DATA_RESET: - _IDNC_Reset(); - break; - case ITEM_DATA_TEST_START: - _IDNC_Test_Start(); - break; - case ITEM_DATA_TEST_END: - _IDNC_Test_End(); - break; - } -}; - -void() Item_Data_Nex_Color_Spawn = -{ - Item_Data_Init(); - - self._reinit = _IDNC_Sync; - self._dataEvent = Item_Data_Nex_Color_DataEvent; -}; diff --git a/scmenu/source/custom/player/name.qc b/scmenu/source/custom/player/name.qc deleted file mode 100644 index 9b5c9e8d5..000000000 --- a/scmenu/source/custom/player/name.qc +++ /dev/null @@ -1,65 +0,0 @@ -// Property of Alientrap/AK -// custom/player/name.qc - -/* -=================== -Item_Data_Nex_Name -=================== -*/ - -void() _IDNN_Sync = -{ - String_EntitySet( self, value, cvar_string( "_cl_name" ) ); - String_EntitySet( self, _syncValue, self.value ); -}; -void() _IDNN_Send = -{ - cmd( strcat( "name \"", self.value, "\"\n" ) ); - String_EntitySet( self, _syncValue, self.value ); -}; - -void() _IDNN_Test_Start = -{ - cmd( strcat( "name \"", self.value, "\"\n" ) ); -}; - -void() _IDNN_Test_End = -{ - String_EntitySet( self, value, self._syncValue ); - cmd( strcat( "name \"", self.value, "\"\n" ) ); -}; - -void() _IDNN_Reset = -{ - String_EntitySet( self, value, self.defValue ); - _IDNN_Send(); -}; - -void( float pEvent ) Item_Data_Nex_Name_DataEvent = -{ - switch( pEvent ) { - case ITEM_DATA_SYNC: - _IDNN_Sync(); - break; - case ITEM_DATA_SEND: - _IDNN_Send(); - break; - case ITEM_DATA_RESET: - _IDNN_Reset(); - break; - case ITEM_DATA_TEST_START: - _IDNN_Test_Start(); - break; - case ITEM_DATA_TEST_END: - _IDNN_Test_End(); - break; - } -}; - -void() Item_Data_Nex_Name_Spawn = -{ - Item_Data_Init(); - - self._reinit = _IDNN_Sync; - self._dataEvent = Item_Data_Nex_Name_DataEvent; -}; diff --git a/scmenu/source/custom/player/player.qh b/scmenu/source/custom/player/player.qh deleted file mode 100644 index c8a7c80f7..000000000 --- a/scmenu/source/custom/player/player.qh +++ /dev/null @@ -1,31 +0,0 @@ -// Property of Alientrap/AK -// custom/player/avatar.qh - -// Item_Nex_Avatar_Info -// its a valid item nevertheless -.string normal; // contains the avatar name -.string target; // contains the model name -.string link; // contains the skin name -.string picture; // contains the picture that should be displayed -.string text; // contains the description text - -void() Item_Nex_Avatar_Info_Destroy; -void() Item_Nex_Avatar_Info_Spawn; - -// see control/data/data.qh -// Item_Data_Nex_Avatar Item_DataLink_Value (implements more or less) -// value should be a integer in the range 1..n where n is the number of found mdefs -.entity _link; - -void( float pEvent ) Item_Data_Nex_Avatar_DataEvent; -void() Item_Data_Nex_Avatar_Spawn; - -// see control/data/data.qh -// Item_Data_Nex_Name [Item_Data] -void( float pEvent ) Item_Data_Nex_Name_DataEvent; -void() Item_Data_Nex_Name_Spawn; - -// see control/data/data.qh -// Item_Data_Nex_Color [Item_Data] -void( float pEvent ) Item_Data_Nex_Color_DataEvent; -void() Item_Data_Nex_Color_Spawn; diff --git a/scmenu/source/custom/quit.qm b/scmenu/source/custom/quit.qm deleted file mode 100644 index 81ae77c03..000000000 --- a/scmenu/source/custom/quit.qm +++ /dev/null @@ -1,45 +0,0 @@ -// Property of Alientrap/AK -// custom/quit.qm - -void() Nex_Quit_Toggle = -{ - local entity lEntity; - - lEntity = Menu_GetItem( "QuitWnd" ); - if( lEntity.flag & FLAG_HIDDEN ) { - lEntity.flag = lEntity.flag - FLAG_HIDDEN; - Menu_Select( Menu_GetItem( "QuitWnd::Layout::Buttons::No" ), false ); - } else { - lEntity.flag = lEntity.flag + FLAG_HIDDEN; - Menu_Reselect( false ); - } -} - -void() Nex_Quit_Action = -{ - local entity lEntity; - - lEntity = Menu_GetItem( "QuitWnd" ); - if( lEntity.flag & FLAG_HIDDEN ) - lEntity.flag = lEntity.flag - FLAG_HIDDEN; - Menu_Select( Menu_GetItem( "QuitWnd::Layout::Buttons::No" ), false ); -} - -bool( float pKey, float pAscii ) Nex_Quit_Key = -{ - if( pKey == K_ESCAPE ) { - Nex_Quit_Toggle(); - return true; - } - return false; -}; - -void() Nex_Quit_Yes = -{ - cmd( "quit\n" ); -}; - -void() Nex_Quit_No = -{ - Nex_Quit_Toggle(); -}; diff --git a/scmenu/source/custom/stresstest.qm b/scmenu/source/custom/stresstest.qm deleted file mode 100644 index b96c6c8a6..000000000 --- a/scmenu/source/custom/stresstest.qm +++ /dev/null @@ -1,14 +0,0 @@ -// Property of Alientrap/AK -// custom/stresstest.qc - -void() Item_Nex_StressRepeat_Spawn = -{ - // at least a few times - local entity lItem; - local float lCounter; - - self.flag = self.flag | FLAG_EMBEDDED; - - for( lCounter = 0 ; lCounter < 100 ; ++lCounter ) - lItem = Menu_DeriveItem( self._child, ftos( lCounter ), self._parent.name, true ); -}; diff --git a/scmenu/source/custom/util.qm b/scmenu/source/custom/util.qm deleted file mode 100644 index 296cdba2f..000000000 --- a/scmenu/source/custom/util.qm +++ /dev/null @@ -1,29 +0,0 @@ -// Property of Alientrap/AK -// custom/util.qm - -void() Nex_Action_TestOnChange = -{ - Raise_DataEvent( self._target, ITEM_DATA_TEST_START ); -}; - -void( bool pSelect, bool pUser ) Nex_Action_TestOnSelect = -{ - if( !pSelect && pUser ) - Raise_DataEvent( self._target, ITEM_DATA_TEST_START ); -}; - -// play the sound specified in the target field -void() Nex_Action_PlaySound = -{ - if( self.target ) { - Sound_Play( self.target ); - } -}; - -void() Nex_Action_PlaySoundOnce = -{ - if( self.target ) { - Sound_Play( self.target ); - } - Menu_DeleteAfterToggle( self ); -}; diff --git a/scmenu/source/custom/video.qc b/scmenu/source/custom/video.qc deleted file mode 100644 index bd75a1ec9..000000000 --- a/scmenu/source/custom/video.qc +++ /dev/null @@ -1,67 +0,0 @@ -// Property of Alientrap -// custom/video.qc - -void() _IDNR_Sync = -{ - String_EntitySet( self, value, strcat( cvar_string( "vid_width" ), " ", cvar_string( "vid_height" ) ) ); - String_EntitySet( self, _syncValue, self.value ); -}; - -void() _IDNR_Set = -{ - tokenize( self.value ); - cvar_set( "vid_width", argv( 0 ) ); - cvar_set( "vid_height", argv( 1 ) ); -}; - -void() _IDNR_Send = -{ - _IDNR_Set(); - _IDNR_Sync(); -}; - -void() _IDNR_Reset = -{ - String_EntitySet( self, value, self.defValue ); - _IDNR_Send(); -}; - -void() _IDNR_Test_Start = -{ - _IDNR_Set(); -}; - -void() _IDNR_Test_End = -{ - String_EntitySet( self, value, self._syncValue ); - _IDNR_Send(); -}; - -void( float pEvent ) Item_Data_Nex_Resolution_DataEvent = -{ - switch( pEvent ) { - case ITEM_DATA_SYNC: - _IDNR_Sync(); - break; - case ITEM_DATA_SEND: - _IDNR_Send(); - break; - case ITEM_DATA_RESET: - _IDNR_Reset(); - break; - case ITEM_DATA_TEST_START: - _IDNR_Test_Start(); - break; - case ITEM_DATA_TEST_END: - _IDNR_Test_End(); - break; - } -}; - -void() Item_Data_Nex_Resolution_Spawn = -{ - Item_Data_Init(); - - self._dataEvent = Item_Data_Nex_Resolution_DataEvent; - self._reinit = _IDNR_Sync; -}; diff --git a/scmenu/source/custom/video.qh b/scmenu/source/custom/video.qh deleted file mode 100644 index 8b6049911..000000000 --- a/scmenu/source/custom/video.qh +++ /dev/null @@ -1,9 +0,0 @@ -// Property of Alientrap -// custom/video.qh - -// Item_Data_Nex_Resolution [Item_Data] -.string value; // contains the current resolution in the format "width height" - -void() Item_Data_Nex_Resolution_Spawn; - - diff --git a/scmenu/source/custom/video.qm b/scmenu/source/custom/video.qm deleted file mode 100644 index b36206b16..000000000 --- a/scmenu/source/custom/video.qm +++ /dev/null @@ -1,10 +0,0 @@ -// Property of Alientrap -// custom/video.qm - -void() Nex_Action_Video_Apply = -{ - Raise_DataEvent( Menu_GetItem( "::Data::Video::Fullscreen" ), ITEM_DATA_SEND ); - Raise_DataEvent( Menu_GetItem( "::Data::Video::Resolution" ), ITEM_DATA_SEND ); - Raise_DataEvent( Menu_GetItem( "::Data::Video::BPP" ), ITEM_DATA_SEND ); - cmd( "vid_restart\n" ); -}; diff --git a/scmenu/source/custom/visible.qc b/scmenu/source/custom/visible.qc deleted file mode 100644 index 564f618fb..000000000 --- a/scmenu/source/custom/visible.qc +++ /dev/null @@ -1,14 +0,0 @@ -// Property of Alientrap/AK -// custom/visible.qc - -void( entity pItem ) Nex_MakeOnlyVisible = -{ - local entity lChild; - - for( lChild = pItem._parent._child ; lChild ; lChild = lChild._next ) - lChild.flag = lChild.flag | FLAG_HIDDEN; - - pItem.flag = pItem.flag - FLAG_HIDDEN; - - Menu_UpdateRunFlags(); -}; diff --git a/scmenu/source/custom/visible.qm b/scmenu/source/custom/visible.qm deleted file mode 100644 index 3bf72c4a0..000000000 --- a/scmenu/source/custom/visible.qm +++ /dev/null @@ -1,96 +0,0 @@ -// Property of Alientrap/AK -// custom/visible.qm - -// uses .target to determine the target window - -void() Nex_Action_MakeOnlyVisible_Destroy = -{ - String_EntityFree( self, target ); -}; - -void() Nex_Action_MakeOnlyVisible_Action = -{ - Nex_MakeOnlyVisible( Menu_GetItem( self.target ) ); -}; - -void() Nex_Action_MakeOnlyVisible = -{ - String_EntityZone( self, target ); - - self.destroy = Nex_Action_MakeOnlyVisible_Destroy; - self.action = Nex_Action_MakeOnlyVisible_Action; -}; - -// makes the first child as only item in the window visible -void() Nex_Action_MakeFirstVisible = -{ - Nex_MakeOnlyVisible( self._child ); -}; - -// like MakeOnlyVisible, but also jumps to the window -void() Nex_Action_JumpToPage_Destroy = -{ - String_EntityFree( self, target ); -}; - -void() Nex_Action_JumpToPage_Action = -{ - local entity lItem; - lItem = Menu_GetItem( self.target ); - Nex_MakeOnlyVisible( lItem ); - Menu_JumpToWindow( lItem, false, false ); -}; - -void() Nex_Action_JumpToPage = -{ - String_EntityZone( self, target ); - - self.action = Nex_Action_JumpToPage_Action; - self.destroy = Nex_Action_JumpToPage_Destroy; -}; - -// sets the link field of Normal::Panel -void() Nex_Action_SetNormalPanelLink_Destroy = -{ - String_EntityFree( self, target ); -}; - -void() Nex_Action_SetNormalPanelLink_Action = -{ - local entity lItem; - - lItem = Menu_GetItem( "Normal::Panel" ); - String_EntitySet( lItem, link, self.target ); - - Raise_Update( lItem ); - Menu_UpdateRunFlags(); - Menu_JumpToWindow( lItem._link, false, false ); -}; - -void() Nex_Action_SetNormalPanelLink = -{ - String_EntityZone( self, target ); - - self.destroy = Nex_Action_SetNormalPanelLink_Destroy; - self.action = Nex_Action_SetNormalPanelLink_Action; -}; - -// sets the link field of Normal::Panel on reinit -void() Nex_Action_SetLinkOnReinit_Destroy = -{ - String_EntityFree( self, target ); -}; - -void() Nex_Action_SetLinkOnReinitk_Reinit = -{ - String_EntitySet( Menu_GetItem( "Normal::Panel" ), link, self.target ); -}; - -void() Nex_Action_SetLinkOnReinit = -{ - String_EntityZone( self, target ); - - self.destroy = Nex_Action_SetLinkOnReinit_Destroy; - self.reinit = Nex_Action_SetLinkOnReinitk_Reinit; -}; - diff --git a/scmenu/source/mbuiltin.qc b/scmenu/source/mbuiltin.qc deleted file mode 100644 index d9de42084..000000000 --- a/scmenu/source/mbuiltin.qc +++ /dev/null @@ -1,250 +0,0 @@ -////////////////////////////////////////////////// -// common cmd -////////////////////////////////////////////////// -// AK FIXME: Create perhaps a special builtin file for the common cmds - -//#define PROFILESTRZONE -#define FIXEDFOPEN - -void checkextension(string ext) = #1; - -// error cmds -void error(string err,...) = #2; -void objerror(string err,...) = #3; - -// print - -void print(string text,...) = #4; -void bprint(string text,...) = #5; -void sprint(float clientnum, string text,...) = #6; -void centerprint(string text,...) = #7; - -// vector stuff - -vector normalize(vector v) = #8; -float vlen(vector v) = #9; -float vectoyaw(vector v) = #10; -vector vectoangles(vector v) = #11; - -float random(void) = #12; - -void cmd(string command) = #13; - -// cvar cmds - -float cvar(string name) = #14; -const string cvar_string(string name) = #71; -const string cvar_defstring(string name) = #89; -void cvar_set(string name, string value) = #15; - -void dprint(string text,...) = #16; - -// conversion functions - -string ftos(float f) = #17; -float fabs(float f) = #18; -string vtos(vector v) = #19; -string etos(entity e) = #20; - -float stof(string val,...) = #21; - -entity spawn(void) = #22; -void remove(entity e) = #23; - -entity findstring(entity start, .string _field, string match) = #24; -entity findfloat(entity start, .float _field, float match) = #25; -entity findentity(entity start, .entity _field, entity match) = #25; - -entity findchainstring(.string _field, string match) = #26; -entity findchainfloat(.float _field, float match) = #27; -entity findchainentity(.entity _field, entity match) = #27; - -entity findflags(entity start, .float field, float match) = #87; -entity findchainflags(.float field, float match) = #88; - -string precache_file(string file) = #28; -string precache_sound(string sample) = #29; - -void crash(void) = #72; -void coredump(void) = #30; -void stackdump(void) = #73; -void traceon(void) = #31; -void traceoff(void) = #32; - -void eprint(entity e) = #33; -float rint(float f) = #34; -float floor(float f) = #35; -float ceil(float f) = #36; -entity nextent(entity e) = #37; -float sin(float f) = #38; -float cos(float f) = #39; -float sqrt(float f) = #40; -vector randomvec(void) = #41; - -float registercvar(string name, string value, float flags) = #42; // returns 1 if success -float min(float f,...) = #43; -float max(float f,...) = #44; -float bound(float min,float value, float max) = #45; -float pow(float a, float b) = #46; -void copyentity(entity src, entity dst) = #47; - -#ifdef FIXEDFOPEN -float _fopen( string filename, float mode ) = #48; -#else -float fopen(string filename, float mode) = #48; -#endif -void fclose(float fhandle) = #49; -string fgets(float fhandle) = #50; -void fputs(float fhandle, string s) = #51; - -float strlen(string s) = #52; -//string strcat(string s1,string s2,...) = #53; -string strcat(string s1, ...) = #53; -string substring(string s, float start, float length) = #54; - -vector stov(string s) = #55; - -#ifdef PROFILESTRZONE -string _strzone(string s) = #56; -void _strunzone(string s) = #57; - -string( string s ) strzone = -{ - return _strzone( s ); -}; - -void( string s ) strunzone = -{ - return _strunzone( s ); -}; -#else -string strzone(string s) = #56; -void strunzone(string s) = #57; -#endif - -float tokenize(string s) = #58 -string argv(float n) = #59; - -float isserver(void) = #60; -float clientcount(void) = #61; -float clientstate(void) = #62; -void clientcommand(float client, string s) = #63; -void changelevel(string map) = #64; -void localsound(string sample) = #65; -vector getmousepos(void) = #66; -float gettime(void) = #67; -void loadfromdata(string data) = #68; -void loadfromfile(string file) = #69; - -float mod(float val, float m) = #70; - -float search_begin(string pattern, float caseinsensitive, float quiet) = #74; -void search_end(float handle) = #75; -float search_getsize(float handle) = #76; -string search_getfilename(float handle, float num) = #77; - -string chr(float ascii) = #78; - -float etof(entity ent) = #79; -entity ftoe(float num) = #80; - -float validstring(string str) = #81; - -float altstr_count(string str) = #82; -string altstr_prepare(string str) = #83; -string altstr_get(string str, float num) = #84; -string altstr_set(string str, float num, string set) = #85; -string altstr_ins(string str, float num, string set) = #86; - -///////////////////////////////////////////////// -// Write* Functions -///////////////////////////////////////////////// -void WriteByte(float data, float dest, float desto) = #401; -void WriteChar(float data, float dest, float desto) = #402; -void WriteShort(float data, float dest, float desto) = #403; -void WriteLong(float data, float dest, float desto) = #404; -void WriteAngle(float data, float dest, float desto) = #405; -void WriteCoord(float data, float dest, float desto) = #406; -void WriteString(string data, float dest, float desto)= #407; -void WriteEntity(entity data, float dest, float desto) = #408; - -////////////////////////////////////////////////// -// Draw funtions -////////////////////////////////////////////////// - -float iscachedpic(string name) = #451; -string precache_pic(string name) = #452; -void freepic(string name) = #453; - -float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454; - -float drawstring(vector position, string text, vector scale, vector rgb, float alpha, float flag) = #455; - -float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456; - -float drawfill(vector position, vector size, vector rgb, float alpha, float flag) = #457; - -void drawsetcliparea(float x, float y, float width, float height) = #458; - -void drawresetcliparea(void) = #459; - -vector drawgetimagesize(string pic) = #460; - -float cin_open(string file, string name) = #461; -void cin_close(string name) = #462; -void cin_setstate(string name, float type) = #463; -float cin_getstate(string name) = #464; - -//////////////////////////////////////////////// -// Menu functions -//////////////////////////////////////////////// - -void setkeydest(float dest) = #601; -float getkeydest(void) = #602; - -void setmousetarget(float trg) = #603; -float getmousetarget(void) = #604; - -float isfunction(string function_name) = #607; -void callfunction(...) = #605; -void writetofile(float fhandle, entity ent) = #606; -vector getresolution(float number) = #608; -string keynumtostring(float keynum) = #609; -string findkeysforcommand(string command) = #610; - -float gethostcachevalue(float type) = #611; -string gethostcachestring(float type, float hostnr) = #612; - -void parseentitydata(entity ent, string data) = #613; - -float stringtokeynum(string key) = #614; - -void resethostcachemasks(void) = #615; -void sethostcachemaskstring(float mask, float fld, string str, float op) = #616; -void sethostcachemasknumber(float mask, float fld, float num, float op) = #617; -void resorthostcache(void) = #618; -void sethostcachesort(float fld, float descending) = #619; -void refreshhostcache(void) = #620; -float gethostcachenumber(float fld, float hostnr) = #621; -float gethostcacheindexforkey(string key) = #622; -void addwantedhostcachekey(string key) = #623; - -#ifdef FIXEDFOPEN -float fopen( string filename, float mode ) = -{ - local float handle; - if( mode == FILE_READ ) { - return _fopen( filename, mode ); - } - - // check for data/ - filename = strzone( filename ); - if( substring( filename, 0, 5 ) != "data/" ) { - print( "menu: fopen: all output must go into data/!\n" ); - return -1; - } - handle = _fopen( substring( filename, 5, 10000 ), mode ); - strunzone( filename ); - return handle; -}; -#endif diff --git a/scmenu/source/menu.qc b/scmenu/source/menu.qc deleted file mode 100644 index e50ff93f6..000000000 --- a/scmenu/source/menu.qc +++ /dev/null @@ -1,151 +0,0 @@ -/////////////////////////////////////////////// -// Menu Source File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all menu functions (especially the required ones) -/////////////////////////////////////////////// - -void() m_updategamestate = -{ - // update isserver and clientstate - gamestatus = 0; - if( isserver() ) - gamestatus = gamestatus | GAME_ISSERVER; - if( clientstate() == CS_CONNECTED ) - gamestatus = gamestatus | GAME_CONNECTED; - if( cvar("developer") ) - gamestatus = gamestatus | GAME_DEVELOPER; -}; - -void() m_init = -{ - // init graphic - Gfx_Init(); - - // init cursor - Cursor_Init(); - - Key_Init(); - - HostCache_Init(); - - // init menu - Menu_Init(); -}; - -// required menu functions -void( float pKey, float pAscii ) m_keydown = -{ - if( !Menu_Active ) - return; - - // actually the menu is the only system that needs to react on key events - Menu_Key( pKey, pAscii ); -}; - -void() m_frame = -{ - Timer_Update(); - - HostCache_Update(); - - Key_Update(); - - // graphic frame - Gfx_Update(); - - // cursor frame - Cursor_Update(); - - // menu frame - Menu_Frame(); -}; - -void() m_draw = -{ - m_updategamestate(); - - - if( !Menu_Active ) { - // test whether we want to force it to be displayed - if( !(gamestatus & GAME_CONNECTED) && !(gamestatus & GAME_DEVELOPER) ) { - m_display(); - } - else { - return; - } - } - - // call m_frame cause draw is the only menu function called once per frame - m_frame(); - - // now the drawing code - Menu_Draw(); - - // draw the cursor on top of the menu - Cursor_Draw(); - - // and now the gfx drawing code (for special fx) - Gfx_Draw(); -}; - -void() m_display = -{ - Menu_Active = true; - - m_updategamestate(); - - // let also the snd and gfx know (perhaps for sfx) - Gfx_Display(); - Cursor_Display(); - Key_Display(); - - // let the menu manager know - Menu_PerformReinit(); -}; - -void() m_hide = -{ - Gfx_Hide(); - Cursor_Hide(); - Key_Hide(); - - // let the menu manager know - Menu_Hide(); - - Menu_Active = false; -}; - -void() m_toggle = -{ - Timer_Update(); - - if( Menu_Active ) - m_hide(); - else - m_display(); -}; - -void() m_shutdown = -{ - Timer_Update(); - - // shutdown menu - Menu_Shutdown(); - - // shutdown timer - Timer_Quit(); - - // shutdown key system - Key_Quit(); - - // shutdown cursor - Cursor_Quit(); - - // shutdown graphic - Gfx_Quit(); - - // make sure everything is reset - setkeydest( KEY_GAME ); - setmousetarget( MT_CLIENT ); -}; \ No newline at end of file diff --git a/scmenu/source/menu.qh b/scmenu/source/menu.qh deleted file mode 100644 index 1de9229df..000000000 --- a/scmenu/source/menu.qh +++ /dev/null @@ -1,35 +0,0 @@ -/////////////////////////////////////////////// -// Menu Header File -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all common constants, etc. -/////////////////////////////////////////////// -// constants - -const float GAME_ISSERVER = 1; -const float GAME_CONNECTED = 2; -const float GAME_DEVELOPER = 4; - -const float INFINITY = 10000000.0; - -// prototypes - -typedef float bool; - -// global vars - -//float time; // important for animations, etc. -bool Menu_Active; // is set when the menu is active - -// updated every time toggle is called -float gamestatus; - -//#define USEFUNCTIONS -//#define UTILALTSTRING - -#define AVOIDSTRZONES - -// get rid of __NULL__ sets again! - -#pragma keyword enable ifstring -#pragma keyword enable lo diff --git a/scmenu/source/msys.qc b/scmenu/source/msys.qc deleted file mode 100644 index d23fad6a0..000000000 --- a/scmenu/source/msys.qc +++ /dev/null @@ -1,278 +0,0 @@ -////////////////////////////////////////////////////////// -// sys globals - -entity self; - -///////////////////////////////////////////////////////// -void end_sys_globals; -///////////////////////////////////////////////////////// -// sys fields - -///////////////////////////////////////////////////////// -void end_sys_fields; -///////////////////////////////////////////////////////// -// sys functions - -void() m_init; -void(float keynr, float ascii) m_keydown; -void() m_draw; -void() m_display; // old NG Menu -void() m_toggle; -void() m_hide; // old NG Menu -void() m_shutdown; - -///////////////////////////////////////////////////////// -// sys constants -/////////////////////////// -// key constants - -// -// these are the key numbers that should be passed to Key_Event -// -float K_TAB = 9; -float K_ENTER = 13; -float K_ESCAPE = 27; -float K_SPACE = 32; - -// normal keys should be passed as lowercased ascii - -float K_BACKSPACE = 127; -float K_UPARROW = 128; -float K_DOWNARROW = 129; -float K_LEFTARROW = 130; -float K_RIGHTARROW = 131; - -float K_ALT = 132; -float K_CTRL = 133; -float K_SHIFT = 134; -float K_F1 = 135; -float K_F2 = 136; -float K_F3 = 137; -float K_F4 = 138; -float K_F5 = 139; -float K_F6 = 140; -float K_F7 = 141; -float K_F8 = 142; -float K_F9 = 143; -float K_F10 = 144; -float K_F11 = 145; -float K_F12 = 146; -float K_INS = 147; -float K_DEL = 148; -float K_PGDN = 149; -float K_PGUP = 150; -float K_HOME = 151; -float K_END = 152; - -float K_KP_HOME = 160; -float K_KP_UPARROW = 161; -float K_KP_PGUP = 162; -float K_KP_LEFTARROW = 163; -float K_KP_5 = 164; -float K_KP_RIGHTARROW = 165; -float K_KP_END = 166; -float K_KP_DOWNARROW = 167; -float K_KP_PGDN = 168; -float K_KP_ENTER = 169; -float K_KP_INS = 170; -float K_KP_DEL = 171; -float K_KP_SLASH = 172; -float K_KP_MINUS = 173; -float K_KP_PLUS = 174; - -float K_PAUSE = 255; - -// -// joystick buttons -// -float K_JOY1 = 768; -float K_JOY2 = 769; -float K_JOY3 = 770; -float K_JOY4 = 771; - -// -// aux keys are for multi-buttoned joysticks to generate so they can use -// the normal binding process -// -float K_AUX1 = 772; -float K_AUX2 = 773; -float K_AUX3 = 774; -float K_AUX4 = 775; -float K_AUX5 = 776; -float K_AUX6 = 777; -float K_AUX7 = 778; -float K_AUX8 = 779; -float K_AUX9 = 780; -float K_AUX10 = 781; -float K_AUX11 = 782; -float K_AUX12 = 783; -float K_AUX13 = 784; -float K_AUX14 = 785; -float K_AUX15 = 786; -float K_AUX16 = 787; -float K_AUX17 = 788; -float K_AUX18 = 789; -float K_AUX19 = 790; -float K_AUX20 = 791; -float K_AUX21 = 792; -float K_AUX22 = 793; -float K_AUX23 = 794; -float K_AUX24 = 795; -float K_AUX25 = 796; -float K_AUX26 = 797; -float K_AUX27 = 798; -float K_AUX28 = 799; -float K_AUX29 = 800; -float K_AUX30 = 801; -float K_AUX31 = 802; -float K_AUX32 = 803; - -// -// mouse buttons generate virtual keys -// -float K_MOUSE1 = 512; -float K_MOUSE2 = 513; -float K_MOUSE3 = 514; -float K_MOUSE4 = 515; -float K_MOUSE5 = 516; -float K_MOUSE6 = 517; -float K_MOUSE7 = 518; -float K_MOUSE8 = 519; -float K_MOUSE9 = 520; -float K_MOUSE10 = 521; - -float K_MWHEELDOWN = K_MOUSE4; -float K_MWHEELUP = K_MOUSE5; - -/////////////////////////// -// key dest constants - -float KEY_GAME = 0; -float KEY_MENU = 2; -float KEY_UNKNOWN = 3; - -/////////////////////////// -// file constants - -float FILE_READ = 0; -float FILE_APPEND = 1; -float FILE_WRITE = 2; - -/////////////////////////// -// logical constants (just for completeness) - -float TRUE = 1; -float FALSE = 0; - -/////////////////////////// -// boolean constants - -float true = 1; -float false = 0; - -/////////////////////////// -// msg constants - -float MSG_BROADCAST = 0; // unreliable to all -float MSG_ONE = 1; // reliable to one (msg_entity) -float MSG_ALL = 2; // reliable to all -float MSG_INIT = 3; // write to the init string - -///////////////////////////// -// mouse target constants - -float MT_MENU = 1; -float MT_CLIENT = 2; - -///////////////////////// -// client state constants - -float CS_DEDICATED = 0; -float CS_DISCONNECTED = 1; -float CS_CONNECTED = 2; - -/////////////////////////// -// blend flags - -float DRAWFLAG_NORMAL = 0; -float DRAWFLAG_ADDITIVE = 1; -float DRAWFLAG_MODULATE = 2; -float DRAWFLAG_2XMODULATE = 3; - - -/////////////////////////// -// cvar constants - -float CVAR_SAVE = 1; -float CVAR_NOTIFY = 2; -float CVAR_READONLY = 4; - -/////////////////////////// -// server list constants - -float SLIST_HOSTCACHEVIEWCOUNT = 0; -float SLIST_HOSTCACHETOTALCOUNT = 1; -float SLIST_MASTERQUERYCOUNT = 2; -float SLIST_MASTERREPLYCOUNT = 3; -float SLIST_SERVERQUERYCOUNT = 4; -float SLIST_SERVERREPLYCOUNT = 5; -float SLIST_SORTFIELD = 6; -float SLIST_SORTDESCENDING = 7; - -float SLIST_LEGACY_LINE1 = 1024; -float SLIST_LEGACY_LINE2 = 1025; - -float SLIST_TEST_CONTAINS = 0; -float SLIST_TEST_NOTCONTAIN = 1; -float SLIST_TEST_LESSEQUAL = 2; -float SLIST_TEST_LESS = 3; -float SLIST_TEST_EQUAL = 4; -float SLIST_TEST_GREATER = 5; -float SLIST_TEST_GREATEREQUAL = 6; -float SLIST_TEST_NOTEQUAL = 7; - -float SLIST_MASK_AND = 0; -float SLIST_MASK_OR = 512; - -float NET_CURRENTPROTOCOL = 3; - -//////////////////////////////// -// cinematic action constants - -float CINE_PLAY = 1; -float CINE_LOOP = 2; -float CINE_PAUSE = 3; -float CINE_FIRSTFRAME = 4; -float CINE_RESETONWAKEUP= 5; - -/////////////////////////// -// null entity (actually it is the same like the world entity) - -entity null_entity; - -/////////////////////////// -// error constants - -// file handling -float ERR_CANNOTOPEN = -1; // fopen -float ERR_NOTENOUGHFILEHANDLES = -2; // fopen -float ERR_INVALIDMODE = -3; // fopen -float ERR_BADFILENAME = -4; // fopen - -// drawing functions - -float ERR_NULLSTRING = -1; -float ERR_BADDRAWFLAG = -2; -float ERR_BADSCALE = -3; -float ERR_BADSIZE = ERR_BADSCALE; -float ERR_NOTCACHED = -4; - -/* not supported at the moment -/////////////////////////// -// os constants - -float OS_WINDOWS = 0; -float OS_LINUX = 1; -float OS_MAC = 2; -*/ - diff --git a/scmenu/source/progdefs.h b/scmenu/source/progdefs.h deleted file mode 100644 index d719f326a..000000000 --- a/scmenu/source/progdefs.h +++ /dev/null @@ -1,13 +0,0 @@ - -/* file generated by qcc, do not modify */ - -typedef struct -{ int pad[28]; - int self; -} globalvars_t; - -typedef struct -{ -} entvars_t; - -#define PROGHEADER_CRC 10020 diff --git a/scmenu/source/progs.src b/scmenu/source/progs.src deleted file mode 100644 index f96c326f3..000000000 --- a/scmenu/source/progs.src +++ /dev/null @@ -1,180 +0,0 @@ -/////////////////////////////////////////////// -// Progs file -/////////////////////// -// This file belongs to dpmod/darkplaces -// AK contains all file names which should be included into menu.dat -// this is absolutly beta -/////////////////////////////////////////////// -// menu.dat destination path -../../menu.dat - -// these are the default qc header files -msys.qc -mbuiltin.qc - -//////////////////////////// -// dpmod-specific menu files -/// - -// Header Files - -menu.qh - -// util functions -util/util.qh -util/altstring.qh -util/rect.qh -util/string.qh -util/text.qh -util/uid.qh -util/property.qh - -// base system -base/timer.qh -base/gfx.qh -base/snd.qh -base/cursor.qh -base/key.qh -base/hostcache.qh - -// main system -system/parser.qh -system/debug.qh -system/isframe.qh -system/mgfx.qh -system/item.qh -system/structure.qh -system/events.qh -system/history.qh -system/gc.qh - -// controls -control/items.qh -control/constants.qh -control/data/data.qh -control/window/windows.qh -control/visual/visual.qh -control/automation/automation.qh -//control/fx/fx.qh - -// custom (game specific) -custom/custom.qh -custom/player/player.qh -custom/creategame/creategame.qh -custom/joingame.qh -custom/key.qh -custom/video.qh -custom/credits.qh -custom/messagebox.qh - -// Source Files - -// custom (game specific) -custom/quit.qm -custom/option.qm -custom/globalkey.qm -custom/stresstest.qm -custom/visible.qm -custom/color.qm -custom/player.qm -custom/util.qm -custom/creategame.qm -custom/key.qm -custom/video.qm -custom/joingame.qm -custom/credits.qm - -custom/player/avatar.qc -custom/player/name.qc -custom/player/color.qc - -custom/creategame/maps.qc -custom/creategame/mods.qc -custom/creategame/filelist.qc - -custom/visible.qc -custom/key.qc -custom/video.qc -custom/joingame.qc -custom/credits.qc -custom/messagebox.qc - -// controls -control/automation/automation.qc -control/automation/foreach.qc -control/automation/job.qc - -control/data/base.qc -control/data/container.qc -control/data/cvar.qc -control/data/text.qc -control/data/value.qc -control/data/textswitch.qc -control/data/valueswitch.qc -control/data/fastresync.qc -control/data/textvalue.qc -control/data/texttime.qc -control/data/altstring.qc -control/data/router.qc - -control/window/window.qc -control/window/reference.qc -control/window/layout.qc -control/window/arrangement.qc -control/window/scroll.qc -control/window/eventwindow.qc -control/window/frame.qc - -control/visual/list.qc -control/visual/button.qc -control/visual/editbox.qc -control/visual/label.qc -control/visual/multilabel.qc -control/visual/picture.qc -control/visual/rect.qc -control/visual/slider.qc -control/visual/valuebutton.qc -control/visual/floating.qc -control/visual/switchbutton.qc -control/visual/scrollbar.qc - -//control/fx/vector.qc -//control/fx/float.qc -//control/fx/interpol.qc - -control/cinematic.qc -control/container.qc -control/custom.qc -control/link.qc - -// main system -system/history.qc -system/events.qc -//system/events_.qc -system/event_helper.qc -system/structure.qc -system/mgfx.qc -system/isframe.qc -system/debug.qc -system/parser.qc -system/gc.qc - -// base systems -base/key.qc -base/cursor.qc -base/snd.qc -base/gfx.qc -base/timer.qc -base/hostcache.qc - -// util functions -util/property.qc -util/text.qc -util/uid.qc -util/string.qc -util/rect.qc -util/altstring.qc -util/nfunction.qc - -menu.qc - diff --git a/scmenu/source/system/debug.qc b/scmenu/source/system/debug.qc deleted file mode 100644 index 8b3da1ad9..000000000 --- a/scmenu/source/system/debug.qc +++ /dev/null @@ -1,179 +0,0 @@ -// SCMenu -// system/debug.qc - - -/* -=================== -Sys_Debug_Init -=================== -*/ -void() Sys_Debug_Init = -{ - registercvar( SYSTEM_CVAR_VERSION_BUILDDATE, "", CVAR_READONLY ); - cvar_set( SYSTEM_CVAR_VERSION_BUILDDATE, SYSTEM_CVAR_VERSION_BUILDDATE_VALUE ); - registercvar( SYSTEM_CVAR_VERSION_BUILDTIME, "", CVAR_READONLY ); - cvar_set( SYSTEM_CVAR_VERSION_BUILDTIME, SYSTEM_CVAR_VERSION_BUILDTIME_VALUE ); - registercvar( SYSTEM_CVAR_VERSION, "", CVAR_READONLY ); - cvar_set( SYSTEM_CVAR_VERSION, SYSTEM_CVAR_VERSION_VALUE ); - - registercvar( SYSTEM_CVAR_DEBUG, ftos( SYSTEM_CVAR_DEBUG_DEFAULT ), 0 ); - registercvar( SYSTEM_CVAR_DEBUG_REF, ftos( SYSTEM_CVAR_DEBUG_REF_DEFAULT ), 0 ); - registercvar( SYSTEM_CVAR_DEBUG_RUNFLAG, ftos( SYSTEM_CVAR_DEBUG_RUNFLAG_DEFAULT ), 0 ); - registercvar( SYSTEM_CVAR_DEBUG_PROCESS, ftos( SYSTEM_CVAR_DEBUG_PROCESS_DEFAULT ), 0 ); - registercvar( SYSTEM_CVAR_DEBUG_MGFX, ftos( SYSTEM_CVAR_DEBUG_MGFX_DEFAULT ), 0 ); - registercvar( SYSTEM_CVAR_DEBUG_STRUCTURE, ftos( SYSTEM_CVAR_DEBUG_STRUCTURE_DEFAULT ), 0 ); - registercvar( SYSTEM_CVAR_DEBUG_PARSER, SYSTEM_CVAR_DEBUG_PARSER_DEFAULT, 0 ); - registercvar( SYSTEM_CVAR_DEBUG_PROCESS_FILTER, SYSTEM_CVAR_DEBUG_PROCESS_FILTER_DEFAULT, 0 ); - registercvar( SYSTEM_CVAR_DEBUG_SOUND, ftos( SYSTEM_CVAR_DEBUG_SOUND_DEFAULT ), 0 ); - registercvar( SYSTEM_CVAR_DEBUG_DUMP_NAMES, "0", 0 ); - registercvar( SYSTEM_CVAR_DEBUG_AREA, ftos( SYSTEM_CVAR_DEBUG_AREA_DEFAULT ), 0 ); - registercvar( SYSTEM_CVAR_DEBUG_STEP, ftos( SYSTEM_CVAR_DEBUG_STEP_DEFAULT ), 0 ); - registercvar( SYSTEM_CVAR_DEBUG_MOUSE, ftos( SYSTEM_CVAR_DEBUG_MOUSE_DEFAULT ), 0 ); -}; - -/* -=================== -Sys_Debug_Frame -=================== -*/ -void() Sys_Debug_Frame = -{ - local float lTemp1, lTemp2, lStep; - sys_debug = cvar( SYSTEM_CVAR_DEBUG ); - if( sys_debug ) { - sys_debug_ref = cvar( SYSTEM_CVAR_DEBUG_REF ); - - sys_debug_area = cvar( SYSTEM_CVAR_DEBUG_AREA ); - - sys_debug_sound = cvar( SYSTEM_CVAR_DEBUG_SOUND ); - - sys_debug_structure = cvar( SYSTEM_CVAR_DEBUG_STRUCTURE ); - - sys_debug_mouse = cvar( SYSTEM_CVAR_DEBUG_MOUSE ); - - lStep = cvar( SYSTEM_CVAR_DEBUG_STEP ); - if( lStep == 1 ) { - sys_debug_halt = true; - } else if( lStep == 2 ) { - sys_debug_halt = false; - cvar_set( SYSTEM_CVAR_DEBUG_STEP, "1" ); - - print( "Menu: -- Step: Time:", ftos( gettime() ), "\n" ); - } else { - sys_debug_halt = false; - } - - sys_debug_runflag = cvar( SYSTEM_CVAR_DEBUG_RUNFLAG ); - // FIXME: evil bug in fteqcc!! dont pass function calls to switches - switch( sys_debug_runflag ) { - case 0: - sys_debug_runflag = false; - break; - case 1: - cvar_set( SYSTEM_CVAR_DEBUG_RUNFLAG, "0" ); - case 2: - sys_debug_runflag = true; - break; - } - - sys_debug_process = cvar( SYSTEM_CVAR_DEBUG_PROCESS ); - switch( sys_debug_process ) { - case 0: - sys_debug_process = false; - break; - case 1: - cvar_set( SYSTEM_CVAR_DEBUG_PROCESS, "0" ); - case 2: - sys_debug_process = true; - break; - } - - sys_debug_mgfx = cvar( SYSTEM_CVAR_DEBUG_MGFX ); - switch( sys_debug_mgfx ) { - case 0: - sys_debug_mgfx = false; - break; - case 1: - cvar_set( SYSTEM_CVAR_DEBUG_MGFX, "0" ); - case 2: - sys_debug_mgfx = true; - break; - } - - lTemp1 = tokenize( cvar_string( SYSTEM_CVAR_DEBUG_PROCESS_FILTER ) ); - sys_debug_process_filter = 0; - for( lTemp2 = 0 ; lTemp2 < lTemp1 ; ++lTemp2 ) - if( argv( lTemp2 ) == "runflag" ) - sys_debug_process_filter = sys_debug_process_filter | MENU_PROCESS_RUNFLAG; - else if( argv( lTemp2 ) == "draw" ) - sys_debug_process_filter = sys_debug_process_filter | MENU_PROCESS_DRAW; - else if( argv( lTemp2 ) == "update" ) - sys_debug_process_filter = sys_debug_process_filter | MENU_PROCESS_UPDATE; - else if( argv( lTemp2 ) == "mouse" ) - sys_debug_process_filter = sys_debug_process_filter | MENU_PROCESS_MOUSE; - else if( argv( lTemp2 ) == "key" ) - sys_debug_process_filter = sys_debug_process_filter | MENU_PROCESS_KEY; - - lTemp1 = tokenize( cvar_string( SYSTEM_CVAR_DEBUG_PARSER ) ); - sys_debug_parser = 0; - for( lTemp2 = 0 ; lTemp2 < lTemp1 ; ++lTemp2 ) - if( argv( lTemp2 ) == "info" ) - sys_debug_parser = sys_debug_parser | PARSER_INFO; - else if( argv( lTemp2 ) == "high" ) - sys_debug_parser = sys_debug_parser | PARSER_HIGH; - else if( argv( lTemp2 ) == "low" ) - sys_debug_parser = sys_debug_parser | PARSER_LOW; - - - } else { - sys_debug_halt = false; - sys_debug_ref = false; - sys_debug_area = false; - sys_debug_sound = false; - sys_debug_runflag = 0; - sys_debug_process = 0; - sys_debug_mgfx = false; - sys_debug_structure = 0; - sys_debug_parser = 0; - sys_debug_process_filter = 0; - sys_debug_mouse = 0; - } - if( cvar( SYSTEM_CVAR_DEBUG_DUMP_NAMES ) ) { - Sys_Debug_DumpNames(); - cvar_set( SYSTEM_CVAR_DEBUG_DUMP_NAMES, "0" ); - } - sys_debug_cursor_localpos = '-1 -1 -1'; -}; - -/* -=================== -Sys_Debug_Draw -=================== -*/ -void() Sys_Debug_Draw = -{ - if( sys_debug_mouse == 1 ) - Cursor_PrintInfo( '1 0 0', strcat( ftos( floor( sys_debug_cursor_localpos_x ) ), - " ", ftos( floor( sys_debug_cursor_localpos_y ) ) ), '9 9 0', '0.8 0.8 0.8', - 1, DRAWFLAG_ADDITIVE ); - else if( sys_debug_mouse == 2 ) - Cursor_PrintInfo( '1 0 0', strcat( ftos( floor( Cursor_Position_x ) ), " ", - ftos( floor( Cursor_Position_y ) ) ), '9 9 0', '0.8 0.8 0.8', 1, DRAWFLAG_ADDITIVE ); -}; - -/* -=================== -Sys_Debug_DumpNames -=================== -*/ -void() Sys_Debug_DumpNames = -{ - local entity lNode; - - print( "Menu: Dumping names..\n" ); - - lNode = null_entity; - while( (lNode = nextent( lNode )) != null_entity ) - print( "Menu: ", etos( lNode ), " <-> ", lNode.name, "\n" ); - print( "\n" ); -}; diff --git a/scmenu/source/system/debug.qh b/scmenu/source/system/debug.qh deleted file mode 100644 index 5fb3ed66b..000000000 --- a/scmenu/source/system/debug.qh +++ /dev/null @@ -1,80 +0,0 @@ -// SCMenu -// system/debug.qh - -// version cvars (constant) -const string SYSTEM_CVAR_VERSION_BUILDDATE = "scmenu_version_builddate"; -const string SYSTEM_CVAR_VERSION_BUILDTIME = "scmenu_version_buildtime"; -const string SYSTEM_CVAR_VERSION = "scmenu_version"; - -const string SYSTEM_CVAR_VERSION_BUILDDATE_VALUE = __DATE__; -const string SYSTEM_CVAR_VERSION_BUILDTIME_VALUE = __TIME__; -const string SYSTEM_CVAR_VERSION_VALUE = "prerelease"; - -// system cvars - -// 0 or 1 -const string SYSTEM_CVAR_DEBUG = "scmenu_debug"; -const string SYSTEM_CVAR_DEBUG_REF = "scmenu_debug_ref"; -const string SYSTEM_CVAR_DEBUG_SOUND = "scmenu_debug_sound"; -const string SYSTEM_CVAR_DEBUG_AREA = "scmenu_debug_area"; - -// 0 for normal, 1 for halted, 2 for new step -const string SYSTEM_CVAR_DEBUG_STEP = "scmenu_debug_step"; - -// 0 for no info, 1 for local position, 2 for absolute position -const string SYSTEM_CVAR_DEBUG_MOUSE = "scmenu_debug_mouse"; - -// 0 for no output, 1 for medium output, 2 for extensive output -const string SYSTEM_CVAR_DEBUG_STRUCTURE = "scmenu_debug_structure"; - -// NOTE: set it to 1 to make it display the data for one frame, set it to 2 to display it always -const string SYSTEM_CVAR_DEBUG_RUNFLAG = "scmenu_debug_runflag"; -const string SYSTEM_CVAR_DEBUG_PROCESS = "scmenu_debug_process"; -const string SYSTEM_CVAR_DEBUG_MGFX = "scmenu_debug_mgfx"; - -// parser filter, possible values: info high low -const string SYSTEM_CVAR_DEBUG_PARSER = "scmenu_debug_parser"; - -// process_filter, possible values: runflag update draw mouse key -const string SYSTEM_CVAR_DEBUG_PROCESS_FILTER = "scmenu_debug_process_filter"; - -// dump item names -const string SYSTEM_CVAR_DEBUG_DUMP_NAMES = "scmenu_dumpnames"; - -const float SYSTEM_CVAR_DEBUG_DEFAULT = 0; -const float SYSTEM_CVAR_DEBUG_REF_DEFAULT = 0; -const float SYSTEM_CVAR_DEBUG_RUNFLAG_DEFAULT = 0; -const float SYSTEM_CVAR_DEBUG_PROCESS_DEFAULT = 0; -const float SYSTEM_CVAR_DEBUG_MGFX_DEFAULT = 0; -const float SYSTEM_CVAR_DEBUG_STRUCTURE_DEFAULT = 0; -const string SYSTEM_CVAR_DEBUG_PARSER_DEFAULT = ""; -const string SYSTEM_CVAR_DEBUG_PROCESS_FILTER_DEFAULT= ""; -const float SYSTEM_CVAR_DEBUG_SOUND_DEFAULT = 0; -const float SYSTEM_CVAR_DEBUG_AREA_DEFAULT = 0; -const float SYSTEM_CVAR_DEBUG_STEP_DEFAULT = 0; -const float SYSTEM_CVAR_DEBUG_MOUSE_DEFAULT = 0; - -bool sys_debug; -bool sys_debug_sound; -bool sys_debug_ref; -bool sys_debug_area; -bool sys_debug_runflag; -bool sys_debug_process; -bool sys_debug_mgfx; -float sys_debug_mouse; -float sys_debug_structure; -float sys_debug_parser; - -bool sys_debug_halt; - -float sys_debug_process_filter; - -vector sys_debug_cursor_localpos; - -void() Sys_Debug_Init; -void() Sys_Debug_Frame; -void() Sys_Debug_Draw; - -void() Sys_Debug_DumpNames; - - diff --git a/scmenu/source/system/event_helper.qc b/scmenu/source/system/event_helper.qc deleted file mode 100644 index 554f98814..000000000 --- a/scmenu/source/system/event_helper.qc +++ /dev/null @@ -1,290 +0,0 @@ -// DP/Nex menu -// system/events.qc - -// raise function -/* template - -void( entity pEntity ) Raise_x = -{ - local entity lOld; - if( !pEntity._y ) - return; - - lOld = self; - self = pEntity; - self._y(); - self = lOld; -}; -*/ - -void( entity pEntity ) Raise_Reinit = -{ - local entity lOld; - if(!pEntity._reinit) - return; - - lOld = self; - self = pEntity; - self._reinit(); - self = lOld; -}; - -void( entity pEntity ) Raise_Destroy = -{ - local entity lOld; - if( !pEntity._destroy ) - return; - - lOld = self; - self = pEntity; - self._destroy(); - self = lOld; -}; - -bool( entity pEntity, float pKey, float pAscii) Raise_Key = -{ - local entity lOld; - local bool lResult; - - if( !pEntity._key ) - return false; - - lOld = self; - self = pEntity; - lResult = self._key( pKey, pAscii ); - self = lOld; - - return lResult; -}; - -void( entity pEntity ) Raise_Draw = -{ - local entity lOld; - if( !pEntity._draw ) - return; - - lOld = self; - self = pEntity; - self._draw(); - self = lOld; -}; - -void( entity pEntity ) Raise_MouseEnter = -{ - local entity lOld; - if( !pEntity._mouseEnter ) - return; - - lOld = self; - self = pEntity; - self._mouseEnter(); - self = lOld; -}; - -void( entity pEntity ) Raise_MouseLeave = -{ - local entity lOld; - if( !pEntity._mouseLeave ) - return; - - lOld = self; - self = pEntity; - self._mouseLeave(); - self = lOld; -}; - -void( entity pEntity ) Raise_Update = -{ - local entity lOld; - if( !pEntity._update ) - return; - - lOld = self; - self = pEntity; - self._update(); - self = lOld; -}; - -void( entity pEntity, bool pSelect, bool pUser ) Raise_Select = -{ - local entity lOld; - if( !pEntity._select ) - return; - - lOld = self; - self = pEntity; - self._select( pSelect, pUser ); - self = lOld; -}; - -// safe call control function functions -// default control functions -/* template - -void() CtCall_x = -{ - if( self.y ) - self.y(); -}; - -*/ -void() CtCall_Init = -{ - if( self.init ) - self.init(); -}; - -void() CtCall_Reinit = -{ - if( self.reinit ) - self.reinit(); -}; - -void() CtCall_Destroy = -{ - if( self.destroy ) - self.destroy(); -}; - -bool( float pKey, float pAscii ) CtCall_Key = -{ - if( self.key ) - return self.key( pKey, pAscii ); - return false; -}; - -void() CtCall_Draw = -{ - if( self.draw ) - self.draw(); -}; - -void() CtCall_MouseEnter = -{ - if( self.mouseEnter ) - self.mouseEnter(); -}; - -void() CtCall_MouseLeave = -{ - if( self.mouseLeave ) - self.mouseLeave(); -}; - -void() CtCall_Action = -{ - if( self.action ) - self.action(); -}; - -void() CtCall_Update = -{ - if( self.update ) - self.update(); -} - -void( bool pSelect, bool pUser ) CtCall_Select = -{ - if( self.select ) - self.select( pSelect, pUser ); -}; - -// default control functions -/* template (expect DefCt_Key) - -void(void) defct_x = -{ - CtCall_x(); -}; - -*/ -// defct_init not needed cause its the same like the type function - -void() DefCt_Reinit = -{ -}; - -void() DefCt_Destroy = -{ -}; - -bool( float pKey, float pAscii ) DefCt_Key = -{ - return false; -}; - -void() DefCt_Draw = -{ -}; - -void() DefCt_MouseEnter = -{ -}; - -void() DefCt_MouseLeave = -{ -}; - -void() DefCt_Action = -{ -}; - -void( float pSelect, bool pUser ) DefCt_Select = -{ -}; - -void() DefCt_Update = -{ -}; - -// default key function -/*void(float keynr, float ascii) def_keyevent = -{ - if(keynr == K_ESCAPE) - { - // move up to the parent - menu_selectup(); - } else if(keynr == K_LEFTARROW || keynr == K_UPARROW) - { - // move to the previous element - menu_loopprev(); - - if(Menu_ActiveItem == self) - { - if(self._prev) - { - Menu_ActiveItem = self._prev; - menu_selectdown(); - if(Menu_ActiveItem != self._prev) - { - return; - } - } - Menu_ActiveItem = self; - } - } else if(keynr == K_RIGHTARROW || keynr == K_DOWNARROW) - { - // move to the next element - menu_loopnext(); - - if(Menu_ActiveItem == self) - { - if(self._next) - { - Menu_ActiveItem = self._next; - menu_selectdown(); - if(Menu_ActiveItem != self._next) - { - return; - } - } - Menu_ActiveItem = self; - } - } else if(keynr == K_ENTER || keynr == K_MOUSE1) - { - if(self._action) - self._action(); - // move to the child menu - menu_selectdown(); - } -};*/ diff --git a/scmenu/source/system/events.qc b/scmenu/source/system/events.qc deleted file mode 100644 index f19f36d89..000000000 --- a/scmenu/source/system/events.qc +++ /dev/null @@ -1,458 +0,0 @@ -// DP/Nex menu -// system/events.qc - -// debug process output functions -bool _menu_process_filtered; -void( float pMode, float pSelectState ) _Menu_Process_Debug_Filter = -{ - if( !sys_debug_process ) - _menu_process_filtered = false; - else if( sys_debug_process_filter ) - _menu_process_filtered = (pMode & sys_debug_process_filter); - else - _menu_process_filtered = true; - if( _menu_process_filtered == MENU_PROCESS_MOUSE && pSelectState == MENU_SELECT_NEVER ) - _menu_process_filtered = false; -}; - -#ifdef USEFUNCTIONS -void( string pText ) _Menu_Process_Debug_Print = -{ - if( _menu_process_filtered ) - print( pText ); -}; -#else -#define _Menu_Process_Debug_Print(pText) if( _menu_process_filtered ) print( pText ) -#endif - -// process stacks - -void() Menu_Process_Setup = -{ - Menu_Origin = '0 0 0'; - Menu_Clip_Position = '0 0 0'; - Menu_Clip_Size = '0 0 0'; -}; - -void( entity pItem ) _Menu_Env_LoadClipArea -{ - Menu_Clip_Position = pItem._cache_clip_pos; - Menu_Clip_Size = pItem._cache_clip_size; - - if( sys_debug_mgfx && _menu_process_filtered ) - print( "MGFX Loaded clip area = (", vtos( Menu_Clip_Position ), "; ", vtos( Menu_Clip_Size ), ")\n" ); -}; - -void( entity pItem ) _Menu_Env_LoadOrigin = -{ - Menu_Origin = pItem._cache_origin; - Menu_Cursor_Position = Cursor_Position - Menu_Origin; - - if( sys_debug_mgfx && _menu_process_filtered ) - print( "MGFX Loaded org = ", vtos( Menu_Origin ), "\n" ); -}; - -void( entity pItem ) _Menu_Env_Reload = -{ - Menu_Origin = pItem._cache_origin; - Menu_Cursor_Position = Cursor_Position - Menu_Origin; - Menu_Clip_Position = pItem._cache_clip_pos; - Menu_Clip_Size = pItem._cache_clip_size; - - if( sys_debug_mgfx && _menu_process_filtered ) - print( "MGFX Reloaded env for: org = ", vtos( Menu_Origin ), "; clip area = (", vtos( Menu_Clip_Position ), "; ", vtos( Menu_Clip_Size ), ")\n" ); -}; - -void() _MGX_SetClipArea = -{ - if( Menu_Clip_Position == '0 0 0' && Menu_Clip_Size == '0 0 0' ) - Gfx_ResetClipArea(); - else - Gfx_SetClipArea( Menu_Clip_Position_x, Menu_Clip_Position_y, Menu_Clip_Size_x, Menu_Clip_Size_y ); -}; - -void( entity pItem ) _Menu_Env_SetupClipArea -{ - local vector lDelta, lPos, lSize; - - lPos = pItem.pos; - lSize = pItem.size; - if( lPos != '0 0 0' || lSize != '0 0 0' ) { - if( (Menu_Clip_Position != '0 0 0' || Menu_Clip_Size != '0 0 0') ) { - lPos = Menu_Origin + lPos; - lDelta = Util_GetClipDelta( lPos, Menu_Clip_Position, Menu_Clip_Size ); - lPos = lPos + lDelta; - lSize = Util_ClipRect( lPos, lSize - lDelta, Menu_Clip_Position, Menu_Clip_Size ); - } - - Menu_Clip_Position = lPos; - Menu_Clip_Size = lSize; - } - pItem._cache_clip_pos = Menu_Clip_Position; - pItem._cache_clip_size = Menu_Clip_Size; - - if( sys_debug_mgfx && _menu_process_filtered ) { - print( "MGFX Setup clip area: (", vtos( pItem.pos ), "; ", vtos( pItem.size ) ); - print( ") clipped to (", vtos( Menu_Clip_Position ), "; ", vtos( Menu_Clip_Size ), ")\n" ); - } -}; - -void( entity pItem ) _Menu_Env_SetupOrigin = -{ - Menu_Origin = Menu_Origin + pItem.origin + pItem.pos; - pItem._cache_origin = Menu_Origin; - - if( sys_debug_mgfx && _menu_process_filtered ) - print( "MGFX Setup org = ", vtos( Menu_Origin ), "\n" ); -}; - -void( entity pItem ) _Menu_ProcessRunFlag = -{ - local entity lChild; - local bool lWasHidden; - local float lOldRunFlag; - - _Menu_Process_Debug_Print( strcat( "R ", pItem.name, "\n" ) ); - - // setup the cache and the Menu_* variables - _Menu_Env_SetupClipArea( pItem ); - - lWasHidden = Menu_HasRunFlag( pItem, RUNFLAG_HIDDEN ); - - lOldRunFlag = pItem._runFlag; - Menu_SetRunFlag( pItem ); - - // AK LATE: This should speed up things a bit - if( /*lOldRunFlag == pItem._runFlag &&*/ lWasHidden && Menu_HasRunFlag( pItem, RUNFLAG_HIDDEN ) ) { - _Menu_Process_Debug_Print( "Aborted branching (RUNFLAG_HIDDEN)\n" ); - return; - } - - // we adjust the origin for the children - _Menu_Env_SetupOrigin( pItem ); - - for( lChild = pItem._child ; lChild ; lChild = lChild._next ) { - Menu_InheritRunFlag( pItem, lChild ); - _Menu_ProcessRunFlag( lChild ); - // reload the cached state - _Menu_Env_Reload( pItem ); - } -}; - -void( entity pItem ) _Menu_ProcessDraw = -{ - local entity lChild; - - _Menu_Process_Debug_Print( strcat( "D ", pItem.name, " " ) ); - - if( !Menu_IsVisible( pItem ) ) { - _Menu_Process_Debug_Print( "Failed (Not visible)\n" ); - return; - } - _Menu_Process_Debug_Print( "\n" ); - - _Menu_Env_LoadClipArea( pItem ); - _MGX_SetClipArea(); - - Raise_Draw( pItem ); - - _Menu_Env_LoadOrigin( pItem ); - for( lChild = pItem._child ; lChild ; lChild = lChild._next ) { - _Menu_ProcessDraw( lChild ); - // reload old state - _Menu_Env_Reload( pItem ); - _MGX_SetClipArea(); - } -}; - -void( entity pItem ) _Menu_ProcessUpdate = -{ - local entity lChild; - - _Menu_Process_Debug_Print( strcat( "U ", pItem.name, " " ) ); - - if( Menu_HasRunFlag( pItem, RUNFLAG_CHILDDRAWONLY ) ) { - _Menu_Process_Debug_Print( "Failed (RUNFLAG_CHILDDRAWONLY)\n" ); - return; - } - - _Menu_Env_LoadClipArea( pItem ); - Raise_Update( pItem ); - - if( Menu_HasRunFlag( pItem, RUNFLAG_HIDDEN ) ) { - _Menu_Process_Debug_Print( "Aborted branching (RUNFLAG_HIDDEN)\n" ); - return; - } - _Menu_Process_Debug_Print( "\n" ); - - _Menu_Env_LoadOrigin( pItem ); - for( lChild = pItem._child ; lChild ; lChild = lChild._next ) { - _Menu_ProcessUpdate( lChild ); - _Menu_Env_Reload( lChild ); - } -}; - -void( entity pItem, float pSelectMode ) _Menu_ProcessMouse = -{ - local entity lChild; - - if( _menu_process_filtered ) { - print( "M " ); - switch( pSelectMode ) { - case MENU_SELECT_SELECTABLE: - print( "S " ); - break; - case MENU_SELECT_ALWAYS: - print( "A " ); - break; - case MENU_SELECT_NEVER: - print( "N " ); - break; - } - print( pItem.name, " " ); - } - - if( !Menu_IsVisible( pItem ) ) { - _Menu_Process_Debug_Print( "Failed (Not visible)\n" ); - return; - } - - _Menu_Env_LoadClipArea( pItem ); - // check if the mouse is even in the clip area - if( Util_InRect( Cursor_Position, Menu_Clip_Position, Menu_Clip_Size ) || - ( Menu_Clip_Position == '0 0 0' && Menu_Clip_Size == '0 0 0' ) ) { - pItem._runFlag = pItem._runFlag | RUNFLAG_MOUSEINAREA; - - if( !Menu_HasRunFlag( pItem, RUNFLAG_HADMOUSE ) && Menu_HasEvents( pItem ) ) - Raise_MouseEnter( pItem ); - if( pSelectMode != MENU_SELECT_NEVER && Menu_HasFlag( pItem, FLAG_SEALOFFMOUSE ) ) - Menu_ActiveItem = null_entity; - if( ( pSelectMode == MENU_SELECT_ALWAYS ) || - ( Menu_IsSelectable( pItem ) && pSelectMode == MENU_SELECT_SELECTABLE ) ) - Menu_ActiveItem = pItem; - } else { // if the mouse isnt in the clip area, neither the children will be! - if( Menu_HasRunFlag( pItem, RUNFLAG_HADMOUSE ) && Menu_HasEvents( pItem ) ) - Raise_MouseLeave( pItem ); - _Menu_Process_Debug_Print( "Aborted branching (Outside the clip area)\n" ); - return; - } - _Menu_Process_Debug_Print( "\n" ); - - _Menu_Env_LoadOrigin( pItem ); - for( lChild = pItem._child ; lChild ; lChild = lChild._next ) { - if( !Menu_HasRunFlag( pItem, RUNFLAG_CHILDDRAWUPDATEONLY ) || !Menu_HasRunFlag( pItem, RUNFLAG_CHILDDRAWONLY ) ) - _Menu_ProcessMouse( lChild, pSelectMode ); - else - _Menu_ProcessMouse( lChild, MENU_SELECT_NEVER ); - _Menu_Env_Reload( pItem ); - } -}; - -float( float pRetValue ) _Menu_Process_Debug_Return = -{ - if( _menu_process_filtered ) - switch( pRetValue ) { - case MENU_EVENT_NORMAL: - case MENU_EVENT_CONTINUE: - print( "MENU_EVENT_CONTINUE\n" ); - break; - case MENU_EVENT_RAISEPARENT: - print( "MENU_EVENT_RAISEPARENT\n" ); - break; - case MENU_EVENT_PROCESSED: - print( "MENU_EVENT_PROCESSED\n" ); - break; - } - - return pRetValue; -}; - -float( entity pItem, float pKey, float pAscii ) _Menu_ProcessKey = -{ - local entity lChild; - local float lResult; - - _Menu_Process_Debug_Print( strcat( "K ", ftos( pKey ), " ", pItem.name, " " ) ); - if( Menu_HasRunFlag( pItem, RUNFLAG_CHILDDRAWUPDATEONLY ) || Menu_HasRunFlag( pItem, RUNFLAG_CHILDDRAWONLY ) ) - return _Menu_Process_Debug_Return( MENU_EVENT_CONTINUE ); - - _Menu_Env_LoadClipArea( pItem ); - - if( Menu_ActiveItem == pItem ) { - if( Raise_Key( pItem, pKey, pAscii ) ) - lResult = MENU_EVENT_PROCESSED; - else - lResult = MENU_EVENT_RAISEPARENT; - - return _Menu_Process_Debug_Return( lResult ); - } - - _Menu_Env_LoadOrigin( pItem ); - for( lChild = pItem._child ; lChild ; lChild = lChild._next ) { - lResult = _Menu_ProcessKey( lChild, pKey, pAscii ); - _Menu_Env_Reload( pItem ); - - if( lResult == MENU_EVENT_PROCESSED ) - return _Menu_Process_Debug_Return( MENU_EVENT_PROCESSED ); - else if( lResult == MENU_EVENT_RAISEPARENT ) - if( Raise_Key( pItem, pKey, pAscii ) ) - return _Menu_Process_Debug_Return( MENU_EVENT_PROCESSED ); - else - return _Menu_Process_Debug_Return( MENU_EVENT_RAISEPARENT ); - } - - return _Menu_Process_Debug_Return( MENU_EVENT_CONTINUE ); -}; - -float( entity pItem, float pMode, float pSelectMode, float pKey, float pAscii ) Menu_Process = -{ - local vector lSize, lPos, lOrigin; - local float lResult; - - lSize = Menu_Clip_Size; - lPos = Menu_Clip_Position; - lOrigin = Menu_Origin; - - _Menu_Process_Debug_Filter( pMode, pSelectMode ); - - lResult = 0; - switch( pMode ) { - case MENU_PROCESS_RUNFLAG: - _Menu_ProcessRunFlag( pItem ); - break; - case MENU_PROCESS_UPDATE: - _Menu_ProcessUpdate( pItem ); - break; - case MENU_PROCESS_DRAW: - _Menu_ProcessDraw( pItem ); - break; - case MENU_PROCESS_MOUSE: - _Menu_ProcessMouse( pItem, pSelectMode ); - break; - case MENU_PROCESS_KEY: - lResult = _Menu_ProcessKey( pItem, pKey, pAscii ); - break; - } - - Menu_Clip_Size = lSize; - Menu_Clip_Position = lPos; - Menu_Origin = lOrigin; - Menu_Cursor_Position = Cursor_Position - Menu_Origin; - if( pMode == MENU_PROCESS_DRAW ) - _MGX_SetClipArea(); - - return lResult; -}; - -void() Menu_Frame = -{ - Sys_Debug_Frame(); - if( sys_debug_halt ) { - return; - } - - Menu_UpdateRunFlags(); - - Menu_Process_Setup(); - // if mouse was moved, select an item - if( Cursor_Relative != '0 0 0' ) { - local entity lOld; - - lOld = Menu_ActiveItem; - Menu_ProcessMouse( Menu_ActiveWindow, MENU_SELECT_SELECTABLE ); - - if( !Menu_ActiveItem ) - Menu_ActiveItem = lOld; - else if( lOld != Menu_ActiveItem ) { - Raise_Select( lOld, false, true ); - Raise_Select( Menu_ActiveItem, true, true ); - } - } else // just update mouseinarea - Menu_ProcessMouse( Menu_ActiveWindow, MENU_SELECT_NEVER ); - - // process the update event - Menu_Process_Setup(); - Menu_ProcessUpdate( Menu_ActiveWindow, MENU_PROCESS_UPDATE ); - - - Menu_CollectGarbage( false ); -} - -void() Menu_Draw = -{ - if( sys_debug_halt ) { - return; - } - // if Menu_ActiveWindow is visible loop though it - if( Menu_IsVisible( Menu_ActiveWindow ) ) - { - Menu_Process_Setup(); - Menu_ProcessDraw( Menu_ActiveWindow ); - } - - Sys_Debug_Draw(); -}; - -void( float pKey, float pAscii) Menu_Key = -{ - if( sys_debug_halt ) { - return; - } - - // is a keyhook set ? - if( Menu_KeyHook != Util_NullFunction ) { - // call it - Menu_KeyHook( pKey, pAscii ); - return; - } - // before calling the current keydown functions, process the mouse again - // to make sure the correct item is called - // (except mouse wheel up and down) - // if the mouse doesnt point to an item, there wont be a reaction on the clicking - if(K_MOUSE1 <= pKey && pKey <= K_MOUSE10) { - local entity lOld; - - lOld = Menu_ActiveItem; - Menu_ActiveItem = null_entity; - Menu_ProcessMouse( Menu_ActiveWindow, MENU_SELECT_SELECTABLE ); - - if( !Menu_ActiveItem ) { - Menu_ActiveItem = lOld; - return; - } else if( lOld != Menu_ActiveItem ) { - Raise_Select( lOld, false, true ); - Raise_Select( Menu_ActiveItem, true, true ); - } - } - - // call current selected keydown function - // if nothing is selected -> window has no items -> call window key - if(Menu_ActiveItem == null_entity) - Menu_Reselect( false ); - - if( ( !Menu_IsSelectable( Menu_ActiveItem ) && Menu_ActiveItem != Menu_ActiveWindow ) || - Menu_ProcessKey( Menu_ActiveWindow, pKey, pAscii ) != MENU_EVENT_PROCESSED ) - // If it goes really wrong: - if( pKey == K_ESCAPE ) - if( gamestatus & GAME_DEVELOPER ) - error( " K_ESCAPE wasnt processed!\n" ); - else { - Menu_Toggle(); - cmd( "menu_restart\n" ); - } - else if( gamestatus & GAME_DEVELOPER ) { - print( " Key ", ftos( pKey ), " ('" ); - print( chr( pAscii ), "') wasn't processed!\n" ); - } -}; - -bool() Menu_Toggle = -{ - // only let the qc toggle the menu if we are ingame or a developer - if( gamestatus & GAME_CONNECTED || gamestatus & GAME_DEVELOPER ) { - // then allow toggling - m_hide(); - return true; - } else - return false; -}; diff --git a/scmenu/source/system/events.qh b/scmenu/source/system/events.qh deleted file mode 100644 index 5dbaab28d..000000000 --- a/scmenu/source/system/events.qh +++ /dev/null @@ -1,56 +0,0 @@ -// DP/Nex Menu -// system/events.qh - -// menu_processmous states -enum { - MENU_SELECT_SELECTABLE, - MENU_SELECT_ALWAYS, - MENU_SELECT_NEVER -}; - -enum { - MENU_EVENT_NORMAL, - MENU_EVENT_CONTINUE = 0, - MENU_EVENT_RAISEPARENT, - MENU_EVENT_PROCESSED -}; - -enumflags { //enumflags because of the debug filter - MENU_PROCESS_RUNFLAG, - MENU_PROCESS_UPDATE, - MENU_PROCESS_DRAW, - MENU_PROCESS_MOUSE, - MENU_PROCESS_KEY -}; - -// used to build up the local coord system -vector Menu_Cursor_Position; - -// key hook - only as long as there is no history change or the menu is closed -entity Menu_KeyHook_Target; -var void( float pKey, float pAscii ) Menu_KeyHook = __NULL__; - -/////////////// -// prototypes -/// - -void() Menu_Frame; -void() Menu_Draw; -void(float pKey, float pAscii) Menu_Key; - -// decide whether to toggle the menu -bool() Menu_Toggle; - -void() Menu_Process_Setup; - -float( entity pItem, float pMode, float pSelectState, float pKey, float pAscii ) Menu_Process; -#define _Menu_Process(item,mode) Menu_Process( item, mode, 0, 0, 0 ) -#define Menu_ProcessDraw(item) _Menu_Process( item, MENU_PROCESS_DRAW ) -#define Menu_ProcessUpdate(item) _Menu_Process( item, MENU_PROCESS_UPDATE ) -#define Menu_ProcessRunFlag(item) _Menu_Process( item, MENU_PROCESS_RUNFLAG ) -#define Menu_ProcessMouse(item,select) Menu_Process( item, MENU_PROCESS_MOUSE, select, 0, 0 ) -#define Menu_ProcessKey(item,key,ascii) Menu_Process( item, MENU_PROCESS_KEY, 0, key, ascii ) - - - - diff --git a/scmenu/source/system/events_.qc b/scmenu/source/system/events_.qc deleted file mode 100644 index 749002c2e..000000000 --- a/scmenu/source/system/events_.qc +++ /dev/null @@ -1,419 +0,0 @@ -// DP/Nex menu -// system/events.qc - -// process stacks - -void() Menu_Process_Setup = -{ - - Menu_Origin = '0 0 0'; - Menu_Clip_Position = '0 0 0'; - Menu_Clip_Size = '0 0 0'; - - Gfx_ResetClipArea(); -} - -void( vector pOrigin ) _Menu_Origin_Push = -{ - Menu_Origin = Menu_OrgToMen( pOrigin ); - - if( _menu_process_filtered ) { - print( "MGFX Pushed origin: ", vtos( pOrigin ), " Absolute ", vtos( Menu_Origin ), "\n" ); - //print( "MGFX Pushed origin: ", vtos( pOrigin ), " Absolute " ); - //print( vtos( Menu_Origin ), "\n" ); - } - - Menu_Cursor_Position = Cursor_Position - Menu_Origin; -}; - -void( vector pOldOrigin ) _Menu_Origin_Pop = -{ - Menu_Origin = pOldOrigin; - - if( _menu_process_filtered ) - print( "MGFX Popped origin for origin: ", vtos( Menu_Origin ), "\n" ); - - Menu_Cursor_Position = Cursor_Position - Menu_Origin; -}; - -void( vector pPos, vector pSize ) _Menu_Clip_Push = -{ - local vector lDelta; - - if( pPos != '0 0 0' || pSize != '0 0 0' ) { - if( (Menu_Clip_Position != '0 0 0' || Menu_Clip_Size != '0 0 0') ) { - pPos = Menu_OrgToMen( pPos ); - lDelta = Util_GetClipDelta( pPos, Menu_Clip_Position, Menu_Clip_Size ); - pPos = pPos + lDelta; - pSize = Util_ClipRect( pPos, pSize - lDelta, Menu_Clip_Position, Menu_Clip_Size ); - } - - Menu_Clip_Position = pPos; - Menu_Clip_Size = pSize; - Gfx_SetClipArea( Menu_Clip_Position_x, Menu_Clip_Position_y, Menu_Clip_Size_x, Menu_Clip_Size_y ); - } - - if( _menu_process_filtered ) { - print( "MGFX Pushed clipper: ", vtos( pPos ), " " ); - print( vtos( pSize ) ); - print( " Clipped to: ", vtos( Menu_Clip_Position ), " " ); - print( vtos( Menu_Clip_Size),"\n" ); - } -}; - -void( vector pOldPos, vector pOldSize ) _Menu_Clip_Pop = -{ - Menu_Clip_Position = pOldPos; - Menu_Clip_Size = pOldSize; - - if( sys_debug_mgfx ) { - print( "MGFX Popped clipper for clip area: ", vtos( Menu_Clip_Position ), " " ); - print( vtos( Menu_Clip_Size ), "\n" ); - } - - if( Menu_Clip_Position == '0 0 0' && Menu_Clip_Size == '0 0 0' ) - Gfx_ResetClipArea(); - else - Gfx_SetClipArea( Menu_Clip_Position_x, Menu_Clip_Position_y, Menu_Clip_Size_x, Menu_Clip_Size_y ); -}; - -// debug process functions -bool _menu_process_filtered; -void( float pMode, float pSelectState ) _Menu_Process_Debug_Filter = -{ - if( !sys_debug_process ) - _menu_process_filtered = false; - else if( sys_debug_process_filter ) - _menu_process_filtered = (pMode & sys_debug_process_filter); - else - _menu_process_filtered = true; - if( _menu_process_filtered == MENU_PROCESS_MOUSE && pSelectState == MENU_SELECT_NEVER ) - _menu_process_filtered = false; -}; - -void( string pText ) _Menu_Process_Debug_Print = -{ - if( _menu_process_filtered ) - print( pText ); -}; - -void( entity pItem, float pMode, float pSelectState, float pKey, float pAscii ) _Menu_Process_Debug_Header = -{ - if( sys_debug_process && _menu_process_filtered ) { - switch( pMode ) { - case MENU_PROCESS_RUNFLAG: - print( "R " ); - break; - case MENU_PROCESS_UPDATE: - print( "U " ); - break; - case MENU_PROCESS_DRAW: - print( "D " ); - break; - case MENU_PROCESS_MOUSE: - print( "M " ); - switch( pSelectState ) { - case MENU_SELECT_SELECTABLE: - print( "S " ); - break; - case MENU_SELECT_ALWAYS: - print( "A " ); - break; - case MENU_SELECT_NEVER: - print( "N " ); - break; - } - break; - case MENU_PROCESS_KEY: - print( "K " ); - print( ftos( pKey ), " " ); - break; - default: - print( "~ " ); - } - print( pItem.name, " " ); - } -}; - -void( float pRetValue ) _Menu_Process_Debug_Return = -{ - if( sys_debug_process && _menu_process_filtered ) - switch( pRetValue ) { - case MENU_EVENT_NORMAL: - case MENU_EVENT_CONTINUE: - print( "MENU_EVENT_CONTINUE\n" ); - break; - case MENU_EVENT_RAISEPARENT: - print( "MENU_EVENT_RAISEPARENT\n" ); - break; - case MENU_EVENT_PROCESSED: - print( "MENU_EVENT_PROCESSED\n" ); - break; - } -}; - -// main process functions -float( entity pItem, float pMode, float pSelectState, float pKey, float pAscii ) Menu_Process = -{ - local entity lChild; - local bool lContinue; - local float lResult; - // the new clip and origin stack - local vector lOldOrigin, lOldClipPos, lOldClipSize; - - // set the debug filter - _Menu_Process_Debug_Filter( pMode, pSelectState ); - - _Menu_Process_Debug_Header( pItem, pMode, pSelectState, pKey, pAscii ); - - // adjust the clip area - lOldClipPos = Menu_Clip_Position; - lOldClipSize = Menu_Clip_Size; - _Menu_Clip_Push( pItem.pos, pItem.size ); - - // test if its necessary to do anything - lContinue = false; - lResult = MENU_EVENT_NORMAL; - switch( pMode ) { - case MENU_PROCESS_RUNFLAG: - lContinue = true; - break; - case MENU_PROCESS_MOUSE: - if( !Menu_IsVisible( pItem ) ) - break; - lContinue = true; - break; - case MENU_PROCESS_DRAW: - if( !Menu_IsVisible( pItem ) ) - break; - lContinue = true; - break; - case MENU_PROCESS_UPDATE: - if( Menu_HasRunFlag( pItem, RUNFLAG_CHILDDRAWONLY ) ) - break; - lContinue = true; - break; - case MENU_PROCESS_KEY: - if( !Menu_HasEvents( pItem ) ) - break; - lContinue = true; - break; - default: - error( "Bad pMode in Menu_Processs!" ); - break; - } - if( !lContinue ) { - _Menu_Process_Debug_Print( "Condition failed\n" ); - _Menu_Clip_Pop( lOldClipPos, lOldClipSize ); - return lResult; - } - - // process the events for this item - lContinue = true; - switch( pMode ) { - case MENU_PROCESS_RUNFLAG: - Menu_SetRunFlag( pItem ); - break; - case MENU_PROCESS_UPDATE: - Raise_Update( pItem ); - if( Menu_HasRunFlag( pItem, RUNFLAG_HIDDEN ) ) - lContinue = false; - break; - case MENU_PROCESS_DRAW: - Raise_Draw( pItem ); - break; - case MENU_PROCESS_MOUSE: - // check if the mouse is even in the clip area - if( Util_InRect( Cursor_Position, Menu_Clip_Position, Menu_Clip_Size ) || - ( Menu_Clip_Position == '0 0 0' && Menu_Clip_Size == '0 0 0' ) ) { - pItem._runFlag = pItem._runFlag | RUNFLAG_MOUSEINAREA; - - if( !Menu_HasRunFlag( pItem, RUNFLAG_HADMOUSE ) && Menu_HasEvents( pItem ) ) - Raise_MouseEnter( pItem ); - if( pSelectState != MENU_SELECT_NEVER && Menu_HasFlag( pItem, FLAG_SEALOFFMOUSE ) ) - Menu_ActiveItem = null_entity; - if( ( pSelectState == MENU_SELECT_ALWAYS ) || - ( Menu_IsSelectable( pItem ) && pSelectState == MENU_SELECT_SELECTABLE ) ) - Menu_ActiveItem = pItem; - } else if( Menu_HasRunFlag( pItem, RUNFLAG_HADMOUSE ) && Menu_HasEvents( pItem ) ) - Raise_MouseLeave( pItem ); - break; - case MENU_PROCESS_KEY: - if( Menu_ActiveItem == pItem ) { - lContinue = false; - if( Raise_Key( pItem, pKey, pAscii ) ) - lResult = MENU_EVENT_PROCESSED; - else - lResult = MENU_EVENT_RAISEPARENT; - - _Menu_Process_Debug_Return( lResult ); - } - break; - } - if( !lContinue ) { - _Menu_Process_Debug_Print( "Early\n" ); - _Menu_Clip_Pop( lOldClipPos, lOldClipSize ); - return lResult; - } - - // we adjust the origin for the children - lOldOrigin = Menu_Origin; - _Menu_Origin_Push( pItem.pos + pItem.origin ); - - _Menu_Process_Debug_Print( "\n" ); - - switch( pMode ) { - case MENU_PROCESS_RUNFLAG: - for( lChild = pItem._child ; lChild ; lChild = lChild._next ) { - Menu_InheritRunFlag( pItem, lChild ); - Menu_ProcessRunFlag( lChild ); - } - break; - case MENU_PROCESS_DRAW: - for( lChild = pItem._child ; lChild ; lChild = lChild._next ) - Menu_ProcessDraw( lChild ); - break; - case MENU_PROCESS_UPDATE: - for( lChild = pItem._child ; lChild ; lChild = lChild._next ) - Menu_ProcessUpdate( lChild ); - break; - case MENU_PROCESS_MOUSE: - for( lChild = pItem._child ; lChild ; lChild = lChild._next ) - if( Menu_HasEvents( pItem ) ) - Menu_ProcessMouse( lChild, pSelectState ); - else - Menu_ProcessMouse( lChild, MENU_SELECT_NEVER ); - break; - case MENU_PROCESS_KEY: - for( lChild = pItem._child ; lContinue && lChild ; lChild = lChild._next ) { - local float lRet; - - lRet = Menu_ProcessKey( lChild, pKey, pAscii ); - - switch( lRet ) { - case MENU_EVENT_RAISEPARENT: - lContinue = false; - if( Raise_Key( pItem, pKey, pAscii ) ) - lResult = MENU_EVENT_PROCESSED; - else - lResult = MENU_EVENT_RAISEPARENT; - break; - case MENU_EVENT_PROCESSED: - lResult = lRet; - lContinue = false; - break; - case MENU_EVENT_CONTINUE: - lResult = lRet; - break; - } - } - _Menu_Process_Debug_Return( lResult ); - break; - } - - _Menu_Origin_Pop( lOldOrigin ); - - _Menu_Clip_Pop( lOldClipPos, lOldClipSize ); - return lResult; -}; - -void() Menu_Frame = -{ - Sys_Debug_Frame(); - - Menu_UpdateRunFlags(); - // process the update event - Menu_Process_Setup(); - Menu_ProcessUpdate( Menu_ActiveWindow, MENU_PROCESS_UPDATE ); - - Menu_Process_Setup(); - // if mouse was moved, select an item - if( Cursor_Relative != '0 0 0' ) { - local entity lOld; - - lOld = Menu_ActiveItem; - Menu_ProcessMouse( Menu_ActiveWindow, MENU_SELECT_SELECTABLE ); - - if( !Menu_ActiveItem ) - Menu_ActiveItem = lOld; - else if( lOld != Menu_ActiveItem ) { - Raise_Select( lOld, false, true ); - Raise_Select( Menu_ActiveItem, true, true ); - } - } else // just update mouseinarea - Menu_ProcessMouse( Menu_ActiveWindow, MENU_SELECT_NEVER ); - - Menu_CollectGarbage( false ); -} - -void() Menu_Draw = -{ - // if Menu_ActiveWindow is visible loop though it - if( Menu_IsVisible( Menu_ActiveWindow ) ) - { - Menu_Process_Setup(); - Menu_ProcessDraw( Menu_ActiveWindow ); - } - - Sys_Debug_Draw(); -}; - -void( float pKey, float pAscii) Menu_Key = -{ - // is a keyhook set ? - if( Menu_KeyHook != Util_NullFunction ) { - // call it - Menu_KeyHook( pKey, pAscii ); - return; - } - // before calling the current keydown functions, process the mouse again - // to make sure the correct item is called - // (except mouse wheel up and down) - // if the mouse doesnt point to an item, there wont be a reaction on the clicking - if(K_MOUSE1 <= pKey && pKey <= K_MOUSE10) { - local entity lOld; - - lOld = Menu_ActiveItem; - Menu_ActiveItem = null_entity; - Menu_ProcessMouse( Menu_ActiveWindow, MENU_SELECT_SELECTABLE ); - - if( !Menu_ActiveItem ) { - Menu_ActiveItem = lOld; - return; - } else if( lOld != Menu_ActiveItem ) { - Raise_Select( lOld, false, true ); - Raise_Select( Menu_ActiveItem, true, true ); - } - } - - // call current selected keydown function - // if nothing is selected -> window has no items -> call window key - if(Menu_ActiveItem == null_entity) - Menu_Reselect( false ); - - if( ( !Menu_IsSelectable( Menu_ActiveItem ) && Menu_ActiveItem != Menu_ActiveWindow ) || - Menu_ProcessKey( Menu_ActiveWindow, pKey, pAscii ) != MENU_EVENT_PROCESSED ) - // If it goes really wrong: - if( pKey == K_ESCAPE ) - if( gamestatus & GAME_DEVELOPER ) - error( " K_ESCAPE wasnt processed!\n" ); - else { - Menu_Toggle(); - cmd( "menu_restart\n" ); - } - else if( gamestatus & GAME_DEVELOPER ) { - print( " Key ", ftos( pKey ), " ('" ); - print( chr( pAscii ), "') wasn't processed!\n" ); - } -}; - -bool() Menu_Toggle = -{ - // only let the qc toggle the menu if we are ingame or a developer - if( gamestatus & GAME_CONNECTED || gamestatus & GAME_DEVELOPER ) { - // then allow toggling - m_hide(); - return true; - } else - return false; -}; diff --git a/scmenu/source/system/gc.qc b/scmenu/source/system/gc.qc deleted file mode 100644 index bd57fde8e..000000000 --- a/scmenu/source/system/gc.qc +++ /dev/null @@ -1,72 +0,0 @@ -// DP/Nex Menu -// system/gc.qc - -void() Menu_InitGarbageStats = -{ - Menu_GarbageFrameCount = 0; - Menu_GarbageToggleCount = 0; -}; - -void() Menu_ResetGarbageStats = -{ - if( Menu_GarbageFrameCount ) - print( "Menu: GC: ", ftos( Menu_GarbageFrameCount ), " items marked for frame deletion but couldnt be reached!\n" ); - if( Menu_GarbageToggleCount ) - print( "Menu: GC: ", ftos( Menu_GarbageToggleCount ), " items marked for toggle delition but couldnt be reached!\n" ); - - Menu_GarbageFrameCount = 0; - Menu_GarbageToggleCount = 0; -}; - -bool( entity pItem ) Menu_CheckForGarbage = -{ - if( Menu_HasRunFlag( pItem, RUNFLAG_DELETEFRAME ) ) { - Menu_RemoveItem( pItem ); - --Menu_GarbageFrameCount; - return true; - } - return false; -}; - -void( bool pToggle ) Menu_CollectGarbage = -{ - local entity lNode; - - lNode = null_entity; - if( pToggle ) { - while( (Menu_GarbageFrameCount || Menu_GarbageToggleCount) && (lNode = nextent( lNode )) != null_entity ) - if( Menu_HasRunFlag( lNode, RUNFLAG_DELETEFRAME ) ) { - Menu_RemoveItem( lNode ); - --Menu_GarbageFrameCount; - } else if( Menu_HasRunFlag( lNode, RUNFLAG_DELETETOGGLE ) ) { - Menu_RemoveItem( lNode ); - --Menu_GarbageToggleCount; - } - } else while( Menu_GarbageFrameCount && (lNode = nextent( lNode )) != null_entity ) - if( Menu_HasRunFlag( lNode, RUNFLAG_DELETEFRAME ) ) { - Menu_RemoveItem( lNode ); - --Menu_GarbageFrameCount; - } -}; - -void( entity pItem ) Menu_DeleteAfterFrame = -{ - if( !Menu_HasRunFlag( pItem, RUNFLAG_DELETEFRAME ) ) { - if( Menu_HasRunFlag( pItem, RUNFLAG_DELETETOGGLE ) ) { - pItem._runFlag = pItem._runFlag + RUNFLAG_DELETEFRAME - RUNFLAG_DELETETOGGLE; - --Menu_GarbageToggleCount; - } else - pItem._runFlag = pItem._runFlag + RUNFLAG_DELETEFRAME; - ++Menu_GarbageFrameCount; - } -}; - -void( entity pItem ) Menu_DeleteAfterToggle = -{ - if( Menu_HasRunFlag( pItem, RUNFLAG_DELETEFRAME ) - || Menu_HasRunFlag( pItem, RUNFLAG_DELETETOGGLE ) ) - return; - pItem._runFlag = self._runFlag + RUNFLAG_DELETETOGGLE; - ++Menu_GarbageToggleCount; -}; - diff --git a/scmenu/source/system/gc.qh b/scmenu/source/system/gc.qh deleted file mode 100644 index b2df766a1..000000000 --- a/scmenu/source/system/gc.qh +++ /dev/null @@ -1,14 +0,0 @@ -// DP/Nex Menu -// system/gc.qh - -float Menu_GarbageFrameCount; -float Menu_GarbageToggleCount; - -void() Menu_InitGarbageStats; -void() Menu_ResetGarbageStats; - -bool( entity pItem ) Menu_CheckForGarbage; // also removes it, only checks for framedelete - -void( bool pToggle ) Menu_CollectGarbage; -void( entity pItem ) Menu_DeleteAfterFrame; -void( entity pItem ) Menu_DeleteAfterToggle; diff --git a/scmenu/source/system/history.qc b/scmenu/source/system/history.qc deleted file mode 100644 index 65abbb141..000000000 --- a/scmenu/source/system/history.qc +++ /dev/null @@ -1,81 +0,0 @@ -// DP/Nex menu -// system/history.qc - - -/* -=================== -Menu_History_Push -=================== -*/ -void( entity pEntity, Menu_History_PopFunction pPopFunction ) Menu_History_Push = -{ - local entity lHistory; - - Menu_KeyHook = Util_NullFunction; - - lHistory = spawn(); - - lHistory.type = "MMANAGER_HISTORY"; - lHistory._prev = Menu_History; - lHistory._child = Menu_ActiveItem; - lHistory._parent = Menu_ActiveWindow; - lHistory._next = pEntity; // "used for" - lHistory._destroy = pPopFunction; - - Menu_History = lHistory; -}; - -/* -=================== -Menu_History_Pop -=================== -*/ -void() Menu_History_Pop = -{ - local entity lTemp; - - if( Menu_History == null_entity ) - return; - - Menu_KeyHook = Util_NullFunction; - - Menu_ActiveItem = Menu_History._child; - Menu_ActiveWindow = Menu_History._parent; - - lTemp = Menu_History; - // FIXME: use Menu_DestroyItem - Raise_Destroy( lTemp ); - Menu_History = Menu_History._prev; - remove( lTemp ); -}; - -/* -=================== -Menu_History_Verify -=================== -*/ -bool( entity pEntity ) Menu_History_Verify = -{ - if( Menu_History == null_entity ) - return false; - - if( Menu_History._next == pEntity ) - return true; - return false; -}; - -/* -=================== -Menu_History_Clear -=================== -*/ -void() Menu_History_Clear = -{ - local entity lEntity; - - lEntity = null_entity; - while( ( lEntity = findstring( lEntity, type, "MMANAGER_HISTORY" ) ) != null_entity) - remove( lEntity ); - - Menu_History = null_entity; -}; diff --git a/scmenu/source/system/history.qh b/scmenu/source/system/history.qh deleted file mode 100644 index e8c20ca01..000000000 --- a/scmenu/source/system/history.qh +++ /dev/null @@ -1,23 +0,0 @@ -// DP/Nex Menu -// system/history.qh - -// MMANAGER_HISTORY -.entity _prev; // <- points to the previous history element -.entity _child; // <- points to the old/calling selected item -.entity _parent; // <- points to the old active window -.entity _next; // <- points to the item which the history is used for -.event _destroy; // <- points to the function that is called when the history is popped - -// points to the last element of the history -entity Menu_History; - -/////////////// -// prototypes -/// -typedef void() Menu_History_PopFunction; - -void( entity pEntity, Menu_History_PopFunction pPopFunction ) Menu_History_Push; -void() Menu_History_Pop; -bool( entity pEntity ) Menu_History_Verify; // Verifies the target item -void() Menu_History_Clear; - diff --git a/scmenu/source/system/isframe.qc b/scmenu/source/system/isframe.qc deleted file mode 100644 index c328870b8..000000000 --- a/scmenu/source/system/isframe.qc +++ /dev/null @@ -1,335 +0,0 @@ -// DP/Nex Menu -// system/isframe.qc - -void() Menu_Init = -{ - //registercvar("menu_reloadlist","0"); - - Sys_Debug_Init(); - // do one frame to make it possible to debug the parser - Sys_Debug_Frame(); - - Menu_InitGarbageStats(); - Menu_Load(); -}; - -void() Menu_Load = -{ - Parser_ParseMenu( MENU_MAINFILE, MENU_PLUGINDIR ); - - Menu_LinkWindows(); -}; - -// the good thing is, finddef doesnt fuck up any chain lists -entity(entity pStart, .string pFind1, string pMatch, .float pFind2, float pMatch2) finddef = -{ - while( 1 ) { - pStart = findstring( pStart, pFind1, pMatch ); - if( pStart == null_entity ) - break; - if( pStart.pFind2 == pMatch2 ) - break; - } - - return pStart; -}; - -void( entity pParent ) Menu_LinkChildren = -{ - local entity lChild; - local float lOrder; - local entity lPrevious; - - // build a list of all children - lChild = findchainstring( parent, pParent.name ); - if( lChild == null_entity ) - return; - - // inverse the chain - lPrevious = null_entity; - while( lChild ) { - local entity lNext; - - lNext = lChild.chain; - lChild.chain = lPrevious; - lPrevious = lChild; - lChild = lNext; - } - lChild = lPrevious; - - lOrder = 1; // we start with orderPos 1 (0 is auto-set) - lPrevious = null_entity; - while( lChild ) { - local entity lOverwrite; - // try to find an item that has the current orderPos set - lOverwrite = finddef( null_entity, parent, pParent.name, orderPos, lOrder ); - if( lOverwrite == lChild ) - lChild.orderPos = lOrder; - else if( lOverwrite ) { - // insert lOverwrite in front of lChild - local entity lOPrevious; - - lOPrevious = findentity( null_entity, chain, lOverwrite ); - lOPrevious.chain = lOverwrite.chain; - lOverwrite.chain = lChild; - lChild = lOverwrite; - } else - lChild.orderPos = 0 - lOrder; //INFO: HACK: tell Spike - - // link it - if( lPrevious ) - lPrevious._next = lChild; - else - pParent._child = lChild; - lChild._prev = lPrevious; - lChild._parent = pParent; - - lPrevious = lChild; - lChild = lChild.chain; - lOrder++; - } - lPrevious._next = null_entity; -}; - -void() Menu_LinkWindows = -{ - // first verify that MENU_NORMAL_NAME and MENU_INGAME_NAME exist - // if not add the default strings - local entity lEntity; - - dprint( "Loading defaults if necessary\n" ); - - lEntity = findstring( null_entity, name, MENU_NORMAL_NAME ); - if( lEntity == null_entity ) - loadfromdata( MENU_NORMAL_DEFAULT ); - - // verify again if MENU_NORMAL_NAME is there now - lEntity = findstring( null_entity, name, MENU_NORMAL_NAME ); - if( lEntity == null_entity ) - error( "Bad MENU_NORMAL_DEFAULT!\n" ); - - lEntity = findstring( null_entity, name, MENU_INGAME_NAME ); - if( lEntity == null_entity ) - loadfromdata( MENU_INGAME_DEFAULT ); - - // verify again if MENU_INGAME_NAME is there now - lEntity = findstring( null_entity, name, MENU_INGAME_NAME ); - if( lEntity == null_entity ) - error( "Bad MENU_INGAME_DEFAULT!\n" ); - - dprint( "Verifying that every name is used only once\n" ); - - // verify that every name is only used *once* - lEntity = null_entity; - while( ( lEntity = nextent( lEntity ) ) != null_entity ) { - self = lEntity; - while( ( self = findstring( self, name, lEntity.name ) ) != null_entity ) - if( self != null_entity ) - objerror( "Name ", lEntity.name, " already used!\n" ); - } - - dprint( "Verification of: name, type and parent fields\n" ); - - // now we have to : - // set the parent field with parent_name - // check the type field - self = null_entity; - while( ( self = nextent( self ) ) != null_entity ) { - if( self.name == "" ) { - objerror( "Name is missing!\n" ); - continue; - } - - if( self.type == "" ) { - objerror( "Type is missing!\n" ); - continue; - } - - if( !isfunction( strcat( self.type, "_Spawn" ) ) ) { - objerror( "Control ", self.type, " not found!\n" ); - continue; - } - - // find parent - // if parent_name is "" do nothing else check whether the parent exists - if( self.parent != "" ) { - lEntity = findstring( null_entity, name, self.parent ); - - if( lEntity == null_entity ) { - objerror( "Item ", self.parent, " not found!\n" ); - continue; - } - } - else - self._parent = null_entity; - } - - dprint( "Building the child lists\n" ); - // call LinkChildren for all entities - lEntity = null_entity; - while( ( lEntity = nextent( lEntity ) ) != null_entity ) - Menu_LinkChildren( lEntity ); - - dprint( "Calling the type functions\n" ); - - // call the type functions (former classname functions) - lEntity = null_entity; - while( ( lEntity = nextent( lEntity ) ) != null_entity ) { - self = lEntity; - //dprint("Calling ",self.type," (", etos(self),")\n"); - if( !Menu_HasFlag( self, FLAG_TEMPLATE ) && !Menu_HasRunFlag( self, RUNFLAG_SPAWNED ) ) { - //print( lEntity.name, "\n" ); - callfunction( strcat( self.type, "_Spawn" ) ); - self._runFlag = self._runFlag | RUNFLAG_SPAWNED; - } //else - //print( "X ", lEntity.name, "\n" ); - } - - dprint( "Linking windows finished.\n" ); -}; - -void( entity pItem ) Menu_LinkItem = -{ - local entity lEntity; - local entity lOldSelf; - - if( Menu_HasRunFlag( pItem, RUNFLAG_SPAWNED ) ) - return; - - // verify the type - if( pItem.type == "" ) - error( "LinkItem: Type is missing (", etos( pItem ), ")!\n" ); - - if( !isfunction( strcat( pItem.type, "_Spawn" ) ) ) - error( "LinkItem: Control ", pItem.type, " not found (", etos( pItem ), ")!\n" ); - - // verify name and parent - lEntity = null_entity; - while( (lEntity = findstring( lEntity, name, pItem.name )) != null_entity ) - if( lEntity != pItem ) - error( "LinkItem: Name '", pItem.name, "' already in use (", etos( pItem ), ", ", etos( lEntity ), ")!" ); - - if( pItem.parent != "" ) { - pItem._parent = findstring( null_entity, name, pItem.parent ); - - if( !pItem._parent ) - error( "LinkItem: Couldnt find parent '", pItem.parent, "' (", etos( pItem ), ")!" ); - } else - pItem._parent = null_entity; - - // Add the children - Menu_LinkChildren( pItem ); - - // link children - for( lEntity = pItem._child ; lEntity ; lEntity = lEntity._next ) - Menu_LinkItem( lEntity ); - - // call the spawn function - lOldSelf = self; - self = pItem; - if( !Menu_HasFlag( self, FLAG_TEMPLATE ) ) { - callfunction( strcat( self.type, "_Spawn" ) ); - self._runFlag = self._runFlag | RUNFLAG_SPAWNED; - } - self = lOldSelf; -}; - -void() Menu_Hide = -{ - Raise_Select( Menu_ActiveItem, false, false ); - Menu_CollectGarbage( true ); - Menu_ResetGarbageStats(); -}; - -void() Menu_PerformReinit = -{ - // clear history - Menu_History_Clear(); - - // reset the key hook (if necessary at all) - Menu_KeyHook = Util_NullFunction; - - // choose which menu to display - if( MENU_ALLOWINGAME && ( gamestatus & GAME_CONNECTED ) ) - Menu_ActiveWindow = findstring( null_entity, name, MENU_INGAME_NAME ); - else - Menu_ActiveWindow = findstring( null_entity, name, MENU_NORMAL_NAME ); - - // and reinit all menu items - self = null_entity; - while( (self = nextent( self ) ) != null_entity ) { - if( self.parent == "" ) - self._parent = null_entity; - //else actually this shouldnt happen - else if( self._parent.name != self.parent ) - objerror( "Parent (should be ", self.parent, ") of menu item ", self.name, " changed to ", self._parent.name, " !\n" ); - - Raise_Reinit( self ); // always call reinit - } - - // run one runflag frame to (re)init the runflags - Menu_UpdateRunFlags(); - - Menu_Reselect( false ); -}; - -void() Menu_Shutdown = -{ - // call the terminate event for each object - self = null_entity; - while( ( self = nextent( self ) ) != null_entity ) - Raise_Destroy( self ); -}; - -entity( string pType, string pName, string pParent ) Menu_CreateItem = -{ - local entity lItem; - - if( !pType ) - error( "Bad pType '", pType, "'!" ); - if( !pName ) - error( "Bad pName '", pName, "'!" ); - - lItem = spawn(); - parseentitydata( lItem, strcat( "{ type \"", pType, "\" name \"", strcat( pParent, "::", pName ), "\" parent \"", pParent, "\" }" ) ); - return lItem; -}; - -entity( entity pTemplate, string pName, string pParent, bool pTree ) Menu_DeriveItem = -{ - local entity lItem; - local entity lChild; - - if( !pTemplate ) - error( "Null pTemplate!" ); - if( !pName ) - error( "Bad pName '", pName, "'!" ); - - lItem = spawn(); - copyentity( pTemplate, lItem ); - if( lItem.flag & FLAG_TEMPLATE ) - lItem.flag = lItem.flag - FLAG_TEMPLATE; - if( lItem._runFlag & RUNFLAG_SPAWNED ) - lItem._runFlag = lItem._runFlag - RUNFLAG_SPAWNED; - parseentitydata( lItem, strcat( "{ name \"", strcat( pParent, "::", pName ), "\" parent \"", pParent, "\" }" ) ); - - if( pTree ) - for( lChild = pTemplate._child ; lChild ; lChild = lChild._next ) { - local string lName; - lName = String_Zone( substring( lChild.name, strlen( lChild.parent ) + 2, 100000 ) ); - Menu_DeriveItem( lChild, lName, lItem.name, true ); - String_Free( lName ); - } - - return lItem; -}; - -void( entity pItem, string pData ) Menu_AddEntityData = -{ - parseentitydata( pItem, pData ); -}; - -void( entity pWindow ) Menu_LinkWindow = -{ - Menu_LinkItem( pWindow ); -}; diff --git a/scmenu/source/system/isframe.qh b/scmenu/source/system/isframe.qh deleted file mode 100644 index a9823ef9e..000000000 --- a/scmenu/source/system/isframe.qh +++ /dev/null @@ -1,57 +0,0 @@ -// DP/Nex Menu -// system/isframe.qh - -// define these menus in the menu def files or dont -// if not defined there will be added default items -const string MENU_NORMAL_NAME = "Normal"; -const string MENU_INGAME_NAME = "Ingame"; - -const string MENU_NORMAL_DEFAULT = -"// default normal menu\n" -"{\n" -" \"type\" \"Item_Window\"\n" -" \"name\" \"Normal\"\n" -"}"; - -const string MENU_INGAME_DEFAULT = -"// default ingame menu\n" -"{\n" -" \"type\" \"Item_Window\"\n" -" \"name\" \"Ingame\"\n" -"}"; - -// insert the files here -var string MENU_MAINFILE = "menu/menu"; -var string MENU_PLUGINDIR = "menu/plugin"; - -const bool MENU_ALLOWINGAME = false; - -/////////////// -// prototypes -/// - -// used for global managing -void() Menu_Init; -// loads all files the file lists consists of -void() Menu_Load; -// used to reset the menu states everytime the menu is activated -void() Menu_PerformReinit; -// called when the hide event is processed -void() Menu_Hide; -// unload the menu -void() Menu_Shutdown; - -// For runtime addition of items, there is one function: -// it supposes that the Item has already been embedded into its parent -void( entity pItem ) Menu_LinkItem; // does also link all children and call their spawn function if necessary -void( entity pWindow ) Menu_LinkWindow; - - // to make life easier -entity( string pType, string pName, string pParent ) Menu_CreateItem; -entity( entity pTemplate, string pName, string pParent, bool pTree ) Menu_DeriveItem; - -void( entity pItem, string pData ) Menu_AddEntityData; - -// these functions are pretty private, so dont call them ! -void( entity pParent ) Menu_LinkChildren; -void() Menu_LinkWindows; diff --git a/scmenu/source/system/item.qh b/scmenu/source/system/item.qh deleted file mode 100644 index 9972cfd4d..000000000 --- a/scmenu/source/system/item.qh +++ /dev/null @@ -1,126 +0,0 @@ -// DP/Nex Menu -// system/item.qh - -enumflags { - RUNFLAG_TEMPLATE, - - RUNFLAG_HADMOUSE, - RUNFLAG_MOUSEINAREA, - - RUNFLAG_CHILDDRAWONLY, - RUNFLAG_CHILDDRAWUPDATEONLY, - - RUNFLAG_HIDDEN, - RUNFLAG_CLIPPED, // used to distinguish between intentionally hidden and casaully hidden - RUNFLAG_NOSELECT, - - RUNFLAG_USERSELECT, - - RUNFLAG_DELETEFRAME, - RUNFLAG_DELETETOGGLE, - - RUNFLAG_SPAWNED // set after the spawn function has been called -}; - -typedef void() event; -typedef bool(float,float) keyEvent; -typedef void(bool,bool) selectEvent; - -/////////// -// [Item] fields -/// - -.entity chain; - -// controly type -.string type; - -// managing stuff -.entity _parent; -.string parent; - -//.entity _history; // used to set up the history -> selectdown prefers _history over _parent - -.string name; - -.entity _next, _prev; // point to the next, respectively, the previous item - -.entity _child; // points to the first child - -// updating stuff -.float orderPos; // if FLAG_NOSELECT or FLAG_HIDDEN is set, it cant be selected - // has to be set always to a correct value or to 0 then it is set -.float flag; -.float _runFlag; - -// drawing -.vector pos; -.vector size; - -.vector origin; - -// event cache fields -.vector _cache_origin; -.vector _cache_clip_pos; -.vector _cache_clip_size; - -// function pointers -.event init; // called once at object creation -.event reinit; -.event destroy; -.event mouseEnter; -.event mouseLeave; -.event update; -.selectEvent select; -.event action; -.event draw; -.keyEvent key; // if it returns TRUE, the key was processed by the function - -// hidden function pointers - actually these are called by the manager -// and they call the normal ones (used to make controls more generic -.event _reinit; // called in performreinit -.event _destroy; // called when the item is removed -> menu_removeitem -.event _mouseEnter; -.event _mouseLeave; -.event _update; -.selectEvent _select; -.event _draw; -.keyEvent _key; - -///////////////////// -// Helper Functions -/// - -// default control functions - assign only to the _* event functions -// (assigning to the 'normal' event functions will crash the vm !) -// are used by ITEM_CUSTOM and can be used to test new ITEMs easily -void() DefCt_Reinit; -void() DefCt_Destroy; -bool( float pKey, float pAscii ) DefCt_Key; -void() DefCt_Draw; -void() DefCt_MouseEnter; -void() DefCt_MouseLeave; -void() DefCt_Update; -void( bool pSelect, bool pUser ) DefCt_Select; - -// use this to raise an event from another item or function -void( entity pEntity ) Raise_Reinit; -void( entity pEntity ) Raise_Destroy; -bool( entity pEntity, float pKey, float pAscii) Raise_Key; -void( entity pEntity ) Raise_Draw; -void( entity pEntity ) Raise_MouseEnter; -void( entity pEntity ) Raise_MouseLeave; -void( entity pEntity ) Raise_Update; -void( entity pEntity, bool pSelect, bool pUser ) Raise_Select; - -// safe call the event control functions (only used by the mcontrols function) -void() CtCall_Init; -void() CtCall_Reinit; -void() CtCall_Destroy; -bool( float pKey, float pAscii) CtCall_Key; -void() CtCall_Draw; -void() CtCall_MouseEnter; -void() CtCall_MouseLeave; -void() CtCall_Action; -void() CtCall_Update; -void( bool pSelect, bool pUser ) CtCall_Select; diff --git a/scmenu/source/system/mgfx.qc b/scmenu/source/system/mgfx.qc deleted file mode 100644 index 7fb4c859f..000000000 --- a/scmenu/source/system/mgfx.qc +++ /dev/null @@ -1,158 +0,0 @@ -// DP/Nex Menu -// system/mgfx.qc - -void( vector pPos, vector pSize, vector pColor, float pAlpha, float pDrawFlag, string pText ) _Mgfx_Debug_Info = -{ - if( !sys_debug_mgfx ) - return; - - pText = String_Zone( pText ); - - print( "MGFX output: ", vtos( pPos ), " - ", vtos( pSize), " C", vtos( pColor ) ); - print( " A", ftos( pAlpha ), " X", ftos( pDrawFlag ), " ", pText, "\n" ); - - String_Free( pText ); -}; - -/* -=================== -Menu_MenToOrg -=================== -*/ -vector( vector pPos ) Menu_MenToOrg = -{ - return pPos - Menu_Origin; -}; - -/* -=================== -Menu_OrgToMen -=================== -*/ -vector( vector pPos ) Menu_OrgToMen = -{ - return pPos + Menu_Origin; -}; - -/* -=================== -Menu_ConToOrg -=================== -*/ -vector( vector pPos ) Menu_ConToOrg = -{ - pPos = Gfx_ConToMen( pPos ); - return Menu_MenToOrg( pPos ); -}; - -/* -=================== -Menu_OrgToCon -=================== -*/ -vector( vector pPos ) Menu_OrgToCon = -{ - pPos = Menu_OrgToMen( pPos ); - return Gfx_MenToCon( pPos ); -}; - -/* -=================== -Menu_DrawCharacter -=================== -*/ -float( vector pPosition, float pCharacter, vector pScale, vector pRGB, float pAlpha, float pFlag ) -Menu_DrawCharacter = -{ - _Mgfx_Debug_Info( pPosition, pScale, pRGB, pAlpha, pFlag, strcat( "DrawChar: ", ftos( pCharacter ) ) ); - - pPosition = Menu_OrgToMen( pPosition ); - return Gfx_DrawCharacter( pPosition, pCharacter, pScale, pRGB, pAlpha, pFlag ); -}; - -/* -=================== -Menu_DrawString -=================== -*/ -float( vector pPosition, string pText, vector pScale, vector pRGB, float pAlpha, float pFlag ) -Menu_DrawString = -{ - // TODO: FIXME: do I really want this? - if( !pText ) - return 1; - - _Mgfx_Debug_Info( pPosition, pScale, pRGB, pAlpha, pFlag, strcat( "DrawString: ", pText ) ); - - pPosition = Menu_OrgToMen( pPosition ); - return Gfx_DrawString( pPosition, pText, pScale, pRGB, pAlpha, pFlag ); -}; - -/* -=================== -Menu_DrawPicture -=================== -*/ -float( vector pPosition, string pPicture, vector pSize, vector pRGB, float pAlpha, float pFlag ) -Menu_DrawPicture = -{ - _Mgfx_Debug_Info( pPosition, pSize, pRGB, pAlpha, pFlag, strcat( "DrawPicture: ", pPicture ) ); - - pPosition = Menu_OrgToMen( pPosition ); - return Gfx_DrawPic( pPosition, pPicture, pSize, pRGB, pAlpha, pFlag ); -}; - -/* -=================== -Menu_Fill -=================== -*/ -float( vector pPosition, vector pSize, vector pRGB, float pAlpha, float pFlag ) -Menu_Fill = -{ - _Mgfx_Debug_Info( pPosition, pSize, pRGB, pAlpha, pFlag, "Fill" ); - - pPosition = Menu_OrgToMen( pPosition ); - return Gfx_Fill( pPosition, pSize, pRGB, pAlpha, pFlag ); -}; - -/* -=================== -Menu_SetClipArea -=================== -*/ -void( float pX, float pY, float pWidth, float pHeight ) -Menu_SetClipArea = -{ - local vector lPosition; - local vector lDelta; - local vector lSize; - - lPosition_x = pX; - lPosition_y = pY; - lPosition = Menu_OrgToMen( lPosition); - - lSize_x = pWidth; - lSize_y = pHeight; - // clip it to the current clip area - lDelta = Util_GetClipDelta( lPosition, Menu_Clip_Position, Menu_Clip_Size ); - lPosition = lPosition + lDelta; - lSize = Util_ClipRect( lPosition, lSize - lDelta, Menu_Clip_Position, Menu_Clip_Size ); - - Gfx_SetClipArea( lPosition_x, lPosition_y, pWidth, pHeight ); -}; - -/* -=================== -Menu_ResetClipArea -=================== -*/ -void() -Menu_ResetClipArea = -{ - if( Menu_Clip_Position == '0 0 0' && Menu_Clip_Size == '0 0 0' ) - Gfx_ResetClipArea(); - else - Gfx_SetClipArea( Menu_Clip_Position_x, Menu_Clip_Position_y, Menu_Clip_Size_x, Menu_Clip_Size_y ); -} - diff --git a/scmenu/source/system/mgfx.qh b/scmenu/source/system/mgfx.qh deleted file mode 100644 index 8fcca8f79..000000000 --- a/scmenu/source/system/mgfx.qh +++ /dev/null @@ -1,36 +0,0 @@ -// DP/Nex Menu -// system/mgfx.qh - -vector Menu_Clip_Position; -vector Menu_Clip_Size; -vector Menu_Origin; - -vector( vector pPos ) Menu_OrgToMen; -vector( vector pPos ) Menu_MenToOrg; -vector( vector pPos ) Menu_ConToOrg; -vector( vector pPos ) Menu_OrgToCon; - -float( vector pPosition, float pCharacter, vector pScale, vector pRGB, float pAlpha, float pFlag ) -Menu_DrawCharacter; - -float( vector pPosition, string pText, vector pScale, vector pRGB, float pAlpha, float pFlag ) -Menu_DrawString; - -float( vector pPosition, string pPicture, vector pSize, vector pRGB, float pAlpha, float pFlag ) -Menu_DrawPicture; - -float( vector pPosition, vector pSize, vector pRGB, float pAlpha, float pFlag ) -Menu_Fill; - -void( float pX, float pY, float pWidth, float pHeight ) -Menu_SetClipArea; - -void() -Menu_ResetClipArea; - -#ifdef USEFUNCTIONS -void( string pText ) -_Menu_Process_Debug_Print; -#endif - -bool _menu_process_filtered; diff --git a/scmenu/source/system/parser.qc b/scmenu/source/system/parser.qc deleted file mode 100644 index 56b39b473..000000000 --- a/scmenu/source/system/parser.qc +++ /dev/null @@ -1,569 +0,0 @@ -// DP/Nex Menu -// system/parser.qc - -void() Parser_Define_Spawn = {}; - -void() Parser_TokenizeLine = -{ - Parser_NumTokens = tokenize( Parser_Line ); - Parser_TokenNum = 0; -}; - -bool() Parser_GetToken = -{ - local string lLine; - - if( Parser_TokenNum >= Parser_NumTokens ) { // get a new line - lLine = fgets( Parser_File ); - ++Parser_LineNumber; - if( !lLine ) - if( !validstring( lLine ) ) - return false; - else - return Parser_GetToken(); - - Parser_Line = String_Set( Parser_Line, lLine ); - Parser_TokenizeLine(); - return Parser_GetToken(); - } else { - Parser_Token = String_Set( Parser_Token, argv( Parser_TokenNum ) ); - Parser_TokenNum++; - } - - Parser_Print( PARSER_LOW, strcat( "Read token '", Parser_Token, "'" ) ); - - Parser_TokenType = Parser_GetTokenType(); - if( Parser_TokenType == PARSER_TT_BRACKETOPEN ) { - Parser_ProcessDefine(); - return Parser_GetToken(); - } - - return true; -}; - -float() Parser_GetTokenType = -{ - if( Parser_Token == "Item" ) - return PARSER_TT_ITEM; - else if( Parser_Token == "Template" ) - return PARSER_TT_TEMPLATE; - else if( Parser_Token == "Derive" ) - return PARSER_TT_DERIVE; - else if( Parser_Token == "DeriveTemplate" ) - return PARSER_TT_DERIVETEMPLATE; - else if( Parser_Token == "#define" ) - return PARSER_TT_DEFINE; - else if( Parser_Token == "Ignore" ) - return PARSER_TT_IGNORE; - else if( Parser_Token == "#undef" ) - return PARSER_TT_UNDEF; - else if( Parser_Token == "Namespace" ) - return PARSER_TT_NAMESPACE; - else if( Parser_Token == "#include" ) - return PARSER_TT_INCLUDE; - else if( Parser_Token == "}" ) - return PARSER_TT_BRACECLOSE; - else if( Parser_Token == "{" ) - return PARSER_TT_BRACEOPEN; - else if( Parser_Token == "[" ) - return PARSER_TT_BRACKETOPEN; - else if( Parser_Token == "]" ) - return PARSER_TT_BRACKETCLOSE; - - return PARSER_TT_TOKEN; -}; - -void( float pLevel, string pText ) _Parser_Print = -{ - if( pLevel == 0 || sys_debug_parser & pLevel ) - print( "Parser: ", pText, "\n" ); -}; - -void( float pLevel, string pInfo ) Parser_Print = -{ - if( pLevel == 0 || sys_debug_parser & pLevel ) - print( "Parser: ", Parser_Filename, ":", ftos( Parser_LineNumber ), ": ", pInfo, "\n" ); -}; - -void( string pInfo ) Parser_Error = -{ - print( "Parser: ", Parser_Filename, ":", ftos( Parser_LineNumber ), ": Error: '"); - print( Parser_Token, "' not expected (", pInfo, ")!\n" ); - fclose( Parser_File ); - error( "Error in the menu parser!" ); -}; - -void( float pType ) Parser_Expect = -{ - if( !Parser_GetToken() || ( Parser_TokenType != pType && Parser_TokenType != PARSER_TT_BRACKETOPEN ) ) - Parser_Error( strcat( "expected ", PARSER_TT_TEXT[ pType - PARSER_TT_ITEM ] ) ); -}; - -void( string pNamespace ) Parser_IncludeFile = -{ - local string lFilename, lLine; - local float lFile, lLineNumber, lNumTokens, lTokenNum; - - // #include file - Parser_Expect( PARSER_TT_TOKEN ); - - Parser_Print( PARSER_INFO, strcat( "#include: Including file '", Parser_Token, "'" ) ); - - Parser_FileList = String_Append( Parser_FileList, strcat( " {'", String_Normal( Util_AltStringPrepare( Parser_Token ) ), "'" ) ); - - lFilename = Parser_Filename; - lLine = Parser_Line; - - lFile = Parser_File; - lLineNumber = Parser_LineNumber; - lNumTokens = Parser_NumTokens; - lTokenNum = Parser_TokenNum; - - --Parser_IncludeDepth; - if( Parser_IncludeDepth > Parser_MaxIncludeDepth ) - Parser_Print( PARSER_NORMAL, "#include: Maximum depth reached!" ); - else - Parser_ParseFile( Parser_Token, pNamespace ); - --Parser_IncludeDepth; - - Parser_Filename = lFilename; - Parser_Line = lLine; - - Parser_File = lFile; - Parser_LineNumber = lLineNumber; - - // tokenize the line again, but jump to the old position - Parser_TokenizeLine(); - Parser_NumTokens = lNumTokens; - Parser_TokenNum = lTokenNum; - - Parser_FileList = String_Append( Parser_FileList, "}" ); -}; - -void() Parser_ParseDefine = -{ - local entity lDefine; - local float lOldLine; - - Parser_Print( 2, "Parsing #define..." ); - - // #define NAME CONSTANT - //Parser_Expect( PARSER_TT_BRACKETOPEN ); - Parser_Expect( PARSER_TT_TOKEN ); - - // check for double definitions (dont error just print a warning) - for( lDefine = Parser_DefineChain ; lDefine ; lDefine = lDefine.chain ) - if( Parser_Token == lDefine.name ) { - Parser_Print( PARSER_INFO, strcat( "#define: [", Parser_Token, "] already defined!" ) ); - Parser_Expect( PARSER_TT_TOKEN ); - return; - } - - lDefine = spawn(); - lDefine.type = "Parser_Define"; - lDefine.name = String_Zone( Parser_Token ); - - //Parser_Expect( PARSER_TT_BRACKETCLOSE ); - // read the rest of the line - String_EntityZone( lDefine, value ); - lOldLine = Parser_LineNumber; - while( 1 ) - if( !Parser_GetToken() ) - break; - else if( lOldLine != Parser_LineNumber ) { - --Parser_TokenNum; - break; - } else if( Parser_Token == "\\" ) - ++lOldLine; - else - String_EntitySet( lDefine, value, strcat( lDefine.value, "\"", Parser_Token, "\" " ) ); - - Parser_Print( PARSER_HIGH, strcat( " Name = '", lDefine.name, "' Replacement = '", lDefine.value, "'" ) ); - - lDefine.chain = Parser_DefineChain; - Parser_DefineChain = lDefine; - - Parser_Print( PARSER_HIGH, "Done parsing #define" ); -}; - -void() Parser_ParseUndef = -{ - local entity lEntity, lPrevious; - - // #undef Name - Parser_Print( PARSER_HIGH, "Parsing #undef..." ); - Parser_Expect( PARSER_TT_TOKEN ); - - lPrevious = null_entity; - for( lEntity = Parser_DefineChain ; lEntity ; lPrevious = lEntity, lEntity = lEntity.chain ) - if( lEntity.name == Parser_Token ) { - if( lPrevious ) - lPrevious.chain = lEntity.chain; - else - Parser_DefineChain = lEntity.chain; - - Parser_Print( PARSER_INFO, strcat( "#undef: Removed [", Parser_Token, "]" ) ); - - String_Free( lEntity.name ); - String_Free( lEntity.value ); - - remove( lEntity ); - - return; - } - - Parser_Print( PARSER_INFO, strcat( "#undef: [", Parser_Token, "] not found!" ) ); -}; - -void() Parser_ProcessDefine = -{ - local string lConstant; - local entity lDefine; - - // [Name] - Parser_Expect( PARSER_TT_TOKEN ); - lConstant = String_Zone( Parser_Token ); - - Parser_Expect( PARSER_TT_BRACKETCLOSE ); - - Parser_Print( PARSER_HIGH, strcat( "Processing [", lConstant, "]..." ) ); - - for( lDefine = Parser_DefineChain ; lDefine ; lDefine = lDefine.chain ) - if( lDefine.name == lConstant ) { - // if you want to have a single token use \" or ' - Parser_Line = String_Set( Parser_Line, strcat( " ", lDefine.value ) ); - Parser_Print( PARSER_HIGH, strcat( "Replacing with '", Parser_Line, "'" ) ); - for( ; Parser_TokenNum < Parser_NumTokens ; Parser_TokenNum++ ) - Parser_Line = String_Set( Parser_Line, strcat( Parser_Line, " \"", argv( Parser_TokenNum ), "\"" ) ); - Parser_TokenizeLine(); - String_Free( lConstant ); - return; - } - - Parser_Token = String_Set( Parser_Token, String_Normal( lConstant ) ); - Parser_Print( PARSER_NORMAL, strcat( "#define: Couldn't find constant '", Parser_Token, "'!" ) ); - Parser_Error( "constant not found" ); -}; - -// Item [Template] -// Template -void( string pNamespace ) Parser_ParseDefinition = -{ - local entity lEntity; - - if( Parser_TokenType == PARSER_TT_ITEM ) - Parser_ParseItem( pNamespace ); - else if( Parser_TokenType == PARSER_TT_TEMPLATE ) { - lEntity = Parser_ParseItem( pNamespace ); - lEntity.flag = lEntity.flag | FLAG_TEMPLATE; - } else if( Parser_TokenType == PARSER_TT_DEFINE ) - Parser_ParseDefine(); - else if( Parser_TokenType == PARSER_TT_DERIVE ) - Parser_DeriveItem( pNamespace ); - else if( Parser_TokenType == PARSER_TT_DERIVETEMPLATE ) { - lEntity = Parser_DeriveItem( pNamespace ); - lEntity.flag = lEntity.flag | FLAG_TEMPLATE; - } else if( Parser_TokenType == PARSER_TT_UNDEF ) - Parser_ParseUndef(); - else if( Parser_TokenType == PARSER_TT_NAMESPACE ) - Parser_ParseNamespace( pNamespace ); - else if( Parser_TokenType == PARSER_TT_INCLUDE ) - Parser_IncludeFile( pNamespace ); - else if( Parser_TokenType == PARSER_TT_IGNORE ) - Parser_ParseIgnore(); - else - Parser_Error( "couldn't find type in Parser_ParseDef" ); -}; - -void() Parser_ParseIgnore = -{ - local float lBraceCount; - - Parser_Expect( PARSER_TT_BRACEOPEN ); - for( lBraceCount = 1 ; lBraceCount > 0 ; ) - if( !Parser_GetToken() ) - break; - else if( Parser_TokenType == PARSER_TT_BRACEOPEN ) - ++lBraceCount; - else if( Parser_TokenType == PARSER_TT_BRACECLOSE ) - --lBraceCount; -}; - -entity( string pNamespace ) Parser_ParseItem = -{ - local string lNamespace; - local string lEntityText; - local entity lEntity; - - Parser_Print( PARSER_HIGH, "Parsing item.." ); - - // get the item type - Parser_Expect( PARSER_TT_TOKEN ); - lEntityText = String_Zone( strcat( "{ \"type\" \"Item_", Parser_Token,"\" " ) ); - - Parser_Print( PARSER_HIGH, strcat( " Type = '", Parser_Token, "'" ) ); - - // get the item name - Parser_Expect( PARSER_TT_TOKEN ); - if( pNamespace != "" ) - lNamespace = String_Zone( strcat( pNamespace, "::", Parser_Token ) ); - else - lNamespace = String_Zone( Parser_Token ); - - lEntityText = String_Set( lEntityText, strcat( lEntityText, "\"name\" \"", lNamespace, "\" " ) ); - lEntityText = String_Set( lEntityText, strcat( lEntityText, "\"parent\" \"", pNamespace, "\" " ) ); - - Parser_Print( PARSER_HIGH, strcat( " Name = '", Parser_Token, "' Parent = '", pNamespace, - "' Namespace = '", lNamespace, "'" ) ); - - Parser_Expect( PARSER_TT_BRACEOPEN ); - lEntityText = Parser_ParseEntity( lNamespace, lEntityText ); - - // parse the entity (builtin) - lEntity = spawn(); - parseentitydata( lEntity, lEntityText ); - - String_Free( lEntityText ); - String_Free( lNamespace ); - - Parser_Print( PARSER_HIGH, strcat( "Parsing '", lEntity.name, "' finished" ) ); - - return lEntity; -}; - -void( entity pSource, entity pTarget ) Parser_CloneChildren = -{ - // we search for all items that are direct children of pSource and copy them - // and adapt their parent and names - local entity lNode; - - lNode = null_entity; - while ( (lNode = findstring( lNode, parent, pSource.name )) != null_entity ) { - local entity lClone; - local string lModifierString; - - lClone = spawn(); - copyentity( lNode, lClone ); - - if( lClone.flag & FLAG_TEMPLATE ) - lClone.flag = lClone.flag - FLAG_TEMPLATE; - - lModifierString = strcat( "{ name \"", pTarget.name, - substring( lNode.name, strlen( pSource.name ), 100000 ), "\" parent \"", pTarget.name, "\" }" ); - - parseentitydata( lClone, lModifierString ); - - Parser_CloneChildren( lNode, lClone ); - } -}; - -entity( string pNamespace ) Parser_DeriveItem = -{ - local string lNamespace; - local string lEntityText; - local entity lBase; - local string lBaseName; - local entity lEntity; - - Parser_Print( PARSER_HIGH, "Parsing derived item.." ); - - // get the base item - Parser_Expect( PARSER_TT_TOKEN ); - - if( substring( Parser_Token, 0, 2 ) == "::" ) - lBaseName = String_Zone( substring( Parser_Token, 2, strlen( Parser_Token ) - 2 ) ); - else if( pNamespace == "" ) - lBaseName = String_Zone( Parser_Token ); - else { - lBaseName = String_Zone( strcat( pNamespace, "::", Parser_Token ) ); - - // try the local namespace first, then try to find it in the global - if( findstring( null_entity, name, lBaseName ) == null_entity ) - lBaseName = String_Set( lBaseName, Parser_Token ); - } - - Parser_Print( PARSER_HIGH, strcat( " Base = '", lBaseName, "'" ) ); - - lBase = findstring( null_entity, name, lBaseName ); - if( lBase == null_entity ) - Parser_Error( "couldnt find item" ); - - // get the item name - Parser_Expect( PARSER_TT_TOKEN ); - if( pNamespace != "" ) - lNamespace = String_Zone( strcat( pNamespace, "::", Parser_Token ) ); - else - lNamespace = String_Zone( Parser_Token ); - - lEntityText = String_Zone( strcat( "{ \"name\" \"", lNamespace, "\" " ) ); - lEntityText = String_Set( lEntityText, strcat( lEntityText, "\"parent\" \"", pNamespace, "\" " ) ); - - Parser_Print( PARSER_HIGH, strcat( " Name = '", Parser_Token, "' Parent = '", pNamespace, - "' Namespace = '", lNamespace, "'" ) ); - - Parser_Expect( PARSER_TT_BRACEOPEN ); - lEntityText = Parser_ParseEntity( lNamespace, lEntityText ); - - // parse the entity (builtin) - lEntity = spawn(); - copyentity( lBase, lEntity ); - if( lEntity.flag & FLAG_TEMPLATE ) - lEntity.flag = lEntity.flag - FLAG_TEMPLATE; - parseentitydata( lEntity, lEntityText ); - - String_Free( lEntityText ); - String_Free( lNamespace ); - String_Free( lBaseName ); - - // now copy over all children - Parser_CloneChildren( lBase, lEntity ); - - Parser_Print( PARSER_HIGH, strcat( "Parsing '", lEntity.name, "' finished" ) ); - - return lEntity; -}; - -string( string pNamespace, string pEntityText ) Parser_ParseEntity = -{ - while( Parser_GetToken() ) { - if( Parser_TokenType == PARSER_TT_TOKEN ) { - // must be a property... - // store the key value - pEntityText = String_Set( pEntityText, strcat( pEntityText, "\"", Parser_Token, "\" " ) ); - Parser_Expect( PARSER_TT_TOKEN ); - pEntityText = String_Set( pEntityText, strcat( pEntityText, "\"", Parser_Token, "\" " ) ); - } else if( Parser_TokenType == PARSER_TT_BRACECLOSE ) - break; - else - Parser_ParseDefinition( pNamespace ); - } - - return String_Append( pEntityText, " }" ); -}; - -void( string pNamespace ) Parser_ParseNamespace = -{ - local string lNamespace; - - Parser_Print( PARSER_HIGH, "Parsing Namespace..." ); - // namespace Name { - Parser_Expect( PARSER_TT_TOKEN ); - if( pNamespace != "" ) - lNamespace = String_Zone( strcat( pNamespace, "::", Parser_Token ) ); - else - lNamespace = String_Zone( Parser_Token ); - Parser_Print( PARSER_HIGH, strcat( " Subnamespace = '", Parser_Token, "' New namespace = '", lNamespace, "'" ) ); - - Parser_Expect( PARSER_TT_BRACEOPEN ); - - while( Parser_GetToken() ) { - if( Parser_TokenType == PARSER_TT_BRACECLOSE ) - break; - - Parser_ParseDefinition( lNamespace ); - } - - Parser_Print( PARSER_HIGH, strcat( "Finished parsing Namespace. Namespace = '", pNamespace, "'" ) ); - - String_Free( lNamespace ); -}; - -void( string pFilename, string pNamespace ) Parser_ParseFile = -{ - Parser_Filename = String_Zone( pFilename ); - Parser_File = fopen( Parser_Filename, FILE_READ ); - if( Parser_File == -1 ) { - print( "Parser: Couldn't open ", Parser_Filename, "\n" ); - return; - } - - Parser_Line = String_Create(); - Parser_LineNumber = 0; - Parser_NumTokens = Parser_TokenNum = 0; - - while( Parser_GetToken() ) - Parser_ParseDefinition( pNamespace ); - - fclose( Parser_File ); - String_Free( Parser_Filename ); - String_Free( Parser_Line ); -}; - -void() Parser_Init = -{ - Parser_Token = String_Create(); - Parser_DefineChain = null_entity; - Parser_IncludeDepth = 0; - - Parser_FileList = String_Create(); -}; - -void() Parser_Quit = -{ - local entity lNext; - - _Parser_Print( PARSER_HIGH, "Deleting #defines:" ); - while( Parser_DefineChain ) { - lNext = Parser_DefineChain.chain; - _Parser_Print( PARSER_HIGH, strcat( " [", Parser_DefineChain.name, "]" ) ); - - String_Free( Parser_DefineChain.name ); - String_Free( Parser_DefineChain.value ); - - remove( Parser_DefineChain ); - Parser_DefineChain = lNext; - } - - - String_Free( Parser_Token ); - String_Free( Parser_FileList ); -}; - -void( string pPluginDir ) Parser_ParsePlugins = -{ - local float lSearchHandle; - local float lCounter, lCount; - - lSearchHandle = search_begin( strcat( pPluginDir, "/*.plugin" ), true, true ); - if( lSearchHandle < 0 ) { - return; - } - - lCount = search_getsize( lSearchHandle ); - - for( lCounter = 0 ; lCounter < lCount ; lCounter++ ) { - local string pPlugin; - - Parser_FileList = String_Set( Parser_FileList, "" ); - - pPlugin = String_Zone( search_getfilename( lSearchHandle, lCounter ) ); - Parser_FileList = Util_AltStringPush( Parser_FileList, pPlugin ); - - Parser_ParseFile( pPlugin, "" ); - - _Parser_Print( PARSER_INFO, strcat( "Plugin '", pPlugin, "': files parsed: ", Parser_FileList ) ); - String_Free( pPlugin ); - } - - search_end( lSearchHandle ); -}; - -void( string pMain, string pPluginDir ) Parser_ParseMenu = -{ - Parser_Init(); - - pMain = String_Zone( pMain ); - Parser_FileList = Util_AltStringPush( Parser_FileList, pMain ); - - Parser_ParseFile( pMain, "" ); - - _Parser_Print( PARSER_INFO, strcat( "Files parsed: ", Parser_FileList ) ); - String_Free( pMain ); - - // plugins - if( pPluginDir != "" ) { - Parser_ParsePlugins( pPluginDir ); - } - - Parser_Quit(); -}; diff --git a/scmenu/source/system/parser.qh b/scmenu/source/system/parser.qh deleted file mode 100644 index 88a4ceb35..000000000 --- a/scmenu/source/system/parser.qh +++ /dev/null @@ -1,82 +0,0 @@ -// DP/Nex Menu -// system/parser.qh - -enum { - PARSER_TT_ITEM, - PARSER_TT_TEMPLATE, - PARSER_TT_DERIVE, - PARSER_TT_DERIVETEMPLATE, - PARSER_TT_DEFINE, - PARSER_TT_UNDEF, - PARSER_TT_IGNORE, - PARSER_TT_NAMESPACE, - PARSER_TT_INCLUDE, - PARSER_TT_BRACEOPEN, - PARSER_TT_BRACECLOSE, - PARSER_TT_BRACKETOPEN, - PARSER_TT_BRACKETCLOSE, - PARSER_TT_TOKEN, - PARSER_TT_SIZE -}; - -// FIXME: FTEQCC: const string PARSER_TT_TEXT[PARSER_TT_SIZE] = { -const string PARSER_TT_TEXT[14] = { - "Item", "Template", "Derive", "DeriveTemplate", "Define", "#undef", "Ignore", "Namespace", - "#include", "{", "}", "[", "]", "Token" -}; - -const float PARSER_NORMAL = 0; -enumflags { - PARSER_INFO, - PARSER_HIGH, - PARSER_LOW -}; - -const float Parser_MaxIncludeDepth = 32; - -string Parser_FileList; -float Parser_IncludeDepth; - -entity Parser_DefineChain; - -string Parser_Filename; -float Parser_LineNumber; - -float Parser_File; -string Parser_Line; - -float Parser_NumTokens; -float Parser_TokenNum; -string Parser_Token; -float Parser_TokenType; - -bool() Parser_GetToken; -float() Parser_GetTokenType; - -void() Parser_ParseDefine; -void() Parser_ProcessDefine; -void() Parser_ParseUndef; - -void( float pType ) Parser_Expect; - -void( string pInfo ) Parser_Error; -void( float pLevel, string pInfo ) Parser_Print; - -entity( string pNamespace ) Parser_ParseItem; -entity( string pNamespace ) Parser_DeriveItem; -string( string pNamespace, string pEntityText ) Parser_ParseEntity; -void( string pNamespace ) Parser_ParseDefinition; -void( string pNamespace ) Parser_ParseNamespace; -void() Parser_ParseIgnore; - -void( entity pSource, entity pTarget ) Parser_CloneChildren; - -void( string pNamespace ) Parser_IncludeFile; - -void( string pFilename, string pNamespace ) Parser_ParseFile; - -void( string pPluginDir ) Parser_ParsePlugins; -void( string pMain, string pPluginDir ) Parser_ParseMenu; - -void() Parser_Init; -void() Parser_Quit; diff --git a/scmenu/source/system/structure.qc b/scmenu/source/system/structure.qc deleted file mode 100644 index 149bc1268..000000000 --- a/scmenu/source/system/structure.qc +++ /dev/null @@ -1,599 +0,0 @@ -// DP/Nex Menu -// system/structure.qc - -// TODO: finish the debug output -void( float pLevel, string pText ) _Menu_Structure_Debug = -{ - if( pLevel <= sys_debug_structure ) - print( pText ); -}; - -void( bool pUser ) _Menu_Select = -{ - Raise_Select( Menu_ActiveItem, true, pUser ); -}; - -entity( entity pItem ) _Menu_GetParent = -{ - if( !pItem._parent ) - return null_entity; - if( Menu_IsEmbedded( pItem._parent ) ) - return _Menu_GetParent( pItem._parent ); - return pItem._parent; -}; - -bool( entity pItem, entity pParent ) _Menu_IsEmbeddedParentOf = -{ - if( pItem._parent == pParent ) - return true; - if( Menu_IsEmbedded( pItem._parent ) ) - return _Menu_IsEmbeddedParentOf( pItem._parent, pParent ); - return false; -}; - -entity( entity pItem ) _Menu_GetFirst = -{ - if( Menu_IsEmbedded( pItem ) && pItem._child ) - return _Menu_GetFirst( pItem._child ); - return pItem; -}; - -entity( entity pItem ) _Menu_GetLast = -{ - if( Menu_IsEmbedded( pItem ) && pItem._child ) { - local entity lNode; - - for( lNode = pItem._child ; lNode._next ; lNode = lNode._next ); - return _Menu_GetLast( lNode ); - } - return pItem; -}; - -entity( entity pItem ) _Menu_GetNext = -{ - local entity lNext; - - lNext = pItem._next; - if( lNext ) - return _Menu_GetFirst( lNext ); - if( Menu_IsEmbedded( pItem._parent ) && pItem._parent != Menu_ActiveWindow ) - return _Menu_GetNext( pItem._parent ); - else - return null_entity; -}; - -entity( entity pItem ) _Menu_GetPrev = -{ - local entity lPrev; - - lPrev = pItem._prev; - if( lPrev ) - return _Menu_GetLast( lPrev ); - if( Menu_IsEmbedded( pItem._parent ) && pItem._parent != Menu_ActiveWindow ) - return _Menu_GetPrev( pItem._parent ); - else - return null_entity; -}; - -void() _Menu_SelectNext = -{ - local entity lTemp; - - if( !Menu_ActiveItem ) { - _Menu_Structure_Debug( 1, "_SelectNext: Bad Menu_ActiveItem!\n" ); - return; - } - - // try to select the next item - lTemp = Menu_ActiveItem; - while( (lTemp = _Menu_GetNext( lTemp )) != null_entity ) - if( Menu_IsSelectable( lTemp ) ) { - Menu_ActiveItem = lTemp; - _Menu_Structure_Debug( 1, strcat( "_SelectNext: ", lTemp.name, "\n" ) ); - return; - } - // loop - // only because of embedded: - for( lTemp = Menu_ActiveItem ; _Menu_GetPrev( lTemp ) ; lTemp = _Menu_GetPrev( lTemp ) ); -// TODO: rewrite _Menu_Select* to use an additional temp variable for storing the result of the functionc all - for( ; lTemp != Menu_ActiveItem ; lTemp = _Menu_GetNext( lTemp ) ) - if( Menu_IsSelectable( lTemp ) ) { - Menu_ActiveItem = lTemp; - _Menu_Structure_Debug( 1, strcat( "_SelectNext after loop: ", lTemp.name, "\n" ) ); - return; - } -}; - -void() _Menu_SelectPrev = -{ - local entity lTemp; - - if( !Menu_ActiveItem ) { - _Menu_Structure_Debug( 1, "_SelectPrev: Bad Menu_ActiveItem!\n" ); - return; - } - - // try to select the previous item - lTemp = Menu_ActiveItem; - while( (lTemp = _Menu_GetPrev( lTemp )) != null_entity ) - if( Menu_IsSelectable( lTemp ) ) { - Menu_ActiveItem = lTemp; - _Menu_Structure_Debug( 1, strcat( "_SelectPrev: ", lTemp.name, "\n" ) ); - return; - } - // loop - for( lTemp = Menu_ActiveItem ; _Menu_GetNext( lTemp ) ; lTemp = _Menu_GetNext( lTemp ) ); - for( ; lTemp != Menu_ActiveItem ; lTemp = _Menu_GetPrev( lTemp ) ) { - if( Menu_IsSelectable( lTemp ) ) { - Menu_ActiveItem = lTemp; - _Menu_Structure_Debug( 1, strcat( "_SelectPrev after loop: ", lTemp.name, "\n" ) ); - return; - } - } -}; - -bool() _Menu_SelectUp = -{ - // Menu_ActiveItem is the child - local entity lSelected, lParent, lNode; - - lSelected = Menu_ActiveItem; - if( !lSelected ) { - _Menu_Structure_Debug( 1, "_SelectUp: Bad Menu_ActiveItem!\n" ); - return false; - } - - // If we try to select up the active window, we'll pop the menu history - if( lSelected == Menu_ActiveWindow ) { - // If there is no history, we quit the menu - _Menu_Structure_Debug( 2, "_SelectUp: Selecting up current active window..\n" ); - if( Menu_History == null_entity ) { - _Menu_Structure_Debug( 2, "_SelectUp: Empty history -> toggling menu..\n" ); - if( !Menu_Toggle() ) - Menu_Reselect( false ); - return true; - } - - _Menu_Structure_Debug( 2, "_SelectUp: Popping history..\n" ); - Menu_History_Pop(); - } - - lParent = _Menu_GetParent( lSelected ); - if( !lParent ) { - _Menu_Structure_Debug( 2, "_SelectUp: No parent and not active window!\n" ); - return false; - } - - // If this window is selectable, we know that there is at least one selectable item in the parent, - // thus we will select the parent - if( Menu_IsSelectable( lParent ) ) { - Menu_ActiveItem = lParent; - _Menu_Structure_Debug( 1, strcat( "_SelectUp: first parent: ", lParent.name, "\n" ) ); - return true; - } - - // if there is no parent window of this window (lParent), it's the active window - // else we have failed - if( lParent == Menu_ActiveWindow ) { - Menu_ActiveItem = Menu_ActiveWindow; - _Menu_Structure_Debug( 2, strcat( "_SelectUp: select up parent: ", Menu_ActiveItem.name, "\n" ) ); - if( _Menu_SelectUp() ) - return true; - Menu_ActiveItem = lSelected; - return false; - } else if( !lParent._parent ) { - _Menu_Structure_Debug( 1, "_SelectUp: No parent of parent and not active window!\n" ); - return false; - } - - // If not, we try to determine whether the window is the first window with a selectable children in - // the parent window. If lParent is the selected by selectdown, we move up, if not we have found it. - // IDEA: inline this - Menu_ActiveItem = _Menu_GetParent( lParent ); - _Menu_Structure_Debug( 2, strcat( "_SelectUp: SelectDown on parent of parent '", Menu_ActiveItem.name, "' \n" ) ); - _Menu_SelectDown(); - // thanks to embedded windows (and not only them) - added later on - perhaps doesnt really - // fit into the old logic behind it - take this with caution - for( lNode = Menu_ActiveItem ; lNode ; lNode = lNode._parent ) - if( lNode._parent == lParent ) { - Menu_ActiveItem = _Menu_GetParent( lSelected ); //lParent._parent; - if( _Menu_SelectUp() ) - return true; - Menu_ActiveItem = lSelected; - return false; - } - - // else we have already found the window we have searched! - return true; -}; - -void( entity pItem ) _Menu_PrintRunFlag; -bool() _Menu_SelectDown = -{ - // Menu_ActiveItem is the window - local entity lParent, lChild; - - lParent = Menu_ActiveItem; - if( !lParent ) { - _Menu_Structure_Debug( 1, "_SelectDown: Bad Menu_ActiveItem!\n" ); - return false; - } - - // lets find the first selectable item - for( lChild = _Menu_GetFirst( lParent._child ) ; lChild ; lChild = _Menu_GetNext( lChild ) ) - if( Menu_IsSelectable( lChild ) ) { - Menu_ActiveItem = lChild; - _Menu_PrintRunFlag( lChild ); - _Menu_Structure_Debug( 1, strcat( "_SelectDown: ", lChild.name, "\n" ) ); - return true; - } - - // lets find the first window that has a selectable item - for( lChild = _Menu_GetFirst( lParent._child ) ; lChild ; lChild = _Menu_GetNext( lChild ) ) - if( !Menu_IsEmbedded( lChild ) ) { - Menu_ActiveItem = lChild; - _Menu_Structure_Debug( 2, strcat( "_SelectDown: Try child: ", Menu_ActiveItem.name, "\n" ) ); - if( _Menu_SelectDown() ) - return true; - } - - Menu_ActiveItem = lParent; - return false; -}; - -void() _Menu_Reselect = -{ - Menu_ActiveItem = Menu_ActiveWindow; - _Menu_SelectDown(); -}; - -void( bool pUser ) Menu_SelectNext = -{ - Raise_Select( Menu_ActiveItem, false, pUser ); - _Menu_SelectNext(); - Raise_Select( Menu_ActiveItem, true, pUser ); -}; - -void( bool pUser ) Menu_SelectPrev = -{ - Raise_Select( Menu_ActiveItem, false, pUser ); - _Menu_SelectPrev(); - Raise_Select( Menu_ActiveItem, true, pUser ); -}; - -bool( bool pUser ) Menu_SelectUp = -{ - local entity lOld; - - lOld = Menu_ActiveItem; - if( _Menu_SelectUp() ) { - Raise_Select( lOld, false, pUser ); - Raise_Select( Menu_ActiveItem, true, pUser ); - return true; - } - return false; -}; - -bool( bool pUser ) Menu_SelectDown = -{ - local entity lOld; - - lOld = Menu_ActiveItem; - if( _Menu_SelectDown() ) { - Raise_Select( lOld, false, pUser ); - Raise_Select( Menu_ActiveItem, true, pUser ); - return true; - } - return false; -}; - -void( entity pItem, bool pUser ) Menu_Select = -{ - Raise_Select( Menu_ActiveItem, false, pUser ); - _Menu_Structure_Debug( 1, strcat( "Menu_Select: ", pItem.name, "\n" ) ); - Menu_ActiveItem = pItem; - Raise_Select( Menu_ActiveItem, true, pUser ); -}; - -void( entity pItem, bool pUser ) Menu_CorrectSelection = -{ - if( Menu_ActiveItem != pItem ) - Menu_Select( pItem, pUser ); -}; - -void( bool pUser ) Menu_Reselect = -{ - Raise_Select( Menu_ActiveItem, false, pUser ); - _Menu_Reselect(); - Raise_Select( Menu_ActiveItem, true, pUser ); -}; - -void( entity pMenu, bool pMakeActive, bool pUser ) Menu_JumpToWindow = -{ - Raise_Select( Menu_ActiveItem, false, pUser ); - - // only jump to windows - if( !pMenu._child ) - error("Cant jump to ", pMenu.name, " !\n"); - - // add a history point - if( pMakeActive ) { - Menu_History_Push( pMenu, Util_NullFunction ); - Menu_ActiveWindow = pMenu; - } - - // now set the selected to the first selectable child - Menu_ActiveItem = pMenu; - if( !_Menu_SelectDown() ) - error( "Couldn't jump to ", pMenu.name, " !\n" ); - - Raise_Select( Menu_ActiveItem, true, pUser ); -}; - -#ifdef USEFUNCTIONS -bool( entity pEntity, float pFlag ) Menu_HasFlag = -{ - if( pEntity.flag & pFlag ) - return true; - return false; -}; - -bool( entity pEntity, float pRunFlag ) Menu_HasRunFlag = -{ - if( pEntity._runFlag & pRunFlag ) - return true; - return false; -}; -#endif - -entity( entity pOrigin, string pName, bool pThrow ) Menu_GetItemEx = -{ - local entity lItem; - local string lFirstTwo; - - lFirstTwo = substring( pName, 0, 2 ); - - // FIXME: perhaps add another function or do this in some other way - if( lFirstTwo == "::" ) - lItem = findstring( null_entity, name, substring( pName, 2, 100000 ) ); - // support for direction tokens, init token ## - else if( lFirstTwo == "##" ) { - local string lToken; - local float lCount, lCounter; - lItem = pOrigin; - lCount = tokenize( substring( pName, 2, 100000 ) ); - // we have the following tokens atfer the ##: up down next prev - for( lCounter = 0 ; lCounter < lCount && lItem ; ++lCounter ) { - lToken = argv( lCounter ); - if( lToken == "up" ) - lItem = lItem._parent; - else if( lToken == "down" ) - lItem = lItem._child; - else if( lToken == "next" ) - lItem = lItem._next; - else if( lToken == "prev" ) - lItem = lItem._prev; - else - error( "Bad direction link(bad token): '", pName, "'!" ); - } - } else { - // we start from the current namespace and try to find the object - // by checking for it in all parent namespaces - lItem = null_entity; - while( !lItem && (pOrigin = pOrigin._parent) != null_entity ) - lItem = findstring( null_entity, name, strcat( pOrigin.name, "::", pName ) ); - - if( !lItem ) - lItem = findstring( null_entity, name, pName ); - } - - if( lItem == null_entity && pThrow ) - error( "Couldn't find item '", pName, "'!" ); - - return lItem; -}; - -entity( entity pOrigin, string pName, bool pThrow ) Menu_GetChildEx = -{ - local entity lItem; - - if( pOrigin ) - lItem = findstring( null_entity, name, strcat( pOrigin.name, "::", pName ) ); - else - lItem = findstring( null_entity, name, pName ); - - if( lItem == null_entity && pThrow ) - error( "Couldn't find item '", pName, "'!" ); - - return lItem; -}; - -entity( string pName ) Menu_GetItem = -{ - return Menu_GetItemEx( self, pName, true ); -}; - -entity( string pName ) Menu_GetChild = -{ - return Menu_GetChildEx( self, pName, true ); -}; - -void( entity pWindow ) Menu_EmptyWindow = -{ - local entity lChild; - - for( lChild = pWindow._child ; lChild ; lChild = lChild._next ) { - Menu_EmptyWindow( lChild ); - Raise_Destroy( lChild ); - remove( lChild ); - } - - pWindow._child = null_entity; -}; - -void( entity pEntity ) Menu_RemoveItem = -{ - local entity lParent; - // raise the destroy event - lParent = pEntity._parent; - Menu_EmptyWindow( pEntity ); - Raise_Destroy( pEntity ); - remove( pEntity ); - if( lParent ) - Menu_LinkChildren( lParent ); -}; - -void( entity pItem ) _Menu_PrintRunFlag = -{ - if( sys_debug_runflag ) { - print( " ", pItem.name, " Runflags: " ); - if( pItem._runFlag & RUNFLAG_TEMPLATE ) - print( "TEMPLATE " ); - if( pItem._runFlag & RUNFLAG_MOUSEINAREA ) - print( "MOUSEINAREA " ); - if( pItem._runFlag & RUNFLAG_HADMOUSE ) - print( "HADMOUSE " ); - if( pItem._runFlag & RUNFLAG_CHILDDRAWONLY ) - print( "CHILDDRAWONLY " ); - if( pItem._runFlag & RUNFLAG_CHILDDRAWUPDATEONLY ) - print( "CHILDDRAWUPDATEONLY " ); - if( pItem._runFlag & RUNFLAG_HIDDEN ) - print( "HIDDEN " ); - if( pItem._runFlag & RUNFLAG_CLIPPED ) - print( "CLIPPED " ); - if( pItem._runFlag & RUNFLAG_NOSELECT ) - print( "NOSELECT " ); - print( "\n" ); - } -}; - -void( entity pItem ) Menu_SetRunFlag = -{ - local float lFlag; - local float lRunFlag; - - lFlag = pItem.flag; - - // RUNFLAG_TEMPLATE - if( lFlag & FLAG_TEMPLATE ) - pItem._runFlag = pItem._runFlag | RUNFLAG_TEMPLATE; - // RUNFLAG_HADMOUSE, - lRunFlag = pItem._runFlag; - if(lRunFlag & RUNFLAG_MOUSEINAREA ) - pItem._runFlag = (lRunFlag - RUNFLAG_MOUSEINAREA) | RUNFLAG_HADMOUSE; - // RUNFLAG_MOUSEINAREA, - // these will be handled in MENU_PROCESS_MOUSE - // RUNFLAG_CHILDDRAWONLY, - // RUNFLAG_CHILDDRAWONLY, - // these two are handled in InheritRunFlag - // RUNFLAG_CLIPPED, - // check if it is within the clipping area (ie. really visible) - // trick: since the position and size are clipped against the previous clipping area - // Menu_Clip_Size will be '0 0 0', if the areas dont overlap - if( Menu_Clip_Size == '0 0 0' && Menu_Clip_Position != '0 0 0' ) - pItem._runFlag = pItem._runFlag | RUNFLAG_CLIPPED; - // RUNFLAG_HIDDEN - lRunFlag = pItem._runFlag; - if( ( lFlag & FLAG_HIDDEN ) || - ( lRunFlag & RUNFLAG_TEMPLATE ) || - ( ( lFlag & FLAG_SERVERONLY ) && !( gamestatus & GAME_ISSERVER ) ) || - ( ( lFlag & FLAG_CONNECTEDONLY ) && !( gamestatus & GAME_CONNECTED ) ) || - ( ( lFlag & FLAG_DEVELOPERONLY ) && !( gamestatus & GAME_DEVELOPER ) ) ) - pItem._runFlag = lRunFlag | RUNFLAG_HIDDEN; - // RUNFLAG_NOSELECT - lRunFlag = pItem._runFlag; - if( ( lFlag & FLAG_NOSELECT ) || - ( lFlag & FLAG_DRAWONLY ) || - ( lFlag & FLAG_DRAWUPDATEONLY ) || - ( lFlag & FLAG_EMBEDDED ) || - ( lRunFlag & RUNFLAG_TEMPLATE ) || - ( lRunFlag & RUNFLAG_HIDDEN ) || - ( lRunFlag & RUNFLAG_CHILDDRAWONLY ) || - ( lRunFlag & RUNFLAG_CHILDDRAWUPDATEONLY ) ) - pItem._runFlag = lRunFlag | RUNFLAG_NOSELECT; - - _Menu_PrintRunFlag( pItem ); -}; - -void( entity pParent, entity pItem ) Menu_InheritRunFlag = -{ - // reset the runflag - pItem._runFlag = pItem._runFlag & (RUNFLAG_MOUSEINAREA | RUNFLAG_DELETEFRAME | RUNFLAG_DELETETOGGLE | RUNFLAG_SPAWNED); - // inherit template - if( pParent._runFlag & RUNFLAG_TEMPLATE ) - pItem._runFlag = pItem._runFlag | RUNFLAG_TEMPLATE; - // inherit drawonly - if( ( pParent._runFlag & RUNFLAG_CHILDDRAWONLY ) || - ( pParent.flag & FLAG_CHILDDRAWONLY ) ) - pItem._runFlag = pItem._runFlag | RUNFLAG_CHILDDRAWONLY; - // inherit drawupdateonly - if( ( pParent._runFlag & RUNFLAG_CHILDDRAWUPDATEONLY ) || - ( pParent.flag & FLAG_CHILDDRAWUPDATEONLY ) ) - pItem._runFlag = pItem._runFlag | RUNFLAG_CHILDDRAWUPDATEONLY; - if( pParent._runFlag & RUNFLAG_HIDDEN ) - pItem._runFlag = pItem._runFlag | RUNFLAG_HIDDEN; -}; - -void() Menu_UpdateRunFlags = -{ - local vector lPos, lSize, lOrg; - - lPos = Menu_Clip_Position; - lSize = Menu_Clip_Size; - lOrg = Menu_Origin; - - Menu_Process_Setup(); - - // set the runflag of the active window - Menu_ActiveWindow._runFlag = Menu_ActiveWindow._runFlag & RUNFLAG_MOUSEINAREA; - - // update runflag by using the view tree - Menu_ProcessRunFlag( Menu_ActiveWindow ); - - Menu_Clip_Size = lSize; - Menu_Clip_Position = lPos; - Menu_Origin = lOrg; - Menu_Cursor_Position = Cursor_Position - Menu_Origin; -}; - -bool( entity pEntity ) Menu_HasEvents = -{ - if( pEntity._runFlag & RUNFLAG_CHILDDRAWONLY ) - return false; - if( pEntity._runFlag & RUNFLAG_CHILDDRAWUPDATEONLY ) - return false; - if( pEntity.flag & FLAG_DRAWONLY ) - return false; - if( pEntity.flag & FLAG_DRAWUPDATEONLY ) - return false; - //if( pEntity._runflag & RUNFLAG_HIDDEN ) - // return false; - return true; -}; - -#ifdef USEFUNCTIONS -bool( entity pEntity ) Menu_IsVisible = -{ - return !(pEntity._runFlag & (RUNFLAG_HIDDEN | RUNFLAG_CLIPPED)); -}; - -bool( entity pEntity ) Menu_IsSelectable = -{ - return !(pEntity._runFlag & RUNFLAG_NOSELECT); // && !(pEntity._runFlag & RUNFLAG_TEMPLATE); -}; - -bool( entity pEntity ) Menu_IsTemplate = -{ - return pEntity._runFlag & RUNFLAG_TEMPLATE; -}; - -bool( entity pEntity ) Menu_IsEmbedded = -{ - return pEntity.flag & FLAG_EMBEDDED; -}; - -string( entity pItem ) Menu_GetName = -{ - return substring( pItem.name, strlen( pItem.parent ) + 2, 100000 ); -}; -#endif diff --git a/scmenu/source/system/structure.qh b/scmenu/source/system/structure.qh deleted file mode 100644 index 36551e924..000000000 --- a/scmenu/source/system/structure.qh +++ /dev/null @@ -1,88 +0,0 @@ -// DP/Nex Menu -// system/structure.qh - -entity Menu_ActiveWindow; - -// points to the lowest selected menu item (that has no child item selected) -entity Menu_ActiveItem; - -/////////////// -// prototypes -/// - -// help if you need to iterate through embedded items, too -entity( entity pItem ) _Menu_GetParent; -entity( entity pItem ) _Menu_GetFirst; -entity( entity pItem ) _Menu_GetLast; -entity( entity pItem ) _Menu_GetNext; -entity( entity pItem ) _Menu_GetPrev; -bool( entity pItem, entity pParent ) _Menu_IsEmbeddedParentOf; - -// INFO: SelectUp/Down rules: -// INFO: Down: -// INFO: 1. try to select a selectable item -// INFO: 2. try to select a subwindow -// INFO: Up: -// INFO: 1. try to select the parent -// INFO: 2. select down the parent -// INFO: 3. select up the parent - -// raw select -void() _Menu_SelectNext; -void() _Menu_SelectPrev; -bool() _Menu_SelectUp; -bool() _Menu_SelectDown; -void() _Menu_Reselect; - -void( bool pUser ) Menu_SelectNext; -void( bool pUser ) Menu_SelectPrev; -bool( bool pUser ) Menu_SelectUp; -bool( bool pUser ) Menu_SelectDown; -void( bool pUser ) Menu_Reselect; - -// INFO:Should only be used inside of _select event functions and only (only!) when -// absolutely necessary since this is more or less a hack -void( entity pItem, bool pUser ) Menu_CorrectSelection; - -void( entity pItem, bool pUser ) Menu_Select; -void( entity pMenu, bool pMakeActive, bool pUser ) Menu_JumpToWindow; - -bool( entity pEntity ) Menu_HasEvents; - -#ifdef USEFUNCTIONS -bool( entity pEntity ) Menu_IsVisible; -bool( entity pEntity ) Menu_IsSelectable; -bool( entity pEntity ) Menu_IsTemplate; -bool( entity pEntity ) Menu_IsEmbedded; - -bool( entity pEntity, float pFlag ) Menu_HasFlag; -bool( entity pEntity, float pRunFlag ) Menu_HasRunFlag; -#else -#define Menu_IsVisible(pEntity) (!((pEntity)._runFlag & (RUNFLAG_HIDDEN | RUNFLAG_CLIPPED))) -#define Menu_IsSelectable(pEntity) (!((pEntity)._runFlag & RUNFLAG_NOSELECT)) -#define Menu_IsTemplate(pEntity) ((pEntity)._runFlag & RUNFLAG_TEMPLATE) -#define Menu_IsEmbedded(pEntity) ((pEntity).flag & FLAG_EMBEDDED) - -#define Menu_HasFlag(pEntity,pFlag) ((pEntity).flag & (pFlag)) -#define Menu_HasRunFlag(pEntity,pRunFlag) ((pEntity)._runFlag & (pRunFlag)) -#endif - -void( entity pEntity ) Menu_SetRunFlag; -void( entity pParent, entity pEntity ) Menu_InheritRunFlag; - -void() Menu_UpdateRunFlags; - -void( entity pWindow ) Menu_EmptyWindow; -void( entity pEntity ) Menu_RemoveItem; - -entity( entity pOrigin, string pName, bool pThrow ) Menu_GetItemEx; -entity( entity pOrigin, string pName, bool pThrow ) Menu_GetChildEx; - -entity( string pName ) Menu_GetItem; // pOrigin = self -entity( string pName ) Menu_GetChild; - -#ifdef USEFUNCTIONS -string( entity pItem ) Menu_GetName; // gets the name without the parent namespace -#else -#define Menu_GetName(pItem) (substring( (pItem) .name, strlen( (pItem) .parent ) + 2, 100000 )) -#endif diff --git a/scmenu/source/todo b/scmenu/source/todo deleted file mode 100644 index 664a54231..000000000 --- a/scmenu/source/todo +++ /dev/null @@ -1,75 +0,0 @@ -// Todo list - --Clean up the Nex_ custom mess a bit --Notify Spike that the "effectless statement" warning has a off-by-one bug -*-Rename Item_Composition and make it not embedded by default -*-Add support for a MOUSECLIP flag which will make the menu not pass any mouse events to the items under it -*-Move the normal key function somewhere else perhaps?? -*--Write a test menu ^^ ---Unroll as menu recursive functions as possible -f-Remove this bloody RUNFLAG_SPAWNED again -*-Only spawn an item once(even if its tried to spawn it multiple times) --Think about the layout alignment and improve it -*-Calculate the clip sizes and positions only once in PROCESS_RUNFLAG ---Rewrite *all* controls and the event handler to have the origin change before the current event function --Add #enum and #enumflags to the parser --Add effect support to all bloody items, use fixed names - if non existent ignore - change Menu_GetItem to a non-erroring version for this --Add extended # commands like #add or #and, #complement, etc. --Rewrite isframe to allow automation to create a good amount of new items -*-Clip the Item_DataLink_Value value strings (so it contains e.g. 1.45 instead of 1.450000) -*-Make all datalinks route all ITEM_DATA events --Make FLOATING window clip its movement to the parent window's size so you cant hide it this way --Fix orderPos in LinkChildren -*-Add a slist subsystem to base! --Do a big naming check to smooth things out --Move the _menu_process stuff somewhere else -s-Only call the mouse event when the position has been changed - since all changes happens then --Perhaps make the RUNFLAGs be reset every frame for all items? --Spend some time writing docs for the API - preferably at http://wiki.quakesrc.org :/ --Write a parser readme file explaining every tiny, little bit of it -/-Add effects items/classes -/-Rewrite isframe -/-Think about when to support ctcalls and when not -//-Add full support for the template idea or remove it -?s-Make altstring and property conform with the new string param rules -?s-Make the Data items support runtime changes, too -?-Restructurize the controls -f-Add some kind of overlay control -f-Remove TokenType -f-Remove support for cliparea '0 0 0'-'0 0 0' => whole plane -s-Add a color and alpha stack to mgfx -s-Add a current namespace global that builds the current namespace from the parent lists -s-Add the abstract Item Item_Selectable -s-Remove all ctcall, customizeable events - -*-Add ._runflags to system/item.qc - which will be used to determine visibility, etc. of items -*-Add MENU_PROCESS_KEY to Menu_ProcessEvent -*-Add MENU_PROCESS_RUNFLAG -*-Add RUNFLAG_CLIPPED, so we can select items that arent visible (but arent hidden intentionally as well -> scrollwindows) -*-Add a .userselect event (Toddd) -*-Add a multiline label item class -*-Add a real #include to the parser -*-Add a scmenu_debug_process_filter cvar (only displays information on a specific process run) -*-Add a select event instead of userselect -*-Add a system controlled destruction of items similar to the NG Menu's system -*-Add direction tokens to Menu_GetItem -*-Add layout classes -*-Add more output to the parser (perhaps also a debug mode) -*-Finish the goddamn design -*-Finish the structure debug output -*-Finish this darn #include support!! -*-Fix the _FLAG_MOUSEINAREA bug: if the flag is set and the item is hidden somehow, it wont be unset -*-Fix the init function calling the spawn function for templates, too -*-Fix this strange clipping bug (items plop out of the void instead of shifting slowly in) -*-Implement an embedded window perhaps -*-Make FLAG_DRAWONLY and FLAG_DRAWUPDATEONLY only affect the parent item -*-Merge as many of the debug functions (especially clientarea and parentarea) -*-Move as many constants as possible to constants.menu -*-Remove Item_Init - its poison to deriving classes -*-Rename .refresh to .update and change all constants, too -*-Rename Spawn_ to _Spawn perhaps?? -*-Rename link to target in the DataUser class -*-Rewrite _menu_* to use the normal stack instead of an altstring stack -*-Rewrite all controls -*-Rewrite all gfx functions to reuse the params for conversions, etc. -*-Update scmenu_debug_parser to also support tokens instead of pure floats diff --git a/scmenu/source/util/altstring.qc b/scmenu/source/util/altstring.qc deleted file mode 100644 index a68d913a0..000000000 --- a/scmenu/source/util/altstring.qc +++ /dev/null @@ -1,314 +0,0 @@ -// NG-Menu -// util/altstring.qc - -#ifdef UTILALTSTRING -/* -=================== -Util_GetAltStringCount -=================== -*/ -float( string pStr ) Util_GetAltStringCount = -{ - local float lLength; - local float lCount; - local float lPosition; - local string lLetter; - - lPosition = lCount = 0; - for( lLength = strlen( pStr ) ; lPosition < lLength ; lPosition++ ) { - lLetter = substring( pStr, lPosition, 1 ); - if( lLetter == "'" ) - lCount++; - else if( lLetter == "\\" ) - lPosition++; - } - - return floor( lCount / 2 ); -}; - -/* -=================== -Util_GetAltStringItem -=================== -*/ -string( string pStr, float pCount ) Util_GetAltStringItem = -{ - local float lCount; - local float lPosition; - local float lLength; - local string lLetter; - local string lOut; - - pCount = pCount*2 + 1; // number of ' until item starts - lCount = lPosition = 0; - for( lLength = strlen( pStr ) ; lPosition < lLength && lCount < pCount ; lPosition++ ) { - lLetter = substring( pStr, lPosition, 1 ); - - if( lLetter == "'" ) - lCount = lCount + 1; - else if( lLetter == "\\" ) - lPosition++; - } - - if( lCount != pCount ) - return String_Create(); - - for( lOut = "" ; lPosition < lLength ; lPosition++ ) { - lLetter = substring( pStr, lPosition, 1 ); - - if( lLetter == "'" ) - break; - else if( lLetter == "\\" ) { - lPosition++; - if( lPosition >= lLength ) - break; - lLetter = substring( pStr, lPosition, 1 ); - } - - // no need for strzone since there are 16 buffers and we use 2 in the for - lOut = strcat( lOut, lLetter ); - } - - return String_Zone( lOut ); // return a strzoned string -}; -#else -float( string pStr ) Util_GetAltStringCount = -{ - return altstr_count( pStr ); -}; -string( string pStr, float pCount ) Util_GetAltStringItem = -{ - return String_Zone( altstr_get( pStr, pCount ) ); -}; -#endif - - -/* -=================== -Util_SetAltStringItem -=================== -*/ -#ifdef UTILALTSTRING -string( string pAlt, float pIndex, string pSet ) Util_SetAltStringItem = -{ - local float lCount; - local float lPosition; - local float lStart; - local float lLength; - local string lLetter; - local string lOut; - - pSet = String_Zone( pSet ); - - pIndex = pIndex*2 + 1; // number of ' until item starts - lCount = lPosition = 0; - for( lLength = strlen( pAlt ) ; lPosition < lLength && lCount < pIndex ; lPosition = lPosition + 1 ) { - lLetter = substring( pAlt, lPosition, 1 ); - - if( lLetter == "'" ) - lCount = lCount + 1; - else if( lLetter == "\\" ) - lPosition = lPosition + 1; - } - - if( lCount != pIndex ) - return pAlt; - - lStart = lPosition; - // find the end of it - for( ; lPosition < lLength ; lPosition++ ) { - lLetter = substring( pAlt, lPosition, 1 ); - - if( lLetter == "'" ) - break; - else if( lLetter == "\\" ) - lPosition = lPosition + 1; - } - - lOut = String_Substring( pAlt, 0, lStart ); - pSet = String_Normal( Util_AltStringPrepare( String_Normal( pSet ) ) ); - lOut = strcat( lOut, pSet, substring( pAlt, lPosition, lLength - lPosition ) ); - - return String_Set( pAlt, lOut ); -}; -#else -string( string pAlt, float pIndex, string pSet ) Util_SetAltStringItem = -{ - return String_Set( pAlt, altstr_set( pAlt, pIndex, pSet ) ); -}; -#endif - -/* -=================== -Util_DelAltStringItem -=================== -*/ -string( string pAlt, float pIndex ) Util_DelAltStringItem = -{ - local float lCount; - local float lPosition; - local float lStart; - local float lLength; - local string lLetter; - local string lOut; - - pIndex = pIndex*2 + 1; // number of ' until item starts - lCount = lPosition = 0; - for( lLength = strlen( pAlt ) ; lPosition < lLength && lCount < pIndex ; lPosition = lPosition + 1 ) { - lLetter = substring( pAlt, lPosition, 1 ); - - if( lLetter == "'" ) - lCount = lCount + 1; - else if( lLetter == "\\" ) - lPosition = lPosition + 1; - } - - if( lCount != pIndex ) - return pAlt; - - lStart = lPosition; - // find the end of it - for( ; lPosition < lLength ; lPosition++ ) { - lLetter = substring( pAlt, lPosition, 1 ); - - if( lLetter == "'" ) - break; - else if( lLetter == "\\" ) - lPosition = lPosition + 1; - } - - if( lStart > 0 ) - lOut = substring( pAlt, 0, lStart - 1 ); - if( lPosition < lLength - 1) - lOut = strcat( lOut, substring( pAlt, lPosition + 1, lLength - lPosition - 1) ); - - return String_Set( pAlt, lOut ); -}; - -/* -=================== -Util_InsAltStringItem -=================== -*/ -#ifdef UTILALTSTRING -string( string pAlt, float pIndex, string pSet ) Util_InsAltStringItem = -{ - local float lCount; - local float lPosition; - local float lLength; - local string lLetter; - local string lOut; - - pSet = String_Zone( pSet ); - - pIndex = pIndex*2 + 2; // number of ' until item starts - lCount = lPosition = 0; - for( lLength = strlen( pAlt ) ; lPosition < lLength && lCount < pIndex ; lPosition = lPosition + 1 ) { - lLetter = substring( pAlt, lPosition, 1 ); - - if( lLetter == "'" ) - lCount = lCount + 1; - else if( lLetter == "\\" ) - lPosition = lPosition + 1; - } - - if( lCount != pIndex ) - return pAlt; - - lOut = String_Substring( pAlt, 0, lPosition ); - pSet = String_Normal( Util_AltStringPrepare( String_Normal( pSet ) ) ); - lOut = strcat( lOut, "'", pSet, "'", substring( pAlt, lPosition, lLength - lPosition ) ); - - return String_Set( pAlt, lOut ); -}; -#else -string( string pAlt, float pIndex, string pSet ) Util_InsAltStringItem = -{ - return String_Set( pAlt, altstr_ins( pAlt, pIndex, pSet ) ); -}; -#endif - -/* -=================== -Util_AltStringPrepare -=================== -*/ -#ifdef UTILALTSTRING -string( string pString ) Util_AltStringPrepare = -{ - local string lOut, lChar; - local float lPos, lLength; - - pString = String_Zone( pString ); - - lOut = ""; - lLength = strlen( pString ); - for( lPos = 0; lPos < lLength ; lPos = lPos + 1 ) { - lChar = substring( pString, lPos, 1 ); - if( lChar == "'" ) - lChar = "\\'"; - lOut = strcat( lOut, lChar ); - } - - String_Free( pString ); - return String_Zone( lOut ); -}; -#else -string( string pString ) Util_AltStringPrepare = -{ - return String_Zone( altstr_prepare( pString ) ); -}; -#endif - -/* -=================== -Util_AltStringPush -=================== -*/ -string( string pAlt, string pPush ) Util_AltStringPush = -{ - return String_Set( pAlt, strcat( "'", altstr_prepare( pPush ), "'", pAlt ) ); -}; - -/* -=================== -Util_AltStringPushBack -=================== -*/ -string( string pAlt, string pPush ) Util_AltStringPushBack = -{ - return String_Set( pAlt, strcat( pAlt, "'", altstr_prepare( pPush ), "'" ) ); -}; - -/* -=================== -Util_GetAltStringTop -=================== -*/ -string( string pAlt ) Util_GetAltStringTop = -{ - return Util_GetAltStringItem( pAlt, 0 ); -}; - -/* -=================== -Util_AltStringPop -=================== -*/ -string( string pAlt ) Util_AltStringPop = -{ - local float lPos, lCount, lLength; - local string lChar; - - lCount = 0; - lLength = strlen( pAlt ); - for( lPos = 0 ; lPos < lLength && lCount < 2 ; lPos++) { - lChar = substring( pAlt, lPos, 1 ); - if( lChar == "\\" ) - lPos++; - else if( lChar == "'" ) - lCount++; - } - - return String_Set( pAlt, substring( pAlt, lPos, lLength - lPos ) ); // no - 1 because this time we dont break after the ' -}; diff --git a/scmenu/source/util/altstring.qh b/scmenu/source/util/altstring.qh deleted file mode 100644 index ee2beaf02..000000000 --- a/scmenu/source/util/altstring.qh +++ /dev/null @@ -1,17 +0,0 @@ -// NG Menu -// util/altstring.qh - -// used to extract 'string' strings from a normal string -// INFO: the index into the altstring is the same like in a C array -float( string s) Util_GetAltStringCount; -string( string s, float c ) Util_GetAltStringItem; -string( string pAlt, float pIndex, string pSet ) Util_SetAltStringItem; -string( string pAlt, float pIndex ) Util_DelAltStringItem; -// insert a new item after the indexed (to insert an item at the front use -1) -string( string pAlt, float pIndex, string pSet ) Util_InsAltStringItem; - -string( string pString ) Util_AltStringPrepare; -string( string pAlt, string pPush ) Util_AltStringPush; // strzone -string( string pAlt, string pPush ) Util_AltStringPushBack; // strzone -string( string pAlt ) Util_GetAltStringTop; -string( string pAlt ) Util_AltStringPop; // strzone diff --git a/scmenu/source/util/nfunction.qc b/scmenu/source/util/nfunction.qc deleted file mode 100644 index 0253ea2d2..000000000 --- a/scmenu/source/util/nfunction.qc +++ /dev/null @@ -1,9 +0,0 @@ -// NG Menu -// util/nfunction.qc - -void() Util_NullFunction = {}; -bool() Util_TrueFunction = { return true; }; -bool() Util_FalseFunction = { return false; }; -string() Util_StringFuntion = { return ""; }; -vector() Util_VectorFunction = { return '0 0 0'; }; -entity() Util_EntityFunction = { return null_entity; }; diff --git a/scmenu/source/util/property.qc b/scmenu/source/util/property.qc deleted file mode 100644 index 4df4b9ef4..000000000 --- a/scmenu/source/util/property.qc +++ /dev/null @@ -1,275 +0,0 @@ -// NG Menu -// util/property.qc - -#ifdef DEBUG - #define DebugValidate(str) Property_Validate( str ) -#else - #define DebugValidate(str) true -#endif - -/* -=================== -Property_Create -=================== -*/ -string() Property_Create = -{ - return String_Create(); -}; - -string( string pString ) Property_Zone = -{ - return String_Zone( pString ); -}; - -string( string pString ) Propery_Free = -{ - return String_Free( pString ); -}; - -/* -=================== -Property_Validate -=================== -*/ -bool( string pString ) Property_Validate = -{ - local float lCount; - - lCount = Util_GetAltStringCount( pString ); - // check whether this is a valid property string - if( rint( lCount / 2 ) != lCount / 2 ) -#ifdef STRICTRULES - error( __FUNC__, "Invalid property string \"", pString , "\"!\n" ); -#else - { - dprint( __FUNC__, "Invalid property string \"", pString, "\"!\n" ); - return false; - } -#endif - return true; -}; - -/* -=================== -Property_Exists -=================== -*/ -bool( string pString, string pName ) Property_Exists = -{ - local float lCount; - local float lCounter; - - if( !DebugValidate( pString ) ) - return false; - - lCount = Util_GetAltStringCount( pString ); - for( lCounter = 0 ; lCounter < lCount ; lCounter += 2 ) - if( String_Normal( Util_GetAltStringItem( pString, lCounter ) ) == pName ) - return true; - return false; -}; - -/* -=================== -Property_Register -=================== -*/ -string( string pString, string pName, string pInitValue ) Property_Register = -{ - local float lCount; - local float lCounter; - - if( !DebugValidate( pString ) ) - return pString; - - // If the entry already exists, do nothing (thus exit the function) - lCount = Util_GetAltStringCount( pString ); - for( lCounter = 0 ; lCounter < lCount ; lCounter += 2 ) - if( String_Normal( Util_GetAltStringItem( pString, lCounter ) ) == pName ) - return pString; - - // If it hasnt been added yet, create it - pString = Util_AltStringPush( pString, pInitValue ); - pString = Util_AltStringPush( pString, pName ); - - return pString; -} - -/* -=================== -Property_Set -=================== -*/ -string( string pString, string pName, string pValue ) Property_Set = -{ - local float lCount; - local float lCounter; - - if( !DebugValidate( pString ) ) - return pString; - - // Found the entry and set it to the new value - lCount = Util_GetAltStringCount( pString ); - for( lCounter = 0 ; lCounter < lCount ; lCounter += 2 ) - if( String_Normal( Util_GetAltStringItem( pString, lCounter ) ) == pName ) - return Util_SetAltStringItem( pString, lCounter + 1, pValue ); - - // If the property isnt found, it depends on DEBUG and STRICT -#ifdef STRICTRULES - error( __FUNC__, "The property \"", pName, "\" hasn't been declared!\npString = \"", pString, "\"" ); -#else - dprint( __FUNC__, "The property \"", pName, "\" hasn't been declared!\npString = \"", pString, "\"" ); -#endif - - return pString; -}; - -string( string pString, string pOldName, string pNewName ) Property_Rename = -{ - local float lCount; - local float lCounter; - - if( !DebugValidate( pString ) ) - return pString; - - // Found the entry if it already exists - lCount = Util_GetAltStringCount( pString ); - for( lCounter = 0 ; lCounter < lCount ; lCounter += 2 ) - if( String_Normal( Util_GetAltStringItem( pString, lCounter ) ) == pOldName ) - return Util_SetAltStringItem( pString, lCounter, pNewName ); - - // If the property isnt found, it depends on DEBUG and STRICT -#ifdef STRICTRULES - error( __FUNC__, "The property \"", pOldName, "\" hasn't been declared!\npString = \"", pString, "\"" ); -#else - dprint( __FUNC__, "The property \"", pOldName, "\" hasn't been declared!\npString = \"", pString, "\"" ); -#endif - return pString; -}; - -string( string pString, string pName ) Property_Delete = -{ - local float lCount; - local float lCounter; - - if( !DebugValidate( pString ) ) - return pString; - - // Found the entry if it already exists - lCount = Util_GetAltStringCount( pString ); - for( lCounter = 0 ; lCounter < lCount ; lCounter += 2 ) - if( String_Normal( Util_GetAltStringItem( pString, lCounter ) ) == pName ) { - pString = Util_DelAltStringItem( pString, lCounter ); - pString = Util_DelAltStringItem( pString, lCounter ); - return pString; - } - - // If the property isnt found, it depends on DEBUG and STRICT -#ifdef STRICTRULES - error( __FUNC__, "The property \"", pName, "\" hasn't been declared!\npString = \"", pString, "\"" ); -#else - dprint( __FUNC__, "The property \"", pName, "\" hasn't been declared!\npString = \"", pString, "\"" ); -#endif - return pString; -}; - -/* -=================== -Property_Set -=================== -*/ -/* -string( string pString, string pName, string pValue ) Property_Set = -{ - local float lCount; - local float lCounter; - local float lProp; - - // save pValue - pValue = strzone( pValue ); - - if( !DebugValidate( pString ) ) - return pString; - - // Found the entry if it already exists - lCount = Util_GetAltStringCount( pString ); - lProp = -1; - for( lCounter = 0 ; lCounter < lCount ; lCounter += 2 ) - if( Util_GetAltStringItem( pString, lCounter ) == pName ) { - lProp = lCounter; - break; - } - - // If it hasnt been added yet, create it - if( lProp == -1 ) { - pString = Util_AltStringPush( pString, pValue ); - pString = Util_AltStringPush( pString, pName ); - } else - pString = Util_SetAltStringItem( pString, lProp + 1, pValue ); - - strunzone( pValue ); - return pString; -}; -*/ - -/* -=================== -Property_Get -=================== -*/ -string( string pString, string pName ) Property_Get = -{ - local float lCount; - local float lCounter; - - if( !DebugValidate( pString ) ) - return pString; - - // Found the entry and return its value - lCount = Util_GetAltStringCount( pString ); - for( lCounter = 0 ; lCounter < lCount ; lCounter += 2 ) - if( String_Normal( Util_GetAltStringItem( pString, lCounter ) ) == pName ) - return Util_GetAltStringItem( pString, lCounter + 1); - - // If the property isnt found, it depends on DEBUG and STRICT -#ifdef STRICTRULES - error( "The property \"", pName, "\" hasn't been declared!\npString = \"", pString, "\"" ); -#else - dprint( "The property \"", pName, "\" hasn't been declared!\npString = \"", pString, "\"" ); -#endif - - return String_Zone( "" ); -}; - -/* -=================== -Property_GetString -=================== -*/ -string( string pString, string pName ) Property_GetString = -{ - return Property_Get( pString, pName ); -}; - -/* -=================== -Property_GetFloatProperty -=================== -*/ -float( string pString, string pName ) Property_GetFloat = -{ - return stof( String_Normal( Property_Get( pString, pName ) ) ); -}; - -vector( string pString, string pName ) Property_GetVector = -{ - return stov( String_Normal( Property_Get( pString, pName ) ) ); -}; - -entity( string pString, string pName ) Property_GetEntity = -{ - return ftoe( Property_GetFloat( pString, pName ) ); -}; - -#undef DebugValidate() diff --git a/scmenu/source/util/property.qh b/scmenu/source/util/property.qh deleted file mode 100644 index c04d5000f..000000000 --- a/scmenu/source/util/property.qh +++ /dev/null @@ -1,27 +0,0 @@ -// NG Menu -// util/property.qh - -// INFO: the property functions: -// INFO: to save some entity fields I support property strings, which use altstrings to manage a dynamic -// INFO: range of properties -// INFO: "'nameOfProp''Value''nameOfProp''Value'.." -// INFO: for speed reasons most of the Property_* functions assume that the property string has been validated -// INFO: by Property_Validate -// more or less generic functions -string() Property_Create; -string( string pString ) Property_Zone; -string( string pString ) Propery_Free; -bool( string pString ) Property_Validate; - -bool( string pString, string pName ) Property_Exists; -string( string pString, string pName, string pInitValue ) Property_Register; // doesnt change anything if the property does already exist -string( string pString, string pName, string pValue ) Property_Set; // errors if the property isnt found -//string( string pString, string pName, string pValue ) Property_Set; // if the property doesnt exist yet, it adds it -string( string pString, string pOldName, string pNewName ) Property_Rename; -string( string pString, string pName ) Property_Delete; - -string( string pString, string pName ) Property_Get; -string( string pString, string pName ) Property_GetString; -float( string pString, string pName ) Property_GetFloat; -vector( string pString, string pName ) Property_GetVector; -entity( string pString, string pName ) Property_GetEntity; diff --git a/scmenu/source/util/rect.qc b/scmenu/source/util/rect.qc deleted file mode 100644 index ac59e352b..000000000 --- a/scmenu/source/util/rect.qc +++ /dev/null @@ -1,189 +0,0 @@ -// NG Menu -// util/rect.qc - -/* -=================== -Util_InRect -=================== -*/ -bool( vector pPoint, vector pPos, vector pSize ) Util_InRect = -{ - if( pPoint_x < pPos_x || pPoint_y < pPos_y || pPoint_x > pPos_x + pSize_x || pPoint_y > pPos_y + pSize_y ) - return false; - return true; -}; - -bool( vector pPos1, vector pSize1, vector pPos2, vector pSize2 ) Util_RectInRect = -{ - local vector lFPos1, lFPos2; - - lFPos1 = pPos1 + pSize1; - lFPos2 = pPos2 + pSize2; - - if( pPos1_x <= lFPos2_x && pPos2_x <= lFPos1_x && pPos1_y <= lFPos2_y && pPos2_y <= lFPos1_y ) - return false; - return true; -}; - -/* -=================== -Util_ClipPoint -=================== -*/ -/* -vector( vector pPoint, vector pPos, vector pSize ) Util_ClipPoint = -{ - local vector lPoint; - lPoint_x = bound( pPos_x, pPoint_x, pPos_x + pSize_x ); - lPoint_y = bound( pPos_y, pPoint_y, pPos_y + pSize_y ); - lPoint_z = 0; - - return lPoint; -}; -*/ - -vector( vector pPoint, vector pClipPos, vector pClipSize ) Util_GetClipDelta = -{ - local vector lPoint; - lPoint_x = bound( pClipPos_x, pPoint_x, pClipPos_x + pClipSize_x ) - pPoint_x; - lPoint_y = bound( pClipPos_y, pPoint_y, pClipPos_y + pClipSize_y ) - pPoint_y; - lPoint_z = 0; - - return lPoint; -}; - -/* -=================== -Util_ClipRect -=================== -*/ -vector( vector pPos, vector pSize, vector pClipPos, vector pClipSize ) Util_ClipRect = -{ - vector lSize; - - //DEBUG: Safe version - //lSize_x = bound( pClipPos_x, pPos_x + pSize_x, pClipPos_x + pClipSize_x ) - bound( pClipPos_x, pPos_x, pClipPos_x + pClipSize_x ); - //lSize_y = bound( pClipPos_y, pPos_y + pSize_y, pClipPos_y + pClipSize_y ) - bound( pClipPos_y, pPos_y, pClipPos_y + pClipSize_y ); - //lSize_x = min( pPos_x + pSize_x, pClipPos_x + pClipSize_x ) - max( pPos_x, pClipPos_x ); - //lSize_y = min( pPos_y + pSize_y, pClipPos_y + pClipSize_y ) - max( pPos_y, pClipPos_y ); - //INFO: we suppose pPos to be already clipped and pSize to have been adjusted(!!) - lSize_x = min( pPos_x + pSize_x, pClipPos_x + pClipSize_x ) - pPos_x; - lSize_y = min( pPos_y + pSize_y, pClipPos_y + pClipSize_y ) - pPos_y; - lSize_z = 0; - - if( lSize_x <= 0 || lSize_y <= 0 ) - return '0 0 0'; - - return lSize; -}; - -/* -=================== -Util_ClipStack_Reset -=================== -*/ -string( string pStack ) Util_ClipStack_Reset = -{ - String_Free( pStack ); - return String_Create(); -}; - -/* -=================== -Util_ClipStack_Push -=================== -*/ -string( string pStack, vector pPos, vector pSize ) Util_ClipStack_Push = -{ - local vector lOldPos, lOldSize, lDelta; - - lOldPos = Util_ClipStack_GetPosition( pStack ); - lOldSize = Util_ClipStack_GetSize( pStack ); - - if( pPos == '0 0 0' && pSize == '0 0 0' ) { - pPos = lOldPos; - pSize = lOldSize; - } else if( lOldPos != '0 0 0' || lOldSize != '0 0 0' ) { - lDelta = Util_GetClipDelta( pPos, lOldPos, lOldSize ); - pPos = pPos + lDelta; - pSize = Util_ClipRect( pPos, pSize - lDelta, lOldPos, lOldSize ); - } - - pStack = Util_AltStringPush( pStack, vtos( pSize ) ); - pStack = Util_AltStringPush( pStack, vtos( pPos ) ); - - return pStack; -}; - -/* -=================== -Util_ClipStack_Pop -=================== -*/ -string( string pStack ) Util_ClipStack_Pop = -{ - pStack = Util_AltStringPop( pStack ); - pStack = Util_AltStringPop( pStack ); - return pStack; -}; - -/* -=================== -Util_ClipStack_GetPosition -=================== -*/ -vector( string pStack ) Util_ClipStack_GetPosition = -{ - return stov( String_Normal( Util_GetAltStringItem( pStack, 0 ) ) ); -}; - -/* -=================== -Util_ClipStack_GetSize -=================== -*/ -vector( string pStack ) Util_ClipStack_GetSize = -{ - return stov( String_Normal( Util_GetAltStringItem( pStack, 1 ) ) ); -}; - -/* -=================== -Util_OriginStack_Reset -=================== -*/ -string( string pStack ) Util_OriginStack_Reset = -{ - String_Free( pStack ); - return String_Create(); -}; - -/* -=================== -Util_OriginStack_Push -=================== -*/ -string( string pStack, vector pOrigin ) Util_OriginStack_Push = -{ - return Util_AltStringPush( pStack, vtos( pOrigin ) ); -}; - -/* -=================== -Util_OriginStack_Pop -=================== -*/ -string( string pStack ) Util_OriginStack_Pop = -{ - return Util_AltStringPop( pStack ); -}; - -/* -=================== -Util_OriginStack_Get -=================== -*/ -vector( string pStack ) Util_OriginStack_Get = -{ - return stov( String_Normal( Util_GetAltStringTop( pStack ) ) ); -}; diff --git a/scmenu/source/util/rect.qh b/scmenu/source/util/rect.qh deleted file mode 100644 index 5ac296f96..000000000 --- a/scmenu/source/util/rect.qh +++ /dev/null @@ -1,27 +0,0 @@ -// NG Menu -// util/rect.qh - -// rect utils -// a rect def. consists of 2 vectors (pos & size) -bool( vector pPoint, vector pPos, vector pSize ) Util_InRect; -vector( vector pPoint, vector pClipPos, vector pClipSize ) Util_GetClipDelta; -//vector( vector pPoint, vector pPos, vector pSize ) Util_ClipPoint; -// clips the rect [pPos, pSize] against [pClipPos, pClipSize] retuns the clipped size -vector( vector pPos, vector pSize, vector pClipPos, vector pClipSize ) Util_ClipRect; - -bool( vector pPos1, vector pSize1, vector pPos2, vector pSize2 ) Util_RectInRect; - -// clip stack functions -string( string pStack ) Util_ClipStack_Reset; -string( string pStack, vector pPos, vector pSize ) Util_ClipStack_Push; -string( string pStack ) Util_ClipStack_Pop; - -vector( string pStack ) Util_ClipStack_GetPosition; -vector( string pStack ) Util_ClipStack_GetSize; - -// origin stack functions -string( string pStack ) Util_OriginStack_Reset; -string( string pStack, vector pOrigin ) Util_OriginStack_Push; -string( string pStack ) Util_OriginStack_Pop; - -vector( string pStack ) Util_OriginStack_Get; diff --git a/scmenu/source/util/string.qc b/scmenu/source/util/string.qc deleted file mode 100644 index 08de96b79..000000000 --- a/scmenu/source/util/string.qc +++ /dev/null @@ -1,134 +0,0 @@ -// NG Menu -// util/string.qc - -/* -=================== -String_Create -=================== -*/ -string() String_Create = -{ - //return strzone( strcat( "Static, ", self.name ) ); - return strzone( "" ); -}; - -/* -=================== -String_Make -=================== -*/ -string( string pStr ) String_Zone = -{ - return strzone( pStr ); -}; - -/* -=================== -String_Normal -=================== -*/ -string( string pStr ) String_Normal = -{ - local string lResult; - - lResult = strcat( pStr ); - strunzone( pStr ); - - return lResult; -}; - -/* -=================== -String_Free -=================== -*/ -string( string pStr ) String_Free = -{ - strunzone( pStr ); - return ""; -}; - -/* -=================== -String_EntityCreate -=================== -*/ -void( entity pEntity, .string pField ) String_EntityCreate = -{ - //pEntity.pField = strzone( strcat( "Field, ", pEntity.name ) ); - pEntity.pField = strzone( "" ); -}; - -/* -=================== -String_EntityZone -=================== -*/ -void( entity pEntity, .string pField ) String_EntityZone = -{ - pEntity.pField = strzone( pEntity.pField ); -}; - -/* -=================== -String_EntitySet -=================== -*/ -void( entity pEntity, .string pField, string pSet ) String_EntitySet = -{ -#ifdef AVOIDSTRZONES - if( pEntity.pField == pSet ) { - return; - } -#endif - - strunzone( pEntity.pField ); - pEntity.pField = strzone( pSet ); -}; - -/* -=================== -String_EntityFree -=================== -*/ -void( entity pEntity, .string pField ) String_EntityFree = -{ - strunzone( pEntity.pField ); - pEntity.pField = ""; -}; - -/* -=================== -String_Append -=================== -*/ -string( string pStr, string pApp ) String_Append = -{ - return String_Set( pStr, strcat( pStr, pApp ) ); -}; - -/* -=================== -String_Substring -=================== -*/ -string( string pStr, float pStart, float pLength ) String_Substring = -{ - return strzone( substring( pStr, pStart, pLength ) ); -}; - -/* -=================== -String_Set -=================== -*/ -string( string pStr, string pSet ) String_Set = -{ -#ifdef AVOIDSTRZONES - if( pStr == pSet ) { - return pStr; - } -#endif - strunzone( pStr ); - return strzone( pSet ); -}; diff --git a/scmenu/source/util/string.qh b/scmenu/source/util/string.qh deleted file mode 100644 index 88d5d6a3f..000000000 --- a/scmenu/source/util/string.qh +++ /dev/null @@ -1,23 +0,0 @@ -// NG Menu -// util/string.h - -// INFO: A function strzones all strings that are passed as params and strzones its return param if it -// INFO: is a string (except if the function knows that the string passed is a zone string). -// INFO: Generally, if you only call builtin functions, you can use a temp string -// INFO: You should know that the VM has 16 temp string buffers, so if you could count how many it takes -// INFO: before you have to strzone something -// TODO: convert altstring and property -string() String_Create; -string( string pStr ) String_Zone; // use this for constants -string( string pStr ) String_Normal; // strunzones pStr and returns a temp buffer version of it -string( string pStr, string pSet ) String_Set; // copies pSet to a new strzoned string -string( string pStr ) String_Free; - -string( string pStr, string pApp ) String_Append; -string( string pStr, float pStart, float pLength ) String_Substring; - -void( entity pEntity, .string pField ) String_EntityCreate; -void( entity pEntity, .string pField ) String_EntityZone; -void( entity pEntity, .string pField, string pSet ) String_EntitySet; -void( entity pEntity, .string pField ) String_EntityFree; - diff --git a/scmenu/source/util/text.qc b/scmenu/source/util/text.qc deleted file mode 100644 index cc5766e78..000000000 --- a/scmenu/source/util/text.qc +++ /dev/null @@ -1,59 +0,0 @@ -// NG Menu -// util/text.qc - -//INFO: I only care about \n and \0 and the col if in wrapped mode -vector( string pText, vector pLast ) Util_GetEndOfLine = -{ - local string lChar; - - pLast_x = pLast_y; - pLast_z = 0; - while( 1 ) { - lChar = substring( pText, pLast_x, 1 ); - - // newline -> the current char isnt valid - if( lChar == "\n" ) { - // the next valid is char can only be after the \n - pLast_y = pLast_x + 1; - --pLast_x; - return pLast; - } else if( lChar == "" ) { - pLast_y = --pLast_x; - return pLast; - } else { - ++pLast_x; - ++pLast_z; - } - } -}; - -vector( string pText, vector pLast, float pWrapLength ) Util_GetEndOfWrappedLine = -{ - local string lChar; - - pLast_x = pLast_y; - pLast_z = 0; - while( 1 ) { - lChar = substring( pText, pLast_x, 1 ); - - // newline -> the current char isnt valid - if( lChar == "\n" ) { - --pLast_x; - // the next valid is char can only be after the \n - pLast_y = pLast_x + 2; - return pLast; - } else if( lChar == "" ) { - pLast_y = --pLast_x; - return pLast; - } else { - ++pLast_x; - ++pLast_z; - if( !--pWrapLength ) { - // the current char is one too much - pLast_y = pLast_x; - --pLast_x; - return pLast; - } - } - } -}; diff --git a/scmenu/source/util/text.qh b/scmenu/source/util/text.qh deleted file mode 100644 index 0eb3890f1..000000000 --- a/scmenu/source/util/text.qh +++ /dev/null @@ -1,7 +0,0 @@ -// NG Menu -// util/text.qh - -// text tool functions -// returns a pair -vector( string pText, vector pLast ) Util_GetEndOfLine; -vector( string pText, vector pLast, float pWrapLength ) Util_GetEndOfWrappedLine; diff --git a/scmenu/source/util/uid.qc b/scmenu/source/util/uid.qc deleted file mode 100644 index b86b8eed6..000000000 --- a/scmenu/source/util/uid.qc +++ /dev/null @@ -1,33 +0,0 @@ -// NG Menu -// util/uid.qc - -// name format: "M_UID_" number - -var float _m_uid_counter = 0; -string() Util_CreateUID = -{ - local string lName; - - lName = strzone( strcat( "M_UID_", ftos( _m_uid_counter ) ) ); - _m_uid_counter = _m_uid_counter + 1; - return lName; -}; - -string( float pNum ) Util_GetUIDName = -{ - local string lName; - - lName = strzone( strcat( "M_UID_", ftos( pNum ) ) ); - return lName; -}; - -float( string pUid ) Util_GetUIDNum = -{ - local string lNum; - - lNum = substring( pUid, 6, 100000 ); - return stof( lNum ); -}; - - - diff --git a/scmenu/source/util/uid.qh b/scmenu/source/util/uid.qh deleted file mode 100644 index 5e7d5e6ca..000000000 --- a/scmenu/source/util/uid.qh +++ /dev/null @@ -1,7 +0,0 @@ -// NG Menu -// util/uid.qh - -// used to create unique names while the menu runs -string() Util_CreateUID; -string( float pNum ) Util_GetUIDName; -float( string pNum ) Util_GetUIDNum; diff --git a/scmenu/source/util/util.qh b/scmenu/source/util/util.qh deleted file mode 100644 index 2feb6769a..000000000 --- a/scmenu/source/util/util.qh +++ /dev/null @@ -1,22 +0,0 @@ -// NG-Menu -// util/util.qh - -// empty functions for every return type -void() Util_NullFunction; -bool() Util_TrueFunction; -bool() Util_FalseFunction; -string() Util_StringFuntion; -vector() Util_VectorFunction; -entity() Util_EntityFunction; - -// function typedefs - -typedef void() voidFunction; -typedef float() floatFunction; -typedef string() stringFunction; -typedef vector() vectorFunction; - - - - - diff --git a/scmenu/templates.menu b/scmenu/templates.menu deleted file mode 100644 index 3628708fc..000000000 --- a/scmenu/templates.menu +++ /dev/null @@ -1,269 +0,0 @@ -// Property of Alientrap -// -// Templates - -////////////////////////////////////////////////////////////////////////////////// -// Basic default templates (setting default properties) -////////////////////////////////////////////////////////////////////////////////// -Template Rect Rect -{ - size [InfiniteVector] - alpha 1.0 - drawFlag [DrawFlagNormal] - color '1.0 1.0 1.0' -} -Template Label Label -{ - color [DefaultTextColor] - alpha [DefaultTextAlpha] - drawFlag [DefaultTextDrawFlag] - fontSize [DefaultFontSize] -} -Template Picture Picture -{ - color [DefaultPicColor] - alpha [DefaultPicAlpha] - drawFlag [DefaultPicDrawFlag] -} -Template Button TextButton -{ - fontSize [DefaultFontSize] - color [DefaultTextColor] - colorSelected [DefaultSelTextColor] - colorPressed [DefaultPreTextColor] - alphas_x [DefaultTextAlpha] - alphas_y [DefaultSelTextAlpha] - alphas_z [DefaultPreTextAlpha] - drawFlags_x [DefaultTextDrawFlag] - drawFlags_y [DefaultSelTextDrawFlag] - drawFlags_z [DefaultPreTextDrawFlag] - //soundSelected [DefaultSelectSound] - soundPressed [DefaultPressSound] -} -Template Button PictureButton -{ - color [DefaultPicColor] - colorSelected [DefaultSelPicColor] - colorPressed [DefaultPrePicColor] - alphas_x [DefaultPicAlpha] - alphas_y [DefaultSelPicAlpha] - alphas_z [DefaultPrePicAlpha] - drawFlags_x [DefaultPicDrawFlag] - drawFlags_y [DefaultSelPicDrawFlag] - drawFlags_z [DefaultPrePicDrawFlag] - soundSelected [DefaultSelectSound] - soundPressed [DefaultPressSound] -} -Template Slider Slider -{ - color [DefaultPicColor] - //colorSelected [DefaultSelPicColor] - colorSelected "0.9 0.9 1.0" - alphas_x [DefaultPicAlpha] - alphas_y [DefaultSelPicAlpha] - drawFlags_x [DefaultPicDrawFlag] - drawFlags_y [DefaultSelPicDrawFlag] - //soundSelected [DefaultSelectSound] - soundIncrease [DefaultIncreaseSound] - soundDecrease [DefaultDecreaseSound] - picture [DefaultSliderBar] - pictureSlider [DefaultSlider] - proportions [DefaultProportions] - direction [DefaultDirection] - size [DefaultSliderBarSize] - sizeSlider [DefaultSliderSize] -} -Template EditBox EditBox -{ - fontSize [DefaultFontSize] - color [DefaultTextColor] - colorSelected [DefaultTextColor] - colorPressed [DefaultPreTextColor] - alphas_x [DefaultTextAlpha] - alphas_y [DefaultSelTextAlpha] - alphas_z [DefaultPreTextAlpha] - drawFlags_x [DefaultTextDrawFlag] - drawFlags_y [DefaultSelTextDrawFlag] - drawFlags_z [DefaultPreTextDrawFlag] - colorCursor [DefaultCursorColor] - colorCursorFlash [DefaultCursorFlashColor] - alphasCursor_x [DefaultTextAlpha] - alphasCursor_y [DefaultSelTextAlpha] - drawFlagsCursor_x [DefaultTextDrawFlag] - drawFlagsCursor_y [DefaultSelTextDrawFlag] - sizeCursor [DefaultCursorSize] - sizeCursorFlash [DefaultCursorFlashSize] - //soundSelected [DefaultSelectSound] - soundMove [DefaultIncreaseSound] - soundKey [DefaultDecreaseSound] -} -Template List List -{ - fontSize [DefaultFontSize] - color [DefaultTextColor] - colorSelected [DefaultSelTextColor] - colorPressed [DefaultPreTextColor] - colorInactive [DefaultInaTextColor] - alphas_x [DefaultTextAlpha] - alphas_y [DefaultSelTextAlpha] - alphas_z [DefaultPreTextAlpha] - alphaInactive [DefaultInaTextAlpha] - drawFlags_x [DefaultTextDrawFlag] - drawFlags_y [DefaultSelTextDrawFlag] - drawFlags_z [DefaultPreTextDrawFlag] - drawFlagInactive [DefaultInaTextDrawFlag] - soundSelected [DefaultSelectSound] - soundPressed [DefaultPressSound] -} -DeriveTemplate TextButton ValueButton -{ - type "Item_ValueButton" -} -DeriveTemplate PictureButton PictureValueButton -{ - type "Item_ValueButton" -} -DeriveTemplate Label MultiLabel -{ - type "Item_MultiLabel" -} -DeriveTemplate TextButton SwitchButton -{ - type "Item_SwitchButton" -} -////////////////////////////////////////////////////////////////////////////////// -// Derived items -////////////////////////////////////////////////////////////////////////////////// -Template Arrangement Composition -{ - flag [FlagEmbedded] -} -////////////////////////////////////////////////////////////////////////////////// -// Specialized items -////////////////////////////////////////////////////////////////////////////////// -Template DataLink_ValueSwitch DataLink_OnOffSwitch -{ - minValue 0.0 - maxValue 1.0 - descList "'Off' 'On'" - link "##up" -} -Template DataLink_Value DataLink_ZeroOneValue -{ - minValue 0.0 - maxValue 1.0 - stepValue 0.05 - link "##up" -} -Template DataLink_Value DataLink_SettingValue -{ - minValue 0.0 - maxValue 9999.0 - stepValue 0.01 - link "##up" -} -Template DataLink_Text DataLink_SettingText -{ - maxValue 9 - link "##down" - - Template DataLink_TextValue DataLink_TextValue - { - link "##up prev" - } -} -////////////////////////////////////////////////////////////////////////////////// -// Nexuiz specialized items -////////////////////////////////////////////////////////////////////////////////// -#define Nex_DefaultHorzDirection '20 0 0' -#define Nex_DefaultVertDirection '0 10 0' -Template Automation_Job Nex_Automation_Option_Slider -{ - action Nex_Automation_Option_Slider -} -Template Automation_Job Nex_Automation_Option_EditBox -{ - action Nex_Automation_Option_EditBox -} -Template Automation_Job Nex_Automation_Option_Switch -{ - action Nex_Automation_Option_Switch -} -DeriveTemplate Composition Nex_Composition -{ - direction [Nex_DefaultHorzDirection] -} -DeriveTemplate Picture Nex_Line -{ - picture "gfx/m_dot" - size "200 10" -} -Item Custom Nex_Void -{ - size "200 12" - flag [FlagNoSelect] -} - -DeriveTemplate TextButton Nex_KeyButton -{ - type "Item_Nex_KeyButton" -} -DeriveTemplate MultiLabel Nex_Credits -{ - type "Item_Nex_Credits" -} -DeriveTemplate Label Nex_HostCache_StringField -{ - type "Item_Nex_HostCache_StringField" -} -DeriveTemplate Label Nex_HostCache_ValueField -{ - type "Item_Nex_HostCache_ValueField" -} -DeriveTemplate Label Nex_HostCache_Players -{ - type "Item_Nex_HostCache_Players" -} -DeriveTemplate PictureButton Nex_HostCache_Entry -{ - normal "$gfx/white" - drawFlags [DrawFlagModulate] - type "Item_Nex_HostCache_Entry" -} -DeriveTemplate Nex_Composition Nex_Option_Slider -{ - DeriveTemplate Nex_Automation_Option_Slider Automation - {} - DeriveTemplate TextButton Description - {} - DeriveTemplate Slider Slider - { - action Nex_Action_TestOnChange - } - DeriveTemplate ValueButton Value - {} -} -DeriveTemplate Nex_Composition Nex_Option_Switch -{ - DeriveTemplate Nex_Automation_Option_Switch Automation - {} - DeriveTemplate TextButton Description - {} - DeriveTemplate SwitchButton Switch - { - action Nex_Action_TestOnChange - } -} -DeriveTemplate Nex_Composition Nex_Option_EditBox -{ - DeriveTemplate Nex_Automation_Option_EditBox Automation - {} - DeriveTemplate TextButton Description - {} - DeriveTemplate EditBox EditBox - { - size '260 12' - action Nex_Action_TestOnChange - select Nex_Action_TestOnSelect - } -} diff --git a/scmenu/test.menu b/scmenu/test.menu deleted file mode 100644 index 9363eda0b..000000000 --- a/scmenu/test.menu +++ /dev/null @@ -1,21 +0,0 @@ -// DP/Nex Menu -// Test Menu -Item Window Normal -{ - pos '100 100' - size '800 500' - - Item Window Test1 - { - pos '10 10' - origin '20 20' - size '100 100' - } - Item Window Test2 - { - pos '200 200' - origin '100 100' - size '300 300' - } -} - -- 2.39.2