mirror of
https://github.com/DrBeef/Doom3Quest.git
synced 2024-11-27 06:13:24 +00:00
Start of RoE / Updated Assets
This commit is contained in:
parent
6355e3ba48
commit
8f1d0e0d1e
26 changed files with 2926 additions and 175 deletions
|
@ -92,7 +92,7 @@ const int IMPULSE_33 = 33; // toggle lasersight
|
|||
const int IMPULSE_34 = 34; // comfort turn right
|
||||
const int IMPULSE_35 = 35; // comfort turn left
|
||||
const int IMPULSE_36 = 36; // toggle hud
|
||||
const int IMPULSE_37 = 37; // toggle headingbeam
|
||||
const int IMPULSE_37 = 37; // free
|
||||
const int IMPULSE_38 = 38; // walk in place
|
||||
const int IMPULSE_39 = 39; // freelook
|
||||
const int IMPULSE_40 = 40; // Vehicle
|
||||
|
|
|
@ -1117,6 +1117,61 @@ void idAFEntity_Gibbable::Damage( idEntity *inflictor, idEntity *attacker, const
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
idAFEntity_Gibbable::SetThrown
|
||||
=====================
|
||||
*/
|
||||
void idAFEntity_Gibbable::SetThrown( bool isThrown )
|
||||
{
|
||||
|
||||
if( isThrown )
|
||||
{
|
||||
int i, num = af.GetPhysics()->GetNumBodies();
|
||||
|
||||
for( i = 0; i < num; i++ )
|
||||
{
|
||||
idAFBody* body;
|
||||
|
||||
body = af.GetPhysics()->GetBody( i );
|
||||
body->SetClipMask( MASK_MONSTERSOLID );
|
||||
}
|
||||
}
|
||||
|
||||
wasThrown = isThrown;
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
idAFEntity_Gibbable::Collide
|
||||
=====================
|
||||
*/
|
||||
bool idAFEntity_Gibbable::Collide( const trace_t& collision, const idVec3& velocity )
|
||||
{
|
||||
|
||||
if( !gibbed && wasThrown )
|
||||
{
|
||||
|
||||
// Everything gibs (if possible)
|
||||
if( spawnArgs.GetBool( "gib" ) )
|
||||
{
|
||||
idEntity* ent;
|
||||
|
||||
ent = gameLocal.entities[ collision.c.entityNum ];
|
||||
if( ent->fl.takedamage )
|
||||
{
|
||||
ent->Damage( this, gameLocal.GetLocalPlayer(), collision.c.normal, "damage_thrown_ragdoll", 1.f, CLIPMODEL_ID_TO_JOINT_HANDLE( collision.c.id ) );
|
||||
}
|
||||
|
||||
idVec3 vel = velocity;
|
||||
vel.NormalizeFast();
|
||||
Gib( vel, "damage_gib" );
|
||||
}
|
||||
}
|
||||
|
||||
return idAFEntity_Base::Collide( collision, velocity );
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
idAFEntity_Gibbable::SpawnGibs
|
||||
|
@ -1158,6 +1213,8 @@ void idAFEntity_Gibbable::SpawnGibs( const idVec3 &dir, const char *damageDefNam
|
|||
velocity += ( i & 1 ) ? dir : -dir;
|
||||
list[i]->GetPhysics()->SetLinearVelocity( velocity * 75.0f );
|
||||
}
|
||||
// Don't allow grabber to pick up temporary gibs
|
||||
list[i]->noGrab = true;
|
||||
list[i]->GetRenderEntity()->noShadow = true;
|
||||
list[i]->GetRenderEntity()->shaderParms[ SHADERPARM_TIME_OF_DEATH ] = gameLocal.time * 0.001f;
|
||||
list[i]->PostEventSec( &EV_Remove, 4.0f );
|
||||
|
|
|
@ -228,6 +228,8 @@ public:
|
|||
void Restore( idRestoreGame *savefile );
|
||||
virtual void Present( void );
|
||||
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location );
|
||||
void SetThrown( bool isThrown );
|
||||
virtual bool Collide( const trace_t& collision, const idVec3& velocity );
|
||||
virtual void SpawnGibs( const idVec3 &dir, const char *damageDefName );
|
||||
|
||||
protected:
|
||||
|
@ -235,6 +237,8 @@ protected:
|
|||
int skeletonModelDefHandle;
|
||||
bool gibbed;
|
||||
|
||||
bool wasThrown;
|
||||
|
||||
virtual void Gib( const idVec3 &dir, const char *damageDefName );
|
||||
void InitSkeletonModel( void );
|
||||
|
||||
|
|
|
@ -4860,6 +4860,26 @@ bool idEntity::ClientReceiveEvent( int event, int time, const idBitMsg &msg ) {
|
|||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idEntity::SetGrabbedState
|
||||
================
|
||||
*/
|
||||
void idEntity::SetGrabbedState( bool grabbed )
|
||||
{
|
||||
fl.grabbed = grabbed;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idEntity::IsGrabbed
|
||||
================
|
||||
*/
|
||||
bool idEntity::IsGrabbed()
|
||||
{
|
||||
return fl.grabbed;
|
||||
}
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
|
|
|
@ -157,8 +157,14 @@ public:
|
|||
bool isDormant :1; // if true the entity is dormant
|
||||
bool hasAwakened :1; // before a monster has been awakened the first time, use full PVS for dormant instead of area-connected
|
||||
bool networkSync :1; // if true the entity is synchronized over the network
|
||||
bool grabbed :1; // if true object is currently being grabbed
|
||||
} fl;
|
||||
|
||||
bool noGrab;
|
||||
|
||||
void SetGrabbedState( bool grabbed );
|
||||
bool IsGrabbed();
|
||||
|
||||
public:
|
||||
ABSTRACT_PROTOTYPE( idEntity );
|
||||
|
||||
|
|
|
@ -398,6 +398,12 @@ public:
|
|||
virtual gameReturn_t ClientPrediction( int clientNum, const usercmd_t *clientCmds, bool lastPredictFrame );
|
||||
|
||||
virtual void GetClientStats( int clientNum, char *data, const int len );
|
||||
|
||||
virtual bool IsInGame() const
|
||||
{
|
||||
return GameState() == GAMESTATE_ACTIVE;
|
||||
}
|
||||
|
||||
virtual void SwitchTeam( int clientNum, int team );
|
||||
|
||||
virtual bool DownloadRequest( const char *IP, const char *guid, const char *paks, char urls[ MAX_STRING_CHARS ] );
|
||||
|
|
|
@ -0,0 +1,917 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
#include "sys/platform.h"
|
||||
#include "Grabber.h"
|
||||
#include "../idlib/Dict.h"
|
||||
#include "../renderer/Material.h"
|
||||
#include "Moveable.h"
|
||||
#include "gamesys/SysCvar.h"
|
||||
#include "../cm/CollisionModel.h"
|
||||
#include "../idlib/bv/Bounds.h"
|
||||
#include "Player.h"
|
||||
#include "ai/AI.h"
|
||||
|
||||
#define MAX_DRAG_TRACE_DISTANCE 384.0f
|
||||
#define TRACE_BOUNDS_SIZE 3.f
|
||||
#define HOLD_DISTANCE 72.f
|
||||
#define FIRING_DELAY 1000.0f
|
||||
#define DRAG_FAIL_LEN 64.f
|
||||
#define THROW_SCALE 1000
|
||||
#define MAX_PICKUP_VELOCITY 1500 * 1500
|
||||
#define MAX_PICKUP_SIZE 96
|
||||
|
||||
idCVar vr_grabberBeamWidth( "vr_grabberBeamWidth", "4", CVAR_INTEGER | CVAR_GAME | CVAR_ARCHIVE, "Beam width for grabber in VR. Default 4." );
|
||||
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
Allows entities to be dragged through the world with physics.
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
CLASS_DECLARATION( idEntity, idGrabber )
|
||||
END_CLASS
|
||||
|
||||
/*
|
||||
==============
|
||||
idGrabber::idGrabber
|
||||
==============
|
||||
*/
|
||||
idGrabber::idGrabber()
|
||||
{
|
||||
dragEnt = NULL;
|
||||
owner = NULL;
|
||||
weapon = NULL;
|
||||
beam = NULL;
|
||||
beamTarget = NULL;
|
||||
oldImpulseSequence = 0;
|
||||
shakeForceFlip = false;
|
||||
holdingAF = false;
|
||||
endTime = 0;
|
||||
lastFiredTime = -FIRING_DELAY;
|
||||
dragFailTime = 0;
|
||||
startDragTime = 0;
|
||||
warpId = -1;
|
||||
dragTraceDist = MAX_DRAG_TRACE_DISTANCE;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
idGrabber::~idGrabber
|
||||
==============
|
||||
*/
|
||||
idGrabber::~idGrabber()
|
||||
{
|
||||
StopDrag( true );
|
||||
if( beam )
|
||||
{
|
||||
delete beam;
|
||||
}
|
||||
if( beamTarget )
|
||||
{
|
||||
delete beamTarget;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
idGrabber::Save
|
||||
==============
|
||||
*/
|
||||
void idGrabber::Save( idSaveGame* savefile ) const
|
||||
{
|
||||
|
||||
dragEnt.Save( savefile );
|
||||
savefile->WriteStaticObject( drag );
|
||||
|
||||
savefile->WriteVec3( saveGravity );
|
||||
savefile->WriteInt( id );
|
||||
|
||||
savefile->WriteVec3( localPlayerPoint );
|
||||
|
||||
owner.Save( savefile );
|
||||
|
||||
savefile->WriteBool( holdingAF );
|
||||
savefile->WriteBool( shakeForceFlip );
|
||||
|
||||
savefile->WriteInt( endTime );
|
||||
savefile->WriteInt( lastFiredTime );
|
||||
savefile->WriteInt( dragFailTime );
|
||||
savefile->WriteInt( startDragTime );
|
||||
savefile->WriteFloat( dragTraceDist );
|
||||
savefile->WriteInt( savedContents );
|
||||
savefile->WriteInt( savedClipmask );
|
||||
|
||||
savefile->WriteObject( beam );
|
||||
savefile->WriteObject( beamTarget );
|
||||
|
||||
savefile->WriteInt( warpId );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
idGrabber::Restore
|
||||
==============
|
||||
*/
|
||||
void idGrabber::Restore( idRestoreGame* savefile )
|
||||
{
|
||||
//Spawn the beams
|
||||
Initialize();
|
||||
|
||||
dragEnt.Restore( savefile );
|
||||
savefile->ReadStaticObject( drag );
|
||||
|
||||
savefile->ReadVec3( saveGravity );
|
||||
savefile->ReadInt( id );
|
||||
|
||||
// Restore the drag force's physics object
|
||||
if( dragEnt.IsValid() )
|
||||
{
|
||||
drag.SetPhysics( dragEnt.GetEntity()->GetPhysics(), id, dragEnt.GetEntity()->GetPhysics()->GetOrigin() );
|
||||
}
|
||||
|
||||
savefile->ReadVec3( localPlayerPoint );
|
||||
|
||||
owner.Restore( savefile );
|
||||
if( owner )
|
||||
weapon = owner->GetGrabberWeapon(); // Carl: Dual wielding, don't change save file format
|
||||
else
|
||||
weapon = NULL;
|
||||
|
||||
savefile->ReadBool( holdingAF );
|
||||
savefile->ReadBool( shakeForceFlip );
|
||||
|
||||
savefile->ReadInt( endTime );
|
||||
savefile->ReadInt( lastFiredTime );
|
||||
savefile->ReadInt( dragFailTime );
|
||||
savefile->ReadInt( startDragTime );
|
||||
savefile->ReadFloat( dragTraceDist );
|
||||
savefile->ReadInt( savedContents );
|
||||
savefile->ReadInt( savedClipmask );
|
||||
|
||||
savefile->ReadObject( reinterpret_cast<idClass*&>( beam ) );
|
||||
savefile->ReadObject( reinterpret_cast<idClass*&>( beamTarget ) );
|
||||
|
||||
savefile->ReadInt( warpId );
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
idGrabber::Initialize
|
||||
==============
|
||||
*/
|
||||
void idGrabber::Initialize()
|
||||
{
|
||||
if( !gameLocal.isMultiplayer )
|
||||
{
|
||||
idDict args;
|
||||
|
||||
if( !beamTarget )
|
||||
{
|
||||
args.SetVector( "origin", vec3_origin );
|
||||
args.SetBool( "start_off", true );
|
||||
beamTarget = ( idBeam* )gameLocal.SpawnEntityType( idBeam::Type, &args );
|
||||
}
|
||||
|
||||
if( !beam )
|
||||
{
|
||||
args.Clear();
|
||||
args.Set( "target", beamTarget->name.c_str() );
|
||||
args.SetVector( "origin", vec3_origin );
|
||||
args.SetBool( "start_off", true );
|
||||
|
||||
// Koz begin
|
||||
args.Set( "width", vr_grabberBeamWidth.GetString() );
|
||||
// Koz end
|
||||
|
||||
args.Set( "skin", "textures/smf/flareSizeable" );
|
||||
args.Set( "_color", "0.0235 0.843 0.969 0.2" );
|
||||
beam = ( idBeam* )gameLocal.SpawnEntityType( idBeam::Type, &args );
|
||||
beam->SetShaderParm( 6, 1.0f );
|
||||
}
|
||||
|
||||
endTime = 0;
|
||||
dragTraceDist = MAX_DRAG_TRACE_DISTANCE;
|
||||
}
|
||||
else
|
||||
{
|
||||
beam = NULL;
|
||||
beamTarget = NULL;
|
||||
endTime = 0;
|
||||
dragTraceDist = MAX_DRAG_TRACE_DISTANCE;
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
idGrabber::SetDragDistance
|
||||
==============
|
||||
*/
|
||||
void idGrabber::SetDragDistance( float dist )
|
||||
{
|
||||
dragTraceDist = dist;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
idGrabber::StartDrag
|
||||
==============
|
||||
*/
|
||||
void idGrabber::StartDrag( idEntity* grabEnt, int id )
|
||||
{
|
||||
int clipModelId = id;
|
||||
idPlayer* thePlayer = owner.GetEntity();
|
||||
|
||||
holdingAF = false;
|
||||
dragFailTime = gameLocal.slow.time;
|
||||
startDragTime = gameLocal.slow.time;
|
||||
|
||||
//oldImpulseSequence = thePlayer->usercmd.impulseSequence;
|
||||
oldImpulseSequence = thePlayer->usercmd.impulse;
|
||||
|
||||
// set grabbed state for networking
|
||||
grabEnt->SetGrabbedState( true );
|
||||
|
||||
// This is the new object to drag around
|
||||
dragEnt = grabEnt;
|
||||
|
||||
// Show the beams!
|
||||
UpdateBeams();
|
||||
if ( beam )
|
||||
{
|
||||
beam->Show();
|
||||
}
|
||||
if ( beamTarget )
|
||||
{
|
||||
beamTarget->Show();
|
||||
}
|
||||
|
||||
// Move the object to the fast group (helltime)
|
||||
//grabEnt->timeGroup = TIME_GROUP2;
|
||||
|
||||
// Handle specific class types
|
||||
if ( grabEnt->IsType( idProjectile::Type ) )
|
||||
{
|
||||
idProjectile* p = (idProjectile*)grabEnt;
|
||||
|
||||
p->CatchProjectile( thePlayer, "_catch" );
|
||||
|
||||
// Make the projectile non-solid to other projectiles/enemies (special hack for helltime hunter)
|
||||
if ( !idStr::Cmp( grabEnt->GetEntityDefName(), "projectile_helltime_killer" ) )
|
||||
{
|
||||
savedContents = CONTENTS_PROJECTILE;
|
||||
savedClipmask = MASK_SHOT_RENDERMODEL | CONTENTS_PROJECTILE;
|
||||
}
|
||||
else
|
||||
{
|
||||
savedContents = grabEnt->GetPhysics()->GetContents();
|
||||
savedClipmask = grabEnt->GetPhysics()->GetClipMask();
|
||||
}
|
||||
grabEnt->GetPhysics()->SetContents( 0 );
|
||||
grabEnt->GetPhysics()->SetClipMask( CONTENTS_SOLID | CONTENTS_BODY );
|
||||
|
||||
}
|
||||
else if ( grabEnt->IsType( idExplodingBarrel::Type ) )
|
||||
{
|
||||
idExplodingBarrel* ebarrel = static_cast<idExplodingBarrel*>(grabEnt);
|
||||
|
||||
ebarrel->StartBurning();
|
||||
|
||||
}
|
||||
else if ( grabEnt->IsType( idAFEntity_Gibbable::Type ) )
|
||||
{
|
||||
holdingAF = true;
|
||||
clipModelId = 0;
|
||||
|
||||
if ( grabbableAI( grabEnt->spawnArgs.GetString( "classname" ) ) )
|
||||
{
|
||||
//GB FIX (static_cast from 'idEntity *' to 'idAI *', which are not related by inheritance, is not allowed)
|
||||
idAI* aiEnt = static_cast<idAI*>(grabEnt);
|
||||
aiEnt->StartRagdoll();
|
||||
}
|
||||
}
|
||||
else if ( grabEnt->IsType( idMoveableItem::Type ) )
|
||||
{
|
||||
// RB: 64 bit fixes, changed NULL to 0
|
||||
grabEnt->PostEventMS( &EV_Touch, 250, thePlayer, 0 );
|
||||
// RB end
|
||||
}
|
||||
|
||||
// Get the current physics object to manipulate
|
||||
idPhysics* phys = grabEnt->GetPhysics();
|
||||
|
||||
// Turn off gravity on object
|
||||
saveGravity = phys->GetGravity();
|
||||
phys->SetGravity( vec3_origin );
|
||||
|
||||
// hold it directly in front of player
|
||||
localPlayerPoint = (thePlayer->firstPersonViewAxis[0] * HOLD_DISTANCE) * thePlayer->firstPersonViewAxis.Transpose();
|
||||
|
||||
// Set the ending time for the hold
|
||||
endTime = gameLocal.time + g_grabberHoldSeconds.GetFloat() * 1000;
|
||||
|
||||
// Start up the Force_Drag to bring it in
|
||||
drag.Init( g_grabberDamping.GetFloat() );
|
||||
drag.SetPhysics( phys, clipModelId, thePlayer->firstPersonViewOrigin + localPlayerPoint * thePlayer->firstPersonViewAxis );
|
||||
|
||||
// start the screen warp
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
idGrabber::StopDrag
|
||||
==============
|
||||
*/
|
||||
void idGrabber::StopDrag( bool dropOnly )
|
||||
{
|
||||
idPlayer* thePlayer = owner.GetEntity();
|
||||
|
||||
if( beam )
|
||||
{
|
||||
beam->Hide();
|
||||
}
|
||||
if( beamTarget )
|
||||
{
|
||||
beamTarget->Hide();
|
||||
}
|
||||
|
||||
if( dragEnt.IsValid() )
|
||||
{
|
||||
idEntity* ent = dragEnt.GetEntity();
|
||||
|
||||
// set grabbed state for networking
|
||||
ent->SetGrabbedState( false );
|
||||
|
||||
// If a cinematic has started, allow dropped object to think in cinematics
|
||||
if( gameLocal.inCinematic )
|
||||
{
|
||||
ent->cinematic = true;
|
||||
}
|
||||
|
||||
// Restore Gravity
|
||||
ent->GetPhysics()->SetGravity( saveGravity );
|
||||
|
||||
// Move the object back to the slow group (helltime)
|
||||
//ent->timeGroup = TIME_GROUP1;
|
||||
|
||||
if( holdingAF )
|
||||
{
|
||||
idAFEntity_Gibbable* af = static_cast<idAFEntity_Gibbable*>( ent );
|
||||
idPhysics_AF* af_Phys = static_cast<idPhysics_AF*>( af->GetPhysics() );
|
||||
|
||||
if( grabbableAI( ent->spawnArgs.GetString( "classname" ) ) )
|
||||
{
|
||||
idAI* aiEnt = static_cast<idAI*>( ent );
|
||||
aiEnt->Damage( thePlayer, thePlayer, vec3_origin, "damage_suicide", 1.0f, INVALID_JOINT );
|
||||
}
|
||||
|
||||
af->SetThrown( !dropOnly );
|
||||
|
||||
// Reset timers so that it isn't forcibly put to rest in mid-air
|
||||
af_Phys->PutToRest();
|
||||
af_Phys->Activate();
|
||||
|
||||
af_Phys->SetTimeScaleRamp( MS2SEC( gameLocal.slow.time ) - 1.5f, MS2SEC( gameLocal.slow.time ) + 1.0f );
|
||||
}
|
||||
|
||||
// If the object isn't near its goal, just drop it in place.
|
||||
if( !ent->IsType( idProjectile::Type ) && ( dropOnly || drag.GetDistanceToGoal() > DRAG_FAIL_LEN ) )
|
||||
{
|
||||
ent->GetPhysics()->SetLinearVelocity( vec3_origin );
|
||||
thePlayer->StartSoundShader( declManager->FindSound( "grabber_maindrop" ), SND_CHANNEL_WEAPON, 0, false, NULL );
|
||||
|
||||
if( ent->IsType( idExplodingBarrel::Type ) )
|
||||
{
|
||||
idExplodingBarrel* ebarrel = static_cast<idExplodingBarrel*>( ent );
|
||||
|
||||
ebarrel->SetStability( true );
|
||||
ebarrel->StopBurning();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Shoot the object forward
|
||||
// Koz begin : in vr launch the object in the direction the grabber is pointing
|
||||
if ( game->isVR )
|
||||
{
|
||||
static idVec3 launchOrigin = vec3_zero;
|
||||
static idMat3 launchAxis = mat3_identity;
|
||||
|
||||
weapon->GetProjectileLaunchOriginAndAxis( launchOrigin, launchAxis );
|
||||
ent->ApplyImpulse( thePlayer, 0, ent->GetPhysics()->GetOrigin(), launchAxis[0] * THROW_SCALE * ent->GetPhysics()->GetMass() );
|
||||
}
|
||||
else // in normal play launch in the direction the body is facing
|
||||
{
|
||||
ent->ApplyImpulse( thePlayer, 0, ent->GetPhysics()->GetOrigin(), thePlayer->firstPersonViewAxis[0] * THROW_SCALE * ent->GetPhysics()->GetMass() );
|
||||
}
|
||||
// Koz end
|
||||
|
||||
thePlayer->StartSoundShader( declManager->FindSound( "grabber_release" ), SND_CHANNEL_WEAPON, 0, false, NULL );
|
||||
|
||||
// Orient projectiles away from the player
|
||||
if( ent->IsType( idProjectile::Type ) )
|
||||
{
|
||||
idPlayer* player = owner.GetEntity();
|
||||
idAngles ang = player->firstPersonViewAxis[0].ToAngles();
|
||||
|
||||
ang.pitch += 90.f;
|
||||
ent->GetPhysics()->SetAxis( ang.ToMat3() );
|
||||
ent->GetPhysics()->SetAngularVelocity( vec3_origin );
|
||||
|
||||
// Restore projectile contents
|
||||
ent->GetPhysics()->SetContents( savedContents );
|
||||
ent->GetPhysics()->SetClipMask( savedClipmask );
|
||||
|
||||
idProjectile* projectile = static_cast< idProjectile* >( ent );
|
||||
if( projectile != NULL )
|
||||
{
|
||||
projectile->SetLaunchedFromGrabber( true );
|
||||
}
|
||||
|
||||
}
|
||||
else if( ent->IsType( idMoveable::Type ) )
|
||||
{
|
||||
// Turn on damage for this object
|
||||
idMoveable* obj = static_cast<idMoveable*>( ent );
|
||||
obj->EnableDamage( true, 2.5f );
|
||||
obj->SetAttacker( thePlayer );
|
||||
|
||||
if( ent->IsType( idExplodingBarrel::Type ) )
|
||||
{
|
||||
idExplodingBarrel* ebarrel = static_cast<idExplodingBarrel*>( ent );
|
||||
ebarrel->SetStability( false );
|
||||
}
|
||||
|
||||
}
|
||||
else if( ent->IsType( idMoveableItem::Type ) )
|
||||
{
|
||||
ent->GetPhysics()->SetClipMask( MASK_MONSTERSOLID );
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the Force_Drag's control of the entity
|
||||
drag.RemovePhysics( ent->GetPhysics() );
|
||||
}
|
||||
|
||||
if( warpId != -1 )
|
||||
{
|
||||
thePlayer->playerView.FreeWarp( warpId );
|
||||
warpId = -1;
|
||||
}
|
||||
|
||||
lastFiredTime = gameLocal.time;
|
||||
dragEnt = NULL;
|
||||
endTime = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
idGrabber::Update
|
||||
==============
|
||||
*/
|
||||
int idGrabber::Update( idPlayer* player, idWeapon* weap, bool hide )
|
||||
{
|
||||
trace_t trace;
|
||||
idEntity* newEnt;
|
||||
|
||||
weapon = weap; // Carl: support Dual Wielding
|
||||
|
||||
// Koz begin
|
||||
idVec3 dragOrigin = vec3_zero;
|
||||
idMat3 dragAxis = mat3_identity;
|
||||
|
||||
|
||||
if ( gameLocal.IsInGame() && player != NULL) // Koz fix me
|
||||
{
|
||||
dragOrigin = player->firstPersonViewOrigin;
|
||||
dragAxis = player->firstPersonViewAxis;
|
||||
|
||||
if ( weapon != NULL )
|
||||
{
|
||||
if ( !weapon->GetMuzzlePositionWithHacks( dragOrigin, dragAxis ) )
|
||||
{
|
||||
dragOrigin = player->firstPersonViewOrigin;
|
||||
dragAxis = player->firstPersonViewAxis;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// Koz end
|
||||
|
||||
// pause before allowing refire
|
||||
if( lastFiredTime + FIRING_DELAY > gameLocal.time )
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
// Dead players release the trigger
|
||||
if( hide || player->health <= 0 )
|
||||
{
|
||||
StopDrag( true );
|
||||
if( hide )
|
||||
{
|
||||
lastFiredTime = gameLocal.time - FIRING_DELAY + 250;
|
||||
}
|
||||
return 3;
|
||||
}
|
||||
|
||||
// Check if object being held has been removed (dead demon, projectile, etc.)
|
||||
if( endTime > gameLocal.time )
|
||||
{
|
||||
bool abort = !dragEnt.IsValid();
|
||||
|
||||
if( !abort && dragEnt.GetEntity()->IsType( idProjectile::Type ) )
|
||||
{
|
||||
idProjectile* proj = ( idProjectile* )dragEnt.GetEntity();
|
||||
|
||||
if( proj->GetProjectileState() >= 3 )
|
||||
{
|
||||
abort = true;
|
||||
}
|
||||
}
|
||||
if( !abort && dragEnt.GetEntity() && dragEnt.GetEntity()->IsHidden() )
|
||||
{
|
||||
abort = true;
|
||||
}
|
||||
// Not in multiplayer :: Pressing "reload" lets you carefully drop an item
|
||||
if( !gameLocal.isMultiplayer && !abort && ( weapon->WEAPON_RELOAD ) ) // Carl: support dual wielding
|
||||
{
|
||||
abort = true;
|
||||
}
|
||||
|
||||
if( abort )
|
||||
{
|
||||
StopDrag( true );
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
owner = player;
|
||||
|
||||
// if no entity selected for dragging
|
||||
if( !dragEnt.GetEntity() )
|
||||
{
|
||||
idBounds bounds;
|
||||
idVec3 end;
|
||||
|
||||
|
||||
// Koz begin
|
||||
end = dragOrigin + dragAxis[0] * dragTraceDist;
|
||||
|
||||
bounds.Zero();
|
||||
bounds.ExpandSelf( TRACE_BOUNDS_SIZE );
|
||||
|
||||
// gameLocal.clip.TraceBounds( trace, player->firstPersonViewOrigin, end, bounds, MASK_SHOT_RENDERMODEL | CONTENTS_PROJECTILE | CONTENTS_MOVEABLECLIP, player );
|
||||
gameLocal.clip.TraceBounds( trace, dragOrigin, end, bounds, MASK_SHOT_RENDERMODEL | CONTENTS_PROJECTILE | CONTENTS_MOVEABLECLIP, player );
|
||||
// Koz end
|
||||
|
||||
// If the trace hit something
|
||||
if( trace.fraction < 1.0f )
|
||||
{
|
||||
newEnt = gameLocal.entities[ trace.c.entityNum ];
|
||||
|
||||
// if entity is already being grabbed then bypass
|
||||
if( gameLocal.isMultiplayer && newEnt && newEnt->IsGrabbed() )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Check if this is a valid entity to hold
|
||||
if( newEnt && ( newEnt->IsType( idMoveable::Type ) ||
|
||||
newEnt->IsType( idMoveableItem::Type ) ||
|
||||
newEnt->IsType( idProjectile::Type ) ||
|
||||
newEnt->IsType( idAFEntity_Gibbable::Type )
|
||||
) &&
|
||||
newEnt->noGrab == false &&
|
||||
newEnt->GetPhysics()->GetBounds().GetRadius() < MAX_PICKUP_SIZE &&
|
||||
newEnt->GetPhysics()->GetLinearVelocity().LengthSqr() < MAX_PICKUP_VELOCITY )
|
||||
{
|
||||
|
||||
bool validAF = true;
|
||||
|
||||
if( newEnt->IsType( idAFEntity_Gibbable::Type ) )
|
||||
{
|
||||
idAFEntity_Gibbable* afEnt = static_cast<idAFEntity_Gibbable*>( newEnt );
|
||||
|
||||
if( grabbableAI( newEnt->spawnArgs.GetString( "classname" ) ) )
|
||||
{
|
||||
// Make sure it's also active
|
||||
if( !afEnt->IsActive() )
|
||||
{
|
||||
validAF = false;
|
||||
}
|
||||
}
|
||||
else if( !afEnt->IsActiveAF() )
|
||||
{
|
||||
validAF = false;
|
||||
}
|
||||
}
|
||||
|
||||
if( validAF && weapon->WEAPON_ATTACK ) // Carl: If dual wielding, use attack button for this specific weapon
|
||||
{
|
||||
// Grab this entity and start dragging it around
|
||||
StartDrag( newEnt, trace.c.id );
|
||||
}
|
||||
else if( validAF )
|
||||
{
|
||||
// A holdable object is ready to be grabbed
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// check backwards server time in multiplayer
|
||||
bool allow = true;
|
||||
|
||||
if( gameLocal.isMultiplayer )
|
||||
{
|
||||
// if we've marched backwards
|
||||
if( gameLocal.slow.time < startDragTime )
|
||||
{
|
||||
allow = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if there is an entity selected for dragging
|
||||
if( dragEnt.GetEntity() && allow )
|
||||
{
|
||||
idPhysics* entPhys = dragEnt.GetEntity()->GetPhysics();
|
||||
idVec3 goalPos;
|
||||
|
||||
// If the player lets go of attack, or time is up
|
||||
if( !( weapon->WEAPON_ATTACK ) ) // Carl: support dual wielding
|
||||
{
|
||||
StopDrag( false );
|
||||
return 3;
|
||||
}
|
||||
if( gameLocal.time > endTime )
|
||||
{
|
||||
StopDrag( true );
|
||||
return 3;
|
||||
}
|
||||
|
||||
// Check if the player is standing on the object
|
||||
if( !holdingAF )
|
||||
{
|
||||
idBounds playerBounds;
|
||||
idBounds objectBounds = entPhys->GetAbsBounds();
|
||||
idVec3 newPoint = player->GetPhysics()->GetOrigin();
|
||||
|
||||
// create a bounds at the players feet
|
||||
playerBounds.Clear();
|
||||
playerBounds.AddPoint( newPoint );
|
||||
newPoint.z -= 1.f;
|
||||
playerBounds.AddPoint( newPoint );
|
||||
playerBounds.ExpandSelf( 8.f );
|
||||
|
||||
// If it intersects the object bounds, then drop it
|
||||
if( playerBounds.IntersectsBounds( objectBounds ) )
|
||||
{
|
||||
StopDrag( true );
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
// Shake the object at the end of the hold
|
||||
if( g_grabberEnableShake.GetBool() && !gameLocal.isMultiplayer )
|
||||
{
|
||||
ApplyShake();
|
||||
}
|
||||
|
||||
// Set and evaluate drag force
|
||||
|
||||
// Koz begin
|
||||
//goalPos = player->firstPersonViewOrigin + localPlayerPoint * player->firstPersonViewAxis;
|
||||
goalPos = dragOrigin + localPlayerPoint * dragAxis;
|
||||
// Koz end
|
||||
|
||||
drag.SetGoalPosition( goalPos );
|
||||
drag.Evaluate( gameLocal.time );
|
||||
|
||||
// If an object is flying too fast toward the player, stop it hard
|
||||
if( g_grabberHardStop.GetBool() )
|
||||
{
|
||||
idPlane theWall;
|
||||
idVec3 toPlayerVelocity, objectCenter;
|
||||
float toPlayerSpeed;
|
||||
|
||||
//toPlayerVelocity = -player->firstPersonViewAxis[0];
|
||||
toPlayerVelocity = -dragAxis[0]; // Koz
|
||||
|
||||
toPlayerSpeed = entPhys->GetLinearVelocity() * toPlayerVelocity;
|
||||
|
||||
if( toPlayerSpeed > 64.f )
|
||||
{
|
||||
objectCenter = entPhys->GetAbsBounds().GetCenter();
|
||||
|
||||
//theWall.SetNormal( player->firstPersonViewAxis[0] );
|
||||
theWall.SetNormal( dragAxis[0] ); // Koz
|
||||
|
||||
theWall.FitThroughPoint( goalPos );
|
||||
|
||||
if( theWall.Side( objectCenter, 0.1f ) == PLANESIDE_BACK )
|
||||
{
|
||||
int i, num;
|
||||
|
||||
num = entPhys->GetNumClipModels();
|
||||
for( i = 0; i < num; i++ )
|
||||
{
|
||||
entPhys->SetLinearVelocity( vec3_origin, i );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Make sure the object isn't spinning too fast
|
||||
const float MAX_ROTATION_SPEED = 12.f;
|
||||
|
||||
idVec3 angVel = entPhys->GetAngularVelocity();
|
||||
float rotationSpeed = angVel.LengthFast();
|
||||
|
||||
if( rotationSpeed > MAX_ROTATION_SPEED )
|
||||
{
|
||||
angVel.NormalizeFast();
|
||||
angVel *= MAX_ROTATION_SPEED;
|
||||
entPhys->SetAngularVelocity( angVel );
|
||||
}
|
||||
}
|
||||
|
||||
// Orient projectiles away from the player
|
||||
if( dragEnt.GetEntity()->IsType( idProjectile::Type ) )
|
||||
{
|
||||
//idAngles ang = player->firstPersonViewAxis[0].ToAngles();
|
||||
idAngles ang = dragAxis[0].ToAngles(); // Koz
|
||||
|
||||
ang.pitch += 90.f;
|
||||
entPhys->SetAxis( ang.ToMat3() );
|
||||
}
|
||||
|
||||
// Some kind of effect from gun to object?
|
||||
UpdateBeams();
|
||||
|
||||
// If the object is stuck away from its intended position for more than 500ms, let it go.
|
||||
if( drag.GetDistanceToGoal() > DRAG_FAIL_LEN )
|
||||
{
|
||||
if( dragFailTime < ( gameLocal.slow.time - 500 ) )
|
||||
{
|
||||
StopDrag( true );
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dragFailTime = gameLocal.slow.time;
|
||||
}
|
||||
|
||||
// Currently holding an object
|
||||
return 2;
|
||||
}
|
||||
|
||||
// Not holding, nothing to hold
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
======================
|
||||
idGrabber::UpdateBeams
|
||||
======================
|
||||
*/
|
||||
void idGrabber::UpdateBeams()
|
||||
{
|
||||
jointHandle_t muzzle_joint;
|
||||
idVec3 muzzle_origin;
|
||||
idMat3 muzzle_axis;
|
||||
renderEntity_t* re;
|
||||
|
||||
if( !beam )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( dragEnt.IsValid() )
|
||||
{
|
||||
idPlayer* thePlayer = owner.GetEntity();
|
||||
|
||||
if( beamTarget )
|
||||
{
|
||||
beamTarget->SetOrigin( dragEnt.GetEntity()->GetPhysics()->GetAbsBounds().GetCenter() );
|
||||
}
|
||||
|
||||
muzzle_joint = weapon.GetEntity()->GetAnimator()->GetJointHandle( /* "particle_upper" */ "beam" ); // Koz
|
||||
if( muzzle_joint != INVALID_JOINT )
|
||||
{
|
||||
weapon.GetEntity()->GetJointWorldTransform( muzzle_joint, gameLocal.time, muzzle_origin, muzzle_axis );
|
||||
|
||||
// Koz begin
|
||||
// move the beam forward 3 inches to prevent it from distorting the (now complete) grabber viewmodel.
|
||||
muzzle_origin += muzzle_axis[0] * 3.0;
|
||||
// Koz end
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
muzzle_origin = thePlayer->GetPhysics()->GetOrigin();
|
||||
}
|
||||
|
||||
beam->SetOrigin( muzzle_origin );
|
||||
re = beam->GetRenderEntity();
|
||||
re->origin = muzzle_origin;
|
||||
|
||||
beam->UpdateVisuals();
|
||||
beam->Present();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
idGrabber::ApplyShake
|
||||
==============
|
||||
*/
|
||||
void idGrabber::ApplyShake()
|
||||
{
|
||||
float u = 1 - ( float )( endTime - gameLocal.time ) / ( g_grabberHoldSeconds.GetFloat() * 1000 );
|
||||
|
||||
if( u >= 0.8f )
|
||||
{
|
||||
idVec3 point, impulse;
|
||||
float shakeForceMagnitude = 450.f;
|
||||
float mass = dragEnt.GetEntity()->GetPhysics()->GetMass();
|
||||
|
||||
shakeForceFlip = !shakeForceFlip;
|
||||
|
||||
// get point to rotate around
|
||||
point = dragEnt.GetEntity()->GetPhysics()->GetOrigin();
|
||||
point.y += 1;
|
||||
|
||||
// Articulated figures get less violent shake
|
||||
if( holdingAF )
|
||||
{
|
||||
shakeForceMagnitude = 120.f;
|
||||
}
|
||||
|
||||
// calc impulse
|
||||
if( shakeForceFlip )
|
||||
{
|
||||
impulse.Set( 0, 0, shakeForceMagnitude * u * mass );
|
||||
}
|
||||
else
|
||||
{
|
||||
impulse.Set( 0, 0, -shakeForceMagnitude * u * mass );
|
||||
}
|
||||
|
||||
dragEnt.GetEntity()->ApplyImpulse( NULL, 0, point, impulse );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
idGrabber::grabbableAI
|
||||
==============
|
||||
*/
|
||||
bool idGrabber::grabbableAI( const char* aiName )
|
||||
{
|
||||
// skip "monster_"
|
||||
aiName += 8;
|
||||
|
||||
if( !idStr::Cmpn( aiName, "flying_lostsoul", 15 ) ||
|
||||
!idStr::Cmpn( aiName, "demon_trite", 11 ) ||
|
||||
!idStr::Cmp( aiName, "flying_forgotten" ) ||
|
||||
!idStr::Cmp( aiName, "demon_cherub" ) ||
|
||||
!idStr::Cmp( aiName, "demon_tick" ) )
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
===========================================================================
|
||||
|
||||
Doom 3 BFG Edition GPL Source Code
|
||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
||||
|
||||
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
||||
|
||||
Doom 3 BFG Edition Source Code is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Doom 3 BFG Edition Source Code is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
||||
|
||||
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
||||
|
||||
===========================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
Grabber Object - Class to extend idWeapon to include functionality for
|
||||
manipulating physics objects.
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
#ifndef __GAME_GRABBER_H__
|
||||
#define __GAME_GRABBER_H__
|
||||
|
||||
#include "Entity.h"
|
||||
#include "physics/Force_Grab.h"
|
||||
|
||||
class idBeam;
|
||||
class idWeapon;
|
||||
|
||||
class idGrabber : public idEntity
|
||||
{
|
||||
public:
|
||||
CLASS_PROTOTYPE( idGrabber );
|
||||
|
||||
idGrabber();
|
||||
~idGrabber();
|
||||
|
||||
void Save( idSaveGame* savefile ) const;
|
||||
void Restore( idRestoreGame* savefile );
|
||||
|
||||
void Initialize();
|
||||
void SetDragDistance( float dist );
|
||||
int Update( idPlayer* player, idWeapon* weap, bool hide );
|
||||
|
||||
private:
|
||||
idEntityPtr<idEntity> dragEnt; // entity being dragged
|
||||
idForce_Grab drag;
|
||||
idVec3 saveGravity;
|
||||
|
||||
int id; // id of body being dragged
|
||||
idVec3 localPlayerPoint; // dragged point in player space
|
||||
idEntityPtr<idPlayer> owner;
|
||||
idEntityPtr<idWeapon> weapon;
|
||||
int oldImpulseSequence;
|
||||
bool holdingAF;
|
||||
bool shakeForceFlip;
|
||||
int endTime;
|
||||
int lastFiredTime;
|
||||
int dragFailTime;
|
||||
int startDragTime;
|
||||
float dragTraceDist;
|
||||
int savedContents;
|
||||
int savedClipmask;
|
||||
|
||||
idBeam* beam;
|
||||
idBeam* beamTarget;
|
||||
|
||||
int warpId;
|
||||
|
||||
bool grabbableAI( const char* aiName );
|
||||
void StartDrag( idEntity* grabEnt, int id );
|
||||
void StopDrag( bool dropOnly );
|
||||
void UpdateBeams();
|
||||
void ApplyShake();
|
||||
};
|
||||
|
||||
#endif /* !__GAME_GRABBER_H__ */
|
|
@ -469,6 +469,16 @@ void idMoveable::Event_BecomeNonSolid( void ) {
|
|||
BecomeNonSolid();
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idMoveable::SetAttacker
|
||||
================
|
||||
*/
|
||||
void idMoveable::SetAttacker( idEntity* ent )
|
||||
{
|
||||
attacker = ent;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idMoveable::Event_Activate
|
||||
|
@ -875,6 +885,56 @@ void idExplodingBarrel::Think( void ) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idExplodingBarrel::SetStability
|
||||
================
|
||||
*/
|
||||
void idExplodingBarrel::SetStability( bool stability )
|
||||
{
|
||||
isStable = stability;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idExplodingBarrel::IsStable
|
||||
================
|
||||
*/
|
||||
bool idExplodingBarrel::IsStable()
|
||||
{
|
||||
return isStable;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idExplodingBarrel::StartBurning
|
||||
================
|
||||
*/
|
||||
void idExplodingBarrel::StartBurning()
|
||||
{
|
||||
state = BURNING;
|
||||
AddParticles( "barrelfire.prt", true );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idExplodingBarrel::StartBurning
|
||||
================
|
||||
*/
|
||||
void idExplodingBarrel::StopBurning()
|
||||
{
|
||||
state = NORMAL;
|
||||
|
||||
if( particleModelDefHandle >= 0 )
|
||||
{
|
||||
gameRenderWorld->FreeEntityDef( particleModelDefHandle );
|
||||
particleModelDefHandle = -1;
|
||||
|
||||
particleTime = 0;
|
||||
memset( &particleRenderEntity, 0, sizeof( particleRenderEntity ) );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idExplodingBarrel::AddParticles
|
||||
|
|
|
@ -70,11 +70,17 @@ public:
|
|||
virtual void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location );
|
||||
virtual void WriteToSnapshot( idBitMsgDelta &msg ) const;
|
||||
virtual void ReadFromSnapshot( const idBitMsgDelta &msg );
|
||||
void SetAttacker( idEntity* ent );
|
||||
const idEntity* GetAttacker()
|
||||
{
|
||||
return attacker;
|
||||
}
|
||||
|
||||
protected:
|
||||
idPhysics_RigidBody physicsObj; // physics object
|
||||
idStr brokenModel; // model set when health drops down to or below zero
|
||||
idStr damage; // if > 0 apply damage to hit entities
|
||||
idEntity* attacker;
|
||||
idStr fxCollide; // fx system to start when collides with something
|
||||
int nextCollideFxTime; // next time it is ok to spawn collision fx
|
||||
float minDamageVelocity; // minimum velocity before moveable applies damage
|
||||
|
@ -158,6 +164,11 @@ public:
|
|||
void Save( idSaveGame *savefile ) const;
|
||||
void Restore( idRestoreGame *savefile );
|
||||
|
||||
bool IsStable();
|
||||
void SetStability( bool stability );
|
||||
void StartBurning();
|
||||
void StopBurning();
|
||||
|
||||
virtual void Think( void );
|
||||
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir,
|
||||
const char *damageDefName, const float damageScale, const int location );
|
||||
|
@ -190,6 +201,7 @@ private:
|
|||
int particleTime;
|
||||
int lightTime;
|
||||
float time;
|
||||
bool isStable;
|
||||
|
||||
void AddParticles( const char *name, bool burn );
|
||||
void AddLight( const char *name , bool burn );
|
||||
|
|
|
@ -47,6 +47,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "idlib/Lib.h"
|
||||
#include "Mover.h"
|
||||
#include "sys/sys_public.h"
|
||||
#include "framework/DeclSkin.h"
|
||||
|
||||
|
||||
const int ASYNC_PLAYER_INV_AMMO_BITS = idMath::BitsForInteger( 999 ); // 9 bits to cover the range [0, 999]
|
||||
|
@ -1240,9 +1241,6 @@ idPlayer::idPlayer() {
|
|||
holsterModelDefHandle = -1;
|
||||
memset( &holsterRenderEntity, 0, sizeof( holsterRenderEntity ) );
|
||||
|
||||
headingBeamHandle = -1;
|
||||
memset( &headingBeamEntity, 0, sizeof( headingBeamEntity ) );
|
||||
|
||||
hud = NULL;
|
||||
objectiveSystem = NULL;
|
||||
objectiveSystemOpen = false;
|
||||
|
@ -1804,15 +1802,6 @@ void idPlayer::Init( void ) {
|
|||
skinCrosshairCircleDot = declManager->FindSkin( "skins/vr/crosshairCircleDot" );
|
||||
skinCrosshairCross = declManager->FindSkin( "skins/vr/crosshairCross" );
|
||||
|
||||
|
||||
// heading indicator for VR - point the direction the body is facing.
|
||||
/*
|
||||
* memset( &headingBeamEntity, 0, sizeof( headingBeamEntity ) );
|
||||
headingBeamEntity.hModel = renderModelManager->FindModel( "/models/mapobjects/headingbeam.lwo" );
|
||||
skinHeadingSolid = declManager->FindSkin( "skins/models/headingbeamsolid" );
|
||||
skinHeadingArrows = declManager->FindSkin( "skins/models/headingbeamarrows" );
|
||||
skinHeadingArrowsScroll = declManager->FindSkin( "skins/models/headingbeamarrowsscroll" );*/
|
||||
|
||||
//GBFix Not in Original
|
||||
hudActive = true;
|
||||
PDAorigin = vec3_zero;
|
||||
|
@ -1924,6 +1913,7 @@ void idPlayer::Spawn( void ) {
|
|||
|
||||
idAFAttachment *headEnt = head;
|
||||
if ( headEnt ) {
|
||||
// supress head in non-player views, but allow it in mirrors and remote views
|
||||
headEnt->GetRenderEntity()->suppressSurfaceInViewID = entityNumber+1;
|
||||
headEnt->GetRenderEntity()->noSelfShadow = true;
|
||||
}
|
||||
|
@ -2416,7 +2406,6 @@ void idPlayer::Save( idSaveGame *savefile ) const {
|
|||
|
||||
// Koz begin
|
||||
savefile->WriteBool( hands[0].laserSightActive || hands[1].laserSightActive );
|
||||
savefile->WriteBool( headingBeamActive );
|
||||
savefile->WriteBool( hudActive );
|
||||
|
||||
savefile->WriteInt( commonVr->currentFlashlightMode );
|
||||
|
@ -2879,7 +2868,6 @@ void idPlayer::Restore( idRestoreGame *savefile ) {
|
|||
InitPlayerBones();
|
||||
|
||||
//re-init the VR ui models
|
||||
headingBeamHandle = -1;
|
||||
hudHandle = -1;
|
||||
|
||||
// re-init hud model
|
||||
|
@ -2888,14 +2876,6 @@ void idPlayer::Restore( idRestoreGame *savefile ) {
|
|||
hudEntity.customShader = declManager->FindMaterial( "vr/hud" );
|
||||
hudEntity.weaponDepthHack = vr_hudOcclusion.GetBool();
|
||||
|
||||
// re-init the heading beam model
|
||||
//memset( &headingBeamEntity, 0, sizeof( headingBeamEntity ) );
|
||||
//headingBeamEntity.hModel = renderModelManager->FindModel( "/models/mapobjects/headingbeam.lwo" );
|
||||
|
||||
// re-init skins for heading indicator, crosshair, and telepad
|
||||
skinHeadingSolid = declManager->FindSkin( "skins/models/headingbeamsolid" );
|
||||
skinHeadingArrows = declManager->FindSkin( "skins/models/headingbeamarrows" );
|
||||
skinHeadingArrowsScroll = declManager->FindSkin( "skins/models/headingbeamarrowsscroll" );
|
||||
skinCrosshairDot = declManager->FindSkin( "skins/vr/crosshairDot" );
|
||||
skinCrosshairCircleDot = declManager->FindSkin( "skins/vr/crosshairCircleDot" );
|
||||
skinCrosshairCross = declManager->FindSkin( "skins/vr/crosshairCross" );
|
||||
|
@ -2908,7 +2888,6 @@ void idPlayer::Restore( idRestoreGame *savefile ) {
|
|||
savefile->ReadBool( laserSightActive );
|
||||
hands[ 0 ].laserSightActive = laserSightActive;
|
||||
hands[ 1 ].laserSightActive = laserSightActive;
|
||||
savefile->ReadBool( headingBeamActive );
|
||||
savefile->ReadBool( hudActive );
|
||||
|
||||
savefile->ReadInt( commonVr->currentFlashlightMode );
|
||||
|
@ -3035,8 +3014,6 @@ void idPlayer::Restore( idRestoreGame *savefile ) {
|
|||
}
|
||||
|
||||
vr_weaponSight.SetModified(); // make sure these get initialized properly
|
||||
vr_headingBeamMode.SetModified();
|
||||
|
||||
aasState = 0;
|
||||
|
||||
// Koz end
|
||||
|
@ -3308,7 +3285,6 @@ void idPlayer::SavePersistantInfo( void ) {
|
|||
playerInfo.SetInt( "health", health );
|
||||
playerInfo.SetInt( "current_weapon", hands[ GetBestWeaponHand() ].currentWeapon );
|
||||
// Koz begin
|
||||
playerInfo.SetBool( "headingBeamActive", headingBeamActive );
|
||||
playerInfo.SetBool( "laserSightActive", hands[0].laserSightActive || hands[1].laserSightActive ); // Carl: don't change save format
|
||||
playerInfo.SetBool( "hudActive", hudActive );
|
||||
playerInfo.SetInt( "currentFlashMode", commonVr->currentFlashlightMode );
|
||||
|
@ -3342,7 +3318,6 @@ void idPlayer::RestorePersistantInfo( void ) {
|
|||
hands[vr_weaponHand.GetInteger()].idealWeapon = spawnArgs.GetInt( "current_weapon", "1" );
|
||||
hands[ 1 - vr_weaponHand.GetInteger() ].idealWeapon = weapon_fists;
|
||||
// Koz begin
|
||||
headingBeamActive = spawnArgs.GetBool( "headingBeamActive", "1" );
|
||||
bool laserSightActive = spawnArgs.GetBool( "laserSightActive", "1" );
|
||||
hands[ 0 ].laserSightActive = laserSightActive;
|
||||
hands[ 1 ].laserSightActive = laserSightActive;
|
||||
|
@ -3401,9 +3376,9 @@ void idPlayer::UpdateSkinSetup()
|
|||
|
||||
if ( game->isVR )
|
||||
{
|
||||
//idStr skinN = skin->GetName();
|
||||
idStr skinN = skin->GetName();
|
||||
//GB Force skin
|
||||
idStr skinN = "skins/characters/player/greenmarine_arm2";
|
||||
//idStr skinN = "skins/characters/player/greenmarine_arm2";
|
||||
|
||||
if ( strstr( skinN.c_str(), "skins/characters/player/tshirt_mp" ) )
|
||||
{
|
||||
|
@ -4281,6 +4256,9 @@ void idPlayer::FireWeapon( int hand, idWeapon *weap ) {
|
|||
if( g_infiniteAmmo.GetBool() || weap->AmmoInClip() || weap->AmmoAvailable() )
|
||||
{
|
||||
weapon_t w = weap->IdentifyWeapon();
|
||||
// Koz grabber doesn't fire projectiles, so player script won't trigger fire anim for hand if we dont do this
|
||||
if( w == WEAPON_GRABBER ) AI_WEAPON_FIRED = true;
|
||||
|
||||
AI_ATTACK_HELD = true;
|
||||
weap->BeginAttack();
|
||||
|
||||
|
@ -5625,10 +5603,10 @@ void idPlayerHand::NextWeapon( int dir )
|
|||
}
|
||||
|
||||
//GB don't let it cycle to the flashlight if we're the weapon hand
|
||||
if(w == owner->weapon_flashlight && whichHand == vr_weaponHand.GetInteger())
|
||||
/*if(w == owner->weapon_flashlight && whichHand == vr_weaponHand.GetInteger())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}*/
|
||||
|
||||
// Cycle to the flashlight if we're using our flashlight hand and the flashlight is in our inventory, OR if we set to include the flashlight in the weapon cycle.
|
||||
// todo: don't let it cycle to the flashlight if it's in the other hand and we're the weapon hand
|
||||
|
@ -8509,81 +8487,6 @@ void idPlayer::UpdateHolsterSlot()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Koz
|
||||
idPlayer::UpdateHeadingBeam
|
||||
*/
|
||||
void idPlayer::UpdateHeadingBeam()
|
||||
{
|
||||
if ( vr_headingBeamMode.IsModified() )
|
||||
{
|
||||
int mode = vr_headingBeamMode.GetInteger();
|
||||
vr_headingBeamMode.ClearModified();
|
||||
|
||||
|
||||
switch ( mode )
|
||||
{
|
||||
|
||||
case 0:
|
||||
headingBeamActive = false;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
headingBeamEntity.customSkin = skinHeadingSolid;
|
||||
headingBeamActive = true;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
headingBeamEntity.customSkin = skinHeadingArrows;
|
||||
headingBeamActive = true;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
headingBeamEntity.customSkin = skinHeadingArrowsScroll;
|
||||
headingBeamActive = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
headingBeamEntity.customSkin = skinHeadingArrowsScroll;
|
||||
headingBeamActive = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( !headingBeamActive )
|
||||
{
|
||||
// hide it
|
||||
headingBeamEntity.allowSurfaceInViewID = -1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
idVec3 beamOrigin = GetEyePosition();
|
||||
idMat3 beamAxis = idAngles( 0.0f, viewAngles.yaw, 0.0f ).ToMat3();
|
||||
|
||||
beamOrigin.z -= (pm_normalviewheight.GetFloat());
|
||||
|
||||
headingBeamEntity.axis = beamAxis;
|
||||
headingBeamEntity.origin = beamOrigin;
|
||||
headingBeamEntity.bounds.Zero();
|
||||
|
||||
headingBeamEntity.allowSurfaceInViewID = entityNumber + 1 ;
|
||||
|
||||
}
|
||||
|
||||
// make sure the entitydefs are updated
|
||||
/*
|
||||
if ( headingBeamHandle == -1 )
|
||||
{
|
||||
headingBeamHandle = gameRenderWorld->AddEntityDef( &headingBeamEntity );
|
||||
}
|
||||
else
|
||||
{
|
||||
gameRenderWorld->UpdateEntityDef( headingBeamHandle, &headingBeamEntity );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
idPlayer::CrashLand
|
||||
|
@ -9372,26 +9275,17 @@ void idPlayer::SetHandIKPos( int hand, idVec3 handOrigin, idMat3 handAxis, idQua
|
|||
|
||||
static idVec3 weaponHandAttachJointPositionLocal = vec3_zero;
|
||||
static idMat3 weaponHandAttachJointAxisLocal = mat3_identity;
|
||||
//idVec3 weaponHandAttachJointPositionGlobal = vec3_zero;
|
||||
//idMat3 weaponHandAttachJointAxisGlobal = mat3_identity;
|
||||
|
||||
idVec3 weaponHandAttachJointDefaultPositionLocal = vec3_zero;
|
||||
|
||||
//idVec3 handWeaponAttachJointPositionLocal = vec3_zero;
|
||||
//idMat3 handWeaponAttachJointAxisLocal = mat3_identity;
|
||||
//idVec3 handWeaponAttachJointPositionGlobal = vec3_zero;
|
||||
//idMat3 handWeaponAttachJointAxisGlobal = mat3_identity;
|
||||
|
||||
idVec3 weaponAttachDelta = vec3_zero;
|
||||
|
||||
idVec3 handAttacherPositionLocal = vec3_zero;
|
||||
idVec3 handAttacherPositionGlobal = vec3_zero;
|
||||
idMat3 handmat = mat3_identity;
|
||||
//idVec3 handDelta = vec3_zero;
|
||||
|
||||
//idMat3 rot180 = idAngles( 0.0f, 180.0f, 0.0f ).ToMat3();
|
||||
|
||||
|
||||
commonVr->currentHandWorldPosition[hand] = handOrigin;
|
||||
|
||||
hands[hand].handOrigin = handOrigin;
|
||||
|
@ -9608,6 +9502,20 @@ const idDeclPDA *idPlayer::GetPDA( void ) const {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
idPlayer::GetGrabberWeapon
|
||||
Carl: Dual wielding
|
||||
===============
|
||||
*/
|
||||
idWeapon* idPlayer::GetGrabberWeapon() const
|
||||
{
|
||||
if( hands[ 1 - vr_weaponHand.GetInteger() ].weapon.GetEntity() && hands[ 1 - vr_weaponHand.GetInteger() ].weapon->IdentifyWeapon() == WEAPON_GRABBER )
|
||||
return hands[ 1 - vr_weaponHand.GetInteger() ].weapon.GetEntity();
|
||||
else
|
||||
return hands[ vr_weaponHand.GetInteger() ].weapon.GetEntity();
|
||||
}
|
||||
|
||||
idWeapon * idPlayer::GetPDAWeapon() const
|
||||
{
|
||||
if( hands[ 1 - vr_weaponHand.GetInteger() ].weapon && hands[ 1 - vr_weaponHand.GetInteger() ].weapon->IdentifyWeapon() == WEAPON_PDA )
|
||||
|
@ -10215,12 +10123,6 @@ void idPlayer::PerformImpulse( int impulse ) {
|
|||
break;
|
||||
}
|
||||
|
||||
case IMPULSE_37: // toggle heading beam
|
||||
{
|
||||
ToggleHeadingBeam();
|
||||
break;
|
||||
}
|
||||
|
||||
case IMPULSE_39:// next flashlight mode
|
||||
{
|
||||
commonVr->NextFlashlightMode();
|
||||
|
@ -11947,7 +11849,6 @@ void idPlayer::Think( void ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( game->isVR ) UpdateHeadingBeam(); // Koz
|
||||
UpdatePDASlot();
|
||||
UpdateHolsterSlot();
|
||||
|
||||
|
@ -11994,19 +11895,6 @@ void idPlayer::ToggleLaserSight()
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
idPlayer::ToggleHeadingBeam Koz toggle heading beam
|
||||
==============
|
||||
*/
|
||||
void idPlayer::ToggleHeadingBeam()
|
||||
{
|
||||
if ( vr_headingBeamMode.GetInteger() != 0 )
|
||||
{
|
||||
headingBeamActive = !headingBeamActive;
|
||||
}
|
||||
}
|
||||
|
||||
// Carl: Context sensitive VR thumb clicks, and dual wielding
|
||||
// 0 = right hand, 1 = left hand; true if pressed, false if released; returns true if handled as thumb click
|
||||
// WARNING! Called from the input thread?
|
||||
|
@ -12901,6 +12789,7 @@ void idPlayer::UpdateLaserSight( int hand )
|
|||
commonVr->handInGui || // turn off lasersight if hand is in gui.
|
||||
gameLocal.inCinematic ||
|
||||
game->IsPDAOpen() || // Koz - turn off laser sight if using pda.
|
||||
weapon->GetGrabberState() >= 2 || // Koz turn off laser sight if grabber is dragging an entity
|
||||
showTeleport || !weapon->GetMuzzlePositionWithHacks(muzzleOrigin, muzzleAxis)) // no lasersight for fists,grenades,soulcube etc
|
||||
|
||||
{
|
||||
|
@ -13675,7 +13564,8 @@ bool idPlayer::GetHandOrHeadPositionWithHacks( int hand, idVec3& origin, idMat3&
|
|||
else if ( commonVr->GetCurrentFlashlightMode() == FLASHLIGHT_HAND && weaponEnabled && !spectating && !gameLocal.world->spawnArgs.GetBool("no_Weapons") && !game->IsPDAOpen() && !commonVr->PDAforcetoggle && hands[0].currentWeapon != weapon_pda && hands[1].currentWeapon != weapon_pda )
|
||||
{
|
||||
weapon_t currentWeapon = flashlight->IdentifyWeapon();
|
||||
CalculateViewFlashlightPos( origin, axis, flashlightOffsets[ int( currentWeapon ) ] );
|
||||
CalculateViewFlashlightPos( origin, axis, flashlightOffsets[hands[vr_weaponHand.GetInteger()].currentWeapon] );
|
||||
|
||||
return false;
|
||||
}
|
||||
// Carl: todo empty non-weapon hand (currently using head instead)
|
||||
|
@ -13728,6 +13618,9 @@ void idPlayer::CalculateViewFlashlightPos( idVec3 &origin, idMat3 &axis, idVec3
|
|||
if( flashlightMode == FLASHLIGHT_GUN )
|
||||
{
|
||||
weaponWithFlashlightMounted = GetWeaponWithMountedFlashlight();
|
||||
//GB ALTERNATIVE (think I have fixed elsewhere)
|
||||
//flashlightOffset = flashlightOffsets[int( weaponWithFlashlightMounted->IdentifyWeapon() )];
|
||||
|
||||
if( !weaponWithFlashlightMounted || !weaponWithFlashlightMounted->GetMuzzlePositionWithHacks( origin, axis ) || commonVr->handInGui )
|
||||
{
|
||||
idAngles flashlightAx = axis.ToAngles();
|
||||
|
@ -14349,7 +14242,8 @@ bool idPlayer::GetTeleportBeamOrigin( idVec3 &beamOrigin, idMat3 &beamAxis ) //
|
|||
if ( !hands[hand].weapon->ShowCrosshair() ||
|
||||
hands[hand].weapon->IsHidden() ||
|
||||
hands[ hand ].weapon->hideOffset != 0 || // Koz - turn off lasersight If gun is lowered ( in gui ).
|
||||
commonVr->handInGui // turn off lasersight if hand is in gui.
|
||||
commonVr->handInGui || // turn off lasersight if hand is in gui.
|
||||
hands[ hand ].weapon.GetEntity()->GetGrabberState() >= 2 // Koz turn off laser sight if grabber is dragging an entity
|
||||
)
|
||||
{
|
||||
return false;
|
||||
|
@ -16722,6 +16616,10 @@ void idPlayer::SetupHolsterSlot( int hand, int stashed )
|
|||
{
|
||||
holsterAxis = idAngles(0, -90, -90).ToMat3();
|
||||
}
|
||||
else if( strcmp(modelname, "models/weapons/grabber/grabber_world.ase") == 0 )
|
||||
{
|
||||
holsterAxis = idAngles(-90, 180, 0).ToMat3() * 0.5f;
|
||||
}
|
||||
else if (strcmp(modelname, "models/weapons/machinegun/w_machinegun.lwo") == 0)
|
||||
{
|
||||
holsterAxis = idAngles(0, 90, 90).ToMat3() * 0.75f;
|
||||
|
|
|
@ -109,7 +109,11 @@ enum {
|
|||
INVISIBILITY,
|
||||
MEGAHEALTH,
|
||||
ADRENALINE,
|
||||
MAX_POWERUPS
|
||||
INVULNERABILITY,
|
||||
HELLTIME,
|
||||
ENVIROSUIT,
|
||||
ENVIROTIME,
|
||||
MAX_POWERUPS
|
||||
};
|
||||
|
||||
// powerup modifiers
|
||||
|
@ -444,9 +448,6 @@ public:
|
|||
qhandle_t flashlightModelDefHandle; // handle to static renderer model
|
||||
|
||||
// Koz begin
|
||||
renderEntity_t headingBeamEntity; // Koz add a heading indicator pointing the direction the players body is facing.
|
||||
qhandle_t headingBeamHandle;
|
||||
bool headingBeamActive;
|
||||
const idDeclSkin* skinHeadingSolid;
|
||||
const idDeclSkin* skinHeadingArrows;
|
||||
const idDeclSkin* skinHeadingArrowsScroll;
|
||||
|
@ -694,8 +695,6 @@ public:
|
|||
void SetWeaponHandPose();
|
||||
void SetFlashHandPose(); // Set flashlight hand pose
|
||||
void ToggleLaserSight();
|
||||
void UpdateHeadingBeam();
|
||||
void ToggleHeadingBeam();
|
||||
void UpdateVrHud();
|
||||
void ToggleHud();
|
||||
void RecreateCopyJoints();
|
||||
|
@ -875,6 +874,7 @@ public:
|
|||
idWeapon* GetWeaponInHand( int hand ) const;
|
||||
// Carl: when the code needs just one weapon, guess which one is the "main" one
|
||||
idWeapon* GetMainWeapon();
|
||||
idWeapon* GetGrabberWeapon() const;
|
||||
idWeapon* GetPDAWeapon() const;
|
||||
idWeapon* GetWeaponWithMountedFlashlight();
|
||||
int GetBestWeaponHand();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -57,6 +57,338 @@ typedef struct {
|
|||
|
||||
#define MAX_SCREEN_BLOBS 8
|
||||
|
||||
class WarpPolygon_t
|
||||
{
|
||||
public:
|
||||
idVec4 outer1;
|
||||
idVec4 outer2;
|
||||
idVec4 center;
|
||||
};
|
||||
|
||||
class Warp_t
|
||||
{
|
||||
public:
|
||||
int id;
|
||||
bool active;
|
||||
|
||||
int startTime;
|
||||
float initialRadius;
|
||||
|
||||
idVec3 worldOrigin;
|
||||
idVec2 screenOrigin;
|
||||
|
||||
int durationMsec;
|
||||
|
||||
idList<WarpPolygon_t> polys;
|
||||
};
|
||||
|
||||
class idPlayerView;
|
||||
class FullscreenFXManager;
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
FxFader
|
||||
==================
|
||||
*/
|
||||
class FxFader
|
||||
{
|
||||
enum
|
||||
{
|
||||
FX_STATE_OFF,
|
||||
FX_STATE_RAMPUP,
|
||||
FX_STATE_RAMPDOWN,
|
||||
FX_STATE_ON
|
||||
};
|
||||
|
||||
int time;
|
||||
int state;
|
||||
float alpha;
|
||||
int msec;
|
||||
|
||||
public:
|
||||
FxFader();
|
||||
|
||||
// primary functions
|
||||
bool SetTriggerState( bool active );
|
||||
|
||||
virtual void Save( idSaveGame* savefile );
|
||||
virtual void Restore( idRestoreGame* savefile );
|
||||
|
||||
// fader functions
|
||||
void SetFadeTime( int t )
|
||||
{
|
||||
msec = t;
|
||||
};
|
||||
int GetFadeTime()
|
||||
{
|
||||
return msec;
|
||||
};
|
||||
|
||||
// misc functions
|
||||
float GetAlpha()
|
||||
{
|
||||
return alpha;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
FullscreenFX
|
||||
==================
|
||||
*/
|
||||
class FullscreenFX
|
||||
{
|
||||
protected:
|
||||
idStr name;
|
||||
FxFader fader;
|
||||
FullscreenFXManager* fxman;
|
||||
|
||||
public:
|
||||
FullscreenFX()
|
||||
{
|
||||
fxman = NULL;
|
||||
};
|
||||
virtual ~FullscreenFX() { };
|
||||
|
||||
virtual void Initialize() = 0;
|
||||
virtual bool Active() = 0;
|
||||
virtual void HighQuality() = 0;
|
||||
virtual void LowQuality() { };
|
||||
virtual void AccumPass( const renderView_t* view ) { };
|
||||
virtual bool HasAccum()
|
||||
{
|
||||
return false;
|
||||
};
|
||||
|
||||
void SetName( idStr n )
|
||||
{
|
||||
name = n;
|
||||
};
|
||||
idStr GetName()
|
||||
{
|
||||
return name;
|
||||
};
|
||||
|
||||
void SetFXManager( FullscreenFXManager* fx )
|
||||
{
|
||||
fxman = fx;
|
||||
};
|
||||
|
||||
bool SetTriggerState( bool state )
|
||||
{
|
||||
return fader.SetTriggerState( state );
|
||||
};
|
||||
void SetFadeSpeed( int msec )
|
||||
{
|
||||
fader.SetFadeTime( msec );
|
||||
};
|
||||
float GetFadeAlpha()
|
||||
{
|
||||
return fader.GetAlpha();
|
||||
};
|
||||
|
||||
virtual void Save( idSaveGame* savefile );
|
||||
virtual void Restore( idRestoreGame* savefile );
|
||||
};
|
||||
|
||||
/*
|
||||
==================
|
||||
FullscreenFX_Helltime
|
||||
==================
|
||||
*/
|
||||
class FullscreenFX_Helltime : public FullscreenFX
|
||||
{
|
||||
const idMaterial* initMaterial;
|
||||
const idMaterial* captureMaterials[3];
|
||||
const idMaterial* drawMaterial;
|
||||
bool clearAccumBuffer;
|
||||
|
||||
int DetermineLevel();
|
||||
|
||||
public:
|
||||
virtual void Initialize();
|
||||
virtual bool Active();
|
||||
virtual void HighQuality();
|
||||
virtual void AccumPass( const renderView_t* view );
|
||||
virtual bool HasAccum()
|
||||
{
|
||||
return true;
|
||||
};
|
||||
|
||||
virtual void Restore( idRestoreGame* savefile );
|
||||
};
|
||||
|
||||
/*
|
||||
==================
|
||||
FullscreenFX_Multiplayer
|
||||
==================
|
||||
*/
|
||||
class FullscreenFX_Multiplayer : public FullscreenFX
|
||||
{
|
||||
const idMaterial* initMaterial;
|
||||
const idMaterial* captureMaterial;
|
||||
const idMaterial* drawMaterial;
|
||||
bool clearAccumBuffer;
|
||||
|
||||
int DetermineLevel();
|
||||
|
||||
public:
|
||||
virtual void Initialize();
|
||||
virtual bool Active();
|
||||
virtual void HighQuality();
|
||||
virtual void AccumPass( const renderView_t* view );
|
||||
virtual bool HasAccum()
|
||||
{
|
||||
return true;
|
||||
};
|
||||
|
||||
virtual void Restore( idRestoreGame* savefile );
|
||||
};
|
||||
|
||||
/*
|
||||
==================
|
||||
FullscreenFX_Warp
|
||||
==================
|
||||
*/
|
||||
class FullscreenFX_Warp : public FullscreenFX
|
||||
{
|
||||
const idMaterial* material;
|
||||
bool grabberEnabled;
|
||||
int startWarpTime;
|
||||
|
||||
void DrawWarp( WarpPolygon_t wp, float interp );
|
||||
|
||||
public:
|
||||
virtual void Initialize();
|
||||
virtual bool Active();
|
||||
virtual void HighQuality();
|
||||
|
||||
void EnableGrabber( bool active )
|
||||
{
|
||||
grabberEnabled = active;
|
||||
startWarpTime = gameLocal.slow.time;
|
||||
};
|
||||
|
||||
virtual void Save( idSaveGame* savefile );
|
||||
virtual void Restore( idRestoreGame* savefile );
|
||||
};
|
||||
|
||||
/*
|
||||
==================
|
||||
FullscreenFX_EnviroSuit
|
||||
==================
|
||||
*/
|
||||
class FullscreenFX_EnviroSuit : public FullscreenFX
|
||||
{
|
||||
const idMaterial* material;
|
||||
|
||||
public:
|
||||
virtual void Initialize();
|
||||
virtual bool Active();
|
||||
virtual void HighQuality();
|
||||
};
|
||||
|
||||
/*
|
||||
==================
|
||||
FullscreenFX_DoubleVision
|
||||
==================
|
||||
*/
|
||||
class FullscreenFX_DoubleVision : public FullscreenFX
|
||||
{
|
||||
const idMaterial* material;
|
||||
|
||||
public:
|
||||
virtual void Initialize();
|
||||
virtual bool Active();
|
||||
virtual void HighQuality();
|
||||
};
|
||||
|
||||
/*
|
||||
==================
|
||||
FullscreenFX_InfluenceVision
|
||||
==================
|
||||
*/
|
||||
class FullscreenFX_InfluenceVision : public FullscreenFX
|
||||
{
|
||||
|
||||
public:
|
||||
virtual void Initialize();
|
||||
virtual bool Active();
|
||||
virtual void HighQuality();
|
||||
};
|
||||
|
||||
/*
|
||||
==================
|
||||
FullscreenFX_Bloom
|
||||
==================
|
||||
*/
|
||||
class FullscreenFX_Bloom : public FullscreenFX
|
||||
{
|
||||
const idMaterial* drawMaterial;
|
||||
const idMaterial* initMaterial;
|
||||
|
||||
float currentIntensity;
|
||||
float targetIntensity;
|
||||
|
||||
public:
|
||||
virtual void Initialize();
|
||||
virtual bool Active();
|
||||
virtual void HighQuality();
|
||||
|
||||
virtual void Save( idSaveGame* savefile );
|
||||
virtual void Restore( idRestoreGame* savefile );
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
FullscreenFXManager
|
||||
==================
|
||||
*/
|
||||
class FullscreenFXManager
|
||||
{
|
||||
idList<FullscreenFX*> fx;
|
||||
|
||||
idPlayerView* playerView;
|
||||
const idMaterial* blendBackMaterial;
|
||||
|
||||
void CreateFX( idStr name, idStr fxtype, int fade );
|
||||
|
||||
public:
|
||||
FullscreenFXManager();
|
||||
virtual ~FullscreenFXManager();
|
||||
|
||||
void Initialize( idPlayerView* pv );
|
||||
|
||||
void Process( const renderView_t* view );
|
||||
void Blendback( float alpha );
|
||||
|
||||
idPlayerView* GetPlayerView()
|
||||
{
|
||||
return playerView;
|
||||
};
|
||||
idPlayer* GetPlayer()
|
||||
{
|
||||
return gameLocal.GetLocalPlayer();
|
||||
};
|
||||
|
||||
int GetNum()
|
||||
{
|
||||
return fx.Num();
|
||||
};
|
||||
FullscreenFX* GetFX( int index )
|
||||
{
|
||||
return fx[index];
|
||||
};
|
||||
FullscreenFX* FindFX( idStr name );
|
||||
|
||||
void Save( idSaveGame* savefile );
|
||||
void Restore( idRestoreGame* savefile );
|
||||
};
|
||||
|
||||
class idPlayerView {
|
||||
public:
|
||||
idPlayerView();
|
||||
|
@ -105,9 +437,9 @@ private:
|
|||
void ScreenFade();
|
||||
|
||||
screenBlob_t * GetScreenBlob();
|
||||
|
||||
screenBlob_t screenBlobs[MAX_SCREEN_BLOBS];
|
||||
|
||||
public:
|
||||
int dvFinishTime; // double vision will be stopped at this time
|
||||
const idMaterial * dvMaterial; // material to take the double vision screen shot
|
||||
|
||||
|
@ -136,6 +468,11 @@ private:
|
|||
|
||||
idPlayer * player;
|
||||
renderView_t view;
|
||||
|
||||
FullscreenFXManager* fxManager;
|
||||
|
||||
int AddWarp( idVec3 worldOrigin, float centerx, float centery, float initialRadius, float durationMsec );
|
||||
void FreeWarp( int id );
|
||||
};
|
||||
|
||||
#endif /* !__GAME_PLAYERVIEW_H__ */
|
||||
|
|
|
@ -83,6 +83,7 @@ idProjectile::idProjectile( void ) {
|
|||
lightColor = vec3_zero;
|
||||
state = SPAWNED;
|
||||
damagePower = 1.0f;
|
||||
launchedFromGrabber = false;
|
||||
memset( &projectileFlags, 0, sizeof( projectileFlags ) );
|
||||
memset( &renderLight, 0, sizeof( renderLight ) );
|
||||
|
||||
|
@ -1060,6 +1061,45 @@ void idProjectile::Event_Touch( idEntity *other, trace_t *trace ) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idProjectile::CatchProjectile
|
||||
================
|
||||
*/
|
||||
void idProjectile::CatchProjectile( idEntity* o, const char* reflectName )
|
||||
{
|
||||
idEntity* prevowner = owner.GetEntity();
|
||||
|
||||
owner = o;
|
||||
physicsObj.GetClipModel()->SetOwner( o );
|
||||
|
||||
if( this->IsType( idGuidedProjectile::Type ) )
|
||||
{
|
||||
idGuidedProjectile* proj = static_cast<idGuidedProjectile*>( this );
|
||||
|
||||
proj->SetEnemy( prevowner );
|
||||
}
|
||||
|
||||
idStr s = spawnArgs.GetString( "def_damage" );
|
||||
s += reflectName;
|
||||
|
||||
const idDict* damageDef = gameLocal.FindEntityDefDict( s, false );
|
||||
if( damageDef )
|
||||
{
|
||||
spawnArgs.Set( "def_damage", s );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idProjectile::GetProjectileState
|
||||
================
|
||||
*/
|
||||
int idProjectile::GetProjectileState()
|
||||
{
|
||||
return ( int )state;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
idProjectile::ClientPredictionCollide
|
||||
|
@ -1481,6 +1521,10 @@ void idGuidedProjectile::Launch( const idVec3 &start, const idVec3 &dir, const i
|
|||
UpdateVisuals();
|
||||
}
|
||||
|
||||
void idGuidedProjectile::SetEnemy( idEntity* ent )
|
||||
{
|
||||
enemy = ent;
|
||||
}
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
|
|
@ -60,6 +60,8 @@ public :
|
|||
virtual void FreeLightDef( void );
|
||||
|
||||
idEntity * GetOwner( void ) const;
|
||||
void CatchProjectile( idEntity* o, const char* reflectName );
|
||||
int GetProjectileState();
|
||||
|
||||
virtual void Think( void );
|
||||
virtual void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location );
|
||||
|
@ -75,6 +77,15 @@ public :
|
|||
EVENT_MAXEVENTS
|
||||
};
|
||||
|
||||
void SetLaunchedFromGrabber( bool bl )
|
||||
{
|
||||
launchedFromGrabber = bl;
|
||||
}
|
||||
bool GetLaunchedFromGrabber()
|
||||
{
|
||||
return launchedFromGrabber;
|
||||
}
|
||||
|
||||
static void DefaultDamageEffect( idEntity *soundEnt, const idDict &projectileDef, const trace_t &collision, const idVec3 &velocity );
|
||||
static bool ClientPredictionCollide( idEntity *soundEnt, const idDict &projectileDef, const trace_t &collision, const idVec3 &velocity, bool addDamageEffect );
|
||||
virtual void ClientPredictionThink( void );
|
||||
|
@ -93,6 +104,8 @@ protected:
|
|||
bool noSplashDamage : 1;
|
||||
} projectileFlags;
|
||||
|
||||
bool launchedFromGrabber;
|
||||
|
||||
float thrust;
|
||||
int thrust_end;
|
||||
float damagePower;
|
||||
|
@ -146,6 +159,8 @@ public :
|
|||
void Spawn( void );
|
||||
virtual void Think( void );
|
||||
virtual void Launch( const idVec3 &start, const idVec3 &dir, const idVec3 &pushVelocity, const float timeSinceFire = 0.0f, const float launchPower = 1.0f, const float dmgPower = 1.0f );
|
||||
void SetEnemy( idEntity* ent );
|
||||
void Event_SetEnemy( idEntity* ent );
|
||||
|
||||
protected:
|
||||
float speed;
|
||||
|
|
|
@ -98,8 +98,6 @@ idCVar vr_deadzoneYaw( "vr_deadzoneYaw", "30", CVAR_FLOAT | CVAR_GAME | CVAR_ARC
|
|||
//Not sure if this is used or Dr Beefs setting - not in menu
|
||||
idCVar vr_comfortDelta( "vr_comfortDelta", "10", CVAR_FLOAT | CVAR_GAME | CVAR_ARCHIVE, "Comfort Mode turning angle ", 0, 180 );
|
||||
|
||||
//In Menu- Not working
|
||||
idCVar vr_headingBeamMode( "vr_headingBeamMode", "1", CVAR_INTEGER | CVAR_GAME | CVAR_ARCHIVE, "0 = disabled, 1 = solid, 2 = arrows, 3 = scrolling arrows" );
|
||||
//In menu - Working fine
|
||||
idCVar vr_weaponSight( "vr_weaponSight", "3", CVAR_INTEGER | CVAR_ARCHIVE, "Weapon Sight.\n 0 = Lasersight\n 1 = Red dot\n 2 = Circle dot\n 3 = Crosshair\n 4 = Beam + Dot\n" );
|
||||
idCVar vr_weaponSightToSurface( "vr_weaponSightToSurface", "1", CVAR_INTEGER | CVAR_ARCHIVE, "Map sight to surface. 0 = Disabled 1 = Enabled\n" );
|
||||
|
|
|
@ -469,8 +469,6 @@ extern idCVar vr_deadzonePitch;
|
|||
extern idCVar vr_deadzoneYaw;
|
||||
extern idCVar vr_comfortDelta;
|
||||
|
||||
extern idCVar vr_headingBeamMode;
|
||||
|
||||
extern idCVar vr_weaponSight;
|
||||
extern idCVar vr_weaponSightToSurface;
|
||||
|
||||
|
|
|
@ -89,6 +89,9 @@ const idEventDef EV_Weapon_AutoReload( "autoReload", NULL, 'f' );
|
|||
const idEventDef EV_Weapon_NetReload( "netReload" );
|
||||
const idEventDef EV_Weapon_IsInvisible( "isInvisible", NULL, 'f' );
|
||||
const idEventDef EV_Weapon_NetEndReload( "netEndReload" );
|
||||
const idEventDef EV_Weapon_GrabberHasTarget( "grabberHasTarget", NULL, 'd' );
|
||||
const idEventDef EV_Weapon_Grabber( "grabber", "d" );
|
||||
const idEventDef EV_Weapon_Grabber_SetGrabDistance( "grabberGrabDistance", "f" );
|
||||
// Koz
|
||||
const idEventDef EV_Weapon_GetWeaponSkin( "getWeaponSkin", NULL, 's' );
|
||||
const idEventDef EV_Weapon_IsMotionControlled( "isMotionControlled", NULL, 'd' );
|
||||
|
@ -133,6 +136,9 @@ CLASS_DECLARATION( idAnimatedEntity, idWeapon )
|
|||
EVENT( EV_Weapon_NetReload, idWeapon::Event_NetReload )
|
||||
EVENT( EV_Weapon_IsInvisible, idWeapon::Event_IsInvisible )
|
||||
EVENT( EV_Weapon_NetEndReload, idWeapon::Event_NetEndReload )
|
||||
EVENT( EV_Weapon_Grabber, idWeapon::Event_Grabber )
|
||||
EVENT( EV_Weapon_GrabberHasTarget, idWeapon::Event_GrabberHasTarget )
|
||||
EVENT( EV_Weapon_Grabber_SetGrabDistance, idWeapon::Event_GrabberSetGrabDistance )
|
||||
EVENT( EV_Weapon_GetWeaponSkin, idWeapon::Event_GetWeaponSkin )
|
||||
EVENT( EV_Weapon_IsMotionControlled, idWeapon::Event_IsMotionControlled )
|
||||
END_CLASS
|
||||
|
@ -166,6 +172,7 @@ idWeapon::idWeapon() {
|
|||
guiLightHandle = -1;
|
||||
nozzleGlowHandle = -1;
|
||||
modelDefHandle = -1;
|
||||
grabberState = -1;
|
||||
|
||||
berserk = 2;
|
||||
brassDelay = 0;
|
||||
|
@ -209,6 +216,8 @@ void idWeapon::Spawn( void ) {
|
|||
worldModel.GetEntity()->fl.networkSync = true;
|
||||
}
|
||||
|
||||
grabber.Initialize();
|
||||
|
||||
thread = new idThread();
|
||||
thread->ManualDelete();
|
||||
thread->ManualControl();
|
||||
|
@ -414,6 +423,9 @@ void idWeapon::Save( idSaveGame *savefile ) const {
|
|||
savefile->WriteBool( allowDrop );
|
||||
savefile->WriteObject( projectileEnt );
|
||||
|
||||
savefile->WriteStaticObject( grabber );
|
||||
savefile->WriteInt( grabberState );
|
||||
|
||||
savefile->WriteJoint( smokeJointView );
|
||||
|
||||
// Koz begin
|
||||
|
@ -599,6 +611,9 @@ void idWeapon::Restore( idRestoreGame *savefile ) {
|
|||
savefile->ReadBool( allowDrop );
|
||||
savefile->ReadObject( reinterpret_cast<idClass *&>( projectileEnt ) );
|
||||
|
||||
savefile->ReadStaticObject( grabber );
|
||||
savefile->ReadInt( grabberState );
|
||||
|
||||
savefile->ReadJoint( smokeJointView );
|
||||
|
||||
for ( int i = 0; i < 2; i++ ) {
|
||||
|
@ -741,6 +756,9 @@ void idWeapon::Clear( void ) {
|
|||
lightOn = false;
|
||||
silent_fire = false;
|
||||
|
||||
grabberState = -1;
|
||||
grabber.Update( owner, this, true );
|
||||
|
||||
ammoType = 0;
|
||||
ammoRequired = 0;
|
||||
ammoClip = 0;
|
||||
|
@ -1230,8 +1248,8 @@ weapon_t idWeapon::IdentifyWeapon()
|
|||
else if ( idStr::Icmp( "weapon_bloodstone_active3", weaponDef->GetName() ) == 0 ) currentIdentifiedWeapon = WEAPON_ARTIFACT;
|
||||
else if ( idStr::Icmp( "weapon_pda", weaponDef->GetName() ) == 0 ) currentIdentifiedWeapon = WEAPON_PDA;
|
||||
else if ( idStr::Icmp( "weapon_flashlight_new", weaponDef->GetName() ) == 0 ) currentIdentifiedWeapon = lastIdentifiedWeapon;
|
||||
//else if ( idStr::Icmp( "weapon_flashlight_new", weaponDef->GetName() ) == 0 ) currentWeapon = WEAPON_FLASHLIGHT;
|
||||
//else if ( idStr::Icmp( "weapon_flashlight", weaponDef->GetName() ) == 0 ) currentWeapon = WEAPON_FLASHLIGHT;
|
||||
//else if ( idStr::Icmp( "weapon_flashlight_new", weaponDef->GetName() ) == 0 ) currentWeapon = WEAPON_FLASHLIGHT;
|
||||
//else if ( idStr::Icmp( "weapon_flashlight", weaponDef->GetName() ) == 0 ) currentWeapon = WEAPON_FLASHLIGHT;
|
||||
else currentIdentifiedWeapon = WEAPON_NONE;
|
||||
lastIdentifiedWeapon = currentIdentifiedWeapon;
|
||||
}
|
||||
|
@ -1290,6 +1308,9 @@ void idWeapon::UpdateGUI( void ) {
|
|||
renderEntity.gui[ 0 ]->SetStateBool( "player_ammo_empty", ( ammoamount == 0 ) );
|
||||
renderEntity.gui[ 0 ]->SetStateBool( "player_clip_empty", ( inclip == 0 ) );
|
||||
renderEntity.gui[ 0 ]->SetStateBool( "player_clip_low", ( inclip <= lowAmmo ) );
|
||||
|
||||
//Grabber Gui Info
|
||||
renderEntity.gui[ 0 ]->SetStateString( "grabber_state", va( "%i", grabberState ) );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -1463,6 +1484,10 @@ void idWeapon::UpdateVRGUI()
|
|||
rvrStatGui->SetStateString("player_ammo_count", va("%i", ammoamount[HAND_RIGHT]));
|
||||
// koz end
|
||||
|
||||
// koz todo also need to figure this out for dual guis
|
||||
//Grabber Gui Info
|
||||
rvrStatGui->SetStateString( "grabber_state", va( "%i", grabberState ) );
|
||||
|
||||
//health and armor
|
||||
|
||||
if ( player )
|
||||
|
@ -1535,6 +1560,8 @@ void idWeapon::UpdateVRGUI()
|
|||
// koz end
|
||||
|
||||
// koz todo also need to figure this out for dual guis
|
||||
//Grabber Gui Info
|
||||
lvrStatGui->SetStateString("grabber_state", va("%i", grabberState));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2020,6 +2047,12 @@ void idWeapon::OwnerDied( void ) {
|
|||
if ( isLinked ) {
|
||||
SetState( "OwnerDied", 0 );
|
||||
thread->Execute();
|
||||
|
||||
// Update the grabber effects
|
||||
if( grabberState != -1 )
|
||||
{
|
||||
grabber.Update( owner, this, hide );
|
||||
}
|
||||
}
|
||||
|
||||
Hide();
|
||||
|
@ -2047,7 +2080,7 @@ void idWeapon::BeginAttack( void ) {
|
|||
}
|
||||
|
||||
if ( !WEAPON_ATTACK ) {
|
||||
if ( sndHum ) {
|
||||
if ( sndHum && grabberState == -1 ) { // _D3XP :: don't stop grabber hum
|
||||
StopSound( SND_CHANNEL_BODY, false );
|
||||
}
|
||||
}
|
||||
|
@ -2065,7 +2098,7 @@ void idWeapon::EndAttack( void ) {
|
|||
}
|
||||
if ( WEAPON_ATTACK ) {
|
||||
WEAPON_ATTACK = false;
|
||||
if ( sndHum ) {
|
||||
if( sndHum && grabberState == -1 ) { // _D3XP :: don't stop grabber hum
|
||||
StartSoundShader( sndHum, SND_CHANNEL_BODY, 0, false, NULL );
|
||||
}
|
||||
}
|
||||
|
@ -2728,6 +2761,12 @@ void idWeapon::PresentWeapon( bool showViewModel, int hand ) {
|
|||
}
|
||||
}
|
||||
|
||||
// Update the grabber effects
|
||||
if( grabberState != -1 )
|
||||
{
|
||||
grabberState = grabber.Update( owner, this, hide );
|
||||
}
|
||||
|
||||
// remove the muzzle flash light when it's done
|
||||
if ( (!lightOn && (gameLocal.time >= muzzleFlashEnd)) || IsHidden() )
|
||||
{
|
||||
|
@ -3066,6 +3105,18 @@ int idWeapon::AmmoRequired( void ) const {
|
|||
return ammoRequired;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idWeapon::GetGrabberState
|
||||
|
||||
Returns the current grabberState
|
||||
================
|
||||
*/
|
||||
int idWeapon::GetGrabberState() const
|
||||
{
|
||||
return grabberState;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idWeapon::WriteToSnapshot
|
||||
|
@ -3667,6 +3718,44 @@ void idWeapon::Event_SetLightParms( float parm0, float parm1, float parm2, float
|
|||
UpdateVisuals();
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idWeapon::Event_Grabber
|
||||
================
|
||||
*/
|
||||
void idWeapon::Event_Grabber( int enable )
|
||||
{
|
||||
if( enable )
|
||||
{
|
||||
grabberState = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
grabberState = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idWeapon::Event_GrabberHasTarget
|
||||
================
|
||||
*/
|
||||
void idWeapon::Event_GrabberHasTarget()
|
||||
{
|
||||
idThread::ReturnInt( grabberState );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idWeapon::Event_GrabberSetGrabDistance
|
||||
================
|
||||
*/
|
||||
void idWeapon::Event_GrabberSetGrabDistance( float dist )
|
||||
{
|
||||
|
||||
grabber.SetDragDistance( dist );
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
idWeapon::Event_CreateProjectile
|
||||
|
|
|
@ -34,6 +34,9 @@ If you have questions concerning this license or the applicable additional terms
|
|||
#include "Light.h"
|
||||
#include "Actor.h"
|
||||
#include "Misc.h"
|
||||
#include "Grabber.h"
|
||||
|
||||
class idGrabber;
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
@ -226,6 +229,8 @@ public:
|
|||
int LowAmmo( void ) const;
|
||||
int AmmoRequired( void ) const;
|
||||
int AmmoCount() const;
|
||||
int GetGrabberState() const;
|
||||
|
||||
// Flashlight
|
||||
idAnimatedEntity* GetWorldModel()
|
||||
{
|
||||
|
@ -263,6 +268,7 @@ public:
|
|||
friend class idWeaponHolder;
|
||||
friend class idHolster;
|
||||
friend class idPlayerHand;
|
||||
friend class idGrabber;
|
||||
|
||||
private:
|
||||
// script control
|
||||
|
@ -495,6 +501,12 @@ private:
|
|||
void Event_IsMotionControlled();
|
||||
void CalculateHideRise( idVec3& origin, idMat3& axis );
|
||||
// Koz end
|
||||
idGrabber grabber;
|
||||
int grabberState;
|
||||
|
||||
void Event_Grabber( int enable );
|
||||
void Event_GrabberHasTarget();
|
||||
void Event_GrabberSetGrabDistance( float dist );
|
||||
};
|
||||
|
||||
ID_INLINE bool idWeapon::IsLinked( void ) {
|
||||
|
|
|
@ -151,6 +151,12 @@ idCVar g_showEnemies( "g_showEnemies", "0", CVAR_GAME | CVAR_BOOL, "draws
|
|||
idCVar g_frametime( "g_frametime", "0", CVAR_GAME | CVAR_BOOL, "displays timing information for each game frame" );
|
||||
idCVar g_timeentities( "g_timeEntities", "0", CVAR_GAME | CVAR_FLOAT, "when non-zero, shows entities whose think functions exceeded the # of milliseconds specified" );
|
||||
|
||||
idCVar g_testFullscreenFX( "g_testFullscreenFX", "-1", CVAR_GAME | CVAR_INTEGER, "index will activate specific fx, -2 is for all on, -1 is off" );
|
||||
idCVar g_testHelltimeFX( "g_testHelltimeFX", "-1", CVAR_GAME | CVAR_INTEGER, "set to 0, 1, 2 to test helltime, -1 is off" );
|
||||
idCVar g_testMultiplayerFX( "g_testMultiplayerFX", "-1", CVAR_GAME | CVAR_INTEGER, "set to 0, 1, 2 to test multiplayer, -1 is off" );
|
||||
idCVar g_testBloomIntensity( "g_testBloomIntensity", "-0.01", CVAR_GAME | CVAR_FLOAT, "" );
|
||||
idCVar g_testBloomNumPasses( "g_testBloomNumPasses", "30", CVAR_GAME | CVAR_INTEGER, "" );
|
||||
|
||||
idCVar ai_debugScript( "ai_debugScript", "-1", CVAR_GAME | CVAR_INTEGER, "displays script calls for the specified monster entity number" );
|
||||
idCVar ai_debugMove( "ai_debugMove", "0", CVAR_GAME | CVAR_BOOL, "draws movement information for monsters" );
|
||||
idCVar ai_debugTrajectory( "ai_debugTrajectory", "0", CVAR_GAME | CVAR_BOOL, "draws trajectory tests for monsters" );
|
||||
|
|
|
@ -87,6 +87,12 @@ extern idCVar g_showEnemies;
|
|||
extern idCVar g_frametime;
|
||||
extern idCVar g_timeentities;
|
||||
|
||||
extern idCVar g_testFullscreenFX;
|
||||
extern idCVar g_testHelltimeFX;
|
||||
extern idCVar g_testMultiplayerFX;
|
||||
extern idCVar g_testBloomIntensity;
|
||||
extern idCVar g_testBloomNumPasses;
|
||||
|
||||
extern idCVar ai_debugScript;
|
||||
extern idCVar ai_debugMove;
|
||||
extern idCVar ai_debugTrajectory;
|
||||
|
|
|
@ -26,6 +26,7 @@ If you have questions concerning this license or the applicable additional terms
|
|||
===========================================================================
|
||||
*/
|
||||
|
||||
#include <gamesys/SysCvar.h>
|
||||
#include "sys/platform.h"
|
||||
#include "framework/UsercmdGen.h"
|
||||
#include "physics/Physics.h"
|
||||
|
@ -151,8 +152,7 @@ void idForce_Grab::Evaluate( int time )
|
|||
|
||||
objectCenter = physics->GetAbsBounds( id ).GetCenter();
|
||||
|
||||
//TODO: SB g_grabberRandomMotion needs defining
|
||||
if( /* g_grabberRandomMotion.GetBool() && */ !gameLocal.isMultiplayer )
|
||||
if( g_grabberRandomMotion.GetBool() && !gameLocal.isMultiplayer )
|
||||
{
|
||||
// Jitter the objectCenter around so it doesn't remain stationary
|
||||
float SinOffset = idMath::Sin( ( float )( gameLocal.time ) / 66.f );
|
||||
|
|
|
@ -90,6 +90,7 @@ src_game = \
|
|||
game/GameEdit.cpp \
|
||||
game/Game_local.cpp \
|
||||
game/Game_network.cpp \
|
||||
game/Grabber.cpp \
|
||||
game/Item.cpp \
|
||||
game/IK.cpp \
|
||||
game/Light.cpp \
|
||||
|
|
|
@ -273,29 +273,30 @@ typedef enum {
|
|||
} materialFlags_t;
|
||||
|
||||
// contents flags, NOTE: make sure to keep the defines in doom_defs.script up to date with these!
|
||||
typedef enum {
|
||||
CONTENTS_SOLID = BIT(0), // an eye is never valid in a solid
|
||||
CONTENTS_OPAQUE = BIT(1), // blocks visibility (for ai)
|
||||
CONTENTS_WATER = BIT(2), // used for water
|
||||
CONTENTS_PLAYERCLIP = BIT(3), // solid to players
|
||||
CONTENTS_MONSTERCLIP = BIT(4), // solid to monsters
|
||||
CONTENTS_MOVEABLECLIP = BIT(5), // solid to moveable entities
|
||||
CONTENTS_IKCLIP = BIT(6), // solid to IK
|
||||
CONTENTS_BLOOD = BIT(7), // used to detect blood decals
|
||||
CONTENTS_BODY = BIT(8), // used for actors
|
||||
CONTENTS_PROJECTILE = BIT(9), // used for projectiles
|
||||
CONTENTS_CORPSE = BIT(10), // used for dead bodies
|
||||
CONTENTS_RENDERMODEL = BIT(11), // used for render models for collision detection
|
||||
CONTENTS_TRIGGER = BIT(12), // used for triggers
|
||||
CONTENTS_AAS_SOLID = BIT(13), // solid for AAS
|
||||
CONTENTS_AAS_OBSTACLE = BIT(14), // used to compile an obstacle into AAS that can be enabled/disabled
|
||||
CONTENTS_FLASHLIGHT_TRIGGER = BIT(15), // used for triggers that are activated by the flashlight
|
||||
typedef enum
|
||||
{
|
||||
CONTENTS_SOLID = BIT( 0 ), // an eye is never valid in a solid
|
||||
CONTENTS_OPAQUE = BIT( 1 ), // blocks visibility (for ai)
|
||||
CONTENTS_WATER = BIT( 2 ), // used for water
|
||||
CONTENTS_PLAYERCLIP = BIT( 3 ), // solid to players
|
||||
CONTENTS_MONSTERCLIP = BIT( 4 ), // solid to monsters
|
||||
CONTENTS_MOVEABLECLIP = BIT( 5 ), // solid to moveable entities
|
||||
CONTENTS_IKCLIP = BIT( 6 ), // solid to IK
|
||||
CONTENTS_BLOOD = BIT( 7 ), // used to detect blood decals
|
||||
CONTENTS_BODY = BIT( 8 ), // used for actors
|
||||
CONTENTS_PROJECTILE = BIT( 9 ), // used for projectiles
|
||||
CONTENTS_CORPSE = BIT( 10 ), // used for dead bodies
|
||||
CONTENTS_RENDERMODEL = BIT( 11 ), // used for render models for collision detection
|
||||
CONTENTS_TRIGGER = BIT( 12 ), // used for triggers
|
||||
CONTENTS_AAS_SOLID = BIT( 13 ), // solid for AAS
|
||||
CONTENTS_AAS_OBSTACLE = BIT( 14 ), // used to compile an obstacle into AAS that can be enabled/disabled
|
||||
CONTENTS_FLASHLIGHT_TRIGGER = BIT( 15 ), // used for triggers that are activated by the flashlight
|
||||
|
||||
// contents used by utils
|
||||
CONTENTS_AREAPORTAL = BIT(20), // portal separating renderer areas
|
||||
CONTENTS_NOCSG = BIT(21), // don't cut this brush with CSG operations in the editor
|
||||
CONTENTS_AREAPORTAL = BIT( 20 ), // portal separating renderer areas
|
||||
CONTENTS_NOCSG = BIT( 21 ), // don't cut this brush with CSG operations in the editor
|
||||
|
||||
CONTENTS_REMOVE_UTIL = ~(CONTENTS_AREAPORTAL|CONTENTS_NOCSG)
|
||||
CONTENTS_REMOVE_UTIL = (int)(~( CONTENTS_AREAPORTAL | CONTENTS_NOCSG ))
|
||||
} contentsFlags_t;
|
||||
|
||||
// surface types
|
||||
|
|
Binary file not shown.
Loading…
Reference in a new issue