diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h index 64e37e2..8b7d610 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_local.h @@ -625,6 +625,7 @@ extern vmCvar_t cg_saberAutoThird; extern vmCvar_t cg_gunAutoFirst; extern vmCvar_t cg_debugSaberCombat; extern vmCvar_t cg_saberBurnMarkCoolDownTime; +extern vmCvar_t cg_autoUseBacta; extern vmCvar_t cg_zProj; extern vmCvar_t cg_stereoSeparation; diff --git a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp index cefb1ec..f2f765f 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/cgame/cg_main.cpp @@ -301,6 +301,7 @@ vmCvar_t cg_saberAutoThird; vmCvar_t cg_gunAutoFirst; vmCvar_t cg_debugSaberCombat; vmCvar_t cg_saberBurnMarkCoolDownTime; +vmCvar_t cg_autoUseBacta; vmCvar_t cg_thirdPersonAlpha; vmCvar_t cg_thirdPersonAutoAlpha; @@ -446,6 +447,7 @@ static cvarTable_t cvarTable[] = { { &cg_gunAutoFirst, "cg_gunAutoFirst", "1", CVAR_ARCHIVE }, { &cg_debugSaberCombat, "cg_debugSaberCombat", "0", CVAR_ARCHIVE }, { &cg_saberBurnMarkCoolDownTime, "cg_saberBurnMarkCoolDownTime", "0", CVAR_ARCHIVE }, + { &cg_autoUseBacta, "cg_autoUseBacta", "0", CVAR_ARCHIVE }, { &cg_pano, "pano", "0", 0 }, { &cg_panoNumShots, "panoNumShots", "10", 0 }, diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/g_combat.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/g_combat.cpp index 7b208da..cc18b1f 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/game/g_combat.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/game/g_combat.cpp @@ -5210,6 +5210,12 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_ targ->health = 1; } } + else if ( !alreadyDead && targ->health <=0 && targ->client->ps.inventory[INV_BACTA_CANISTER] && cg_autoUseBacta.integer) + { + targ->health = 25; + targ->client->ps.inventory[INV_BACTA_CANISTER]--; + G_SoundOnEnt( targ, CHAN_VOICE, va( "sound/weapons/force/heal%d.mp3", Q_irand( 1, 4 ) ) ); + } else if ( targ->health < 1 && attacker->client ) { // The player or NPC just killed an enemy so increment the kills counter attacker->client->ps.persistant[PERS_ENEMIES_KILLED]++; @@ -5266,6 +5272,12 @@ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, vec3_ targ->health = 1; } } + else if ( !alreadyDead && targ->health <=0 && targ->client->ps.inventory[INV_BACTA_CANISTER] && cg_autoUseBacta.integer) + { + targ->health = 25; + targ->client->ps.inventory[INV_BACTA_CANISTER]--; + G_SoundOnEnt( targ, CHAN_VOICE, va( "sound/weapons/force/heal%d.mp3", Q_irand( 1, 4 ) ) ); + } else if ( targ->health < 0 ) { targ->health = 0; diff --git a/z_vr_assets/strip/menus_vr.sp b/z_vr_assets/strip/menus_vr.sp index cd004fe..af926df 100644 --- a/z_vr_assets/strip/menus_vr.sp +++ b/z_vr_assets/strip/menus_vr.sp @@ -3,7 +3,7 @@ CONFIG W:\bin\striped.cfg ID 100 REFERENCE MENUS_VR DESCRIPTION "VR Menu Localizations" -COUNT 117 +COUNT 119 INDEX 0 { REFERENCE COMMON_CONTROLS_ITEM @@ -589,3 +589,13 @@ INDEX 116 REFERENCE CROUCH_IRL_1ST_PERSON TEXT_LANGUAGE1 "1st Person" } +INDEX 117 +{ + REFERENCE AUTO_USE_BACTA_ITEM + TEXT_LANGUAGE1 "Auto Use Bacta:" +} +INDEX 118 +{ + REFERENCE AUTO_USE_BACTA_DESC + TEXT_LANGUAGE1 "When enabled, automatically uses bacta canister before dying." +} diff --git a/z_vr_assets/ui/controls.menu b/z_vr_assets/ui/controls.menu index 27aa962..90cb38c 100644 --- a/z_vr_assets/ui/controls.menu +++ b/z_vr_assets/ui/controls.menu @@ -1740,8 +1740,8 @@ name none group invcontrols type ITEM_TYPE_YESNO - text "Placeholder:" - cvar "place_holder" + text @MENUS_VR_AUTO_USE_BACTA_ITEM + cvar "cg_autoUseBacta" rect 305 191 300 20 textalign ITEM_ALIGN_RIGHT textalignx 151 @@ -1751,7 +1751,7 @@ forecolor 1 1 1 1 visible 0 // appearance_slot 1 - descText "Item placeholder." + descText @MENUS_VR_AUTO_USE_BACTA_DESC action { play sound/interface/button1 diff --git a/z_vr_assets/ui/ingamecontrols.menu b/z_vr_assets/ui/ingamecontrols.menu index 7a9f783..423f9d4 100644 --- a/z_vr_assets/ui/ingamecontrols.menu +++ b/z_vr_assets/ui/ingamecontrols.menu @@ -1740,8 +1740,8 @@ name none group invcontrols type ITEM_TYPE_YESNO - text "Placeholder:" - cvar "place_holder" + text @MENUS_VR_AUTO_USE_BACTA_ITEM + cvar "cg_autoUseBacta" rect 305 191 300 20 textalign ITEM_ALIGN_RIGHT textalignx 151 @@ -1751,7 +1751,7 @@ forecolor 1 1 1 1 visible 0 // appearance_slot 1 - descText "Item placeholder." + descText @MENUS_VR_AUTO_USE_BACTA_DESC action { play sound/interface/button1