Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 4529 → Rev 4693

/polymer/eduke32/source/android/android-jni.cpp
57,14 → 57,18
 
float gameControlsAlpha = 0.5;
 
bool invertLook = false;
bool precisionShoot = false;
bool showSticks = true;
bool hideTouchControls = true;
static bool invertLook = false;
static bool precisionShoot = false;
static bool showSticks = true;
static bool hideTouchControls = true;
char toggleCrouch = true;
static bool selectLastWeap = true;
 
bool shooting = false;
static bool shooting = false;
 
static int weaponWheelVisible = false;
 
 
static int controlsCreated = 0;
touchcontrols::TouchControlsContainer controlsContainer;
 
73,12 → 77,11
touchcontrols::TouchControls *tcMenuMain=0;
touchcontrols::TouchControls *tcGameMain=0;
touchcontrols::TouchControls *tcGameWeapons=0;
touchcontrols::TouchControls *tcInventory=0;
//touchcontrols::TouchControls *tcInventory=0;
touchcontrols::TouchControls *tcAutomap=0;
 
 
touchcontrols::TouchJoy *touchJoyLeft;
touchcontrols::TouchJoy *touchJoyRight;
touchcontrols::WheelSelect *weaponWheel;
 
extern JNIEnv* env_;
172,6 → 175,33
env_->CallStaticVoidMethod(NativeLibClass, checkPauseMethod);
}
 
//This is a bit of a hack, if the weapon wheel was selected, then an inv chosen instead, we need to cancel the weapon selection
//NOT needed actually, weapon wheel disabled before is get finger up anyway
//static bool invWasSelected = false;
 
void showWeaponsInventory(bool show)
{
if (show)
{
for (int n=0; n<10; n++)
{
weaponWheel->setSegmentEnabled(n, (PortableRead(READ_WEAPONS) >> n) & 0x1);
}
 
//Show inventory buttons
tcGameWeapons->setAllButtonsEnable(true);
 
tcGameWeapons->fade(touchcontrols::FADE_IN, 5); //fade in
weaponWheelVisible = true;
}
else //hide
{
tcGameWeapons->setAllButtonsEnable(false);
weaponWheel->setTapMode(false);
weaponWheelVisible = false;
}
}
 
void gameButton(int state, int code)
{
switch (code)
194,22 → 224,16
break;
 
case KEY_SHOW_INVEN:
if (state != 1)
break;
 
if (!tcInventory->isEnabled())
if (state)
{
tcInventory->setEnabled(true);
tcInventory->fade(touchcontrols::FADE_IN, 5);
//disable weapon wheel so it does not show, enabled again after inventory cleared
tcGameWeapons->setEnabled(false);
if (!weaponWheelVisible)
{
weaponWheel->setTapMode(true);
showWeaponsInventory(true);
}
else
showWeaponsInventory(false);
}
else
{
tcInventory->setEnabled(false);
tcGameWeapons->setEnabled(true);
}
 
break;
 
case KEY_QUICK_SAVE:
238,8 → 262,8
PortableAction(state,code);
if (state == 0)
{
tcGameWeapons->setEnabled(true);
tcInventory->setEnabled(false);
//Inventory chosen, hide them and wheel
showWeaponsInventory(false);
}
}
 
248,61 → 272,58
PortableKeyEvent(state, code,code);
}
 
static int weaponWheelVisible = false;
 
void weaponWheelSelected(int enabled)
void blankTapButton(int state,int code)
{
if (!enabled)
if (PortableRead(READ_IS_DEAD)) //if the player is dead we need to send a 'open' button
{
//tcGameWeapons->fade(touchcontrols::FADE_OUT, 5);
weaponWheelVisible = false;
}
else
{
for (int n=0; n<10; n++)
if (state)
{
weaponWheel->setSegmentEnabled(n, (PortableRead(READ_WEAPONS) >> n) & 0x1);
PortableAction(1, gamefunc_Open);
PortableAction(0, gamefunc_Open);
}
 
tcGameWeapons->fade(touchcontrols::FADE_IN, 5); //fade in
weaponWheelVisible = true;
}
else //everything else send a return key
{
PortableKeyEvent(state, SDL_SCANCODE_RETURN,0);
}
 
}
 
void weaponWheelSelected(int enabled)
{
if (enabled)
{
tcInventory->setEnabled(true);
tcInventory->fade(touchcontrols::FADE_IN, 5);
//disable weapon wheel so it does not show, enabled again after inventory cleared
// tcGameWeapons->setEnabled(false);
showWeaponsInventory(true);
}
else
{
tcInventory->setEnabled(false);
// tcGameWeapons->setEnabled(true);
showWeaponsInventory(false);
}
 
}
 
void weaponWheelChosen(int segment)
{
LOGI("weaponWheel %d",segment);
 
//LOGI("weaponWheel %d",segment);
if (segment == -1) //Nothing was selected
{
int32_t lw = PortableRead(READ_LASTWEAPON);
if (selectLastWeap)
{
int32_t lw = PortableRead(READ_LASTWEAPON);
 
if (lw != -1)
PortableAction(2, gamefunc_Weapon_1 + lw);
 
return;
if (lw != -1)
PortableAction(2, gamefunc_Weapon_1 + lw);
}
}
 
PortableAction(2, gamefunc_Weapon_1 + segment);
else
{
PortableAction(2, gamefunc_Weapon_1 + segment);
}
}
 
void left_double_tap(int state)
{
LOGI("L double %d, droidinput.left_double_action = %d",state,droidinput.left_double_action);
//LOGI("L double %d, droidinput.left_double_action = %d",state,droidinput.left_double_action);
if (droidinput.left_double_action != -1)
PortableAction(state, droidinput.left_double_action);
}
317,7 → 338,6
void mouseMove(int action, float x, float y, float dx, float dy)
{
//LOGI(" mouse dx = %f, dy = %f",dx,dy);
 
if (weaponWheelVisible)
return;
 
327,10 → 347,22
-dy * droidinput.pitch_sens * scale * (invertLook ? -1.f : 1.f));
}
 
void automap_multitouch_mouse_move(int action,float x, float y,float dx, float dy)
{
 
if (action == MULTITOUCHMOUSE_MOVE)
{
PortableAutomapControl(0,dx,dy);
}
else if (action == MULTITOUCHMOUSE_ZOOM)
{
PortableAutomapControl(x,0,0);
}
}
 
void left_stick(float joy_x, float joy_y, float mouse_x, float mouse_y)
{
//LOGI("left_stick joy_x = %f, joy_y = %f",joy_x,joy_y);
 
joy_x *=10;
float strafe = joy_x*joy_x;
//float strafe = joy_x;
342,8 → 374,6
 
void right_stick(float joy_x, float joy_y, float mouse_x, float mouse_y)
{
//LOGI(" mouse x = %f",mouse_x);
 
mouseMove(0, joy_x, joy_y, mouse_x, mouse_y);
}
 
350,7 → 380,6
void setHideSticks(bool v)
{
if (touchJoyLeft) touchJoyLeft->setHideGraphics(v);
if (touchJoyRight) touchJoyRight->setHideGraphics(v);
}
 
void touchSettingsButton(int state)
385,24 → 414,24
 
tcBlankTap = new touchcontrols::TouchControls("blank_tap", false, false);
tcYesNo = new touchcontrols::TouchControls("yes_no", false, false);
tcMenuMain = new touchcontrols::TouchControls("menu", false, true,1,false);
tcMenuMain = new touchcontrols::TouchControls("menu", false, false);
tcGameMain = new touchcontrols::TouchControls("game", false,true,1,true);
tcGameWeapons = new touchcontrols::TouchControls("weapons", false,true,1,false);
tcAutomap = new touchcontrols::TouchControls("automap", false,true,1,false);
tcInventory = new touchcontrols::TouchControls("inventory", false,true,1,false);
tcAutomap = new touchcontrols::TouchControls("automap", false,false);
// tcInventory = new touchcontrols::TouchControls("inventory", false,true,1,false);
 
///////////////////////// BLANK TAP SCREEN //////////////////////
 
//One button on whole screen with no graphic, send a return key
tcBlankTap->addControl(new touchcontrols::Button("whole_screen", touchcontrols::RectF(0,0,26,16), "", SDL_SCANCODE_RETURN));
tcBlankTap->signal_button.connect( sigc::ptr_fun(&menuButton) ); //Just reuse the menuButton function
tcBlankTap->addControl(new touchcontrols::Button("whole_screen", touchcontrols::RectF(0,0,26,16), std::string("test"), SDL_SCANCODE_RETURN));
tcBlankTap->signal_button.connect( sigc::ptr_fun(&blankTapButton) ); //Just reuse the menuButton function
 
 
 
///////////////////////// YES NO SCREEN /////////////////////
 
tcYesNo->addControl(new touchcontrols::Button("enter", touchcontrols::RectF(8,10,11,13), "enter", SDL_SCANCODE_RETURN));
tcYesNo->addControl(new touchcontrols::Button("esc", touchcontrols::RectF(14,10,17,13), "esc", SDL_SCANCODE_ESCAPE));
tcYesNo->addControl(new touchcontrols::Button("enter", touchcontrols::RectF(8,10,11,13), "yes", SDL_SCANCODE_RETURN));
tcYesNo->addControl(new touchcontrols::Button("esc", touchcontrols::RectF(14,10,17,13), "no", SDL_SCANCODE_ESCAPE));
tcYesNo->signal_button.connect( sigc::ptr_fun(&menuButton) ); //Just reuse the menuButton function
 
 
410,6 → 439,7
///////////////////////// MAIN MENU SCREEN /////////////////////
 
//Menu
/* 3x3
tcMenuMain->addControl(new touchcontrols::Button("down_arrow", touchcontrols::RectF(20,13,23,16), "arrow_down", SDL_SCANCODE_DOWN, true)); //Repeating buttons
tcMenuMain->addControl(new touchcontrols::Button("up_arrow", touchcontrols::RectF(20,10,23,13), "arrow_up", SDL_SCANCODE_UP, true));
tcMenuMain->addControl(new touchcontrols::Button("left_arrow", touchcontrols::RectF(17,13,20,16), "arrow_left", SDL_SCANCODE_LEFT, true));
416,44 → 446,41
tcMenuMain->addControl(new touchcontrols::Button("right_arrow", touchcontrols::RectF(23,13,26,16), "arrow_right", SDL_SCANCODE_RIGHT, true));
tcMenuMain->addControl(new touchcontrols::Button("enter", touchcontrols::RectF(0,13,3,16), "enter", SDL_SCANCODE_RETURN));
tcMenuMain->addControl(new touchcontrols::Button("esc", touchcontrols::RectF(0,10,3,13), "esc", SDL_SCANCODE_ESCAPE));
*/
 
tcMenuMain->addControl(new touchcontrols::Button("down_arrow", touchcontrols::RectF(22,14,24,16), "arrow_down", SDL_SCANCODE_DOWN, true)); //Repeating buttons
tcMenuMain->addControl(new touchcontrols::Button("up_arrow", touchcontrols::RectF(22,12,24,14), "arrow_up", SDL_SCANCODE_UP, true));
tcMenuMain->addControl(new touchcontrols::Button("left_arrow", touchcontrols::RectF(20,14,22,16), "arrow_left", SDL_SCANCODE_LEFT, true));
tcMenuMain->addControl(new touchcontrols::Button("right_arrow", touchcontrols::RectF(24,14,26,16), "arrow_right", SDL_SCANCODE_RIGHT, true));
tcMenuMain->addControl(new touchcontrols::Button("enter", touchcontrols::RectF(0,14,2,16), "enter", SDL_SCANCODE_RETURN));
tcMenuMain->addControl(new touchcontrols::Button("esc", touchcontrols::RectF(0,12,2,14), "esc", SDL_SCANCODE_ESCAPE));
 
 
 
tcMenuMain->signal_button.connect( sigc::ptr_fun(&menuButton) );
tcMenuMain->setAlpha(1);
 
///////////////////////// AUTO MAP SCREEN ///////////////////////
 
/* FIXME: definitely hook this up
//Automap
tcAutomap->addControl(new touchcontrols::Button("down_arrow",touchcontrols::RectF(2,14,4,16),"arrow_down",PORT_ACT_MAP_DOWN));
tcAutomap->addControl(new touchcontrols::Button("up_arrow",touchcontrols::RectF(2,10,4,12),"arrow_up",PORT_ACT_MAP_UP));
tcAutomap->addControl(new touchcontrols::Button("left_arrow",touchcontrols::RectF(0,12,2,14),"arrow_left",PORT_ACT_MAP_LEFT));
tcAutomap->addControl(new touchcontrols::Button("right_arrow",touchcontrols::RectF(4,12,6,14),"arrow_right",PORT_ACT_MAP_RIGHT));
tcAutomap->addControl(new touchcontrols::Button("zoom_in",touchcontrols::RectF(4,10,6,12),"zoom_in",PORT_ACT_MAP_ZOOM_IN));
tcAutomap->addControl(new touchcontrols::Button("zoom_out",touchcontrols::RectF(4,14,6,16),"zoom_out",PORT_ACT_MAP_ZOOM_OUT));
 
tcAutomap->signal_button.connect( sigc::ptr_fun(&automapButton) );
tcAutomap->setAlpha(0.5);
*/
 
//////////////////////////// GAME SCREEN /////////////////////
tcGameMain->setAlpha(gameControlsAlpha);
controlsContainer.editButtonAlpha = gameControlsAlpha;
tcGameMain->addControl(new touchcontrols::Button("use", touchcontrols::RectF(23,3,26,6), "use", gamefunc_Open));
tcGameMain->addControl(new touchcontrols::Button("attack", touchcontrols::RectF(20,7,23,10), "fire2", gamefunc_Fire));
tcGameMain->addControl(new touchcontrols::Button("jump", touchcontrols::RectF(23,6,26,9), "jump", gamefunc_Jump));
tcGameMain->addControl(new touchcontrols::Button("crouch", touchcontrols::RectF(24,12,26,14), "crouch", gamefunc_Crouch));
tcGameMain->addControl(new touchcontrols::Button("kick", touchcontrols::RectF(20,4,23,7), "boot", gamefunc_Quick_Kick,false,true));
tcGameMain->addControl(new touchcontrols::Button("use", touchcontrols::RectF(23,3,26,6), "use", gamefunc_Open));
tcGameMain->addControl(new touchcontrols::Button("attack", touchcontrols::RectF(20,7,23,10), "fire2", gamefunc_Fire));
tcGameMain->addControl(new touchcontrols::Button("jump", touchcontrols::RectF(23,6,26,9), "jump", gamefunc_Jump));
tcGameMain->addControl(new touchcontrols::Button("crouch", touchcontrols::RectF(24,12,26,14), "crouch", gamefunc_Crouch));
tcGameMain->addControl(new touchcontrols::Button("kick","Mighty Foot", touchcontrols::RectF(20,4,23,7), "boot", gamefunc_Quick_Kick,false,true));
 
tcGameMain->addControl(new touchcontrols::Button("quick_save", touchcontrols::RectF(24,0,26,2), "save", KEY_QUICK_SAVE,false,true));
tcGameMain->addControl(new touchcontrols::Button("quick_load", touchcontrols::RectF(20,0,22,2), "load", KEY_QUICK_LOAD,false,true));
tcGameMain->addControl(new touchcontrols::Button("map", touchcontrols::RectF(4,0,6,2), "map", gamefunc_Map, false,true));
tcGameMain->addControl(new touchcontrols::Button("keyboard", touchcontrols::RectF(8,0,10,2), "keyboard", KEY_SHOW_KBRD, false,true));
tcGameMain->addControl(new touchcontrols::Button("quick_save","Quick Save", touchcontrols::RectF(22,0,24,2), "save", KEY_QUICK_SAVE,false,true));
tcGameMain->addControl(new touchcontrols::Button("quick_load","Quick Load", touchcontrols::RectF(20,0,22,2), "load", KEY_QUICK_LOAD,false,true));
touchcontrols::Button *map_button = new touchcontrols::Button("map","Autotmap", touchcontrols::RectF(6,0,8,2), "map", gamefunc_Map, false,true);
tcGameMain->addControl(map_button);
tcGameMain->addControl(new touchcontrols::Button("keyboard","Show Console", touchcontrols::RectF(8,0,10,2), "keyboard", KEY_SHOW_KBRD, false,true));
 
tcGameMain->addControl(new touchcontrols::Button("show_inventory",touchcontrols::RectF(2,0,4,2), "inv", KEY_SHOW_INVEN));
tcGameMain->addControl(new touchcontrols::Button("show_inventory","Show Inventory",touchcontrols::RectF(24,0,26,2), "inv", KEY_SHOW_INVEN));
 
tcGameMain->addControl(new touchcontrols::Button("next_weapon", touchcontrols::RectF(0,3,3,5), "next_weap",gamefunc_Next_Weapon,false,true));
tcGameMain->addControl(new touchcontrols::Button("prev_weapon", touchcontrols::RectF(0,5,3,7), "prev_weap",gamefunc_Previous_Weapon,false,true));
tcGameMain->addControl(new touchcontrols::Button("next_weapon","Next Weapon", touchcontrols::RectF(0,3,3,5), "next_weap",gamefunc_Next_Weapon,false,true));
tcGameMain->addControl(new touchcontrols::Button("prev_weapon","Previous Weapon", touchcontrols::RectF(0,5,3,7), "prev_weap",gamefunc_Previous_Weapon,false,true));
/*
//quick actions binds
tcGameMain->addControl(new touchcontrols::Button("quick_key_1",touchcontrols::RectF(4,3,6,5),"quick_key_1",KEY_QUICK_KEY1,false,true));
467,15 → 494,14
touchJoyLeft->signal_move.connect(sigc::ptr_fun(&left_stick) );
touchJoyLeft->signal_double_tap.connect(sigc::ptr_fun(&left_double_tap) );
 
//Right stick
touchJoyRight = new touchcontrols::TouchJoy("touch",touchcontrols::RectF(17,7,26,16),"look_arrow");
tcGameMain->addControl(touchJoyRight);
touchJoyRight->signal_move.connect(sigc::ptr_fun(&right_stick) );
touchJoyRight->signal_double_tap.connect(sigc::ptr_fun(&right_double_tap) );
touchJoyRight->setEnabled(false);
//Right stick (not used)
//touchJoyRight = new touchcontrols::TouchJoy("touch",touchcontrols::RectF(17,7,26,16),"look_arrow");
//tcGameMain->addControl(touchJoyRight);
//touchJoyRight->signal_move.connect(sigc::ptr_fun(&right_stick) );
//touchJoyRight->signal_double_tap.connect(sigc::ptr_fun(&right_double_tap) );
//touchJoyRight->setEnabled(false);
 
 
 
//Mouse look for whole screen
touchcontrols::Mouse *mouse = new touchcontrols::Mouse("mouse",touchcontrols::RectF(3,0,26,16),"");
mouse->signal_action.connect(sigc::ptr_fun(&mouseMove));
487,7 → 513,32
tcGameMain->signal_button.connect( sigc::ptr_fun(&gameButton) );
tcGameMain->signal_settingsButton.connect( sigc::ptr_fun(&gameSettingsButton) );
 
///////////////////////// AUTO MAP SCREEN ///////////////////////
 
 
//Automap
touchcontrols::MultitouchMouse *multimouse = new touchcontrols::MultitouchMouse("gamemouse",touchcontrols::RectF(0,0,26,16),"");
multimouse->setHideGraphics(true);
tcAutomap->addControl(multimouse);
multimouse->signal_action.connect(sigc::ptr_fun(&automap_multitouch_mouse_move) );
tcAutomap->addControl(map_button);
tcAutomap->signal_button.connect( sigc::ptr_fun(&gameButton) );
tcAutomap->setAlpha(0.5);
 
 
 
 
 
//Now inventory in the weapons control group!
tcGameWeapons->addControl(new touchcontrols::Button("jetpack", touchcontrols::RectF(0,3,2,5),"jetpack",gamefunc_Jetpack,false,false,true));
tcGameWeapons->addControl(new touchcontrols::Button("medkit", touchcontrols::RectF(0,5,2,7),"medkit",gamefunc_MedKit,false,false,true));
tcGameWeapons->addControl(new touchcontrols::Button("nightv", touchcontrols::RectF(0,7,2,9),"nightvision",gamefunc_NightVision,false,false,true));
tcGameWeapons->addControl(new touchcontrols::Button("holoduke",touchcontrols::RectF(0,9,2,11),"holoduke",gamefunc_Holo_Duke,false,false,true));
tcGameWeapons->addControl(new touchcontrols::Button("steroids",touchcontrols::RectF(0,11,2,13),"steroids",gamefunc_Steroids,false,false,true));
//Inventory are the only buttons so safe to do this
tcGameWeapons->signal_button.connect( sigc::ptr_fun(&inventoryButton) );
 
 
//Weapons
weaponWheel = new touchcontrols::WheelSelect("weapon_wheel",touchcontrols::RectF(7,2,19,14),"weapon_wheel_orange_blank",10);
weaponWheel->signal_selected.connect(sigc::ptr_fun(&weaponWheelChosen) );
495,6 → 546,7
tcGameWeapons->addControl(weaponWheel);
tcGameWeapons->setAlpha(0.9);
 
/*
tcInventory->addControl(new touchcontrols::Button("jetpack", touchcontrols::RectF(0,3,2,5),"jetpack",gamefunc_Jetpack));
tcInventory->addControl(new touchcontrols::Button("medkit", touchcontrols::RectF(0,5,2,7),"medkit",gamefunc_MedKit));
tcInventory->addControl(new touchcontrols::Button("nightv", touchcontrols::RectF(0,7,2,9),"nightvision",gamefunc_NightVision));
503,15 → 555,17
tcInventory->setAlpha(1);
 
tcInventory->signal_button.connect( sigc::ptr_fun(&inventoryButton));
*/
 
 
/////////////////////////////////////////////////////////////
 
 
controlsContainer.addControlGroup(tcMenuMain);
controlsContainer.addControlGroup(tcGameMain);
controlsContainer.addControlGroup(tcInventory);//Need to be above tcGameMain incase buttons over stick
// controlsContainer.addControlGroup(tcInventory);//Need to be above tcGameMain incase buttons over stick
controlsContainer.addControlGroup(tcGameWeapons);
//controlsContainer.addControlGroup(tcAutomap);
controlsContainer.addControlGroup(tcAutomap);
controlsContainer.addControlGroup(tcYesNo);
controlsContainer.addControlGroup(tcBlankTap);
controlsCreated = 1;
525,8 → 579,9
tcGameMain->setXMLFile((std::string)graphics_path + "/game.xml");
tcGameWeapons->setXMLFile((std::string)graphics_path + "/weapons.xml");
tcAutomap->setXMLFile((std::string)graphics_path + "/automap.xml");
tcInventory->setXMLFile((std::string)graphics_path + "/inventory.xml");
// tcInventory->setXMLFile((std::string)graphics_path + "/inventory.xml");
 
setControlsContainer(&controlsContainer);
}
else
LOGI("NOT creating controls");
536,7 → 591,7
 
void updateTouchScreenMode(touchscreemode_t mode)
{
// LOGI("updateTouchScreenModeA %d",mode);
// LOGI("updateTouchScreenModeA %d",mode);
 
static touchscreemode_t lastMode = TOUCH_SCREEN_BLANK;
 
565,9 → 620,11
 
tcGameMain->fade(touchcontrols::FADE_OUT,DEFAULT_FADE_FRAMES);
tcGameWeapons->setEnabled(false);
tcInventory->setEnabled(false);
 
break;
case TOUCH_SCREEN_AUTOMAP:
tcAutomap->resetOutput();
tcAutomap->fade(touchcontrols::FADE_OUT,DEFAULT_FADE_FRAMES);
break;
case TOUCH_SCREEN_CONSOLE:
break;
588,14 → 645,20
case TOUCH_SCREEN_MENU:
tcMenuMain->setEnabled(true);
tcMenuMain->fade(touchcontrols::FADE_IN,DEFAULT_FADE_FRAMES);
 
//This is a bit of a hack, we need to enable the inventory buttons so they can be edited, they will not be seen anyway
showWeaponsInventory(true);
break;
case TOUCH_SCREEN_GAME:
tcGameMain->setEnabled(true);
tcGameMain->fade(touchcontrols::FADE_IN,DEFAULT_FADE_FRAMES);
tcGameWeapons->setEnabled(true);
tcInventory->setEnabled(false);
showWeaponsInventory(false);
break;
case TOUCH_SCREEN_AUTOMAP:
tcAutomap->setEnabled(true);
tcAutomap->fade(touchcontrols::FADE_IN,DEFAULT_FADE_FRAMES);
 
break;
case TOUCH_SCREEN_CONSOLE:
break;
612,19 → 675,16
#include "s-setup/gp_lic_include.h"
#endif
 
extern int clearCtrl;
void frameControls()
{
static int loadedGLImages = 0;
 
//LOGI("frameControls");
clearCtrl ++;
LOGI("frameControls");
 
 
//We need to do this here now because duke loads a new gl context
if (!loadedGLImages)
{
touchJoyRight->setEnabled(false);
 
controlsContainer.initGL();
loadedGLImages = 1;
}
634,41 → 694,7
 
updateTouchScreenMode((touchscreemode_t)PortableRead(READ_SCREEN_MODE));
 
/*
int inMenuNew = PortableRead(READ_MENU);
if (inMenuLast != inMenuNew)
{
inMenuLast = inMenuNew;
if (!inMenuNew)
{
tcGameMain->setEnabled(true);
tcGameWeapons->setEnabled(true);
tcGameWeapons->fade(1,DEFAULT_FADE_FRAMES);
tcMenuMain->setEnabled(false);
}
else
{
tcGameMain->setEnabled(false);
tcGameWeapons->setEnabled(false);
tcMenuMain->setEnabled(true);
}
}
 
int inAutomapNew = PortableRead(READ_AUTOMAP) && !inMenuLast; //Dont show if menu comes up
if (inAutomapLast != inAutomapNew)
{
inAutomapLast = inAutomapNew;
if (inAutomapNew)
{
tcAutomap->animateIn(5);
}
else
{
tcAutomap->animateOut(5);
}
}
*/
 
setHideSticks(!showSticks);
controlsContainer.draw();
 
695,6 → 721,7
}
 
// TODO: defined names for these values
selectLastWeap = other & 0x1 ? true : false;
toggleCrouch = other & 0x2 ? true : false;
invertLook = other & 0x4 ? true : false;
precisionShoot = other & 0x8 ? true : false;
702,30 → 729,12
 
hideTouchControls = other & 0x80000000 ? true : false;
 
switch ((other>>4) & 0xF)
{
case 1:
droidinput.left_double_action = gamefunc_Fire;
break;
case 2:
droidinput.left_double_action = gamefunc_Jump;
break;
default:
droidinput.left_double_action = -1;
}
int doubletap_options[6] = {0,gamefunc_Fire,gamefunc_Jump,gamefunc_Quick_Kick,gamefunc_MedKit,gamefunc_Jetpack};
 
switch ((other>>8) & 0xF)
{
case 1:
droidinput.right_double_action = gamefunc_Fire;
break;
case 2:
droidinput.right_double_action = gamefunc_Jump;
break;
default:
droidinput.right_double_action = -1;
}
droidinput.left_double_action = doubletap_options[((other>>4) & 0xF)];
droidinput.right_double_action = doubletap_options[((other>>8) & 0xF)];
 
 
droidinput.strafe_sens = strafe;
droidinput.forward_sens = fwd;
droidinput.pitch_sens = pitch;
734,7 → 743,7
LOGI("setTouchSettings alpha = %f, left_double_action = %d",alpha,droidinput.left_double_action);
}
 
#define EXPORT_ME __attribute__ ((visibility("default")))
#define EXPORT_ME __NDK_FPABI__ __attribute__ ((visibility("default")))
 
JNIEnv* env_;
 
748,6 → 757,7
return doom_path.c_str();
}
 
 
jint EXPORT_ME
Java_com_beloko_duke_engine_NativeLib_init( JNIEnv* env,
jobject thiz,jstring graphics_dir,jint audio_rate,jint audio_buffer_size,jobjectArray argsArray,jint renderer,jstring doom_path_ )