Major Merge
Bringing all the changes done (mostly by baggyg) in the OVRPassToVR branch bringing over the major FP related changes to master. Please refer to that branch for the individual changes that have all been brought over in this single commit. Co-Authored-By: Grant Bagwell <general@grantbagwell.co.uk>
This commit is contained in:
parent
d63b586757
commit
15f78d843b
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.drbeef.doom3quest"
|
||||
android:versionCode="14"
|
||||
android:versionName="0.1.1" android:installLocation="auto" >
|
||||
android:versionCode="16"
|
||||
android:versionName="0.2.0" android:installLocation="auto" >
|
||||
|
||||
<!-- Tell the system this app requires OpenGL ES 3.1. -->
|
||||
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>
|
||||
|
@ -18,6 +18,7 @@
|
|||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||
<application android:allowBackup="false" android:icon="@drawable/ic_qquest" android:label="@string/doom3quest">
|
||||
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
|
||||
<meta-data android:name="com.oculus.supportedDevices" android:value="quest|delmar"/>
|
||||
<!-- The activity is the built-in NativeActivity framework class. -->
|
||||
<!-- launchMode is set to singleTask because there should never be multiple copies of the app running. -->
|
||||
<!-- Theme.Black.NoTitleBar.Fullscreen gives solid black instead of a (bad stereoscopic) gradient on app transition. -->
|
||||
|
@ -29,8 +30,9 @@
|
|||
android:label="@string/doom3quest"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="landscape"
|
||||
android:resizeableActivity="false"
|
||||
android:excludeFromRecents="false"
|
||||
android:configChanges="screenSize|screenLayout|orientation|keyboardHidden|keyboard|navigation|uiMode">
|
||||
android:configChanges="density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode">
|
||||
<!-- Tell NativeActivity the name of the .so -->
|
||||
<meta-data android:name="android.app.lib_name" android:value="Doom3Quest" />
|
||||
<!-- This filter lets the apk show up as a launchable icon. -->
|
||||
|
|
|
@ -23,7 +23,6 @@ Copyright : Copyright 2015 Oculus VR, LLC. All Rights reserved.
|
|||
#include <android/native_window_jni.h> // for native window JNI
|
||||
#include <android/input.h>
|
||||
|
||||
#include "argtable3.h"
|
||||
#include "VrInput.h"
|
||||
|
||||
#include <EGL/egl.h>
|
||||
|
@ -83,12 +82,13 @@ PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR;
|
|||
#endif
|
||||
|
||||
//Let's go to the maximum!
|
||||
int CPU_LEVEL = 4;
|
||||
int GPU_LEVEL = 4;
|
||||
int NUM_MULTI_SAMPLES = 1;
|
||||
int FFR = 0;
|
||||
float SS_MULTIPLIER = 1.0f;
|
||||
int DISPLAY_REFRESH = 60;
|
||||
const int CPU_LEVEL = 4;
|
||||
const int GPU_LEVEL = 4;
|
||||
|
||||
//Passed in from the Java code
|
||||
int NUM_MULTI_SAMPLES = -1;
|
||||
float SS_MULTIPLIER = -1.0f;
|
||||
int DISPLAY_REFRESH = -1;
|
||||
|
||||
vrClientInfo vr;
|
||||
vrClientInfo *pVRClientInfo;
|
||||
|
@ -103,15 +103,6 @@ float degrees(float rad) {
|
|||
return (rad * 180.0) / M_PI;
|
||||
}
|
||||
|
||||
/* global arg_xxx structs */
|
||||
struct arg_dbl *ss;
|
||||
struct arg_int *cpu;
|
||||
struct arg_int *gpu;
|
||||
struct arg_int *msaa;
|
||||
struct arg_int *ffr;
|
||||
struct arg_int *refresh;
|
||||
struct arg_end *end;
|
||||
|
||||
char **argv;
|
||||
int argc=0;
|
||||
|
||||
|
@ -152,7 +143,8 @@ void Doom3Quest_setUseScreenLayer(int screen)
|
|||
|
||||
bool Doom3Quest_useScreenLayer()
|
||||
{
|
||||
return inMenu || inCinematic || forceVirtualScreen;
|
||||
//Cinematics are now first person
|
||||
return inMenu || forceVirtualScreen;
|
||||
}
|
||||
|
||||
static void UnEscapeQuotes( char *arg )
|
||||
|
@ -929,12 +921,6 @@ void updateHMDOrientation()
|
|||
|
||||
//Keep this for our records
|
||||
VectorCopy(vr.hmdposition, vr.hmdposition_last);
|
||||
|
||||
//Orientation
|
||||
VectorSubtract(vr.hmdorientation_last, vr.hmdorientation, vr.hmdorientation_delta);
|
||||
|
||||
//Keep this for our records
|
||||
VectorCopy(vr.hmdorientation, vr.hmdorientation_last);
|
||||
}
|
||||
|
||||
void setHMDPosition( float x, float y, float z, float yaw )
|
||||
|
@ -942,6 +928,16 @@ void setHMDPosition( float x, float y, float z, float yaw )
|
|||
VectorSet(vr.hmdposition, x, y, z);
|
||||
}
|
||||
|
||||
void setHMDOrientation( float x, float y, float z, float w )
|
||||
{
|
||||
Vector4Set(vr.hmdorientation_quat, x, y, z, w);
|
||||
}
|
||||
|
||||
void setHMDTranslation( float x, float y, float z)
|
||||
{
|
||||
VectorSet(vr.hmdtranslation, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
========================
|
||||
|
@ -950,36 +946,28 @@ Doom3Quest_Vibrate
|
|||
*/
|
||||
|
||||
//0 = left, 1 = right
|
||||
float vibration_channel_duration[2] = {0.0f, 0.0f};
|
||||
float vibration_channel_intensity[2] = {0.0f, 0.0f};
|
||||
float vibration_channel_intensity[2][2] = {{0.0f,0.0f},{0.0f,0.0f}};
|
||||
|
||||
void Doom3Quest_Vibrate(int duration, int channel, float intensity )
|
||||
void Doom3Quest_Vibrate(int channel, float low, float high)
|
||||
{
|
||||
if (vibration_channel_duration[channel] > 0.0f)
|
||||
return;
|
||||
|
||||
if (vibration_channel_duration[channel] == -1.0f && duration != 0.0f)
|
||||
return;
|
||||
|
||||
vibration_channel_duration[channel] = duration;
|
||||
vibration_channel_intensity[channel] = intensity;
|
||||
vibration_channel_intensity[channel][0] = low;
|
||||
vibration_channel_intensity[channel][1] = high;
|
||||
}
|
||||
|
||||
void VR_Doom3Main(int argc, char** argv);
|
||||
|
||||
void VR_GetMove( float *joy_forward, float *joy_side, float *hmd_forward, float *hmd_side, float *up, float *yaw, float *pitch, float *roll )
|
||||
{
|
||||
void VR_GetMove( float *joy_forward, float *joy_side, float *hmd_forward, float *hmd_side, float *up, float *yaw, float *pitch, float *roll ) {
|
||||
*joy_side = remote_movementSideways;
|
||||
*joy_forward = remote_movementForward;
|
||||
*hmd_forward = positional_movementForward;
|
||||
*up = remote_movementUp;
|
||||
*joy_side = remote_movementSideways;
|
||||
*hmd_side = positional_movementSideways;
|
||||
*yaw = vr.hmdorientation[YAW] + snapTurn;
|
||||
*pitch = vr.hmdorientation[PITCH];
|
||||
*roll = vr.hmdorientation[ROLL];
|
||||
*up = remote_movementUp;
|
||||
//*yaw = vr.hmdorientation[YAW] + snapTurn;
|
||||
*yaw = snapTurn;
|
||||
//*pitch = vr.hmdorientation[PITCH];
|
||||
//*roll = vr.hmdorientation[ROLL];}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================================================================================
|
||||
|
||||
|
@ -1034,8 +1022,8 @@ static void ovrApp_Clear( ovrApp * app )
|
|||
memset(app->DisplayTime, 0, MAX_TRACKING_SAMPLES * sizeof(double));
|
||||
memset(app->Tracking, 0, MAX_TRACKING_SAMPLES * sizeof(ovrTracking2));
|
||||
app->SwapInterval = 1;
|
||||
app->CpuLevel = 4;
|
||||
app->GpuLevel = 4;
|
||||
app->CpuLevel = CPU_LEVEL;
|
||||
app->GpuLevel = GPU_LEVEL;
|
||||
app->MainThreadTid = 0;
|
||||
app->RenderThreadTid = 0;
|
||||
|
||||
|
@ -1406,7 +1394,7 @@ void Doom3Quest_finishEyeBuffer( )
|
|||
renderThreadCPUTime = GetTimeInMilliSeconds() - renderThreadCPUTime;
|
||||
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_INFO, "Doom3Quest", "RENDER THREAD TOTAL CPU TIME: %i", renderThreadCPUTime);
|
||||
//__android_log_print(ANDROID_LOG_INFO, "Doom3Quest", "RENDER THREAD TOTAL CPU TIME: %ld", renderThreadCPUTime);
|
||||
}
|
||||
|
||||
GLCheckErrors( __LINE__ );
|
||||
|
@ -1521,6 +1509,8 @@ void ActivateContext()
|
|||
gAppState.RenderThreadTid = gettid();
|
||||
}
|
||||
|
||||
int questType;
|
||||
|
||||
void * AppThreadFunction(void * parm ) {
|
||||
gAppThread = (ovrAppThread *) parm;
|
||||
|
||||
|
@ -1554,15 +1544,6 @@ void * AppThreadFunction(void * parm ) {
|
|||
ovrApp_Clear(&gAppState);
|
||||
gAppState.Java = java;
|
||||
|
||||
// This app will handle android gamepad events itself.
|
||||
vrapi_SetPropertyInt(&gAppState.Java, VRAPI_EAT_NATIVE_GAMEPAD_EVENTS, 0);
|
||||
|
||||
//Set FFR property
|
||||
vrapi_SetPropertyInt( &gAppState.Java, VRAPI_FOVEATION_LEVEL, FFR );
|
||||
|
||||
//Using a symmetrical render target
|
||||
m_height = m_width = (int)(vrapi_GetSystemPropertyInt(&java, VRAPI_SYS_PROP_SUGGESTED_EYE_TEXTURE_WIDTH) * SS_MULTIPLIER);
|
||||
|
||||
gAppState.CpuLevel = CPU_LEVEL;
|
||||
gAppState.GpuLevel = GPU_LEVEL;
|
||||
gAppState.MainThreadTid = gettid();
|
||||
|
@ -1573,6 +1554,41 @@ void * AppThreadFunction(void * parm ) {
|
|||
|
||||
chdir("/sdcard/Doom3Quest");
|
||||
|
||||
// This app will handle android gamepad events itself.
|
||||
vrapi_SetPropertyInt(&gAppState.Java, VRAPI_EAT_NATIVE_GAMEPAD_EVENTS, 0);
|
||||
|
||||
//Set device defaults
|
||||
if (vrapi_GetSystemPropertyInt(&java, VRAPI_SYS_PROP_DEVICE_TYPE) == VRAPI_DEVICE_TYPE_OCULUSQUEST)
|
||||
{
|
||||
questType = 1;
|
||||
DISPLAY_REFRESH = 60; // Fixed to 60 for oculus 1
|
||||
if (SS_MULTIPLIER == -1.0f)
|
||||
{
|
||||
SS_MULTIPLIER = 1.0f;
|
||||
}
|
||||
|
||||
if (NUM_MULTI_SAMPLES == -1)
|
||||
{
|
||||
NUM_MULTI_SAMPLES = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
questType = 2;
|
||||
if (SS_MULTIPLIER == -1.0f)
|
||||
{
|
||||
SS_MULTIPLIER = 1.1f;
|
||||
}
|
||||
|
||||
if (NUM_MULTI_SAMPLES == -1)
|
||||
{
|
||||
NUM_MULTI_SAMPLES = 1;
|
||||
}
|
||||
}
|
||||
|
||||
//Using a symmetrical render target
|
||||
m_height = m_width = (int)(vrapi_GetSystemPropertyInt(&java, VRAPI_SYS_PROP_SUGGESTED_EYE_TEXTURE_WIDTH) * SS_MULTIPLIER);
|
||||
|
||||
//First handle any messages in the queue
|
||||
while ( gAppState.Ovr == NULL ) {
|
||||
Doom3Quest_processMessageQueue();
|
||||
|
@ -1588,12 +1604,6 @@ void * AppThreadFunction(void * parm ) {
|
|||
// Create the scene if not yet created.
|
||||
ovrScene_Create( m_width, m_height, &gAppState.Scene, &java );
|
||||
|
||||
//Set the screen refresh - only for Quest 1
|
||||
bool quest1 = false;
|
||||
if (quest1) {
|
||||
vrapi_SetDisplayRefreshRate(gAppState.Ovr, DISPLAY_REFRESH);
|
||||
}
|
||||
|
||||
//Run loading loop until we are ready to start QzDoom
|
||||
while (!destroyed && !Doom3Quest_initialised) {
|
||||
Doom3Quest_processMessageQueue();
|
||||
|
@ -1601,6 +1611,11 @@ void * AppThreadFunction(void * parm ) {
|
|||
showLoadingIcon();
|
||||
}
|
||||
|
||||
if (DISPLAY_REFRESH != -1)
|
||||
{
|
||||
vrapi_SetDisplayRefreshRate(gAppState.Ovr, DISPLAY_REFRESH);
|
||||
}
|
||||
|
||||
//Should now be all set up and ready - start the Doom3 main loop
|
||||
VR_Doom3Main(argc, argv);
|
||||
|
||||
|
@ -1624,7 +1639,7 @@ void Doom3Quest_FrameSetup(int controlscheme)
|
|||
|
||||
if (!Doom3Quest_useScreenLayer())
|
||||
{
|
||||
screenYaw = vr.hmdorientation[YAW];
|
||||
screenYaw = vr.hmdorientation_temp[YAW];
|
||||
}
|
||||
|
||||
Doom3Quest_processHaptics();
|
||||
|
@ -1632,7 +1647,7 @@ void Doom3Quest_FrameSetup(int controlscheme)
|
|||
Doom3Quest_getTrackedRemotesOrientation(controlscheme);
|
||||
}
|
||||
|
||||
void Doom3Quest_processHaptics() {//Handle haptics
|
||||
/*void Doom3Quest_processHaptics() {//Handle haptics
|
||||
static float lastFrameTime = 0.0f;
|
||||
float timestamp = (float)(GetTimeInMilliSeconds());
|
||||
float frametime = timestamp - lastFrameTime;
|
||||
|
@ -1656,6 +1671,19 @@ void Doom3Quest_processHaptics() {//Handle haptics
|
|||
vrapi_SetHapticVibrationSimple(gAppState.Ovr, controllerIDs[i], 0.0f);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
void Doom3Quest_processHaptics() {//Handle haptics
|
||||
|
||||
float beat;
|
||||
bool enable;
|
||||
for (int h = 0; h < 2; ++h) {
|
||||
beat = fabs( vibration_channel_intensity[h][0] - vibration_channel_intensity[h][1] ) / 65535;
|
||||
if(beat > 0.0f)
|
||||
vrapi_SetHapticVibrationSimple(gAppState.Ovr, controllerIDs[1 - h], beat);
|
||||
else
|
||||
vrapi_SetHapticVibrationSimple(gAppState.Ovr, controllerIDs[1 - h], 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
void showLoadingIcon()
|
||||
|
@ -1712,16 +1740,18 @@ void Doom3Quest_getHMDOrientation() {
|
|||
*tracking = vrapi_GetPredictedTracking2(gAppState.Ovr, gAppState.DisplayTime[gAppState.MainThreadFrameIndex % MAX_TRACKING_SAMPLES]);
|
||||
|
||||
//Don't update game with tracking if we are in big screen mode
|
||||
if (!Doom3Quest_useScreenLayer()) {
|
||||
|
||||
const ovrQuatf quatHmd = tracking->HeadPose.Pose.Orientation;
|
||||
const ovrVector3f positionHmd = tracking->HeadPose.Pose.Position;
|
||||
|
||||
vec3_t rotation = {0};
|
||||
QuatToYawPitchRoll(quatHmd, rotation, vr.hmdorientation);
|
||||
setHMDPosition(positionHmd.x, positionHmd.y, positionHmd.z, vr.hmdorientation[YAW]);
|
||||
updateHMDOrientation();
|
||||
}
|
||||
//GB Do pass the stuff but block at my end (if big screen prompt is needed)
|
||||
const ovrQuatf quatHmd = tracking->HeadPose.Pose.Orientation;
|
||||
const ovrVector3f positionHmd = tracking->HeadPose.Pose.Position;
|
||||
//const ovrVector3f translationHmd = tracking->HeadPose.Pose.Translation;
|
||||
vec3_t rotation = {0};
|
||||
QuatToYawPitchRoll(quatHmd, rotation, vr.hmdorientation_temp);
|
||||
setHMDPosition(positionHmd.x, positionHmd.y, positionHmd.z, 0);
|
||||
//GB
|
||||
setHMDOrientation(quatHmd.x, quatHmd.y, quatHmd.z, quatHmd.w);
|
||||
//setHMDTranslation(translationHmd.x, translationHmd.y, translationHmd.z);
|
||||
//End GB
|
||||
updateHMDOrientation();
|
||||
}
|
||||
|
||||
void Doom3Quest_getTrackedRemotesOrientation(int controlscheme) {
|
||||
|
@ -1899,21 +1929,10 @@ int JNI_OnLoad(JavaVM* vm, void* reserved)
|
|||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_drbeef_doom3quest_GLES3JNILib_onCreate( JNIEnv * env, jclass activityClass, jobject activity,
|
||||
jstring commandLineParams)
|
||||
jstring commandLineParams, jlong refresh, jfloat ss, jlong msaa)
|
||||
{
|
||||
ALOGV( " GLES3JNILib::onCreate()" );
|
||||
|
||||
/* the global arg_xxx structs are initialised within the argtable */
|
||||
void *argtable[] = {
|
||||
ss = arg_dbl0("s", "supersampling", "<double>", "super sampling value (e.g. 1.0)"),
|
||||
cpu = arg_int0("c", "cpu", "<int>", "CPU perf index 1-4 (default: 2)"),
|
||||
gpu = arg_int0("g", "gpu", "<int>", "GPU perf index 1-4 (default: 3)"),
|
||||
msaa = arg_int0("m", "msaa", "<int>", "MSAA 1-4 (default: 1)"),
|
||||
ffr = arg_int0("f", "ffr", "<int>", "FFR 0-4 (default: 0)"),
|
||||
refresh = arg_int0("r", "refresh", "<int>", "Display Refresh 60 or 72 (default: 72)"),
|
||||
end = arg_end(20)
|
||||
};
|
||||
|
||||
jboolean iscopy;
|
||||
const char *arg = (*env)->GetStringUTFChars(env, commandLineParams, &iscopy);
|
||||
|
||||
|
@ -1930,42 +1949,22 @@ JNIEXPORT jlong JNICALL Java_com_drbeef_doom3quest_GLES3JNILib_onCreate( JNIEnv
|
|||
argv = malloc(sizeof(char*) * 255);
|
||||
argc = ParseCommandLine(strdup(cmdLine), argv);
|
||||
|
||||
/* verify the argtable[] entries were allocated sucessfully */
|
||||
if (arg_nullcheck(argtable) == 0) {
|
||||
/* Parse the command line as defined by argtable[] */
|
||||
arg_parse(argc, argv, argtable);
|
||||
|
||||
if (ss->count > 0 && ss->dval[0] > 0.0)
|
||||
{
|
||||
SS_MULTIPLIER = ss->dval[0];
|
||||
}
|
||||
|
||||
if (cpu->count > 0 && cpu->ival[0] > 0 && cpu->ival[0] < 10)
|
||||
{
|
||||
CPU_LEVEL = cpu->ival[0];
|
||||
}
|
||||
|
||||
if (gpu->count > 0 && gpu->ival[0] > 0 && gpu->ival[0] < 10)
|
||||
{
|
||||
GPU_LEVEL = gpu->ival[0];
|
||||
}
|
||||
|
||||
if (msaa->count > 0 && msaa->ival[0] > 0 && msaa->ival[0] < 5)
|
||||
{
|
||||
NUM_MULTI_SAMPLES = msaa->ival[0];
|
||||
}
|
||||
|
||||
if (ffr->count > 0 && ffr->ival[0] >= 0 && ffr->ival[0] <= 4)
|
||||
{
|
||||
FFR = ffr->ival[0];
|
||||
}
|
||||
|
||||
if (refresh->count > 0 && (refresh->ival[0] == 60 || refresh->ival[0] == 72))
|
||||
{
|
||||
DISPLAY_REFRESH = refresh->ival[0];
|
||||
}
|
||||
if (ss != -1.0f)
|
||||
{
|
||||
SS_MULTIPLIER = ss;
|
||||
}
|
||||
|
||||
if (msaa != -1)
|
||||
{
|
||||
NUM_MULTI_SAMPLES = msaa;
|
||||
}
|
||||
|
||||
if (refresh != -1)
|
||||
{
|
||||
DISPLAY_REFRESH = refresh;
|
||||
}
|
||||
|
||||
|
||||
ovrAppThread * appThread = (ovrAppThread *) malloc( sizeof( ovrAppThread ) );
|
||||
ovrAppThread_Create( appThread, env, activity, activityClass );
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
typedef float vec3_t[3];
|
||||
typedef float vec4_t[4];
|
||||
|
||||
typedef struct {
|
||||
bool screen;
|
||||
|
@ -23,26 +24,40 @@ typedef struct {
|
|||
int lastweaponid;
|
||||
int holsteritemactive; //0 - nothing, 1 - flashlight
|
||||
|
||||
//FP - Carry original values
|
||||
vec4_t hmdorientation_quat;
|
||||
vec3_t hmdtranslation;
|
||||
vec3_t lhandposition;
|
||||
vec3_t rhandposition;
|
||||
vec4_t lhand_orientation_quat;
|
||||
vec4_t rhand_orientation_quat;
|
||||
|
||||
|
||||
vec3_t hmdposition;
|
||||
vec3_t hmdposition_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t hmdposition_delta;
|
||||
|
||||
vec3_t hmdorientation;
|
||||
vec3_t hmdorientation_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t hmdorientation_delta;
|
||||
//FP - Temp Variables for other stuff
|
||||
vec3_t hmdorientation_temp;
|
||||
vec3_t weaponangles_temp;
|
||||
vec3_t weaponangles_last_temp; // Don't use this, it is just for calculating delta!
|
||||
vec3_t weaponangles_delta_temp;
|
||||
|
||||
vec3_t weaponangles_unadjusted;
|
||||
/*vec3_t hmdorientation;
|
||||
vec3_t hmdorientation_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t hmdorientation_delta;*/
|
||||
|
||||
/*vec3_t weaponangles_unadjusted;
|
||||
vec3_t weaponangles;
|
||||
vec3_t weaponangles_last; // Don't use this, it is just for calculating delta!
|
||||
vec3_t weaponangles_delta;
|
||||
vec3_t weaponangles_delta;*/
|
||||
|
||||
vec3_t flashlightHolsterOffset; // Where the flashlight can be picked up from
|
||||
//vec3_t flashlightHolsterOffset; // Where the flashlight can be picked up from
|
||||
|
||||
|
||||
vec3_t current_weaponoffset;
|
||||
/*vec3_t current_weaponoffset;
|
||||
float current_weaponoffset_timestamp;
|
||||
vec3_t weaponoffset_history[NUM_WEAPON_SAMPLES];
|
||||
float weaponoffset_history_timestamp[NUM_WEAPON_SAMPLES];
|
||||
float weaponoffset_history_timestamp[NUM_WEAPON_SAMPLES];*/
|
||||
|
||||
vec3_t throw_origin;
|
||||
vec3_t throw_trajectory;
|
||||
|
@ -52,17 +67,17 @@ typedef struct {
|
|||
|
||||
bool velocitytriggered; // Weapon attack triggered by velocity (knife)
|
||||
|
||||
vec3_t offhandangles;
|
||||
vec3_t offhandoffset;
|
||||
vec3_t offhandangles_temp;
|
||||
vec3_t offhandoffset_temp;
|
||||
|
||||
//
|
||||
// Teleport Stuff
|
||||
//
|
||||
bool teleportenabled;
|
||||
/*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
|
||||
bool teleportexecute; // execute the teleport*/
|
||||
|
||||
|
||||
|
||||
|
@ -70,10 +85,10 @@ typedef struct {
|
|||
// Test stuff for weapon alignment
|
||||
//////////////////////////////////////
|
||||
|
||||
char test_name[256];
|
||||
/*char test_name[256];
|
||||
float test_scale;
|
||||
vec3_t test_angles;
|
||||
vec3_t test_offset;
|
||||
vec3_t test_offset;*/
|
||||
|
||||
} vrClientInfo;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ bool Doom3Quest_useScreenLayer();
|
|||
|
||||
void Doom3Quest_GetScreenRes(int *width, int *height);
|
||||
|
||||
void Doom3Quest_Vibrate(int duration, int channel, float intensity);
|
||||
void Doom3Quest_Vibrate(int channel, float low, float high);
|
||||
|
||||
bool Doom3Quest_processMessageQueue();
|
||||
|
||||
|
|
|
@ -149,8 +149,8 @@ void controlMouse(ovrInputStateTrackedRemote *newState, ovrInputStateTrackedRemo
|
|||
static int cursorX = 0;
|
||||
static int cursorY = 0;
|
||||
|
||||
cursorX = (float)(pVRClientInfo->weaponangles_delta[YAW] * 18.0f);
|
||||
cursorY = (float)(-pVRClientInfo->weaponangles_delta[PITCH] * 18.0f);
|
||||
cursorX = (float)(pVRClientInfo->weaponangles_delta_temp[YAW] * 18.0f);
|
||||
cursorY = (float)(-pVRClientInfo->weaponangles_delta_temp[PITCH] * 18.0f);
|
||||
|
||||
Sys_AddMouseMoveEvent(cursorX, cursorY);
|
||||
}
|
|
@ -50,7 +50,7 @@ int Sys_Milliseconds( void ) {
|
|||
return curtime;
|
||||
}
|
||||
|
||||
void Android_SetImpuse(int impulse);
|
||||
void Android_SetImpulse(int impulse);
|
||||
void Android_SetCommand(const char * cmd);
|
||||
void Android_ButtonChange(int key, int state);
|
||||
int Android_GetCVarInteger(const char* cvar);
|
||||
|
@ -70,7 +70,7 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
pVRClientInfo->right_handed = controlscheme < 10 ||
|
||||
controlscheme == 99; // Always right-handed for weapon calibration
|
||||
|
||||
pVRClientInfo->teleportenabled = vr_teleport != 0;
|
||||
//pVRClientInfo->teleportenabled = vr_teleport != 0;
|
||||
|
||||
static bool dominantGripPushed = false;
|
||||
static float dominantGripPushTime = 0.0f;
|
||||
|
@ -126,9 +126,35 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
|
||||
|
||||
{
|
||||
//Store original values
|
||||
const ovrQuatf quatRHand = pWeapon->HeadPose.Pose.Orientation;
|
||||
const ovrVector3f positionRHand = pWeapon->HeadPose.Pose.Position;
|
||||
const ovrQuatf quatLHand = pOff->HeadPose.Pose.Orientation;
|
||||
const ovrVector3f positionLHand = pOff->HeadPose.Pose.Position;
|
||||
//Right Hand
|
||||
if(pVRClientInfo->right_handed) {
|
||||
VectorSet(pVRClientInfo->rhandposition, positionRHand.x, positionRHand.y, positionRHand.z);
|
||||
Vector4Set(pVRClientInfo->rhand_orientation_quat, quatRHand.x, quatRHand.y, quatRHand.z, quatRHand.w);
|
||||
VectorSet(pVRClientInfo->lhandposition, positionLHand.x, positionLHand.y, positionLHand.z);
|
||||
Vector4Set(pVRClientInfo->lhand_orientation_quat, quatLHand.x, quatLHand.y, quatLHand.z, quatLHand.w);
|
||||
} else {
|
||||
VectorSet(pVRClientInfo->lhandposition, positionRHand.x, positionRHand.y, positionRHand.z);
|
||||
Vector4Set(pVRClientInfo->lhand_orientation_quat, quatRHand.x, quatRHand.y, quatRHand.z, quatRHand.w);
|
||||
VectorSet(pVRClientInfo->rhandposition, positionLHand.x, positionLHand.y, positionLHand.z);
|
||||
Vector4Set(pVRClientInfo->rhand_orientation_quat, quatLHand.x, quatLHand.y, quatLHand.z, quatLHand.w);
|
||||
}
|
||||
|
||||
|
||||
//Set gun angles - We need to calculate all those we might need (including adjustments) for the client to then take its pick
|
||||
vec3_t rotation = {0};
|
||||
rotation[PITCH] = 30;
|
||||
rotation[PITCH] = vr_weapon_pitchadjust;
|
||||
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, pVRClientInfo->weaponangles_temp);
|
||||
VectorSubtract(pVRClientInfo->weaponangles_last_temp, pVRClientInfo->weaponangles_temp, pVRClientInfo->weaponangles_delta_temp);
|
||||
VectorCopy(pVRClientInfo->weaponangles_temp, pVRClientInfo->weaponangles_last_temp);
|
||||
/*
|
||||
vec3_t rotation = {0};
|
||||
rotation[PITCH] = 30;
|
||||
QuatToYawPitchRoll(pWeapon->HeadPose.Pose.Orientation, rotation, pVRClientInfo->weaponangles_unadjusted);
|
||||
|
||||
rotation[PITCH] = vr_weapon_pitchadjust;
|
||||
|
@ -136,26 +162,27 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
|
||||
VectorSubtract(pVRClientInfo->weaponangles_last, pVRClientInfo->weaponangles, pVRClientInfo->weaponangles_delta);
|
||||
VectorCopy(pVRClientInfo->weaponangles, pVRClientInfo->weaponangles_last);
|
||||
*/
|
||||
}
|
||||
|
||||
//Menu button - can be used in all modes
|
||||
handleTrackedControllerButton_AsKey(&leftTrackedRemoteState_new, &leftTrackedRemoteState_old, ovrButton_Enter, K_ESCAPE);
|
||||
|
||||
if ( inMenu || inGameGuiActive || inCinematic ) // Specific cases where we need to interact using mouse etc
|
||||
if ( inMenu || inCinematic ) // Specific cases where we need to interact using mouse etc
|
||||
{
|
||||
controlMouse(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld);
|
||||
handleTrackedControllerButton_AsButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, true, ovrButton_Trigger, 1);
|
||||
}
|
||||
|
||||
if ( objectiveSystemActive )
|
||||
/*if ( objectiveSystemActive )
|
||||
{
|
||||
controlMouse(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld);
|
||||
handleTrackedControllerButton_AsButton(pDominantTrackedRemoteNew, pDominantTrackedRemoteOld, true, ovrButton_Trigger, 1);
|
||||
if (((pOffTrackedRemoteNew->Buttons & offButton1) != (pOffTrackedRemoteOld->Buttons & offButton1)) && (pOffTrackedRemoteNew->Buttons & offButton1))
|
||||
{
|
||||
Android_SetImpuse(UB_IMPULSE19);
|
||||
Android_SetImpulse(UB_IMPULSE19);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if ( !inCinematic && !inMenu )
|
||||
{
|
||||
|
@ -165,7 +192,7 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
}
|
||||
else if (!canUseQuickSave) {
|
||||
int channel = (controlscheme >= 10) ? 1 : 0;
|
||||
Doom3Quest_Vibrate(40, channel, 0.5); // vibrate to let user know they can switch
|
||||
//Doom3Quest_Vibrate(channel, 0.5,0.5); // vibrate to let user know they can switch
|
||||
canUseQuickSave = true;
|
||||
}
|
||||
|
||||
|
@ -188,13 +215,7 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
if (((pOffTrackedRemoteNew->Buttons & offButton1) !=
|
||||
(pOffTrackedRemoteOld->Buttons & offButton1)) &&
|
||||
(pOffTrackedRemoteNew->Buttons & offButton1)) {
|
||||
Android_SetImpuse(UB_IMPULSE19);
|
||||
}
|
||||
|
||||
if (((pOffTrackedRemoteNew->Buttons & offButton2) !=
|
||||
(pOffTrackedRemoteOld->Buttons & offButton2)) &&
|
||||
(pOffTrackedRemoteNew->Buttons & offButton2)) {
|
||||
forceVirtualScreen = !forceVirtualScreen;
|
||||
Android_SetImpulse(UB_IMPULSE19);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,6 +236,7 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
//dominant hand stuff first
|
||||
{
|
||||
//Record recent weapon position for trajectory based stuff
|
||||
/*
|
||||
for (int i = (NUM_WEAPON_SAMPLES-1); i != 0; --i)
|
||||
{
|
||||
VectorCopy(pVRClientInfo->weaponoffset_history[i-1], pVRClientInfo->weaponoffset_history[i]);
|
||||
|
@ -241,7 +263,7 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
|
||||
//Set origin to the newer reading offset
|
||||
VectorCopy(pVRClientInfo->weaponoffset_history[NEWER_READING], pVRClientInfo->throw_origin);
|
||||
}
|
||||
}*/
|
||||
|
||||
//Does weapon velocity trigger attack (knife) and is it fast enough
|
||||
static bool velocityTriggeredAttack = false;
|
||||
|
@ -255,7 +277,7 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
velocityTriggeredAttack = (velocity > VELOCITY_TRIGGER);
|
||||
|
||||
if (fired != velocityTriggeredAttack) {
|
||||
ALOGV("**WEAPON EVENT** veocity triggered %s", velocityTriggeredAttack ? "+attack" : "-attack");
|
||||
ALOGV("**WEAPON EVENT** velocity triggered %s", velocityTriggeredAttack ? "+attack" : "-attack");
|
||||
Android_ButtonChange(UB_ATTACK, velocityTriggeredAttack ? 1 : 0);
|
||||
fired = velocityTriggeredAttack;
|
||||
}
|
||||
|
@ -264,11 +286,11 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
{
|
||||
//send a stop attack as we have an unfinished velocity attack
|
||||
velocityTriggeredAttack = false;
|
||||
ALOGV("**WEAPON EVENT** veocity triggered -attack");
|
||||
ALOGV("**WEAPON EVENT** velocity triggered -attack");
|
||||
Android_ButtonChange(UB_ATTACK, velocityTriggeredAttack ? 1 : 0);
|
||||
}
|
||||
|
||||
if (pVRClientInfo->weapon_stabilised)
|
||||
/*if (pVRClientInfo->weapon_stabilised)
|
||||
{
|
||||
{
|
||||
float x = pOff->HeadPose.Pose.Position.x - pWeapon->HeadPose.Pose.Position.x;
|
||||
|
@ -283,8 +305,9 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/*
|
||||
if (pVRClientInfo->weaponid != -1 &&
|
||||
pVRClientInfo->weaponid != 11)
|
||||
{
|
||||
|
@ -309,7 +332,7 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
|
||||
canGrabFlashlight = true;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
dominantGripPushed = (pDominantTrackedRemoteNew->Buttons &
|
||||
ovrButton_GripTrigger) != 0;
|
||||
|
@ -326,9 +349,9 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
pVRClientInfo->lastweaponid = pVRClientInfo->weaponid;
|
||||
|
||||
//Initiate flashlight from backpack mode
|
||||
Android_SetImpuse(UB_IMPULSE11);
|
||||
Android_SetImpulse(UB_IMPULSE11);
|
||||
int channel = (controlscheme >= 10) ? 0 : 1;
|
||||
Doom3Quest_Vibrate(80, channel, 0.8); // vibrate to let user know they switched
|
||||
//Doom3Quest_Vibrate(80, channel, 0.8); // vibrate to let user know they switched
|
||||
|
||||
pVRClientInfo->holsteritemactive = 1;
|
||||
}
|
||||
|
@ -339,13 +362,13 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
if (pVRClientInfo->holsteritemactive == 1) {
|
||||
//Restores last used weapon if possible
|
||||
if (pVRClientInfo->weaponid != -1) {
|
||||
Android_SetImpuse(UB_IMPULSE0 + pVRClientInfo->weaponid);
|
||||
Android_SetImpulse(UB_IMPULSE0 + pVRClientInfo->weaponid);
|
||||
}
|
||||
pVRClientInfo->holsteritemactive = 0;
|
||||
}
|
||||
else if ((GetTimeInMilliSeconds() - dominantGripPushTime) < vr_reloadtimeoutms) {
|
||||
//Reload
|
||||
Android_SetImpuse(UB_IMPULSE13);
|
||||
Android_SetImpulse(UB_IMPULSE13);
|
||||
}
|
||||
|
||||
dominantGripPushTime = 0;
|
||||
|
@ -353,6 +376,17 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
}
|
||||
|
||||
float controllerYawHeading = 0.0f;
|
||||
//GBFP - off-hand stuff
|
||||
{
|
||||
pVRClientInfo->offhandoffset_temp[0] = pOff->HeadPose.Pose.Position.x - pVRClientInfo->hmdposition[0];
|
||||
pVRClientInfo->offhandoffset_temp[1] = pOff->HeadPose.Pose.Position.y - pVRClientInfo->hmdposition[1];
|
||||
pVRClientInfo->offhandoffset_temp[2] = pOff->HeadPose.Pose.Position.z - pVRClientInfo->hmdposition[2];
|
||||
|
||||
vec3_t rotation = {0};
|
||||
rotation[PITCH] = -45;
|
||||
QuatToYawPitchRoll(pOff->HeadPose.Pose.Orientation, rotation, pVRClientInfo->offhandangles_temp);
|
||||
}
|
||||
/*
|
||||
//off-hand stuff
|
||||
{
|
||||
pVRClientInfo->offhandoffset[0] = pOff->HeadPose.Pose.Position.x - pVRClientInfo->hmdposition[0];
|
||||
|
@ -370,12 +404,13 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
{
|
||||
controllerYawHeading = 0.0f;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//Right-hand specific stuff
|
||||
{
|
||||
//Adjust positional factor for this sample based on how long the last frame took, it should
|
||||
//approximately even out the positional movement on a per frame basis (especially when fps is much lower than 60)
|
||||
/*
|
||||
static float lastSampleTime = 0;
|
||||
float sampleTime = Sys_Milliseconds();
|
||||
float vr_positional_factor = 2400.0f * ((1000.0f / (float)Doom3Quest_GetRefresh()) / (sampleTime-lastSampleTime));
|
||||
|
@ -383,11 +418,13 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
|
||||
//This section corrects for the fact that the controller actually controls direction of movement, but we want to move relative to the direction the
|
||||
//player is facing for positional tracking
|
||||
|
||||
vec2_t v;
|
||||
rotateAboutOrigin(-pVRClientInfo->hmdposition_delta[0] * vr_positional_factor,
|
||||
pVRClientInfo->hmdposition_delta[2] * vr_positional_factor, - pVRClientInfo->hmdorientation[YAW], v);
|
||||
positional_movementSideways = v[0];
|
||||
positional_movementForward = v[1];
|
||||
*/
|
||||
|
||||
//Jump (B Button)
|
||||
if (pVRClientInfo->holsteritemactive != 2 && !canGrabFlashlight) {
|
||||
|
@ -429,12 +466,12 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
if (between(0.8f, pPrimaryJoystick->y, 1.0f))
|
||||
{
|
||||
//Previous Weapon
|
||||
Android_SetImpuse(UB_IMPULSE15);
|
||||
Android_SetImpulse(UB_IMPULSE15);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Next Weapon
|
||||
Android_SetImpuse(UB_IMPULSE14);
|
||||
Android_SetImpulse(UB_IMPULSE14);
|
||||
}
|
||||
itemSwitched = true;
|
||||
}
|
||||
|
@ -462,9 +499,9 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
remote_movementForward = v[1] * vr_movement_multiplier;
|
||||
|
||||
if (!canUseQuickSave) {
|
||||
if (((secondaryButtonsNew & secondaryButton1) !=
|
||||
(secondaryButtonsOld & secondaryButton1)) &&
|
||||
(secondaryButtonsNew & secondaryButton1)) {
|
||||
if (((secondaryButtonsNew & secondaryButton2) !=
|
||||
(secondaryButtonsOld & secondaryButton2)) &&
|
||||
(secondaryButtonsNew & secondaryButton2)) {
|
||||
|
||||
if (dominantGripPushed) {
|
||||
Android_SetCommand("give all");
|
||||
|
@ -477,28 +514,13 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
(pOffTrackedRemoteOld->Buttons & ovrButton_Joystick)) {
|
||||
|
||||
pVRClientInfo->visible_hud = !pVRClientInfo->visible_hud;
|
||||
|
||||
//Turn on Flashlight
|
||||
Android_SetImpulse(UB_IMPULSE16);
|
||||
}
|
||||
|
||||
//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
|
||||
if (!pVRClientInfo->teleportenabled)
|
||||
{
|
||||
//Run
|
||||
handleTrackedControllerButton_AsButton(pOffTrackedRemoteNew, pOffTrackedRemoteOld, false, ovrButton_Trigger, UB_SPEED);
|
||||
|
||||
} else {
|
||||
if (pOffTrackedRemoteNew->Buttons & ovrButton_Trigger)
|
||||
{
|
||||
pVRClientInfo->teleportseek = true;
|
||||
}
|
||||
else if (pVRClientInfo->teleportseek)
|
||||
{
|
||||
pVRClientInfo->teleportseek = false;
|
||||
pVRClientInfo->teleportexecute = pVRClientInfo->teleportready;
|
||||
pVRClientInfo->teleportready = false;
|
||||
}
|
||||
}
|
||||
handleTrackedControllerButton_AsButton(pOffTrackedRemoteNew, pOffTrackedRemoteOld, false, ovrButton_Trigger, UB_SPEED);
|
||||
|
||||
int vr_turn_mode = Android_GetCVarInteger("vr_turnmode");
|
||||
float vr_turn_angle = Android_GetCVarInteger("vr_turnangle");
|
||||
|
@ -518,6 +540,8 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
if (snapTurn < -180.0f) {
|
||||
snapTurn += 360.f;
|
||||
}
|
||||
} else {
|
||||
snapTurn = 0;
|
||||
}
|
||||
} else if (pPrimaryJoystick->x < 0.3f) {
|
||||
increaseSnap = true;
|
||||
|
@ -539,6 +563,8 @@ void HandleInput_Default( int controlscheme, ovrInputStateTrackedRemote *pDomina
|
|||
snapTurn -= 360.f;
|
||||
}
|
||||
|
||||
} else {
|
||||
snapTurn = 0;
|
||||
}
|
||||
} else if (pPrimaryJoystick->x > -0.3f) {
|
||||
decreaseSnap = true;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,305 +0,0 @@
|
|||
/*******************************************************************************
|
||||
* This file is part of the argtable3 library.
|
||||
*
|
||||
* Copyright (C) 1998-2001,2003-2011,2013 Stewart Heitmann
|
||||
* <sheitmann@users.sourceforge.net>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of STEWART HEITMANN nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL STEWART HEITMANN BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef ARGTABLE3
|
||||
#define ARGTABLE3
|
||||
|
||||
#include <stdio.h> /* FILE */
|
||||
#include <time.h> /* struct tm */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ARG_REX_ICASE 1
|
||||
|
||||
/* bit masks for arg_hdr.flag */
|
||||
enum
|
||||
{
|
||||
ARG_TERMINATOR=0x1,
|
||||
ARG_HASVALUE=0x2,
|
||||
ARG_HASOPTVALUE=0x4
|
||||
};
|
||||
|
||||
typedef void (arg_resetfn)(void *parent);
|
||||
typedef int (arg_scanfn)(void *parent, const char *argval);
|
||||
typedef int (arg_checkfn)(void *parent);
|
||||
typedef void (arg_errorfn)(void *parent, FILE *fp, int error, const char *argval, const char *progname);
|
||||
|
||||
|
||||
/*
|
||||
* The arg_hdr struct defines properties that are common to all arg_xxx structs.
|
||||
* The argtable library requires each arg_xxx struct to have an arg_hdr
|
||||
* struct as its first data member.
|
||||
* The argtable library functions then use this data to identify the
|
||||
* properties of the command line option, such as its option tags,
|
||||
* datatype string, and glossary strings, and so on.
|
||||
* Moreover, the arg_hdr struct contains pointers to custom functions that
|
||||
* are provided by each arg_xxx struct which perform the tasks of parsing
|
||||
* that particular arg_xxx arguments, performing post-parse checks, and
|
||||
* reporting errors.
|
||||
* These functions are private to the individual arg_xxx source code
|
||||
* and are the pointer to them are initiliased by that arg_xxx struct's
|
||||
* constructor function. The user could alter them after construction
|
||||
* if desired, but the original intention is for them to be set by the
|
||||
* constructor and left unaltered.
|
||||
*/
|
||||
struct arg_hdr
|
||||
{
|
||||
char flag; /* Modifier flags: ARG_TERMINATOR, ARG_HASVALUE. */
|
||||
const char *shortopts; /* String defining the short options */
|
||||
const char *longopts; /* String defiing the long options */
|
||||
const char *datatype; /* Description of the argument data type */
|
||||
const char *glossary; /* Description of the option as shown by arg_print_glossary function */
|
||||
int mincount; /* Minimum number of occurences of this option accepted */
|
||||
int maxcount; /* Maximum number of occurences if this option accepted */
|
||||
void *parent; /* Pointer to parent arg_xxx struct */
|
||||
arg_resetfn *resetfn; /* Pointer to parent arg_xxx reset function */
|
||||
arg_scanfn *scanfn; /* Pointer to parent arg_xxx scan function */
|
||||
arg_checkfn *checkfn; /* Pointer to parent arg_xxx check function */
|
||||
arg_errorfn *errorfn; /* Pointer to parent arg_xxx error function */
|
||||
void *priv; /* Pointer to private header data for use by arg_xxx functions */
|
||||
};
|
||||
|
||||
struct arg_rem
|
||||
{
|
||||
struct arg_hdr hdr; /* The mandatory argtable header struct */
|
||||
};
|
||||
|
||||
struct arg_lit
|
||||
{
|
||||
struct arg_hdr hdr; /* The mandatory argtable header struct */
|
||||
int count; /* Number of matching command line args */
|
||||
};
|
||||
|
||||
struct arg_int
|
||||
{
|
||||
struct arg_hdr hdr; /* The mandatory argtable header struct */
|
||||
int count; /* Number of matching command line args */
|
||||
int *ival; /* Array of parsed argument values */
|
||||
};
|
||||
|
||||
struct arg_dbl
|
||||
{
|
||||
struct arg_hdr hdr; /* The mandatory argtable header struct */
|
||||
int count; /* Number of matching command line args */
|
||||
double *dval; /* Array of parsed argument values */
|
||||
};
|
||||
|
||||
struct arg_str
|
||||
{
|
||||
struct arg_hdr hdr; /* The mandatory argtable header struct */
|
||||
int count; /* Number of matching command line args */
|
||||
const char **sval; /* Array of parsed argument values */
|
||||
};
|
||||
|
||||
struct arg_rex
|
||||
{
|
||||
struct arg_hdr hdr; /* The mandatory argtable header struct */
|
||||
int count; /* Number of matching command line args */
|
||||
const char **sval; /* Array of parsed argument values */
|
||||
};
|
||||
|
||||
struct arg_file
|
||||
{
|
||||
struct arg_hdr hdr; /* The mandatory argtable header struct */
|
||||
int count; /* Number of matching command line args*/
|
||||
const char **filename; /* Array of parsed filenames (eg: /home/foo.bar) */
|
||||
const char **basename; /* Array of parsed basenames (eg: foo.bar) */
|
||||
const char **extension; /* Array of parsed extensions (eg: .bar) */
|
||||
};
|
||||
|
||||
struct arg_date
|
||||
{
|
||||
struct arg_hdr hdr; /* The mandatory argtable header struct */
|
||||
const char *format; /* strptime format string used to parse the date */
|
||||
int count; /* Number of matching command line args */
|
||||
struct tm *tmval; /* Array of parsed time values */
|
||||
};
|
||||
|
||||
enum {ARG_ELIMIT=1, ARG_EMALLOC, ARG_ENOMATCH, ARG_ELONGOPT, ARG_EMISSARG};
|
||||
struct arg_end
|
||||
{
|
||||
struct arg_hdr hdr; /* The mandatory argtable header struct */
|
||||
int count; /* Number of errors encountered */
|
||||
int *error; /* Array of error codes */
|
||||
void **parent; /* Array of pointers to offending arg_xxx struct */
|
||||
const char **argval; /* Array of pointers to offending argv[] string */
|
||||
};
|
||||
|
||||
|
||||
/**** arg_xxx constructor functions *********************************/
|
||||
|
||||
struct arg_rem* arg_rem(const char* datatype, const char* glossary);
|
||||
|
||||
struct arg_lit* arg_lit0(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* glossary);
|
||||
struct arg_lit* arg_lit1(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char *glossary);
|
||||
struct arg_lit* arg_litn(const char* shortopts,
|
||||
const char* longopts,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char *glossary);
|
||||
|
||||
struct arg_key* arg_key0(const char* keyword,
|
||||
int flags,
|
||||
const char* glossary);
|
||||
struct arg_key* arg_key1(const char* keyword,
|
||||
int flags,
|
||||
const char* glossary);
|
||||
struct arg_key* arg_keyn(const char* keyword,
|
||||
int flags,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char* glossary);
|
||||
|
||||
struct arg_int* arg_int0(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* datatype,
|
||||
const char* glossary);
|
||||
struct arg_int* arg_int1(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* datatype,
|
||||
const char *glossary);
|
||||
struct arg_int* arg_intn(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char *datatype,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char *glossary);
|
||||
|
||||
struct arg_dbl* arg_dbl0(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* datatype,
|
||||
const char* glossary);
|
||||
struct arg_dbl* arg_dbl1(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* datatype,
|
||||
const char *glossary);
|
||||
struct arg_dbl* arg_dbln(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char *datatype,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char *glossary);
|
||||
|
||||
struct arg_str* arg_str0(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* datatype,
|
||||
const char* glossary);
|
||||
struct arg_str* arg_str1(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* datatype,
|
||||
const char *glossary);
|
||||
struct arg_str* arg_strn(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* datatype,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char *glossary);
|
||||
|
||||
struct arg_rex* arg_rex0(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* pattern,
|
||||
const char* datatype,
|
||||
int flags,
|
||||
const char* glossary);
|
||||
struct arg_rex* arg_rex1(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* pattern,
|
||||
const char* datatype,
|
||||
int flags,
|
||||
const char *glossary);
|
||||
struct arg_rex* arg_rexn(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* pattern,
|
||||
const char* datatype,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
int flags,
|
||||
const char *glossary);
|
||||
|
||||
struct arg_file* arg_file0(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* datatype,
|
||||
const char* glossary);
|
||||
struct arg_file* arg_file1(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* datatype,
|
||||
const char *glossary);
|
||||
struct arg_file* arg_filen(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* datatype,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char *glossary);
|
||||
|
||||
struct arg_date* arg_date0(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* format,
|
||||
const char* datatype,
|
||||
const char* glossary);
|
||||
struct arg_date* arg_date1(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* format,
|
||||
const char* datatype,
|
||||
const char *glossary);
|
||||
struct arg_date* arg_daten(const char* shortopts,
|
||||
const char* longopts,
|
||||
const char* format,
|
||||
const char* datatype,
|
||||
int mincount,
|
||||
int maxcount,
|
||||
const char *glossary);
|
||||
|
||||
struct arg_end* arg_end(int maxerrors);
|
||||
|
||||
|
||||
/**** other functions *******************************************/
|
||||
int arg_nullcheck(void **argtable);
|
||||
int arg_parse(int argc, char **argv, void **argtable);
|
||||
void arg_print_option(FILE *fp, const char *shortopts, const char *longopts, const char *datatype, const char *suffix);
|
||||
void arg_print_syntax(FILE *fp, void **argtable, const char *suffix);
|
||||
void arg_print_syntaxv(FILE *fp, void **argtable, const char *suffix);
|
||||
void arg_print_glossary(FILE *fp, void **argtable, const char *format);
|
||||
void arg_print_glossary_gnu(FILE *fp, void **argtable);
|
||||
void arg_print_errors(FILE* fp, struct arg_end* end, const char* progname);
|
||||
void arg_freetable(void **argtable, size_t n);
|
||||
|
||||
/**** deprecated functions, for back-compatibility only ********/
|
||||
void arg_free(void **argtable);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -740,7 +740,6 @@ set(src_d3xp
|
|||
d3xp/physics/Physics_Static.cpp
|
||||
d3xp/physics/Physics_StaticMulti.cpp
|
||||
d3xp/physics/Push.cpp
|
||||
d3xp/Grabber.cpp
|
||||
d3xp/physics/Force_Grab.cpp
|
||||
)
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
*/
|
||||
|
||||
#include <SDL.h>
|
||||
#include <d3es-multithread-master/neo/game/Vr.h>
|
||||
|
||||
|
||||
#include "sys/platform.h"
|
||||
#include "idlib/containers/HashTable.h"
|
||||
|
@ -76,6 +78,11 @@ struct version_s {
|
|||
char string[256];
|
||||
} version;
|
||||
|
||||
|
||||
idCVar vr_refresh( "vr_refresh", "60", CVAR_INTEGER | CVAR_ARCHIVE, "Refresh rate" );
|
||||
idCVar vr_supersampling( "vr_supersampling", "-1.0", CVAR_FLOAT | CVAR_ARCHIVE, "Supersampling" );
|
||||
idCVar vr_msaa( "vr_msaa", "1", CVAR_FLOAT | CVAR_ARCHIVE, "MSAA" );
|
||||
|
||||
idCVar com_version( "si_version", version.string, CVAR_SYSTEM|CVAR_ROM|CVAR_SERVERINFO, "engine version" );
|
||||
idCVar com_skipRenderer( "com_skipRenderer", "0", CVAR_BOOL|CVAR_SYSTEM, "skip the renderer completely" );
|
||||
idCVar com_machineSpec( "com_machineSpec", "-1", CVAR_INTEGER | CVAR_ARCHIVE | CVAR_SYSTEM, "hardware classification, -1 = not detected, 0 = low quality, 1 = medium quality, 2 = high quality, 3 = ultra quality" );
|
||||
|
@ -162,7 +169,7 @@ public:
|
|||
virtual int ButtonState( int key );
|
||||
virtual int KeyState( int key );
|
||||
|
||||
virtual void Vibrate(int duration, int channel, float intensity );
|
||||
virtual void Vibrate(int channel, float low, float high );
|
||||
|
||||
// DG: hack to allow adding callbacks and exporting additional functions without breaking the game ABI
|
||||
// see Common.h for longer explanation...
|
||||
|
@ -1460,7 +1467,7 @@ void Com_ExecMachineSpec_f( const idCmdArgs &args ) {
|
|||
cvarSystem->SetCVarInteger( "image_preload", 1, CVAR_ARCHIVE );
|
||||
cvarSystem->SetCVarInteger( "image_useAllFormats", 1, CVAR_ARCHIVE );
|
||||
cvarSystem->SetCVarInteger( "image_usePrecompressedTextures", 1, CVAR_ARCHIVE );
|
||||
cvarSystem->SetCVarInteger( "image_downSize", 1, CVAR_ARCHIVE );
|
||||
cvarSystem->SetCVarInteger( "image_downSize", 0, CVAR_ARCHIVE );
|
||||
cvarSystem->SetCVarInteger( "image_anisotropy", 0, CVAR_ARCHIVE );
|
||||
cvarSystem->SetCVarInteger( "image_useCompression", 1, CVAR_ARCHIVE );
|
||||
cvarSystem->SetCVarInteger( "image_ignoreHighQuality", 1, CVAR_ARCHIVE );
|
||||
|
@ -1478,8 +1485,8 @@ void Com_ExecMachineSpec_f( const idCmdArgs &args ) {
|
|||
cvarSystem->SetCVarBool( "r_forceLoadImages", false, CVAR_ARCHIVE );
|
||||
|
||||
cvarSystem->SetCVarBool( "g_decals", true, CVAR_ARCHIVE );
|
||||
cvarSystem->SetCVarBool( "g_projectileLights", true, CVAR_ARCHIVE );
|
||||
cvarSystem->SetCVarBool( "g_doubleVision", true, CVAR_ARCHIVE );
|
||||
//cvarSystem->SetCVarBool( "g_projectileLights", true, CVAR_ARCHIVE );
|
||||
//cvarSystem->SetCVarBool( "g_doubleVision", false, CVAR_ARCHIVE );
|
||||
cvarSystem->SetCVarBool( "g_muzzleFlash", true, CVAR_ARCHIVE );
|
||||
|
||||
#if MACOS_X
|
||||
|
@ -2384,11 +2391,11 @@ void idCommonLocal::InitSIMD( void ) {
|
|||
|
||||
extern "C" void Doom3Quest_setUseScreenLayer(int use);
|
||||
extern "C" void Doom3Quest_FrameSetup(int controlscheme);
|
||||
extern "C" void Doom3Quest_Vibrate(int duration, int channel, float intensity );
|
||||
extern "C" void Doom3Quest_Vibrate(int channel, float low, float high );
|
||||
|
||||
void idCommonLocal::Vibrate(int duration, int channel, float intensity )
|
||||
void idCommonLocal::Vibrate(int channel, float low, float high)
|
||||
{
|
||||
Doom3Quest_Vibrate(duration, channel, intensity );
|
||||
Doom3Quest_Vibrate(channel, low, high);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2446,6 +2453,13 @@ void idCommonLocal::Frame( void ) {
|
|||
session->UpdateScreen( false );
|
||||
}
|
||||
|
||||
/*
|
||||
// process the rumble
|
||||
for(int i = 0; i < 2; i++) {
|
||||
Vibrate(i, ret.vibrationLow[i], ret.vibrationHigh[i]);
|
||||
}
|
||||
*/
|
||||
|
||||
// report timing information
|
||||
if ( com_speeds.GetBool() ) {
|
||||
static int lastTime;
|
||||
|
@ -3044,6 +3058,10 @@ void idCommonLocal::Init( int argc, char **argv ) {
|
|||
// load the persistent console history
|
||||
console->LoadHistory();
|
||||
|
||||
//commonVr->VR_USE_MOTION_CONTROLS = false;
|
||||
//common->Vibrate(0,0,0);
|
||||
|
||||
|
||||
com_fullyInitialized = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,11 @@ typedef enum {
|
|||
#define STRTABLE_ID "#str_"
|
||||
#define STRTABLE_ID_LENGTH 5
|
||||
|
||||
extern idCVar vr_refresh;
|
||||
extern idCVar vr_supersampling;
|
||||
extern idCVar vr_msaa;
|
||||
|
||||
|
||||
extern idCVar com_version;
|
||||
extern idCVar com_skipRenderer;
|
||||
extern idCVar com_asyncInput;
|
||||
|
@ -213,7 +218,7 @@ public:
|
|||
virtual int KeyState( int key ) = 0;
|
||||
|
||||
//Haptic Feedback
|
||||
virtual void Vibrate(int duration, int channel, float intensity ) = 0;
|
||||
virtual void Vibrate(int channel, float low, float high ) = 0;
|
||||
|
||||
/* Some Mods (like Ruiner and DarkMod when it still was a mod) used "SourceHook"
|
||||
* to override Doom3 Methods to call their own code before the original method
|
||||
|
|
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#ifndef __GAME_H__
|
||||
#define __GAME_H__
|
||||
|
||||
|
||||
#include "idlib/BitMsg.h"
|
||||
#include "idlib/Dict.h"
|
||||
#include "framework/UsercmdGen.h"
|
||||
|
@ -53,16 +54,28 @@ class idNetworkSystem;
|
|||
===============================================================================
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
struct gameReturn_t {
|
||||
gameReturn_t() :
|
||||
syncNextGameFrame( false )
|
||||
{
|
||||
for( int h = 0; h < 2; h++ )
|
||||
{
|
||||
vibrationLow[h] = 0;
|
||||
vibrationHigh[h] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
char sessionCommand[MAX_STRING_CHARS]; // "map", "disconnect", "victory", etc
|
||||
int consistencyHash; // used to check for network game divergence
|
||||
int health;
|
||||
int heartRate;
|
||||
int vibrationLow[2];
|
||||
int vibrationHigh[2];
|
||||
int stamina;
|
||||
int combat;
|
||||
bool syncNextGameFrame; // used when cinematics are skipped to prevent session from simulating several game frames to
|
||||
// keep the game time in sync with real time
|
||||
} gameReturn_t;
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
ALLOW_YES = 0,
|
||||
|
@ -92,8 +105,23 @@ public:
|
|||
|
||||
virtual void SetVRClientInfo(vrClientInfo *pVRClientInfo) = 0;
|
||||
|
||||
virtual void EvaluateVRMoveMode(idVec3 &viewangles, usercmd_t &cmd, int buttonCurrentlyClicked, float snapTurn) = 0;
|
||||
virtual bool CMDButtonsAttackCall(int &teleportCanceled) = 0;
|
||||
virtual bool CMDButtonsPhysicalCrouch() = 0;
|
||||
|
||||
virtual bool InCinematic() = 0;
|
||||
|
||||
// Release the mouse when the PDA is open
|
||||
virtual bool IsPDAOpen() const = 0;
|
||||
|
||||
//GB Trying to move animator function
|
||||
virtual bool AnimatorGetJointTransform(idAnimator* animator, jointHandle_t jointHandle, int currentTime, idVec3 &offset, idMat3 &axis ) = 0;
|
||||
|
||||
// Koz begin
|
||||
// VR State
|
||||
bool isVR = 1;
|
||||
// Koz end
|
||||
|
||||
// Sets the user info for a client.
|
||||
// if canModify is true, the game can modify the user info in the returned dictionary pointer, server will forward the change back
|
||||
// canModify is never true on network client
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,28 +1,20 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
|
||||
|
||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
|
@ -35,9 +27,7 @@ class idFile;
|
|||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
Key Input
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
|
@ -49,182 +39,182 @@ class idFile;
|
|||
// table)
|
||||
typedef enum {
|
||||
|
||||
// DG: please don't change any existing constants for keyboard keys below (or recreate the tables in win_input.cpp)!
|
||||
// DG: please don't change any existing constants for keyboard keys below (or recreate the tables in win_input.cpp)!
|
||||
|
||||
K_TAB = 9,
|
||||
K_ENTER = 13,
|
||||
K_ESCAPE = 27,
|
||||
K_SPACE = 32,
|
||||
K_TAB = 9,
|
||||
K_ENTER = 13,
|
||||
K_ESCAPE = 27,
|
||||
K_SPACE = 32,
|
||||
|
||||
K_BACKSPACE = 127,
|
||||
K_BACKSPACE = 127,
|
||||
|
||||
K_COMMAND = 128,
|
||||
K_CAPSLOCK,
|
||||
K_SCROLL,
|
||||
K_POWER,
|
||||
K_PAUSE,
|
||||
K_COMMAND = 128,
|
||||
K_CAPSLOCK,
|
||||
K_SCROLL,
|
||||
K_POWER,
|
||||
K_PAUSE,
|
||||
|
||||
K_UPARROW = 133,
|
||||
K_DOWNARROW,
|
||||
K_LEFTARROW,
|
||||
K_RIGHTARROW,
|
||||
K_UPARROW = 133,
|
||||
K_DOWNARROW,
|
||||
K_LEFTARROW,
|
||||
K_RIGHTARROW,
|
||||
|
||||
// The 3 windows keys
|
||||
K_LWIN = 137,
|
||||
K_RWIN,
|
||||
K_MENU,
|
||||
// The 3 windows keys
|
||||
K_LWIN = 137,
|
||||
K_RWIN,
|
||||
K_MENU,
|
||||
|
||||
K_ALT = 140,
|
||||
K_CTRL,
|
||||
K_SHIFT,
|
||||
K_INS,
|
||||
K_DEL,
|
||||
K_PGDN,
|
||||
K_PGUP,
|
||||
K_HOME,
|
||||
K_END,
|
||||
K_ALT = 140,
|
||||
K_CTRL,
|
||||
K_SHIFT,
|
||||
K_INS,
|
||||
K_DEL,
|
||||
K_PGDN,
|
||||
K_PGUP,
|
||||
K_HOME,
|
||||
K_END,
|
||||
|
||||
K_F1 = 149,
|
||||
K_F2,
|
||||
K_F3,
|
||||
K_F4,
|
||||
K_F5,
|
||||
K_F6,
|
||||
K_F7,
|
||||
K_F8,
|
||||
K_F9,
|
||||
K_F10,
|
||||
K_F11,
|
||||
K_F12,
|
||||
K_INVERTED_EXCLAMATION = 161, // upside down !
|
||||
K_F13,
|
||||
K_F14,
|
||||
K_F15,
|
||||
K_F1 = 149,
|
||||
K_F2,
|
||||
K_F3,
|
||||
K_F4,
|
||||
K_F5,
|
||||
K_F6,
|
||||
K_F7,
|
||||
K_F8,
|
||||
K_F9,
|
||||
K_F10,
|
||||
K_F11,
|
||||
K_F12,
|
||||
K_INVERTED_EXCLAMATION = 161, // upside down !
|
||||
K_F13,
|
||||
K_F14,
|
||||
K_F15,
|
||||
|
||||
K_KP_HOME = 165,
|
||||
K_KP_UPARROW,
|
||||
K_KP_PGUP,
|
||||
K_KP_LEFTARROW,
|
||||
K_KP_5,
|
||||
K_KP_RIGHTARROW,
|
||||
K_KP_END,
|
||||
K_KP_DOWNARROW,
|
||||
K_KP_PGDN,
|
||||
K_KP_ENTER,
|
||||
K_KP_INS,
|
||||
K_KP_DEL,
|
||||
K_KP_SLASH,
|
||||
K_SUPERSCRIPT_TWO = 178, // superscript 2
|
||||
K_KP_MINUS,
|
||||
K_ACUTE_ACCENT = 180, // accute accent
|
||||
K_KP_PLUS,
|
||||
K_KP_NUMLOCK,
|
||||
K_KP_STAR,
|
||||
K_KP_EQUALS,
|
||||
K_KP_HOME = 165,
|
||||
K_KP_UPARROW,
|
||||
K_KP_PGUP,
|
||||
K_KP_LEFTARROW,
|
||||
K_KP_5,
|
||||
K_KP_RIGHTARROW,
|
||||
K_KP_END,
|
||||
K_KP_DOWNARROW,
|
||||
K_KP_PGDN,
|
||||
K_KP_ENTER,
|
||||
K_KP_INS,
|
||||
K_KP_DEL,
|
||||
K_KP_SLASH,
|
||||
K_SUPERSCRIPT_TWO = 178, // superscript 2
|
||||
K_KP_MINUS,
|
||||
K_ACUTE_ACCENT = 180, // accute accent
|
||||
K_KP_PLUS,
|
||||
K_KP_NUMLOCK,
|
||||
K_KP_STAR,
|
||||
K_KP_EQUALS,
|
||||
|
||||
// DG: please don't change any existing constants above this one (or recreate the tables in win_input.cpp)!
|
||||
// DG: please don't change any existing constants above this one (or recreate the tables in win_input.cpp)!
|
||||
|
||||
K_MASCULINE_ORDINATOR = 186,
|
||||
// K_MOUSE enums must be contiguous (no char codes in the middle)
|
||||
K_MOUSE1 = 187,
|
||||
K_MOUSE2,
|
||||
K_MOUSE3,
|
||||
K_MOUSE4,
|
||||
K_MOUSE5,
|
||||
K_MOUSE6,
|
||||
K_MOUSE7,
|
||||
K_MOUSE8,
|
||||
K_MASCULINE_ORDINATOR = 186,
|
||||
// K_MOUSE enums must be contiguous (no char codes in the middle)
|
||||
K_MOUSE1 = 187,
|
||||
K_MOUSE2,
|
||||
K_MOUSE3,
|
||||
K_MOUSE4,
|
||||
K_MOUSE5,
|
||||
K_MOUSE6,
|
||||
K_MOUSE7,
|
||||
K_MOUSE8,
|
||||
|
||||
K_MWHEELDOWN = 195,
|
||||
K_MWHEELUP,
|
||||
K_MWHEELDOWN = 195,
|
||||
K_MWHEELUP,
|
||||
|
||||
K_JOY1 = 197,
|
||||
K_JOY2,
|
||||
K_JOY3,
|
||||
K_JOY4,
|
||||
K_JOY5,
|
||||
K_JOY6,
|
||||
K_JOY7,
|
||||
K_JOY8,
|
||||
K_JOY9,
|
||||
K_JOY10,
|
||||
K_JOY11,
|
||||
K_JOY12,
|
||||
K_JOY13,
|
||||
K_JOY14,
|
||||
K_JOY15,
|
||||
K_JOY16,
|
||||
K_JOY17,
|
||||
K_JOY18,
|
||||
K_JOY19,
|
||||
K_JOY20,
|
||||
K_JOY21,
|
||||
K_JOY22,
|
||||
K_JOY23,
|
||||
K_JOY24,
|
||||
K_JOY25,
|
||||
K_JOY26,
|
||||
K_JOY27,
|
||||
K_GRAVE_A = 224, // lowercase a with grave accent
|
||||
K_JOY28,
|
||||
K_JOY29,
|
||||
K_JOY30,
|
||||
K_JOY31,
|
||||
K_JOY32,
|
||||
K_JOY1 = 197,
|
||||
K_JOY2,
|
||||
K_JOY3,
|
||||
K_JOY4,
|
||||
K_JOY5,
|
||||
K_JOY6,
|
||||
K_JOY7,
|
||||
K_JOY8,
|
||||
K_JOY9,
|
||||
K_JOY10,
|
||||
K_JOY11,
|
||||
K_JOY12,
|
||||
K_JOY13,
|
||||
K_JOY14,
|
||||
K_JOY15,
|
||||
K_JOY16,
|
||||
K_JOY17,
|
||||
K_JOY18,
|
||||
K_JOY19,
|
||||
K_JOY20,
|
||||
K_JOY21,
|
||||
K_JOY22,
|
||||
K_JOY23,
|
||||
K_JOY24,
|
||||
K_JOY25,
|
||||
K_JOY26,
|
||||
K_JOY27,
|
||||
K_GRAVE_A = 224, // lowercase a with grave accent
|
||||
K_JOY28,
|
||||
K_JOY29,
|
||||
K_JOY30,
|
||||
K_JOY31,
|
||||
K_JOY32,
|
||||
|
||||
K_AUX1 = 230,
|
||||
K_CEDILLA_C = 231, // lowercase c with Cedilla
|
||||
K_GRAVE_E = 232, // lowercase e with grave accent
|
||||
K_AUX2,
|
||||
K_AUX3,
|
||||
K_AUX4,
|
||||
K_GRAVE_I = 236, // lowercase i with grave accent
|
||||
K_AUX5,
|
||||
K_AUX6,
|
||||
K_AUX7,
|
||||
K_AUX8,
|
||||
K_TILDE_N = 241, // lowercase n with tilde
|
||||
K_GRAVE_O = 242, // lowercase o with grave accent
|
||||
K_AUX9,
|
||||
K_AUX10,
|
||||
K_AUX11,
|
||||
K_AUX12,
|
||||
K_AUX13,
|
||||
K_AUX14,
|
||||
K_GRAVE_U = 249, // lowercase u with grave accent
|
||||
K_AUX15,
|
||||
K_AUX16,
|
||||
K_AUX1 = 230,
|
||||
K_CEDILLA_C = 231, // lowercase c with Cedilla
|
||||
K_GRAVE_E = 232, // lowercase e with grave accent
|
||||
K_AUX2,
|
||||
K_AUX3,
|
||||
K_AUX4,
|
||||
K_GRAVE_I = 236, // lowercase i with grave accent
|
||||
K_AUX5,
|
||||
K_AUX6,
|
||||
K_AUX7,
|
||||
K_AUX8,
|
||||
K_TILDE_N = 241, // lowercase n with tilde
|
||||
K_GRAVE_O = 242, // lowercase o with grave accent
|
||||
K_AUX9,
|
||||
K_AUX10,
|
||||
K_AUX11,
|
||||
K_AUX12,
|
||||
K_AUX13,
|
||||
K_AUX14,
|
||||
K_GRAVE_U = 249, // lowercase u with grave accent
|
||||
K_AUX15,
|
||||
K_AUX16,
|
||||
|
||||
K_PRINT_SCR = 252, // SysRq / PrintScr
|
||||
K_RIGHT_ALT = 253, // used by some languages as "Alt-Gr"
|
||||
K_LAST_KEY = 254 // this better be < 256!
|
||||
K_PRINT_SCR = 252, // SysRq / PrintScr
|
||||
K_RIGHT_ALT = 253, // used by some languages as "Alt-Gr"
|
||||
K_LAST_KEY = 254 // this better be < 256!
|
||||
} keyNum_t;
|
||||
|
||||
|
||||
class idKeyInput {
|
||||
public:
|
||||
static void Init( void );
|
||||
static void Shutdown( void );
|
||||
static void Init( void );
|
||||
static void Shutdown( void );
|
||||
|
||||
static void ArgCompletion_KeyName( const idCmdArgs &args, void(*callback)( const char *s ) );
|
||||
static void PreliminaryKeyEvent( int keyNum, bool down );
|
||||
static bool IsDown( int keyNum );
|
||||
static int GetUsercmdAction( int keyNum );
|
||||
static bool GetOverstrikeMode( void );
|
||||
static void SetOverstrikeMode( bool state );
|
||||
static void ClearStates( void );
|
||||
static int StringToKeyNum( const char *str );
|
||||
static const char * KeyNumToString( int keyNum, bool localized );
|
||||
static void ArgCompletion_KeyName( const idCmdArgs &args, void(*callback)( const char *s ) );
|
||||
static void PreliminaryKeyEvent( int keyNum, bool down );
|
||||
static bool IsDown( int keyNum );
|
||||
static int GetUsercmdAction( int keyNum );
|
||||
static bool GetOverstrikeMode( void );
|
||||
static void SetOverstrikeMode( bool state );
|
||||
static void ClearStates( void );
|
||||
static int StringToKeyNum( const char *str );
|
||||
static const char * KeyNumToString( int keyNum, bool localized );
|
||||
|
||||
static void SetBinding( int keyNum, const char *binding );
|
||||
static const char * GetBinding( int keyNum );
|
||||
static bool UnbindBinding( const char *bind );
|
||||
static int NumBinds( const char *binding );
|
||||
static bool ExecKeyBinding( int keyNum );
|
||||
static const char * KeysFromBinding( const char *bind );
|
||||
static const char * BindingFromKey( const char *key );
|
||||
static bool KeyIsBoundTo( int keyNum, const char *binding );
|
||||
static void WriteBindings( idFile *f );
|
||||
static void SetBinding( int keyNum, const char *binding );
|
||||
static const char * GetBinding( int keyNum );
|
||||
static bool UnbindBinding( const char *bind );
|
||||
static int NumBinds( const char *binding );
|
||||
static bool ExecKeyBinding( int keyNum );
|
||||
static const char * KeysFromBinding( const char *bind );
|
||||
static const char * BindingFromKey( const char *key );
|
||||
static bool KeyIsBoundTo( int keyNum, const char *binding );
|
||||
static void WriteBindings( idFile *f );
|
||||
};
|
||||
|
||||
#endif /* !__KEYINPUT_H__ */
|
||||
#endif /* !__KEYINPUT_H__ */
|
|
@ -45,10 +45,12 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define XPKEY_FILEPATH "../" BASE_GAMEDIR "/" XPKEY_FILE
|
||||
#endif
|
||||
|
||||
extern "C" int questType;
|
||||
|
||||
idCVar idSessionLocal::com_showAngles( "com_showAngles", "0", CVAR_SYSTEM | CVAR_BOOL, "" );
|
||||
idCVar idSessionLocal::com_minTics( "com_minTics", "1", CVAR_SYSTEM, "" );
|
||||
idCVar idSessionLocal::com_showTics( "com_showTics", "1", CVAR_SYSTEM | CVAR_BOOL, "" );
|
||||
idCVar idSessionLocal::com_skipTics( "com_skipTics", "1", CVAR_SYSTEM | CVAR_BOOL | CVAR_ARCHIVE, "Skip all missed tics and only use one tick per frame" );
|
||||
idCVar idSessionLocal::com_showTics( "com_showTics", "0", CVAR_SYSTEM | CVAR_BOOL, "" );
|
||||
idCVar idSessionLocal::com_skipTics( "com_skipTics", "1", CVAR_SYSTEM | CVAR_BOOL | CVAR_ARCHIVE, "Skip all missed tics and only use one tick per frame, won't be used on Quest 1" );
|
||||
idCVar idSessionLocal::com_fixedTic( "com_fixedTic", "0", CVAR_SYSTEM | CVAR_INTEGER | CVAR_ARCHIVE, "", -1, 10 );
|
||||
idCVar idSessionLocal::com_showDemo( "com_showDemo", "0", CVAR_SYSTEM | CVAR_BOOL, "" );
|
||||
idCVar idSessionLocal::com_skipGameDraw( "com_skipGameDraw", "0", CVAR_SYSTEM | CVAR_BOOL, "" );
|
||||
|
@ -2529,6 +2531,7 @@ void idSessionLocal::UpdateScreen( bool outOfSequence ) {
|
|||
idSessionLocal::Frame
|
||||
===============
|
||||
*/
|
||||
extern "C" int questType;
|
||||
extern bool CheckOpenALDeviceAndRecoverIfNeeded();
|
||||
void idSessionLocal::Frame() {
|
||||
|
||||
|
@ -2744,7 +2747,9 @@ void idSessionLocal::Frame() {
|
|||
}
|
||||
|
||||
//Bit of a hack to smooth things out - needs proper testing
|
||||
if ( com_skipTics.GetBool() && gameTicsToRun > 1 ) {
|
||||
//only allow quest 2 to do this, quest 1 will slowdown too much with this enabled so
|
||||
//prevent it being used on Q1
|
||||
if ( questType == 2 && com_skipTics.GetBool() && gameTicsToRun > 1 ) {
|
||||
syncNextGameFrame = true;
|
||||
break;
|
||||
}
|
||||
|
@ -2795,6 +2800,10 @@ void idSessionLocal::RunGameTic() {
|
|||
int start = Sys_Milliseconds();
|
||||
gameReturn_t ret = game->RunFrame( &cmd );
|
||||
|
||||
for( int h = 0; h < 2; h++ ) {
|
||||
common->Vibrate(h, ret.vibrationLow[h], ret.vibrationHigh[h]);
|
||||
}
|
||||
|
||||
int end = Sys_Milliseconds();
|
||||
time_gameFrame += end - start; // note time used for com_speeds
|
||||
|
||||
|
|
|
@ -366,8 +366,15 @@ bool idSessionLocal::HandleSaveGameMenuCommand( idCmdArgs &args, int &icmd ) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if ( !idStr::Icmp( cmd, "createNewName" ) ) {
|
||||
guiActive->SetStateString( "saveGameName", TimeStampToFilename() );
|
||||
guiActive->StateChanged( com_frameTime );
|
||||
return true;
|
||||
}
|
||||
|
||||
if ( !idStr::Icmp( cmd, "saveGame" ) ) {
|
||||
const char *saveGameName = TimeStampToFilename();//guiActive->State().GetString("saveGameName");
|
||||
//const char *saveGameName = TimeStampToFilename();//
|
||||
const char *saveGameName = guiActive->State().GetString("saveGameName");
|
||||
if ( saveGameName && saveGameName[0] ) {
|
||||
|
||||
// First see if the file already exists unless they pass '1' to authorize the overwrite
|
||||
|
@ -460,8 +467,7 @@ bool idSessionLocal::HandleSaveGameMenuCommand( idCmdArgs &args, int &icmd ) {
|
|||
guiActive->SetStateString( "loadgame_shot", screenshot );
|
||||
|
||||
saveName.RemoveColors();
|
||||
//guiActive->SetStateString( "saveGameName", saveName );
|
||||
guiActive->SetStateString( "saveGameName", TimeStampToFilename() );
|
||||
guiActive->SetStateString( "saveGameName", saveName );
|
||||
guiActive->SetStateString( "saveGameDescription", description );
|
||||
|
||||
ID_TIME_T timeStamp;
|
||||
|
|
|
@ -26,6 +26,10 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "game/Game_local.h"
|
||||
#include "game/Vr.h"
|
||||
#include "game/gamesys/SysCvar.h"
|
||||
|
||||
#include "sys/platform.h"
|
||||
#include "idlib/math/Vector.h"
|
||||
#include "idlib/Lib.h"
|
||||
|
@ -34,6 +38,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "framework/async/AsyncNetwork.h"
|
||||
|
||||
#include "framework/UsercmdGen.h"
|
||||
#include "Game.h"
|
||||
|
||||
|
||||
#include "renderer/RenderSystem.h"
|
||||
|
||||
|
@ -713,6 +719,10 @@ void idUsercmdGenLocal::CmdButtons( void ) {
|
|||
|
||||
cmd.buttons = 0;
|
||||
|
||||
// Koz begin cancel teleport if fire button pressed.
|
||||
static int teleportCanceled = 0;
|
||||
bool performAttack = true;
|
||||
|
||||
// figure button bits
|
||||
for (i = 0 ; i <= 7 ; i++) {
|
||||
if ( ButtonState( (usercmdButton_t)( UB_BUTTON0 + i ) ) ) {
|
||||
|
@ -722,9 +732,13 @@ void idUsercmdGenLocal::CmdButtons( void ) {
|
|||
|
||||
// check the attack button
|
||||
if ( ButtonState( UB_ATTACK ) ) {
|
||||
cmd.buttons |= BUTTON_ATTACK;
|
||||
performAttack = game->CMDButtonsAttackCall(teleportCanceled);
|
||||
if(performAttack)
|
||||
cmd.buttons |= BUTTON_ATTACK;
|
||||
}
|
||||
|
||||
teleportCanceled &= ButtonState( UB_ATTACK );
|
||||
|
||||
// check the run button
|
||||
if ( toggled_run.on ^ ( in_alwaysRun.GetBool() && idAsyncNetwork::IsActive() ) ) {
|
||||
cmd.buttons |= BUTTON_RUN;
|
||||
|
@ -745,6 +759,20 @@ void idUsercmdGenLocal::CmdButtons( void ) {
|
|||
if ( ButtonState( UB_MLOOK ) ^ in_freeLook.GetInteger() ) {
|
||||
cmd.buttons |= BUTTON_MLOOK;
|
||||
}
|
||||
|
||||
if( ButtonState( UB_UP ) )
|
||||
{
|
||||
cmd.buttons |= BUTTON_JUMP;
|
||||
}
|
||||
if( toggled_crouch.on )
|
||||
{
|
||||
cmd.buttons |= BUTTON_CROUCH;
|
||||
}
|
||||
|
||||
if(game->CMDButtonsPhysicalCrouch())
|
||||
{
|
||||
cmd.buttons |= BUTTON_CROUCH;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -772,7 +800,8 @@ creates the current command for this frame
|
|||
================
|
||||
*/
|
||||
void idUsercmdGenLocal::MakeCurrent( void ) {
|
||||
idVec3 oldAngles;
|
||||
idVec3 oldAngles = viewangles;
|
||||
static int thirdPersonTime = Sys_Milliseconds();
|
||||
int i;
|
||||
static float prevYaw = 0;
|
||||
|
||||
|
@ -793,6 +822,35 @@ void idUsercmdGenLocal::MakeCurrent( void ) {
|
|||
// get basic movement from keyboard
|
||||
KeyMove();
|
||||
|
||||
//Call game specific VR stuff and gubbins
|
||||
int buttonCurrentlyClicked =ButtonState( UB_IMPULSE41 );
|
||||
|
||||
//Dr Beefs Code
|
||||
float forward,strafe;
|
||||
float hmd_forward,hmd_strafe;
|
||||
float up = 0;
|
||||
float yaw = 0;
|
||||
float pitch = 0;
|
||||
float roll = 0;
|
||||
VR_GetMove(&forward, &strafe, &hmd_forward, &hmd_strafe, &up, &yaw, &pitch, &roll);
|
||||
|
||||
//Maybe this is right as long as I don't include HMD
|
||||
cmd.rightmove = idMath::ClampChar( cmd.rightmove + strafe );
|
||||
cmd.forwardmove = idMath::ClampChar( cmd.forwardmove + forward);
|
||||
|
||||
game->EvaluateVRMoveMode(viewangles, cmd, buttonCurrentlyClicked, yaw);
|
||||
|
||||
// check to make sure the angles haven't wrapped
|
||||
if( viewangles[PITCH] - oldAngles[PITCH] > 90 )
|
||||
{
|
||||
viewangles[PITCH] = oldAngles[PITCH] + 90;
|
||||
}
|
||||
else if( oldAngles[PITCH] - viewangles[PITCH] > 90 )
|
||||
{
|
||||
viewangles[PITCH] = oldAngles[PITCH] - 90;
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
// get basic movement from mouse
|
||||
MouseMove();
|
||||
|
@ -801,7 +859,7 @@ void idUsercmdGenLocal::MakeCurrent( void ) {
|
|||
JoystickMove();
|
||||
#endif
|
||||
|
||||
float forward,strafe;
|
||||
/*float forward,strafe;
|
||||
float hmd_forward,hmd_strafe;
|
||||
float up = 0;
|
||||
float yaw = 0;
|
||||
|
@ -830,14 +888,14 @@ void idUsercmdGenLocal::MakeCurrent( void ) {
|
|||
viewangles[PITCH] = oldAngles[PITCH] + 90;
|
||||
} else if ( oldAngles[PITCH] - viewangles[PITCH] > 90 ) {
|
||||
viewangles[PITCH] = oldAngles[PITCH] - 90;
|
||||
}
|
||||
}*/
|
||||
} else {
|
||||
mouseDx = 0;
|
||||
mouseDy = 0;
|
||||
}
|
||||
|
||||
for ( i = 0; i < 3; i++ ) {
|
||||
cmd.angles[i] = ANGLE2SHORT( viewangles[i] );
|
||||
cmd.angles[i] = ANGLE2SHORT( viewangles[i] ); // Koz this sets player body
|
||||
}
|
||||
|
||||
cmd.mx = continuousMouseX;
|
||||
|
@ -845,7 +903,6 @@ void idUsercmdGenLocal::MakeCurrent( void ) {
|
|||
|
||||
flags = cmd.flags;
|
||||
impulse = cmd.impulse;
|
||||
|
||||
}
|
||||
|
||||
//=====================================================================
|
||||
|
|
|
@ -48,9 +48,9 @@ const int BUTTON_RUN = BIT(1);
|
|||
const int BUTTON_ZOOM = BIT(2);
|
||||
const int BUTTON_SCORES = BIT(3);
|
||||
const int BUTTON_MLOOK = BIT(4);
|
||||
const int BUTTON_5 = BIT(5);
|
||||
const int BUTTON_6 = BIT(6);
|
||||
const int BUTTON_7 = BIT(7);
|
||||
const int BUTTON_JUMP = BIT(5);
|
||||
const int BUTTON_CROUCH = BIT(6);
|
||||
const int BUTTON_USE = BIT(7);
|
||||
|
||||
// usercmd_t->impulse commands
|
||||
const int IMPULSE_0 = 0; // weap 0
|
||||
|
@ -79,11 +79,29 @@ const int IMPULSE_22 = 22; // spectate
|
|||
const int IMPULSE_23 = 23; // <unused>
|
||||
const int IMPULSE_24 = 24; // <unused>
|
||||
const int IMPULSE_25 = 25; // <unused>
|
||||
const int IMPULSE_26 = 26; // <unused>
|
||||
const int IMPULSE_27 = 27; // <unused>
|
||||
const int IMPULSE_28 = 28; // vote yes
|
||||
const int IMPULSE_29 = 29; // vote no
|
||||
const int IMPULSE_40 = 40; // use vehicle
|
||||
const int IMPULSE_26 = 26; // Carl: Fists
|
||||
const int IMPULSE_27 = 27; // Chainsaw
|
||||
const int IMPULSE_28 = 28; // quick 0
|
||||
const int IMPULSE_29 = 29; // quick 1
|
||||
const int IMPULSE_30 = 30; // quick 2
|
||||
const int IMPULSE_31 = 31; // quick 3
|
||||
|
||||
// Koz
|
||||
const int IMPULSE_32 = 32; // reset HMD/Body orientation
|
||||
const int IMPULSE_33 = 33; // toggle lasersight
|
||||
const int IMPULSE_34 = 34; // comfort turn right
|
||||
const int IMPULSE_35 = 35; // comfort turn left
|
||||
const int IMPULSE_36 = 36; // toggle hud
|
||||
const int IMPULSE_37 = 37; // toggle headingbeam
|
||||
const int IMPULSE_38 = 38; // walk in place
|
||||
const int IMPULSE_39 = 39; // freelook
|
||||
const int IMPULSE_40 = 40; // Vehicle
|
||||
const int IMPULSE_41 = 41; // click to move
|
||||
// Koz end
|
||||
const int IMPULSE_44 = 44; // Carl: computer, freeze program
|
||||
const int IMPULSE_PAUSE = IMPULSE_44;
|
||||
const int IMPULSE_45 = 45; // Carl: computer, resume program
|
||||
const int IMPULSE_RESUME = IMPULSE_45;
|
||||
|
||||
// usercmd_t->flags
|
||||
const int UCF_IMPULSE_SEQUENCE = 0x0001; // toggled every time an impulse command is sent
|
||||
|
|
|
@ -35,6 +35,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "WorldSpawn.h"
|
||||
|
||||
#include "Actor.h"
|
||||
#include "Vr.h"
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -528,6 +529,13 @@ void idActor::Spawn( void ) {
|
|||
|
||||
walkIK.Init( this, IK_ANIM, modelOffset );
|
||||
|
||||
// Koz begin
|
||||
armIK.Init( this, IK_ANIM, modelOffset );
|
||||
if ( armIK.IsInitialized() ) {
|
||||
common->Printf( "ArmIK initialized for %s.\n",name.c_str() );
|
||||
}
|
||||
// Koz end
|
||||
|
||||
// the animation used to be set to the IK_ANIM at this point, but that was fixed, resulting in
|
||||
// attachments not binding correctly, so we're stuck setting the IK_ANIM before attaching things.
|
||||
animator.ClearAllAnims( gameLocal.time, 0 );
|
||||
|
@ -828,6 +836,10 @@ void idActor::Save( idSaveGame *savefile ) const {
|
|||
headAnim.Save( savefile );
|
||||
torsoAnim.Save( savefile );
|
||||
legsAnim.Save( savefile );
|
||||
// Koz begin
|
||||
leftHandAnim.Save( savefile );
|
||||
rightHandAnim.Save( savefile );
|
||||
// Koz end
|
||||
|
||||
savefile->WriteBool( allowPain );
|
||||
savefile->WriteBool( allowEyeFocus );
|
||||
|
@ -935,6 +947,13 @@ void idActor::Restore( idRestoreGame *savefile ) {
|
|||
savefile->ReadJoint( soundJoint );
|
||||
|
||||
walkIK.Restore( savefile );
|
||||
// Koz begin
|
||||
armIK.Init( this, IK_ANIM, modelOffset );
|
||||
if ( armIK.IsInitialized() ) {
|
||||
common->Printf( "ArmIK initialized for %s.\n",name.c_str() );
|
||||
}
|
||||
// Koz end
|
||||
|
||||
|
||||
savefile->ReadString( animPrefix );
|
||||
savefile->ReadString( painAnim );
|
||||
|
@ -951,6 +970,10 @@ void idActor::Restore( idRestoreGame *savefile ) {
|
|||
headAnim.Restore( savefile );
|
||||
torsoAnim.Restore( savefile );
|
||||
legsAnim.Restore( savefile );
|
||||
// Koz begin
|
||||
leftHandAnim.Restore( savefile );
|
||||
rightHandAnim.Restore( savefile );
|
||||
// Koz end
|
||||
|
||||
savefile->ReadBool( allowPain );
|
||||
savefile->ReadBool( allowEyeFocus );
|
||||
|
@ -1144,6 +1167,10 @@ void idActor::SetupBody( void ) {
|
|||
|
||||
torsoAnim.Init( this, &animator, ANIMCHANNEL_TORSO );
|
||||
legsAnim.Init( this, &animator, ANIMCHANNEL_LEGS );
|
||||
// Koz
|
||||
leftHandAnim.Init( this, &animator, ANIMCHANNEL_LEFTHAND );
|
||||
rightHandAnim.Init( this, &animator, ANIMCHANNEL_RIGHTHAND );
|
||||
// Koz end
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1215,6 +1242,10 @@ void idActor::ShutdownThreads( void ) {
|
|||
headAnim.Shutdown();
|
||||
torsoAnim.Shutdown();
|
||||
legsAnim.Shutdown();
|
||||
// Koz
|
||||
leftHandAnim.Shutdown();
|
||||
rightHandAnim.Shutdown();
|
||||
// Koz end
|
||||
|
||||
if ( scriptThread ) {
|
||||
scriptThread->EndThread();
|
||||
|
@ -1920,6 +1951,16 @@ void idActor::SetAnimState( int channel, const char *statename, int blendFrames
|
|||
allowEyeFocus = true;
|
||||
break;
|
||||
|
||||
// Koz begin
|
||||
case ANIMCHANNEL_LEFTHAND :
|
||||
leftHandAnim.SetState( statename, blendFrames );
|
||||
break;
|
||||
|
||||
case ANIMCHANNEL_RIGHTHAND :
|
||||
rightHandAnim.SetState( statename, blendFrames );
|
||||
break;
|
||||
// Koz end
|
||||
|
||||
default:
|
||||
gameLocal.Error( "idActor::SetAnimState: Unknown anim group" );
|
||||
break;
|
||||
|
@ -1945,6 +1986,16 @@ const char *idActor::GetAnimState( int channel ) const {
|
|||
return legsAnim.state;
|
||||
break;
|
||||
|
||||
// Koz begin
|
||||
case ANIMCHANNEL_LEFTHAND :
|
||||
return leftHandAnim.state;
|
||||
break;
|
||||
|
||||
case ANIMCHANNEL_RIGHTHAND :
|
||||
return rightHandAnim.state;
|
||||
break;
|
||||
// Koz end
|
||||
|
||||
default:
|
||||
gameLocal.Error( "idActor::GetAnimState: Unknown anim group" );
|
||||
return NULL;
|
||||
|
@ -1977,6 +2028,22 @@ bool idActor::InAnimState( int channel, const char *statename ) const {
|
|||
}
|
||||
break;
|
||||
|
||||
// Koz begin
|
||||
case ANIMCHANNEL_LEFTHAND :
|
||||
if ( leftHandAnim.state == statename )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
case ANIMCHANNEL_RIGHTHAND :
|
||||
if ( rightHandAnim.state == statename )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
// Koz end
|
||||
|
||||
default:
|
||||
gameLocal.Error( "idActor::InAnimState: Unknown anim group" );
|
||||
break;
|
||||
|
@ -2016,6 +2083,10 @@ void idActor::UpdateAnimState( void ) {
|
|||
headAnim.UpdateState();
|
||||
torsoAnim.UpdateState();
|
||||
legsAnim.UpdateState();
|
||||
// Koz begin
|
||||
leftHandAnim.UpdateState();
|
||||
rightHandAnim.UpdateState();
|
||||
// Koz end
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2180,7 +2251,19 @@ void idActor::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir
|
|||
}
|
||||
|
||||
int damage = damageDef->GetInt( "damage" ) * damageScale;
|
||||
damage = GetDamageForLocation( damage, location );
|
||||
// Koz hack : add an adjustable headshot multiplier for VR for projectile weapons with no splash damage
|
||||
bool headMultiplier = false;
|
||||
if ( !idStr::Icmp( damageDefName, "damage_bullet_chaingun" ) ||
|
||||
!idStr::Icmp( damageDefName, "damage_bullet_machinegun" ) ||
|
||||
!idStr::Icmp( damageDefName, "damage_bullet_pistol" ) ||
|
||||
!idStr::Icmp( damageDefName, "damage_plasmablast" ) ||
|
||||
!idStr::Icmp( damageDefName, "damage_shotgun" ) ||
|
||||
!idStr::Icmp( damageDefName, "damage_fists" )
|
||||
) headMultiplier = true;
|
||||
|
||||
damage = GetDamageForLocation( damage, location, headMultiplier );
|
||||
// Koz end
|
||||
//damage = GetDamageForLocation( damage, location );
|
||||
|
||||
// inform the attacker that they hit someone
|
||||
attacker->DamageFeedback( this, inflictor, damage );
|
||||
|
@ -2367,12 +2450,28 @@ void idActor::SetupDamageGroups( void ) {
|
|||
idActor::GetDamageForLocation
|
||||
=====================
|
||||
*/
|
||||
int idActor::GetDamageForLocation( int damage, int location ) {
|
||||
int idActor::GetDamageForLocation( int damage, int location, bool headMultiplier ) {
|
||||
if ( ( location < 0 ) || ( location >= damageScale.Num() ) ) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
return (int)ceil( damage * damageScale[ location ] );
|
||||
// Koz add more significant headshot damage.
|
||||
//only applies if head damage group is already scaled to take > 1.0x damage.
|
||||
//limited by calling function to fists, pitsol,shotgun,machinegun,chaingun and plasmagun.
|
||||
float damageAmt = damage *= damageScale[location];
|
||||
if ( headMultiplier )
|
||||
{
|
||||
//GBTODO check what the local actor is
|
||||
//if ( ( this != gameLocal.GetLocalPlayer()) && strstr( damageGroups[location].c_str(), "head" ) )
|
||||
if ( strstr( damageGroups[location].c_str(), "head" ) )
|
||||
{
|
||||
if ( damageScale[location] > 1.0f )
|
||||
{
|
||||
damageAmt *= vr_headshotMultiplier.GetFloat();
|
||||
//common->Printf( "Head damage group detected, adding additional damage scale. New damage = %f\n", damageAmt );
|
||||
}
|
||||
}
|
||||
}
|
||||
return (int)ceil( damageAmt );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2567,6 +2666,16 @@ void idActor::Event_StopAnim( int channel, int frames ) {
|
|||
legsAnim.StopAnim( frames );
|
||||
break;
|
||||
|
||||
// Koz begin
|
||||
case ANIMCHANNEL_LEFTHAND :
|
||||
leftHandAnim.StopAnim( frames );
|
||||
break;
|
||||
|
||||
case ANIMCHANNEL_RIGHTHAND :
|
||||
rightHandAnim.StopAnim( frames );
|
||||
break;
|
||||
// Koz end
|
||||
|
||||
default:
|
||||
gameLocal.Error( "Unknown anim group" );
|
||||
break;
|
||||
|
@ -2579,78 +2688,140 @@ idActor::Event_PlayAnim
|
|||
===============
|
||||
*/
|
||||
void idActor::Event_PlayAnim( int channel, const char *animname ) {
|
||||
animFlags_t flags;
|
||||
idEntity *headEnt;
|
||||
int anim;
|
||||
idThread::ReturnInt( PlayAnim( channel, animname ) );
|
||||
}
|
||||
|
||||
anim = GetAnim( channel, animname );
|
||||
if ( !anim ) {
|
||||
if ( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() ) {
|
||||
gameLocal.DPrintf( "missing '%s' animation on '%s' (%s)\n", animname, name.c_str(), spawnArgs.GetString( "def_head", "" ) );
|
||||
} else {
|
||||
gameLocal.DPrintf( "missing '%s' animation on '%s' (%s)\n", animname, name.c_str(), GetEntityDefName() );
|
||||
}
|
||||
idThread::ReturnInt( 0 );
|
||||
return;
|
||||
}
|
||||
int idActor::PlayAnim( int channel, const char* animname )
|
||||
{
|
||||
animFlags_t flags;
|
||||
idEntity* headEnt;
|
||||
int anim;
|
||||
|
||||
switch( channel ) {
|
||||
case ANIMCHANNEL_HEAD :
|
||||
headEnt = head.GetEntity();
|
||||
if ( headEnt ) {
|
||||
headAnim.idleAnim = false;
|
||||
headAnim.PlayAnim( anim );
|
||||
flags = headAnim.GetAnimFlags();
|
||||
if ( !flags.prevent_idle_override ) {
|
||||
if ( torsoAnim.IsIdle() ) {
|
||||
torsoAnim.animBlendFrames = headAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_TORSO, ANIMCHANNEL_HEAD, headAnim.lastAnimBlendFrames );
|
||||
if ( legsAnim.IsIdle() ) {
|
||||
legsAnim.animBlendFrames = headAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_LEGS, ANIMCHANNEL_HEAD, headAnim.lastAnimBlendFrames );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
// Koz debug if ( channel == ANIMCHANNEL_LEFTHAND || channel == ANIMCHANNEL_RIGHTHAND ) common->Printf( "Player Playing anim %s %d\n", animname, gameLocal.time );
|
||||
// Carl: This now supports separate prefixes for the lefthand and righthand channels (on the player object)
|
||||
anim = GetAnim( channel, animname );
|
||||
if( !anim )
|
||||
{
|
||||
if( ( channel == ANIMCHANNEL_HEAD ) && head.GetEntity() )
|
||||
{
|
||||
gameLocal.DPrintf( "missing '%s' animation on '%s' (%s)\n", animname, name.c_str(), spawnArgs.GetString( "def_head", "" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
gameLocal.DPrintf( "missing '%s' animation on '%s' (%s)\n", animname, name.c_str(), GetEntityDefName() );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
case ANIMCHANNEL_TORSO :
|
||||
torsoAnim.idleAnim = false;
|
||||
torsoAnim.PlayAnim( anim );
|
||||
flags = torsoAnim.GetAnimFlags();
|
||||
if ( !flags.prevent_idle_override ) {
|
||||
if ( headAnim.IsIdle() ) {
|
||||
headAnim.animBlendFrames = torsoAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_HEAD, ANIMCHANNEL_TORSO, torsoAnim.lastAnimBlendFrames );
|
||||
}
|
||||
if ( legsAnim.IsIdle() ) {
|
||||
legsAnim.animBlendFrames = torsoAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_LEGS, ANIMCHANNEL_TORSO, torsoAnim.lastAnimBlendFrames );
|
||||
}
|
||||
}
|
||||
break;
|
||||
switch( channel )
|
||||
{
|
||||
case ANIMCHANNEL_HEAD :
|
||||
headEnt = head.GetEntity();
|
||||
if( headEnt )
|
||||
{
|
||||
headAnim.idleAnim = false;
|
||||
headAnim.PlayAnim( anim );
|
||||
flags = headAnim.GetAnimFlags();
|
||||
if( !flags.prevent_idle_override )
|
||||
{
|
||||
if( torsoAnim.IsIdle() )
|
||||
{
|
||||
torsoAnim.animBlendFrames = headAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_TORSO, ANIMCHANNEL_HEAD, headAnim.lastAnimBlendFrames );
|
||||
if( legsAnim.IsIdle() )
|
||||
{
|
||||
legsAnim.animBlendFrames = headAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_LEGS, ANIMCHANNEL_HEAD, headAnim.lastAnimBlendFrames );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ANIMCHANNEL_LEGS :
|
||||
legsAnim.idleAnim = false;
|
||||
legsAnim.PlayAnim( anim );
|
||||
flags = legsAnim.GetAnimFlags();
|
||||
if ( !flags.prevent_idle_override ) {
|
||||
if ( torsoAnim.IsIdle() ) {
|
||||
torsoAnim.animBlendFrames = legsAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_TORSO, ANIMCHANNEL_LEGS, legsAnim.lastAnimBlendFrames );
|
||||
if ( headAnim.IsIdle() ) {
|
||||
headAnim.animBlendFrames = legsAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_HEAD, ANIMCHANNEL_LEGS, legsAnim.lastAnimBlendFrames );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ANIMCHANNEL_TORSO :
|
||||
torsoAnim.idleAnim = false;
|
||||
torsoAnim.PlayAnim( anim );
|
||||
flags = torsoAnim.GetAnimFlags();
|
||||
if( !flags.prevent_idle_override )
|
||||
{
|
||||
if( headAnim.IsIdle() )
|
||||
{
|
||||
headAnim.animBlendFrames = torsoAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_HEAD, ANIMCHANNEL_TORSO, torsoAnim.lastAnimBlendFrames );
|
||||
}
|
||||
if( legsAnim.IsIdle() )
|
||||
{
|
||||
legsAnim.animBlendFrames = torsoAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_LEGS, ANIMCHANNEL_TORSO, torsoAnim.lastAnimBlendFrames );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default :
|
||||
gameLocal.Error( "Unknown anim group" );
|
||||
break;
|
||||
}
|
||||
idThread::ReturnInt( 1 );
|
||||
case ANIMCHANNEL_LEGS :
|
||||
legsAnim.idleAnim = false;
|
||||
legsAnim.PlayAnim( anim );
|
||||
flags = legsAnim.GetAnimFlags();
|
||||
if( !flags.prevent_idle_override )
|
||||
{
|
||||
if( torsoAnim.IsIdle() )
|
||||
{
|
||||
torsoAnim.animBlendFrames = legsAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_TORSO, ANIMCHANNEL_LEGS, legsAnim.lastAnimBlendFrames );
|
||||
if( headAnim.IsIdle() )
|
||||
{
|
||||
headAnim.animBlendFrames = legsAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_HEAD, ANIMCHANNEL_LEGS, legsAnim.lastAnimBlendFrames );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
// Koz fix anims add hand channels to leg and torso cases?
|
||||
// Koz begin
|
||||
case ANIMCHANNEL_LEFTHAND :
|
||||
leftHandAnim.idleAnim = false;
|
||||
leftHandAnim.PlayAnim( anim );
|
||||
/* flags = leftHandAnim.GetAnimFlags();
|
||||
if ( !flags.prevent_idle_override )
|
||||
{
|
||||
if ( torsoAnim.IsIdle() )
|
||||
{
|
||||
torsoAnim.animBlendFrames = leftHandAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_TORSO, ANIMCHANNEL_LEFTHAND, leftHandAnim.lastAnimBlendFrames );
|
||||
if ( legsAnim.IsIdle() )
|
||||
{
|
||||
legsAnim.animBlendFrames = leftHandAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_LEGS, ANIMCHANNEL_LEFTHAND, leftHandAnim.lastAnimBlendFrames );
|
||||
}
|
||||
}
|
||||
}*/
|
||||
break;
|
||||
|
||||
case ANIMCHANNEL_RIGHTHAND:
|
||||
rightHandAnim.idleAnim = false;
|
||||
rightHandAnim.PlayAnim( anim );
|
||||
/*flags = rightHandAnim.GetAnimFlags();
|
||||
if ( !flags.prevent_idle_override )
|
||||
{
|
||||
if ( torsoAnim.IsIdle() )
|
||||
{
|
||||
torsoAnim.animBlendFrames = rightHandAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_TORSO, ANIMCHANNEL_RIGHTHAND, rightHandAnim.lastAnimBlendFrames );
|
||||
if ( legsAnim.IsIdle() )
|
||||
{
|
||||
legsAnim.animBlendFrames = rightHandAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_LEGS, ANIMCHANNEL_RIGHTHAND, rightHandAnim.lastAnimBlendFrames );
|
||||
}
|
||||
}
|
||||
}*/
|
||||
break;
|
||||
// Koz end
|
||||
|
||||
|
||||
default :
|
||||
gameLocal.Error( "Event_PlayAnim Unknown anim group" );
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2720,8 +2891,49 @@ void idActor::Event_PlayCycle( int channel, const char *animname ) {
|
|||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
gameLocal.Error( "Unknown anim group" );
|
||||
// Koz fix anim ad handanims to head/leg/torso cases?
|
||||
// Koz begin
|
||||
case ANIMCHANNEL_LEFTHAND :
|
||||
leftHandAnim.idleAnim = false;
|
||||
leftHandAnim.CycleAnim( anim );
|
||||
/* flags = leftHandAnim.GetAnimFlags();
|
||||
if ( !flags.prevent_idle_override )
|
||||
{
|
||||
if ( torsoAnim.IsIdle() )
|
||||
{
|
||||
torsoAnim.animBlendFrames = leftHandAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_TORSO, ANIMCHANNEL_LEFTHAND, leftHandAnim.lastAnimBlendFrames );
|
||||
if ( headAnim.IsIdle() )
|
||||
{
|
||||
headAnim.animBlendFrames = leftHandAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_HEAD, ANIMCHANNEL_LEFTHAND, leftHandAnim.lastAnimBlendFrames );
|
||||
}
|
||||
}
|
||||
}*/
|
||||
break;
|
||||
|
||||
case ANIMCHANNEL_RIGHTHAND:
|
||||
rightHandAnim.idleAnim = false;
|
||||
rightHandAnim.CycleAnim( anim );
|
||||
/*flags = rightHandAnim.GetAnimFlags();
|
||||
if ( !flags.prevent_idle_override )
|
||||
{
|
||||
if ( torsoAnim.IsIdle() )
|
||||
{
|
||||
torsoAnim.animBlendFrames = rightHandAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_TORSO, ANIMCHANNEL_RIGHTHAND, rightHandAnim.lastAnimBlendFrames );
|
||||
if ( headAnim.IsIdle() )
|
||||
{
|
||||
headAnim.animBlendFrames = rightHandAnim.lastAnimBlendFrames;
|
||||
SyncAnimChannels( ANIMCHANNEL_HEAD, ANIMCHANNEL_RIGHTHAND, rightHandAnim.lastAnimBlendFrames );
|
||||
}
|
||||
}
|
||||
}*/
|
||||
break;
|
||||
// Koz end
|
||||
|
||||
default:
|
||||
gameLocal.Error( "Unknown anim group" );
|
||||
}
|
||||
|
||||
idThread::ReturnInt( true );
|
||||
|
@ -2756,7 +2968,18 @@ void idActor::Event_IdleAnim( int channel, const char *animname ) {
|
|||
legsAnim.BecomeIdle();
|
||||
break;
|
||||
|
||||
default:
|
||||
// Koz begin
|
||||
case ANIMCHANNEL_LEFTHAND :
|
||||
leftHandAnim.BecomeIdle();
|
||||
break;
|
||||
|
||||
case ANIMCHANNEL_RIGHTHAND :
|
||||
rightHandAnim.BecomeIdle();
|
||||
break;
|
||||
// Koz end
|
||||
|
||||
|
||||
default:
|
||||
gameLocal.Error( "Unknown anim group" );
|
||||
}
|
||||
|
||||
|
@ -2827,6 +3050,17 @@ void idActor::Event_IdleAnim( int channel, const char *animname ) {
|
|||
}
|
||||
break;
|
||||
|
||||
// Koz fix anims
|
||||
// Koz begin
|
||||
case ANIMCHANNEL_LEFTHAND :
|
||||
leftHandAnim.BecomeIdle();
|
||||
break;
|
||||
|
||||
case ANIMCHANNEL_RIGHTHAND :
|
||||
rightHandAnim.BecomeIdle();
|
||||
break;
|
||||
// Koz end
|
||||
|
||||
default:
|
||||
gameLocal.Error( "Unknown anim group" );
|
||||
}
|
||||
|
@ -2878,7 +3112,19 @@ void idActor::Event_SetSyncedAnimWeight( int channel, int anim, float weight ) {
|
|||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Koz fix anims
|
||||
// Koz begin
|
||||
case ANIMCHANNEL_LEFTHAND :
|
||||
animator.CurrentAnim( ANIMCHANNEL_LEFTHAND )->SetSyncedAnimWeight( anim, weight );
|
||||
break;
|
||||
|
||||
case ANIMCHANNEL_RIGHTHAND :
|
||||
animator.CurrentAnim( ANIMCHANNEL_RIGHTHAND )->SetSyncedAnimWeight( anim, weight );
|
||||
break;
|
||||
// Koz end
|
||||
|
||||
|
||||
default:
|
||||
gameLocal.Error( "Unknown anim group" );
|
||||
}
|
||||
}
|
||||
|
@ -2912,6 +3158,17 @@ void idActor::Event_OverrideAnim( int channel ) {
|
|||
SyncAnimChannels( ANIMCHANNEL_LEGS, ANIMCHANNEL_TORSO, torsoAnim.lastAnimBlendFrames );
|
||||
break;
|
||||
|
||||
// Koz fix anim
|
||||
// Koz begin
|
||||
case ANIMCHANNEL_LEFTHAND :
|
||||
leftHandAnim.Disable();
|
||||
break;
|
||||
|
||||
case ANIMCHANNEL_RIGHTHAND :
|
||||
rightHandAnim.Disable();
|
||||
break;
|
||||
// Koz end
|
||||
|
||||
default:
|
||||
gameLocal.Error( "Unknown anim group" );
|
||||
break;
|
||||
|
@ -2936,7 +3193,16 @@ void idActor::Event_EnableAnim( int channel, int blendFrames ) {
|
|||
case ANIMCHANNEL_LEGS :
|
||||
legsAnim.Enable( blendFrames );
|
||||
break;
|
||||
// Koz fix anim
|
||||
// Koz begin
|
||||
case ANIMCHANNEL_LEFTHAND :
|
||||
leftHandAnim.Enable( blendFrames );
|
||||
break;
|
||||
|
||||
case ANIMCHANNEL_RIGHTHAND :
|
||||
rightHandAnim.Enable( blendFrames );
|
||||
break;
|
||||
// Koz end
|
||||
default:
|
||||
gameLocal.Error( "Unknown anim group" );
|
||||
break;
|
||||
|
@ -2964,7 +3230,18 @@ void idActor::Event_SetBlendFrames( int channel, int blendFrames ) {
|
|||
legsAnim.animBlendFrames = blendFrames;
|
||||
legsAnim.lastAnimBlendFrames = blendFrames;
|
||||
break;
|
||||
// Koz fix anims
|
||||
// Koz begin
|
||||
case ANIMCHANNEL_LEFTHAND :
|
||||
leftHandAnim.animBlendFrames = blendFrames;
|
||||
leftHandAnim.lastAnimBlendFrames = blendFrames;
|
||||
break;
|
||||
|
||||
case ANIMCHANNEL_RIGHTHAND :
|
||||
rightHandAnim.animBlendFrames = blendFrames;
|
||||
rightHandAnim.lastAnimBlendFrames = blendFrames;
|
||||
break;
|
||||
// Koz end
|
||||
default:
|
||||
gameLocal.Error( "Unknown anim group" );
|
||||
break;
|
||||
|
@ -2989,7 +3266,16 @@ void idActor::Event_GetBlendFrames( int channel ) {
|
|||
case ANIMCHANNEL_LEGS :
|
||||
idThread::ReturnInt( legsAnim.animBlendFrames );
|
||||
break;
|
||||
// Koz fix anims
|
||||
// Koz begin
|
||||
case ANIMCHANNEL_LEFTHAND :
|
||||
idThread::ReturnInt( leftHandAnim.animBlendFrames );
|
||||
break;
|
||||
|
||||
case ANIMCHANNEL_RIGHTHAND :
|
||||
idThread::ReturnInt( rightHandAnim.animBlendFrames );
|
||||
break;
|
||||
// Koz end
|
||||
default:
|
||||
gameLocal.Error( "Unknown anim group" );
|
||||
break;
|
||||
|
@ -3063,7 +3349,19 @@ void idActor::Event_AnimDone( int channel, int blendFrames ) {
|
|||
result = legsAnim.AnimDone( blendFrames );
|
||||
idThread::ReturnInt( result );
|
||||
break;
|
||||
// Koz fix anims
|
||||
// Koz begin
|
||||
case ANIMCHANNEL_LEFTHAND :
|
||||
result = leftHandAnim.AnimDone( blendFrames );
|
||||
idThread::ReturnInt( result );
|
||||
break;
|
||||
|
||||
|
||||
case ANIMCHANNEL_RIGHTHAND :
|
||||
result = rightHandAnim.AnimDone( blendFrames );
|
||||
idThread::ReturnInt( result );
|
||||
break;
|
||||
// Koz end
|
||||
default:
|
||||
gameLocal.Error( "Unknown anim group" );
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ public:
|
|||
// damage
|
||||
void SetupDamageGroups( void );
|
||||
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location );
|
||||
int GetDamageForLocation( int damage, int location );
|
||||
int GetDamageForLocation( int damage, int location, bool headMultiplier = false );
|
||||
const char * GetDamageGroup( int location );
|
||||
void ClearPain( void );
|
||||
virtual bool Pain( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location );
|
||||
|
@ -199,6 +199,7 @@ public:
|
|||
virtual renderView_t * GetRenderView();
|
||||
|
||||
// animation state control
|
||||
int PlayAnim( int channel, const char* name );
|
||||
int GetAnim( int channel, const char *name );
|
||||
void UpdateAnimState( void );
|
||||
void SetAnimState( int channel, const char *name, int blendFrames );
|
||||
|
@ -209,9 +210,18 @@ public:
|
|||
bool AnimDone( int channel, int blendFrames ) const;
|
||||
virtual void SpawnGibs( const idVec3 &dir, const char *damageDefName );
|
||||
|
||||
idEntity* GetHeadEntity()
|
||||
{
|
||||
return head.GetEntity();
|
||||
};
|
||||
|
||||
protected:
|
||||
friend class idAnimState;
|
||||
|
||||
// Carl: navigation (originally in AI.h)
|
||||
idAAS* aas;
|
||||
int travelFlags;
|
||||
|
||||
float fovDot; // cos( fovDegrees )
|
||||
idVec3 eyeOffset; // offset of eye relative to physics origin
|
||||
idVec3 modelOffset; // offset of visual model relative to the physics origin
|
||||
|
@ -239,6 +249,9 @@ protected:
|
|||
jointHandle_t soundJoint;
|
||||
|
||||
idIK_Walk walkIK;
|
||||
// Koz
|
||||
idIK_Reach armIK;
|
||||
// Koz
|
||||
|
||||
idStr animPrefix;
|
||||
idStr painAnim;
|
||||
|
@ -255,6 +268,10 @@ protected:
|
|||
idAnimState headAnim;
|
||||
idAnimState torsoAnim;
|
||||
idAnimState legsAnim;
|
||||
// Koz
|
||||
idAnimState leftHandAnim;
|
||||
idAnimState rightHandAnim;
|
||||
// Koz end
|
||||
|
||||
bool allowPain;
|
||||
bool allowEyeFocus;
|
||||
|
|
|
@ -384,12 +384,49 @@ void idCameraAnim::LoadAnim( void ) {
|
|||
parser.ExpectTokenString( "cuts" );
|
||||
parser.ExpectTokenString( "{" );
|
||||
cameraCuts.SetNum( numCuts );
|
||||
|
||||
idToken cutToken; // Koz
|
||||
|
||||
for( i = 0; i < numCuts; i++ ) {
|
||||
cameraCuts[ i ] = parser.ParseInt();
|
||||
if ( ( cameraCuts[ i ] < 1 ) || ( cameraCuts[ i ] >= numFrames ) ) {
|
||||
cameraCuts[i].posOverride = false;
|
||||
cameraCuts[i].rotOverride = false;
|
||||
cameraCuts[i].posNew = vec3_zero;
|
||||
cameraCuts[i].rotNew.Set( 0.0f, 0.0f, 0.0f );
|
||||
|
||||
cameraCuts[ i ].cutFrame = parser.ParseInt();
|
||||
if( ( cameraCuts[ i ].cutFrame < 0 ) || ( cameraCuts[ i ].cutFrame >= numFrames ) ) // Koz - changed to allow camera cut on first frame.
|
||||
{
|
||||
parser.Error( "Invalid camera cut" );
|
||||
}
|
||||
|
||||
// Koz read pos and rot override values if present.
|
||||
if ( parser.PeekTokenString( "pos" ) )
|
||||
{
|
||||
parser.ReadToken( &cutToken );
|
||||
parser.Parse1DMatrix( 3, cameraCuts[i].posNew.ToFloatPtr() );
|
||||
cameraCuts[i].posOverride = true;
|
||||
}
|
||||
|
||||
if ( parser.PeekTokenString( "rotA" ) ) // read rotation in angles - easier for manual editing.
|
||||
{
|
||||
parser.ReadToken( &cutToken );
|
||||
|
||||
idAngles ta;
|
||||
parser.Parse1DMatrix( 3, &ta[0] );
|
||||
cameraCuts[i].rotNew = ta.ToQuat().ToCQuat();
|
||||
cameraCuts[i].rotOverride = true;
|
||||
}
|
||||
|
||||
if ( parser.PeekTokenString( "rot" ) ) // read rotation quat - easier to copy from exitsing frame.
|
||||
{
|
||||
parser.ReadToken( &cutToken );
|
||||
parser.Parse1DMatrix( 3, cameraCuts[i].rotNew.ToFloatPtr() );
|
||||
cameraCuts[i].rotOverride = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Koz End
|
||||
|
||||
parser.ExpectTokenString( "}" );
|
||||
|
||||
// parse the camera frames
|
||||
|
@ -549,6 +586,11 @@ void idCameraAnim::GetViewParms( renderView_t *view ) {
|
|||
float lerp;
|
||||
float invlerp;
|
||||
cameraFrame_t *camFrame;
|
||||
cameraFrame_t* camFrame2; // Koz for clamping camera positions during cinematics to eliminate uncomfortable panning in VR.
|
||||
|
||||
cameraFrame_t cutFrame;
|
||||
bool cutRotOverride;
|
||||
|
||||
int i;
|
||||
int cut;
|
||||
idQuat q1, q2, q3;
|
||||
|
@ -577,22 +619,55 @@ void idCameraAnim::GetViewParms( renderView_t *view ) {
|
|||
// skip any frames where camera cuts occur
|
||||
realFrame = frame;
|
||||
cut = 0;
|
||||
camFrame2 = &camera[0]; // Koz
|
||||
|
||||
cutFrame.fov = camFrame2[ 0 ].fov;
|
||||
cutFrame.q = camFrame2[ 0 ].q;
|
||||
cutFrame.t = camFrame2[ 0 ].t;
|
||||
|
||||
cutRotOverride = false;
|
||||
for( i = 0; i < cameraCuts.Num(); i++ ) {
|
||||
if ( frame < cameraCuts[ i ] ) {
|
||||
if ( frame < cameraCuts[i].cutFrame )
|
||||
{
|
||||
break;
|
||||
}
|
||||
frame++;
|
||||
cut++;
|
||||
int cf = idMath::ClampInt( 0, camera.Num() - 2, cameraCuts[i].cutFrame + 1 );
|
||||
camFrame2 = &camera[ cf /*cameraCuts[i].cutFrame*/ ];
|
||||
|
||||
cutFrame.fov = camFrame2[0].fov;
|
||||
cutFrame.q = camFrame2[0].q;
|
||||
cutFrame.t = camFrame2[0].t;
|
||||
|
||||
if ( vr_cinematics.GetInteger() == 0 ) // only use replacement positions/rotations if using immersive cinematics.
|
||||
{
|
||||
cutRotOverride = false;
|
||||
if ( cameraCuts[i].posOverride )
|
||||
{
|
||||
cutFrame.t = cameraCuts[i].posNew;
|
||||
}
|
||||
if ( cameraCuts[i].rotOverride )
|
||||
{
|
||||
cutFrame.q = cameraCuts[i].rotNew;
|
||||
cutRotOverride = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( g_debugCinematic.GetBool() ) {
|
||||
if ( gameLocal.GetCamera() )
|
||||
{
|
||||
common->Printf( "Time %d - Camera %s cut %d rot Quat %s : rot Angles %s : pos %s\n", commonVr->Sys_Milliseconds(), gameLocal.GetCamera()->GetName(), cut, cutFrame.q.ToString(), cutFrame.q.ToAngles().ToString(), cutFrame.t.ToString() );
|
||||
}
|
||||
|
||||
int prevFrameTime = ( gameLocal.time - starttime - USERCMD_MSEC ) * frameRate;
|
||||
int prevFrame = prevFrameTime / 1000;
|
||||
int prevCut;
|
||||
|
||||
prevCut = 0;
|
||||
for( i = 0; i < cameraCuts.Num(); i++ ) {
|
||||
if ( prevFrame < cameraCuts[ i ] ) {
|
||||
if( prevFrame < cameraCuts[ i ].cutFrame ) {
|
||||
break;
|
||||
}
|
||||
prevFrame++;
|
||||
|
@ -650,25 +725,61 @@ void idCameraAnim::GetViewParms( renderView_t *view ) {
|
|||
view->fov_x = camFrame[ 0 ].fov * invlerp + camFrame[ 1 ].fov * lerp;
|
||||
}
|
||||
|
||||
// Koz begin
|
||||
if ( game->isVR && (vr_cinematics.GetInteger() == 0) )
|
||||
{
|
||||
// Clamp the camera origin to camera cut locations.
|
||||
// This eliminates camera panning and smooth movements in cutscenes,
|
||||
// while allowing the player to look around from
|
||||
// the camera origin. Not perfect but less vomitous.
|
||||
|
||||
// Update: camera files have been updated with additional cuts, and pos/rot overrides at cut locations
|
||||
// for better 'immersive' cutscenes. Player also has option to use cropped or projected cutscenes
|
||||
// where the pos/rot overrides are ignored and cameras are not clamped to cuts.
|
||||
|
||||
// Flicksync camera
|
||||
idEntity* ent = NULL;
|
||||
static idEntity* hiddenEnt = NULL;
|
||||
|
||||
static idEntity *last_ent = NULL;
|
||||
// only use character if it's not hidden, and it's within range of current camera
|
||||
|
||||
if ( g_debugCinematic.GetBool() && ent != last_ent )
|
||||
{
|
||||
gameLocal.Printf( "%d: Flicksync using camera %s\n", gameLocal.framenum, this->name.c_str() );
|
||||
|
||||
}
|
||||
|
||||
last_ent = ent;
|
||||
|
||||
view->viewaxis = cutFrame.q.ToMat3();
|
||||
view->vieworg = cutFrame.t + offset;
|
||||
|
||||
// if the rotation wasn't overridden, remove camera pitch & roll, this is uncomfortable in VR.
|
||||
|
||||
if ( !cutRotOverride )
|
||||
{
|
||||
idAngles angles = view->viewaxis.ToAngles();
|
||||
angles.pitch = 0;
|
||||
angles.roll = 0;
|
||||
view->viewaxis = angles.ToMat3();
|
||||
}
|
||||
}
|
||||
|
||||
if ( game->isVR && gameLocal.inCinematic )
|
||||
{
|
||||
// override any camera fov changes. Unless you *like* the taste of hurl.
|
||||
|
||||
const idPlayer *player = gameLocal.GetLocalPlayer();
|
||||
view->fov_x = player->DefaultFov();
|
||||
}
|
||||
// Koz end
|
||||
|
||||
gameLocal.CalcFov( view->fov_x, view->fov_x, view->fov_y );
|
||||
|
||||
// setup the pvs for this frame
|
||||
UpdatePVSAreas( view->vieworg );
|
||||
|
||||
#if 0
|
||||
static int lastFrame = 0;
|
||||
static idVec3 lastFrameVec( 0.0f, 0.0f, 0.0f );
|
||||
if ( gameLocal.time != lastFrame ) {
|
||||
gameRenderWorld->DebugBounds( colorCyan, idBounds( view->vieworg ).Expand( 16.0f ), vec3_origin, USERCMD_MSEC );
|
||||
gameRenderWorld->DebugLine( colorRed, view->vieworg, view->vieworg + idVec3( 0.0f, 0.0f, 2.0f ), 10000, false );
|
||||
gameRenderWorld->DebugLine( colorCyan, lastFrameVec, view->vieworg, 10000, false );
|
||||
gameRenderWorld->DebugLine( colorYellow, view->vieworg + view->viewaxis[ 0 ] * 64.0f, view->vieworg + view->viewaxis[ 0 ] * 66.0f, 10000, false );
|
||||
gameRenderWorld->DebugLine( colorOrange, view->vieworg + view->viewaxis[ 0 ] * 64.0f, view->vieworg + view->viewaxis[ 0 ] * 64.0f + idVec3( 0.0f, 0.0f, 2.0f ), 10000, false );
|
||||
lastFrameVec = view->vieworg;
|
||||
lastFrame = gameLocal.time;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( g_showcamerainfo.GetBool() ) {
|
||||
gameLocal.Printf( "^5Frame: ^7%d/%d\n\n\n", realFrame + 1, camera.Num() - cameraCuts.Num() );
|
||||
}
|
||||
|
|
|
@ -97,6 +97,16 @@ typedef struct {
|
|||
float fov;
|
||||
} cameraFrame_t;
|
||||
|
||||
// Koz
|
||||
typedef struct
|
||||
{
|
||||
int cutFrame;
|
||||
bool posOverride;
|
||||
bool rotOverride;
|
||||
idVec3 posNew;
|
||||
idCQuat rotNew;
|
||||
} cameraCut_t;
|
||||
|
||||
class idCameraAnim : public idCamera {
|
||||
public:
|
||||
CLASS_PROTOTYPE( idCameraAnim );
|
||||
|
@ -117,7 +127,8 @@ private:
|
|||
int frameRate;
|
||||
int starttime;
|
||||
int cycle;
|
||||
idList<int> cameraCuts;
|
||||
//idList<int> cameraCuts;
|
||||
idList<cameraCut_t> cameraCuts; // Koz enable position and angle overrides for camera cut positions. ( When using immersive cutscenes, overrides allow better clamped camera positions without having to completely rewrite the camera files. )
|
||||
idList<cameraFrame_t> camera;
|
||||
idEntityPtr<idEntity> activator;
|
||||
|
||||
|
|
|
@ -127,6 +127,7 @@ public:
|
|||
idLinkList<idEntity> snapshotNode; // for being linked into snapshotEntities list
|
||||
int snapshotSequence; // last snapshot this entity was in
|
||||
int snapshotBits; // number of bits this entity occupied in the last snapshot
|
||||
bool snapshotStale; // Set to true if this entity is considered stale in the snapshot
|
||||
|
||||
idStr name; // name of entity
|
||||
idDict spawnArgs; // key/value pairs used to spawn and initialize entity
|
||||
|
@ -173,7 +174,10 @@ public:
|
|||
void SetName( const char *name );
|
||||
const char * GetName( void ) const;
|
||||
virtual void UpdateChangeableSpawnArgs( const idDict *source );
|
||||
|
||||
int GetEntityNumber() const
|
||||
{
|
||||
return entityNumber;
|
||||
}
|
||||
// clients generate views based on all the player specific options,
|
||||
// cameras have custom code, and everything else just uses the axis orientation
|
||||
virtual renderView_t * GetRenderView();
|
||||
|
|
|
@ -274,6 +274,16 @@ bool idGameLocal::InCinematic()
|
|||
return inCinematic;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idGameLocal::IsPDAOpen
|
||||
========================
|
||||
*/
|
||||
bool idGameLocal::IsPDAOpen() const
|
||||
{
|
||||
return GetLocalPlayer() && GetLocalPlayer()->objectiveSystemOpen;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===========
|
||||
|
@ -766,9 +776,414 @@ void idGameLocal::SetLocalClient( int clientNum ) {
|
|||
|
||||
void idGameLocal::SetVRClientInfo(vrClientInfo *pVR)
|
||||
{
|
||||
/*
|
||||
pVR->hmdorientation[0] = 0.0;
|
||||
pVR->hmdorientation[1] = 0.0;
|
||||
pVR->hmdorientation[2] = 0.0;*/
|
||||
pVRClientInfo = pVR;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Koz
|
||||
idGameLocal::CalcTorsoYawDelta()
|
||||
|
||||
Calculates a yaw offset to rotate the player model torso to a somewhat forward position
|
||||
based on view direction and tracked hand controller position.
|
||||
================
|
||||
*/
|
||||
|
||||
float idGameLocal::CalcTorsoYawDelta(usercmd_t &cmd)
|
||||
{
|
||||
// we want to orient the body relative to the view ( if movement, body will be auto positioned by move )
|
||||
// to do : improve this - it's pretty hacky, just calcs a mostly naive forward vector for the body based on view direction and hand positions.
|
||||
static int influenceLevel = 0;
|
||||
|
||||
if ( gameLocal.GetLocalPlayer() )
|
||||
{
|
||||
influenceLevel = gameLocal.GetLocalPlayer()->GetInfluenceLevel();
|
||||
|
||||
// for fucks sake this is now officially beyond ridiculous.
|
||||
// Turns out the teleport sequences in delta labs are just private camera views of the 'hell tunnel'
|
||||
// which are meshes built off in the corner of the level. No player influece is set, and if the torso is
|
||||
// updated here, it screws up the view rendering the teleport sequence.
|
||||
if ( gameLocal.GetLocalPlayer()->GetPrivateCameraView() )
|
||||
{
|
||||
// bail if the teleport camera is active.
|
||||
if ( strstr( gameLocal.GetLocalPlayer()->GetPrivateCameraView()->GetName(), "teleportView" ) ) return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
if ( influenceLevel == 0 && !gameLocal.inCinematic && commonVr->VR_USE_MOTION_CONTROLS && !commonVr->thirdPersonMovement && (abs( cmd.forwardmove ) < .1 || abs( cmd.rightmove ) < .1) )
|
||||
{
|
||||
idVec3 rightHandPos;
|
||||
idVec3 rightHandForwardVec;
|
||||
idVec3 leftHandPos;
|
||||
idVec3 leftHandForwardVec;
|
||||
idVec3 combinedHandVec;
|
||||
idVec3 centerHandsPos;
|
||||
idVec3 hipPos;
|
||||
idVec3 viewDirVec;
|
||||
idVec3 bodyDirVec;
|
||||
idVec3 bodyToHandCenterVec;
|
||||
|
||||
idVec3 torsoVec;
|
||||
static idVec3 lastTorsoVec = vec3_zero;
|
||||
|
||||
float bodyYaw;
|
||||
float viewYaw;
|
||||
|
||||
if (!gameLocal.GetLocalPlayer()) {
|
||||
/*if (common->GetCurrentGame() == DOOM3_BFG)
|
||||
common->Printf("Local player null, skipping for now...\n");*/
|
||||
return 0.0;
|
||||
}
|
||||
bodyYaw = gameLocal.GetLocalPlayer()->viewAngles.yaw;
|
||||
viewYaw = gameLocal.GetLocalPlayer()->viewAngles.yaw - commonVr->bodyYawOffset + commonVr->poseHmdAngles.yaw;
|
||||
|
||||
viewYaw = idAngles( 0.0f, viewYaw, 0.0f ).Normalize180().yaw;
|
||||
static float targetBodyYaw = viewYaw;
|
||||
|
||||
hipPos = gameLocal.GetLocalPlayer()->GetPlayerPhysics()->GetOrigin();
|
||||
hipPos.z += 48.0f;
|
||||
|
||||
rightHandPos = commonVr->currentHandWorldPosition[HAND_RIGHT /*0*/ ];// right Hand
|
||||
rightHandForwardVec = rightHandPos - hipPos;
|
||||
rightHandForwardVec.z = 0.0f;
|
||||
rightHandForwardVec.Normalize();
|
||||
|
||||
leftHandPos = commonVr->currentHandWorldPosition[HAND_LEFT /*1*/ ];// left hand
|
||||
leftHandForwardVec = leftHandPos - hipPos;
|
||||
leftHandForwardVec.z = 0.0f;
|
||||
leftHandForwardVec.Normalize();
|
||||
|
||||
combinedHandVec = leftHandForwardVec + rightHandForwardVec;
|
||||
combinedHandVec.Normalize();
|
||||
|
||||
//body direction vector;
|
||||
bodyDirVec = hipPos + (gameLocal.GetLocalPlayer()->viewAxis[0] * 40);
|
||||
bodyDirVec = bodyDirVec - hipPos;
|
||||
bodyDirVec.z = 0.0f;
|
||||
bodyDirVec.Normalize();
|
||||
|
||||
viewDirVec = gameLocal.GetLocalPlayer()->GetPlayerPhysics()->GetOrigin() + (idAngles( 0.0f, viewYaw, 0.0f ).ToMat3()[0] * 40);
|
||||
viewDirVec = viewDirVec - gameLocal.GetLocalPlayer()->GetPlayerPhysics()->GetOrigin();
|
||||
viewDirVec.z = 0.0f;
|
||||
viewDirVec.Normalize();
|
||||
|
||||
// check if hands are moving behind body.
|
||||
if ( fabs( idMath::AngleDelta( rightHandForwardVec.ToAngles().yaw, bodyDirVec.ToAngles().yaw ) ) >= 80 ||
|
||||
fabs( idMath::AngleDelta( leftHandForwardVec.ToAngles().yaw, bodyDirVec.ToAngles().yaw ) ) >= 80 )
|
||||
{
|
||||
//common->Printf( "hand deltas > 80 resetting %d\n",Sys_Milliseconds() );
|
||||
leftHandForwardVec = bodyDirVec; //viewDirVec
|
||||
rightHandForwardVec = bodyDirVec; //viewDirVec
|
||||
leftHandPos = hipPos + (gameLocal.GetLocalPlayer()->viewAxis[0] * 40); // viewDirVec * 40;
|
||||
rightHandPos = hipPos + (gameLocal.GetLocalPlayer()->viewAxis[0] * 40); // viewDirVec * 40;
|
||||
combinedHandVec = leftHandForwardVec + rightHandForwardVec;
|
||||
combinedHandVec.Normalize();
|
||||
}
|
||||
|
||||
centerHandsPos = (leftHandPos + rightHandPos) / 2.0f;
|
||||
|
||||
bodyToHandCenterVec = hipPos - centerHandsPos;
|
||||
bodyToHandCenterVec.z = 0;
|
||||
bodyToHandCenterVec.Normalize();
|
||||
|
||||
if ( bodyToHandCenterVec * viewDirVec < 0 ) // this shouldn't really happen.
|
||||
{
|
||||
bodyToHandCenterVec *= -1;
|
||||
}
|
||||
|
||||
/*
|
||||
gameRenderWorld->DebugLine( colorYellow, hipPos, hipPos + bodyDirVec * 40, 20 );
|
||||
gameRenderWorld->DebugLine( colorRed, hipPos, hipPos + rightHandForwardVec * 40, 20 );
|
||||
gameRenderWorld->DebugLine( colorBlue, hipPos, hipPos + leftHandForwardVec * 40, 20 );
|
||||
gameRenderWorld->DebugLine( colorBrown, hipPos, hipPos + viewDirVec * 40, 20 );
|
||||
gameRenderWorld->DebugLine( colorPink, hipPos, hipPos + combinedHandVec * 40, 20 );
|
||||
gameRenderWorld->DebugLine( colorPurple, hipPos, hipPos + bodyToHandCenterVec * 40, 20 );
|
||||
*/
|
||||
|
||||
torsoVec = viewDirVec;
|
||||
|
||||
if ( fabs( idMath::AngleDelta( viewDirVec.ToAngles().Normalize180().yaw, combinedHandVec.ToAngles().Normalize180().yaw ) ) > 80.0f )
|
||||
{
|
||||
torsoVec = combinedHandVec + bodyToHandCenterVec;
|
||||
}
|
||||
|
||||
torsoVec.Normalize();
|
||||
|
||||
if ( viewDirVec * torsoVec < 0.0f )
|
||||
{
|
||||
torsoVec = viewDirVec + lastTorsoVec;
|
||||
torsoVec.z = 0.0f;
|
||||
torsoVec.Normalize();
|
||||
}
|
||||
|
||||
lastTorsoVec = torsoVec;
|
||||
|
||||
float desiredBody = torsoVec.ToAngles().Normalize180().yaw;
|
||||
float angDelta = fabs( idMath::AngleDelta( targetBodyYaw, (viewYaw + bodyToHandCenterVec.ToAngles().Normalize180().yaw) / 2 ) );
|
||||
float turnDelta;
|
||||
|
||||
if ( angDelta > 5.0f ) targetBodyYaw = (viewYaw + bodyToHandCenterVec.ToAngles().Normalize180().yaw) / 2;// viewYaw;
|
||||
|
||||
if ( fabs( idMath::AngleDelta( targetBodyYaw, viewYaw ) ) > 70.0f ) targetBodyYaw = viewYaw;
|
||||
|
||||
turnDelta = -idMath::AngleDelta( bodyYaw, targetBodyYaw );
|
||||
|
||||
float cmdYaw = 0.0f;
|
||||
float degPerFrame = fabs( turnDelta ) > 30 ? turnDelta : fabs( turnDelta ) / (200.0f / (1000 / commonVr->hmdHz));// 1.0f;
|
||||
|
||||
if ( fabs( turnDelta ) < degPerFrame )
|
||||
{
|
||||
cmdYaw = turnDelta;
|
||||
}
|
||||
else
|
||||
{
|
||||
cmdYaw = turnDelta > 0.0f ? degPerFrame : -degPerFrame;
|
||||
}
|
||||
|
||||
if ( fabs( cmdYaw ) < 0.1f ) cmdYaw = 0.0f;
|
||||
|
||||
commonVr->bodyYawOffset += cmdYaw;
|
||||
commonVr->bodyYawOffset = idAngles(0.0f, commonVr->bodyYawOffset, 0.0f).Normalize180().yaw;
|
||||
|
||||
return cmdYaw;
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
bool idGameLocal::CMDButtonsAttackCall(int &teleportCanceled)
|
||||
{
|
||||
if ( commonVr->teleportButtonCount != 0 && vr_teleportMode.GetInteger() == 0 )// dont cancel teleport
|
||||
{
|
||||
commonVr->teleportButtonCount = 0;
|
||||
teleportCanceled = 1;
|
||||
return false;
|
||||
}
|
||||
else if ( teleportCanceled == 0 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool idGameLocal::CMDButtonsPhysicalCrouch()
|
||||
{
|
||||
// Koz begin crouch trigger
|
||||
if ( commonVr->userDuckingAmount > vr_crouchTriggerDist.GetFloat() / vr_scale.GetFloat() && vr_crouchMode.GetInteger() == 1 ) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* GB Begin - Moved Render call to Animator
|
||||
*/
|
||||
//GB Trying to move animator function
|
||||
bool idGameLocal::AnimatorGetJointTransform(idAnimator* animator, jointHandle_t jointHandle, int currentTime, idVec3 &offset, idMat3 &axis )
|
||||
{
|
||||
return animator->GetJointTransform( jointHandle, -1, offset, axis );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Koz begin
|
||||
idUsercmdGenLocal::EvaluateVRMoveMode()
|
||||
|
||||
Process the different VR movement mode options
|
||||
================
|
||||
*/
|
||||
void idGameLocal::EvaluateVRMoveMode(idVec3 &viewangles, usercmd_t &cmd, int buttonCurrentlyClicked, float snapTurn)
|
||||
{
|
||||
static int thirdPersonTime = commonVr->Sys_Milliseconds();
|
||||
static bool moveStarted = 0; // no movement
|
||||
static int numButtonClicks = 0; // start not pressed.
|
||||
static int pressedLastPoll = false;
|
||||
static int lastMoveTime = gameLocal.time;
|
||||
|
||||
if ( commonVr->didTeleport )
|
||||
{
|
||||
commonVr->didTeleport = false;
|
||||
if ( vr_teleportMode.GetInteger() == 0 )
|
||||
{
|
||||
viewangles[YAW] += commonVr->teleportDir;
|
||||
common->Printf( "Teleport dir yaw adding %f angles to view \n", commonVr->teleportDir );
|
||||
commonVr->teleportDir = 0.0f;
|
||||
//return;
|
||||
}
|
||||
}
|
||||
|
||||
//GB - Include Dr. Beefs SnapTurn
|
||||
if ( snapTurn != 0.0 && (commonVr->Sys_Milliseconds() - commonVr->lastComfortTime >= vr_comfortRepeat.GetInteger()) )
|
||||
{
|
||||
viewangles[YAW] += snapTurn;
|
||||
commonVr->lastComfortTime = commonVr->Sys_Milliseconds();
|
||||
}
|
||||
|
||||
// Koz make sure the torso faces some form of forward.
|
||||
if( !ik_debug.GetBool() ) {
|
||||
viewangles[YAW] += CalcTorsoYawDelta(cmd);
|
||||
}
|
||||
|
||||
bool okToMove = false;
|
||||
bool moveRequested = ( abs( cmd.forwardmove ) >= 0.05 || abs( cmd.rightmove ) >= 0.05 );
|
||||
|
||||
if ( moveRequested )
|
||||
{
|
||||
lastMoveTime = gameLocal.time;
|
||||
}
|
||||
else if ( gameLocal.time - lastMoveTime < 100 )
|
||||
{
|
||||
moveRequested = true;
|
||||
}
|
||||
|
||||
|
||||
if ( game->InCinematic() == true) return; // do nothing in cinematics
|
||||
|
||||
if ( buttonCurrentlyClicked && !pressedLastPoll && moveRequested )
|
||||
{
|
||||
numButtonClicks++;
|
||||
if ( numButtonClicks == 3 ) numButtonClicks = 1;
|
||||
pressedLastPoll = true;
|
||||
}
|
||||
|
||||
if ( !buttonCurrentlyClicked )
|
||||
{
|
||||
pressedLastPoll = false;
|
||||
}
|
||||
|
||||
if ( !moveRequested )
|
||||
{
|
||||
numButtonClicks = 0;
|
||||
moveStarted = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ( vr_moveClick.GetInteger() )
|
||||
{
|
||||
case 0: // normal movement
|
||||
|
||||
okToMove = true;
|
||||
break;
|
||||
|
||||
case 1: // click and hold to walk
|
||||
|
||||
if ( numButtonClicks > 0 && buttonCurrentlyClicked )
|
||||
{
|
||||
okToMove = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2: // click to start walking, then touch only.
|
||||
|
||||
if ( numButtonClicks > 0 )
|
||||
{
|
||||
okToMove = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3: // click to start walking, pressing again will run while pressed
|
||||
if ( numButtonClicks > 0 )
|
||||
{
|
||||
okToMove = true;
|
||||
}
|
||||
if ( numButtonClicks == 2 )
|
||||
{
|
||||
moveStarted = true;
|
||||
}
|
||||
if ( moveStarted && buttonCurrentlyClicked )
|
||||
{
|
||||
cmd.buttons |= BUTTON_RUN;
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: // click to start walking, clicking again will toggle running on and off
|
||||
if ( numButtonClicks > 0 )
|
||||
{
|
||||
okToMove = true;
|
||||
}
|
||||
if ( numButtonClicks == 2 )
|
||||
{
|
||||
cmd.buttons |= BUTTON_RUN;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
okToMove = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// okToMove is true for Doom VFR
|
||||
// if (vr_teleportMode.GetInteger() == 2) {
|
||||
// cmd.forwardmove = 0.0f;
|
||||
// cmd.rightmove = 0.0f;
|
||||
// okToMove = true;
|
||||
// }
|
||||
|
||||
if ( !okToMove )
|
||||
{
|
||||
cmd.forwardmove = 0.0f;
|
||||
cmd.rightmove = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
if (commonVr->VR_USE_MOTION_CONTROLS && !commonVr->thirdPersonMovement && (vr_movePoint.GetInteger() == 1 || vr_movePoint.GetInteger() > 2) &&
|
||||
(abs(cmd.forwardmove) >= .1 || abs(cmd.rightmove) >= .1) || vr_teleportMode.GetInteger() == 2) // body will follow motion from move vector
|
||||
{
|
||||
static idAngles controllerAng;
|
||||
int hand;
|
||||
switch( vr_movePoint.GetInteger() )
|
||||
{
|
||||
case 1: // off hand
|
||||
hand = 1 - vr_weaponHand.GetInteger();
|
||||
break;
|
||||
case 3: // weapon hand
|
||||
hand = vr_weaponHand.GetInteger();
|
||||
break;
|
||||
case 4:
|
||||
hand = 1; // left hand
|
||||
break;
|
||||
case 5:
|
||||
hand = 0; // right hand
|
||||
break;
|
||||
}
|
||||
|
||||
controllerAng = commonVr->poseHandRotationAngles[hand];
|
||||
viewangles[YAW] += controllerAng.yaw - commonVr->bodyYawOffset;
|
||||
commonVr->bodyYawOffset = controllerAng.yaw;
|
||||
}
|
||||
else if ( !commonVr->VR_USE_MOTION_CONTROLS || vr_movePoint.GetInteger() == 2 ) // body will follow view
|
||||
{
|
||||
viewangles[YAW] += commonVr->poseHmdAngles.yaw - commonVr->bodyMoveAng;
|
||||
commonVr->bodyMoveAng = commonVr->poseHmdAngles.yaw;
|
||||
commonVr->bodyYawOffset = commonVr->poseHmdAngles.yaw;
|
||||
}
|
||||
|
||||
if ( vr_motionSickness.GetInteger() == 10 )
|
||||
{
|
||||
if ( cmd.forwardmove != 0 || cmd.rightmove != 0 )
|
||||
{
|
||||
commonVr->thirdPersonMovement = true;
|
||||
thirdPersonTime = commonVr->Sys_Milliseconds();
|
||||
// third person movement is switched off again in player.cpp
|
||||
// once the speed hits zero and forwardmove and rightmove are 0
|
||||
}
|
||||
else
|
||||
{
|
||||
//in case the player has jumped on something moving in third person,
|
||||
//put a timeout here so the view will snap back if the controls haven't been touched
|
||||
//in a bit.
|
||||
if ( commonVr->thirdPersonMovement == true && ( commonVr->Sys_Milliseconds() - thirdPersonTime ) > 300 ) commonVr->thirdPersonMovement = false;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
commonVr->thirdPersonMovement = false;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
|
@ -1185,6 +1600,10 @@ void idGameLocal::MapPopulate( void ) {
|
|||
// before the physics are run so entities can bind correctly
|
||||
Printf( "==== Processing events ====\n" );
|
||||
idEvent::ServiceEvents();
|
||||
|
||||
// Must set GAME_FPS for script after populating, because some maps run their own scripts
|
||||
// when spawning the world, and GAME_FPS will not be found before then.
|
||||
SetScriptFPS( 60.0f );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1247,11 +1666,13 @@ bool idGameLocal::InitFromSaveGame( const char *mapName, idRenderWorld *renderWo
|
|||
gameRenderWorld = renderWorld;
|
||||
gameSoundWorld = soundWorld;
|
||||
|
||||
idRestoreGame savegame( saveGameFile );
|
||||
SetScriptFPS(renderSystem->GetRefresh());
|
||||
|
||||
idRestoreGame savegame( saveGameFile );
|
||||
|
||||
savegame.ReadBuildNumber();
|
||||
|
||||
// Create the list of all objects in the game
|
||||
// Create the list of all objects in the game
|
||||
savegame.CreateObjects();
|
||||
|
||||
// Load the idProgram, also checking to make sure scripting hasn't changed since the savegame
|
||||
|
@ -1265,10 +1686,10 @@ bool idGameLocal::InitFromSaveGame( const char *mapName, idRenderWorld *renderWo
|
|||
return false;
|
||||
}
|
||||
|
||||
// load the map needed for this savegame
|
||||
LoadMap( mapName, 0 );
|
||||
// load the map needed for this savegame
|
||||
LoadMap( mapName, 0 );
|
||||
|
||||
savegame.ReadInt( i );
|
||||
savegame.ReadInt( i );
|
||||
g_skill.SetInteger( i );
|
||||
|
||||
// precache the player
|
||||
|
@ -1439,6 +1860,27 @@ bool idGameLocal::InitFromSaveGame( const char *mapName, idRenderWorld *renderWo
|
|||
// free up any unused animations
|
||||
animationLib.FlushUnusedAnims();
|
||||
|
||||
// Carl: InitTeleportTarget here instead of in idPlayer::Restore so it is always done AFTER the teleport target is loaded
|
||||
if (GetLocalPlayer())
|
||||
{
|
||||
idPlayer *player = GetLocalPlayer();
|
||||
player->InitTeleportTarget();
|
||||
// if we autosaved while teleporting QuakeCon style, stop the QuakeCon style effect
|
||||
if (player->noclip)// && player->playerView.bfgVision)
|
||||
{
|
||||
extern idCVar timescale;
|
||||
player->warpTime = 0;
|
||||
player->noclip = false;
|
||||
player->warpMove = false;
|
||||
player->warpAim = false;
|
||||
player->warpVel = vec3_origin;
|
||||
player->jetMove = false;
|
||||
player->jetMoveVel = vec3_origin;
|
||||
timescale.SetFloat(1.0f);
|
||||
//player->playerView.EnableBFGVision(false);
|
||||
}
|
||||
}
|
||||
|
||||
gamestate = GAMESTATE_ACTIVE;
|
||||
|
||||
return true;
|
||||
|
@ -1846,6 +2288,21 @@ void idGameLocal::InitScriptForMap( void ) {
|
|||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
===================
|
||||
idGameLocal::SetScriptFPS
|
||||
===================
|
||||
*/
|
||||
void idGameLocal::SetScriptFPS( const float engineHz )
|
||||
{
|
||||
idVarDef* fpsDef = program.GetDef( &type_float, "GAME_FPS", &def_namespace );
|
||||
if( fpsDef != NULL )
|
||||
{
|
||||
eval_t fpsValue;
|
||||
fpsValue._float = engineHz;
|
||||
fpsDef->SetValue( fpsValue, false );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===========
|
||||
|
@ -2204,7 +2661,7 @@ gameReturn_t idGameLocal::RunFrame( const usercmd_t *clientCmds ) {
|
|||
|
||||
player->SetVRClientInfo(pVRClientInfo);
|
||||
|
||||
if ( !isMultiplayer && g_stopTime.GetBool() ) {
|
||||
if ( !isMultiplayer && g_stopTime.GetBool() || commonVr->VR_GAME_PAUSED ) {
|
||||
// clear any debug lines from a previous frame
|
||||
gameRenderWorld->DebugClearLines( time + 1 );
|
||||
|
||||
|
@ -2349,7 +2806,11 @@ gameReturn_t idGameLocal::RunFrame( const usercmd_t *clientCmds ) {
|
|||
ret.sessionCommand[0] = 0;
|
||||
|
||||
if ( !isMultiplayer && player ) {
|
||||
ret.health = player->health;
|
||||
for( int h = 0; h < 2; h++ ) {
|
||||
GetLocalPlayer()->hands[h].GetControllerShake(ret.vibrationLow[h],
|
||||
ret.vibrationHigh[h]);
|
||||
}
|
||||
ret.health = player->health;
|
||||
ret.heartRate = player->heartRate;
|
||||
ret.stamina = idMath::FtoiFast( player->stamina );
|
||||
// combat is a 0-100 value based on lastHitTime and lastDmgTime
|
||||
|
@ -3278,7 +3739,7 @@ void idGameLocal::AddEntityToHash( const char *name, idEntity *ent ) {
|
|||
if ( FindEntity( name ) ) {
|
||||
Error( "Multiple entities named '%s'", name );
|
||||
}
|
||||
entityHash.Add( entityHash.GenerateKey( name, true ), ent->entityNumber );
|
||||
entityHash.Add(entityHash.GenerateKey(name, true), ent->entityNumber);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -3667,6 +4128,19 @@ void idGameLocal::RadiusDamage( const idVec3 &origin, idEntity *inflictor, idEnt
|
|||
}
|
||||
|
||||
ent->Damage( inflictor, attacker, dir, damageDefName, damageScale, INVALID_JOINT );
|
||||
|
||||
// If the player is local. SHAkkkkkkeeee!
|
||||
if( !gameLocal.isMultiplayer && GetLocalPlayer() )
|
||||
{
|
||||
if( ent->IsType( idPlayer::Type ) )
|
||||
{
|
||||
idPlayer* player = static_cast< idPlayer* >( ent );
|
||||
if( player )
|
||||
{
|
||||
player->ControllerShakeFromDamage( damage, dir );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -112,6 +112,38 @@ typedef struct snapshot_s {
|
|||
struct snapshot_s * next;
|
||||
} snapshot_t;
|
||||
|
||||
struct timeState_t
|
||||
{
|
||||
int time;
|
||||
int previousTime;
|
||||
int realClientTime;
|
||||
|
||||
void Set( int t, int pt, int rct )
|
||||
{
|
||||
time = t;
|
||||
previousTime = pt;
|
||||
realClientTime = rct;
|
||||
};
|
||||
void Get( int& t, int& pt, int& rct )
|
||||
{
|
||||
t = time;
|
||||
pt = previousTime;
|
||||
rct = realClientTime;
|
||||
};
|
||||
void Save( idSaveGame* savefile ) const
|
||||
{
|
||||
savefile->WriteInt( time );
|
||||
savefile->WriteInt( previousTime );
|
||||
savefile->WriteInt( realClientTime );
|
||||
}
|
||||
void Restore( idRestoreGame* savefile )
|
||||
{
|
||||
savefile->ReadInt( time );
|
||||
savefile->ReadInt( previousTime );
|
||||
savefile->ReadInt( realClientTime );
|
||||
}
|
||||
};
|
||||
|
||||
const int MAX_EVENT_PARAM_SIZE = 128;
|
||||
|
||||
typedef struct entityNetEvent_s {
|
||||
|
@ -200,12 +232,28 @@ template< class type >
|
|||
class idEntityPtr {
|
||||
public:
|
||||
idEntityPtr();
|
||||
|
||||
// save games
|
||||
void Save( idSaveGame *savefile ) const; // archives object for save game file
|
||||
void Restore( idRestoreGame *savefile ); // unarchives object from save game file
|
||||
|
||||
idEntityPtr<type> & operator=( type *ent );
|
||||
/*idEntityPtr<type> & operator=( type *ent );
|
||||
idEntityPtr& operator=( const idEntityPtr& ep );
|
||||
idEntityPtr& operator=( const type* ent );*/
|
||||
idEntityPtr& operator=( const type* ent );
|
||||
idEntityPtr& operator=( const idEntityPtr& ep );
|
||||
|
||||
bool operator==( const idEntityPtr& ep )
|
||||
{
|
||||
return spawnId == ep.spawnId;
|
||||
}
|
||||
type* operator->() const
|
||||
{
|
||||
return GetEntity();
|
||||
}
|
||||
operator type* () const
|
||||
{
|
||||
return GetEntity();
|
||||
}
|
||||
|
||||
// synchronize entity pointers over the network
|
||||
int GetSpawnId( void ) const { return spawnId; }
|
||||
|
@ -296,6 +344,9 @@ public:
|
|||
idEntityPtr<idEntity> lastGUIEnt; // last entity with a GUI, used by Cmd_NextGUI_f
|
||||
int lastGUI; // last GUI on the lastGUIEnt
|
||||
|
||||
timeState_t fast;
|
||||
timeState_t slow;
|
||||
|
||||
// ---------------------- Public idGame Interface -------------------
|
||||
|
||||
idGameLocal();
|
||||
|
@ -304,6 +355,12 @@ public:
|
|||
virtual void Shutdown( void );
|
||||
virtual void SetLocalClient( int clientNum );
|
||||
virtual void SetVRClientInfo(vrClientInfo *pVRClientInfo);
|
||||
virtual void EvaluateVRMoveMode(idVec3 &viewangles, usercmd_t &cmd, int buttonCurrentlyClicked, float snapTurn);
|
||||
//GB Trying to move animator function
|
||||
virtual bool AnimatorGetJointTransform(idAnimator* animator, jointHandle_t jointHandle, int currentTime, idVec3 &offset, idMat3 &axis );
|
||||
virtual bool CMDButtonsAttackCall(int &teleportCanceled);
|
||||
virtual bool CMDButtonsPhysicalCrouch();
|
||||
virtual float CalcTorsoYawDelta(usercmd_t &cmd);
|
||||
virtual void ThrottleUserInfo( void );
|
||||
virtual const idDict * SetUserInfo( int clientNum, const idDict &userInfo, bool isClient, bool canModify );
|
||||
virtual const idDict * GetUserInfo( int clientNum );
|
||||
|
@ -448,11 +505,19 @@ public:
|
|||
void SetGlobalMaterial( const idMaterial *mat );
|
||||
const idMaterial * GetGlobalMaterial();
|
||||
|
||||
virtual bool IsPDAOpen() const;
|
||||
|
||||
void SetGibTime( int _time ) { nextGibTime = _time; };
|
||||
int GetGibTime() { return nextGibTime; };
|
||||
|
||||
// Koz made public
|
||||
void SetScriptFPS( const float com_engineHz );
|
||||
// Koz end
|
||||
|
||||
bool NeedRestart();
|
||||
|
||||
virtual int GetTimeGroupTime( int timeGroup );
|
||||
|
||||
private:
|
||||
const static int INITIAL_SPAWN_COUNT = 1;
|
||||
|
||||
|
@ -551,7 +616,7 @@ private:
|
|||
void GetShakeSounds( const idDict *dict );
|
||||
|
||||
virtual void SelectTimeGroup( int timeGroup );
|
||||
virtual int GetTimeGroupTime( int timeGroup );
|
||||
|
||||
virtual void GetBestGameType( const char* map, const char* gametype, char buf[ MAX_STRING_CHARS ] );
|
||||
|
||||
void Tokenize( idStrList &out, const char *in );
|
||||
|
@ -576,28 +641,42 @@ public:
|
|||
//============================================================================
|
||||
|
||||
template< class type >
|
||||
ID_INLINE idEntityPtr<type>::idEntityPtr() {
|
||||
spawnId = 0;
|
||||
ID_INLINE idEntityPtr<type>::idEntityPtr()
|
||||
{
|
||||
spawnId = 0;
|
||||
}
|
||||
|
||||
template< class type >
|
||||
ID_INLINE void idEntityPtr<type>::Save( idSaveGame *savefile ) const {
|
||||
savefile->WriteInt( spawnId );
|
||||
ID_INLINE void idEntityPtr<type>::Save( idSaveGame* savefile ) const
|
||||
{
|
||||
savefile->WriteInt( spawnId );
|
||||
}
|
||||
|
||||
template< class type >
|
||||
ID_INLINE void idEntityPtr<type>::Restore( idRestoreGame *savefile ) {
|
||||
savefile->ReadInt( spawnId );
|
||||
ID_INLINE void idEntityPtr<type>::Restore( idRestoreGame* savefile )
|
||||
{
|
||||
savefile->ReadInt( spawnId );
|
||||
}
|
||||
|
||||
template< class type >
|
||||
ID_INLINE idEntityPtr<type> &idEntityPtr<type>::operator=( type *ent ) {
|
||||
if ( ent == NULL ) {
|
||||
spawnId = 0;
|
||||
} else {
|
||||
spawnId = ( gameLocal.spawnIds[ent->entityNumber] << GENTITYNUM_BITS ) | ent->entityNumber;
|
||||
}
|
||||
return *this;
|
||||
ID_INLINE idEntityPtr<type>& idEntityPtr<type>::operator=( const type* ent )
|
||||
{
|
||||
if( ent == NULL )
|
||||
{
|
||||
spawnId = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnId = ( gameLocal.spawnIds[ent->entityNumber] << GENTITYNUM_BITS ) | ent->entityNumber;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
template< class type >
|
||||
ID_INLINE idEntityPtr< type >& idEntityPtr<type>::operator=( const idEntityPtr& ep )
|
||||
{
|
||||
spawnId = ep.spawnId;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template< class type >
|
||||
|
|
|
@ -1222,12 +1222,13 @@ void idGameLocal::ClientReadSnapshot( int clientNum, int sequence, const int gam
|
|||
deltaMsg.Init( base ? &base->state : NULL, &newBase->state, &msg );
|
||||
if ( player->spectating && player->spectator != player->entityNumber && gameLocal.entities[ player->spectator ] && gameLocal.entities[ player->spectator ]->IsType( idPlayer::Type ) ) {
|
||||
static_cast< idPlayer * >( gameLocal.entities[ player->spectator ] )->ReadPlayerStateFromSnapshot( deltaMsg );
|
||||
weap = static_cast< idPlayer * >( gameLocal.entities[ player->spectator ] )->weapon.GetEntity();
|
||||
//GB Not right
|
||||
/*weap = static_cast< idPlayer * >( gameLocal.entities[ player->spectator ] )->weapon.GetEntity();
|
||||
if ( weap && ( weap->GetRenderEntity()->bounds[0] == weap->GetRenderEntity()->bounds[1] ) ) {
|
||||
// update the weapon's viewmodel bounds so that the model doesn't flicker in the spectator's view
|
||||
weap->GetAnimator()->GetBounds( gameLocal.time, weap->GetRenderEntity()->bounds );
|
||||
weap->UpdateVisuals();
|
||||
}
|
||||
}*/
|
||||
} else {
|
||||
player->ReadPlayerStateFromSnapshot( deltaMsg );
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,25 +1,25 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 GPL Source Code
|
||||
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 Source Code is free software: you can redistribute it and/or modify
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 Source Code is distributed in the hope that it will be useful,
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
|
@ -31,9 +31,6 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "Entity.h"
|
||||
|
||||
class idSaveGame;
|
||||
class idRestoreGame;
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
|
@ -44,28 +41,31 @@ class idRestoreGame;
|
|||
|
||||
#define IK_ANIM "ik_pose"
|
||||
|
||||
class idIK {
|
||||
class idIK
|
||||
{
|
||||
public:
|
||||
idIK( void );
|
||||
virtual ~idIK( void );
|
||||
idIK();
|
||||
virtual ~idIK();
|
||||
|
||||
void Save( idSaveGame *savefile ) const;
|
||||
void Restore( idRestoreGame *savefile );
|
||||
void Save( idSaveGame* savefile ) const;
|
||||
void Restore( idRestoreGame* savefile );
|
||||
|
||||
bool IsInitialized( void ) const;
|
||||
bool IsInitialized() const;
|
||||
|
||||
virtual bool Init( idEntity *self, const char *anim, const idVec3 &modelOffset );
|
||||
virtual void Evaluate( void );
|
||||
virtual void ClearJointMods( void );
|
||||
virtual bool Init( idEntity* self, const char* anim, const idVec3& modelOffset );
|
||||
virtual void Evaluate();
|
||||
virtual void ClearJointMods();
|
||||
|
||||
bool SolveTwoBones( const idVec3 &startPos, const idVec3 &endPos, const idVec3 &dir, float len0, float len1, idVec3 &jointPos );
|
||||
float GetBoneAxis( const idVec3 &startPos, const idVec3 &endPos, const idVec3 &dir, idMat3 &axis );
|
||||
bool SolveTwoBones( const idVec3& startPos, const idVec3& endPos, const idVec3& dir, float len0, float len1, idVec3& jointPos );
|
||||
bool SolveTwoArmBones( idVec3& startPos, idVec3& endPos, const idVec3& dir, float len0, float len1, idVec3& jointPos );
|
||||
float GetBoneAxis( const idVec3& startPos, const idVec3& endPos, const idVec3& dir, idMat3& axis, bool debug = false );
|
||||
float GetBoneAxis2( const idVec3& startPos, const idVec3& endPos, const idVec3& dir, idMat3& axis );
|
||||
|
||||
protected:
|
||||
bool initialized;
|
||||
bool ik_activate;
|
||||
idEntity * self; // entity using the animated model
|
||||
idAnimator * animator; // animator on entity
|
||||
idEntity* self; // entity using the animated model
|
||||
idAnimator* animator; // animator on entity
|
||||
int modifiedAnim; // animation modified by the IK
|
||||
idVec3 modelOffset;
|
||||
};
|
||||
|
@ -79,28 +79,29 @@ protected:
|
|||
===============================================================================
|
||||
*/
|
||||
|
||||
class idIK_Walk : public idIK {
|
||||
class idIK_Walk : public idIK
|
||||
{
|
||||
public:
|
||||
|
||||
idIK_Walk( void );
|
||||
virtual ~idIK_Walk( void );
|
||||
idIK_Walk();
|
||||
virtual ~idIK_Walk();
|
||||
|
||||
void Save( idSaveGame *savefile ) const;
|
||||
void Restore( idRestoreGame *savefile );
|
||||
void Save( idSaveGame* savefile ) const;
|
||||
void Restore( idRestoreGame* savefile );
|
||||
|
||||
virtual bool Init( idEntity *self, const char *anim, const idVec3 &modelOffset );
|
||||
virtual void Evaluate( void );
|
||||
virtual void ClearJointMods( void );
|
||||
virtual bool Init( idEntity* self, const char* anim, const idVec3& modelOffset );
|
||||
virtual void Evaluate();
|
||||
virtual void ClearJointMods();
|
||||
|
||||
void EnableAll( void );
|
||||
void DisableAll( void );
|
||||
void EnableAll();
|
||||
void DisableAll();
|
||||
void EnableLeg( int num );
|
||||
void DisableLeg( int num );
|
||||
|
||||
private:
|
||||
static const int MAX_LEGS = 8;
|
||||
|
||||
idClipModel * footModel;
|
||||
idClipModel* footModel;
|
||||
|
||||
int numLegs;
|
||||
int enabledLegs;
|
||||
|
@ -150,28 +151,34 @@ private:
|
|||
===============================================================================
|
||||
*/
|
||||
|
||||
class idIK_Reach : public idIK {
|
||||
class idIK_Reach : public idIK
|
||||
{
|
||||
public:
|
||||
|
||||
idIK_Reach( void );
|
||||
virtual ~idIK_Reach( void );
|
||||
idIK_Reach();
|
||||
virtual ~idIK_Reach();
|
||||
|
||||
void Save( idSaveGame *savefile ) const;
|
||||
void Restore( idRestoreGame *savefile );
|
||||
void Save( idSaveGame* savefile ) const;
|
||||
void Restore( idRestoreGame* savefile );
|
||||
|
||||
virtual bool Init( idEntity *self, const char *anim, const idVec3 &modelOffset );
|
||||
virtual void Evaluate( void );
|
||||
virtual void ClearJointMods( void );
|
||||
virtual bool Init( idEntity* self, const char* anim, const idVec3& modelOffset );
|
||||
virtual void Evaluate();
|
||||
virtual void ClearJointMods();
|
||||
|
||||
private:
|
||||
|
||||
static const int MAX_ARMS = 2;
|
||||
|
||||
int numArms;
|
||||
int enabledArms;
|
||||
// Koz begin - moved from private
|
||||
static const int MAX_ARMS = 2;
|
||||
jointHandle_t handJoints[MAX_ARMS];
|
||||
jointHandle_t elbowJoints[MAX_ARMS];
|
||||
jointHandle_t shoulderJoints[MAX_ARMS];
|
||||
jointHandle_t wristJoints[MAX_ARMS];
|
||||
idMat3 elbowAxisMotion[2];
|
||||
// Koz end
|
||||
|
||||
private:
|
||||
|
||||
int numArms;
|
||||
int enabledArms;
|
||||
|
||||
jointHandle_t dirJoints[MAX_ARMS];
|
||||
|
||||
idVec3 shoulderForward[MAX_ARMS];
|
||||
|
|
|
@ -845,7 +845,7 @@ idPDAItem::GiveToPlayer
|
|||
bool idPDAItem::GiveToPlayer(idPlayer *player) {
|
||||
const char *str = spawnArgs.GetString( "pda_name" );
|
||||
if ( player ) {
|
||||
player->GivePDA( str, &spawnArgs );
|
||||
player->GivePDA( str, &spawnArgs, true ); //GB True was guessed
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1203,7 +1203,7 @@ idMoveablePDAItem::GiveToPlayer
|
|||
bool idMoveablePDAItem::GiveToPlayer(idPlayer *player) {
|
||||
const char *str = spawnArgs.GetString( "pda_name" );
|
||||
if ( player ) {
|
||||
player->GivePDA( str, &spawnArgs );
|
||||
player->GivePDA( str, &spawnArgs, true );//GB True was guessed
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2451,7 +2451,7 @@ void idMultiplayerGame::DropWeapon( int clientNum ) {
|
|||
if ( !ent || !ent->IsType( idPlayer::Type ) ) {
|
||||
return;
|
||||
}
|
||||
static_cast< idPlayer* >( ent )->DropWeapon( false );
|
||||
static_cast< idPlayer* >( ent )->DropWeapons( false );
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -29,6 +29,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#ifndef __GAME_PLAYER_H__
|
||||
#define __GAME_PLAYER_H__
|
||||
|
||||
#include <idlib/math/Quat.h>
|
||||
#include "idlib/math/Interpolate.h"
|
||||
|
||||
#include "physics/Physics_Player.h"
|
||||
|
@ -38,6 +39,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "Projectile.h"
|
||||
#include "PlayerIcon.h"
|
||||
#include "GameEdit.h"
|
||||
#include "PredictedValue.h"
|
||||
#include "Vr.h"
|
||||
|
||||
class idAI;
|
||||
|
||||
|
@ -62,22 +65,12 @@ const float THIRD_PERSON_FOCUS_DISTANCE = 512.0f;
|
|||
const int LAND_DEFLECT_TIME = 150;
|
||||
const int LAND_RETURN_TIME = 300;
|
||||
const int FOCUS_TIME = 300;
|
||||
const int FOCUS_GUI_TIME = 500;
|
||||
const int FOCUS_GUI_TIME = 200; // Koz fixme, only change in VR. Previously 500, reduced to 200 to drop weapon out of guis faster.
|
||||
const int NUM_QUICK_SLOTS = 4;
|
||||
|
||||
const int MAX_WEAPONS = 16;
|
||||
|
||||
const int WEAPON_FISTS = 0;
|
||||
const int WEAPON_PISTOL = 1;
|
||||
const int WEAPON_SHOTGUN = 2;
|
||||
const int WEAPON_MACHINEGUN = 3;
|
||||
const int WEAPON_CHAINGUN = 4;
|
||||
const int WEAPON_GREANDE = 5;
|
||||
const int WEAPON_PLASMARIFLE = 6;
|
||||
const int WEAPON_ROCKETLAUNCHER = 7;
|
||||
const int WEAPON_BFG = 8;
|
||||
const int WEAPON_SOULCUBE = 9;
|
||||
const int WEAPON_CHAINSAW = 10;
|
||||
const int WEAPON_FLASHLIGHT = 11;
|
||||
const int weapon_empty_hand = -2; // Carl: todo, maybe a different constant
|
||||
|
||||
const int DEAD_HEARTRATE = 0; // fall to as you die
|
||||
const int LOWHEALTH_HEARTRATE_ADJ = 20; //
|
||||
|
@ -89,6 +82,19 @@ const int ZERO_VOLUME = -40; // volume at zero
|
|||
const int DMG_VOLUME = 5; // volume when taking damage
|
||||
const int DEATH_VOLUME = 15; // volume at death
|
||||
|
||||
/*const int WEAPON_FISTS = 0;
|
||||
const int WEAPON_PISTOL = 1;
|
||||
const int WEAPON_SHOTGUN = 2;
|
||||
const int WEAPON_MACHINEGUN = 3;
|
||||
const int WEAPON_CHAINGUN = 4;
|
||||
const int WEAPON_GREANDE = 5;
|
||||
const int WEAPON_PLASMARIFLE = 6;
|
||||
const int WEAPON_ROCKETLAUNCHER = 7;
|
||||
const int WEAPON_BFG = 8;
|
||||
const int WEAPON_SOULCUBE = 9;
|
||||
const int WEAPON_CHAINSAW = 10;
|
||||
const int WEAPON_FLASHLIGHT = 11;*/
|
||||
|
||||
const int SAVING_THROW_TIME = 5000; // maximum one "saving throw" every five seconds
|
||||
|
||||
extern const int ASYNC_PLAYER_INV_AMMO_BITS;
|
||||
|
@ -135,15 +141,38 @@ enum {
|
|||
INFLUENCE_LEVEL3, // slow player movement
|
||||
};
|
||||
|
||||
enum gameExpansionType_t
|
||||
{
|
||||
GAME_BASE,
|
||||
GAME_D3XP,
|
||||
GAME_D3LE,
|
||||
GAME_UNKNOWN
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ammo;
|
||||
int rechargeTime;
|
||||
char ammoName[128];
|
||||
} RechargeAmmo_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[64];
|
||||
idList<int> toggleList;
|
||||
int lastUsed;
|
||||
} WeaponToggle_t;
|
||||
|
||||
class idInventory {
|
||||
public:
|
||||
int maxHealth;
|
||||
int weapons;
|
||||
int weapons, duplicateWeapons, foundWeapons;
|
||||
int powerups;
|
||||
int armor;
|
||||
int maxarmor;
|
||||
int ammo[ AMMO_NUMTYPES ];
|
||||
int clip[ MAX_WEAPONS ];
|
||||
int clipDuplicate[ MAX_WEAPONS ];
|
||||
int powerupEndTime[ MAX_POWERUPS ];
|
||||
|
||||
// mp
|
||||
|
@ -201,6 +230,9 @@ public:
|
|||
int HasAmmo( const char *weapon_classname ); // looks up the ammo information for the weapon class first
|
||||
|
||||
void UpdateArmor( void );
|
||||
int GetClipAmmoForWeapon( const int weapon, const bool duplicate ) const;
|
||||
|
||||
bool CanGive( idPlayer* owner, const idDict& spawnArgs, const char* statname, const char* value );
|
||||
|
||||
int nextItemPickup;
|
||||
int nextItemNum;
|
||||
|
@ -219,6 +251,182 @@ typedef struct {
|
|||
idVec3 pos;
|
||||
} aasLocation_t;
|
||||
|
||||
enum slotIndex_t
|
||||
{
|
||||
SLOT_NONE = -1,
|
||||
SLOT_PDA_HIP,
|
||||
SLOT_WEAPON_HIP,
|
||||
SLOT_WEAPON_BACK_BOTTOM,
|
||||
SLOT_WEAPON_BACK_TOP,
|
||||
SLOT_FLASHLIGHT_SHOULDER,
|
||||
SLOT_FLASHLIGHT_HEAD,
|
||||
SLOT_COUNT
|
||||
};
|
||||
|
||||
struct slot_t
|
||||
{
|
||||
idVec3 origin;
|
||||
float radiusSq;
|
||||
};
|
||||
|
||||
class idWeaponHolder
|
||||
{
|
||||
public:
|
||||
idPlayer* owner;
|
||||
int currentWeapon;
|
||||
bool isTheDuplicate; // Carl: Dual wielding, is weapon the duplicate copy or the original? (ie. Which ammo clip does it use?)
|
||||
public:
|
||||
idWeaponHolder();
|
||||
virtual ~idWeaponHolder();
|
||||
void Init( idPlayer* player );
|
||||
virtual bool isEmpty();
|
||||
};
|
||||
|
||||
class idHolster : public idWeaponHolder
|
||||
{
|
||||
public:
|
||||
slotIndex_t slot;
|
||||
idVec3 origin;
|
||||
float radiusSq;
|
||||
renderEntity_t renderEntity; // used to present a model to the renderer
|
||||
qhandle_t modelDefHandle; // handle to static renderer model
|
||||
idMat3 holsterAxis;
|
||||
public:
|
||||
idHolster();
|
||||
virtual ~idHolster();
|
||||
void Init( idPlayer* player );
|
||||
void FreeSlot();
|
||||
void HolsterModelByName( const char* modelname, idRenderModel* renderModel = NULL );
|
||||
void HolsterPDA();
|
||||
void HolsterFlashlight();
|
||||
void EmptyHolster();
|
||||
void HolsterCurrentWeapon( int stashed, int hand );
|
||||
void StashToExtraHolster();
|
||||
void RestoreFromExtraHolster();
|
||||
void UpdateSlot();
|
||||
};
|
||||
|
||||
class idPlayerHand : public idWeaponHolder {
|
||||
public:
|
||||
int whichHand;
|
||||
|
||||
// laser sight - technically every weapon instance could have its own laser sight,
|
||||
// but laser sights are only active when in a player's hand, so make it one per hand
|
||||
renderEntity_t laserSightRenderEntity; // replace crosshair for 3DTV
|
||||
qhandle_t laserSightHandle;
|
||||
renderEntity_t crosshairEntity; // Koz add a model to place the crosshair into the world
|
||||
qhandle_t crosshairHandle;
|
||||
int lastCrosshairMode;
|
||||
bool laserSightActive; // Koz allow lasersight toggle
|
||||
|
||||
// throwing is per hand
|
||||
idVec3 throwDirection; // for motion control throwing actions e.g. grenade
|
||||
float throwVelocity;
|
||||
int frameTime[10];
|
||||
idVec3 position[10];
|
||||
int frameNum;
|
||||
int curTime;
|
||||
int timeDelta;
|
||||
int startFrameNum;
|
||||
|
||||
// slots
|
||||
idVec3 handOrigin;
|
||||
idMat3 handAxis;
|
||||
slotIndex_t handSlot;
|
||||
|
||||
bool grabbingWorld, oldGrabbingWorld; // currently this corresponds more to the state of the grip trigger/button which may actually act as a toggle
|
||||
bool virtualGrabDown, oldVirtualGrabDown; // this is the actual virtual grab state, when this goes false you should drop what you're holding
|
||||
bool triggerDown, oldTriggerDown, oldFlashlightTriggerDown;
|
||||
bool thumbDown, oldThumbDown;
|
||||
|
||||
idEntityPtr<idWeapon> weapon;
|
||||
bool weaponGone; // force stop firing
|
||||
|
||||
// currentWeapon is inherited from the idWeaponHolder superclass
|
||||
int idealWeapon;
|
||||
int previousWeapon;
|
||||
int weaponSwitchTime;
|
||||
|
||||
// Weapon positioning
|
||||
bool PDAfixed; // Koz has the PDA been fixed in space?
|
||||
bool lastPdaFixed;
|
||||
idVec3 playerPdaPos; // position player was at when pda fixed in space
|
||||
idVec3 motionPosition;
|
||||
idQuat motionRotation;// = idQuat_zero;
|
||||
bool wasPDA;
|
||||
|
||||
idStr animPrefix; // player hand anims
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
// controller shake parms
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
const static int MAX_SHAKE_BUFFER = 3;
|
||||
float controllerShakeHighMag[MAX_SHAKE_BUFFER]; // magnitude of the high frequency controller shake
|
||||
float controllerShakeLowMag[MAX_SHAKE_BUFFER]; // magnitude of the low frequency controller shake
|
||||
int controllerShakeHighTime[MAX_SHAKE_BUFFER]; // time the controller shake ends for high frequency.
|
||||
int controllerShakeLowTime[MAX_SHAKE_BUFFER]; // time the controller shake ends for low frequency.
|
||||
int controllerShakeTimeGroup;
|
||||
|
||||
public:
|
||||
idPlayerHand();
|
||||
|
||||
virtual ~idPlayerHand();
|
||||
|
||||
void Init(idPlayer *player, int hand);
|
||||
|
||||
void TrackWeaponDirection(idVec3 origin);
|
||||
|
||||
virtual bool holdingFlashlight();
|
||||
|
||||
virtual bool holdingWeapon(); // physically holding it, not just levitating or using fists
|
||||
virtual bool
|
||||
floatingWeapon(); // the soul cube and the artifact float next to your hand rather than being held
|
||||
virtual bool controllingWeapon(); // holding or floating
|
||||
virtual bool holdingPDA();
|
||||
|
||||
virtual bool holdingPhysics();
|
||||
|
||||
virtual bool holdingItem();
|
||||
|
||||
virtual bool holdingSomethingDroppable();
|
||||
|
||||
bool isOverMountedFlashlight();
|
||||
|
||||
bool tooFullToInteract();
|
||||
|
||||
bool
|
||||
handExists(); // false if our character is missing a hand or has something mounted on their forearm instead
|
||||
|
||||
bool contextToggleVirtualGrab();
|
||||
|
||||
bool startVirtualGrab();
|
||||
|
||||
bool releaseVirtualGrab(); // will drop whatever you're holding
|
||||
|
||||
idStr GetCurrentWeaponString();
|
||||
|
||||
void NextWeapon(int dir = 1);
|
||||
|
||||
void PrevWeapon();
|
||||
|
||||
void NextBestWeapon();
|
||||
|
||||
void SelectWeapon(int num, bool force, bool specific);
|
||||
|
||||
void DropWeapon(bool died);
|
||||
|
||||
// Controller Shake
|
||||
void
|
||||
SetControllerShake(float highMagnitude, int highDuration, float lowMagnitude, int lowDuration);
|
||||
|
||||
void ResetControllerShake();
|
||||
|
||||
void GetControllerShake(int &highMagnitude, int &lowMagnitude) const;
|
||||
|
||||
void debugPrint();
|
||||
};
|
||||
|
||||
class idPlayer : public idActor {
|
||||
public:
|
||||
enum {
|
||||
|
@ -227,21 +435,95 @@ public:
|
|||
EVENT_ABORT_TELEPORTER,
|
||||
EVENT_POWERUP,
|
||||
EVENT_SPECTATE,
|
||||
EVENT_PICKUPNAME,
|
||||
EVENT_FORCE_ORIGIN,
|
||||
EVENT_KNOCKBACK,
|
||||
EVENT_MAXEVENTS
|
||||
};
|
||||
|
||||
usercmd_t usercmd;
|
||||
static const int MAX_PLAYER_PDA = 100;
|
||||
static const int MAX_PLAYER_VIDEO = 100;
|
||||
static const int MAX_PLAYER_AUDIO = 100;
|
||||
static const int MAX_PLAYER_AUDIO_ENTRIES = 2;
|
||||
|
||||
usercmd_t oldCmd;
|
||||
usercmd_t usercmd;
|
||||
|
||||
class idPlayerView playerView; // handles damage kicks and effects
|
||||
|
||||
idPlayerHand hands[2];
|
||||
|
||||
renderEntity_t flashlightRenderEntity; // used to present a model to the renderer
|
||||
qhandle_t flashlightModelDefHandle; // handle to static renderer model
|
||||
|
||||
renderEntity_t hudEntity;
|
||||
qhandle_t hudHandle;
|
||||
// Koz begin
|
||||
renderEntity_t headingBeamEntity; // Koz add a heading indicator pointing the direction the players body is facing.
|
||||
qhandle_t headingBeamHandle;
|
||||
bool headingBeamActive;
|
||||
const idDeclSkin* skinHeadingSolid;
|
||||
const idDeclSkin* skinHeadingArrows;
|
||||
const idDeclSkin* skinHeadingArrowsScroll;
|
||||
|
||||
renderEntity_t pdaRenderEntity; // used to present a model to the renderer
|
||||
qhandle_t pdaModelDefHandle; // handle to static renderer model
|
||||
idMat3 pdaHolsterAxis;
|
||||
|
||||
renderEntity_t holsterRenderEntity; // used to present a model to the renderer
|
||||
qhandle_t holsterModelDefHandle; // handle to static renderer model
|
||||
idMat3 holsterAxis;
|
||||
int holsteredWeapon, extraHolsteredWeapon;
|
||||
const char* extraHolsteredWeaponModel;
|
||||
|
||||
renderEntity_t hudEntity; // Koz add a model to place the hud into the world
|
||||
qhandle_t hudHandle;
|
||||
bool hudActive;
|
||||
|
||||
const idDeclSkin* skinCrosshairDot;
|
||||
const idDeclSkin* skinCrosshairCircleDot;
|
||||
const idDeclSkin* skinCrosshairCross;
|
||||
|
||||
const idDeclSkin* skinTelepadCrouch;
|
||||
|
||||
|
||||
idEntityPtr<idAnimatedEntity> teleportTarget;
|
||||
idAnimator* teleportTargetAnimator;
|
||||
|
||||
jointHandle_t teleportBeamJoint[24];
|
||||
jointHandle_t teleportPadJoint;
|
||||
jointHandle_t teleportCenterPadJoint;
|
||||
|
||||
idVec3 teleportPoint; // Carl: used for teleporting
|
||||
idVec3 teleportAimPoint; // Carl: used for teleporting
|
||||
idVec3 teleportDir; // direction of teleport movement - needed for scripts where entities check player movement.
|
||||
|
||||
float teleportAimPointPitch;
|
||||
|
||||
bool aimValidForTeleport;
|
||||
|
||||
bool flashlightPreviouslyInHand;
|
||||
|
||||
idVec3 PDAorigin; // Koz
|
||||
idMat3 PDAaxis; // Koz
|
||||
|
||||
idMat3 chestPivotCorrectAxis; //made these public so could be accessed by hmdgetorientation;
|
||||
idVec3 chestPivotDefaultPos;
|
||||
jointHandle_t chestPivotJoint;
|
||||
//float independentWeaponPitch; // deltas to provide aim independent of body/view orientation
|
||||
//float independentWeaponYaw;
|
||||
|
||||
|
||||
// Koz end
|
||||
|
||||
bool noclip;
|
||||
bool godmode;
|
||||
bool warpMove, warpAim;
|
||||
idVec3 warpVel, warpDest;
|
||||
int warpTime;
|
||||
|
||||
bool jetMove;
|
||||
idVec3 jetMoveVel;
|
||||
int jetMoveTime;
|
||||
int jetMoveCoolDownTime;
|
||||
|
||||
bool spawnAnglesSet; // on first usercmd, we must set deltaAngles
|
||||
idAngles spawnAngles;
|
||||
|
@ -256,6 +538,10 @@ public:
|
|||
int lastSndHitTime; // MP hit sound - != lastHitTime because we throttle
|
||||
int lastSavingThrowTime; // for the "free miss" effect
|
||||
|
||||
bool pdaHasBeenRead[ MAX_PLAYER_PDA ];
|
||||
bool videoHasBeenViewed[ MAX_PLAYER_VIDEO ];
|
||||
bool audioHasBeenHeard[ MAX_PLAYER_AUDIO ][ MAX_PLAYER_AUDIO_ENTRIES ];
|
||||
|
||||
idScriptBool AI_FORWARD;
|
||||
idScriptBool AI_BACKWARD;
|
||||
idScriptBool AI_STRAFE_LEFT;
|
||||
|
@ -279,10 +565,13 @@ public:
|
|||
// inventory
|
||||
idInventory inventory;
|
||||
|
||||
idEntityPtr<idWeapon> weapon;
|
||||
int flashlightBattery;
|
||||
idEntityPtr<idWeapon> flashlight;
|
||||
|
||||
idUserInterface * hud; // MP: is NULL if not local player
|
||||
idUserInterface * objectiveSystem;
|
||||
bool objectiveSystemOpen;
|
||||
int quickSlot[ NUM_QUICK_SLOTS ];
|
||||
|
||||
vrClientInfo *pVRClientInfo;
|
||||
|
||||
|
@ -290,7 +579,19 @@ public:
|
|||
int weapon_pda;
|
||||
int weapon_fists;
|
||||
int weapon_flashlight;
|
||||
|
||||
int weapon_chainsaw;
|
||||
bool harvest_lock;
|
||||
// Koz begin
|
||||
int weapon_pistol;
|
||||
int weapon_shotgun;
|
||||
int weapon_machinegun;
|
||||
int weapon_chaingun;
|
||||
int weapon_handgrenade;
|
||||
int weapon_plasmagun;
|
||||
int weapon_rocketlauncher;
|
||||
int weapon_bfg;
|
||||
int weapon_flashlight_new;
|
||||
// Koz end
|
||||
int heartRate;
|
||||
idInterpolate<float> heartInfo;
|
||||
int lastHeartAdjust;
|
||||
|
@ -351,7 +652,23 @@ public:
|
|||
idVec3 firstPersonViewOrigin;
|
||||
idMat3 firstPersonViewAxis;
|
||||
|
||||
idDragEntity dragEntity;
|
||||
idVec3 waistOrigin;
|
||||
idMat3 waistAxis;
|
||||
|
||||
idDragEntity dragEntity;
|
||||
|
||||
//idFuncMountedObject* mountedObject;
|
||||
idEntityPtr<idLight> enviroSuitLight;
|
||||
|
||||
bool healthRecharge;
|
||||
int lastHealthRechargeTime;
|
||||
int rechargeSpeed;
|
||||
|
||||
float new_g_damageScale;
|
||||
|
||||
bool bloomEnabled;
|
||||
float bloomSpeed;
|
||||
float bloomIntensity;
|
||||
|
||||
public:
|
||||
CLASS_PROTOTYPE( idPlayer );
|
||||
|
@ -359,9 +676,50 @@ public:
|
|||
idPlayer();
|
||||
virtual ~idPlayer();
|
||||
|
||||
void SetVRClientInfo(vrClientInfo *pVRClientInfo);
|
||||
vrClientInfo* GetVRClientInfo();
|
||||
|
||||
void Spawn( void );
|
||||
void Think( void );
|
||||
|
||||
void SetupPDASlot( bool holsterPDA );
|
||||
void FreePDASlot();
|
||||
void UpdatePDASlot();
|
||||
|
||||
void SetupHolsterSlot( int hand, int stashed = -1 );
|
||||
void FreeHolsterSlot();
|
||||
void UpdateHolsterSlot();
|
||||
|
||||
void UpdateLaserSight( int hand );
|
||||
bool GetHandOrHeadPositionWithHacks( int hand, idVec3& origin, idMat3& axis );
|
||||
|
||||
// Koz begin
|
||||
void UpdateTeleportAim();
|
||||
bool GetTeleportBeamOrigin( idVec3 &beamOrigin, idMat3 &beamAxis);
|
||||
void UpdatePlayerSkinsPoses();
|
||||
void SetWeaponHandPose();
|
||||
void SetFlashHandPose(); // Set flashlight hand pose
|
||||
void ToggleLaserSight();
|
||||
void UpdateHeadingBeam();
|
||||
void ToggleHeadingBeam();
|
||||
void UpdateVrHud();
|
||||
void ToggleHud();
|
||||
void RecreateCopyJoints();
|
||||
void UpdateNeckPose();
|
||||
bool IsCrouching()
|
||||
{
|
||||
return physicsObj.IsCrouching();
|
||||
}
|
||||
void InitTeleportTarget();
|
||||
// Koz end
|
||||
//GB Begin
|
||||
float GetHudAlpha();
|
||||
//GB End
|
||||
|
||||
// Carl begin
|
||||
bool HasHoldableFlashlight();
|
||||
// Carl end
|
||||
|
||||
// save games
|
||||
void Save( idSaveGame *savefile ) const; // archives object for save game file
|
||||
void Restore( idRestoreGame *savefile ); // unarchives object from save game file
|
||||
|
@ -370,6 +728,7 @@ public:
|
|||
virtual void Show( void );
|
||||
|
||||
void Init( void );
|
||||
void InitPlayerBones(); // Koz
|
||||
void PrepareForRestart( void );
|
||||
virtual void Restart( void );
|
||||
void LinkScriptVariables( void );
|
||||
|
@ -387,9 +746,6 @@ public:
|
|||
idDict * GetUserInfo( void );
|
||||
bool BalanceTDM( void );
|
||||
|
||||
void SetVRClientInfo(vrClientInfo *pVRClientInfo);
|
||||
vrClientInfo* GetVRClientInfo();
|
||||
|
||||
void CacheWeapons( void );
|
||||
|
||||
void EnterCinematic( void );
|
||||
|
@ -400,11 +756,21 @@ public:
|
|||
void UpdateConditions( void );
|
||||
void SetViewAngles( const idAngles &angles );
|
||||
|
||||
void ControllerShakeFromDamage( int damage );
|
||||
void ControllerShakeFromDamage( int damage, const idVec3 &direction );
|
||||
void SetControllerShake( float magnitude, int duration, const idVec3 &direction );
|
||||
void ResetControllerShake();
|
||||
|
||||
// delta view angles to allow movers to rotate the view of the player
|
||||
void UpdateDeltaViewAngles( const idAngles &angles );
|
||||
|
||||
virtual bool Collide( const trace_t &collision, const idVec3 &velocity );
|
||||
|
||||
// Carl : Teleporting
|
||||
int PointReachableAreaNum(const idVec3& pos, const float boundsScale = 2.0f) const;
|
||||
bool PathToGoal(aasPath_t& path, int areaNum, const idVec3& origin, int goalAreaNum, const idVec3& goalOrigin) const;
|
||||
bool CanReachPosition( const idVec3& pos, idVec3& betterPos );
|
||||
|
||||
virtual void GetAASLocation( idAAS *aas, idVec3 &pos, int &areaNum ) const;
|
||||
virtual void GetAIAimTargets( const idVec3 &lastSightPos, idVec3 &headPos, idVec3 &chestPos );
|
||||
virtual void DamageFeedback( idEntity *victim, idEntity *inflictor, int &damage );
|
||||
|
@ -414,33 +780,52 @@ public:
|
|||
|
||||
// use exitEntityNum to specify a teleport with private camera view and delayed exit
|
||||
virtual void Teleport( const idVec3 &origin, const idAngles &angles, idEntity *destination );
|
||||
virtual bool TeleportPathSegment( const idVec3& start, const idVec3& end, idVec3& lastPos );
|
||||
virtual void TeleportPath( const idVec3& target );
|
||||
virtual bool CheckTeleportPathSegment(const idVec3& start, const idVec3& end, idVec3& lastPos);
|
||||
virtual bool CheckTeleportPath(const idVec3& target, int toAreaNum = 0);
|
||||
|
||||
virtual void SetupFlashlightHolster();
|
||||
virtual void UpdateFlashlightHolster();
|
||||
virtual void SetupLaserSight();
|
||||
virtual void UpdateLaserSight( );
|
||||
virtual void UpdateVrHud();
|
||||
//virtual void UpdateLaserSight( );
|
||||
|
||||
void Kill( bool delayRespawn, bool nodamage );
|
||||
virtual void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location );
|
||||
void StartFxOnBone(const char *fx, const char *bone);
|
||||
|
||||
bool ShouldBlink();
|
||||
renderView_t * GetRenderView( void );
|
||||
void CalculateRenderView( void ); // called every tic by player code
|
||||
void CalculateFirstPersonView( void );
|
||||
void CalculateWaist();
|
||||
void CalculateLeftHand();
|
||||
void CalculateRightHand();
|
||||
|
||||
void DrawHUD( idUserInterface *hud );
|
||||
// void DrawHUDVR( idMenuHandler_HUD* hudManager );
|
||||
void DrawHUDVR( idUserInterface *hud );
|
||||
|
||||
void WeaponFireFeedback( const idDict *weaponDef );
|
||||
void WeaponFireFeedback( int hand, const idDict* weaponDef );
|
||||
|
||||
float DefaultFov( void ) const;
|
||||
float CalcFov( bool honorZoom );
|
||||
void CalculateViewWeaponPos( bool pointer, idVec3 &origin, idMat3 &axis, idAngles &angles );
|
||||
void CalculateViewWeaponPos( int hand, idVec3& origin, idMat3& axis );
|
||||
void CalculateViewWeaponPosVR( int hand, idVec3& origin, idMat3& axis );
|
||||
void SetHandIKPos( int hand, idVec3 handOrigin, idMat3 handAxis, idQuat rotation, bool isFlashlight = false );
|
||||
|
||||
// Koz begin
|
||||
void CalculateViewFlashlightPos( idVec3 &origin, idMat3 &axis, idVec3 flashlightOffset ); // Koz aim the flashlight with motion controls
|
||||
// Koz end
|
||||
|
||||
idVec3 GetEyePosition( void ) const;
|
||||
void GetViewPos( idVec3 &origin, idMat3 &axis ) const;
|
||||
void GetViewPosVR( idVec3& origin, idMat3& axis ) const; // Koz fixme
|
||||
|
||||
void OffsetThirdPersonView( float angle, float range, float height, bool clip );
|
||||
|
||||
bool Give( const char *statname, const char *value );
|
||||
//bool Give( const char *statname, const char *value );
|
||||
bool Give( const char* statname, const char* value, int hand );
|
||||
bool GiveItem( idItem *item );
|
||||
void GiveItem( const char *name );
|
||||
void GiveHealthPool( float amt );
|
||||
|
@ -451,7 +836,10 @@ public:
|
|||
void RemoveInventoryItem( const char *name );
|
||||
idDict * FindInventoryItem( const char *name );
|
||||
|
||||
void GivePDA( const char *pdaName, idDict *item );
|
||||
void SetQuickSlot( int index, int val );
|
||||
int GetQuickSlot( int index );
|
||||
|
||||
void GivePDA( const char *pdaName, idDict *item, bool toggle );
|
||||
void GiveVideo( const char *videoName, idDict *item );
|
||||
void GiveEmail( const char *emailName );
|
||||
void GiveSecurity( const char *security );
|
||||
|
@ -463,23 +851,46 @@ public:
|
|||
bool PowerUpActive( int powerup ) const;
|
||||
float PowerUpModifier( int type );
|
||||
|
||||
bool OtherHandImpulseSlot();
|
||||
bool WeaponHandImpulseSlot();
|
||||
bool GrabWorld( int hand, bool pressed ); // 0 = right hand, 1 = left hand; true if pressed, false if released; returns true if handled as grab
|
||||
bool TriggerClickWorld( int hand, bool pressed ); // 0 = right hand, 1 = left hand; true if pressed, false if released; returns true if handled as trigger
|
||||
bool ThumbClickWorld( int hand, bool pressed ); // 0 = right hand, 1 = left hand; true if pressed, false if released; returns true if handled as thumb click
|
||||
|
||||
int SlotForWeapon( const char *weaponName );
|
||||
void Reload( void );
|
||||
void NextWeapon( void );
|
||||
void NextBestWeapon( void );
|
||||
void PrevWeapon( void );
|
||||
void SelectWeapon( int num, bool force );
|
||||
void DropWeapon( bool died ) ;
|
||||
void SetPreviousWeapon( int num )
|
||||
{
|
||||
hands[ vr_weaponHand.GetInteger() ].previousWeapon = num;
|
||||
}
|
||||
void SelectWeapon( int num, bool force, bool specific = false );
|
||||
void DropWeapons( bool died ) ;
|
||||
void StealWeapon( idPlayer *player );
|
||||
void AddProjectilesFired( int count );
|
||||
void AddProjectileHits( int count );
|
||||
void SetLastHitTime( int time );
|
||||
void LowerWeapon( void );
|
||||
void RaiseWeapon( void );
|
||||
void WeaponLoweringCallback( void );
|
||||
void WeaponRisingCallback( void );
|
||||
void RemoveWeapon( const char *weap );
|
||||
bool CanShowWeaponViewmodel( void ) const;
|
||||
// Carl: Dual wielding
|
||||
bool CanDualWield( int num ) const;
|
||||
idWeapon* GetWeaponInHand( int hand ) const;
|
||||
// Carl: when the code needs just one weapon, guess which one is the "main" one
|
||||
idWeapon* GetMainWeapon();
|
||||
idWeapon* GetPDAWeapon() const;
|
||||
idWeapon* GetWeaponWithMountedFlashlight();
|
||||
int GetBestWeaponHand();
|
||||
int GetBestWeaponHandToSteal( idPlayer* thief );
|
||||
// Carl: get the specific weapon used to harvest souls (Soul Cube or Artifact)
|
||||
// Returns the required one if you're holding it in a hand, or the other one, or the main weapon
|
||||
idWeapon* GetHarvestWeapon( idStr requiredWeapons );
|
||||
idStr GetCurrentHarvestWeapon( idStr requiredWeapons );
|
||||
virtual int GetAnim( int channel, const char* name );
|
||||
// Carl end
|
||||
|
||||
void AddAIKill( void );
|
||||
void SetSoulCubeProjectile( idProjectile *projectile );
|
||||
|
@ -491,10 +902,11 @@ public:
|
|||
|
||||
virtual bool HandleSingleGuiCommand( idEntity *entityGui, idLexer *src );
|
||||
bool GuiActive( void ) { return focusGUIent != NULL; }
|
||||
bool HandleGuiEvents( const sysEvent_t* ev );
|
||||
|
||||
void PerformImpulse( int impulse );
|
||||
void Spectate( bool spectate );
|
||||
void TogglePDA( void );
|
||||
void TogglePDA( int hand );
|
||||
void ToggleScoreboard( void );
|
||||
void RouteGuiMouse( idUserInterface *gui );
|
||||
void UpdateHud( void );
|
||||
|
@ -504,18 +916,23 @@ public:
|
|||
void SetInfluenceView( const char *mtr, const char *skinname, float radius, idEntity *ent );
|
||||
void SetInfluenceLevel( int level );
|
||||
int GetInfluenceLevel( void ) { return influenceActive; };
|
||||
|
||||
void SetPrivateCameraView( idCamera *camView );
|
||||
idCamera * GetPrivateCameraView( void ) const { return privateCameraView; }
|
||||
|
||||
void StartFxFov( float duration );
|
||||
void UpdateHudWeapon( bool flashWeapon = true );
|
||||
void UpdateHudWeapon( int flashWeaponHand );
|
||||
void UpdateHudStats( idUserInterface *hud );
|
||||
void UpdateHudAmmo( idUserInterface *hud );
|
||||
void UpdateHudAmmo( idUserInterface *hud, int hand );
|
||||
void Event_StopAudioLog( void );
|
||||
bool IsSoundChannelPlaying( const s_channelType channel = SND_CHANNEL_ANY );
|
||||
void StartAudioLog( void );
|
||||
void StopAudioLog( void );
|
||||
void ShowTip( const char *title, const char *tip, bool autoHide );
|
||||
void HideTip( void );
|
||||
|
||||
bool IsTipVisible( void ) { return tipUp; };
|
||||
|
||||
void ShowObjective( const char *obj );
|
||||
void HideObjective( void );
|
||||
|
||||
|
@ -547,7 +964,7 @@ public:
|
|||
void SetLeader( bool lead );
|
||||
bool IsLeader( void );
|
||||
|
||||
void UpdateSkinSetup( bool restart );
|
||||
void UpdateSkinSetup();
|
||||
|
||||
bool OnLadder( void ) const;
|
||||
|
||||
|
@ -558,13 +975,70 @@ public:
|
|||
|
||||
bool SelfSmooth( void );
|
||||
void SetSelfSmooth( bool b );
|
||||
int GetCurrentWeapon();
|
||||
idStr GetCurrentWeapon();
|
||||
int GetCurrentWeaponId();
|
||||
int GetCurrentWeaponSlot()
|
||||
{
|
||||
return hands[ vr_weaponHand.GetInteger() ].currentWeapon;
|
||||
}
|
||||
int GetIdealWeapon()
|
||||
{
|
||||
return hands[ vr_weaponHand.GetInteger() ].idealWeapon;
|
||||
}
|
||||
idHashTable<WeaponToggle_t> GetWeaponToggles() const
|
||||
{
|
||||
return weaponToggles;
|
||||
}
|
||||
|
||||
virtual void FreeModelDef();
|
||||
|
||||
const idAngles& GetViewBobAngles()
|
||||
{
|
||||
return viewBobAngles;
|
||||
}
|
||||
const idVec3& GetViewBob()
|
||||
{
|
||||
return viewBob;
|
||||
}
|
||||
|
||||
bool IsLocallyControlled() const
|
||||
{
|
||||
return entityNumber == gameLocal.localClientNum;
|
||||
}
|
||||
|
||||
gameExpansionType_t GetExpansionType() const;
|
||||
|
||||
friend class idWeaponHolder;
|
||||
friend class idHolster;
|
||||
friend class idPlayerHand;
|
||||
|
||||
private:
|
||||
jointHandle_t hipJoint;
|
||||
jointHandle_t chestJoint;
|
||||
jointHandle_t headJoint;
|
||||
|
||||
// Koz begin
|
||||
jointHandle_t neckJoint;
|
||||
|
||||
jointHandle_t ik_hand[2];
|
||||
jointHandle_t ik_elbow[2];
|
||||
jointHandle_t ik_shoulder[2];
|
||||
jointHandle_t ik_handAttacher[2];
|
||||
bool handLowered;
|
||||
bool handRaised;
|
||||
|
||||
//idMat3 chestPivotCorrectAxis; //made these public so could be accessed by hmdge
|
||||
//idVec3 chestPivotDefaultPos;
|
||||
idMat3 ik_elbowCorrectAxis[2];
|
||||
idMat3 ik_handCorrectAxis[2][32];
|
||||
idVec3 handWeaponAttachertoWristJointOffset[2][32];
|
||||
idVec3 handWeaponAttacherToDefaultOffset[2][32];
|
||||
|
||||
int aasState;
|
||||
// Koz end
|
||||
|
||||
bool blink;
|
||||
|
||||
idPhysics_Player physicsObj; // player physics
|
||||
|
||||
idList<aasLocation_t> aasLocation; // for AI tracking the player
|
||||
|
@ -585,11 +1059,8 @@ private:
|
|||
int landChange;
|
||||
int landTime;
|
||||
|
||||
int currentWeapon;
|
||||
int idealWeapon;
|
||||
int previousWeapon;
|
||||
int weaponSwitchTime;
|
||||
bool weaponEnabled;
|
||||
int risingWeaponHand; // Carl: getWeaponEntity script function assumes there is only one weapon and assigns it during raise
|
||||
bool showWeaponViewModel;
|
||||
|
||||
const idDeclSkin * skin;
|
||||
|
@ -654,6 +1125,8 @@ private:
|
|||
idVec3 smoothedOrigin;
|
||||
idAngles smoothedAngles;
|
||||
|
||||
idHashTable<WeaponToggle_t> weaponToggles;
|
||||
|
||||
// mp
|
||||
bool ready; // from userInfo
|
||||
bool respawning; // set to true while in SpawnToPoint for telefrag checks
|
||||
|
@ -676,11 +1149,14 @@ private:
|
|||
void LookAtKiller( idEntity *inflictor, idEntity *attacker );
|
||||
|
||||
void StopFiring( void );
|
||||
void FireWeapon( void );
|
||||
void FireWeapon( int hand, idWeapon* weap );
|
||||
void Weapon_Combat( void );
|
||||
void Weapon_NPC( void );
|
||||
void Weapon_GUI( void );
|
||||
void UpdateWeapon( void );
|
||||
void UpdateFlashlight();
|
||||
void FlashlightOn();
|
||||
void FlashlightOff();
|
||||
void UpdateSpectating( void );
|
||||
void SpectateFreeFly( bool force ); // ignore the timeout to force when followed spec is no longer valid
|
||||
void SpectateCycle( void );
|
||||
|
@ -695,9 +1171,15 @@ private:
|
|||
void EvaluateControls( void );
|
||||
void AdjustSpeed( void );
|
||||
void AdjustBodyAngles( void );
|
||||
void InitAASLocation( void );
|
||||
|
||||
void SnapBodyToView(); // Koz align body to current view;
|
||||
void OrientHMDBody(); // Koz reset hmd/body orientations
|
||||
|
||||
void SetAAS( bool forceAAS48 = false );
|
||||
void InitAASLocation( void );
|
||||
void SetAASLocation( void );
|
||||
void Move( void );
|
||||
void Move_Interpolated( float fraction );
|
||||
void UpdatePowerUps( void );
|
||||
void UpdateDeathSkin( bool state_hitch );
|
||||
void ClearPowerup( int i );
|
||||
|
@ -705,6 +1187,8 @@ private:
|
|||
|
||||
void ClearFocus( void );
|
||||
void UpdateFocus( void );
|
||||
void SendPDAEvent( const sysEvent_t* sev );
|
||||
bool UpdateFocusPDA( void );
|
||||
void UpdateLocation( void );
|
||||
idUserInterface * ActiveGui( void );
|
||||
void UpdatePDAInfo( bool updatePDASel );
|
||||
|
@ -712,6 +1196,8 @@ private:
|
|||
void ExtractEmailInfo( const idStr &email, const char *scan, idStr &out );
|
||||
void UpdateObjectiveInfo( void );
|
||||
|
||||
bool WeaponAvailable( const char* name );
|
||||
|
||||
void UseVehicle( void );
|
||||
|
||||
void Event_GetButtons( void );
|
||||
|
@ -731,7 +1217,19 @@ private:
|
|||
void Event_HideTip( void );
|
||||
void Event_LevelTrigger( void );
|
||||
void Event_Gibbed( void );
|
||||
void Event_ForceOrigin( idVec3& origin, idAngles& angles );
|
||||
void Event_GetIdealWeapon( void );
|
||||
void Event_WeaponAvailable( const char* name );
|
||||
void Event_SetPowerupTime( int powerup, int time );
|
||||
void Event_IsPowerupActive( int powerup );
|
||||
void Event_StartWarp();
|
||||
|
||||
// Koz
|
||||
void Event_GetWeaponHand();
|
||||
void Event_GetWeaponHandState();
|
||||
void Event_GetFlashHand(); // get flashlight hand
|
||||
void Event_GetFlashHandState(); // get flashlight hand state
|
||||
void Event_GetFlashState(); // get flashlight state
|
||||
};
|
||||
|
||||
ID_INLINE bool idPlayer::IsReady( void ) {
|
||||
|
|
|
@ -357,9 +357,12 @@ Called when a weapon fires, generates head twitches, etc
|
|||
==================
|
||||
*/
|
||||
void idPlayerView::WeaponFireFeedback( const idDict *weaponDef ) {
|
||||
if ( game->isVR && !vr_headKick.GetBool() ) return; // Koz skip head kick from weapon recoil in vr
|
||||
|
||||
int recoilTime;
|
||||
|
||||
recoilTime = weaponDef->GetInt( "recoilTime" );
|
||||
|
||||
// don't shorten a damage kick in progress
|
||||
if ( recoilTime && kickFinishTime < gameLocal.time ) {
|
||||
idAngles angles;
|
||||
|
@ -370,6 +373,7 @@ void idPlayerView::WeaponFireFeedback( const idDict *weaponDef ) {
|
|||
}
|
||||
|
||||
//Defined for the VR weapons - defaults in case they are missing
|
||||
/*
|
||||
float controllerShakeHighMag = weaponDef->GetFloat( "controllerShakeHighMag", "1.0" );
|
||||
int controllerShakeHighTime = weaponDef->GetInt( "controllerShakeHighTime", "0" );
|
||||
vrClientInfo *pVRClientInfo = player->GetVRClientInfo();
|
||||
|
@ -383,7 +387,7 @@ void idPlayerView::WeaponFireFeedback( const idDict *weaponDef ) {
|
|||
if (cvarSystem->GetCVarBool("vr_weapon_stabilised"))
|
||||
{
|
||||
common->Vibrate(controllerShakeHighTime, rightHanded ? 0 : 1, controllerShakeHighMag);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -402,15 +406,18 @@ void idPlayerView::CalculateShake() {
|
|||
// since CurrentShakeAmplitudeForPosition() returns all the shake sounds
|
||||
// the player can hear, it can go over 1.0 too.
|
||||
//
|
||||
// Koz
|
||||
if ( game->isVR ) shakeVolume *= vr_shakeAmplitude.GetFloat();
|
||||
|
||||
shakeAng[0] = gameLocal.random.CRandomFloat() * shakeVolume * vr_shakeamplitude.GetFloat();
|
||||
shakeAng[1] = gameLocal.random.CRandomFloat() * shakeVolume * vr_shakeamplitude.GetFloat();
|
||||
shakeAng[2] = gameLocal.random.CRandomFloat() * shakeVolume * vr_shakeamplitude.GetFloat();
|
||||
|
||||
if (shakeVolume > 0.1) {
|
||||
/*if (shakeVolume > 0.1) {
|
||||
//Shake controllers!
|
||||
common->Vibrate(50, 0, idMath::ClampFloat(0.1, 1.0, shakeVolume*2.0f + 0.1f));
|
||||
common->Vibrate(50, 1, idMath::ClampFloat(0.1, 1.0, shakeVolume*2.0f + 0.1f));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -463,15 +470,24 @@ void idPlayerView::SingleView( idUserInterface *hud, const renderView_t *view )
|
|||
return;
|
||||
}
|
||||
|
||||
renderSystem->DirectFrameBufferStart();
|
||||
renderSystem->DirectFrameBufferStart();
|
||||
|
||||
if ( player->objectiveSystemOpen ) {
|
||||
player->objectiveSystem->Redraw( gameLocal.time );
|
||||
} else {
|
||||
|
||||
if ( player->objectiveSystemOpen ) {
|
||||
cvarSystem->SetCVarBool("draw_pda", true);
|
||||
renderSystem->CropRenderSize( 1024, 1024, true );
|
||||
player->objectiveSystem->Redraw( gameLocal.time );
|
||||
renderSystem->CaptureRenderToImage( "_pdaImage" );
|
||||
renderSystem->UnCrop();
|
||||
//globalImages->pdaImage->Resize( rendertarget.w, rendertarget.h );
|
||||
cvarSystem->SetCVarBool("draw_pda", false);
|
||||
} else {
|
||||
renderSystem->SetHudOpacity(player->GetHudAlpha());
|
||||
player->DrawHUD(hud);
|
||||
renderSystem->SetHudOpacity(1.0f);
|
||||
renderSystem->CaptureRenderToImage( "_hudImage" );
|
||||
}
|
||||
|
||||
renderSystem->CaptureRenderToImage( "_hudImage" );
|
||||
|
||||
renderSystem->DirectFrameBufferEnd();
|
||||
|
||||
|
@ -565,6 +581,16 @@ void idPlayerView::SingleView( idUserInterface *hud, const renderView_t *view )
|
|||
renderSystem->DrawStretchPic( 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 0.0f, 1.0f, 1.0f, mtr );
|
||||
}
|
||||
}
|
||||
|
||||
// Koz begin
|
||||
if ( game->isVR )
|
||||
|
||||
{
|
||||
commonVr->lastViewOrigin = view->vieworg;
|
||||
commonVr->lastViewAxis = view->viewaxis;
|
||||
}
|
||||
// Koz end
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -618,9 +644,9 @@ void idPlayerView::BerserkVision( idUserInterface *hud, const renderView_t *view
|
|||
SingleView( hud, view );
|
||||
renderSystem->CaptureRenderToImage( "_scratch" );
|
||||
renderSystem->UnCrop();
|
||||
renderSystem->DirectFrameBufferEnd();
|
||||
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
renderSystem->DrawStretchPic( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 1, 1, 0, dvMaterial );
|
||||
renderSystem->DirectFrameBufferEnd();
|
||||
}
|
||||
|
||||
|
||||
|
@ -705,8 +731,11 @@ idPlayerView::InfluenceVision
|
|||
===================
|
||||
*/
|
||||
void idPlayerView::InfluenceVision( idUserInterface *hud, const renderView_t *view ) {
|
||||
//Influence vision doesn't work with multiview, simplest thing is to do is to skip it altogether
|
||||
SingleView( hud, view );
|
||||
return;
|
||||
|
||||
float distance = 0.0f;
|
||||
/* float distance = 0.0f;
|
||||
float pct = 1.0f;
|
||||
if ( player->GetInfluenceEntity() ) {
|
||||
distance = ( player->GetInfluenceEntity()->GetPhysics()->GetOrigin() - player->GetPhysics()->GetOrigin() ).Length();
|
||||
|
@ -728,7 +757,7 @@ void idPlayerView::InfluenceVision( idUserInterface *hud, const renderView_t *vi
|
|||
} else {
|
||||
int offset = 25 + sinf( gameLocal.time );
|
||||
DoubleVision( hud, view, pct * offset );
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -737,25 +766,25 @@ idPlayerView::RenderPlayerView
|
|||
===================
|
||||
*/
|
||||
void idPlayerView::RenderPlayerView( idUserInterface *hud ) {
|
||||
const renderView_t *view = player->GetRenderView();
|
||||
const renderView_t *view = player->GetRenderView();
|
||||
|
||||
if (g_skipViewEffects.GetBool()) {
|
||||
SingleView( hud, view );
|
||||
} else {
|
||||
if (player->GetInfluenceMaterial() || player->GetInfluenceEntity()) {
|
||||
InfluenceVision( hud, view );
|
||||
} else if (gameLocal.time < dvFinishTime) {
|
||||
DoubleVision( hud, view, dvFinishTime - gameLocal.time );
|
||||
} else if (player->PowerUpActive(BERSERK)) {
|
||||
BerserkVision( hud, view );
|
||||
} else {
|
||||
SingleView( hud, view );
|
||||
}
|
||||
ScreenFade();
|
||||
}
|
||||
if (g_skipViewEffects.GetBool()) {
|
||||
SingleView( hud, view );
|
||||
} else {
|
||||
if (player->GetInfluenceMaterial() || player->GetInfluenceEntity()) {
|
||||
InfluenceVision( hud, view );
|
||||
} else if (gameLocal.time < dvFinishTime) {
|
||||
DoubleVision( hud, view, dvFinishTime - gameLocal.time );
|
||||
} else if (player->PowerUpActive(BERSERK)) {
|
||||
BerserkVision( hud, view );
|
||||
} else {
|
||||
SingleView( hud, view );
|
||||
}
|
||||
ScreenFade();
|
||||
}
|
||||
|
||||
if ( net_clientLagOMeter.GetBool() && lagoMaterial && gameLocal.isClient ) {
|
||||
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
renderSystem->DrawStretchPic( 10.0f, 380.0f, 64.0f, 64.0f, 0.0f, 0.0f, 1.0f, 1.0f, lagoMaterial );
|
||||
}
|
||||
if ( net_clientLagOMeter.GetBool() && lagoMaterial && gameLocal.isClient ) {
|
||||
renderSystem->SetColor4( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||
renderSystem->DrawStretchPic( 10.0f, 380.0f, 64.0f, 64.0f, 0.0f, 0.0f, 1.0f, 1.0f, lagoMaterial );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,6 +91,12 @@ public:
|
|||
// temp for view testing
|
||||
void EnableBFGVision( bool b ) { bfgVision = b; };
|
||||
|
||||
// for VR comfort vision
|
||||
void EnableVrComfortVision(bool b)
|
||||
{
|
||||
vrComfortVision = b;
|
||||
};
|
||||
|
||||
private:
|
||||
void SingleView( idUserInterface *hud, const renderView_t *view );
|
||||
void DoubleVision( idUserInterface *hud, const renderView_t *view, int offset );
|
||||
|
@ -109,6 +115,7 @@ private:
|
|||
idAngles kickAngles;
|
||||
|
||||
bool bfgVision; //
|
||||
bool vrComfortVision; // "tunnel" to improve vrComfort
|
||||
|
||||
const idMaterial * tunnelMaterial; // health tunnel vision
|
||||
const idMaterial * armorMaterial; // armor damage view effect
|
||||
|
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
#ifndef PREDICTED_VALUE_H_
|
||||
#define PREDICTED_VALUE_H_
|
||||
|
||||
#include "Game_local.h"
|
||||
|
||||
/*
|
||||
================================================
|
||||
A simple class to handle simple predictable values
|
||||
on multiplayer clients.
|
||||
|
||||
The class encapsulates the actual value to be stored
|
||||
as well as the client frame number on which it is set.
|
||||
|
||||
When reading predicted values from a snapshot, the actual
|
||||
value is only updated if the server has processed the client's
|
||||
usercmd for the frame in which the client predicted the value.
|
||||
Got that?
|
||||
================================================
|
||||
*/
|
||||
template< class type_ >
|
||||
class idPredictedValue
|
||||
{
|
||||
public:
|
||||
explicit idPredictedValue();
|
||||
explicit idPredictedValue( const type_ & value_ );
|
||||
|
||||
void Set( const type_ & newValue );
|
||||
|
||||
idPredictedValue< type_ >& operator=( const type_ & value );
|
||||
|
||||
idPredictedValue< type_ >& operator+=( const type_ & toAdd );
|
||||
idPredictedValue< type_ >& operator-=( const type_ & toSubtract );
|
||||
|
||||
bool UpdateFromSnapshot( const type_ & valueFromSnapshot, int clientNumber );
|
||||
|
||||
type_ Get() const
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
private:
|
||||
// Noncopyable
|
||||
idPredictedValue( const idPredictedValue< type_ >& other );
|
||||
idPredictedValue< type_ >& operator=( const idPredictedValue< type_ >& other );
|
||||
|
||||
type_ value;
|
||||
int clientPredictedMilliseconds; // The time in which the client predicted the value.
|
||||
|
||||
void UpdatePredictionTime();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -279,7 +279,7 @@ void idProjectile::FreeLightDef( void ) {
|
|||
idProjectile::Launch
|
||||
=================
|
||||
*/
|
||||
void idProjectile::Launch( const idVec3 &start, const idVec3 &dir, const idVec3 &pushVelocity, const float timeSinceFire, const float launchPower, const float dmgPower ) {
|
||||
void idProjectile::Launch( const idVec3& start, const idVec3& dir, const idVec3& pushVelocity, const float timeSinceFire, const float launchPower, const float dmgPower, const float motionThrowSpeed ) {
|
||||
float fuse;
|
||||
float endthrust;
|
||||
idVec3 velocity;
|
||||
|
@ -311,6 +311,11 @@ void idProjectile::Launch( const idVec3 &start, const idVec3 &dir, const idVec3
|
|||
|
||||
speed = velocity.Length() * launchPower;
|
||||
|
||||
// Koz if throwing a grenade use the tracked hand velocity when using motion controls if the controller is not mounted
|
||||
if( motionThrowSpeed != 0 )
|
||||
speed = motionThrowSpeed;
|
||||
// Koz end
|
||||
|
||||
damagePower = dmgPower;
|
||||
|
||||
spawnArgs.GetAngles( "angular_velocity", "0 0 0", angular_velocity );
|
||||
|
@ -782,6 +787,43 @@ void idProjectile::Explode( const trace_t &collision, idEntity *ignore ) {
|
|||
return;
|
||||
}
|
||||
|
||||
// activate rumble for player
|
||||
idPlayer* player = gameLocal.GetLocalPlayer();
|
||||
const bool isHitscan = spawnArgs.GetBool( "net_instanthit" );
|
||||
if( player != NULL && isHitscan == false )
|
||||
{
|
||||
|
||||
// damage
|
||||
const char* damageDefName = spawnArgs.GetString( "def_damage" );
|
||||
const idDict* damageDef = gameLocal.FindEntityDefDict( damageDefName );
|
||||
int damage;
|
||||
if( damageDef != NULL )
|
||||
{
|
||||
damage = damageDef->GetInt( "damage" );
|
||||
}
|
||||
else
|
||||
{
|
||||
damage = 200;
|
||||
}
|
||||
float damageScale = idMath::ClampFloat( 0.25f, 1.0f, ( float )damage * ( 1.0f / 200.0f ) ); // 50...200 -> min...max rumble
|
||||
|
||||
// distance
|
||||
float dist = ( GetPhysics()->GetOrigin() - player->GetPhysics()->GetOrigin() ).LengthFast();
|
||||
float distScale = 1.0f - idMath::ClampFloat( 0.0f, 1.0f, ( dist * ( 1.0f / 4000.0f ) ) + 0.25f ); // 0...4000 -> max...min rumble
|
||||
|
||||
distScale *= damageScale; // apply damage scale here, weaker damage produces less rumble
|
||||
|
||||
// determine rumble
|
||||
float highMag = distScale;
|
||||
int highDuration = idMath::Ftoi( 300.0f * distScale );
|
||||
float lowMag = distScale * 0.75f;
|
||||
int lowDuration = idMath::Ftoi( 500.0f * distScale );
|
||||
|
||||
// Carl: TODO calculate direction
|
||||
player->hands[HAND_RIGHT].SetControllerShake( highMag, highDuration, lowMag, lowDuration );
|
||||
player->hands[HAND_LEFT].SetControllerShake( highMag, highDuration, lowMag, lowDuration );
|
||||
}
|
||||
|
||||
// stop sound
|
||||
StopSound( SND_CHANNEL_BODY2, false );
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ public :
|
|||
void Restore( idRestoreGame *savefile );
|
||||
|
||||
void Create( idEntity *owner, const idVec3 &start, const idVec3 &dir );
|
||||
virtual void Launch( const idVec3 &start, const idVec3 &dir, const idVec3 &pushVelocity, const float timeSinceFire = 0.0f, const float launchPower = 1.0f, const float dmgPower = 1.0f );
|
||||
virtual void Launch( const idVec3& start, const idVec3& dir, const idVec3& pushVelocity, const float timeSinceFire = 0.0f, const float launchPower = 1.0f, const float dmgPower = 1.0f, const float motionThrowSpeed = 0.0f );
|
||||
virtual void FreeLightDef( void );
|
||||
|
||||
idEntity * GetOwner( void ) const;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,605 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
//#include "precompiled.h"
|
||||
//#pragma hdrstop
|
||||
|
||||
//#include "..\LibOVR\Include\OVR_CAPI.h"
|
||||
//#include "..\LibOVR\Include\OVR_CAPI_GL.h"
|
||||
|
||||
|
||||
#include "vr_hmd.h"
|
||||
#include "../renderer/Image.h"
|
||||
#include "../idlib/math/Quat.h"
|
||||
#include "../idlib/math/Matrix.h"
|
||||
#include "../idlib/Str.h"
|
||||
#include "../idlib/math/Angles.h"
|
||||
#include "../framework/CVarSystem.h"
|
||||
#include "../../../Doom3Quest/VrClientInfo.h"
|
||||
//#include "Voice.h"
|
||||
//#include "FlickSync.h"
|
||||
//#include "../renderer/Framebuffer.h"
|
||||
//#include "..\LibOVR\Include\OVR_CAPI_Audio.h"
|
||||
|
||||
//#include "../libs/openvr/headers/openvr.h"
|
||||
|
||||
|
||||
#ifndef __VR_H__
|
||||
#define __VR_H__
|
||||
|
||||
// hand == 0 == right, 1 == left
|
||||
#define HAND_RIGHT 0
|
||||
#define HAND_LEFT 1
|
||||
|
||||
#define POSE_FINGER 8
|
||||
#define POSE_INDEX 1
|
||||
#define POSE_THUMB 2
|
||||
#define POSE_GRIP 4
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MOTION_NONE,
|
||||
MOTION_STEAMVR,
|
||||
MOTION_OCULUS
|
||||
} vr_motionControl_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
VR_AA_NONE,
|
||||
VR_AA_MSAA,
|
||||
VR_AA_FXAA,
|
||||
NUM_VR_AA
|
||||
} vr_aa_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
VR_HUD_NONE,
|
||||
VR_HUD_FULL,
|
||||
VR_HUD_LOOK_DOWN,
|
||||
} vr_hud_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RENDERING_NORMAL,
|
||||
RENDERING_PDA,
|
||||
RENDERING_HUD
|
||||
} vr_swf_render_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
FLASHLIGHT_BODY,
|
||||
FLASHLIGHT_HEAD,
|
||||
FLASHLIGHT_GUN,
|
||||
FLASHLIGHT_HAND,
|
||||
FLASHLIGHT_PISTOL, // like in RoE for XBox, except you can turn the light on and off
|
||||
FLASHLIGHT_INVENTORY, // flashlight is put away (or holstered)
|
||||
FLASHLIGHT_NONE, // not carrying a flashlight
|
||||
FLASHLIGHT_MAX,
|
||||
} vr_flashlight_mode_t;
|
||||
|
||||
/// Position and orientation together.
|
||||
typedef struct idPosef_ {
|
||||
idQuat Orientation;
|
||||
idVec3 Position;
|
||||
} idPosef;
|
||||
|
||||
typedef struct idPoseStatef_ {
|
||||
idPosef ThePose; ///< Position and orientation.
|
||||
idVec3 AngularVelocity; ///< Angular velocity in radians per second.
|
||||
idVec3 LinearVelocity; ///< Velocity in meters per second.
|
||||
idVec3 AngularAcceleration; ///< Angular acceleration in radians per second per second.
|
||||
idVec3 LinearAcceleration; ///< Acceleration in meters per second per second.
|
||||
double TimeInSeconds; ///< Absolute time that this pose refers to. \see ovr_GetTimeInSeconds
|
||||
} idPoseStatef;
|
||||
|
||||
void SwapWeaponHand();
|
||||
|
||||
class idClipModel;
|
||||
|
||||
class iVr
|
||||
{
|
||||
public:
|
||||
|
||||
iVr();
|
||||
bool initialResetPerformed;
|
||||
|
||||
int lastFrame;
|
||||
|
||||
int curtime;
|
||||
int sys_timeBase;
|
||||
int Sys_Milliseconds();
|
||||
|
||||
vrClientInfo * pVRClientInfo;
|
||||
bool OculusInit( void );
|
||||
bool OpenVRInit( void );
|
||||
void HMDInit( void );
|
||||
void HMDShutdown( void );
|
||||
void HMDInitializeDistortion( void );
|
||||
void HMDGetOrientation( idAngles &hmdAngles, idVec3 &headPositionDelta, idVec3 &bodyPositionDelta, idVec3 &absolutePosition, bool resetTrackingOffset );
|
||||
void HMDGetOrientationAbsolute( idAngles &hmdAngles, idVec3 &positoin );
|
||||
void HMDRender( idImage *leftCurrent, idImage *rightCurrent );
|
||||
bool HMDRenderQuad( idImage *leftCurrent, idImage *rightCurrent );
|
||||
void HMDTrackStatic( bool is3D );
|
||||
void HUDRender( idImage *image0, idImage *image1 );
|
||||
void HMDResetTrackingOriginOffset();
|
||||
|
||||
void FrameStart( void );
|
||||
|
||||
void OpenVrGetRight( idVec3 &position, idQuat &rotation );
|
||||
void OpenVrGetLeft( idVec3 &position, idQuat &rotation );
|
||||
|
||||
void MotionControlSetRotationOffset();
|
||||
void MotionControlSetOffset();
|
||||
void MotionControlGetHand( int hand, idVec3 &position, idQuat &rotation );
|
||||
void MotionControlGetLeftHand( idVec3 &position, idQuat &rotation );
|
||||
void MotionControlGetRightHand( idVec3 &position, idQuat &rotation );
|
||||
//void MotionControlGetOpenVrController( vr::TrackedDeviceIndex_t deviceNum, idVec3 &position, idQuat &rotation );
|
||||
void MotionControlGetTouchController( int hand, idVec3 &position, idQuat &rotation );
|
||||
void MotionControllerSetHapticOculus( float low, float hi );
|
||||
void MotionControllerSetHapticOpenVR( int hand, unsigned short value );
|
||||
|
||||
//void MSAAResolve( void );
|
||||
//void FXAAResolve( idImage * leftCurrent, idImage * rightCurrent );
|
||||
//void FXAASetUniforms( Framebuffer FBO );
|
||||
|
||||
void CalcAimMove( float &yawDelta, float &pitchDelta );
|
||||
|
||||
int GetCurrentFlashlightMode();
|
||||
void NextFlashlightMode();
|
||||
|
||||
bool ShouldQuit();
|
||||
void ForceChaperone(int which, bool force);
|
||||
|
||||
|
||||
//------------------
|
||||
int lastComfortTime;
|
||||
int currentFlashlightMode;
|
||||
|
||||
bool VR_GAME_PAUSED;
|
||||
|
||||
bool PDAforcetoggle;
|
||||
bool PDAforced;
|
||||
bool PDArising;
|
||||
bool gameSavingLoading;
|
||||
bool showingIntroVideo;
|
||||
|
||||
int swfRenderMode;
|
||||
bool PDAclipModelSet;
|
||||
int pdaToggleTime;
|
||||
int lastSaveTime;
|
||||
bool wasSaved;
|
||||
bool wasLoaded;
|
||||
|
||||
bool forceRun;
|
||||
|
||||
bool forceLeftStick;
|
||||
|
||||
int currentFlashlightPosition;
|
||||
|
||||
bool handInGui;
|
||||
|
||||
bool vrIsBackgroundSaving;
|
||||
|
||||
bool shouldRecenter;
|
||||
|
||||
int vrFrameNumber;
|
||||
int lastPostFrame;
|
||||
|
||||
int frameCount;
|
||||
|
||||
double sensorSampleTime;
|
||||
|
||||
int fingerPose[2];
|
||||
|
||||
idVec3 lastViewOrigin;
|
||||
idMat3 lastViewAxis;
|
||||
|
||||
idVec3 lastCenterEyeOrigin;
|
||||
idMat3 lastCenterEyeAxis;
|
||||
|
||||
float handRoll[2];
|
||||
|
||||
|
||||
float bodyYawOffset;
|
||||
float lastHMDYaw;
|
||||
float lastHMDPitch;
|
||||
float lastHMDRoll;
|
||||
idVec3 lastHMDViewOrigin;
|
||||
idMat3 lastHMDViewAxis;
|
||||
idVec3 uncrouchedHMDViewOrigin;
|
||||
float headHeightDiff;
|
||||
|
||||
bool isWalking;
|
||||
bool thirdPersonMovement;
|
||||
float thirdPersonDelta;
|
||||
idVec3 thirdPersonHudPos;
|
||||
idMat3 thirdPersonHudAxis;
|
||||
|
||||
|
||||
float angles[3];
|
||||
|
||||
//uint32_t hmdWidth;
|
||||
//uint32_t hmdHeight;
|
||||
//GBCHANGE
|
||||
int hmdWidth;
|
||||
int hmdHeight;
|
||||
int hmdHz;
|
||||
|
||||
bool useFBO;
|
||||
int primaryFBOWidth;
|
||||
int primaryFBOHeight;
|
||||
|
||||
int VR_AAmode;
|
||||
|
||||
int VR_USE_MOTION_CONTROLS;
|
||||
int weaponHand;
|
||||
|
||||
bool hasHMD;
|
||||
bool hasOculusRift;
|
||||
|
||||
bool m_bDebugOpenGL;
|
||||
bool m_bVerbose;
|
||||
bool m_bPerf;
|
||||
bool m_bVblank;
|
||||
bool m_bGlFinishHack;
|
||||
|
||||
idStr m_strDriver;
|
||||
idStr m_strDisplay;
|
||||
|
||||
//char m_rDevClassChar[vr::k_unMaxTrackedDeviceCount];
|
||||
//idMat4 m_rmat4DevicePose[vr::k_unMaxTrackedDeviceCount];
|
||||
//bool m_rbShowTrackedDevice[vr::k_unMaxTrackedDeviceCount];
|
||||
|
||||
|
||||
idMat4 m_mat4ProjectionLeft;
|
||||
idMat4 m_mat4ProjectionRight;
|
||||
idMat4 m_mat4eyePosLeft;
|
||||
idMat4 m_mat4eyePosRight;
|
||||
|
||||
float singleEyeIPD;
|
||||
float hmdForwardOffset;
|
||||
|
||||
float hmdFovX;
|
||||
float hmdFovY;
|
||||
float hmdPixelScale;
|
||||
float hmdAspect;
|
||||
hmdEye_t hmdEye[2];
|
||||
|
||||
float VRScreenSeparation; // for Reduce FOV motion sickness fix
|
||||
|
||||
float officialIPD;
|
||||
float officialHeight;
|
||||
|
||||
float manualIPD;
|
||||
float manualHeight;
|
||||
|
||||
idImage* hmdEyeImage[2];
|
||||
idImage* hmdCurrentRender[2];
|
||||
|
||||
|
||||
idPosef EyeRenderPose[2];
|
||||
|
||||
idPosef handPose[2];
|
||||
|
||||
int mirrorW;
|
||||
int mirrorH;
|
||||
|
||||
|
||||
idImage* primaryFBOimage;
|
||||
idImage* resolveFBOimage;
|
||||
idImage* fullscreenFBOimage;
|
||||
|
||||
double hmdFrameTime;
|
||||
bool hmdPositionTracked;
|
||||
int currentEye;
|
||||
|
||||
idVec3 trackingOriginOffset;
|
||||
float trackingOriginYawOffset;
|
||||
float trackingOriginHeight;
|
||||
bool chestDefaultDefined;
|
||||
idVec3 hmdBodyTranslation;
|
||||
|
||||
idVec3 motionMoveDelta;
|
||||
idVec3 motionMoveVelocity;
|
||||
bool isLeaning;
|
||||
idVec3 leanOffset;
|
||||
idVec3 leanBlankOffset;
|
||||
float leanBlankOffsetLengthSqr;
|
||||
bool leanBlank;
|
||||
|
||||
idVec3 fixedPDAMoveDelta;
|
||||
|
||||
int teleportButtonCount;
|
||||
idVec2 leftMapped;
|
||||
int oldTeleportButtonState;
|
||||
|
||||
float independentWeaponYaw;
|
||||
float independentWeaponPitch;
|
||||
|
||||
bool playerDead;
|
||||
|
||||
bool isLoading;
|
||||
|
||||
int lastRead;
|
||||
int currentRead;
|
||||
bool updateScreen;
|
||||
|
||||
bool scanningPDA;
|
||||
|
||||
float bodyMoveAng;
|
||||
|
||||
bool privateCamera;
|
||||
|
||||
vr_motionControl_t motionControlType;
|
||||
|
||||
// wip stuff
|
||||
int wipNumSteps;
|
||||
int wipStepState;
|
||||
int wipLastPeriod;
|
||||
float wipCurrentDelta;
|
||||
float wipCurrentVelocity;
|
||||
float wipPeriodVel;
|
||||
float wipTotalDelta;
|
||||
float wipLastAcces;
|
||||
float wipAvgPeriod;
|
||||
float wipTotalDeltaAvg;
|
||||
|
||||
bool renderingSplash;
|
||||
|
||||
idAngles poseHmdAngles;
|
||||
idVec3 poseHmdHeadPositionDelta;
|
||||
idVec3 poseHmdBodyPositionDelta;
|
||||
idVec3 remainingMoveHmdBodyPositionDelta;
|
||||
idVec3 poseHmdAbsolutePosition;
|
||||
float userDuckingAmount; // how many game units the user has physically ducked in real life from their calibrated position
|
||||
|
||||
idVec3 poseHandPos[2];
|
||||
idQuat poseHandRotationQuat[2];
|
||||
idMat3 poseHandRotationMat3[2];
|
||||
idAngles poseHandRotationAngles[2];
|
||||
|
||||
idAngles poseLastHmdAngles;
|
||||
idVec3 poseLastHmdHeadPositionDelta;
|
||||
idVec3 poseLastHmdBodyPositionDelta;
|
||||
idVec3 poseLastHmdAbsolutePosition;
|
||||
float lastBodyYawOffset;
|
||||
|
||||
idStr currentBindingDisplay;
|
||||
|
||||
float cinematicStartViewYaw;
|
||||
idVec3 cinematicStartPosition;
|
||||
|
||||
bool didTeleport;
|
||||
float teleportDir;
|
||||
|
||||
idVec3 currentHandWorldPosition[2];
|
||||
|
||||
|
||||
|
||||
// clip stuff
|
||||
idClipModel* bodyClip;
|
||||
idClipModel* headClip;
|
||||
|
||||
//---------------------------
|
||||
private:
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
extern idCVar vr_scale;
|
||||
extern idCVar vr_normalViewHeight;
|
||||
extern idCVar vr_useFloorHeight;
|
||||
|
||||
extern idCVar vr_wristStatMon;
|
||||
extern idCVar vr_disableWeaponAnimation;
|
||||
extern idCVar vr_headKick;
|
||||
|
||||
extern idCVar vr_weaponHand;
|
||||
|
||||
extern idCVar vr_flashlightMode;
|
||||
extern idCVar vr_flashlightStrict; // Carl
|
||||
|
||||
extern idCVar vr_flashlightBodyPosX;
|
||||
extern idCVar vr_flashlightBodyPosY;
|
||||
extern idCVar vr_flashlightBodyPosZ;
|
||||
|
||||
extern idCVar vr_flashlightHelmetPosX;
|
||||
extern idCVar vr_flashlightHelmetPosY;
|
||||
extern idCVar vr_flashlightHelmetPosZ;
|
||||
|
||||
extern idCVar vr_forward_keyhole;
|
||||
|
||||
extern idCVar vr_PDAfixLocation;
|
||||
|
||||
extern idCVar vr_weaponPivotOffsetForward;
|
||||
extern idCVar vr_weaponPivotOffsetHorizontal;
|
||||
extern idCVar vr_weaponPivotOffsetVertical;
|
||||
extern idCVar vr_weaponPivotForearmLength;
|
||||
|
||||
|
||||
extern idCVar vr_guiScale;
|
||||
extern idCVar vr_guiSeparation;
|
||||
|
||||
extern idCVar vr_guiMode;
|
||||
|
||||
extern idCVar vr_hudScale;
|
||||
extern idCVar vr_hudPosHor;
|
||||
extern idCVar vr_hudPosVer;
|
||||
extern idCVar vr_hudPosDis;
|
||||
extern idCVar vr_hudPosLock;
|
||||
extern idCVar vr_hudType;
|
||||
extern idCVar vr_hudPosAngle;
|
||||
extern idCVar vr_hudRevealAngle;
|
||||
extern idCVar vr_hudTransparency;
|
||||
extern idCVar vr_hudOcclusion;
|
||||
|
||||
extern idCVar vr_hudLowHealth;
|
||||
|
||||
extern idCVar vr_listMonitorName;
|
||||
|
||||
extern idCVar vr_joystickMenuMapping;
|
||||
|
||||
extern idCVar vr_trackingPredictionUserDefined;
|
||||
|
||||
extern idCVar vr_deadzonePitch;
|
||||
extern idCVar vr_deadzoneYaw;
|
||||
extern idCVar vr_comfortDelta;
|
||||
|
||||
extern idCVar vr_headingBeamMode;
|
||||
|
||||
extern idCVar vr_weaponSight;
|
||||
extern idCVar vr_weaponSightToSurface;
|
||||
|
||||
extern idCVar vr_motionFlashPitchAdj; // flashlight pitch adjust
|
||||
extern idCVar vr_motionWeaponPitchAdj;
|
||||
|
||||
extern idCVar vr_3dgui;
|
||||
extern idCVar vr_shakeAmplitude;
|
||||
|
||||
extern idCVar vr_padDeadzone;
|
||||
extern idCVar vr_jsDeadzone;
|
||||
extern idCVar vr_padToButtonThreshold;
|
||||
extern idCVar vr_knockBack;
|
||||
extern idCVar vr_jumpBounce;
|
||||
extern idCVar vr_stepSmooth;
|
||||
|
||||
extern idCVar vr_mountedWeaponController;
|
||||
extern idCVar vr_walkSpeedAdjust;
|
||||
|
||||
|
||||
extern idCVar vr_movePoint;
|
||||
|
||||
extern idCVar vr_crouchTriggerDist;
|
||||
extern idCVar vr_crouchMode;
|
||||
extern idCVar vr_crouchHideBody;
|
||||
|
||||
extern idCVar vr_wipPeriodMin;
|
||||
extern idCVar vr_wipPeriodMax;
|
||||
|
||||
extern idCVar vr_wipVelocityMin;
|
||||
extern idCVar vr_wipVelocityMax;
|
||||
|
||||
extern idCVar vr_headbbox;
|
||||
|
||||
extern idCVar vr_pdaPosX;
|
||||
extern idCVar vr_pdaPosY;
|
||||
extern idCVar vr_pdaPosZ;
|
||||
|
||||
extern idCVar vr_pdaPitch;
|
||||
|
||||
extern idCVar vr_movePoint;
|
||||
extern idCVar vr_moveClick;
|
||||
extern idCVar vr_playerBodyMode;
|
||||
extern idCVar vr_bodyToMove;
|
||||
extern idCVar vr_moveThirdPerson;
|
||||
|
||||
extern idCVar vr_teleportSkipHandrails;
|
||||
extern idCVar vr_teleportShowAimAssist;
|
||||
extern idCVar vr_teleportButtonMode;
|
||||
extern idCVar vr_teleportHint;
|
||||
|
||||
extern idCVar vr_teleport;
|
||||
extern idCVar vr_teleportMode;
|
||||
extern idCVar vr_teleportMaxTravel;
|
||||
extern idCVar vr_teleportThroughDoors;
|
||||
extern idCVar vr_motionSickness;
|
||||
extern idCVar vr_strobeTime;
|
||||
extern idCVar vr_chaperone;
|
||||
extern idCVar vr_chaperoneColor;
|
||||
|
||||
extern idCVar vr_slotDebug;
|
||||
extern idCVar vr_slotMag;
|
||||
extern idCVar vr_slotDur;
|
||||
extern idCVar vr_slotDisable;
|
||||
|
||||
extern idCVar vr_handSwapsAnalogs;
|
||||
extern idCVar vr_autoSwitchControllers;
|
||||
|
||||
extern idCVar vr_useHandPoses;
|
||||
extern idCVar vr_cinematics;
|
||||
|
||||
extern idCVar vr_instantAccel;
|
||||
extern idCVar vr_shotgunChoke;
|
||||
|
||||
extern idCVar vr_headshotMultiplier;
|
||||
|
||||
extern idCVar vr_weaponCycleMode;
|
||||
extern idCVar vr_gripMode;
|
||||
extern idCVar vr_doubleClickGrip;
|
||||
extern idCVar vr_pickUpMode;
|
||||
extern idCVar vr_reloadMode;
|
||||
extern idCVar vr_mustEmptyHands;
|
||||
extern idCVar vr_contextSensitive;
|
||||
extern idCVar vr_dualWield;
|
||||
extern idCVar vr_voiceMicLocation;
|
||||
extern idCVar vr_debugHands;
|
||||
extern idCVar vr_rumbleChainsaw;
|
||||
|
||||
extern idCVar vr_comfortRepeat;
|
||||
|
||||
extern iVr* commonVr;
|
||||
//extern iVoice* commonVoice;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
VR_GRIP_CONTEXT_TOGGLE = 0,
|
||||
VR_GRIP_CONTEXT_TOGGLE_NO_SURFACE = 1,
|
||||
VR_GRIP_TOGGLE_WEAPONS_HOLD_PHYSICS = 2,
|
||||
VR_GRIP_TOGGLE_WEAPONS_HOLD_ITEMS = 3,
|
||||
VR_GRIP_TOGGLE_WITH_DROP = 4,
|
||||
VR_GRIP_DEAD_AND_BURIED = 5,
|
||||
VR_GRIP_HOLD = 6,
|
||||
VR_GRIP_HOLD_AND_SQUEEZE = 7,
|
||||
} vr_gripMode_t;
|
||||
|
||||
//Carl: Can you use two weapons at once?
|
||||
typedef enum
|
||||
{
|
||||
VR_DUALWIELD_NOT_EVEN_FISTS = 0,
|
||||
VR_DUALWIELD_NOTHING = 1,
|
||||
VR_DUALWIELD_ONLY_FLASHLIGHT = 2,
|
||||
VR_DUALWIELD_ONLY_GRENADES = 3,
|
||||
VR_DUALWIELD_ONLY_GRENADES_FLASHLIGHT = 4,
|
||||
VR_DUALWIELD_ONLY_PISTOLS = 5,
|
||||
VR_DUALWIELD_ONLY_PISTOLS_FLASHLIGHT = 6,
|
||||
VR_DUALWIELD_ONLY_PISTOLS_GRENADES_FLASHLIGHT = 7,
|
||||
VR_DUALWIELD_YES = 8
|
||||
} vr_dualwield_t;
|
||||
|
||||
//Carl: Can you use two weapons at once?
|
||||
typedef enum
|
||||
{
|
||||
VR_WEAPONCYCLE_SKIP_HOLSTERED = 0,
|
||||
VR_WEAPONCYCLE_INCLUDE_HOLSTERED = 1,
|
||||
VR_WEAPONCYCLE_INCLUDE_FLASHLIGHT = 2,
|
||||
VR_WEAPONCYCLE_HOLSTERED_AND_FLASHLIGHT = 3,
|
||||
VR_WEAPONCYCLE_HOLSTERED_AND_FLASHLIGHT_AND_PDA = 4
|
||||
} vr_weaponcycle_t;
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -33,6 +33,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "Entity.h"
|
||||
#include "Light.h"
|
||||
#include "Actor.h"
|
||||
#include "Misc.h"
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
@ -51,6 +52,42 @@ typedef enum {
|
|||
WP_LOWERING
|
||||
} weaponStatus_t;
|
||||
|
||||
typedef enum { // Koz weapon enumerations
|
||||
WEAPON_NONE = 0,
|
||||
WEAPON_FISTS,
|
||||
WEAPON_CHAINSAW,
|
||||
WEAPON_PISTOL,
|
||||
WEAPON_SHOTGUN,
|
||||
WEAPON_MACHINEGUN,
|
||||
WEAPON_CHAINGUN,
|
||||
WEAPON_HANDGRENADE,
|
||||
WEAPON_PLASMAGUN,
|
||||
WEAPON_ROCKETLAUNCHER,
|
||||
WEAPON_BFG,
|
||||
WEAPON_SOULCUBE,
|
||||
WEAPON_ARTIFACT,
|
||||
WEAPON_PDA,
|
||||
WEAPON_FLASHLIGHT,
|
||||
WEAPON_NUM_WEAPONS
|
||||
} weapon_t;
|
||||
|
||||
// Koz flashlightOffsets - values are used to move flashlight model to 'mount' to the active weapon. Hacky McCrappyHack was here.
|
||||
const idVec3 flashlightOffsets[int(WEAPON_NUM_WEAPONS)] = { idVec3( 0.0f, 0.0f, 0.0f ), // WEAPON_NONE
|
||||
idVec3( 0.0f, 0.0f, 0.0f ), // WEAPON_FISTS
|
||||
idVec3( 0.0f, 0.0f, 0.0f ), // WEAPON_CHAINSAW
|
||||
idVec3( -1.25f, -6.5f, 0.9f ), // WEAPON_PISTOL
|
||||
idVec3( -1.75f, -3.5f, 1.15f ), // WEAPON_SHOTGUN
|
||||
idVec3( -2.2f, -7.5f, 1.2f ), // WEAPON_MACHINEGUN
|
||||
idVec3( -2.3f, -11.25f, -4.5f ), // WEAPON_CHAINGUN
|
||||
idVec3( 0.0f, 0.0f, 0.0f ), // WEAPON_HANDGRENADE
|
||||
idVec3( -3.0f, -6.5f, 1.65f ), // WEAPON_PLASMAGUN
|
||||
idVec3( 4.4f, -14.5f, -3.5f ), // WEAPON_ROCKETLAUNCHER
|
||||
idVec3( -0.5f, -6.0f, 6.9f ), // WEAPON_BFG
|
||||
idVec3( 0.0f, 0.0f, 0.0f ), // WEAPON_SOULCUBE
|
||||
idVec3( 0.0f, 0.0f, 0.0f ), // WEAPON_ARTIFACT
|
||||
idVec3( 0.0f, 0.0f, 0.0f ) // WEAPON_PDA
|
||||
};
|
||||
|
||||
typedef int ammo_t;
|
||||
static const int AMMO_NUMTYPES = 16;
|
||||
|
||||
|
@ -61,6 +98,28 @@ static const int LIGHTID_VIEW_MUZZLE_FLASH = 100;
|
|||
|
||||
class idMoveableItem;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[64];
|
||||
char particlename[128];
|
||||
bool active;
|
||||
int startTime;
|
||||
jointHandle_t joint; //The joint on which to attach the particle
|
||||
bool smoke; //Is this a smoke particle
|
||||
const idDeclParticle* particle; //Used for smoke particles
|
||||
idFuncEmitter* emitter; //Used for non-smoke particles
|
||||
} WeaponParticle_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[64];
|
||||
bool active;
|
||||
int startTime;
|
||||
jointHandle_t joint;
|
||||
int lightHandle;
|
||||
renderLight_t light;
|
||||
} WeaponLight_t;
|
||||
|
||||
class idWeapon : public idAnimatedEntity {
|
||||
public:
|
||||
CLASS_PROTOTYPE( idWeapon );
|
||||
|
@ -68,11 +127,15 @@ public:
|
|||
idWeapon();
|
||||
virtual ~idWeapon();
|
||||
|
||||
weaponStatus_t status;
|
||||
|
||||
// Init
|
||||
void Spawn( void );
|
||||
void SetOwner( idPlayer *owner );
|
||||
void SetOwner( idPlayer* owner, int ownerHand );
|
||||
idPlayer* GetOwner( void );
|
||||
virtual bool ShouldConstructScriptObjectAtSpawn( void ) const;
|
||||
void SetFlashlightOwner( idPlayer* owner );
|
||||
int GetHand();
|
||||
|
||||
static void CacheWeapon( const char *weaponName );
|
||||
|
||||
|
@ -85,12 +148,14 @@ public:
|
|||
void GetWeaponDef( const char *objectname, int ammoinclip );
|
||||
bool IsLinked( void );
|
||||
bool IsWorldModelReady( void );
|
||||
weapon_t IdentifyWeapon(); // Koz
|
||||
|
||||
// GUIs
|
||||
const char * Icon( void ) const;
|
||||
void UpdateGUI( void );
|
||||
void UpdateVRGUI();
|
||||
|
||||
virtual void SetModel( const char *modelname );
|
||||
virtual void SetModel( const char *modelname );
|
||||
bool GetGlobalJointTransform( bool viewModel, const jointHandle_t jointHandle, idVec3 &offset, idMat3 &axis );
|
||||
void SetPushVelocity( const idVec3 &pushVelocity );
|
||||
bool UpdateSkin( void );
|
||||
|
@ -116,7 +181,11 @@ public:
|
|||
idEntity * DropItem( const idVec3 &velocity, int activateDelay, int removeDelay, bool died );
|
||||
bool CanDrop( void ) const;
|
||||
void WeaponStolen( void );
|
||||
|
||||
void ForceAmmoInClip();
|
||||
weaponStatus_t GetStatus()
|
||||
{
|
||||
return status;
|
||||
};
|
||||
// Script state management
|
||||
virtual idThread * ConstructScriptObject( void );
|
||||
virtual void DeconstructScriptObject( void );
|
||||
|
@ -127,11 +196,17 @@ public:
|
|||
void NetCatchup( void );
|
||||
|
||||
// Visual presentation
|
||||
void PresentWeapon( bool showViewModel );
|
||||
void PresentWeapon( bool showViewModel, int hand );
|
||||
int GetZoomFov( void );
|
||||
void GetWeaponAngleOffsets( int *average, float *scale, float *max );
|
||||
void GetWeaponTimeOffsets( float *time, float *scale );
|
||||
bool BloodSplat( float size );
|
||||
void SetIsPlayerFlashlight( bool bl )
|
||||
{
|
||||
isPlayerFlashlight = bl;
|
||||
}
|
||||
void FlashlightOn();
|
||||
void FlashlightOff();
|
||||
|
||||
// Ammo
|
||||
static ammo_t GetAmmoNumForName( const char *ammoname );
|
||||
|
@ -144,6 +219,12 @@ public:
|
|||
int ClipSize( void ) const;
|
||||
int LowAmmo( void ) const;
|
||||
int AmmoRequired( void ) const;
|
||||
int AmmoCount() const;
|
||||
// Flashlight
|
||||
idAnimatedEntity* GetWorldModel()
|
||||
{
|
||||
return worldModel.GetEntity();
|
||||
}
|
||||
|
||||
virtual void WriteToSnapshot( idBitMsgDelta &msg ) const;
|
||||
virtual void ReadFromSnapshot( const idBitMsgDelta &msg );
|
||||
|
@ -157,6 +238,25 @@ public:
|
|||
virtual bool ClientReceiveEvent( int event, int time, const idBitMsg &msg );
|
||||
|
||||
virtual void ClientPredictionThink( void );
|
||||
void MuzzleFlashLight();
|
||||
void RemoveMuzzleFlashlight();
|
||||
|
||||
// Get a global origin and axis suitable for the laser sight or bullet tracing
|
||||
// Returns false for hands, grenades, and chainsaw.
|
||||
// Can't be const because a frame may need to be created.
|
||||
bool GetMuzzlePositionWithHacks( idVec3& origin, idMat3& axis );
|
||||
|
||||
void GetProjectileLaunchOriginAndAxis( idVec3& origin, idMat3& axis );
|
||||
|
||||
const idDeclEntityDef* GetDeclEntityDef()
|
||||
{
|
||||
return weaponDef;
|
||||
}
|
||||
|
||||
friend class idPlayer;
|
||||
friend class idWeaponHolder;
|
||||
friend class idHolster;
|
||||
friend class idPlayerHand;
|
||||
|
||||
private:
|
||||
// script control
|
||||
|
@ -167,19 +267,26 @@ private:
|
|||
idScriptBool WEAPON_NETFIRING;
|
||||
idScriptBool WEAPON_RAISEWEAPON;
|
||||
idScriptBool WEAPON_LOWERWEAPON;
|
||||
weaponStatus_t status;
|
||||
|
||||
idThread * thread;
|
||||
idStr state;
|
||||
idStr idealState;
|
||||
int animBlendFrames;
|
||||
int animDoneTime;
|
||||
bool isLinked;
|
||||
bool isPlayerFlashlight;
|
||||
bool isPlayerLeftHand;
|
||||
|
||||
// precreated projectile
|
||||
int lastIdentifiedFrame = 0;
|
||||
weapon_t currentIdentifiedWeapon = WEAPON_NONE;
|
||||
weapon_t lastIdentifiedWeapon = WEAPON_NONE; // lastweapon holds the last actual weapon value, so the weapon enum will never return a value of 'weapon_flaslight'. nothing to do with the players previous weapon
|
||||
|
||||
// precreated projectile
|
||||
idEntity *projectileEnt;
|
||||
|
||||
idPlayer * owner;
|
||||
idEntityPtr<idAnimatedEntity> worldModel;
|
||||
int hand;
|
||||
|
||||
// hiding (for GUIs and NPCs)
|
||||
int hideTime;
|
||||
|
@ -225,6 +332,12 @@ private:
|
|||
renderLight_t guiLight;
|
||||
int guiLightHandle;
|
||||
|
||||
// Koz begin
|
||||
// VR Stat Gui - this is the 'watch' the player wears in VR to display stats.
|
||||
class idUserInterface* rvrStatGui;
|
||||
class idUserInterface* lvrStatGui;
|
||||
// Koz end
|
||||
|
||||
// muzzle flash
|
||||
renderLight_t muzzleFlash; // positioned on view weapon bone
|
||||
int muzzleFlashHandle;
|
||||
|
@ -232,6 +345,9 @@ private:
|
|||
renderLight_t worldMuzzleFlash; // positioned on world weapon bone
|
||||
int worldMuzzleFlashHandle;
|
||||
|
||||
float fraccos;
|
||||
float fraccos2;
|
||||
|
||||
idVec3 flashColor;
|
||||
int muzzleFlashEnd;
|
||||
int flashTime;
|
||||
|
@ -274,6 +390,19 @@ private:
|
|||
jointHandle_t barrelJointWorld;
|
||||
jointHandle_t ejectJointWorld;
|
||||
|
||||
jointHandle_t smokeJointView;
|
||||
|
||||
// Koz
|
||||
jointHandle_t weaponHandAttacher[2];
|
||||
idVec3 weaponHandDefaultPos[2];
|
||||
idMat3 weaponHandDefaultAxis[2];
|
||||
|
||||
idVec3 laserSightOffset;
|
||||
// Koz end
|
||||
|
||||
idHashTable<WeaponParticle_t> weaponParticles;
|
||||
idHashTable<WeaponLight_t> weaponLights;
|
||||
|
||||
// sound
|
||||
const idSoundShader * sndHum;
|
||||
|
||||
|
@ -311,11 +440,12 @@ private:
|
|||
|
||||
// Visual presentation
|
||||
void InitWorldModel( const idDeclEntityDef *def );
|
||||
void MuzzleFlashLight( void );
|
||||
void MuzzleRise( idVec3 &origin, idMat3 &axis );
|
||||
void UpdateNozzleFx( void );
|
||||
void UpdateFlashPosition( void );
|
||||
|
||||
void UpdateWeaponClipPosition( idVec3 &origin, idMat3 &axis ); // Koz
|
||||
|
||||
// script events
|
||||
void Event_Clear( void );
|
||||
void Event_GetOwner( void );
|
||||
|
@ -354,6 +484,11 @@ private:
|
|||
void Event_NetReload( void );
|
||||
void Event_IsInvisible( void );
|
||||
void Event_NetEndReload( void );
|
||||
// Koz
|
||||
void Event_GetWeaponSkin();
|
||||
void Event_IsMotionControlled();
|
||||
void CalculateHideRise( idVec3& origin, idMat3& axis );
|
||||
// Koz end
|
||||
};
|
||||
|
||||
ID_INLINE bool idWeapon::IsLinked( void ) {
|
||||
|
|
|
@ -133,11 +133,13 @@ public:
|
|||
// Returns true if one can fly along a straight line from the origin to the goal origin.
|
||||
virtual bool FlyPathValid( int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags, idVec3 &endPos, int &endAreaNum ) const = 0;
|
||||
// Show the walk path from the origin towards the area.
|
||||
virtual void ShowWalkPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin ) const = 0;
|
||||
virtual void ShowWalkPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags = TFL_WALK | TFL_AIR ) const = 0;
|
||||
// Show the fly path from the origin towards the area.
|
||||
virtual void ShowFlyPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin ) const = 0;
|
||||
// Find the nearest goal which satisfies the callback.
|
||||
virtual bool FindNearestGoal( aasGoal_t &goal, int areaNum, const idVec3 origin, const idVec3 &target, int travelFlags, aasObstacle_t *obstacles, int numObstacles, idAASCallback &callback ) const = 0;
|
||||
// Carl: Show the area
|
||||
virtual void DrawArea( int areaNum ) const = 0;
|
||||
};
|
||||
|
||||
#endif /* !__AAS_H__ */
|
||||
|
|
|
@ -232,7 +232,7 @@ void idAASLocal::ShowArea( const idVec3 &origin ) const {
|
|||
idAASLocal::ShowWalkPath
|
||||
============
|
||||
*/
|
||||
void idAASLocal::ShowWalkPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin ) const {
|
||||
void idAASLocal::ShowWalkPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags ) const {
|
||||
int i, areaNum, curAreaNum, travelTime;
|
||||
idReachability *reach;
|
||||
idVec3 org, areaCenter;
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
virtual bool WalkPathValid( int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags, idVec3 &endPos, int &endAreaNum ) const;
|
||||
virtual bool FlyPathToGoal( aasPath_t &path, int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags ) const;
|
||||
virtual bool FlyPathValid( int areaNum, const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags, idVec3 &endPos, int &endAreaNum ) const;
|
||||
virtual void ShowWalkPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin ) const;
|
||||
virtual void ShowWalkPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin, int travelFlags = TFL_WALK | TFL_AIR ) const;
|
||||
virtual void ShowFlyPath( const idVec3 &origin, int goalAreaNum, const idVec3 &goalOrigin ) const;
|
||||
virtual bool FindNearestGoal( aasGoal_t &goal, int areaNum, const idVec3 origin, const idVec3 &target, int travelFlags, aasObstacle_t *obstacles, int numObstacles, idAASCallback &callback ) const;
|
||||
|
||||
|
|
|
@ -1079,6 +1079,8 @@ void idAI::Think( void ) {
|
|||
} else {
|
||||
// clear the ik before we do anything else so the skeleton doesn't get updated twice
|
||||
walkIK.ClearJointMods();
|
||||
// Koz
|
||||
armIK.ClearJointMods();
|
||||
|
||||
switch( move.moveType ) {
|
||||
case MOVETYPE_DEAD :
|
||||
|
@ -3453,6 +3455,18 @@ void idAI::PlayCinematic( void ) {
|
|||
|
||||
torsoAnim.animBlendFrames = 0;
|
||||
torsoAnim.lastAnimBlendFrames = 0;
|
||||
|
||||
// Koz begin
|
||||
leftHandAnim.animBlendFrames = 0;
|
||||
leftHandAnim.lastAnimBlendFrames = 0;
|
||||
|
||||
rightHandAnim.animBlendFrames = 0;
|
||||
rightHandAnim.lastAnimBlendFrames = 0;
|
||||
|
||||
ProcessEvent( &AI_PlayAnim, ANIMCHANNEL_LEFTHAND, animname );
|
||||
ProcessEvent( &AI_PlayAnim, ANIMCHANNEL_RIGHTHAND, animname );
|
||||
// Koz end
|
||||
|
||||
ProcessEvent( &AI_PlayAnim, ANIMCHANNEL_TORSO, animname );
|
||||
|
||||
// make sure our model gets updated
|
||||
|
@ -3549,6 +3563,16 @@ void idAI::EnemyDead( void ) {
|
|||
AI_ENEMY_DEAD = true;
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
idAI::ListenTo
|
||||
=====================
|
||||
*/
|
||||
void idAI::ListenTo( idEntity* ent )
|
||||
{
|
||||
Event_LookAtEntity(ent, 1.0f);
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
idAI::TalkTo
|
||||
|
|
|
@ -257,6 +257,7 @@ public:
|
|||
void HeardSound( idEntity *ent, const char *action );
|
||||
idActor *GetEnemy( void ) const;
|
||||
void TalkTo( idActor *actor );
|
||||
void ListenTo( idEntity* ent );
|
||||
talkState_t GetTalkState( void ) const;
|
||||
|
||||
bool GetAimDir( const idVec3 &firePos, idEntity *aimAtEnt, const idEntity *ignore, idVec3 &aimDir ) const;
|
||||
|
|
|
@ -108,6 +108,14 @@ idMD5Anim::Length
|
|||
====================
|
||||
*/
|
||||
int idMD5Anim::Length( void ) const {
|
||||
if ( strstr( name, "idle" ) && strstr( name, "md5/weapons" ) )
|
||||
{
|
||||
// let the idle animations play for the soulcube, artifact, & bloodstone
|
||||
if ( !strstr( name, "soulcube" ) && !strstr( name, "artifact" ) && !strstr( name, "blood_orb" ) )
|
||||
{
|
||||
return 1; // set anmination length to 1
|
||||
}
|
||||
}
|
||||
return animLength;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,12 +33,12 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "idlib/Dict.h"
|
||||
#include "renderer/Model.h"
|
||||
|
||||
#include "physics/Clip.h"
|
||||
#include "../physics/Clip.h"
|
||||
|
||||
//
|
||||
// animation channels
|
||||
// these can be changed by modmakers and licensees to be whatever they need.
|
||||
const int ANIM_NumAnimChannels = 5;
|
||||
const int ANIM_NumAnimChannels = 7;
|
||||
const int ANIM_MaxAnimsPerChannel = 3;
|
||||
const int ANIM_MaxSyncedAnims = 3;
|
||||
|
||||
|
@ -50,6 +50,10 @@ const int ANIMCHANNEL_TORSO = 1;
|
|||
const int ANIMCHANNEL_LEGS = 2;
|
||||
const int ANIMCHANNEL_HEAD = 3;
|
||||
const int ANIMCHANNEL_EYELIDS = 4;
|
||||
// Koz add channels for right and left hand;
|
||||
const int ANIMCHANNEL_RIGHTHAND = 5;
|
||||
const int ANIMCHANNEL_LEFTHAND = 6;
|
||||
// Koz end
|
||||
|
||||
// for converting from 24 frames per second to milliseconds
|
||||
ID_INLINE int FRAME2MS( int framenum ) {
|
||||
|
|
|
@ -41,7 +41,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "anim/Anim.h"
|
||||
|
||||
static const char *channelNames[ ANIM_NumAnimChannels ] = {
|
||||
"all", "torso", "legs", "head", "eyelids"
|
||||
"all", "torso", "legs", "head", "eyelids", "rightHand", "leftHand"
|
||||
};
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -4444,8 +4444,8 @@ bool idAnimator::GetJointTransform( jointHandle_t jointHandle, int currentTime,
|
|||
if ( !modelDef || ( jointHandle < 0 ) || ( jointHandle >= modelDef->NumJoints() ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CreateFrame( currentTime, false );
|
||||
if(currentTime != -1)
|
||||
CreateFrame( currentTime, false );
|
||||
|
||||
offset = joints[ jointHandle ].ToVec3();
|
||||
axis = joints[ jointHandle ].ToMat3();
|
||||
|
|
|
@ -31,7 +31,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "idlib/containers/Hierarchy.h"
|
||||
|
||||
#include "gamesys/Event.h"
|
||||
#include "Event.h"
|
||||
|
||||
class idClass;
|
||||
class idTypeInfo;
|
||||
|
|
|
@ -836,14 +836,24 @@ void idRestoreGame::RestoreObjects( void ) {
|
|||
// restore all the objects
|
||||
for( i = 1; i < objects.Num(); i++ ) {
|
||||
CallRestore_r( objects[ i ]->GetType(), objects[ i ] );
|
||||
/*if ( objects[ i ]->IsType( idEntity::Type ) ) {
|
||||
idEntity *ent = static_cast<idEntity *>( objects[i] );
|
||||
if (ent->name.Icmp("player1_weapon_left2") == 0 ||
|
||||
ent->name.Icmp( "player1_weapon_left_worldmodel2" ) == 0 ||
|
||||
ent->name.Icmp("player1_weapon_right2") == 0 ||
|
||||
ent->name.Icmp( "player1_weapon_right_worldmodel2" ) == 0) {
|
||||
delete(ent);
|
||||
//gameLocal.UnregisterEntity(ent);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
// regenerate render entities and render lights because are not saved
|
||||
for( i = 1; i < objects.Num(); i++ ) {
|
||||
if ( objects[ i ]->IsType( idEntity::Type ) ) {
|
||||
idEntity *ent = static_cast<idEntity *>( objects[ i ] );
|
||||
ent->UpdateVisuals();
|
||||
ent->Present();
|
||||
ent->UpdateVisuals();
|
||||
ent->Present();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "renderer/Model.h"
|
||||
#include "renderer/RenderSystem.h"
|
||||
|
||||
#include "gamesys/Class.h"
|
||||
#include "Class.h"
|
||||
|
||||
/*
|
||||
|
||||
|
|
|
@ -326,7 +326,9 @@ void Cmd_Give_f( const idCmdArgs &args ) {
|
|||
}
|
||||
|
||||
if ( give_all || idStr::Icmp( name, "weapons" ) == 0 ) {
|
||||
player->inventory.weapons = BIT( MAX_WEAPONS ) - 1;
|
||||
player->inventory.duplicateWeapons |= player->inventory.weapons;
|
||||
player->inventory.weapons = ( int )( BIT( MAX_WEAPONS ) - 1 );
|
||||
player->inventory.foundWeapons |= player->inventory.weapons;
|
||||
player->CacheWeapons();
|
||||
|
||||
if ( !give_all ) {
|
||||
|
@ -361,7 +363,7 @@ void Cmd_Give_f( const idCmdArgs &args ) {
|
|||
}
|
||||
|
||||
if ( idStr::Icmp( name, "pda" ) == 0 ) {
|
||||
player->GivePDA( args.Argv(2), NULL );
|
||||
player->GivePDA( args.Argv(2), NULL, true );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -370,7 +372,7 @@ void Cmd_Give_f( const idCmdArgs &args ) {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( !give_all && !player->Give( args.Argv(1), args.Argv(2) ) ) {
|
||||
if ( !give_all && !player->Give( args.Argv(1), args.Argv(2), -1 ) ) {
|
||||
gameLocal.Printf( "unknown item\n" );
|
||||
}
|
||||
}
|
||||
|
@ -1576,7 +1578,13 @@ static void Cmd_WeaponSplat_f( const idCmdArgs &args ) {
|
|||
return;
|
||||
}
|
||||
|
||||
player->weapon.GetEntity()->BloodSplat( 2.0f );
|
||||
// Carl dual wielding, splat blood on both weapons
|
||||
for( int hand = 0; hand < 2; hand++ )
|
||||
{
|
||||
idWeapon* weapon = player->GetWeaponInHand( hand );
|
||||
if( weapon )
|
||||
weapon->BloodSplat( 2.0f );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -99,9 +99,10 @@ idCVar g_cinematic( "g_cinematic", "1", CVAR_GAME | CVAR_BOOL, "skips u
|
|||
idCVar g_cinematicMaxSkipTime( "g_cinematicMaxSkipTime", "600", CVAR_GAME | CVAR_FLOAT, "# of seconds to allow game to run when skipping cinematic. prevents lock-up when cinematic doesn't end.", 0, 3600 );
|
||||
|
||||
idCVar g_muzzleFlash( "g_muzzleFlash", "1", CVAR_GAME | CVAR_ARCHIVE | CVAR_BOOL, "show muzzle flashes" );
|
||||
idCVar g_projectileLights( "g_projectileLights", "1", CVAR_GAME | CVAR_ARCHIVE | CVAR_BOOL, "show dynamic lights on projectiles" );
|
||||
//SB disable by default for VR
|
||||
idCVar g_projectileLights( "g_projectileLights", "0", CVAR_GAME | CVAR_ARCHIVE | CVAR_BOOL, "show dynamic lights on projectiles" );
|
||||
idCVar g_bloodEffects( "g_bloodEffects", "1", CVAR_GAME | CVAR_ARCHIVE | CVAR_BOOL, "show blood splats, sprays and gibs" );
|
||||
idCVar g_doubleVision( "g_doubleVision", "1", CVAR_GAME | CVAR_ARCHIVE | CVAR_BOOL, "show double vision when taking damage" );
|
||||
idCVar g_doubleVision( "g_doubleVision", "0", CVAR_GAME | CVAR_ARCHIVE | CVAR_BOOL, "show double vision when taking damage" );
|
||||
idCVar g_hitEffect( "g_hitEffect", "1", CVAR_GAME | CVAR_ARCHIVE | CVAR_BOOL, "mess up player camera when taking damage" );
|
||||
idCVar g_monsters( "g_monsters", "1", CVAR_GAME | CVAR_BOOL, "" );
|
||||
idCVar g_decals( "g_decals", "1", CVAR_GAME | CVAR_ARCHIVE | CVAR_BOOL, "show decals such as bullet holes" );
|
||||
|
@ -343,9 +344,11 @@ idCVar vr_heightoffset( "vr_heightoffset", "0.0", CVAR_GAME | CVAR_FLOAT
|
|||
idCVar vr_controlscheme( "vr_controlscheme", "0", CVAR_GAME | CVAR_INTEGER, "VR Control Scheme: 0 = right handed, 10 = left handed" );
|
||||
idCVar vr_shakeamplitude( "vr_shakeamplitude", "0.8", CVAR_FLOAT | CVAR_ARCHIVE, "Screen shake amplitude 0.0 = disabled to 1.0 = full\n", 0.0f, 1.0f );
|
||||
idCVar vr_knockback( "vr_knockback", "0", CVAR_BOOL | CVAR_ARCHIVE | CVAR_GAME, "Enable damage knockback in VR. 0 = Disabled, 1 = Enabled" );
|
||||
idCVar vr_weaponsight( "vr_weaponsight", "0", CVAR_BOOL | CVAR_ARCHIVE, "Weapon Sight.\n 0 = Disable\n 1 = Lasersight" );
|
||||
idCVar vr_throwables( "vr_throwables", "1", CVAR_BOOL | CVAR_ARCHIVE, "Throwable Grenades.\n 0 = Disable\n 1 = Throw and release with trigger" );
|
||||
idCVar vr_turnmode( "vr_turnmode", "0", CVAR_BOOL | CVAR_ARCHIVE, "Turn Mode.\n 0 = Snap Turn\n 1 = Smooth Turn" );
|
||||
idCVar vr_turnangle( "vr_turnangle", "45", CVAR_INTEGER | CVAR_ARCHIVE, "Turn Angle. angle for snap, or velocity for smooth" );
|
||||
idCVar vr_hudmode( "vr_hudmode", "0", CVAR_BOOL | CVAR_ARCHIVE, "HUD Mode.\n 1 = Attached to off-hand controller\n 0 = Fixed" );
|
||||
|
||||
idCVar vr_hudmode( "vr_hudmode", "1", CVAR_BOOL | CVAR_ARCHIVE, "HUD Mode.\n 1 = Attached to off-hand controller\n 0 = Fixed" );
|
||||
idCVar g_infiniteAmmo( "g_infiniteAmmo", "0", CVAR_GAME | CVAR_BOOL, "infinite ammo" );
|
||||
idCVar g_useWeaponDepthHack( "g_useWeaponDepthHack", "0", CVAR_BOOL | CVAR_GAME | CVAR_ARCHIVE, "Crunch z depth on weapons" );// Koz
|
||||
idCVar g_weaponShadows( "g_weaponShadows", "1", CVAR_BOOL | CVAR_GAME | CVAR_ARCHIVE, "Cast shadows from weapons" ); // Koz
|
||||
idCVar timescale( "timescale", "1", CVAR_SYSTEM | CVAR_FLOAT, "Number of game frames to run per render frame", 0.001f, 100.0f );
|
||||
|
|
|
@ -257,12 +257,14 @@ extern idCVar vr_heightoffset;
|
|||
extern idCVar vr_controlscheme;
|
||||
extern idCVar vr_shakeamplitude;
|
||||
extern idCVar vr_knockback;
|
||||
extern idCVar vr_weaponsight;
|
||||
extern idCVar vr_throwables;
|
||||
extern idCVar vr_turnmode;
|
||||
extern idCVar vr_turnangle;
|
||||
extern idCVar vr_hudmode;
|
||||
|
||||
extern idCVar g_infiniteAmmo;
|
||||
extern idCVar g_useWeaponDepthHack;
|
||||
extern idCVar g_weaponShadows;
|
||||
extern idCVar timescale;
|
||||
|
||||
extern const char *si_gameTypeArgs[];
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
#include <Vr.h>
|
||||
#include "sys/platform.h"
|
||||
#include "gamesys/SysCvar.h"
|
||||
#include "Entity.h"
|
||||
|
@ -136,7 +137,16 @@ void idPhysics_Player::Accelerate( const idVec3 &wishdir, const float wishspeed,
|
|||
accelspeed = addspeed;
|
||||
}
|
||||
|
||||
current.velocity += accelspeed * wishdir;
|
||||
// Koz instant accel/decel
|
||||
if ( game->isVR && vr_instantAccel.GetBool() && vr_teleportMode.GetInteger() !=2 && walking && groundPlane && !OnLadder() )
|
||||
{
|
||||
idVec3 newVel = wishspeed * wishdir;
|
||||
current.velocity.x = newVel.x;
|
||||
current.velocity.y = newVel.y;
|
||||
}
|
||||
else {
|
||||
current.velocity += accelspeed * wishdir;
|
||||
}
|
||||
#else
|
||||
// proper way (avoids strafe jump maxspeed bug), but feels bad
|
||||
idVec3 wishVelocity;
|
||||
|
@ -166,7 +176,316 @@ Returns true if the velocity was clipped in some way
|
|||
*/
|
||||
#define MAX_CLIP_PLANES 5
|
||||
|
||||
bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool push ) {
|
||||
// Koz MotionMove, allow physical movent to move player body in the world
|
||||
idVec3 idPhysics_Player::MotionMove( idVec3 &moveVelocity ) // bool gravity, bool stepUp, bool stepDown, bool push )
|
||||
{
|
||||
int i, j, k, pushFlags;
|
||||
int bumpcount, numbumps, numplanes;
|
||||
float d, time_left, into, totalMass;
|
||||
idVec3 dir, planes[MAX_CLIP_PLANES];
|
||||
idVec3 end, stepEnd, primal_velocity, endVelocity, endClipVelocity, clipVelocity;
|
||||
trace_t trace, stepTrace, downTrace;
|
||||
bool nearGround, stepped, pushed;
|
||||
|
||||
bool gravity = false;
|
||||
bool stepUp = true;
|
||||
bool stepDown = true;
|
||||
bool push = true;
|
||||
|
||||
idVec3 mVel = moveVelocity;
|
||||
|
||||
numbumps = 4;
|
||||
|
||||
// Koz begin motion movement
|
||||
//movement vector was calc'd in player::move, was converted to a velocity
|
||||
//in idPhysics_Player::Evaluate
|
||||
//add this temp velocity to move the player model the correct amount,
|
||||
//and slidemove will calc physics for going up/down steps or plane following
|
||||
//remove this vel after calc, so only a finite movement will be imparted, not deltav
|
||||
|
||||
time_left = (1000 / commonVr->hmdHz) * 0.001f; //frametime;
|
||||
|
||||
// never turn against the ground plane
|
||||
if ( groundPlane )
|
||||
{
|
||||
numplanes = 1;
|
||||
planes[0] = groundTrace.c.normal;
|
||||
}
|
||||
else
|
||||
{
|
||||
numplanes = 0;
|
||||
}
|
||||
|
||||
// never turn against original velocity
|
||||
planes[numplanes] = mVel;
|
||||
planes[numplanes].Normalize();
|
||||
numplanes++;
|
||||
|
||||
for ( bumpcount = 0; bumpcount < numbumps; bumpcount++ )
|
||||
{
|
||||
|
||||
// calculate position we are trying to move to
|
||||
end = current.origin + time_left * mVel;
|
||||
|
||||
// see if we can make it there
|
||||
gameLocal.clip.Translation( trace, current.origin, end, clipModel, clipModel->GetAxis(), clipMask, self );
|
||||
|
||||
time_left -= time_left * trace.fraction;
|
||||
current.origin = trace.endpos;
|
||||
|
||||
// if moved the entire distance
|
||||
if ( trace.fraction >= 1.0f )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
stepped = pushed = false;
|
||||
|
||||
// if we are allowed to step up
|
||||
if ( stepUp )
|
||||
{
|
||||
|
||||
nearGround = groundPlane | ladder;
|
||||
|
||||
if ( !nearGround )
|
||||
{
|
||||
// trace down to see if the player is near the ground
|
||||
// step checking when near the ground allows the player to move up stairs smoothly while jumping
|
||||
stepEnd = current.origin + maxStepHeight * gravityNormal;
|
||||
gameLocal.clip.Translation( downTrace, current.origin, stepEnd, clipModel, clipModel->GetAxis(), clipMask, self );
|
||||
nearGround = (downTrace.fraction < 1.0f && (downTrace.c.normal * -gravityNormal) > MIN_WALK_NORMAL);
|
||||
}
|
||||
|
||||
// may only step up if near the ground or on a ladder
|
||||
if ( nearGround )
|
||||
{
|
||||
|
||||
// step up
|
||||
stepEnd = current.origin - maxStepHeight * gravityNormal;
|
||||
gameLocal.clip.Translation( downTrace, current.origin, stepEnd, clipModel, clipModel->GetAxis(), clipMask, self );
|
||||
|
||||
// trace along velocity
|
||||
stepEnd = downTrace.endpos + time_left * mVel;
|
||||
|
||||
gameLocal.clip.Translation( stepTrace, downTrace.endpos, stepEnd, clipModel, clipModel->GetAxis(), clipMask, self );
|
||||
|
||||
// step down
|
||||
stepEnd = stepTrace.endpos + maxStepHeight * gravityNormal;
|
||||
gameLocal.clip.Translation( downTrace, stepTrace.endpos, stepEnd, clipModel, clipModel->GetAxis(), clipMask, self );
|
||||
|
||||
if ( downTrace.fraction >= 1.0f || (downTrace.c.normal * -gravityNormal) > MIN_WALK_NORMAL )
|
||||
{
|
||||
|
||||
// if moved the entire distance
|
||||
if ( stepTrace.fraction >= 1.0f )
|
||||
{
|
||||
time_left = 0;
|
||||
current.stepUp -= (downTrace.endpos - current.origin) * gravityNormal;
|
||||
current.origin = downTrace.endpos;
|
||||
current.movementFlags |= PMF_STEPPED_UP;
|
||||
mVel *= PM_STEPSCALE;
|
||||
break;
|
||||
}
|
||||
|
||||
// if the move is further when stepping up
|
||||
if ( stepTrace.fraction > trace.fraction )
|
||||
{
|
||||
time_left -= time_left * stepTrace.fraction;
|
||||
current.stepUp -= (downTrace.endpos - current.origin) * gravityNormal;
|
||||
current.origin = downTrace.endpos;
|
||||
current.movementFlags |= PMF_STEPPED_UP;
|
||||
mVel *= PM_STEPSCALE;
|
||||
trace = stepTrace;
|
||||
stepped = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we can push other entities and not blocked by the world
|
||||
if ( push && trace.c.entityNum != ENTITYNUM_WORLD )
|
||||
{
|
||||
|
||||
clipModel->SetPosition( current.origin, clipModel->GetAxis() );
|
||||
|
||||
// clip movement, only push idMoveables, don't push entities the player is standing on
|
||||
// apply impact to pushed objects
|
||||
pushFlags = PUSHFL_CLIP | PUSHFL_ONLYMOVEABLE | PUSHFL_NOGROUNDENTITIES | PUSHFL_APPLYIMPULSE;
|
||||
|
||||
// clip & push
|
||||
totalMass = gameLocal.push.ClipTranslationalPush( trace, self, pushFlags, end, end - current.origin );
|
||||
|
||||
if ( totalMass > 0.0f )
|
||||
{
|
||||
// decrease velocity based on the total mass of the objects being pushed ?
|
||||
mVel *= 1.0f - idMath::ClampFloat( 0.0f, 1000.0f, totalMass - 20.0f ) * (1.0f / 950.0f);
|
||||
pushed = true;
|
||||
}
|
||||
|
||||
current.origin = trace.endpos;
|
||||
time_left -= time_left * trace.fraction;
|
||||
|
||||
// if moved the entire distance
|
||||
if ( trace.fraction >= 1.0f )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !stepped )
|
||||
{
|
||||
// let the entity know about the collision
|
||||
self->Collide( trace, mVel );
|
||||
}
|
||||
|
||||
if ( numplanes >= MAX_CLIP_PLANES )
|
||||
{
|
||||
// MrElusive: I think we have some relatively high poly LWO models with a lot of slanted tris
|
||||
// where it may hit the max clip planes
|
||||
mVel = vec3_origin;
|
||||
return current.origin;
|
||||
}
|
||||
|
||||
//
|
||||
// if this is the same plane we hit before, nudge velocity
|
||||
// out along it, which fixes some epsilon issues with
|
||||
// non-axial planes
|
||||
//
|
||||
for ( i = 0; i < numplanes; i++ )
|
||||
{
|
||||
if ( (trace.c.normal * planes[i]) > 0.999f )
|
||||
{
|
||||
mVel += trace.c.normal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( i < numplanes )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
planes[numplanes] = trace.c.normal;
|
||||
numplanes++;
|
||||
|
||||
//
|
||||
// modify velocity so it parallels all of the clip planes
|
||||
//
|
||||
|
||||
// find a plane that it enters
|
||||
for ( i = 0; i < numplanes; i++ )
|
||||
{
|
||||
into = mVel * planes[i];
|
||||
if ( into >= 0.1f )
|
||||
{
|
||||
continue; // move doesn't interact with the plane
|
||||
}
|
||||
|
||||
// slide along the plane
|
||||
clipVelocity = mVel;
|
||||
clipVelocity.ProjectOntoPlane( planes[i], OVERCLIP );
|
||||
|
||||
// slide along the plane
|
||||
endClipVelocity = endVelocity;
|
||||
endClipVelocity.ProjectOntoPlane( planes[i], OVERCLIP );
|
||||
|
||||
// see if there is a second plane that the new move enters
|
||||
for ( j = 0; j < numplanes; j++ )
|
||||
{
|
||||
if ( j == i )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ( (clipVelocity * planes[j]) >= 0.1f )
|
||||
{
|
||||
continue; // move doesn't interact with the plane
|
||||
}
|
||||
|
||||
// try clipping the move to the plane
|
||||
clipVelocity.ProjectOntoPlane( planes[j], OVERCLIP );
|
||||
endClipVelocity.ProjectOntoPlane( planes[j], OVERCLIP );
|
||||
|
||||
// see if it goes back into the first clip plane
|
||||
if ( (clipVelocity * planes[i]) >= 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// slide the original velocity along the crease
|
||||
dir = planes[i].Cross( planes[j] );
|
||||
dir.Normalize();
|
||||
d = dir * mVel;
|
||||
clipVelocity = d * dir;
|
||||
|
||||
dir = planes[i].Cross( planes[j] );
|
||||
dir.Normalize();
|
||||
d = dir * endVelocity;
|
||||
endClipVelocity = d * dir;
|
||||
|
||||
// see if there is a third plane the the new move enters
|
||||
for ( k = 0; k < numplanes; k++ )
|
||||
{
|
||||
if ( k == i || k == j )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ( (clipVelocity * planes[k]) >= 0.1f )
|
||||
{
|
||||
continue; // move doesn't interact with the plane
|
||||
}
|
||||
|
||||
// stop dead at a tripple plane interaction
|
||||
mVel = vec3_origin;
|
||||
return current.origin;
|
||||
}
|
||||
}
|
||||
|
||||
// if we have fixed all interactions, try another move
|
||||
mVel = clipVelocity;
|
||||
endVelocity = endClipVelocity;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// step down
|
||||
if ( stepDown && groundPlane )
|
||||
{
|
||||
stepEnd = current.origin + gravityNormal * maxStepHeight;
|
||||
gameLocal.clip.Translation( downTrace, current.origin, stepEnd, clipModel, clipModel->GetAxis(), clipMask, self );
|
||||
if ( downTrace.fraction > 1e-4f && downTrace.fraction < 1.0f )
|
||||
{
|
||||
current.stepUp -= (downTrace.endpos - current.origin) * gravityNormal;
|
||||
current.origin = downTrace.endpos;
|
||||
current.movementFlags |= PMF_STEPPED_DOWN;
|
||||
mVel *= PM_STEPSCALE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( gravity )
|
||||
{
|
||||
mVel = endVelocity;
|
||||
}
|
||||
|
||||
// come to a dead stop when the velocity orthogonal to the gravity flipped
|
||||
clipVelocity = mVel - gravityNormal * mVel * gravityNormal;
|
||||
endClipVelocity = endVelocity - gravityNormal * endVelocity * gravityNormal;
|
||||
if ( clipVelocity * endClipVelocity < 0.0f )
|
||||
{
|
||||
mVel = gravityNormal * mVel * gravityNormal;
|
||||
}
|
||||
|
||||
//return (bool)(bumpcount == 0);
|
||||
return current.origin;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
idPhysics_Player::SlideMove
|
||||
|
||||
Returns true if the velocity was clipped in some way
|
||||
==================
|
||||
*/
|
||||
|
||||
bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool push )
|
||||
{
|
||||
int i, j, k, pushFlags;
|
||||
int bumpcount, numbumps, numplanes;
|
||||
float d, time_left, into, totalMass;
|
||||
|
@ -177,28 +496,35 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool
|
|||
|
||||
numbumps = 4;
|
||||
|
||||
|
||||
primal_velocity = current.velocity;
|
||||
|
||||
if ( gravity ) {
|
||||
if( gravity )
|
||||
{
|
||||
endVelocity = current.velocity + gravityVector * frametime;
|
||||
current.velocity = ( current.velocity + endVelocity ) * 0.5f;
|
||||
primal_velocity = endVelocity;
|
||||
if ( groundPlane ) {
|
||||
if( groundPlane )
|
||||
{
|
||||
// slide along the ground plane
|
||||
current.velocity.ProjectOntoPlane( groundTrace.c.normal, OVERCLIP );
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
endVelocity = current.velocity;
|
||||
}
|
||||
|
||||
time_left = frametime;
|
||||
|
||||
// never turn against the ground plane
|
||||
if ( groundPlane ) {
|
||||
if( groundPlane )
|
||||
{
|
||||
numplanes = 1;
|
||||
planes[0] = groundTrace.c.normal;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
numplanes = 0;
|
||||
}
|
||||
|
||||
|
@ -207,7 +533,8 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool
|
|||
planes[numplanes].Normalize();
|
||||
numplanes++;
|
||||
|
||||
for ( bumpcount = 0; bumpcount < numbumps; bumpcount++ ) {
|
||||
for( bumpcount = 0; bumpcount < numbumps; bumpcount++ )
|
||||
{
|
||||
|
||||
// calculate position we are trying to move to
|
||||
end = current.origin + time_left * current.velocity;
|
||||
|
@ -219,27 +546,31 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool
|
|||
current.origin = trace.endpos;
|
||||
|
||||
// if moved the entire distance
|
||||
if ( trace.fraction >= 1.0f ) {
|
||||
if( trace.fraction >= 1.0f )
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
stepped = pushed = false;
|
||||
|
||||
// if we are allowed to step up
|
||||
if ( stepUp ) {
|
||||
if( stepUp )
|
||||
{
|
||||
|
||||
nearGround = groundPlane | ladder;
|
||||
|
||||
if ( !nearGround ) {
|
||||
if( !nearGround )
|
||||
{
|
||||
// trace down to see if the player is near the ground
|
||||
// step checking when near the ground allows the player to move up stairs smoothly while jumping
|
||||
stepEnd = current.origin + maxStepHeight * gravityNormal;
|
||||
gameLocal.clip.Translation( downTrace, current.origin, stepEnd, clipModel, clipModel->GetAxis(), clipMask, self );
|
||||
nearGround = ( downTrace.fraction < 1.0f && (downTrace.c.normal * -gravityNormal) > MIN_WALK_NORMAL );
|
||||
nearGround = ( downTrace.fraction < 1.0f && ( downTrace.c.normal * -gravityNormal ) > MIN_WALK_NORMAL );
|
||||
}
|
||||
|
||||
// may only step up if near the ground or on a ladder
|
||||
if ( nearGround ) {
|
||||
if( nearGround )
|
||||
{
|
||||
|
||||
// step up
|
||||
stepEnd = current.origin - maxStepHeight * gravityNormal;
|
||||
|
@ -247,16 +578,19 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool
|
|||
|
||||
// trace along velocity
|
||||
stepEnd = downTrace.endpos + time_left * current.velocity;
|
||||
|
||||
gameLocal.clip.Translation( stepTrace, downTrace.endpos, stepEnd, clipModel, clipModel->GetAxis(), clipMask, self );
|
||||
|
||||
// step down
|
||||
stepEnd = stepTrace.endpos + maxStepHeight * gravityNormal;
|
||||
gameLocal.clip.Translation( downTrace, stepTrace.endpos, stepEnd, clipModel, clipModel->GetAxis(), clipMask, self );
|
||||
|
||||
if ( downTrace.fraction >= 1.0f || (downTrace.c.normal * -gravityNormal) > MIN_WALK_NORMAL ) {
|
||||
if( downTrace.fraction >= 1.0f || ( downTrace.c.normal * -gravityNormal ) > MIN_WALK_NORMAL )
|
||||
{
|
||||
|
||||
// if moved the entire distance
|
||||
if ( stepTrace.fraction >= 1.0f ) {
|
||||
if( stepTrace.fraction >= 1.0f )
|
||||
{
|
||||
time_left = 0;
|
||||
current.stepUp -= ( downTrace.endpos - current.origin ) * gravityNormal;
|
||||
current.origin = downTrace.endpos;
|
||||
|
@ -266,7 +600,8 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool
|
|||
}
|
||||
|
||||
// if the move is further when stepping up
|
||||
if ( stepTrace.fraction > trace.fraction ) {
|
||||
if( stepTrace.fraction > trace.fraction )
|
||||
{
|
||||
time_left -= time_left * stepTrace.fraction;
|
||||
current.stepUp -= ( downTrace.endpos - current.origin ) * gravityNormal;
|
||||
current.origin = downTrace.endpos;
|
||||
|
@ -280,18 +615,20 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool
|
|||
}
|
||||
|
||||
// if we can push other entities and not blocked by the world
|
||||
if ( push && trace.c.entityNum != ENTITYNUM_WORLD ) {
|
||||
if( push && trace.c.entityNum != ENTITYNUM_WORLD )
|
||||
{
|
||||
|
||||
clipModel->SetPosition( current.origin, clipModel->GetAxis() );
|
||||
|
||||
// clip movement, only push idMoveables, don't push entities the player is standing on
|
||||
// apply impact to pushed objects
|
||||
pushFlags = PUSHFL_CLIP|PUSHFL_ONLYMOVEABLE|PUSHFL_NOGROUNDENTITIES|PUSHFL_APPLYIMPULSE;
|
||||
pushFlags = PUSHFL_CLIP | PUSHFL_ONLYMOVEABLE | PUSHFL_NOGROUNDENTITIES | PUSHFL_APPLYIMPULSE;
|
||||
|
||||
// clip & push
|
||||
totalMass = gameLocal.push.ClipTranslationalPush( trace, self, pushFlags, end, end - current.origin );
|
||||
|
||||
if ( totalMass > 0.0f ) {
|
||||
if( totalMass > 0.0f )
|
||||
{
|
||||
// decrease velocity based on the total mass of the objects being pushed ?
|
||||
current.velocity *= 1.0f - idMath::ClampFloat( 0.0f, 1000.0f, totalMass - 20.0f ) * ( 1.0f / 950.0f );
|
||||
pushed = true;
|
||||
|
@ -301,17 +638,20 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool
|
|||
time_left -= time_left * trace.fraction;
|
||||
|
||||
// if moved the entire distance
|
||||
if ( trace.fraction >= 1.0f ) {
|
||||
if( trace.fraction >= 1.0f )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !stepped ) {
|
||||
if( !stepped )
|
||||
{
|
||||
// let the entity know about the collision
|
||||
self->Collide( trace, current.velocity );
|
||||
}
|
||||
|
||||
if ( numplanes >= MAX_CLIP_PLANES ) {
|
||||
if( numplanes >= MAX_CLIP_PLANES )
|
||||
{
|
||||
// MrElusive: I think we have some relatively high poly LWO models with a lot of slanted tris
|
||||
// where it may hit the max clip planes
|
||||
current.velocity = vec3_origin;
|
||||
|
@ -323,13 +663,16 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool
|
|||
// out along it, which fixes some epsilon issues with
|
||||
// non-axial planes
|
||||
//
|
||||
for ( i = 0; i < numplanes; i++ ) {
|
||||
if ( ( trace.c.normal * planes[i] ) > 0.999f ) {
|
||||
for( i = 0; i < numplanes; i++ )
|
||||
{
|
||||
if( ( trace.c.normal * planes[i] ) > 0.999f )
|
||||
{
|
||||
current.velocity += trace.c.normal;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( i < numplanes ) {
|
||||
if( i < numplanes )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
planes[numplanes] = trace.c.normal;
|
||||
|
@ -340,9 +683,11 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool
|
|||
//
|
||||
|
||||
// find a plane that it enters
|
||||
for ( i = 0; i < numplanes; i++ ) {
|
||||
for( i = 0; i < numplanes; i++ )
|
||||
{
|
||||
into = current.velocity * planes[i];
|
||||
if ( into >= 0.1f ) {
|
||||
if( into >= 0.1f )
|
||||
{
|
||||
continue; // move doesn't interact with the plane
|
||||
}
|
||||
|
||||
|
@ -355,11 +700,14 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool
|
|||
endClipVelocity.ProjectOntoPlane( planes[i], OVERCLIP );
|
||||
|
||||
// see if there is a second plane that the new move enters
|
||||
for ( j = 0; j < numplanes; j++ ) {
|
||||
if ( j == i ) {
|
||||
for( j = 0; j < numplanes; j++ )
|
||||
{
|
||||
if( j == i )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ( ( clipVelocity * planes[j] ) >= 0.1f ) {
|
||||
if( ( clipVelocity * planes[j] ) >= 0.1f )
|
||||
{
|
||||
continue; // move doesn't interact with the plane
|
||||
}
|
||||
|
||||
|
@ -368,7 +716,8 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool
|
|||
endClipVelocity.ProjectOntoPlane( planes[j], OVERCLIP );
|
||||
|
||||
// see if it goes back into the first clip plane
|
||||
if ( ( clipVelocity * planes[i] ) >= 0 ) {
|
||||
if( ( clipVelocity * planes[i] ) >= 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -384,11 +733,14 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool
|
|||
endClipVelocity = d * dir;
|
||||
|
||||
// see if there is a third plane the the new move enters
|
||||
for ( k = 0; k < numplanes; k++ ) {
|
||||
if ( k == i || k == j ) {
|
||||
for( k = 0; k < numplanes; k++ )
|
||||
{
|
||||
if( k == i || k == j )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if ( ( clipVelocity * planes[k] ) >= 0.1f ) {
|
||||
if( ( clipVelocity * planes[k] ) >= 0.1f )
|
||||
{
|
||||
continue; // move doesn't interact with the plane
|
||||
}
|
||||
|
||||
|
@ -405,11 +757,78 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool
|
|||
}
|
||||
}
|
||||
|
||||
// Leyland
|
||||
blink = false;
|
||||
idVec3 headOrigin = commonVr->uncrouchedHMDViewOrigin - current.origin;
|
||||
headOrigin.z = 0.f;
|
||||
|
||||
static const float headBodyLimit = 11.f;
|
||||
static const float maxHeadDist = headBodyLimit + 24.5f;
|
||||
static const float headBodyLimitSq = headBodyLimit * headBodyLimit;
|
||||
static const float maxHeadDistSq = maxHeadDist * maxHeadDist;
|
||||
|
||||
idBounds bounds(idVec3(-5,-5,-5), idVec3(5,5,5));
|
||||
idVec3 start;
|
||||
|
||||
// see if we can raise our head high enough
|
||||
start = end = current.origin;
|
||||
start.z += 20.f;
|
||||
end.z = commonVr->uncrouchedHMDViewOrigin.z;
|
||||
gameLocal.clip.TraceBounds( trace, start, end, bounds, clipMask, self );
|
||||
commonVr->headHeightDiff = trace.endpos.z - end.z;
|
||||
|
||||
if( trace.fraction < 1.f )
|
||||
{
|
||||
if( !headBumped )
|
||||
{
|
||||
blink = true;
|
||||
headBumped = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( headBumped )
|
||||
{
|
||||
blink = true;
|
||||
headBumped = false;
|
||||
}
|
||||
}
|
||||
|
||||
// clamp to a max distance
|
||||
float headDistSq = headOrigin.LengthSqr();
|
||||
if( headDistSq > maxHeadDistSq )
|
||||
{
|
||||
headOrigin *= maxHeadDist / sqrtf(headDistSq);
|
||||
headDistSq = maxHeadDistSq;
|
||||
blink = true;
|
||||
}
|
||||
|
||||
// head collision check if we are outside the body bounds
|
||||
if( headDistSq > headBodyLimitSq )
|
||||
{
|
||||
// see if we can make it there
|
||||
start = current.origin;
|
||||
start.z = commonVr->uncrouchedHMDViewOrigin.z + commonVr->headHeightDiff;
|
||||
end = headOrigin + start;
|
||||
gameLocal.clip.TraceBounds( trace, start, end, bounds, clipMask, self );
|
||||
|
||||
if( trace.fraction < 1.0f )
|
||||
{
|
||||
blink = true;
|
||||
}
|
||||
|
||||
headOrigin = trace.endpos - current.origin;
|
||||
}
|
||||
headOrigin.z = commonVr->headHeightDiff;
|
||||
// end Leyland
|
||||
|
||||
// step down
|
||||
if ( stepDown && groundPlane ) {
|
||||
if( stepDown && groundPlane )
|
||||
{
|
||||
stepEnd = current.origin + gravityNormal * maxStepHeight;
|
||||
gameLocal.clip.Translation( downTrace, current.origin, stepEnd, clipModel, clipModel->GetAxis(), clipMask, self );
|
||||
if ( downTrace.fraction > 1e-4f && downTrace.fraction < 1.0f ) {
|
||||
if( downTrace.fraction > 1e-4f && downTrace.fraction < 1.0f )
|
||||
{
|
||||
current.stepUp -= ( downTrace.endpos - current.origin ) * gravityNormal;
|
||||
current.origin = downTrace.endpos;
|
||||
current.movementFlags |= PMF_STEPPED_DOWN;
|
||||
|
@ -417,18 +836,21 @@ bool idPhysics_Player::SlideMove( bool gravity, bool stepUp, bool stepDown, bool
|
|||
}
|
||||
}
|
||||
|
||||
if ( gravity ) {
|
||||
if( gravity )
|
||||
{
|
||||
current.velocity = endVelocity;
|
||||
}
|
||||
|
||||
|
||||
// come to a dead stop when the velocity orthogonal to the gravity flipped
|
||||
clipVelocity = current.velocity - gravityNormal * current.velocity * gravityNormal;
|
||||
endClipVelocity = endVelocity - gravityNormal * endVelocity * gravityNormal;
|
||||
if ( clipVelocity * endClipVelocity < 0.0f ) {
|
||||
if( clipVelocity * endClipVelocity < 0.0f )
|
||||
{
|
||||
current.velocity = gravityNormal * current.velocity * gravityNormal;
|
||||
}
|
||||
|
||||
return (bool)( bumpcount == 0 );
|
||||
return ( bool )( bumpcount == 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -447,6 +869,16 @@ void idPhysics_Player::Friction( void ) {
|
|||
if ( walking ) {
|
||||
// ignore slope movement, remove all velocity in gravity direction
|
||||
vel += (vel * gravityNormal) * gravityNormal;
|
||||
|
||||
// Koz instant accel/decel
|
||||
if ( game->isVR && vr_instantAccel.GetBool() && vr_teleportMode.GetInteger() != 2 && groundPlane && !OnLadder() )
|
||||
{
|
||||
if ( command.forwardmove == 0 && command.rightmove == 0 )
|
||||
{
|
||||
current.velocity.x = 0;
|
||||
current.velocity.y = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
speed = vel.Length();
|
||||
|
@ -732,9 +1164,11 @@ void idPhysics_Player::WalkMove( void ) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// don't do anything if standing still
|
||||
vel = current.velocity - (current.velocity * gravityNormal) * gravityNormal;
|
||||
if ( !vel.LengthSqr() ) {
|
||||
if( !vel.LengthSqr() && !commonVr->motionMoveDelta.x && !commonVr->motionMoveDelta.y )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1078,27 +1512,52 @@ void idPhysics_Player::CheckDuck( void ) {
|
|||
if ( current.movementType == PM_DEAD ) {
|
||||
maxZ = pm_deadheight.GetFloat();
|
||||
} else {
|
||||
// stand up when up against a ladder
|
||||
if ( command.upmove < 0 && !ladder ) {
|
||||
// duck
|
||||
current.movementFlags |= PMF_DUCKED;
|
||||
} else {
|
||||
// stand up if possible
|
||||
if ( current.movementFlags & PMF_DUCKED ) {
|
||||
// try to stand up
|
||||
end = current.origin - ( pm_normalheight.GetFloat() - pm_crouchheight.GetFloat() ) * gravityNormal;
|
||||
gameLocal.clip.Translation( trace, current.origin, end, clipModel, clipModel->GetAxis(), clipMask, self );
|
||||
if ( trace.fraction >= 1.0f ) {
|
||||
current.movementFlags &= ~PMF_DUCKED;
|
||||
}
|
||||
if ( current.movementType == PM_NORMAL && game->isVR && vr_crouchMode.GetInteger() == 0 && !(command.buttons & BUTTON_CROUCH) )
|
||||
// game is in full motion crouch mode, dont do anything except change the bounding box to crouch height if ducking
|
||||
// and change the player speed to crouch speed if player has ducked enough.
|
||||
// thought I was going to have to do a bunch of bullshit to toggle the crouch anim
|
||||
// but turns out the walk anim with the waist IK doesn't look too terrible for now
|
||||
// of course, I haven't tested crouching EVERYWHERE in the game yet.....
|
||||
//
|
||||
{
|
||||
maxZ = pm_normalviewheight.GetFloat() + commonVr->poseHmdBodyPositionDelta.z + commonVr->headHeightDiff;
|
||||
idMath::ClampFloat(pm_crouchheight.GetFloat(), pm_normalheight.GetFloat(), maxZ);
|
||||
maxZ = (int)maxZ; // if this is not cast as an int, it crashes the savegame file!!!!!!! WTF?
|
||||
|
||||
current.movementFlags &= ~PMF_DUCKED;
|
||||
// If we're using floor height, it only counts as crouching if we're actually trying to duck, not simply sitting.
|
||||
if (maxZ <= (pm_crouchheight.GetFloat() + 2) && (!vr_useFloorHeight.GetBool() || commonVr->userDuckingAmount > vr_crouchTriggerDist.GetFloat() / vr_scale.GetFloat()))
|
||||
{
|
||||
playerSpeed = crouchSpeed;
|
||||
if (!ladder)
|
||||
current.movementFlags |= PMF_DUCKED;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// stand up when up against a ladder
|
||||
if (command.upmove < 0 && !ladder) {
|
||||
// duck
|
||||
current.movementFlags |= PMF_DUCKED;
|
||||
} else {
|
||||
// stand up if possible
|
||||
if (current.movementFlags & PMF_DUCKED) {
|
||||
// try to stand up
|
||||
end = current.origin -
|
||||
(pm_normalheight.GetFloat() - pm_crouchheight.GetFloat()) * gravityNormal;
|
||||
gameLocal.clip.Translation(trace, current.origin, end, clipModel,
|
||||
clipModel->GetAxis(), clipMask, self);
|
||||
if (trace.fraction >= 1.0f) {
|
||||
current.movementFlags &= ~PMF_DUCKED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( current.movementFlags & PMF_DUCKED ) {
|
||||
playerSpeed = crouchSpeed;
|
||||
maxZ = pm_crouchheight.GetFloat();
|
||||
} else {
|
||||
maxZ = pm_normalheight.GetFloat();
|
||||
if (current.movementFlags & PMF_DUCKED) {
|
||||
playerSpeed = crouchSpeed;
|
||||
maxZ = pm_crouchheight.GetFloat();
|
||||
} else {
|
||||
maxZ = pm_normalheight.GetFloat();
|
||||
}
|
||||
}
|
||||
}
|
||||
// if the clipModel height should change
|
||||
|
@ -1351,8 +1810,7 @@ void idPhysics_Player::MovePlayer( int msec ) {
|
|||
current.velocity -= current.pushVelocity;
|
||||
|
||||
// view vectors
|
||||
viewAngles.ToVectors( &viewForward, NULL, NULL );
|
||||
viewForward *= clipModelAxis;
|
||||
viewForward = commandForward * clipModelAxis;
|
||||
viewRight = gravityNormal.Cross( viewForward );
|
||||
viewRight.Normalize();
|
||||
|
||||
|
@ -1506,7 +1964,7 @@ idPhysics_Player::idPhysics_Player( void ) {
|
|||
maxStepHeight = 0;
|
||||
maxJumpHeight = 0;
|
||||
memset( &command, 0, sizeof( command ) );
|
||||
viewAngles.Zero();
|
||||
commandForward = idVec3( 1, 0, 0 );
|
||||
framemsec = 0;
|
||||
frametime = 0;
|
||||
playerSpeed = 0;
|
||||
|
@ -1571,7 +2029,7 @@ void idPhysics_Player::Save( idSaveGame *savefile ) const {
|
|||
savefile->WriteInt( debugLevel );
|
||||
|
||||
savefile->WriteUsercmd( command );
|
||||
savefile->WriteAngles( viewAngles );
|
||||
savefile->WriteVec3( commandForward );
|
||||
|
||||
savefile->WriteInt( framemsec );
|
||||
savefile->WriteFloat( frametime );
|
||||
|
@ -1608,7 +2066,7 @@ void idPhysics_Player::Restore( idRestoreGame *savefile ) {
|
|||
savefile->ReadInt( debugLevel );
|
||||
|
||||
savefile->ReadUsercmd( command );
|
||||
savefile->ReadAngles( viewAngles );
|
||||
savefile->ReadVec3( commandForward );
|
||||
|
||||
savefile->ReadInt( framemsec );
|
||||
savefile->ReadFloat( frametime );
|
||||
|
@ -1633,9 +2091,11 @@ void idPhysics_Player::Restore( idRestoreGame *savefile ) {
|
|||
idPhysics_Player::SetPlayerInput
|
||||
================
|
||||
*/
|
||||
void idPhysics_Player::SetPlayerInput( const usercmd_t &cmd, const idAngles &newViewAngles ) {
|
||||
//void idPhysics_Player::SetPlayerInput( const usercmd_t &cmd, const idAngles &newViewAngles ) {
|
||||
void idPhysics_Player::SetPlayerInput( const usercmd_t& cmd, const idVec3& forwardVector ) {
|
||||
command = cmd;
|
||||
viewAngles = newViewAngles; // can't use cmd.angles cause of the delta_angles
|
||||
//viewAngles = newViewAngles; // can't use cmd.angles cause of the delta_angles
|
||||
commandForward = forwardVector; // can't use cmd.angles cause of the delta_angles
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1781,7 +2241,7 @@ idPhysics_Player::ApplyImpulse
|
|||
================
|
||||
*/
|
||||
void idPhysics_Player::ApplyImpulse( const int id, const idVec3 &point, const idVec3 &impulse ) {
|
||||
if ( current.movementType != PM_NOCLIP ) {
|
||||
if ( current.movementType != PM_NOCLIP && !(game->isVR && !vr_knockBack.GetBool())) {
|
||||
current.velocity += impulse * invMass;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
float GetMaxStepHeight( void ) const;
|
||||
void SetMaxJumpHeight( const float newMaxJumpHeight );
|
||||
void SetMovementType( const pmtype_t type );
|
||||
void SetPlayerInput( const usercmd_t &cmd, const idAngles &newViewAngles );
|
||||
void SetPlayerInput( const usercmd_t& cmd, const idVec3& forwardVector );
|
||||
void SetKnockBack( const int knockBackTime );
|
||||
void SetDebugLevel( bool set );
|
||||
// feed back from last physics frame
|
||||
|
@ -132,11 +132,16 @@ public: // common physics interface
|
|||
void WriteToSnapshot( idBitMsgDelta &msg ) const;
|
||||
void ReadFromSnapshot( const idBitMsgDelta &msg );
|
||||
|
||||
// Koz
|
||||
idVec3 MotionMove( idVec3 &moveVelocity ); // bool gravity, bool stepUp, bool stepDown, bool push );
|
||||
|
||||
private:
|
||||
// player physics state
|
||||
playerPState_t current;
|
||||
playerPState_t saved;
|
||||
|
||||
public:
|
||||
bool blink;
|
||||
bool headBumped;
|
||||
// properties
|
||||
float walkSpeed;
|
||||
float crouchSpeed;
|
||||
|
@ -146,7 +151,7 @@ private:
|
|||
|
||||
// player input
|
||||
usercmd_t command;
|
||||
idAngles viewAngles;
|
||||
idVec3 commandForward; // can't use cmd.angles cause of the delta_angles and head tracking
|
||||
|
||||
// run-time variables
|
||||
int framemsec;
|
||||
|
|
|
@ -31,8 +31,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
#include "cm/CollisionModel.h"
|
||||
|
||||
#include "physics/Clip.h"
|
||||
#include "GameBase.h"
|
||||
#include "Clip.h"
|
||||
#include "../GameBase.h"
|
||||
|
||||
class idEntity;
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "idlib/containers/HashIndex.h"
|
||||
#include "idlib/math/Vector.h"
|
||||
|
||||
#include "GameBase.h"
|
||||
#include "../GameBase.h"
|
||||
|
||||
class idEventDef;
|
||||
class idVarDef;
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#ifndef __VR_HMD_H__
|
||||
#define __VR_HMD_H__
|
||||
|
||||
#include "../idlib/math/Vector.h"
|
||||
#include "../../../../../../../../VrApi/Include/VrApi_Types.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EYE_LEFT = 0,
|
||||
EYE_RIGHT = 1,
|
||||
NUM_EYES = 2,
|
||||
} vr_eye_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vr_eye_t eyes[NUM_EYES];
|
||||
} eye_order_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float scale;
|
||||
float offset;
|
||||
} scaleOffset_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
scaleOffset_t x;
|
||||
scaleOffset_t y;
|
||||
} eyeScaleOffset_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float projUp;
|
||||
float projDown;
|
||||
float projLeft;
|
||||
float projRight;
|
||||
} eyeProjRaw_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
} resolution_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
} ovrEyeRenderDesc;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int w;
|
||||
int h;
|
||||
} ovrSizei;
|
||||
|
||||
typedef struct ovrFovPort_
|
||||
{
|
||||
float LeftTan;
|
||||
float RightTan;
|
||||
float UpTan;
|
||||
float DownTan;
|
||||
} ovrFovPort;
|
||||
|
||||
typedef struct _hmdEye
|
||||
{
|
||||
|
||||
float projectionHmd[16];
|
||||
idVec3 viewOffset;
|
||||
eyeProjRaw_t projectionOpenVR;
|
||||
eyeScaleOffset_t projectionOculus;
|
||||
resolution_t renderTargetRes;
|
||||
ovrFovPort eyeFov;
|
||||
ovrEyeRenderDesc eyeRenderDesc;
|
||||
ovrSizei renderTarget;
|
||||
ovrVector2f UVScaleoffset[2];
|
||||
} hmdEye_t;
|
||||
|
||||
#endif
|
|
@ -78,4 +78,31 @@ private:
|
|||
int baseID;
|
||||
};
|
||||
|
||||
/*
|
||||
================================================
|
||||
idLocalization
|
||||
================================================
|
||||
*/
|
||||
class idLocalization
|
||||
{
|
||||
public:
|
||||
static const char* GetString( const char* inString ); // returns inString if string not found
|
||||
static const char* FindString( const char* inString ); // Returns NULL if string not found
|
||||
|
||||
static void ClearDictionary();
|
||||
static bool LoadDictionary( const byte* buffer, const int bufferLen, const char* name );
|
||||
|
||||
// This is only here for tools, normal code should only ever call GetString
|
||||
static idLangDict& GetDictionary()
|
||||
{
|
||||
return languageDict;
|
||||
}
|
||||
|
||||
static utf8Encoding_t VerifyUTF8( const uint* buffer, const int bufferLen, const char* name );
|
||||
|
||||
private:
|
||||
static idLangDict languageDict;
|
||||
friend class idStrId;
|
||||
};
|
||||
|
||||
#endif /* !__LANGDICT_H__ */
|
||||
|
|
|
@ -44,6 +44,15 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#define strcmp idStr::Cmp // use_idStr_Cmp
|
||||
#define strncmp use_idStr_Cmpn
|
||||
|
||||
enum utf8Encoding_t
|
||||
{
|
||||
UTF8_PURE_ASCII, // no characters with values > 127
|
||||
UTF8_ENCODED_BOM, // characters > 128 encoded with UTF8, but no byte-order-marker at the beginning
|
||||
UTF8_ENCODED_NO_BOM, // characters > 128 encoded with UTF8, with a byte-order-marker at the beginning
|
||||
UTF8_INVALID, // has values > 127 but isn't valid UTF8
|
||||
UTF8_INVALID_BOM // has a byte-order-marker at the beginning, but isn't valuid UTF8 -- it's messed up
|
||||
};
|
||||
|
||||
#if defined( StrCmpN )
|
||||
#undef StrCmpN
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
#ifndef __SORT_H__
|
||||
#define __SORT_H__
|
||||
|
||||
/*
|
||||
================================================================================================
|
||||
Contains the generic templated sort algorithms for quick-sort, heap-sort and insertion-sort.
|
||||
|
||||
The sort algorithms do not use class operators or overloaded functions to compare
|
||||
objects because it is often desireable to sort the same objects in different ways
|
||||
based on different keys (not just ascending and descending but sometimes based on
|
||||
name and other times based on say priority). So instead, for each different sort a
|
||||
separate class is implemented with a Compare() function.
|
||||
|
||||
This class is derived from one of the classes that implements a sort algorithm.
|
||||
The Compare() member function does not only define how objects are sorted, the class
|
||||
can also store additional data that can be used by the Compare() function. This, for
|
||||
instance, allows a list of indices to be sorted where the indices point to objects
|
||||
in an array. The base pointer of the array with objects can be stored on the class
|
||||
that implements the Compare() function such that the Compare() function can use keys
|
||||
that are stored on the objects.
|
||||
|
||||
The Compare() function is not virtual because this would incur significant overhead.
|
||||
Do NOT make the Compare() function virtual on the derived class!
|
||||
The sort implementations also explicitely call the Compare() function of the derived
|
||||
class. This is to avoid various compiler bugs with using overloaded compare functions
|
||||
and the inability of various compilers to find the right overloaded compare function.
|
||||
|
||||
To sort an array, an idList or an idStaticList, a new sort class, typically derived from
|
||||
idSort_Quick, is implemented as follows:
|
||||
|
||||
class idSort_MySort : public idSort_Quick< idMyObject, idSort_MySort > {
|
||||
public:
|
||||
int Compare( const idMyObject & a, const idMyObject & b ) const {
|
||||
if ( a should come before b ) {
|
||||
return -1; // or any negative integer
|
||||
} if ( a should come after b ) {
|
||||
return 1; // or any positive integer
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
To sort an array:
|
||||
|
||||
idMyObject array[100];
|
||||
idSort_MySort().Sort( array, 100 );
|
||||
|
||||
To sort an idList:
|
||||
|
||||
idList< idMyObject > list;
|
||||
list.Sort( idSort_MySort() );
|
||||
|
||||
The sort implementations never create temporaries of the template type. Only the
|
||||
'SwapValues' template is used to move data around. This 'SwapValues' template can be
|
||||
specialized to implement fast swapping of data. For instance, when sorting a list with
|
||||
objects of some string class it is important to implement a specialized 'SwapValues' for
|
||||
this string class to avoid excessive re-allocation and copying of strings.
|
||||
|
||||
================================================================================================
|
||||
*/
|
||||
|
||||
#include "../../sys/platform.h"
|
||||
|
||||
/*
|
||||
========================
|
||||
SwapValues
|
||||
========================
|
||||
*/
|
||||
template< typename _type_ >
|
||||
ID_INLINE void SwapValues( _type_ & a, _type_ & b )
|
||||
{
|
||||
_type_ c = a;
|
||||
a = b;
|
||||
b = c;
|
||||
}
|
||||
#endif
|
|
@ -38,6 +38,57 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
===============================================================================
|
||||
*/
|
||||
typedef unsigned short halfFloat_t;
|
||||
|
||||
// GPU half-float bit patterns
|
||||
#define HF_MANTISSA(x) (x&1023)
|
||||
#define HF_EXP(x) ((x&32767)>>10)
|
||||
#define HF_SIGN(x) ((x&32768)?-1:1)
|
||||
/*
|
||||
========================
|
||||
F16toF32
|
||||
========================
|
||||
*/
|
||||
ID_INLINE float F16toF32( halfFloat_t x )
|
||||
{
|
||||
int e = HF_EXP( x );
|
||||
int m = HF_MANTISSA( x );
|
||||
int s = HF_SIGN( x );
|
||||
|
||||
if( 0 < e && e < 31 )
|
||||
{
|
||||
return s * powf( 2.0f, ( e - 15.0f ) ) * ( 1 + m / 1024.0f );
|
||||
}
|
||||
else if( m == 0 )
|
||||
{
|
||||
return s * 0.0f;
|
||||
}
|
||||
return s * powf( 2.0f, -14.0f ) * ( m / 1024.0f );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
F32toF16
|
||||
========================
|
||||
*/
|
||||
ID_INLINE halfFloat_t F32toF16( float a )
|
||||
{
|
||||
unsigned int f = *( unsigned* )( &a );
|
||||
unsigned int signbit = ( f & 0x80000000 ) >> 16;
|
||||
int exponent = ( ( f & 0x7F800000 ) >> 23 ) - 112;
|
||||
unsigned int mantissa = ( f & 0x007FFFFF );
|
||||
|
||||
if( exponent <= 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if( exponent > 30 )
|
||||
{
|
||||
return ( halfFloat_t )( signbit | 0x7BFF );
|
||||
}
|
||||
|
||||
return ( halfFloat_t )( signbit | ( exponent << 10 ) | ( mantissa >> 13 ) );
|
||||
}
|
||||
|
||||
class idDrawVert {
|
||||
public:
|
||||
|
@ -61,8 +112,88 @@ public:
|
|||
|
||||
void SetColor( dword color );
|
||||
dword GetColor( void ) const;
|
||||
|
||||
void SetTexCoord( const idVec2& st );
|
||||
void SetTexCoord( float s, float t );
|
||||
void SetTexCoordS( float s );
|
||||
void SetTexCoordT( float t );
|
||||
const idVec2 GetTexCoord() const;
|
||||
const float GetTexCoordS() const;
|
||||
const float GetTexCoordT() const;
|
||||
};
|
||||
|
||||
/*
|
||||
========================
|
||||
idDrawVert::SetTexCoord
|
||||
========================
|
||||
*/
|
||||
ID_INLINE void idDrawVert::SetTexCoord( const idVec2& st )
|
||||
{
|
||||
SetTexCoordS( st.x );
|
||||
SetTexCoordT( st.y );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idDrawVert::SetTexCoord
|
||||
========================
|
||||
*/
|
||||
ID_INLINE void idDrawVert::SetTexCoord( float s, float t )
|
||||
{
|
||||
SetTexCoordS( s );
|
||||
SetTexCoordT( t );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idDrawVert::SetTexCoordS
|
||||
========================
|
||||
*/
|
||||
ID_INLINE void idDrawVert::SetTexCoordS( float s )
|
||||
{
|
||||
st[0] = F32toF16( s );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idDrawVert::SetTexCoordT
|
||||
========================
|
||||
*/
|
||||
ID_INLINE void idDrawVert::SetTexCoordT( float t )
|
||||
{
|
||||
st[1] = F32toF16( t );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idDrawVert::GetTexCoord
|
||||
========================
|
||||
*/
|
||||
ID_INLINE const idVec2 idDrawVert::GetTexCoord() const
|
||||
{
|
||||
return idVec2( F16toF32( st[0] ), F16toF32( st[1] ) );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idDrawVert::GetTexCoordT
|
||||
========================
|
||||
*/
|
||||
ID_INLINE const float idDrawVert::GetTexCoordS() const
|
||||
{
|
||||
return F16toF32( st[0] );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idDrawVert::GetTexCoordS
|
||||
========================
|
||||
*/
|
||||
ID_INLINE const float idDrawVert::GetTexCoordT() const
|
||||
{
|
||||
return F16toF32( st[1] );
|
||||
}
|
||||
|
||||
ID_INLINE float idDrawVert::operator[]( const int index ) const {
|
||||
assert( index >= 0 && index < 5 );
|
||||
return ((float *)(&xyz))[index];
|
||||
|
|
|
@ -80,6 +80,8 @@ public:
|
|||
bool operator==( const idJointMat &a ) const; // exact compare, no epsilon
|
||||
bool operator!=( const idJointMat &a ) const; // exact compare, no epsilon
|
||||
|
||||
void Invert();
|
||||
|
||||
idMat3 ToMat3( void ) const;
|
||||
idVec3 ToVec3( void ) const;
|
||||
idJointQuat ToJointQuat( void ) const;
|
||||
|
@ -227,6 +229,35 @@ ID_INLINE bool idJointMat::operator!=( const idJointMat &a ) const {
|
|||
return !Compare( a );
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idJointMat::Invert
|
||||
========================
|
||||
*/
|
||||
ID_INLINE void idJointMat::Invert()
|
||||
{
|
||||
float tmp[3];
|
||||
|
||||
// negate inverse rotated translation part
|
||||
tmp[0] = mat[0 * 4 + 0] * mat[0 * 4 + 3] + mat[1 * 4 + 0] * mat[1 * 4 + 3] + mat[2 * 4 + 0] * mat[2 * 4 + 3];
|
||||
tmp[1] = mat[0 * 4 + 1] * mat[0 * 4 + 3] + mat[1 * 4 + 1] * mat[1 * 4 + 3] + mat[2 * 4 + 1] * mat[2 * 4 + 3];
|
||||
tmp[2] = mat[0 * 4 + 2] * mat[0 * 4 + 3] + mat[1 * 4 + 2] * mat[1 * 4 + 3] + mat[2 * 4 + 2] * mat[2 * 4 + 3];
|
||||
mat[0 * 4 + 3] = -tmp[0];
|
||||
mat[1 * 4 + 3] = -tmp[1];
|
||||
mat[2 * 4 + 3] = -tmp[2];
|
||||
|
||||
// transpose rotation part
|
||||
tmp[0] = mat[0 * 4 + 1];
|
||||
mat[0 * 4 + 1] = mat[1 * 4 + 0];
|
||||
mat[1 * 4 + 0] = tmp[0];
|
||||
tmp[1] = mat[0 * 4 + 2];
|
||||
mat[0 * 4 + 2] = mat[2 * 4 + 0];
|
||||
mat[2 * 4 + 0] = tmp[1];
|
||||
tmp[2] = mat[1 * 4 + 2];
|
||||
mat[1 * 4 + 2] = mat[2 * 4 + 1];
|
||||
mat[2 * 4 + 1] = tmp[2];
|
||||
}
|
||||
|
||||
ID_INLINE idMat3 idJointMat::ToMat3( void ) const {
|
||||
return idMat3( mat[0 * 4 + 0], mat[1 * 4 + 0], mat[2 * 4 + 0],
|
||||
mat[0 * 4 + 1], mat[1 * 4 + 1], mat[2 * 4 + 1],
|
||||
|
|
|
@ -307,8 +307,7 @@ src_d3quest = \
|
|||
../../Doom3Quest/VrInputCommon.c \
|
||||
../../Doom3Quest/VrInputDefault.c \
|
||||
../../Doom3Quest/mathlib.c \
|
||||
../../Doom3Quest/matrixlib.c \
|
||||
../../Doom3Quest/argtable3.c
|
||||
../../Doom3Quest/matrixlib.c
|
||||
|
||||
src_core = \
|
||||
${src_renderer} \
|
||||
|
|
|
@ -107,6 +107,7 @@ src_game = \
|
|||
game/Sound.cpp \
|
||||
game/Target.cpp \
|
||||
game/Trigger.cpp \
|
||||
game/Vr.cpp \
|
||||
game/Weapon.cpp \
|
||||
game/WorldSpawn.cpp \
|
||||
game/ai/AAS.cpp \
|
||||
|
|
|
@ -149,7 +149,6 @@ src_game = \
|
|||
d3xp/physics/Physics_Static.cpp \
|
||||
d3xp/physics/Physics_StaticMulti.cpp \
|
||||
d3xp/physics/Push.cpp \
|
||||
d3xp/Grabber.cpp \
|
||||
d3xp/physics/Force_Grab.cpp \
|
||||
|
||||
LOCAL_SRC_FILES = $(src_idlib) $(src_game)
|
||||
|
|
|
@ -22,7 +22,7 @@ void Android_SetCommand(const char * cmd)
|
|||
|
||||
// Can only set one impulse per frame, this should be fine
|
||||
static int nextImpulse = 0;
|
||||
void Android_SetImpuse(int impulse)
|
||||
void Android_SetImpulse(int impulse)
|
||||
{
|
||||
nextImpulse = impulse;
|
||||
}
|
||||
|
|
|
@ -372,7 +372,7 @@ idCinematicLocal::ResetTime
|
|||
==============
|
||||
*/
|
||||
void idCinematicLocal::ResetTime(int time) {
|
||||
startTime = ( backEnd.viewDef ) ? 1000 * backEnd.viewDef->floatTime : -1;
|
||||
startTime = -1;//( backEnd.viewDef ) ? 1000 * backEnd.viewDef->floatTime : -1;
|
||||
status = FMV_PLAY;
|
||||
}
|
||||
|
||||
|
|
|
@ -407,6 +407,7 @@ public:
|
|||
idImage * borderClampImage; // white inside, black outside
|
||||
|
||||
idImage* hudImage;
|
||||
idImage* pdaImage;
|
||||
|
||||
//--------------------------------------------------------
|
||||
|
||||
|
|
|
@ -1795,6 +1795,7 @@ void idImageManager::Init() {
|
|||
currentRenderImage = ImageFromFunction("_currentRender", R_RGBA8Image );
|
||||
|
||||
hudImage = ImageFromFunction( "_hudImage", R_VRSurfaceImage ); // R_RGBA8Image );
|
||||
pdaImage = ImageFromFunction( "_pdaImage", R_VRSurfaceImage ); // R_RGBA8Image );
|
||||
|
||||
|
||||
cmdSystem->AddCommand( "reloadImages", R_ReloadImages_f, CMD_FL_RENDERER, "reloads images" );
|
||||
|
|
|
@ -189,6 +189,7 @@ public:
|
|||
private:
|
||||
idList<idMD5Joint> joints;
|
||||
idList<idJointQuat> defaultPose;
|
||||
idList<idJointMat> invertedDefaultPose;
|
||||
idList<idMD5Mesh> meshes;
|
||||
|
||||
void CalculateBounds( const idJointMat *joints );
|
||||
|
|
|
@ -558,11 +558,127 @@ void idRenderModelMD5::LoadModel() {
|
|||
}
|
||||
parser.ExpectTokenString( "}" );
|
||||
|
||||
for( i = 0; i < meshes.Num(); i++ ) {
|
||||
//-----------------------------------------
|
||||
// create the inverse of the base pose joints to support tech6 style deformation
|
||||
// of base pose vertexes, normals, and tangents.
|
||||
//
|
||||
// vertex * joints * inverseJoints == vertex when joints is the base pose
|
||||
// When the joints are in another pose, it gives the animated vertex position
|
||||
//-----------------------------------------
|
||||
invertedDefaultPose.SetNum( SIMD_ROUND_JOINTS( joints.Num() ) );
|
||||
for( int i = 0; i < joints.Num(); i++ )
|
||||
{
|
||||
invertedDefaultPose[i] = poseMat3[i];
|
||||
invertedDefaultPose[i].Invert();
|
||||
}
|
||||
SIMD_INIT_LAST_JOINT( invertedDefaultPose.Ptr(), joints.Num() );
|
||||
|
||||
idStr materialName; // Koz
|
||||
bool isPDAmesh = false;
|
||||
|
||||
for( int i = 0; i < meshes.Num(); i++ )
|
||||
{
|
||||
isPDAmesh = false;
|
||||
parser.ExpectTokenString( "mesh" );
|
||||
meshes[ i ].ParseMesh( parser, defaultPose.Num(), poseMat3 );
|
||||
meshes[i].ParseMesh( parser, defaultPose.Num(), poseMat3 );
|
||||
|
||||
// Koz begin
|
||||
// Remove hands from weapon & pda viewmodels if desired.
|
||||
|
||||
materialName = meshes[i].shader->GetName();
|
||||
if ( materialName.IsEmpty() )
|
||||
{
|
||||
meshes[i].shader = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( materialName == "textures/common/pda_gui" || materialName == "_pdaImage" || materialName == "_pdaimage" )
|
||||
{
|
||||
// Koz pda - change material to _pdaImage instead of deault
|
||||
// this allows rendering the PDA & swf menus to the model ingame.
|
||||
// if we find this gui, we also need to add a surface to the model, so flag.
|
||||
meshes[i].shader = declManager->FindMaterial( "_pdaImage" );
|
||||
isPDAmesh = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( isPDAmesh )
|
||||
{
|
||||
|
||||
|
||||
{
|
||||
common->Printf( "Load pda model\n" );
|
||||
for ( int ti = 0; ti < meshes[i].NumVerts(); ti++ )
|
||||
{
|
||||
common->Printf( "Numverts %d Vert %d %f %f %f : %f %f %f %f\n", meshes[i].NumVerts(), ti, meshes[i].deformInfo->verts[ti].xyz.x,
|
||||
meshes[i].deformInfo->verts[ti].xyz.y,
|
||||
meshes[i].deformInfo->verts[ti].xyz.z,
|
||||
meshes[i].deformInfo->verts[ti].GetTexCoordS(),
|
||||
meshes[i].deformInfo->verts[ti].GetTexCoordT(),
|
||||
meshes[i].deformInfo->verts[ti].st[0],
|
||||
meshes[i].deformInfo->verts[ti].st[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
common->Printf( "PDA gui found, creating gui surface for hitscan.\n" );
|
||||
|
||||
modelSurface_t pdasurface;
|
||||
|
||||
pdasurface.id = 0;
|
||||
pdasurface.shader = declManager->FindMaterial( "_pdaImage" );
|
||||
|
||||
srfTriangles_t * pdageometry = AllocSurfaceTriangles( meshes[i].NumVerts(), meshes[i].deformInfo->numIndexes );
|
||||
assert( pdageometry != NULL );
|
||||
|
||||
// infinite bounds
|
||||
pdageometry->bounds[0][0] =
|
||||
pdageometry->bounds[0][1] =
|
||||
pdageometry->bounds[0][2] = -99999;
|
||||
pdageometry->bounds[1][0] =
|
||||
pdageometry->bounds[1][1] =
|
||||
pdageometry->bounds[1][2] = 99999;
|
||||
|
||||
pdageometry->numVerts = meshes[i].NumVerts();
|
||||
pdageometry->numIndexes = meshes[i].deformInfo->numIndexes;
|
||||
|
||||
for ( int zz = 0; zz < pdageometry->numIndexes; zz++ )
|
||||
{
|
||||
pdageometry->indexes[zz] = meshes[i].deformInfo->indexes[zz];
|
||||
}
|
||||
|
||||
for ( int zz = 0; zz < pdageometry->numVerts; zz++ )
|
||||
{
|
||||
//GB Fix Verts (if needed)
|
||||
pdageometry->verts[zz].xyz = meshes[i].deformInfo->verts[zz].xyz;
|
||||
//pdageometry->verts[zz].SetTexCoord( meshes[i].deformInfo->verts[zz].GetTexCoord() );
|
||||
pdageometry->verts[zz].st = meshes[i].deformInfo->verts[zz].st;
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
common->Printf( "verify pda model\n" );
|
||||
for ( int ti = 0; ti < pdageometry->numVerts; ti++ )
|
||||
{
|
||||
common->Printf( "Numverts %d Vert %d %f %f %f : %f %f %f %f\n", pdageometry->numVerts, ti, pdageometry->verts[ti].xyz.x,
|
||||
pdageometry->verts[ti].xyz.y,
|
||||
pdageometry->verts[ti].xyz.z,
|
||||
pdageometry->verts[ti].GetTexCoordS(),
|
||||
pdageometry->verts[ti].GetTexCoordT(),
|
||||
pdageometry->verts[ti].st[0],
|
||||
pdageometry->verts[ti].st[1] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pdasurface.geometry = pdageometry;
|
||||
AddSurface( pdasurface );
|
||||
}
|
||||
// Koz end PDA
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// calculate the bounds of the model
|
||||
//
|
||||
|
|
|
@ -25,6 +25,8 @@ If you have questions concerning this license or the applicable additional terms
|
|||
|
||||
===========================================================================
|
||||
*/
|
||||
#include "framework/Game.h"
|
||||
#include "../game/Vr.h"
|
||||
#include "sys/platform.h"
|
||||
#include "idlib/containers/List.h"
|
||||
#include "framework/EventLoop.h"
|
||||
|
@ -280,6 +282,20 @@ See if some cvars that we watch have changed
|
|||
static void R_CheckCvars( void ) {
|
||||
globalImages->CheckCvars();
|
||||
|
||||
//GB Not Currently working - Fix (Create a Virtual Function)
|
||||
// Koz
|
||||
/*if ( game->isVR )
|
||||
{
|
||||
if ( vr_useFloorHeight.IsModified() || ( vr_normalViewHeight.IsModified() && vr_useFloorHeight.GetInteger() == 0 ) || vr_scale.IsModified() || commonVr->shouldRecenter )
|
||||
{
|
||||
commonVr->HMDResetTrackingOriginOffset();
|
||||
vr_useFloorHeight.ClearModified();
|
||||
vr_normalViewHeight.ClearModified();
|
||||
vr_scale.ClearModified();
|
||||
commonVr->shouldRecenter = false;
|
||||
}
|
||||
}*/
|
||||
|
||||
// gamma stuff
|
||||
if ( r_gamma.IsModified() || r_brightness.IsModified() ) {
|
||||
r_gamma.ClearModified();
|
||||
|
@ -314,7 +330,7 @@ just colors
|
|||
=============
|
||||
*/
|
||||
void idRenderSystemLocal::SetColor( const idVec4 &rgba ) {
|
||||
guiModel->SetColor( rgba[0], rgba[1], rgba[2], rgba[3] );
|
||||
guiModel->SetColor(rgba[0], rgba[1], rgba[2], hudOpacity * rgba[3]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -324,6 +340,7 @@ SetColor4
|
|||
=============
|
||||
*/
|
||||
void idRenderSystemLocal::SetColor4( float r, float g, float b, float a ) {
|
||||
a = hudOpacity * a;
|
||||
guiModel->SetColor( r, g, b, a );
|
||||
}
|
||||
|
||||
|
@ -1084,6 +1101,7 @@ void idRenderSystemLocal::CaptureRenderToImage( const char *imageName ) {
|
|||
cmd->imageHeight = rc->height;
|
||||
cmd->image = image;
|
||||
|
||||
|
||||
guiModel->Clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -172,6 +172,7 @@ public:
|
|||
// GUI drawing just involves shader parameter setting and axial image subsections
|
||||
virtual void SetColor( const idVec4 &rgba ) = 0;
|
||||
virtual void SetColor4( float r, float g, float b, float a ) = 0;
|
||||
virtual void SetHudOpacity( float opacity ) = 0;
|
||||
|
||||
virtual void DrawStretchPic( const idDrawVert *verts, const glIndex_t *indexes, int vertCount, int indexCount, const idMaterial *material,
|
||||
bool clip = true, float min_x = 0.0f, float min_y = 0.0f, float max_x = 640.0f, float max_y = 480.0f ) = 0;
|
||||
|
|
|
@ -1624,6 +1624,8 @@ void idRenderSystemLocal::Init( void ) {
|
|||
// we used to memset tr, but now that it is a class, we can't, so
|
||||
// there may be other state we need to reset
|
||||
|
||||
hudOpacity = 1.0f;
|
||||
|
||||
multithreadActive = r_multithread.GetBool();
|
||||
useSpinLock = false;
|
||||
spinLockDelay = 500;
|
||||
|
@ -1793,6 +1795,15 @@ int idRenderSystemLocal::GetScreenHeight( void ) const {
|
|||
return glConfig.vidHeight;
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
idRenderSystemLocal::SetHUDOpacity
|
||||
========================
|
||||
*/
|
||||
void idRenderSystemLocal::SetHudOpacity( float opacity ) {
|
||||
hudOpacity = opacity;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
{
|
||||
float Doom3Quest_GetFOV();
|
||||
|
|
|
@ -26,14 +26,16 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "framework/Game.h"
|
||||
#include "sys/platform.h"
|
||||
#include "framework/Session.h"
|
||||
#include "framework/DeclSkin.h"
|
||||
#include "renderer/GuiModel.h"
|
||||
#include "renderer/RenderWorld_local.h"
|
||||
|
||||
#include "renderer/tr_local.h"
|
||||
|
||||
#include "../game/anim/Anim.h"
|
||||
|
||||
/*
|
||||
===================
|
||||
R_ListRenderLightDefs_f
|
||||
|
@ -967,18 +969,23 @@ this doesn't do any occlusion testing, simply ignoring non-gui surfaces.
|
|||
start / end are in global world coordinates.
|
||||
================
|
||||
*/
|
||||
guiPoint_t idRenderWorldLocal::GuiTrace( qhandle_t entityHandle, const idVec3 start, const idVec3 end ) const {
|
||||
guiPoint_t idRenderWorldLocal::GuiTrace( qhandle_t entityHandle, idAnimator* animator, const idVec3 start, const idVec3 end ) const {
|
||||
localTrace_t local;
|
||||
idVec3 localStart, localEnd, bestPoint;
|
||||
int j;
|
||||
idRenderModel *model;
|
||||
srfTriangles_t *tri;
|
||||
const idMaterial *shader;
|
||||
guiPoint_t pt;
|
||||
|
||||
guiPoint_t pt;
|
||||
pt.fraction = 1.0f; // Koz
|
||||
pt.x = pt.y = -1;
|
||||
pt.guiId = 0;
|
||||
|
||||
// Koz begin
|
||||
bool isPDA = false;
|
||||
// Koz end
|
||||
|
||||
if ( ( entityHandle < 0 ) || ( entityHandle >= entityDefs.Num() ) ) {
|
||||
common->Printf( "idRenderWorld::GuiTrace: invalid handle %i\n", entityHandle );
|
||||
return pt;
|
||||
|
@ -991,10 +998,43 @@ guiPoint_t idRenderWorldLocal::GuiTrace( qhandle_t entityHandle, const idVec3 st
|
|||
}
|
||||
|
||||
model = def->parms.hModel;
|
||||
if ( def->parms.callback || !def->parms.hModel || def->parms.hModel->IsDynamicModel() != DM_STATIC ) {
|
||||
//if ( def->parms.callback || !def->parms.hModel || def->parms.hModel->IsDynamicModel() != DM_STATIC) {
|
||||
if ( !def->parms.hModel) {
|
||||
return pt;
|
||||
}
|
||||
|
||||
// Koz begin
|
||||
// Koz allow the PDA model to be traced.
|
||||
|
||||
jointHandle_t guiJoints[4];
|
||||
|
||||
if (game->IsPDAOpen())
|
||||
{
|
||||
|
||||
isPDA = idStr::Icmp( "models/md5/items/pda_view/pda_vr_idle.md5mesh", model->Name() ) == 0;
|
||||
|
||||
if ( isPDA )
|
||||
{
|
||||
guiJoints[3] = model->GetJointHandle( "BLgui" );
|
||||
guiJoints[0] = model->GetJointHandle( "BRgui" );
|
||||
guiJoints[1] = model->GetJointHandle( "TRgui" );
|
||||
guiJoints[2] = model->GetJointHandle( "TLgui" );
|
||||
|
||||
for ( int checkJoint = 0; checkJoint < 4; checkJoint++ )
|
||||
{
|
||||
if ( guiJoints[checkJoint] == INVALID_JOINT ) isPDA = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ( (model->IsDynamicModel() != DM_STATIC || def->parms.callback != NULL ) && !isPDA )
|
||||
{
|
||||
return pt;
|
||||
}
|
||||
// Koz end
|
||||
|
||||
// transform the points into local space
|
||||
R_GlobalPointToLocal( def->modelMatrix, start, localStart );
|
||||
R_GlobalPointToLocal( def->modelMatrix, end, localEnd );
|
||||
|
@ -1012,10 +1052,34 @@ guiPoint_t idRenderWorldLocal::GuiTrace( qhandle_t entityHandle, const idVec3 st
|
|||
continue;
|
||||
}
|
||||
// only trace against gui surfaces
|
||||
if (!shader->HasGui()) {
|
||||
if (!shader->HasGui() && !isPDA ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Koz begin
|
||||
|
||||
if ( isPDA )
|
||||
{
|
||||
|
||||
idMat3 discardAxis = mat3_identity;
|
||||
idVec3 modelOrigin = def->parms.origin;
|
||||
idMat3 modelAxis = def->parms.axis;
|
||||
|
||||
for ( int jj = 0; jj < 4; jj++ )
|
||||
{
|
||||
// overwrite surface coords for testing
|
||||
//GBFIX
|
||||
game->AnimatorGetJointTransform(animator, guiJoints[jj], Sys_Milliseconds(), tri->verts[jj].xyz, discardAxis );
|
||||
//animator->GetJointTransform( guiJoints[jj], Sys_Milliseconds(), tri->verts[jj].xyz, discardAxis );
|
||||
|
||||
// draw debug lines from view start to gui corners
|
||||
// gameRenderWorld->DebugLine( colorYellow, start, modelOrigin + tri->verts[jj].xyz * modelAxis, 20 );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
// Koz end
|
||||
|
||||
local = R_LocalTrace( localStart, localEnd, 0.0f, tri );
|
||||
if ( local.fraction < 1.0 ) {
|
||||
idVec3 origin, axis[3];
|
||||
|
@ -1031,7 +1095,7 @@ guiPoint_t idRenderWorldLocal::GuiTrace( qhandle_t entityHandle, const idVec3 st
|
|||
pt.x = ( cursor * axis[0] ) / ( axisLen[0] * axisLen[0] );
|
||||
pt.y = ( cursor * axis[1] ) / ( axisLen[1] * axisLen[1] );
|
||||
pt.guiId = shader->GetEntityGui();
|
||||
|
||||
pt.fraction = local.fraction;
|
||||
return pt;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#ifndef __RENDERWORLD_H__
|
||||
#define __RENDERWORLD_H__
|
||||
|
||||
#include "../game/anim/Anim.h"
|
||||
#include "idlib/geometry/Winding.h"
|
||||
#include "idlib/geometry/JointTransform.h"
|
||||
#include "idlib/bv/Box.h"
|
||||
#include "idlib/bv/Frustum.h"
|
||||
#include "framework/DeclParticle.h"
|
||||
|
@ -82,6 +84,19 @@ const int SHADERPARM_PARTICLE_STOPTIME = 8; // don't spawn any more particles af
|
|||
// guis
|
||||
const int MAX_RENDERENTITY_GUI = 3;
|
||||
|
||||
ID_INLINE int SIMD_ROUND_JOINTS( int numJoints )
|
||||
{
|
||||
return ( ( numJoints + 1 ) & ~1 );
|
||||
}
|
||||
ID_INLINE void SIMD_INIT_LAST_JOINT( idJointMat* joints, int numJoints )
|
||||
{
|
||||
if( numJoints & 1 )
|
||||
{
|
||||
joints[numJoints] = joints[numJoints - 1];
|
||||
}
|
||||
}
|
||||
|
||||
class idAnimator; // Koz
|
||||
|
||||
typedef bool(*deferredEntityCallback_t)( renderEntity_s *, const renderView_s * );
|
||||
|
||||
|
@ -247,6 +262,7 @@ typedef struct {
|
|||
typedef struct {
|
||||
float x, y; // 0.0 to 1.0 range if trace hit a gui, otherwise -1
|
||||
int guiId; // id of gui ( 0, 1, or 2 ) that the trace happened against
|
||||
float fraction; // Koz added fraction of trace completed for touch screens
|
||||
} guiPoint_t;
|
||||
|
||||
|
||||
|
@ -377,7 +393,7 @@ public:
|
|||
// fraction location of the trace on the gui surface, or -1,-1 if no hit.
|
||||
// This doesn't do any occlusion testing, simply ignoring non-gui surfaces.
|
||||
// start / end are in global world coordinates.
|
||||
virtual guiPoint_t GuiTrace( qhandle_t entityHandle, const idVec3 start, const idVec3 end ) const = 0;
|
||||
virtual guiPoint_t GuiTrace( qhandle_t entityHandle, idAnimator* animator, const idVec3 start, const idVec3 end ) const = 0; // Koz added animator
|
||||
|
||||
// Traces vs the render model, possibly instantiating a dynamic version, and returns true if something was hit
|
||||
virtual bool ModelTrace( modelTrace_t &trace, qhandle_t entityHandle, const idVec3 &start, const idVec3 &end, const float radius ) const = 0;
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
virtual int NumPortalsInArea( int areaNum );
|
||||
virtual exitPortal_t GetPortal( int areaNum, int portalNum );
|
||||
|
||||
virtual guiPoint_t GuiTrace( qhandle_t entityHandle, const idVec3 start, const idVec3 end ) const;
|
||||
virtual guiPoint_t GuiTrace( qhandle_t entityHandle, idAnimator* animator, const idVec3 start, const idVec3 end ) const; // Koz added animator
|
||||
virtual bool ModelTrace( modelTrace_t &trace, qhandle_t entityHandle, const idVec3 &start, const idVec3 &end, const float radius ) const;
|
||||
virtual bool Trace( modelTrace_t &trace, const idVec3 &start, const idVec3 &end, const float radius, bool skipDynamic = true, bool skipPlayer = false ) const;
|
||||
virtual bool FastWorldTrace( modelTrace_t &trace, const idVec3 &start, const idVec3 &end ) const;
|
||||
|
|
|
@ -43,7 +43,7 @@ shaderProgram_t stencilShadowShader;
|
|||
GLuint viewMatricesBuffer;
|
||||
|
||||
bool projectionMatricesSet = false;
|
||||
GLuint projectionMatricesBuffer[DEPTH_HACK_PROJECTION + NUM_DEPTH_HACK_PROJECTIONS];
|
||||
GLuint projectionMatricesBuffer[DEPTH_HACK_PROJECTION + NUM_DEPTH_HACK_PROJECTIONS + 1];
|
||||
|
||||
#define ATTR_VERTEX 0 // Don't change this, as WebGL require the vertex attrib 0 to be always bound
|
||||
#define ATTR_COLOR 1
|
||||
|
@ -402,7 +402,7 @@ static bool RB_GLSL_InitShaders(void) {
|
|||
GL_STATIC_DRAW);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, 0);
|
||||
|
||||
for (int i = 0; i < (NUM_DEPTH_HACK_PROJECTIONS+DEPTH_HACK_PROJECTION); ++i)
|
||||
for (int i = 0; i <= (NUM_DEPTH_HACK_PROJECTIONS+DEPTH_HACK_PROJECTION); ++i)
|
||||
{
|
||||
qglGenBuffers(1, &projectionMatricesBuffer[i]);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, projectionMatricesBuffer[i]);
|
||||
|
@ -2650,8 +2650,8 @@ void RB_GLSL_PrepareShaders(void) {
|
|||
GL_ProjectionMatricesUniformBuffer(projectionMatricesBuffer[WEAPON_PROJECTION], projection);
|
||||
|
||||
//3+ ore model depth hack projections
|
||||
for (int i = 0; i < NUM_DEPTH_HACK_PROJECTIONS; ++i) {
|
||||
float depthHack = (float) (i + 1) / float(NUM_DEPTH_HACK_PROJECTIONS);
|
||||
for (int i = 0; i <= NUM_DEPTH_HACK_PROJECTIONS; ++i) {
|
||||
float depthHack = (float)(i+1) / float(NUM_DEPTH_HACK_PROJECTIONS+1);
|
||||
RB_ComputeProjection(false, depthHack, projection);
|
||||
GL_ProjectionMatricesUniformBuffer(projectionMatricesBuffer[DEPTH_HACK_PROJECTION + i],
|
||||
projection);
|
||||
|
|
|
@ -5,7 +5,7 @@ GPL3
|
|||
#include "renderer/tr_local.h"
|
||||
#include "renderer/VertexCache.h"
|
||||
|
||||
#define FRAMEBUFFER_POOL_SIZE 3
|
||||
#define FRAMEBUFFER_POOL_SIZE 5
|
||||
|
||||
static GLuint m_framebuffer[FRAMEBUFFER_POOL_SIZE];
|
||||
static GLuint m_depthbuffer[FRAMEBUFFER_POOL_SIZE];
|
||||
|
|
|
@ -694,6 +694,7 @@ public:
|
|||
virtual void BeginLevelLoad( void );
|
||||
virtual void EndLevelLoad( void );
|
||||
virtual bool RegisterFont( const char *fontName, fontInfoEx_t &font );
|
||||
virtual void SetHudOpacity( float opacity );
|
||||
virtual void SetColor( const idVec4 &rgba );
|
||||
virtual void SetColor4( float r, float g, float b, float a );
|
||||
virtual void DrawStretchPic ( const idDrawVert *verts, const glIndex_t *indexes, int vertCount, int indexCount, const idMaterial *material,
|
||||
|
@ -737,6 +738,7 @@ public:
|
|||
|
||||
bool useSpinLock = true;
|
||||
int spinLockDelay = 1000;
|
||||
float hudOpacity = 0.0f;
|
||||
|
||||
bool windowActive = false; // True when the app is at the foreground and not minimised
|
||||
|
||||
|
@ -1425,6 +1427,7 @@ typedef struct deformInfo_s {
|
|||
// it will often be larger if the input had mirrored texture seams that needed
|
||||
// to be busted for proper tangent spaces
|
||||
int numOutputVerts;
|
||||
idDrawVert* verts;
|
||||
|
||||
int numMirroredVerts;
|
||||
int * mirroredVerts;
|
||||
|
|
|
@ -2200,6 +2200,7 @@ deformInfo_t *R_BuildDeformInfo( int numVerts, const idDrawVert *verts, int numI
|
|||
|
||||
deform->numSourceVerts = numVerts;
|
||||
deform->numOutputVerts = tri.numVerts;
|
||||
deform->verts = tri.verts;
|
||||
|
||||
deform->numIndexes = numIndexes;
|
||||
deform->indexes = tri.indexes;
|
||||
|
|
|
@ -128,8 +128,6 @@ bff6543d6ab3ebbb7d72aecde1802847 *src/d3xp/gamesys/TypeInfo.cpp
|
|||
4ce41c1583e13dee525c3962599d4344 *src/d3xp/Game_local.cpp
|
||||
c47b817da63b29e136b1dd15cc6616c5 *src/d3xp/Game_local.h
|
||||
228d27ea27c967bb957cbe6d79d50628 *src/d3xp/Game_network.cpp
|
||||
c48750d415082e129b09f411b9d0fbb2 *src/d3xp/Grabber.cpp
|
||||
406bec75a737035f70b7be3a896fc6d9 *src/d3xp/Grabber.h
|
||||
24c6f213c515acae0b2ea944ed4f43f7 *src/d3xp/IK.cpp
|
||||
df74f5d7c6a346ee41a131864ac33a06 *src/d3xp/IK.h
|
||||
df4cccd9cd3c0c99493ac0f9e47b1dbc *src/d3xp/Item.cpp
|
||||
|
|
|
@ -215,7 +215,7 @@ typedef int qhandle_t;
|
|||
#endif
|
||||
|
||||
#ifndef BIT
|
||||
#define BIT( num ) ( 1 << ( num ) )
|
||||
#define BIT( num ) ( 1ULL << ( num ) )
|
||||
#endif
|
||||
|
||||
#define MAX_STRING_CHARS 1024 // max length of a string
|
||||
|
|
|
@ -360,8 +360,6 @@ d3xp/gamesys/TypeInfo.h
|
|||
d3xp/Game_local.cpp
|
||||
d3xp/Game_local.h
|
||||
d3xp/Game_network.cpp
|
||||
d3xp/Grabber.cpp
|
||||
d3xp/Grabber.h
|
||||
d3xp/IK.cpp
|
||||
d3xp/IK.h
|
||||
d3xp/Item.cpp
|
||||
|
|
|
@ -1214,16 +1214,18 @@ void idWindow::Redraw(float x, float y) {
|
|||
return;
|
||||
}
|
||||
|
||||
// DG: allow scaling menus to 4:3
|
||||
bool fixupFor43 = false;
|
||||
if ( flags & WIN_DESKTOP ) {
|
||||
// only scale desktop windows (will automatically scale its sub-windows)
|
||||
// that EITHER have the scaleto43 flag set OR are fullscreen menus and r_scaleMenusTo43 is 1
|
||||
if( (flags & WIN_SCALETO43) ||
|
||||
((flags & WIN_MENUGUI) && r_scaleMenusTo43.GetBool()) )
|
||||
{
|
||||
fixupFor43 = true;
|
||||
dc->SetMenuScaleFix(true);
|
||||
if (!cvarSystem->GetCVarBool("draw_pda")) // only do the following if we aren't drawing pda
|
||||
{
|
||||
// DG: allow scaling menus to 4:3
|
||||
if (flags & WIN_DESKTOP) {
|
||||
// only scale desktop windows (will automatically scale its sub-windows)
|
||||
// that EITHER have the scaleto43 flag set OR are fullscreen menus and r_scaleMenusTo43 is 1
|
||||
if ((flags & WIN_SCALETO43) ||
|
||||
((flags & WIN_MENUGUI) && r_scaleMenusTo43.GetBool())) {
|
||||
fixupFor43 = true;
|
||||
dc->SetMenuScaleFix(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Binary file not shown.
|
@ -1,14 +0,0 @@
|
|||
|
||||
|
||||
vr/hud
|
||||
|
||||
{
|
||||
qer_editorimage textures/zaphod/shotgun_laser.TGA
|
||||
translucent
|
||||
noShadows
|
||||
{
|
||||
blend add
|
||||
map _hudImage
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
|
@ -156,9 +156,7 @@ import static android.system.Os.setenv;
|
|||
//Create all required folders
|
||||
new File("/sdcard/Doom3Quest/base").mkdirs();
|
||||
|
||||
//Weapons - force overwrite
|
||||
copy_asset("/sdcard/Doom3Quest/base", "pak099.pk4", true);
|
||||
|
||||
copy_asset("/sdcard/Doom3Quest/base", "pak399.pk4", true);
|
||||
|
||||
//Read these from a file and pass through
|
||||
commandLineParams = new String("doom3quest");
|
||||
|
@ -195,7 +193,45 @@ import static android.system.Os.setenv;
|
|||
|
||||
}
|
||||
|
||||
mNativeHandle = GLES3JNILib.onCreate( this, commandLineParams );
|
||||
//Parse the config file for these values
|
||||
long refresh = 60; // Default to 60
|
||||
float ss = -1.0F;
|
||||
long msaa = 1; // default for both HMDs
|
||||
String configFileName = "/sdcard/Doom3Quest/config/base/doom3quest.cfg";
|
||||
if(new File(configFileName).exists())
|
||||
{
|
||||
BufferedReader br;
|
||||
try {
|
||||
br = new BufferedReader(new FileReader(configFileName));
|
||||
String s;
|
||||
while ((s=br.readLine())!=null) {
|
||||
int i1 = s.indexOf("\"");
|
||||
int i2 = s.lastIndexOf("\"");
|
||||
if (i1 != -1 && i2 != -1) {
|
||||
String value = s.substring(i1+1, i2);
|
||||
if (s.contains("vr_refresh")) {
|
||||
refresh = Long.parseLong(value);
|
||||
} else if (s.contains("vr_msaa")) {
|
||||
msaa = Long.parseLong(value);
|
||||
} else if (s.contains("vr_supersampling")) {
|
||||
ss = Float.parseFloat(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
br.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (NumberFormatException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
mNativeHandle = GLES3JNILib.onCreate( this, commandLineParams, refresh, ss, msaa );
|
||||
}
|
||||
|
||||
public void copy_asset(String path, String name, boolean force) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import android.view.Surface;
|
|||
public class GLES3JNILib
|
||||
{
|
||||
// Activity lifecycle
|
||||
public static native long onCreate( Activity obj, String commandLineParams );
|
||||
public static native long onCreate( Activity obj, String commandLineParams, long refresh, float ss, long msaa );
|
||||
public static native void onStart( long handle, Object obj );
|
||||
public static native void onResume( long handle );
|
||||
public static native void onPause( long handle );
|
||||
|
|
Loading…
Reference in New Issue