diff --git a/d3xp/Entity.cpp b/d3xp/Entity.cpp index ec636a6..cbcc6b6 100644 --- a/d3xp/Entity.cpp +++ b/d3xp/Entity.cpp @@ -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 ); } + diff --git a/d3xp/Entity.h b/d3xp/Entity.h index 4413c30..3fe6691 100644 --- a/d3xp/Entity.h +++ b/d3xp/Entity.h @@ -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 ); }; /* diff --git a/d3xp/GameEdit.cpp b/d3xp/GameEdit.cpp index 0c637bd..3c9c49d 100644 --- a/d3xp/GameEdit.cpp +++ b/d3xp/GameEdit.cpp @@ -88,8 +88,12 @@ void idCursor3D::Present( void ) { const idVec3 &origin = GetPhysics()->GetOrigin(); const idMat3 &axis = GetPhysics()->GetAxis(); - gameRenderWorld->DebugArrow( colorYellow, origin + axis[1] * -5.0f + axis[2] * 5.0f, origin, 2 ); - gameRenderWorld->DebugArrow( colorRed, origin, draggedPosition, 2 ); + + 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,10 +281,17 @@ 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; - 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 ); + + + 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(); - gameRenderWorld->DrawText( va( "%s\n%s\n%s", drag->GetName(), drag->GetType()->classname, bodyName.c_str() ), cursor->GetPhysics()->GetOrigin(), 0.1f, colorWhite, viewAxis, 1 ); + + + 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,7 +300,10 @@ void idDragEntity::Update( idPlayer *player ) { // draw the bbox of the selected entity renderEntity_t *renderEntity = selected.GetEntity()->GetRenderEntity(); if ( renderEntity ) { - gameRenderWorld->DebugBox( colorYellow, idBox( renderEntity->bounds, renderEntity->origin, renderEntity->axis ) ); + + + if (developer.GetBool()) + gameRenderWorld->DebugBox( colorYellow, idBox( renderEntity->bounds, renderEntity->origin, renderEntity->axis ) ); } } } diff --git a/d3xp/Game_local.cpp b/d3xp/Game_local.cpp index dc09037..4829fed 100644 --- a/d3xp/Game_local.cpp +++ b/d3xp/Game_local.cpp @@ -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 ); diff --git a/d3xp/Player.cpp b/d3xp/Player.cpp index dc779df..10a4a76 100644 --- a/d3xp/Player.cpp +++ b/d3xp/Player.cpp @@ -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(); diff --git a/d3xp/Weapon.cpp b/d3xp/Weapon.cpp index 30f8882..bc9783b 100644 --- a/d3xp/Weapon.cpp +++ b/d3xp/Weapon.cpp @@ -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 ); diff --git a/d3xp/gamesys/SysCvar.cpp b/d3xp/gamesys/SysCvar.cpp index f2bb0b7..25d7bd5 100644 --- a/d3xp/gamesys/SysCvar.cpp +++ b/d3xp/gamesys/SysCvar.cpp @@ -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" ); diff --git a/d3xp/script/Script_Compiler.cpp b/d3xp/script/Script_Compiler.cpp index 7620c60..e8b8912 100644 --- a/d3xp/script/Script_Compiler.cpp +++ b/d3xp/script/Script_Compiler.cpp @@ -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; } } + } /* diff --git a/d3xp/script/Script_Thread.cpp b/d3xp/script/Script_Thread.cpp index cb82633..541acc2 100644 --- a/d3xp/script/Script_Thread.cpp +++ b/d3xp/script/Script_Thread.cpp @@ -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 ); +} \ No newline at end of file diff --git a/d3xp/script/Script_Thread.h b/d3xp/script/Script_Thread.h index 7d77643..52a11f4 100644 --- a/d3xp/script/Script_Thread.h +++ b/d3xp/script/Script_Thread.h @@ -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 //