mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2024-11-22 20:51:40 +00:00
Add Code of Fitz Packerton
It's a short experimental standalone game based on the Doom3 Engine. I got the source at http://blendogames.com/older.htm You can get the game at https://teddydief.itch.io/fitz
This commit is contained in:
parent
85a1020490
commit
114a99cf83
10 changed files with 165 additions and 49 deletions
|
@ -130,6 +130,13 @@ const idEventDef EV_MotionBlurOff( "motionBlurOff" );
|
|||
const idEventDef EV_GuiNamedEvent ( "guiNamedEvent", "ds" );
|
||||
#endif
|
||||
|
||||
|
||||
//bc
|
||||
const idEventDef EV_GetIndex( "getIndex", NULL, 'd' );
|
||||
const idEventDef EV_SetSolid( "setSolid", "d" );
|
||||
|
||||
|
||||
|
||||
ABSTRACT_DECLARATION( idClass, idEntity )
|
||||
EVENT( EV_GetName, idEntity::Event_GetName )
|
||||
EVENT( EV_SetName, idEntity::Event_SetName )
|
||||
|
@ -201,6 +208,12 @@ ABSTRACT_DECLARATION( idClass, idEntity )
|
|||
EVENT( EV_GetGuiParmFloat, idEntity::Event_GetGuiParmFloat )
|
||||
EVENT( EV_GuiNamedEvent, idEntity::Event_GuiNamedEvent )
|
||||
#endif
|
||||
|
||||
|
||||
//bc
|
||||
EVENT( EV_GetIndex, idEntity::Event_GetIndex)
|
||||
EVENT( EV_SetSolid, idEntity::Event_SetSolid)
|
||||
|
||||
END_CLASS
|
||||
|
||||
/*
|
||||
|
@ -5068,6 +5081,30 @@ bool idEntity::IsGrabbed() {
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
//bc
|
||||
void idEntity::Event_GetIndex( void )
|
||||
{
|
||||
idThread::ReturnInt( this->entityNumber);
|
||||
}
|
||||
|
||||
void idEntity::Event_SetSolid( int enable )
|
||||
{
|
||||
if ( enable > 0 )
|
||||
{
|
||||
GetPhysics()->SetContents( CONTENTS_SOLID );
|
||||
}
|
||||
else
|
||||
{
|
||||
GetPhysics()->SetContents( 0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
|
@ -5613,3 +5650,4 @@ void idAnimatedEntity::Event_GetJointAngle( jointHandle_t jointnum ) {
|
|||
idVec3 vec( ang[ 0 ], ang[ 1 ], ang[ 2 ] );
|
||||
idThread::ReturnVector( vec );
|
||||
}
|
||||
|
||||
|
|
|
@ -488,6 +488,11 @@ private:
|
|||
void Event_GetGuiParmFloat(int guiNum, const char *key);
|
||||
void Event_GuiNamedEvent(int guiNum, const char *event);
|
||||
#endif
|
||||
|
||||
|
||||
//bc
|
||||
void Event_GetIndex( void );
|
||||
void Event_SetSolid( int enable );
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -88,9 +88,13 @@ void idCursor3D::Present( void ) {
|
|||
|
||||
const idVec3 &origin = GetPhysics()->GetOrigin();
|
||||
const idMat3 &axis = GetPhysics()->GetAxis();
|
||||
|
||||
if (developer.GetBool())
|
||||
{
|
||||
gameRenderWorld->DebugArrow( colorYellow, origin + axis[1] * -5.0f + axis[2] * 5.0f, origin, 2 );
|
||||
gameRenderWorld->DebugArrow( colorRed, origin, draggedPosition, 2 );
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
|
@ -113,7 +117,7 @@ void idCursor3D::Think( void ) {
|
|||
===============================================================================
|
||||
*/
|
||||
|
||||
#define MAX_DRAG_TRACE_DISTANCE 2048.0f
|
||||
#define MAX_DRAG_TRACE_DISTANCE 128.0f
|
||||
|
||||
/*
|
||||
==============
|
||||
|
@ -277,9 +281,16 @@ void idDragEntity::Update( idPlayer *player ) {
|
|||
if ( joint != INVALID_JOINT && renderEntity && dragAnimator ) {
|
||||
dragAnimator->GetJointTransform( joint, gameLocal.time, cursor->draggedPosition, axis );
|
||||
cursor->draggedPosition = renderEntity->origin + cursor->draggedPosition * renderEntity->axis;
|
||||
|
||||
|
||||
if (developer.GetBool())
|
||||
gameRenderWorld->DrawText( va( "%s\n%s\n%s, %s", drag->GetName(), drag->GetType()->classname, dragAnimator->GetJointName( joint ), bodyName.c_str() ), cursor->GetPhysics()->GetOrigin(), 0.1f, colorWhite, viewAxis, 1 );
|
||||
|
||||
} else {
|
||||
cursor->draggedPosition = cursor->GetPhysics()->GetOrigin();
|
||||
|
||||
|
||||
if (developer.GetBool())
|
||||
gameRenderWorld->DrawText( va( "%s\n%s\n%s", drag->GetName(), drag->GetType()->classname, bodyName.c_str() ), cursor->GetPhysics()->GetOrigin(), 0.1f, colorWhite, viewAxis, 1 );
|
||||
}
|
||||
}
|
||||
|
@ -289,6 +300,9 @@ void idDragEntity::Update( idPlayer *player ) {
|
|||
// draw the bbox of the selected entity
|
||||
renderEntity_t *renderEntity = selected.GetEntity()->GetRenderEntity();
|
||||
if ( renderEntity ) {
|
||||
|
||||
|
||||
if (developer.GetBool())
|
||||
gameRenderWorld->DebugBox( colorYellow, idBox( renderEntity->bounds, renderEntity->origin, renderEntity->axis ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2687,6 +2687,12 @@ void idGameLocal::CalcFov( float base_fov, float &fov_x, float &fov_y ) const {
|
|||
ratio_x = 16.0f;
|
||||
ratio_y = 10.0f;
|
||||
break;
|
||||
|
||||
case 3 :
|
||||
// 21:9
|
||||
ratio_x = 21.0f;
|
||||
ratio_y = 9.0f;
|
||||
break;
|
||||
}
|
||||
|
||||
y = ratio_y / tan( fov_y / 360.0f * idMath::PI );
|
||||
|
|
|
@ -1494,10 +1494,7 @@ void idPlayer::Init( void ) {
|
|||
weapon_pda = SlotForWeapon( "weapon_pda" );
|
||||
weapon_fists = SlotForWeapon( "weapon_fists" );
|
||||
#ifdef _D3XP
|
||||
weapon_bloodstone = SlotForWeapon( "weapon_bloodstone_passive" );
|
||||
weapon_bloodstone_active1 = SlotForWeapon( "weapon_bloodstone_active1" );
|
||||
weapon_bloodstone_active2 = SlotForWeapon( "weapon_bloodstone_active2" );
|
||||
weapon_bloodstone_active3 = SlotForWeapon( "weapon_bloodstone_active3" );
|
||||
|
||||
harvest_lock = false;
|
||||
#endif
|
||||
showWeaponViewModel = GetUserInfo()->GetBool( "ui_showGun" );
|
||||
|
@ -1645,19 +1642,19 @@ void idPlayer::Init( void ) {
|
|||
value = spawnArgs.GetString( "bone_hips", "" );
|
||||
hipJoint = animator.GetJointHandle( value );
|
||||
if ( hipJoint == INVALID_JOINT ) {
|
||||
gameLocal.Error( "Joint '%s' not found for 'bone_hips' on '%s'", value, name.c_str() );
|
||||
gameLocal.Warning( "Joint '%s' not found for 'bone_hips' on '%s'", value, name.c_str() );
|
||||
}
|
||||
|
||||
value = spawnArgs.GetString( "bone_chest", "" );
|
||||
chestJoint = animator.GetJointHandle( value );
|
||||
if ( chestJoint == INVALID_JOINT ) {
|
||||
gameLocal.Error( "Joint '%s' not found for 'bone_chest' on '%s'", value, name.c_str() );
|
||||
gameLocal.Warning( "Joint '%s' not found for 'bone_chest' on '%s'", value, name.c_str() );
|
||||
}
|
||||
|
||||
value = spawnArgs.GetString( "bone_head", "" );
|
||||
headJoint = animator.GetJointHandle( value );
|
||||
if ( headJoint == INVALID_JOINT ) {
|
||||
gameLocal.Error( "Joint '%s' not found for 'bone_head' on '%s'", value, name.c_str() );
|
||||
gameLocal.Warning( "Joint '%s' not found for 'bone_head' on '%s'", value, name.c_str() );
|
||||
}
|
||||
|
||||
// initialize the script variables
|
||||
|
@ -3031,14 +3028,7 @@ void idPlayer::UpdateHudAmmo( idUserInterface *_hud ) {
|
|||
_hud->SetStateString( "player_ammo_count", va("%i", weapon.GetEntity()->AmmoCount()));
|
||||
#endif
|
||||
|
||||
#ifdef _D3XP
|
||||
//Make sure the hud always knows how many bloodstone charges there are
|
||||
int ammoRequired;
|
||||
ammo_t ammo_i = inventory.AmmoIndexForWeaponClass( "weapon_bloodstone_passive", &ammoRequired );
|
||||
int bloodstoneAmmo = inventory.HasAmmo( ammo_i, ammoRequired );
|
||||
_hud->SetStateString("player_bloodstone_ammo", va("%i", bloodstoneAmmo));
|
||||
_hud->HandleNamedEvent( "bloodstoneAmmoUpdate" );
|
||||
#endif
|
||||
|
||||
|
||||
_hud->HandleNamedEvent( "updateAmmo" );
|
||||
}
|
||||
|
@ -3186,7 +3176,9 @@ idPlayer::DrawHUD
|
|||
*/
|
||||
void idPlayer::DrawHUD( idUserInterface *_hud ) {
|
||||
|
||||
if ( !weapon.GetEntity() || influenceActive != INFLUENCE_NONE || privateCameraView || gameLocal.GetCamera() || !_hud || !g_showHud.GetBool() ) {
|
||||
|
||||
|
||||
if ( !weapon.GetEntity() || influenceActive != INFLUENCE_NONE || privateCameraView || /*bc gameLocal.GetCamera() ||*/ !_hud || !g_showHud.GetBool() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -3243,7 +3235,7 @@ void idPlayer::EnterCinematic( void ) {
|
|||
|
||||
physicsObj.SetLinearVelocity( vec3_origin );
|
||||
|
||||
SetState( "EnterCinematic" );
|
||||
//bc SetState( "EnterCinematic" );
|
||||
UpdateScript();
|
||||
|
||||
if ( weaponEnabled && weapon.GetEntity() ) {
|
||||
|
@ -3284,7 +3276,7 @@ void idPlayer::ExitCinematic( void ) {
|
|||
weapon.GetEntity()->ExitCinematic();
|
||||
}
|
||||
|
||||
SetState( "ExitCinematic" );
|
||||
//bc SetState( "ExitCinematic" );
|
||||
UpdateScript();
|
||||
}
|
||||
|
||||
|
@ -3507,23 +3499,7 @@ bool idPlayer::Give( const char *statname, const char *value ) {
|
|||
}
|
||||
} else {
|
||||
bool ret = inventory.Give( this, spawnArgs, statname, value, &idealWeapon, true );
|
||||
if(!idStr::Icmp( statname, "ammo_bloodstone" ) ) {
|
||||
//int i = inventory.AmmoIndexForAmmoClass( statname );
|
||||
//int max = inventory.MaxAmmoForAmmoClass( this, statname );
|
||||
//if(hud && inventory.ammo[ i ] >= max) {
|
||||
if(hud) {
|
||||
|
||||
//Force an update of the bloodstone ammount
|
||||
int ammoRequired;
|
||||
ammo_t ammo_i = inventory.AmmoIndexForWeaponClass( "weapon_bloodstone_passive", &ammoRequired );
|
||||
int bloodstoneAmmo = inventory.HasAmmo( ammo_i, ammoRequired );
|
||||
hud->SetStateString("player_bloodstone_ammo", va("%i", bloodstoneAmmo));
|
||||
|
||||
hud->HandleNamedEvent("bloodstoneReady");
|
||||
//Make sure we unlock the ability to harvest
|
||||
harvest_lock = false;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
#else
|
||||
return inventory.Give( this, spawnArgs, statname, value, &idealWeapon, true );
|
||||
|
@ -5265,6 +5241,7 @@ Searches nearby locations
|
|||
================
|
||||
*/
|
||||
void idPlayer::UpdateLocation( void ) {
|
||||
|
||||
if ( hud ) {
|
||||
idLocationEntity *locationEntity = gameLocal.LocationForPoint( GetEyePosition() );
|
||||
if ( locationEntity ) {
|
||||
|
@ -7416,7 +7393,7 @@ void idPlayer::Think( void ) {
|
|||
// update GUIs, Items, and character interactions
|
||||
UpdateFocus();
|
||||
|
||||
UpdateLocation();
|
||||
//UpdateLocation();
|
||||
|
||||
// update player script
|
||||
UpdateScript();
|
||||
|
|
|
@ -1154,7 +1154,7 @@ void idWeapon::GetWeaponDef( const char *objectname, int ammoinclip ) {
|
|||
renderEntity.gui[ 0 ] = uiManager->FindGui( guiName, true, false, true );
|
||||
}
|
||||
|
||||
zoomFov = weaponDef->dict.GetInt( "zoomFov", "70" );
|
||||
zoomFov = weaponDef->dict.GetInt( "zoomFov", "10" );
|
||||
berserk = weaponDef->dict.GetInt( "berserk", "2" );
|
||||
|
||||
weaponAngleOffsetAverages = weaponDef->dict.GetInt( "weaponAngleOffsetAverages", "10" );
|
||||
|
@ -2360,7 +2360,7 @@ void idWeapon::EnterCinematic( void ) {
|
|||
StopSound( SND_CHANNEL_ANY, false );
|
||||
|
||||
if ( isLinked ) {
|
||||
SetState( "EnterCinematic", 0 );
|
||||
//bc SetState( "EnterCinematic", 0 );
|
||||
thread->Execute();
|
||||
|
||||
WEAPON_ATTACK = false;
|
||||
|
@ -2390,7 +2390,7 @@ void idWeapon::ExitCinematic( void ) {
|
|||
disabled = false;
|
||||
|
||||
if ( isLinked ) {
|
||||
SetState( "ExitCinematic", 0 );
|
||||
//bc SetState( "ExitCinematic", 0 );
|
||||
thread->Execute();
|
||||
}
|
||||
|
||||
|
@ -2459,7 +2459,7 @@ ammo_t idWeapon::GetAmmoNumForName( const char *ammoname ) {
|
|||
|
||||
ammoDict = gameLocal.FindEntityDefDict( "ammo_types", false );
|
||||
if ( !ammoDict ) {
|
||||
gameLocal.Error( "Could not find entity definition for 'ammo_types'\n" );
|
||||
gameLocal.Warning( "Could not find entity definition for 'ammo_types'\n" );
|
||||
}
|
||||
|
||||
if ( !ammoname[ 0 ] ) {
|
||||
|
@ -2513,7 +2513,7 @@ const char *idWeapon::GetAmmoNameForNum( ammo_t ammonum ) {
|
|||
|
||||
ammoDict = gameLocal.FindEntityDefDict( "ammo_types", false );
|
||||
if ( !ammoDict ) {
|
||||
gameLocal.Error( "Could not find entity definition for 'ammo_types'\n" );
|
||||
gameLocal.Warning( "Could not find entity definition for 'ammo_types'\n" );
|
||||
}
|
||||
|
||||
sprintf( text, "%d", ammonum );
|
||||
|
|
|
@ -223,7 +223,7 @@ idCVar g_editEntityMode( "g_editEntityMode", "0", CVAR_GAME | CVAR_INTEGER
|
|||
"5 = monsters\n"
|
||||
"6 = entity names\n"
|
||||
"7 = entity models", 0, 7, idCmdSystem::ArgCompletion_Integer<0,7> );
|
||||
idCVar g_dragEntity( "g_dragEntity", "0", CVAR_GAME | CVAR_BOOL, "allows dragging physics objects around by placing the crosshair over them and holding the fire button" );
|
||||
idCVar g_dragEntity( "g_dragEntity", "1", CVAR_GAME | CVAR_BOOL, "allows dragging physics objects around by placing the crosshair over them and holding the fire button" );
|
||||
idCVar g_dragDamping( "g_dragDamping", "0.5", CVAR_GAME | CVAR_FLOAT, "" );
|
||||
idCVar g_dragShowSelection( "g_dragShowSelection", "0", CVAR_GAME | CVAR_BOOL, "" );
|
||||
idCVar g_dropItemRotation( "g_dropItemRotation", "", CVAR_GAME, "" );
|
||||
|
@ -314,7 +314,7 @@ idCVar pm_normalviewheight( "pm_normalviewheight", "68", CVAR_GAME | CVAR_N
|
|||
idCVar pm_deadheight( "pm_deadheight", "20", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "height of player's bounding box while dead" );
|
||||
idCVar pm_deadviewheight( "pm_deadviewheight", "10", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "height of player's view while dead" );
|
||||
idCVar pm_crouchrate( "pm_crouchrate", "0.87", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "time it takes for player's view to change from standing to crouching" );
|
||||
idCVar pm_bboxwidth( "pm_bboxwidth", "32", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "x/y size of player's bounding box" );
|
||||
idCVar pm_bboxwidth( "pm_bboxwidth", "16", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "x/y size of player's bounding box" );
|
||||
idCVar pm_crouchbob( "pm_crouchbob", "0.5", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "bob much faster when crouched" );
|
||||
idCVar pm_walkbob( "pm_walkbob", "0.3", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "bob slowly when walking" );
|
||||
idCVar pm_runbob( "pm_runbob", "0.4", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "bob faster when running" );
|
||||
|
|
|
@ -233,12 +233,16 @@ idCompiler::idCompiler() {
|
|||
|
||||
memset( &immediate, 0, sizeof( immediate ) );
|
||||
memset( punctuationValid, 0, sizeof( punctuationValid ) );
|
||||
|
||||
|
||||
//BC todo
|
||||
for( ptr = punctuation; *ptr != NULL; ptr++ ) {
|
||||
id = parserPtr->GetPunctuationId( *ptr );
|
||||
if ( ( id >= 0 ) && ( id < 256 ) ) {
|
||||
punctuationValid[ id ] = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -125,6 +125,9 @@ const idEventDef EV_Thread_DebugBounds( "debugBounds", "vvvf" );
|
|||
const idEventDef EV_Thread_DrawText( "drawText", "svfvdf" );
|
||||
const idEventDef EV_Thread_InfluenceActive( "influenceActive", NULL, 'd' );
|
||||
|
||||
//bc
|
||||
const idEventDef EV_Thread_getClassEntity( "getClassEntity", "sd", 'e' );
|
||||
|
||||
CLASS_DECLARATION( idClass, idThread )
|
||||
EVENT( EV_Thread_Execute, idThread::Event_Execute )
|
||||
EVENT( EV_Thread_TerminateThread, idThread::Event_TerminateThread )
|
||||
|
@ -215,6 +218,15 @@ CLASS_DECLARATION( idClass, idThread )
|
|||
EVENT( EV_Thread_DebugBounds, idThread::Event_DebugBounds )
|
||||
EVENT( EV_Thread_DrawText, idThread::Event_DrawText )
|
||||
EVENT( EV_Thread_InfluenceActive, idThread::Event_InfluenceActive )
|
||||
|
||||
|
||||
|
||||
//bc
|
||||
EVENT( EV_Thread_getClassEntity, idThread::Event_getClassEntity)
|
||||
|
||||
|
||||
|
||||
|
||||
END_CLASS
|
||||
|
||||
idThread *idThread::currentThread = NULL;
|
||||
|
@ -1921,3 +1933,52 @@ void idThread::Event_InfluenceActive( void ) {
|
|||
idThread::ReturnInt( false );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//bc
|
||||
void idThread::Event_getClassEntity( const char *classname, int lastFound )
|
||||
{
|
||||
int i;
|
||||
lastFound++;
|
||||
|
||||
if (lastFound >= gameLocal.num_entities || lastFound < 0)
|
||||
{
|
||||
idThread::ReturnEntity( NULL );
|
||||
return;
|
||||
}
|
||||
|
||||
for ( i = lastFound; i < gameLocal.num_entities; i++ )
|
||||
{
|
||||
if ( !gameLocal.entities[ i ] )
|
||||
continue;
|
||||
|
||||
//check if the classname matches.
|
||||
|
||||
//BC 12-18-2013 wildcard support.
|
||||
|
||||
idStr strClassname = classname;
|
||||
int subIndex = strClassname.Find("*", false, 0, -1);
|
||||
|
||||
if (subIndex >= 0)
|
||||
{
|
||||
//Has a wildcard.
|
||||
idStr classnameChunk = strClassname.Mid(0, subIndex);
|
||||
idStr entityClassname = gameLocal.entities[ i ]->spawnArgs.GetString( "classname" );
|
||||
|
||||
if (idStr::Icmpn(classnameChunk, entityClassname, subIndex) != 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (idStr::Icmp( classname, gameLocal.entities[ i ]->spawnArgs.GetString( "classname" )) != 0) //No wildcard. Do normal check.
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
idThread::ReturnEntity( gameLocal.entities[ i ] );
|
||||
return;
|
||||
}
|
||||
|
||||
idThread::ReturnEntity( NULL );
|
||||
}
|
|
@ -78,6 +78,11 @@ extern const idEventDef EV_Thread_FadeOut;
|
|||
extern const idEventDef EV_Thread_FadeTo;
|
||||
extern const idEventDef EV_Thread_Restart;
|
||||
|
||||
|
||||
//bc
|
||||
extern const idEventDef EV_Thread_getClassEntity;
|
||||
|
||||
|
||||
class idThread : public idClass {
|
||||
private:
|
||||
static idThread *currentThread;
|
||||
|
@ -108,6 +113,12 @@ private:
|
|||
void Event_Execute( void );
|
||||
void Event_SetThreadName( const char *name );
|
||||
|
||||
|
||||
//bc
|
||||
void Event_getClassEntity( const char *classname, int lastFound );
|
||||
|
||||
|
||||
|
||||
//
|
||||
// script callable Events
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue