Android shit. DONT_BUILD.

git-svn-id: https://svn.eduke32.com/eduke32@5629 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2016-02-17 19:08:32 +00:00
parent aca7533f55
commit d3ff92c5d5
6 changed files with 58 additions and 53 deletions

View file

@ -16,7 +16,7 @@ LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := duke LOCAL_MODULE := duke3d
# -O2 -fvisibility=hidden # -O2 -fvisibility=hidden
@ -29,7 +29,7 @@ else
endif endif
LOCAL_CFLAGS += -W -Werror-implicit-function-declaration -Wpointer-arith -Wextra -Wno-unused-result -Wno-char-subscripts -Wno-strict-overflow -Wno-attributes -Wno-write-strings LOCAL_CFLAGS += -W -Werror-implicit-function-declaration -Wpointer-arith -Wextra -Wno-unused-result -Wno-char-subscripts -Wno-strict-overflow -Wno-attributes -Wno-write-strings
LOCAL_CPPFLAGS := -std=gnu++03 LOCAL_CPPFLAGS := -std=gnu++11
LOCAL_CFLAGS += -DHAVE_SDL -DHAVE_VORBIS -DHAVE_JWZGLES -DHAVE_ANDROID -DRENDERTYPESDL=1 -DUSE_OPENGL -DNETCODE_DISABLE -DUSE_LIBVPX LOCAL_CFLAGS += -DHAVE_SDL -DHAVE_VORBIS -DHAVE_JWZGLES -DHAVE_ANDROID -DRENDERTYPESDL=1 -DUSE_OPENGL -DNETCODE_DISABLE -DUSE_LIBVPX

View file

