disable interstitial by default and fix crash

This commit is contained in:
Dante Ruiz 2018-09-12 15:31:03 -07:00
parent e243792cac
commit d76a2c1add
3 changed files with 30 additions and 9 deletions

View file

@ -3498,7 +3498,9 @@ bool Application::isServerlessMode() const {
} }
void Application::setIsInterstitialMode(bool interstitialMode) { void Application::setIsInterstitialMode(bool interstitialMode) {
if (_interstitialMode != interstitialMode) { Settings settings;
bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool();
if (_interstitialMode != interstitialMode && enableInterstitial) {
_interstitialMode = interstitialMode; _interstitialMode = interstitialMode;
DependencyManager::get<AudioClient>()->setAudioPaused(_interstitialMode); DependencyManager::get<AudioClient>()->setAudioPaused(_interstitialMode);

View file

@ -66,13 +66,18 @@ void SafeLanding::addTrackedEntity(const EntityItemID& entityID) {
Locker lock(_lock); Locker lock(_lock);
EntityItemPointer entity = _entityTree->findEntityByID(entityID); EntityItemPointer entity = _entityTree->findEntityByID(entityID);
_trackedEntities.emplace(entityID, entity); if (entity) {
int trackedEntityCount = (int)_trackedEntities.size();
if (trackedEntityCount > _maxTrackedEntityCount) { _trackedEntities.emplace(entityID, entity);
_maxTrackedEntityCount = trackedEntityCount; int trackedEntityCount = (int)_trackedEntities.size();
if (trackedEntityCount > _maxTrackedEntityCount) {
_maxTrackedEntityCount = trackedEntityCount;
}
qCDebug(interfaceapp) << "Safe Landing: Tracking entity " << entity->getItemName();
} }
qCDebug(interfaceapp) << "Safe Landing: Tracking entity " << entity->getItemName(); } else {
qCDebug(interfaceapp) << "Safe Landing: Null Entity: " << entityID;
} }
} }
@ -146,7 +151,7 @@ bool isEntityPhysicsReady(const EntityItemPointer& entity) {
bool hasAABox; bool hasAABox;
entity->getAABox(hasAABox); entity->getAABox(hasAABox);
if (hasAABox && downloadedCollisionTypes.count(modelEntity->getShapeType()) != 0) { if (hasAABox && downloadedCollisionTypes.count(modelEntity->getShapeType()) != 0) {
return entity->isReadyToComputeShape(); return (!entity->shouldBePhysical() || entity->isReadyToComputeShape());
} }
} }
} }
@ -156,12 +161,23 @@ bool isEntityPhysicsReady(const EntityItemPointer& entity) {
bool SafeLanding::isEntityLoadingComplete() { bool SafeLanding::isEntityLoadingComplete() {
Locker lock(_lock); Locker lock(_lock);
auto entityTree = qApp->getEntities(); auto entityTree = qApp->getEntities();
auto entityMapIter = _trackedEntities.begin(); auto entityMapIter = _trackedEntities.begin();
while (entityMapIter != _trackedEntities.end()) { while (entityMapIter != _trackedEntities.end()) {
auto entity = entityMapIter->second; auto entity = entityMapIter->second;
bool isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first));
bool isVisuallyReady = true;
Settings settings;
bool enableInterstitial = settings.value("enableIntersitialMode", false).toBool();
if (enableInterstitial) {
bool isVisuallyReady = (entity->isVisuallyReady() || !entityTree->renderableForEntityId(entityMapIter->first));
}
if (isEntityPhysicsReady(entity) && isVisuallyReady) { if (isEntityPhysicsReady(entity) && isVisuallyReady) {
entityMapIter = _trackedEntities.erase(entityMapIter); entityMapIter = _trackedEntities.erase(entityMapIter);
} else { } else {

View file

@ -35,10 +35,13 @@ var DEFAULT_SCRIPTS_COMBINED = [
]; ];
var DEFAULT_SCRIPTS_SEPARATE = [ var DEFAULT_SCRIPTS_SEPARATE = [
"system/controllers/controllerScripts.js", "system/controllers/controllerScripts.js",
"system/interstitialPage.js"
//"system/chat.js" //"system/chat.js"
]; ];
if (Settings.getValue("enableInterstitialMode", false)) {
DEFAULT_SCRIPTS_SEPARATE.push("system/interstitialPage.js");
}
// add a menu item for debugging // add a menu item for debugging
var MENU_CATEGORY = "Developer"; var MENU_CATEGORY = "Developer";
var MENU_ITEM = "Debug defaultScripts.js"; var MENU_ITEM = "Debug defaultScripts.js";