Zwip-Zwap Zapony
Member
(EXE Modding) Making an "extern INT32" thing be considered integers when compiling?
I'm working on an EXE modification, where I want to check a struct thingie through the "case" of a "switch (variable)".
However, when I try to compile it, even though it can only ever contain integer numbers in-game, the compiler complains about it, saying "case label does not be reduce to an integer amount".
Is there any way to get around this correctly? See the spoiler for code snippets.
Edit: If you saw the previous edit, sorry, false alarm, not fixed.
I'm working on an EXE modification, where I want to check a struct thingie through the "case" of a "switch (variable)".
However, when I try to compile it, even though it can only ever contain integer numbers in-game, the compiler complains about it, saying "case label does not be reduce to an integer amount".
Is there any way to get around this correctly? See the spoiler for code snippets.
g_input.h:
g_input.c:
m_menu.c:
The compiling errors point at the start of the "gamecontrolmenu[mc_thing][X]" things in m_menu.c. I have tried laying them out as "(gamecontrolmenu[mc_thing][X])" too, which didn't fix it.
Code:
-
typedef enum
{
mc_null = 0, // A key/button mapped to mc_null has no effect
mc_up,
mc_down,
mc_right,
mc_left,
mc_confirm,
mc_cancel,
mc_clear,
mc_openmenu,
num_menucontrols
} menucontrols_e;
-
extern INT32 gamecontrolmenu[num_menucontrols][2]; // Menu navigation
-
Code:
-
INT32 gamecontrolmenu[num_menucontrols][2]; // Menu navigation
-
Code:
-
else if (ev->type == ev_keydown)
{
ch = ev->data1;
// R.I.P. "remap virtual keys" for joysticks 5/2/1998 - Some day in September/2016
// But hey, we got user-customizable controls instead, which supports joysticks too!
switch (ch)
{
case KEY_LSHIFT:
case KEY_RSHIFT:
shiftdown = true;
break; //return false;
case gamecontrolmenu[mc_confirm][0]:
case gamecontrolmenu[mc_confirm][1]:
ch = KEY_ENTER;
break;
// Escape and Backspace must be done on a case-by-case basis, so they're not here
case gamecontrolmenu[mc_up][0]:
case gamecontrolmenu[mc_up][1]:
ch = KEY_UPARROW;
break;
case gamecontrolmenu[mc_down][0]:
case gamecontrolmenu[mc_down][1]:
ch = KEY_DOWNARROW;
break;
case gamecontrolmenu[mc_left][0]:
case gamecontrolmenu[mc_left][1]:
ch = KEY_LEFTARROW;
break;
case gamecontrolmenu[mc_right][0]:
case gamecontrolmenu[mc_right][1]:
ch = KEY_RIGHTARROW;
break;
}
}
-
Last edited: