diff --git a/docs/zengin/scripts/classes/c_menuitem.md b/docs/zengin/scripts/classes/c_menuitem.md new file mode 100644 index 0000000000..a8b04deb25 --- /dev/null +++ b/docs/zengin/scripts/classes/c_menuitem.md @@ -0,0 +1,765 @@ +--- +title: C_MENU_ITEM +--- + +# C_MENU_ITEM Daedalus class + +!!! example "Acknowledgment" + Heavily inspired by the amazing documentation site [Gothic library](http://www.gothic-library.ru) + +Class `C_Menu_Item` describes the elements of the game menu (sliders, checkboxes, buttons, etc.) . +## Class definition +Class definition as it is defined in [`Scripts/System/_intern/Menu.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Menu.d) script file. + +??? "C_Menu_Item Daedalus class" + ```dae + CONST INT MAX_USERSTRINGS = 10; + CONST INT MAX_ITEMS = 150; + CONST INT MAX_EVENTS = 10; + CONST INT MAX_SEL_ACTIONS = 5; + CONST INT MAX_USERVARS = 4; + + class C_Menu_Item + { + var string fontName; // Font of the menu item. + var string text[MAX_USERSTRINGS]; // Text of the interface element. + var string backPic; // Background image of menu items. + var string alphaMode; // Transparency blending mode of menu items. + var int alpha; // Transparency of the menu item. + var int type; // Type of the interface element. + var int onSelAction[MAX_SEL_ACTIONS]; // Array of commands executed when selecting the menu item. + var string onSelAction_S[MAX_SEL_ACTIONS]; // Arguments for commands specified in the onSelAction property. + var string onChgSetOption; // Gothic.ini file parameter modified by this menu item. + var string onChgSetOptionSection; // Section of the Gothic.ini file where the modified parameter is located. + var func onEventAction[MAX_EVENTS]; // Call the required function by a constant identifier. + var int posx; // Top-left point of the menu item on the screen horizontally (X-axis). + var int posy; // Top-left point of the menu item on the screen vertically (Y-axis). + var int dimx; // Width of the menu item in virtual coordinates. + var int dimy; // Height of the menu item in virtual coordinates. + var float sizeStartScale; // Initial size of the item. Not used. + var int flags; // Flags of the menu item. + var float openDelayTime; // Delay before opening the item. Not used. + var float openDuration; // Opening time. Not used. + var float userFloat[MAX_USERVARS]; // Digital settings of menu items. + var string userString[MAX_USERVARS]; // String settings of menu items. + var int frameSizeX; // Text offset inside the frame on the X-axis. + var int frameSizeY; // Text offset inside the frame on the Y-axis. + var string hideIfOptionSectionSet; // Section of Gothic.ini file where the option determining the display of this menu item is located. + var string hideIfOptionSet; // Gothic.ini file parameter determining the display of this menu item. + var int hideOnValue; // Value of the Gothic.ini file parameter at which this interface element is not displayed. + }; + ``` + +## Class members + +| Property | Type | Description | +|---------------------------------|--------|-------------------------------------------------------------------------| +| [fontName](#fontname) | string | Font of the menu item. | +| [text](#text) | string | Text of the interface element. | +| [backPic](#backpic) | string | Background image of menu items. | +| [alphaMode](#alphamode) | string | Transparency blending mode of menu items. | +| [alpha](#alpha) | int | Transparency of the menu item. | +| [type](#type) | int | Type of the interface element. | +| [onSelAction](#onselaction) | int | Array of commands executed when selecting the menu item. | +| [onSelAction_S](#onselaction_s) | string | Arguments for commands specified in the onSelAction property. | +| [onChgSetOption](#onchgsetoption) | string | Gothic.ini file parameter modified by this menu item. | +| [onChgSetOptionSection](#onchgsetoptionsection) | string | Section of the Gothic.ini file where the modified parameter is located. | +| [onEventAction](#oneventaction) | Func | Call the required function by a constant identifier. | +| [posx](#posx) | int | Top-left point of the menu item on the screen horizontally (X-axis). | +| [posy](#posy) | int | Top-left point of the menu item on the screen vertically (Y-axis). | +| [dimx](#dimx) | int | Width of the menu item in virtual coordinates. | +| [dimy](#dimy) | int | Height of the menu item in virtual coordinates. | +| [sizeStartScale](#sizestartscale) | float | Initial size of the item. Not used. | +| [flags](#flags) | int | Flags of the menu item. | +| [openDelayTime](#opendelaytime) | float | Delay before opening the item. Not used. | +| [openDuration](#openduration) | float | Opening time. Not used. | +| [userFloat](#userfloat) | float | Digital settings of menu items. | +| [userString](#userstring) | string | String settings of menu items. | +| [frameSizeX](#framesizex) | int | Text offset inside the frame on the X-axis. | +| [frameSizeY](#framesizey) | int | Text offset inside the frame on the Y-axis. | +| [hideIfOptionSectionSet](#hideifoptionsectionset) | string | Section of Gothic.ini file where the option determining the display of this menu item is located. | +| [hideIfOptionSet](#hideifoptionset) | string | Gothic.ini file parameter determining the display of this menu item. | +| [hideOnValue](#hideonvalue) | int | Value of the Gothic.ini file parameter at which this interface element is not displayed. | + +## Class member overview + +Description of the class member variables. + +### fontName +`*.TGA` file defining the font of the displayed text of the menu item. + +To create a color change effect, two fonts are needed: + + - The first font is specified in the `fontName` field and is used by default. + - The second font with the suffix `_Hi` is used to replace the text on the active (selected) element. + +This creates a highlighting effect. + +### text +Text inside a menu item. + +Used to determine possible values ​​for game settings. See [onChgSetOptionSection](#onchgsetoptionsection). + +Also used to display hints about the item at the bottom of the menu when the `MENU_SHOW_INFO` [flag](#flags) is set. + +```dae +// Text displayed in the element + +text[0] = "New Game"; + +// Text in the interface element responsible for game settings +// One of the presented options is displayed + +text[0] = "off|on"; + +// Tooltip for the selected element +// Index 1 is used for tooltips, not 0 + +text[1] = "Start a new adventure"; +``` + +### backPic +Background image of the menu item in `*.TGA` format. + +```dae +instance MENUITEM_MAIN_NEWGAME(C_MENU_ITEM_DEF) +{ + backpic = "Inv_Slot_Highlighted.tga"; +} +``` + +### alphaMode +Texture transparency blending mode. Used in conjunction with the [alpha](#alpha) property. This parameter's value is ignored if the [backPic](#backpic) property is not specified. + +**Supported modes:** + +- `MAT_DEFAULT` + Uses the standard texture. If the material has an alpha channel, it will be transparent; otherwise, it will be opaque. + +- `NONE` + Transparency is not used unless the texture itself is transparent. + +- `BLEND` + Blends the alpha channel of the texture with the background. + +- `ADD` + Adds the alpha channel of the texture to the background. + +- `SUB` + Subtracts the alpha channel of the texture from the background. + +- `MUL` and `MUL2` + Multiplies the alpha channel of the texture by the background. + +### alpha +Menu element transparency. Accepts values ​​from 0 to 255. Without specifying the [backPic](#backpic) property, the value of this parameter is ignored. + +The alpha channel rendering mode is determined using the [alphaMode](#alphamode) property. + +### type +Interface element type. Some interface elements have their own settings determined by the [userFloat](#userfloat) and [userString](#userstring) properties. + +Constants for menu item types are described in the file [`Scripts/System/_intern/Menu.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Menu.d#L18-L25). + +```dae +CONST INT MENU_ITEM_UNDEF = 0; // Undefined +CONST INT MENU_ITEM_TEXT = 1; // Text +CONST INT MENU_ITEM_SLIDER = 2; // Slider +CONST INT MENU_ITEM_INPUT = 3; // Input field +CONST INT MENU_ITEM_CURSOR = 4; +CONST INT MENU_ITEM_CHOICEBOX = 5; // Checkbox +CONST INT MENU_ITEM_BUTTON = 6; // Button +CONST INT MENU_ITEM_LISTBOX = 7; // Frame +``` + +- `MENU_ITEM_UNDEF` + Undefined element type. Not used in scripts. + +- `MENU_ITEM_TEXT` + Menu item type "Text". Text can be multiline by setting the `IT_MULTILINE` [flag](#flags). + +- `MENU_ITEM_SLIDER` + Menu item type "Slider". Additional settings are provided for the slider. + - [`userFloat[0]`](#userfloat) property determines the number of divisions for the slider. + - [`userFloat[1]`](#userfloat) property determines the width of the slider. + - [`userString[0]`](#userstring) property determines the background image for the slider thumb. + + ```dae + INSTANCE MENUITEM_AUDIO_MUSICVOL_SLIDER(C_MENU_ITEM_DEF) + { + backPic = MENU_SLIDER_BACK_PIC; + type = MENU_ITEM_SLIDER; // Type: Slider + // [...] + onChgSetOption = "musicVolume"; // INI file parameter + onChgSetOptionSection = "SOUND"; // INI file section + userFloat[0] = 15; // Number of slider positions + userString[0] = MENU_SLIDER_POS_PIC; // Background image of the slider + // [...] + }; + ``` + +- `MENU_ITEM_INPUT` + This type of element is intended for entering control keys during configuration, as well as for entering the name of the save in the corresponding menu. + +- `MENU_ITEM_CURSOR` + Deprecated element type. Not used in scripts. + +- `MENU_ITEM_CHOICEBOX` + "SELECT" type allowing the selection of one of the available values. + +- `MENU_ITEM_BUTTON` + Button. Not used in scripts. + - The [`userString[0]`](#userstring) property determines which image will be used for the disabled button. The [backPic](#backpic) property is responsible for the background image of the enabled button. + +- `MENU_ITEM_LISTBOX` + Menu item type used in the "Quest Log" menu. + - The [`userString[0]`](#userstring) property determines which task list will be displayed in this element. + + ```dae + userstring[0] = "CURRENTMISSIONS"; + userstring[0] = "OLDMISSIONS"; + userstring[0] = "FAILEDMISSIONS"; + userstring[0] = "LOG"; + ``` + +### onSelAction +Array of commands executed when selecting the menu item. + +Each command receives parameters in the [`onSelAction_S`](#onselaction_s) property. + +Constants are described in the file [`Scripts/System/_intern/Menu.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Menu.d#L8-L15). + +```dae +CONST INT SEL_ACTION_UNDEF = 0; // No action. Used when setting game parameters, calling functions... +CONST INT SEL_ACTION_BACK = 1; // Return to the previous menu or game +CONST INT SEL_ACTION_STARTMENU = 2; // Open a menu +CONST INT SEL_ACTION_STARTITEM = 3; // Special command for save slots +CONST INT SEL_ACTION_CLOSE = 4; // Close menu or game +CONST INT SEL_ACTION_CONCOMMANDS = 5; // Execute console command +CONST INT SEL_ACTION_PLAY_SOUND = 6; // Play sound from C_SFX instance +CONST INT SEL_ACTION_EXECCOMMANDS = 7; // Execute command specified in the onSelAction_S field using RUN or EFFECT commands +``` + +### onSelAction_S +Arguments for commands specified in the [`onSelAction`](#onselaction) property. + +Below are commands and their arguments: + +- `SEL_ACTION_UNDEF` + This command has no arguments and is mostly used in options and for calling script functions. + + ```dae + instance MENUITEM_MAIN_CREDITS(C_MENU_ITEM_DEF) + { + text[0] = "Credits"; + // [...] + onselaction[0] = SEL_ACTION_UNDEF; + oneventaction[1] = showcredits; + }; + + func int showcredits() + { + PlayVideo("credits.bik"); + PlayVideo("credits2.bik"); + return 1; + }; + ``` + +- `SEL_ACTION_BACK` + This command has no arguments. It returns to the previous menu or the game. + + ```dae + instance MENUITEM_MAIN_RESUME(C_MENU_ITEM_DEF) + { + text[0] = "Resume"; + text[1] = "Resume the current game"; + // [...] + onselaction[0] = SEL_ACTION_BACK; + }; + ``` + +- `SEL_ACTION_STARTMENU` + The argument for this command is the menu instance. The specified menu will be displayed. + + ```dae + instance MENUITEM_MAIN_EXIT(C_MENU_ITEM_DEF) + { + text[0] = "Quit Game"; + text[1] = "Leave the world of Gothic II"; + onselaction[0] = SEL_ACTION_STARTMENU; + onselaction_s[0] = "MENU_LEAVE_GAME"; + // [...] + }; + + instance MENU_LEAVE_GAME(C_MENU_DEF) + { + // [...] + }; + ``` + +- `SEL_ACTION_STARTITEM` + The argument is an interface element serving as a slot for saving the game. + + ```dae + INSTANCE MENUITEM_SAVE_SLOT1(C_MENU_ITEM_DEF) + { + // [...] + onSelAction[0] = SEL_ACTION_STARTITEM; + onSelAction_S[0]= "MENUITEM_SAVE_SLOT1"; + onSelAction[1] = SEL_ACTION_CLOSE; + onSelAction_S[1]= "SAVEGAME_SAVE"; + }; + ``` + +- `SEL_ACTION_CLOSE` + The closing menu command supports the following arguments: + + - `NEW_GAME` + Start a new game. + + ```dae + instance MENUITEM_MAIN_NEWGAME(C_MENU_ITEM_DEF) + { + // [...] + text[0] = "New Game"; + text[1] = "Start a new adventure"; + onSelAction[0] = SEL_ACTION_CLOSE; + onSelAction_S[0]= "NEW_GAME"; + }; + ``` + + - `LEAVE_GAME` + Exit the game. + + ```dae + INSTANCE MENUITEM_LEAVE_GAME_YES(C_MENU_ITEM_DEF) + { + // [...] + text[0] = "Yes."; + text[1] = "Yes, I'll be back!"; + onSelAction[0] = SEL_ACTION_CLOSE; + onSelAction_S[0]= "LEAVE_GAME"; + }; + ``` + + - `SAVEGAME_SAVE` + Save the game to the selected slot and return to the game. + + ```dae + INSTANCE MENUITEM_SAVE_SLOT1(C_MENU_ITEM_DEF) + { + // [...] + onSelAction[0] = SEL_ACTION_STARTITEM; + onSelAction_S[0]= "MENUITEM_SAVE_SLOT1"; + onSelAction[1] = SEL_ACTION_CLOSE; + onSelAction_S[1]= "SAVEGAME_SAVE"; + }; + ``` + + - `SAVEGAME_LOAD` + Load the game from the selected slot and return to the game. + + ```dae + INSTANCE MENUITEM_LOAD_SLOT1(C_MENU_ITEM_DEF) + { + // [...] + onSelAction[0] = SEL_ACTION_CLOSE; + onSelAction_S[0]= "SAVEGAME_LOAD"; + }; + ``` + +- `SEL_ACTION_CONCOMMANDS` + The argument is a console commands. + + ```dae + INSTANCE MENUITEM_EXAMPLE_1(C_MENU_ITEM_DEF) + { + // [...] + onSelAction[1] = SEL_ACTION_CONCOMMANDS; + onSelAction_S[1]= "goto pos 0 0 0"; + }; + ``` + +- `SEL_ACTION_PLAY_SOUND` + The argument is an C_SFX class instance. + + ```dae + INSTANCE MENUITEM_EXAMPLE_1(C_MENU_ITEM_DEF) + { + // [...] + onSelAction[1] = SEL_ACTION_PLAY_SOUND; + onSelAction_S[1]= "LevelUp"; + }; + ``` + +- `SEL_ACTION_EXECCOMMANDS` + There are two supported executable commands: `RUN` and `EFFECTS`. + + - `RUN` + Indicates the instance of the menu element that is used to select the key. + + ```dae + INSTANCE MENU_ITEM_KEY_UP(C_MENU_ITEM_DEF) + { + // [...] + text[0] = "Forward"; + text[1] = "press DEL key to empty slot and RETURN to define"; + onSelAction[0] = SEL_ACTION_EXECCOMMANDS; + onSelAction_S[0]= "RUN MENU_ITEM_INP_UP"; + }; + + INSTANCE MENU_ITEM_INP_UP(C_MENU_ITEM_DEF) + { + // [...] + text[1] = "Please press the desired key for this action."; + type = MENU_ITEM_INPUT; + onChgSetOption = "keyUp"; + onChgSetOptionSection = "KEYS"; + }; + ``` + + - `EFFECTS` + Specifies the menu item instance to which the focus switches. + + ```dae + INSTANCE MENU_ITEM_SEL_MISSIONS_ACT(C_MENU_ITEM_DEF) + { + text[0] = "Current\nQuests"; + // [...] + onSelAction[0] = SEL_ACTION_EXECCOMMANDS; + onSelAction_S[0]= "EFFECTS MENU_ITEM_LIST_MISSIONS_ACT"; + }; + + instance MENU_ITEM_LIST_MISSIONS_ACT(C_MENU_ITEM_DEF) + { + type = MENU_ITEM_LISTBOX; + text[0] = "Act Missions"; + // [...] + userString[0] = "CURRENTMISSIONS"; + }; + ``` + + There are also two commands, `SETDEFAULT` and `SETALTERNATIVE`, which set control settings. The first restores default settings, and the second uses alternative character control settings. + +### onChgSetOption + +Parameter of the `Gothic.ini` file that will be modified by this menu item. + +```dae +instance MENUITEM_GAME_FIGHTFOCUS_CHOICE(C_MENU_ITEM_DEF) +{ + text[0] = "none|box|lighten|both"; + // [...] + onChgSetOption = "highlightMeleeFocus"; // INI parameter + onChgSetOptionSection = "GAME"; // INI section + // [...] +}; +``` + +The `text[0]` property of such an element usually specifies possible values of the modified parameter. Values are listed using the `|` symbol. + +Make sure that the number of parameter options in the menu corresponds to the number of options in the `Gothic.ini` file. + +```ini +highlightMeleeFocus=2 +; ... here you can turn on an optional focus highlight effect during fighting +``` + +### onChgSetOptionSection +The section of the Gothic.ini file in which the parameter being changed is located. + +See [onChgSetOption](#onchgsetoption) above. + +### onEventAction +Allows a user to call a function on a specified event. + +The list of constants is described in the file [`Scripts/System/_intern/Menu.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Menu.d#L51-L59). + +```dae +const int EVENT_UNDEF = 0; // Undefined +const int EVENT_EXECUTE = 1; // Process start event +const int EVENT_CHANGED = 2; // Menu parameter change event +const int EVENT_LEAVE = 3; // Menu item focus loss event +const int EVENT_TIMER = 4; // Timer fire event +const int EVENT_CLOSE = 5; // Menu close event +const int EVENT_INIT = 6; // Initialization event +const int EVENT_SEL_PREV = 7; // Select event of the previous menu item +const int EVENT_SEL_NEXT = 8; // Select event of the next menu item +``` + +For example, you can use the function associated with the constant `EVENT_EXECUTE` to call a script function. + +```dae +instance MENUITEM_MAIN_INTRO(C_MENU_ITEM_DEF) +{ + text[0] = "Play Intro"; + text[1] = "Play introduction sequence"; + // [...] + onEventAction[EVENT_EXECUTE] = ShowIntro; +}; + +func int ShowIntro() +{ + PlayVideo("intro.bik"); + return 1; +}; +``` + +### posx +The horizontal position of the top left point of the menu on the screen, measured in virtual coordinates. + +!!! Example "Virtual coordinates" + Virtual coordinates divide the menu into 8192 parts (`0 - 8191`) horizontally and vertically. The position of the menu item is calculated based on these values. + +### posy +The vertical position of the top left point of the menu on the screen, measured in virtual coordinates. + +### dimx +The width of the menu item in virtual coordinates. + +!!! Tip + To automatically determine the width, enter `-1`. In this case, the width is calculated based on the text contained in the element. + +### dimy + +The height of the menu item in virtual coordinates. + +!!! Tip + To automatically determine the element's height, enter a value of `-1`. In this case, the height is calculated taking into account the text contained in the element. + +### sizeStartScale + +!!! Warning "Deprecated setting" + Size of the menu item at the beginning. + + +### flags +Flags of the menu item. + +Constants for all flags are described in the file [`Scripts/System/_intern/Menu.d`](https://github.com/VaanaCZ/gothic-2-addon-scripts/blob/Unified-EN/_work/Data/Scripts/System/_intern/Menu.d#L27-L41). + +```dae +const int IT_CHROMAKEYED = 1; +const int IT_TRANSPARENT = 2; +const int IT_SELECTABLE = 4; // Element can be selected +const int IT_MOVEABLE = 8; +const int IT_TXT_CENTER = 16; // Align text to center +const int IT_DISABLED = 32; // Interactive item +const int IT_FADE = 64; +const int IT_EFFECTS_NEXT = 128; // Flag for influencing an adjacent menu item +const int IT_ONLY_OUT_GAME = 256; // Element available only outside the game +const int IT_ONLY_IN_GAME = 512; // Element available only in-game +const int IT_PERF_OPTION = 1 << 10; // Option responsible for performance +const int IT_MULTILINE = 1 << 11; // Multi-line text element +const int IT_NEEDS_APPLY = 1 << 12; // Need to apply a settings. Used when changing screen resolution +const int IT_NEEDS_RESTART = 1 << 13; // The game need to be restarted +const int IT_EXTENDED_MENU = 1 << 14; // Advanced menu flag +``` + +- `IT_CHROMAKEYED` + Empty flag. Not used. + +- `IT_TRANSPARENT` + Empty flag. Not used. + +- `IT_SELECTABLE` + Items marked with this flag can be selected. + +- `IT_MOVEABLE` + Empty flag. Not used. + + ??? Example "Intended use" + In early engine versions, the initial position of the element could be specified using the `startPosX` and `startPosY` properties. The element moved from these coordinates to the desired position. + + At the beginning of the video below, it can be seen that the elements slides into the screen. That was probably done using this flag and mentioned parameters. + + ![type:video](https://www.youtube.com/embed/mfJag6fkfH8) + +- `IT_TXT_CENTER` + Aligns the text in the element to the center. + +- `IT_DISABLED` + The menu item becomes inactive. + + ```dae + instance MENUITEM_MAIN_NEWGAME(C_MENU_ITEM_DEF) + { + text[0] = "New Game"; + text[1] = "Start a new adventure"; + flags = flags | IT_TXT_CENTER | IT_DISABLED; + // [...] + }; + ``` + +- `IT_FADE` + Empty flag. Not used. + +- `IT_EFFECTS_NEXT` + This flag affects the next neighboring element, i.e., the element specified in the [`items`](./c_menu.md#items) list of the [`C_MENU`](./c_menu.md) class. + + ```dae + instance MENU_OPT_GAME(C_MENU_DEF) + { + // [...] + items[1] = "MENUITEM_GAME_SUB_TITLES"; + items[2] = "MENUITEM_GAME_SUB_TITLES_CHOICE"; + // [...] + }; + ``` + + In this case, the element affecting (MENUITEM_GAME_SUB_TITLES_CHOICE) is usually made non-selectable. + + ```dae + instance MENUITEM_GAME_SUB_TITLES(C_MENU_ITEM_DEF) + { + // [...] + text[0] = "Subtitles"; + text[1] = "Subtitles on/off"; + flags = flags | IT_EFFECTS_NEXT; + // [...] + }; + + instance MENUITEM_GAME_SUB_TITLES_CHOICE(C_MENU_ITEM_DEF) + { + // [...] + text[0] = "no|yes"; + flags = flags & ~IT_SELECTABLE; + // [...] + }; + ``` + + This flag is mainly used for options and for managing checkboxes, sliders, and enumerations. + +- `IT_ONLY_OUT_GAME` + This flag determines that the menu item is only available before starting the game. Once you start the game, the menu item becomes unavailable. + +- `IT_ONLY_IN_GAME` + This flag determines that the menu item is only available in the running game. Until the game is started, the element remains unavailable. + +- `IT_PERF_OPTION` + A special flag for options. Settings affecting the game's performance are marked with this flag. + +- `IT_MULTILINE` + Flag for multiline text. The text of such elements can be moved to a new line using the newline escape sequence `\n`. + +- `IT_NEEDS_APPLY` + Flag indicating the need to apply settings. Used when changing the game resolution. + +- `IT_NEEDS_RESTART` + Flag indicating that the game needs to be restarted for the settings to take effect. + +- `IT_EXTENDED_MENU` + Flag indicating that this element is part of the "Extended Menu." It is displayed only if the `extendedMenu` parameter in the `Gothic.ini` file is set to `1`. + +### openDelayTime + +!!! Warning "Deprecated setting" + Delay before opening a menu item. + +### openDuration + +!!! Warning "Deprecated setting" + The time the menu item was opened. + +### userFloat + +Numerical settings of the interface element. Depending on the interface element, the purpose of the property changes. See [type](#type). + +### userString + +String settings of the interface element. The purpose of the property changes depending on the interface element. See [type](#type)`. + +### frameSizeX + +Indentation of text inside the frame along the X axis. This applies the padding to both sides of the frame. Measured in virtual coordinates from 0 to 4095. + +Frames are a special tool designed to work with the log of tasks and quests. + +Used for elements of [type](#type) `MENU_ITEM_LISTBOX`. + +```dae +instance MENU_ITEM_LIST_MISSIONS_ACT(C_MENU_ITEM_DEF) +{ + backpic = "NW_Misc_CaveWall_01.tga"; + type = MENU_ITEM_LISTBOX; + text[0] = "Act Missions"; + // [...] + userstring[0] = "CURRENTMISSIONS"; + framesizex = 2000; + framesizey = 2000; +}; +``` + +As a result, we get the following frame (Source: [Gothic-Library](http://www.gothic-library.ru/publ/class_c_menu_item/1-1-0-37#frameSizeX)): + +![](../../../assets/images/c_menu_item_farmesize.png) + +And the width and height of the frame are set, as for all elements, by the [dimx](#dimx) and [dimy](#dimy) properties. + +### frameSizeY + +Indentation of text inside the frame along the Y axis. In this case, the indentation is applied at the top and bottom of the frame. Measured in virtual coordinates from 0 to 4095. + +See [frameSizeX](#framesizex) above. + + +### hideIfOptionSectionSet +The section of the `Gothic.ini` file with the option which value of determines the display of this menu item. + +This property works together with the [`hideIfOptionSet`](#hideifoptionset) and [`hideOnValue`](#hideonvalue) properties. + +In the example below, the interface element will not be displayed until the `useGothic1Controls` parameter in the GAME section is set to 1, i.e., enabled. + +```dae +instance MENU_ITEM_NEXTMENU(C_MENU_ITEM_DEF) +{ + text[0] = "More keys..."; + text[1] = "Configure further control keys"; + // [...] + hideifoptionsectionset = "GAME"; + hideifoptionset = "useGothic1Controls"; + hideonvalue = 1; +}; +``` + +!!! Tip + `Gothic.ini` settings can also be changed through the main menu. See [`onChgSetOption`](#onchgsetoption) and [`onChgSetOptionSection`](#onchgsetoptionsection). + +### hideIfOptionSet +The `Gothic.ini` file parameter, the value of which determines the display of this menu item. + +See [hideIfOptionSectionSet](#hideifoptionsectionset). + +### hideOnValue +The value of the `Gothic.ini` file parameter at which this interface element is not displayed. + +See [hideIfOptionSectionSet](#hideifoptionsectionset). + +## Predefined instances +There are a lot of predefined class instances in the menu `C_MENU_ITEM` performing a strictly defined function. They cannot be renamed, but they can be configured to a certain extent. + +| Instance | Description | +|---------------------------------------|------------------------------------------------------------| +| MENUITEM_LOADSAVE_THUMBPIC | Save picture in the Save/Load menu. | +| MENUITEM_LOADSAVE_LEVELNAME_VALUE | The name of the level of the selected Save/Load menu item. | +| MENUITEM_LOADSAVE_DATETIME_VALUE | The date the selected Save/Load menu item was saved. | +| MENUITEM_LOADSAVE_GAMETIME_VALUE | Game time for saving the selected Save/Load menu item. | +| MENUITEM_LOADSAVE_PLAYTIME_VALUE | Total play time of the selected Save/Load menu item. | +| MENUITEM_SAVE_SLOT1 - MENUITEM_SAVE_SLOT20 | Save menu slots. | +| MENUITEM_LOAD_SLOT1 - MENUITEM_LOAD_SLOT20 | Load menu slots. | +| MENU_ITEM_LIST_MISSIONS_ACT | Frame with a list of current tasks in the journal. | +| MENU_ITEM_LIST_MISSIONS_FAILED | Frame with a list of failed tasks in the log. | +| MENU_ITEM_LIST_MISSIONS_OLD | Frame with a list of old tasks in the journal. | +| MENU_ITEM_LIST_LOG | Frame of general information in the task log. | +| MENU_ITEM_CONTENT_VIEWER | Job log window. | +| MENU_ITEM_DAY | Current day in the quest log window. | +| MENU_ITEM_TIME | Current time in the task log window. | +| MENU_ITEM_PLAYERGUILD | Character's guild in the statistics window. | +| MENU_ITEM_TALENT_0_TITLE - MENU_ITEM_TALENT_16_TITLE | The name of the character's talent. Array indexes are used `TXT_TALENTS` from the `Text.d` file. There may be more elements, depending on the talents realized in the game. | +| MENU_ITEM_TALENT_0_SKILL - MENU_ITEM_TALENT_16_SKILL | Character's talent level. Array indexes are used `TXT_TALENTS_SKILLS` from the `Text.d` file. | +| MENU_ITEM_EXP | The character's current experience value in the statistics window. | +| MENU_ITEM_LEVEL | Current character level in the statistics window. | +| MENU_ITEM_LEVEL_NEXT | The amount of experience required to obtain the next level in the statistics window. | +| MENU_ITEM_LEARN | The number of available training points in the statistics window. | +| MENU_ITEM_ATTRIBUTE_1 - MENU_ITEM_ATTRIBUTE_4 | Character attributes in the statistics window. | +| MENU_ITEM_ARMOR_1 - MENU_ITEM_ARMOR_4 | Character protection in the statistics window. | diff --git a/docs/zengin/scripts/extenders/lego/applications/bars.md b/docs/zengin/scripts/extenders/lego/applications/bars.md index 29722596f5..c007323f7b 100644 --- a/docs/zengin/scripts/extenders/lego/applications/bars.md +++ b/docs/zengin/scripts/extenders/lego/applications/bars.md @@ -1,3 +1,7 @@ +--- +title: Bars +description: LeGo package for creating new status bars +--- # Bars This package makes it very easy to add new bars, for e.g. stamina. diff --git a/docs/zengin/scripts/extenders/lego/applications/bars.pl.md b/docs/zengin/scripts/extenders/lego/applications/bars.pl.md index 5da2afdf02..af683b9162 100644 --- a/docs/zengin/scripts/extenders/lego/applications/bars.pl.md +++ b/docs/zengin/scripts/extenders/lego/applications/bars.pl.md @@ -1,5 +1,6 @@ --- title: Bars +description: Pakiet LeGo do tworzenia nowych pasków statusu --- # Bars - paski Ten pakiet bardzo ułatwia dodawanie nowych pasków, dla wyświetlania np. wytrzymałości. diff --git a/docs/zengin/scripts/extenders/lego/applications/buffs.md b/docs/zengin/scripts/extenders/lego/applications/buffs.md index 010649ca42..e219fd1c97 100644 --- a/docs/zengin/scripts/extenders/lego/applications/buffs.md +++ b/docs/zengin/scripts/extenders/lego/applications/buffs.md @@ -1,3 +1,7 @@ +--- +title: Buffs +description: LeGo package allowing to create status effects and apply them on NPCs +--- # Buffs This package allows you to easily create status effects that can affect any NPC. Status effects on the hero are displayed graphically in a bar. diff --git a/docs/zengin/scripts/extenders/lego/applications/buttons.md b/docs/zengin/scripts/extenders/lego/applications/buttons.md index 7446c7c411..d751f86b61 100644 --- a/docs/zengin/scripts/extenders/lego/applications/buttons.md +++ b/docs/zengin/scripts/extenders/lego/applications/buttons.md @@ -1,3 +1,7 @@ +--- +title: Buttons +description: LeGo package for creating buttons that reacts to mouse +--- # Buttons This package extends the handling of the mouse and allows creating rectangular buttons, which react to mouse (hover) entry and exit as well as a mouse click. diff --git a/docs/zengin/scripts/extenders/lego/applications/console_commands.md b/docs/zengin/scripts/extenders/lego/applications/console_commands.md index 89f6abc7f8..40b3d830ec 100644 --- a/docs/zengin/scripts/extenders/lego/applications/console_commands.md +++ b/docs/zengin/scripts/extenders/lego/applications/console_commands.md @@ -1,3 +1,7 @@ +--- +title: Console Commands +description: LeGo package allowing the registering of new console commands +--- # Console Commands This package allows you to create new console commands. diff --git a/docs/zengin/scripts/extenders/lego/applications/console_commands.pl.md b/docs/zengin/scripts/extenders/lego/applications/console_commands.pl.md index cbb7329754..aaf30badd8 100644 --- a/docs/zengin/scripts/extenders/lego/applications/console_commands.pl.md +++ b/docs/zengin/scripts/extenders/lego/applications/console_commands.pl.md @@ -1,5 +1,6 @@ --- title: Console Commands +description: Pakiet LeGo umożliwiający rejestrację nowych poleceń konsoli --- # Console Commands - polecenia konsoli Ten Pakiet pozwala na tworzenie nowych poleceń konsoli dostępnej po naciśnięciu klawisza F2 w trybie marvin. diff --git a/docs/zengin/scripts/extenders/lego/applications/cursor.md b/docs/zengin/scripts/extenders/lego/applications/cursor.md index 9b1546dde4..b9894118d0 100644 --- a/docs/zengin/scripts/extenders/lego/applications/cursor.md +++ b/docs/zengin/scripts/extenders/lego/applications/cursor.md @@ -1,3 +1,7 @@ +--- +title: Cursor +description: LeGo package implementing in-game mouse cursor support +--- # Cursor This package implements Gothic in-game mouse cursor support. To visually display the cursor there is a `Cursor.tga` file in the resources, but the texture can be changed in [user constants](../various/userconstants.md#cursor-1). diff --git a/docs/zengin/scripts/extenders/lego/applications/focusnames.md b/docs/zengin/scripts/extenders/lego/applications/focusnames.md index 59bc86c0a1..91e4940938 100644 --- a/docs/zengin/scripts/extenders/lego/applications/focusnames.md +++ b/docs/zengin/scripts/extenders/lego/applications/focusnames.md @@ -1,3 +1,7 @@ +--- +title: Focusnames +description: LeGo package that change NPCs/Object's focus name color based on its attitude +--- # Focusnames This package colors the focus names of the NPCs in appropriate colors according to the behavior defined below (alpha values are taken into account). Also affects monsters. (Mobs/Items get Color_Neutral) diff --git a/docs/zengin/scripts/extenders/lego/applications/names.md b/docs/zengin/scripts/extenders/lego/applications/names.md index 107abbb5d0..be3f0ae7d9 100644 --- a/docs/zengin/scripts/extenders/lego/applications/names.md +++ b/docs/zengin/scripts/extenders/lego/applications/names.md @@ -1,3 +1,7 @@ +--- +title: Names +description: LeGo package for changing NPCs display name during the game +--- # Names Allows the user to change NPC name e.g. after he shows up. diff --git a/docs/zengin/scripts/extenders/lego/applications/render.md b/docs/zengin/scripts/extenders/lego/applications/render.md index 9e515a79c3..432bfd3af2 100644 --- a/docs/zengin/scripts/extenders/lego/applications/render.md +++ b/docs/zengin/scripts/extenders/lego/applications/render.md @@ -1,3 +1,7 @@ +--- +title: Render +description: LeGo package for rendering items on a screen +--- # Render With this package items can be rendered on the screen. Since items are rendered independently of the normal views, textures that are 'below' the items must also be managed by this package, this behaviour is managed by the priority system. The view with the highest priority is always rendered first, so it is at the bottom. In theory, any .3DS model can be rendered if you just create a suitable item script. ## Dependencies diff --git a/docs/zengin/scripts/extenders/lego/applications/saves.md b/docs/zengin/scripts/extenders/lego/applications/saves.md index a2c0cc6ff7..d0c95ea4eb 100644 --- a/docs/zengin/scripts/extenders/lego/applications/saves.md +++ b/docs/zengin/scripts/extenders/lego/applications/saves.md @@ -1,3 +1,7 @@ +--- +title: Saves +description: LeGo package offering open data stream to the game save file +--- # Saves Offers an open file stream that can read/write variables on save/load. It is used by [PermMem](../tools/permmem.md), so you don't need to address it manually anymore. diff --git a/docs/zengin/scripts/extenders/lego/tools/hook_engine.md b/docs/zengin/scripts/extenders/lego/tools/hook_engine.md index 8b102eb550..82d480104e 100644 --- a/docs/zengin/scripts/extenders/lego/tools/hook_engine.md +++ b/docs/zengin/scripts/extenders/lego/tools/hook_engine.md @@ -1,3 +1,7 @@ +--- +title: HookEngine +description: LeGo package for hooking engine functions +--- # HookEngine This package allows you to hook anywhere in an engine function to run your own Daedalus code. diff --git a/docs/zengin/scripts/extenders/lego/tools/int64.md b/docs/zengin/scripts/extenders/lego/tools/int64.md index 8af97f6def..dac5056ab3 100644 --- a/docs/zengin/scripts/extenders/lego/tools/int64.md +++ b/docs/zengin/scripts/extenders/lego/tools/int64.md @@ -1,3 +1,7 @@ +--- +title: Int64 +description: LeGo package implementing 64 bit integer support +--- # Int64 Int64 implements basic arithmetic for 64-bit integers based on machine code (hence the function signatures are also in machine code style). Furthermore, Int64 offers the constructor `int64@` for Int64 objects, but mk64 expects a pointer, not a handle. diff --git a/docs/zengin/scripts/extenders/lego/tools/item_helper.md b/docs/zengin/scripts/extenders/lego/tools/item_helper.md index eee957bd1d..1e0c374b18 100644 --- a/docs/zengin/scripts/extenders/lego/tools/item_helper.md +++ b/docs/zengin/scripts/extenders/lego/tools/item_helper.md @@ -1,3 +1,7 @@ +--- +title: ItemHelper +description: LeGo package that makes changing `C_ITEM` instance to `oCItem` pointer possible +--- # ItemHelper This package is very simple - it retrieves a `oCItem` pointer from an `C_ITEM` instance valid for the current world and session. diff --git a/docs/zengin/scripts/extenders/lego/tools/item_helper.pl.md b/docs/zengin/scripts/extenders/lego/tools/item_helper.pl.md index 6e574d364c..b76263bb24 100644 --- a/docs/zengin/scripts/extenders/lego/tools/item_helper.pl.md +++ b/docs/zengin/scripts/extenders/lego/tools/item_helper.pl.md @@ -1,5 +1,6 @@ --- title: ItemHelper +description: Pakiet LeGo umożliwiający zmianę instancji `C_ITEM` na pointer `oCItem` --- # ItemHelper - pomocnik do przedmiotów Ten pakiet jest bardzo prosty - pobiera wskaźnik `oCItem` z instancji `C_ITEM` ważnej dla bieżącego świata i sesji. diff --git a/docs/zengin/scripts/extenders/lego/tools/list.md b/docs/zengin/scripts/extenders/lego/tools/list.md index 884e37d031..2512ac66a8 100644 --- a/docs/zengin/scripts/extenders/lego/tools/list.md +++ b/docs/zengin/scripts/extenders/lego/tools/list.md @@ -1,3 +1,7 @@ +--- +title: List +description: LeGo package implementing `zCList` and `zCListSort` data types handling +--- # List The List package is a collection of functions designed to simplify the handling of `zCList` and `zCListSort` lists in daedalus. It offers a range of functions for creating, manipulating, and querying lists. diff --git a/docs/zengin/scripts/extenders/lego/tools/locals.md b/docs/zengin/scripts/extenders/lego/tools/locals.md index a3123f7727..fcc41fcf7b 100644 --- a/docs/zengin/scripts/extenders/lego/tools/locals.md +++ b/docs/zengin/scripts/extenders/lego/tools/locals.md @@ -1,3 +1,7 @@ +--- +title: Locals +description: LeGo package adding true local variables and final clause +--- # Locals Daedalus doesn't offer any local variables, which can quickly lead to problems with recursive functions. The Locals package allows variables to be saved temporarily on a pseudo-stack. Locals is a very specific package. People who work normally with Daedalus will probably never need it. diff --git a/docs/zengin/scripts/extenders/lego/tools/permmem.md b/docs/zengin/scripts/extenders/lego/tools/permmem.md index 96e31e52a7..a32df568ac 100644 --- a/docs/zengin/scripts/extenders/lego/tools/permmem.md +++ b/docs/zengin/scripts/extenders/lego/tools/permmem.md @@ -1,3 +1,7 @@ +--- +title: PermMem +description: LeGo package implementing automatic instances saving and loading +--- # PermMem PermMem is a powerful package that allows classes (or instances) to be used permanently even after loading or restarting by saving them to the ASCII `.ZEN` archive in the savegame directory. PermMem manages handles that are used to access instances, and provides various functions to manipulate these handles and instances. diff --git a/docs/zengin/scripts/extenders/lego/tools/queue.md b/docs/zengin/scripts/extenders/lego/tools/queue.md index 819052c933..f16a52283e 100644 --- a/docs/zengin/scripts/extenders/lego/tools/queue.md +++ b/docs/zengin/scripts/extenders/lego/tools/queue.md @@ -1,3 +1,7 @@ +--- +title: Queue +description: LeGo package implementing queue data structure +--- # Queue This package is an implementation of the Queue data structure and a queue for function calls. diff --git a/docs/zengin/scripts/extenders/lego/tools/random.md b/docs/zengin/scripts/extenders/lego/tools/random.md index c0f667d86e..1b5c48d6cd 100644 --- a/docs/zengin/scripts/extenders/lego/tools/random.md +++ b/docs/zengin/scripts/extenders/lego/tools/random.md @@ -1,3 +1,7 @@ +--- +title: Random +description: LeGo package providing a better alternative for a `Hlp_Random()` function +--- # Random Provides more random randomization than `Hlp_Random()` function. diff --git a/docs/zengin/scripts/extenders/lego/tools/talents.md b/docs/zengin/scripts/extenders/lego/tools/talents.md index faf9e96590..e252dd067c 100644 --- a/docs/zengin/scripts/extenders/lego/tools/talents.md +++ b/docs/zengin/scripts/extenders/lego/tools/talents.md @@ -1,3 +1,7 @@ +--- +title: Talents +description: LeGo package providing an extension for AIVar array +--- # Talents The Talents package does two things: diff --git a/docs/zengin/scripts/extenders/lego/tools/talents.pl.md b/docs/zengin/scripts/extenders/lego/tools/talents.pl.md index 3ca8f7d0e9..e7689a3069 100644 --- a/docs/zengin/scripts/extenders/lego/tools/talents.pl.md +++ b/docs/zengin/scripts/extenders/lego/tools/talents.pl.md @@ -1,5 +1,6 @@ --- title: Talents +description: Pakiet LeGo zapewniający rozszerzenie dla tablicy AIVar --- # Talents - talenty Ten pakiet robi dwie rzeczy: diff --git a/docs/zengin/scripts/extenders/lego/tools/timer.md b/docs/zengin/scripts/extenders/lego/tools/timer.md index 38a8d6ddc7..11bb06fb40 100644 --- a/docs/zengin/scripts/extenders/lego/tools/timer.md +++ b/docs/zengin/scripts/extenders/lego/tools/timer.md @@ -1,3 +1,7 @@ +--- +title: Timer +description: LeGo package for better game timer handling +--- # Timer Timer is a better alternative to the timers that Gothic offers. The [FrameFunctions](frame_functions.md) and [Anim8](../applications/anim8.md) packages are already based on it. It isn't possible to modify the current time, as this would only cause difficulties. diff --git a/docs/zengin/scripts/extenders/lego/tools/view.md b/docs/zengin/scripts/extenders/lego/tools/view.md index 2ae1886825..ada2fc380a 100644 --- a/docs/zengin/scripts/extenders/lego/tools/view.md +++ b/docs/zengin/scripts/extenders/lego/tools/view.md @@ -1,3 +1,7 @@ +--- +title: View +description: LeGo package for `zCView` handling in daedalus +--- # View This package can create textures on the screen and work with them in an extended manner. diff --git a/docs/zengin/scripts/extenders/lego/various/userconstants.md b/docs/zengin/scripts/extenders/lego/various/userconstants.md index c1be06fb4f..1bb6628585 100644 --- a/docs/zengin/scripts/extenders/lego/various/userconstants.md +++ b/docs/zengin/scripts/extenders/lego/various/userconstants.md @@ -1,3 +1,7 @@ +--- +title: User constants +description: LeGo package user-configurable constants description +--- # User constants All constants that the user can either use or even change freely are defined in [Userconst.d](https://github.com/Lehona/LeGo/blob/dev/Userconst.d) file. diff --git a/overrides/assets/images/c_menu_item_farmesize.png b/overrides/assets/images/c_menu_item_farmesize.png new file mode 100644 index 0000000000..b2769a5c28 Binary files /dev/null and b/overrides/assets/images/c_menu_item_farmesize.png differ