Quick Save/Load in Selector

Haven't been able to test yet!
This commit is contained in:
Simon 2023-04-10 19:42:06 +01:00
parent a6318867bb
commit a2ff16b576
12 changed files with 155 additions and 201 deletions

View file

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

View file

@ -626,35 +626,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
}
}
// Calculate if player tries to reach backpack
bool handInBackpack = false;
bool bpDistToHMDOk = false, bpWeaponHeightOk = false, bpWeaponAngleOk = false, bpHmdToWeaponAngleOk = false;
vec3_t hmdForwardXY = {}, weaponForwardXY = {};
float weaponToDownAngle = 0, hmdToWeaponDotProduct = 0;
static vec3_t downVector = {0.0, 0.0, -1.0};
if ((bpDistToHMDOk = distanceToHMD >= 0.2 && distanceToHMD <=
0.35) // 2) Weapon-to-HMD distance must be within <0.2-0.35> range
&& (bpWeaponHeightOk = vr.weaponoffset[1] >= -0.10 && vr.weaponoffset[1] <=
0.10)) // 3) Weapon height in relation to HMD must be within <-0.10, 0.10> range
{
AngleVectors(vr.hmdorientation, hmdForwardXY, NULL, NULL);
AngleVectors(vr.weaponangles[ANGLES_ADJUSTED], weaponForwardXY, NULL, NULL);
float weaponToDownAngle = AngleBetweenVectors(downVector, weaponForwardXY);
// 4) Angle between weapon forward vector and a down vector must be within 80-140 degrees
if (bpWeaponAngleOk = weaponToDownAngle >= 80.0 && weaponToDownAngle <= 140.0) {
hmdForwardXY[2] = 0;
VectorNormalize(hmdForwardXY);
weaponForwardXY[2] = 0;
VectorNormalize(weaponForwardXY);
hmdToWeaponDotProduct = DotProduct(hmdForwardXY, weaponForwardXY);
// 5) HMD and weapon forward on XY plane must go in opposite directions (i.e. dot product < 0)
handInBackpack = bpHmdToWeaponAngleOk = hmdToWeaponDotProduct < 0;
}
}
//off-hand stuff (done here as I reference it in the save state thing
{
@ -677,86 +648,6 @@ void HandleInput_Default( ovrInputStateTrackedRemote *pDominantTrackedRemoteNew,
}
}
// Use off hand as well to trigger save condition
canUseQuickSave = false;
bool bpOffhandDistToHMDOk = false, bpOffhandHeightOk = false, bpOffhandAngleOk = false, bpHmdToOffhandAngleOk = false;
vec3_t offhandForwardXY = {};
float hmdToOffhandDotProduct = 0;
float offhandToDownAngle = 0;
if ((bpOffhandDistToHMDOk = distanceToHMDOff >= 0.2 &&
distanceToHMDOff <=
0.35) // 2) Off-to-HMD distance must be within <0.2-0.35> range
&& (bpOffhandHeightOk = vr.offhandoffset[1] >= -0.10 && vr.offhandoffset[1] <=
0.10)) // 3) Offhand height in relation to HMD must be within <-0.10, 0.10> range
{
//Need to do this again as might not have done it above and cant be bothered to refactor
AngleVectors(vr.hmdorientation, hmdForwardXY, NULL, NULL);
AngleVectors(vr.offhandangles[ANGLES_ADJUSTED], offhandForwardXY, NULL, NULL);
offhandToDownAngle = AngleBetweenVectors(downVector, offhandForwardXY);
// 4) Angle between weapon forward vector and a down vector must be within 80-140 degrees
if (bpOffhandAngleOk =
offhandToDownAngle >= 80.0 && offhandToDownAngle <= 140.0) {
hmdForwardXY[2] = 0;
VectorNormalize(hmdForwardXY);
offhandForwardXY[2] = 0;
VectorNormalize(offhandForwardXY);
hmdToOffhandDotProduct = DotProduct(hmdForwardXY, offhandForwardXY);
// 5) HMD and weapon forward on XY plane must go in opposite directions (i.e. dot product < 0)
canUseQuickSave = bpHmdToOffhandAngleOk = hmdToOffhandDotProduct < 0;
}
}
// Uncomment to debug offhand reaching
/* ALOGV("Quick Save> Dist: %f | OffHandToDownAngle: %f | HandOffs: %f %f %f\nHmdHandDot: %f | HmdFwdXY: %f %f | WpnFwdXY: %f %f\nTrackOk: %i, DistOk: %i, HeightOk: %i, HnadAngleOk: %i, HmdHandDotOk: %i",
distanceToHMDOff, offhandToDownAngle, vr.offhandoffset[0],
vr.offhandoffset[1], vr.offhandoffset[2],
hmdToOffhandDotProduct, hmdForwardXY[0], hmdForwardXY[1], offhandForwardXY[0],
offhandForwardXY[1],
bpTrackOk, bpOffhandDistToHMDOk, bpOffhandHeightOk, bpOffhandAngleOk,
bpHmdToOffhandAngleOk);
*/
// Check quicksave
static bool indicateQuickSave = true;
if (canUseQuickSave) {
//GB Fix buzzing left controller not right
int channel = (vr_control_scheme->integer >= 10) ? 1 : 2;
if (indicateQuickSave)
{
TBXR_Vibrate(40, channel, 0.5); // vibrate to let user know they can switch
indicateQuickSave = false;
}
if (((secondaryButtonsNew & secondaryButton1) !=
(secondaryButtonsOld & secondaryButton1)) &&
(secondaryButtonsNew & secondaryButton1)) {
#ifdef JK2_MODE
sendButtonActionSimple("save quik*");
#else
sendButtonActionSimple("save quick");
#endif
}
if (((secondaryButtonsNew & secondaryButton2) !=
(secondaryButtonsOld & secondaryButton2)) &&
(secondaryButtonsNew & secondaryButton2)) {
#ifdef JK2_MODE
sendButtonActionSimple("load quik");
#else
sendButtonActionSimple("load quick");
#endif
}
}
else
{
//Next time we can quick save, allow a haptic blip
indicateQuickSave = true;
}
}
//Right-hand specific stuff

