Android work. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@5652 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-03-14 00:06:54 +00:00
parent 6f6762edfa
commit 2b357b58f1
11 changed files with 389 additions and 780 deletions

View file

@ -147,7 +147,7 @@ LOCAL_SRC_FILES = $(ANDROID_SRC) $(JAUDIO_SRC) $(JMACT_SRC) $(GAME_SRC) $(BUILD_
LOCAL_LDLIBS := -lGLESv1_CM -lEGL -ldl -llog -lOpenSLES -lz -L$(TOP_DIR)/openssl/libs/ LOCAL_LDLIBS := -lGLESv1_CM -lEGL -ldl -llog -lOpenSLES -lz -L$(TOP_DIR)/openssl/libs/
LOCAL_STATIC_LIBRARIES := libpng crypto LOCAL_STATIC_LIBRARIES := libpng crypto
LOCAL_SHARED_LIBRARIES := touchcontrols ogg vorbis SDL2 SDL2_mixer libvpx LOCAL_SHARED_LIBRARIES := ogg vorbis SDL2 SDL2_mixer libvpx drm
# SDL2_image # SDL2_image
include $(BUILD_SHARED_LIBRARY) include $(BUILD_SHARED_LIBRARY)

View file

@ -705,6 +705,10 @@ void uploadtexture(int32_t doalloc, vec2_t siz, int32_t texfmt,
{ {
gltexmaxsize = 0; gltexmaxsize = 0;
for (; i>1; i>>=1) gltexmaxsize++; for (; i>1; i>>=1) gltexmaxsize++;
#ifdef EDUKE32_GLES
while ((1<<gltexmaxsize) > xdim)
gltexmaxsize--;
#endif
} }
} }

View file

@ -1681,7 +1681,7 @@ void enddrawing(void)
#if SDL_MAJOR_VERSION != 1 #if SDL_MAJOR_VERSION != 1
#ifdef __ANDROID__ #ifdef __ANDROID__
extern "C" void frameControls(); extern "C" void AndroidDrawControls();
#endif #endif
void showframe(int32_t w) void showframe(int32_t w)
@ -1699,7 +1699,7 @@ void showframe(int32_t w)
fullscreen_tint_gl(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta); fullscreen_tint_gl(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta);
#ifdef __ANDROID__ #ifdef __ANDROID__
frameControls(); AndroidDrawControls();
#endif #endif
SDL_GL_SwapWindow(sdl_window); SDL_GL_SwapWindow(sdl_window);
return; return;

File diff suppressed because it is too large Load diff

View file

@ -57,17 +57,15 @@ extern int SDL_SendMouseButton(SDL_Window * window, Uint32 mouseID, Uint8 state,
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO,"DUKE", __VA_ARGS__)) #define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO,"DUKE", __VA_ARGS__))
extern int32_t main(int32_t argc, char *argv []);
static char sdl_text[2]; static char sdl_text[2];
droidinput_t droidinput; droidinput_t droidinput;
int PortableTimer(int tics) { G_InitTimer(tics); } int AndroidTimer(int tics) { G_InitTimer(tics); }
int PortableKeyEvent(int state, int code,int unicode) int AndroidKeyEvent(int state, int code,int unicode)
{ {
LOGI("PortableKeyEvent %d %d %d",state,(SDL_Scancode)code,unicode); LOGI("AndroidKeyEvent %d %d %d",state,(SDL_Scancode)code,unicode);
SDL_SendKeyboardKey(state ? SDL_PRESSED : SDL_RELEASED, (SDL_Scancode)code); SDL_SendKeyboardKey(state ? SDL_PRESSED : SDL_RELEASED, (SDL_Scancode)code);
SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE); SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE);
@ -86,18 +84,18 @@ int PortableKeyEvent(int state, int code,int unicode)
} }
if (state == 2) if (state == 2)
PortableKeyEvent(0, code, unicode); AndroidKeyEvent(0, code, unicode);
} }
return 0; return 0;
} }
void PortableMouseMenu(float x,float y) void AndroidMouseMenu(float x,float y)
{ {
SDL_SendMouseMotion(NULL,0,0,x,y); SDL_SendMouseMotion(NULL,0,0,x,y);
} }
void PortableMouseMenuButton(int state,int button) void AndroidMouseMenuButton(int state,int button)
{ {
SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, state?SDL_PRESSED:SDL_RELEASED, SDL_BUTTON_LEFT); SDL_SendMouseButton(NULL, SDL_TOUCH_MOUSEID, state?SDL_PRESSED:SDL_RELEASED, SDL_BUTTON_LEFT);
} }
@ -116,23 +114,20 @@ void changeActionState(int state, int action)
droidinput.functionHeld &= ~((uint64_t) 1<<((uint64_t) (action))); droidinput.functionHeld &= ~((uint64_t) 1<<((uint64_t) (action)));
} }
void PortableAction(int state, int action) void AndroidAction(int state, int action)
{ {
LOGI("PortableAction action = %d, state = %d", action, state); LOGI("AndroidAction action = %d, state = %d", action, state);
if (action >= MENU_UP && action <= MENU_BACK) if (action >= MENU_UP && action <= MENU_BACK)
{ {
// if (PortableRead(READ_SCREEN_MODE) == TOUCH_SCREEN_MENU) int const sdl_code [] = { SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT,
{ SDL_SCANCODE_RIGHT, SDL_SCANCODE_RETURN, SDL_SCANCODE_ESCAPE };
int const sdl_code [] = { SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT, AndroidKeyEvent(state, sdl_code[action-MENU_UP], 0);
SDL_SCANCODE_RIGHT, SDL_SCANCODE_RETURN, SDL_SCANCODE_ESCAPE }; return;
PortableKeyEvent(state, sdl_code[action-MENU_UP], 0);
return;
}
} }
else else
{ {
//if (PortableRead(READ_SCREEN_MODE) != TOUCH_SCREEN_GAME) //If not in game don't do any of this //if (AndroidRead(READ_SCREEN_MODE) != TOUCH_SCREEN_GAME) //If not in game don't do any of this
/// return; /// return;
//Special toggle for crouch, NOT when using jetpack or in water //Special toggle for crouch, NOT when using jetpack or in water
@ -145,7 +140,7 @@ void PortableAction(int state, int action)
droidinput.crouchToggleState = 0; droidinput.crouchToggleState = 0;
if (action == gamefunc_Crouch) if (action == gamefunc_Crouch)
state = 0; state = 0;
else PortableAction(0, gamefunc_Crouch); else AndroidAction(0, gamefunc_Crouch);
} }
if (action == gamefunc_Crouch) if (action == gamefunc_Crouch)
@ -177,9 +172,9 @@ void PortableAction(int state, int action)
changeActionState(state, action); changeActionState(state, action);
if (state == 2) if (state == 2)
PortableAction(0, action); AndroidAction(0, action);
// LOGI("PortableAction state = 0x%016llX", CONTROL_ButtonState); // LOGI("AndroidAction state = 0x%016llX", CONTROL_ButtonState);
} }
} }
@ -196,7 +191,7 @@ float analogCalibrate(float v)
} }
//Need these NAN check as not cumulative. //Need these NAN check as not cumulative.
void PortableMove(float fwd, float strafe) void AndroidMove(float fwd, float strafe)
{ {
if (!ud.auto_run) if (!ud.auto_run)
{ {
@ -211,13 +206,13 @@ void PortableMove(float fwd, float strafe)
droidinput.sidemove = fclamp2(analogCalibrate(strafe), -1.f, 1.f); droidinput.sidemove = fclamp2(analogCalibrate(strafe), -1.f, 1.f);
} }
void PortableLook(float yaw, float pitch) void AndroidLook(float yaw, float pitch)
{ {
droidinput.pitch += pitch; droidinput.pitch += pitch;
droidinput.yaw += yaw; droidinput.yaw += yaw;
} }
void PortableLookJoystick(float yaw, float pitch) void AndroidLookJoystick(float yaw, float pitch)
{ {
if (!isnan(pitch)) if (!isnan(pitch))
droidinput.pitch_joystick = analogCalibrate(pitch); droidinput.pitch_joystick = analogCalibrate(pitch);
@ -226,16 +221,11 @@ void PortableLookJoystick(float yaw, float pitch)
droidinput.yaw_joystick = analogCalibrate(yaw); droidinput.yaw_joystick = analogCalibrate(yaw);
} }
void PortableCommand(const char * cmd) void AndroidOSD(const char * cmd)
{ {
OSD_Dispatch(cmd); OSD_Dispatch(cmd);
} }
void PortableInit(int argc, const char ** argv)
{
main(argc, ( char **)argv);
}
int consoleShown = 0; int consoleShown = 0;
void AndroidSetConsoleShown(int onf) void AndroidSetConsoleShown(int onf)
{ {
@ -243,49 +233,49 @@ void AndroidSetConsoleShown(int onf)
} }
extern int inExtraScreens; //In game.c extern int inExtraScreens; //In game.c
int32_t PortableRead(portableread_t r) int32_t AndroidRead(portableread_t r)
{ {
int32_t rv; int32_t rv;
switch (r) switch (r)
{ {
case READ_SCREEN_MODE: case R_TOUCH_MODE:
if (g_animPtr || inExtraScreens) if (g_animPtr || inExtraScreens)
rv = TOUCH_SCREEN_BLANK_TAP; rv = TOUCH_SCREEN_BLANK_TAP;
else if (consoleShown) else if (consoleShown)
rv = TOUCH_SCREEN_CONSOLE; rv = TOUCH_SCREEN_CONSOLE;
else if ((g_player[myconnectindex].ps->gm & MODE_MENU) == MODE_MENU) else if ((g_player[myconnectindex].ps->gm & MODE_MENU) == MODE_MENU && g_currentMenu != MENU_MAIN)
rv = (m_currentMenu->type == Verify) ? TOUCH_SCREEN_YES_NO : TOUCH_SCREEN_MENU; rv = (m_currentMenu->type == Verify) ? TOUCH_SCREEN_YES_NO : TOUCH_SCREEN_MENU;
else if ((g_player[myconnectindex].ps->gm & MODE_MENU) == MODE_MENU && g_currentMenu == MENU_MAIN)
rv = TOUCH_SCREEN_MENU_NOBACK;
/* /*
else if (ud.overhead_on == 2) else if (ud.overhead_on == 2)
rv = TOUCH_SCREEN_AUTOMAP; rv = TOUCH_SCREEN_AUTOMAP;
*/ */
else if ((g_player[myconnectindex].ps->gm & MODE_GAME)) else if ((g_player[myconnectindex].ps->gm & MODE_GAME))
if (PortableRead(READ_IS_DEAD)) if (AndroidRead(R_PLAYER_DEAD_FLAG))
rv = TOUCH_SCREEN_BLANK_TAP; rv = TOUCH_SCREEN_BLANK_TAP;
else else
rv = TOUCH_SCREEN_GAME; rv = TOUCH_SCREEN_GAME;
else else
rv = TOUCH_SCREEN_BLANK_TAP; rv = TOUCH_SCREEN_BLANK_TAP;
break; break;
case READ_WEAPONS: case R_PLAYER_GOTWEAPON:
rv = g_player[myconnectindex].ps->gotweapon; break; rv = g_player[myconnectindex].ps->gotweapon; break;
case READ_AUTOMAP: case R_UD_OVERHEAD_ON:
rv = 0; break;//ud.overhead_on != 0; break;// ud.overhead_on ranges from 0-2 rv = 0; break;//ud.overhead_on != 0; break;// ud.overhead_on ranges from 0-2
case READ_MAPFOLLOWMODE: case R_UD_SCROLLMODE:
rv = ud.scrollmode; break; rv = ud.scrollmode; break;
case READ_RENDERER: case R_PLAYER_LASTWEAPON:
rv = getrendermode(); break;
case READ_LASTWEAPON:
rv = droidinput.lastWeapon; rv = droidinput.lastWeapon;
if ((unsigned)rv < MAX_WEAPONS && !g_player[myconnectindex].ps->ammo_amount[rv]) if ((unsigned)rv < MAX_WEAPONS && !g_player[myconnectindex].ps->ammo_amount[rv])
rv = -1; rv = -1;
break; break;
case READ_PAUSED: case R_GAME_PAUSED:
rv = ud.pause_on != 0; break; rv = ud.pause_on != 0; break;
case READ_IS_DEAD: case R_PLAYER_DEAD_FLAG:
rv = g_player[myconnectindex].ps->dead_flag; break; rv = g_player[myconnectindex].ps->dead_flag; break;
case READ_INVENTORY: case R_PLAYER_INV_AMOUNT:
rv = 0; rv = 0;
for (int i = 0; i < GET_MAX; i++) for (int i = 0; i < GET_MAX; i++)
{ {
@ -293,7 +283,7 @@ int32_t PortableRead(portableread_t r)
rv += (1 << i); rv += (1 << i);
} }
break; break;
case READ_SOMETHINGONPLAYER: case R_SOMETHINGONPLAYER:
rv = g_player[myconnectindex].ps->somethingonplayer != -1; rv = g_player[myconnectindex].ps->somethingonplayer != -1;
break; break;
default: default:
@ -305,7 +295,7 @@ int32_t PortableRead(portableread_t r)
static float map_zoom,map_dx,map_dy = 0; static float map_zoom,map_dx,map_dy = 0;
void PortableAutomapControl(float zoom,float dx,float dy) void AndroidAutomapControl(float zoom,float dx,float dy)
{ {
map_zoom += zoom; map_zoom += zoom;
map_dx += dx; map_dx += dx;

View file

@ -40,16 +40,15 @@ extern "C"
#define MINCONTROLALPHA 0.25f #define MINCONTROLALPHA 0.25f
typedef enum { typedef enum {
READ_SCREEN_MODE, R_TOUCH_MODE,
READ_WEAPONS, R_PLAYER_GOTWEAPON,
READ_AUTOMAP, R_UD_OVERHEAD_ON,
READ_MAPFOLLOWMODE, R_UD_SCROLLMODE,
READ_RENDERER, R_PLAYER_LASTWEAPON,
READ_LASTWEAPON, R_GAME_PAUSED,
READ_PAUSED, R_PLAYER_DEAD_FLAG,
READ_IS_DEAD, R_PLAYER_INV_AMOUNT,
READ_INVENTORY, R_SOMETHINGONPLAYER
READ_SOMETHINGONPLAYER
} portableread_t; } portableread_t;
@ -57,7 +56,8 @@ typedef enum {
TOUCH_SCREEN_BLANK, //Nothing on screen (not used) TOUCH_SCREEN_BLANK, //Nothing on screen (not used)
TOUCH_SCREEN_BLANK_TAP, //One button filling screen with no graphic, tap to send Enter key TOUCH_SCREEN_BLANK_TAP, //One button filling screen with no graphic, tap to send Enter key
TOUCH_SCREEN_YES_NO, //Yes/No buttons on screen, sends Enter or Esc TOUCH_SCREEN_YES_NO, //Yes/No buttons on screen, sends Enter or Esc
TOUCH_SCREEN_MENU, //Normal Menu arrows and Enter Esc keys TOUCH_SCREEN_MENU, //Normal menu
TOUCH_SCREEN_MENU_NOBACK, // menu without back button
TOUCH_SCREEN_GAME, //Normal game screen TOUCH_SCREEN_GAME, //Normal game screen
TOUCH_SCREEN_AUTOMAP, //When auto map is up (not used yet) TOUCH_SCREEN_AUTOMAP, //When auto map is up (not used yet)
TOUCH_SCREEN_CONSOLE //When Console is up TOUCH_SCREEN_CONSOLE //When Console is up
@ -100,27 +100,25 @@ typedef struct
extern droidinput_t droidinput; extern droidinput_t droidinput;
extern droidsysinfo_t droidinfo; extern droidsysinfo_t droidinfo;
int PortableTimer(int tics); int AndroidTimer(int tics);
int PortableKeyEvent(int state, int code, int unicode); int AndroidKeyEvent(int state, int code, int unicode);
int PortableRead(portableread_t r); int AndroidRead(portableread_t r);
void PortableAction(int state, int action); void AndroidAction(int state, int action);
void PortableMouseMenu(float x,float y); void AndroidMouseMenu(float x,float y);
void PortableMouseMenuButton(int state,int button); void AndroidMouseMenuButton(int state,int button);
void PortableMove(float fwd, float strafe); void AndroidMove(float fwd, float strafe);
void PortableLook(float yaw, float pitch); void AndroidLook(float yaw, float pitch);
void PortableLookJoystick(float yaw, float pitch); void AndroidLookJoystick(float yaw, float pitch);
void PortableCommand(const char * cmd); void AndroidOSD(const char * cmd);
void PortableAutomapControl(float zoom,float dx,float dy); void AndroidAutomapControl(float zoom,float dx,float dy);
void PortableInit(int argc, const char ** argv);
void AndroidShowKeyboard(int onf); void AndroidShowKeyboard(int onf);
void AndroidToggleButtonEditor(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View file

@ -416,6 +416,8 @@ MAKE_MENU_TOP_ENTRYLINK( "Mouse Setup", MEF_CenterMenu, OPTIONS_MOUSESETUP, MENU
MAKE_MENU_TOP_ENTRYLINK( "Joystick Setup", MEF_CenterMenu, OPTIONS_JOYSTICKSETUP, MENU_JOYSTICKSETUP ); MAKE_MENU_TOP_ENTRYLINK( "Joystick Setup", MEF_CenterMenu, OPTIONS_JOYSTICKSETUP, MENU_JOYSTICKSETUP );
#ifdef DROIDMENU #ifdef DROIDMENU
MAKE_MENU_TOP_ENTRYLINK( "Touch Setup", MEF_CenterMenu, OPTIONS_TOUCHSETUP, MENU_TOUCHSETUP ); MAKE_MENU_TOP_ENTRYLINK( "Touch Setup", MEF_CenterMenu, OPTIONS_TOUCHSETUP, MENU_TOUCHSETUP );
MAKE_MENU_TOP_ENTRYLINK( "Touch Sensitivity", MEF_CenterMenu, OPTIONS_TOUCHSENS, MENU_TOUCHSENS);
MAKE_MENU_TOP_ENTRYLINK( "Touch Buttons", MEF_CenterMenu, OPTIONS_TOUCHBUTTONS, MENU_TOUCHBUTTONS);
#endif #endif
static int32_t newresolution, newrendermode, newfullscreen, newvsync; static int32_t newresolution, newrendermode, newfullscreen, newvsync;
@ -480,7 +482,9 @@ static MenuOption_t MEO_DISPLAYSETUP_ASPECTRATIO = MAKE_MENUOPTION(&MF_Redfont,
#else #else
static MenuOption_t MEO_DISPLAYSETUP_ASPECTRATIO = MAKE_MENUOPTION(&MF_Redfont, &MEOS_OffOn, &r_usenewaspect); static MenuOption_t MEO_DISPLAYSETUP_ASPECTRATIO = MAKE_MENUOPTION(&MF_Redfont, &MEOS_OffOn, &r_usenewaspect);
#endif #endif
#ifndef DROIDMENU
static MenuEntry_t ME_DISPLAYSETUP_ASPECTRATIO = MAKE_MENUENTRY( "Widescreen:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_DISPLAYSETUP_ASPECTRATIO, Option ); static MenuEntry_t ME_DISPLAYSETUP_ASPECTRATIO = MAKE_MENUENTRY( "Widescreen:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_DISPLAYSETUP_ASPECTRATIO, Option );
#endif
#ifdef POLYMER #ifdef POLYMER
static char const *MEOSN_DISPLAYSETUP_ASPECTRATIO_POLYMER[] = { "Auto", "4:3", "16:10", "5:3", "16:9", "1.85:1", "2.39:1", }; static char const *MEOSN_DISPLAYSETUP_ASPECTRATIO_POLYMER[] = { "Auto", "4:3", "16:10", "5:3", "16:9", "1.85:1", "2.39:1", };
static double MEOSV_DISPLAYSETUP_ASPECTRATIO_POLYMER[] = { 0., 1.33, 1.6, 1.66, 1.78, 1.85, 2.39, }; static double MEOSV_DISPLAYSETUP_ASPECTRATIO_POLYMER[] = { 0., 1.33, 1.6, 1.66, 1.78, 1.85, 2.39, };
@ -645,8 +649,8 @@ static MenuEntry_t *MEL_DISPLAYSETUP[] = {
&ME_DISPLAYSETUP_COLORCORR, &ME_DISPLAYSETUP_COLORCORR,
#ifndef DROIDMENU #ifndef DROIDMENU
&ME_DISPLAYSETUP_VIDEOSETUP, &ME_DISPLAYSETUP_VIDEOSETUP,
#endif
&ME_DISPLAYSETUP_ASPECTRATIO, &ME_DISPLAYSETUP_ASPECTRATIO,
#endif
&ME_DISPLAYSETUP_PIXELDOUBLING, &ME_DISPLAYSETUP_PIXELDOUBLING,
}; };
@ -656,8 +660,8 @@ static MenuEntry_t *MEL_DISPLAYSETUP_GL[] = {
&ME_DISPLAYSETUP_COLORCORR, &ME_DISPLAYSETUP_COLORCORR,
#ifndef DROIDMENU #ifndef DROIDMENU
&ME_DISPLAYSETUP_VIDEOSETUP, &ME_DISPLAYSETUP_VIDEOSETUP,
#endif
&ME_DISPLAYSETUP_ASPECTRATIO, &ME_DISPLAYSETUP_ASPECTRATIO,
#endif
&ME_DISPLAYSETUP_TEXFILTER, &ME_DISPLAYSETUP_TEXFILTER,
#ifdef DROIDMENU #ifdef DROIDMENU
&ME_DISPLAYSETUP_HIDEDPAD, &ME_DISPLAYSETUP_HIDEDPAD,
@ -675,8 +679,8 @@ static MenuEntry_t *MEL_DISPLAYSETUP_GL_POLYMER[] = {
&ME_DISPLAYSETUP_COLORCORR, &ME_DISPLAYSETUP_COLORCORR,
#ifndef DROIDMENU #ifndef DROIDMENU
&ME_DISPLAYSETUP_VIDEOSETUP, &ME_DISPLAYSETUP_VIDEOSETUP,
#endif
&ME_DISPLAYSETUP_ASPECTRATIO_POLYMER, &ME_DISPLAYSETUP_ASPECTRATIO_POLYMER,
#endif
&ME_DISPLAYSETUP_TEXFILTER, &ME_DISPLAYSETUP_TEXFILTER,
#ifndef DROIDMENU #ifndef DROIDMENU
&ME_DISPLAYSETUP_ANISOTROPY, &ME_DISPLAYSETUP_ANISOTROPY,
@ -779,21 +783,29 @@ static MenuEntry_t *MEL_MOUSESETUP[] = {
#ifdef DROIDMENU #ifdef DROIDMENU
static MenuRangeFloat_t MEO_TOUCHSETUP_SENSITIVITY_MOVE = MAKE_MENURANGE(&droidinput.forward_sens, &MF_Redfont, 1.f, 9.f, 0.f, 17, 1 + EnforceIntervals); static MenuRangeFloat_t MEO_TOUCHSETUP_SENSITIVITY_MOVE = MAKE_MENURANGE(&droidinput.forward_sens, &MF_Redfont, 1.f, 9.f, 0.f, 17, 1 + EnforceIntervals);
static MenuEntry_t ME_TOUCHSETUP_SENSITIVITY_MOVE = MAKE_MENUENTRY("Run sens:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_TOUCHSETUP_SENSITIVITY_MOVE, RangeFloat); static MenuEntry_t ME_TOUCHSETUP_SENSITIVITY_MOVE = MAKE_MENUENTRY("Running:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_TOUCHSETUP_SENSITIVITY_MOVE, RangeFloat);
static MenuRangeFloat_t MEO_TOUCHSETUP_SENSITIVITY_STRAFE = MAKE_MENURANGE(&droidinput.strafe_sens, &MF_Redfont, 1.f, 9.f, 0.f, 17, 1 + EnforceIntervals); static MenuRangeFloat_t MEO_TOUCHSETUP_SENSITIVITY_STRAFE = MAKE_MENURANGE(&droidinput.strafe_sens, &MF_Redfont, 1.f, 9.f, 0.f, 17, 1 + EnforceIntervals);
static MenuEntry_t ME_TOUCHSETUP_SENSITIVITY_STRAFE = MAKE_MENUENTRY("Strafe sens:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_TOUCHSETUP_SENSITIVITY_STRAFE, RangeFloat); static MenuEntry_t ME_TOUCHSETUP_SENSITIVITY_STRAFE = MAKE_MENUENTRY("Strafing:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_TOUCHSETUP_SENSITIVITY_STRAFE, RangeFloat);
static MenuRangeFloat_t MEO_TOUCHSETUP_SENSITIVITY_LOOK = MAKE_MENURANGE(&droidinput.pitch_sens, &MF_Redfont, 1.f, 9.f, 0.f, 17, 1 + EnforceIntervals); static MenuRangeFloat_t MEO_TOUCHSETUP_SENSITIVITY_LOOK = MAKE_MENURANGE(&droidinput.pitch_sens, &MF_Redfont, 1.f, 9.f, 0.f, 17, 1 + EnforceIntervals);
static MenuEntry_t ME_TOUCHSETUP_SENSITIVITY_LOOK = MAKE_MENUENTRY("Look sens:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_TOUCHSETUP_SENSITIVITY_LOOK, RangeFloat); static MenuEntry_t ME_TOUCHSETUP_SENSITIVITY_LOOK = MAKE_MENUENTRY("Looking:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_TOUCHSETUP_SENSITIVITY_LOOK, RangeFloat);
static MenuRangeFloat_t MEO_TOUCHSETUP_SENSITIVITY_TURN = MAKE_MENURANGE(&droidinput.yaw_sens, &MF_Redfont, 1.f, 9.f, 0.f, 17, 1 + EnforceIntervals); static MenuRangeFloat_t MEO_TOUCHSETUP_SENSITIVITY_TURN = MAKE_MENURANGE(&droidinput.yaw_sens, &MF_Redfont, 1.f, 9.f, 0.f, 17, 1 + EnforceIntervals);
static MenuEntry_t ME_TOUCHSETUP_SENSITIVITY_TURN = MAKE_MENUENTRY("Turn sens:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_TOUCHSETUP_SENSITIVITY_TURN, RangeFloat); static MenuEntry_t ME_TOUCHSETUP_SENSITIVITY_TURN = MAKE_MENUENTRY("Turning:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_TOUCHSETUP_SENSITIVITY_TURN, RangeFloat);
static MenuOption_t MEO_TOUCHSETUP_INVERT = MAKE_MENUOPTION(&MF_Redfont, &MEOS_NoYes, &droidinput.invertLook); static MenuOption_t MEO_TOUCHSETUP_INVERT = MAKE_MENUOPTION(&MF_Redfont, &MEOS_NoYes, &droidinput.invertLook);
static MenuEntry_t ME_TOUCHSETUP_INVERT = MAKE_MENUENTRY("Invert look:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_TOUCHSETUP_INVERT, Option); static MenuEntry_t ME_TOUCHSETUP_INVERT = MAKE_MENUENTRY("Invert look:", &MF_Redfont, &MEF_BigOptionsRt, &MEO_TOUCHSETUP_INVERT, Option);
MAKE_MENU_TOP_ENTRYLINK("Sensitivity", MEF_CenterMenu, TOUCHSENS, MENU_TOUCHSENS);
MAKE_MENU_TOP_ENTRYLINK("Button Setup", MEF_CenterMenu, TOUCHBUTTONS, MENU_TOUCHBUTTONS);
static MenuEntry_t *MEL_TOUCHSETUP [] ={ static MenuEntry_t *MEL_TOUCHSETUP [] ={
&ME_TOUCHSENS,
&ME_TOUCHBUTTONS,
};
static MenuEntry_t *MEL_TOUCHSENS [] ={
&ME_TOUCHSETUP_SENSITIVITY_MOVE, &ME_TOUCHSETUP_SENSITIVITY_MOVE,
&ME_TOUCHSETUP_SENSITIVITY_STRAFE, &ME_TOUCHSETUP_SENSITIVITY_STRAFE,
&ME_TOUCHSETUP_SENSITIVITY_LOOK, &ME_TOUCHSETUP_SENSITIVITY_LOOK,
@ -801,6 +813,9 @@ static MenuEntry_t *MEL_TOUCHSETUP [] ={
&ME_Space2, &ME_Space2,
&ME_TOUCHSETUP_INVERT, &ME_TOUCHSETUP_INVERT,
}; };
static MenuEntry_t *MEL_TOUCHBUTTONS [] ={
};
#endif #endif
MAKE_MENU_TOP_ENTRYLINK( "Edit Buttons", MEF_CenterMenu, JOYSTICK_EDITBUTTONS, MENU_JOYSTICKBTNS ); MAKE_MENU_TOP_ENTRYLINK( "Edit Buttons", MEF_CenterMenu, JOYSTICK_EDITBUTTONS, MENU_JOYSTICKBTNS );
@ -1219,7 +1234,9 @@ static MenuMenu_t M_CONTROLS = MAKE_MENUMENU( "Control Setup", &MMF_Top_Options,
static MenuMenu_t M_CHEATS = MAKE_MENUMENU( "Cheats", &MMF_SmallOptions, MEL_CHEATS ); static MenuMenu_t M_CHEATS = MAKE_MENUMENU( "Cheats", &MMF_SmallOptions, MEL_CHEATS );
static MenuMenu_t M_MOUSESETUP = MAKE_MENUMENU( "Mouse Setup", &MMF_BigOptions, MEL_MOUSESETUP ); static MenuMenu_t M_MOUSESETUP = MAKE_MENUMENU( "Mouse Setup", &MMF_BigOptions, MEL_MOUSESETUP );
#ifdef DROIDMENU #ifdef DROIDMENU
static MenuMenu_t M_TOUCHSETUP = MAKE_MENUMENU( "Touch Setup", &MMF_BigOptions, MEL_TOUCHSETUP ); static MenuMenu_t M_TOUCHSETUP = MAKE_MENUMENU( "Touch Setup", &MMF_Top_Options, MEL_TOUCHSETUP );
static MenuMenu_t M_TOUCHSENS = MAKE_MENUMENU( "Sensitivity", &MMF_BigOptions, MEL_TOUCHSENS);
static MenuMenu_t M_TOUCHBUTTONS = MAKE_MENUMENU("Button Setup", &MMF_BigOptions, MEL_TOUCHBUTTONS);
#endif #endif
static MenuMenu_t M_JOYSTICKSETUP = MAKE_MENUMENU( "Joystick Setup", &MMF_Top_Joystick_Network, MEL_JOYSTICKSETUP ); static MenuMenu_t M_JOYSTICKSETUP = MAKE_MENUMENU( "Joystick Setup", &MMF_Top_Joystick_Network, MEL_JOYSTICKSETUP );
static MenuMenu_t M_JOYSTICKBTNS = MAKE_MENUMENU( "Joystick Buttons", &MMF_MouseJoySetupBtns, MEL_JOYSTICKBTNS ); static MenuMenu_t M_JOYSTICKBTNS = MAKE_MENUMENU( "Joystick Buttons", &MMF_MouseJoySetupBtns, MEL_JOYSTICKBTNS );
@ -1311,6 +1328,8 @@ static Menu_t Menus[] = {
{ &M_JOYSTICKAXIS, MENU_JOYSTICKAXIS, MENU_JOYSTICKAXES, MA_Return, Menu }, { &M_JOYSTICKAXIS, MENU_JOYSTICKAXIS, MENU_JOYSTICKAXES, MA_Return, Menu },
#ifdef DROIDMENU #ifdef DROIDMENU
{ &M_TOUCHSETUP, MENU_TOUCHSETUP, MENU_OPTIONS, MA_Return, Menu }, { &M_TOUCHSETUP, MENU_TOUCHSETUP, MENU_OPTIONS, MA_Return, Menu },
{ &M_TOUCHSENS, MENU_TOUCHSENS, MENU_TOUCHSETUP, MA_Return, Menu },
{ &M_TOUCHBUTTONS, MENU_TOUCHBUTTONS, MENU_TOUCHSETUP, MA_Return, Menu },
#endif #endif
{ &M_CONTROLS, MENU_CONTROLS, MENU_OPTIONS, MA_Return, Menu }, { &M_CONTROLS, MENU_CONTROLS, MENU_OPTIONS, MA_Return, Menu },
#ifdef USE_OPENGL #ifdef USE_OPENGL
@ -2790,10 +2809,12 @@ static int32_t M_MenuEntryOptionModify(MenuEntry_t *entry, int32_t newOption)
gltexfiltermode = newOption ? TEXFILTER_ON : TEXFILTER_OFF; gltexfiltermode = newOption ? TEXFILTER_ON : TEXFILTER_OFF;
gltexapplyprops(); gltexapplyprops();
} }
#ifndef DROIDMENU
else if (entry == &ME_DISPLAYSETUP_ASPECTRATIO) else if (entry == &ME_DISPLAYSETUP_ASPECTRATIO)
{ {
r_usenewaspect = newOption & 1; r_usenewaspect = newOption & 1;
} }
#endif
#ifdef POLYMER #ifdef POLYMER
else if (entry == &ME_DISPLAYSETUP_ASPECTRATIO_POLYMER) else if (entry == &ME_DISPLAYSETUP_ASPECTRATIO_POLYMER)
{ {
@ -3101,8 +3122,10 @@ static int32_t M_MenuEntryOptionSource(MenuEntry_t *entry, int32_t currentValue)
else if (entry == &ME_DISPLAYSETUP_TEXFILTER) else if (entry == &ME_DISPLAYSETUP_TEXFILTER)
return gltexfiltermode; return gltexfiltermode;
*/ */
#ifndef DROIDMENU
else if (entry == &ME_DISPLAYSETUP_ASPECTRATIO) else if (entry == &ME_DISPLAYSETUP_ASPECTRATIO)
return r_usenewaspect; return r_usenewaspect;
#endif
#ifdef POLYMER #ifdef POLYMER
else if (entry == &ME_DISPLAYSETUP_ASPECTRATIO_POLYMER) else if (entry == &ME_DISPLAYSETUP_ASPECTRATIO_POLYMER)
return clamp(currentValue, 0, ARRAY_SIZE(MEOSV_DISPLAYSETUP_ASPECTRATIO_POLYMER)-1); return clamp(currentValue, 0, ARRAY_SIZE(MEOSV_DISPLAYSETUP_ASPECTRATIO_POLYMER)-1);
@ -3583,6 +3606,12 @@ int M_ChangeMenu(MenuID_t cm)
soundvoices = ud.config.NumVoices; soundvoices = ud.config.NumVoices;
break; break;
#ifdef DROIDMENU
case MENU_TOUCHBUTTONS:
AndroidToggleButtonEditor();
break;
#endif
default: default:
break; break;
} }

View file

@ -57,6 +57,8 @@ enum MenuIndex_t {
MENU_MOUSEADVANCED = 212, MENU_MOUSEADVANCED = 212,
MENU_JOYSTICKAXIS = 213, MENU_JOYSTICKAXIS = 213,
MENU_TOUCHSETUP = 214, MENU_TOUCHSETUP = 214,
MENU_TOUCHSENS = 215,
MENU_TOUCHBUTTONS = 216,
MENU_CONTROLS = 220, MENU_CONTROLS = 220,
MENU_POLYMOST = 230, MENU_POLYMOST = 230,
MENU_COLCORR = 231, MENU_COLCORR = 231,

View file

@ -1,195 +0,0 @@
// All things old go here to keep the sources clean. To have a reference to the place
// in the code, place a marker like __SomeMarker__ in the source file, and refer to it
// by placing it as the first context line of the corresponding hunk.
Index: astub.c
==============================
+++ astub.c
--- astub.c
@@ -2118,1 +2118,37 @@
///__ShowHelpText__
+#if 0
+static void ShowHelpText(char *name)
+{
+ BFILE *fp;
+ char x=0,y=4;
+ UNREFERENCED_PARAMETER(name);
+ if ((fp=fopenfrompath("helpdoc.txt","rb")) == NULL)
+ {
+ begindrawing();
+ printext256(1*4,4*8,whitecol,-1,"ERROR: file not found.",0);
+ enddrawing();
+ return;
+ }
+ /*
+ Bfgets(tempbuf,80,fp);
+ while(!Bfeof(fp) && Bstrcmp(tempbuf,"SectorEffector"))
+ {
+ Bfgets(tempbuf,80,fp);
+ }
+ */
+ y=2;
+ Bfgets(tempbuf,80,fp);
+ Bstrcat(tempbuf,"\n");
+ begindrawing();
+ while (!Bfeof(fp) && !(Bstrcmp(tempbuf,"SectorEffector")==0))
+ {
+ Bfgets(tempbuf,80,fp);
+ Bstrcat(tempbuf,"\n");
+ printext256(x*4,(y*6)+2,whitecol,-1,tempbuf,1);
+ y++;
+ }
+ enddrawing();
+
+ Bfclose(fp);
+}// end ShowHelpText
+#endif
@@ -6777,1 +6777,34 @@
///__bigcomment__
+ /*
+ if ((totalclock > getmessagetimeoff) && (totalclock > (lastpm16time + 120*3)))
+ {
+ if (pointhighlight >= 16384)
+ {
+ char tmpbuf[2048];
+ i = pointhighlight-16384;
+ if (strlen(names[sprite[i].picnum]) > 0)
+ {
+ if (sprite[i].picnum==SECTOREFFECTOR)
+ Bsprintf(tmpbuf,"Sprite %d %s, hi:%d ex:%d",i,SectorEffectorText(i),sprite[i].hitag,sprite[i].extra);
+ else Bsprintf(tmpbuf,"Sprite %d %s: lo:%d hi:%d ex:%d",i,names[sprite[i].picnum],sprite[i].lotag,sprite[i].hitag,sprite[i].extra);
+ }
+ else Bsprintf(tmpbuf,"Sprite %d picnum %d: lo:%d hi:%d ex:%d",i,sprite[i].picnum,sprite[i].lotag,sprite[i].hitag,sprite[i].extra);
+ _printmessage16(tmpbuf);
+ }
+ else if ((linehighlight >= 0) && (sectorofwall(linehighlight) == cursectornum))
+ {
+ int32_t dax, day, dist;
+ dax = wall[linehighlight].x-wall[wall[linehighlight].point2].x;
+ day = wall[linehighlight].y-wall[wall[linehighlight].point2].y;
+ dist = ksqrt(dax*dax+day*day);
+ Bsprintf(tempbuf,"Wall %d: length:%d lo:%d hi:%d ex:%d",linehighlight,dist,wall[linehighlight].lotag,wall[linehighlight].hitag,wall[linehighlight].extra);
+ _printmessage16(tempbuf);
+ }
+ else if (cursectornum >= 0)
+ {
+ Bsprintf(tempbuf,"Sector %d: lo:%d hi:%d ex:%d",cursectornum,sector[cursectornum].lotag,sector[cursectornum].hitag,sector[cursectornum].extra);
+ _printmessage16(tempbuf);
+ }
+ else _printmessage16("");
+ }
+ */
@@ -6723,1 +6723,29 @@
///__old_sprite_search_1__
+#if 0
+ {
+ if (cursearchspritenum>0) cursearchspritenum--;
+ for (i=cursearchspritenum; i>=0; i--)
+ {
+
+ if (
+ (sprite[i].picnum==sprite[cursearchsprite].picnum &&
+ sprite[i].statnum==0)
+ &&((search_lotag==0)||
+ (search_lotag!=0 && search_lotag==sprite[i].lotag))
+ &&((search_hitag==0)||
+ (search_hitag!=0 && search_hitag==sprite[i].hitag))
+ )
+ {
+ pos.x=sprite[i].x;
+ pos.y=sprite[i].y;
+ ang= sprite[i].ang;
+ printmessage16("< Sprite search: found");
+ // curspritenum--;
+ keystatus[KEYSC_LBRACK]=0;
+ return;
+ }
+ cursearchspritenum--;
+ }
+ printmessage16("< Sprite search: none found");
+ }
+#endif
@@ -6757,1 +6757,27 @@
///__old_sprite_search_2__
+#if 0
+ {
+ if (cursearchspritenum<MAXSPRITES) cursearchspritenum++;
+ for (i=cursearchspritenum; i<=MAXSPRITES; i++)
+ {
+ if ((sprite[i].picnum==sprite[cursearchsprite].picnum &&
+ sprite[i].statnum==0)
+ &&((search_lotag==0)||
+ (search_lotag!=0 && search_lotag==sprite[i].lotag))
+ &&((search_hitag==0)||
+ (search_hitag!=0 && search_hitag==sprite[i].hitag))
+ )
+ {
+ pos.x=sprite[i].x;
+ pos.y=sprite[i].y;
+ ang= sprite[i].ang;
+ printmessage16("> Sprite search: found");
+ // curspritenum++;
+ keystatus[KEYSC_RBRACK]=0;
+ return;
+ }
+ cursearchspritenum++;
+ }
+ printmessage16("> Sprite search: none found");
+ }
+#endif
@@ -6840,1 +6840,37 @@
///__motorcycle__
+ /*
+ if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(5)) // ' 5
+ {
+ sprintf(tempbuf,"Power-Up Ammo now equals Normal");
+ printmessage16(tempbuf);
+ for(i=0;i<MAXSPRITES;i++)
+ {
+ if(sprite[i].picnum>=20 && sprite[i].picnum<=59)
+ {
+ sprite[i].xrepeat = 32;
+ sprite[i].yrepeat = 32;
+ }
+ }
+
+ }
+ */
+
+ // What the fuck is this supposed to do?
+
+ /* Motorcycle ha ha ha
+ if (keystatus[KEYSC_QUOTE] && PRESSED_KEYSC(5)) // ' 5
+ {
+ sidemode++; if (sidemode > 2) sidemode = 0;
+ if (sidemode == 1)
+ {
+ editstatus = 0;
+ zmode = 2;
+ pos.z = ((sector[cursectnum].ceilingz+sector[cursectnum].floorz)>>1);
+ }
+ else
+ {
+ editstatus = 1;
+ zmode = 1;
+ }
+ }
+ */
@@ -5532,1 +5532,17 @@
///__unused_keys__
+ /* if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_G]) // ' g <Unused>
+ {
+ keystatus[KEYSC_G] = 0;
+ tabgraphic++;
+ if (tabgraphic > 2) tabgraphic = 0;
+ if (tabgraphic) message("Graphics ON");
+ else message("Graphics OFF");
+ }*/
+
+ /* if (keystatus[KEYSC_QUOTE] && keystatus[KEYSC_R]) // ' r <Handled already>
+ {
+ keystatus[KEYSC_R] = 0;
+ framerateon=!framerateon;
+ if (framerateon) message("Framerate ON");
+ else message("Framerate OFF");
+ }*/

View file

@ -2249,110 +2249,3 @@ static void postloadplayer(int32_t savegamep)
////////// END GENERIC SAVING/LOADING SYSTEM ////////// ////////// END GENERIC SAVING/LOADING SYSTEM //////////
#ifdef __ANDROID__
#include <jni.h>
#include <android/log.h>
#ifndef LOGI
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO,"DUKE", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "DUKE", __VA_ARGS__))
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR,"DUKE", __VA_ARGS__))
#endif
char const * G_GetStringFromSavegame(const char *filename, int type)
{
LOGI("getSavegameText %s", filename);
int32_t fil = kopen4load(filename, 0);
if (fil == -1)
{
LOGE("couldn't load %s", filename);
return "";
}
savehead_t saveh;
int32_t i = sv_loadheader(fil, 0, &saveh);
if (i && (i != 2 && i != 3))
goto corrupt;
kclose(fil);
static char tempbuf[64];
switch (type)
{
case 0: Bstrncpyz(tempbuf, saveh.savename, sizeof(saveh.savename) - 1); break;
case 1: Bstrncpyz(tempbuf, saveh.volname, sizeof(saveh.volname) - 1); break;
case 2: Bstrncpyz(tempbuf, saveh.skillname, sizeof(saveh.skillname) - 1); break;
}
return tempbuf;
corrupt:
kclose(fil);
LOGE("couldn't load %s", filename);
return "";
}
int32_t G_GetScreenshotFromSavegame(const char *filename, char *pal, char *data)
{
LOGI("getSavegameScreenshot %s", filename);
int32_t fil = kopen4load(filename, 0);
if (fil == -1)
return -1;
savehead_t saveh;
int32_t i = sv_loadheader(fil, 0, &saveh);
if (i && (i != 2 && i != 3))
goto corrupt;
int32_t screenshotofs;
if (kread(fil, &screenshotofs, 4) != 4)
goto corrupt;
if (screenshotofs)
{
if (kdfread(data, 320, 200, fil) != 200)
{
// OSD_Printf("G_LoadSaveHeaderNew(%d): failed reading screenshot\n", spot);
goto corrupt;
}
}
else
{
kclose(fil);
return -1;
}
kclose(fil);
char pstr[BMAX_PATH];
Bstrcpy(pstr, filename);
Bcorrectfilename(pstr, 1);
Bstrcat(pstr, "palette.dat");
int32_t pfil;
if ((pfil = kopen4load(pstr, 0)) == -1)
{
LOGE("couldn't load %s", pstr);
return -1;
}
kread(pfil, pal, 768);
kclose(pfil);
return 0;
corrupt:
kclose(fil);
return 1;
}
#endif

View file

@ -111,11 +111,6 @@ extern const char *(*El_SerializeGamevars)(int32_t *slenptr, int32_t levelnum);
void El_FreeSaveCode(void); void El_FreeSaveCode(void);
#endif #endif
#ifdef __ANDROID__
char const * G_GetStringFromSavegame(const char *filename, int type);
int32_t G_GetScreenshotFromSavegame(const char *filename, char *pal, char *data);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif