From f448a713c3fba65a1b300fb10971d9ea379a9e13 Mon Sep 17 00:00:00 2001 From: div0 Date: Wed, 23 Jan 2008 20:03:49 +0000 Subject: [PATCH] -scmenu; make mapinfo default git-svn-id: svn://svn.icculus.org/nexuiz/trunk@3244 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- data/qcsrc/menu-div0test/menu.qh | 5 +- data/qcsrc/menu/base/cursor.qc | 102 --- data/qcsrc/menu/base/cursor.qh | 33 - data/qcsrc/menu/base/gfx.qc | 194 ----- data/qcsrc/menu/base/gfx.qh | 51 -- data/qcsrc/menu/base/hostcache.qc | 41 - data/qcsrc/menu/base/hostcache.qh | 28 - data/qcsrc/menu/base/key.qc | 80 -- data/qcsrc/menu/base/key.qh | 16 - data/qcsrc/menu/base/snd.qc | 32 - data/qcsrc/menu/base/snd.qh | 8 - data/qcsrc/menu/base/timer.qc | 22 - data/qcsrc/menu/base/timer.qh | 11 - data/qcsrc/menu/control/_fx/float.qc | 55 -- data/qcsrc/menu/control/_fx/fx.qh | 61 -- data/qcsrc/menu/control/_fx/interpol.qc | 12 - data/qcsrc/menu/control/_fx/vector.qc | 71 -- .../menu/control/automation/automation.qc | 13 - .../menu/control/automation/automation.qh | 30 - data/qcsrc/menu/control/automation/foreach.qc | 23 - data/qcsrc/menu/control/automation/job.qc | 22 - data/qcsrc/menu/control/cinematic.qc | 49 -- data/qcsrc/menu/control/constants.qh | 13 - data/qcsrc/menu/control/container.qc | 7 - data/qcsrc/menu/control/custom.qc | 22 - data/qcsrc/menu/control/data/altstring.qc | 25 - data/qcsrc/menu/control/data/base.qc | 224 ------ data/qcsrc/menu/control/data/container.qc | 38 - data/qcsrc/menu/control/data/cvar.qc | 185 ----- data/qcsrc/menu/control/data/data.qh | 144 ---- data/qcsrc/menu/control/data/fastresync.qc | 35 - data/qcsrc/menu/control/data/router.qc | 32 - data/qcsrc/menu/control/data/text.qc | 32 - data/qcsrc/menu/control/data/textswitch.qc | 70 -- data/qcsrc/menu/control/data/texttime.qc | 74 -- data/qcsrc/menu/control/data/textvalue.qc | 33 - data/qcsrc/menu/control/data/value.qc | 70 -- data/qcsrc/menu/control/data/valueswitch.qc | 59 -- data/qcsrc/menu/control/fx/base.qc | 69 -- data/qcsrc/menu/control/fx/fx.qh | 21 - data/qcsrc/menu/control/items.qh | 99 --- data/qcsrc/menu/control/link.qc | 63 -- data/qcsrc/menu/control/visual/button.qc | 190 ----- data/qcsrc/menu/control/visual/editbox.qc | 189 ----- data/qcsrc/menu/control/visual/floating.qc | 54 -- data/qcsrc/menu/control/visual/label.qc | 64 -- data/qcsrc/menu/control/visual/list.qc | 147 ---- data/qcsrc/menu/control/visual/multilabel.qc | 110 --- data/qcsrc/menu/control/visual/picture.qc | 36 - data/qcsrc/menu/control/visual/rect.qc | 18 - data/qcsrc/menu/control/visual/scrollbar.qc | 163 ---- data/qcsrc/menu/control/visual/slider.qc | 146 ---- .../qcsrc/menu/control/visual/switchbutton.qc | 43 -- data/qcsrc/menu/control/visual/valuebutton.qc | 31 - data/qcsrc/menu/control/visual/visual.qh | 210 ----- data/qcsrc/menu/control/window/arrangement.qc | 76 -- data/qcsrc/menu/control/window/eventwindow.qc | 13 - data/qcsrc/menu/control/window/frame.qc | 9 - data/qcsrc/menu/control/window/layout.qc | 66 -- data/qcsrc/menu/control/window/reference.qc | 68 -- data/qcsrc/menu/control/window/scroll.qc | 57 -- data/qcsrc/menu/control/window/window.qc | 58 -- data/qcsrc/menu/control/window/windows.qh | 52 -- data/qcsrc/menu/custom/campaign.qc | 167 ---- data/qcsrc/menu/custom/campaign.qh | 9 - data/qcsrc/menu/custom/color.qm | 12 - data/qcsrc/menu/custom/creategame.qm | 450 ----------- .../menu/custom/creategame/creategame.qh | 71 -- data/qcsrc/menu/custom/creategame/filelist.qc | 100 --- data/qcsrc/menu/custom/creategame/maps.qc | 716 ------------------ data/qcsrc/menu/custom/creategame/mods.qc | 85 --- data/qcsrc/menu/custom/credits.qc | 26 - data/qcsrc/menu/custom/credits.qh | 7 - data/qcsrc/menu/custom/credits.qm | 67 -- data/qcsrc/menu/custom/custom.qh | 5 - data/qcsrc/menu/custom/demos.qm | 23 - data/qcsrc/menu/custom/extresponse.qc | 127 ---- data/qcsrc/menu/custom/extresponse.qh | 7 - data/qcsrc/menu/custom/gecko.qm | 53 -- data/qcsrc/menu/custom/globalkey.qm | 32 - data/qcsrc/menu/custom/joingame.qc | 153 ---- data/qcsrc/menu/custom/joingame.qh | 35 - data/qcsrc/menu/custom/joingame.qm | 244 ------ data/qcsrc/menu/custom/key.qc | 162 ---- data/qcsrc/menu/custom/key.qh | 13 - data/qcsrc/menu/custom/key.qm | 65 -- data/qcsrc/menu/custom/messagebox.qc | 85 --- data/qcsrc/menu/custom/messagebox.qh | 5 - data/qcsrc/menu/custom/option.qm | 113 --- data/qcsrc/menu/custom/player.qm | 82 -- data/qcsrc/menu/custom/player/avatar.qc | 237 ------ data/qcsrc/menu/custom/player/color.qc | 178 ----- data/qcsrc/menu/custom/player/player.qh | 36 - data/qcsrc/menu/custom/quit.qm | 45 -- data/qcsrc/menu/custom/sound.qm | 7 - data/qcsrc/menu/custom/stresstest.qm | 14 - data/qcsrc/menu/custom/util.qm | 48 -- data/qcsrc/menu/custom/video.qc | 67 -- data/qcsrc/menu/custom/video.qh | 9 - data/qcsrc/menu/custom/video.qm | 14 - data/qcsrc/menu/custom/visible.qc | 14 - data/qcsrc/menu/custom/visible.qm | 103 --- data/qcsrc/menu/gamecommand.qc | 46 -- data/qcsrc/menu/mbuiltin.qc | 302 -------- data/qcsrc/menu/menu.qc | 158 ---- data/qcsrc/menu/menu.qh | 35 - data/qcsrc/menu/msys.qc | 294 ------- data/qcsrc/menu/progdefs.h | 13 - data/qcsrc/menu/progs.src | 194 ----- data/qcsrc/menu/system/debug.qc | 179 ----- data/qcsrc/menu/system/debug.qh | 80 -- data/qcsrc/menu/system/event_helper.qc | 290 ------- data/qcsrc/menu/system/events.qc | 458 ----------- data/qcsrc/menu/system/events.qh | 56 -- data/qcsrc/menu/system/events_.qc | 419 ---------- data/qcsrc/menu/system/gc.qc | 72 -- data/qcsrc/menu/system/gc.qh | 14 - data/qcsrc/menu/system/history.qc | 81 -- data/qcsrc/menu/system/history.qh | 23 - data/qcsrc/menu/system/isframe.qc | 342 --------- data/qcsrc/menu/system/isframe.qh | 57 -- data/qcsrc/menu/system/item.qh | 126 --- data/qcsrc/menu/system/mgfx.qc | 158 ---- data/qcsrc/menu/system/mgfx.qh | 36 - data/qcsrc/menu/system/parser.qc | 569 -------------- data/qcsrc/menu/system/parser.qh | 82 -- data/qcsrc/menu/system/structure.qc | 599 --------------- data/qcsrc/menu/system/structure.qh | 88 --- data/qcsrc/menu/todo | 75 -- data/qcsrc/menu/util/altstring.qc | 314 -------- data/qcsrc/menu/util/altstring.qh | 17 - data/qcsrc/menu/util/nfunction.qc | 9 - data/qcsrc/menu/util/property.qc | 275 ------- data/qcsrc/menu/util/property.qh | 27 - data/qcsrc/menu/util/rect.qc | 189 ----- data/qcsrc/menu/util/rect.qh | 27 - data/qcsrc/menu/util/string.qc | 134 ---- data/qcsrc/menu/util/string.qh | 23 - data/qcsrc/menu/util/text.qc | 76 -- data/qcsrc/menu/util/text.qh | 8 - data/qcsrc/menu/util/uid.qc | 33 - data/qcsrc/menu/util/uid.qh | 7 - data/qcsrc/menu/util/util.qh | 22 - data/qcsrc/server/defs.qh | 2 + 144 files changed, 3 insertions(+), 13766 deletions(-) delete mode 100644 data/qcsrc/menu/base/cursor.qc delete mode 100644 data/qcsrc/menu/base/cursor.qh delete mode 100644 data/qcsrc/menu/base/gfx.qc delete mode 100644 data/qcsrc/menu/base/gfx.qh delete mode 100644 data/qcsrc/menu/base/hostcache.qc delete mode 100644 data/qcsrc/menu/base/hostcache.qh delete mode 100644 data/qcsrc/menu/base/key.qc delete mode 100644 data/qcsrc/menu/base/key.qh delete mode 100644 data/qcsrc/menu/base/snd.qc delete mode 100644 data/qcsrc/menu/base/snd.qh delete mode 100644 data/qcsrc/menu/base/timer.qc delete mode 100644 data/qcsrc/menu/base/timer.qh delete mode 100644 data/qcsrc/menu/control/_fx/float.qc delete mode 100644 data/qcsrc/menu/control/_fx/fx.qh delete mode 100644 data/qcsrc/menu/control/_fx/interpol.qc delete mode 100644 data/qcsrc/menu/control/_fx/vector.qc delete mode 100644 data/qcsrc/menu/control/automation/automation.qc delete mode 100644 data/qcsrc/menu/control/automation/automation.qh delete mode 100644 data/qcsrc/menu/control/automation/foreach.qc delete mode 100644 data/qcsrc/menu/control/automation/job.qc delete mode 100644 data/qcsrc/menu/control/cinematic.qc delete mode 100644 data/qcsrc/menu/control/constants.qh delete mode 100644 data/qcsrc/menu/control/container.qc delete mode 100644 data/qcsrc/menu/control/custom.qc delete mode 100644 data/qcsrc/menu/control/data/altstring.qc delete mode 100644 data/qcsrc/menu/control/data/base.qc delete mode 100644 data/qcsrc/menu/control/data/container.qc delete mode 100644 data/qcsrc/menu/control/data/cvar.qc delete mode 100644 data/qcsrc/menu/control/data/data.qh delete mode 100644 data/qcsrc/menu/control/data/fastresync.qc delete mode 100644 data/qcsrc/menu/control/data/router.qc delete mode 100644 data/qcsrc/menu/control/data/text.qc delete mode 100644 data/qcsrc/menu/control/data/textswitch.qc delete mode 100644 data/qcsrc/menu/control/data/texttime.qc delete mode 100644 data/qcsrc/menu/control/data/textvalue.qc delete mode 100644 data/qcsrc/menu/control/data/value.qc delete mode 100644 data/qcsrc/menu/control/data/valueswitch.qc delete mode 100644 data/qcsrc/menu/control/fx/base.qc delete mode 100644 data/qcsrc/menu/control/fx/fx.qh delete mode 100644 data/qcsrc/menu/control/items.qh delete mode 100644 data/qcsrc/menu/control/link.qc delete mode 100644 data/qcsrc/menu/control/visual/button.qc delete mode 100644 data/qcsrc/menu/control/visual/editbox.qc delete mode 100644 data/qcsrc/menu/control/visual/floating.qc delete mode 100644 data/qcsrc/menu/control/visual/label.qc delete mode 100644 data/qcsrc/menu/control/visual/list.qc delete mode 100644 data/qcsrc/menu/control/visual/multilabel.qc delete mode 100644 data/qcsrc/menu/control/visual/picture.qc delete mode 100644 data/qcsrc/menu/control/visual/rect.qc delete mode 100644 data/qcsrc/menu/control/visual/scrollbar.qc delete mode 100644 data/qcsrc/menu/control/visual/slider.qc delete mode 100644 data/qcsrc/menu/control/visual/switchbutton.qc delete mode 100644 data/qcsrc/menu/control/visual/valuebutton.qc delete mode 100644 data/qcsrc/menu/control/visual/visual.qh delete mode 100644 data/qcsrc/menu/control/window/arrangement.qc delete mode 100644 data/qcsrc/menu/control/window/eventwindow.qc delete mode 100644 data/qcsrc/menu/control/window/frame.qc delete mode 100644 data/qcsrc/menu/control/window/layout.qc delete mode 100644 data/qcsrc/menu/control/window/reference.qc delete mode 100644 data/qcsrc/menu/control/window/scroll.qc delete mode 100644 data/qcsrc/menu/control/window/window.qc delete mode 100644 data/qcsrc/menu/control/window/windows.qh delete mode 100644 data/qcsrc/menu/custom/campaign.qc delete mode 100644 data/qcsrc/menu/custom/campaign.qh delete mode 100644 data/qcsrc/menu/custom/color.qm delete mode 100644 data/qcsrc/menu/custom/creategame.qm delete mode 100644 data/qcsrc/menu/custom/creategame/creategame.qh delete mode 100644 data/qcsrc/menu/custom/creategame/filelist.qc delete mode 100644 data/qcsrc/menu/custom/creategame/maps.qc delete mode 100644 data/qcsrc/menu/custom/creategame/mods.qc delete mode 100644 data/qcsrc/menu/custom/credits.qc delete mode 100644 data/qcsrc/menu/custom/credits.qh delete mode 100644 data/qcsrc/menu/custom/credits.qm delete mode 100644 data/qcsrc/menu/custom/custom.qh delete mode 100644 data/qcsrc/menu/custom/demos.qm delete mode 100644 data/qcsrc/menu/custom/extresponse.qc delete mode 100644 data/qcsrc/menu/custom/extresponse.qh delete mode 100644 data/qcsrc/menu/custom/gecko.qm delete mode 100644 data/qcsrc/menu/custom/globalkey.qm delete mode 100644 data/qcsrc/menu/custom/joingame.qc delete mode 100644 data/qcsrc/menu/custom/joingame.qh delete mode 100644 data/qcsrc/menu/custom/joingame.qm delete mode 100644 data/qcsrc/menu/custom/key.qc delete mode 100644 data/qcsrc/menu/custom/key.qh delete mode 100644 data/qcsrc/menu/custom/key.qm delete mode 100644 data/qcsrc/menu/custom/messagebox.qc delete mode 100644 data/qcsrc/menu/custom/messagebox.qh delete mode 100644 data/qcsrc/menu/custom/option.qm delete mode 100644 data/qcsrc/menu/custom/player.qm delete mode 100644 data/qcsrc/menu/custom/player/avatar.qc delete mode 100644 data/qcsrc/menu/custom/player/color.qc delete mode 100644 data/qcsrc/menu/custom/player/player.qh delete mode 100644 data/qcsrc/menu/custom/quit.qm delete mode 100644 data/qcsrc/menu/custom/sound.qm delete mode 100644 data/qcsrc/menu/custom/stresstest.qm delete mode 100644 data/qcsrc/menu/custom/util.qm delete mode 100644 data/qcsrc/menu/custom/video.qc delete mode 100644 data/qcsrc/menu/custom/video.qh delete mode 100644 data/qcsrc/menu/custom/video.qm delete mode 100644 data/qcsrc/menu/custom/visible.qc delete mode 100644 data/qcsrc/menu/custom/visible.qm delete mode 100644 data/qcsrc/menu/gamecommand.qc delete mode 100644 data/qcsrc/menu/mbuiltin.qc delete mode 100644 data/qcsrc/menu/menu.qc delete mode 100644 data/qcsrc/menu/menu.qh delete mode 100644 data/qcsrc/menu/msys.qc delete mode 100644 data/qcsrc/menu/progdefs.h delete mode 100644 data/qcsrc/menu/progs.src delete mode 100644 data/qcsrc/menu/system/debug.qc delete mode 100644 data/qcsrc/menu/system/debug.qh delete mode 100644 data/qcsrc/menu/system/event_helper.qc delete mode 100644 data/qcsrc/menu/system/events.qc delete mode 100644 data/qcsrc/menu/system/events.qh delete mode 100644 data/qcsrc/menu/system/events_.qc delete mode 100644 data/qcsrc/menu/system/gc.qc delete mode 100644 data/qcsrc/menu/system/gc.qh delete mode 100644 data/qcsrc/menu/system/history.qc delete mode 100644 data/qcsrc/menu/system/history.qh delete mode 100644 data/qcsrc/menu/system/isframe.qc delete mode 100644 data/qcsrc/menu/system/isframe.qh delete mode 100644 data/qcsrc/menu/system/item.qh delete mode 100644 data/qcsrc/menu/system/mgfx.qc delete mode 100644 data/qcsrc/menu/system/mgfx.qh delete mode 100644 data/qcsrc/menu/system/parser.qc delete mode 100644 data/qcsrc/menu/system/parser.qh delete mode 100644 data/qcsrc/menu/system/structure.qc delete mode 100644 data/qcsrc/menu/system/structure.qh delete mode 100644 data/qcsrc/menu/todo delete mode 100644 data/qcsrc/menu/util/altstring.qc delete mode 100644 data/qcsrc/menu/util/altstring.qh delete mode 100644 data/qcsrc/menu/util/nfunction.qc delete mode 100644 data/qcsrc/menu/util/property.qc delete mode 100644 data/qcsrc/menu/util/property.qh delete mode 100644 data/qcsrc/menu/util/rect.qc delete mode 100644 data/qcsrc/menu/util/rect.qh delete mode 100644 data/qcsrc/menu/util/string.qc delete mode 100644 data/qcsrc/menu/util/string.qh delete mode 100644 data/qcsrc/menu/util/text.qc delete mode 100644 data/qcsrc/menu/util/text.qh delete mode 100644 data/qcsrc/menu/util/uid.qc delete mode 100644 data/qcsrc/menu/util/uid.qh delete mode 100644 data/qcsrc/menu/util/util.qh diff --git a/data/qcsrc/menu-div0test/menu.qh b/data/qcsrc/menu-div0test/menu.qh index 8aac63968..66b24979a 100644 --- a/data/qcsrc/menu-div0test/menu.qh +++ b/data/qcsrc/menu-div0test/menu.qh @@ -2,10 +2,7 @@ #define NULL (null_entity) -#ifndef MAPINFO -#warning Sorry, need to compile with -DMAPINFO enabled (server QC too, by the way) -! -#endif +#define MAPINFO // constants diff --git a/data/qcsrc/menu/base/cursor.qc b/data/qcsrc/menu/base/cursor.qc deleted file mode 100644 index 3df4bfde5..000000000 --- a/data/qcsrc/menu/base/cursor.qc +++ /dev/null @@ -1,102 +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; - local float lMenuMouseSpeed; - lMenuMouseSpeed = cvar("scmenu_mouse_speed"); - if(lMenuMouseSpeed == 0) - lMenuMouseSpeed = 1; - else - lMenuMouseSpeed = bound(0.7, lMenuMouseSpeed, 3.0); - - lRelPos = getmousepos(); - lRelPos = Gfx_ConToMen( lRelPos ); - - Cursor_Relative_x = lRelPos_x * Cursor_Speed_x * lMenuMouseSpeed; - Cursor_Relative_y = lRelPos_y * Cursor_Speed_y * lMenuMouseSpeed; - - 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/data/qcsrc/menu/base/cursor.qh b/data/qcsrc/menu/base/cursor.qh deleted file mode 100644 index 66f18e462..000000000 --- a/data/qcsrc/menu/base/cursor.qh +++ /dev/null @@ -1,33 +0,0 @@ -// NG Menu -// cursor qh - -const string CURSOR_PATH = "gfx/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; -// center of the cursor -vector Cursor_Offset = '0 0 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/data/qcsrc/menu/base/gfx.qc b/data/qcsrc/menu/base/gfx.qc deleted file mode 100644 index a35fc9b5a..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/base/gfx.qh b/data/qcsrc/menu/base/gfx.qh deleted file mode 100644 index 6a0f4b377..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/base/hostcache.qc b/data/qcsrc/menu/base/hostcache.qc deleted file mode 100644 index b2413440c..000000000 --- a/data/qcsrc/menu/base/hostcache.qc +++ /dev/null @@ -1,41 +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_NUMHUMANS = gethostcacheindexforkey( "numhumans" ); - SLIST_FIELD_NUMBOTS = gethostcacheindexforkey( "numbots" ); - 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/data/qcsrc/menu/base/hostcache.qh b/data/qcsrc/menu/base/hostcache.qh deleted file mode 100644 index c9e3c1dfd..000000000 --- a/data/qcsrc/menu/base/hostcache.qh +++ /dev/null @@ -1,28 +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_NUMHUMANS; -float SLIST_FIELD_NUMBOTS; -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/data/qcsrc/menu/base/key.qc b/data/qcsrc/menu/base/key.qc deleted file mode 100644 index e4ecef623..000000000 --- a/data/qcsrc/menu/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( "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( "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/data/qcsrc/menu/base/key.qh b/data/qcsrc/menu/base/key.qh deleted file mode 100644 index 51902d0b1..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/base/snd.qc b/data/qcsrc/menu/base/snd.qc deleted file mode 100644 index 7c6d3452d..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/base/snd.qh b/data/qcsrc/menu/base/snd.qh deleted file mode 100644 index 84f7fe56e..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/base/timer.qc b/data/qcsrc/menu/base/timer.qc deleted file mode 100644 index 6886acbc1..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/base/timer.qh b/data/qcsrc/menu/base/timer.qh deleted file mode 100644 index 52e631a00..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/_fx/float.qc b/data/qcsrc/menu/control/_fx/float.qc deleted file mode 100644 index 965d54120..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/_fx/fx.qh b/data/qcsrc/menu/control/_fx/fx.qh deleted file mode 100644 index abaae054f..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/_fx/interpol.qc b/data/qcsrc/menu/control/_fx/interpol.qc deleted file mode 100644 index feb046c69..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/_fx/vector.qc b/data/qcsrc/menu/control/_fx/vector.qc deleted file mode 100644 index 4bb9ff37f..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/automation/automation.qc b/data/qcsrc/menu/control/automation/automation.qc deleted file mode 100644 index 54d2ed018..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/automation/automation.qh b/data/qcsrc/menu/control/automation/automation.qh deleted file mode 100644 index 18107aa9e..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/automation/foreach.qc b/data/qcsrc/menu/control/automation/foreach.qc deleted file mode 100644 index 78600e2f9..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/automation/job.qc b/data/qcsrc/menu/control/automation/job.qc deleted file mode 100644 index 6537ae3ff..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/cinematic.qc b/data/qcsrc/menu/control/cinematic.qc deleted file mode 100644 index f0d3e47dc..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/constants.qh b/data/qcsrc/menu/control/constants.qh deleted file mode 100644 index fa7353678..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/container.qc b/data/qcsrc/menu/control/container.qc deleted file mode 100644 index 1a1f19323..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/custom.qc b/data/qcsrc/menu/control/custom.qc deleted file mode 100644 index 59ff1552f..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/data/altstring.qc b/data/qcsrc/menu/control/data/altstring.qc deleted file mode 100644 index 35d33610f..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/data/base.qc b/data/qcsrc/menu/control/data/base.qc deleted file mode 100644 index 7d52a5973..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/data/container.qc b/data/qcsrc/menu/control/data/container.qc deleted file mode 100644 index 373be5584..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/data/cvar.qc b/data/qcsrc/menu/control/data/cvar.qc deleted file mode 100644 index 86abedec8..000000000 --- a/data/qcsrc/menu/control/data/cvar.qc +++ /dev/null @@ -1,185 +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_ServerCvar -=================== -*/ - -void( string pValue ) Item_Data_ServerCvar_SendSyncCmd = { - cmd( self.syncCmd, " \"", pValue, "\"\n" ); -}; -//#define Item_Data_ServerCvar_SendSyncCmd(pValue) cmd( self.syncCmd, " \"", pValue, "\"\n" ) - -void() Item_Data_ServerCvar_Sync = -{ - String_EntitySet( self, _syncValue, cvar_string( self.cvarName ) ); - String_EntitySet( self, value, self._syncValue ); -}; - -void() Item_Data_ServerCvar_Send = -{ - Item_Data_ServerCvar_SendSyncCmd( self.value ); - String_EntitySet( self, _syncValue, self.value ); -}; - -void() Item_Data_ServerCvar_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_ServerCvar_Test_Start = -{ - Item_Data_ServerCvar_SendSyncCmd( self.value ); -}; - -void() Item_Data_ServerCvar_Test_End = -{ - Item_Data_ServerCvar_SendSyncCmd( self._syncValue ); -}; - -void() Item_Data_ServerCvar_Save_ExecString = { - Data_ExecString = String_Append( Data_ExecString, strcat( self.syncCmd, " \"", self.value, "\"\n" ) ); -}; - -void( float pEvent ) Item_Data_ServerCvar_DataEvent = -{ - switch( pEvent ) { - case ITEM_DATA_SYNC: - Item_Data_ServerCvar_Sync(); - break; - case ITEM_DATA_SEND: - Item_Data_ServerCvar_Send(); - break; - case ITEM_DATA_RESET: - Item_Data_ServerCvar_Reset(); - break; - case ITEM_DATA_TEST_START: - Item_Data_ServerCvar_Test_Start(); - break; - case ITEM_DATA_TEST_END: - Item_Data_ServerCvar_Test_End(); - break; - case ITEM_DATA_SAVE_EXECSTRING: - Item_Data_ServerCvar_Save_ExecString(); - break; - } -}; - -void() Item_Data_ServerCvar_Destroy = { - String_EntityFree( self, syncCmd ); - Item_Data_Cvar_Destroy(); -}; - -void() Item_Data_ServerCvar_Spawn = { - Item_Data_Cvar_Spawn(); - - String_EntityZone( self, syncCmd ); - - self._reinit = Item_Data_ServerCvar_Sync; - self._destroy = Item_Data_ServerCvar_Destroy; - self._dataEvent = Item_Data_ServerCvar_DataEvent; -}; - -/* -=================== -Item_Data_CvarCreateSave -=================== -*/ - -void() Item_Data_CvarCreateSave_Spawn = -{ - Item_Data_Cvar_Spawn(); - - registercvar( self.cvarName, self.defValue, CVAR_SAVE ); -}; diff --git a/data/qcsrc/menu/control/data/data.qh b/data/qcsrc/menu/control/data/data.qh deleted file mode 100644 index b1b65c020..000000000 --- a/data/qcsrc/menu/control/data/data.qh +++ /dev/null @@ -1,144 +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_Data_ServerCvar Item_Data_Cvar -.string syncCmd; - -void( float pEvent ) Item_Data_ServerCvar_DataEvent; -void() Item_Data_ServerCvar_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; -string() Item_DataLink_Value_ClampedText; -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/data/qcsrc/menu/control/data/fastresync.qc b/data/qcsrc/menu/control/data/fastresync.qc deleted file mode 100644 index e4aaf2587..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/data/router.qc b/data/qcsrc/menu/control/data/router.qc deleted file mode 100644 index 67174048f..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/data/text.qc b/data/qcsrc/menu/control/data/text.qc deleted file mode 100644 index 7cbb32af5..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/data/textswitch.qc b/data/qcsrc/menu/control/data/textswitch.qc deleted file mode 100644 index f317a25fa..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/data/texttime.qc b/data/qcsrc/menu/control/data/texttime.qc deleted file mode 100644 index 5b15dcf8f..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/data/textvalue.qc b/data/qcsrc/menu/control/data/textvalue.qc deleted file mode 100644 index 921ea837a..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/data/value.qc b/data/qcsrc/menu/control/data/value.qc deleted file mode 100644 index 04574bbc9..000000000 --- a/data/qcsrc/menu/control/data/value.qc +++ /dev/null @@ -1,70 +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_Value_ClampedText -=================== -*/ -string() Item_DataLink_Value_ClampedText = -{ - return Util_FloatToClampedText( self._realValue, self.stepValue ); -} - -/* -=================== -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_Value_ClampedText() ); - 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/data/qcsrc/menu/control/data/valueswitch.qc b/data/qcsrc/menu/control/data/valueswitch.qc deleted file mode 100644 index 5b894c8a8..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/fx/base.qc b/data/qcsrc/menu/control/fx/base.qc deleted file mode 100644 index 56cafa905..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/fx/fx.qh b/data/qcsrc/menu/control/fx/fx.qh deleted file mode 100644 index 9dbf0ab02..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/items.qh b/data/qcsrc/menu/control/items.qh deleted file mode 100644 index 1fc3c4842..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/link.qc b/data/qcsrc/menu/control/link.qc deleted file mode 100644 index 05d68e126..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/visual/button.qc b/data/qcsrc/menu/control/visual/button.qc deleted file mode 100644 index 3dfd53c87..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/visual/editbox.qc b/data/qcsrc/menu/control/visual/editbox.qc deleted file mode 100644 index 7fdcaafa3..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/visual/floating.qc b/data/qcsrc/menu/control/visual/floating.qc deleted file mode 100644 index a5d8128cb..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/visual/label.qc b/data/qcsrc/menu/control/visual/label.qc deleted file mode 100644 index e5c5cb07b..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/visual/list.qc b/data/qcsrc/menu/control/visual/list.qc deleted file mode 100644 index 1448baff2..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/visual/multilabel.qc b/data/qcsrc/menu/control/visual/multilabel.qc deleted file mode 100644 index 45791b9a8..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/visual/picture.qc b/data/qcsrc/menu/control/visual/picture.qc deleted file mode 100644 index b0beca409..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/visual/rect.qc b/data/qcsrc/menu/control/visual/rect.qc deleted file mode 100644 index 0b2785366..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/visual/scrollbar.qc b/data/qcsrc/menu/control/visual/scrollbar.qc deleted file mode 100644 index e48dc4a8f..000000000 --- a/data/qcsrc/menu/control/visual/scrollbar.qc +++ /dev/null @@ -1,163 +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 = '1 1 1'; -const vector _VSB_SCROLLAREA_COLOR = '1 1 1'; - -// todo: maybe use fields to retrieve the picture names? -const string _VSB_SCOLLER_PICTURE = "gfx/scroll_scroller"; -const string _VSB_SCROLLAREA_PICTURE = "gfx/scroll_background"; -const string _VSB_BUTTON_PICTURE = "gfx/scroll_up"; - -// 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_DrawPicture( lPosition, _VSB_BUTTON_PICTURE, 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_DrawPicture( lPosition, _VSB_SCROLLAREA_PICTURE,lSize, _VSB_SCROLLAREA_COLOR, 1.0, 0 ); - - lPosition_y = self.pos_y + self.size_y - _VSB_DOWN_HEIGHT; - lSize_y = _VSB_DOWN_HEIGHT; - Menu_DrawPicture( lPosition, _VSB_BUTTON_PICTURE, 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_DrawPicture( lPosition, _VSB_SCOLLER_PICTURE, 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/data/qcsrc/menu/control/visual/slider.qc b/data/qcsrc/menu/control/visual/slider.qc deleted file mode 100644 index 02063f6a4..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/visual/switchbutton.qc b/data/qcsrc/menu/control/visual/switchbutton.qc deleted file mode 100644 index 30ce55aea..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/visual/valuebutton.qc b/data/qcsrc/menu/control/visual/valuebutton.qc deleted file mode 100644 index 53a2e22c7..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/visual/visual.qh b/data/qcsrc/menu/control/visual/visual.qh deleted file mode 100644 index 2f784e19b..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/window/arrangement.qc b/data/qcsrc/menu/control/window/arrangement.qc deleted file mode 100644 index 5d75b7c5b..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/window/eventwindow.qc b/data/qcsrc/menu/control/window/eventwindow.qc deleted file mode 100644 index df2b87753..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/window/frame.qc b/data/qcsrc/menu/control/window/frame.qc deleted file mode 100644 index 9b3dac31a..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/window/layout.qc b/data/qcsrc/menu/control/window/layout.qc deleted file mode 100644 index 04dcfec3c..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/window/reference.qc b/data/qcsrc/menu/control/window/reference.qc deleted file mode 100644 index d33a1baa2..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/window/scroll.qc b/data/qcsrc/menu/control/window/scroll.qc deleted file mode 100644 index 8316ae5a2..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/window/window.qc b/data/qcsrc/menu/control/window/window.qc deleted file mode 100644 index b90f88e38..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/control/window/windows.qh b/data/qcsrc/menu/control/window/windows.qh deleted file mode 100644 index bd0d6e1a4..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/campaign.qc b/data/qcsrc/menu/custom/campaign.qc deleted file mode 100644 index a37380ded..000000000 --- a/data/qcsrc/menu/custom/campaign.qc +++ /dev/null @@ -1,167 +0,0 @@ -string campaign_index_var; - -void Campaign_Init() -{ - campaign_name = strzone(cvar_string("g_campaign_name")); - campaign_index_var = strzone(strcat("g_campaign", campaign_name, "_index")); - CampaignFile_Load(0, CAMPAIGN_MAX_ENTRIES); -} - -void Campaign_Shutdown() -{ - CampaignFile_Unload(); - strunzone(campaign_index_var); - strunzone(campaign_name); - campaign_name = ""; -} - -void Campaign_DumpLevels() -{ - float i; - float imax; - imax = cvar(campaign_index_var) - campaign_offset; - if(imax >= campaign_entries) - imax = campaign_entries - 1; - for(i = 0; i <= imax; ++i) - { - print("Level "); - print(ftos(i + campaign_offset)); - print(": "); - print(campaign_gametype[i]); - print("_"); - print(campaign_mapname[i]); - print(" - "); - print(campaign_shortdesc[i]); - print("\n"); - } - print("\n"); -} - -void Campaign_JumpLevel(float n) -{ - float current; - // 1. current level? - current = cvar(campaign_index_var); - if(n > current) - n = current; - if(n < 0) - n = current; - - n = n - campaign_offset; - if(n >= 0 && n < campaign_entries) - CampaignSetup(n); -} - -float campaign_entry_index; - -void() Nex_Action_Campaign_Start = -{ - Campaign_JumpLevel(campaign_entry_index); - - // force the menu to hide - m_hide(); -}; - -void() Nex_Action_Campaign_Update = -{ - local entity item; - local string desc; - local float handle; - local string line; - - handle = fopen(strcat("maps/campaign", campaign_name, ".txt"), FILE_READ); - if(handle >= 0) { - while ((line = fgets(handle))) { - if(substring(line, 0, 12) == "\"//campaign:") { - desc = substring(line, 12, (strlen(line) - (12 + 1))); - break; - } else { - continue; - } - } - } - fclose(handle); - - item = Menu_GetItem("ShortDescriptionCampaign"); - desc = strcat("Campaign: ", desc); - String_EntitySet(item, text, desc); - - item = Menu_GetItem("ShortDescriptionEntry"); - desc = campaign_shortdesc[campaign_entry_index]; - desc = strcat("Level ", ftos(campaign_entry_index + 1), ": ", desc); - String_EntitySet(item, text, desc); - - item = Menu_GetItem("LongDescriptionEntry"); - desc = wordwrap(campaign_longdesc[campaign_entry_index], item.wrap - 1); - String_EntitySet(item, text, desc); - - item = Menu_GetItem("PictureEntry"); - String_EntitySet(item, picture, strcat("maps/",campaign_mapname[campaign_entry_index], ".jpg")); -}; - -void(float index) Nex_Action_Campaign_Find_Entry = -{ - campaign_entry_index+=index; - if (campaign_entry_index < 0) campaign_entry_index = min((campaign_entries - 1), cvar(campaign_index_var)); - if (campaign_entry_index > min((campaign_entries - 1), cvar(campaign_index_var))) campaign_entry_index = 0; -} - -void() Nex_Action_Campaign_Prev_Entry = -{ - Nex_Action_Campaign_Find_Entry(-1); - Nex_Action_Campaign_Update(); -}; - -void() Nex_Action_Campaign_Next_Entry = -{ - Nex_Action_Campaign_Find_Entry(1); - Nex_Action_Campaign_Update(); -}; - -void() Nex_Action_Campaign_Init = -{ - Campaign_Init(); - - campaign_entry_index = cvar(campaign_index_var); - Nex_Action_Campaign_Find_Entry(0); // set campaign_index_var back into range if too high or low - - Nex_Action_Campaign_Update(); -}; - -void(float index) Nex_Action_Campaign_Find_Campaign = -{ - local float handle; - local float count; - float i; - local string filename; - handle = search_begin("maps/campaign*.txt", true, true); - if(handle >= 0) { - count = search_getsize(handle); - for (i = 0; i < count; i++) { - filename = search_getfilename(handle, i); - if (filename == strcat("maps/campaign", campaign_name, ".txt")) { - index+=i; - if (index < 0) index = (count - 1); - if (index > (count - 1)) index = 0; - filename = search_getfilename(handle, index); - break; - } - } - count = strlen(filename); - cvar_set("g_campaign_name", substring(filename, 13, (count - (13 + 4)))); - } - search_end(handle); - Nex_Action_Campaign_Init(); -} - -void() Nex_Action_Campaign_Prev_Campaign = -{ - Nex_Action_Campaign_Find_Campaign(-1); - Nex_Action_Campaign_Update(); -}; - -void() Nex_Action_Campaign_Next_Campaign = -{ - Nex_Action_Campaign_Find_Campaign(1); - Nex_Action_Campaign_Update(); -}; diff --git a/data/qcsrc/menu/custom/campaign.qh b/data/qcsrc/menu/custom/campaign.qh deleted file mode 100644 index abc7711f7..000000000 --- a/data/qcsrc/menu/custom/campaign.qh +++ /dev/null @@ -1,9 +0,0 @@ -// some preprocessoir magic to make the common campaign gamec code work: -#define CAMPAIGN_MAX_ENTRIES 64 -#define localcmd cmd - -// jump to a level -void Campaign_Init(); -void Campaign_Shutdown(); -void Campaign_DumpLevels(); // debug -void Campaign_JumpLevel(float n); // call with -1 to play CURRENT level diff --git a/data/qcsrc/menu/custom/color.qm b/data/qcsrc/menu/custom/color.qm deleted file mode 100644 index 336825dc3..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/creategame.qm b/data/qcsrc/menu/custom/creategame.qm deleted file mode 100644 index 9c7e85d34..000000000 --- a/data/qcsrc/menu/custom/creategame.qm +++ /dev/null @@ -1,450 +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 \"", lItem.value, "\"\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 ", exit_cfg, "\n" ); - } - // exec the game reset cfg and then the mapcfg - cmd( "exec game_reset.cfg \nwait \nexec \"maps/", String_Normal( Util_GetAltStringItem( lItem.valueList, 0 ) ), ".mapcfg\"\n" ); - - // force the menu to hide - m_hide(); -}; - -void() Nex_Action_Instant_Action = -{ - local string exit_cfg; - local float randommap; - local float lSearchHandle; - local float lSearchSize; - local string lFilename; - - lSearchHandle = search_begin( "maps/*.instantaction", true, true ); - if( lSearchHandle < 0 ) - return; - - lSearchSize = search_getsize( lSearchHandle ); - randommap = random() * lSearchSize; - lFilename = search_getfilename( lSearchHandle, randommap ); - - search_end( lSearchHandle ); - - // 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 ", exit_cfg, "\n" ); - } - // exec the game reset cfg and then the mapcfg - cmd( strcat( "exec game_reset.cfg \n wait \n exec \"", lFilename, "\"\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/data/qcsrc/menu/custom/creategame/creategame.qh b/data/qcsrc/menu/custom/creategame/creategame.qh deleted file mode 100644 index 5409e4ef5..000000000 --- a/data/qcsrc/menu/custom/creategame/creategame.qh +++ /dev/null @@ -1,71 +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; - -// 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/data/qcsrc/menu/custom/creategame/filelist.qc b/data/qcsrc/menu/custom/creategame/filelist.qc deleted file mode 100644 index 998c08dff..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/creategame/maps.qc b/data/qcsrc/menu/custom/creategame/maps.qc deleted file mode 100644 index 0a8386cd5..000000000 --- a/data/qcsrc/menu/custom/creategame/maps.qc +++ /dev/null @@ -1,716 +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; - lSearchCounter = 0; - for( lSearchSize = search_getsize( lSearchHandle ); - 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( "\n--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/data/qcsrc/menu/custom/creategame/mods.qc b/data/qcsrc/menu/custom/creategame/mods.qc deleted file mode 100644 index 1b9331d49..000000000 --- a/data/qcsrc/menu/custom/creategame/mods.qc +++ /dev/null @@ -1,85 +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; - } - - lSearchCounter = 0; - for( lSearchSize = search_getsize( lSearchHandle ); - 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/data/qcsrc/menu/custom/credits.qc b/data/qcsrc/menu/custom/credits.qc deleted file mode 100644 index 90a262f3a..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/credits.qh b/data/qcsrc/menu/custom/credits.qh deleted file mode 100644 index 972a3f303..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/credits.qm b/data/qcsrc/menu/custom/credits.qm deleted file mode 100644 index 36722d0b4..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/custom.qh b/data/qcsrc/menu/custom/custom.qh deleted file mode 100644 index 748ad193d..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/demos.qm b/data/qcsrc/menu/custom/demos.qm deleted file mode 100644 index 75f471af0..000000000 --- a/data/qcsrc/menu/custom/demos.qm +++ /dev/null @@ -1,23 +0,0 @@ -// Property of Alientrap -// custom/demos.qm - -void() Nex_Demos_Start = -{ - local entity lFileList; - lFileList = Menu_GetItem( "::Data::Demos::FileList::Demos" ); - - if (lFileList.value) { - cmd( strcat( "playdemo \"", lFileList.selected, lFileList.value, ".", lFileList.normal, "\"\n" ) ); - - // force the menu to hide - m_hide(); - } -}; - -void() Nex_Demos_SyncData = -{ - if( self._realValue < Timer_Time && self._realValue > 0.0 ) { - Raise_DataEvent( Menu_GetItem( "::Data::Demos" ), ITEM_DATA_SYNC ); - self._realValue = 0.0; - } -}; diff --git a/data/qcsrc/menu/custom/extresponse.qc b/data/qcsrc/menu/custom/extresponse.qc deleted file mode 100644 index 27902af92..000000000 --- a/data/qcsrc/menu/custom/extresponse.qc +++ /dev/null @@ -1,127 +0,0 @@ -bool _Nex_ExtResponseSystem_RequestsSent; -bool _Nex_ExtResponseSystem_VersionHandled; -bool _Nex_ExtResponseSystem_BanlistHandled; -string _Nex_ExtResponseSystem_UpdateTo; -float _Nex_ExtResponseSystem_RetryTime; -float _Nex_ExtResponseSystem_RetryTime_LastDelay; -bool _Nex_ExtResponseSystem_UpdateStringSet; -bool _Nex_ExtResponseSystem_Initialized; - -void() Item_Nex_ExtResponseSystem_SendQuery = -{ - dprint("Sending extended response requests...\n"); - localcmd(strcat("packet update.alientrap.org:27950 \"getExtResponse checkUpdates nexuiz ", cvar_string("g_nexuizversion"), "\"\n")); - localcmd(strcat("packet update.alientrap.org:27950 \"getExtResponse getBanlist nexuiz\"\n")); - _Nex_ExtResponseSystem_RequestsSent = TRUE; - _Nex_ExtResponseSystem_RetryTime_LastDelay = _Nex_ExtResponseSystem_RetryTime_LastDelay * 2 + 1; - _Nex_ExtResponseSystem_RetryTime = Timer_Time + _Nex_ExtResponseSystem_RetryTime_LastDelay; -} - -void(float argc) Item_Nex_ExtResponseSystem_Parse = -{ - float i; - string banlist; - dprint("Received extended response packet from ", argv(0), "\n"); - if(!_Nex_ExtResponseSystem_RequestsSent) - { - dprint(" But I haven't sent a request yet! Ignoring.\n"); - return; - } - if(argv(1) == "noUpdateAvailable") - { - if(_Nex_ExtResponseSystem_VersionHandled) - { - dprint(" duplicated update notice, ignored\n"); - return; - } - _Nex_ExtResponseSystem_VersionHandled = TRUE; - } - else if(argv(1) == "updateAvailable") - { - if(_Nex_ExtResponseSystem_VersionHandled) - { - dprint(" duplicated update notice, ignored\n"); - return; - } - _Nex_ExtResponseSystem_VersionHandled = TRUE; - _Nex_ExtResponseSystem_UpdateTo = strzone(argv(2)); // note: only one packet can be handled, so this can't be a leak - //Nex_MessageBox("Update available!", strcat("We recommend you to download Nexuiz ", _Nex_ExtResponseSystem_UpdateTo, " from http://www.nexuiz.com/"), "Ok", "Download in background", Util_NullFunction, Util_NullFunction); - } - else if(argv(1) == "banlist") - { - if(_Nex_ExtResponseSystem_BanlistHandled) - { - dprint(" duplicated banlist notice\n"); - return; - } - _Nex_ExtResponseSystem_BanlistHandled = TRUE; - dprint(" BANLIST RECEIVED:"); - - if(cvar_string("net_banlist") == cvar_string("_alientrap_net_banlist")) - { - banlist = ""; // IP of www.alientrap.org - for(i = 0; i < argc - 2; ++i) - { - banlist = strcat(banlist, argv(i + 2), " "); - dprint(" ", argv(i + 2)); - } - dprint(" (", ftos(i), " items)\n"); - cvar_set("net_banlist", banlist); - cvar_set("_alientrap_net_banlist", banlist); - } - else - { - for(i = 0; i < argc - 2; ++i) - dprint(" ", argv(i + 2)); - dprint(" (", ftos(i), " items; overridden by user setting)\n"); - } - } - else - dprint(" UNKNOWN RESPONSE TYPE: ", argv(1), "\n"); -} - -void() Item_Nex_ExtResponseSystem_CheckForResponse = -{ - local string s; - local float argc; - while(strlen((s = getextresponse()))) - { - argc = tokenize(s); - Item_Nex_ExtResponseSystem_Parse(argc); - } -} - -void() Item_Nex_ExtResponseSystem_Update = -{ - Item_Nex_ExtResponseSystem_CheckForResponse(); - - if(!_Nex_ExtResponseSystem_VersionHandled) - if(Timer_Time > _Nex_ExtResponseSystem_RetryTime) - Item_Nex_ExtResponseSystem_SendQuery(); - - if(_Nex_ExtResponseSystem_UpdateTo) - if(!_Nex_ExtResponseSystem_UpdateStringSet) - { - local string filler; - local float count; - - filler = ""; - for(count = strlen(_Nex_ExtResponseSystem_UpdateTo); count < 5; ++count) - filler = strcat(filler, " "); - - String_EntitySet(self, text, strcat(filler, "Update to Nexuiz ", _Nex_ExtResponseSystem_UpdateTo, " on:")); - self.size = '0 0 0'; - _Nex_ExtResponseSystem_UpdateStringSet = TRUE; - } - - Item_Label_Update(); -} - -void() Item_Nex_ExtResponseSystem_Spawn = -{ - if(_Nex_ExtResponseSystem_Initialized) - objerror("Item_Nex_ExtResponseSystem is a singleton!"); - _Nex_ExtResponseSystem_Initialized = TRUE; - Item_Label_Spawn(); - self._update = Item_Nex_ExtResponseSystem_Update; -} diff --git a/data/qcsrc/menu/custom/extresponse.qh b/data/qcsrc/menu/custom/extresponse.qh deleted file mode 100644 index 1c5427259..000000000 --- a/data/qcsrc/menu/custom/extresponse.qh +++ /dev/null @@ -1,7 +0,0 @@ -// Property of Alientrap -// custom/extresponse.qh - -// Item_Nex_ExtResponseSystem (singleton) Item_Label - -void() Item_Nex_ExtResponseSystem_Update; -void() Item_Nex_ExtResponseSystem_Spawn; diff --git a/data/qcsrc/menu/custom/gecko.qm b/data/qcsrc/menu/custom/gecko.qm deleted file mode 100644 index 8cf9e2e25..000000000 --- a/data/qcsrc/menu/custom/gecko.qm +++ /dev/null @@ -1,53 +0,0 @@ -// Andreas Kirsch 2007 -// Im putting it into custom because its not really engineered but simply hacked together -.string targetURL; - -var float _gecko_instanceNumber; - -void() Item_Gecko_Draw = { - Menu_DrawPicture( self.pos, self.picture, self.size, self.color, self.alpha, self.drawFlag ); -}; - -void() Item_Gecko_Destroy = -{ - if( self.picture ) { - gecko_destroy( self.picture ); - } - - String_EntityFree( self, picture ); -}; - -void() Item_Gecko_Update = { - // "normalize" the mouse position - local vector lNormalizedPosition; - lNormalizedPosition_x = (Menu_Cursor_Position_x - self.pos_x) / self.size_x; - lNormalizedPosition_y = (Menu_Cursor_Position_y - self.pos_y) / self.size_y; - lNormalizedPosition_z = 0.0; - - if( Util_InRect( lNormalizedPosition, '0 0 0', '1 1 0' ) ) { - gecko_mousemove( self.picture, lNormalizedPosition_x, lNormalizedPosition_y ); - } -}; - -bool( float pKey, float pAscii ) Item_Gecko_Key = { - if( pKey == K_ESCAPE ) { - return false; - } - return gecko_keyevent( self.picture, pKey, GECKO_BUTTON_PRESS ); -}; - -void() Item_Gecko_Spawn = { - // targetURL wont be changed anyway... - self.picture = String_Zone( strcat( "_dynamic/gecko/menu/", ftos( _gecko_instanceNumber ) ) ); - _gecko_instanceNumber += 1; - - gecko_create( self.picture ); - gecko_navigate( self.picture, self.targetURL ); - - self._destroy = Item_Gecko_Destroy; - self._key = Item_Gecko_Key; - self._draw = Item_Gecko_Draw; - self._update = Item_Gecko_Update; -}; - - diff --git a/data/qcsrc/menu/custom/globalkey.qm b/data/qcsrc/menu/custom/globalkey.qm deleted file mode 100644 index 826acac1f..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/joingame.qc b/data/qcsrc/menu/custom/joingame.qc deleted file mode 100644 index 3cb2a868d..000000000 --- a/data/qcsrc/menu/custom/joingame.qc +++ /dev/null @@ -1,153 +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 lHum, lNum, lMax; - local float lHumans, lBots; - - if( HostCache_ViewCount <= self._parent.stepValue ) - return; - lHumans = gethostcachenumber( SLIST_FIELD_NUMHUMANS, self._parent.stepValue ); - lBots = gethostcachenumber( SLIST_FIELD_NUMBOTS, self._parent.stepValue ); - if (lBots >= 0) lHum = ftos( lHumans ); else lHum = "?"; - lNum = ftos( gethostcachenumber( SLIST_FIELD_NUMPLAYERS, self._parent.stepValue ) ); - lMax = ftos( gethostcachenumber( SLIST_FIELD_MAXPLAYERS, self._parent.stepValue ) ); - - String_EntitySet( self, text, strcat( lHum, "/", lNum, "/", lMax ) ); - - Item_Label_Update(); -}; - -void() Item_Nex_HostCache_Players_Spawn = -{ - Item_Label_Spawn(); - - self._update = Item_Nex_HostCache_Players_Update; -}; - -////////////////////////////////// -// Item_Nex_HostCache_Ping -/////// - -const vector HOSTCACHE_FAST_PING_COLOR = '0.0 1.0 0.0'; -const vector HOSTCACHE_MEDIUM_PING_COLOR = '1.0 1.0 0.0'; -const vector HOSTCACHE_SLOW_PING_COLOR = '1.0 0.0 0.0'; - -const float HOSTCACHE_FAST_PING = 90; -const float HOSTCACHE_SLOW_PING = 150; - -void() Item_Nex_HostCache_Ping_Update = -{ - local float ping; - - Item_Nex_HostCache_ValueField_Update(); - - // AK 06 yes I know its not fast.. but its shorter.. - ping = stof( self.text ); - if( ping < HOSTCACHE_FAST_PING ) { - self.color = HOSTCACHE_FAST_PING_COLOR; - } else if( ping > HOSTCACHE_SLOW_PING ) { - self.color = HOSTCACHE_SLOW_PING_COLOR; - } else { - self.color = HOSTCACHE_MEDIUM_PING_COLOR; - } -} - -void() Item_Nex_HostCache_Ping_Spawn = -{ - Item_Nex_HostCache_ValueField_Spawn(); - - self._update = Item_Nex_HostCache_Ping_Update; -}; - diff --git a/data/qcsrc/menu/custom/joingame.qh b/data/qcsrc/menu/custom/joingame.qh deleted file mode 100644 index c56e8dc81..000000000 --- a/data/qcsrc/menu/custom/joingame.qh +++ /dev/null @@ -1,35 +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; - -// Item_Nex_HostCache_Ping Item_Nex_HostCache_ValueField -void() Item_Nex_HostCache_Ping_Update; -void() Item_Nex_HostCache_Ping_Spawn; - diff --git a/data/qcsrc/menu/custom/joingame.qm b/data/qcsrc/menu/custom/joingame.qm deleted file mode 100644 index 02fb9cd46..000000000 --- a/data/qcsrc/menu/custom/joingame.qm +++ /dev/null @@ -1,244 +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 \"", gethostcachestring( SLIST_FIELD_CNAME, self.stepValue ), "\"\n" ); - - m_hide(); -}; - -void() Nex_Action_RefreshSlist = -{ - HostCache_RefreshHostCache(); -}; - -void() Nex_Action_JumpToPlayerSetup; -void() Nex_Action_JumpToJoinGame = -{ - local entity lItem; - - if(cvar_string("_cl_name") == "Player") - { - Nex_Action_JumpToPlayerSetup(); - return; - } - - 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_PING, 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 == "numbots" ) { - lField = SLIST_FIELD_NUMBOTS; - lIsStringArg = false; - } - else if( lToken == "numhumans" ) { - lField = SLIST_FIELD_NUMHUMANS; - 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/data/qcsrc/menu/custom/key.qc b/data/qcsrc/menu/custom/key.qc deleted file mode 100644 index 646fbdd3a..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/key.qh b/data/qcsrc/menu/custom/key.qh deleted file mode 100644 index 18ef4c621..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/key.qm b/data/qcsrc/menu/custom/key.qm deleted file mode 100644 index 123ff46b5..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/messagebox.qc b/data/qcsrc/menu/custom/messagebox.qc deleted file mode 100644 index abea0b885..000000000 --- a/data/qcsrc/menu/custom/messagebox.qc +++ /dev/null @@ -1,85 +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'; - // select the left button since it has to be available - Menu_Select( lItem, false ); - - lItem = Menu_GetItem( "MessageBoxWnd::Layout::Buttons::Right" ); - String_EntitySet( lItem, normal, pRightButton ); - lItem.size = '0 0 0'; - if( strlen( pRightButton ) != 0 ) { - // select the right button since we prefer it (standard scheme is Yes No or Ok Cancel) - Menu_Select( lItem, false ); - - if( lItem.flag & FLAG_HIDDEN ) { - lItem.flag = lItem.flag - FLAG_HIDDEN; - } - } else { - 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; - } -}; - -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/data/qcsrc/menu/custom/messagebox.qh b/data/qcsrc/menu/custom/messagebox.qh deleted file mode 100644 index 6683b748d..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/option.qm b/data/qcsrc/menu/custom/option.qm deleted file mode 100644 index a949375b4..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/player.qm b/data/qcsrc/menu/custom/player.qm deleted file mode 100644 index 70024a41a..000000000 --- a/data/qcsrc/menu/custom/player.qm +++ /dev/null @@ -1,82 +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 ); -}; - -// jumps to Player setup -void() Nex_Action_JumpToPlayerSetup = -{ - local entity lItem; - lItem = Menu_GetItem( "Normal::Panel" ); - String_EntitySet( lItem, link, "Options" ); - - Raise_Update( lItem ); - Menu_UpdateRunFlags(); - Menu_JumpToWindow( lItem._link, false, false ); - - lItem = Menu_GetItem( "Options::Dummy::Panel::Player" ); - Nex_MakeOnlyVisible( lItem ); - Menu_JumpToWindow( lItem, false, false ); - - Nex_MessageBox( "Player setup", "Enter a player name first!", "OK", "", Util_NullFunction, Util_NullFunction); -}; diff --git a/data/qcsrc/menu/custom/player/avatar.qc b/data/qcsrc/menu/custom/player/avatar.qc deleted file mode 100644 index d91f14081..000000000 --- a/data/qcsrc/menu/custom/player/avatar.qc +++ /dev/null @@ -1,237 +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; - lSearchCounter = 0; - for( lSearchSize = search_getsize( lSearchHandle ); - 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( "playermodel \"", self._link.target, "\";" ); - cmd( "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/data/qcsrc/menu/custom/player/color.qc b/data/qcsrc/menu/custom/player/color.qc deleted file mode 100644 index 0cd722ab6..000000000 --- a/data/qcsrc/menu/custom/player/color.qc +++ /dev/null @@ -1,178 +0,0 @@ -// Property of Alientrap/AK -// custom/player/color.qc - -/* -color/_cl_color - -color = shirt * 16 + pants -*/ - -/* -=================== -Item_Data_Nex_Color -=================== -*/ - -void( string pValue ) _IDNC_SendSyncCmd = { - local float lPants, lShirt, lCombined; - - lCombined = stof( pValue ); - lPants = lCombined & 0x0F; - lShirt = (lCombined & 0xF0) / 16; - - cmd( "color ", ftos( lShirt ), " ", ftos( lPants ), "\n" ); - //print( "%color ", ftos( lPants ), " ", ftos( lShirt ), "\n" ); -}; - -void() _IDNC_Sync = -{ - String_EntitySet( self, value, cvar_string( "_cl_color" ) ); - String_EntitySet( self, _syncValue, self.value ); -}; - -void() _IDNC_Send = -{ - _IDNC_SendSyncCmd( self.value ); - - String_EntitySet( self, _syncValue, self.value ); -}; - -void() _IDNC_Test_Start = -{ - _IDNC_SendSyncCmd( self.value ); -}; - -void() _IDNC_Test_End = -{ - String_EntitySet( self, value, self._syncValue ); - _IDNC_SendSyncCmd( self.value ); -}; - -void() _IDNC_Reset = -{ - String_EntitySet( self, value, self.defValue ); - _IDNC_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; -}; - -/* -=================== -Item_DataLink_Nex_PantsColor -=================== -*/ - -void( float pEvent ) Item_DataLink_Nex_PantsColor_DataEvent = -{ - Item_DataLink_Update(); - - if( pEvent == ITEM_DATALINK_SET ) { - Item_DataLink_Value_Clamp(); - if( self._link ) { - local float lShirt; - local float lNewColor; - - self._realValue = stof( self.value ); - - lShirt = (stof( self._link.value ) & 0xF0) / 16; - lNewColor = self._realValue + lShirt * 16; - - self._link._realValue = lNewColor; - String_EntitySet( self._link, value, Util_FloatToClampedText( lNewColor, 1.0 ) ); - - 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 ) & 0x0F; - - Item_DataLink_Value_Clamp(); - String_EntitySet( self, value, Item_DataLink_Value_ClampedText() ); - } else - Raise_DataEvent( self._link, pEvent ); -}; - -void() Item_DataLink_Nex_PantsColor_Spawn = -{ - Item_DataLink_Value_Spawn(); - - self.stepValue = 1.0; - - self._dataEvent = Item_DataLink_Nex_PantsColor_DataEvent; -}; - -/* -=================== -Item_DataLink_Nex_ShirtColor -=================== -*/ - -void( float pEvent ) Item_DataLink_Nex_ShirtColor_DataEvent = -{ - Item_DataLink_Update(); - - if( pEvent == ITEM_DATALINK_SET ) { - Item_DataLink_Value_Clamp(); - if( self._link ) { - local float lPants; - local float lNewColor; - - self._realValue = stof( self.value ); - - lPants = stof( self._link.value ) & 0x0F; - lNewColor = self._realValue * 16 + lPants; - - self._link._realValue = lNewColor; - String_EntitySet( self._link, value, Util_FloatToClampedText( lNewColor, 1.0 ) ); - - 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 ) & 0xF0) / 16; - - Item_DataLink_Value_Clamp(); - String_EntitySet( self, value, Item_DataLink_Value_ClampedText() ); - } else - Raise_DataEvent( self._link, pEvent ); -}; - -void() Item_DataLink_Nex_ShirtColor_Spawn = -{ - Item_DataLink_Value_Spawn(); - - self.stepValue = 1.0; - - self._dataEvent = Item_DataLink_Nex_ShirtColor_DataEvent; -}; diff --git a/data/qcsrc/menu/custom/player/player.qh b/data/qcsrc/menu/custom/player/player.qh deleted file mode 100644 index dc5d088a2..000000000 --- a/data/qcsrc/menu/custom/player/player.qh +++ /dev/null @@ -1,36 +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_ShirtColor Item_DataLink_Value -void( float pEvent ) Item_DataLink_Nex_ShirtColor_DataEvent; -void() Item_DataLink_Nex_ShirtColor_Spawn; - -// see control/data/data.qh -// Item_Data_Nex_PantsColor Item_DataLink_Value -void( float pEvent ) Item_DataLink_Nex_PantsColor_DataEvent; -void() Item_DataLink_Nex_PantsColor_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/data/qcsrc/menu/custom/quit.qm b/data/qcsrc/menu/custom/quit.qm deleted file mode 100644 index 81ae77c03..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/sound.qm b/data/qcsrc/menu/custom/sound.qm deleted file mode 100644 index 1ecf5469a..000000000 --- a/data/qcsrc/menu/custom/sound.qm +++ /dev/null @@ -1,7 +0,0 @@ -// Property of Alientrap -// custom/sound.qm - -void() Nex_Action_Sound_Apply = -{ - cmd( "snd_restart\n" ); -}; diff --git a/data/qcsrc/menu/custom/stresstest.qm b/data/qcsrc/menu/custom/stresstest.qm deleted file mode 100644 index b96c6c8a6..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/util.qm b/data/qcsrc/menu/custom/util.qm deleted file mode 100644 index 845ac5f4e..000000000 --- a/data/qcsrc/menu/custom/util.qm +++ /dev/null @@ -1,48 +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 ); -}; - -// execute a console cmd on action -void() Nex_Action_ConsoleCmd_Destroy = -{ - String_EntityFree( self, syncCmd ); -}; - -void() Nex_Action_ConsoleCmd_Action = -{ - cmd( self.syncCmd ); -} - -void() Nex_Action_ConsoleCmd = -{ - String_EntityZone( self, syncCmd ); - - self.destroy = Nex_Action_ConsoleCmd_Destroy; - self.action = Nex_Action_ConsoleCmd_Action; -}; diff --git a/data/qcsrc/menu/custom/video.qc b/data/qcsrc/menu/custom/video.qc deleted file mode 100644 index bd75a1ec9..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/video.qh b/data/qcsrc/menu/custom/video.qh deleted file mode 100644 index 8b6049911..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/video.qm b/data/qcsrc/menu/custom/video.qm deleted file mode 100644 index f6bcd22d7..000000000 --- a/data/qcsrc/menu/custom/video.qm +++ /dev/null @@ -1,14 +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::VSync" ), ITEM_DATA_SEND ); - Raise_DataEvent( Menu_GetItem( "::Data::Video::Resolution" ), ITEM_DATA_SEND ); - Raise_DataEvent( Menu_GetItem( "::Data::Video::BPP" ), ITEM_DATA_SEND ); - Raise_DataEvent( Menu_GetItem( "::Data::Video::Anisotropy" ), ITEM_DATA_SEND ); - Raise_DataEvent( Menu_GetItem( "::Data::Video::Picmip" ), ITEM_DATA_SEND ); - Raise_DataEvent( Menu_GetItem( "::Data::Video::PicmipWorld" ), ITEM_DATA_SEND ); - cmd( "vid_restart\n" ); -}; diff --git a/data/qcsrc/menu/custom/visible.qc b/data/qcsrc/menu/custom/visible.qc deleted file mode 100644 index 564f618fb..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/custom/visible.qm b/data/qcsrc/menu/custom/visible.qm deleted file mode 100644 index 9afc22b48..000000000 --- a/data/qcsrc/menu/custom/visible.qm +++ /dev/null @@ -1,103 +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_JumpToPlayerSetup; -void() Nex_Action_SetNormalPanelLink_Action = -{ - local entity lItem; - - if(self.target == "CreateGame" && cvar_string("_cl_name") == "Player") - { - Nex_Action_JumpToPlayerSetup(); - return; - } - - 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/data/qcsrc/menu/gamecommand.qc b/data/qcsrc/menu/gamecommand.qc deleted file mode 100644 index e6c7d8448..000000000 --- a/data/qcsrc/menu/gamecommand.qc +++ /dev/null @@ -1,46 +0,0 @@ -void GameCommand_Init() -{ - // make gg call menu QC commands - localcmd("alias qc_cmd \"menu_cmd $*\"\n"); -} - -void GameCommand(string command) -{ - float argc; - argc = tokenize(command); - - if(argv(0) == "help" || argc == 0) - { - print("Usage: menu_cmd COMMAND..., where possible commands are:\n"); - print(" sync - reloads all cvars on the current menu page\n"); - print(" directmenu ITEM - select a menu item as main item\n"); - GameCommand_Generic("help"); - return; - } - - if(GameCommand_Generic(command)) - return; - - if(argv(0) == "sync") - { - for(self = null_entity; (self = nextent(self)); ) - Raise_DataEvent(self, ITEM_DATA_SYNC); - /* - for(self = null_entity; (self = findstring(self, type, "Item_Data_Cvar")); ) - Raise_DataEvent(self, ITEM_DATA_SYNC); - for(self = null_entity; (self = findstring(self, type, "Item_Data_ServerCvar")); ) - Raise_DataEvent(self, ITEM_DATA_SYNC); - */ - return; - } - - if(argv(0) == "directmenu") if(argc == 2) - { - entity newitem; - cvar_set("scmenu_directmenu", argv(1)); - m_display(); - return; - } - - print("Invalid command. For a list of supported commands, try menu_cmd help.\n"); -} diff --git a/data/qcsrc/menu/mbuiltin.qc b/data/qcsrc/menu/mbuiltin.qc deleted file mode 100644 index 7dcb52850..000000000 --- a/data/qcsrc/menu/mbuiltin.qc +++ /dev/null @@ -1,302 +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; -float(string s, string separator1, ...) tokenizebyseparator = #479; -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 drawcolorcodedstring(vector position, string text, vector scale, float alpha, float flag) = #467; -float stringwidth(string text, float handleColors) = #468; - -float drawpic(vector position, string pic, vector size, vector rgb, float alpha, float flag) = #456; -float drawsubpic(vector position, vector size, string pic, vector srcPosition, vector srcSize, vector rgb, float alpha, float flag) = #469; - -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; -string getextresponse(void) = #624; - -// AK the builtin numbers may change - the code might be removed again -float gecko_create( string name ) = #487; -void gecko_destroy( string name ) = #488; -void gecko_navigate( string name, string URI ) = #489; -float gecko_keyevent( string name, float key, float eventtype ) = #490; -void gecko_mousemove( string name, float x, float y ) = #491; -void gecko_resize( string name, float w, float h ) = #492; -vector gecko_get_texture_extent( string name ) = #493; - -//FTE_STRINGS -//idea: many -//darkplaces implementation: KrimZon -//description: -//various string manipulation functions -float(string str, string sub, float startpos) strstrofs = #221; -float(string str, float ofs) str2chr = #222; -string(float c, ...) chr2str = #223; -string(float ccase, float calpha, float cnum, string s, ...) strconv = #224; -string(float chars, string s, ...) strpad = #225; -string(string info, string key, string value, ...) infoadd = #226; -string(string info, string key) infoget = #227; -float(string s1, string s2, float len) strncmp = #228; -float(string s1, string s2) strcasecmp = #229; -float(string s1, string s2, float len) strncasecmp = #230; - -//DP_QC_STRINGBUFFERS -//idea: ?? -//darkplaces implementation: LordHavoc -//functions to manage string buffer objects - that is, arbitrary length string arrays that are handled by the engine -float() buf_create = #440; -void(float bufhandle) buf_del = #441; -float(float bufhandle) buf_getsize = #442; -void(float bufhandle_from, float bufhandle_to) buf_copy = #443; -void(float bufhandle, float sortpower, float backward) buf_sort = #444; -string(float bufhandle, string glue) buf_implode = #445; -string(float bufhandle, float string_index) bufstr_get = #446; -void(float bufhandle, float string_index, string str) bufstr_set = #447; -float(float bufhandle, string str, float order) bufstr_add = #448; -void(float bufhandle, float string_index) bufstr_free = #449; - -//DP_QC_CRC16 -//idea: div0 -//darkplaces implementation: div0 -//Some hash function to build hash tables with. This has to be be the CRC-16-CCITT that is also required for the QuakeWorld download protocol. -//When caseinsensitive is set, the CRC is calculated of the lower cased string. -float(float caseinsensitive, string s, ...) crc16 = #494; - -#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/data/qcsrc/menu/menu.qc b/data/qcsrc/menu/menu.qc deleted file mode 100644 index e36816616..000000000 --- a/data/qcsrc/menu/menu.qc +++ /dev/null @@ -1,158 +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 = -{ - dprint_load(); - - // init graphic - Gfx_Init(); - - // init cursor - Cursor_Init(); - - Key_Init(); - - HostCache_Init(); - - // init menu - Menu_Init(); - - // menu QC is running; make the aliases use its GameCommand() - GameCommand_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 = -{ - dprint_load(); - - 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) && cvar_string( "menu_directmenu" ) != "" ) { - 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 ); -}; diff --git a/data/qcsrc/menu/menu.qh b/data/qcsrc/menu/menu.qh deleted file mode 100644 index 1de9229df..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/msys.qc b/data/qcsrc/menu/msys.qc deleted file mode 100644 index 5a9af02d7..000000000 --- a/data/qcsrc/menu/msys.qc +++ /dev/null @@ -1,294 +0,0 @@ -#pragma flag off fastarrays // make dp behave with new fteqcc versions. remove when dp bug with fteqcc fastarrays is fixed -#define MENUQC // so common/*.qc can check for menu QC or game QC - -////////////////////////////////////////////////////////// -// 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_MWHEELUP = 515; -float K_MWHEELDOWN = 516; -float K_MOUSE4 = 517; -float K_MOUSE5 = 518; -float K_MOUSE6 = 519; -float K_MOUSE7 = 520; -float K_MOUSE8 = 521; -float K_MOUSE9 = 522; -float K_MOUSE10 = 523; -float K_MOUSE11 = 524; -float K_MOUSE12 = 525; -float K_MOUSE13 = 526; -float K_MOUSE14 = 527; -float K_MOUSE15 = 528; -float K_MOUSE16 = 529; - -/////////////////////////// -// key dest constants - -float KEY_UNKNOWN = -1; -float KEY_GAME = 0; -float KEY_MENU = 2; -float KEY_MENU_GRABBED = 3; - -/////////////////////////// -// file constants - -float FILE_READ = 0; -float FILE_APPEND = 1; -float FILE_WRITE = 2; - -/////////////////////////// -// logical constants (just for completeness) - -float TRUE = 1; -float FALSE = 0; - -/////////////////////////// -// boolean constants - -float true = 1; -float false = 0; - -/////////////////////////// -// msg constants - -float MSG_BROADCAST = 0; // unreliable to all -float MSG_ONE = 1; // reliable to one (msg_entity) -float MSG_ALL = 2; // reliable to all -float MSG_INIT = 3; // write to the init string - -///////////////////////////// -// mouse target constants - -float MT_MENU = 1; -float MT_CLIENT = 2; - -///////////////////////// -// client state constants - -float CS_DEDICATED = 0; -float CS_DISCONNECTED = 1; -float CS_CONNECTED = 2; - -/////////////////////////// -// blend flags - -float DRAWFLAG_NORMAL = 0; -float DRAWFLAG_ADDITIVE = 1; -float DRAWFLAG_MODULATE = 2; -float DRAWFLAG_2XMODULATE = 3; - - -/////////////////////////// -// 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; - -float GECKO_BUTTON_DOWN = 0; -float GECKO_BUTTON_UP = 1; -// either use down and up or just press but not all of them! -float GECKO_BUTTON_PRESS = 2; -// use this for mouse events if needed? -float GECKO_BUTTON_DOUBLECLICK = 3; - -/* not supported at the moment -/////////////////////////// -// os constants - -float OS_WINDOWS = 0; -float OS_LINUX = 1; -float OS_MAC = 2; -*/ - diff --git a/data/qcsrc/menu/progdefs.h b/data/qcsrc/menu/progdefs.h deleted file mode 100644 index d719f326a..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/progs.src b/data/qcsrc/menu/progs.src deleted file mode 100644 index 0bfa5db1a..000000000 --- a/data/qcsrc/menu/progs.src +++ /dev/null @@ -1,194 +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 -../common/util.qh -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 - -// 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 -custom/extresponse.qh - -// Singleplayer campaign -custom/campaign.qh -../common/campaign_common.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/demos.qm -custom/key.qm -custom/video.qm -custom/sound.qm -custom/joingame.qm -custom/credits.qm - -custom/gecko.qm - -custom/player/avatar.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 -custom/extresponse.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/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 -../common/util.qc -util/property.qc -util/text.qc -util/uid.qc -util/string.qc -util/rect.qc -util/altstring.qc -util/nfunction.qc - -// Singleplayer campaign -custom/campaign.qc -../common/campaign_setup.qc -../common/campaign_file.qc - -// GameCommand() extension -../common/gamecommand.qc -gamecommand.qc - -menu.qc diff --git a/data/qcsrc/menu/system/debug.qc b/data/qcsrc/menu/system/debug.qc deleted file mode 100644 index 8b3da1ad9..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/debug.qh b/data/qcsrc/menu/system/debug.qh deleted file mode 100644 index 043a7b629..000000000 --- a/data/qcsrc/menu/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 = "1.3"; - -// 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/data/qcsrc/menu/system/event_helper.qc b/data/qcsrc/menu/system/event_helper.qc deleted file mode 100644 index 554f98814..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/events.qc b/data/qcsrc/menu/system/events.qc deleted file mode 100644 index f19f36d89..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/events.qh b/data/qcsrc/menu/system/events.qh deleted file mode 100644 index 5dbaab28d..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/events_.qc b/data/qcsrc/menu/system/events_.qc deleted file mode 100644 index 749002c2e..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/gc.qc b/data/qcsrc/menu/system/gc.qc deleted file mode 100644 index bd57fde8e..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/gc.qh b/data/qcsrc/menu/system/gc.qh deleted file mode 100644 index b2df766a1..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/history.qc b/data/qcsrc/menu/system/history.qc deleted file mode 100644 index 65abbb141..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/history.qh b/data/qcsrc/menu/system/history.qh deleted file mode 100644 index e8c20ca01..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/isframe.qc b/data/qcsrc/menu/system/isframe.qc deleted file mode 100644 index 4eb9c236b..000000000 --- a/data/qcsrc/menu/system/isframe.qc +++ /dev/null @@ -1,342 +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(); - - Campaign_Init(); - - 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 - // AK 05: added support for scmenu_directmenu - if( cvar_string( "scmenu_directmenu" ) != "" ) { - Menu_ActiveWindow = findstring( null_entity, name, cvar_string( "scmenu_directmenu" ) ); - cvar_set( "scmenu_directmenu", "" ); - } else 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 ); - Campaign_Shutdown(); -}; - -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/data/qcsrc/menu/system/isframe.qh b/data/qcsrc/menu/system/isframe.qh deleted file mode 100644 index a9823ef9e..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/item.qh b/data/qcsrc/menu/system/item.qh deleted file mode 100644 index 9972cfd4d..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/mgfx.qc b/data/qcsrc/menu/system/mgfx.qc deleted file mode 100644 index 7fb4c859f..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/mgfx.qh b/data/qcsrc/menu/system/mgfx.qh deleted file mode 100644 index 8fcca8f79..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/parser.qc b/data/qcsrc/menu/system/parser.qc deleted file mode 100644 index 56b39b473..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/parser.qh b/data/qcsrc/menu/system/parser.qh deleted file mode 100644 index 88a4ceb35..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/structure.qc b/data/qcsrc/menu/system/structure.qc deleted file mode 100644 index f33367d3c..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/system/structure.qh b/data/qcsrc/menu/system/structure.qh deleted file mode 100644 index 36551e924..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/todo b/data/qcsrc/menu/todo deleted file mode 100644 index a4960e17e..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/util/altstring.qc b/data/qcsrc/menu/util/altstring.qc deleted file mode 100644 index a68d913a0..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/util/altstring.qh b/data/qcsrc/menu/util/altstring.qh deleted file mode 100644 index ee2beaf02..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/util/nfunction.qc b/data/qcsrc/menu/util/nfunction.qc deleted file mode 100644 index 0253ea2d2..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/util/property.qc b/data/qcsrc/menu/util/property.qc deleted file mode 100644 index 4df4b9ef4..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/util/property.qh b/data/qcsrc/menu/util/property.qh deleted file mode 100644 index c04d5000f..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/util/rect.qc b/data/qcsrc/menu/util/rect.qc deleted file mode 100644 index ac59e352b..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/util/rect.qh b/data/qcsrc/menu/util/rect.qh deleted file mode 100644 index 5ac296f96..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/util/string.qc b/data/qcsrc/menu/util/string.qc deleted file mode 100644 index 08de96b79..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/util/string.qh b/data/qcsrc/menu/util/string.qh deleted file mode 100644 index 88d5d6a3f..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/util/text.qc b/data/qcsrc/menu/util/text.qc deleted file mode 100644 index fbc132ca5..000000000 --- a/data/qcsrc/menu/util/text.qc +++ /dev/null @@ -1,76 +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; - } - } - } -}; - -string( float pValue, float pStep ) Util_FloatToClampedText = -{ - local float lLen; - local float lClampedStep; - local float lInverseClamped; - lClampedStep = pStep - floor( pStep ); - if( lClampedStep == 0.0 ) - return ftos( pValue ); - // get the integer length - lLen = strlen( ftos( floor( pValue ) ) ); - // 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( pValue + 0.0001 ), 0, lLen ); -} diff --git a/data/qcsrc/menu/util/text.qh b/data/qcsrc/menu/util/text.qh deleted file mode 100644 index 36be276a8..000000000 --- a/data/qcsrc/menu/util/text.qh +++ /dev/null @@ -1,8 +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; -string( float pValue, float pStep ) Util_FloatToClampedText; diff --git a/data/qcsrc/menu/util/uid.qc b/data/qcsrc/menu/util/uid.qc deleted file mode 100644 index b86b8eed6..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/util/uid.qh b/data/qcsrc/menu/util/uid.qh deleted file mode 100644 index 5e7d5e6ca..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/menu/util/util.qh b/data/qcsrc/menu/util/util.qh deleted file mode 100644 index 2feb6769a..000000000 --- a/data/qcsrc/menu/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/data/qcsrc/server/defs.qh b/data/qcsrc/server/defs.qh index 6a8b4dc04..094263f24 100644 --- a/data/qcsrc/server/defs.qh +++ b/data/qcsrc/server/defs.qh @@ -1,3 +1,5 @@ +#define MAPINFO + // Globals float g_domination, g_ctf, g_tdm, g_keyhunt, g_onslaught, g_assault, g_arena, g_lms, g_runematch; -- 2.39.2