From 0d5162626dd92cbf6df225a571e1f04ca1b5ed99 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 12 Mar 2023 10:03:25 +0000 Subject: [PATCH] Realistic Saber (dismemberment) --- Projects/Android/jni/OpenJK/code/game/g_main.cpp | 4 ++-- Projects/Android/jni/OpenJK/code/game/wp_saber.cpp | 8 +++++++- Projects/Android/jni/OpenJK/codeJK2/game/g_main.cpp | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Projects/Android/jni/OpenJK/code/game/g_main.cpp b/Projects/Android/jni/OpenJK/code/game/g_main.cpp index 1481b5a..39ea37a 100644 --- a/Projects/Android/jni/OpenJK/code/game/g_main.cpp +++ b/Projects/Android/jni/OpenJK/code/game/g_main.cpp @@ -664,9 +664,9 @@ void G_InitCvars( void ) { g_TeamBeefDirectorsCut = gi.cvar( "g_TeamBeefDirectorsCut", "1", CVAR_ARCHIVE ); // Team Beef Director's Cut tweaks - g_saberAutoDeflect1stPerson = gi.cvar( "g_saberAutoDeflect1stPerson", "0", CVAR_CHEAT );//Whether the saber will auto deflect missiles in first person + g_saberAutoDeflect1stPerson = gi.cvar( "g_saberAutoDeflect1stPerson", "0", CVAR_ARCHIVE );//Whether the saber will auto deflect missiles in first person g_saberAutoBlocking = gi.cvar( "g_saberAutoBlocking", "0", CVAR_CHEAT );//must press +block button to do any blocking - g_saberRealisticCombat = gi.cvar( "g_saberMoreRealistic", "1", CVAR_ARCHIVE );//makes collision more precise, increases damage + g_saberRealisticCombat = gi.cvar( "g_saberMoreRealistic", "3", CVAR_ARCHIVE );//makes collision more precise, increases damage debug_subdivision = gi.cvar( "debug_subdivision", "0", CVAR_ARCHIVE );//debug for dismemberment g_dismemberProbabilities = gi.cvar ( "g_dismemberProbabilities", "1", CVAR_ARCHIVE );//0 = ignore probabilities, 1 = use probabilities g_saberDamageCapping = gi.cvar( "g_saberDamageCapping", "1", CVAR_CHEAT );//caps damage of sabers vs players and NPC who use sabers diff --git a/Projects/Android/jni/OpenJK/code/game/wp_saber.cpp b/Projects/Android/jni/OpenJK/code/game/wp_saber.cpp index 1b47f6b..70db814 100644 --- a/Projects/Android/jni/OpenJK/code/game/wp_saber.cpp +++ b/Projects/Android/jni/OpenJK/code/game/wp_saber.cpp @@ -160,6 +160,9 @@ void WP_ForcePowerDrain( gentity_t *self, forcePowers_t forcePower, int override void WP_DeactivateSaber( gentity_t *self, qboolean clearLength = qfalse ); qboolean FP_ForceDrainGrippableEnt( gentity_t *victim ); +extern cvar_t *g_TeamBeefDirectorsCut; + +extern cvar_t *g_saberAutoDeflect1stPerson; extern cvar_t *g_saberAutoBlocking; extern cvar_t *g_saberRealisticCombat; extern cvar_t *g_saberDamageCapping; @@ -7994,9 +7997,12 @@ void WP_SaberUpdate( gentity_t *self, usercmd_t *ucmd ) else if ( self->client->ps.saberBlocking == BLK_TIGHT || self->client->ps.saberBlocking == BLK_WIDE ) {//FIXME: keep bbox in front of player, even when wide? + bool autoBlocking = (cg_thirdPerson.integer && g_saberAutoBlocking->integer) || + (!cg_thirdPerson.integer && g_saberAutoDeflect1stPerson->integer); vec3_t saberOrg; if ( !forceBlock - && ( (self->s.number&&!Jedi_SaberBusy(self)&&!g_saberRealisticCombat->integer) || (self->s.number == 0 && self->client->ps.saberBlocking == BLK_WIDE && (g_saberAutoBlocking->integer||self->client->ps.saberBlockingTime>level.time)) ) + && ( (self->s.number&&!Jedi_SaberBusy(self)&&!g_saberRealisticCombat->integer) || + (self->s.number == 0 && self->client->ps.saberBlocking == BLK_WIDE && (autoBlocking||self->client->ps.saberBlockingTime>level.time)) ) && self->client->ps.weaponTime <= 0 && !G_InCinematicSaberAnim( self ) ) {//full-size blocking for non-attacking player with g_saberAutoBlocking on diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/g_main.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/g_main.cpp index 8502726..84998ec 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/game/g_main.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/game/g_main.cpp @@ -588,7 +588,7 @@ void G_InitCvars( void ) { g_TeamBeefDirectorsCut = gi.cvar( "g_TeamBeefDirectorsCut", "1", CVAR_ARCHIVE ); // Team Beef Director's Cut tweaks - g_saberAutoDeflect1stPerson = gi.cvar( "g_saberAutoDeflect1stPerson", "0", CVAR_ARCHIVE|CVAR_CHEAT );//Whether the saber will auto deflect missiles in first person + g_saberAutoDeflect1stPerson = gi.cvar( "g_saberAutoDeflect1stPerson", "0", CVAR_ARCHIVE );//Whether the saber will auto deflect missiles in first person g_saberAutoBlocking = gi.cvar( "g_saberAutoBlocking", "0", CVAR_ARCHIVE|CVAR_CHEAT );//must press +block button to do any blocking g_saberRealisticCombat = gi.cvar( "g_saberRealisticCombat", "1", CVAR_ARCHIVE );//makes collision more precise, increases damage g_saberMoveSpeed = gi.cvar( "g_saberMoveSpeed", "1", CVAR_ARCHIVE|CVAR_CHEAT );//how fast you run while attacking with a saber