Skip to content

Commit

Permalink
Add menu item class
Browse files Browse the repository at this point in the history
  • Loading branch information
szapp committed May 6, 2024
1 parent 0c7e5c3 commit ea07561
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 8 deletions.
1 change: 1 addition & 0 deletions Ninja/Stamina/Menu.src
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
System\dependencies.d
System\MENU_OPT_CONTROLS_STAMINA.d
16 changes: 8 additions & 8 deletions Ninja/Stamina/System/MENU_OPT_CONTROLS_STAMINA.D
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// English
instance MENUITEM_KEY_EN_PATCH_STAMINA(C_MENU_ITEM_DEF)
instance Menuitem_KEY_EN_Patch_Stamina(Patch_Stamina_C_Menu_Item_Def /* C_Menu_Item_Def */)
{
text[0] = "Sprint";
text[1] = "Press DEL to remove and ENTER to define a key.";
Expand All @@ -8,7 +8,7 @@ instance MENUITEM_KEY_EN_PATCH_STAMINA(C_MENU_ITEM_DEF)
onSelAction_S[0] = "RUN MENUITEM_INP_EN_PATCH_STAMINA";
};

instance MENUITEM_INP_EN_PATCH_STAMINA(C_MENU_ITEM_DEF)
instance Menuitem_INP_EN_Patch_Stamina(Patch_Stamina_C_Menu_Item_Def /* C_Menu_Item_Def */)
{
type = /*MENU_ITEM_INPUT*/ 3;
text[1] = "Press the desired key.";
Expand All @@ -20,7 +20,7 @@ instance MENUITEM_INP_EN_PATCH_STAMINA(C_MENU_ITEM_DEF)


// German
instance MENUITEM_KEY_DE_PATCH_STAMINA(C_MENU_ITEM_DEF)
instance Menuitem_KEY_DE_Patch_Stamina(Patch_Stamina_C_Menu_Item_Def /* C_Menu_Item_Def */)
{
text[0] = "Sprinten";
text[1] = "Taste ENTF zum Löschen und RETURN zum definieren";
Expand All @@ -29,7 +29,7 @@ instance MENUITEM_KEY_DE_PATCH_STAMINA(C_MENU_ITEM_DEF)
onSelAction_S[0] = "RUN MENUITEM_INP_DE_PATCH_STAMINA";
};

instance MENUITEM_INP_DE_PATCH_STAMINA(C_MENU_ITEM_DEF)
instance Menuitem_INP_DE_Patch_Stamina(Patch_Stamina_C_Menu_Item_Def /* C_Menu_Item_Def */)
{
type = /*MENU_ITEM_INPUT*/ 3;
text[1] = "Gewünschte Taste betätigen.";
Expand All @@ -41,7 +41,7 @@ instance MENUITEM_INP_DE_PATCH_STAMINA(C_MENU_ITEM_DEF)


// Polish
instance MENUITEM_KEY_PL_PATCH_STAMINA(C_MENU_ITEM_DEF)
instance Menuitem_KEY_PL_Patch_Stamina(Patch_Stamina_C_Menu_Item_Def /* C_Menu_Item_Def */)
{
text[0] = "Sprint";
text[1] = "DEL - usuwa, ENTER - przypisuje klawisz.";
Expand All @@ -50,7 +50,7 @@ instance MENUITEM_KEY_PL_PATCH_STAMINA(C_MENU_ITEM_DEF)
onSelAction_S[0] = "RUN MENUITEM_INP_PL_PATCH_STAMINA";
};

instance MENUITEM_INP_PL_PATCH_STAMINA(C_MENU_ITEM_DEF)
instance Menuitem_INP_PL_Patch_Stamina(Patch_Stamina_C_Menu_Item_Def /* C_Menu_Item_Def */)
{
type = /*MENU_ITEM_INPUT*/ 3;
text[1] = "Naci¶nij ¿±dany klawisz.";
Expand All @@ -62,7 +62,7 @@ instance MENUITEM_INP_PL_PATCH_STAMINA(C_MENU_ITEM_DEF)


// Russian
instance MENUITEM_KEY_RU_PATCH_STAMINA(C_MENU_ITEM_DEF)
instance Menuitem_KEY_RU_Patch_Stamina(Patch_Stamina_C_Menu_Item_Def /* C_Menu_Item_Def */)
{
text[0] = "ñïðèíò";
text[1] = "íàæìèòå DEL, ÷òîáû î÷èñòèòü ñëîò èëè ENTER, ÷òîáû ïåðåîïðåäåëèòü";
Expand All @@ -71,7 +71,7 @@ instance MENUITEM_KEY_RU_PATCH_STAMINA(C_MENU_ITEM_DEF)
onSelAction_S[0] = "RUN MENUITEM_INP_RU_PATCH_STAMINA";
};

instance MENUITEM_INP_RU_PATCH_STAMINA(C_MENU_ITEM_DEF)
instance Menuitem_INP_RU_Patch_Stamina(Patch_Stamina_C_Menu_Item_Def /* C_Menu_Item_Def */)
{
type = /*MENU_ITEM_INPUT*/ 3;
text[1] = "Ïîæàëóéñòà, íàæìèòå êëàâèøó äëÿ ýòîãî äåéñòâèÿ.";
Expand Down
68 changes: 68 additions & 0 deletions Ninja/Stamina/System/dependencies.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Re-define the menu item class because it is not guaranteed that it exists in every mod.
* Note, that the original class/prototype are not overwritten but unique symbol names are used.
*/

class Patch_Stamina_C_Menu_Item /* C_Menu_Item */ {
var string fontName;
var string text[10];
var string backPic;
var string alphaMode;
var int alpha;
var int type;
var int onSelAction[5];
var string onSelAction_S[5];
var string onChgSetOption;
var string onChgSetOptionSection;
var func onEventAction[10];
var int posx;
var int posy;
var int dimx;
var int dimy;
var float sizeStartScale;
var int flags;
var float openDelayTime;
var float openDuration;
var float userFloat[4];
var string userString[4];
var int frameSizeX;
var int frameSizeY;
// Gothic 1.30 / Gothic 2.6 only. Not needed here
// var string hideIfOptionSectionSet;
// var string hideIfOptionSet;
// var int hideOnValue;
};

prototype Patch_Stamina_C_Menu_Item_Def(PATCH_STAMINA_C_MENU_ITEM /* C_Menu_Item */) {
// Constants
const string MENU_FONT_DEFAULT = "font_old_20_white.tga";
const int MENU_ITEM_TEXT = 1;
const int IT_CHROMAKEYED = 1;
const int IT_TRANSPARENT = 2;
const int IT_SELECTABLE = 4;
const int SEL_ACTION_BACK = 1;

fontName = "font_old_20_white.tga";
text = "";
alphaMode = "BLEND";
alpha = 254;
type = MENU_ITEM_TEXT;
posx = 0;
posy = 0;
dimx = -1;
dimy = -1;
flags = IT_CHROMAKEYED|IT_TRANSPARENT|IT_SELECTABLE;
openDelayTime = 0;
openDuration = -1;
sizeStartScale = 1;
userFloat[0] = 100;
userFloat[1] = 200;
onSelAction[0] = SEL_ACTION_BACK;
onChgSetOption = "";
onChgSetOptionSection = "INTERNAL";
hideIfOptionSectionSet = "";

Check failure on line 63 in Ninja/Stamina/System/dependencies.d

View workflow job for this annotation

GitHub Actions / Patch Validator

Reference violation: HIDEIFOPTIONSECTIONSET

The symbol "HIDEIFOPTIONSECTIONSET" might not exist ("Unknown identifier"). Reference only symbols that are declared in the patch or safely search for other symbols by their name.
Raw output
if (MEM_FindParserSymbol("HIDEIFOPTIONSECTIONSET") != -1) {
    var zCPar_Symbol symb; symb = _^(MEM_GetSymbol("HIDEIFOPTIONSECTIONSET"));
    // Access content with symb.content
} else {
    // Fallback to a default if the symbol does not exist
};
hideIfOptionSet = "";

Check failure on line 64 in Ninja/Stamina/System/dependencies.d

View workflow job for this annotation

GitHub Actions / Patch Validator

Reference violation: HIDEIFOPTIONSET

The symbol "HIDEIFOPTIONSET" might not exist ("Unknown identifier"). Reference only symbols that are declared in the patch or safely search for other symbols by their name.
Raw output
if (MEM_FindParserSymbol("HIDEIFOPTIONSET") != -1) {
    var zCPar_Symbol symb; symb = _^(MEM_GetSymbol("HIDEIFOPTIONSET"));
    // Access content with symb.content
} else {
    // Fallback to a default if the symbol does not exist
};
hideOnValue = -1;

Check failure on line 65 in Ninja/Stamina/System/dependencies.d

View workflow job for this annotation

GitHub Actions / Patch Validator

Reference violation: HIDEONVALUE

The symbol "HIDEONVALUE" might not exist ("Unknown identifier"). Reference only symbols that are declared in the patch or safely search for other symbols by their name.
Raw output
if (MEM_FindParserSymbol("HIDEONVALUE") != -1) {
    var zCPar_Symbol symb; symb = _^(MEM_GetSymbol("HIDEONVALUE"));
    // Access content with symb.content
} else {
    // Fallback to a default if the symbol does not exist
};
frameSizeX = 0;
frameSizeY = 0;
};

0 comments on commit ea07561

Please sign in to comment.