View file

@ -1453,6 +1453,9 @@ static void CG_RegisterGraphics( void ) {
cgs.media.iconMoveSpeed[1] = cgi_R_RegisterShaderNoMip( "gfx/icon_full" );
cgs.media.iconMoveSpeed[2] = cgi_R_RegisterShaderNoMip( "gfx/icon_walk" );
cgs.media.iconSave = cgi_R_RegisterShaderNoMip( "gfx/icon_save" );
cgs.media.iconLoad = cgi_R_RegisterShaderNoMip( "gfx/icon_load" );
// FIXME: do these conditionally
cgi_R_RegisterShader( "gfx/2d/workingCamera" );
cgi_R_RegisterShader( "gfx/2d/brokenCamera" );

View file

@ -148,6 +148,9 @@ typedef struct {
qhandle_t iconMoveSpeed[3];
qhandle_t iconSave;
qhandle_t iconLoad;
//Chunks
qhandle_t chunkModels[NUM_CHUNK_TYPES][4];
sfxHandle_t chunkSound;

View file

@ -2880,12 +2880,12 @@ void CG_ItemSelectorSelect_f( void )
cg.itemSelectorTime = 0;
cgi_Cvar_Set("timescale", "1.0");
if (cg.itemSelectorSelection == -1)
if (cg.itemSelectorSelection == ST_NONE)
{
return;
}
if (cg.itemSelectorType == 0) // weapons
if (cg.itemSelectorType == ST_WEAPON) // weapons
{
if (cg.weaponSelect == cg.itemSelectorSelection)
{
@ -2895,7 +2895,7 @@ void CG_ItemSelectorSelect_f( void )
cg.weaponSelectTime = cg.time;
cg.weaponSelect = cg.itemSelectorSelection;
}
else if (cg.itemSelectorType == 1) // gadgets
else if (cg.itemSelectorType == ST_GADGET) // gadgets
{
cg.inventorySelectTime = cg.time;
cg.inventorySelect = cg.itemSelectorSelection;
@ -2906,11 +2906,11 @@ void CG_ItemSelectorSelect_f( void )
Cmd_UseInventory_f(player);
}
}
else if (cg.itemSelectorType == 2) //fighting style
else if (cg.itemSelectorType == ST_FIGHTING_STYLE) //fighting style
{
cgi_SendConsoleCommand(va( "setSaberLevel %i\n", cg.itemSelectorSelection + 1));
}
else // 3 - force powers
else if (cg.itemSelectorType == ST_FORCE_POWER)
{
if (cg.forcepowerSelect == cg.itemSelectorSelection)
{
@ -2920,15 +2920,24 @@ void CG_ItemSelectorSelect_f( void )
cg.forcepowerSelectTime = cg.time;
cg.forcepowerSelect = cg.itemSelectorSelection;
}
else if (cg.itemSelectorType == ST_QUICK_SAVE) {
if (cg.itemSelectorSelection == 0) {
cgi_SendConsoleCommand("save quick\n");
CG_CenterPrint("Quick Saved", 240);
} else {
cgi_SendConsoleCommand("load quick\n");
}
}
//reset ready for next time
cg.itemSelectorSelection = -1;
cg.itemSelectorSelection = ST_NONE;
}
void CG_ItemSelectorNext_f( void )
{
if (cg.itemSelectorType == 3)
if (cg.itemSelectorType >= ST_FORCE_POWER)
{
cg.itemSelectorType = (cg.itemSelectorType == ST_FORCE_POWER) ? ST_QUICK_SAVE : ST_FORCE_POWER;
return;
}
@ -2943,8 +2952,9 @@ void CG_ItemSelectorNext_f( void )
void CG_ItemSelectorPrev_f( void )
{
if (cg.itemSelectorType == 3)
if (cg.itemSelectorType >= ST_FORCE_POWER)
{
cg.itemSelectorType = (cg.itemSelectorType == ST_FORCE_POWER) ? ST_QUICK_SAVE : ST_FORCE_POWER;
return;
}
@ -2976,12 +2986,12 @@ void CG_DrawItemSelector( void )
if (vr->item_selector == 2)
{
cg.itemSelectorType = 3;
cg.itemSelectorType = ST_FORCE_POWER;
VectorCopy(vr->offhandposition[0], cg.itemSelectorOrigin);
VectorCopy(vr->offhandoffset, cg.itemSelectorOffset);
}
else {
cg.itemSelectorType = 0;
cg.itemSelectorType = ST_WEAPON;
VectorCopy(vr->weaponposition, cg.itemSelectorOrigin);
VectorCopy(vr->weaponoffset, cg.itemSelectorOffset);
}
@ -2999,7 +3009,7 @@ void CG_DrawItemSelector( void )
cgi_Cvar_Set("timescale", "0.22");
vec3_t controllerOrigin, controllerAngles, controllerOffset, selectorOrigin;
if (cg.itemSelectorType == 3)
if (cg.itemSelectorType >= ST_FORCE_POWER)
{
BG_CalculateVROffHandPosition(controllerOrigin, controllerAngles);
VectorSubtract(vr->offhandposition[0], cg.itemSelectorOrigin, controllerOffset);
@ -3047,7 +3057,7 @@ void CG_DrawItemSelector( void )
int count;
switch (cg.itemSelectorType)
{
case 0: //weapons
case ST_WEAPON: //weapons
if (vr->in_vehicle)
count = 2;
else
@ -3056,24 +3066,30 @@ void CG_DrawItemSelector( void )
beam.shaderRGBA[1] = 0xae;
beam.shaderRGBA[2] = 0x40;
break;
case 1: //gadgets
case ST_GADGET: //gadgets
count = INV_GOODIE_KEY;
beam.shaderRGBA[0] = 0x00;
beam.shaderRGBA[1] = 0xff;
beam.shaderRGBA[2] = 0x00;
break;
case 2: //fighting style
case ST_FIGHTING_STYLE: //fighting style
count = 3;
beam.shaderRGBA[0] = 0xff;
beam.shaderRGBA[1] = 0xff;
beam.shaderRGBA[2] = 0xff;
break;
case 3: // force powers
case ST_FORCE_POWER: // force powers
count = MAX_SHOWPOWERS;
beam.shaderRGBA[0] = 0x00;
beam.shaderRGBA[1] = 0x00;
beam.shaderRGBA[2] = 0xff;
break;
case ST_QUICK_SAVE:
count = 2;
beam.shaderRGBA[0] = 0xff;
beam.shaderRGBA[1] = 0xff;
beam.shaderRGBA[2] = 0xff;
break;
}
VectorCopy(beamOrigin, beam.oldorigin);
@ -3085,7 +3101,7 @@ void CG_DrawItemSelector( void )
cgi_R_AddRefEntityToScene( &beam );
if (cg.itemSelectorType == 0) // weapons
if (cg.itemSelectorType == ST_WEAPON) // weapons
{
if (cg.weaponSelect != WP_NONE &&
cg.weaponSelect != WP_MELEE) {
@ -3126,7 +3142,7 @@ void CG_DrawItemSelector( void )
cgi_R_AddRefEntityToScene(&sprite);
}
}*/
else if (cg.itemSelectorType == 3) // force powers
else if (cg.itemSelectorType == ST_FORCE_POWER) // force powers
{
if (cent->gent->client->ps.forcePowersKnown != 0) {
refEntity_t sprite;
@ -3140,29 +3156,27 @@ void CG_DrawItemSelector( void )
}
}
if (cg.itemSelectorType != 3) {
for (int s = -1; s < 2; s += 2) {
refEntity_t sprite;
memset(&sprite, 0, sizeof(sprite));
vec3_t right;
AngleVectors(wheelAngles, NULL, right, NULL);
float offset = ((float) s * 6.0f) + (((float) s * 0.3f) *
sinf(DEG2RAD(AngleNormalize360(cg.time - cg.itemSelectorTime))));
VectorMA(wheelOrigin, offset, right, sprite.origin);
sprite.reType = RT_SPRITE;
sprite.customShader = cgs.media.binocularArrow;
sprite.radius = 0.6f;
sprite.rotation = 180.0f * ((s - 1.0f) / 2.0f);
memset(sprite.shaderRGBA, 0xff, 4);
cgi_R_AddRefEntityToScene(&sprite);
}
for (int s = -1; s < 2; s += 2) {
refEntity_t sprite;
memset(&sprite, 0, sizeof(sprite));
vec3_t right;
AngleVectors(wheelAngles, NULL, right, NULL);
float offset = ((float) s * 6.0f) + (((float) s * 0.3f) *
sinf(DEG2RAD(AngleNormalize360(cg.time - cg.itemSelectorTime))));
VectorMA(wheelOrigin, offset, right, sprite.origin);
sprite.reType = RT_SPRITE;
sprite.customShader = cgs.media.binocularArrow;
sprite.radius = 0.6f;
sprite.rotation = 180.0f * ((s - 1.0f) / 2.0f);
memset(sprite.shaderRGBA, 0xff, 4);
cgi_R_AddRefEntityToScene(&sprite);
}
qboolean selected = qfalse;
for (int index = 0; index < count; ++index)
{
int itemId = index;
if (cg.itemSelectorType == 0) {
if (cg.itemSelectorType == ST_WEAPON) {
if (vr->in_vehicle)
{
itemId = WP_ATST_MAIN + index;
@ -3183,14 +3197,14 @@ void CG_DrawItemSelector( void )
bool selectable;
switch (cg.itemSelectorType)
{
case 0: //weapons
case ST_WEAPON: //weapons
selectable = vr->in_vehicle || // both ATST weapons are always selectable
(CG_WeaponSelectable(itemId, cg.weaponSelect, qfalse) && cg.snap->ps.ammo[weaponData[itemId].ammoIndex]);
break;
case 1: //gadgets
case ST_GADGET: //gadgets
selectable = CG_InventorySelectable(itemId) && inv_icons[itemId];
break;
case 2: //fighting style
case ST_FIGHTING_STYLE: //fighting style
{
if (cent->gent->client->ps.forcePowersKnown & ( 1 << FP_SABER_OFFENSE )) {
selectable = itemId < cent->gent->client->ps.forcePowerLevel[FP_SABER_OFFENSE];
@ -3199,9 +3213,12 @@ void CG_DrawItemSelector( void )
}
}
break;
case 3: // force powers
case ST_FORCE_POWER: // force powers
selectable = ForcePower_Valid(itemId);
break;
case ST_QUICK_SAVE:
selectable = true;
break;
}
if (selectable) {
@ -3211,7 +3228,7 @@ void CG_DrawItemSelector( void )
angles[YAW] = wheelAngles[YAW];
angles[PITCH] = wheelAngles[PITCH];
angles[ROLL] =
(float)(360 / (count - ((cg.itemSelectorType == 0 && !vr->in_vehicle) ? 1 : 0))) * index;
(float)(360 / (count - ((cg.itemSelectorType == ST_WEAPON && !vr->in_vehicle) ? 1 : 0))) * index;
vec3_t forward, up;
AngleVectors(angles, forward, NULL, up);
@ -3230,7 +3247,7 @@ void CG_DrawItemSelector( void )
cg.itemSelectorSelection = itemId;
cgi_HapticEvent("selector_icon", 0, vr->right_handed ?
((cg.itemSelectorType == 3) ? 2 : 1) : ((cg.itemSelectorType == 3) ? 1 : 2), 100, 0, 0);
((cg.itemSelectorType >= ST_FORCE_POWER) ? 2 : 1) : ((cg.itemSelectorType >= ST_FORCE_POWER) ? 1 : 2), 100, 0, 0);
}
selected = qtrue;
@ -3264,10 +3281,10 @@ void CG_DrawItemSelector( void )
sprite.reType = RT_SPRITE;
switch (cg.itemSelectorType)
{
case 0: //weapons
case ST_WEAPON: //weapons
sprite.customShader = cg_weapons[itemId].weaponIcon;
break;
case 1: //gadgets
case ST_GADGET: //gadgets
sprite.customShader = inv_icons[itemId];
break;
/* case 2: //fighting style
@ -3284,9 +3301,12 @@ void CG_DrawItemSelector( void )
break;
}
break;
*/ case 3: // force powers
*/ case ST_FORCE_POWER: // force powers
sprite.customShader = force_icons[showPowers[itemId]];
break;
case ST_QUICK_SAVE:
sprite.customShader = itemId == 0 ? cgs.media.iconSave : cgs.media.iconLoad;
break;
}
sprite.radius =
@ -3303,7 +3323,7 @@ void CG_DrawItemSelector( void )
if (!selected)
{
cg.itemSelectorSelection = -1;
cg.itemSelectorSelection = ST_NONE;
}
}

View file

@ -761,6 +761,17 @@ typedef enum
NUM_FORCE_POWERS
} forcePowers_t;
typedef enum
{
ST_NONE = -1, // Used to indicate no active selection (rather than type)
ST_WEAPON,
ST_GADGET,
ST_FIGHTING_STYLE,
ST_FORCE_POWER,
ST_QUICK_SAVE
} selectorType_t;
typedef enum
{
SABER_NONE = 0,

View file

@ -23,7 +23,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
// Current version of the single player game
#include "../win32/AutoVersion.h"
#define JKXR_VERSION "1.0.0"
#define JKXR_VERSION "1.0.1-ea"
#ifdef _DEBUG
#define Q3_VERSION "(debug)OpenJK: v" VERSION_STRING_DOTTED " JKXR: " JKXR_VERSION

View file

@ -1330,6 +1330,9 @@ static void CG_RegisterGraphics( void ) {
cgs.media.iconMoveSpeed[1] = cgi_R_RegisterShaderNoMip( "gfx/icon_full" );
cgs.media.iconMoveSpeed[2] = cgi_R_RegisterShaderNoMip( "gfx/icon_walk" );
cgs.media.iconSave = cgi_R_RegisterShaderNoMip( "gfx/icon_save" );
cgs.media.iconLoad = cgi_R_RegisterShaderNoMip( "gfx/icon_load" );
// FIXME: do these conditionally
cgi_R_RegisterShader( "gfx/2d/workingCamera" );

View file

@ -105,6 +105,9 @@ typedef struct {
qhandle_t iconMoveSpeed[3];
qhandle_t iconSave;
qhandle_t iconLoad;
int currentDataPadIconBackground;
//Chunks

View file

@ -2731,12 +2731,12 @@ void CG_ItemSelectorSelect_f( void )
cg.itemSelectorTime = 0;
cgi_Cvar_Set("timescale", "1.0");
if (cg.itemSelectorSelection == -1)
if (cg.itemSelectorSelection == ST_NONE)
{
return;
}
if (cg.itemSelectorType == 0) // weapons
if (cg.itemSelectorType == ST_WEAPON) // weapons
{
if (cg.weaponSelect == cg.itemSelectorSelection)
{
@ -2746,7 +2746,7 @@ void CG_ItemSelectorSelect_f( void )
cg.weaponSelectTime = cg.time;
cg.weaponSelect = cg.itemSelectorSelection;
}
else if (cg.itemSelectorType == 1) // gadgets
else if (cg.itemSelectorType == ST_GADGET) // gadgets
{
cg.inventorySelectTime = cg.time;
cg.inventorySelect = cg.itemSelectorSelection;
@ -2757,11 +2757,11 @@ void CG_ItemSelectorSelect_f( void )
Cmd_UseInventory_f(player);
}
}
else if (cg.itemSelectorType == 2) //fighting style
else if (cg.itemSelectorType == ST_FIGHTING_STYLE) //fighting style
{
cgi_SendConsoleCommand(va( "setSaberLevel %i\n", cg.itemSelectorSelection + 1));
}
else // 3 - force powers
else if (cg.itemSelectorType == ST_FORCE_POWER)
{
if (cg.forcepowerSelect == cg.itemSelectorSelection)
{
@ -2771,15 +2771,24 @@ void CG_ItemSelectorSelect_f( void )
cg.forcepowerSelectTime = cg.time;
cg.forcepowerSelect = cg.itemSelectorSelection;
}
else if (cg.itemSelectorType == ST_QUICK_SAVE) {
if (cg.itemSelectorSelection == 0) {
cgi_SendConsoleCommand("save quik*\n");
CG_CenterPrint("Quick Saved", 240);
} else {
cgi_SendConsoleCommand("load quik\n");
}
}
//reset ready for next time
cg.itemSelectorSelection = -1;
cg.itemSelectorSelection = ST_NONE;
}
void CG_ItemSelectorNext_f( void )
{
if (cg.itemSelectorType == 3)
if (cg.itemSelectorType >= ST_FORCE_POWER)
{
cg.itemSelectorType = (cg.itemSelectorType == ST_FORCE_POWER) ? ST_QUICK_SAVE : ST_FORCE_POWER;
return;
}
@ -2794,8 +2803,9 @@ void CG_ItemSelectorNext_f( void )
void CG_ItemSelectorPrev_f( void )
{
if (cg.itemSelectorType == 3)
if (cg.itemSelectorType >= ST_FORCE_POWER)
{
cg.itemSelectorType = (cg.itemSelectorType == ST_FORCE_POWER) ? ST_QUICK_SAVE : ST_FORCE_POWER;
return;
}
@ -2827,12 +2837,12 @@ void CG_DrawItemSelector( void )
if (vr->item_selector == 2)
{
cg.itemSelectorType = 3;
cg.itemSelectorType = ST_FORCE_POWER;
VectorCopy(vr->offhandposition[0], cg.itemSelectorOrigin);
VectorCopy(vr->offhandoffset, cg.itemSelectorOffset);
}
else {
cg.itemSelectorType = 0;
cg.itemSelectorType = ST_WEAPON;
VectorCopy(vr->weaponposition, cg.itemSelectorOrigin);
VectorCopy(vr->weaponoffset, cg.itemSelectorOffset);
}
@ -2850,7 +2860,7 @@ void CG_DrawItemSelector( void )
cgi_Cvar_Set("timescale", "0.22");
vec3_t controllerOrigin, controllerAngles, controllerOffset, selectorOrigin;
if (cg.itemSelectorType == 3)
if (cg.itemSelectorType >= ST_FORCE_POWER)
{
BG_CalculateVROffHandPosition(controllerOrigin, controllerAngles);
VectorSubtract(vr->offhandposition[0], cg.itemSelectorOrigin, controllerOffset);
@ -2898,7 +2908,7 @@ void CG_DrawItemSelector( void )
int count;
switch (cg.itemSelectorType)
{
case 0: //weapons
case ST_WEAPON: //weapons
if (vr->in_vehicle)
count = 2;
else
@ -2907,24 +2917,30 @@ void CG_DrawItemSelector( void )
beam.shaderRGBA[1] = 0xae;
beam.shaderRGBA[2] = 0x40;
break;
case 1: //gadgets
case ST_GADGET: //gadgets
count = INV_GOODIE_KEY;
beam.shaderRGBA[0] = 0x00;
beam.shaderRGBA[1] = 0xff;
beam.shaderRGBA[2] = 0x00;
break;
case 2: //fighting style
case ST_FIGHTING_STYLE: //fighting style
count = 3;
beam.shaderRGBA[0] = 0xff;
beam.shaderRGBA[1] = 0xff;
beam.shaderRGBA[2] = 0xff;
break;
case 3: // force powers
case ST_FORCE_POWER: // force powers
count = MAX_SHOWPOWERS;
beam.shaderRGBA[0] = 0x00;
beam.shaderRGBA[1] = 0x00;
beam.shaderRGBA[2] = 0xff;
break;
case ST_QUICK_SAVE:
count = 2;
beam.shaderRGBA[0] = 0xff;
beam.shaderRGBA[1] = 0xff;
beam.shaderRGBA[2] = 0xff;
break;
}
VectorCopy(beamOrigin, beam.oldorigin);
@ -2936,7 +2952,7 @@ void CG_DrawItemSelector( void )
cgi_R_AddRefEntityToScene( &beam );
if (cg.itemSelectorType == 0) // weapons
if (cg.itemSelectorType == ST_WEAPON) // weapons
{
if (cg.weaponSelect != WP_NONE &&
cg.weaponSelect != WP_MELEE) {
@ -2950,7 +2966,7 @@ void CG_DrawItemSelector( void )
cgi_R_AddRefEntityToScene(&sprite);
}
}
else if (cg.itemSelectorType == 2) // fighting style
else if (cg.itemSelectorType == ST_FIGHTING_STYLE) // fighting style
{
//For the fighting style show the active one in the middle
int level = cent->gent->client->ps.saberAnimLevel;
@ -2977,7 +2993,7 @@ void CG_DrawItemSelector( void )
cgi_R_AddRefEntityToScene(&sprite);
}
}
else if (cg.itemSelectorType == 3) // force powers
else if (cg.itemSelectorType == ST_FORCE_POWER) // force powers
{
if (cent->gent->client->ps.forcePowersKnown != 0) {
refEntity_t sprite;
@ -2991,22 +3007,20 @@ void CG_DrawItemSelector( void )
}
}
if (cg.itemSelectorType != 3) {
for (int s = -1; s < 2; s += 2) {
refEntity_t sprite;
memset(&sprite, 0, sizeof(sprite));
vec3_t right;
AngleVectors(wheelAngles, NULL, right, NULL);
float offset = ((float) s * 6.0f) + (((float) s * 0.3f) *
sinf(DEG2RAD(AngleNormalize360(cg.time - cg.itemSelectorTime))));
VectorMA(wheelOrigin, offset, right, sprite.origin);
sprite.reType = RT_SPRITE;
sprite.customShader = cgs.media.binocularArrow;
sprite.radius = 0.6f;
sprite.rotation = 180.0f * ((s - 1.0f) / 2.0f);
memset(sprite.shaderRGBA, 0xff, 4);
cgi_R_AddRefEntityToScene(&sprite);
}
for (int s = -1; s < 2; s += 2) {
refEntity_t sprite;
memset(&sprite, 0, sizeof(sprite));
vec3_t right;
AngleVectors(wheelAngles, NULL, right, NULL);
float offset = ((float) s * 6.0f) + (((float) s * 0.3f) *
sinf(DEG2RAD(AngleNormalize360(cg.time - cg.itemSelectorTime))));
VectorMA(wheelOrigin, offset, right, sprite.origin);
sprite.reType = RT_SPRITE;
sprite.customShader = cgs.media.binocularArrow;
sprite.radius = 0.6f;
sprite.rotation = 180.0f * ((s - 1.0f) / 2.0f);
memset(sprite.shaderRGBA, 0xff, 4);
cgi_R_AddRefEntityToScene(&sprite);
}
const char *info = CG_ConfigString( CS_SERVERINFO );
@ -3035,14 +3049,14 @@ void CG_DrawItemSelector( void )
bool selectable;
switch (cg.itemSelectorType)
{
case 0: //weapons
case ST_WEAPON: //weapons
selectable = vr->in_vehicle || // both ATST weapons are always selectable
(CG_WeaponSelectable(itemId, cg.weaponSelect, qfalse) && cg.snap->ps.ammo[weaponData[itemId].ammoIndex]);
break;
case 1: //gadgets
case ST_GADGET: //gadgets
selectable = CG_InventorySelectable(itemId) && inv_icons[itemId];
break;
case 2: //fighting style
case ST_FIGHTING_STYLE: //fighting style
{
if (cent->gent->client->ps.forcePowersKnown & ( 1 << FP_SABER_OFFENSE )) {
selectable = itemId < cent->gent->client->ps.forcePowerLevel[FP_SABER_OFFENSE];
@ -3051,9 +3065,12 @@ void CG_DrawItemSelector( void )
}
}
break;
case 3: // force powers
case ST_FORCE_POWER: // force powers
selectable = ForcePower_Valid(itemId);
break;
case ST_QUICK_SAVE:
selectable = true;
break;
}
if (selectable) {
@ -3063,7 +3080,7 @@ void CG_DrawItemSelector( void )
angles[YAW] = wheelAngles[YAW];
angles[PITCH] = wheelAngles[PITCH];
angles[ROLL] =
(float)(360 / (count - ((cg.itemSelectorType == 0 && !vr->in_vehicle) ? 1 : 0))) * index;
(float)(360 / (count - ((cg.itemSelectorType == ST_WEAPON && !vr->in_vehicle) ? 1 : 0))) * index;
vec3_t forward, up;
AngleVectors(angles, forward, NULL, up);
@ -3082,7 +3099,7 @@ void CG_DrawItemSelector( void )
cg.itemSelectorSelection = itemId;
cgi_HapticEvent("selector_icon", 0, vr->right_handed ?
((cg.itemSelectorType == 3) ? 2 : 1) : ((cg.itemSelectorType == 3) ? 1 : 2), 100, 0, 0);
((cg.itemSelectorType >= ST_FORCE_POWER) ? 2 : 1) : ((cg.itemSelectorType >= ST_FORCE_POWER) ? 1 : 2), 100, 0, 0);
}
selected = qtrue;
@ -3116,13 +3133,13 @@ void CG_DrawItemSelector( void )
sprite.reType = RT_SPRITE;
switch (cg.itemSelectorType)
{
case 0: //weapons
case ST_WEAPON: //weapons
sprite.customShader = cg_weapons[itemId].weaponIcon;
break;
case 1: //gadgets
case ST_GADGET: //gadgets
sprite.customShader = inv_icons[itemId];
break;
case 2: //fighting style
case ST_FIGHTING_STYLE: //fighting style
switch ( itemId )
{
case 0://FORCE_LEVEL_1:
@ -3136,9 +3153,12 @@ void CG_DrawItemSelector( void )
break;
}
break;
case 3: // force powers
case ST_FORCE_POWER: // force powers
sprite.customShader = force_icons[showPowers[itemId]];
break;
case ST_QUICK_SAVE:
sprite.customShader = itemId == 0 ? cgs.media.iconSave : cgs.media.iconLoad;
break;
}
sprite.radius =
@ -3155,7 +3175,7 @@ void CG_DrawItemSelector( void )
if (!selected)
{
cg.itemSelectorSelection = -1;
cg.itemSelectorSelection = ST_NONE;
}
}

Binary file not shown.

Binary file not shown.