mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2024-11-21 12:11:07 +00:00
afebd7e1e5
Don't include the lazy precompiled.h everywhere, only what's required for the compilation unit. platform.h needs to be included instead to provide all essential defines and types. All includes use the relative path to the neo or the game specific root. Move all idlib related includes from idlib/Lib.h to precompiled.h. precompiled.h still exists for the MFC stuff in tools/. Add some missing header guards.
156 lines
5.7 KiB
C++
156 lines
5.7 KiB
C++
/*
|
|
===========================================================================
|
|
|
|
Doom 3 GPL Source Code
|
|
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
|
|
|
|
This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").
|
|
|
|
Doom 3 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 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 Source Code. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
In addition, the Doom 3 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 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.
|
|
|
|
===========================================================================
|
|
*/
|
|
|
|
#ifndef __PHYSICS_STATICMULTI_H__
|
|
#define __PHYSICS_STATICMULTI_H__
|
|
|
|
#include "physics/Physics_Static.h"
|
|
|
|
/*
|
|
===============================================================================
|
|
|
|
Physics for a non moving object using no or multiple collision models.
|
|
|
|
===============================================================================
|
|
*/
|
|
|
|
class idPhysics_StaticMulti : public idPhysics {
|
|
|
|
public:
|
|
CLASS_PROTOTYPE( idPhysics_StaticMulti );
|
|
|
|
idPhysics_StaticMulti( void );
|
|
~idPhysics_StaticMulti( void );
|
|
|
|
void Save( idSaveGame *savefile ) const;
|
|
void Restore( idRestoreGame *savefile );
|
|
|
|
void RemoveIndex( int id = 0, bool freeClipModel = true );
|
|
|
|
public: // common physics interface
|
|
|
|
void SetSelf( idEntity *e );
|
|
|
|
void SetClipModel( idClipModel *model, float density, int id = 0, bool freeOld = true );
|
|
idClipModel * GetClipModel( int id = 0 ) const;
|
|
int GetNumClipModels( void ) const;
|
|
|
|
void SetMass( float mass, int id = -1 );
|
|
float GetMass( int id = -1 ) const;
|
|
|
|
void SetContents( int contents, int id = -1 );
|
|
int GetContents( int id = -1 ) const;
|
|
|
|
void SetClipMask( int mask, int id = -1 );
|
|
int GetClipMask( int id = -1 ) const;
|
|
|
|
const idBounds & GetBounds( int id = -1 ) const;
|
|
const idBounds & GetAbsBounds( int id = -1 ) const;
|
|
|
|
bool Evaluate( int timeStepMSec, int endTimeMSec );
|
|
void UpdateTime( int endTimeMSec );
|
|
int GetTime( void ) const;
|
|
|
|
void GetImpactInfo( const int id, const idVec3 &point, impactInfo_t *info ) const;
|
|
void ApplyImpulse( const int id, const idVec3 &point, const idVec3 &impulse );
|
|
void AddForce( const int id, const idVec3 &point, const idVec3 &force );
|
|
void Activate( void );
|
|
void PutToRest( void );
|
|
bool IsAtRest( void ) const;
|
|
int GetRestStartTime( void ) const;
|
|
bool IsPushable( void ) const;
|
|
|
|
void SaveState( void );
|
|
void RestoreState( void );
|
|
|
|
void SetOrigin( const idVec3 &newOrigin, int id = -1 );
|
|
void SetAxis( const idMat3 &newAxis, int id = -1 );
|
|
|
|
void Translate( const idVec3 &translation, int id = -1 );
|
|
void Rotate( const idRotation &rotation, int id = -1 );
|
|
|
|
const idVec3 & GetOrigin( int id = 0 ) const;
|
|
const idMat3 & GetAxis( int id = 0 ) const;
|
|
|
|
void SetLinearVelocity( const idVec3 &newLinearVelocity, int id = 0 );
|
|
void SetAngularVelocity( const idVec3 &newAngularVelocity, int id = 0 );
|
|
|
|
const idVec3 & GetLinearVelocity( int id = 0 ) const;
|
|
const idVec3 & GetAngularVelocity( int id = 0 ) const;
|
|
|
|
void SetGravity( const idVec3 &newGravity );
|
|
const idVec3 & GetGravity( void ) const;
|
|
const idVec3 & GetGravityNormal( void ) const;
|
|
|
|
void ClipTranslation( trace_t &results, const idVec3 &translation, const idClipModel *model ) const;
|
|
void ClipRotation( trace_t &results, const idRotation &rotation, const idClipModel *model ) const;
|
|
int ClipContents( const idClipModel *model ) const;
|
|
|
|
void DisableClip( void );
|
|
void EnableClip( void );
|
|
|
|
void UnlinkClip( void );
|
|
void LinkClip( void );
|
|
|
|
bool EvaluateContacts( void );
|
|
int GetNumContacts( void ) const;
|
|
const contactInfo_t & GetContact( int num ) const;
|
|
void ClearContacts( void );
|
|
void AddContactEntity( idEntity *e );
|
|
void RemoveContactEntity( idEntity *e );
|
|
|
|
bool HasGroundContacts( void ) const;
|
|
bool IsGroundEntity( int entityNum ) const;
|
|
bool IsGroundClipModel( int entityNum, int id ) const;
|
|
|
|
void SetPushed( int deltaTime );
|
|
const idVec3 & GetPushedLinearVelocity( const int id = 0 ) const;
|
|
const idVec3 & GetPushedAngularVelocity( const int id = 0 ) const;
|
|
|
|
void SetMaster( idEntity *master, const bool orientated = true );
|
|
|
|
const trace_t * GetBlockingInfo( void ) const;
|
|
idEntity * GetBlockingEntity( void ) const;
|
|
|
|
int GetLinearEndTime( void ) const;
|
|
int GetAngularEndTime( void ) const;
|
|
|
|
void WriteToSnapshot( idBitMsgDelta &msg ) const;
|
|
void ReadFromSnapshot( const idBitMsgDelta &msg );
|
|
|
|
protected:
|
|
idEntity * self; // entity using this physics object
|
|
idList<staticPState_t> current; // physics state
|
|
idList<idClipModel *> clipModels; // collision model
|
|
|
|
// master
|
|
bool hasMaster;
|
|
bool isOrientated;
|
|
};
|
|
|
|
#endif /* !__PHYSICS_STATICMULTI_H__ */
|