Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions neo/Prey/prey_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
4 changes: 4 additions & 0 deletions neo/game/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down
43 changes: 43 additions & 0 deletions neo/game/Game_local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ void idGameLocal::Clear( void ) {
spawnedEntities.Clear();
activeEntities.Clear();
numEntitiesToDeactivate = 0;
subviewCameraAreas.Clear();
subviewCameraAreasBuilt = false;
sortPushers = false;
sortTeamMasters = false;
//HUMANHEAD rww
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions neo/game/Game_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,12 @@ class idGameLocal : public idGame {
bool InPlayerPVS( idEntity *ent ) const;
bool InPlayerConnectedArea( idEntity *ent ) const;

idList<int> 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 );
Expand Down
Loading