Merge pull request #19 from fighterguard/master
Multiple fixes and QoL additions
|
@ -115,6 +115,11 @@ cvar_t *vr_worldscale;
|
|||
cvar_t *vr_weaponscale;
|
||||
cvar_t *vr_weapon_stabilised;
|
||||
cvar_t *vr_comfort_mask;
|
||||
cvar_t *vr_turn_deadzone;
|
||||
cvar_t *vr_framerate;
|
||||
cvar_t *vr_use_wheels;
|
||||
char **refresh_names;
|
||||
float *refresh_values;
|
||||
|
||||
enum control_scheme {
|
||||
RIGHT_HANDED_DEFAULT = 0,
|
||||
|
@ -1409,6 +1414,25 @@ void VR_Init()
|
|||
vr_weapon_stabilised = Cvar_Get( "vr_weapon_stabilised", "0.0", CVAR_LATCH);
|
||||
vr_lasersight = Cvar_Get( "vr_lasersight", "0", CVAR_LATCH);
|
||||
vr_comfort_mask = Cvar_Get( "vr_comfort_mask", "0.0", CVAR_ARCHIVE);
|
||||
vr_turn_deadzone = Cvar_Get( "vr_turn_deadzone", "0.2", CVAR_ARCHIVE);
|
||||
vr_framerate = Cvar_Get( "vr_framerate", "0", CVAR_ARCHIVE);
|
||||
vr_use_wheels = Cvar_Get( "vr_use_wheels", "0", CVAR_ARCHIVE);
|
||||
|
||||
//Acquire supported refresh rates to populate options in video menu where framerate is selected
|
||||
|
||||
int refresh_num = vrapi_GetSystemPropertyInt( &java, VRAPI_SYS_PROP_NUM_SUPPORTED_DISPLAY_REFRESH_RATES );
|
||||
float refresh_arr[refresh_num];
|
||||
int total = vrapi_GetSystemPropertyFloatArray( &java, VRAPI_SYS_PROP_SUPPORTED_DISPLAY_REFRESH_RATES, refresh_arr, refresh_num );
|
||||
|
||||
refresh_names = malloc((total+1) * sizeof (char*));
|
||||
refresh_values = malloc((total) * sizeof (float));
|
||||
for (int i = 0; i < total; i++) {
|
||||
refresh_names[i] = malloc(5 * sizeof (char*));
|
||||
sprintf(refresh_names[i],"%.0fHz", refresh_arr[i]);
|
||||
refresh_values[i] = refresh_arr[i];
|
||||
}
|
||||
refresh_names[total] = malloc(5 * sizeof (int));
|
||||
refresh_names[total] = 0;
|
||||
|
||||
//The Engine (which is a derivative of Quake) uses a very specific unit size:
|
||||
//Wolfenstein 3D, DOOM and QUAKE use the same coordinate/unit system:
|
||||
|
@ -1697,6 +1721,10 @@ void * AppThreadFunction( void * parm )
|
|||
}
|
||||
|
||||
ovrSubmitFrameDescription2 frameDesc = { 0 };
|
||||
if(vr_framerate->modified){
|
||||
vrapi_SetDisplayRefreshRate(appState.Ovr, refresh_values[(int)vr_framerate->value]);
|
||||
vr_framerate->modified = false;
|
||||
}
|
||||
if (!useScreenLayer()) {
|
||||
|
||||
ovrLayerProjection2 layer = vrapi_DefaultLayerProjection2();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
extern cvar_t *vr_snapturn_angle;
|
||||
extern cvar_t *vr_turn_deadzone;
|
||||
extern cvar_t *vr_walkdirection;
|
||||
extern cvar_t *vr_weapon_pitchadjust;
|
||||
extern cvar_t *vr_lasersight;
|
||||
|
@ -8,3 +9,7 @@ extern cvar_t *vr_worldscale;
|
|||
extern cvar_t *vr_weaponscale;
|
||||
extern cvar_t *vr_weapon_stabilised;
|
||||
extern cvar_t *vr_comfort_mask;
|
||||
extern cvar_t *vr_framerate;
|
||||
extern cvar_t *vr_use_wheels;
|
||||
extern char **refresh_names;
|
||||
extern float *refresh_values;
|
||||
|
|
|
@ -21,6 +21,11 @@ Authors : Simon Brown
|
|||
extern cvar_t *cl_forwardspeed;
|
||||
cvar_t *sv_cheats;
|
||||
extern cvar_t *vr_weapon_stabilised;
|
||||
extern cvar_t *vr_use_wheels;
|
||||
qboolean draw_item_wheel;
|
||||
qboolean isItems;
|
||||
vec2_t polarCursor;
|
||||
int segment;
|
||||
|
||||
|
||||
|
||||
|
@ -41,6 +46,10 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
uint32_t primaryButtonsOld;
|
||||
uint32_t secondaryButtonsNew;
|
||||
uint32_t secondaryButtonsOld;
|
||||
uint32_t primaryTouchesNew;
|
||||
uint32_t primaryTouchesOld;
|
||||
uint32_t secondaryTouchesNew;
|
||||
uint32_t secondaryTouchesOld;
|
||||
int primaryButton1;
|
||||
int primaryButton2;
|
||||
int secondaryButton1;
|
||||
|
@ -58,6 +67,12 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
secondaryButtonsNew = pDominantTrackedRemoteNew->Buttons;
|
||||
secondaryButtonsOld = pDominantTrackedRemoteOld->Buttons;
|
||||
|
||||
primaryTouchesNew = pDominantTrackedRemoteNew->Touches;
|
||||
primaryTouchesOld = pDominantTrackedRemoteOld->Touches;
|
||||
|
||||
secondaryTouchesNew = pOffTrackedRemoteNew->Touches;
|
||||
secondaryTouchesOld = pOffTrackedRemoteOld->Touches;
|
||||
|
||||
primaryButton1 = offButton1;
|
||||
primaryButton2 = offButton2;
|
||||
secondaryButton1 = domButton1;
|
||||
|
@ -75,6 +90,12 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
secondaryButtonsNew = pOffTrackedRemoteNew->Buttons;
|
||||
secondaryButtonsOld = pOffTrackedRemoteOld->Buttons;
|
||||
|
||||
primaryTouchesNew = pDominantTrackedRemoteNew->Touches;
|
||||
primaryTouchesOld = pDominantTrackedRemoteOld->Touches;
|
||||
|
||||
secondaryTouchesNew = pOffTrackedRemoteNew->Touches;
|
||||
secondaryTouchesOld = pOffTrackedRemoteOld->Touches;
|
||||
|
||||
primaryButton1 = domButton1;
|
||||
primaryButton2 = domButton2;
|
||||
secondaryButton1 = offButton1;
|
||||
|
@ -195,11 +216,103 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
}
|
||||
}
|
||||
|
||||
if ((secondaryButtonsNew & secondaryButton2) !=
|
||||
(secondaryButtonsOld & secondaryButton2))
|
||||
{
|
||||
sendButtonActionSimple("inven");
|
||||
inventoryManagementMode = (secondaryButtonsNew & secondaryButton2) > 0;
|
||||
if(vr_use_wheels->value > 0) {
|
||||
{
|
||||
// weapon selection wheel
|
||||
if ((secondaryButtonsNew & secondaryButton2) !=
|
||||
(secondaryButtonsOld & secondaryButton2)) {
|
||||
sendButtonActionSimple("inven");
|
||||
inventoryManagementMode = (secondaryButtonsNew & secondaryButton2) > 0;
|
||||
}
|
||||
static qboolean active = false;
|
||||
static qboolean touching = false;
|
||||
static qboolean runTouchLogic = false;
|
||||
static int totalIcons;
|
||||
static int t_rel_t;
|
||||
static vec3_t initialAngles;
|
||||
static wheel_icon_t *iconList;
|
||||
ovrTracking *activeController;
|
||||
vec3_t currentAngles;
|
||||
vec2_t relativeAngles;
|
||||
|
||||
if ((primaryTouchesNew & ovrTouch_ThumbRest) &&
|
||||
!(secondaryTouchesNew & ovrTouch_ThumbRest)) {
|
||||
activeController = pDominantTracking; // regardless of handedness or stick assignment, makes sense to use the weapon hand for the weapon wheel
|
||||
iconList = weaponIcons;
|
||||
isItems = false;
|
||||
totalIcons = 11;
|
||||
active = true;
|
||||
} else if ((secondaryTouchesNew & ovrTouch_ThumbRest) &&
|
||||
!(primaryTouchesNew & ovrTouch_ThumbRest)) {
|
||||
activeController = pOffTracking; // conversely, makes sense to use the off hand for the item wheel
|
||||
iconList = itemIcons;
|
||||
isItems = true;
|
||||
totalIcons = 6;
|
||||
active = true;
|
||||
} else {
|
||||
active = false;
|
||||
}
|
||||
if (active) {
|
||||
if (!touching) {
|
||||
draw_item_wheel = true;
|
||||
sendButtonActionSimple(
|
||||
"inven"); // send the "inven" command to force cl.inventory to be populated
|
||||
QuatToYawPitchRoll(activeController->HeadPose.Pose.Orientation, 0.0f,
|
||||
initialAngles);
|
||||
VectorCopy(initialAngles, relativeAngles);
|
||||
touching = true;
|
||||
} else {
|
||||
QuatToYawPitchRoll(activeController->HeadPose.Pose.Orientation, 0.0f,
|
||||
currentAngles);
|
||||
relativeAngles[0] = initialAngles[1] -
|
||||
currentAngles[1]; // relative x -> pitch | Inverted to make right = positive
|
||||
relativeAngles[1] = currentAngles[0] -
|
||||
initialAngles[0]; // relative y -> yaw | to match display coordinates, down = positive
|
||||
polarCursor[0] = sqrtf(
|
||||
powf(relativeAngles[0], 2.0f) +
|
||||
powf(relativeAngles[1], 2.0f)); // r
|
||||
if (polarCursor[0] > 15)
|
||||
polarCursor[0] = 15; // to keep it within the ring
|
||||
polarCursor[1] = atan2f(relativeAngles[1], relativeAngles[0]); // theta
|
||||
segment =
|
||||
(int) (((polarCursor[1] + (M_PI / totalIcons)) + (2.5 * M_PI)) *
|
||||
(totalIcons / (2 * M_PI))) %
|
||||
totalIcons; // Top segment index = 0, clockwise up to 10
|
||||
|
||||
/*float th = M_PI/-2;
|
||||
int r = 160;
|
||||
float factor = M_PI * 2/6;
|
||||
for(int i = 0; i < 6; i++){
|
||||
int x, y;
|
||||
x = r * cosf(th + (i * factor));
|
||||
y = r * sinf(th + (i * factor));
|
||||
ALOGV(" segment %i: x: %i y=%i", i, x, y);
|
||||
}*/ // this snippet generated precalculated coordinates for each icon, relative to the ring center
|
||||
// I'll leave it here in case those values need to be calculated again
|
||||
|
||||
}
|
||||
} else {
|
||||
if (touching) {
|
||||
sendButtonActionSimple(
|
||||
"inven"); // send the "inven" command again to close the inventory
|
||||
touching = false;
|
||||
runTouchLogic = true;
|
||||
t_rel_t = Sys_Milliseconds();
|
||||
if (polarCursor[0] > 8) {
|
||||
char useCom[50];
|
||||
sprintf(useCom, "use %s", iconList[segment].command);
|
||||
sendButtonActionSimple(useCom);
|
||||
}
|
||||
}
|
||||
// give it time for the "inven" commmand to be sent,
|
||||
// preventing the "invisible" inventory window to be shown for a little bit
|
||||
if (runTouchLogic && Sys_Milliseconds() - t_rel_t > 100) {
|
||||
draw_item_wheel = false;
|
||||
runTouchLogic = false;
|
||||
polarCursor[0] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -377,46 +490,44 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
|
|||
pOffTrackedRemoteOld->Buttons,
|
||||
ovrButton_Trigger, K_SHIFT);
|
||||
|
||||
static int increaseSnap = true;
|
||||
if (primaryJoystickNew.x > 0.6f)
|
||||
{
|
||||
if (increaseSnap)
|
||||
{
|
||||
snapTurn -= vr_snapturn_angle->value;
|
||||
if (vr_snapturn_angle->value > 10.0f) {
|
||||
increaseSnap = false;
|
||||
}
|
||||
|
||||
if (snapTurn < -180.0f)
|
||||
static qboolean snapping = true;
|
||||
static float turn_rate;
|
||||
if (vr_snapturn_angle->value > 10.0f){ // snap turning
|
||||
if (primaryJoystickNew.x > 0.6f)
|
||||
{
|
||||
if (snapping)
|
||||
{
|
||||
snapTurn += 360.f;
|
||||
snapTurn -= vr_snapturn_angle->value;
|
||||
snapping = false;
|
||||
|
||||
if (snapTurn < -180.0f)
|
||||
{
|
||||
snapTurn += 360.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (primaryJoystickNew.x < 0.4f) {
|
||||
increaseSnap = true;
|
||||
}
|
||||
|
||||
static int decreaseSnap = true;
|
||||
if (primaryJoystickNew.x < -0.6f)
|
||||
{
|
||||
if (decreaseSnap)
|
||||
{
|
||||
snapTurn += vr_snapturn_angle->value;
|
||||
|
||||
//If snap turn configured for less than 10 degrees
|
||||
if (vr_snapturn_angle->value > 10.0f) {
|
||||
decreaseSnap = false;
|
||||
}
|
||||
|
||||
if (snapTurn > 180.0f)
|
||||
else if (primaryJoystickNew.x < -0.6f)
|
||||
{
|
||||
if (snapping)
|
||||
{
|
||||
snapTurn -= 360.f;
|
||||
snapTurn += vr_snapturn_angle->value;
|
||||
snapping = false;
|
||||
|
||||
if (snapTurn > 180.0f)
|
||||
{
|
||||
snapTurn -= 360.f;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (primaryJoystickNew.x > -0.4f)
|
||||
{
|
||||
decreaseSnap = true;
|
||||
}
|
||||
} else
|
||||
{
|
||||
snapping = true;
|
||||
}
|
||||
}else{ // continuous turning
|
||||
turn_rate = vr_snapturn_angle->value < 1.0f ? 1.0f : vr_snapturn_angle->value;
|
||||
if(fabsf(primaryJoystickNew.x) > vr_turn_deadzone->value) {
|
||||
snapTurn -= (10.0f * primaryJoystickNew.x) / turn_rate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -800,6 +800,8 @@ CL_AddViewWeapon(player_state_t *ps, player_state_t *ops)
|
|||
gun.flags = RF_MINLIGHT | RF_DEPTHHACK | RF_WEAPONMODEL;
|
||||
gun.backlerp = 1.0f - cl.lerpfrac;
|
||||
VectorCopy(gun.origin, gun.oldorigin); /* don't lerp at all */
|
||||
//HACK!
|
||||
CL_UpdateLaserSightOrigins(/*gun.origin*/);
|
||||
V_AddEntity(&gun);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include "header/client.h"
|
||||
|
||||
extern qboolean draw_item_wheel;
|
||||
|
||||
void
|
||||
CL_ParseInventory(void)
|
||||
{
|
||||
|
@ -62,103 +64,103 @@ SetStringHighBit(char *s)
|
|||
void
|
||||
CL_DrawInventory(float separation)
|
||||
{
|
||||
int i, j;
|
||||
int num, selected_num, item;
|
||||
int index[MAX_ITEMS];
|
||||
char string[1024];
|
||||
int x, y;
|
||||
char binding[1024];
|
||||
const char *bind;
|
||||
int selected;
|
||||
int top;
|
||||
if(!draw_item_wheel) { // do not draw if weapon wheel is being drawn
|
||||
Com_Printf("qiqiqiqi inventory drawn at %i", Sys_Milliseconds());
|
||||
int i, j;
|
||||
int num, selected_num, item;
|
||||
int index[MAX_ITEMS];
|
||||
char string[1024];
|
||||
int x, y;
|
||||
char binding[1024];
|
||||
const char *bind;
|
||||
int selected;
|
||||
int top;
|
||||
|
||||
selected = cl.frame.playerstate.stats[STAT_SELECTED_ITEM];
|
||||
selected = cl.frame.playerstate.stats[STAT_SELECTED_ITEM];
|
||||
|
||||
int offset_stereo= (separation>0) ? -25 : 25;
|
||||
num = 0;
|
||||
selected_num = 0;
|
||||
int offset_stereo = (separation > 0) ? -25 : 25;
|
||||
num = 0;
|
||||
selected_num = 0;
|
||||
|
||||
float scale = SCR_GetHUDScale();
|
||||
float scale = SCR_GetHUDScale();
|
||||
|
||||
for (i = 0; i < MAX_ITEMS; i++)
|
||||
{
|
||||
if (i == selected)
|
||||
{
|
||||
selected_num = num;
|
||||
}
|
||||
for (i = 0; i < MAX_ITEMS; i++)
|
||||
{
|
||||
if (i == selected) {
|
||||
selected_num = num;
|
||||
}
|
||||
|
||||
if (cl.inventory[i])
|
||||
{
|
||||
index[num] = i;
|
||||
num++;
|
||||
}
|
||||
}
|
||||
if (cl.inventory[i]) {
|
||||
index[num] = i;
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
/* determine scroll point */
|
||||
top = selected_num - DISPLAY_ITEMS / 2;
|
||||
/* determine scroll point */
|
||||
top = selected_num - DISPLAY_ITEMS / 2;
|
||||
|
||||
if (num - top < DISPLAY_ITEMS)
|
||||
{
|
||||
top = num - DISPLAY_ITEMS;
|
||||
}
|
||||
if (num - top < DISPLAY_ITEMS)
|
||||
{
|
||||
top = num - DISPLAY_ITEMS;
|
||||
}
|
||||
|
||||
if (top < 0)
|
||||
{
|
||||
top = 0;
|
||||
}
|
||||
if (top < 0)
|
||||
{
|
||||
top = 0;
|
||||
}
|
||||
|
||||
x = (viddef.width - scale*256) / 2;
|
||||
y = viddef.height/2;
|
||||
x = (viddef.width - scale * 256) / 2;
|
||||
y = viddef.height / 2;
|
||||
|
||||
/* repaint everything next frame */
|
||||
SCR_DirtyScreen();
|
||||
/* repaint everything next frame */
|
||||
SCR_DirtyScreen();
|
||||
|
||||
Draw_PicScaled(x+offset_stereo, y + scale*8, "inventory", scale);
|
||||
Draw_PicScaled(x + offset_stereo, y + scale * 8, "inventory", scale);
|
||||
|
||||
y += scale*24;
|
||||
x += scale*24;
|
||||
y += scale * 24;
|
||||
x += scale * 24;
|
||||
|
||||
//Inv_DrawStringScaled(x, y, "hotkey ### item", scale);
|
||||
//Inv_DrawStringScaled(x, y + scale*8, "------ --- ----", scale);
|
||||
//Inv_DrawStringScaled(x, y, "hotkey ### item", scale);
|
||||
//Inv_DrawStringScaled(x, y + scale*8, "------ --- ----", scale);
|
||||
|
||||
y += scale*16;
|
||||
y += scale * 16;
|
||||
|
||||
for (i = top; i < num && i < top + DISPLAY_ITEMS; i++)
|
||||
{
|
||||
item = index[i];
|
||||
/* search for a binding */
|
||||
Com_sprintf(binding, sizeof(binding), "use %s",
|
||||
cl.configstrings[CS_ITEMS + item]);
|
||||
bind = "";
|
||||
for (i = top; i < num && i < top + DISPLAY_ITEMS; i++)
|
||||
{
|
||||
item = index[i];
|
||||
/* search for a binding */
|
||||
Com_sprintf(binding, sizeof(binding), "use %s",
|
||||
cl.configstrings[CS_ITEMS + item]);
|
||||
bind = "";
|
||||
|
||||
/*for (j = 0; j < 256; j++)
|
||||
{
|
||||
if (keybindings[j] && !Q_stricmp(keybindings[j], binding))
|
||||
{
|
||||
bind = Key_KeynumToString(j);
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
/*for (j = 0; j < 256; j++)
|
||||
{
|
||||
if (keybindings[j] && !Q_stricmp(keybindings[j], binding))
|
||||
{
|
||||
bind = Key_KeynumToString(j);
|
||||
break;
|
||||
}
|
||||
}*/
|
||||
|
||||
Com_sprintf(string, sizeof(string), "%6s %3i %s", bind,
|
||||
cl.inventory[item], cl.configstrings[CS_ITEMS + item]);
|
||||
Com_sprintf(string, sizeof(string), "%6s %3i %s", bind,
|
||||
cl.inventory[item], cl.configstrings[CS_ITEMS + item]);
|
||||
|
||||
if (item != selected)
|
||||
{
|
||||
SetStringHighBit(string);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* draw a blinky cursor by the selected item */
|
||||
if ((int)(cls.realtime * 10) & 1)
|
||||
{
|
||||
Draw_CharScaled(x + offset_stereo - scale*8, y, 15, scale);
|
||||
}
|
||||
}
|
||||
if (item != selected)
|
||||
{
|
||||
SetStringHighBit(string);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* draw a blinky cursor by the selected item */
|
||||
if ((int) (cls.realtime * 10) & 1) {
|
||||
Draw_CharScaled(x + offset_stereo - scale * 8, y, 15, scale);
|
||||
}
|
||||
}
|
||||
|
||||
Inv_DrawStringScaled(x+offset_stereo, y, string, scale);
|
||||
Inv_DrawStringScaled(x + offset_stereo, y, string, scale);
|
||||
|
||||
y += scale*8;
|
||||
}
|
||||
y += scale * 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -799,10 +799,6 @@ CL_BeginFrame(int packetdelta, int renderdelta, int timedelta, qboolean packetfr
|
|||
VID_CheckChanges();
|
||||
CL_PredictMovement();
|
||||
|
||||
|
||||
//HACK!
|
||||
CL_UpdateLaserSightOrigins();
|
||||
|
||||
if (!cl.refresh_prepped && (cls.state == ca_active)) {
|
||||
CL_PrepRefresh();
|
||||
}
|
||||
|
|
|
@ -72,6 +72,165 @@ extern cvar_t *crosshair_scale;
|
|||
void SCR_TimeRefresh_f(void);
|
||||
void SCR_Loading_f(void);
|
||||
|
||||
const wheel_icon_t weaponIcons[11] = {
|
||||
{
|
||||
"w_blaster",
|
||||
7,
|
||||
"Blaster",
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
-160
|
||||
},
|
||||
{
|
||||
"w_shotgun",
|
||||
8,
|
||||
"Shotgun",
|
||||
"shells",
|
||||
18,
|
||||
86,
|
||||
-134
|
||||
},
|
||||
{
|
||||
"w_sshotgun",
|
||||
9,
|
||||
"Super Shotgun",
|
||||
"shells",
|
||||
18,
|
||||
145,
|
||||
-66
|
||||
},
|
||||
{
|
||||
"w_machinegun",
|
||||
10,
|
||||
"Machinegun",
|
||||
"bullets",
|
||||
19,
|
||||
158,
|
||||
22
|
||||
},
|
||||
{
|
||||
"w_chaingun",
|
||||
11,
|
||||
"Chaingun",
|
||||
"bullets",
|
||||
19,
|
||||
120,
|
||||
104
|
||||
},
|
||||
{
|
||||
"w_grenades",
|
||||
12,
|
||||
"Grenades",
|
||||
"grenades",
|
||||
12,
|
||||
45,
|
||||
153
|
||||
},
|
||||
{
|
||||
"w_glauncher",
|
||||
13,
|
||||
"Grenade Launcher",
|
||||
"grenades",
|
||||
12,
|
||||
-45,
|
||||
153
|
||||
},
|
||||
{
|
||||
"w_rlauncher",
|
||||
14,
|
||||
"Rocket Launcher",
|
||||
"rockets",
|
||||
21,
|
||||
-120,
|
||||
104
|
||||
},
|
||||
{
|
||||
"w_hyperblaster",
|
||||
15,
|
||||
"HyperBlaster",
|
||||
"cells",
|
||||
20,
|
||||
-158,
|
||||
22
|
||||
},
|
||||
{
|
||||
"w_railgun",
|
||||
16,
|
||||
"Railgun",
|
||||
"slugs",
|
||||
22,
|
||||
-145,
|
||||
-66
|
||||
},
|
||||
{
|
||||
"w_bfg",
|
||||
17,
|
||||
"BFG10K",
|
||||
"cells",
|
||||
20,
|
||||
-86,
|
||||
-134
|
||||
}
|
||||
};
|
||||
|
||||
const wheel_icon_t itemIcons[6] = {
|
||||
{
|
||||
"p_silencer",
|
||||
25,
|
||||
"Silencer",
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
-160
|
||||
},
|
||||
{
|
||||
"p_rebreather",
|
||||
26,
|
||||
"Rebreather",
|
||||
NULL,
|
||||
0,
|
||||
138,
|
||||
-80
|
||||
},
|
||||
{
|
||||
"p_envirosuit",
|
||||
27,
|
||||
"Environment Suit",
|
||||
NULL,
|
||||
0,
|
||||
138,
|
||||
80
|
||||
},
|
||||
{
|
||||
"i_powershield",
|
||||
6,
|
||||
"Power Shield",
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
160
|
||||
},
|
||||
{
|
||||
"p_quad",
|
||||
23,
|
||||
"Quad Damage",
|
||||
NULL,
|
||||
0,
|
||||
-138,
|
||||
80
|
||||
},
|
||||
{
|
||||
"p_invulnerability",
|
||||
24,
|
||||
"Invulnerability",
|
||||
NULL,
|
||||
0,
|
||||
-138,
|
||||
-80
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* A new packet was just parsed
|
||||
*/
|
||||
|
@ -516,6 +675,99 @@ void SCR_DrawVignette (void)
|
|||
}
|
||||
}
|
||||
|
||||
extern qboolean draw_item_wheel;
|
||||
extern qboolean isItems;
|
||||
extern vec2_t polarCursor;
|
||||
extern int segment;
|
||||
static float cursorFactor = 200/15; // 200 is the radius of the ring image
|
||||
// 15 is the same radius in VR scale
|
||||
|
||||
void
|
||||
DrawNumberCenteredImageScaled(int x, int y, char* num, float scale)
|
||||
{
|
||||
int len = strlen(num);
|
||||
int width = 8; // half of img width
|
||||
int height = 12; // half of img height
|
||||
for(int i = 0; i < len; i++){
|
||||
char image[6];
|
||||
sprintf(image, "num_%c", num[i]);
|
||||
float offset = width * ((i * 2) - (len));
|
||||
Draw_PicScaled(x + offset, y - (height * scale), image,
|
||||
scale);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SCR_DrawItemWheel (float separation)
|
||||
{
|
||||
int totalIcons;
|
||||
wheel_icon_t* iconlist;
|
||||
if(!isItems) {
|
||||
totalIcons = 11;
|
||||
iconlist = weaponIcons;
|
||||
} else {
|
||||
totalIcons = 6;
|
||||
iconlist = itemIcons;
|
||||
}
|
||||
if(draw_item_wheel) {
|
||||
int offset_stereo = (separation>0) ? -25 : 25;
|
||||
int ringw, ringh;
|
||||
int curw, curh;
|
||||
int vidwc = (viddef.width/2);
|
||||
int vidhc = (viddef.height/2);
|
||||
Draw_GetPicSize(&ringw, &ringh,"/wheel/ring.png");
|
||||
Draw_PicScaled((vidwc - (ringw/2)) + offset_stereo, (vidhc - (ringh/2)), "/wheel/ring.png", 1.0f);
|
||||
Draw_GetPicSize(&curw, &curh,"/wheel/cursor.png");
|
||||
Draw_PicScaled((vidwc - (curw/2)) + ((polarCursor[0] * cosf(polarCursor[1])) * cursorFactor) + offset_stereo,
|
||||
(vidwc - (curh/2)) + ((polarCursor[0] * sinf(polarCursor[1])) * cursorFactor),
|
||||
"/wheel/cursor.png", 1.0f);
|
||||
|
||||
for(int i = 0; i < totalIcons; i++)
|
||||
{
|
||||
if(cl.inventory[iconlist[i].index])
|
||||
{ // if weapon is available in inventory
|
||||
char iconName[40];
|
||||
char ammoName[30];
|
||||
char ammoAmount[4];
|
||||
float iconFactor;
|
||||
float ammoFactor = 4.0f;
|
||||
int iconWidth = 12; // actually half of icon size. For centering purposes
|
||||
if (i == segment && polarCursor[0] > 8)
|
||||
{ // if cursor is inside the segment corresponding to the item
|
||||
iconFactor = 2.5f;
|
||||
DrawStringScaled(vidwc + offset_stereo - (strlen(iconlist[i].command) * 4),
|
||||
vidhc - 100,
|
||||
iconlist[i].command, 1.0f); // Item name
|
||||
sprintf(iconName, "/wheel/%s_selected.png", iconlist[i].name); // selected icon path
|
||||
Draw_PicScaled(vidwc + iconlist[i].x - (iconWidth * iconFactor) + (offset_stereo * 1.3f),
|
||||
vidhc + iconlist[i].y - (iconWidth * iconFactor), iconName,
|
||||
iconFactor);
|
||||
if(iconlist[i].ammo) {
|
||||
sprintf(ammoAmount, "%i", cl.inventory[iconlist[i].ammo_i]);
|
||||
DrawNumberCenteredImageScaled(vidwc + offset_stereo, vidhc + 100,
|
||||
ammoAmount,
|
||||
1.0f); // ammo amount in image numbers
|
||||
sprintf(ammoName, "/wheel/a_%s.png", iconlist[i].ammo); // ammo icon path
|
||||
Draw_PicScaled(vidwc - (iconWidth * ammoFactor) +
|
||||
offset_stereo, // ammo icon for the weapon
|
||||
vidhc - (iconWidth * ammoFactor), ammoName,
|
||||
ammoFactor);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iconFactor = 1.5f;
|
||||
sprintf(iconName, "/wheel/%s.png", iconlist[i].name);
|
||||
Draw_PicScaled(vidwc + iconlist[i].x - (iconWidth * iconFactor) + (offset_stereo),
|
||||
vidhc + iconlist[i].y - (iconWidth * iconFactor), iconName,
|
||||
iconFactor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SCR_DrawLoading(void)
|
||||
{
|
||||
|
@ -1647,6 +1899,8 @@ void SCR_UpdateForEye (int eye)
|
|||
CL_DrawInventory(separation);
|
||||
}
|
||||
|
||||
SCR_DrawItemWheel(separation);
|
||||
|
||||
SCR_DrawNet();
|
||||
SCR_CheckDrawCenterString();
|
||||
|
||||
|
|
|
@ -538,6 +538,8 @@ trace_t CL_Trace (vec3_t start, vec3_t end, float size, int contentmask)
|
|||
|
||||
extern vec3_t weaponangles;
|
||||
extern vec3_t weaponoffset;
|
||||
extern vec3_t hmdPosition;
|
||||
extern cvar_t *vr_height_adjust;
|
||||
|
||||
void CL_UpdateLaserSightOrigins ()
|
||||
{
|
||||
|
@ -548,6 +550,8 @@ void CL_UpdateLaserSightOrigins ()
|
|||
|
||||
//At the point of calling this, the vieworg should already have the player height included
|
||||
convertFromVRtoQ2(weaponoffset, cl.refdef.vieworg, gunorigin);
|
||||
gunorigin[2] -= (QUAKE_MARINE_HEIGHT * vr_worldscale->value);
|
||||
gunorigin[2] += ((hmdPosition[1] + vr_height_adjust->value) * vr_worldscale->value);
|
||||
//gunorigin[2] += 1; // just add a little bit
|
||||
AngleVectors(weaponangles, forward, right, NULL);
|
||||
|
||||
|
|
|
@ -319,6 +319,20 @@ extern entity_state_t cl_parse_entities[MAX_PARSE_ENTITIES];
|
|||
extern netadr_t net_from;
|
||||
extern sizebuf_t net_message;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char* name; // segment for matching icon file
|
||||
const int index; // index in inventory
|
||||
const char* command; // command triggered when icon is selected. Also display name
|
||||
const char* ammo; // weapons only. type of ammo used by this weapon
|
||||
const int ammo_i; // weapons only. index of ammo amount in inventory
|
||||
const int x; // h offset from center of selection wheel
|
||||
const int y; // v offset from center of selection wheel
|
||||
} wheel_icon_t;
|
||||
|
||||
extern const wheel_icon_t weaponIcons[];
|
||||
extern const wheel_icon_t itemIcons[];
|
||||
|
||||
void DrawString (int x, int y, char *s);
|
||||
void DrawStringScaled(int x, int y, char *s, float factor);
|
||||
void DrawAltString (int x, int y, char *s); /* toggle high bit */
|
||||
|
|
|
@ -1066,6 +1066,7 @@ static menuslider_s s_options_oggvolume_slider;
|
|||
static menulist_s s_options_oggenable_box;
|
||||
static menulist_s s_options_quality_list;
|
||||
static menulist_s s_options_console_action;
|
||||
static menulist_s s_options_enable_item_wheels;
|
||||
|
||||
static void
|
||||
CrosshairFunc(void *unused)
|
||||
|
@ -1091,6 +1092,12 @@ AlwaysRunFunc(void *unused)
|
|||
Cvar_SetValue("cl_run", (float)s_options_alwaysrun_box.curvalue);
|
||||
}
|
||||
|
||||
static void
|
||||
EnableWheels(void *unused)
|
||||
{
|
||||
Cvar_SetValue("vr_use_wheels", (float)s_options_enable_item_wheels.curvalue);
|
||||
}
|
||||
|
||||
static void
|
||||
HeightAdjustFunc(void *unused)
|
||||
{
|
||||
|
@ -1134,6 +1141,7 @@ ControlsSetMenuItemValues(void)
|
|||
s_options_vr_height_adjust_box.curvalue = vr_height_adjust->value * 10.0f;
|
||||
s_options_crosshair_box.curvalue = ClampCvar(0, 3, crosshair->value);
|
||||
s_options_haptic_slider.curvalue = Cvar_VariableValue("joy_haptic_magnitude") * 10.0F;
|
||||
s_options_enable_item_wheels.curvalue = (int)vr_use_wheels->value;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1303,6 +1311,13 @@ Options_MenuInit(void)
|
|||
0
|
||||
};
|
||||
|
||||
static const char *yesno_thumbrest_wheels[] =
|
||||
{
|
||||
"no",
|
||||
"yes",
|
||||
0
|
||||
};
|
||||
|
||||
static const char *crosshair_names[] =
|
||||
{
|
||||
"none",
|
||||
|
@ -1407,6 +1422,13 @@ Options_MenuInit(void)
|
|||
s_options_vr_height_adjust_box.minvalue = 0;
|
||||
s_options_vr_height_adjust_box.maxvalue = 10;
|
||||
|
||||
s_options_enable_item_wheels.generic.type = MTYPE_SPINCONTROL;
|
||||
s_options_enable_item_wheels.generic.x = 0;
|
||||
s_options_enable_item_wheels.generic.y = 110;
|
||||
s_options_enable_item_wheels.generic.name = "Enable item wheels (Quest only)";
|
||||
s_options_enable_item_wheels.generic.callback = EnableWheels;
|
||||
s_options_enable_item_wheels.itemnames = yesno_thumbrest_wheels;
|
||||
|
||||
s_options_crosshair_box.generic.type = MTYPE_SPINCONTROL;
|
||||
s_options_crosshair_box.generic.x = 0;
|
||||
s_options_crosshair_box.generic.y = 110;
|
||||
|
@ -1457,7 +1479,7 @@ Options_MenuInit(void)
|
|||
|
||||
// if (show_haptic)
|
||||
// Menu_AddItem(&s_options_menu, (void *)&s_options_haptic_slider);
|
||||
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_enable_item_wheels);
|
||||
// Menu_AddItem(&s_options_menu, (void *)&s_options_customize_options_action);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_defaults_action);
|
||||
Menu_AddItem(&s_options_menu, (void *)&s_options_console_action);
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
#include "../../client/header/client.h"
|
||||
#include "../../client/menu/header/qmenu.h"
|
||||
#include "header/qmenu.h"
|
||||
#include "../../../../Quake2VR/VrCvars.h"
|
||||
|
||||
extern void M_ForceMenuOff(void);
|
||||
|
@ -53,6 +52,7 @@ static menulist_s s_uiscale_list;
|
|||
static menuslider_s s_brightness_slider;
|
||||
static menuslider_s s_comfort_slider;
|
||||
static menulist_s s_fs_box;
|
||||
static menulist_s s_refresh_rate;
|
||||
static menulist_s s_vsync_list;
|
||||
static menulist_s s_af_list;
|
||||
static menulist_s s_msaa_list;
|
||||
|
@ -242,6 +242,8 @@ ApplyChanges(void *unused)
|
|||
}
|
||||
}
|
||||
|
||||
Cvar_SetValue("vr_framerate", (float)s_refresh_rate.curvalue);
|
||||
|
||||
if (restart)
|
||||
{
|
||||
Cbuf_AddText("vid_restart\n");
|
||||
|
@ -481,6 +483,13 @@ VID_MenuInit(void)
|
|||
s_fs_box.itemnames = fullscreen_names;
|
||||
s_fs_box.curvalue = (int)vid_fullscreen->value;
|
||||
|
||||
s_refresh_rate.generic.type = MTYPE_SPINCONTROL;
|
||||
s_refresh_rate.generic.name = "refresh rate";
|
||||
s_refresh_rate.generic.x = 0;
|
||||
s_refresh_rate.generic.y = (y += 10);
|
||||
s_refresh_rate.itemnames = (const char **) refresh_names;
|
||||
s_refresh_rate.curvalue = (int)vr_framerate->value;
|
||||
|
||||
s_vsync_list.generic.type = MTYPE_SPINCONTROL;
|
||||
s_vsync_list.generic.name = "vertical sync";
|
||||
s_vsync_list.generic.x = 0;
|
||||
|
@ -539,6 +548,7 @@ VID_MenuInit(void)
|
|||
Menu_AddItem(&s_opengl_menu, (void *)&s_comfort_slider);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_uiscale_list);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_fs_box);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_refresh_rate);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_vsync_list);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_af_list);
|
||||
Menu_AddItem(&s_opengl_menu, (void *)&s_msaa_list);
|
||||
|
|
BIN
assets/wheel/a_bullets.png
Normal file
After Width: | Height: | Size: 695 B |
BIN
assets/wheel/a_cells.png
Normal file
After Width: | Height: | Size: 709 B |
BIN
assets/wheel/a_grenades.png
Normal file
After Width: | Height: | Size: 732 B |
BIN
assets/wheel/a_rockets.png
Normal file
After Width: | Height: | Size: 731 B |
BIN
assets/wheel/a_shells.png
Normal file
After Width: | Height: | Size: 703 B |
BIN
assets/wheel/a_slugs.png
Normal file
After Width: | Height: | Size: 794 B |
BIN
assets/wheel/cursor.png
Normal file
After Width: | Height: | Size: 197 B |
BIN
assets/wheel/i_powershield.png
Normal file
After Width: | Height: | Size: 909 B |
BIN
assets/wheel/i_powershield_selected.png
Normal file
After Width: | Height: | Size: 1,015 B |
BIN
assets/wheel/p_envirosuit.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/wheel/p_envirosuit_selected.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/wheel/p_invulnerability.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/wheel/p_invulnerability_selected.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/wheel/p_quad.png
Normal file
After Width: | Height: | Size: 606 B |
BIN
assets/wheel/p_quad_selected.png
Normal file
After Width: | Height: | Size: 546 B |
BIN
assets/wheel/p_rebreather.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
assets/wheel/p_rebreather_selected.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
assets/wheel/p_silencer.png
Normal file
After Width: | Height: | Size: 871 B |
BIN
assets/wheel/p_silencer_selected.png
Normal file
After Width: | Height: | Size: 937 B |
BIN
assets/wheel/ring.png
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
assets/wheel/w_bfg.png
Normal file
After Width: | Height: | Size: 869 B |
BIN
assets/wheel/w_bfg_selected.png
Normal file
After Width: | Height: | Size: 965 B |
BIN
assets/wheel/w_blaster.png
Normal file
After Width: | Height: | Size: 502 B |
BIN
assets/wheel/w_blaster_selected.png
Normal file
After Width: | Height: | Size: 535 B |
BIN
assets/wheel/w_chaingun.png
Normal file
After Width: | Height: | Size: 698 B |
BIN
assets/wheel/w_chaingun_selected.png
Normal file
After Width: | Height: | Size: 781 B |
BIN
assets/wheel/w_glauncher.png
Normal file
After Width: | Height: | Size: 708 B |
BIN
assets/wheel/w_glauncher_selected.png
Normal file
After Width: | Height: | Size: 812 B |
BIN
assets/wheel/w_grenades.png
Normal file
After Width: | Height: | Size: 732 B |
BIN
assets/wheel/w_grenades_selected.png
Normal file
After Width: | Height: | Size: 788 B |
BIN
assets/wheel/w_hyperblaster.png
Normal file
After Width: | Height: | Size: 742 B |
BIN
assets/wheel/w_hyperblaster_selected.png
Normal file
After Width: | Height: | Size: 827 B |
BIN
assets/wheel/w_machinegun.png
Normal file
After Width: | Height: | Size: 774 B |
BIN
assets/wheel/w_machinegun_selected.png
Normal file
After Width: | Height: | Size: 893 B |
BIN
assets/wheel/w_railgun.png
Normal file
After Width: | Height: | Size: 925 B |
BIN
assets/wheel/w_railgun_selected.png
Normal file
After Width: | Height: | Size: 1 KiB |
BIN
assets/wheel/w_rlauncher.png
Normal file
After Width: | Height: | Size: 857 B |
BIN
assets/wheel/w_rlauncher_selected.png
Normal file
After Width: | Height: | Size: 983 B |
BIN
assets/wheel/w_shotgun.png
Normal file
After Width: | Height: | Size: 757 B |
BIN
assets/wheel/w_shotgun_selected.png
Normal file
After Width: | Height: | Size: 874 B |
BIN
assets/wheel/w_sshotgun.png
Normal file
After Width: | Height: | Size: 813 B |
BIN
assets/wheel/w_sshotgun_selected.png
Normal file
After Width: | Height: | Size: 939 B |
|
@ -161,6 +161,15 @@ import static android.system.Os.setenv;
|
|||
|
||||
public void create()
|
||||
{
|
||||
try {
|
||||
AssetManager assets = this.getAssets();
|
||||
String[] assetList = assets.list("wheel");
|
||||
for(String filename: assetList){
|
||||
Log.v("Assets", "qfqfqfqf Filename: " + filename);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
//throw new RuntimeException(e);
|
||||
}
|
||||
//This will copy the shareware version of quake2 if user doesn't have anything installed
|
||||
copy_asset("/sdcard/Quake2Quest", "pak0.pak");
|
||||
|
||||
|
@ -178,6 +187,17 @@ import static android.system.Os.setenv;
|
|||
//Comfort Vignette Mask
|
||||
copy_asset("/sdcard/Quake2Quest", "vignette.tga");
|
||||
|
||||
//item wheel files
|
||||
try {
|
||||
AssetManager assets = this.getAssets();
|
||||
String[] assetList = assets.list("wheel");
|
||||
for(String filename: assetList){
|
||||
copy_asset("/sdcard/Quake2Quest", "wheel/" + filename);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
//Read these from a file and pass through
|
||||
commandLineParams = new String("quake2");
|
||||
|
||||
|
|