Skip to content

Commit

Permalink
Prey2006 some fixes
Browse files Browse the repository at this point in the history
1.1.0harmattan22
  • Loading branch information
glKarin committed Jan 10, 2023
1 parent 214c12e commit 93f1768
Show file tree
Hide file tree
Showing 31 changed files with 761 additions and 118 deletions.
42 changes: 30 additions & 12 deletions DIII4A/Q3E/src/main/java/com/n0n3m4/q3e/Q3EMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,11 @@ public class Q3EMain extends Activity {
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE
| View.SYSTEM_UI_FLAG_FULLSCREEN;
@SuppressLint("InlinedApi")
private final int m_uiOptions_def = View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
public static Q3EControlView mControlGLSurfaceView;
private MemInfoTextView memoryUsageText;

Expand Down Expand Up @@ -94,21 +97,30 @@ public void onCreate(Bundle savedInstanceState) {
WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
requestWindowFeature(Window.FEATURE_NO_TITLE);

if (Build.VERSION.SDK_INT>=9)
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);


SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && preferences.getBoolean("harm_cover_edges", true))
{
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
getWindow().setAttributes(lp);
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) // 9
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);

m_hideNav = preferences.getBoolean("harm_hide_nav", true);
m_renderMemStatus = preferences.getInt("harm_render_mem_status", 0);
m_runBackground = Integer.parseInt(preferences.getString("harm_run_background", "1"));
//k
if(m_hideNav)
SetupUIFlags();
/* if(m_hideNav)
{
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
final View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(m_uiOptions);// This code will always hide the navigation bar
/* decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener(){
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener(){
@Override
public void onSystemUiVisibilityChange(int visibility)
{
Expand All @@ -117,9 +129,9 @@ public void onSystemUiVisibilityChange(int visibility)
decorView.setSystemUiVisibility(m_uiOptions);
}
}
});*/
});
}
}
}*/
Q3EUtils.q3ei.VOLUME_UP_KEY_CODE = preferences.getInt("harm_volume_up_key", Q3EKeyCodes.KeyCodes.K_F3);
Q3EUtils.q3ei.VOLUME_DOWN_KEY_CODE = preferences.getInt("harm_volume_down_key", Q3EKeyCodes.KeyCodes.K_F2);
Q3EUtils.q3ei.SetupEngineLib(); //k setup engine library here again
Expand Down Expand Up @@ -250,10 +262,16 @@ protected void onResume() {
public void onWindowFocusChanged(boolean hasFocus)
{
super.onWindowFocusChanged(hasFocus);
SetupUIFlags();
}

private void SetupUIFlags()
{
final View decorView = getWindow().getDecorView();
if(m_hideNav)
{
getWindow().getDecorView().setSystemUiVisibility(m_uiOptions);
}
decorView.setSystemUiVisibility(m_uiOptions);
else
decorView.setSystemUiVisibility(m_uiOptions_def);
}

private class MemInfoTextView extends TextView
Expand Down
42 changes: 28 additions & 14 deletions DIII4A/Q3E/src/main/java/com/n0n3m4/q3e/Q3EUiConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package com.n0n3m4.q3e;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Build;
Expand All @@ -35,30 +36,37 @@ public class Q3EUiConfig extends Activity {
Q3EUiView vw;
//k
private boolean m_hideNav = true;
private int m_uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
@SuppressLint("InlinedApi")
private final int m_uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_IMMERSIVE
| View.SYSTEM_UI_FLAG_FULLSCREEN;
@SuppressLint("InlinedApi")
private final int m_uiOptions_def = View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE;

@Override
protected void onCreate(Bundle savedInstanceState) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
requestWindowFeature(Window.FEATURE_NO_TITLE);
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.P && preferences.getBoolean("harm_cover_edges", true))
{
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
getWindow().setAttributes(lp);
}

if (Build.VERSION.SDK_INT>=9)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) // 9
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);

//k
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
//k
m_hideNav = preferences.getBoolean("harm_hide_nav", true);
if(m_hideNav)
{
final View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(m_uiOptions);
}
SetupUIFlags();

super.onCreate(savedInstanceState);
vw=new Q3EUiView(this);
Expand All @@ -82,9 +90,15 @@ public void onBackPressed() {
public void onWindowFocusChanged(boolean hasFocus)
{
super.onWindowFocusChanged(hasFocus);
if(m_hideNav)
{
getWindow().getDecorView().setSystemUiVisibility(m_uiOptions);
}
SetupUIFlags();
}

private void SetupUIFlags()
{
final View decorView = getWindow().getDecorView();
if(m_hideNav)
decorView.setSystemUiVisibility(m_uiOptions);
else
decorView.setSystemUiVisibility(m_uiOptions_def);
}
}
4 changes: 2 additions & 2 deletions DIII4A/idTech4Amm/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ android {
applicationId "com.karin.idTech4Amm"
minSdkVersion 14
targetSdkVersion 28
versionCode 11021
versionName '1.1.0harmattan21'
versionCode 11022
versionName '1.1.0harmattan22'
versionNameSuffix 'natasha'
}

Expand Down
6 changes: 3 additions & 3 deletions DIII4A/idTech4Amm/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.karin.idTech4Amm"
android:versionCode="11021"
android:versionName="1.1.0harmattan21"
android:versionCode="11022"
android:versionName="1.1.0harmattan22"
android:installLocation="preferExternal"
>

Expand All @@ -23,7 +23,7 @@
tools:ignore="ScopedStorage" />
android:requestLegacyExternalStorage="true"
-->

<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
Expand Down
Binary file modified DIII4A/idTech4Amm/src/main/assets/source/DIII4A.source.tgz
Binary file not shown.
Binary file modified DIII4A/idTech4Amm/src/main/assets/source/doom3_droid.source.tgz
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.karin.idTech4Amm.lib;

import android.Manifest;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.graphics.Point;
import android.os.Environment;
import android.provider.Settings;
import android.content.Intent;
Expand All @@ -14,6 +17,9 @@
import android.os.Build;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.view.Display;
import android.view.DisplayCutout;
import android.view.WindowInsets;
import android.widget.TextView;
import android.text.util.Linkify;
import android.text.method.LinkMovementMethod;
Expand Down Expand Up @@ -217,8 +223,8 @@ public static String NativeLibDir(Context context)
public static int CheckFilePermission(Activity context, int resultCode)
{
String permission = Manifest.permission.WRITE_EXTERNAL_STORAGE;
/* Android SDK > 28
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) // Android 11
// Android SDK > 28
/* if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) // Android 11
{
if(Environment.isExternalStorageManager())
return CHECK_PERMISSION_RESULT_GRANTED;
Expand All @@ -227,8 +233,7 @@ public static int CheckFilePermission(Activity context, int resultCode)
context.startActivityForResult(intent, resultCode);
return CHECK_PERMISSION_RESULT_REQUEST;
}
else */
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) // Android M - Q
else*/ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) // Android M - Q
{
boolean granted = context.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED;
if(granted)
Expand Down Expand Up @@ -278,6 +283,73 @@ public static void OpenUrlExternally(Context context, String url)
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
context.startActivity(intent);
}

public static int[] GetNormalScreenSize(Activity activity)
{
Display display = activity.getWindowManager().getDefaultDisplay();
Point size = new Point();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
{
display.getSize(size);
return new int[]{ size.x, size.y };
}
else
{
return new int[]{ display.getWidth(), display.getHeight() };
}
}

public static int[] GetFullScreenSize(Activity activity)
{
Display display = activity.getWindowManager().getDefaultDisplay();
Point size = new Point();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
{
display.getRealSize(size);
return new int[]{ size.x, size.y };
}
else
{
return new int[]{ display.getWidth(), display.getHeight() };
}
}

