C_MENU_ITEM Daedalus class
Acknowledgment
Heavily inspired by the amazing documentation site Gothic library
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
script file.
C_Menu_Item Daedalus class
Class members
Property | Type | Description |
---|---|---|
fontName | string | Font of the menu item. |
text | string | Text of the interface element. |
backPic | string | Background image of menu items. |
alphaMode | string | Transparency blending mode of menu items. |
alpha | int | Transparency of the menu item. |
type | int | Type of the interface element. |
onSelAction | int | Array of commands executed when selecting the menu item. |
onSelAction_S | string | Arguments for commands specified in the onSelAction property. |
onChgSetOption | string | Gothic.ini file parameter modified by this menu item. |
onChgSetOptionSection | string | Section of the Gothic.ini file where the modified parameter is located. |
onEventAction | Func | Call the required function by a constant identifier. |
posx | int | Top-left point of the menu item on the screen horizontally (X-axis). |
posy | int | Top-left point of the menu item on the screen vertically (Y-axis). |
dimx | int | Width of the menu item in virtual coordinates. |
dimy | int | Height of the menu item in virtual coordinates. |
sizeStartScale | float | Initial size of the item. Not used. |
flags | int | Flags of the menu item. |
openDelayTime | float | Delay before opening the item. Not used. |
openDuration | float | Opening time. Not used. |
userFloat | float | Digital settings of menu items. |
userString | string | String settings of menu items. |
frameSizeX | int | Text offset inside the frame on the X-axis. |
frameSizeY | int | Text offset inside the frame on the Y-axis. |
hideIfOptionSectionSet | string | Section of Gothic.ini file where the option determining the display of this menu item is located. |
hideIfOptionSet | string | Gothic.ini file parameter determining the display of this menu item. |
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.
Also used to display hints about the item at the bottom of the menu when the MENU_SHOW_INFO
flag is set.
backPic
Background image of the menu item in *.TGA
format.
alphaMode
Texture transparency blending mode. Used in conjunction with the alpha property. This parameter's value is ignored if the 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
andMUL2
Multiplies the alpha channel of the texture by the background.
alpha
Menu element transparency. Accepts values ββfrom 0 to 255. Without specifying the backPic property, the value of this parameter is ignored.
The alpha channel rendering mode is determined using the alphaMode property.
type
Interface element type. Some interface elements have their own settings determined by the userFloat and userString properties.
Constants for menu item types are described in the file Scripts/System/_intern/Menu.d
.
-
MENU_ITEM_UNDEF
Undefined element type. Not used in scripts. -
MENU_ITEM_TEXT
Menu item type "Text". Text can be multiline by setting theIT_MULTILINE
flag. -
MENU_ITEM_SLIDER
Menu item type "Slider". Additional settings are provided for the slider.userFloat[0]
property determines the number of divisions for the slider.userFloat[1]
property determines the width of the slider.userString[0]
property determines the background image for the slider thumb.
-
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]
property determines which image will be used for the disabled button. The backPic property is responsible for the background image of the enabled button.
- The
-
MENU_ITEM_LISTBOX
Menu item type used in the "Quest Log" menu.- The
userString[0]
property determines which task list will be displayed in this element.
- The
onSelAction
Array of commands executed when selecting the menu item.
Each command receives parameters in the onSelAction_S
property.
Constants are described in the file Scripts/System/_intern/Menu.d
.
onSelAction_S
Arguments for commands specified in the 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. -
SEL_ACTION_BACK
This command has no arguments. It returns to the previous menu or the game. -
SEL_ACTION_STARTMENU
The argument for this command is the menu instance. The specified menu will be displayed. -
SEL_ACTION_STARTITEM
The argument is an interface element serving as a slot for saving the game. -
SEL_ACTION_CLOSE
The closing menu command supports the following arguments:-
NEW_GAME
Start a new game. -
LEAVE_GAME
Exit the game. -
SAVEGAME_SAVE
Save the game to the selected slot and return to the game. -
SAVEGAME_LOAD
Load the game from the selected slot and return to the game.
-
-
SEL_ACTION_CONCOMMANDS
The argument is a console commands. -
SEL_ACTION_PLAY_SOUND
The argument is an C_SFX class instance. -
SEL_ACTION_EXECCOMMANDS
There are two supported executable commands:RUN
andEFFECTS
.-
RUN
Indicates the instance of the menu element that is used to select the key. -
EFFECTS
Specifies the menu item instance to which the focus switches.
There are also two commands,
SETDEFAULT
andSETALTERNATIVE
, 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.
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.
onChgSetOptionSection
The section of the Gothic.ini file in which the parameter being changed is located.
See 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
.
For example, you can use the function associated with the constant EVENT_EXECUTE
to call a script function.
posx
The horizontal position of the top left point of the menu on the screen, measured in virtual coordinates.
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
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
.
-
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.Intended use
In early engine versions, the initial position of the element could be specified using the
startPosX
andstartPosY
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.
-
IT_TXT_CENTER
Aligns the text in the element to the center. -
IT_DISABLED
The menu item becomes inactive. -
IT_FADE
Empty flag. Not used. -
IT_EFFECTS_NEXT
This flag affects the next neighboring element, i.e., the element specified in theitems
list of theC_MENU
class.In this case, the element affecting (MENUITEM_GAME_SUB_TITLES_CHOICE) is usually made non-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 theextendedMenu
parameter in theGothic.ini
file is set to1
.
openDelayTime
Deprecated setting
Delay before opening a menu item.
openDuration
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.
userString
String settings of the interface element. The purpose of the property changes depending on the interface element. See 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 MENU_ITEM_LISTBOX
.
As a result, we get the following frame (Source: Gothic-Library):
And the width and height of the frame are set, as for all elements, by the dimx and 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 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
and 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.
Tip
Gothic.ini
settings can also be changed through the main menu. See onChgSetOption
and onChgSetOptionSection
.
hideIfOptionSet
The Gothic.ini
file parameter, the value of which determines the display of this menu item.
hideOnValue
The value of the Gothic.ini
file parameter at which this interface element is not displayed.
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. |