Commit b34db1eb authored by Edward Jung's avatar Edward Jung Committed by Commit Bot

chrome://dino post M69 removal of bday mode

Bug: 846473
Change-Id: I46923a902045b531578439e73068c0fd93c66691
Reviewed-on: https://chromium-review.googlesource.com/1240301Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Commit-Queue: Edward Jung <edwardjung@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594408}
parent 95f93d44
......@@ -1926,7 +1926,6 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
static const char* const kDinosaurEasterEggSwitches[] = {
error_page::switches::kDisableDinosaurEasterEgg,
error_page::switches::kEnableEasterEggBdayMode,
};
command_line->CopySwitchesFrom(browser_command_line,
kDinosaurEasterEggSwitches,
......
......@@ -6,8 +6,6 @@ static_library("common") {
sources = [
"error.cc",
"error.h",
"error_page_features.cc",
"error_page_features.h",
"error_page_params.cc",
"error_page_params.h",
"error_page_switches.cc",
......
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/error_page/common/error_page_features.h"
namespace error_page {
namespace features {
const base::Feature kDinoEasterEggBdayMode{"DinoEasterEggBdayMode",
base::FEATURE_DISABLED_BY_DEFAULT};
} // namespace features
} // namespace error_page
\ No newline at end of file
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_ERROR_PAGE_COMMON_ERROR_PAGE_FEATURES_H_
#define COMPONENTS_ERROR_PAGE_COMMON_ERROR_PAGE_FEATURES_H_
#include "base/feature_list.h"
namespace error_page {
namespace features {
// Defines all the features used by //components/error_page.
// Enables or disables the offline dino easter egg bday mode.
extern const base::Feature kDinoEasterEggBdayMode;
} // namespace features
} // namespace error_page
#endif // COMPONENTS_ERROR_PAGE_COMMON_ERROR_PAGE_FEATURES_H_
......@@ -9,7 +9,6 @@ namespace switches {
// Disables the dinosaur easter egg on the offline interstitial.
const char kDisableDinosaurEasterEgg[] = "disable-dinosaur-easter-egg";
const char kEnableEasterEggBdayMode[] = "enable-dino-easter-egg-bday-mode";
// Values for the kShowSavedCopy flag.
const char kDisableShowSavedCopy[] = "disable";
......
......@@ -12,7 +12,6 @@ namespace switches {
extern const char kDisableDinosaurEasterEgg[];
extern const char kDisableShowSavedCopy[];
extern const char kEnableEasterEggBdayMode[];
extern const char kEnableShowSavedCopyPrimary[];
extern const char kEnableShowSavedCopySecondary[];
extern const char kShowSavedCopy[];
......
......@@ -22,7 +22,6 @@
#include "base/values.h"
#include "build/build_config.h"
#include "components/error_page/common/error.h"
#include "components/error_page/common/error_page_features.h"
#include "components/error_page/common/error_page_params.h"
#include "components/error_page/common/error_page_switches.h"
#include "components/error_page/common/net_error_info.h"
......@@ -945,12 +944,6 @@ void LocalizedError::GetStrings(
l10n_util::GetStringUTF16(IDS_ERRORPAGE_FUN_DISABLED));
}
if (command_line->HasSwitch(error_page::switches::kEnableEasterEggBdayMode) ||
base::FeatureList::IsEnabled(
error_page::features::kDinoEasterEggBdayMode)) {
error_strings->SetBoolean("bdayMode", true);
}
summary->SetString("failedUrl", failed_url_string);
summary->SetString("hostName", host_name);
......
......@@ -132,8 +132,6 @@
<div id="offline-resources">
<img id="offline-resources-1x" src="images/default_100_percent/offline/100-offline-sprite.png">
<img id="offline-resources-2x" src="images/default_200_percent/offline/200-offline-sprite.png">
<img id="offline-resources-bday-1x" src="images/default_100_percent/offline/100-offline-sprite-bday.png">
<img id="offline-resources-bday-2x" src="images/default_200_percent/offline/200-offline-sprite-bday.png">
<template id="audio-resources">
<audio id="offline-sound-press" src="sounds/button-press.mp3"></audio>
<audio id="offline-sound-hit" src="sounds/hit.mp3"></audio>
......
......@@ -51,7 +51,6 @@ function Runner(outerContainerId, opt_config) {
this.inverted = false;
this.invertTimer = 0;
this.resizeTimerId_ = null;
this.bdayFlashTimer = null;
this.playCount = 0;
......@@ -107,9 +106,6 @@ Runner.config = {
ACCELERATION: 0.001,
BG_CLOUD_SPEED: 0.2,
BOTTOM_PAD: 10,
BOTTOM_PAD_BDAY: 26,
BDAY_FLASH_DURATION: 1000,
BDAY_Y_POS_ADJUST: 16,
CLEAR_TIME: 3000,
CLOUD_FREQUENCY: 0.5,
GAMEOVER_CLEAR_TIME: 750,
......@@ -166,7 +162,6 @@ Runner.classes = {
*/
Runner.spriteDefinition = {
LDPI: {
BALLOON: {x: 417, y: 29},
CACTUS_LARGE: {x: 332, y: 2},
CACTUS_SMALL: {x: 228, y: 2},
CLOUD: {x: 86, y: 2},
......@@ -176,12 +171,9 @@ Runner.spriteDefinition = {
RESTART: {x: 2, y: 2},
TEXT_SPRITE: {x: 655, y: 2},
TREX: {x: 848, y: 2},
TREX_BDAY: {x: 0, y: 0},
SNACK: {x: 384, y: 22},
STAR: {x: 645, y: 2}
},
HDPI: {
BALLOON: {x: 834, y: 58},
CACTUS_LARGE: {x: 652, y: 2},
CACTUS_SMALL: {x: 446, y: 2},
CLOUD: {x: 166, y: 2},
......@@ -191,8 +183,6 @@ Runner.spriteDefinition = {
RESTART: {x: 2, y: 2},
TEXT_SPRITE: {x: 1294, y: 2},
TREX: {x: 1678, y: 2},
TREX_BDAY: {x: 0, y: 0},
SNACK: {x: 768, y: 44},
STAR: {x: 1276, y: 2}
}
};
......@@ -299,13 +289,9 @@ Runner.prototype = {
loadImages: function() {
if (IS_HIDPI) {
Runner.imageSprite = document.getElementById('offline-resources-2x');
Runner.bdayImageSprite =
document.getElementById('offline-resources-bday-2x');
this.spriteDef = Runner.spriteDefinition.HDPI;
} else {
Runner.imageSprite = document.getElementById('offline-resources-1x');
Runner.bdayImageSprite =
document.getElementById('offline-resources-bday-1x');
this.spriteDef = Runner.spriteDefinition.LDPI;
}
......@@ -540,19 +526,6 @@ Runner.prototype = {
var now = getTimeStamp();
var deltaTime = now - (this.time || now);
// Flashing.
if (this.bdayFlashTimer != null) {
if (this.bdayFlashTimer <= 0) {
this.bdayFlashTimer = null;
this.tRex.setFlashing(false);
this.tRex.enableBdayMode(this.spriteDef.TREX_BDAY);
} else {
this.bdayFlashTimer -= deltaTime;
this.tRex.update(deltaTime);
deltaTime = 0;
}
}
this.time = now;
if (this.playing) {
......@@ -583,15 +556,6 @@ Runner.prototype = {
var collision = hasObstacles &&
checkForCollision(this.horizon.obstacles[0], this.tRex);
// Ate snack.
if (Runner.isBdayModeEnabled() && collision &&
this.horizon.obstacles[0].typeConfig.type == 'SNACK') {
this.horizon.enableBdayMode();
this.tRex.setFlashing(true);
collision = false;
this.bdayFlashTimer = this.config.BDAY_FLASH_DURATION;
}
if (!collision) {
this.distanceRan += this.currentSpeed * deltaTime / this.msPerFrame;
......@@ -1000,15 +964,6 @@ Runner.updateCanvasScaling = function(canvas, opt_width, opt_height) {
};
/**
* Whether the bday mode is enabled.
* @return {boolean}
*/
Runner.isBdayModeEnabled = function() {
return loadTimeData && loadTimeData.valueExists('bdayMode');
}
/**
* Get random number.
* @param {number} min
......@@ -1195,7 +1150,7 @@ function checkForCollision(obstacle, tRex, opt_canvasCtx) {
tRex.xPos + 1,
tRex.yPos + 1,
tRex.config.WIDTH - 2,
(tRex.bdayModeActive ? tRex.config.HEIGHT_BDAY : tRex.config.HEIGHT) - 2);
tRex.config.HEIGHT - 2);
var obstacleBox = new CollisionBox(
obstacle.xPos + 1,
......@@ -1224,10 +1179,6 @@ function checkForCollision(obstacle, tRex, opt_canvasCtx) {
createAdjustedCollisionBox(collisionBoxes[i], obstacleBox);
var crashed = boxCompare(adjTrexBox, adjObstacleBox);
if (tRex.bdayModeActive) {
adjTrexBox.y += Runner.config.BDAY_Y_POS_ADJUST;
}
// Draw boxes for debug.
if (opt_canvasCtx) {
drawCollisionBoxes(opt_canvasCtx, adjTrexBox, adjObstacleBox);
......@@ -1344,8 +1295,6 @@ function Obstacle(canvasCtx, type, spriteImgPos, dimensions,
this.collisionBoxes = [];
this.gap = 0;
this.speedOffset = 0;
this.imageSprite = this.typeConfig.type == 'SNACK' ? Runner.bdayImageSprite :
Runner.imageSprite;
// For animated obstacles.
this.currentFrame = 0;
......@@ -1437,7 +1386,7 @@ Obstacle.prototype = {
sourceX += sourceWidth * this.currentFrame;
}
this.canvasCtx.drawImage(this.imageSprite,
this.canvasCtx.drawImage(Runner.imageSprite,
sourceX, this.spritePos.y,
sourceWidth * this.size, sourceHeight,
this.xPos, this.yPos,
......@@ -1567,18 +1516,6 @@ Obstacle.types = [
numFrames: 2,
frameRate: 1000/6,
speedOffset: .8
},
{
type: 'SNACK',
width: 33,
height: 42,
yPos: 85,
multipleSpeed: 999,
minGap: 999,
minSpeed: 0,
collisionBoxes: [
new CollisionBox(0, 0, 40, 40)
]
}
];
......@@ -1593,7 +1530,6 @@ Obstacle.types = [
function Trex(canvas, spritePos) {
this.canvas = canvas;
this.canvasCtx = canvas.getContext('2d');
this.imageSprite = Runner.imageSprite;
this.spritePos = spritePos;
this.xPos = 0;
this.yPos = 0;
......@@ -1617,8 +1553,6 @@ function Trex(canvas, spritePos) {
this.speedDrop = false;
this.jumpCount = 0;
this.jumpspotX = 0;
this.bdayModeActive = false;
this.flashing = false;
this.init();
};
......@@ -1630,11 +1564,8 @@ function Trex(canvas, spritePos) {
*/
Trex.config = {
DROP_VELOCITY: -5,
FLASH_OFF: 175,
FLASH_ON: 100,
GRAVITY: 0.6,
HEIGHT: 47,
HEIGHT_BDAY: 63,
HEIGHT_DUCK: 25,
INIITAL_JUMP_VELOCITY: -10,
INTRO_DURATION: 1500,
......@@ -1729,25 +1660,6 @@ Trex.prototype = {
this.update(0, Trex.status.WAITING);
},
/**
* @param {Object} spritePos New positioning within image sprite.
*/
enableBdayMode: function(spritePos) {
this.bdayModeActive = true;
this.spritePos = spritePos;
this.imageSprite = Runner.bdayImageSprite;
this.groundYPos = Runner.defaultDimensions.HEIGHT - this.config.HEIGHT -
Runner.config.BOTTOM_PAD_BDAY;
this.yPos -= Runner.config.BDAY_Y_POS_ADJUST;
},
/**
* @param {boolean} status Whether dino is flashing.
*/
setFlashing: function(status) {
this.flashing = status;
},
/**
* Setter for the jump velocity.
* The approriate drop velocity is also set.
......@@ -1791,7 +1703,7 @@ Trex.prototype = {
}
// Update the frame position.
if (!this.flashing && this.timer >= this.msPerFrame) {
if (this.timer >= this.msPerFrame) {
this.currentFrame = this.currentFrame ==
this.currentAnimFrames.length - 1 ? 0 : this.currentFrame + 1;
this.timer = 0;
......@@ -1814,11 +1726,9 @@ Trex.prototype = {
var sourceY = y;
var sourceWidth = this.ducking && this.status != Trex.status.CRASHED ?
this.config.WIDTH_DUCK : this.config.WIDTH;
var sourceHeight = this.bdayModeActive ? this.config.HEIGHT_BDAY :
this.config.HEIGHT;
var sourceHeight = this.config.HEIGHT;
var outputHeight = sourceHeight;
if (IS_HIDPI) {
sourceX *= 2;
sourceY *= 2;
......@@ -1830,18 +1740,9 @@ Trex.prototype = {
sourceX += this.spritePos.x;
sourceY += this.spritePos.y;
// Flashing.
if (this.flashing) {
if (this.timer < this.config.FLASH_ON) {
this.canvasCtx.globalAlpha = 0.5;
} else if (this.timer > this.config.FLASH_OFF) {
this.timer = 0;
}
}
// Ducking.
if (this.ducking && this.status != Trex.status.CRASHED) {
this.canvasCtx.drawImage(this.imageSprite, sourceX, sourceY,
this.canvasCtx.drawImage(Runner.imageSprite, sourceX, sourceY,
sourceWidth, sourceHeight,
this.xPos, this.yPos,
this.config.WIDTH_DUCK, outputHeight);
......@@ -1851,7 +1752,7 @@ Trex.prototype = {
this.xPos++;
}
// Standing / running
this.canvasCtx.drawImage(this.imageSprite, sourceX, sourceY,
this.canvasCtx.drawImage(Runner.imageSprite, sourceX, sourceY,
sourceWidth, sourceHeight,
this.xPos, this.yPos,
this.config.WIDTH, outputHeight);
......@@ -2251,10 +2152,9 @@ DistanceMeter.prototype = {
* Similar to an obstacle object but without collision boxes.
* @param {HTMLCanvasElement} canvas Canvas element.
* @param {Object} spritePos Position of image in sprite.
* @param {boolean} isBalloon Switch Cloud to balloon.
* @param {number} containerWidth
*/
function Cloud(canvas, spritePos, containerWidth, isBalloon) {
function Cloud(canvas, spritePos, containerWidth) {
this.canvas = canvas;
this.canvasCtx = this.canvas.getContext('2d');
this.spritePos = spritePos;
......@@ -2264,8 +2164,6 @@ function Cloud(canvas, spritePos, containerWidth, isBalloon) {
this.remove = false;
this.cloudGap = getRandomNum(Cloud.config.MIN_CLOUD_GAP,
Cloud.config.MAX_CLOUD_GAP);
this.isBalloon = isBalloon;
this.imageSprite = isBalloon ? Runner.bdayImageSprite : Runner.imageSprite;
this.init();
};
......@@ -2277,13 +2175,11 @@ function Cloud(canvas, spritePos, containerWidth, isBalloon) {
*/
Cloud.config = {
HEIGHT: 14,
HEIGHT_BALLOON: 34,
MAX_CLOUD_GAP: 400,
MAX_SKY_LEVEL: 30,
MIN_CLOUD_GAP: 100,
MIN_SKY_LEVEL: 71,
WIDTH: 46,
WIDTH_BALLOON: 16
WIDTH: 46
};
......@@ -2302,10 +2198,8 @@ Cloud.prototype = {
*/
draw: function() {
this.canvasCtx.save();
var sourceWidth = this.isBalloon ? Cloud.config.WIDTH_BALLOON :
Cloud.config.WIDTH;
var sourceHeight = this.isBalloon ? Cloud.config.HEIGHT_BALLOON :
Cloud.config.HEIGHT;
var sourceWidth = Cloud.config.WIDTH;
var sourceHeight = Cloud.config.HEIGHT;
var outputWidth = sourceWidth;
var outputHeight = sourceHeight;
if (IS_HIDPI) {
......@@ -2313,7 +2207,7 @@ Cloud.prototype = {
sourceHeight = sourceHeight * 2;
}
this.canvasCtx.drawImage(this.imageSprite, this.spritePos.x,
this.canvasCtx.drawImage(Runner.imageSprite, this.spritePos.x,
this.spritePos.y,
sourceWidth, sourceHeight,
this.xPos, this.yPos,
......@@ -2655,7 +2549,6 @@ function Horizon(canvas, spritePos, dimensions, gapCoefficient) {
this.cloudFrequency = this.config.CLOUD_FREQUENCY;
this.spritePos = spritePos;
this.nightMode = null;
this.bdayModeActive = false;
// Cloud
this.clouds = [];
......@@ -2691,14 +2584,6 @@ Horizon.prototype = {
this.dimensions.WIDTH);
},
/**
* Enable additional items.
*/
enableBdayMode: function() {
this.bdayModeActive = true;
this.removeFirstObstacle();
},
/**
* @param {number} deltaTime
* @param {number} currentSpeed
......@@ -2795,10 +2680,7 @@ Horizon.prototype = {
* @param {number} currentSpeed
*/
addNewObstacle: function(currentSpeed) {
var obstacleCount = Runner.isBdayModeEnabled() &&
!this.bdayModeActive ? Obstacle.types.length - 1 :
Obstacle.types.length - 2;
var obstacleTypeIndex = getRandomNum(0, obstacleCount);
var obstacleTypeIndex = getRandomNum(0, Obstacle.types.length - 1);
var obstacleType = Obstacle.types[obstacleTypeIndex];
// Check for multiples of the same type of obstacle.
......@@ -2860,10 +2742,8 @@ Horizon.prototype = {
* Add a new cloud to the horizon.
*/
addCloud: function() {
var cloudType = this.bdayModeActive && getRandomNum(0, 1) > 0 ?
this.spritePos.BALLOON : this.spritePos.CLOUD;
this.clouds.push(new Cloud(this.canvas, cloudType,
this.dimensions.WIDTH, cloudType == this.spritePos.BALLOON));
this.clouds.push(new Cloud(this.canvas, this.spritePos.CLOUD,
this.dimensions.WIDTH));
}
};
})();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment