2015-07-08 03:34:24 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 2015 EDuke32 developers and contributors
|
|
|
|
Copyright (C) 2015 Voidpoint, LLC
|
|
|
|
|
|
|
|
This file is part of EDuke32.
|
|
|
|
|
|
|
|
EDuke32 is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License version 2
|
|
|
|
as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
2015-02-11 05:22:19 +00:00
|
|
|
#include "compat.h"
|
2014-03-22 09:25:51 +00:00
|
|
|
#include "sdl_inc.h"
|
|
|
|
#include "baselayer.h"
|
|
|
|
#include "keys.h"
|
|
|
|
#include "duke3d.h"
|
|
|
|
#include "common_game.h"
|
|
|
|
#include "osd.h"
|
|
|
|
#include "player.h"
|
2014-04-12 08:45:50 +00:00
|
|
|
#include "game.h"
|
|
|
|
#include "build.h"
|
2015-02-11 05:22:19 +00:00
|
|
|
#include "anim.h"
|
|
|
|
#include "player.h"
|
2014-03-22 09:25:51 +00:00
|
|
|
|
2017-02-01 10:20:54 +00:00
|
|
|
#include "keyboard.h"
|
|
|
|
#include "control.h"
|
|
|
|
#include "_control.h"
|
2014-03-22 09:25:51 +00:00
|
|
|
|
2014-07-06 00:10:33 +00:00
|
|
|
#include "menus.h"
|
|
|
|
|
2015-02-11 05:22:19 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
extern int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode);
|
|
|
|
extern int SDL_SendKeyboardText(const char *text);
|
|
|
|
extern int SDL_SendMouseMotion(SDL_Window * window, Uint32 mouseID, int relative, int x, int y);
|
|
|
|
extern int SDL_SendMouseButton(SDL_Window * window, Uint32 mouseID, Uint8 state, Uint8 button);
|
2014-03-22 09:25:51 +00:00
|
|
|
|
2015-02-11 05:22:19 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2014-03-22 09:25:51 +00:00
|
|
|
|
2015-02-11 05:22:19 +00:00
|
|
|
#include "in_android.h"
|
2014-03-22 09:25:51 +00:00
|
|
|
#include <android/log.h>
|
|
|
|
|
2016-03-28 05:15:32 +00:00
|
|
|
#if defined __GNUC__
|
|
|
|
# pragma GCC diagnostic push
|
|
|
|
# pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
|
|
#endif
|
|
|
|
|
2014-03-22 09:25:51 +00:00
|
|
|
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO,"DUKE", __VA_ARGS__))
|
|
|
|
|
2014-04-12 08:45:50 +00:00
|
|
|
static char sdl_text[2];
|
2014-03-22 09:25:51 +00:00
|
|
|
|
2014-04-14 16:30:23 +00:00
|
|
|
droidinput_t droidinput;
|
2014-04-12 22:10:36 +00:00
|
|
|
|
2016-03-28 05:15:32 +00:00
|
|
|
void AndroidTimer(int tics) { G_InitTimer(tics); }
|
2015-07-08 03:34:24 +00:00
|
|
|
|
2016-03-14 00:06:54 +00:00
|
|
|
int AndroidKeyEvent(int state, int code,int unicode)
|
2014-04-12 08:45:50 +00:00
|
|
|
{
|
2016-03-14 00:06:54 +00:00
|
|
|
LOGI("AndroidKeyEvent %d %d %d",state,(SDL_Scancode)code,unicode);
|
2015-02-11 05:22:19 +00:00
|
|
|
SDL_SendKeyboardKey(state ? SDL_PRESSED : SDL_RELEASED, (SDL_Scancode)code);
|
2014-04-12 22:10:36 +00:00
|
|
|
SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE);
|
2014-03-22 09:25:51 +00:00
|
|
|
|
2014-10-29 17:03:50 +00:00
|
|
|
// if (code == 42)
|
|
|
|
// unicode = 42;
|
2014-03-22 09:25:51 +00:00
|
|
|
|
2014-04-12 22:10:36 +00:00
|
|
|
if (state)
|
|
|
|
{
|
|
|
|
//if (unicode < 128)
|
|
|
|
{
|
|
|
|
sdl_text[0] = unicode;
|
|
|
|
sdl_text[1] = 0;
|
2014-03-22 09:25:51 +00:00
|
|
|
|
2014-04-12 22:10:36 +00:00
|
|
|
int posted = SDL_SendKeyboardText((const char*)sdl_text);
|
|
|
|
LOGI("posted = %d",posted);
|
|
|
|
}
|
2014-03-22 09:25:51 +00:00
|
|
|
|
2014-04-12 22:10:36 +00:00
|
|
|
if (state == 2)
|
2016-03-14 00:06:54 +00:00
|
|
|
AndroidKeyEvent(0, code, unicode);
|
2014-04-12 22:10:36 +00:00
|
|
|
}
|
2014-03-22 09:25:51 +00:00
|
|
|
|
2014-04-12 22:10:36 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2014-03-22 09:25:51 +00:00
|
|
|
|
2016-03-14 00:06:54 +00:00
|
|
|
void AndroidMouseMenu(float x,float y)
|
2015-02-11 05:22:19 +00:00
|
|
|
{
|
|
|
|
SDL_SendMouseMotion(NULL,0,0,x,y);
|
|
|
|
}
|
|
|
|
|
2016-03-14 00:06:54 +00:00
|
|
|
void AndroidMouseMenuButton(int state,int button)
|
2015-02-11 05:22:19 +00:00
|
|
|
{
|
|
|
|
SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, state?SDL_PRESSED:SDL_RELEASED, SDL_BUTTON_LEFT);
|
|
|
|
}
|
|
|
|
|
2014-03-22 09:25:51 +00:00
|
|
|
void changeActionState(int state, int action)
|
|
|
|
{
|
2014-04-12 22:10:36 +00:00
|
|
|
if (state)
|
|
|
|
{
|
|
|
|
//BUTTONSET(action,1);
|
|
|
|
droidinput.functionSticky |= ((uint64_t)1<<((uint64_t)(action)));
|
|
|
|
droidinput.functionHeld |= ((uint64_t)1<<((uint64_t)(action)));
|
2014-04-12 08:45:50 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
//BUTTONCLEAR(action);
|
2014-04-12 22:10:36 +00:00
|
|
|
droidinput.functionHeld &= ~((uint64_t) 1<<((uint64_t) (action)));
|
2014-03-22 09:25:51 +00:00
|
|
|
}
|
|
|
|
|
2016-03-14 00:06:54 +00:00
|
|
|
void AndroidAction(int state, int action)
|
2014-03-22 09:25:51 +00:00
|
|
|
{
|
2016-03-14 00:06:54 +00:00
|
|
|
LOGI("AndroidAction action = %d, state = %d", action, state);
|
2014-03-22 09:25:51 +00:00
|
|
|
|
2014-04-13 03:20:17 +00:00
|
|
|
if (action >= MENU_UP && action <= MENU_BACK)
|
2014-04-12 08:45:50 +00:00
|
|
|
{
|
2016-03-14 00:06:54 +00:00
|
|
|
int const sdl_code [] = { SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT,
|
|
|
|
SDL_SCANCODE_RIGHT, SDL_SCANCODE_RETURN, SDL_SCANCODE_ESCAPE };
|
|
|
|
AndroidKeyEvent(state, sdl_code[action-MENU_UP], 0);
|
|
|
|
return;
|
2014-04-12 22:10:36 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2016-03-14 00:06:54 +00:00
|
|
|
//if (AndroidRead(READ_SCREEN_MODE) != TOUCH_SCREEN_GAME) //If not in game don't do any of this
|
2014-10-29 17:03:50 +00:00
|
|
|
/// return;
|
2014-04-12 22:10:36 +00:00
|
|
|
|
|
|
|
//Special toggle for crouch, NOT when using jetpack or in water
|
2015-02-11 05:22:19 +00:00
|
|
|
if (droidinput.toggleCrouch)
|
2014-04-12 22:10:36 +00:00
|
|
|
{
|
2015-02-11 05:22:19 +00:00
|
|
|
int lotag = sector[g_player[myconnectindex].ps->cursectnum].lotag;
|
|
|
|
|
|
|
|
if (droidinput.crouchToggleState && (lotag == ST_2_UNDERWATER || lotag == ST_1_ABOVE_WATER))
|
2014-04-12 22:10:36 +00:00
|
|
|
{
|
2015-02-11 05:22:19 +00:00
|
|
|
droidinput.crouchToggleState = 0;
|
2014-04-12 22:10:36 +00:00
|
|
|
if (action == gamefunc_Crouch)
|
2015-02-11 05:22:19 +00:00
|
|
|
state = 0;
|
2016-03-14 00:06:54 +00:00
|
|
|
else AndroidAction(0, gamefunc_Crouch);
|
2015-02-11 05:22:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (action == gamefunc_Crouch)
|
|
|
|
{
|
|
|
|
if (!g_player[myconnectindex].ps->jetpack_on && g_player[myconnectindex].ps->on_ground &&
|
|
|
|
lotag != ST_2_UNDERWATER && lotag != ST_1_ABOVE_WATER)
|
2014-04-12 22:10:36 +00:00
|
|
|
{
|
|
|
|
if (state)
|
|
|
|
droidinput.crouchToggleState = !droidinput.crouchToggleState;
|
|
|
|
|
|
|
|
state = droidinput.crouchToggleState;
|
|
|
|
}
|
|
|
|
}
|
2015-02-11 05:22:19 +00:00
|
|
|
|
2014-04-12 22:10:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//Check if jumping while crouched
|
|
|
|
if (action == gamefunc_Jump)
|
|
|
|
{
|
2015-02-11 05:22:19 +00:00
|
|
|
if (droidinput.crouchToggleState)
|
|
|
|
{
|
|
|
|
droidinput.crouchToggleState = 0;
|
|
|
|
changeActionState(0, gamefunc_Crouch);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
changeActionState(state, action);
|
2014-04-12 22:10:36 +00:00
|
|
|
}
|
2015-02-11 05:22:19 +00:00
|
|
|
else
|
|
|
|
changeActionState(state, action);
|
2014-04-12 22:10:36 +00:00
|
|
|
|
2014-04-15 19:02:48 +00:00
|
|
|
if (state == 2)
|
2016-03-14 00:06:54 +00:00
|
|
|
AndroidAction(0, action);
|
2014-04-15 19:02:48 +00:00
|
|
|
|
2016-03-14 00:06:54 +00:00
|
|
|
// LOGI("AndroidAction state = 0x%016llX", CONTROL_ButtonState);
|
2014-04-12 08:45:50 +00:00
|
|
|
}
|
2014-03-22 09:25:51 +00:00
|
|
|
}
|
|
|
|
|
2015-03-24 00:40:01 +00:00
|
|
|
int const deadRegion = 0.3;
|
|
|
|
|
|
|
|
float analogCalibrate(float v)
|
|
|
|
{
|
|
|
|
float rv = 0;
|
|
|
|
|
|
|
|
if (v > deadRegion) rv = (v - deadRegion) * (v - deadRegion);
|
|
|
|
else if (-v > deadRegion) rv = -(-v - deadRegion) * (-v - deadRegion);
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2014-04-15 19:02:48 +00:00
|
|
|
//Need these NAN check as not cumulative.
|
2016-03-14 00:06:54 +00:00
|
|
|
void AndroidMove(float fwd, float strafe)
|
2014-03-22 09:25:51 +00:00
|
|
|
{
|
2015-02-11 05:22:19 +00:00
|
|
|
if (!ud.auto_run)
|
|
|
|
{
|
|
|
|
fwd *= 0.5f;
|
|
|
|
strafe *= 0.5f;
|
|
|
|
}
|
|
|
|
|
2014-04-15 19:02:48 +00:00
|
|
|
if (!isnan(fwd))
|
2015-03-24 00:40:01 +00:00
|
|
|
droidinput.forwardmove = fclamp2(analogCalibrate(fwd), -1.f, 1.f);
|
2014-04-15 19:02:48 +00:00
|
|
|
|
|
|
|
if (!isnan(strafe))
|
2015-03-24 00:40:01 +00:00
|
|
|
droidinput.sidemove = fclamp2(analogCalibrate(strafe), -1.f, 1.f);
|
2014-03-22 09:25:51 +00:00
|
|
|
}
|
|
|
|
|
2016-03-14 00:06:54 +00:00
|
|
|
void AndroidLook(float yaw, float pitch)
|
2014-03-22 09:25:51 +00:00
|
|
|
{
|
2014-04-12 22:10:36 +00:00
|
|
|
droidinput.pitch += pitch;
|
|
|
|
droidinput.yaw += yaw;
|
2014-03-22 09:25:51 +00:00
|
|
|
}
|
|
|
|
|
2016-03-14 00:06:54 +00:00
|
|
|
void AndroidLookJoystick(float yaw, float pitch)
|
2014-04-15 19:02:48 +00:00
|
|
|
{
|
|
|
|
if (!isnan(pitch))
|
2015-03-24 00:40:01 +00:00
|
|
|
droidinput.pitch_joystick = analogCalibrate(pitch);
|
2014-04-15 19:02:48 +00:00
|
|
|
|
|
|
|
if (!isnan(yaw))
|
2015-03-24 00:40:01 +00:00
|
|
|
droidinput.yaw_joystick = analogCalibrate(yaw);
|
2014-04-15 19:02:48 +00:00
|
|
|
}
|
|
|
|
|
2016-03-14 00:06:54 +00:00
|
|
|
void AndroidOSD(const char * cmd)
|
2014-03-22 09:25:51 +00:00
|
|
|
{
|
2014-04-12 08:45:50 +00:00
|
|
|
OSD_Dispatch(cmd);
|
2014-03-22 09:25:51 +00:00
|
|
|
}
|
2015-03-24 00:40:01 +00:00
|
|
|
|
2014-10-29 17:03:50 +00:00
|
|
|
int consoleShown = 0;
|
|
|
|
void AndroidSetConsoleShown(int onf)
|
|
|
|
{
|
|
|
|
consoleShown = onf;
|
|
|
|
}
|
2014-07-06 00:10:33 +00:00
|
|
|
|
2014-10-29 17:03:50 +00:00
|
|
|
extern int inExtraScreens; //In game.c
|
2016-03-14 00:06:54 +00:00
|
|
|
int32_t AndroidRead(portableread_t r)
|
2014-03-22 09:25:51 +00:00
|
|
|
{
|
2015-02-11 05:22:19 +00:00
|
|
|
int32_t rv;
|
|
|
|
|
2014-04-12 08:45:50 +00:00
|
|
|
switch (r)
|
|
|
|
{
|
2016-03-14 00:06:54 +00:00
|
|
|
case R_TOUCH_MODE:
|
2015-02-11 05:22:19 +00:00
|
|
|
if (g_animPtr || inExtraScreens)
|
|
|
|
rv = TOUCH_SCREEN_BLANK_TAP;
|
2014-10-29 17:03:50 +00:00
|
|
|
else if (consoleShown)
|
2015-02-11 05:22:19 +00:00
|
|
|
rv = TOUCH_SCREEN_CONSOLE;
|
2016-03-14 00:06:54 +00:00
|
|
|
else if ((g_player[myconnectindex].ps->gm & MODE_MENU) == MODE_MENU && g_currentMenu != MENU_MAIN)
|
2016-03-14 00:07:40 +00:00
|
|
|
rv = (m_currentMenu->type == Verify && totalclock > (m_animation.length + m_animation.start)) ? TOUCH_SCREEN_YES_NO : TOUCH_SCREEN_MENU;
|
2016-03-14 00:06:54 +00:00
|
|
|
else if ((g_player[myconnectindex].ps->gm & MODE_MENU) == MODE_MENU && g_currentMenu == MENU_MAIN)
|
|
|
|
rv = TOUCH_SCREEN_MENU_NOBACK;
|
2015-03-24 00:40:01 +00:00
|
|
|
/*
|
2014-10-29 17:03:50 +00:00
|
|
|
else if (ud.overhead_on == 2)
|
2015-02-11 05:22:19 +00:00
|
|
|
rv = TOUCH_SCREEN_AUTOMAP;
|
2015-03-24 00:40:01 +00:00
|
|
|
*/
|
2014-07-06 00:10:33 +00:00
|
|
|
else if ((g_player[myconnectindex].ps->gm & MODE_GAME))
|
2016-03-14 00:06:54 +00:00
|
|
|
if (AndroidRead(R_PLAYER_DEAD_FLAG))
|
2015-02-11 05:22:19 +00:00
|
|
|
rv = TOUCH_SCREEN_BLANK_TAP;
|
2014-10-29 17:03:50 +00:00
|
|
|
else
|
2015-02-11 05:22:19 +00:00
|
|
|
rv = TOUCH_SCREEN_GAME;
|
2014-07-06 00:10:33 +00:00
|
|
|
else
|
2015-02-11 05:22:19 +00:00
|
|
|
rv = TOUCH_SCREEN_BLANK_TAP;
|
|
|
|
break;
|
2016-03-14 00:06:54 +00:00
|
|
|
case R_PLAYER_GOTWEAPON:
|
2015-02-11 05:22:19 +00:00
|
|
|
rv = g_player[myconnectindex].ps->gotweapon; break;
|
2016-03-14 00:06:54 +00:00
|
|
|
case R_UD_OVERHEAD_ON:
|
2015-03-24 00:40:01 +00:00
|
|
|
rv = 0; break;//ud.overhead_on != 0; break;// ud.overhead_on ranges from 0-2
|
2016-03-14 00:06:54 +00:00
|
|
|
case R_UD_SCROLLMODE:
|
2015-02-11 05:22:19 +00:00
|
|
|
rv = ud.scrollmode; break;
|
2016-03-14 00:06:54 +00:00
|
|
|
case R_PLAYER_LASTWEAPON:
|
2015-02-11 05:22:19 +00:00
|
|
|
rv = droidinput.lastWeapon;
|
|
|
|
if ((unsigned)rv < MAX_WEAPONS && !g_player[myconnectindex].ps->ammo_amount[rv])
|
|
|
|
rv = -1;
|
|
|
|
break;
|
2016-03-14 00:06:54 +00:00
|
|
|
case R_GAME_PAUSED:
|
2015-02-11 05:22:19 +00:00
|
|
|
rv = ud.pause_on != 0; break;
|
2016-03-14 00:06:54 +00:00
|
|
|
case R_PLAYER_DEAD_FLAG:
|
2015-02-11 05:22:19 +00:00
|
|
|
rv = g_player[myconnectindex].ps->dead_flag; break;
|
2016-03-14 00:06:54 +00:00
|
|
|
case R_PLAYER_INV_AMOUNT:
|
2015-02-11 05:22:19 +00:00
|
|
|
rv = 0;
|
2016-08-27 01:41:21 +00:00
|
|
|
for (bssize_t i = 0; i < GET_MAX; i++)
|
2015-02-11 05:22:19 +00:00
|
|
|
{
|
|
|
|
if (g_player[myconnectindex].ps->inv_amount[i])
|
|
|
|
rv += (1 << i);
|
|
|
|
}
|
|
|
|
break;
|
2016-03-14 00:06:54 +00:00
|
|
|
case R_SOMETHINGONPLAYER:
|
2015-02-11 05:22:19 +00:00
|
|
|
rv = g_player[myconnectindex].ps->somethingonplayer != -1;
|
|
|
|
break;
|
2014-04-12 08:45:50 +00:00
|
|
|
default:
|
2015-02-11 05:22:19 +00:00
|
|
|
rv = 0; break;
|
2014-04-12 08:45:50 +00:00
|
|
|
}
|
2015-02-11 05:22:19 +00:00
|
|
|
|
|
|
|
return rv;
|
2014-03-22 09:25:51 +00:00
|
|
|
}
|
|
|
|
|
2014-10-29 17:03:50 +00:00
|
|
|
static float map_zoom,map_dx,map_dy = 0;
|
|
|
|
|
2016-03-14 00:06:54 +00:00
|
|
|
void AndroidAutomapControl(float zoom,float dx,float dy)
|
2014-10-29 17:03:50 +00:00
|
|
|
{
|
|
|
|
map_zoom += zoom;
|
|
|
|
map_dx += dx;
|
|
|
|
map_dy += dy;
|
|
|
|
}
|
|
|
|
|
2014-03-22 09:25:51 +00:00
|
|
|
///This stuff is called from the game/engine
|
|
|
|
|
2014-10-29 17:03:50 +00:00
|
|
|
extern void CONTROL_Android_ScrollMap(int32_t *angle,int32_t *x, int32_t *y, uint16_t *zoom )
|
|
|
|
{
|
|
|
|
|
|
|
|
*x += ((int)(map_dx * -30000)*sintable[(512+2048-*angle)&2047])>>14;
|
|
|
|
*y += ((int)(map_dy * -30000)*sintable[(512+1024-512-*angle)&2047])>>14;
|
|
|
|
|
2015-02-11 05:22:19 +00:00
|
|
|
// *zoom += map_zoom * 2000;
|
2014-10-29 17:03:50 +00:00
|
|
|
//*angle = 0;
|
|
|
|
map_dx = map_dy = map_zoom = 0;
|
|
|
|
}
|
|
|
|
|
2014-04-12 08:45:50 +00:00
|
|
|
void CONTROL_Android_SetLastWeapon(int w)
|
2014-03-22 09:25:51 +00:00
|
|
|
{
|
2014-04-12 22:10:36 +00:00
|
|
|
droidinput.lastWeapon = w;
|
2014-03-22 09:25:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CONTROL_Android_ClearButton(int32_t whichbutton)
|
|
|
|
{
|
2014-04-12 22:10:36 +00:00
|
|
|
droidinput.functionHeld &= ~((uint64_t)1<<((uint64_t)(whichbutton)));
|
2014-03-22 09:25:51 +00:00
|
|
|
}
|
|
|
|
|
2014-04-13 03:20:17 +00:00
|
|
|
void CONTROL_Android_PollDevices(ControlInfo *info)
|
2014-03-22 09:25:51 +00:00
|
|
|
{
|
2014-04-12 22:10:36 +00:00
|
|
|
//LOGI("CONTROL_Android_PollDevices %f %f",forwardmove,sidemove);
|
2014-04-15 19:02:48 +00:00
|
|
|
//LOGI("CONTROL_Android_PollDevices %f %f",droidinput.pitch,droidinput.yaw);
|
2014-04-12 22:10:36 +00:00
|
|
|
|
2015-03-24 00:40:01 +00:00
|
|
|
info->dz = (int32_t)nearbyintf(-droidinput.forwardmove * ANDROIDMOVEFACTOR);
|
|
|
|
info->dx = (int32_t)nearbyintf(droidinput.sidemove * ANDROIDMOVEFACTOR) >> 5;
|
|
|
|
info->dpitch =
|
2016-02-13 21:06:28 +00:00
|
|
|
(int32_t)nearbyintf(droidinput.pitch * ANDROIDLOOKFACTOR + droidinput.pitch_joystick * ANDROIDPITCHFACTORJOYSTICK);
|
2015-03-24 00:40:01 +00:00
|
|
|
info->dyaw =
|
2016-02-13 21:06:28 +00:00
|
|
|
(int32_t)nearbyintf(-droidinput.yaw * ANDROIDLOOKFACTOR - droidinput.yaw_joystick * ANDROIDYAWFACTORJOYSTICK);
|
2014-07-06 00:10:33 +00:00
|
|
|
|
2014-04-12 22:10:36 +00:00
|
|
|
droidinput.pitch = droidinput.yaw = 0.f;
|
2015-03-24 00:40:01 +00:00
|
|
|
CONTROL_ButtonState = droidinput.functionSticky | droidinput.functionHeld;
|
2014-04-12 22:10:36 +00:00
|
|
|
droidinput.functionSticky = 0;
|
|
|
|
|
|
|
|
//LOGI("poll state = 0x%016llX",CONTROL_ButtonState);
|
2014-03-22 09:25:51 +00:00
|
|
|
}
|
|
|
|
|
2016-03-28 05:15:32 +00:00
|
|
|
#if defined __GNUC__
|
|
|
|
# pragma GCC diagnostic pop
|
|
|
|
#endif
|