More Android. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@4439 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2014-04-14 16:30:23 +00:00
parent e9f7b5d09a
commit 4815ebaa23
6 changed files with 50 additions and 33 deletions

View file

@ -90,7 +90,12 @@ extern int32_t filelength(int h); // kplib.c
extern char textfont[2048], smalltextfont[2048]; extern char textfont[2048], smalltextfont[2048];
int32_t rendmode=0; int32_t rendmode=0;
int32_t usemodels=1, usehightile=1; #ifdef __ANDROID__
int32_t usemodels=0;
#else
int32_t usemodels=1;
#endif
int32_t usehightile=1;
int32_t vsync=0; int32_t vsync=0;
#include <math.h> //<-important! #include <math.h> //<-important!
@ -5212,7 +5217,11 @@ void polymost_initosdfuncs(void)
{ "r_pr_ati_nodepthoffset", "enable this to workaround an ATI driver bug that causes sprite drawing to freeze the game on Radeon X1x00 hardware - you need to restart the renderer for it to take effect", (void *) &pr_ati_nodepthoffset, CVAR_BOOL | CVAR_NOSAVE, 0, 1 }, { "r_pr_ati_nodepthoffset", "enable this to workaround an ATI driver bug that causes sprite drawing to freeze the game on Radeon X1x00 hardware - you need to restart the renderer for it to take effect", (void *) &pr_ati_nodepthoffset, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
#endif #endif
#ifdef __ANDROID__
{ "r_models","enable/disable model rendering",(void *) &usemodels, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
#else
{ "r_models","enable/disable model rendering",(void *) &usemodels, CVAR_BOOL, 0, 1 }, { "r_models","enable/disable model rendering",(void *) &usemodels, CVAR_BOOL, 0, 1 },
#endif
{ "r_hightile","enable/disable hightile texture rendering",(void *) &usehightile, CVAR_BOOL, 0, 1 }, { "r_hightile","enable/disable hightile texture rendering",(void *) &usehightile, CVAR_BOOL, 0, 1 },
{ "r_preview_mouseaim", "toggles mouse aiming preview, use this to calibrate yxaspect in Polymost Mapster32", (void *) &preview_mouseaim, CVAR_BOOL, 0, 1 }, { "r_preview_mouseaim", "toggles mouse aiming preview, use this to calibrate yxaspect in Polymost Mapster32", (void *) &preview_mouseaim, CVAR_BOOL, 0, 1 },

View file

@ -271,29 +271,20 @@ void weaponWheelChosen(int segment)
PortableAction(2, gamefunc_Weapon_1 + segment); PortableAction(2, gamefunc_Weapon_1 + segment);
} }
int left_double_action = -1;
int right_double_action = -1;
void left_double_tap(int state) void left_double_tap(int state)
{ {
//LOGTOUCH("L double %d",state); //LOGTOUCH("L double %d",state);
if (left_double_action != -1) if (droidinput.left_double_action != -1)
PortableAction(state, left_double_action); PortableAction(state, droidinput.left_double_action);
} }
void right_double_tap(int state) void right_double_tap(int state)
{ {
//LOGTOUCH("R double %d",state); //LOGTOUCH("R double %d",state);
if (right_double_action != -1) if (droidinput.right_double_action != -1)
PortableAction(state, right_double_action); PortableAction(state, droidinput.right_double_action);
} }
//To be set by android
float strafe_sens,forward_sens;
float pitch_sens,yaw_sens;
void mouseMove(int action, float x, float y, float dx, float dy) void mouseMove(int action, float x, float y, float dx, float dy)
{ {
//LOGI(" mouse dx = %f",dx); //LOGI(" mouse dx = %f",dx);
@ -303,8 +294,8 @@ void mouseMove(int action, float x, float y, float dx, float dy)
double scale = (shooting && precisionShoot) ? PRECISIONSHOOTFACTOR : 1.f; double scale = (shooting && precisionShoot) ? PRECISIONSHOOTFACTOR : 1.f;
PortableLook(dx * 2 * yaw_sens * scale, PortableLook(dx * 2 * droidinput.yaw_sens * scale,
-dy * pitch_sens * scale * invertLook ? -1 : 1); -dy * droidinput.pitch_sens * scale * invertLook ? -1 : 1);
} }
void left_stick(float joy_x, float joy_y, float mouse_x, float mouse_y) void left_stick(float joy_x, float joy_y, float mouse_x, float mouse_y)
@ -315,7 +306,7 @@ void left_stick(float joy_x, float joy_y, float mouse_x, float mouse_y)
if (joy_x < 0) if (joy_x < 0)
strafe *= -1; strafe *= -1;
PortableMove(joy_y * 15 * forward_sens, -strafe * strafe_sens); PortableMove(joy_y * 15 * droidinput.forward_sens, -strafe * droidinput.strafe_sens);
} }
void right_stick(float joy_x, float joy_y, float mouse_x, float mouse_y) void right_stick(float joy_x, float joy_y, float mouse_x, float mouse_y)
@ -567,31 +558,31 @@ void setTouchSettings(float alpha,float strafe,float fwd,float pitch,float yaw,i
switch ((other>>4) & 0xF) switch ((other>>4) & 0xF)
{ {
case 1: case 1:
left_double_action = gamefunc_Fire; droidinput.left_double_action = gamefunc_Fire;
break; break;
case 2: case 2:
left_double_action = gamefunc_Jump; droidinput.left_double_action = gamefunc_Jump;
break; break;
default: default:
left_double_action = -1; droidinput.left_double_action = -1;
} }
switch ((other>>8) & 0xF) switch ((other>>8) & 0xF)
{ {
case 1: case 1:
right_double_action = gamefunc_Fire; droidinput.right_double_action = gamefunc_Fire;
break; break;
case 2: case 2:
right_double_action = gamefunc_Jump; droidinput.right_double_action = gamefunc_Jump;
break; break;
default: default:
right_double_action = -1; droidinput.right_double_action = -1;
} }
strafe_sens = strafe; droidinput.strafe_sens = strafe;
forward_sens = fwd; droidinput.forward_sens = fwd;
pitch_sens = pitch; droidinput.pitch_sens = pitch;
yaw_sens = yaw; droidinput.yaw_sens = yaw;
} }
#define EXPORT_ME __attribute__ ((visibility("default"))) #define EXPORT_ME __attribute__ ((visibility("default")))

View file

@ -26,7 +26,7 @@ extern int SDL_SendKeyboardText(const char *text);
static char sdl_text[2]; static char sdl_text[2];
static droidinput_t droidinput; droidinput_t droidinput;
int PortableKeyEvent(int state, int code,int unicode) int PortableKeyEvent(int state, int code,int unicode)
{ {
@ -139,6 +139,9 @@ void PortableCommand(const char * cmd)
void PortableInit(int argc, const char ** argv) void PortableInit(int argc, const char ** argv)
{ {
droidinput.left_double_action = -1;
droidinput.right_double_action = -1;
main(argc, argv); main(argc, argv);
} }
@ -183,10 +186,10 @@ void CONTROL_Android_PollDevices(ControlInfo *info)
{ {
//LOGI("CONTROL_Android_PollDevices %f %f",forwardmove,sidemove); //LOGI("CONTROL_Android_PollDevices %f %f",forwardmove,sidemove);
info->dz = -droidinput.forwardmove * ANDROIDFORWARDMOVEFACTOR; info->dz = (int32_t)nearbyintf(-droidinput.forwardmove * ANDROIDFORWARDMOVEFACTOR);
info->dx = droidinput.sidemove * ANDROIDSIDEMOVEFACTOR; info->dx = (int32_t)nearbyintf(droidinput.sidemove * ANDROIDSIDEMOVEFACTOR);
info->dpitch = droidinput.pitch * ANDROIDPITCHFACTOR; info->dpitch = (int32_t)nearbyint(droidinput.pitch * ANDROIDPITCHFACTOR);
info->dyaw = -droidinput.yaw * ANDROIDYAWFACTOR; info->dyaw = (int32_t)nearbyint(-droidinput.yaw * ANDROIDYAWFACTOR);
droidinput.forwardmove = droidinput.sidemove = 0.f; droidinput.forwardmove = droidinput.sidemove = 0.f;
droidinput.pitch = droidinput.yaw = 0.f; droidinput.pitch = droidinput.yaw = 0.f;

View file

@ -55,8 +55,15 @@ typedef struct
uint64_t functionSticky; //To let at least one tick uint64_t functionSticky; //To let at least one tick
uint64_t functionHeld; uint64_t functionHeld;
int32_t left_double_action;
int32_t right_double_action;
double pitch, yaw; double pitch, yaw;
float forwardmove, sidemove; float forwardmove, sidemove;
// set by configuration UI
float strafe_sens, forward_sens;
float pitch_sens, yaw_sens;
} droidinput_t; } droidinput_t;
typedef struct typedef struct
@ -66,6 +73,7 @@ typedef struct
uint16_t screen_width, screen_height; uint16_t screen_width, screen_height;
} droidsysinfo_t; } droidsysinfo_t;
extern droidinput_t droidinput;
extern droidsysinfo_t droidinfo; extern droidsysinfo_t droidinfo;
int PortableKeyEvent(int state, int code, int unicode); int PortableKeyEvent(int state, int code, int unicode);

View file

@ -3881,11 +3881,13 @@ void G_DisplayRest(int32_t smoothratio)
El_DisplayErrors(); El_DisplayErrors();
#endif #endif
#ifndef __ANDROID__
if (VOLUMEONE) if (VOLUMEONE)
{ {
if (ud.show_help == 0 && g_showShareware > 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0) if (ud.show_help == 0 && g_showShareware > 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
rotatesprite_fs((320-50)<<16,9<<16,65536L,0,BETAVERSION,0,0,2+8+16+128); rotatesprite_fs((320-50)<<16,9<<16,65536L,0,BETAVERSION,0,0,2+8+16+128);
} }
#endif
if (!Demo_IsProfiling()) if (!Demo_IsProfiling())
{ {
@ -11285,6 +11287,10 @@ int32_t app_main(int32_t argc, const char **argv)
g_numSkills = 4; g_numSkills = 4;
ud.multimode = 1; ud.multimode = 1;
#ifdef __ANDROID__
G_AddDef("duke3d-android.def");
#endif
// this needs to happen before G_CheckCommandLine because G_GameExit accesses g_player[0] // this needs to happen before G_CheckCommandLine because G_GameExit accesses g_player[0]
G_MaybeAllocPlayer(0); G_MaybeAllocPlayer(0);

View file

@ -863,7 +863,7 @@ void M_DisplayMenus(void)
mgametext(160,104+8,"Please read the 'How To Order' item",0,2+8+16); mgametext(160,104+8,"Please read the 'How To Order' item",0,2+8+16);
mgametext(160,113+8,"on the main menu or visit",0,2+8+16); mgametext(160,113+8,"on the main menu or visit",0,2+8+16);
mgametext(160,122+8,"http://www.eduke32.com",0,2+8+16); mgametext(160,122+8,"Steam or the Google Play Store",0,2+8+16);
mgametext(160,131+8,"to upgrade to the full registered",0,2+8+16); mgametext(160,131+8,"to upgrade to the full registered",0,2+8+16);
mgametext(160,139+8,"version of Duke Nukem 3D.",0,2+8+16); mgametext(160,139+8,"version of Duke Nukem 3D.",0,2+8+16);
mgametext(160,148+16,"Press any key...",0,2+8+16); mgametext(160,148+16,"Press any key...",0,2+8+16);