Some weapon aiming code

This commit is contained in:
Simon 2022-09-29 23:38:22 +01:00
parent 163b725ebe
commit 385017812e
24 changed files with 231 additions and 149 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.jk2quest" package="com.drbeef.jk2quest"
android:versionCode="2" android:versionCode="4"
android:versionName="0.0.2" android:installLocation="auto" > android:versionName="0.0.4" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. --> <!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030001" android:required="true"/> <uses-feature android:glEsVersion="0x00030001" android:required="true"/>

View file

@ -1282,16 +1282,6 @@ void JKVR_Init()
vr_immersive_cinematics = Cvar_Get("vr_immersive_cinematics", "1", 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); vr_screen_dist = Cvar_Get( "vr_screen_dist", "2.5", CVAR_ARCHIVE);
//Set up vr client info
vr.visible_hud = qtrue;
vr.weapon_recoil = 0.0f;
//Clear teleport stuff
vr.teleportexecute = qfalse;
vr.teleportseek = qfalse;
vr.teleportenabled = qfalse;
vr.teleportready = qfalse;
} }
@ -1353,23 +1343,7 @@ void JKVR_processMessageQueue() {
} }
case MESSAGE_ON_START: case MESSAGE_ON_START:
{ {
if (!jk2_initialised) openjk_initialised = qtrue;
{
ALOGV( " Initialising jk2 Engine" );
//Set command line arguments here
if (argc != 0)
{
//TODO
}
else
{
int argc = 1; char *argv[] = { "jk2" };
}
jk2_initialised = qtrue;
}
break; break;
} }
case MESSAGE_ON_RESUME: case MESSAGE_ON_RESUME:
@ -1425,7 +1399,7 @@ void * AppThreadFunction(void * parm ) {
// Note that AttachCurrentThread will reset the thread name. // Note that AttachCurrentThread will reset the thread name.
prctl(PR_SET_NAME, (long) "OVR::Main", 0, 0, 0); prctl(PR_SET_NAME, (long) "OVR::Main", 0, 0, 0);
jk2_initialised = false; openjk_initialised = false;
vr_screen_dist = NULL; vr_screen_dist = NULL;
const ovrInitParms initParms = vrapi_DefaultInitParms(&java); const ovrInitParms initParms = vrapi_DefaultInitParms(&java);
@ -1491,16 +1465,15 @@ void * AppThreadFunction(void * parm ) {
// Create the scene if not yet created. // Create the scene if not yet created.
ovrScene_Create( m_width, m_height, &gAppState.Scene, &java ); ovrScene_Create( m_width, m_height, &gAppState.Scene, &java );
char *game = (char*)getenv("JK_GAME"); #ifdef JK2_MODE
if (strcmp(game, "jo") == 0) {
chdir("/sdcard/JKQuest/JK2"); chdir("/sdcard/JKQuest/JK2");
} else { #else
chdir("/sdcard/JKQuest/JK3"); chdir("/sdcard/JKQuest/JK3");
} #endif
//Run loading loop until we are ready to start JKVR //Run loading loop until we are ready to start JKVR
while (!destroyed && !jk2_initialised) { while (!destroyed && !openjk_initialised) {
JKVR_processMessageQueue(); JKVR_processMessageQueue();
JKVR_incrementFrameIndex(); JKVR_incrementFrameIndex();
showLoadingIcon(); showLoadingIcon();

View file

@ -2,7 +2,6 @@
#define vr_client_info_h #define vr_client_info_h
#define NUM_WEAPON_SAMPLES 10 #define NUM_WEAPON_SAMPLES 10
#define WEAPON_RECOIL 15.0f;
typedef struct { typedef struct {
bool in_camera; // cinematic camera taken over bool in_camera; // cinematic camera taken over
@ -12,7 +11,6 @@ typedef struct {
bool weapon_stabilised; bool weapon_stabilised;
bool right_handed; bool right_handed;
bool player_moving; bool player_moving;
bool visible_hud;
int weaponid; int weaponid;
int lastweaponid; int lastweaponid;
bool mountedgun; bool mountedgun;
@ -33,8 +31,6 @@ typedef struct {
vec3_t clientviewangles; //orientation in the client - we use this in the cgame 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 snapTurn; // how much turn has been applied to the yaw by joystick
float weapon_recoil; // recoil effect to improve the default
vec3_t weaponposition; vec3_t weaponposition;
vec3_t weaponoffset; vec3_t weaponoffset;
float weaponoffset_timestamp; float weaponoffset_timestamp;
@ -60,17 +56,6 @@ typedef struct {
vec3_t offhandposition; vec3_t offhandposition;
vec3_t offhandoffset; vec3_t offhandoffset;
//
// Teleport Stuff
//
bool teleportenabled;
bool teleportseek; // player looking to teleport
bool teleportready; // player pointing to a valid teleport location
vec3_t teleportdest; // teleport destination
bool teleportexecute; // execute the teleport
////////////////////////////////////// //////////////////////////////////////
// Test stuff for weapon alignment // Test stuff for weapon alignment
////////////////////////////////////// //////////////////////////////////////

View file

@ -31,7 +31,7 @@ typedef enum control_scheme {
WEAPON_ALIGN = 99 WEAPON_ALIGN = 99
} control_scheme_t; } control_scheme_t;
extern bool jk2_initialised; extern bool openjk_initialised;
extern long long global_time; extern long long global_time;
extern float playerHeight; extern float playerHeight;
extern float playerYaw; extern float playerYaw;

View file

@ -48,7 +48,7 @@ float remote_movementForward;
float remote_movementUp; float remote_movementUp;
float positional_movementSideways; float positional_movementSideways;
float positional_movementForward; float positional_movementForward;
bool jk2_initialised; bool openjk_initialised;
long long global_time; long long global_time;
float playerHeight; float playerHeight;
float playerYaw; float playerYaw;

View file

@ -43,8 +43,6 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
vr.right_handed = vr_control_scheme->value < 10 || vr.right_handed = vr_control_scheme->value < 10 ||
vr_control_scheme->value == 99; // Always right-handed for weapon calibration vr_control_scheme->value == 99; // Always right-handed for weapon calibration
vr.teleportenabled = vr_teleport->integer != 0;
static bool dominantGripPushed = false; static bool dominantGripPushed = false;
static float dominantGripPushTime = 0.0f; static float dominantGripPushTime = 0.0f;
static bool canUseBackpack = false; static bool canUseBackpack = false;
@ -112,9 +110,7 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
vec3_t rotation = {0}; vec3_t rotation = {0};
rotation[PITCH] = 30; rotation[PITCH] = 30;
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, vr.weaponangles_knife); QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, vr.weaponangles_knife);
rotation[PITCH] = vr_weapon_pitchadjust->value + rotation[PITCH] = vr_weapon_pitchadjust->value;
(vr.pistol ? vr.weapon_recoil : 0.0f); // Our hacked recoil effect
vr.weapon_recoil *= 0.8f; // quick reduction on synthetic recoil
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, vr.weaponangles); QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, vr.weaponangles);
VectorSubtract(vr.weaponangles_last, vr.weaponangles, vr.weaponangles_delta); VectorSubtract(vr.weaponangles_last, vr.weaponangles, vr.weaponangles_delta);
@ -281,14 +277,6 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
} }
} }
static bool finishReloadNextFrame = false;
if (finishReloadNextFrame)
{
ALOGV("**WEAPON EVENT** -reload");
sendButtonActionSimple("-reload");
finishReloadNextFrame = false;
}
// Calculate if player tries to reach backpack // Calculate if player tries to reach backpack
bool handInBackpack = false; bool handInBackpack = false;
bool bpDistToHMDOk = false, bpWeaponHeightOk = false, bpWeaponAngleOk = false, bpHmdToWeaponAngleOk = false; bool bpDistToHMDOk = false, bpWeaponHeightOk = false, bpWeaponAngleOk = false, bpHmdToWeaponAngleOk = false;
@ -412,11 +400,6 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
} }
else else
{ {
if ((GetTimeInMilliSeconds() - dominantGripPushTime) <
vr_reloadtimeoutms->integer) {
sendButtonActionSimple("+reload");
finishReloadNextFrame = true;
}
dominantGripPushTime = 0; dominantGripPushTime = 0;
} }
} }
@ -447,10 +430,16 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
positional_movementSideways, positional_movementSideways,
positional_movementForward); positional_movementForward);
//Jump (B Button) //Jump (A Button)
if ((primaryButtonsNew & primaryButton1) != (primaryButtonsOld & primaryButton1))
{
sendButtonAction("+moveup", (primaryButtonsNew & primaryButton1));
}
//Alt Fire (B Button)
if ((primaryButtonsNew & primaryButton2) != (primaryButtonsOld & primaryButton2)) if ((primaryButtonsNew & primaryButton2) != (primaryButtonsOld & primaryButton2))
{ {
sendButtonAction("+moveup", (primaryButtonsNew & primaryButton2)); sendButtonAction("+altattack", (primaryButtonsNew & primaryButton2));
} }
@ -470,10 +459,10 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
//Duck - off hand joystick //Duck - off hand joystick
if ((secondaryButtonsNew & ovrButton_Joystick) != if ((secondaryButtonsNew & secondaryThumb) !=
(secondaryButtonsNew & ovrButton_Joystick)) { (secondaryButtonsNew & secondaryThumb)) {
sendButtonAction("+movedown", (primaryButtonsNew & primaryButton1)); sendButtonAction("+movedown", (secondaryButtonsNew & secondaryThumb));
} }
//Use //Use
@ -526,61 +515,29 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
remote_movementForward); remote_movementForward);
static bool stopUseItemNextFrame = false; //Use Force (X button)
if (stopUseItemNextFrame)
{
Cbuf_AddText("-useitem\n");
stopUseItemNextFrame = false;
}
if (!canUseQuickSave) { if (!canUseQuickSave) {
if (((secondaryButtonsNew & secondaryButton1) != if ((secondaryButtonsNew & secondaryButton1) !=
(secondaryButtonsOld & secondaryButton1)) && (secondaryButtonsOld & secondaryButton1)) {
(secondaryButtonsNew & secondaryButton1)) { sendButtonAction("+useforce", (secondaryButtonsNew & secondaryButton1));
if (dominantGripPushed) {
Cbuf_AddText("+useitem\n");
stopUseItemNextFrame = qtrue;
} else {
vr.visible_hud = !vr.visible_hud;
}
} }
} }
//notebook or select "item"
if (!canUseQuickSave) { if (!canUseQuickSave) {
if (((secondaryButtonsNew & secondaryButton2) != if (((secondaryButtonsNew & secondaryButton2) !=
(secondaryButtonsOld & secondaryButton2)) && (secondaryButtonsOld & secondaryButton2)) &&
(secondaryButtonsNew & secondaryButton2)) { (secondaryButtonsNew & secondaryButton2)) {
sendButtonActionSimple("forcenext");
if (dominantGripPushed) {
sendButtonActionSimple("itemprev");
} else {
sendButtonActionSimple("notebook");
}
} }
} }
//We need to record if we have started firing primary so that releasing trigger will stop definitely firing, if user has pushed grip //We need to record if we have started firing primary so that releasing trigger will stop definitely firing, if user has pushed grip
//in meantime, then it wouldn't stop the gun firing and it would get stuck //in meantime, then it wouldn't stop the gun firing and it would get stuck
if (!vr.teleportenabled)
{ {
//Run //Run
handleTrackedControllerButton(pOffTrackedRemoteNew, handleTrackedControllerButton(pOffTrackedRemoteNew,
pOffTrackedRemoteOld, pOffTrackedRemoteOld,
ovrButton_Trigger, A_SHIFT); ovrButton_Trigger, A_SHIFT);
} else {
if (pOffTrackedRemoteNew->Buttons & ovrButton_Trigger)
{
vr.teleportseek = qtrue;
}
else if (vr.teleportseek)
{
vr.teleportseek = qfalse;
vr.teleportexecute = vr.teleportready;
vr.teleportready = qfalse;
}
} }

View file

@ -887,7 +887,9 @@ static float CG_CalculateWeaponPositionAndScale( playerState_t *ps, vec3_t origi
VectorCopy(vr->test_offset, offset); VectorCopy(vr->test_offset, offset);
CG_CenterPrint( vr->test_name, SMALLCHAR_WIDTH ); int w = cgi_R_Font_StrLenPixels(vr->test_name, cgs.media.qhFontSmall, 1.0f);
int x = ( SCREEN_WIDTH - w ) / 2;
cgi_R_Font_DrawString(x, (SCREEN_HEIGHT / 2), vr->test_name, colorTable[CT_ICON_BLUE], cgs.media.qhFontSmall, -1, 1.0f);
} else { } else {
if (ps->weapon != 0) if (ps->weapon != 0)
{ {
@ -1184,12 +1186,11 @@ void CG_AddViewWeapon( playerState_t *ps )
if (strcmp(cgi_Cvar_Get("vr_control_scheme"), "99") == 0) { if (strcmp(cgi_Cvar_Get("vr_control_scheme"), "99") == 0) {
vec3_t origin; vec3_t origin;
vec3_t endForward, endRight, endUp; vec3_t endForward, endRight, endUp;
vec3_t angles; vec3_t _angles;
clientInfo_t ci; BG_CalculateVRWeaponPosition( origin, _angles );
BG_CalculateVRWeaponPosition( origin, angles );
vec3_t forward, right, up; vec3_t forward, right, up;
AngleVectors(angles, forward, right, up); AngleVectors(_angles, forward, right, up);
trace_t trace; trace_t trace;
VectorMA(origin, 256, forward, endForward); VectorMA(origin, 256, forward, endForward);

View file

@ -25,6 +25,8 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "wp_saber.h" #include "wp_saber.h"
#include "w_local.h" #include "w_local.h"
#include "bg_local.h"
//--------------- //---------------
// Bryar Pistol // Bryar Pistol
@ -37,6 +39,15 @@ void WP_FireBryarPistol( gentity_t *ent, qboolean alt_fire )
vec3_t start; vec3_t start;
int damage = !alt_fire ? weaponData[WP_BRYAR_PISTOL].damage : weaponData[WP_BRYAR_PISTOL].altDamage; int damage = !alt_fire ? weaponData[WP_BRYAR_PISTOL].damage : weaponData[WP_BRYAR_PISTOL].altDamage;
vec3_t angs;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(muzzle, angs);
}
else {
vectoangles(forwardVec, angs);
}
VectorCopy( muzzle, start ); VectorCopy( muzzle, start );
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
@ -46,10 +57,6 @@ void WP_FireBryarPistol( gentity_t *ent, qboolean alt_fire )
//FIXME: maybe force sight level 3 autoaims some? //FIXME: maybe force sight level 3 autoaims some?
if ( ent->NPC && ent->NPC->currentAim < 5 ) if ( ent->NPC && ent->NPC->currentAim < 5 )
{ {
vec3_t angs;
vectoangles( forwardVec, angs );
if ( ent->client->NPC_class == CLASS_IMPWORKER ) if ( ent->client->NPC_class == CLASS_IMPWORKER )
{//*sigh*, hack to make impworkers less accurate without affecteing imperial officer accuracy {//*sigh*, hack to make impworkers less accurate without affecteing imperial officer accuracy
angs[PITCH] += ( Q_flrand(-1.0f, 1.0f) * (BLASTER_NPC_SPREAD+(6-ent->NPC->currentAim)*0.25f));//was 0.5f angs[PITCH] += ( Q_flrand(-1.0f, 1.0f) * (BLASTER_NPC_SPREAD+(6-ent->NPC->currentAim)*0.25f));//was 0.5f

View file

@ -25,6 +25,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "g_functions.h" #include "g_functions.h"
#include "wp_saber.h" #include "wp_saber.h"
#include "w_local.h" #include "w_local.h"
#include "bg_local.h"
//------------------- //-------------------
// Wookiee Bowcaster // Wookiee Bowcaster
@ -88,7 +89,14 @@ static void WP_BowcasterMainFire( gentity_t *ent )
// create a range of different velocities // create a range of different velocities
vel = BOWCASTER_VELOCITY * ( Q_flrand(-1.0f, 1.0f) * BOWCASTER_VEL_RANGE + 1.0f ); vel = BOWCASTER_VELOCITY * ( Q_flrand(-1.0f, 1.0f) * BOWCASTER_VEL_RANGE + 1.0f );
vectoangles( forwardVec, angs ); vec3_t angs;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(muzzle, angs);
}
else {
vectoangles(forwardVec, angs);
}
if ( !(ent->client->ps.forcePowersActive&(1<<FP_SEE)) if ( !(ent->client->ps.forcePowersActive&(1<<FP_SEE))
|| ent->client->ps.forcePowerLevel[FP_SEE] < FORCE_LEVEL_2 ) || ent->client->ps.forcePowerLevel[FP_SEE] < FORCE_LEVEL_2 )

View file

@ -26,6 +26,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "wp_saber.h" #include "wp_saber.h"
#include "w_local.h" #include "w_local.h"
#include "../cgame/cg_local.h" #include "../cgame/cg_local.h"
#include "bg_local.h"
static void WP_FireConcussionAlt( gentity_t *ent ) static void WP_FireConcussionAlt( gentity_t *ent )
{//a rail-gun-like beam {//a rail-gun-like beam
@ -256,13 +257,23 @@ static void WP_FireConcussion( gentity_t *ent )
int damage = weaponData[WP_CONCUSSION].damage; int damage = weaponData[WP_CONCUSSION].damage;
float vel = CONC_VELOCITY; float vel = CONC_VELOCITY;
vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(muzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy(forwardVec, forward);
}
if (ent->s.number >= MAX_CLIENTS) if (ent->s.number >= MAX_CLIENTS)
{ {
vec3_t angles; vec3_t angles;
vectoangles(forwardVec, angles); vectoangles(forward, angles);
angles[PITCH] += ( Q_flrand(-1.0f, 1.0f) * (CONC_NPC_SPREAD+(6-ent->NPC->currentAim)*0.25f));//was 0.5f angles[PITCH] += ( Q_flrand(-1.0f, 1.0f) * (CONC_NPC_SPREAD+(6-ent->NPC->currentAim)*0.25f));//was 0.5f
angles[YAW] += ( Q_flrand(-1.0f, 1.0f) * (CONC_NPC_SPREAD+(6-ent->NPC->currentAim)*0.25f));//was 0.5f angles[YAW] += ( Q_flrand(-1.0f, 1.0f) * (CONC_NPC_SPREAD+(6-ent->NPC->currentAim)*0.25f));//was 0.5f
AngleVectors(angles, forwardVec, vrightVec, up); AngleVectors(angles, forward, vrightVec, up);
} }
//hold us still for a bit //hold us still for a bit
@ -279,7 +290,7 @@ static void WP_FireConcussion( gentity_t *ent )
VectorCopy( muzzle, start ); VectorCopy( muzzle, start );
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
gentity_t *missile = CreateMissile( start, forwardVec, vel, 10000, ent, qfalse ); gentity_t *missile = CreateMissile( start, forward, vel, 10000, ent, qfalse );
missile->classname = "conc_proj"; missile->classname = "conc_proj";
missile->s.weapon = WP_CONCUSSION; missile->s.weapon = WP_CONCUSSION;

View file

@ -25,6 +25,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "g_functions.h" #include "g_functions.h"
#include "wp_saber.h" #include "wp_saber.h"
#include "w_local.h" #include "w_local.h"
#include "bg_local.h"
//------------------- //-------------------
// DEMP2 // DEMP2
@ -37,12 +38,22 @@ static void WP_DEMP2_MainFire( gentity_t *ent )
vec3_t start; vec3_t start;
int damage = weaponData[WP_DEMP2].damage; int damage = weaponData[WP_DEMP2].damage;
vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(muzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy(forwardVec, forward);
}
VectorCopy( muzzle, start ); VectorCopy( muzzle, start );
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
WP_MissileTargetHint(ent, start, forwardVec); WP_MissileTargetHint(ent, start, forward);
gentity_t *missile = CreateMissile( start, forwardVec, DEMP2_VELOCITY, 10000, ent ); gentity_t *missile = CreateMissile( start, forward, DEMP2_VELOCITY, 10000, ent );
missile->classname = "demp2_proj"; missile->classname = "demp2_proj";
missile->s.weapon = WP_DEMP2; missile->s.weapon = WP_DEMP2;

View file

@ -25,6 +25,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "g_functions.h" #include "g_functions.h"
#include "wp_saber.h" #include "wp_saber.h"
#include "w_local.h" #include "w_local.h"
#include "bg_local.h"
//--------------------- //---------------------
// Tenloss Disruptor // Tenloss Disruptor
@ -67,8 +68,20 @@ static void WP_DisruptorMainFire( gentity_t *ent )
// damage *= 2; // damage *= 2;
// } // }
WP_MissileTargetHint(ent, start, forwardVec);
VectorMA( start, shotRange, forwardVec, end ); vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(muzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy(forwardVec, forward);
}
WP_MissileTargetHint(ent, start, forward);
VectorMA( start, shotRange, forward, end );
int ignore = ent->s.number; int ignore = ent->s.number;
int traces = 0; int traces = 0;

View file

@ -25,6 +25,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "g_functions.h" #include "g_functions.h"
#include "wp_saber.h" #include "wp_saber.h"
#include "w_local.h" #include "w_local.h"
#include "bg_local.h"
//----------------------- //-----------------------
// Golan Arms Flechette // Golan Arms Flechette
@ -56,7 +57,14 @@ static void WP_FlechetteMainFire( gentity_t *ent )
for ( int i = 0; i < FLECHETTE_SHOTS; i++ ) for ( int i = 0; i < FLECHETTE_SHOTS; i++ )
{ {
vectoangles( forwardVec, angs ); vec3_t angs;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(muzzle, angs);
}
else {
vectoangles(forwardVec, angs);
}
if ( i == 0 && ent->s.number == 0 ) if ( i == 0 && ent->s.number == 0 )
{ {

View file

@ -25,6 +25,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "g_functions.h" #include "g_functions.h"
#include "wp_saber.h" #include "wp_saber.h"
#include "w_local.h" #include "w_local.h"
#include "bg_local.h"
//------------------- //-------------------
// Heavy Repeater // Heavy Repeater
@ -97,8 +98,18 @@ static void WP_RepeaterAltFire( gentity_t *ent )
} }
else else
{ {
WP_MissileTargetHint(ent, start, forwardVec); vec3_t angs, forward;
missile = CreateMissile( start, forwardVec, REPEATER_ALT_VELOCITY, 10000, ent, qtrue ); if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(muzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy(forwardVec, forward);
}
WP_MissileTargetHint(ent, start, forward);
missile = CreateMissile( start, forward, REPEATER_ALT_VELOCITY, 10000, ent, qtrue );
} }
missile->classname = "repeater_alt_proj"; missile->classname = "repeater_alt_proj";
@ -151,8 +162,13 @@ void WP_FireRepeater( gentity_t *ent, qboolean alt_fire )
//--------------------------------------------------------- //---------------------------------------------------------
{ {
vec3_t dir, angs; vec3_t dir, angs;
if ( ent->client && !ent->NPC)
vectoangles( forwardVec, angs ); {
BG_CalculateVRWeaponPosition(muzzle, angs);
}
else {
vectoangles( forwardVec, angs );
}
if ( alt_fire ) if ( alt_fire )
{ {

View file

@ -25,6 +25,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "g_functions.h" #include "g_functions.h"
#include "wp_saber.h" #include "wp_saber.h"
#include "w_local.h" #include "w_local.h"
#include "bg_local.h"
//----------------------- //-----------------------
// Rocket Launcher // Rocket Launcher
@ -182,10 +183,20 @@ void WP_FireRocket( gentity_t *ent, qboolean alt_fire )
vel *= 0.5f; vel *= 0.5f;
} }
vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(muzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy(forwardVec, forward);
}
VectorCopy( muzzle, start ); VectorCopy( muzzle, start );
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );//make sure our start point isn't on the other side of a wall
gentity_t *missile = CreateMissile( start, forwardVec, vel, 10000, ent, alt_fire ); gentity_t *missile = CreateMissile( start, forward, vel, 10000, ent, alt_fire );
missile->classname = "rocket_proj"; missile->classname = "rocket_proj";
missile->s.weapon = WP_ROCKET_LAUNCHER; missile->s.weapon = WP_ROCKET_LAUNCHER;

View file

@ -25,6 +25,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
#include "g_functions.h" #include "g_functions.h"
#include "wp_saber.h" #include "wp_saber.h"
#include "w_local.h" #include "w_local.h"
#include "bg_local.h"
//--------------------------------------------------------- //---------------------------------------------------------
void WP_FireStunBaton( gentity_t *ent, qboolean alt_fire ) void WP_FireStunBaton( gentity_t *ent, qboolean alt_fire )
@ -35,10 +36,20 @@ void WP_FireStunBaton( gentity_t *ent, qboolean alt_fire )
G_Sound( ent, G_SoundIndex( "sound/weapons/baton/fire" )); G_Sound( ent, G_SoundIndex( "sound/weapons/baton/fire" ));
vec3_t angs, forward;
if ( ent->client && !ent->NPC)
{
BG_CalculateVRWeaponPosition(muzzle, angs);
AngleVectors(angs, forward, NULL, NULL);
}
else {
VectorCopy(forwardVec, forward);
}
VectorCopy( muzzle, start ); VectorCopy( muzzle, start );
WP_TraceSetStart( ent, start, vec3_origin, vec3_origin ); WP_TraceSetStart( ent, start, vec3_origin, vec3_origin );
VectorMA( start, STUN_BATON_RANGE, forwardVec, end ); VectorMA( start, STUN_BATON_RANGE, forward, end );
VectorSet( maxs, 5, 5, 5 ); VectorSet( maxs, 5, 5, 5 );
VectorScale( maxs, -1, mins ); VectorScale( maxs, -1, mins );
@ -60,10 +71,10 @@ void WP_FireStunBaton( gentity_t *ent, qboolean alt_fire )
// G_Sound( tr_ent, G_SoundIndex( va("sound/weapons/melee/punch%d", Q_irand(1, 4)) ) ); // G_Sound( tr_ent, G_SoundIndex( va("sound/weapons/melee/punch%d", Q_irand(1, 4)) ) );
tr_ent->client->ps.powerups[PW_SHOCKED] = level.time + 1500; tr_ent->client->ps.powerups[PW_SHOCKED] = level.time + 1500;
G_Damage( tr_ent, ent, ent, forwardVec, tr.endpos, weaponData[WP_STUN_BATON].damage, DAMAGE_NO_KNOCKBACK, MOD_MELEE ); G_Damage( tr_ent, ent, ent, forward, tr.endpos, weaponData[WP_STUN_BATON].damage, DAMAGE_NO_KNOCKBACK, MOD_MELEE );
} }
else if ( tr_ent->svFlags & SVF_GLASS_BRUSH || ( tr_ent->svFlags & SVF_BBRUSH && tr_ent->material == 12 )) // material grate...we are breaking a grate! else if ( tr_ent->svFlags & SVF_GLASS_BRUSH || ( tr_ent->svFlags & SVF_BBRUSH && tr_ent->material == 12 )) // material grate...we are breaking a grate!
{ {
G_Damage( tr_ent, ent, ent, forwardVec, tr.endpos, 999, DAMAGE_NO_KNOCKBACK, MOD_MELEE ); // smash that puppy G_Damage( tr_ent, ent, ent, forward, tr.endpos, 999, DAMAGE_NO_KNOCKBACK, MOD_MELEE ); // smash that puppy
} }
} }

View file

@ -991,7 +991,11 @@ void Com_ExecuteCfg(void)
Cbuf_Execute(); Cbuf_Execute();
Cbuf_ExecuteText(EXEC_NOW, "exec autoexec_sp.cfg\n"); Cbuf_ExecuteText(EXEC_NOW, "exec autoexec_sp.cfg\n");
//Execute to overwrite weapon locations with our desired adjustments //Execute to overwrite weapon locations with our desired adjustments
Cbuf_AddText( "exec weapons_vr.cfg\n" ); #ifdef JK2_MODE
Cbuf_AddText( "exec weapons_vr_jo.cfg\n" );
#else
Cbuf_AddText( "exec weapons_vr_ja.cfg\n" );
#endif
Cbuf_Execute(); Cbuf_Execute();
} }
} }

View file

@ -270,7 +270,7 @@ void UI_Init( int apiVersion, uiimport_t *uiimport, qboolean inGameLoad )
Menu_Cache( ); Menu_Cache( );
ui.Cvar_Create( "cg_drawCrosshair", "1", CVAR_ARCHIVE ); ui.Cvar_Create( "cg_drawCrosshair", "0", CVAR_ARCHIVE );
ui.Cvar_Create( "cg_marks", "1", CVAR_ARCHIVE ); ui.Cvar_Create( "cg_marks", "1", CVAR_ARCHIVE );
ui.Cvar_Create ("s_language", "english", CVAR_ARCHIVE | CVAR_NORESTART); ui.Cvar_Create ("s_language", "english", CVAR_ARCHIVE | CVAR_NORESTART);
#ifndef JK2_MODE #ifndef JK2_MODE

View file

@ -3522,7 +3522,7 @@ void CG_DrawForceSelect( void )
{ {
int w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.0f); int w = cgi_R_Font_StrLenPixels(text, cgs.media.qhFontSmall, 1.0f);
int x = ( SCREEN_WIDTH - w ) / 2; int x = ( SCREEN_WIDTH - w ) / 2;
cgi_R_Font_DrawString(x, (SCREEN_HEIGHT - 24), text, colorTable[CT_ICON_BLUE], cgs.media.qhFontSmall, -1, 1.0f); cgi_R_Font_DrawString(x, (SCREEN_HEIGHT / 2 + 50), text, colorTable[CT_ICON_BLUE], cgs.media.qhFontSmall, -1, 1.0f);
} }
} }

View file

@ -580,7 +580,7 @@ void G_InitCvars( void ) {
g_ICARUSDebug = gi.cvar( "g_ICARUSDebug", "0", CVAR_CHEAT ); g_ICARUSDebug = gi.cvar( "g_ICARUSDebug", "0", CVAR_CHEAT );
g_timescale = gi.cvar( "timescale", "1", 0 ); g_timescale = gi.cvar( "timescale", "1", 0 );
g_subtitles = gi.cvar( "g_subtitles", "2", CVAR_ARCHIVE ); g_subtitles = gi.cvar( "g_subtitles", "0", CVAR_ARCHIVE );
com_buildScript = gi.cvar ("com_buildscript", "0", 0); com_buildScript = gi.cvar ("com_buildscript", "0", 0);
g_saberAutoBlocking = gi.cvar( "g_saberAutoBlocking", "1", CVAR_ARCHIVE|CVAR_CHEAT );//must press +block button to do any blocking g_saberAutoBlocking = gi.cvar( "g_saberAutoBlocking", "1", CVAR_ARCHIVE|CVAR_CHEAT );//must press +block button to do any blocking

Binary file not shown.

68
assets/weapons_vr_ja.cfg Normal file
View file

@ -0,0 +1,68 @@
///////////////////////////////////////////////////////////////////
// Weapon IDs
//
// WP_NONE,
//
// // Player weapons
// WP_SABER, // player and NPC weapon
// WP_BLASTER_PISTOL, // player and NPC weapon
// WP_BLASTER, // player and NPC weapon
// WP_DISRUPTOR, // player and NPC weapon
// WP_BOWCASTER, // NPC weapon - player can pick this up, but never starts with them
// WP_REPEATER, // NPC weapon - player can pick this up, but never starts with them
// WP_DEMP2, // NPC weapon - player can pick this up, but never starts with them
// WP_FLECHETTE, // NPC weapon - player can pick this up, but never starts with them
// WP_ROCKET_LAUNCHER, // NPC weapon - player can pick this up, but never starts with them
// WP_THERMAL, // player and NPC weapon
// WP_TRIP_MINE, // NPC weapon - player can pick this up, but never starts with them
// WP_DET_PACK, // NPC weapon - player can pick this up, but never starts with them
// WP_CONCUSSION, // NPC weapon - player can pick this up, but never starts with them
//
// //extras
// WP_MELEE, // player and NPC weapon - Any old melee attack
//
// //when in atst
// WP_ATST_MAIN,
// WP_ATST_SIDE,
//
// // These can never be gotten directly by the player
// WP_STUN_BATON, // stupid weapon, should remove
//
// //NPC weapons
// WP_BRYAR_PISTOL, // NPC weapon - player can pick this up, but never starts with them
//
// WP_EMPLACED_GUN,
//
// WP_BOT_LASER, // Probe droid - Laser blast
//
// WP_TURRET, // turret guns
//
// WP_TIE_FIGHTER,
//
// WP_RAPID_FIRE_CONC,
//
// WP_JAWA,
// WP_TUSKEN_RIFLE,
// WP_TUSKEN_STAFF,
// WP_SCEPTER,
// WP_NOGHRI_STICK,
// Weapon offsets - This is the default for the weapon models
// put the weapon id at the end of the cvar name, so the knife is vr_weapon_adjustment_1
// Values are: scale,right,up,forward,pitch,yaw,roll
seta vr_weapon_adjustment_2 "1.0,-3.5,7.4,-12.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_3 "1.0,-3.5,7.4,-10.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_4 "1.0,-3.5,7.4,-6.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_5 "1.5,-3.5,8.5,-10.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_6 "1.0,-3.5,7.0,-8.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_7 "1.0,-5.0,7.5,-10.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_8 "1.0,-5.0,8.0,-10.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_13 "1.5,-5.0,8.0,-10.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_9 "1.5,-4.0,7.5,-10.0,0.0,0.0,0.0"
seta vr_weapon_adjustment_10 "1.7,-4.5,8.0,-15.4,0.0,0.0,0.0"
seta vr_weapon_adjustment_11 "1.0,-6.0,6.0,-10.0,20.0,0.0,0.0"
seta vr_weapon_adjustment_12 "1.5,-5.0,7.0,-11.0,30.0,6.3,-12.0"

View file

@ -186,19 +186,18 @@ import static android.system.Os.setenv;
public void create() { public void create() {
//Make the directories //Make the directories
new File("/sdcard/JKQuest/jo/base").mkdirs(); new File("/sdcard/JKQuest/JK2/base").mkdirs();
new File("/sdcard/JKQuest/ja/base").mkdirs(); new File("/sdcard/JKQuest/JK3/base").mkdirs();
//Copy the command line params file //Copy the command line params file
copy_asset("/sdcard/JKQuest", "commandline.txt", false); copy_asset("/sdcard/JKQuest", "commandline.txt", false);
//Copy the weapon adjustment config //Copy the weapon adjustment config
copy_asset("/sdcard/JKQuest/jo/base", "weapons_vr.cfg", false); copy_asset("/sdcard/JKQuest/JK2/base", "weapons_vr_jo.cfg", false);
copy_asset("/sdcard/JKQuest/ja/base", "weapons_vr.cfg", false); copy_asset("/sdcard/JKQuest/JK3/base", "weapons_vr_ja.cfg", false);
//and the cheat menu pk3 for testing //and the cheat menu pk3 for testing
copy_asset("/sdcard/JKQuest/jo/base", "Expanded_Menu.pk3", true); copy_asset("/sdcard/JKQuest/JK3/base", "Z_BetaV0.2_NewMenus.pk3", true);
copy_asset("/sdcard/JKQuest/ja/base", "Z_BetaV0.2_NewMenus.pk3", true);
//Read these from a file and pass through //Read these from a file and pass through
commandLineParams = new String("jo"); commandLineParams = new String("jo");
@ -226,7 +225,6 @@ import static android.system.Os.setenv;
} }
try { try {
setenv("JK_GAME", game, true);
setenv("JK_LIBDIR", getApplicationInfo().nativeLibraryDir, true); setenv("JK_LIBDIR", getApplicationInfo().nativeLibraryDir, true);
} }
catch (Exception e) catch (Exception e)