mirror of
https://github.com/DrBeef/JKXR.git
synced 2025-01-19 06:51:06 +00:00
Hints to force direction
also rotated saber back so the glitch is not so visible Added controls for force direction hint and Speed FOV adjust to the menu
This commit is contained in:
parent
4d5b8de994
commit
b1e6677fc0
10 changed files with 228 additions and 29 deletions
|
@ -647,6 +647,9 @@ extern vmCvar_t fx_debug;
|
|||
extern vmCvar_t cg_missionInfoFlashTime;
|
||||
extern vmCvar_t cg_hudFiles;
|
||||
|
||||
extern vmCvar_t cg_showForcePowerDirection;
|
||||
extern vmCvar_t cg_forceSpeedFOVAdjust;
|
||||
|
||||
extern vmCvar_t cg_turnAnims;
|
||||
extern vmCvar_t cg_motionBoneComp;
|
||||
extern vmCvar_t cg_reliableAnimSounds;
|
||||
|
|
|
@ -635,6 +635,10 @@ extern vmCvar_t cg_missionInfoCentered;
|
|||
extern vmCvar_t cg_missionInfoFlashTime;
|
||||
extern vmCvar_t cg_hudFiles;
|
||||
|
||||
extern vmCvar_t cg_showForcePowerDirection;
|
||||
extern vmCvar_t cg_forceSpeedFOVAdjust;
|
||||
|
||||
|
||||
/*
|
||||
Ghoul2 Insert Start
|
||||
*/
|
||||
|
|
|
@ -321,6 +321,9 @@ vmCvar_t cg_missionInfoCentered;
|
|||
vmCvar_t cg_missionInfoFlashTime;
|
||||
vmCvar_t cg_hudFiles;
|
||||
|
||||
vmCvar_t cg_showForcePowerDirection;
|
||||
vmCvar_t cg_forceSpeedFOVAdjust;
|
||||
|
||||
vmCvar_t vr_weapon_adjustment_1;
|
||||
vmCvar_t vr_weapon_adjustment_2;
|
||||
vmCvar_t vr_weapon_adjustment_3;
|
||||
|
@ -454,6 +457,8 @@ static cvarTable_t cvarTable[] = {
|
|||
{ &cg_missionInfoCentered, "cg_missionInfoCentered", "1", CVAR_ARCHIVE },
|
||||
{ &cg_missionInfoFlashTime, "cg_missionInfoFlashTime", "10000", 0 },
|
||||
{ &cg_hudFiles, "cg_hudFiles", "ui/jk2hud.txt", CVAR_ARCHIVE},
|
||||
{ &cg_showForcePowerDirection, "cg_showForcePowerDirection", "1", CVAR_ARCHIVE},
|
||||
{ &cg_forceSpeedFOVAdjust, "cg_forceSpeedFOVAdjust", "1", CVAR_ARCHIVE},
|
||||
|
||||
//Default Weapon adjustments - these WILL be overridden
|
||||
// scale,right,up,forward,pitch,yaw,roll
|
||||
|
|
|
@ -3450,7 +3450,7 @@ void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, centity_t *cen
|
|||
hiltEnt.hModel = cgi_R_RegisterModel( "models/weapons2/saber/saber_w.md3" );
|
||||
vec3_t angles;
|
||||
BG_CalculateVRSaberPosition(hiltEnt.origin, hiltEnt.angles);
|
||||
hiltEnt.angles[ROLL] += 180;
|
||||
//hiltEnt.angles[ROLL] += 180;
|
||||
VectorCopy(hiltEnt.origin, hiltEnt.oldorigin);
|
||||
vec3_t axis[3];
|
||||
AnglesToAxis(hiltEnt.angles, axis);
|
||||
|
|
|
@ -1312,23 +1312,29 @@ qboolean CG_CalcFOVFromX( float fov_x )
|
|||
|
||||
float CG_ForceSpeedFOV( float infov )
|
||||
{
|
||||
if (!cg_forceSpeedFOVAdjust.integer)
|
||||
{
|
||||
return infov;
|
||||
}
|
||||
|
||||
gentity_t *player = &g_entities[0];
|
||||
float fov;
|
||||
float timeLeft = player->client->ps.forcePowerDuration[FP_SPEED] - cg.time;
|
||||
float length = FORCE_SPEED_DURATION*forceSpeedValue[player->client->ps.forcePowerLevel[FP_SPEED]];
|
||||
float amt = forceSpeedFOVMod[player->client->ps.forcePowerLevel[FP_SPEED]];
|
||||
if ( timeLeft < 500 )
|
||||
if ( timeLeft < 400 )
|
||||
{//start going back
|
||||
fov = infov + (timeLeft)/500*amt;
|
||||
fov = infov + sinf(DEG2RAD((timeLeft/400)*180))*amt;
|
||||
}
|
||||
else if ( length - timeLeft < 1000 )
|
||||
else if ( length - timeLeft < 600 )
|
||||
{//start zooming in
|
||||
fov = infov + (length - timeLeft)/1000*amt;
|
||||
fov = infov + sinf(DEG2RAD(((length - timeLeft)/600)*180))*amt;
|
||||
}
|
||||
else
|
||||
{//stay at this FOV
|
||||
fov = infov+amt;
|
||||
fov = infov;//+amt;
|
||||
}
|
||||
|
||||
return fov;
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -2667,7 +2667,6 @@ void CG_ItemSelectorSelect_f( void )
|
|||
|
||||
if (cg.itemSelectorSelection == -1)
|
||||
{
|
||||
cg.itemSelectorType = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
#include "g_functions.h"
|
||||
#include "wp_saber.h"
|
||||
#include "../../code/qcommon/tri_coll_test.h"
|
||||
#include "../cgame/FxScheduler.h"
|
||||
|
||||
#define MAX_SABER_VICTIMS 16
|
||||
static int victimEntityNum[MAX_SABER_VICTIMS];
|
||||
|
@ -5724,15 +5725,30 @@ void ForceThrow( gentity_t *self, qboolean pull )
|
|||
|
||||
G_Sound( self, soundIndex );
|
||||
|
||||
vec3_t origin, angles;
|
||||
if (self->client->ps.clientNum == 0)
|
||||
{
|
||||
vec3_t origin, angles;
|
||||
BG_CalculateVROffHandPosition(origin, fwdangles);
|
||||
|
||||
if (cg_showForcePowerDirection.integer)
|
||||
{
|
||||
vec3_t color = { 0, 255, 0 };
|
||||
AngleVectors( fwdangles, forward, right, NULL );
|
||||
VectorMA( origin, radius, forward, end );
|
||||
FX_AddLine( origin, end, 0.1f, 1.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f,
|
||||
color, color, 0.0f,
|
||||
500, cgi_R_RegisterShader( "gfx/misc/nav_line" ),
|
||||
FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorCopy( self->client->ps.viewangles, fwdangles );
|
||||
VectorCopy( self->client->renderInfo.eyePoint, origin );
|
||||
}
|
||||
|
||||
//fwdangles[1] = self->client->ps.viewangles[1];
|
||||
AngleVectors( fwdangles, forward, right, NULL );
|
||||
VectorCopy( self->currentOrigin, center );
|
||||
|
@ -5756,8 +5772,8 @@ void ForceThrow( gentity_t *self, qboolean pull )
|
|||
|
||||
if ( cone >= 1.0f )
|
||||
{//must be pointing right at them
|
||||
VectorMA( self->client->renderInfo.eyePoint, radius, forward, end );
|
||||
gi.trace( &tr, self->client->renderInfo.eyePoint, vec3_origin, vec3_origin, end, self->s.number, MASK_OPAQUE|CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_ITEM|CONTENTS_CORPSE, G2_NOCOLLIDE, 0 );//was MASK_SHOT, changed to match crosshair trace
|
||||
VectorMA( origin, radius, forward, end );
|
||||
gi.trace( &tr, origin, vec3_origin, vec3_origin, end, self->s.number, MASK_OPAQUE|CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_ITEM|CONTENTS_CORPSE, G2_NOCOLLIDE, 0 );//was MASK_SHOT, changed to match crosshair trace
|
||||
/*
|
||||
//FIXME: can't just return, need to be able to push missiles
|
||||
if ( tr.entityNum >= ENTITYNUM_WORLD )
|
||||
|
@ -5892,8 +5908,8 @@ void ForceThrow( gentity_t *self, qboolean pull )
|
|||
}
|
||||
else
|
||||
{//do a forwardEnt trace
|
||||
VectorMA( self->client->renderInfo.eyePoint, radius, forward, end );
|
||||
gi.trace( &tr, self->client->renderInfo.eyePoint, vec3_origin, vec3_origin, end, self->s.number, MASK_OPAQUE|CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_ITEM|CONTENTS_CORPSE, G2_NOCOLLIDE, 0 );//was MASK_SHOT, changed to match crosshair trace
|
||||
VectorMA( origin, radius, forward, end );
|
||||
gi.trace( &tr, origin, vec3_origin, vec3_origin, end, self->s.number, MASK_OPAQUE|CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_ITEM|CONTENTS_CORPSE, G2_NOCOLLIDE, 0 );//was MASK_SHOT, changed to match crosshair trace
|
||||
if ( tr.entityNum != ent->s.number )
|
||||
{//last chance
|
||||
continue;
|
||||
|
@ -5982,7 +5998,7 @@ void ForceThrow( gentity_t *self, qboolean pull )
|
|||
}
|
||||
|
||||
//in PVS?
|
||||
if ( !ent->bmodel && !gi.inPVS( ent_org, self->client->renderInfo.eyePoint ) )
|
||||
if ( !ent->bmodel && !gi.inPVS( ent_org, origin ) )
|
||||
{//must be in PVS
|
||||
continue;
|
||||
}
|
||||
|
@ -5990,7 +6006,7 @@ void ForceThrow( gentity_t *self, qboolean pull )
|
|||
if ( ent != forwardEnt )
|
||||
{//don't need to trace against forwardEnt again
|
||||
//really should have a clear LOS to this thing...
|
||||
gi.trace( &tr, self->client->renderInfo.eyePoint, vec3_origin, vec3_origin, ent_org, self->s.number, MASK_OPAQUE|CONTENTS_SOLID, G2_NOCOLLIDE, 0 );//was MASK_SHOT, but changed to match above trace and crosshair trace
|
||||
gi.trace( &tr, origin, vec3_origin, vec3_origin, ent_org, self->s.number, MASK_OPAQUE|CONTENTS_SOLID, G2_NOCOLLIDE, 0 );//was MASK_SHOT, but changed to match above trace and crosshair trace
|
||||
if ( tr.fraction < 1.0f && tr.entityNum != ent->s.number )
|
||||
{//must have clear LOS
|
||||
continue;
|
||||
|
@ -6263,8 +6279,8 @@ void ForceThrow( gentity_t *self, qboolean pull )
|
|||
AngleVectors(self->client->ps.viewangles, forward, right, NULL);
|
||||
}
|
||||
VectorNormalize( forward );
|
||||
VectorMA( self->client->renderInfo.eyePoint, radius, forward, end );
|
||||
gi.trace( &tr, self->client->renderInfo.eyePoint, vec3_origin, vec3_origin, end, self->s.number, MASK_SHOT, G2_NOCOLLIDE, 0 );
|
||||
VectorMA( origin, radius, forward, end );
|
||||
gi.trace( &tr, origin, vec3_origin, vec3_origin, end, self->s.number, MASK_SHOT, G2_NOCOLLIDE, 0 );
|
||||
if ( tr.entityNum != push_list[x]->s.number || tr.fraction == 1.0 || tr.allsolid || tr.startsolid )
|
||||
{//must be pointing right at it
|
||||
continue;
|
||||
|
@ -6272,22 +6288,22 @@ void ForceThrow( gentity_t *self, qboolean pull )
|
|||
|
||||
if ( pull )
|
||||
{
|
||||
VectorSubtract( self->client->renderInfo.eyePoint, tr.endpos, pushDir );
|
||||
VectorSubtract( origin, tr.endpos, pushDir );
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSubtract( tr.endpos, self->client->renderInfo.eyePoint, pushDir );
|
||||
VectorSubtract( tr.endpos, origin, pushDir );
|
||||
}
|
||||
/*
|
||||
VectorSubtract( push_list[x]->absmax, push_list[x]->absmin, size );
|
||||
VectorMA( push_list[x]->absmin, 0.5, size, center );
|
||||
if ( pull )
|
||||
{
|
||||
VectorSubtract( self->client->renderInfo.eyePoint, center, pushDir );
|
||||
VectorSubtract( origin, center, pushDir );
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSubtract( center, self->client->renderInfo.eyePoint, pushDir );
|
||||
VectorSubtract( center, origin, pushDir );
|
||||
}
|
||||
*/
|
||||
damage -= VectorNormalize( pushDir );
|
||||
|
@ -6316,8 +6332,8 @@ void ForceThrow( gentity_t *self, qboolean pull )
|
|||
|
||||
AngleVectors( self->client->ps.viewangles, forward, NULL, NULL );
|
||||
VectorNormalize( forward );
|
||||
VectorMA( self->client->renderInfo.eyePoint, radius, forward, end );
|
||||
gi.trace( &tr, self->client->renderInfo.eyePoint, vec3_origin, vec3_origin, end, self->s.number, MASK_SHOT, G2_NOCOLLIDE, 0 );
|
||||
VectorMA( origin, radius, forward, end );
|
||||
gi.trace( &tr, origin, vec3_origin, vec3_origin, end, self->s.number, MASK_SHOT, G2_NOCOLLIDE, 0 );
|
||||
if ( tr.entityNum != push_list[x]->s.number || tr.fraction == 1.0 || tr.allsolid || tr.startsolid )
|
||||
{//must be pointing right at it
|
||||
continue;
|
||||
|
@ -6345,7 +6361,7 @@ void ForceThrow( gentity_t *self, qboolean pull )
|
|||
VectorCopy( push_list[x]->pos2, pos2 );
|
||||
}
|
||||
|
||||
if ( Distance( pos1, self->client->renderInfo.eyePoint ) < Distance( pos2, self->client->renderInfo.eyePoint ) )
|
||||
if ( Distance( pos1, origin ) < Distance( pos2, origin ) )
|
||||
{//pos1 is closer
|
||||
if ( push_list[x]->moverState == MOVER_POS1 )
|
||||
{//at the closest pos
|
||||
|
@ -6764,17 +6780,31 @@ void ForceTelepathy( gentity_t *self )
|
|||
{
|
||||
BG_CalculateVROffHandPosition(origin, angles);
|
||||
AngleVectors(angles, forward, NULL, NULL);
|
||||
|
||||
if (cg_showForcePowerDirection.integer)
|
||||
{
|
||||
vec3_t color = { 0, 255, 0 };
|
||||
AngleVectors( angles, forward, NULL, NULL );
|
||||
VectorMA( origin, 512, forward, end );
|
||||
FX_AddLine( origin, end, 0.1f, 1.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f,
|
||||
color, color, 0.0f,
|
||||
500, cgi_R_RegisterShader( "gfx/misc/nav_line" ),
|
||||
FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AngleVectors(self->client->ps.viewangles, forward, NULL, NULL);
|
||||
VectorCopy(self->client->ps.viewangles, angles);
|
||||
VectorCopy(self->client->renderInfo.eyePoint, origin);
|
||||
}
|
||||
VectorNormalize( forward );
|
||||
VectorMA( self->client->renderInfo.eyePoint, 2048, forward, end );
|
||||
VectorMA( origin, 2048, forward, end );
|
||||
|
||||
//Cause a distraction if enemy is not fighting
|
||||
gi.trace( &tr, self->client->renderInfo.eyePoint, vec3_origin, vec3_origin, end, self->s.number, MASK_OPAQUE|CONTENTS_BODY, G2_NOCOLLIDE, 0 );
|
||||
gi.trace( &tr, origin, vec3_origin, vec3_origin, end, self->s.number, MASK_OPAQUE|CONTENTS_BODY, G2_NOCOLLIDE, 0 );
|
||||
if ( tr.entityNum == ENTITYNUM_NONE || tr.fraction == 1.0 || tr.allsolid || tr.startsolid )
|
||||
{
|
||||
return;
|
||||
|
@ -6987,20 +7017,36 @@ void ForceGrip( gentity_t *self )
|
|||
{
|
||||
BG_CalculateVROffHandPosition(origin, angles);
|
||||
AngleVectors(angles, forward, NULL, NULL);
|
||||
|
||||
if (cg_showForcePowerDirection.integer)
|
||||
{
|
||||
vec3_t origin, angles;
|
||||
vec3_t color = { 0, 255, 0 };
|
||||
AngleVectors( angles, forward, NULL, NULL );
|
||||
VectorMA( origin, FORCE_GRIP_DIST, forward, end );
|
||||
FX_AddLine( origin, end, 0.1f, 1.0f, 0.0f,
|
||||
1.0f, 0.0f, 0.0f,
|
||||
color, color, 0.0f,
|
||||
500, cgi_R_RegisterShader( "gfx/misc/nav_line" ),
|
||||
FX_SIZE_LINEAR | FX_ALPHA_LINEAR );
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AngleVectors(self->client->ps.viewangles, forward, NULL, NULL);
|
||||
VectorCopy(self->client->ps.viewangles, angles);
|
||||
VectorCopy(self->client->renderInfo.eyePoint, origin);
|
||||
}
|
||||
|
||||
VectorNormalize( forward );
|
||||
VectorMA( self->client->renderInfo.handLPoint, FORCE_GRIP_DIST, forward, end );
|
||||
|
||||
if ( self->enemy && (self->s.number || InFront( self->enemy->currentOrigin, self->client->renderInfo.eyePoint, angles, 0.2f ) ) )
|
||||
if ( self->enemy && (self->s.number || InFront( self->enemy->currentOrigin, origin, angles, 0.2f ) ) )
|
||||
{//NPCs can always lift enemy since we assume they're looking at them, players need to be facing the enemy
|
||||
if ( gi.inPVS( self->enemy->currentOrigin, self->client->renderInfo.eyePoint ) )
|
||||
if ( gi.inPVS( self->enemy->currentOrigin, origin ) )
|
||||
{//must be in PVS
|
||||
gi.trace( &tr, self->client->renderInfo.eyePoint, vec3_origin, vec3_origin, self->enemy->currentOrigin, self->s.number, MASK_SHOT, G2_NOCOLLIDE, 0 );
|
||||
gi.trace( &tr, origin, vec3_origin, vec3_origin, self->enemy->currentOrigin, self->s.number, MASK_SHOT, G2_NOCOLLIDE, 0 );
|
||||
if ( tr.fraction == 1.0f || tr.entityNum == self->enemy->s.number )
|
||||
{//must have clear LOS
|
||||
traceEnt = self->enemy;
|
||||
|
|
Binary file not shown.
|
@ -1002,6 +1002,74 @@
|
|||
|
||||
}
|
||||
|
||||
itemDef
|
||||
{
|
||||
name none
|
||||
group weaponcontrols
|
||||
type ITEM_TYPE_YESNO
|
||||
text "Show Force Power Direction:"
|
||||
cvar "cg_showForcePowerDirection"
|
||||
rect 305 251 300 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 151
|
||||
textaligny -2
|
||||
font 2
|
||||
textscale 0.8
|
||||
forecolor 1 1 1 1
|
||||
visible 0
|
||||
// appearance_slot 2
|
||||
descText "Hint as to which direction a force power was fired."
|
||||
action
|
||||
{
|
||||
play sound/interface/button1
|
||||
}
|
||||
|
||||
mouseenter
|
||||
{
|
||||
show highlight4
|
||||
}
|
||||
|
||||
mouseexit
|
||||
{
|
||||
hide highlight4
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
itemDef
|
||||
{
|
||||
name none
|
||||
group weaponcontrols
|
||||
type ITEM_TYPE_YESNO
|
||||
text "Show Force Speed FOV Change:"
|
||||
cvar "cg_forceSpeedFOVAdjust"
|
||||
rect 305 271 300 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 151
|
||||
textaligny -2
|
||||
font 2
|
||||
textscale 0.8
|
||||
forecolor 1 1 1 1
|
||||
visible 0
|
||||
// appearance_slot 2
|
||||
descText "Whether the FOV will be adjusted briefly when engaging Force Speed."
|
||||
action
|
||||
{
|
||||
play sound/interface/button1
|
||||
}
|
||||
|
||||
mouseenter
|
||||
{
|
||||
show highlight4
|
||||
}
|
||||
|
||||
mouseexit
|
||||
{
|
||||
hide highlight4
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -1012,6 +1012,74 @@
|
|||
|
||||
}
|
||||
|
||||
itemDef
|
||||
{
|
||||
name none
|
||||
group weaponcontrols
|
||||
type ITEM_TYPE_YESNO
|
||||
text "Show Force Power Direction:"
|
||||
cvar "cg_showForcePowerDirection"
|
||||
rect 305 251 300 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 151
|
||||
textaligny -2
|
||||
font 2
|
||||
textscale 0.8
|
||||
forecolor 1 1 1 1
|
||||
visible 0
|
||||
// appearance_slot 2
|
||||
descText "Hint as to which direction a force power was fired."
|
||||
action
|
||||
{
|
||||
play sound/interface/button1
|
||||
}
|
||||
|
||||
mouseenter
|
||||
{
|
||||
show highlight4
|
||||
}
|
||||
|
||||
mouseexit
|
||||
{
|
||||
hide highlight4
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
itemDef
|
||||
{
|
||||
name none
|
||||
group weaponcontrols
|
||||
type ITEM_TYPE_YESNO
|
||||
text "Show Force Speed FOV Change:"
|
||||
cvar "cg_forceSpeedFOVAdjust"
|
||||
rect 305 271 300 20
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 151
|
||||
textaligny -2
|
||||
font 2
|
||||
textscale 0.8
|
||||
forecolor 1 1 1 1
|
||||
visible 0
|
||||
// appearance_slot 2
|
||||
descText "Whether the FOV will be adjusted briefly when engaging Force Speed."
|
||||
action
|
||||
{
|
||||
play sound/interface/button1
|
||||
}
|
||||
|
||||
mouseenter
|
||||
{
|
||||
show highlight4
|
||||
}
|
||||
|
||||
mouseexit
|
||||
{
|
||||
hide highlight4
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue