Introduce preprocessor token EDUKE32_TOUCH_DEVICES that covers both Android and iOS, and replace selected instances of __ANDROID__ with it.

git-svn-id: https://svn.eduke32.com/eduke32@4852 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2014-12-27 18:36:14 +00:00
parent b010dfd2ee
commit bfb3614b92
8 changed files with 36 additions and 20 deletions

View file

@ -85,9 +85,15 @@
# include <CoreFoundation/CoreFoundation.h>
# endif
# include <CoreServices/CoreServices.h>
# else
# define EDUKE32_TOUCH_DEVICES
# endif
#endif
#ifdef __ANDROID__
# define EDUKE32_TOUCH_DEVICES
#endif
// This gives us access to 'intptr_t' and 'uintptr_t', which are
// abstractions to the size of a pointer on a given platform
// (ie, they're guaranteed to be the same size as a pointer)

View file

@ -109,7 +109,7 @@ static float lastvidgcb[3];
#include "sdlkeytrans.c"
static SDL_Surface *appicon = NULL;
#if !defined(__APPLE__) && !defined(__ANDROID__)
#if !defined __APPLE__ && !defined EDUKE32_TOUCH_DEVICES
static SDL_Surface *loadappicon(void);
#endif
@ -167,7 +167,7 @@ int32_t wm_msgbox(const char *name, const char *fmt, ...)
#elif defined _WIN32
MessageBox(win_gethwnd(),buf,name,MB_OK|MB_TASKMODAL);
return 0;
#elif defined __ANDROID__
#elif defined EDUKE32_TOUCH_DEVICES
initprintf("wm_msgbox called. Message: %s: %s",name,buf);
return 0;
#elif SDL_MAJOR_VERSION==2
@ -215,7 +215,7 @@ int32_t wm_ynbox(const char *name, const char *fmt, ...)
}
#elif defined _WIN32
return (MessageBox(win_gethwnd(),buf,name,MB_YESNO|MB_ICONQUESTION|MB_TASKMODAL) == IDYES);
#elif defined __ANDROID__
#elif defined EDUKE32_TOUCH_DEVICES
initprintf("wm_ynbox called, this is bad! Message: %s: %s",name,buf);
initprintf("Returning false..");
return 0;
@ -255,7 +255,7 @@ int32_t wm_ynbox(const char *name, const char *fmt, ...)
void wm_setapptitle(const char *name)
{
#ifndef __ANDROID__
#ifndef EDUKE32_TOUCH_DEVICES
if (name != apptitle)
Bstrncpyz(apptitle, name, sizeof(apptitle));
@ -277,6 +277,8 @@ void wm_setapptitle(const char *name)
#endif
startwin_settitle(apptitle);
#else
UNREFERENCED_PARAMETER(name);
#endif
}
@ -293,7 +295,7 @@ void wm_setapptitle(const char *name)
static void attach_debugger_here(void) {}
/* XXX: libexecinfo could be used on systems without gnu libc. */
#if !defined _WIN32 && defined __GNUC__ && !defined __OpenBSD__ && !(defined __APPLE__ && defined __BIG_ENDIAN__) && !defined(GEKKO) && !defined(__ANDROID__) && !defined __OPENDINGUX__
#if !defined _WIN32 && defined __GNUC__ && !defined __OpenBSD__ && !(defined __APPLE__ && defined __BIG_ENDIAN__) && !defined GEKKO && !defined EDUKE32_TOUCH_DEVICES && !defined __OPENDINGUX__
# define PRINTSTACKONSEGV 1
# include <execinfo.h>
#endif
@ -778,7 +780,7 @@ void uninitmouse(void)
static inline char grabmouse_low(char a)
{
#if !defined __ANDROID__ && (!defined DEBUGGINGAIDS || defined _WIN32 || defined __APPLE__)
#if !defined EDUKE32_TOUCH_DEVICES && (!defined DEBUGGINGAIDS || defined _WIN32 || defined __APPLE__)
/* FIXME: Maybe it's better to make sure that grabmouse_low
is called only when a window is ready? */
if (sdl_window)
@ -798,7 +800,7 @@ void grabmouse(char a)
{
if (appactive && moustat)
{
#if !defined __ANDROID__ && (!defined DEBUGGINGAIDS || defined _WIN32 || defined __APPLE__)
#if !defined EDUKE32_TOUCH_DEVICES && (!defined DEBUGGINGAIDS || defined _WIN32 || defined __APPLE__)
if ((a != mousegrab) && !grabmouse_low(a))
#endif
mousegrab = a;
@ -1685,7 +1687,7 @@ int32_t setgamma(void)
return i;
}
#if !defined(__APPLE__) && !defined(__ANDROID__)
#if !defined __APPLE__ && !defined EDUKE32_TOUCH_DEVICES
extern struct sdlappicon sdlappicon;
static inline SDL_Surface *loadappicon(void)
{

View file

@ -586,7 +586,7 @@ int32_t CONFIG_ReadSetup(void)
ud.config.setupread = 1;
pathsearchmode = 1;
#ifndef __ANDROID__
#ifndef EDUKE32_TOUCH_DEVICES
if (SafeFileExists(setupfilename) && ud.config.scripthandle < 0) // JBF 20031211
ud.config.scripthandle = SCRIPT_Load(setupfilename);
else if (SafeFileExists(SETUPFILENAME) && ud.config.scripthandle < 0)

View file

@ -157,7 +157,7 @@ static void G_DoOrderScreen(void);
int32_t althud_numbertile = 2930;
int32_t althud_numberpal = 0;
#ifdef __ANDROID__
#ifdef EDUKE32_TOUCH_DEVICES
int32_t althud_shadows = 0;
#else
int32_t althud_shadows = 1;
@ -2679,7 +2679,7 @@ void G_PrintGameQuotes(int32_t snum)
{
#ifdef GEKKO
k = 16;
#elif defined(__ANDROID__)
#elif defined EDUKE32_TOUCH_DEVICES
k = ud.althud == 2 ? 32 : 24;
#else
k = ud.althud == 2 ? 32 : 0;
@ -3862,7 +3862,7 @@ void G_DisplayRest(int32_t smoothratio)
El_DisplayErrors();
#endif
#ifndef __ANDROID__
#ifndef EDUKE32_TOUCH_DEVICES
if (VOLUMEONE)
{
if (ud.show_help == 0 && g_showShareware > 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) == 0)
@ -4386,7 +4386,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
if (pub > 0 || getrendermode() >= REND_POLYMOST) // JBF 20040101: redraw background always
{
#ifndef __ANDROID__
#ifndef EDUKE32_TOUCH_DEVICES
if (ud.screen_size >= 8)
#endif
G_DrawBackground();
@ -10424,7 +10424,7 @@ static void G_DisplayLogo(void)
if ((!g_netServer && ud.multimode < 2) && (logoflags & LOGO_ENABLED) && !g_noLogo)
{
if (
#ifndef __ANDROID__
#ifndef EDUKE32_TOUCH_DEVICES
VOLUMEALL &&
#endif
(logoflags & LOGO_PLAYANIM))

View file

@ -1853,8 +1853,12 @@ static void M_PreMenuDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
#ifndef DROIDMENU
mgametextcenter(origin.x, origin.y + ((104+8)<<16), "Please visit Steam and purchase");
mgametextcenter(origin.x, origin.y + ((113+8)<<16), "Duke Nukem 3D: Megaton Edition");
#else
# if defined __APPLE__ && TARGET_OS_IPHONE
mgametextcenter(origin.x, origin.y + ((113+8)<<16), "Please visit the App Store");
# else
mgametextcenter(origin.x, origin.y + ((113+8)<<16), "Please visit the Play Store");
# endif
#endif
mgametextcenter(origin.x, origin.y + ((122+8)<<16), "to upgrade to the full registered");
@ -2005,7 +2009,11 @@ static void M_PreMenuDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
creditsminitext(origin.x + (160<<16), origin.y + ((90+7+10-l)<<16), "Evan \"Hendricks266\" Ramos", 8);
#ifdef DROIDMENU
# if defined __APPLE__ && TARGET_OS_IPHONE
mgametextcenter(origin.x, origin.y + ((110+7-l)<<16), "iOS support programming");
# else
mgametextcenter(origin.x, origin.y + ((110+7-l)<<16), "Android support programming");
# endif
creditsminitext(origin.x + (160<<16), origin.y + ((110+7+10-l)<<16), "Emile Belanger", 8);
#endif

View file

@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
extern "C" {
#endif
#if defined(__ANDROID__)
#if defined EDUKE32_TOUCH_DEVICES
# define DROIDMENU
#endif

View file

@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
int32_t osdhightile = 1;
int32_t osdshown = 0;
#ifdef __ANDROID__
#ifdef EDUKE32_TOUCH_DEVICES
float osdscale = 2.f, osdrscale = 0.5f;
#else
float osdscale = 1.f, osdrscale = 1.f;

View file

@ -1394,7 +1394,7 @@ end_vol4a:
ud.last_level = -1;
g_lastSaveSlot = -1;
#ifdef __ANDROID__
#ifdef EDUKE32_TOUCH_DEVICES
p->zoom = 360;
#else
p->zoom = 768;
@ -1923,7 +1923,7 @@ int32_t G_EnterLevel(int32_t g)
if ((ud.recstat == 1) && (g&MODE_RESTART) != MODE_RESTART)
G_OpenDemoWrite();
#ifndef __ANDROID__
#ifndef EDUKE32_TOUCH_DEVICES
if (VOLUMEONE && ud.level_number == 0 && ud.recstat != 2)
P_DoQuote(QUOTE_F1HELP,g_player[myconnectindex].ps);
#endif