mirror of https://github.com/DrBeef/JKXR.git
Many many changes
- Added in a cheat menu (https://jkhub.org/files/file/3828-beta-ingame-customization-and-cheat-menu/) - Added and building source for JK2 - FIxed jittery head tracking - Started on motion controlled weapons (no sabers yet) - made cutscenes immersive (can be turned off) - Started on a visible HUD
This commit is contained in:
parent
18f17c2bab
commit
adfc6da46d
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.drbeef.jk2quest"
|
||||
android:versionCode="49"
|
||||
android:versionName="1.3.0" android:installLocation="auto" >
|
||||
android:versionCode="2"
|
||||
android:versionName="0.0.2" android:installLocation="auto" >
|
||||
|
||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>
|
||||
|
@ -39,7 +39,7 @@
|
|||
android:excludeFromRecents="false"
|
||||
android:configChanges="screenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode">
|
||||
<!-- Tell NativeActivity the name of the .so -->
|
||||
<meta-data android:name="android.app.lib_name" android:value="jk2quest" />
|
||||
<!-- <meta-data android:name="android.app.lib_name" android:value="jkquest" /> -->
|
||||
<!-- This filter lets the apk show up as a launchable icon. -->
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
|
|
@ -15,11 +15,12 @@ SUPPORT_LIBS := $(TOP_DIR)/SupportLibs
|
|||
GL4ES_PATH := $(SUPPORT_LIBS)/gl4es
|
||||
OPENJK_PATH := $(TOP_DIR)/OpenJK
|
||||
SHARED_PATH := $(OPENJK_PATH)/shared
|
||||
SPDir := $(OPENJK_PATH)/code
|
||||
JK3_CODE_PATH := $(OPENJK_PATH)/code
|
||||
JK2_CODE_PATH := $(OPENJK_PATH)/codeJK2
|
||||
|
||||
APP_ALLOW_MISSING_DEPS=true
|
||||
|
||||
APP_MODULES := gl4es rd-gles_arm jagamearm openjk_sp
|
||||
APP_MODULES := gl4es rd-gles_arm jogamearm openjk_jo jagamearm openjk_ja
|
||||
APP_STL := c++_shared
|
||||
|
||||
|
||||
|
|
|
@ -138,13 +138,14 @@ LAMBDA1VR Stuff
|
|||
|
||||
bool JKVR_useScreenLayer()
|
||||
{
|
||||
vr.screen = (bool)(showingScreenLayer ||
|
||||
vr.using_screen_layer = (bool)((vr.in_camera && !vr.immersive_cinematics) ||
|
||||
(CL_IsRunningInGameCinematic() || CL_InGameCinematicOnStandBy()) ||
|
||||
(cls.state == CA_CINEMATIC) ||
|
||||
(cls.state == CA_LOADING) ||
|
||||
( Key_GetCatcher( ) & KEYCATCH_UI ) ||
|
||||
( Key_GetCatcher( ) & KEYCATCH_CONSOLE ));
|
||||
|
||||
return vr.screen;
|
||||
return vr.using_screen_layer;
|
||||
}
|
||||
|
||||
int runStatus = -1;
|
||||
|
@ -822,9 +823,6 @@ void setHMDPosition( float x, float y, float z )
|
|||
|
||||
//Record player height on transition
|
||||
playerHeight = y;
|
||||
|
||||
//Resync yaw on transition
|
||||
JKVR_ResyncClientYawWithGameYaw();
|
||||
}
|
||||
|
||||
if (!JKVR_useScreenLayer())
|
||||
|
@ -869,7 +867,7 @@ void JKVR_GetMove(float *forward, float *side, float *pos_forward, float *pos_si
|
|||
*up = remote_movementUp;
|
||||
*side = remote_movementSideways;
|
||||
*pos_side = positional_movementSideways;
|
||||
*yaw = vr.hmdorientation[YAW] + snapTurn;
|
||||
*yaw = vr.hmdorientation[YAW] + vr.snapTurn;
|
||||
*pitch = vr.hmdorientation[PITCH];
|
||||
*roll = vr.hmdorientation[ROLL];
|
||||
}
|
||||
|
@ -1256,27 +1254,18 @@ extern "C" {
|
|||
void initialize_gl4es();
|
||||
}
|
||||
|
||||
void JKVR_ResyncClientYawWithGameYaw()
|
||||
{
|
||||
//Allow several frames for the yaw to sync, first is this frame which is the old yaw
|
||||
//second is the next frame which _should_ be the new yaw, but just in case it isn't
|
||||
//we resync on the 3rd frame as well
|
||||
resyncClientYawWithGameYaw = 2;
|
||||
}
|
||||
|
||||
void JKVR_Init()
|
||||
{
|
||||
//Initialise all our variables
|
||||
playerYaw = 0.0f;
|
||||
showingScreenLayer = qfalse;
|
||||
remote_movementSideways = 0.0f;
|
||||
remote_movementForward = 0.0f;
|
||||
remote_movementUp = 0.0f;
|
||||
positional_movementSideways = 0.0f;
|
||||
positional_movementForward = 0.0f;
|
||||
snapTurn = 0.0f;
|
||||
vr.snapTurn = 0.0f;
|
||||
vr.immersive_cinematics = true;
|
||||
ducked = DUCK_NOTDUCKED;
|
||||
JKVR_ResyncClientYawWithGameYaw();
|
||||
|
||||
//init randomiser
|
||||
srand(time(NULL));
|
||||
|
@ -1297,13 +1286,11 @@ void JKVR_Init()
|
|||
vr_control_scheme = Cvar_Get( "vr_control_scheme", "0", CVAR_ARCHIVE);
|
||||
vr_switch_sticks = Cvar_Get( "vr_switch_sticks", "0", CVAR_ARCHIVE);
|
||||
|
||||
vr_cinematic_stereo = Cvar_Get( "vr_cinematic_stereo", "0", CVAR_ARCHIVE); // Default to 2D
|
||||
vr_screen_dist = Cvar_Get( "vr_screen_dist", "3.5", CVAR_ARCHIVE);
|
||||
vr_immersive_cinematics = Cvar_Get("vr_immersive_cinematics", "1", CVAR_ARCHIVE);
|
||||
vr_screen_dist = Cvar_Get( "vr_screen_dist", "2.5", CVAR_ARCHIVE);
|
||||
|
||||
//Set up vr client info
|
||||
vr.backpackitemactive = 0;
|
||||
vr.visible_hud = qtrue;
|
||||
vr.dualwield = qfalse;
|
||||
vr.weapon_recoil = 0.0f;
|
||||
|
||||
//Clear teleport stuff
|
||||
|
@ -1473,7 +1460,7 @@ void * AppThreadFunction(void * parm ) {
|
|||
if (SS_MULTIPLIER == 0.0f)
|
||||
{
|
||||
//GB Override as refresh is now 72 by default as we decided a higher res is better as 90hz has stutters
|
||||
SS_MULTIPLIER = 1.35f;
|
||||
SS_MULTIPLIER = 1.1f;
|
||||
}
|
||||
else if (SS_MULTIPLIER > 1.5f)
|
||||
{
|
||||
|
@ -1569,6 +1556,9 @@ void JKVR_FrameSetup()
|
|||
vrapi_SetDisplayRefreshRate(gAppState.Ovr, REFRESH);
|
||||
|
||||
vrapi_SetExtraLatencyMode(gAppState.Ovr, VRAPI_EXTRA_LATENCY_MODE_ON);
|
||||
|
||||
//get any cvar values required here
|
||||
vr.immersive_cinematics = (vr_immersive_cinematics->value != 0.0f);
|
||||
}
|
||||
|
||||
void JKVR_processHaptics() {
|
||||
|
|
|
@ -5,16 +5,16 @@
|
|||
#define WEAPON_RECOIL 15.0f;
|
||||
|
||||
typedef struct {
|
||||
bool screen;
|
||||
bool in_camera; // cinematic camera taken over
|
||||
bool using_screen_layer;
|
||||
float fov;
|
||||
bool immersive_cinematics;
|
||||
bool weapon_stabilised;
|
||||
bool right_handed;
|
||||
bool player_moving;
|
||||
bool visible_hud;
|
||||
bool dualwield;
|
||||
int weaponid;
|
||||
int lastweaponid;
|
||||
int backpackitemactive; //0 - nothing, 1 - grenades, 2 - knife, 3 - Binoculars
|
||||
bool mountedgun;
|
||||
|
||||
vec3_t hmdposition;
|
||||
|
@ -30,11 +30,14 @@ typedef struct {
|
|||
vec3_t weaponangles_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t weaponangles_delta;
|
||||
|
||||
vec3_t clientviewangles; //orientation in the client - we use this in the cgame
|
||||
float snapTurn; // how much turn has been applied to the yaw by joystick
|
||||
|
||||
float weapon_recoil; // recoil effect to improve the default
|
||||
|
||||
vec3_t current_weaponoffset;
|
||||
vec3_t calculated_weaponoffset;
|
||||
float current_weaponoffset_timestamp;
|
||||
vec3_t weaponposition;
|
||||
vec3_t weaponoffset;
|
||||
float weaponoffset_timestamp;
|
||||
vec3_t weaponoffset_history[NUM_WEAPON_SAMPLES];
|
||||
float weaponoffset_history_timestamp[NUM_WEAPON_SAMPLES];
|
||||
|
||||
|
@ -54,6 +57,7 @@ typedef struct {
|
|||
vec3_t offhandangles_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t offhandangles_delta;
|
||||
|
||||
vec3_t offhandposition;
|
||||
vec3_t offhandoffset;
|
||||
|
||||
//
|
||||
|
|
|
@ -29,10 +29,8 @@ extern bool jk2_initialised;
|
|||
extern long long global_time;
|
||||
extern float playerHeight;
|
||||
extern float playerYaw;
|
||||
extern bool showingScreenLayer;
|
||||
extern ovrTracking2 tracking;
|
||||
extern int ducked;
|
||||
extern int resyncClientYawWithGameYaw;
|
||||
extern vr_client_info_t vr;
|
||||
|
||||
#define DUCK_NOTDUCKED 0
|
||||
|
@ -71,9 +69,9 @@ void JKVR_setUseScreenLayer(bool use);
|
|||
void JKVR_processHaptics();
|
||||
void JKVR_getHMDOrientation();
|
||||
void JKVR_getTrackedRemotesOrientation();
|
||||
void JKVR_ResyncClientYawWithGameYaw();
|
||||
void JKVR_incrementFrameIndex();
|
||||
|
||||
bool JKVR_useScreenLayer();
|
||||
void JKVR_prepareEyeBuffer(int eye );
|
||||
void JKVR_finishEyeBuffer(int eye );
|
||||
void JKVR_submitFrame();
|
||||
|
|
|
@ -154,7 +154,7 @@ ovrLayerCylinder2 BuildCylinderLayer( ovrRenderer * cylinderRenderer,
|
|||
|
||||
const float density = 4500.0f;
|
||||
const float rotateYaw = 0.0f;
|
||||
const float radius = 4.0f;
|
||||
const float radius = 2.0f;
|
||||
//GB Hacky Override
|
||||
float screen_offset = 0;
|
||||
if(textureWidth > 1900)
|
||||
|
|
|
@ -10,6 +10,6 @@ extern cvar_t *vr_control_scheme;
|
|||
extern cvar_t *vr_teleport;
|
||||
extern cvar_t *vr_virtual_stock;
|
||||
extern cvar_t *vr_switch_sticks;
|
||||
extern cvar_t *vr_cinematic_stereo;
|
||||
extern cvar_t *vr_immersive_cinematics;
|
||||
extern cvar_t *vr_screen_dist;
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ extern float remote_movementForward;
|
|||
extern float remote_movementUp;
|
||||
extern float positional_movementSideways;
|
||||
extern float positional_movementForward;
|
||||
extern float snapTurn;
|
||||
|
||||
void sendButtonAction(const char* action, long buttonDown);
|
||||
void sendButtonActionSimple(const char* action);
|
||||
|
|
|
@ -30,7 +30,7 @@ cvar_t *vr_control_scheme;
|
|||
cvar_t *vr_teleport;
|
||||
cvar_t *vr_virtual_stock;
|
||||
cvar_t *vr_switch_sticks;
|
||||
cvar_t *vr_cinematic_stereo;
|
||||
cvar_t *vr_immersive_cinematics;
|
||||
cvar_t *vr_screen_dist;
|
||||
|
||||
ovrInputStateTrackedRemote leftTrackedRemoteState_old;
|
||||
|
@ -48,15 +48,12 @@ float remote_movementForward;
|
|||
float remote_movementUp;
|
||||
float positional_movementSideways;
|
||||
float positional_movementForward;
|
||||
float snapTurn;
|
||||
bool jk2_initialised;
|
||||
long long global_time;
|
||||
float playerHeight;
|
||||
float playerYaw;
|
||||
bool showingScreenLayer;
|
||||
ovrTracking2 tracking;
|
||||
int ducked;
|
||||
int resyncClientYawWithGameYaw;
|
||||
vr_client_info_t vr;
|
||||
|
||||
//keys.h
|
||||
|
@ -189,9 +186,6 @@ void updateScopeAngles()
|
|||
static vec3_t lastScopeAngles;
|
||||
if (vr.scopeengaged)
|
||||
{
|
||||
//Clear weapon offset
|
||||
VectorSet(vr.calculated_weaponoffset, 0, 0, 0);
|
||||
|
||||
VectorSet(currentScopeAngles, vr.weaponangles[PITCH], vr.weaponangles[YAW], vr.hmdorientation[ROLL]);
|
||||
|
||||
//Set "view" Angles
|
||||
|
|
|
@ -199,21 +199,6 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
if (scopeEngaged != vr.scopeengaged)
|
||||
{
|
||||
scopeEngaged = vr.scopeengaged;
|
||||
|
||||
//Resync on either transition
|
||||
JKVR_ResyncClientYawWithGameYaw();
|
||||
}
|
||||
|
||||
|
||||
static bool binocularstate = qfalse;
|
||||
bool binocularsactive = (vr.hasbinoculars && vr.backpackitemactive == 3 &&
|
||||
(distanceToHMD < BINOCULAR_ENGAGE_DISTANCE) &&
|
||||
(pDominantTracking->Status & (VRAPI_TRACKING_STATUS_POSITION_TRACKED | VRAPI_TRACKING_STATUS_POSITION_VALID)));
|
||||
if (binocularstate != binocularsactive)
|
||||
{
|
||||
//Engage scope if conditions are right
|
||||
binocularstate = binocularsactive;
|
||||
sendButtonAction("+zoom", binocularstate);
|
||||
}
|
||||
|
||||
//dominant hand stuff first
|
||||
|
@ -224,17 +209,18 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
VectorCopy(vr.weaponoffset_history[i-1], vr.weaponoffset_history[i]);
|
||||
vr.weaponoffset_history_timestamp[i] = vr.weaponoffset_history_timestamp[i-1];
|
||||
}
|
||||
VectorCopy(vr.current_weaponoffset, vr.weaponoffset_history[0]);
|
||||
vr.weaponoffset_history_timestamp[0] = vr.current_weaponoffset_timestamp;
|
||||
VectorCopy(vr.weaponoffset, vr.weaponoffset_history[0]);
|
||||
vr.weaponoffset_history_timestamp[0] = vr.weaponoffset_timestamp;
|
||||
|
||||
vr.weaponposition[0] = pWeapon->HeadPose.Pose.Position.x;
|
||||
vr.weaponposition[1] = pWeapon->HeadPose.Pose.Position.y;
|
||||
vr.weaponposition[2] = pWeapon->HeadPose.Pose.Position.z;
|
||||
|
||||
///Weapon location relative to view
|
||||
vr.current_weaponoffset[0] = pWeapon->HeadPose.Pose.Position.x - vr.hmdposition[0];
|
||||
vr.current_weaponoffset[1] = pWeapon->HeadPose.Pose.Position.y - vr.hmdposition[1];
|
||||
vr.current_weaponoffset[2] = pWeapon->HeadPose.Pose.Position.z - vr.hmdposition[2];
|
||||
vr.current_weaponoffset_timestamp = Sys_Milliseconds( );
|
||||
|
||||
//Just copy to calculated offset, used to use this in case we wanted to apply any modifiers, but don't any more
|
||||
VectorCopy(vr.current_weaponoffset, vr.calculated_weaponoffset);
|
||||
vr.weaponoffset[0] = pWeapon->HeadPose.Pose.Position.x - vr.hmdposition[0];
|
||||
vr.weaponoffset[1] = pWeapon->HeadPose.Pose.Position.y - vr.hmdposition[1];
|
||||
vr.weaponoffset[2] = pWeapon->HeadPose.Pose.Position.z - vr.hmdposition[2];
|
||||
vr.weaponoffset_timestamp = Sys_Milliseconds( );
|
||||
|
||||
//Does weapon velocity trigger attack (knife) and is it fast enough
|
||||
static bool velocityTriggeredAttack = false;
|
||||
|
@ -261,10 +247,9 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
sendButtonAction("+attack", velocityTriggeredAttack);
|
||||
}
|
||||
|
||||
if (vr.weapon_stabilised || vr.dualwield)
|
||||
if (vr.weapon_stabilised)
|
||||
{
|
||||
if (vr.scopeengaged || (vr_virtual_stock->integer == 1 && // Classic Virtual Stock
|
||||
!vr.dualwield))
|
||||
if (vr.scopeengaged || vr_virtual_stock->integer == 1)
|
||||
{
|
||||
//offset to the appropriate eye a little bit
|
||||
vec2_t xy;
|
||||
|
@ -287,16 +272,8 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
float zxDist = length(x, z);
|
||||
|
||||
if (zxDist != 0.0f && z != 0.0f) {
|
||||
if (vr.dualwield) {
|
||||
//SUPER FUDGE
|
||||
VectorSet(vr.weaponangles, vr.weaponangles[PITCH],
|
||||
-90.0f-degrees(atan2f(x, -z)), degrees(atanf(y / zxDist)));
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSet(vr.weaponangles, -degrees(atanf(y / zxDist)),
|
||||
-degrees(atan2f(x, -z)), vr.weaponangles[ROLL] / 2.0f); //Dampen roll on stabilised weapon
|
||||
}
|
||||
VectorSet(vr.weaponangles, -degrees(atanf(y / zxDist)),
|
||||
-degrees(atan2f(x, -z)), vr.weaponangles[ROLL] / 2.0f); //Dampen roll on stabilised weapon
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -318,7 +295,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
|
||||
bool bpTrackOk = pOffTracking->Status & VRAPI_TRACKING_STATUS_POSITION_TRACKED; // 1) Position must be tracked
|
||||
if (bpTrackOk && (bpDistToHMDOk = distanceToHMD >= 0.2 && distanceToHMD <= 0.35) // 2) Weapon-to-HMD distance must be within <0.2-0.35> range
|
||||
&& (bpWeaponHeightOk = vr.current_weaponoffset[1] >= -0.10 && vr.current_weaponoffset[1] <= 0.10)) // 3) Weapon height in relation to HMD must be within <-0.10, 0.10> range
|
||||
&& (bpWeaponHeightOk = vr.weaponoffset[1] >= -0.10 && vr.weaponoffset[1] <= 0.10)) // 3) Weapon height in relation to HMD must be within <-0.10, 0.10> range
|
||||
{
|
||||
AngleVectors(vr.hmdorientation, hmdForwardXY, NULL, NULL);
|
||||
AngleVectors(vr.weaponangles, weaponForwardXY, NULL, NULL);
|
||||
|
@ -339,17 +316,12 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
}
|
||||
}
|
||||
|
||||
// Uncomment to debug backpack reaching
|
||||
/*
|
||||
ALOGV("Backpack> Dist: %f | WpnToDownAngle: %f | WpnOffs: %f %f %f\nHmdWpnDot: %f | HmdFwdXY: %f %f | WpnFwdXY: %f %f\nTrackOk: %i, DistOk: %i, HeightOk: %i, WpnAngleOk: %i, HmdWpnDotOk: %i",
|
||||
distanceToHMD, weaponToDownAngle, vr.current_weaponoffset[0], vr.current_weaponoffset[1], vr.current_weaponoffset[2],
|
||||
hmdToWeaponDotProduct, hmdForwardXY[0], hmdForwardXY[1], weaponForwardXY[0], weaponForwardXY[1],
|
||||
bpTrackOk, bpDistToHMDOk, bpWeaponHeightOk, bpWeaponAngleOk, bpHmdToWeaponAngleOk);
|
||||
*/
|
||||
|
||||
|
||||
//off-hand stuff (done here as I reference it in the save state thing
|
||||
{
|
||||
vr.offhandposition[0] = pOff->HeadPose.Pose.Position.x;
|
||||
vr.offhandposition[1] = pOff->HeadPose.Pose.Position.y;
|
||||
vr.offhandposition[2] = pOff->HeadPose.Pose.Position.z;
|
||||
|
||||
vr.offhandoffset[0] = pOff->HeadPose.Pose.Position.x - vr.hmdposition[0];
|
||||
vr.offhandoffset[1] = pOff->HeadPose.Pose.Position.y - vr.hmdposition[1];
|
||||
vr.offhandoffset[2] = pOff->HeadPose.Pose.Position.z - vr.hmdposition[2];
|
||||
|
@ -422,16 +394,6 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
}
|
||||
}
|
||||
|
||||
if (!handInBackpack) {
|
||||
canUseBackpack = false;
|
||||
}
|
||||
else if (!canUseBackpack && vr.backpackitemactive == 0) {
|
||||
int channel = (vr_control_scheme->integer >= 10) ? 0 : 1;
|
||||
JKVR_Vibrate(40, channel, 0.5); // vibrate to let user know they can switch
|
||||
|
||||
canUseBackpack = true;
|
||||
}
|
||||
|
||||
dominantGripPushed = (pDominantTrackedRemoteNew->Buttons &
|
||||
ovrButton_GripTrigger) != 0;
|
||||
bool dominantButton1Pushed = (pDominantTrackedRemoteNew->Buttons &
|
||||
|
@ -439,7 +401,6 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
bool dominantButton2Pushed = (pDominantTrackedRemoteNew->Buttons &
|
||||
domButton2) != 0;
|
||||
|
||||
if (!canUseBackpack)
|
||||
{
|
||||
if (dominantGripPushed) {
|
||||
if (dominantGripPushTime == 0) {
|
||||
|
@ -448,59 +409,13 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
}
|
||||
else
|
||||
{
|
||||
if (vr.backpackitemactive == 1) {
|
||||
//Restores last used weapon if possible
|
||||
char buffer[32];
|
||||
sprintf(buffer, "weapon %i", vr.lastweaponid);
|
||||
sendButtonActionSimple(buffer);
|
||||
vr.backpackitemactive = 0;
|
||||
}
|
||||
else if ((GetTimeInMilliSeconds() - dominantGripPushTime) <
|
||||
if ((GetTimeInMilliSeconds() - dominantGripPushTime) <
|
||||
vr_reloadtimeoutms->integer) {
|
||||
sendButtonActionSimple("+reload");
|
||||
finishReloadNextFrame = true;
|
||||
}
|
||||
dominantGripPushTime = 0;
|
||||
}
|
||||
|
||||
if (!dominantButton1Pushed && vr.backpackitemactive == 2)
|
||||
{
|
||||
char buffer[32];
|
||||
sprintf(buffer, "weapon %i", vr.lastweaponid);
|
||||
sendButtonActionSimple(buffer);
|
||||
vr.backpackitemactive = 0;
|
||||
}
|
||||
|
||||
if (!dominantButton2Pushed && vr.backpackitemactive == 3)
|
||||
{
|
||||
vr.backpackitemactive = 0;
|
||||
}
|
||||
} else {
|
||||
if (vr.backpackitemactive == 0) {
|
||||
if (dominantGripPushed) {
|
||||
vr.lastweaponid = vr.weaponid;
|
||||
//Initiate grenade from backpack mode
|
||||
sendButtonActionSimple("weaponbank 6");
|
||||
int channel = (vr_control_scheme->integer >= 10) ? 0 : 1;
|
||||
JKVR_Vibrate(80, channel, 0.8); // vibrate to let user know they switched
|
||||
vr.backpackitemactive = 1;
|
||||
}
|
||||
else if (dominantButton1Pushed)
|
||||
{
|
||||
vr.lastweaponid = vr.weaponid;
|
||||
//Initiate knife from backpack mode
|
||||
sendButtonActionSimple("weapon 1");
|
||||
int channel = (vr_control_scheme->integer >= 10) ? 0 : 1;
|
||||
JKVR_Vibrate(80, channel, 0.8); // vibrate to let user know they switched
|
||||
vr.backpackitemactive = 2;
|
||||
}
|
||||
else if (dominantButton2Pushed && vr.hasbinoculars)
|
||||
{
|
||||
int channel = (vr_control_scheme->integer >= 10) ? 0 : 1;
|
||||
JKVR_Vibrate(80, channel, 0.8); // vibrate to let user know they switched
|
||||
vr.backpackitemactive = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -530,60 +445,17 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
positional_movementForward);
|
||||
|
||||
//Jump (B Button)
|
||||
if (vr.backpackitemactive != 2 && !canUseBackpack) {
|
||||
|
||||
if ((primaryButtonsNew & primaryButton2) != (primaryButtonsOld & primaryButton2))
|
||||
{
|
||||
//Sys_QueEvent( 0, SE_KEY, A_SPACE, (primaryButtonsNew & primaryButton2) != 0, 0, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//We need to record if we have started firing primary so that releasing trigger will stop firing, if user has pushed grip
|
||||
//in meantime, then it wouldn't stop the gun firing and it would get stuck
|
||||
static bool firing = false;
|
||||
if (dominantGripPushed && vr.backpackitemactive == 0)
|
||||
if ((primaryButtonsNew & primaryButton2) != (primaryButtonsOld & primaryButton2))
|
||||
{
|
||||
if ((pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger))
|
||||
{
|
||||
if (!vr.scopedweapon) {
|
||||
if (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) {
|
||||
ALOGV("**WEAPON EVENT** weapalt");
|
||||
sendButtonActionSimple("weapalt");
|
||||
}
|
||||
else if (firing)
|
||||
{
|
||||
//no longer firing
|
||||
firing = qfalse;
|
||||
ALOGV("**WEAPON EVENT** Grip Pushed %sattack", (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) ? "+" : "-");
|
||||
sendButtonAction("+attack", firing);
|
||||
}
|
||||
}
|
||||
else if (vr.detachablescope)
|
||||
{
|
||||
if (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) {
|
||||
//See if we are able to detach the scope
|
||||
ALOGV("**WEAPON EVENT** weapdetachscope");
|
||||
sendButtonActionSimple("weapdetachscope");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Just ignore grip and fire
|
||||
firing = (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger);
|
||||
ALOGV("**WEAPON EVENT** Grip Pushed %sattack", (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) ? "+" : "-");
|
||||
sendButtonAction("+attack", firing);
|
||||
}
|
||||
}
|
||||
sendButtonAction("+moveup", (primaryButtonsNew & primaryButton2));
|
||||
}
|
||||
else
|
||||
|
||||
|
||||
static bool firing = false;
|
||||
|
||||
{
|
||||
//Fire Primary
|
||||
if (vr.backpackitemactive != 3 && // Can't fire while holding binoculars
|
||||
!vr.velocitytriggered && // Don't fire velocity triggered weapons
|
||||
if (!vr.velocitytriggered && // Don't fire velocity triggered weapons
|
||||
(pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) !=
|
||||
(pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger)) {
|
||||
|
||||
|
@ -591,22 +463,10 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
firing = (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger);
|
||||
sendButtonAction("+attack", firing);
|
||||
}
|
||||
else if (binocularsactive) // trigger can zoom-in binoculars, remove from face to reset
|
||||
{
|
||||
static bool zoomin = true;
|
||||
if (pDominantTrackedRemoteNew->Buttons & ovrButton_Trigger) {
|
||||
sendButtonActionSimple(zoomin ? "weapnext" : "weapprev");
|
||||
} else if (pDominantTrackedRemoteOld->Buttons & ovrButton_Trigger)
|
||||
{
|
||||
zoomin = !zoomin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Duck
|
||||
if (vr.backpackitemactive != 2 &&
|
||||
!canUseBackpack &&
|
||||
(primaryButtonsNew & primaryButton1) !=
|
||||
if ((primaryButtonsNew & primaryButton1) !=
|
||||
(primaryButtonsOld & primaryButton1)) {
|
||||
|
||||
sendButtonAction("+movedown", (primaryButtonsNew & primaryButton1));
|
||||
|
@ -732,7 +592,6 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
static int usingMountedGun = false;
|
||||
if (vr.mountedgun != usingMountedGun)
|
||||
{
|
||||
resyncClientYawWithGameYaw = 10; // HACK
|
||||
usingMountedGun = vr.mountedgun;
|
||||
}
|
||||
|
||||
|
@ -743,17 +602,15 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
if (pPrimaryJoystick->x > 0.7f) {
|
||||
if (increaseSnap) {
|
||||
float turnAngle = vr_turn_mode->integer ? (vr_turn_angle->value / 9.0f) : vr_turn_angle->value;
|
||||
snapTurn -= turnAngle;
|
||||
vr.snapTurn -= turnAngle;
|
||||
|
||||
if (vr_turn_mode->integer == 0) {
|
||||
increaseSnap = false;
|
||||
}
|
||||
|
||||
if (snapTurn < -180.0f) {
|
||||
snapTurn += 360.f;
|
||||
if (vr.snapTurn < -180.0f) {
|
||||
vr.snapTurn += 360.f;
|
||||
}
|
||||
|
||||
JKVR_ResyncClientYawWithGameYaw();
|
||||
}
|
||||
} else if (pPrimaryJoystick->x < 0.3f) {
|
||||
increaseSnap = true;
|
||||
|
@ -764,18 +621,16 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
if (decreaseSnap) {
|
||||
|
||||
float turnAngle = vr_turn_mode->integer ? (vr_turn_angle->value / 9.0f) : vr_turn_angle->value;
|
||||
snapTurn += turnAngle;
|
||||
vr.snapTurn += turnAngle;
|
||||
|
||||
//If snap turn configured for less than 10 degrees
|
||||
if (vr_turn_mode->integer == 0) {
|
||||
decreaseSnap = false;
|
||||
}
|
||||
|
||||
if (snapTurn > 180.0f) {
|
||||
snapTurn -= 360.f;
|
||||
if (vr.snapTurn > 180.0f) {
|
||||
vr.snapTurn -= 360.f;
|
||||
}
|
||||
|
||||
JKVR_ResyncClientYawWithGameYaw();
|
||||
}
|
||||
} else if (pPrimaryJoystick->x > -0.3f) {
|
||||
decreaseSnap = true;
|
||||
|
@ -783,10 +638,6 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
}
|
||||
else {
|
||||
if (fabs(pPrimaryJoystick->x) > 0.5f) {
|
||||
if (increaseSnap)
|
||||
{
|
||||
JKVR_ResyncClientYawWithGameYaw();
|
||||
}
|
||||
increaseSnap = false;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -80,16 +80,23 @@ void HandleInput_WeaponAlign( ovrInputStateTrackedRemote *pDominantTrackedRemote
|
|||
|
||||
//dominant hand stuff first
|
||||
{
|
||||
vr.weaponposition[0] = pDominantTracking->HeadPose.Pose.Position.x;
|
||||
vr.weaponposition[1] = pDominantTracking->HeadPose.Pose.Position.y;
|
||||
vr.weaponposition[2] = pDominantTracking->HeadPose.Pose.Position.z;
|
||||
///Weapon location relative to view
|
||||
vr.current_weaponoffset[0] = pDominantTracking->HeadPose.Pose.Position.x - vr.hmdposition[0];
|
||||
vr.current_weaponoffset[1] = pDominantTracking->HeadPose.Pose.Position.y - vr.hmdposition[1];
|
||||
vr.current_weaponoffset[2] = pDominantTracking->HeadPose.Pose.Position.z - vr.hmdposition[2];
|
||||
vr.current_weaponoffset_timestamp = Sys_Milliseconds( );
|
||||
vr.weaponoffset[0] = pDominantTracking->HeadPose.Pose.Position.x - vr.hmdposition[0];
|
||||
vr.weaponoffset[1] = pDominantTracking->HeadPose.Pose.Position.y - vr.hmdposition[1];
|
||||
vr.weaponoffset[2] = pDominantTracking->HeadPose.Pose.Position.z - vr.hmdposition[2];
|
||||
vr.weaponoffset_timestamp = Sys_Milliseconds( );
|
||||
}
|
||||
|
||||
float controllerYawHeading = 0.0f;
|
||||
//off-hand stuff
|
||||
{
|
||||
vr.offhandposition[0] = pOffTracking->HeadPose.Pose.Position.x;
|
||||
vr.offhandposition[1] = pOffTracking->HeadPose.Pose.Position.y;
|
||||
vr.offhandposition[2] = pOffTracking->HeadPose.Pose.Position.z;
|
||||
|
||||
vr.offhandoffset[0] = pOffTracking->HeadPose.Pose.Position.x - vr.hmdposition[0];
|
||||
vr.offhandoffset[1] = pOffTracking->HeadPose.Pose.Position.y - vr.hmdposition[1];
|
||||
vr.offhandoffset[2] = pOffTracking->HeadPose.Pose.Position.z - vr.hmdposition[2];
|
||||
|
|
|
@ -1,21 +1,23 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
|
||||
JK3_BASE_CFLAGS = -DHAVE_GLES -DFINAL_BUILD -fexceptions -Wall -Wno-write-strings -Wno-comment -fno-caller-saves -fno-tree-vectorize -Wno-unused-but-set-variable
|
||||
JK3_BASE_CFLAGS = -DHAVE_GLES -DFINAL_BUILD -fexceptions -Wall -Wno-write-strings -Wno-comment -fno-caller-saves -fno-tree-vectorize -Wno-unused-but-set-variable
|
||||
JK3_BASE_CPPFLAGS = -fvisibility-inlines-hidden -Wno-invalid-offsetof
|
||||
|
||||
JK3_BASE_LDLIBS =
|
||||
|
||||
#Armv7
|
||||
JK3_BASE_CFLAGS += -mfloat-abi=softfp
|
||||
# JK3_BASE_CFLAGS += -mfloat-abi=softfp
|
||||
JK3_BASE_LDLIBS += -Wl
|
||||
|
||||
JK3_BASE_C_INCLUDES := $(OPENJK_PATH)/lib $(SPDir)/client $(SPDir)/qclib $(SPDir)/botlib $(SPDir)/d3d $(SPDir)/server $(SPDir)/sw $(SPDir)/libs/freetype2/include $(SPDir)/common $(SPDir)/gl
|
||||
JK3_BASE_C_INCLUDES += $(SPDir)/ $(OPENJK_PATH)/code/ $(OPENJK_PATH)/shared/ $(SPDir)/game $(SPDir)/ui $(OPENJK_PATH)/lib/gsl-lite/include
|
||||
JK3_BASE_C_INCLUDES := $(OPENJK_PATH)/lib $(JK3_CODE_PATH)/client $(JK3_CODE_PATH)/server $(JK3_CODE_PATH)/libs/freetype2/include $(JK3_CODE_PATH)/common $(JK3_CODE_PATH)/gl
|
||||
JK3_BASE_C_INCLUDES += $(JK3_CODE_PATH)/ $(OPENJK_PATH)/code/ $(OPENJK_PATH)/shared/ $(JK3_CODE_PATH)/ui $(OPENJK_PATH)/lib/gsl-lite/include
|
||||
|
||||
include $(OPENJK_PATH)/Android_client.mk
|
||||
include $(OPENJK_PATH)/Android_game.mk
|
||||
include $(OPENJK_PATH)/Android_gles.mk
|
||||
include $(OPENJK_PATH)/Android_client_jo.mk
|
||||
include $(OPENJK_PATH)/Android_client_ja.mk
|
||||
include $(OPENJK_PATH)/Android_game_jo.mk
|
||||
include $(OPENJK_PATH)/Android_game_ja.mk
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,145 +0,0 @@
|
|||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
|
||||
LOCAL_MODULE := openjk_sp
|
||||
|
||||
|
||||
LOCAL_CFLAGS := $(JK3_BASE_CFLAGS)
|
||||
LOCAL_CPPFLAGS := $(JK3_BASE_CPPFLAGS) -DBOTLIB -D_JK2EXE
|
||||
|
||||
LOCAL_LDLIBS := $(JK3_BASE_LDLIBS)
|
||||
|
||||
|
||||
LOCAL_LDLIBS += -lGLESv3 -landroid -lEGL -llog -lz -lOpenSLES
|
||||
|
||||
#Needed so lib can be loaded (_exit error)
|
||||
LOCAL_LDLIBS += -fuse-ld=bfd
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := sigc libzip libpng libminizip
|
||||
LOCAL_SHARED_LIBRARIES := vrapi gl4es
|
||||
|
||||
|
||||
LOCAL_C_INCLUDES := $(JK3_BASE_C_INCLUDES) $(TOP_DIR) $(TOP_DIR)/JKVR $(GL4ES_PATH) $(GL4ES_PATH)/include $(SUPPORT_LIBS)/minizip/include $(SPDir)/rd-vanilla $(SPDir)/rd-common
|
||||
|
||||
|
||||
#############################################################################
|
||||
# CLIENT/SERVER
|
||||
#############################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
JK3_SRC = \
|
||||
${SPDir}/android/in_android.cpp \
|
||||
${SPDir}/android/android_main.cpp \
|
||||
${SPDir}/android/android_snd.cpp \
|
||||
${SPDir}/android/android_window.cpp \
|
||||
\
|
||||
${SPDir}/client/cl_cgame.cpp \
|
||||
${SPDir}/client/cl_cin.cpp \
|
||||
${SPDir}/client/cl_console.cpp \
|
||||
${SPDir}/client/cl_input.cpp \
|
||||
${SPDir}/client/cl_keys.cpp \
|
||||
${SPDir}/client/cl_main.cpp \
|
||||
${SPDir}/client/cl_mp3.cpp \
|
||||
${SPDir}/client/cl_parse.cpp \
|
||||
${SPDir}/client/cl_scrn.cpp \
|
||||
${SPDir}/client/cl_ui.cpp \
|
||||
${SPDir}/client/snd_ambient.cpp \
|
||||
${SPDir}/client/snd_dma.cpp \
|
||||
${SPDir}/client/snd_mem.cpp \
|
||||
${SPDir}/client/snd_mix.cpp \
|
||||
${SPDir}/client/snd_music.cpp \
|
||||
${SPDir}/client/vmachine.cpp \
|
||||
${SPDir}/qcommon/cm_load.cpp \
|
||||
${SPDir}/qcommon/cm_patch.cpp \
|
||||
${SPDir}/qcommon/cm_polylib.cpp \
|
||||
${SPDir}/qcommon/cm_test.cpp \
|
||||
${SPDir}/qcommon/cm_trace.cpp \
|
||||
${SPDir}/qcommon/cmd.cpp \
|
||||
${SPDir}/qcommon/common.cpp \
|
||||
${SPDir}/qcommon/cvar.cpp \
|
||||
${SPDir}/qcommon/files.cpp \
|
||||
${SPDir}/qcommon/md4.cpp \
|
||||
${SPDir}/qcommon/msg.cpp \
|
||||
${SPDir}/qcommon/net_chan.cpp \
|
||||
${SPDir}/qcommon/q_shared.cpp \
|
||||
${SPDir}/qcommon/stringed_ingame.cpp \
|
||||
${SPDir}/qcommon/stringed_interface.cpp \
|
||||
${SPDir}/qcommon/strip.cpp \
|
||||
${SPDir}/qcommon/persistence.cpp \
|
||||
${SPDir}/qcommon/z_memman_pc.cpp \
|
||||
${SPDir}/qcommon/ojk_saved_game.cpp \
|
||||
${SHARED_PATH}/qcommon/safe/files.cpp \
|
||||
${SPDir}/server/exe_headers.cpp \
|
||||
${SPDir}/server/sv_ccmds.cpp \
|
||||
${SPDir}/server/sv_client.cpp \
|
||||
${SPDir}/server/sv_game.cpp \
|
||||
${SPDir}/server/sv_init.cpp \
|
||||
${SPDir}/server/sv_main.cpp \
|
||||
${SPDir}/server/sv_savegame.cpp \
|
||||
${SPDir}/server/sv_snapshot.cpp \
|
||||
${SPDir}/server/sv_world.cpp \
|
||||
${SPDir}/game/genericparser2.cpp \
|
||||
${SPDir}/mp3code/cdct.c \
|
||||
${SPDir}/mp3code/csbt.c \
|
||||
${SPDir}/mp3code/csbtb.c \
|
||||
${SPDir}/mp3code/csbtl3.c \
|
||||
${SPDir}/mp3code/cup.c \
|
||||
${SPDir}/mp3code/cupini.c \
|
||||
${SPDir}/mp3code/cupl1.c \
|
||||
${SPDir}/mp3code/cupl3.c \
|
||||
${SPDir}/mp3code/cwin.c \
|
||||
${SPDir}/mp3code/cwinb.c \
|
||||
${SPDir}/mp3code/cwinm.c \
|
||||
${SPDir}/mp3code/hwin.c \
|
||||
${SPDir}/mp3code/l3dq.c \
|
||||
${SPDir}/mp3code/l3init.c \
|
||||
${SPDir}/mp3code/mdct.c \
|
||||
${SPDir}/mp3code/mhead.c \
|
||||
${SPDir}/mp3code/msis.c \
|
||||
${SPDir}/mp3code/towave.c \
|
||||
${SPDir}/mp3code/uph.c \
|
||||
${SPDir}/mp3code/upsf.c \
|
||||
${SPDir}/mp3code/wavep.c \
|
||||
${SPDir}/ui/ui_atoms.cpp \
|
||||
${SPDir}/ui/ui_connect.cpp \
|
||||
${SPDir}/ui/ui_main.cpp \
|
||||
${SPDir}/ui/ui_saber.cpp \
|
||||
${SPDir}/ui/ui_shared.cpp \
|
||||
${SPDir}/ui/ui_syscalls.cpp \
|
||||
${SHARED_PATH}/sys/sys_event.cpp \
|
||||
${SHARED_PATH}/sys/con_log.cpp \
|
||||
${SHARED_PATH}/sys/sys_unix.cpp \
|
||||
${SHARED_PATH}/sys/con_tty.cpp \
|
||||
\
|
||||
${SHARED_PATH}/qcommon/q_color.c \
|
||||
${SHARED_PATH}/qcommon/q_math.c \
|
||||
${SHARED_PATH}/qcommon/q_string.c \
|
||||
${SHARED_PATH}/qcommon/safe/string.cpp \
|
||||
|
||||
|
||||
JKVR_SRC_FILES := ${TOP_DIR}/JKVR/JKVR_SurfaceView.cpp \
|
||||
${TOP_DIR}/JKVR/VrCompositor.cpp \
|
||||
${TOP_DIR}/JKVR/VrInputCommon.cpp \
|
||||
${TOP_DIR}/JKVR/VrInputWeaponAlign.cpp \
|
||||
${TOP_DIR}/JKVR/VrInputDefault.cpp \
|
||||
${TOP_DIR}/JKVR/argtable3.c
|
||||
|
||||
LOCAL_SRC_FILES += $(JK3_SRC) $(JKVR_SRC_FILES)
|
||||
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
|
||||
|
||||
$(call import-module,VrApi/Projects/AndroidPrebuilt/jni)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
|
||||
LOCAL_MODULE := openjk_ja
|
||||
|
||||
|
||||
LOCAL_CFLAGS := $(JK3_BASE_CFLAGS)
|
||||
LOCAL_CPPFLAGS := $(JK3_BASE_CPPFLAGS) -DBOTLIB -D_JK2EXE
|
||||
|
||||
LOCAL_LDLIBS := $(JK3_BASE_LDLIBS)
|
||||
|
||||
|
||||
LOCAL_LDLIBS += -lGLESv3 -landroid -lEGL -llog -lz -lOpenSLES
|
||||
|
||||
#Needed so lib can be loaded (_exit error)
|
||||
LOCAL_LDLIBS += -fuse-ld=bfd
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := sigc libzip libpng libminizip
|
||||
LOCAL_SHARED_LIBRARIES := vrapi gl4es
|
||||
|
||||
|
||||
LOCAL_C_INCLUDES := $(JK3_BASE_C_INCLUDES) $(TOP_DIR) $(TOP_DIR)/JKVR $(GL4ES_PATH) $(GL4ES_PATH)/include $(JK3_CODE_PATH)/game $(SUPPORT_LIBS)/minizip/include $(JK3_CODE_PATH)/rd-vanilla $(JK3_CODE_PATH)/rd-common
|
||||
|
||||
|
||||
#############################################################################
|
||||
# CLIENT/SERVER
|
||||
#############################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
JK3_SRC = \
|
||||
${JK3_CODE_PATH}/android/in_android.cpp \
|
||||
${JK3_CODE_PATH}/android/android_main.cpp \
|
||||
${JK3_CODE_PATH}/android/android_snd.cpp \
|
||||
${JK3_CODE_PATH}/android/android_window.cpp \
|
||||
\
|
||||
${JK3_CODE_PATH}/client/cl_cgame.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_cin.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_console.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_input.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_keys.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_main.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_mp3.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_parse.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_scrn.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_ui.cpp \
|
||||
${JK3_CODE_PATH}/client/snd_ambient.cpp \
|
||||
${JK3_CODE_PATH}/client/snd_dma.cpp \
|
||||
${JK3_CODE_PATH}/client/snd_mem.cpp \
|
||||
${JK3_CODE_PATH}/client/snd_mix.cpp \
|
||||
${JK3_CODE_PATH}/client/snd_music.cpp \
|
||||
${JK3_CODE_PATH}/client/vmachine.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/cm_load.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/cm_patch.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/cm_polylib.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/cm_test.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/cm_trace.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/cmd.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/common.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/cvar.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/files.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/md4.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/msg.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/net_chan.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/q_shared.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/stringed_ingame.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/stringed_interface.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/strip.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/persistence.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/z_memman_pc.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/ojk_saved_game.cpp \
|
||||
${SHARED_PATH}/qcommon/safe/files.cpp \
|
||||
${JK3_CODE_PATH}/server/exe_headers.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_ccmds.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_client.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_game.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_init.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_main.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_savegame.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_snapshot.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_world.cpp \
|
||||
${JK3_CODE_PATH}/game/genericparser2.cpp \
|
||||
${JK3_CODE_PATH}/mp3code/cdct.c \
|
||||
${JK3_CODE_PATH}/mp3code/csbt.c \
|
||||
${JK3_CODE_PATH}/mp3code/csbtb.c \
|
||||
${JK3_CODE_PATH}/mp3code/csbtl3.c \
|
||||
${JK3_CODE_PATH}/mp3code/cup.c \
|
||||
${JK3_CODE_PATH}/mp3code/cupini.c \
|
||||
${JK3_CODE_PATH}/mp3code/cupl1.c \
|
||||
${JK3_CODE_PATH}/mp3code/cupl3.c \
|
||||
${JK3_CODE_PATH}/mp3code/cwin.c \
|
||||
${JK3_CODE_PATH}/mp3code/cwinb.c \
|
||||
${JK3_CODE_PATH}/mp3code/cwinm.c \
|
||||
${JK3_CODE_PATH}/mp3code/hwin.c \
|
||||
${JK3_CODE_PATH}/mp3code/l3dq.c \
|
||||
${JK3_CODE_PATH}/mp3code/l3init.c \
|
||||
${JK3_CODE_PATH}/mp3code/mdct.c \
|
||||
${JK3_CODE_PATH}/mp3code/mhead.c \
|
||||
${JK3_CODE_PATH}/mp3code/msis.c \
|
||||
${JK3_CODE_PATH}/mp3code/towave.c \
|
||||
${JK3_CODE_PATH}/mp3code/uph.c \
|
||||
${JK3_CODE_PATH}/mp3code/upsf.c \
|
||||
${JK3_CODE_PATH}/mp3code/wavep.c \
|
||||
${JK3_CODE_PATH}/ui/ui_atoms.cpp \
|
||||
${JK3_CODE_PATH}/ui/ui_connect.cpp \
|
||||
${JK3_CODE_PATH}/ui/ui_main.cpp \
|
||||
${JK3_CODE_PATH}/ui/ui_saber.cpp \
|
||||
${JK3_CODE_PATH}/ui/ui_shared.cpp \
|
||||
${JK3_CODE_PATH}/ui/ui_syscalls.cpp \
|
||||
${SHARED_PATH}/sys/sys_event.cpp \
|
||||
${SHARED_PATH}/sys/con_log.cpp \
|
||||
${SHARED_PATH}/sys/sys_unix.cpp \
|
||||
${SHARED_PATH}/sys/con_tty.cpp \
|
||||
\
|
||||
${SHARED_PATH}/qcommon/q_color.c \
|
||||
${SHARED_PATH}/qcommon/q_math.c \
|
||||
${SHARED_PATH}/qcommon/q_string.c \
|
||||
${SHARED_PATH}/qcommon/safe/string.cpp \
|
||||
|
||||
|
||||
JKVR_SRC_FILES := ${TOP_DIR}/JKVR/JKVR_SurfaceView.cpp \
|
||||
${TOP_DIR}/JKVR/VrCompositor.cpp \
|
||||
${TOP_DIR}/JKVR/VrInputCommon.cpp \
|
||||
${TOP_DIR}/JKVR/VrInputWeaponAlign.cpp \
|
||||
${TOP_DIR}/JKVR/VrInputDefault.cpp \
|
||||
${TOP_DIR}/JKVR/argtable3.c
|
||||
|
||||
LOCAL_SRC_FILES += $(JK3_SRC) $(JKVR_SRC_FILES)
|
||||
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
|
||||
|
||||
$(call import-module,VrApi/Projects/AndroidPrebuilt/jni)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
|
||||
LOCAL_MODULE := openjk_jo
|
||||
|
||||
|
||||
LOCAL_CFLAGS := $(JK3_BASE_CFLAGS)
|
||||
LOCAL_CPPFLAGS := $(JK3_BASE_CPPFLAGS) -DBOTLIB -D_JK2EXE -DJK2_MODE
|
||||
|
||||
LOCAL_LDLIBS := $(JK3_BASE_LDLIBS)
|
||||
|
||||
|
||||
LOCAL_LDLIBS += -lGLESv3 -landroid -lEGL -llog -lz -lOpenSLES
|
||||
|
||||
#Needed so lib can be loaded (_exit error)
|
||||
LOCAL_LDLIBS += -fuse-ld=bfd
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := sigc libzip libpng libminizip
|
||||
LOCAL_SHARED_LIBRARIES := vrapi gl4es
|
||||
|
||||
|
||||
LOCAL_C_INCLUDES := $(JK3_BASE_C_INCLUDES) $(TOP_DIR) $(TOP_DIR)/JKVR $(GL4ES_PATH) $(GL4ES_PATH)/include $(JK3_CODE_PATH)/game $(SUPPORT_LIBS)/minizip/include $(JK3_CODE_PATH)/rd-vanilla $(JK3_CODE_PATH)/rd-common
|
||||
|
||||
|
||||
#############################################################################
|
||||
# CLIENT/SERVER
|
||||
#############################################################################
|
||||
|
||||
|
||||
|
||||
|
||||
JK3_SRC = \
|
||||
${JK3_CODE_PATH}/android/in_android.cpp \
|
||||
${JK3_CODE_PATH}/android/android_main.cpp \
|
||||
${JK3_CODE_PATH}/android/android_snd.cpp \
|
||||
${JK3_CODE_PATH}/android/android_window.cpp \
|
||||
\
|
||||
${JK3_CODE_PATH}/client/cl_cgame.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_cin.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_console.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_input.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_keys.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_main.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_mp3.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_parse.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_scrn.cpp \
|
||||
${JK3_CODE_PATH}/client/cl_ui.cpp \
|
||||
${JK3_CODE_PATH}/client/snd_ambient.cpp \
|
||||
${JK3_CODE_PATH}/client/snd_dma.cpp \
|
||||
${JK3_CODE_PATH}/client/snd_mem.cpp \
|
||||
${JK3_CODE_PATH}/client/snd_mix.cpp \
|
||||
${JK3_CODE_PATH}/client/snd_music.cpp \
|
||||
${JK3_CODE_PATH}/client/vmachine.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/cm_load.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/cm_patch.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/cm_polylib.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/cm_test.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/cm_trace.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/cmd.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/common.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/cvar.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/files.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/md4.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/msg.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/net_chan.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/q_shared.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/stringed_ingame.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/stringed_interface.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/strip.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/persistence.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/z_memman_pc.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/ojk_saved_game.cpp \
|
||||
${SHARED_PATH}/qcommon/safe/files.cpp \
|
||||
${JK3_CODE_PATH}/server/exe_headers.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_ccmds.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_client.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_game.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_init.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_main.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_savegame.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_snapshot.cpp \
|
||||
${JK3_CODE_PATH}/server/sv_world.cpp \
|
||||
${JK3_CODE_PATH}/game/genericparser2.cpp \
|
||||
${JK3_CODE_PATH}/mp3code/cdct.c \
|
||||
${JK3_CODE_PATH}/mp3code/csbt.c \
|
||||
${JK3_CODE_PATH}/mp3code/csbtb.c \
|
||||
${JK3_CODE_PATH}/mp3code/csbtl3.c \
|
||||
${JK3_CODE_PATH}/mp3code/cup.c \
|
||||
${JK3_CODE_PATH}/mp3code/cupini.c \
|
||||
${JK3_CODE_PATH}/mp3code/cupl1.c \
|
||||
${JK3_CODE_PATH}/mp3code/cupl3.c \
|
||||
${JK3_CODE_PATH}/mp3code/cwin.c \
|
||||
${JK3_CODE_PATH}/mp3code/cwinb.c \
|
||||
${JK3_CODE_PATH}/mp3code/cwinm.c \
|
||||
${JK3_CODE_PATH}/mp3code/hwin.c \
|
||||
${JK3_CODE_PATH}/mp3code/l3dq.c \
|
||||
${JK3_CODE_PATH}/mp3code/l3init.c \
|
||||
${JK3_CODE_PATH}/mp3code/mdct.c \
|
||||
${JK3_CODE_PATH}/mp3code/mhead.c \
|
||||
${JK3_CODE_PATH}/mp3code/msis.c \
|
||||
${JK3_CODE_PATH}/mp3code/towave.c \
|
||||
${JK3_CODE_PATH}/mp3code/uph.c \
|
||||
${JK3_CODE_PATH}/mp3code/upsf.c \
|
||||
${JK3_CODE_PATH}/mp3code/wavep.c \
|
||||
${JK3_CODE_PATH}/ui/ui_atoms.cpp \
|
||||
${JK3_CODE_PATH}/ui/ui_connect.cpp \
|
||||
${JK3_CODE_PATH}/ui/ui_main.cpp \
|
||||
${JK3_CODE_PATH}/ui/ui_saber.cpp \
|
||||
${JK3_CODE_PATH}/ui/ui_shared.cpp \
|
||||
${JK3_CODE_PATH}/ui/ui_syscalls.cpp \
|
||||
${SHARED_PATH}/sys/sys_event.cpp \
|
||||
${SHARED_PATH}/sys/con_log.cpp \
|
||||
${SHARED_PATH}/sys/sys_unix.cpp \
|
||||
${SHARED_PATH}/sys/con_tty.cpp \
|
||||
\
|
||||
${SHARED_PATH}/qcommon/q_color.c \
|
||||
${SHARED_PATH}/qcommon/q_math.c \
|
||||
${SHARED_PATH}/qcommon/q_string.c \
|
||||
${SHARED_PATH}/qcommon/safe/string.cpp \
|
||||
|
||||
|
||||
JKVR_SRC_FILES := ${TOP_DIR}/JKVR/JKVR_SurfaceView.cpp \
|
||||
${TOP_DIR}/JKVR/VrCompositor.cpp \
|
||||
${TOP_DIR}/JKVR/VrInputCommon.cpp \
|
||||
${TOP_DIR}/JKVR/VrInputWeaponAlign.cpp \
|
||||
${TOP_DIR}/JKVR/VrInputDefault.cpp \
|
||||
${TOP_DIR}/JKVR/argtable3.c
|
||||
|
||||
LOCAL_SRC_FILES += $(JK3_SRC) $(JKVR_SRC_FILES)
|
||||
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
|
||||
|
||||
$(call import-module,VrApi/Projects/AndroidPrebuilt/jni)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ LOCAL_LDLIBS += -llog -lz
|
|||
#LOCAL_STATIC_LIBRARIES := s-setup lz
|
||||
LOCAL_SHARED_LIBRARIES :=
|
||||
|
||||
LOCAL_C_INCLUDES := $(JK3_BASE_C_INCLUDES) $(TOP_DIR) $(GL4ES_PATH) $(GL4ES_PATH)/include $(TOP_DIR)/SupportLibs/openal/include $(SPDir)/rd-vanilla $(SPDir)/rd-common
|
||||
LOCAL_C_INCLUDES := $(JK3_BASE_C_INCLUDES) $(TOP_DIR) $(GL4ES_PATH) $(GL4ES_PATH)/include $(JK3_CODE_PATH)/game $(TOP_DIR)/SupportLibs/openal/include $(JK3_CODE_PATH)/rd-vanilla $(JK3_CODE_PATH)/rd-common
|
||||
|
||||
JK3_SRC = \
|
||||
code/game/AI_Animal.cpp \
|
|
@ -0,0 +1,191 @@
|
|||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
|
||||
LOCAL_MODULE := jogamearm
|
||||
|
||||
|
||||
LOCAL_CFLAGS := $(JK3_BASE_CFLAGS) -DSP_GAME -DJK2_MODE
|
||||
LOCAL_CPPFLAGS := $(JK3_BASE_CPPFLAGS) -DSP_GAME -DJK2_MODE
|
||||
|
||||
LOCAL_LDLIBS := $(JK3_BASE_LDLIBS)
|
||||
|
||||
|
||||
LOCAL_LDLIBS += -llog -lz
|
||||
#LOCAL_STATIC_LIBRARIES := s-setup lz
|
||||
LOCAL_SHARED_LIBRARIES :=
|
||||
|
||||
LOCAL_C_INCLUDES := $(JK3_BASE_C_INCLUDES) $(TOP_DIR) $(GL4ES_PATH) $(GL4ES_PATH)/include $(JK2_CODE_PATH)/game $(TOP_DIR)/SupportLibs/openal/include $(JK3_CODE_PATH)/rd-vanilla $(JK3_CODE_PATH)/rd-common
|
||||
|
||||
JK2_SRC = \
|
||||
codeJK2/game/AI_Atst.cpp \
|
||||
codeJK2/game/AI_Default.cpp \
|
||||
codeJK2/game/AI_Droid.cpp \
|
||||
codeJK2/game/AI_GalakMech.cpp \
|
||||
codeJK2/game/AI_Grenadier.cpp \
|
||||
codeJK2/game/AI_Howler.cpp \
|
||||
codeJK2/game/AI_ImperialProbe.cpp \
|
||||
codeJK2/game/AI_Interrogator.cpp \
|
||||
codeJK2/game/AI_Jedi.cpp \
|
||||
codeJK2/game/AI_Mark1.cpp \
|
||||
codeJK2/game/AI_Mark2.cpp \
|
||||
codeJK2/game/AI_MineMonster.cpp \
|
||||
codeJK2/game/AI_Remote.cpp \
|
||||
codeJK2/game/AI_Seeker.cpp \
|
||||
codeJK2/game/AI_Sentry.cpp \
|
||||
codeJK2/game/AI_Sniper.cpp \
|
||||
codeJK2/game/AI_Stormtrooper.cpp \
|
||||
codeJK2/game/AI_Utils.cpp \
|
||||
codeJK2/game/G_Timer.cpp \
|
||||
codeJK2/game/NPC.cpp \
|
||||
codeJK2/game/NPC_behavior.cpp \
|
||||
codeJK2/game/NPC_combat.cpp \
|
||||
codeJK2/game/NPC_goal.cpp \
|
||||
codeJK2/game/NPC_misc.cpp \
|
||||
codeJK2/game/NPC_move.cpp \
|
||||
codeJK2/game/NPC_reactions.cpp \
|
||||
codeJK2/game/NPC_senses.cpp \
|
||||
codeJK2/game/NPC_sounds.cpp \
|
||||
codeJK2/game/NPC_spawn.cpp \
|
||||
codeJK2/game/NPC_stats.cpp \
|
||||
codeJK2/game/NPC_utils.cpp \
|
||||
codeJK2/game/Q3_Interface.cpp \
|
||||
codeJK2/game/Q3_Registers.cpp \
|
||||
codeJK2/game/bg_misc.cpp \
|
||||
codeJK2/game/bg_pangles.cpp \
|
||||
codeJK2/game/bg_panimate.cpp \
|
||||
codeJK2/game/bg_pmove.cpp \
|
||||
codeJK2/game/bg_slidemove.cpp \
|
||||
codeJK2/game/g_ICARUS.cpp \
|
||||
codeJK2/game/g_active.cpp \
|
||||
codeJK2/game/g_breakable.cpp \
|
||||
codeJK2/game/g_camera.cpp \
|
||||
codeJK2/game/g_client.cpp \
|
||||
codeJK2/game/g_cmds.cpp \
|
||||
codeJK2/game/g_combat.cpp \
|
||||
codeJK2/game/g_functions.cpp \
|
||||
codeJK2/game/g_fx.cpp \
|
||||
codeJK2/game/g_inventory.cpp \
|
||||
codeJK2/game/g_itemLoad.cpp \
|
||||
codeJK2/game/g_items.cpp \
|
||||
codeJK2/game/g_main.cpp \
|
||||
codeJK2/game/g_mem.cpp \
|
||||
codeJK2/game/g_misc.cpp \
|
||||
codeJK2/game/g_misc_model.cpp \
|
||||
codeJK2/game/g_missile.cpp \
|
||||
codeJK2/game/g_mover.cpp \
|
||||
codeJK2/game/g_nav.cpp \
|
||||
codeJK2/game/g_navnew.cpp \
|
||||
codeJK2/game/g_navigator.cpp \
|
||||
codeJK2/game/g_object.cpp \
|
||||
codeJK2/game/g_objectives.cpp \
|
||||
codeJK2/game/g_ref.cpp \
|
||||
codeJK2/game/g_roff.cpp \
|
||||
codeJK2/game/g_savegame.cpp \
|
||||
codeJK2/game/g_session.cpp \
|
||||
codeJK2/game/g_spawn.cpp \
|
||||
codeJK2/game/g_svcmds.cpp \
|
||||
codeJK2/game/g_target.cpp \
|
||||
codeJK2/game/g_trigger.cpp \
|
||||
codeJK2/game/g_turret.cpp \
|
||||
codeJK2/game/g_usable.cpp \
|
||||
codeJK2/game/g_utils.cpp \
|
||||
codeJK2/game/g_weapon.cpp \
|
||||
codeJK2/game/g_weaponLoad.cpp \
|
||||
codeJK2/game/genericparser2.cpp \
|
||||
codeJK2/game/wp_atst.cpp \
|
||||
codeJK2/game/wp_blaster_rifle.cpp \
|
||||
codeJK2/game/wp_bot_laser.cpp \
|
||||
codeJK2/game/wp_bowcaster.cpp \
|
||||
codeJK2/game/wp_bryar_pistol.cpp \
|
||||
codeJK2/game/wp_demp2.cpp \
|
||||
codeJK2/game/wp_det_pack.cpp \
|
||||
codeJK2/game/wp_disruptor.cpp \
|
||||
codeJK2/game/wp_emplaced_gun.cpp \
|
||||
codeJK2/game/wp_flechette.cpp \
|
||||
codeJK2/game/wp_melee.cpp \
|
||||
codeJK2/game/wp_repeater.cpp \
|
||||
codeJK2/game/wp_rocket_launcher.cpp \
|
||||
codeJK2/game/wp_saber.cpp \
|
||||
codeJK2/game/wp_stun_baton.cpp \
|
||||
codeJK2/game/wp_thermal.cpp \
|
||||
codeJK2/game/wp_trip_mine.cpp \
|
||||
codeJK2/cgame/FX_ATSTMain.cpp \
|
||||
codeJK2/cgame/FX_Blaster.cpp \
|
||||
codeJK2/cgame/FX_Bowcaster.cpp \
|
||||
codeJK2/cgame/FX_BryarPistol.cpp \
|
||||
codeJK2/cgame/FX_DEMP2.cpp \
|
||||
codeJK2/cgame/FX_Disruptor.cpp \
|
||||
codeJK2/cgame/FX_Emplaced.cpp \
|
||||
codeJK2/cgame/FX_Flechette.cpp \
|
||||
codeJK2/cgame/FX_HeavyRepeater.cpp \
|
||||
codeJK2/cgame/FX_RocketLauncher.cpp \
|
||||
codeJK2/cgame/FxPrimitives.cpp \
|
||||
codeJK2/cgame/FxPrimitives.h \
|
||||
codeJK2/cgame/FxScheduler.cpp \
|
||||
codeJK2/cgame/FxScheduler.h \
|
||||
codeJK2/cgame/FxSystem.cpp \
|
||||
codeJK2/cgame/FxSystem.h \
|
||||
codeJK2/cgame/FxTemplate.cpp \
|
||||
codeJK2/cgame/FxUtil.cpp \
|
||||
codeJK2/cgame/FxUtil.h \
|
||||
codeJK2/cgame/animtable.h \
|
||||
codeJK2/cgame/cg_camera.cpp \
|
||||
codeJK2/cgame/cg_camera.h \
|
||||
codeJK2/cgame/cg_consolecmds.cpp \
|
||||
codeJK2/cgame/cg_credits.cpp \
|
||||
codeJK2/cgame/cg_draw.cpp \
|
||||
codeJK2/cgame/cg_drawtools.cpp \
|
||||
codeJK2/cgame/cg_effects.cpp \
|
||||
codeJK2/cgame/cg_ents.cpp \
|
||||
codeJK2/cgame/cg_event.cpp \
|
||||
codeJK2/cgame/cg_info.cpp \
|
||||
codeJK2/cgame/cg_lights.cpp \
|
||||
codeJK2/cgame/cg_local.h \
|
||||
codeJK2/cgame/cg_localents.cpp \
|
||||
codeJK2/cgame/cg_main.cpp \
|
||||
codeJK2/cgame/cg_marks.cpp \
|
||||
codeJK2/cgame/cg_media.h \
|
||||
codeJK2/cgame/cg_players.cpp \
|
||||
codeJK2/cgame/cg_playerstate.cpp \
|
||||
codeJK2/cgame/cg_predict.cpp \
|
||||
codeJK2/cgame/cg_public.h \
|
||||
codeJK2/cgame/cg_scoreboard.cpp \
|
||||
codeJK2/cgame/cg_servercmds.cpp \
|
||||
codeJK2/cgame/cg_snapshot.cpp \
|
||||
codeJK2/cgame/cg_syscalls.cpp \
|
||||
codeJK2/cgame/cg_text.cpp \
|
||||
codeJK2/cgame/cg_view.cpp \
|
||||
codeJK2/cgame/cg_weapons.cpp \
|
||||
code/ui/gameinfo.cpp \
|
||||
code/qcommon/tri_coll_test.cpp \
|
||||
code/qcommon/q_shared.cpp \
|
||||
codeJK2/icarus/BlockStream.cpp \
|
||||
codeJK2/icarus/Sequence.cpp \
|
||||
codeJK2/icarus/Sequencer.cpp \
|
||||
codeJK2/icarus/TaskManager.cpp \
|
||||
codeJK2/icarus/Instance.cpp \
|
||||
${JK3_CODE_PATH}/Rufl/hstring.cpp \
|
||||
\
|
||||
${SHARED_PATH}/qcommon/q_color.c \
|
||||
${SHARED_PATH}/qcommon/q_math.c \
|
||||
${SHARED_PATH}/qcommon/q_string.c \
|
||||
${SHARED_PATH}/qcommon/safe/string.cpp \
|
||||
${SHARED_PATH}/qcommon/safe/files.cpp \
|
||||
|
||||
|
||||
LOCAL_SRC_FILES += $(JK2_SRC)
|
||||
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -18,51 +18,51 @@ LOCAL_LDLIBS += -lGLESv3 -landroid -lEGL -ldl -llog
|
|||
LOCAL_STATIC_LIBRARIES := libpng libjpeg
|
||||
LOCAL_SHARED_LIBRARIES := gl4es
|
||||
|
||||
LOCAL_C_INCLUDES := $(JK3_BASE_C_INCLUDES) $(SUPPORT_LIBS)/libpng $(TOP_DIR) $(SPDir)/rd-vanilla $(SPDir)/rd-common
|
||||
LOCAL_C_INCLUDES := $(JK3_BASE_C_INCLUDES) $(SUPPORT_LIBS)/libpng $(TOP_DIR) $(JK3_CODE_PATH)/rd-vanilla $(JK3_CODE_PATH)/rd-common
|
||||
|
||||
|
||||
JK3_SRC = \
|
||||
${SPDir}/rd-vanilla/G2_API.cpp \
|
||||
${SPDir}/rd-vanilla/G2_bolts.cpp \
|
||||
${SPDir}/rd-vanilla/G2_bones.cpp \
|
||||
${SPDir}/rd-vanilla/G2_misc.cpp \
|
||||
${SPDir}/rd-vanilla/G2_surfaces.cpp \
|
||||
${SPDir}/qcommon/matcomp.cpp \
|
||||
${SPDir}/qcommon/q_shared.cpp \
|
||||
${SPDir}/rd-vanilla/tr_arb.cpp \
|
||||
${SPDir}/rd-vanilla/tr_backend.cpp \
|
||||
${SPDir}/rd-vanilla/tr_bsp.cpp \
|
||||
${SPDir}/rd-vanilla/tr_cmds.cpp \
|
||||
${SPDir}/rd-vanilla/tr_curve.cpp \
|
||||
${SPDir}/rd-vanilla/tr_draw.cpp \
|
||||
${SPDir}/rd-vanilla/tr_ghoul2.cpp \
|
||||
${SPDir}/rd-vanilla/tr_image.cpp \
|
||||
${SPDir}/rd-vanilla/tr_init.cpp \
|
||||
${SPDir}/rd-vanilla/tr_light.cpp \
|
||||
${SPDir}/rd-vanilla/tr_main.cpp \
|
||||
${SPDir}/rd-vanilla/tr_marks.cpp \
|
||||
${SPDir}/rd-vanilla/tr_mesh.cpp \
|
||||
${SPDir}/rd-vanilla/tr_model.cpp \
|
||||
${SPDir}/rd-vanilla/tr_quicksprite.cpp \
|
||||
${SPDir}/rd-vanilla/tr_scene.cpp \
|
||||
${SPDir}/rd-vanilla/tr_shade.cpp \
|
||||
${SPDir}/rd-vanilla/tr_shade_calc.cpp \
|
||||
${SPDir}/rd-vanilla/tr_shader.cpp \
|
||||
${SPDir}/rd-vanilla/tr_shadows.cpp \
|
||||
${SPDir}/rd-vanilla/tr_skin.cpp \
|
||||
${SPDir}/rd-vanilla/tr_sky.cpp \
|
||||
${SPDir}/rd-vanilla/tr_stl.cpp \
|
||||
${SPDir}/rd-vanilla/tr_subs.cpp \
|
||||
${SPDir}/rd-vanilla/tr_surface.cpp \
|
||||
${SPDir}/rd-vanilla/tr_surfacesprites.cpp \
|
||||
${SPDir}/rd-vanilla/tr_world.cpp \
|
||||
${SPDir}/rd-vanilla/tr_WorldEffects.cpp \
|
||||
${SPDir}/rd-common/tr_font.cpp \
|
||||
${SPDir}/rd-common/tr_image_load.cpp \
|
||||
${SPDir}/rd-common/tr_image_jpg.cpp \
|
||||
${SPDir}/rd-common/tr_image_tga.cpp \
|
||||
${SPDir}/rd-common/tr_image_png.cpp \
|
||||
${SPDir}/rd-common/tr_noise.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/G2_API.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/G2_bolts.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/G2_bones.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/G2_misc.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/G2_surfaces.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/matcomp.cpp \
|
||||
${JK3_CODE_PATH}/qcommon/q_shared.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_arb.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_backend.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_bsp.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_cmds.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_curve.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_draw.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_ghoul2.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_image.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_init.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_light.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_main.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_marks.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_mesh.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_model.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_quicksprite.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_scene.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_shade.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_shade_calc.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_shader.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_shadows.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_skin.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_sky.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_stl.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_subs.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_surface.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_surfacesprites.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_world.cpp \
|
||||
${JK3_CODE_PATH}/rd-vanilla/tr_WorldEffects.cpp \
|
||||
${JK3_CODE_PATH}/rd-common/tr_font.cpp \
|
||||
${JK3_CODE_PATH}/rd-common/tr_image_load.cpp \
|
||||
${JK3_CODE_PATH}/rd-common/tr_image_jpg.cpp \
|
||||
${JK3_CODE_PATH}/rd-common/tr_image_tga.cpp \
|
||||
${JK3_CODE_PATH}/rd-common/tr_image_png.cpp \
|
||||
${JK3_CODE_PATH}/rd-common/tr_noise.cpp \
|
||||
${OPENJK_PATH}/shared/qcommon/q_math.c \
|
||||
${OPENJK_PATH}/shared/qcommon/q_color.c \
|
||||
${OPENJK_PATH}/shared/qcommon/q_string.c \
|
||||
|
|
|
@ -1,791 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2009 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
|
||||
//#include "TouchControlsContainer.h"
|
||||
//#include "JNITouchControlsUtils.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
#include "src/ui/keycodes.h"
|
||||
|
||||
#include "in_android.h"
|
||||
|
||||
|
||||
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO,"JNI", __VA_ARGS__))
|
||||
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "JNI", __VA_ARGS__))
|
||||
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR,"JNI", __VA_ARGS__))
|
||||
|
||||
#define JAVA_FUNC(x) Java_com_beloko_opengames_rtcw_NativeLib_##x
|
||||
|
||||
int android_screen_width;
|
||||
int android_screen_height;
|
||||
|
||||
|
||||
#define KEY_SHOW_WEAPONS 0x1000
|
||||
#define KEY_SHOOT 0x1001
|
||||
|
||||
#define KEY_SHOW_INV 0x1006
|
||||
#define KEY_QUICK_CMD 0x1007
|
||||
|
||||
#define KEY_SHOW_KEYB 0x1009
|
||||
|
||||
float gameControlsAlpha = 0.5;
|
||||
bool showWeaponCycle = false;
|
||||
bool turnMouseMode = true;
|
||||
bool invertLook = false;
|
||||
bool precisionShoot = false;
|
||||
bool showSticks = true;
|
||||
bool hideTouchControls = true;
|
||||
bool enableWeaponWheel = true;
|
||||
|
||||
bool shooting = false;
|
||||
|
||||
//set when holding down reload
|
||||
bool sniperMode = false;
|
||||
|
||||
static int controlsCreated = 0;
|
||||
touchcontrols::TouchControlsContainer controlsContainer;
|
||||
|
||||
touchcontrols::TouchControls *tcMenuMain=0;
|
||||
touchcontrols::TouchControls *tcGameMain=0;
|
||||
touchcontrols::TouchControls *tcGameWeapons=0;
|
||||
touchcontrols::TouchControls *tcInventory=0;
|
||||
touchcontrols::TouchControls *tcWeaponWheel=0;
|
||||
|
||||
//So can hide and show these buttons
|
||||
touchcontrols::Button *nextWeapon=0;
|
||||
touchcontrols::Button *prevWeapon=0;
|
||||
touchcontrols::TouchJoy *touchJoyLeft;
|
||||
touchcontrols::TouchJoy *touchJoyRight;
|
||||
|
||||
extern JNIEnv* env_;
|
||||
JavaVM* jvm_;
|
||||
|
||||
|
||||
void openGLStart()
|
||||
{
|
||||
|
||||
glPushMatrix();
|
||||
//glClearColor(1.0f, 1.0f, 0.0f, 1.0f);
|
||||
//glClear(GL_COLOR_BUFFER_BIT);
|
||||
//LOGI("openGLStart");
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glEnableClientState(GL_VERTEX_ARRAY);
|
||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY );
|
||||
|
||||
//glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glEnable (GL_BLEND);
|
||||
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
//glEnable(GL_TEXTURE_2D);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
|
||||
glPushMatrix();
|
||||
|
||||
|
||||
}
|
||||
|
||||
void openGLEnd()
|
||||
{
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
void gameSettingsButton(int state)
|
||||
{
|
||||
if (state == 1)
|
||||
{
|
||||
showTouchSettings();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
extern unsigned int Sys_Milliseconds(void);
|
||||
|
||||
static unsigned int reload_time_down;
|
||||
void gameButton(int state,int code)
|
||||
{
|
||||
if (code == KEY_SHOOT)
|
||||
{
|
||||
shooting = state;
|
||||
PortableAction(state,PORT_ACT_ATTACK);
|
||||
}
|
||||
else if (code == PORT_ACT_RELOAD)
|
||||
{
|
||||
//If holding down the reload button, do not reload
|
||||
if (state) //key down
|
||||
{
|
||||
reload_time_down = Sys_Milliseconds();
|
||||
}
|
||||
else //up
|
||||
{
|
||||
//if less than 0.5 sec, reload
|
||||
if (( Sys_Milliseconds() - reload_time_down) < 500)
|
||||
{
|
||||
PortableAction(1, PORT_ACT_RELOAD);
|
||||
PortableAction(0, PORT_ACT_RELOAD);
|
||||
}
|
||||
}
|
||||
|
||||
sniperMode = state; //Use reload button for precision aim also
|
||||
}
|
||||
else if (code == KEY_SHOW_WEAPONS)
|
||||
{
|
||||
if (state == 1)
|
||||
if (!tcGameWeapons->enabled)
|
||||
{
|
||||
tcInventory->animateOut(5);
|
||||
tcGameWeapons->animateIn(5);
|
||||
}
|
||||
}
|
||||
else if (code == KEY_SHOW_INV)
|
||||
{
|
||||
if (state == 1)
|
||||
{
|
||||
if (!tcInventory->enabled)
|
||||
{
|
||||
tcGameWeapons->animateOut(5);
|
||||
tcInventory->animateIn(5);
|
||||
}
|
||||
else
|
||||
tcInventory->animateOut(5);
|
||||
}
|
||||
}
|
||||
else if (code == KEY_QUICK_CMD){
|
||||
//if (state == 1)
|
||||
// showCustomCommands();
|
||||
PortableKeyEvent(state, '~', 0);
|
||||
if (state)
|
||||
toggleKeyboard();
|
||||
}
|
||||
else
|
||||
{
|
||||
PortableAction(state, code);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Weapon wheel callbacks
|
||||
void weaponWheelSelected(int enabled)
|
||||
{
|
||||
if (enabled)
|
||||
tcWeaponWheel->fade(touchcontrols::FADE_IN,5); //fade in
|
||||
|
||||
}
|
||||
void weaponWheel(int segment)
|
||||
{
|
||||
LOGI("weaponWheel %d",segment);
|
||||
int code;
|
||||
if (segment == 9)
|
||||
code = '0';
|
||||
else
|
||||
code = '1' + segment;
|
||||
|
||||
PortableKeyEvent(1,code,0);
|
||||
PortableKeyEvent(0, code,0);
|
||||
}
|
||||
|
||||
void menuButton(int state,int code)
|
||||
{
|
||||
if (code == KEY_SHOW_KEYB)
|
||||
{
|
||||
if (state)
|
||||
toggleKeyboard();
|
||||
return;
|
||||
}
|
||||
PortableKeyEvent(state, code, 0);
|
||||
}
|
||||
|
||||
void inventoryButton(int state,int code)
|
||||
{
|
||||
PortableAction(state,code);
|
||||
}
|
||||
|
||||
int left_double_action;
|
||||
int right_double_action;
|
||||
|
||||
void left_double_tap(int state)
|
||||
{
|
||||
//LOGTOUCH("L double %d",state);
|
||||
if (left_double_action)
|
||||
PortableAction(state,left_double_action);
|
||||
}
|
||||
|
||||
void right_double_tap(int state)
|
||||
{
|
||||
//LOGTOUCH("R double %d",state);
|
||||
if (right_double_action)
|
||||
PortableAction(state,right_double_action);
|
||||
}
|
||||
|
||||
void mouse_move(int action,float x, float y,float dx, float dy)
|
||||
{
|
||||
//PortableMouse(mouse_x,mouse_y);
|
||||
PortableMouseAbs(x * 640,y * 480);
|
||||
if (action == TOUCHMOUSE_TAP)
|
||||
{
|
||||
PortableKeyEvent(1, K_MOUSE1, 0);
|
||||
PortableKeyEvent(0, K_MOUSE1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//To be set by android
|
||||
float strafe_sens,forward_sens;
|
||||
float pitch_sens,yaw_sens;
|
||||
|
||||
void left_stick(float joy_x, float joy_y,float mouse_x, float mouse_y)
|
||||
{
|
||||
joy_x *=10;
|
||||
//float strafe = joy_x*joy_x;
|
||||
float strafe = joy_x;
|
||||
//if (joy_x < 0)
|
||||
// strafe *= -1;
|
||||
|
||||
PortableMove(joy_y * 15 * forward_sens,-strafe * strafe_sens);
|
||||
}
|
||||
void right_stick(float joy_x, float joy_y,float mouse_x, float mouse_y)
|
||||
{
|
||||
//LOGI(" mouse x = %f",mouse_x);
|
||||
int invert = invertLook?-1:1;
|
||||
|
||||
float scale;
|
||||
|
||||
if (sniperMode)
|
||||
scale = 0.1;
|
||||
else
|
||||
scale = (shooting && precisionShoot)?0.3:1;
|
||||
|
||||
if (1)
|
||||
{
|
||||
PortableLookPitch(LOOK_MODE_MOUSE,-mouse_y * pitch_sens * invert * scale);
|
||||
|
||||
if (turnMouseMode)
|
||||
PortableLookYaw(LOOK_MODE_MOUSE,mouse_x*2*yaw_sens * scale);
|
||||
else
|
||||
PortableLookYaw(LOOK_MODE_JOYSTICK,joy_x*6*yaw_sens * scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
float y = mouse_y * mouse_y;
|
||||
y *= 50;
|
||||
if (mouse_y < 0)
|
||||
y *= -1;
|
||||
|
||||
PortableLookPitch(LOOK_MODE_MOUSE,-y * pitch_sens * invert * scale);
|
||||
|
||||
float x = mouse_x * mouse_x;
|
||||
x *= 100;
|
||||
if (mouse_x < 0)
|
||||
x *= -1;
|
||||
|
||||
if (turnMouseMode)
|
||||
PortableLookYaw(LOOK_MODE_MOUSE,x*2*yaw_sens * scale);
|
||||
else
|
||||
PortableLookYaw(LOOK_MODE_JOYSTICK,joy_x*6*yaw_sens * scale);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Weapon select callbacks
|
||||
void selectWeaponButton(int state, int code)
|
||||
{
|
||||
PortableKeyEvent(state, code, 0);
|
||||
if (state == 0)
|
||||
tcGameWeapons->animateOut(5);
|
||||
}
|
||||
|
||||
void weaponCycle(bool v)
|
||||
{
|
||||
if (v)
|
||||
{
|
||||
if (nextWeapon) nextWeapon->setEnabled(true);
|
||||
if (prevWeapon) prevWeapon->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nextWeapon) nextWeapon->setEnabled(false);
|
||||
if (prevWeapon) prevWeapon->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void setHideSticks(bool v)
|
||||
{
|
||||
if (touchJoyLeft) touchJoyLeft->setHideGraphics(v);
|
||||
if (touchJoyRight) touchJoyRight->setHideGraphics(v);
|
||||
}
|
||||
|
||||
|
||||
void initControls(int width, int height,const char * graphics_path,const char *settings_file)
|
||||
{
|
||||
touchcontrols::GLScaleWidth = (float)width;
|
||||
touchcontrols::GLScaleHeight = (float)height;
|
||||
|
||||
LOGI("initControls %d x %d,x path = %s, settings = %s",width,height,graphics_path,settings_file);
|
||||
|
||||
if (!controlsCreated)
|
||||
{
|
||||
LOGI("creating controls");
|
||||
|
||||
touchcontrols::setGraphicsBasePath(graphics_path);
|
||||
setControlsContainer(&controlsContainer);
|
||||
|
||||
controlsContainer.openGL_start.connect( sigc::ptr_fun(&openGLStart));
|
||||
controlsContainer.openGL_end.connect( sigc::ptr_fun(&openGLEnd));
|
||||
|
||||
|
||||
tcMenuMain = new touchcontrols::TouchControls("menu",true,false);
|
||||
tcGameMain = new touchcontrols::TouchControls("game",false,true,1);
|
||||
tcGameWeapons = new touchcontrols::TouchControls("weapons",false,true,1);
|
||||
tcInventory = new touchcontrols::TouchControls("inventory",false,true,1);
|
||||
tcWeaponWheel = new touchcontrols::TouchControls("weapon_wheel",false,true,1);
|
||||
|
||||
tcGameMain->signal_settingsButton.connect( sigc::ptr_fun(&gameSettingsButton) );
|
||||
|
||||
//Menu
|
||||
tcMenuMain->signal_button.connect( sigc::ptr_fun(&menuButton) );
|
||||
|
||||
touchcontrols::Mouse *mouse = new touchcontrols::Mouse("mouse",touchcontrols::RectF(0,0,26,16),"");
|
||||
mouse->setHideGraphics(true);
|
||||
tcMenuMain->addControl(mouse);
|
||||
mouse->signal_action.connect(sigc::ptr_fun(&mouse_move) );
|
||||
|
||||
tcMenuMain->setAlpha(0.3);
|
||||
|
||||
|
||||
//Game
|
||||
tcGameMain->setAlpha(gameControlsAlpha);
|
||||
tcGameMain->addControl(new touchcontrols::Button("jump",touchcontrols::RectF(24,4,26,6),"jump",PORT_ACT_JUMP));
|
||||
tcGameMain->addControl(new touchcontrols::Button("crouch",touchcontrols::RectF(24,14,26,16),"crouch",PORT_ACT_DOWN));
|
||||
tcGameMain->addControl(new touchcontrols::Button("attack",touchcontrols::RectF(20,7,23,10),"shoot",KEY_SHOOT));
|
||||
tcGameMain->addControl(new touchcontrols::Button("use",touchcontrols::RectF(23,6,26,9),"use",PORT_ACT_USE));
|
||||
tcGameMain->addControl(new touchcontrols::Button("binocular",touchcontrols::RectF(21,5,23,7),"binocular",PORT_ACT_ZOOM_IN));
|
||||
tcGameMain->addControl(new touchcontrols::Button("kick",touchcontrols::RectF(3,5,5,7),"kick",PORT_ACT_KICK));
|
||||
|
||||
tcGameMain->addControl(new touchcontrols::Button("notebook",touchcontrols::RectF(14,0,16,2),"notebook",PORT_ACT_HELPCOMP));
|
||||
tcGameMain->addControl(new touchcontrols::Button("use_inventory",touchcontrols::RectF(16,0,18,2),"inv",KEY_SHOW_INV));
|
||||
tcGameMain->addControl(new touchcontrols::Button("quick_save",touchcontrols::RectF(24,0,26,2),"save",PORT_ACT_QUICKSAVE));
|
||||
tcGameMain->addControl(new touchcontrols::Button("quick_load",touchcontrols::RectF(20,0,22,2),"load",PORT_ACT_QUICKLOAD));
|
||||
tcGameMain->addControl( new touchcontrols::Button("prompt",touchcontrols::RectF(9,0,11,2),"keyboard",KEY_QUICK_CMD));
|
||||
|
||||
|
||||
tcGameMain->addControl(new touchcontrols::Button("reload",touchcontrols::RectF(0,5,3,7),"reload_sniper",PORT_ACT_RELOAD));
|
||||
tcGameMain->addControl(new touchcontrols::Button("alt_fire",touchcontrols::RectF(13,14,15,16),"Custom_2",PORT_ACT_ALT_FIRE));
|
||||
|
||||
tcGameMain->addControl(new touchcontrols::Button("show_weapons",touchcontrols::RectF(11,14,13,16),"show_weapons",KEY_SHOW_WEAPONS));
|
||||
|
||||
nextWeapon = new touchcontrols::Button("next_weapon",touchcontrols::RectF(0,3,3,5),"next_weap",PORT_ACT_NEXT_WEP);
|
||||
tcGameMain->addControl(nextWeapon);
|
||||
prevWeapon = new touchcontrols::Button("prev_weapon",touchcontrols::RectF(0,7,3,9),"prev_weap",PORT_ACT_PREV_WEP);
|
||||
tcGameMain->addControl(prevWeapon);
|
||||
|
||||
touchJoyLeft = new touchcontrols::TouchJoy("stick",touchcontrols::RectF(0,7,8,16),"strafe_arrow");
|
||||
tcGameMain->addControl(touchJoyLeft);
|
||||
touchJoyLeft->signal_move.connect(sigc::ptr_fun(&left_stick) );
|
||||
touchJoyLeft->signal_double_tap.connect(sigc::ptr_fun(&left_double_tap) );
|
||||
|
||||
touchJoyRight = new touchcontrols::TouchJoy("touch",touchcontrols::RectF(17,4,26,16),"look_arrow");
|
||||
tcGameMain->addControl(touchJoyRight);
|
||||
touchJoyRight->signal_move.connect(sigc::ptr_fun(&right_stick) );
|
||||
touchJoyRight->signal_double_tap.connect(sigc::ptr_fun(&right_double_tap) );
|
||||
|
||||
tcGameMain->signal_button.connect( sigc::ptr_fun(&gameButton) );
|
||||
|
||||
//Weapons
|
||||
tcGameWeapons->addControl(new touchcontrols::Button("weapon1",touchcontrols::RectF(1,14,3,16),"key_1",'1'));
|
||||
tcGameWeapons->addControl(new touchcontrols::Button("weapon2",touchcontrols::RectF(3,14,5,16),"key_2",'2'));
|
||||
tcGameWeapons->addControl(new touchcontrols::Button("weapon3",touchcontrols::RectF(5,14,7,16),"key_3",'3'));
|
||||
tcGameWeapons->addControl(new touchcontrols::Button("weapon4",touchcontrols::RectF(7,14,9,16),"key_4",'4'));
|
||||
tcGameWeapons->addControl(new touchcontrols::Button("weapon5",touchcontrols::RectF(9,14,11,16),"key_5",'5'));
|
||||
|
||||
tcGameWeapons->addControl(new touchcontrols::Button("weapon6",touchcontrols::RectF(15,14,17,16),"key_6",'6'));
|
||||
tcGameWeapons->addControl(new touchcontrols::Button("weapon7",touchcontrols::RectF(17,14,19,16),"key_7",'7'));
|
||||
tcGameWeapons->addControl(new touchcontrols::Button("weapon8",touchcontrols::RectF(19,14,21,16),"key_8",'8'));
|
||||
tcGameWeapons->addControl(new touchcontrols::Button("weapon9",touchcontrols::RectF(21,14,23,16),"key_9",'9'));
|
||||
tcGameWeapons->addControl(new touchcontrols::Button("weapon0",touchcontrols::RectF(23,14,25,16),"key_0",'0'));
|
||||
tcGameWeapons->signal_button.connect( sigc::ptr_fun(&selectWeaponButton) );
|
||||
tcGameWeapons->setAlpha(0.8);
|
||||
|
||||
//Weapon wheel
|
||||
touchcontrols::WheelSelect *wheel = new touchcontrols::WheelSelect("weapon_wheel",touchcontrols::RectF(7,2,19,14),"weapon_wheel",10);
|
||||
wheel->signal_selected.connect(sigc::ptr_fun(&weaponWheel) );
|
||||
wheel->signal_enabled.connect(sigc::ptr_fun(&weaponWheelSelected));
|
||||
tcWeaponWheel->addControl(wheel);
|
||||
tcWeaponWheel->setAlpha(0.5);
|
||||
|
||||
//Inventory
|
||||
tcInventory->addControl(new touchcontrols::Button("invuse",touchcontrols::RectF(3,14,5,16),"enter",PORT_ACT_INVUSE));
|
||||
tcInventory->addControl(new touchcontrols::Button("invprev",touchcontrols::RectF(6,14,8,16),"arrow_left",PORT_ACT_INVPREV));
|
||||
tcInventory->addControl(new touchcontrols::Button("invnext",touchcontrols::RectF(8,14,10,16),"arrow_right",PORT_ACT_INVNEXT));
|
||||
|
||||
tcInventory->signal_button.connect( sigc::ptr_fun(&inventoryButton) );
|
||||
tcInventory->setAlpha(0.5);
|
||||
|
||||
|
||||
controlsContainer.addControlGroup(tcGameMain);
|
||||
controlsContainer.addControlGroup(tcGameWeapons);
|
||||
controlsContainer.addControlGroup(tcMenuMain);
|
||||
controlsContainer.addControlGroup(tcInventory);
|
||||
controlsContainer.addControlGroup(tcWeaponWheel);
|
||||
controlsCreated = 1;
|
||||
|
||||
tcGameMain->setXMLFile(settings_file);
|
||||
tcGameWeapons->setXMLFile((std::string)graphics_path + "/weapons.xml");
|
||||
tcInventory->setXMLFile((std::string)graphics_path + "/inventory.xml");
|
||||
tcWeaponWheel->setXMLFile((std::string)graphics_path + "/weaponwheel.xml");
|
||||
}
|
||||
else
|
||||
LOGI("NOT creating controls");
|
||||
|
||||
controlsContainer.initGL();
|
||||
}
|
||||
|
||||
|
||||
int inMenuLast = 1;
|
||||
int inAutomapLast = 0;
|
||||
void frameControls()
|
||||
{
|
||||
int inMenuNew = PortableInMenu();
|
||||
if (inMenuLast != inMenuNew)
|
||||
{
|
||||
inMenuLast = inMenuNew;
|
||||
if (!inMenuNew)
|
||||
{
|
||||
tcGameMain->setEnabled(true);
|
||||
if (enableWeaponWheel)
|
||||
tcWeaponWheel->setEnabled(true);
|
||||
tcMenuMain->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
tcGameMain->setEnabled(false);
|
||||
tcGameWeapons->setEnabled(false);
|
||||
tcWeaponWheel->setEnabled(false);
|
||||
tcMenuMain->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
weaponCycle(showWeaponCycle);
|
||||
setHideSticks(!showSticks);
|
||||
controlsContainer.draw();
|
||||
}
|
||||
|
||||
|
||||
void setTouchSettings(float alpha,float strafe,float fwd,float pitch,float yaw,int other)
|
||||
{
|
||||
|
||||
gameControlsAlpha = alpha;
|
||||
if (tcGameMain)
|
||||
tcGameMain->setAlpha(gameControlsAlpha);
|
||||
|
||||
showWeaponCycle = other & 0x1?true:false;
|
||||
turnMouseMode = other & 0x2?true:false;
|
||||
invertLook = other & 0x4?true:false;
|
||||
precisionShoot = other & 0x8?true:false;
|
||||
showSticks = other & 0x1000?true:false;
|
||||
enableWeaponWheel = other & 0x2000?true:false;
|
||||
|
||||
if (tcWeaponWheel)
|
||||
tcWeaponWheel->setEnabled(enableWeaponWheel);
|
||||
|
||||
|
||||
hideTouchControls = other & 0x80000000?true:false;
|
||||
|
||||
|
||||
switch ((other>>4) & 0xF)
|
||||
{
|
||||
case 1:
|
||||
left_double_action = PORT_ACT_ATTACK;
|
||||
break;
|
||||
case 2:
|
||||
left_double_action = PORT_ACT_JUMP;
|
||||
break;
|
||||
case 3:
|
||||
left_double_action = PORT_ACT_USE;
|
||||
break;
|
||||
default:
|
||||
left_double_action = 0;
|
||||
}
|
||||
|
||||
switch ((other>>8) & 0xF)
|
||||
{
|
||||
case 1:
|
||||
right_double_action = PORT_ACT_ATTACK;
|
||||
break;
|
||||
case 2:
|
||||
right_double_action = PORT_ACT_JUMP;
|
||||
break;
|
||||
case 3:
|
||||
right_double_action = PORT_ACT_USE;
|
||||
break;
|
||||
default:
|
||||
right_double_action = 0;
|
||||
}
|
||||
|
||||
strafe_sens = strafe;
|
||||
forward_sens = fwd;
|
||||
pitch_sens = pitch;
|
||||
yaw_sens = yaw;
|
||||
|
||||
}
|
||||
|
||||
int quit_now = 0;
|
||||
|
||||
#define EXPORT_ME __attribute__ ((visibility("default")))
|
||||
|
||||
JNIEnv* env_;
|
||||
|
||||
int argc=1;
|
||||
const char * argv[32];
|
||||
std::string graphicpath;
|
||||
|
||||
|
||||
std::string game_path;
|
||||
const char * getGamePath()
|
||||
{
|
||||
return game_path.c_str();
|
||||
}
|
||||
|
||||
std::string lib_path;
|
||||
const char * getLibPath()
|
||||
{
|
||||
return lib_path.c_str();
|
||||
}
|
||||
|
||||
jint EXPORT_ME
|
||||
JAVA_FUNC(init) ( JNIEnv* env, jobject thiz,jstring graphics_dir,jint mem_mb,jobjectArray argsArray,jint renderer,jstring game_path_ ,jstring lib_path_ )
|
||||
{
|
||||
env_ = env;
|
||||
|
||||
argv[0] = "quake";
|
||||
int argCount = (env)->GetArrayLength( argsArray);
|
||||
LOGI("argCount = %d",argCount);
|
||||
for (int i=0; i<argCount; i++) {
|
||||
jstring string = (jstring) (env)->GetObjectArrayElement( argsArray, i);
|
||||
argv[argc] = (char *)(env)->GetStringUTFChars( string, 0);
|
||||
LOGI("arg = %s",argv[argc]);
|
||||
argc++;
|
||||
}
|
||||
|
||||
|
||||
game_path = (char *)(env)->GetStringUTFChars( game_path_, 0);
|
||||
lib_path = (char *)(env)->GetStringUTFChars( lib_path_, 0);
|
||||
|
||||
LOGI("game_path = %s",getGamePath());
|
||||
LOGI("lib_path = %s",getLibPath());
|
||||
|
||||
|
||||
PortableInit(argc,argv);
|
||||
|
||||
const char * p = env->GetStringUTFChars(graphics_dir,NULL);
|
||||
graphicpath = std::string(p);
|
||||
|
||||
|
||||
|
||||
initControls(android_screen_width,-android_screen_height,graphicpath.c_str(),(graphicpath + "/game_controls.xml").c_str());
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern int androidSwapped;
|
||||
|
||||
jint EXPORT_ME
|
||||
JAVA_FUNC(frame) ( JNIEnv* env, jobject thiz )
|
||||
{
|
||||
|
||||
//LOGI("frame");
|
||||
|
||||
androidSwapped = 1;
|
||||
|
||||
PortableFrame();
|
||||
|
||||
if (quit_now)
|
||||
{
|
||||
LOGI("frame QUIT");
|
||||
return 128;
|
||||
}
|
||||
|
||||
|
||||
frameControls();
|
||||
|
||||
int ret = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) jint JNI_OnLoad(JavaVM* vm, void* reserved)
|
||||
{
|
||||
LOGI("JNI_OnLoad");
|
||||
jvm_ = vm;
|
||||
setTCJNIEnv(vm);
|
||||
|
||||
return JNI_VERSION_1_4;
|
||||
}
|
||||
|
||||
|
||||
void EXPORT_ME
|
||||
JAVA_FUNC(keypress) (JNIEnv *env, jobject obj, jint down, jint keycode, jint unicode)
|
||||
{
|
||||
LOGI("keypress %d",keycode);
|
||||
if (controlsContainer.isEditing())
|
||||
{
|
||||
if (down && (keycode == K_ESCAPE ))
|
||||
controlsContainer.finishEditing();
|
||||
return;
|
||||
}
|
||||
|
||||
PortableKeyEvent(down,keycode,unicode);
|
||||
}
|
||||
|
||||
|
||||
void EXPORT_ME
|
||||
JAVA_FUNC(touchEvent) (JNIEnv *env, jobject obj,jint action, jint pid, jfloat x, jfloat y)
|
||||
{
|
||||
//LOGI("TOUCHED");
|
||||
controlsContainer.processPointer(action,pid,x,y);
|
||||
}
|
||||
|
||||
|
||||
void EXPORT_ME
|
||||
JAVA_FUNC(doAction) (JNIEnv *env, jobject obj, jint state, jint action)
|
||||
{
|
||||
//gamepadButtonPressed();
|
||||
if (hideTouchControls)
|
||||
if (tcGameMain)
|
||||
{
|
||||
if (tcGameMain->isEnabled())
|
||||
tcGameMain->animateOut(30);
|
||||
|
||||
if (tcWeaponWheel->isEnabled())
|
||||
tcWeaponWheel->animateOut(30);
|
||||
}
|
||||
LOGI("doAction %d %d",state,action);
|
||||
|
||||
//Sniper mode for gamepad
|
||||
if (action == PORT_ACT_RELOAD)
|
||||
{
|
||||
if (state) //key down
|
||||
{
|
||||
reload_time_down = Sys_Milliseconds();
|
||||
}
|
||||
else //up
|
||||
{
|
||||
//if less than 0.5 sec, reload
|
||||
if (( Sys_Milliseconds() - reload_time_down) < 500)
|
||||
{
|
||||
PortableAction(1, PORT_ACT_RELOAD);
|
||||
PortableAction(0, PORT_ACT_RELOAD);
|
||||
}
|
||||
}
|
||||
|
||||
sniperMode = state; //Use reload button for precision aim also
|
||||
return;
|
||||
}
|
||||
|
||||
PortableAction(state,action);
|
||||
}
|
||||
|
||||
void EXPORT_ME
|
||||
JAVA_FUNC(analogFwd) (JNIEnv *env, jobject obj, jfloat v)
|
||||
{
|
||||
PortableMoveFwd(v);
|
||||
}
|
||||
|
||||
void EXPORT_ME
|
||||
JAVA_FUNC(analogSide) (JNIEnv *env, jobject obj,jfloat v)
|
||||
{
|
||||
PortableMoveSide(v);
|
||||
}
|
||||
|
||||
void EXPORT_ME
|
||||
JAVA_FUNC(analogPitch) (JNIEnv *env, jobject obj,jint mode,jfloat v)
|
||||
{
|
||||
if (sniperMode)
|
||||
v *= 0.1;
|
||||
|
||||
PortableLookPitch(mode, v);
|
||||
}
|
||||
|
||||
void EXPORT_ME
|
||||
JAVA_FUNC(analogYaw) (JNIEnv *env, jobject obj, jint mode,jfloat v)
|
||||
{
|
||||
if (sniperMode)
|
||||
v *= 0.1;
|
||||
|
||||
PortableLookYaw(mode, v);
|
||||
}
|
||||
|
||||
void EXPORT_ME
|
||||
JAVA_FUNC(setTouchSettings) (JNIEnv *env, jobject obj, jfloat alpha,jfloat strafe,jfloat fwd,jfloat pitch,jfloat yaw,int other)
|
||||
{
|
||||
setTouchSettings(alpha,strafe,fwd,pitch,yaw,other);
|
||||
}
|
||||
|
||||
std::string quickCommandString;
|
||||
jint EXPORT_ME
|
||||
JAVA_FUNC(quickCommand) (JNIEnv *env, jobject obj, jstring command)
|
||||
{
|
||||
const char * p = env->GetStringUTFChars(command,NULL);
|
||||
quickCommandString = std::string(p) + "\n";
|
||||
env->ReleaseStringUTFChars(command, p);
|
||||
PortableCommand(quickCommandString.c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void EXPORT_ME
|
||||
JAVA_FUNC(setScreenSize) ( JNIEnv* env, jobject thiz, jint width, jint height)
|
||||
{
|
||||
android_screen_width = width;
|
||||
android_screen_height = height;
|
||||
}
|
||||
|
||||
|
||||
void bqPause(int p);
|
||||
void EXPORT_ME
|
||||
JAVA_FUNC(pauseAudio) ( JNIEnv* env, jobject thiz, jint v)
|
||||
{
|
||||
bqPause(v);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static JNIEnv *my_getJNIEnv ( )
|
||||
{
|
||||
JNIEnv *pJNIEnv ;
|
||||
|
||||
if ( jvm_ && ( jvm_->GetEnv ( (void**) &pJNIEnv, JNI_VERSION_1_4 ) >= 0 ) )
|
||||
{
|
||||
return pJNIEnv ;
|
||||
}
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
}
|
|
@ -27,6 +27,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "cg_media.h"
|
||||
|
||||
#include "../game/g_roff.h"
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
bool in_camera = false;
|
||||
camera_t client_camera={};
|
||||
|
@ -41,6 +42,8 @@ void CGCam_DistanceDisable( void );
|
|||
extern qboolean CG_CalcFOVFromX( float fov_x );
|
||||
extern void WP_SaberCatch( gentity_t *self, gentity_t *saber, qboolean switchToSaber );
|
||||
|
||||
extern vr_client_info_t *vr;
|
||||
|
||||
/*
|
||||
TODO:
|
||||
CloseUp, FullShot & Longshot commands:
|
||||
|
@ -1179,7 +1182,8 @@ void CGCam_Update( void )
|
|||
}
|
||||
else
|
||||
{
|
||||
CG_CalcFOVFromX( client_camera.FOV );
|
||||
float fov = vr && vr->immersive_cinematics ? vr->fov : client_camera.FOV;
|
||||
CG_CalcFOVFromX( fov );
|
||||
}
|
||||
|
||||
//Check for roffing angles
|
||||
|
@ -1301,6 +1305,13 @@ void CGCam_Update( void )
|
|||
//Normal fading - separate call because can finish after camera is disabled
|
||||
CGCam_UpdateFade();
|
||||
|
||||
if (vr->immersive_cinematics)
|
||||
{
|
||||
float yaw = cg.refdefViewAngles[YAW] + vr->hmdorientation[YAW];
|
||||
VectorCopy(vr->hmdorientation, cg.refdefViewAngles);
|
||||
cg.refdefViewAngles[YAW] = yaw;
|
||||
}
|
||||
|
||||
//Update shaking if there's any
|
||||
//CGCam_UpdateSmooth( cg.refdef.vieworg, cg.refdefViewAngles );
|
||||
CGCam_UpdateShake( cg.refdef.vieworg, cg.refdefViewAngles );
|
||||
|
|
|
@ -4267,14 +4267,19 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
}
|
||||
|
||||
cg.refdef.worldscale = cg_worldScale.value;
|
||||
VectorCopy(cg.refdefViewAngles, cg.refdef.viewangles);
|
||||
if (!in_camera) {
|
||||
VectorCopy(vr->hmdorientation, cg.refdef.viewangles);
|
||||
cg.refdef.viewangles[YAW] =
|
||||
SHORT2ANGLE(cg.snap->ps.delta_angles[YAW]) + vr->hmdorientation[YAW] + vr->snapTurn;
|
||||
AnglesToAxis(cg.refdef.viewangles, cg.refdef.viewaxis);
|
||||
}
|
||||
|
||||
// clear around the rendered view if sized down
|
||||
CG_TileClear();
|
||||
|
||||
// offset vieworg appropriately if we're doing stereo separation
|
||||
VectorCopy( cg.refdef.vieworg, baseOrg );
|
||||
if ( separation != 0 ) {
|
||||
if ( separation != 0 && (!in_camera || vr->immersive_cinematics)) {
|
||||
VectorMA( cg.refdef.vieworg, -separation, cg.refdef.viewaxis[1], cg.refdef.vieworg );
|
||||
}
|
||||
|
||||
|
@ -4283,9 +4288,11 @@ void CG_DrawActive( stereoFrame_t stereoView ) {
|
|||
cgi_R_LAGoggles();
|
||||
}
|
||||
|
||||
//Vertical Positional Movement
|
||||
cg.refdef.vieworg[2] -= 64;
|
||||
cg.refdef.vieworg[2] += (vr->hmdposition[1] + cg_heightAdjust.value) * cg_worldScale.value;
|
||||
if (!in_camera) {
|
||||
//Vertical Positional Movement
|
||||
cg.refdef.vieworg[2] -= (float)g_entities[cg.snap->ps.viewEntity].client->ps.viewheight;
|
||||
cg.refdef.vieworg[2] += (vr->hmdposition[1] + cg_heightAdjust.value) * cg_worldScale.value;
|
||||
}
|
||||
|
||||
if ( (cg.snap->ps.forcePowersActive&(1<<FP_SEE)) )
|
||||
{
|
||||
|
|
|
@ -24,6 +24,59 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "cg_headers.h"
|
||||
|
||||
#include "cg_media.h"
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
extern vr_client_info_t *vr;
|
||||
|
||||
|
||||
void CG_AdjustFrom640( float *x, float *y, float *w, float *h ) {
|
||||
if (!vr->in_camera && !vr->using_screen_layer && !vr->scopeengaged)
|
||||
{
|
||||
float screenXScale = 1.0f / 3.5f;
|
||||
float screenYScale = 1.0f / 3.5f;
|
||||
|
||||
float xoffset = -24;
|
||||
if (cg.refdef.stereoView == 1) {
|
||||
xoffset *= -1;
|
||||
}
|
||||
|
||||
*x *= screenXScale;
|
||||
*y *= screenYScale;
|
||||
if (w != NULL) {
|
||||
*w *= screenXScale;
|
||||
}
|
||||
if (h != NULL) {
|
||||
*h *= screenYScale;
|
||||
}
|
||||
|
||||
*x += (640 - (640 * screenXScale)) / 2.0f + xoffset;
|
||||
*y += (480 - (480 * screenYScale)) / 2.0f;
|
||||
}
|
||||
}
|
||||
void CG_AdjustFrom640Int( int *x, int *y, int *w, int *h ) {
|
||||
if (!vr->in_camera && !vr->using_screen_layer && !vr->scopeengaged)
|
||||
{
|
||||
float screenXScale = 1.0f / 3.5f;
|
||||
float screenYScale = 1.0f / 3.5f;
|
||||
|
||||
float xoffset = -24;
|
||||
if (cg.refdef.stereoView == 1) {
|
||||
xoffset *= -1;
|
||||
}
|
||||
|
||||
*x *= screenXScale;
|
||||
*y *= screenYScale;
|
||||
if (w != NULL) {
|
||||
*w *= screenXScale;
|
||||
}
|
||||
if (h != NULL) {
|
||||
*h *= screenYScale;
|
||||
}
|
||||
|
||||
*x += (640 - (640 * screenXScale)) / 2.0f + xoffset;
|
||||
*y += (480 - (480 * screenYScale)) / 2.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -34,12 +87,14 @@ Coords are virtual 640x480
|
|||
*/
|
||||
void CG_DrawSides(float x, float y, float w, float h, float size) {
|
||||
//size *= cgs.screenXScale;
|
||||
CG_AdjustFrom640(&x, &y, &w, &h);
|
||||
cgi_R_DrawStretchPic( x, y, size, h, 0, 0, 0, 0, cgs.media.whiteShader );
|
||||
cgi_R_DrawStretchPic( x + w - size, y, size, h, 0, 0, 0, 0, cgs.media.whiteShader );
|
||||
}
|
||||
|
||||
void CG_DrawTopBottom(float x, float y, float w, float h, float size) {
|
||||
//size *= cgs.screenYScale;
|
||||
CG_AdjustFrom640(&x, &y, &w, &h);
|
||||
cgi_R_DrawStretchPic( x, y, w, size, 0, 0, 0, 0, cgs.media.whiteShader );
|
||||
cgi_R_DrawStretchPic( x, y + h - size, w, size, 0, 0, 0, 0, cgs.media.whiteShader );
|
||||
}
|
||||
|
@ -54,6 +109,7 @@ Coordinates are 640*480 virtual values
|
|||
void CG_DrawRect( float x, float y, float width, float height, float size, const float *color ) {
|
||||
cgi_R_SetColor( color );
|
||||
|
||||
CG_AdjustFrom640(&x, &y, &width, &height);
|
||||
CG_DrawTopBottom(x, y, width, height, size);
|
||||
CG_DrawSides(x, y, width, height, size);
|
||||
|
||||
|
@ -69,6 +125,7 @@ Coordinates are 640*480 virtual values
|
|||
*/
|
||||
void CG_FillRect( float x, float y, float width, float height, const float *color ) {
|
||||
cgi_R_SetColor( color );
|
||||
CG_AdjustFrom640(&x, &y, &width, &height);
|
||||
cgi_R_DrawStretchPic( x, y, width, height, 0, 0, 0, 0, cgs.media.whiteShader);
|
||||
cgi_R_SetColor( NULL );
|
||||
}
|
||||
|
@ -84,6 +141,7 @@ Coordinates are 640*480 virtual values
|
|||
void CG_Scissor( float x, float y, float width, float height)
|
||||
{
|
||||
|
||||
CG_AdjustFrom640(&x, &y, &width, &height);
|
||||
cgi_R_Scissor( x, y, width, height);
|
||||
|
||||
}
|
||||
|
@ -98,6 +156,7 @@ A width of 0 will draw with the original image width
|
|||
=================
|
||||
*/
|
||||
void CG_DrawPic( float x, float y, float width, float height, qhandle_t hShader ) {
|
||||
CG_AdjustFrom640(&x, &y, &width, &height);
|
||||
cgi_R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader );
|
||||
}
|
||||
|
||||
|
@ -112,6 +171,7 @@ Can also specify the exact texture coordinates
|
|||
*/
|
||||
void CG_DrawPic2( float x, float y, float width, float height, float s1, float t1, float s2, float t2, qhandle_t hShader )
|
||||
{
|
||||
CG_AdjustFrom640(&x, &y, &width, &height);
|
||||
cgi_R_DrawStretchPic( x, y, width, height, s1, t1, s2, t2, hShader );
|
||||
}
|
||||
|
||||
|
@ -125,6 +185,7 @@ rotates around the upper right corner of the passed in point
|
|||
=================
|
||||
*/
|
||||
void CG_DrawRotatePic( float x, float y, float width, float height,float angle, qhandle_t hShader ) {
|
||||
CG_AdjustFrom640(&x, &y, &width, &height);
|
||||
cgi_R_DrawRotatePic( x, y, width, height, 0, 0, 1, 1, angle, hShader );
|
||||
}
|
||||
|
||||
|
@ -138,6 +199,7 @@ Actually rotates around the center point of the passed in coordinates
|
|||
=================
|
||||
*/
|
||||
void CG_DrawRotatePic2( float x, float y, float width, float height,float angle, qhandle_t hShader ) {
|
||||
CG_AdjustFrom640(&x, &y, &width, &height);
|
||||
cgi_R_DrawRotatePic2( x, y, width, height, 0, 0, 1, 1, angle, hShader );
|
||||
}
|
||||
|
||||
|
@ -185,6 +247,7 @@ void CG_DrawChar( int x, int y, int width, int height, int ch ) {
|
|||
size = 0.03125;
|
||||
size2 = 0.0625;
|
||||
|
||||
CG_AdjustFrom640(&ax, &ay, &aw, &ah);
|
||||
cgi_R_DrawStretchPic( ax, ay, aw, ah, fcol, frow, fcol + size, frow + size2,
|
||||
cgs.media.charsetShader );
|
||||
|
||||
|
@ -248,7 +311,10 @@ void CG_DrawStringExt( int x, int y, const char *string, const float *setColor,
|
|||
|
||||
|
||||
void CG_DrawSmallStringColor( int x, int y, const char *s, vec4_t color ) {
|
||||
CG_DrawStringExt( x, y, s, color, qtrue, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT );
|
||||
auto fx = (float)x;
|
||||
auto fy = (float)y;
|
||||
CG_AdjustFrom640(&fx, &fy, NULL, NULL);
|
||||
CG_DrawStringExt( (int)fx, (int)fy, s, color, qtrue, qfalse, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -285,6 +351,8 @@ refresh window.
|
|||
static void CG_TileClearBox( int x, int y, int w, int h, qhandle_t hShader ) {
|
||||
float s1, t1, s2, t2;
|
||||
|
||||
// CG_AdjustFrom640Int(&x, &y, &w, &h);
|
||||
|
||||
s1 = x/64.0;
|
||||
t1 = y/64.0;
|
||||
s2 = (x+w)/64.0;
|
||||
|
@ -430,17 +498,22 @@ void CG_DrawNumField (int x, int y, int width, int value,int charWidth,int charH
|
|||
{
|
||||
for (int i = 0; i < (width - l); i++ )
|
||||
{
|
||||
int _x = x;
|
||||
int _y = y;
|
||||
int _charWidth = charWidth;
|
||||
int _charHeight = charHeight;
|
||||
//CG_AdjustFrom640Int(&_x, &_y, &_charWidth, &_charHeight);
|
||||
switch(style)
|
||||
{
|
||||
case NUM_FONT_SMALL:
|
||||
CG_DrawPic( x,y, charWidth, charHeight, cgs.media.smallnumberShaders[0] );
|
||||
CG_DrawPic( _x,_y, _charWidth, _charHeight, cgs.media.smallnumberShaders[0] );
|
||||
break;
|
||||
case NUM_FONT_CHUNKY:
|
||||
CG_DrawPic( x,y, charWidth, charHeight, cgs.media.chunkyNumberShaders[0] );
|
||||
CG_DrawPic( _x,_y, _charWidth, _charHeight, cgs.media.chunkyNumberShaders[0] );
|
||||
break;
|
||||
default:
|
||||
case NUM_FONT_BIG:
|
||||
CG_DrawPic( x,y, charWidth, charHeight, cgs.media.numberShaders[0] );
|
||||
CG_DrawPic( _x,_y, _charWidth, _charHeight, cgs.media.numberShaders[0] );
|
||||
break;
|
||||
}
|
||||
x += 2 + (xWidth);
|
||||
|
@ -459,18 +532,23 @@ void CG_DrawNumField (int x, int y, int width, int value,int charWidth,int charH
|
|||
else
|
||||
frame = *ptr -'0';
|
||||
|
||||
int _x = x;
|
||||
int _y = y;
|
||||
int _charWidth = charWidth;
|
||||
int _charHeight = charHeight;
|
||||
//CG_AdjustFrom640Int(&_x, &_y, &_charWidth, &_charHeight);
|
||||
switch(style)
|
||||
{
|
||||
case NUM_FONT_SMALL:
|
||||
CG_DrawPic( x,y, charWidth, charHeight, cgs.media.smallnumberShaders[frame] );
|
||||
CG_DrawPic( _x, _y, _charWidth, _charHeight, cgs.media.smallnumberShaders[frame] );
|
||||
x++; // For a one line gap
|
||||
break;
|
||||
case NUM_FONT_CHUNKY:
|
||||
CG_DrawPic( x,y, charWidth, charHeight, cgs.media.chunkyNumberShaders[frame] );
|
||||
CG_DrawPic( _x, _y, _charWidth, _charHeight, cgs.media.chunkyNumberShaders[frame] );
|
||||
break;
|
||||
default:
|
||||
case NUM_FONT_BIG:
|
||||
CG_DrawPic( x,y, charWidth, charHeight, cgs.media.numberShaders[frame] );
|
||||
CG_DrawPic( _x, _y, _charWidth, _charHeight, cgs.media.numberShaders[frame] );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -489,5 +567,6 @@ CG_DrawProportionalString
|
|||
void CG_DrawProportionalString( int x, int y, const char* str, int style, vec4_t color )
|
||||
{
|
||||
//assert(!style);//call this directly if you need style (OR it into the font handle)
|
||||
CG_AdjustFrom640Int(&x, &y, NULL, NULL);
|
||||
cgi_R_Font_DrawString (x, y, str, color, cgs.media.qhFontMedium, -1, 1.0f);
|
||||
}
|
|
@ -657,6 +657,28 @@ extern vmCvar_t cg_fovViewmodelAdjust;
|
|||
|
||||
extern vmCvar_t cg_scaleVehicleSensitivity;
|
||||
|
||||
|
||||
//VR Weapon Offsets
|
||||
extern vmCvar_t vr_weapon_adjustment_1;
|
||||
extern vmCvar_t vr_weapon_adjustment_2;
|
||||
extern vmCvar_t vr_weapon_adjustment_3;
|
||||
extern vmCvar_t vr_weapon_adjustment_4;
|
||||
extern vmCvar_t vr_weapon_adjustment_5;
|
||||
extern vmCvar_t vr_weapon_adjustment_6;
|
||||
extern vmCvar_t vr_weapon_adjustment_7;
|
||||
extern vmCvar_t vr_weapon_adjustment_8;
|
||||
extern vmCvar_t vr_weapon_adjustment_9;
|
||||
extern vmCvar_t vr_weapon_adjustment_10;
|
||||
extern vmCvar_t vr_weapon_adjustment_11;
|
||||
extern vmCvar_t vr_weapon_adjustment_12;
|
||||
extern vmCvar_t vr_weapon_adjustment_13;
|
||||
extern vmCvar_t vr_weapon_adjustment_14;
|
||||
extern vmCvar_t vr_weapon_adjustment_18;
|
||||
extern vmCvar_t vr_weapon_adjustment_19;
|
||||
extern vmCvar_t vr_weapon_adjustment_20;
|
||||
extern vmCvar_t vr_weapon_adjustment_22;
|
||||
|
||||
|
||||
void CG_NewClientinfo( int clientNum );
|
||||
//
|
||||
// cg_main.c
|
||||
|
@ -822,7 +844,6 @@ void CG_DPPrevInventory_f( void );
|
|||
void CG_DPNextForcePower_f( void );
|
||||
void CG_DPPrevForcePower_f( void );
|
||||
|
||||
|
||||
void CG_RegisterWeapon( int weaponNum );
|
||||
void CG_RegisterItemVisuals( int itemNum );
|
||||
void CG_RegisterItemSounds( int itemNum );
|
||||
|
@ -931,6 +952,7 @@ int cgi_Milliseconds( void );
|
|||
void cgi_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
|
||||
void cgi_Cvar_Update( vmCvar_t *vmCvar );
|
||||
void cgi_Cvar_Set( const char *var_name, const char *value );
|
||||
char* cgi_Cvar_Get( const char *var_name );
|
||||
|
||||
|
||||
// ServerCommand and ConsoleCommand parameter access
|
||||
|
|
|
@ -127,8 +127,8 @@ temporary marks will not be stored or randomly oriented, but immediately
|
|||
passed to the renderer.
|
||||
=================
|
||||
*/
|
||||
#define MAX_MARK_FRAGMENTS 128
|
||||
#define MAX_MARK_POINTS 384
|
||||
#define MAX_MARK_FRAGMENTS 256
|
||||
#define MAX_MARK_POINTS 768
|
||||
|
||||
void CG_ImpactMark( qhandle_t markShader, const vec3_t origin, const vec3_t dir, float orientation, float red,
|
||||
float green, float blue, float alpha, qboolean alphaFade, float radius, qboolean temporary )
|
||||
|
@ -227,8 +227,8 @@ void CG_ImpactMark( qhandle_t markShader, const vec3_t origin, const vec3_t dir,
|
|||
CG_AddMarks
|
||||
===============
|
||||
*/
|
||||
#define MARK_TOTAL_TIME 10000
|
||||
#define MARK_FADE_TIME 1000
|
||||
#define MARK_TOTAL_TIME 20000
|
||||
#define MARK_FADE_TIME 10000
|
||||
|
||||
void CG_AddMarks( void ) {
|
||||
int j;
|
||||
|
|
|
@ -31,6 +31,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "../game/wp_saber.h"
|
||||
#include "../game/g_vehicles.h"
|
||||
#include "../Rufl/hstring.h"
|
||||
#include "bg_local.h"
|
||||
|
||||
#define LOOK_SWING_SCALE 0.5f
|
||||
#define CG_SWINGSPEED 0.3f
|
||||
|
@ -8178,7 +8179,14 @@ Ghoul2 Insert End
|
|||
//FIXME: allow it to be put anywhere and move this out of if(torso.hModel)
|
||||
//Will have to call CG_PositionRotatedEntityOnTag
|
||||
|
||||
CG_PositionEntityOnTag( &gun, &torso, torso.hModel, "tag_weapon");
|
||||
//CG_PositionEntityOnTag( &gun, &torso, torso.hModel, "tag_weapon");
|
||||
|
||||
vec3_t angs;
|
||||
BG_CalculateVRWeaponPosition(gun.origin, angs);
|
||||
AnglesToAxis(angs, gun.axis);
|
||||
//Gotta move this forward but test for now
|
||||
VectorCopy( gun.origin, gun.lightingOrigin );
|
||||
|
||||
|
||||
//--------------------- start saber hacks
|
||||
/*
|
||||
|
|
|
@ -221,6 +221,7 @@ Ghoul2 Insert End
|
|||
|
||||
CG_OPENJK_MENU_PAINT,
|
||||
CG_OPENJK_GETMENU_BYNAME,
|
||||
CG_CVAR_GET
|
||||
} cgameImport_t;
|
||||
|
||||
#ifdef JK2_MODE
|
||||
|
|
|
@ -68,6 +68,10 @@ void cgi_Cvar_Set( const char *var_name, const char *value ) {
|
|||
Q_syscall( CG_CVAR_SET, var_name, value );
|
||||
}
|
||||
|
||||
char* cgi_Cvar_Get( const char *var_name ) {
|
||||
return (char*)Q_syscall( CG_CVAR_GET, var_name );
|
||||
}
|
||||
|
||||
int cgi_Argc( void ) {
|
||||
return Q_syscall( CG_ARGC );
|
||||
}
|
||||
|
|
|
@ -1393,8 +1393,8 @@ static qboolean CG_CalcFov( void ) {
|
|||
}
|
||||
else if ( (!cg.zoomMode || cg.zoomMode > 2) && (cg.snap->ps.forcePowersActive&(1<<FP_SPEED)) && player->client->ps.forcePowerDuration[FP_SPEED] )//cg.renderingThirdPerson &&
|
||||
{
|
||||
//fov_x = CG_ForceSpeedFOV();
|
||||
fov_x = vr ? vr->fov : 90.0f;
|
||||
fov_x = CG_ForceSpeedFOV();
|
||||
//fov_x = vr ? vr->fov : 90.0f;
|
||||
} else {
|
||||
/*
|
||||
// user selectable
|
||||
|
@ -1941,6 +1941,10 @@ static void CG_DrawSkyBoxPortal(void)
|
|||
cg.refdef.rdflags |= RDF_DRAWSKYBOX; //drawk portal skies
|
||||
|
||||
cgi_CM_SnapPVS( cg.refdef.vieworg, cg.refdef.areamask ); //fill in my areamask for this view origin
|
||||
|
||||
//Don't need any special adjustment for the sky box afaik
|
||||
VectorCopy(vr->hmdorientation, cg.refdef.viewangles);
|
||||
|
||||
// draw the skybox
|
||||
cgi_R_RenderScene( &cg.refdef );
|
||||
|
||||
|
@ -2086,11 +2090,13 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) {
|
|||
}
|
||||
cgi_SetUserCmdValue( cg.weaponSelect, speed, mPitchOverride, mYawOverride );
|
||||
|
||||
// this counter will be bumped for every valid scene we generate
|
||||
cg.clientFrame++;
|
||||
if ( stereoView == STEREO_LEFT ) {
|
||||
// this counter will be bumped for every valid scene we generate
|
||||
cg.clientFrame++;
|
||||
|
||||
// update cg.predicted_player_state
|
||||
CG_PredictPlayerState();
|
||||
// update cg.predicted_player_state
|
||||
CG_PredictPlayerState();
|
||||
}
|
||||
|
||||
if (cg.snap->ps.eFlags&EF_HELD_BY_SAND_CREATURE)
|
||||
{
|
||||
|
@ -2101,8 +2107,11 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) {
|
|||
cg_thirdPerson.integer
|
||||
|| (cg.snap->ps.stats[STAT_HEALTH] <= 0)
|
||||
|| (cg.snap->ps.eFlags&EF_HELD_BY_SAND_CREATURE)
|
||||
|| ((g_entities[0].client&&g_entities[0].client->NPC_class==CLASS_ATST)
|
||||
|| (cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_MELEE) ));
|
||||
|| (
|
||||
(g_entities[0].client&&g_entities[0].client->NPC_class==CLASS_ATST)
|
||||
|| (cg.snap->ps.weapon == WP_SABER || cg.snap->ps.weapon == WP_MELEE)
|
||||
)
|
||||
);
|
||||
|
||||
if ( cg.zoomMode )
|
||||
{
|
||||
|
@ -2110,6 +2119,7 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView ) {
|
|||
cg.renderingThirdPerson = qfalse;
|
||||
}
|
||||
|
||||
vr->in_camera = in_camera;
|
||||
if ( in_camera )
|
||||
{
|
||||
// The camera takes over the view
|
||||
|
|
|
@ -29,6 +29,10 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "../game/g_vehicles.h"
|
||||
|
||||
#include "../game/anims.h"
|
||||
#include <bg_local.h>
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
extern vr_client_info_t *vr;
|
||||
|
||||
extern void CG_LightningBolt( centity_t *cent, vec3_t origin );
|
||||
|
||||
|
@ -862,6 +866,82 @@ void CG_CalculateWeaponPosition( vec3_t origin, vec3_t angles )
|
|||
angles[PITCH] += (scale * 0.5f ) * fracsin * 0.01;
|
||||
}
|
||||
|
||||
static float CG_CalculateWeaponPositionAndScale( playerState_t *ps, vec3_t origin, vec3_t angles ) {
|
||||
|
||||
BG_CalculateVRWeaponPosition(origin, angles);
|
||||
|
||||
vec3_t offset;
|
||||
|
||||
//Weapon offset debugging
|
||||
float scale=1.0f;
|
||||
if (strcmp(cgi_Cvar_Get("vr_control_scheme"), "99") == 0) {
|
||||
vr->weaponid = ps->weapon;
|
||||
scale = vr->test_scale;
|
||||
|
||||
//Adjust angles for weapon models that aren't aligned very well
|
||||
matrix4x4 m1, m2, m3;
|
||||
vec3_t zero;
|
||||
VectorClear(zero);
|
||||
Matrix4x4_CreateFromEntity(m1, angles, zero, 1.0);
|
||||
Matrix4x4_CreateFromEntity(m2, vr->test_angles, zero, 1.0);
|
||||
Matrix4x4_Concat(m3, m1, m2);
|
||||
Matrix4x4_ConvertToEntity(m3, angles, zero);
|
||||
|
||||
VectorCopy(vr->test_offset, offset);
|
||||
|
||||
CG_CenterPrint( vr->test_name, SMALLCHAR_WIDTH );
|
||||
} else {
|
||||
if (ps->weapon != 0)
|
||||
{
|
||||
char cvar_name[64];
|
||||
Com_sprintf(cvar_name, sizeof(cvar_name), "vr_weapon_adjustment_%i", ps->weapon);
|
||||
|
||||
char* weapon_adjustment = cgi_Cvar_Get(cvar_name);
|
||||
|
||||
if (strlen(weapon_adjustment) > 0) {
|
||||
vec3_t adjust;
|
||||
vec3_t temp_offset;
|
||||
VectorClear(temp_offset);
|
||||
VectorClear(adjust);
|
||||
|
||||
sscanf(weapon_adjustment, "%f,%f,%f,%f,%f,%f,%f", &scale,
|
||||
&(temp_offset[0]), &(temp_offset[1]), &(temp_offset[2]),
|
||||
&(adjust[PITCH]), &(adjust[YAW]), &(adjust[ROLL]));
|
||||
VectorScale(temp_offset, scale, offset);
|
||||
|
||||
if (!vr->right_handed)
|
||||
{
|
||||
//yaw needs to go in the other direction as left handed model is reversed
|
||||
adjust[YAW] *= -1.0f;
|
||||
}
|
||||
|
||||
//Adjust angles for weapon models that aren't aligned very well
|
||||
matrix4x4 m1, m2, m3;
|
||||
vec3_t zero;
|
||||
VectorClear(zero);
|
||||
Matrix4x4_CreateFromEntity(m1, angles, zero, 1.0);
|
||||
Matrix4x4_CreateFromEntity(m2, adjust, zero, 1.0);
|
||||
Matrix4x4_Concat(m3, m1, m2);
|
||||
Matrix4x4_ConvertToEntity(m3, angles, zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Now move weapon closer to proper origin
|
||||
vec3_t forward, right, up;
|
||||
AngleVectors( angles, forward, right, up );
|
||||
VectorMA( origin, offset[2], forward, origin );
|
||||
VectorMA( origin, offset[1], up, origin );
|
||||
if (vr->right_handed) {
|
||||
VectorMA(origin, offset[0], right, origin);
|
||||
} else {
|
||||
VectorMA(origin, -offset[0], right, origin);
|
||||
}
|
||||
|
||||
return scale;
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
CG_MachinegunSpinAngle
|
||||
|
@ -1103,8 +1183,32 @@ void CG_AddViewWeapon( playerState_t *ps )
|
|||
weapon->firingSound );
|
||||
}
|
||||
|
||||
// set up gun position
|
||||
CG_CalculateWeaponPosition( hand.origin, angles );
|
||||
if (strcmp(cgi_Cvar_Get("vr_control_scheme"), "99") == 0) {
|
||||
vec3_t origin;
|
||||
vec3_t endForward, endRight, endUp;
|
||||
vec3_t angles;
|
||||
clientInfo_t ci;
|
||||
BG_CalculateVRWeaponPosition( origin, angles );
|
||||
|
||||
vec3_t forward, right, up;
|
||||
AngleVectors(angles, forward, right, up);
|
||||
|
||||
trace_t trace;
|
||||
VectorMA(origin, 256, forward, endForward);
|
||||
CG_TestLine(origin, endForward, FRAMETIME, 0xFF0000, 0.5 );
|
||||
|
||||
VectorMA(origin, 20, right, endRight);
|
||||
CG_TestLine(origin, endRight, FRAMETIME, 0x00FF00, 0.5 );
|
||||
|
||||
VectorMA(origin, 20, up, endUp);
|
||||
CG_TestLine(origin, endUp, FRAMETIME, 0x0000FF, 0.5 );
|
||||
|
||||
CG_CenterPrint(vr->test_name, 240);
|
||||
|
||||
}
|
||||
|
||||
// set up gun position
|
||||
float scale = CG_CalculateWeaponPositionAndScale( ps, hand.origin, angles );
|
||||
|
||||
vec3_t extraOffset;
|
||||
extraOffset[0] = extraOffset[1] = extraOffset[2] = 0.0f;
|
||||
|
@ -1119,19 +1223,23 @@ void CG_AddViewWeapon( playerState_t *ps )
|
|||
VectorMA( hand.origin, cg_gun_x.value+extraOffset[0], cg.refdef.viewaxis[0], hand.origin );
|
||||
VectorMA( hand.origin, (cg_gun_y.value+leanOffset+extraOffset[1]), cg.refdef.viewaxis[1], hand.origin );
|
||||
VectorMA( hand.origin, (cg_gun_z.value+fovOffset+extraOffset[2]), cg.refdef.viewaxis[2], hand.origin );
|
||||
//VectorMA( hand.origin, 0, cg.refdef.viewaxis[0], hand.origin );
|
||||
//VectorMA( hand.origin, (0+leanOffset), cg.refdef.viewaxis[1], hand.origin );
|
||||
//VectorMA( hand.origin, (0+fovOffset), cg.refdef.viewaxis[2], hand.origin );
|
||||
|
||||
AnglesToAxis( angles, hand.axis );
|
||||
AnglesToAxis(angles, hand.axis);
|
||||
|
||||
//scale the whole model (hand and weapon)
|
||||
for ( int i = 0; i < 3; i++ ) {
|
||||
VectorScale( hand.axis[i], (vr->right_handed || i != 1 ) ? scale : -scale, hand.axis[i] );
|
||||
}
|
||||
|
||||
if ( cg_fovViewmodel.integer ) {
|
||||
//Gotta move this forward but test for now
|
||||
VectorCopy( hand.origin, hand.lightingOrigin );
|
||||
|
||||
/* if ( cg_fovViewmodel.integer ) {
|
||||
float fracDistFOV = tanf( cg.refdef.fov_x * ( M_PI/180 ) * 0.5f );
|
||||
float fracWeapFOV = (1.0f / fracDistFOV) * tanf( actualFOV * (M_PI / 180) * 0.5f );
|
||||
VectorScale( hand.axis[0], fracWeapFOV, hand.axis[0] );
|
||||
}
|
||||
|
||||
*/
|
||||
// map torso animations to weapon animations
|
||||
#ifndef FINAL_BUILD
|
||||
if ( cg_gun_frame.integer )
|
||||
|
|
|
@ -25,7 +25,6 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
// leave this as first line for PCH reasons...
|
||||
//
|
||||
#include <JKVR/VrCommon.h>
|
||||
#include "../server/exe_headers.h"
|
||||
#include "../ui/ui_shared.h"
|
||||
|
||||
|
@ -33,6 +32,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "vmachine.h"
|
||||
#include "qcommon/stringed_ingame.h"
|
||||
#include "sys/sys_loadlib.h"
|
||||
#include <JKVR/VrCommon.h>
|
||||
|
||||
vm_t cgvm;
|
||||
/*
|
||||
|
@ -69,7 +69,7 @@ qboolean CL_InitCGameVM( void *gameLibrary )
|
|||
|
||||
if ( !cgvm.entryPoint || !dllEntry ) {
|
||||
#ifdef JK2_MODE
|
||||
const char *gamename = "jospgame";
|
||||
const char *gamename = "jogame";
|
||||
#else
|
||||
const char *gamename = "jagame";
|
||||
#endif
|
||||
|
@ -827,6 +827,8 @@ intptr_t CL_CgameSystemCalls( intptr_t *args ) {
|
|||
case CG_CVAR_SET:
|
||||
Cvar_Set( (const char *) VMA(1), (const char *) VMA(2) );
|
||||
return 0;
|
||||
case CG_CVAR_GET:
|
||||
return (intptr_t)Cvar_VariableString( (const char *) VMA(1));
|
||||
case CG_ARGC:
|
||||
return Cmd_Argc();
|
||||
case CG_ARGV:
|
||||
|
@ -1465,12 +1467,16 @@ void CL_CGameRendering( stereoFrame_t stereo ) {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
int timei=cl.serverTime;
|
||||
if (timei>60)
|
||||
{
|
||||
timei-=0;
|
||||
//Only update server time if we are starting a new pair of frames
|
||||
static int timei=0;
|
||||
if (stereo == STEREO_LEFT) {
|
||||
timei = cl.serverTime;
|
||||
if (timei > 60) {
|
||||
timei -= 0;
|
||||
}
|
||||
re.G2API_SetTime(cl.serverTime, G2T_CG_TIME);
|
||||
}
|
||||
re.G2API_SetTime(cl.serverTime,G2T_CG_TIME);
|
||||
|
||||
VM_Call( CG_DRAW_ACTIVE_FRAME,timei, stereo, qfalse );
|
||||
// VM_Debug( 0 );
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
#include "client.h"
|
||||
#include "client_ui.h"
|
||||
#include <JKVR/VrCommon.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <cmath>
|
||||
|
@ -424,6 +425,8 @@ void CL_AdjustAngles( void ) {
|
|||
cl.viewangles[PITCH] = new_move.pitch;
|
||||
|
||||
cl.viewangles[ROLL] = new_move.roll;
|
||||
|
||||
VectorCopy(cl.viewangles, vr.clientviewangles);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -931,7 +931,7 @@ CL_InitRenderer
|
|||
*/
|
||||
void CL_InitRenderer( void ) {
|
||||
// this sets up the renderer and calls R_Init
|
||||
re.BeginRegistration( &cls.glconfig );
|
||||
re.BeginRegistration( &cls.glconfig, (intptr_t )&vr );
|
||||
|
||||
// load character sets
|
||||
cls.charSetShader = re.RegisterShaderNoMip("gfx/2d/charsgrid_med");
|
||||
|
@ -1184,6 +1184,7 @@ void CL_InitRef( void ) {
|
|||
rit.saved_game = &ojk::SavedGame::get_instance();
|
||||
|
||||
rit.JKVR_prepareEyeBuffer = JKVR_prepareEyeBuffer;
|
||||
rit.JKVR_useScreenLayer = JKVR_useScreenLayer;
|
||||
|
||||
ret = GetRefAPI( REF_API_VERSION, &rit );
|
||||
|
||||
|
|
|
@ -78,6 +78,11 @@ void PM_AddEvent( int newEvent );
|
|||
qboolean PM_SlideMove( float gravity );
|
||||
void PM_StepSlideMove( float gravity );
|
||||
|
||||
void rotateAboutOrigin(float x, float y, float rotation, vec2_t out);
|
||||
void BG_CalculateVRWeaponPosition( vec3_t origin, vec3_t angles );
|
||||
void BG_CalculateVROffHandPosition( vec3_t origin, vec3_t angles );
|
||||
void BG_ConvertFromVR(vec3_t in, vec3_t offset, vec3_t out);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "bg_public.h"
|
||||
#include "g_items.h"
|
||||
#include "g_vehicles.h"
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
extern vr_client_info_t *vr;
|
||||
|
||||
|
||||
extern weaponData_t weaponData[WP_NUM_WEAPONS];
|
||||
|
@ -705,6 +708,56 @@ void PlayerStateToEntityState( playerState_t *ps, entityState_t *s )
|
|||
}
|
||||
|
||||
|
||||
void rotateAboutOrigin(float x, float y, float rotation, vec2_t out)
|
||||
{
|
||||
out[0] = cosf(DEG2RAD(-rotation)) * x + sinf(DEG2RAD(-rotation)) * y;
|
||||
out[1] = cosf(DEG2RAD(-rotation)) * y - sinf(DEG2RAD(-rotation)) * x;
|
||||
}
|
||||
|
||||
void BG_ConvertFromVR(vec3_t in, vec3_t offset, vec3_t out)
|
||||
{
|
||||
vec3_t vrSpace;
|
||||
VectorSet(vrSpace, in[2], in[0], in[1] );
|
||||
|
||||
vec2_t r;
|
||||
rotateAboutOrigin(vrSpace[0], vrSpace[1], cg.refdefViewAngles[YAW] - vr->hmdorientation[YAW], r);
|
||||
|
||||
vrSpace[0] = -r[0];
|
||||
vrSpace[1] = -r[1];
|
||||
|
||||
vec3_t temp;
|
||||
VectorScale(vrSpace, cg_worldScale.value, temp);
|
||||
|
||||
if (offset) {
|
||||
VectorAdd(temp, offset, out);
|
||||
} else {
|
||||
VectorCopy(temp, out);
|
||||
}
|
||||
}
|
||||
|
||||
static void BG_CalculateVRPositionInWorld( vec3_t in_position, vec3_t in_offset, vec3_t in_orientation, vec3_t origin, vec3_t angles )
|
||||
{
|
||||
vec3_t offset;
|
||||
VectorCopy(in_offset, offset);
|
||||
offset[1] = 0; // up/down is index 1 in this case
|
||||
BG_ConvertFromVR(offset, cg.refdef.vieworg, origin);
|
||||
origin[2] -= (float)g_entities[cg.snap->ps.viewEntity].client->ps.viewheight;
|
||||
origin[2] += in_position[1] * cg_worldScale.value;
|
||||
|
||||
VectorCopy(in_orientation, angles);
|
||||
angles[YAW] += (cg.refdefViewAngles[YAW] - vr->hmdorientation[YAW]);
|
||||
}
|
||||
|
||||
void BG_CalculateVROffHandPosition( vec3_t origin, vec3_t angles )
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->offhandposition, vr->offhandoffset, vr->offhandangles, origin, angles);
|
||||
}
|
||||
|
||||
void BG_CalculateVRWeaponPosition( vec3_t origin, vec3_t angles )
|
||||
{
|
||||
BG_CalculateVRPositionInWorld(vr->weaponposition, vr->weaponoffset, vr->weaponangles, origin, angles);
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
BG_PlayerTouchesItem
|
||||
|
|
|
@ -9036,7 +9036,7 @@ static void PM_FinishWeaponChange( void ) {
|
|||
WP_SaberInitBladeData( pm->gent );
|
||||
if ( (pm->ps->clientNum < MAX_CLIENTS||PM_ControlledByPlayer()) )
|
||||
{
|
||||
gi.cvar_set( "cg_thirdperson", "1" );
|
||||
//gi.cvar_set( "cg_thirdperson", "1" );
|
||||
}
|
||||
}
|
||||
if ( trueSwitch )
|
||||
|
|
|
@ -26,6 +26,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "wp_saber.h"
|
||||
#include "w_local.h"
|
||||
|
||||
#include "bg_local.h"
|
||||
|
||||
|
||||
//---------------
|
||||
// Blaster
|
||||
|
@ -117,7 +119,13 @@ void WP_FireBlaster( gentity_t *ent, qboolean alt_fire )
|
|||
{
|
||||
vec3_t dir, angs;
|
||||
|
||||
vectoangles( forwardVec, angs );
|
||||
if ( ent->client && !ent->NPC)
|
||||
{
|
||||
BG_CalculateVRWeaponPosition(muzzle, angs);
|
||||
}
|
||||
else {
|
||||
vectoangles(forwardVec, angs);
|
||||
}
|
||||
|
||||
if ( ent->client && ent->client->NPC_class == CLASS_VEHICLE )
|
||||
{//no inherent aim screw up
|
||||
|
|
|
@ -990,6 +990,8 @@ void Com_ExecuteCfg(void)
|
|||
Cbuf_ExecuteText(EXEC_NOW, "exec " Q3CONFIG_NAME "\n");
|
||||
Cbuf_Execute();
|
||||
Cbuf_ExecuteText(EXEC_NOW, "exec autoexec_sp.cfg\n");
|
||||
//Execute to overwrite weapon locations with our desired adjustments
|
||||
Cbuf_AddText( "exec weapons_vr.cfg\n" );
|
||||
Cbuf_Execute();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@ typedef struct {
|
|||
|
||||
//JKVR Functions
|
||||
void (*JKVR_prepareEyeBuffer) (int eye );
|
||||
bool (*JKVR_useScreenLayer) ( void );
|
||||
|
||||
} refimport_t;
|
||||
|
||||
|
@ -152,7 +153,7 @@ typedef struct {
|
|||
// and returns the current gl configuration, including screen width
|
||||
// and height, which can be used by the client to intelligently
|
||||
// size display elements
|
||||
void (*BeginRegistration)( glconfig_t *config );
|
||||
void (*BeginRegistration)( glconfig_t *config, intptr_t pVrClientInfo );
|
||||
qhandle_t (*RegisterModel)( const char *name );
|
||||
qhandle_t (*RegisterSkin)( const char *name );
|
||||
int (*GetAnimationCFG)(const char *psCFGFilename, char *psDest, int iDestSize);
|
||||
|
|
|
@ -135,7 +135,7 @@ typedef struct {
|
|||
|
||||
vec3_t axis[3]; // rotation vectors
|
||||
qboolean nonNormalizedAxes; // axis are not normalized, i.e. they have scale
|
||||
float origin[3]; // also used as MODEL_BEAM's "from"
|
||||
vec3_t origin; // also used as MODEL_BEAM's "from"
|
||||
int frame; // also used as MODEL_BEAM's diameter
|
||||
|
||||
// previous data for frame interpolation
|
||||
|
@ -196,7 +196,7 @@ typedef struct {
|
|||
vec3_t vieworg;
|
||||
vec3_t viewaxis[3]; // transformation matrix
|
||||
int viewContents; // world contents at vieworg
|
||||
vec3_t viewangles;
|
||||
vec3_t viewangles; //adjusted viewangles for rendering
|
||||
|
||||
// time in milliseconds for shader effects and other time dependent rendering issues
|
||||
int time;
|
||||
|
|
|
@ -1403,8 +1403,6 @@ const void *RB_DrawSurfs( const void *data ) {
|
|||
return (const void *)(cmd + 1);
|
||||
}
|
||||
|
||||
void JKVR_prepareEyeBuffer(int eye );
|
||||
|
||||
/*
|
||||
=============
|
||||
RB_DrawBuffer
|
||||
|
|
|
@ -1314,7 +1314,7 @@ void RE_GetScreenShot(byte *data, int w, int h);
|
|||
byte* RE_TempRawImage_ReadFromFile(const char *psLocalFilename, int *piWidth, int *piHeight, byte *pbReSampleBuffer, qboolean qbVertFlip);
|
||||
void RE_TempRawImage_CleanUp();
|
||||
|
||||
void RE_BeginRegistration( glconfig_t *glconfig );
|
||||
void RE_BeginRegistration( glconfig_t *glconfig, intptr_t pVrClientInfo );
|
||||
void RE_LoadWorldMap( const char *mapname );
|
||||
void RE_SetWorldVisData( const byte *vis );
|
||||
qhandle_t RE_RegisterModel( const char *name );
|
||||
|
|
|
@ -27,6 +27,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "../server/exe_headers.h"
|
||||
|
||||
#include "tr_local.h"
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
#if !defined(G2_H_INC)
|
||||
#include "../ghoul2/G2.h"
|
||||
|
@ -34,6 +35,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
trGlobals_t tr;
|
||||
|
||||
vr_client_info_t *vr;
|
||||
|
||||
static float s_flipMatrix[16] = {
|
||||
// convert from our coordinate system (looking down X)
|
||||
// to OpenGL's coordinate system (looking down -Z)
|
||||
|
|
|
@ -30,6 +30,9 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "tr_local.h"
|
||||
#include "qcommon/matcomp.h"
|
||||
#include "../qcommon/sstring.h"
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
extern vr_client_info_t *vr;
|
||||
|
||||
#define LL(x) x=LittleLong(x)
|
||||
#define LS(x) x=LittleShort(x)
|
||||
|
@ -977,12 +980,13 @@ void CM_SetupShaderProperties(void);
|
|||
/*
|
||||
** RE_BeginRegistration
|
||||
*/
|
||||
void RE_BeginRegistration( glconfig_t *glconfigOut ) {
|
||||
void RE_BeginRegistration( glconfig_t *glconfigOut, intptr_t pVrClientInfo ) {
|
||||
ri.Hunk_ClearToMark();
|
||||
|
||||
R_Init();
|
||||
|
||||
*glconfigOut = glConfig;
|
||||
vr = (vr_client_info_t*)pVrClientInfo;
|
||||
|
||||
R_IssuePendingRenderCommands();
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "../server/exe_headers.h"
|
||||
|
||||
#include "tr_local.h"
|
||||
#include <JKVR/VrClientInfo.h>
|
||||
|
||||
int r_firstSceneDrawSurf;
|
||||
|
||||
|
@ -42,6 +43,8 @@ int r_numpolyverts;
|
|||
int skyboxportal;
|
||||
int drawskyboxportal;
|
||||
|
||||
extern vr_client_info_t *vr;
|
||||
|
||||
/*
|
||||
====================
|
||||
R_InitNextFrame
|
||||
|
@ -296,6 +299,11 @@ void RE_RenderScene( const refdef_t *fd ) {
|
|||
tr.refdef.fov_x = fd->fov_x;
|
||||
tr.refdef.fov_y = fd->fov_y;
|
||||
|
||||
memset( &parms, 0, sizeof( parms ) );
|
||||
VectorCopy( fd->viewaxis[0], parms.ori.axis[0] );
|
||||
VectorCopy( fd->viewaxis[1], parms.ori.axis[1] );
|
||||
VectorCopy( fd->viewaxis[2], parms.ori.axis[2] );
|
||||
|
||||
VectorCopy( fd->vieworg, tr.refdef.vieworg );
|
||||
VectorCopy( fd->viewaxis[0], tr.refdef.viewaxis[0] );
|
||||
VectorCopy( fd->viewaxis[1], tr.refdef.viewaxis[1] );
|
||||
|
@ -384,7 +392,6 @@ void RE_RenderScene( const refdef_t *fd ) {
|
|||
// The refdef takes 0-at-the-top y coordinates, so
|
||||
// convert to GL's 0-at-the-bottom space
|
||||
//
|
||||
memset( &parms, 0, sizeof( parms ) );
|
||||
parms.viewportX = tr.refdef.x;
|
||||
parms.viewportY = glConfig.vidHeight - ( tr.refdef.y + tr.refdef.height );
|
||||
parms.viewportWidth = tr.refdef.width;
|
||||
|
@ -395,9 +402,9 @@ void RE_RenderScene( const refdef_t *fd ) {
|
|||
parms.fovY = tr.refdef.fov_y;
|
||||
|
||||
VectorCopy( fd->vieworg, parms.ori.origin );
|
||||
VectorCopy( fd->viewaxis[0], parms.ori.axis[0] );
|
||||
VectorCopy( fd->viewaxis[1], parms.ori.axis[1] );
|
||||
VectorCopy( fd->viewaxis[2], parms.ori.axis[2] );
|
||||
// VectorCopy( fd->viewaxis[0], parms.ori.axis[0] );
|
||||
// VectorCopy( fd->viewaxis[1], parms.ori.axis[1] );
|
||||
// VectorCopy( fd->viewaxis[2], parms.ori.axis[2] );
|
||||
|
||||
VectorCopy( fd->vieworg, parms.pvsOrigin );
|
||||
|
||||
|
|
|
@ -1049,7 +1049,7 @@ void SV_InitGameProgs (void) {
|
|||
import.WE_SetTempGlobalFogColor = SV_WE_SetTempGlobalFogColor;
|
||||
|
||||
#ifdef JK2_MODE
|
||||
const char *gamename = "jospgame";
|
||||
const char *gamename = "jogame";
|
||||
#else
|
||||
const char *gamename = "jagame";
|
||||
#endif
|
||||
|
|
|
@ -313,6 +313,25 @@ vmCvar_t cg_missionInfoCentered;
|
|||
vmCvar_t cg_missionInfoFlashTime;
|
||||
vmCvar_t cg_hudFiles;
|
||||
|
||||
vmCvar_t vr_weapon_adjustment_1;
|
||||
vmCvar_t vr_weapon_adjustment_2;
|
||||
vmCvar_t vr_weapon_adjustment_3;
|
||||
vmCvar_t vr_weapon_adjustment_4;
|
||||
vmCvar_t vr_weapon_adjustment_5;
|
||||
vmCvar_t vr_weapon_adjustment_6;
|
||||
vmCvar_t vr_weapon_adjustment_7;
|
||||
vmCvar_t vr_weapon_adjustment_8;
|
||||
vmCvar_t vr_weapon_adjustment_9;
|
||||
vmCvar_t vr_weapon_adjustment_10;
|
||||
vmCvar_t vr_weapon_adjustment_11;
|
||||
vmCvar_t vr_weapon_adjustment_12;
|
||||
vmCvar_t vr_weapon_adjustment_13;
|
||||
vmCvar_t vr_weapon_adjustment_14;
|
||||
vmCvar_t vr_weapon_adjustment_18;
|
||||
vmCvar_t vr_weapon_adjustment_19;
|
||||
vmCvar_t vr_weapon_adjustment_20;
|
||||
vmCvar_t vr_weapon_adjustment_22;
|
||||
|
||||
/*
|
||||
Ghoul2 Insert Start
|
||||
*/
|
||||
|
@ -424,6 +443,28 @@ static cvarTable_t cvarTable[] = {
|
|||
{ &cg_missionInfoCentered, "cg_missionInfoCentered", "1", CVAR_ARCHIVE },
|
||||
{ &cg_missionInfoFlashTime, "cg_missionInfoFlashTime", "10000", 0 },
|
||||
{ &cg_hudFiles, "cg_hudFiles", "ui/jk2hud.txt", CVAR_ARCHIVE},
|
||||
|
||||
//Default Weapon adjustments - these WILL be overridden
|
||||
// scale,right,up,forward,pitch,yaw,roll
|
||||
{ &vr_weapon_adjustment_1, "vr_weapon_adjustment_1", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_2, "vr_weapon_adjustment_2", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_3, "vr_weapon_adjustment_3", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_4, "vr_weapon_adjustment_4", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_5, "vr_weapon_adjustment_5", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_6, "vr_weapon_adjustment_6", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_7, "vr_weapon_adjustment_7", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_8, "vr_weapon_adjustment_8", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_9, "vr_weapon_adjustment_9", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_10, "vr_weapon_adjustment_10", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_11, "vr_weapon_adjustment_11", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_12, "vr_weapon_adjustment_12", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_13, "vr_weapon_adjustment_13", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_14, "vr_weapon_adjustment_14", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_18, "vr_weapon_adjustment_18", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_19, "vr_weapon_adjustment_19", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_20, "vr_weapon_adjustment_20", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
{ &vr_weapon_adjustment_22, "vr_weapon_adjustment_22", "0.62,-9.8,11.3,-16.1,0.0,0.0,0.0", CVAR_ARCHIVE},
|
||||
|
||||
/*
|
||||
Ghoul2 Insert Start
|
||||
*/
|
||||
|
|
|
@ -6500,7 +6500,9 @@ qboolean PM_SaberLocked( void )
|
|||
#endif // _DEBUG
|
||||
gi.G2API_GetBoneAnimIndex( &gent->ghoul2[gent->playerModel], gent->lowerLumbarBone, (cg.time?cg.time:level.time), ¤tFrame, &junk, &junk, &junk, &junk2, NULL );
|
||||
|
||||
#ifdef _DEBUG
|
||||
assert(ret); // this would be pretty bad, the below code seems to assume the call succeeds. -gil
|
||||
#endif // _DEBUG
|
||||
|
||||
strength = G_SaberLockStrength( gent );
|
||||
if ( pm->ps->torsoAnim == BOTH_CCWCIRCLELOCK ||
|
||||
|
|
|
@ -118,6 +118,10 @@ typedef enum
|
|||
NUM_EVASION_TYPES
|
||||
} evasionType_t;
|
||||
|
||||
#ifdef LS_NONE
|
||||
#undef LS_NONE
|
||||
#endif
|
||||
|
||||
// Okay, here lies the much-dreaded Pat-created FSM movement chart... Heretic II strikes again!
|
||||
// Why am I inflicting this on you? Well, it's better than hardcoded states.
|
||||
// Ideally this will be replaced with an external file or more sophisticated move-picker
|
||||
|
|
|
@ -1431,3 +1431,195 @@ void VectorClear4( vec4_t vec )
|
|||
void VectorSet5( vec5_t vec, float x, float y, float z, float w, float u ) {
|
||||
vec[0]=x; vec[1]=y; vec[2]=z; vec[3]=w; vec[4]=u;
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Matrix 4x4
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define M_PI2 (float)6.28318530717958647692
|
||||
|
||||
/*
|
||||
=================
|
||||
SinCos
|
||||
=================
|
||||
*/
|
||||
void SinCos( float radians, float *sine, float *cosine )
|
||||
{
|
||||
#if _MSC_VER == 1200
|
||||
_asm
|
||||
{
|
||||
fld dword ptr [radians]
|
||||
fsincos
|
||||
|
||||
mov edx, dword ptr [cosine]
|
||||
mov eax, dword ptr [sine]
|
||||
|
||||
fstp dword ptr [edx]
|
||||
fstp dword ptr [eax]
|
||||
}
|
||||
#else
|
||||
// I think, better use math.h function, instead of ^
|
||||
#if defined (__linux__) && !defined (__ANDROID__)
|
||||
sincosf(radians, sine, cosine);
|
||||
#else
|
||||
*sine = sinf(radians);
|
||||
*cosine = cosf(radians);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void Matrix4x4_Concat (matrix4x4 out, const matrix4x4 in1, const matrix4x4 in2)
|
||||
{
|
||||
out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0] + in1[0][3] * in2[3][0];
|
||||
out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + in1[0][2] * in2[2][1] + in1[0][3] * in2[3][1];
|
||||
out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] + in1[0][2] * in2[2][2] + in1[0][3] * in2[3][2];
|
||||
out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] + in1[0][2] * in2[2][3] + in1[0][3] * in2[3][3];
|
||||
out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] + in1[1][2] * in2[2][0] + in1[1][3] * in2[3][0];
|
||||
out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] + in1[1][2] * in2[2][1] + in1[1][3] * in2[3][1];
|
||||
out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] + in1[1][2] * in2[2][2] + in1[1][3] * in2[3][2];
|
||||
out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] + in1[1][2] * in2[2][3] + in1[1][3] * in2[3][3];
|
||||
out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] + in1[2][2] * in2[2][0] + in1[2][3] * in2[3][0];
|
||||
out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] + in1[2][2] * in2[2][1] + in1[2][3] * in2[3][1];
|
||||
out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] + in1[2][2] * in2[2][2] + in1[2][3] * in2[3][2];
|
||||
out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + in1[2][2] * in2[2][3] + in1[2][3] * in2[3][3];
|
||||
out[3][0] = in1[3][0] * in2[0][0] + in1[3][1] * in2[1][0] + in1[3][2] * in2[2][0] + in1[3][3] * in2[3][0];
|
||||
out[3][1] = in1[3][0] * in2[0][1] + in1[3][1] * in2[1][1] + in1[3][2] * in2[2][1] + in1[3][3] * in2[3][1];
|
||||
out[3][2] = in1[3][0] * in2[0][2] + in1[3][1] * in2[1][2] + in1[3][2] * in2[2][2] + in1[3][3] * in2[3][2];
|
||||
out[3][3] = in1[3][0] * in2[0][3] + in1[3][1] * in2[1][3] + in1[3][2] * in2[2][3] + in1[3][3] * in2[3][3];
|
||||
}
|
||||
|
||||
void Matrix4x4_CreateFromEntity( matrix4x4 out, const vec3_t angles, const vec3_t origin, float scale )
|
||||
{
|
||||
float angle, sr, sp, sy, cr, cp, cy;
|
||||
|
||||
if( angles[ROLL] )
|
||||
{
|
||||
#ifdef XASH_VECTORIZE_SINCOS
|
||||
SinCosFastVector3( DEG2RAD(angles[YAW]), DEG2RAD(angles[PITCH]), DEG2RAD(angles[ROLL]),
|
||||
&sy, &sp, &sr,
|
||||
&cy, &cp, &cr);
|
||||
#else
|
||||
angle = angles[YAW] * (M_PI2 / 360.0f);
|
||||
SinCos( angle, &sy, &cy );
|
||||
angle = angles[PITCH] * (M_PI2 / 360.0f);
|
||||
SinCos( angle, &sp, &cp );
|
||||
angle = angles[ROLL] * (M_PI2 / 360.0f);
|
||||
SinCos( angle, &sr, &cr );
|
||||
#endif
|
||||
|
||||
out[0][0] = (cp*cy) * scale;
|
||||
out[0][1] = (sr*sp*cy+cr*-sy) * scale;
|
||||
out[0][2] = (cr*sp*cy+-sr*-sy) * scale;
|
||||
out[0][3] = origin[0];
|
||||
out[1][0] = (cp*sy) * scale;
|
||||
out[1][1] = (sr*sp*sy+cr*cy) * scale;
|
||||
out[1][2] = (cr*sp*sy+-sr*cy) * scale;
|
||||
out[1][3] = origin[1];
|
||||
out[2][0] = (-sp) * scale;
|
||||
out[2][1] = (sr*cp) * scale;
|
||||
out[2][2] = (cr*cp) * scale;
|
||||
out[2][3] = origin[2];
|
||||
out[3][0] = 0.0f;
|
||||
out[3][1] = 0.0f;
|
||||
out[3][2] = 0.0f;
|
||||
out[3][3] = 1.0f;
|
||||
}
|
||||
else if( angles[PITCH] )
|
||||
{
|
||||
#ifdef XASH_VECTORIZE_SINCOS
|
||||
SinCosFastVector2( DEG2RAD(angles[YAW]), DEG2RAD(angles[PITCH]),
|
||||
&sy, &sp,
|
||||
&cy, &cp);
|
||||
#else
|
||||
angle = angles[YAW] * (M_PI2 / 360.0f);
|
||||
SinCos( angle, &sy, &cy );
|
||||
angle = angles[PITCH] * (M_PI2 / 360.0f);
|
||||
SinCos( angle, &sp, &cp );
|
||||
#endif
|
||||
|
||||
out[0][0] = (cp*cy) * scale;
|
||||
out[0][1] = (-sy) * scale;
|
||||
out[0][2] = (sp*cy) * scale;
|
||||
out[0][3] = origin[0];
|
||||
out[1][0] = (cp*sy) * scale;
|
||||
out[1][1] = (cy) * scale;
|
||||
out[1][2] = (sp*sy) * scale;
|
||||
out[1][3] = origin[1];
|
||||
out[2][0] = (-sp) * scale;
|
||||
out[2][1] = 0.0f;
|
||||
out[2][2] = (cp) * scale;
|
||||
out[2][3] = origin[2];
|
||||
out[3][0] = 0.0f;
|
||||
out[3][1] = 0.0f;
|
||||
out[3][2] = 0.0f;
|
||||
out[3][3] = 1.0f;
|
||||
}
|
||||
else if( angles[YAW] )
|
||||
{
|
||||
angle = angles[YAW] * (M_PI2 / 360.0f);
|
||||
SinCos( angle, &sy, &cy );
|
||||
|
||||
out[0][0] = (cy) * scale;
|
||||
out[0][1] = (-sy) * scale;
|
||||
out[0][2] = 0.0f;
|
||||
out[0][3] = origin[0];
|
||||
out[1][0] = (sy) * scale;
|
||||
out[1][1] = (cy) * scale;
|
||||
out[1][2] = 0.0f;
|
||||
out[1][3] = origin[1];
|
||||
out[2][0] = 0.0f;
|
||||
out[2][1] = 0.0f;
|
||||
out[2][2] = scale;
|
||||
out[2][3] = origin[2];
|
||||
out[3][0] = 0.0f;
|
||||
out[3][1] = 0.0f;
|
||||
out[3][2] = 0.0f;
|
||||
out[3][3] = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
out[0][0] = scale;
|
||||
out[0][1] = 0.0f;
|
||||
out[0][2] = 0.0f;
|
||||
out[0][3] = origin[0];
|
||||
out[1][0] = 0.0f;
|
||||
out[1][1] = scale;
|
||||
out[1][2] = 0.0f;
|
||||
out[1][3] = origin[1];
|
||||
out[2][0] = 0.0f;
|
||||
out[2][1] = 0.0f;
|
||||
out[2][2] = scale;
|
||||
out[2][3] = origin[2];
|
||||
out[3][0] = 0.0f;
|
||||
out[3][1] = 0.0f;
|
||||
out[3][2] = 0.0f;
|
||||
out[3][3] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void Matrix4x4_ConvertToEntity( vec4_t *in, vec3_t angles, vec3_t origin )
|
||||
{
|
||||
float xyDist = sqrt( in[0][0] * in[0][0] + in[1][0] * in[1][0] );
|
||||
|
||||
// enough here to get angles?
|
||||
if( xyDist > 0.001f )
|
||||
{
|
||||
angles[0] = RAD2DEG( atan2( -in[2][0], xyDist ));
|
||||
angles[1] = RAD2DEG( atan2( in[1][0], in[0][0] ));
|
||||
angles[2] = RAD2DEG( atan2( in[2][1], in[2][2] ));
|
||||
}
|
||||
else // forward is mostly Z, gimbal lock
|
||||
{
|
||||
angles[0] = RAD2DEG( atan2( -in[2][0], xyDist ));
|
||||
angles[1] = RAD2DEG( atan2( -in[0][1], in[1][1] ));
|
||||
angles[2] = 0.0f;
|
||||
}
|
||||
|
||||
origin[0] = in[0][3];
|
||||
origin[1] = in[1][3];
|
||||
origin[2] = in[2][3];
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ typedef float vec_t;
|
|||
typedef float vec2_t[2], vec3_t[3], vec4_t[4], vec5_t[5];
|
||||
typedef int ivec2_t[2], ivec3_t[3], ivec4_t[4], ivec5_t[5];
|
||||
typedef vec3_t vec3pair_t[2], matrix3_t[3];
|
||||
typedef vec_t matrix4x4[4][4];
|
||||
|
||||
typedef int fixed4_t, fixed8_t, fixed16_t;
|
||||
|
||||
|
@ -300,6 +301,17 @@ void VectorClear4( vec4_t vec );
|
|||
void VectorSet5( vec5_t vec, float x, float y, float z, float w, float u );
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Matrix 4x4
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void Matrix4x4_Concat (matrix4x4 out, const matrix4x4 in1, const matrix4x4 in2);
|
||||
void Matrix4x4_CreateFromEntity( matrix4x4 out, const vec3_t angles, const vec3_t origin, float scale );
|
||||
void Matrix4x4_ConvertToEntity( vec4_t *in, vec3_t angles, vec3_t origin );
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
@ -315,7 +315,7 @@ itemDef
|
|||
group grpControls
|
||||
text "Cinematic:"
|
||||
type ITEM_TYPE_MULTI
|
||||
cvar "vr_cinematic_stereo"
|
||||
cvar "vr_immersive_cinematics"
|
||||
cvarFloatList {"2D" 0 "3D" 1 }
|
||||
rect 82 195 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
|
|
|
@ -288,7 +288,7 @@ itemDef
|
|||
group grpControls
|
||||
text "Cinematic:"
|
||||
type ITEM_TYPE_MULTI
|
||||
cvar "vr_cinematic_stereo"
|
||||
cvar "vr_immersive_cinematics"
|
||||
cvarFloatList {"2D" 0 "3D" 1 }
|
||||
rect 82 195 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
|
|
Binary file not shown.
|
@ -40,7 +40,7 @@ import static android.system.Os.setenv;
|
|||
// Load the gles3jni library right away to make sure JNI_OnLoad() gets called as the very first thing.
|
||||
static
|
||||
{
|
||||
System.loadLibrary( "openjk_sp" );
|
||||
System.loadLibrary( "openjk_ja" );
|
||||
}
|
||||
|
||||
private static final String TAG = "JKQuest";
|
||||
|
@ -165,22 +165,16 @@ import static android.system.Os.setenv;
|
|||
|
||||
public void create() {
|
||||
//Make the directories
|
||||
new File("/sdcard/JKQuest/Main").mkdirs();
|
||||
new File("/sdcard/JKQuest/base").mkdirs();
|
||||
|
||||
//Copy the command line params file
|
||||
copy_asset("/sdcard/JKQuest", "commandline.txt", false);
|
||||
|
||||
//Copy the weapon adjustment config
|
||||
// copy_asset("/sdcard/JKQuest/Main", "weapons_vr.cfg", false);
|
||||
copy_asset("/sdcard/JKQuest/base", "weapons_vr.cfg", false);
|
||||
|
||||
//and the demo version - if required
|
||||
// copy_asset("/sdcard/JKQuest/Main", "pak0.pk3", false);
|
||||
|
||||
//and the vr weapons
|
||||
// copy_asset("/sdcard/JKQuest/Main", "z_zvr_weapons.pk3", true);
|
||||
|
||||
//and the vr menu pk3
|
||||
// copy_asset("/sdcard/JKQuest/Main", "z_jkquest_vrmenu.pk3", true);
|
||||
//and the cheat menu pk3 for testing
|
||||
copy_asset("/sdcard/JKQuest/base", "Z_BetaV0.2_NewMenus.pk3", true);
|
||||
|
||||
//and the venom scripting improvements pak (thank-you _HELLBARON_ !!)
|
||||
// copy_asset("/sdcard/JKQuest/Main", "sp_vpak8.pk3", false);
|
||||
|
|
Loading…
Reference in New Issue