Auto-Map controls

This commit is contained in:
Simon 2016-03-07 22:22:11 +00:00
parent 2dddd6ad40
commit cc28497ed2
3 changed files with 38 additions and 5 deletions

View file

@ -275,6 +275,19 @@ JNIEXPORT jint JNICALL Java_doom_util_Natives_gameState
demoplayback ? 1 : 0; demoplayback ? 1 : 0;
} }
JNIEXPORT jint JNICALL Java_doom_util_Natives_isMapShowing
(JNIEnv * env, jclass cls)
{
return (int) automapmode;
}
JNIEXPORT jint JNICALL Java_doom_util_Natives_isMenuShowing
(JNIEnv * env, jclass cls)
{
return menuactive ? 1 : 0;
}
/** /**
* Get java array length * Get java array length
*/ */

View file

@ -97,16 +97,34 @@ public class DoomTools {
switch (key) { switch (key) {
case KeyEvent.KEYCODE_DPAD_LEFT: case KeyEvent.KEYCODE_DPAD_LEFT:
return KEY_A; if(Natives.isMapShowing() == 0 || Natives.isMenuShowing() != 0)
return KEY_A;
else
return 0xac;
case KeyEvent.KEYCODE_DPAD_RIGHT: case KeyEvent.KEYCODE_DPAD_RIGHT:
return KEY_D; if(Natives.isMapShowing() == 0 || Natives.isMenuShowing() != 0)
return KEY_D;
else
return 0xae;
case KeyEvent.KEYCODE_DPAD_UP: case KeyEvent.KEYCODE_DPAD_UP:
return KEY_W; if(Natives.isMapShowing() == 0 || Natives.isMenuShowing() != 0)
return KEY_W;
else
return 0xad;
case KeyEvent.KEYCODE_DPAD_DOWN: case KeyEvent.KEYCODE_DPAD_DOWN:
return KEY_S; if(Natives.isMapShowing() == 0 || Natives.isMenuShowing() != 0)
return KEY_S;
else
return 0xaf;
case KeyEvent.KEYCODE_BUTTON_THUMBR:
return 0x69;
case KeyEvent.KEYCODE_BUTTON_THUMBL:
return 0x6f;
// Left // Left
case 84: // SYM case 84: // SYM

View file

@ -70,8 +70,10 @@ public class Natives
*/ */
public static native int motionEvent(int b, int x, int y); public static native int motionEvent(int b, int x, int y);
//Returns whether menu or map is showing //Little game state getters
public static native int gameState(); public static native int gameState();
public static native int isMapShowing();
public static native int isMenuShowing();
/*********************************************************** /***********************************************************
* C - Callbacks * C - Callbacks