@ -11,7 +11,6 @@
#include "scriptfile.h" #include "scriptfile.h"
#include "cache1d.h" #include "cache1d.h"
#include "pragmas.h" // klabs #include "pragmas.h" // klabs
#include "build.h"
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -134,6 +134,14 @@ int32_t r_parallaxskypanning = 0;
#define MIN_CACHETIME_PRINT 10 #define MIN_CACHETIME_PRINT 10
#ifdef EDUKE32_GLES
int32_t texfmt_art = GL_RGB5_A1;
int32_t texfmt_alpha = GL_RGBA4;
#else
int32_t texfmt_art = GL_RGBA;
int32_t texfmt_alpha = GL_RGBA;
#endif
// this was faster in MSVC but slower with GCC... currently unknown on ARM where both // this was faster in MSVC but slower with GCC... currently unknown on ARM where both
// the FPU and possibly the optimization path in the compiler need improvement // the FPU and possibly the optimization path in the compiler need improvement
#if 0 #if 0
@ -671,10 +679,20 @@ void uploadtexture(int32_t doalloc, vec2_t siz, int32_t intexfmt, int32_t texfmt
if (!miplevel) if (!miplevel)
{ {
redo:
if (doalloc&1) if (doalloc&1)
bglTexImage2D(GL_TEXTURE_2D,0,intexfmt,siz.x,siz.y,0,texfmt,GL_UNSIGNED_BYTE,pic); //loading 1st time bglTexImage2D(GL_TEXTURE_2D,0,intexfmt,siz.x,siz.y,0,texfmt,GL_UNSIGNED_BYTE,pic); //loading 1st time
else else
bglTexSubImage2D(GL_TEXTURE_2D,0,0,0,siz.x,siz.y,texfmt,GL_UNSIGNED_BYTE,pic); //overwrite old texture bglTexSubImage2D(GL_TEXTURE_2D,0,0,0,siz.x,siz.y,texfmt,GL_UNSIGNED_BYTE,pic); //overwrite old texture
if (bglGetError() != GL_NO_ERROR)
{
if (intexfmt == GL_RGB5_A1)
texfmt_art = intexfmt = GL_RGB;
else if (intexfmt == GL_RGBA4)
texfmt_alpha = intexfmt = GL_RGBA;
goto redo;
}
} }
vec2_t siz2 = siz; vec2_t siz2 = siz;
@ -728,10 +746,20 @@ void uploadtexture(int32_t doalloc, vec2_t siz, int32_t intexfmt, int32_t texfmt
if (j >= miplevel) if (j >= miplevel)
{ {
redo_mip:
if (doalloc & 1) // loading 1st time if (doalloc & 1) // loading 1st time
bglTexImage2D(GL_TEXTURE_2D, j - miplevel, intexfmt, siz3.x, siz3.y, 0, texfmt, GL_UNSIGNED_BYTE, pic); bglTexImage2D(GL_TEXTURE_2D, j - miplevel, intexfmt, siz3.x, siz3.y, 0, texfmt, GL_UNSIGNED_BYTE, pic);
else // overwrite old texture else // overwrite old texture
bglTexSubImage2D(GL_TEXTURE_2D, j - miplevel, 0, 0, siz3.x, siz3.y, texfmt, GL_UNSIGNED_BYTE, pic); bglTexSubImage2D(GL_TEXTURE_2D, j - miplevel, 0, 0, siz3.x, siz3.y, texfmt, GL_UNSIGNED_BYTE, pic);
if (bglGetError() != GL_NO_ERROR)
{
if (intexfmt == GL_RGB5_A1)
texfmt_art = intexfmt = GL_RGB;
else if (intexfmt == GL_RGBA4)
texfmt_alpha = intexfmt = GL_RGBA;
goto redo_mip;
}
} }
siz2 = siz3; siz2 = siz3;
@ -943,7 +971,8 @@ void gloadtile_art(int32_t dapic, int32_t dapal, int32_t tintpalnum, int32_t das
npoty = PTH_NPOTWALL; npoty = PTH_NPOTWALL;
} }
uploadtexture(doalloc, siz, hasalpha ? GL_RGBA : GL_RGB, GL_RGBA, pic, tsiz, dameth | DAMETH_NOFIX); uploadtexture(doalloc, siz, hasalpha && texfmt_art == GL_RGBA ? GL_RGB : texfmt_art,
GL_RGBA, pic, tsiz, dameth | DAMETH_NOFIX);
Bfree(pic); Bfree(pic);
@ -1221,14 +1250,18 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
if (glinfo.texcompr && glusetexcompr && !(hicr->flags & HICR_NOSAVE)) if (glinfo.texcompr && glusetexcompr && !(hicr->flags & HICR_NOSAVE))
intexfmt = (hasalpha == 255) ? GL_COMPRESSED_RGB_ARB : GL_COMPRESSED_RGBA_ARB; intexfmt = (hasalpha == 255) ? GL_COMPRESSED_RGB_ARB : GL_COMPRESSED_RGBA_ARB;
else else
#endif
if (hasalpha == 255) intexfmt = GL_RGB; if (hasalpha == 255) intexfmt = GL_RGB;
#else
if (hasalpha == 255) intexfmt = texfmt_art;
else intexfmt = texfmt_alpha;
#endif
if ((doalloc&3)==1) if ((doalloc&3)==1)
bglGenTextures(1, &pth->glpic); //# of textures (make OpenGL allocate structure) bglGenTextures(1, &pth->glpic); //# of textures (make OpenGL allocate structure)
bglBindTexture(GL_TEXTURE_2D,pth->glpic); bglBindTexture(GL_TEXTURE_2D,pth->glpic);
fixtransparency(pic,tsiz,siz,dameth); fixtransparency(pic,tsiz,siz,dameth);
uploadtexture(doalloc,siz,intexfmt,texfmt,pic,tsiz, uploadtexture(doalloc,siz,intexfmt,texfmt,pic,tsiz,
dameth | DAMETH_HI | DAMETH_NOFIX | (hicr->flags & HICR_NOCOMPRESS ? DAMETH_NOCOMPRESS : 0)); dameth | DAMETH_HI | DAMETH_NOFIX | (hicr->flags & HICR_NOCOMPRESS ? DAMETH_NOCOMPRESS : 0));
} }

View file

@ -21,9 +21,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <jni.h> #include <jni.h>
#include <android/log.h> #include <android/log.h>
@ -43,7 +40,7 @@ extern int32_t G_GetScreenshotFromSavegame(const char *filename, char *pal, char
#include "in_android.h" #include "in_android.h"
#include "../function.h" #include "../function.h"
#include "../GL/gl.h" // #include "../GL/gl.h"
// Copied from build.h, which didnt include here // Copied from build.h, which didnt include here
enum rendmode_t enum rendmode_t
@ -86,6 +83,7 @@ static int curRenderer;
static bool hideTouchControls = true; static bool hideTouchControls = true;
static bool hasTouch = false; static bool hasTouch = false;
static int weaponWheelVisible = false; static int weaponWheelVisible = false;
static bool hwScaling = false;
static int controlsCreated = 0; static int controlsCreated = 0;
@ -142,49 +140,19 @@ void openGLStart()
glDisable(GL_CULL_FACE); glDisable(GL_CULL_FACE);
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
// nanoPushState();
} }
/*
else // software mode
{
glDisable(GL_ALPHA_TEST);
glDisableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_TEXTURE_2D);
glDisable(GL_CULL_FACE);
glMatrixMode(GL_MODELVIEW);
}
*/
} }
void openGLEnd() void openGLEnd()
{ {
if (curRenderer == REND_GL) if (curRenderer == REND_GL)
{
// glPopMatrix();
// nanoPopState();
glPopMatrix(); glPopMatrix();
}
/*
else // Software mode
{
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glMatrixMode(GL_MODELVIEW);
}
*/
} }
void gameSettingsButton(int state) void gameSettingsButton(int state)
{ {
if (state == 1) if (state == 1)
{
showTouchSettings(); showTouchSettings();
}
} }
// This is a bit of a hack, if the weapon wheel was selected, then an inv chosen instead, we need to cancel the weapon // This is a bit of a hack, if the weapon wheel was selected, then an inv chosen instead, we need to cancel the weapon
@ -207,12 +175,16 @@ void showWeaponsInventory(bool show)
tcGameWeapons->fade(touchcontrols::FADE_IN, 5); // fade in tcGameWeapons->fade(touchcontrols::FADE_IN, 5); // fade in
weaponWheelVisible = true; weaponWheelVisible = true;
PortableTimer(0);
} }
else // hide else // hide
{ {
tcGameWeapons->setAllButtonsEnable(false); tcGameWeapons->setAllButtonsEnable(false);
weaponWheel->setTapMode(false); weaponWheel->setTapMode(false);
weaponWheelVisible = false; weaponWheelVisible = false;
PortableTimer(120);
} }
} }
@ -256,12 +228,10 @@ void gameButton(int state, int code)
{ {
weaponWheel->setTapMode(true); weaponWheel->setTapMode(true);
showWeaponsInventory(true); showWeaponsInventory(true);
PortableTimer(30);
} }
else else
{ {
showWeaponsInventory(false); showWeaponsInventory(false);
PortableTimer(120);
} }
} }
break; break;
@ -289,7 +259,6 @@ void inventoryButton(int state, int code)
{ {
// Inventory chosen, hide them and wheel // Inventory chosen, hide them and wheel
showWeaponsInventory(false); showWeaponsInventory(false);
PortableTimer(120);
} }
} }
@ -320,7 +289,6 @@ void blankTapButton(int state, int code)
void weaponWheelSelected(int enabled) { void weaponWheelSelected(int enabled) {
showWeaponsInventory(enabled ? true : false); showWeaponsInventory(enabled ? true : false);
PortableTimer(enabled ? 0 : 120);
} }
void weaponWheelChosen(int segment) void weaponWheelChosen(int segment)
@ -396,6 +364,16 @@ void initControls(int width, int height, const char *graphics_path)
touchcontrols::GLScaleWidth = (float)width; touchcontrols::GLScaleWidth = (float)width;
touchcontrols::GLScaleHeight = (float)-height; touchcontrols::GLScaleHeight = (float)-height;
touchcontrols::ScaleY = nearbyintf(((float) height/(float) width) * touchcontrols::ScaleX);
/*
if (hwScaling)
{
touchcontrols::GLScaleWidth = (float) (width * 2);
touchcontrols::GLScaleHeight = (float) -(height * 2);
}
*/
LOGI("initControls %d x %d,x path = %s", width, height, graphics_path); LOGI("initControls %d x %d,x path = %s", width, height, graphics_path);
if (controlsCreated) if (controlsCreated)
@ -412,10 +390,9 @@ void initControls(int width, int height, const char *graphics_path)
tcBlankTap = new touchcontrols::TouchControls("blank_tap", false, false); tcBlankTap = new touchcontrols::TouchControls("blank_tap", false, false);
tcYesNo = new touchcontrols::TouchControls("yes_no", false, false); tcYesNo = new touchcontrols::TouchControls("yes_no", false, false);
tcMenuMain = new touchcontrols::TouchControls("menu", false, false); tcMenuMain = new touchcontrols::TouchControls("menu", false, false);
tcGameMain = new touchcontrols::TouchControls("game", false, true, 1, true); tcGameMain = new touchcontrols::TouchControls("game", false, true, 1);
tcGameWeapons = new touchcontrols::TouchControls("weapons", false, true, 1, false); tcGameWeapons = new touchcontrols::TouchControls("weapons", false, false);
tcAutomap = new touchcontrols::TouchControls("automap", false, false); tcAutomap = new touchcontrols::TouchControls("automap", false, false);
// tcInventory = new touchcontrols::TouchControls("inventory", false,true,1,false);
///////////////////////// BLANK TAP SCREEN ////////////////////// ///////////////////////// BLANK TAP SCREEN //////////////////////
@ -437,7 +414,7 @@ void initControls(int width, int height, const char *graphics_path)
///////////////////////// MAIN MENU SCREEN ///////////////////// ///////////////////////// MAIN MENU SCREEN /////////////////////
tcMenuMain->addControl( tcMenuMain->addControl(
new touchcontrols::Button("arrow_left", touchcontrols::RectF(0, 2, 2, 4), "arrow_left", SDL_SCANCODE_ESCAPE)); new touchcontrols::Button("arrow_left", touchcontrols::RectF(0, 0, 2, 2), "arrow_left", SDL_SCANCODE_ESCAPE));
tcMenuMain->signal_button.connect(sigc::ptr_fun(&menuButton)); tcMenuMain->signal_button.connect(sigc::ptr_fun(&menuButton));
touchcontrols::MultitouchMouse *mouseMenu = touchcontrols::MultitouchMouse *mouseMenu =
@ -634,13 +611,11 @@ void updateTouchScreenMode(touchscreemode_t mode)
// This is a bit of a hack, we need to enable the inventory buttons so they can be edited, they will not // This is a bit of a hack, we need to enable the inventory buttons so they can be edited, they will not
// be seen anyway // be seen anyway
showWeaponsInventory(true);
break; break;
case TOUCH_SCREEN_GAME: case TOUCH_SCREEN_GAME:
tcGameMain->setEnabled(true); tcGameMain->setEnabled(true);
tcGameMain->fade(touchcontrols::FADE_IN, DEFAULT_FADE_FRAMES); tcGameMain->fade(touchcontrols::FADE_IN, DEFAULT_FADE_FRAMES);
tcGameWeapons->setEnabled(true); tcGameWeapons->setEnabled(true);
showWeaponsInventory(false);
break; break;
case TOUCH_SCREEN_AUTOMAP: case TOUCH_SCREEN_AUTOMAP:
tcAutomap->setEnabled(true); tcAutomap->setEnabled(true);
@ -710,6 +685,7 @@ void setTouchSettings(int other)
// TODO: defined names for these values // TODO: defined names for these values
hasTouch = other & 0x4000 ? true : false; hasTouch = other & 0x4000 ? true : false;
hideTouchControls = other & 0x8000 ? true : false; hideTouchControls = other & 0x8000 ? true : false;
hwScaling = other & 0x10000 ? true : false;
// keep in sync with Duke3d/res/values/strings.xml // keep in sync with Duke3d/res/values/strings.xml
int doubletap_options[4] = { -1, gamefunc_Quick_Kick, gamefunc_MedKit, gamefunc_Jetpack }; int doubletap_options[4] = { -1, gamefunc_Quick_Kick, gamefunc_MedKit, gamefunc_Jetpack };

View file

@ -5207,7 +5207,6 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
break; break;
case T_ANIMSOUNDS: case T_ANIMSOUNDS:
{ {
char *otokptr = script->ltextptr; char *otokptr = script->ltextptr;
int32_t numpairs = 0, allocsz = 4, bad = 1, lastframenum = INT32_MIN; int32_t numpairs = 0, allocsz = 4, bad = 1, lastframenum = INT32_MIN;
dukeanim_t *anim = NULL; dukeanim_t *anim = NULL;
@ -5239,7 +5238,6 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
break; break;
} }
if (animname) if (animname)
anim = Anim_Find(animname); anim = Anim_Find(animname);
@ -5250,7 +5248,6 @@ static int32_t parsedefinitions_game(scriptfile *script, int32_t preload)
break; break;
} }
if (anim->sounds) if (anim->sounds)
{ {
initprintf("Warning: overwriting already defined hi-anim %s's sounds on line %s:%d\n", animname, initprintf("Warning: overwriting already defined hi-anim %s's sounds on line %s:%d\n", animname,

View file

@ -4676,8 +4676,8 @@ static void M_RunMenu_MouseReturn(Menu_t *cm, const vec2_t origin)
{ {
#if !defined EDUKE32_TOUCH_DEVICES #if !defined EDUKE32_TOUCH_DEVICES
if (!MOUSEACTIVECONDITION) if (!MOUSEACTIVECONDITION)
return;
#endif #endif
return;
if (cm->menuID == MENU_MAIN) if (cm->menuID == MENU_MAIN)
return; return;