public static int GetEdgeHeight(Activity activity)
{
int safeInsetTop = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P)
{
WindowInsets rootWindowInsets = activity.getWindow().getDecorView().getRootWindowInsets();
if(null != rootWindowInsets)
{
DisplayCutout displayCutout = rootWindowInsets.getDisplayCutout();
if(null != displayCutout) {
safeInsetTop = displayCutout.getSafeInsetTop();
}
}
}
return safeInsetTop;
}

public static int GetNavigationBarHeight(Activity activity)
{
int[] fullSize = GetFullScreenSize(activity);
int[] size = GetNormalScreenSize(activity);
return fullSize[1] - size[1] - GetEdgeHeight(activity);
}

public static int GetStatusBarHeight(Activity activity)
{
int result = 0;

Resources resources = activity.getResources();
int resourceId = resources.getIdentifier("status_bar_height","dimen", "android");

if (resourceId > 0)
result = resources.getDimensionPixelSize(resourceId);

return result;
}

private ContextUtility() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public static CharSequence GetHelpText()
"For playing Prey(2006)(Thanks for `" + GenLinkText("https://github.com/jmarshall23", "jmarshall") + "`'s `" + GenLinkText("https://github.com/jmarshall23/PreyDoom", "PreyDoom") + "`): ",
" 1. Putting PC Prey game data file to `preybase` folder and START directly.",
" *. Some problems solution: e.g. using cvar `harm_g_translateAlienFont` to translate Alien text on GUI.",
" *. Exists bugs: e.g. some incorrect collision(using `noclip`), incorrect render(portals, skybox), some menu draw, some GUIs not work(Music CD in RoadHouse).",
" *. Exists bugs: e.g. some incorrect collision(using `noclip`), incorrect render(portals, skybox), some menu draw(Tab window), some GUIs not work(Music CD in RoadHouse).",
null,
"For playing Quake 4(Thanks for `" + GenLinkText("https://github.com/jmarshall23", "jmarshall") + "`'s `" + GenLinkText("https://github.com/jmarshall23/Quake4Doom", "Quake4Doom") + "`): ",
" 1. Putting PC Quake 4 game data file to `q4base` folder.",
Expand Down Expand Up @@ -250,7 +250,7 @@ public static CharSequence GetAboutText(Context context)
final String[] ABOUTS = {
Constants.CONST_APP_NAME + "(" + Constants.CONST_CODE + ")",
Constants.CONST_NAME,
"Changes by " + GenLinkText("https://forum.xda-developers.com/member.php?u=10584229", Constants.CONST_DEV)
"Changes by " + GenLinkText(Constants.CONST_DEVELOPER, Constants.CONST_DEV)
+ "&lt;" + GenLinkText("mailto:" + Constants.CONST_EMAIL, Constants.CONST_EMAIL) + "&gt;",
"Update: " + ContextUtility.GetAppVersion(context) + ("(API " + Build.VERSION.SDK_INT + ")") + (ContextUtility.BuildIsDebug(context) ? "(debug)" : ""),
"Release: " + Constants.CONST_RELEASE + " (R" + Constants.CONST_UPDATE_RELEASE + ")",
Expand Down Expand Up @@ -279,6 +279,11 @@ public static CharSequence GetChangesText()
final ChangeLog[] CHANGES = {
ChangeLog.Create(Constants.CONST_RELEASE, Constants.CONST_UPDATE_RELEASE, Constants.CONST_CHANGES),

ChangeLog.Create("2022-12-10", 21,
"Prey(2006) for DOOM3 support, game data folder named `preybase`. All levels clear, but have some bugs.",
"Add setup On-screen buttons position unit when config controls layout."
),

ChangeLog.Create("2022-11-18", 20,
"Add default font for somewhere missing text in Quake 4, using cvar `harm_gui_defaultFont` to control, default is `chain`.",
"Implement show surface/hide surface for fixup entity render incorrect in Quake 4, e.g. AI's weapons, weapons in player view and Makron in boss level."
Expand Down Expand Up @@ -314,16 +319,16 @@ public static CharSequence GetChangesText()

ChangeLog.Create("2022-10-15", 15,
"Add gyroscope control support.",
"Add reset onscreen buttton layout with fullscreen.",
"Add reset onscreen button layout with fullscreen.",
"If running Quake 4 crash on arm32 device, trying to check `Use ETC1 compression` or `Disable lighting` for decreasing memory usage.",
"Fixup some Quake 4 bugs: ",
" Fixup start new game in main menu, now start new game is work.",
" Fixup loading zombie material in level `game/waste`.",
" Fixup AI `Singer` can not move when opening the door in level `game/building_b`.",
" Fixup jump down on broken floor in level `game/putra`.",
" Fixup player model choice and view in `Settings` menu in Multiplayer game.",
" Add bool cvar `harm_g_flashlightOn` for controling gun-lighting is open/close initial, default is 1(open).",
" Add bool cvar `harm_g_vehicleWalkerMoveNormalize` for re-normalize `vehicle walker` movment if enable `Smooth joystick` in launcher, default is 1(re-normalize), it can fix up move left-right."
" Add bool cvar `harm_g_flashlightOn` for controlling gun-lighting is open/close initial, default is 1(open).",
" Add bool cvar `harm_g_vehicleWalkerMoveNormalize` for re-normalize `vehicle walker` movement if enable `Smooth joystick` in launcher, default is 1(re-normalize), it can fix up move left-right."
),

ChangeLog.Create("2022-10-29", 13,
Expand Down Expand Up @@ -385,8 +390,8 @@ public static CharSequence GetChangesText()
"Fix sky box.",
"Fix fog and blend light.",
"Fix glass reflection.",
"Add texgen shader for like `D3XP` hell level sky.",
"Fix translucent object. i.e. window glass, transclucent Demon in `Classic DOOM` mod.",
"Add `texgen` shader for like `D3XP` hell level sky.",
"Fix translucent object. i.e. window glass, translucent Demon in `Classic DOOM` mod.",
"Fix dynamic texture interaction. i.e. rotating fans.",
"Fix `Berserk`, `Grabber`, `Helltime` vision effect(First set cvar `harm_g_skipBerserkVision`, `harm_g_skipWarpVision` and `harm_g_skipHelltimeVision` to 0).",
"Fix screen capture image when quick save game or mission tips.",
Expand Down Expand Up @@ -602,8 +607,8 @@ public static CharSequence GetCvarText()
final Cvar[] QUAKE4_CVARS = {
Cvar.Create("harm_g_alwaysRun", "bool", "1", "Force to always run automatic."),
Cvar.Create("harm_g_autoGenAASFileInMPGame", "bool", "1", "For bot in Multiplayer-Game, if AAS file load fail and not exists, server can generate AAS file for Multiplayer-Game map automatic."),
Cvar.Create("harm_g_flashlightOn", "bool", "1", "Automitic make flash light on initial."),
Cvar.Create("harm_g_vehicleWalkerMoveNormalize", "bool", "1", "Re-normalize vehicle walker movment."),
Cvar.Create("harm_g_flashlightOn", "bool", "1", "Automatic make flash light on initial."),
Cvar.Create("harm_g_vehicleWalkerMoveNormalize", "bool", "1", "Re-normalize vehicle walker movement."),
Cvar.Create("harm_gui_defaultFont", "string", "chain", "Default font name.",
"chain", "fonts/chain",
"lowpixel", "fonts/lowpixel",
Expand All @@ -614,7 +619,7 @@ public static CharSequence GetCvarText()
),
};
final Cvar[] PREY_CVARS = {
Cvar.Create("harm_g_translateAlienFont", "string", "fonts", "Setup font name for automitic translate `alien` font text of GUI(empty to disable).",
Cvar.Create("harm_g_translateAlienFont", "string", "fonts", "Setup font name for automatic translate `alien` font text of GUI(empty to disable).",
"fonts", "fonts",
"fonts/menu", "fonts/menu",
"\"\"", "Disable"
Expand Down
Loading

0 comments on commit 93f1768

Please sign in to comment.