mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-26 03:30:46 +00:00
Android work. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@5652 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6f6762edfa
commit
2b357b58f1
11 changed files with 389 additions and 780 deletions
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -30,25 +30,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "TouchControlsContainer.h"
|
#include "TouchControlsContainer.h"
|
||||||
#include "JNITouchControlsUtils.h"
|
#include "JNITouchControlsUtils.h"
|
||||||
|
|
||||||
|
using namespace touchcontrols;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#define DEFAULT_FADE_FRAMES 10
|
#define DEFAULT_FADE_FRAMES 10
|
||||||
|
|
||||||
extern void SDL_Android_Init(JNIEnv *env, jclass cls);
|
|
||||||
extern char const *G_GetStringFromSavegame(const char *filename, int type);
|
|
||||||
extern int32_t G_GetScreenshotFromSavegame(const char *filename, char *pal, char *data);
|
|
||||||
|
|
||||||
#include "in_android.h"
|
#include "in_android.h"
|
||||||
#include "../function.h"
|
#include "function.h"
|
||||||
|
|
||||||
// #include "../GL/gl.h"
|
|
||||||
|
|
||||||
// Copied from build.h, which didnt include here
|
|
||||||
enum rendmode_t
|
|
||||||
{
|
|
||||||
REND_CLASSIC,
|
|
||||||
REND_POLYMOST = 3,
|
|
||||||
REND_POLYMER
|
|
||||||
};
|
|
||||||
|
|
||||||
enum dukeinv_t
|
enum dukeinv_t
|
||||||
{
|
{
|
||||||
|
@ -66,52 +54,43 @@ enum dukeinv_t
|
||||||
GET_MAX
|
GET_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifndef LOGI
|
#ifndef LOGI
|
||||||
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "DUKE", __VA_ARGS__))
|
#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 LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "DUKE", __VA_ARGS__))
|
||||||
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "DUKE", __VA_ARGS__))
|
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, "DUKE", __VA_ARGS__))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define REND_SOFT 0
|
|
||||||
#define REND_GL 1
|
|
||||||
|
|
||||||
droidsysinfo_t droidinfo;
|
droidsysinfo_t droidinfo;
|
||||||
|
|
||||||
static int curRenderer;
|
|
||||||
|
|
||||||
static bool hideTouchControls = true;
|
static bool hideTouchControls = true;
|
||||||
static bool hasTouch = false;
|
static bool hasTouch = false;
|
||||||
static int weaponWheelVisible = false;
|
static bool weaponWheelVisible = false;
|
||||||
static bool hwScaling = false;
|
static bool hwScaling = false;
|
||||||
|
static bool controlsCreated = false;
|
||||||
|
static bool backButtonEnabled = true;
|
||||||
|
|
||||||
|
TouchControlsContainer controlsContainer;
|
||||||
|
|
||||||
static int controlsCreated = 0;
|
TouchControls *tcBlankTap;
|
||||||
touchcontrols::TouchControlsContainer controlsContainer;
|
TouchControls *tcYesNo;
|
||||||
|
TouchControls *tcMenuMain;
|
||||||
|
TouchControls *tcBackButton;
|
||||||
|
TouchControls *tcGameMain;
|
||||||
|
TouchControls *tcGameWeapons;
|
||||||
|
TouchControls *tcAutomap;
|
||||||
|
|
||||||
touchcontrols::TouchControls *tcBlankTap;
|
TouchStick *touchJoyLeft;
|
||||||
touchcontrols::TouchControls *tcYesNo;
|
WheelSelect *weaponWheel;
|
||||||
touchcontrols::TouchControls *tcMenuMain;
|
|
||||||
touchcontrols::TouchControls *tcGameMain;
|
|
||||||
touchcontrols::TouchControls *tcGameWeapons;
|
|
||||||
// touchcontrols::TouchControls *tcInventory;
|
|
||||||
touchcontrols::TouchControls *tcAutomap;
|
|
||||||
|
|
||||||
|
|
||||||
touchcontrols::TouchJoy *touchJoyLeft;
|
|
||||||
touchcontrols::WheelSelect *weaponWheel;
|
|
||||||
|
|
||||||
extern JNIEnv *env_;
|
extern JNIEnv *env_;
|
||||||
JavaVM *jvm_;
|
JavaVM *jvm_;
|
||||||
|
|
||||||
touchcontrols::Button *inv_buttons[GET_MAX];
|
Button *inv_buttons[GET_MAX];
|
||||||
|
|
||||||
std::string obbPath, gamePath;
|
std::string obbPath, gamePath;
|
||||||
|
|
||||||
void openGLStart()
|
void AndroidPreDrawButtons()
|
||||||
{
|
{
|
||||||
if (curRenderer == REND_GL)
|
|
||||||
{
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
@ -120,7 +99,7 @@ void openGLStart()
|
||||||
|
|
||||||
// glClearColor(1.0f, 1.0f, 0.0f, 1.0f);
|
// glClearColor(1.0f, 1.0f, 0.0f, 1.0f);
|
||||||
// glClear(GL_COLOR_BUFFER_BIT);
|
// glClear(GL_COLOR_BUFFER_BIT);
|
||||||
// LOGI("openGLStart");
|
// LOGI("AndroidPreDrawButtons");
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
glDisable(GL_FOG);
|
glDisable(GL_FOG);
|
||||||
|
@ -140,27 +119,14 @@ void openGLStart()
|
||||||
glDisable(GL_CULL_FACE);
|
glDisable(GL_CULL_FACE);
|
||||||
|
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void openGLEnd()
|
void AndroidPostDrawButtons()
|
||||||
{
|
{
|
||||||
if (curRenderer == REND_GL)
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
void gameSettingsButton(int state)
|
void AndroidShowWheel(bool show)
|
||||||
{
|
|
||||||
if (state == 1)
|
|
||||||
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
|
|
||||||
// selection
|
|
||||||
// NOT needed actually, weapon wheel disabled before is get finger up anyway
|
|
||||||
// static bool invWasSelected = false;
|
|
||||||
|
|
||||||
void showWeaponsInventory(bool show)
|
|
||||||
{
|
{
|
||||||
if (!controlsCreated)
|
if (!controlsCreated)
|
||||||
return;
|
return;
|
||||||
|
@ -168,57 +134,58 @@ void showWeaponsInventory(bool show)
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
for (int n = 0; n < 10; n++)
|
for (int n = 0; n < 10; n++)
|
||||||
weaponWheel->setSegmentEnabled(n, (PortableRead(READ_WEAPONS) >> n) & 0x1);
|
weaponWheel->setSegmentEnabled(n, (AndroidRead(R_PLAYER_GOTWEAPON) >> n) & 0x1);
|
||||||
|
|
||||||
// Show inventory buttons
|
// Show inventory buttons
|
||||||
tcGameWeapons->setAllButtonsEnable(true);
|
tcGameWeapons->setAllButtonsEnabled(true);
|
||||||
|
tcGameWeapons->fade(FADE_IN, 5);
|
||||||
tcGameWeapons->fade(touchcontrols::FADE_IN, 5); // fade in
|
|
||||||
weaponWheelVisible = true;
|
weaponWheelVisible = true;
|
||||||
|
|
||||||
PortableTimer(0);
|
AndroidTimer(0);
|
||||||
}
|
}
|
||||||
else // hide
|
else // hide
|
||||||
{
|
{
|
||||||
tcGameWeapons->setAllButtonsEnable(false);
|
tcGameWeapons->setAllButtonsEnabled(false);
|
||||||
weaponWheel->setTapMode(false);
|
weaponWheel->setTapMode(false);
|
||||||
weaponWheelVisible = false;
|
weaponWheelVisible = false;
|
||||||
|
|
||||||
PortableTimer(120);
|
AndroidTimer(120);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AndroidShowKeyboard(int onf)
|
void AndroidShowKeyboard(int onf)
|
||||||
{
|
{
|
||||||
showKeyboard(onf);
|
JNI_ShowKeyboard(onf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gameButton(int state, int code)
|
namespace callbacks
|
||||||
{
|
{
|
||||||
|
void in_game(int state, int code)
|
||||||
|
{
|
||||||
if (!controlsCreated)
|
if (!controlsCreated)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case gamefunc_Fire:
|
case gamefunc_Fire:
|
||||||
if (state && PortableRead(READ_SOMETHINGONPLAYER))
|
if (state && AndroidRead(R_SOMETHINGONPLAYER))
|
||||||
{
|
{
|
||||||
PortableAction(1, gamefunc_Quick_Kick);
|
AndroidAction(1, gamefunc_Quick_Kick);
|
||||||
PortableAction(0, gamefunc_Quick_Kick);
|
AndroidAction(0, gamefunc_Quick_Kick);
|
||||||
}
|
}
|
||||||
else PortableAction(state, code);
|
else AndroidAction(state, code);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_SHOW_KBRD:
|
case KEY_SHOW_KBRD:
|
||||||
if (state)
|
if (state)
|
||||||
toggleKeyboard();
|
JNI_ToggleKeyboard();
|
||||||
|
|
||||||
PortableKeyEvent(state, SDL_SCANCODE_GRAVE, 0);
|
AndroidKeyEvent(state, SDL_SCANCODE_GRAVE, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_QUICK_CMD:
|
case KEY_QUICK_CMD:
|
||||||
if (state == 1)
|
if (state == 1)
|
||||||
showCustomCommands();
|
JNI_ShowCustomCommands();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_SHOW_INVEN:
|
case KEY_SHOW_INVEN:
|
||||||
|
@ -227,152 +194,133 @@ void gameButton(int state, int code)
|
||||||
if (!weaponWheelVisible)
|
if (!weaponWheelVisible)
|
||||||
{
|
{
|
||||||
weaponWheel->setTapMode(true);
|
weaponWheel->setTapMode(true);
|
||||||
showWeaponsInventory(true);
|
AndroidShowWheel(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
showWeaponsInventory(false);
|
AndroidShowWheel(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_QUICK_SAVE:
|
case KEY_QUICK_SAVE:
|
||||||
LOGI("QUICK SAVE");
|
LOGI("QUICK SAVE");
|
||||||
PortableKeyEvent(state, SDL_SCANCODE_F6, 0);
|
AndroidKeyEvent(state, SDL_SCANCODE_F6, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case KEY_QUICK_LOAD:
|
case KEY_QUICK_LOAD:
|
||||||
LOGI("QUICK LOAD");
|
LOGI("QUICK LOAD");
|
||||||
PortableKeyEvent(state, SDL_SCANCODE_F9, 0);
|
AndroidKeyEvent(state, SDL_SCANCODE_F9, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: PortableAction(state, code); break;
|
default: AndroidAction(state, code); break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void automapButton(int state, int code) { PortableAction(state, code); }
|
void inv_button(int state, int code)
|
||||||
|
{
|
||||||
|
AndroidAction(state, code);
|
||||||
|
|
||||||
void inventoryButton(int state, int code)
|
|
||||||
{
|
|
||||||
PortableAction(state, code);
|
|
||||||
if (state == 0)
|
if (state == 0)
|
||||||
{
|
{
|
||||||
// Inventory chosen, hide them and wheel
|
// Inventory chosen, hide them and wheel
|
||||||
showWeaponsInventory(false);
|
AndroidShowWheel(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void menuButton(int state, int code) { PortableKeyEvent(state, code, code); }
|
void menu_button(int state, int code)
|
||||||
|
{
|
||||||
|
AndroidKeyEvent(state, code, code);
|
||||||
|
|
||||||
void menuMouse(int action, float x, float y, float dx, float dy)
|
if (controlsContainer.editingControls)
|
||||||
{
|
controlsContainer.editorButtonPress();
|
||||||
// PortableMouse(dx,dy);
|
}
|
||||||
PortableMouseMenu(x * droidinfo.screen_width, y * droidinfo.screen_height);
|
|
||||||
|
void menu_select(int action, float x, float y, float dx, float dy)
|
||||||
|
{
|
||||||
|
AndroidMouseMenu(x * droidinfo.screen_width, y * droidinfo.screen_height);
|
||||||
|
|
||||||
if (action == MULTITOUCHMOUSE_DOWN || action == MULTITOUCHMOUSE_UP)
|
if (action == MULTITOUCHMOUSE_DOWN || action == MULTITOUCHMOUSE_UP)
|
||||||
PortableMouseMenuButton(action == MULTITOUCHMOUSE_DOWN, 0);
|
AndroidMouseMenuButton(action == MULTITOUCHMOUSE_DOWN, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void blankTapButton(int state, int code)
|
void proceed(int state, int code)
|
||||||
{
|
{
|
||||||
if (PortableRead(READ_IS_DEAD)) // if the player is dead we need to send a 'open' button
|
if (AndroidRead(R_PLAYER_DEAD_FLAG))
|
||||||
{
|
{
|
||||||
if (state)
|
if (state)
|
||||||
{
|
{
|
||||||
PortableAction(1, gamefunc_Open);
|
AndroidAction(1, gamefunc_Open);
|
||||||
PortableAction(0, gamefunc_Open);
|
AndroidAction(0, gamefunc_Open);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // everything else send a return key
|
else
|
||||||
PortableKeyEvent(state, SDL_SCANCODE_RETURN, 0);
|
AndroidKeyEvent(state, SDL_SCANCODE_RETURN, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void weaponWheelSelected(int enabled) {
|
void show_wheel(int enabled) { AndroidShowWheel(enabled ? true : false); }
|
||||||
showWeaponsInventory(enabled ? true : false);
|
void select_weapon(int segment)
|
||||||
}
|
{
|
||||||
|
|
||||||
void weaponWheelChosen(int segment)
|
|
||||||
{
|
|
||||||
// LOGI("weaponWheel %d",segment);
|
// LOGI("weaponWheel %d",segment);
|
||||||
if (segment == -1 && droidinput.quickSelectWeapon)
|
if (segment == -1 && droidinput.quickSelectWeapon)
|
||||||
segment = PortableRead(READ_LASTWEAPON);
|
segment = AndroidRead(R_PLAYER_LASTWEAPON);
|
||||||
|
|
||||||
if (segment != -1)
|
if (segment != -1)
|
||||||
PortableAction(2, gamefunc_Weapon_1 + segment);
|
AndroidAction(2, gamefunc_Weapon_1 + segment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void left_double_tap(int state)
|
void left_double_tap(int state)
|
||||||
{
|
{
|
||||||
// LOGI("L double %d, droidinput.left_double_action = %d",state,droidinput.left_double_action);
|
// LOGI("L double %d, droidinput.left_double_action = %d",state,droidinput.left_double_action);
|
||||||
if (droidinput.left_double_action != -1)
|
if (droidinput.left_double_action != -1)
|
||||||
PortableAction(state, droidinput.left_double_action);
|
AndroidAction(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 (droidinput.right_double_action != -1)
|
if (droidinput.right_double_action != -1)
|
||||||
PortableAction(state, droidinput.right_double_action);
|
AndroidAction(state, droidinput.right_double_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mouseMove(int action, float x, float y, float dx, float dy)
|
void look(int action, float x, float y, float dx, float dy)
|
||||||
{
|
{
|
||||||
// LOGI(" mouse dx = %f, dy = %f",dx,dy);
|
// LOGI(" mouse dx = %f, dy = %f",dx,dy);
|
||||||
|
|
||||||
if (weaponWheelVisible)
|
if (weaponWheelVisible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float const scale = .1f;
|
float const scale = .1f;
|
||||||
|
|
||||||
PortableLook(dx * droidinput.yaw_sens * scale, -dy * droidinput.pitch_sens * scale * (droidinput.invertLook ? -1.f : 1.f));
|
AndroidLook(dx * droidinput.yaw_sens * scale, -dy * droidinput.pitch_sens * scale * (droidinput.invertLook ? -1.f : 1.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
void automap_multitouch_mouse_move(int action, float x, float y, float dx, float dy)
|
void automap_multitouch_mouse_move(int action, float x, float y, float dx, float dy)
|
||||||
{
|
{
|
||||||
if (action == MULTITOUCHMOUSE_MOVE)
|
if (action == MULTITOUCHMOUSE_MOVE)
|
||||||
PortableAutomapControl(0, dx, dy);
|
AndroidAutomapControl(0, dx, dy);
|
||||||
else if (action == MULTITOUCHMOUSE_ZOOM)
|
else if (action == MULTITOUCHMOUSE_ZOOM)
|
||||||
PortableAutomapControl(x, 0, 0);
|
AndroidAutomapControl(x, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void left_stick(float joy_x, float joy_y, float mouse_x, float mouse_y)
|
void move(float joy_x, float joy_y, float mouse_x, float mouse_y)
|
||||||
{
|
{
|
||||||
// LOGI("left_stick joy_x = %f, joy_y = %f",joy_x,joy_y);
|
// LOGI("left_stick joy_x = %f, joy_y = %f",joy_x,joy_y);
|
||||||
PortableMove(joy_y * droidinput.forward_sens, -joy_x * droidinput.strafe_sens);
|
AndroidMove(joy_y * droidinput.forward_sens, -joy_x * droidinput.strafe_sens);
|
||||||
}
|
|
||||||
|
|
||||||
void setHideSticks(bool v)
|
|
||||||
{
|
|
||||||
if (touchJoyLeft)
|
|
||||||
touchJoyLeft->setHideGraphics(v);
|
|
||||||
}
|
|
||||||
|
|
||||||
void touchSettingsButton(int state)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
int32_t paused = PortableRead(READ_PAUSED);
|
|
||||||
|
|
||||||
//We wanna pause the game when doing settings
|
|
||||||
if (state && !paused || !state && paused)
|
|
||||||
{
|
|
||||||
PortableKeyEvent(2, SDL_SCANCODE_PAUSE, 0);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void initControls(int width, int height, const char *graphics_path)
|
void AndroidToggleButtonEditor(void)
|
||||||
{
|
{
|
||||||
touchcontrols::GLScaleWidth = (float)width;
|
controlsContainer.editorButtonPress();
|
||||||
touchcontrols::GLScaleHeight = (float)-height;
|
}
|
||||||
|
|
||||||
touchcontrols::ScaleY = nearbyintf(((float) height/(float) width) * touchcontrols::ScaleX);
|
void AndroidTouchInit(int width, int height, const char *graphics_path)
|
||||||
|
{
|
||||||
|
GLScaleWidth = (float)width;
|
||||||
|
GLScaleHeight = (float)-height;
|
||||||
|
|
||||||
/*
|
ScaleY = nearbyintf(((float) height/(float) width) * 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);
|
||||||
|
|
||||||
|
@ -381,180 +329,139 @@ void initControls(int width, int height, const char *graphics_path)
|
||||||
|
|
||||||
LOGI("creating controls");
|
LOGI("creating controls");
|
||||||
|
|
||||||
touchcontrols::setGraphicsBasePath(graphics_path);
|
setGraphicsBasePath(graphics_path);
|
||||||
|
|
||||||
controlsContainer.openGL_start.connect(sigc::ptr_fun(&openGLStart));
|
controlsContainer.pre_draw.connect(sigc::ptr_fun(&AndroidPreDrawButtons));
|
||||||
controlsContainer.openGL_end.connect(sigc::ptr_fun(&openGLEnd));
|
controlsContainer.post_draw.connect(sigc::ptr_fun(&AndroidPostDrawButtons));
|
||||||
controlsContainer.signal_settings.connect(sigc::ptr_fun(&touchSettingsButton));
|
|
||||||
|
|
||||||
tcBlankTap = new touchcontrols::TouchControls("blank_tap", false, false);
|
tcBlankTap = new TouchControls("blank_tap", false, false);
|
||||||
tcYesNo = new touchcontrols::TouchControls("yes_no", false, false);
|
tcYesNo = new TouchControls("yes_no", false, false);
|
||||||
tcMenuMain = new touchcontrols::TouchControls("menu", false, false);
|
tcMenuMain = new TouchControls("menu", false, false);
|
||||||
tcGameMain = new touchcontrols::TouchControls("game", false, true, 1);
|
tcBackButton = new TouchControls("back", false, false);
|
||||||
tcGameWeapons = new touchcontrols::TouchControls("weapons", false, false);
|
tcGameMain = new TouchControls("game", false, true, 1);
|
||||||
tcAutomap = new touchcontrols::TouchControls("automap", false, false);
|
tcGameWeapons = new TouchControls("weapons", false, false);
|
||||||
|
tcAutomap = new TouchControls("automap", false, false);
|
||||||
|
|
||||||
///////////////////////// BLANK TAP SCREEN //////////////////////
|
///////////////////////// BLANK TAP SCREEN //////////////////////
|
||||||
|
|
||||||
// One button on whole screen with no graphic, send a return key
|
// One button on whole screen with no graphic, send a return key
|
||||||
tcBlankTap->addControl(new touchcontrols::Button("whole_screen", touchcontrols::RectF(0, 0, 26, 16),
|
tcBlankTap->addControl(new Button("whole_screen", RectF(0, 0, 26, 16), "", SDL_SCANCODE_RETURN));
|
||||||
"" /*std::string("test")*/, SDL_SCANCODE_RETURN));
|
tcBlankTap->signal_button.connect(sigc::ptr_fun(&callbacks::proceed));
|
||||||
tcBlankTap->signal_button.connect(sigc::ptr_fun(&blankTapButton)); // Just reuse the menuButton function
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////// YES NO SCREEN /////////////////////
|
///////////////////////// YES NO SCREEN /////////////////////
|
||||||
|
|
||||||
tcYesNo->addControl(
|
tcYesNo->addControl(new Button("enter", RectF(16, 9, 18, 11), "yes", SDL_SCANCODE_RETURN));
|
||||||
new touchcontrols::Button("enter", touchcontrols::RectF(16, 9, 18, 11), "yes", SDL_SCANCODE_RETURN));
|
tcYesNo->addControl(new Button("esc", RectF(8, 9, 10, 11), "no", SDL_SCANCODE_ESCAPE));
|
||||||
tcYesNo->addControl(
|
tcYesNo->signal_button.connect(sigc::ptr_fun(&callbacks::menu_button));
|
||||||
new touchcontrols::Button("esc", touchcontrols::RectF(8, 9, 10, 11), "no", SDL_SCANCODE_ESCAPE));
|
|
||||||
tcYesNo->signal_button.connect(sigc::ptr_fun(&menuButton)); // Just reuse the menuButton function
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////// MAIN MENU SCREEN /////////////////////
|
// menu and shared back button
|
||||||
|
|
||||||
tcMenuMain->addControl(
|
MultitouchMouse *mouseMenu = new MultitouchMouse("mouse", RectF(0, 0, 26, 16), "");
|
||||||
new touchcontrols::Button("arrow_left", touchcontrols::RectF(0, 0, 2, 2), "arrow_left", SDL_SCANCODE_ESCAPE));
|
mouseMenu->signal_action.connect(sigc::ptr_fun(&callbacks::menu_select));
|
||||||
tcMenuMain->signal_button.connect(sigc::ptr_fun(&menuButton));
|
|
||||||
|
|
||||||
touchcontrols::MultitouchMouse *mouseMenu =
|
|
||||||
new touchcontrols::MultitouchMouse("mouse", touchcontrols::RectF(0, 0, 26, 16), "");
|
|
||||||
mouseMenu->setHideGraphics(true);
|
mouseMenu->setHideGraphics(true);
|
||||||
tcMenuMain->addControl(mouseMenu);
|
tcMenuMain->addControl(mouseMenu);
|
||||||
mouseMenu->signal_action.connect(sigc::ptr_fun(&menuMouse));
|
|
||||||
|
|
||||||
touchcontrols::Button *console_button = new touchcontrols::Button(
|
|
||||||
"keyboard", "Development console", touchcontrols::RectF(8, 0, 10, 2), "keyboard", KEY_SHOW_KBRD, false, true);
|
|
||||||
|
|
||||||
|
Button *console_button = new Button("keyboard", "Development console", RectF(8, 0, 10, 2), "keyboard", KEY_SHOW_KBRD, false, true);
|
||||||
tcMenuMain->addControl(console_button);
|
tcMenuMain->addControl(console_button);
|
||||||
|
|
||||||
//////////////////////////// GAME SCREEN /////////////////////
|
tcBackButton->addControl(new Button("menu_back", RectF(0, 0, 2, 2), "arrow_left", SDL_SCANCODE_ESCAPE));
|
||||||
|
tcBackButton->signal_button.connect(sigc::ptr_fun(&callbacks::menu_button));
|
||||||
|
|
||||||
|
// main controls
|
||||||
|
|
||||||
tcGameMain->setAlpha(droidinput.gameControlsAlpha);
|
tcGameMain->setAlpha(droidinput.gameControlsAlpha);
|
||||||
controlsContainer.editButtonAlpha = droidinput.gameControlsAlpha;
|
|
||||||
|
|
||||||
tcGameMain->addControl(
|
tcGameMain->addControl(new Button("use", RectF(20, 4, 23, 7), "use", gamefunc_Open));
|
||||||
new touchcontrols::Button("game_menu", touchcontrols::RectF(0, 0, 2, 2), "settings_bars", MENU_BACK));
|
tcGameMain->addControl(new Button("fire", RectF(20, 7, 23, 10), "fire2", gamefunc_Fire));
|
||||||
|
tcGameMain->addControl(new Button("jump", RectF(23, 6, 26, 9), "jump", gamefunc_Jump));
|
||||||
|
tcGameMain->addControl(new Button("crouch", RectF(24, 12, 26, 14), "crouch", gamefunc_Crouch));
|
||||||
|
tcGameMain->addControl(new Button("kick", "Mighty Foot", RectF(23, 3, 26, 6), "boot", gamefunc_Quick_Kick, false, true));
|
||||||
|
|
||||||
tcGameMain->addControl(new touchcontrols::Button("use", touchcontrols::RectF(20, 4, 23, 7), "use", gamefunc_Open));
|
Button *map_button = new Button("map", "Overhead map", RectF(6, 0, 8, 2), "map", gamefunc_Map, false, true);
|
||||||
tcGameMain->addControl(
|
|
||||||
new touchcontrols::Button("fire", touchcontrols::RectF(20, 7, 23, 10), "fire2", gamefunc_Fire));
|
|
||||||
tcGameMain->addControl(
|
|
||||||
new touchcontrols::Button("jump", touchcontrols::RectF(23, 6, 26, 9), "jump", gamefunc_Jump));
|
|
||||||
tcGameMain->addControl(
|
|
||||||
new touchcontrols::Button("crouch", touchcontrols::RectF(24, 12, 26, 14), "crouch", gamefunc_Crouch));
|
|
||||||
tcGameMain->addControl(new touchcontrols::Button("kick", "Mighty Foot", touchcontrols::RectF(23, 3, 26, 6), "boot",
|
|
||||||
gamefunc_Quick_Kick, false, true));
|
|
||||||
|
|
||||||
touchcontrols::Button *map_button = new touchcontrols::Button(
|
|
||||||
"map", "Overhead map", touchcontrols::RectF(6, 0, 8, 2), "map", gamefunc_Map, false, true);
|
|
||||||
tcGameMain->addControl(map_button);
|
tcGameMain->addControl(map_button);
|
||||||
tcGameMain->addControl(new touchcontrols::Button("show_inventory", "Inventory", touchcontrols::RectF(24, 0, 26, 2),
|
|
||||||
"inv", KEY_SHOW_INVEN));
|
Button *inv_button = new Button("show_inventory", "Inventory", RectF(24, 0, 26, 2), "inv", KEY_SHOW_INVEN);
|
||||||
tcGameMain->addControl(new touchcontrols::Button("next_weapon", "Next weapon", touchcontrols::RectF(0, 3, 3, 5),
|
tcGameMain->addControl(inv_button);
|
||||||
"next_weap", gamefunc_Next_Weapon, false, true));
|
tcGameMain->addControl(new Button("next_weapon", "Next weapon", RectF(0, 3, 3, 5), "next_weap", gamefunc_Next_Weapon, false, true));
|
||||||
tcGameMain->addControl(new touchcontrols::Button("prev_weapon", "Previous weapon", touchcontrols::RectF(0, 5, 3, 7),
|
tcGameMain->addControl(new Button("prev_weapon", "Previous weapon", RectF(0, 5, 3, 7), "prev_weap", gamefunc_Previous_Weapon, false, true));
|
||||||
"prev_weap", gamefunc_Previous_Weapon, false, true));
|
tcGameMain->addControl(new Button("quick_save", "Save game", RectF(22, 0, 24, 2), "save", KEY_QUICK_SAVE, false, true));
|
||||||
tcGameMain->addControl(new touchcontrols::Button("quick_save", "Save game", touchcontrols::RectF(22, 0, 24, 2),
|
tcGameMain->addControl(new Button("quick_load", "Load game", RectF(20, 0, 22, 2), "load", KEY_QUICK_LOAD, false, true));
|
||||||
"save", KEY_QUICK_SAVE, false, true));
|
|
||||||
tcGameMain->addControl(new touchcontrols::Button("quick_load", "Load game", touchcontrols::RectF(20, 0, 22, 2),
|
|
||||||
"load", KEY_QUICK_LOAD, false, true));
|
|
||||||
|
|
||||||
tcGameMain->addControl(console_button);
|
tcGameMain->addControl(console_button);
|
||||||
/*
|
|
||||||
//quick actions binds
|
|
||||||
tcGameMain->addControl(new
|
|
||||||
touchcontrols::Button("quick_key_1",touchcontrols::RectF(4,3,6,5),"quick_key_1",KEY_QUICK_KEY1,false,true));
|
|
||||||
tcGameMain->addControl(new
|
|
||||||
touchcontrols::Button("quick_key_2",touchcontrols::RectF(6,3,8,5),"quick_key_2",KEY_QUICK_KEY2,false,true));
|
|
||||||
tcGameMain->addControl(new
|
|
||||||
touchcontrols::Button("quick_key_3",touchcontrols::RectF(8,3,10,5),"quick_key_3",KEY_QUICK_KEY3,false,true));
|
|
||||||
tcGameMain->addControl(new
|
|
||||||
touchcontrols::Button("quick_key_4",touchcontrols::RectF(10,3,12,5),"quick_key_4",KEY_QUICK_KEY4,false,true));
|
|
||||||
*/
|
|
||||||
// Left stick
|
// Left stick
|
||||||
touchJoyLeft = new touchcontrols::TouchJoy("stick", touchcontrols::RectF(0, 7, 8, 16), "strafe_arrow");
|
touchJoyLeft = new TouchStick("stick", RectF(0, 7, 8, 16), "strafe_arrow");
|
||||||
tcGameMain->addControl(touchJoyLeft);
|
tcGameMain->addControl(touchJoyLeft);
|
||||||
touchJoyLeft->signal_move.connect(sigc::ptr_fun(&left_stick));
|
touchJoyLeft->signal_move.connect(sigc::ptr_fun(&callbacks::move));
|
||||||
touchJoyLeft->signal_double_tap.connect(sigc::ptr_fun(&left_double_tap));
|
touchJoyLeft->signal_double_tap.connect(sigc::ptr_fun(&callbacks::left_double_tap));
|
||||||
|
|
||||||
// Mouse look for whole screen
|
// Mouse look for whole screen
|
||||||
touchcontrols::Mouse *mouse = new touchcontrols::Mouse("mouse", touchcontrols::RectF(3, 0, 26, 16), "");
|
Mouse *mouse = new Mouse("mouse", RectF(3, 0, 26, 16), "");
|
||||||
mouse->signal_action.connect(sigc::ptr_fun(&mouseMove));
|
mouse->signal_action.connect(sigc::ptr_fun(&callbacks::look));
|
||||||
mouse->signal_double_tap.connect(sigc::ptr_fun(&right_double_tap));
|
mouse->signal_double_tap.connect(sigc::ptr_fun(&callbacks::right_double_tap));
|
||||||
|
|
||||||
mouse->setHideGraphics(true);
|
mouse->setHideGraphics(true);
|
||||||
tcGameMain->addControl(mouse);
|
tcGameMain->addControl(mouse);
|
||||||
|
|
||||||
tcGameMain->signal_button.connect(sigc::ptr_fun(&gameButton));
|
tcGameMain->signal_button.connect(sigc::ptr_fun(&callbacks::in_game));
|
||||||
tcGameMain->signal_settingsButton.connect(sigc::ptr_fun(&gameSettingsButton));
|
|
||||||
|
|
||||||
///////////////////////// AUTO MAP SCREEN ///////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
// Automap
|
// Automap
|
||||||
touchcontrols::MultitouchMouse *multimouse =
|
MultitouchMouse *multimouse = new MultitouchMouse("gamemouse", RectF(0, 0, 26, 16), "");
|
||||||
new touchcontrols::MultitouchMouse("gamemouse", touchcontrols::RectF(0, 0, 26, 16), "");
|
|
||||||
multimouse->setHideGraphics(true);
|
multimouse->setHideGraphics(true);
|
||||||
tcAutomap->addControl(multimouse);
|
tcAutomap->addControl(multimouse);
|
||||||
multimouse->signal_action.connect(sigc::ptr_fun(&automap_multitouch_mouse_move));
|
multimouse->signal_action.connect(sigc::ptr_fun(&callbacks::automap_multitouch_mouse_move));
|
||||||
tcAutomap->addControl(map_button);
|
tcAutomap->addControl(map_button);
|
||||||
tcAutomap->signal_button.connect(sigc::ptr_fun(&gameButton));
|
tcAutomap->signal_button.connect(sigc::ptr_fun(&callbacks::in_game));
|
||||||
tcAutomap->setAlpha(0.5);
|
tcAutomap->setAlpha(0.5);
|
||||||
|
|
||||||
// Now inventory in the weapons control group!
|
// Now inventory in the weapons control group!
|
||||||
|
|
||||||
inv_buttons[GET_JETPACK] = new touchcontrols::Button("jetpack", touchcontrols::RectF(0, 3, 2, 5), "jetpack",
|
inv_buttons[GET_JETPACK] = new Button("jetpack", RectF(0, 3, 2, 5), "jetpack", gamefunc_Jetpack, false, false, true);
|
||||||
gamefunc_Jetpack, false, false, true);
|
inv_buttons[GET_FIRSTAID] = new Button("medkit", RectF(0, 5, 2, 7), "medkit", gamefunc_MedKit, false, false, true);
|
||||||
inv_buttons[GET_FIRSTAID] = new touchcontrols::Button("medkit", touchcontrols::RectF(0, 5, 2, 7), "medkit",
|
inv_buttons[GET_HEATS] = new Button("nightv", RectF(0, 7, 2, 9), "nightvision", gamefunc_NightVision, false, false, true);
|
||||||
gamefunc_MedKit, false, false, true);
|
inv_buttons[GET_HOLODUKE] = new Button("holoduke", RectF(0, 9, 2, 11), "holoduke", gamefunc_Holo_Duke, false, false, true);
|
||||||
inv_buttons[GET_HEATS] = new touchcontrols::Button("nightv", touchcontrols::RectF(0, 7, 2, 9), "nightvision",
|
inv_buttons[GET_STEROIDS] = new Button("steroids", RectF(0, 11, 2, 13), "steroids", gamefunc_Steroids, false, false, true);
|
||||||
gamefunc_NightVision, false, false, true);
|
|
||||||
inv_buttons[GET_HOLODUKE] = new touchcontrols::Button("holoduke", touchcontrols::RectF(0, 9, 2, 11), "holoduke",
|
|
||||||
gamefunc_Holo_Duke, false, false, true);
|
|
||||||
inv_buttons[GET_STEROIDS] = new touchcontrols::Button("steroids", touchcontrols::RectF(0, 11, 2, 13), "steroids",
|
|
||||||
gamefunc_Steroids, false, false, true);
|
|
||||||
|
|
||||||
tcGameWeapons->addControl(inv_buttons[GET_JETPACK]);
|
tcGameWeapons->addControl(inv_buttons[GET_JETPACK]);
|
||||||
tcGameWeapons->addControl(inv_buttons[GET_FIRSTAID]);
|
tcGameWeapons->addControl(inv_buttons[GET_FIRSTAID]);
|
||||||
tcGameWeapons->addControl(inv_buttons[GET_HEATS]);
|
tcGameWeapons->addControl(inv_buttons[GET_HEATS]);
|
||||||
tcGameWeapons->addControl(inv_buttons[GET_HOLODUKE]);
|
tcGameWeapons->addControl(inv_buttons[GET_HOLODUKE]);
|
||||||
tcGameWeapons->addControl(inv_buttons[GET_STEROIDS]);
|
tcGameWeapons->addControl(inv_buttons[GET_STEROIDS]);
|
||||||
|
// tcGameWeapons->addControl(inv_button);
|
||||||
|
|
||||||
// Inventory are the only buttons so safe to do this
|
// Inventory are the only buttons so safe to do this
|
||||||
tcGameWeapons->signal_button.connect(sigc::ptr_fun(&inventoryButton));
|
tcGameWeapons->signal_button.connect(sigc::ptr_fun(&callbacks::inv_button));
|
||||||
|
|
||||||
// Weapons
|
// Weapons
|
||||||
weaponWheel =
|
weaponWheel = new WheelSelect("weapon_wheel", RectF(7, 2, 19, 14), "weapon_wheel_orange_blank", 10);
|
||||||
new touchcontrols::WheelSelect("weapon_wheel", touchcontrols::RectF(7, 2, 19, 14), "weapon_wheel_orange_blank", 10);
|
weaponWheel->signal_selected.connect(sigc::ptr_fun(&callbacks::select_weapon));
|
||||||
weaponWheel->signal_selected.connect(sigc::ptr_fun(&weaponWheelChosen));
|
weaponWheel->signal_enabled.connect(sigc::ptr_fun(&callbacks::show_wheel));
|
||||||
weaponWheel->signal_enabled.connect(sigc::ptr_fun(&weaponWheelSelected));
|
|
||||||
tcGameWeapons->addControl(weaponWheel);
|
tcGameWeapons->addControl(weaponWheel);
|
||||||
tcGameWeapons->setAlpha(0.9);
|
tcGameWeapons->setAlpha(0.9);
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
controlsContainer.addControlGroup(tcMenuMain);
|
controlsContainer.addControlGroup(tcMenuMain);
|
||||||
|
controlsContainer.addControlGroup(tcBackButton);
|
||||||
controlsContainer.addControlGroup(tcGameMain);
|
controlsContainer.addControlGroup(tcGameMain);
|
||||||
// controlsContainer.addControlGroup(tcInventory);//Need to be above tcGameMain incase buttons over stick
|
|
||||||
controlsContainer.addControlGroup(tcGameWeapons);
|
controlsContainer.addControlGroup(tcGameWeapons);
|
||||||
controlsContainer.addControlGroup(tcAutomap);
|
controlsContainer.addControlGroup(tcAutomap);
|
||||||
controlsContainer.addControlGroup(tcYesNo);
|
controlsContainer.addControlGroup(tcYesNo);
|
||||||
controlsContainer.addControlGroup(tcBlankTap);
|
controlsContainer.addControlGroup(tcBlankTap);
|
||||||
controlsCreated = 1;
|
|
||||||
|
|
||||||
tcGameMain->setAlpha(droidinput.gameControlsAlpha);
|
tcGameMain->setAlpha(droidinput.gameControlsAlpha);
|
||||||
controlsContainer.editButtonAlpha = droidinput.gameControlsAlpha;
|
|
||||||
tcGameWeapons->setAlpha(droidinput.gameControlsAlpha);
|
tcGameWeapons->setAlpha(droidinput.gameControlsAlpha);
|
||||||
tcMenuMain->setAlpha(droidinput.gameControlsAlpha);
|
tcMenuMain->setAlpha(droidinput.gameControlsAlpha);
|
||||||
|
tcBackButton->setAlpha(droidinput.gameControlsAlpha);
|
||||||
|
|
||||||
tcGameMain->setXMLFile(gamePath + "/control_layout_main.xml");
|
tcGameMain->setXMLFile(gamePath + "/control_layout_main.xml");
|
||||||
tcGameWeapons->setXMLFile(gamePath + "/control_layout_weapons.xml");
|
tcGameWeapons->setXMLFile(gamePath + "/control_layout_weapons.xml");
|
||||||
tcAutomap->setXMLFile(gamePath + "/control_layout_automap.xml");
|
tcAutomap->setXMLFile(gamePath + "/control_layout_automap.xml");
|
||||||
// tcInventory->setXMLFile((std::string)graphics_path + "/inventory.xml");
|
|
||||||
|
|
||||||
setControlsContainer(&controlsContainer);
|
setControlsContainer(&controlsContainer);
|
||||||
|
|
||||||
// controlsContainer.initGL();
|
controlsCreated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateTouchScreenMode(touchscreemode_t mode)
|
void updateTouchScreenMode(touchscreemode_t mode)
|
||||||
|
@ -577,21 +484,23 @@ void updateTouchScreenMode(touchscreemode_t mode)
|
||||||
break;
|
break;
|
||||||
case TOUCH_SCREEN_YES_NO:
|
case TOUCH_SCREEN_YES_NO:
|
||||||
tcYesNo->resetOutput();
|
tcYesNo->resetOutput();
|
||||||
tcYesNo->fade(touchcontrols::FADE_OUT, DEFAULT_FADE_FRAMES);
|
tcYesNo->setEnabled(false);
|
||||||
break;
|
break;
|
||||||
|
case TOUCH_SCREEN_MENU_NOBACK:
|
||||||
|
tcBackButton->fade(FADE_IN, DEFAULT_FADE_FRAMES);
|
||||||
case TOUCH_SCREEN_MENU:
|
case TOUCH_SCREEN_MENU:
|
||||||
tcMenuMain->resetOutput();
|
tcMenuMain->resetOutput();
|
||||||
tcMenuMain->fade(touchcontrols::FADE_OUT, DEFAULT_FADE_FRAMES);
|
tcMenuMain->fade(FADE_OUT, DEFAULT_FADE_FRAMES);
|
||||||
break;
|
break;
|
||||||
case TOUCH_SCREEN_GAME:
|
case TOUCH_SCREEN_GAME:
|
||||||
tcGameMain->resetOutput();
|
tcGameMain->resetOutput();
|
||||||
|
|
||||||
tcGameMain->fade(touchcontrols::FADE_OUT, DEFAULT_FADE_FRAMES);
|
tcGameMain->fade(FADE_OUT, DEFAULT_FADE_FRAMES);
|
||||||
tcGameWeapons->setEnabled(false);
|
tcGameWeapons->setEnabled(false);
|
||||||
break;
|
break;
|
||||||
case TOUCH_SCREEN_AUTOMAP:
|
case TOUCH_SCREEN_AUTOMAP:
|
||||||
tcAutomap->resetOutput();
|
tcAutomap->resetOutput();
|
||||||
tcAutomap->fade(touchcontrols::FADE_OUT, DEFAULT_FADE_FRAMES);
|
tcAutomap->fade(FADE_OUT, DEFAULT_FADE_FRAMES);
|
||||||
break;
|
break;
|
||||||
case TOUCH_SCREEN_CONSOLE: break;
|
case TOUCH_SCREEN_CONSOLE: break;
|
||||||
}
|
}
|
||||||
|
@ -603,23 +512,26 @@ void updateTouchScreenMode(touchscreemode_t mode)
|
||||||
case TOUCH_SCREEN_BLANK_TAP: tcBlankTap->setEnabled(true); break;
|
case TOUCH_SCREEN_BLANK_TAP: tcBlankTap->setEnabled(true); break;
|
||||||
case TOUCH_SCREEN_YES_NO:
|
case TOUCH_SCREEN_YES_NO:
|
||||||
tcYesNo->setEnabled(true);
|
tcYesNo->setEnabled(true);
|
||||||
tcYesNo->fade(touchcontrols::FADE_IN, DEFAULT_FADE_FRAMES);
|
tcYesNo->fade(FADE_IN, DEFAULT_FADE_FRAMES);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TOUCH_SCREEN_MENU_NOBACK:
|
||||||
|
tcBackButton->fade(FADE_OUT, DEFAULT_FADE_FRAMES);
|
||||||
case TOUCH_SCREEN_MENU:
|
case TOUCH_SCREEN_MENU:
|
||||||
tcMenuMain->setEnabled(true);
|
tcMenuMain->setEnabled(true);
|
||||||
tcMenuMain->fade(touchcontrols::FADE_IN, DEFAULT_FADE_FRAMES);
|
tcMenuMain->fade(FADE_IN, DEFAULT_FADE_FRAMES);
|
||||||
|
|
||||||
// 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
|
||||||
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(FADE_IN, DEFAULT_FADE_FRAMES);
|
||||||
tcGameWeapons->setEnabled(true);
|
tcGameWeapons->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
case TOUCH_SCREEN_AUTOMAP:
|
case TOUCH_SCREEN_AUTOMAP:
|
||||||
tcAutomap->setEnabled(true);
|
tcAutomap->setEnabled(true);
|
||||||
tcAutomap->fade(touchcontrols::FADE_IN, DEFAULT_FADE_FRAMES);
|
tcAutomap->fade(FADE_IN, DEFAULT_FADE_FRAMES);
|
||||||
break;
|
break;
|
||||||
case TOUCH_SCREEN_CONSOLE: break;
|
case TOUCH_SCREEN_CONSOLE: break;
|
||||||
}
|
}
|
||||||
|
@ -627,16 +539,19 @@ void updateTouchScreenMode(touchscreemode_t mode)
|
||||||
lastMode = mode;
|
lastMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int inv = PortableRead(READ_INVENTORY);
|
int inv = AndroidRead(R_PLAYER_INV_AMOUNT);
|
||||||
|
|
||||||
for (int i = 0; i < GET_MAX; ++i)
|
for (int i = 0; i < GET_MAX; ++i)
|
||||||
if (inv_buttons[i])
|
if (inv_buttons[i])
|
||||||
inv_buttons[i]->setAlpha(tcGameWeapons->getFadedAlpha() * ((inv & (1 << i)) ? 1.f : 0.3f));
|
inv_buttons[i]->setAlpha(tcGameWeapons->getFadedAlpha() * ((inv & (1 << i)) ? 1.f : 0.3f));
|
||||||
|
|
||||||
|
backButtonEnabled = !tcBlankTap->enabled && mode != TOUCH_SCREEN_MENU_NOBACK;
|
||||||
|
tcBackButton->setEnabled(backButtonEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern char videomodereset;
|
extern char videomodereset;
|
||||||
|
|
||||||
void frameControls()
|
void AndroidDrawControls()
|
||||||
{
|
{
|
||||||
static int loadedGLImages = 0;
|
static int loadedGLImages = 0;
|
||||||
|
|
||||||
|
@ -654,47 +569,34 @@ void frameControls()
|
||||||
loadedGLImages = 1;
|
loadedGLImages = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// LOGI("frameControls");
|
// LOGI("AndroidDrawControls");
|
||||||
|
|
||||||
curRenderer = (PortableRead(READ_RENDERER) != REND_CLASSIC);
|
|
||||||
|
|
||||||
if (!controlsCreated)
|
if (!controlsCreated)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
updateTouchScreenMode((touchscreemode_t)PortableRead(READ_SCREEN_MODE));
|
updateTouchScreenMode((touchscreemode_t)AndroidRead(R_TOUCH_MODE));
|
||||||
|
|
||||||
setHideSticks(droidinput.hideStick);
|
if (touchJoyLeft)
|
||||||
|
touchJoyLeft->setHideGraphics(droidinput.hideStick);
|
||||||
|
|
||||||
if (tcGameMain)
|
if (tcGameMain)
|
||||||
{
|
|
||||||
tcGameMain->setAlpha(droidinput.gameControlsAlpha);
|
tcGameMain->setAlpha(droidinput.gameControlsAlpha);
|
||||||
controlsContainer.editButtonAlpha = droidinput.gameControlsAlpha;
|
|
||||||
|
|
||||||
if (tcGameWeapons)
|
if (tcGameWeapons)
|
||||||
tcGameWeapons->setAlpha(droidinput.gameControlsAlpha);
|
tcGameWeapons->setAlpha(droidinput.gameControlsAlpha);
|
||||||
|
|
||||||
if (tcMenuMain)
|
if (tcMenuMain)
|
||||||
tcMenuMain->setAlpha(droidinput.gameControlsAlpha);
|
tcMenuMain->setAlpha(droidinput.gameControlsAlpha);
|
||||||
}
|
|
||||||
|
if (tcBackButton)
|
||||||
|
tcBackButton->setAlpha(droidinput.gameControlsAlpha);
|
||||||
|
|
||||||
controlsContainer.draw();
|
controlsContainer.draw();
|
||||||
|
|
||||||
|
if (controlsContainer.editingControls)
|
||||||
|
tcBackButton->draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setTouchSettings(int other)
|
|
||||||
{
|
|
||||||
// TODO: defined names for these values
|
|
||||||
hasTouch = other & 0x4000 ? true : false;
|
|
||||||
hideTouchControls = other & 0x8000 ? true : false;
|
|
||||||
hwScaling = other & 0x10000 ? true : false;
|
|
||||||
|
|
||||||
// keep in sync with Duke3d/res/values/strings.xml
|
|
||||||
int doubletap_options[4] = { -1, gamefunc_Quick_Kick, gamefunc_MedKit, gamefunc_Jetpack };
|
|
||||||
|
|
||||||
droidinput.left_double_action = doubletap_options[((other >> 4) & 0xF)];
|
|
||||||
droidinput.right_double_action = doubletap_options[((other >> 8) & 0xF)];
|
|
||||||
|
|
||||||
LOGI("setTouchSettings left_double_action = %d", droidinput.left_double_action);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define EXPORT_ME __NDK_FPABI__ __attribute__((visibility("default")))
|
#define EXPORT_ME __NDK_FPABI__ __attribute__((visibility("default")))
|
||||||
|
|
||||||
|
@ -715,8 +617,6 @@ jint EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_init(JNIEnv *env, jobj
|
||||||
droidinfo.audio_sample_rate = audio_rate;
|
droidinfo.audio_sample_rate = audio_rate;
|
||||||
droidinfo.audio_buffer_size = audio_buffer_size;
|
droidinfo.audio_buffer_size = audio_buffer_size;
|
||||||
|
|
||||||
curRenderer = REND_GL;
|
|
||||||
|
|
||||||
argv[0] = "eduke32";
|
argv[0] = "eduke32";
|
||||||
int argCount = (env)->GetArrayLength(argsArray);
|
int argCount = (env)->GetArrayLength(argsArray);
|
||||||
LOGI("argCount = %d", argCount);
|
LOGI("argCount = %d", argCount);
|
||||||
|
@ -742,9 +642,10 @@ jint EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_init(JNIEnv *env, jobj
|
||||||
LOGI("obbPath = %s", obbPath.c_str());
|
LOGI("obbPath = %s", obbPath.c_str());
|
||||||
|
|
||||||
if (hasTouch)
|
if (hasTouch)
|
||||||
initControls(droidinfo.screen_width, droidinfo.screen_height, (obbPath + "/assets/").c_str());
|
AndroidTouchInit(droidinfo.screen_width, droidinfo.screen_height, (obbPath + "/assets/").c_str());
|
||||||
|
else LOGI("skipping touch input");
|
||||||
|
|
||||||
PortableInit(argc, argv);
|
main(argc, (char **)argv);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -769,15 +670,19 @@ Java_com_voidpoint_duke3d_engine_NativeLib_keyPress(JNIEnv *env, jobject obj, ji
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
PortableKeyEvent(down, keycode, unicode);
|
AndroidKeyEvent(down, keycode, unicode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_touchEvent(JNIEnv *env, jobject obj, jint action, jint pid,
|
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_touchEvent(JNIEnv *env, jobject obj, jint action, jint pid,
|
||||||
jfloat x, jfloat y)
|
jfloat x, jfloat y)
|
||||||
{
|
{
|
||||||
|
if (tcBackButton && backButtonEnabled)
|
||||||
|
tcBackButton->processPointer(action, pid, x, y);
|
||||||
|
|
||||||
// LOGI("TOUCHED");
|
// LOGI("TOUCHED");
|
||||||
controlsContainer.processPointer(action, pid, x, y);
|
controlsContainer.processPointer(action, pid, x, y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -795,23 +700,34 @@ void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_doAction(JNIEnv *env,
|
||||||
tcGameWeapons->setEnabled(false);
|
tcGameWeapons->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
PortableAction(state, action);
|
AndroidAction(state, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_analogMove(JNIEnv *env, jobject obj, jfloat fwd, jfloat strafe)
|
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_analogMove(JNIEnv *env, jobject obj, jfloat fwd, jfloat strafe)
|
||||||
{
|
{
|
||||||
PortableMove(fwd, strafe);
|
AndroidMove(fwd, strafe);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_analogLook(JNIEnv *env, jobject obj, jfloat pitch, jfloat yaw)
|
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_analogLook(JNIEnv *env, jobject obj, jfloat pitch, jfloat yaw)
|
||||||
{
|
{
|
||||||
PortableLookJoystick(yaw, pitch);
|
AndroidLookJoystick(yaw, pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXPORT_ME
|
void EXPORT_ME
|
||||||
Java_com_voidpoint_duke3d_engine_NativeLib_setTouchSettings(JNIEnv *env, jobject obj, int other)
|
Java_com_voidpoint_duke3d_engine_NativeLib_setTouchSettings(JNIEnv *env, jobject obj, int other)
|
||||||
{
|
{
|
||||||
setTouchSettings(other);
|
// TODO: defined names for these values
|
||||||
|
hasTouch = other & 0x4000 ? true : false;
|
||||||
|
hideTouchControls = other & 0x8000 ? true : false;
|
||||||
|
hwScaling = other & 0x10000 ? true : false;
|
||||||
|
|
||||||
|
// keep in sync with Duke3d/res/values/strings.xml
|
||||||
|
int doubletap_options[4] ={ -1, gamefunc_Quick_Kick, gamefunc_MedKit, gamefunc_Jetpack };
|
||||||
|
|
||||||
|
droidinput.left_double_action = doubletap_options[((other >> 4) & 0xF)];
|
||||||
|
droidinput.right_double_action = doubletap_options[((other >> 8) & 0xF)];
|
||||||
|
|
||||||
|
LOGI("setTouchSettings left_double_action = %d", droidinput.left_double_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_resetTouchSettings(JNIEnv *env, jobject obj)
|
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_resetTouchSettings(JNIEnv *env, jobject obj)
|
||||||
|
@ -826,7 +742,7 @@ jint EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_quickCommand(JNIEnv *e
|
||||||
const char *p = env->GetStringUTFChars(command, NULL);
|
const char *p = env->GetStringUTFChars(command, NULL);
|
||||||
quickCommandString = std::string(p) + "\n";
|
quickCommandString = std::string(p) + "\n";
|
||||||
env->ReleaseStringUTFChars(command, p);
|
env->ReleaseStringUTFChars(command, p);
|
||||||
PortableCommand(quickCommandString.c_str());
|
AndroidOSD(quickCommandString.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXPORT_ME
|
void EXPORT_ME
|
||||||
|
@ -836,6 +752,8 @@ Java_com_voidpoint_duke3d_engine_NativeLib_setScreenSize(JNIEnv *env, jobject th
|
||||||
droidinfo.screen_height = height;
|
droidinfo.screen_height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void SDL_Android_Init(JNIEnv *env, jclass cls);
|
||||||
|
|
||||||
void EXPORT_ME Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv *env, jclass cls)
|
void EXPORT_ME Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv *env, jclass cls)
|
||||||
{
|
{
|
||||||
/* This interface could expand with ABI negotiation, calbacks, etc. */
|
/* This interface could expand with ABI negotiation, calbacks, etc. */
|
||||||
|
@ -844,29 +762,4 @@ void EXPORT_ME Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv *env, jclass cl
|
||||||
// SDL_EventState(SDL_TEXTINPUT,SDL_ENABLE);
|
// SDL_EventState(SDL_TEXTINPUT,SDL_ENABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
jstring EXPORT_ME
|
|
||||||
Java_com_voidpoint_duke3d_engine_NativeLib_getSaveText(JNIEnv *env, jobject obj, jstring jfile, jint type)
|
|
||||||
{
|
|
||||||
const char *p = env->GetStringUTFChars(jfile, NULL);
|
|
||||||
|
|
||||||
jstring ret = env->NewStringUTF(G_GetStringFromSavegame(p, type));
|
|
||||||
env->ReleaseStringUTFChars(jfile, p);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
jint EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_getScreenshot(JNIEnv *env, jobject obj, jstring jfile,
|
|
||||||
jobject jpal, jobject jdataOut)
|
|
||||||
{
|
|
||||||
const char *p = env->GetStringUTFChars(jfile, NULL);
|
|
||||||
|
|
||||||
jbyte *bb = (jbyte *)env->GetDirectBufferAddress(jdataOut);
|
|
||||||
jbyte *pb = (jbyte *)env->GetDirectBufferAddress(jpal);
|
|
||||||
|
|
||||||
int ret = G_GetScreenshotFromSavegame(p, (char *)pb, (char *)bb);
|
|
||||||
|
|
||||||
env->ReleaseStringUTFChars(jfile, p);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
int const sdl_code [] = { SDL_SCANCODE_UP, SDL_SCANCODE_DOWN, SDL_SCANCODE_LEFT,
|
||||||
SDL_SCANCODE_RIGHT, SDL_SCANCODE_RETURN, SDL_SCANCODE_ESCAPE };
|
SDL_SCANCODE_RIGHT, SDL_SCANCODE_RETURN, SDL_SCANCODE_ESCAPE };
|
||||||
PortableKeyEvent(state, sdl_code[action-MENU_UP], 0);
|
AndroidKeyEvent(state, sdl_code[action-MENU_UP], 0);
|
||||||
return;
|
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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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");
|
|
||||||
+ }*/
|
|
|
@ -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
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue