From a2ff16b57616ae8443892e022cff8e073060b9da Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 10 Apr 2023 19:42:06 +0100 Subject: [PATCH] Quick Save/Load in Selector Haven't been able to test yet! --- Projects/Android/AndroidManifest.xml | 4 +- Projects/Android/jni/JKXR/VrInputDefault.cpp | 109 ----------------- .../Android/jni/OpenJK/code/cgame/cg_main.cpp | 3 + .../Android/jni/OpenJK/code/cgame/cg_media.h | 3 + .../jni/OpenJK/code/cgame/cg_weapons.cpp | 108 ++++++++++------- .../jni/OpenJK/code/qcommon/q_shared.h | 11 ++ .../jni/OpenJK/code/qcommon/stv_version.h | 2 +- .../jni/OpenJK/codeJK2/cgame/cg_main.cpp | 3 + .../jni/OpenJK/codeJK2/cgame/cg_media.h | 3 + .../jni/OpenJK/codeJK2/cgame/cg_weapons.cpp | 110 +++++++++++------- z_vr_assets_base/gfx/icon_load.tga | Bin 0 -> 1635 bytes z_vr_assets_base/gfx/icon_save.tga | Bin 0 -> 2285 bytes 12 files changed, 155 insertions(+), 201 deletions(-) create mode 100644 z_vr_assets_base/gfx/icon_load.tga create mode 100644 z_vr_assets_base/gfx/icon_save.tga diff --git a/Projects/Android/AndroidManifest.xml b/Projects/Android/AndroidManifest.xml index 9676767..954a248 100644 --- a/Projects/Android/AndroidManifest.xml +++ b/Projects/Android/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="51" + android:versionName="1.0.1" android:installLocation="auto" > diff --git a/Projects/Android/jni/JKXR/VrInputDefault.cpp b/Projects/Android/jni/JKXR/VrInputDefault.cpp index 24ce518..4ea5a7e 100644 --- a/Projects/Android/jni/JKXR/VrInputDefault.cpp +++ b/Projects/Android/jni/JKXR/VrInputDefault.cpp @@ -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 diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_main.cpp b/Projects/Android/jni/OpenJK/code/cgame/cg_main.cpp index 423a75d..a0b2506 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_main.cpp +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_main.cpp @@ -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" ); diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_media.h b/Projects/Android/jni/OpenJK/code/cgame/cg_media.h index c7b25e3..69a8676 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_media.h +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_media.h @@ -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; diff --git a/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp b/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp index 9b3ffe4..c07ef1b 100644 --- a/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp +++ b/Projects/Android/jni/OpenJK/code/cgame/cg_weapons.cpp @@ -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; } } diff --git a/Projects/Android/jni/OpenJK/code/qcommon/q_shared.h b/Projects/Android/jni/OpenJK/code/qcommon/q_shared.h index 8135915..4570f09 100644 --- a/Projects/Android/jni/OpenJK/code/qcommon/q_shared.h +++ b/Projects/Android/jni/OpenJK/code/qcommon/q_shared.h @@ -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, diff --git a/Projects/Android/jni/OpenJK/code/qcommon/stv_version.h b/Projects/Android/jni/OpenJK/code/qcommon/stv_version.h index ada79a8..c8d4a3c 100644 --- a/Projects/Android/jni/OpenJK/code/qcommon/stv_version.h +++ b/Projects/Android/jni/OpenJK/code/qcommon/stv_version.h @@ -23,7 +23,7 @@ along with this program; if not, see . // 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 diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp index 5b6b917..21fcbc0 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp @@ -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" ); diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_media.h b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_media.h index c87d619..101666d 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_media.h +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_media.h @@ -105,6 +105,9 @@ typedef struct { qhandle_t iconMoveSpeed[3]; + qhandle_t iconSave; + qhandle_t iconLoad; + int currentDataPadIconBackground; //Chunks diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp index 1a0162b..e8947ed 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_weapons.cpp @@ -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; } } diff --git a/z_vr_assets_base/gfx/icon_load.tga b/z_vr_assets_base/gfx/icon_load.tga new file mode 100644 index 0000000000000000000000000000000000000000..2b553a0ae39424e4ef10469dcd10b233d99902a8 GIT binary patch literal 1635 zcmb7_J4{qT6ozMULskl6xg}bXs0oh-Laf-h$woH#h|(e*Euo;`r3)xpAU0Bf3DIcb zqoV~%+LeUF5Sv8^g*HZ_3G4r#J#&T=DsS@7o%_uSez`azjZ?oN2uZ`M0QvaHuFhOJYL7 zgbfu6UKlfh6XiU{ys&P<0~OZ2P&J`lg=!KqK!1^(tmFb}%&$miPzfw#13GP_9Yvj9 z7&c)=g<&r&nJ}utk{32j=u=@+1lh1Api|^0lCcT5o~85}yG!{S!kM?(sQZz4@sr}R zi60~JqRazLlO|57IO)Yf#UD&8N8-gRiuX;t97z&+Q!)rw&Kk>@Ze6`!D38J1P*r+v zAmfmPa-{HNrcR(dT9Yoo{4#|865ZKpK5bb`K4y*54|#H6rOv}=EXcQ z)Lr*HyHcZ$pWxkkYK>rhceT1_=W}odsfQ4OJ<<_;0BMT_FCway;*MFGDfu+pP?^UJ z|8hW;vUZBDpmiAUub>5ZBI^*C!KrO1o`RWdoXlOy5ayP+Q3}>!NOlcr{~;mg9ZjhI#H!Zf+I>*ewJVDi2HU-2g*uN|Le_E5YS@vv zbA%~AV}0P$_t=mxO+MmG+VMr!w!|cHHNmiVm1B3WGmo+YVV&x08HU5!tBP2EIK)1% z6fXfqOlAejVR%CwL2CO@O1gxR(R-z-;mM@;pmJp3*(cYa!hcri;u;w$6-JB0#leA| LvA$w|q1U_uYZQo# literal 0 HcmV?d00001