11,6 → 11,8 |
#include "jmact/keyboard.h" |
#include "jmact/control.h" |
|
#include "menus.h" |
|
#include "../src/video/android/SDL_androidkeyboard.h" // FIXME: include header locally if necessary |
|
#include "in_android.h" |
81,7 → 83,7 |
|
if (action >= MENU_UP && action <= MENU_BACK) |
{ |
if (PortableRead(READ_MENU)) |
if (PortableRead(READ_SCREEN_MODE) == TOUCH_SCREEN_MENU) |
{ |
int sdl_code [] = { SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, |
SDL_SCANCODE_RIGHT, SDL_SCANCODE_RETURN, SDL_SCANCODE_ESCAPE }; |
91,8 → 93,8 |
} |
else |
{ |
if (PortableRead(READ_MENU)) //If in the menu, dont do any game actions |
return; |
//if (PortableRead(READ_SCREEN_MODE) != TOUCH_SCREEN_GAME) //If not in game don't do any of this |
/// return; |
|
#ifdef GP_LIC |
#define GP_LIC_INC 5 |
165,18 → 167,45 |
|
void PortableInit(int argc, const char ** argv) |
{ |
droidinput.left_double_action = -1; |
droidinput.right_double_action = -1; |
//droidinput.left_double_action = -1; |
//droidinput.right_double_action = -1; |
|
main(argc, argv); |
} |
|
|
extern int animation_playing; |
|
int32_t PortableRead(portableread_t r) |
{ |
switch (r) |
{ |
case READ_MENU: |
return (g_player[myconnectindex].ps->gm & MODE_MENU) == MODE_MENU || (g_player[myconnectindex].ps->gm & MODE_GAME) != MODE_GAME; |
case READ_SCREEN_MODE: |
|
if (animation_playing) |
return TOUCH_SCREEN_BLANK_TAP; |
else if ((g_player[myconnectindex].ps->gm & MODE_MENU) == MODE_MENU) |
{ |
//Then check if Yes/No menu |
if ((g_currentMenu == MENU_QUITTOTITLE) || |
(g_currentMenu == MENU_RESETPLAYER ) || |
(g_currentMenu == MENU_RESETPLAYER2 ) || |
((g_currentMenu >= MENU_LOADVERIFY ) && (g_currentMenu <= MENU_LOADVERIFY10 )) || |
(g_currentMenu == MENU_NEWVERIFY ) || |
((g_currentMenu >= MENU_SAVEVERIFY ) && (g_currentMenu <= MENU_SAVEVERIFY10 )) || |
(g_currentMenu == MENU_QUIT ) || |
(g_currentMenu == MENU_QUIT2) || |
(g_currentMenu == MENU_QUITTOTITLE ) |
) |
return TOUCH_SCREEN_YES_NO; |
else |
return TOUCH_SCREEN_MENU; |
} |
else if ((g_player[myconnectindex].ps->gm & MODE_GAME)) |
return TOUCH_SCREEN_GAME; |
else |
return TOUCH_SCREEN_BLANK_TAP; |
|
case READ_WEAPONS: |
return g_player[myconnectindex].ps->gotweapon; |
case READ_AUTOMAP: |
208,6 → 237,7 |
droidinput.functionHeld &= ~((uint64_t)1<<((uint64_t)(whichbutton))); |
} |
|
int clearCtrl=1; |
void CONTROL_Android_PollDevices(ControlInfo *info) |
{ |
//LOGI("CONTROL_Android_PollDevices %f %f",forwardmove,sidemove); |
220,9 → 250,19 |
info->dyaw = (int32_t)nearbyint(-droidinput.yaw * ANDROIDYAWFACTOR - |
droidinput.yaw_joystick * ANDROIDYAWFACTORJOYSTICK); |
|
//droidinput.forwardmove = droidinput.sidemove = 0.f; |
/* |
if (clearCtrl == 0) |
clearCtrl = 1; |
|
LOGI("ctrl = %d",clearCtrl); |
info->dpitch *= clearCtrl; |
info->dyaw *= clearCtrl; |
*/ |
|
droidinput.pitch = droidinput.yaw = 0.f; |
|
clearCtrl = 0; |
|
CONTROL_ButtonState = 0; |
CONTROL_ButtonState |= droidinput.functionSticky; |
CONTROL_ButtonState |= droidinput.functionHeld; |