From e9a6bb4dc9e263982e5ea67931fdc212554ba51f Mon Sep 17 00:00:00 2001 From: morb Date: Thu, 21 May 2026 22:59:36 -0400 Subject: [PATCH] the ftbHugeHunter update - implement subview camera rigging for feedingtowerb --- neo/Prey/prey_game.cpp | 1 + neo/game/Entity.cpp | 4 ++++ neo/game/Game_local.cpp | 43 +++++++++++++++++++++++++++++++++++++++++ neo/game/Game_local.h | 6 ++++++ 4 files changed, 54 insertions(+) diff --git a/neo/Prey/prey_game.cpp b/neo/Prey/prey_game.cpp index 4bfcea4d..49af2400 100644 --- a/neo/Prey/prey_game.cpp +++ b/neo/Prey/prey_game.cpp @@ -1230,6 +1230,7 @@ void hhGameLocal::Restore( idRestoreGame *savefile ) { for ( i = 0; i < num; i++ ) { hands[i].Restore( savefile ); } + InvalidateSubviewCameraAreas(); // ftbHugeHunter cutscene } bool hhGameLocal::InhibitEntitySpawn( idDict &spawnArgs ) { diff --git a/neo/game/Entity.cpp b/neo/game/Entity.cpp index 6833ca00..c18987d2 100644 --- a/neo/game/Entity.cpp +++ b/neo/game/Entity.cpp @@ -888,6 +888,10 @@ bool idEntity::DoDormantTests( void ) { return false; } + if ( gameLocal.InSubviewCameraArea( this ) ) { // ftbHugeHunter: keep ticking in subview camera areas + return false; + } + // if the monster area is not topologically connected to a player if ( !gameLocal.InPlayerConnectedArea( this ) ) { if ( dormantStart == 0 ) { diff --git a/neo/game/Game_local.cpp b/neo/game/Game_local.cpp index ec36306a..233752ee 100644 --- a/neo/game/Game_local.cpp +++ b/neo/game/Game_local.cpp @@ -200,6 +200,8 @@ void idGameLocal::Clear( void ) { spawnedEntities.Clear(); activeEntities.Clear(); numEntitiesToDeactivate = 0; + subviewCameraAreas.Clear(); + subviewCameraAreasBuilt = false; sortPushers = false; sortTeamMasters = false; //HUMANHEAD rww @@ -1004,6 +1006,8 @@ void idGameLocal::LoadMap( const char *mapName, int randseed ) { spawnedEntities.Clear(); activeEntities.Clear(); numEntitiesToDeactivate = 0; + subviewCameraAreas.Clear(); + subviewCameraAreasBuilt = false; sortTeamMasters = false; sortPushers = false; //HUMANHEAD rww @@ -2519,6 +2523,45 @@ bool idGameLocal::InPlayerConnectedArea( idEntity *ent ) const { return pvs.InCurrentPVS( playerConnectedAreas, ent->GetPVSAreas(), ent->GetNumPVSAreas() ); } +// ftbHugeHunter - subview camera functions +void idGameLocal::BuildSubviewCameraAreas( void ) { + subviewCameraAreas.Clear(); + for ( idEntity *src = spawnedEntities.Next(); src != NULL; src = src->spawnNode.Next() ) { + // look up by spawnArgs — src->cameraTarget wired by deferred event + const char *targetName = src->spawnArgs.GetString( "cameraTarget" ); + if ( !targetName || !targetName[0] ) { + continue; + } + idEntity *tgt = src->cameraTarget ? src->cameraTarget : FindEntity( targetName ); + if ( !tgt ) { + continue; + } + const int *areas = tgt->GetPVSAreas(); + const int n = tgt->GetNumPVSAreas(); + for ( int i = 0; i < n; i++ ) { + subviewCameraAreas.AddUnique( areas[i] ); + } + } + subviewCameraAreasBuilt = true; +} + +bool idGameLocal::InSubviewCameraArea( idEntity *ent ) { + if ( !subviewCameraAreasBuilt ) { + BuildSubviewCameraAreas(); + } + if ( subviewCameraAreas.Num() == 0 ) { + return false; + } + const int *areas = ent->GetPVSAreas(); + const int n = ent->GetNumPVSAreas(); + for ( int i = 0; i < n; i++ ) { + if ( subviewCameraAreas.FindIndex( areas[i] ) >= 0 ) { + return true; + } + } + return false; +} + /* ================ idGameLocal::UpdateGravity diff --git a/neo/game/Game_local.h b/neo/game/Game_local.h index 598e3617..8e75f333 100644 --- a/neo/game/Game_local.h +++ b/neo/game/Game_local.h @@ -475,6 +475,12 @@ class idGameLocal : public idGame { bool InPlayerPVS( idEntity *ent ) const; bool InPlayerConnectedArea( idEntity *ent ) const; + idList subviewCameraAreas; + bool subviewCameraAreasBuilt; + void BuildSubviewCameraAreas( void ); + void InvalidateSubviewCameraAreas( void ) { subviewCameraAreasBuilt = false; subviewCameraAreas.Clear(); } + bool InSubviewCameraArea( idEntity *ent ); + void SetCamera( idCamera *cam ); idCamera * GetCamera( void ) const; bool SkipCinematic( void );