mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Android stuff. DONT_BUILD.
git-svn-id: https://svn.eduke32.com/eduke32@5661 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
83acadd3b4
commit
e2c24bda95
9 changed files with 84 additions and 100 deletions
|
@ -145,9 +145,9 @@ GAME_SRC=source/game.c \
|
||||||
|
|
||||||
LOCAL_SRC_FILES = $(ANDROID_SRC) $(JAUDIO_SRC) $(JMACT_SRC) $(GAME_SRC) $(BUILD_SRC)
|
LOCAL_SRC_FILES = $(ANDROID_SRC) $(JAUDIO_SRC) $(JMACT_SRC) $(GAME_SRC) $(BUILD_SRC)
|
||||||
|
|
||||||
LOCAL_LDLIBS := -lGLESv1_CM -lEGL -ldl -llog -lOpenSLES -lz -L$(TOP_DIR)/openssl/libs/
|
LOCAL_LDLIBS := -lGLESv1_CM -lEGL -ldl -llog
|
||||||
LOCAL_STATIC_LIBRARIES := libpng crypto
|
LOCAL_STATIC_LIBRARIES := touch
|
||||||
LOCAL_SHARED_LIBRARIES := ogg vorbis SDL2 SDL2_mixer libvpx drm
|
LOCAL_SHARED_LIBRARIES := ogg vorbis SDL2 SDL2_mixer libvpx
|
||||||
# SDL2_image
|
# SDL2_image
|
||||||
|
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
|
@ -1267,8 +1267,6 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
|
||||||
|
|
||||||
if (!glinfo.bgra)
|
if (!glinfo.bgra)
|
||||||
{
|
{
|
||||||
texfmt = GL_RGBA;
|
|
||||||
|
|
||||||
for (int i=siz.x*siz.y, j=0; j<i; j++)
|
for (int i=siz.x*siz.y, j=0; j<i; j++)
|
||||||
swapchar(&pic[j].r, &pic[j].b);
|
swapchar(&pic[j].r, &pic[j].b);
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,6 +183,7 @@
|
||||||
<ClInclude Include="source\gamevars.h" />
|
<ClInclude Include="source\gamevars.h" />
|
||||||
<ClInclude Include="source\global.h" />
|
<ClInclude Include="source\global.h" />
|
||||||
<ClInclude Include="source\input.h" />
|
<ClInclude Include="source\input.h" />
|
||||||
|
<ClInclude Include="source\inv.h" />
|
||||||
<ClInclude Include="source\jaudiolib\include\drivers.h" />
|
<ClInclude Include="source\jaudiolib\include\drivers.h" />
|
||||||
<ClInclude Include="source\lunatic\lunatic_game.h" />
|
<ClInclude Include="source\lunatic\lunatic_game.h" />
|
||||||
<ClInclude Include="source\lunatic\lunatic_m32.h" />
|
<ClInclude Include="source\lunatic\lunatic_m32.h" />
|
||||||
|
|
|
@ -525,6 +525,9 @@
|
||||||
<ClInclude Include="source\cmdline.h">
|
<ClInclude Include="source\cmdline.h">
|
||||||
<Filter>eduke32\headers</Filter>
|
<Filter>eduke32\headers</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="source\inv.h">
|
||||||
|
<Filter>eduke32\headers</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="build\src\a-c.c">
|
<ClCompile Include="build\src\a-c.c">
|
||||||
|
|
|
@ -30,29 +30,16 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
#include "TouchControlsContainer.h"
|
#include "TouchControlsContainer.h"
|
||||||
#include "JNITouchControlsUtils.h"
|
#include "JNITouchControlsUtils.h"
|
||||||
|
|
||||||
|
#include "inv.h"
|
||||||
|
|
||||||
using namespace touchcontrols;
|
using namespace touchcontrols;
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#define DEFAULT_FADE_FRAMES 10
|
|
||||||
|
|
||||||
#include "in_android.h"
|
#include "in_android.h"
|
||||||
#include "function.h"
|
#include "function.h"
|
||||||
|
|
||||||
enum dukeinv_t
|
#define DEFAULT_FADE_FRAMES 10
|
||||||
{
|
|
||||||
GET_STEROIDS, // 0
|
|
||||||
GET_SHIELD,
|
|
||||||
GET_SCUBA,
|
|
||||||
GET_HOLODUKE,
|
|
||||||
GET_JETPACK,
|
|
||||||
GET_DUMMY1, // 5
|
|
||||||
GET_ACCESS,
|
|
||||||
GET_HEATS,
|
|
||||||
GET_DUMMY2,
|
|
||||||
GET_FIRSTAID,
|
|
||||||
GET_BOOTS, // 10
|
|
||||||
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__))
|
||||||
|
@ -82,9 +69,6 @@ TouchControls *tcAutomap;
|
||||||
TouchStick *touchJoyLeft;
|
TouchStick *touchJoyLeft;
|
||||||
WheelSelect *weaponWheel;
|
WheelSelect *weaponWheel;
|
||||||
|
|
||||||
extern JNIEnv *env_;
|
|
||||||
JavaVM *jvm_;
|
|
||||||
|
|
||||||
Button *inv_buttons[GET_MAX];
|
Button *inv_buttons[GET_MAX];
|
||||||
|
|
||||||
std::string obbPath, gamePath;
|
std::string obbPath, gamePath;
|
||||||
|
@ -133,12 +117,15 @@ void AndroidShowWheel(bool show)
|
||||||
|
|
||||||
if (show)
|
if (show)
|
||||||
{
|
{
|
||||||
|
int weap = AndroidRead(R_PLAYER_GOTWEAPON);
|
||||||
|
|
||||||
for (int n = 0; n < 10; n++)
|
for (int n = 0; n < 10; n++)
|
||||||
weaponWheel->setSegmentEnabled(n, (AndroidRead(R_PLAYER_GOTWEAPON) >> n) & 0x1);
|
weaponWheel->setSegmentEnabled(n, (weap >> n) & 0x1);
|
||||||
|
|
||||||
// Show inventory buttons
|
// Show inventory buttons
|
||||||
tcGameWeapons->setAllButtonsEnabled(true);
|
tcGameWeapons->setAllButtonsEnabled(true);
|
||||||
tcGameWeapons->fade(FADE_IN, 5);
|
tcGameWeapons->fade(FADE_IN, 5);
|
||||||
|
|
||||||
weaponWheelVisible = true;
|
weaponWheelVisible = true;
|
||||||
|
|
||||||
AndroidTimer(0);
|
AndroidTimer(0);
|
||||||
|
@ -234,6 +221,8 @@ namespace callbacks
|
||||||
|
|
||||||
if (controlsContainer.editingControls)
|
if (controlsContainer.editingControls)
|
||||||
controlsContainer.editorButtonPress();
|
controlsContainer.editorButtonPress();
|
||||||
|
|
||||||
|
AndroidShowWheel(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void menu_select(int action, float x, float y, float dx, float dy)
|
void menu_select(int action, float x, float y, float dx, float dy)
|
||||||
|
@ -290,7 +279,7 @@ namespace callbacks
|
||||||
if (weaponWheelVisible)
|
if (weaponWheelVisible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float const scale = .1f;
|
float const scale = 10.f;
|
||||||
|
|
||||||
AndroidLook(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));
|
||||||
}
|
}
|
||||||
|
@ -320,6 +309,8 @@ void AndroidTouchInit(int width, int height, const char *graphics_path)
|
||||||
GLScaleWidth = (float)width;
|
GLScaleWidth = (float)width;
|
||||||
GLScaleHeight = (float)-height;
|
GLScaleHeight = (float)-height;
|
||||||
|
|
||||||
|
GLAspectRatio = GLScaleWidth/GLScaleHeight;
|
||||||
|
|
||||||
ScaleY = nearbyintf(((float) height/(float) width) * ScaleX);
|
ScaleY = nearbyintf(((float) height/(float) width) * ScaleX);
|
||||||
|
|
||||||
LOGI("initControls %d x %d,x path = %s", width, height, graphics_path);
|
LOGI("initControls %d x %d,x path = %s", width, height, graphics_path);
|
||||||
|
@ -351,8 +342,8 @@ void AndroidTouchInit(int width, int height, const char *graphics_path)
|
||||||
|
|
||||||
///////////////////////// YES NO SCREEN /////////////////////
|
///////////////////////// YES NO SCREEN /////////////////////
|
||||||
|
|
||||||
tcYesNo->addControl(new Button("enter", RectF(16, 9, 18, 11), "yes", SDL_SCANCODE_RETURN));
|
tcYesNo->addControl(new Button("enter", RectF(16, 9, 18, 11), "button_yes", SDL_SCANCODE_RETURN));
|
||||||
tcYesNo->addControl(new Button("esc", RectF(8, 9, 10, 11), "no", SDL_SCANCODE_ESCAPE));
|
tcYesNo->addControl(new Button("esc", RectF(8, 9, 10, 11), "button_no", SDL_SCANCODE_ESCAPE));
|
||||||
tcYesNo->signal_button.connect(sigc::ptr_fun(&callbacks::menu_button));
|
tcYesNo->signal_button.connect(sigc::ptr_fun(&callbacks::menu_button));
|
||||||
|
|
||||||
|
|
||||||
|
@ -363,36 +354,34 @@ void AndroidTouchInit(int width, int height, const char *graphics_path)
|
||||||
mouseMenu->setHideGraphics(true);
|
mouseMenu->setHideGraphics(true);
|
||||||
tcMenuMain->addControl(mouseMenu);
|
tcMenuMain->addControl(mouseMenu);
|
||||||
|
|
||||||
Button *console_button = new Button("keyboard", "Development console", RectF(8, 0, 10, 2), "keyboard", KEY_SHOW_KBRD, false, true);
|
Button *console_button = new Button("keyboard", "Development console", RectF(8, 0, 10, 2), "button_console", KEY_SHOW_KBRD, false, true);
|
||||||
tcMenuMain->addControl(console_button);
|
tcMenuMain->addControl(console_button);
|
||||||
|
|
||||||
tcBackButton->addControl(new Button("menu_back", RectF(0, 0, 2, 2), "arrow_left", SDL_SCANCODE_ESCAPE));
|
tcBackButton->addControl(new Button("menu_back", RectF(0, 0, 2, 2), "button_left", SDL_SCANCODE_ESCAPE));
|
||||||
tcBackButton->signal_button.connect(sigc::ptr_fun(&callbacks::menu_button));
|
tcBackButton->signal_button.connect(sigc::ptr_fun(&callbacks::menu_button));
|
||||||
|
|
||||||
// main controls
|
// main controls
|
||||||
|
|
||||||
tcGameMain->setAlpha(droidinput.gameControlsAlpha);
|
tcGameMain->addControl(new Button("use", RectF(20, 4, 23, 7), "button_use", gamefunc_Open));
|
||||||
|
tcGameMain->addControl(new Button("fire", RectF(20, 7, 23, 10), "button_fire", gamefunc_Fire));
|
||||||
|
tcGameMain->addControl(new Button("jump", RectF(23, 6, 26, 9), "button_jump", gamefunc_Jump));
|
||||||
|
tcGameMain->addControl(new Button("crouch", RectF(24, 12, 26, 14), "button_crouch", gamefunc_Crouch));
|
||||||
|
tcGameMain->addControl(new Button("kick", "Mighty Foot", RectF(23, 3, 26, 6), "button_kick", gamefunc_Quick_Kick, false, true));
|
||||||
|
|
||||||
tcGameMain->addControl(new Button("use", RectF(20, 4, 23, 7), "use", gamefunc_Open));
|
Button *map_button = new Button("map", "Overhead map", RectF(6, 0, 8, 2), "button_map", gamefunc_Map, false, true);
|
||||||
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));
|
|
||||||
|
|
||||||
Button *map_button = new Button("map", "Overhead map", RectF(6, 0, 8, 2), "map", gamefunc_Map, false, true);
|
|
||||||
tcGameMain->addControl(map_button);
|
tcGameMain->addControl(map_button);
|
||||||
|
|
||||||
Button *inv_button = new Button("show_inventory", "Inventory", RectF(24, 0, 26, 2), "inv", KEY_SHOW_INVEN);
|
Button *inv_button = new Button("show_inventory", "Inventory", RectF(24, 0, 26, 2), "button_activate", KEY_SHOW_INVEN);
|
||||||
tcGameMain->addControl(inv_button);
|
tcGameMain->addControl(inv_button);
|
||||||
tcGameMain->addControl(new Button("next_weapon", "Next weapon", RectF(0, 3, 3, 5), "next_weap", gamefunc_Next_Weapon, false, true));
|
tcGameMain->addControl(new Button("next_weapon", "Next weapon", RectF(0, 3, 3, 5), "button_up", gamefunc_Next_Weapon, false, true));
|
||||||
tcGameMain->addControl(new Button("prev_weapon", "Previous weapon", RectF(0, 5, 3, 7), "prev_weap", gamefunc_Previous_Weapon, false, true));
|
tcGameMain->addControl(new Button("prev_weapon", "Previous weapon", RectF(0, 5, 3, 7), "button_down", 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 Button("quick_save", "Save game", RectF(22, 0, 24, 2), "button_save", KEY_QUICK_SAVE, false, true));
|
||||||
tcGameMain->addControl(new Button("quick_load", "Load game", RectF(20, 0, 22, 2), "load", KEY_QUICK_LOAD, false, true));
|
tcGameMain->addControl(new Button("quick_load", "Load game", RectF(20, 0, 22, 2), "button_load", KEY_QUICK_LOAD, false, true));
|
||||||
|
|
||||||
tcGameMain->addControl(console_button);
|
tcGameMain->addControl(console_button);
|
||||||
|
|
||||||
// Left stick
|
// Left stick
|
||||||
touchJoyLeft = new TouchStick("stick", RectF(0, 7, 8, 16), "strafe_arrow");
|
touchJoyLeft = new TouchStick("stick", RectF(0, 8, 8, 16), "button_move");
|
||||||
tcGameMain->addControl(touchJoyLeft);
|
tcGameMain->addControl(touchJoyLeft);
|
||||||
touchJoyLeft->signal_move.connect(sigc::ptr_fun(&callbacks::move));
|
touchJoyLeft->signal_move.connect(sigc::ptr_fun(&callbacks::move));
|
||||||
touchJoyLeft->signal_double_tap.connect(sigc::ptr_fun(&callbacks::left_double_tap));
|
touchJoyLeft->signal_double_tap.connect(sigc::ptr_fun(&callbacks::left_double_tap));
|
||||||
|
@ -416,31 +405,29 @@ void AndroidTouchInit(int width, int height, const char *graphics_path)
|
||||||
tcAutomap->signal_button.connect(sigc::ptr_fun(&callbacks::in_game));
|
tcAutomap->signal_button.connect(sigc::ptr_fun(&callbacks::in_game));
|
||||||
tcAutomap->setAlpha(0.5);
|
tcAutomap->setAlpha(0.5);
|
||||||
|
|
||||||
|
// Weapons
|
||||||
// Now inventory in the weapons control group!
|
// Now inventory in the weapons control group!
|
||||||
|
|
||||||
inv_buttons[GET_JETPACK] = new Button("jetpack", RectF(0, 3, 2, 5), "jetpack", gamefunc_Jetpack, false, false, true);
|
weaponWheel = new WheelSelect("weapon_wheel", RectF(7, 2, 19, 14), "weapon_wheel_orange_blank", 10);
|
||||||
inv_buttons[GET_FIRSTAID] = new Button("medkit", RectF(0, 5, 2, 7), "medkit", gamefunc_MedKit, false, false, true);
|
weaponWheel->signal_selected.connect(sigc::ptr_fun(&callbacks::select_weapon));
|
||||||
inv_buttons[GET_HEATS] = new Button("nightv", RectF(0, 7, 2, 9), "nightvision", gamefunc_NightVision, false, false, true);
|
weaponWheel->signal_enabled.connect(sigc::ptr_fun(&callbacks::show_wheel));
|
||||||
inv_buttons[GET_HOLODUKE] = new Button("holoduke", RectF(0, 9, 2, 11), "holoduke", gamefunc_Holo_Duke, false, false, true);
|
tcGameWeapons->addControl(weaponWheel);
|
||||||
inv_buttons[GET_STEROIDS] = new Button("steroids", RectF(0, 11, 2, 13), "steroids", gamefunc_Steroids, false, false, true);
|
|
||||||
|
inv_buttons[GET_FIRSTAID] = new Button("medkit", RectF(0, 5, 2, 7), "button_inv1", gamefunc_MedKit, false, false, true);
|
||||||
|
inv_buttons[GET_STEROIDS] = new Button("steroids", RectF(0, 11, 2, 13), "button_inv2", gamefunc_Steroids, false, false, true);
|
||||||
|
inv_buttons[GET_HOLODUKE] = new Button("holoduke", RectF(0, 9, 2, 11), "button_inv3", gamefunc_Holo_Duke, false, false, true);
|
||||||
|
inv_buttons[GET_JETPACK] = new Button("jetpack", RectF(0, 3, 2, 5), "button_inv4", gamefunc_Jetpack, false, false, true);
|
||||||
|
inv_buttons[GET_HEATS] = new Button("nightv", RectF(0, 7, 2, 9), "button_inv5", gamefunc_NightVision, 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(&callbacks::inv_button));
|
tcGameWeapons->signal_button.connect(sigc::ptr_fun(&callbacks::inv_button));
|
||||||
|
|
||||||
// Weapons
|
|
||||||
weaponWheel = new WheelSelect("weapon_wheel", RectF(7, 2, 19, 14), "weapon_wheel_orange_blank", 10);
|
|
||||||
weaponWheel->signal_selected.connect(sigc::ptr_fun(&callbacks::select_weapon));
|
|
||||||
weaponWheel->signal_enabled.connect(sigc::ptr_fun(&callbacks::show_wheel));
|
|
||||||
tcGameWeapons->addControl(weaponWheel);
|
|
||||||
tcGameWeapons->setAlpha(0.9);
|
|
||||||
|
|
||||||
|
|
||||||
controlsContainer.addControlGroup(tcMenuMain);
|
controlsContainer.addControlGroup(tcMenuMain);
|
||||||
controlsContainer.addControlGroup(tcBackButton);
|
controlsContainer.addControlGroup(tcBackButton);
|
||||||
|
@ -451,7 +438,11 @@ void AndroidTouchInit(int width, int height, const char *graphics_path)
|
||||||
controlsContainer.addControlGroup(tcBlankTap);
|
controlsContainer.addControlGroup(tcBlankTap);
|
||||||
|
|
||||||
tcGameMain->setAlpha(droidinput.gameControlsAlpha);
|
tcGameMain->setAlpha(droidinput.gameControlsAlpha);
|
||||||
tcGameWeapons->setAlpha(droidinput.gameControlsAlpha);
|
tcGameWeapons->setAlpha(0.f);
|
||||||
|
tcGameWeapons->resetOutput();
|
||||||
|
tcGameWeapons->setAllButtonsEnabled(false);
|
||||||
|
weaponWheel->setTapMode(false);
|
||||||
|
weaponWheelVisible = false;
|
||||||
tcMenuMain->setAlpha(droidinput.gameControlsAlpha);
|
tcMenuMain->setAlpha(droidinput.gameControlsAlpha);
|
||||||
tcBackButton->setAlpha(droidinput.gameControlsAlpha);
|
tcBackButton->setAlpha(droidinput.gameControlsAlpha);
|
||||||
|
|
||||||
|
@ -539,12 +530,6 @@ void updateTouchScreenMode(touchscreemode_t mode)
|
||||||
lastMode = mode;
|
lastMode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
int inv = AndroidRead(R_PLAYER_INV_AMOUNT);
|
|
||||||
|
|
||||||
for (int i = 0; i < GET_MAX; ++i)
|
|
||||||
if (inv_buttons[i])
|
|
||||||
inv_buttons[i]->setAlpha(tcGameWeapons->getFadedAlpha() * ((inv & (1 << i)) ? 1.f : 0.3f));
|
|
||||||
|
|
||||||
backButtonEnabled = !tcBlankTap->enabled && mode != TOUCH_SCREEN_MENU_NOBACK;
|
backButtonEnabled = !tcBlankTap->enabled && mode != TOUCH_SCREEN_MENU_NOBACK;
|
||||||
tcBackButton->setEnabled(backButtonEnabled);
|
tcBackButton->setEnabled(backButtonEnabled);
|
||||||
}
|
}
|
||||||
|
@ -582,15 +567,23 @@ void AndroidDrawControls()
|
||||||
if (tcGameMain)
|
if (tcGameMain)
|
||||||
tcGameMain->setAlpha(droidinput.gameControlsAlpha);
|
tcGameMain->setAlpha(droidinput.gameControlsAlpha);
|
||||||
|
|
||||||
if (tcGameWeapons)
|
|
||||||
tcGameWeapons->setAlpha(droidinput.gameControlsAlpha);
|
|
||||||
|
|
||||||
if (tcMenuMain)
|
if (tcMenuMain)
|
||||||
tcMenuMain->setAlpha(droidinput.gameControlsAlpha);
|
tcMenuMain->setAlpha(droidinput.gameControlsAlpha);
|
||||||
|
|
||||||
if (tcBackButton)
|
if (tcBackButton)
|
||||||
tcBackButton->setAlpha(droidinput.gameControlsAlpha);
|
tcBackButton->setAlpha(droidinput.gameControlsAlpha);
|
||||||
|
|
||||||
|
int inv = AndroidRead(R_PLAYER_INV_AMOUNT);
|
||||||
|
|
||||||
|
if (tcGameWeapons)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < GET_MAX; ++i)
|
||||||
|
if (inv_buttons[i])
|
||||||
|
inv_buttons[i]->setAlpha(tcGameWeapons->getFadedAlpha() * ((inv & (1 << i)) ? 1.f : 0.3f));
|
||||||
|
|
||||||
|
tcGameWeapons->setAlpha(droidinput.gameControlsAlpha);
|
||||||
|
}
|
||||||
|
|
||||||
controlsContainer.draw();
|
controlsContainer.draw();
|
||||||
|
|
||||||
if (controlsContainer.editingControls)
|
if (controlsContainer.editingControls)
|
||||||
|
@ -600,20 +593,16 @@ void AndroidDrawControls()
|
||||||
|
|
||||||
#define EXPORT_ME __NDK_FPABI__ __attribute__((visibility("default")))
|
#define EXPORT_ME __NDK_FPABI__ __attribute__((visibility("default")))
|
||||||
|
|
||||||
JNIEnv *env_;
|
|
||||||
|
|
||||||
int argc = 1;
|
int argc = 1;
|
||||||
const char *argv[32];
|
const char *argv[32];
|
||||||
|
|
||||||
static inline const char *getGamePath() { return gamePath.c_str(); }
|
static inline const char *getGamePath() { return gamePath.c_str(); }
|
||||||
|
|
||||||
jint EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_init(JNIEnv *env, jobject thiz, jstring graphics_dir,
|
jint EXPORT_ME Java_com_voidpoint_duke3d_NativeLib_i(JNIEnv *env, jobject thiz, jstring graphics_dir,
|
||||||
jint audio_rate, jint audio_buffer_size,
|
jint audio_rate, jint audio_buffer_size,
|
||||||
jobjectArray argsArray,
|
jobjectArray argsArray,
|
||||||
jstring jduke3d_path)
|
jstring jduke3d_path)
|
||||||
{
|
{
|
||||||
env_ = env;
|
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
|
@ -642,7 +631,7 @@ 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)
|
||||||
AndroidTouchInit(droidinfo.screen_width, droidinfo.screen_height, (obbPath + "/assets/").c_str());
|
AndroidTouchInit(droidinfo.screen_width, droidinfo.screen_height, "/assets/");
|
||||||
else LOGI("skipping touch input");
|
else LOGI("skipping touch input");
|
||||||
|
|
||||||
main(argc, (char **)argv);
|
main(argc, (char **)argv);
|
||||||
|
@ -653,14 +642,13 @@ jint EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_init(JNIEnv *env, jobj
|
||||||
__attribute__((visibility("default"))) jint JNI_OnLoad(JavaVM *vm, void *reserved)
|
__attribute__((visibility("default"))) jint JNI_OnLoad(JavaVM *vm, void *reserved)
|
||||||
{
|
{
|
||||||
LOGI("JNI_OnLoad");
|
LOGI("JNI_OnLoad");
|
||||||
setTCJNIEnv(vm);
|
JNI_SetEnv(vm);
|
||||||
jvm_ = vm;
|
|
||||||
return JNI_VERSION_1_4;
|
return JNI_VERSION_1_4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EXPORT_ME
|
void EXPORT_ME
|
||||||
Java_com_voidpoint_duke3d_engine_NativeLib_keyPress(JNIEnv *env, jobject obj, jint down, jint keycode, jint unicode)
|
Java_com_voidpoint_duke3d_NativeLib_kp(JNIEnv *env, jobject obj, jint down, jint keycode, jint unicode)
|
||||||
{
|
{
|
||||||
LOGI("keypress %d", keycode);
|
LOGI("keypress %d", keycode);
|
||||||
if (controlsContainer.isEditing())
|
if (controlsContainer.isEditing())
|
||||||
|
@ -674,7 +662,7 @@ Java_com_voidpoint_duke3d_engine_NativeLib_keyPress(JNIEnv *env, jobject obj, ji
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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_NativeLib_te(JNIEnv *env, jobject obj, jint action, jint pid,
|
||||||
jfloat x, jfloat y)
|
jfloat x, jfloat y)
|
||||||
{
|
{
|
||||||
if (tcBackButton && backButtonEnabled)
|
if (tcBackButton && backButtonEnabled)
|
||||||
|
@ -686,7 +674,7 @@ void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_touchEvent(JNIEnv *env
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_doAction(JNIEnv *env, jobject obj, jint state, jint action)
|
void EXPORT_ME Java_com_voidpoint_duke3d_NativeLib_da(JNIEnv *env, jobject obj, jint state, jint action)
|
||||||
{
|
{
|
||||||
LOGI("doAction %d %d", state, action);
|
LOGI("doAction %d %d", state, action);
|
||||||
|
|
||||||
|
@ -703,18 +691,18 @@ void EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_doAction(JNIEnv *env,
|
||||||
AndroidAction(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_NativeLib_am(JNIEnv *env, jobject obj, jfloat fwd, jfloat strafe)
|
||||||
{
|
{
|
||||||
AndroidMove(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_NativeLib_al(JNIEnv *env, jobject obj, jfloat pitch, jfloat yaw)
|
||||||
{
|
{
|
||||||
AndroidLookJoystick(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_NativeLib_sts(JNIEnv *env, jobject obj, int other)
|
||||||
{
|
{
|
||||||
// TODO: defined names for these values
|
// TODO: defined names for these values
|
||||||
hasTouch = other & 0x4000 ? true : false;
|
hasTouch = other & 0x4000 ? true : false;
|
||||||
|
@ -730,14 +718,14 @@ Java_com_voidpoint_duke3d_engine_NativeLib_setTouchSettings(JNIEnv *env, jobject
|
||||||
LOGI("setTouchSettings left_double_action = %d", droidinput.left_double_action);
|
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_NativeLib_rts(JNIEnv *env, jobject obj)
|
||||||
{
|
{
|
||||||
controlsContainer.resetDefaults();
|
controlsContainer.resetDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string quickCommandString;
|
std::string quickCommandString;
|
||||||
|
|
||||||
jint EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_quickCommand(JNIEnv *env, jobject obj, jstring command)
|
jint EXPORT_ME Java_com_voidpoint_duke3d_NativeLib_qc(JNIEnv *env, jobject obj, jstring command)
|
||||||
{
|
{
|
||||||
const char *p = env->GetStringUTFChars(command, NULL);
|
const char *p = env->GetStringUTFChars(command, NULL);
|
||||||
quickCommandString = std::string(p) + "\n";
|
quickCommandString = std::string(p) + "\n";
|
||||||
|
@ -746,7 +734,7 @@ jint EXPORT_ME Java_com_voidpoint_duke3d_engine_NativeLib_quickCommand(JNIEnv *e
|
||||||
}
|
}
|
||||||
|
|
||||||
void EXPORT_ME
|
void EXPORT_ME
|
||||||
Java_com_voidpoint_duke3d_engine_NativeLib_setScreenSize(JNIEnv *env, jobject thiz, jint width, jint height)
|
Java_com_voidpoint_duke3d_NativeLib_sss(JNIEnv *env, jobject thiz, jint width, jint height)
|
||||||
{
|
{
|
||||||
droidinfo.screen_width = width;
|
droidinfo.screen_width = width;
|
||||||
droidinfo.screen_height = height;
|
droidinfo.screen_height = height;
|
||||||
|
|
|
@ -31,14 +31,11 @@ extern "C"
|
||||||
|
|
||||||
// where do these numbers come from?
|
// where do these numbers come from?
|
||||||
#define ANDROIDMOVEFACTOR 6400
|
#define ANDROIDMOVEFACTOR 6400
|
||||||
#define ANDROIDLOOKFACTOR 160000
|
#define ANDROIDLOOKFACTOR 1600
|
||||||
|
|
||||||
#define ANDROIDPITCHFACTORJOYSTICK 2000
|
#define ANDROIDPITCHFACTORJOYSTICK 2000
|
||||||
#define ANDROIDYAWFACTORJOYSTICK 4000
|
#define ANDROIDYAWFACTORJOYSTICK 4000
|
||||||
|
|
||||||
|
|
||||||
#define MINCONTROLALPHA 0.25f
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
R_TOUCH_MODE,
|
R_TOUCH_MODE,
|
||||||
R_PLAYER_GOTWEAPON,
|
R_PLAYER_GOTWEAPON,
|
||||||
|
|
|
@ -544,6 +544,7 @@ static void G_LoadAddon(void)
|
||||||
g_selectedGrp = grp;
|
g_selectedGrp = grp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef EDUKE32_TOUCH_DEVICES
|
||||||
#if defined EDUKE32_OSX || defined __linux__ || defined EDUKE32_BSD
|
#if defined EDUKE32_OSX || defined __linux__ || defined EDUKE32_BSD
|
||||||
static void G_AddSteamPaths(const char *basepath)
|
static void G_AddSteamPaths(const char *basepath)
|
||||||
{
|
{
|
||||||
|
@ -745,9 +746,11 @@ static void G_ParseSteamKeyValuesForPaths(const char *vdf)
|
||||||
Bfree(vdfbufstart);
|
Bfree(vdfbufstart);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
void G_AddSearchPaths(void)
|
void G_AddSearchPaths(void)
|
||||||
{
|
{
|
||||||
|
#ifndef EDUKE32_TOUCH_DEVICES
|
||||||
#if defined __linux__ || defined EDUKE32_BSD
|
#if defined __linux__ || defined EDUKE32_BSD
|
||||||
char buf[BMAX_PATH];
|
char buf[BMAX_PATH];
|
||||||
char *homepath = Bgethomedir();
|
char *homepath = Bgethomedir();
|
||||||
|
@ -879,6 +882,7 @@ void G_AddSearchPaths(void)
|
||||||
addsearchpath_user(buf, SEARCHPATH_WW2GI);
|
addsearchpath_user(buf, SEARCHPATH_WW2GI);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_CleanupSearchPaths(void)
|
void G_CleanupSearchPaths(void)
|
||||||
|
|
|
@ -286,7 +286,7 @@ MAKE_MENU_TOP_ENTRYLINK( "Options", MEF_MainMenu, MAIN_OPTIONS, MENU_OPTIONS );
|
||||||
MAKE_MENU_TOP_ENTRYLINK( "Help", MEF_MainMenu, MAIN_HELP, MENU_STORY );
|
MAKE_MENU_TOP_ENTRYLINK( "Help", MEF_MainMenu, MAIN_HELP, MENU_STORY );
|
||||||
#endif
|
#endif
|
||||||
MAKE_MENU_TOP_ENTRYLINK( "Credits", MEF_MainMenu, MAIN_CREDITS, MENU_CREDITS );
|
MAKE_MENU_TOP_ENTRYLINK( "Credits", MEF_MainMenu, MAIN_CREDITS, MENU_CREDITS );
|
||||||
MAKE_MENU_TOP_ENTRYLINK( "Quit To Title", MEF_MainMenu, MAIN_QUITTOTITLE, MENU_QUITTOTITLE );
|
MAKE_MENU_TOP_ENTRYLINK( "Return To Title", MEF_MainMenu, MAIN_QUITTOTITLE, MENU_QUITTOTITLE );
|
||||||
MAKE_MENU_TOP_ENTRYLINK( "Quit", MEF_MainMenu, MAIN_QUIT, MENU_QUIT );
|
MAKE_MENU_TOP_ENTRYLINK( "Quit", MEF_MainMenu, MAIN_QUIT, MENU_QUIT );
|
||||||
#ifndef DROIDMENU
|
#ifndef DROIDMENU
|
||||||
MAKE_MENU_TOP_ENTRYLINK( "Quit Game", MEF_MainMenu, MAIN_QUITGAME, MENU_QUIT );
|
MAKE_MENU_TOP_ENTRYLINK( "Quit Game", MEF_MainMenu, MAIN_QUITGAME, MENU_QUIT );
|
||||||
|
@ -813,9 +813,6 @@ static MenuEntry_t *MEL_TOUCHSENS [] ={
|
||||||
&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 );
|
||||||
|
@ -1236,7 +1233,7 @@ static MenuMenu_t M_MOUSESETUP = MAKE_MENUMENU( "Mouse Setup", &MMF_BigOptions,
|
||||||
#ifdef DROIDMENU
|
#ifdef DROIDMENU
|
||||||
static MenuMenu_t M_TOUCHSETUP = MAKE_MENUMENU( "Touch Setup", &MMF_Top_Options, 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_TOUCHSENS = MAKE_MENUMENU( "Sensitivity", &MMF_BigOptions, MEL_TOUCHSENS);
|
||||||
static MenuMenu_t M_TOUCHBUTTONS = MAKE_MENUMENU("Button Setup", &MMF_BigOptions, MEL_TOUCHBUTTONS);
|
static MenuPanel_t M_TOUCHBUTTONS ={ "Button Setup", MENU_TOUCHSETUP, MA_Return, MENU_TOUCHSETUP, MA_Advance, };
|
||||||
#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 );
|
||||||
|
@ -1329,7 +1326,7 @@ static Menu_t Menus[] = {
|
||||||
#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_TOUCHSENS, MENU_TOUCHSENS, MENU_TOUCHSETUP, MA_Return, Menu },
|
||||||
{ &M_TOUCHBUTTONS, MENU_TOUCHBUTTONS, MENU_TOUCHSETUP, MA_Return, Menu },
|
{ &M_TOUCHBUTTONS, MENU_TOUCHBUTTONS, MENU_TOUCHSETUP, MA_Return, Panel },
|
||||||
#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
|
||||||
|
@ -2147,7 +2144,7 @@ static void M_PreMenuDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
|
||||||
|
|
||||||
case MENU_QUITTOTITLE:
|
case MENU_QUITTOTITLE:
|
||||||
fade_screen_black(1);
|
fade_screen_black(1);
|
||||||
mgametextcenter(origin.x, origin.y + (90<<16), "Quit to Title?");
|
mgametextcenter(origin.x, origin.y + (90<<16), "End game and return to title screen?");
|
||||||
#ifndef DROIDMENU
|
#ifndef DROIDMENU
|
||||||
mgametextcenter(origin.x, origin.y + (99<<16), "(Y/N)");
|
mgametextcenter(origin.x, origin.y + (99<<16), "(Y/N)");
|
||||||
#endif
|
#endif
|
||||||
|
@ -2360,7 +2357,6 @@ static void M_PreMenuDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
|
||||||
};
|
};
|
||||||
const char *body[] =
|
const char *body[] =
|
||||||
{
|
{
|
||||||
"Alan Ondra", // testing
|
|
||||||
"Bioman", // GTK work, APT repository and package upkeep
|
"Bioman", // GTK work, APT repository and package upkeep
|
||||||
"Brandon Bergren", // "Bdragon" - tiles.cfg
|
"Brandon Bergren", // "Bdragon" - tiles.cfg
|
||||||
"Charlie Honig", // "CONAN" - showview command
|
"Charlie Honig", // "CONAN" - showview command
|
||||||
|
@ -2368,7 +2364,6 @@ static void M_PreMenuDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
|
||||||
"David Koenig", // "Bargle" - Merged a couple of things from duke3d_w32
|
"David Koenig", // "Bargle" - Merged a couple of things from duke3d_w32
|
||||||
"Ed Coolidge", // Mapster32 improvements
|
"Ed Coolidge", // Mapster32 improvements
|
||||||
"Emile Belanger", // original Android work
|
"Emile Belanger", // original Android work
|
||||||
"Ferry Landzaat", // ? (listed on the wiki page)
|
|
||||||
"Hunter_rus", // tons of stuff
|
"Hunter_rus", // tons of stuff
|
||||||
"James Bentler", // Mapster32 improvements
|
"James Bentler", // Mapster32 improvements
|
||||||
"Jasper Foreman", // netcode contributions
|
"Jasper Foreman", // netcode contributions
|
||||||
|
@ -2384,11 +2379,9 @@ static void M_PreMenuDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
|
||||||
"Ozkan Sezer", // SDL/GTK version checking improvements
|
"Ozkan Sezer", // SDL/GTK version checking improvements
|
||||||
"Peter Green", // "Plugwash" - dynamic remapping, custom gametypes
|
"Peter Green", // "Plugwash" - dynamic remapping, custom gametypes
|
||||||
"Peter Veenstra", // "Qbix" - port to 64-bit
|
"Peter Veenstra", // "Qbix" - port to 64-bit
|
||||||
"Randy Heit", // random snippets of ZDoom here and there
|
|
||||||
"Robin Green", // CON array support
|
"Robin Green", // CON array support
|
||||||
"Ryan Gordon", // "icculus" - icculus.org Duke3D port sound code
|
"Ryan Gordon", // "icculus" - icculus.org Duke3D port sound code
|
||||||
"Stephen Anthony", // early 64-bit porting work
|
"Stephen Anthony", // early 64-bit porting work
|
||||||
"Thijs Leenders", // Android icon work
|
|
||||||
"tueidj", // Wii port
|
"tueidj", // Wii port
|
||||||
" ",
|
" ",
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
/*
|
/*
|
||||||
Copyright (C) 2010 EDuke32 developers and contributors
|
Copyright (C) 2016 EDuke32 developers and contributors
|
||||||
|
|
||||||
This file is part of EDuke32.
|
This file is part of EDuke32.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue