diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 5880aff3b..d9c51a402 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -90,7 +90,12 @@ extern int32_t filelength(int h); // kplib.c extern char textfont[2048], smalltextfont[2048]; 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; #include //<-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 }, #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 }, +#endif { "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 }, diff --git a/polymer/eduke32/source/android/android-jni.cpp b/polymer/eduke32/source/android/android-jni.cpp index 9da908401..f64b019a5 100644 --- a/polymer/eduke32/source/android/android-jni.cpp +++ b/polymer/eduke32/source/android/android-jni.cpp @@ -271,29 +271,20 @@ void weaponWheelChosen(int segment) PortableAction(2, gamefunc_Weapon_1 + segment); } - -int left_double_action = -1; -int right_double_action = -1; - void left_double_tap(int state) { //LOGTOUCH("L double %d",state); - if (left_double_action != -1) - PortableAction(state, left_double_action); + if (droidinput.left_double_action != -1) + PortableAction(state, droidinput.left_double_action); } void right_double_tap(int state) { //LOGTOUCH("R double %d",state); - if (right_double_action != -1) - PortableAction(state, right_double_action); + if (droidinput.right_double_action != -1) + 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) { //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; - PortableLook(dx * 2 * yaw_sens * scale, - -dy * pitch_sens * scale * invertLook ? -1 : 1); + PortableLook(dx * 2 * droidinput.yaw_sens * scale, + -dy * droidinput.pitch_sens * scale * invertLook ? -1 : 1); } 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) 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) @@ -567,31 +558,31 @@ void setTouchSettings(float alpha,float strafe,float fwd,float pitch,float yaw,i switch ((other>>4) & 0xF) { case 1: - left_double_action = gamefunc_Fire; + droidinput.left_double_action = gamefunc_Fire; break; case 2: - left_double_action = gamefunc_Jump; + droidinput.left_double_action = gamefunc_Jump; break; default: - left_double_action = -1; + droidinput.left_double_action = -1; } switch ((other>>8) & 0xF) { case 1: - right_double_action = gamefunc_Fire; + droidinput.right_double_action = gamefunc_Fire; break; case 2: - right_double_action = gamefunc_Jump; + droidinput.right_double_action = gamefunc_Jump; break; default: - right_double_action = -1; + droidinput.right_double_action = -1; } - strafe_sens = strafe; - forward_sens = fwd; - pitch_sens = pitch; - yaw_sens = yaw; + droidinput.strafe_sens = strafe; + droidinput.forward_sens = fwd; + droidinput.pitch_sens = pitch; + droidinput.yaw_sens = yaw; } #define EXPORT_ME __attribute__ ((visibility("default"))) diff --git a/polymer/eduke32/source/android/in_android.c b/polymer/eduke32/source/android/in_android.c index e433db93f..0e9f83d56 100644 --- a/polymer/eduke32/source/android/in_android.c +++ b/polymer/eduke32/source/android/in_android.c @@ -26,7 +26,7 @@ extern int SDL_SendKeyboardText(const char *text); static char sdl_text[2]; -static droidinput_t droidinput; +droidinput_t droidinput; int PortableKeyEvent(int state, int code,int unicode) { @@ -139,6 +139,9 @@ void PortableCommand(const char * cmd) void PortableInit(int argc, const char ** argv) { + droidinput.left_double_action = -1; + droidinput.right_double_action = -1; + main(argc, argv); } @@ -183,10 +186,10 @@ void CONTROL_Android_PollDevices(ControlInfo *info) { //LOGI("CONTROL_Android_PollDevices %f %f",forwardmove,sidemove); - info->dz = -droidinput.forwardmove * ANDROIDFORWARDMOVEFACTOR; - info->dx = droidinput.sidemove * ANDROIDSIDEMOVEFACTOR; - info->dpitch = droidinput.pitch * ANDROIDPITCHFACTOR; - info->dyaw = -droidinput.yaw * ANDROIDYAWFACTOR; + info->dz = (int32_t)nearbyintf(-droidinput.forwardmove * ANDROIDFORWARDMOVEFACTOR); + info->dx = (int32_t)nearbyintf(droidinput.sidemove * ANDROIDSIDEMOVEFACTOR); + info->dpitch = (int32_t)nearbyint(droidinput.pitch * ANDROIDPITCHFACTOR); + info->dyaw = (int32_t)nearbyint(-droidinput.yaw * ANDROIDYAWFACTOR); droidinput.forwardmove = droidinput.sidemove = 0.f; droidinput.pitch = droidinput.yaw = 0.f; diff --git a/polymer/eduke32/source/android/in_android.h b/polymer/eduke32/source/android/in_android.h index 8ddd46c5c..1ae16be98 100644 --- a/polymer/eduke32/source/android/in_android.h +++ b/polymer/eduke32/source/android/in_android.h @@ -55,8 +55,15 @@ typedef struct uint64_t functionSticky; //To let at least one tick uint64_t functionHeld; + int32_t left_double_action; + int32_t right_double_action; + double pitch, yaw; float forwardmove, sidemove; + + // set by configuration UI + float strafe_sens, forward_sens; + float pitch_sens, yaw_sens; } droidinput_t; typedef struct @@ -66,6 +73,7 @@ typedef struct uint16_t screen_width, screen_height; } droidsysinfo_t; +extern droidinput_t droidinput; extern droidsysinfo_t droidinfo; int PortableKeyEvent(int state, int code, int unicode); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 03d3bccde..10784688a 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -3881,11 +3881,13 @@ void G_DisplayRest(int32_t smoothratio) El_DisplayErrors(); #endif +#ifndef __ANDROID__ if (VOLUMEONE) { 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); } +#endif if (!Demo_IsProfiling()) { @@ -11285,6 +11287,10 @@ int32_t app_main(int32_t argc, const char **argv) g_numSkills = 4; 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] G_MaybeAllocPlayer(0); diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 2757e0e99..c1117e35a 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -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,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,139+8,"version of Duke Nukem 3D.",0,2+8+16); mgametext(160,148+16,"Press any key...",0,2+8+16);