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( ...@@ -1926,7 +1926,6 @@ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
static const char* const kDinosaurEasterEggSwitches[] = { static const char* const kDinosaurEasterEggSwitches[] = {
error_page::switches::kDisableDinosaurEasterEgg, error_page::switches::kDisableDinosaurEasterEgg,
error_page::switches::kEnableEasterEggBdayMode,
}; };
command_line->CopySwitchesFrom(browser_command_line, command_line->CopySwitchesFrom(browser_command_line,
kDinosaurEasterEggSwitches, kDinosaurEasterEggSwitches,
......
...@@ -6,8 +6,6 @@ static_library("common") { ...@@ -6,8 +6,6 @@ static_library("common") {
sources = [ sources = [
"error.cc", "error.cc",
"error.h", "error.h",
"error_page_features.cc",
"error_page_features.h",
"error_page_params.cc", "error_page_params.cc",
"error_page_params.h", "error_page_params.h",
"error_page_switches.cc", "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 { ...@@ -9,7 +9,6 @@ namespace switches {
// Disables the dinosaur easter egg on the offline interstitial. // Disables the dinosaur easter egg on the offline interstitial.
const char kDisableDinosaurEasterEgg[] = "disable-dinosaur-easter-egg"; const char kDisableDinosaurEasterEgg[] = "disable-dinosaur-easter-egg";
const char kEnableEasterEggBdayMode[] = "enable-dino-easter-egg-bday-mode";
// Values for the kShowSavedCopy flag. // Values for the kShowSavedCopy flag.
const char kDisableShowSavedCopy[] = "disable"; const char kDisableShowSavedCopy[] = "disable";
......
...@@ -12,7 +12,6 @@ namespace switches { ...@@ -12,7 +12,6 @@ namespace switches {
extern const char kDisableDinosaurEasterEgg[]; extern const char kDisableDinosaurEasterEgg[];
extern const char kDisableShowSavedCopy[]; extern const char kDisableShowSavedCopy[];
extern const char kEnableEasterEggBdayMode[];
extern const char kEnableShowSavedCopyPrimary[]; extern const char kEnableShowSavedCopyPrimary[];
extern const char kEnableShowSavedCopySecondary[]; extern const char kEnableShowSavedCopySecondary[];
extern const char kShowSavedCopy[]; extern const char kShowSavedCopy[];
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "base/values.h" #include "base/values.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/error_page/common/error.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_params.h"
#include "components/error_page/common/error_page_switches.h" #include "components/error_page/common/error_page_switches.h"
#include "components/error_page/common/net_error_info.h" #include "components/error_page/common/net_error_info.h"
...@@ -945,12 +944,6 @@ void LocalizedError::GetStrings( ...@@ -945,12 +944,6 @@ void LocalizedError::GetStrings(
l10n_util::GetStringUTF16(IDS_ERRORPAGE_FUN_DISABLED)); 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("failedUrl", failed_url_string);
summary->SetString("hostName", host_name); summary->SetString("hostName", host_name);
......
...@@ -132,8 +132,6 @@ ...@@ -132,8 +132,6 @@
<div id="offline-resources"> <div id="offline-resources">
<img id="offline-resources-1x" src="images/default_100_percent/offline/100-offline-sprite.png"> <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-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"> <template id="audio-resources">
<audio id="offline-sound-press" src="sounds/button-press.mp3"></audio> <audio id="offline-sound-press" src="sounds/button-press.mp3"></audio>
<audio id="offline-sound-hit" src="sounds/hit.mp3"></audio> <audio id="offline-sound-hit" src="sounds/hit.mp3"></audio>
......
...@@ -51,7 +51,6 @@ function Runner(outerContainerId, opt_config) { ...@@ -51,7 +51,6 @@ function Runner(outerContainerId, opt_config) {
this.inverted = false; this.inverted = false;
this.invertTimer = 0; this.invertTimer = 0;
this.resizeTimerId_ = null; this.resizeTimerId_ = null;
this.bdayFlashTimer = null;
this.playCount = 0; this.playCount = 0;
...@@ -107,9 +106,6 @@ Runner.config = { ...@@ -107,9 +106,6 @@ Runner.config = {
ACCELERATION: 0.001, ACCELERATION: 0.001,
BG_CLOUD_SPEED: 0.2, BG_CLOUD_SPEED: 0.2,
BOTTOM_PAD: 10, BOTTOM_PAD: 10,
BOTTOM_PAD_BDAY: 26,
BDAY_FLASH_DURATION: 1000,
BDAY_Y_POS_ADJUST: 16,
CLEAR_TIME: 3000, CLEAR_TIME: 3000,
CLOUD_FREQUENCY: 0.5, CLOUD_FREQUENCY: 0.5,
GAMEOVER_CLEAR_TIME: 750, GAMEOVER_CLEAR_TIME: 750,
...@@ -166,7 +162,6 @@ Runner.classes = { ...@@ -166,7 +162,6 @@ Runner.classes = {
*/ */
Runner.spriteDefinition = { Runner.spriteDefinition = {
LDPI: { LDPI: {
BALLOON: {x: 417, y: 29},
CACTUS_LARGE: {x: 332, y: 2}, CACTUS_LARGE: {x: 332, y: 2},
CACTUS_SMALL: {x: 228, y: 2}, CACTUS_SMALL: {x: 228, y: 2},
CLOUD: {x: 86, y: 2}, CLOUD: {x: 86, y: 2},
...@@ -176,12 +171,9 @@ Runner.spriteDefinition = { ...@@ -176,12 +171,9 @@ Runner.spriteDefinition = {
RESTART: {x: 2, y: 2}, RESTART: {x: 2, y: 2},
TEXT_SPRITE: {x: 655, y: 2}, TEXT_SPRITE: {x: 655, y: 2},
TREX: {x: 848, y: 2}, TREX: {x: 848, y: 2},
TREX_BDAY: {x: 0, y: 0},
SNACK: {x: 384, y: 22},
STAR: {x: 645, y: 2} STAR: {x: 645, y: 2}
}, },
HDPI: { HDPI: {
BALLOON: {x: 834, y: 58},
CACTUS_LARGE: {x: 652, y: 2}, CACTUS_LARGE: {x: 652, y: 2},
CACTUS_SMALL: {x: 446, y: 2}, CACTUS_SMALL: {x: 446, y: 2},
CLOUD: {x: 166, y: 2}, CLOUD: {x: 166, y: 2},
...@@ -191,8 +183,6 @@ Runner.spriteDefinition = { ...@@ -191,8 +183,6 @@ Runner.spriteDefinition = {
RESTART: {x: 2, y: 2}, RESTART: {x: 2, y: 2},
TEXT_SPRITE: {x: 1294, y: 2}, TEXT_SPRITE: {x: 1294, y: 2},
TREX: {x: 1678, y: 2}, TREX: {x: 1678, y: 2},
TREX_BDAY: {x: 0, y: 0},
SNACK: {x: 768, y: 44},
STAR: {x: 1276, y: 2} STAR: {x: 1276, y: 2}
} }
}; };
...@@ -299,13 +289,9 @@ Runner.prototype = { ...@@ -299,13 +289,9 @@ Runner.prototype = {
loadImages: function() { loadImages: function() {
if (IS_HIDPI) { if (IS_HIDPI) {
Runner.imageSprite = document.getElementById('offline-resources-2x'); Runner.imageSprite = document.getElementById('offline-resources-2x');
Runner.bdayImageSprite =
document.getElementById('offline-resources-bday-2x');
this.spriteDef = Runner.spriteDefinition.HDPI; this.spriteDef = Runner.spriteDefinition.HDPI;
} else { } else {
Runner.imageSprite = document.getElementById('offline-resources-1x'); Runner.imageSprite = document.getElementById('offline-resources-1x');
Runner.bdayImageSprite =
document.getElementById('offline-resources-bday-1x');
this.spriteDef = Runner.spriteDefinition.LDPI; this.spriteDef = Runner.spriteDefinition.LDPI;
} }
...@@ -540,19 +526,6 @@ Runner.prototype = { ...@@ -540,19 +526,6 @@ Runner.prototype = {
var now = getTimeStamp(); var now = getTimeStamp();
var deltaTime = now - (this.time || now); 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; this.time = now;
if (this.playing) { if (this.playing) {
...@@ -583,15 +556,6 @@ Runner.prototype = { ...@@ -583,15 +556,6 @@ Runner.prototype = {
var collision = hasObstacles && var collision = hasObstacles &&
checkForCollision(this.horizon.obstacles[0], this.tRex); 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) { if (!collision) {
this.distanceRan += this.currentSpeed * deltaTime / this.msPerFrame; this.distanceRan += this.currentSpeed * deltaTime / this.msPerFrame;
...@@ -1000,15 +964,6 @@ Runner.updateCanvasScaling = function(canvas, opt_width, opt_height) { ...@@ -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. * Get random number.
* @param {number} min * @param {number} min
...@@ -1195,7 +1150,7 @@ function checkForCollision(obstacle, tRex, opt_canvasCtx) { ...@@ -1195,7 +1150,7 @@ function checkForCollision(obstacle, tRex, opt_canvasCtx) {
tRex.xPos + 1, tRex.xPos + 1,
tRex.yPos + 1, tRex.yPos + 1,
tRex.config.WIDTH - 2, tRex.config.WIDTH - 2,
(tRex.bdayModeActive ? tRex.config.HEIGHT_BDAY : tRex.config.HEIGHT) - 2); tRex.config.HEIGHT - 2);
var obstacleBox = new CollisionBox( var obstacleBox = new CollisionBox(
obstacle.xPos + 1, obstacle.xPos + 1,
...@@ -1224,10 +1179,6 @@ function checkForCollision(obstacle, tRex, opt_canvasCtx) { ...@@ -1224,10 +1179,6 @@ function checkForCollision(obstacle, tRex, opt_canvasCtx) {
createAdjustedCollisionBox(collisionBoxes[i], obstacleBox); createAdjustedCollisionBox(collisionBoxes[i], obstacleBox);
var crashed = boxCompare(adjTrexBox, adjObstacleBox); var crashed = boxCompare(adjTrexBox, adjObstacleBox);
if (tRex.bdayModeActive) {
adjTrexBox.y += Runner.config.BDAY_Y_POS_ADJUST;
}
// Draw boxes for debug. // Draw boxes for debug.
if (opt_canvasCtx) { if (opt_canvasCtx) {
drawCollisionBoxes(opt_canvasCtx, adjTrexBox, adjObstacleBox); drawCollisionBoxes(opt_canvasCtx, adjTrexBox, adjObstacleBox);
...@@ -1344,8 +1295,6 @@ function Obstacle(canvasCtx, type, spriteImgPos, dimensions, ...@@ -1344,8 +1295,6 @@ function Obstacle(canvasCtx, type, spriteImgPos, dimensions,
this.collisionBoxes = []; this.collisionBoxes = [];
this.gap = 0; this.gap = 0;
this.speedOffset = 0; this.speedOffset = 0;
this.imageSprite = this.typeConfig.type == 'SNACK' ? Runner.bdayImageSprite :
Runner.imageSprite;
// For animated obstacles. // For animated obstacles.
this.currentFrame = 0; this.currentFrame = 0;
...@@ -1437,7 +1386,7 @@ Obstacle.prototype = { ...@@ -1437,7 +1386,7 @@ Obstacle.prototype = {
sourceX += sourceWidth * this.currentFrame; sourceX += sourceWidth * this.currentFrame;
} }
this.canvasCtx.drawImage(this.imageSprite, this.canvasCtx.drawImage(Runner.imageSprite,
sourceX, this.spritePos.y, sourceX, this.spritePos.y,
sourceWidth * this.size, sourceHeight, sourceWidth * this.size, sourceHeight,
this.xPos, this.yPos, this.xPos, this.yPos,
...@@ -1567,18 +1516,6 @@ Obstacle.types = [ ...@@ -1567,18 +1516,6 @@ Obstacle.types = [
numFrames: 2, numFrames: 2,
frameRate: 1000/6, frameRate: 1000/6,
speedOffset: .8 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 = [ ...@@ -1593,7 +1530,6 @@ Obstacle.types = [
function Trex(canvas, spritePos) { function Trex(canvas, spritePos) {
this.canvas = canvas; this.canvas = canvas;
this.canvasCtx = canvas.getContext('2d'); this.canvasCtx = canvas.getContext('2d');
this.imageSprite = Runner.imageSprite;
this.spritePos = spritePos; this.spritePos = spritePos;
this.xPos = 0; this.xPos = 0;
this.yPos = 0; this.yPos = 0;
...@@ -1617,8 +1553,6 @@ function Trex(canvas, spritePos) { ...@@ -1617,8 +1553,6 @@ function Trex(canvas, spritePos) {
this.speedDrop = false; this.speedDrop = false;
this.jumpCount = 0; this.jumpCount = 0;
this.jumpspotX = 0; this.jumpspotX = 0;
this.bdayModeActive = false;
this.flashing = false;
this.init(); this.init();
}; };
...@@ -1630,11 +1564,8 @@ function Trex(canvas, spritePos) { ...@@ -1630,11 +1564,8 @@ function Trex(canvas, spritePos) {
*/ */
Trex.config = { Trex.config = {
DROP_VELOCITY: -5, DROP_VELOCITY: -5,
FLASH_OFF: 175,
FLASH_ON: 100,
GRAVITY: 0.6, GRAVITY: 0.6,
HEIGHT: 47, HEIGHT: 47,
HEIGHT_BDAY: 63,
HEIGHT_DUCK: 25, HEIGHT_DUCK: 25,
INIITAL_JUMP_VELOCITY: -10, INIITAL_JUMP_VELOCITY: -10,
INTRO_DURATION: 1500, INTRO_DURATION: 1500,
...@@ -1729,25 +1660,6 @@ Trex.prototype = { ...@@ -1729,25 +1660,6 @@ Trex.prototype = {
this.update(0, Trex.status.WAITING); 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. * Setter for the jump velocity.
* The approriate drop velocity is also set. * The approriate drop velocity is also set.
...@@ -1791,7 +1703,7 @@ Trex.prototype = { ...@@ -1791,7 +1703,7 @@ Trex.prototype = {
} }
// Update the frame position. // Update the frame position.
if (!this.flashing && this.timer >= this.msPerFrame) { if (this.timer >= this.msPerFrame) {
this.currentFrame = this.currentFrame == this.currentFrame = this.currentFrame ==
this.currentAnimFrames.length - 1 ? 0 : this.currentFrame + 1; this.currentAnimFrames.length - 1 ? 0 : this.currentFrame + 1;
this.timer = 0; this.timer = 0;
...@@ -1814,11 +1726,9 @@ Trex.prototype = { ...@@ -1814,11 +1726,9 @@ Trex.prototype = {
var sourceY = y; var sourceY = y;
var sourceWidth = this.ducking && this.status != Trex.status.CRASHED ? var sourceWidth = this.ducking && this.status != Trex.status.CRASHED ?
this.config.WIDTH_DUCK : this.config.WIDTH; this.config.WIDTH_DUCK : this.config.WIDTH;
var sourceHeight = this.bdayModeActive ? this.config.HEIGHT_BDAY : var sourceHeight = this.config.HEIGHT;
this.config.HEIGHT;
var outputHeight = sourceHeight; var outputHeight = sourceHeight;
if (IS_HIDPI) { if (IS_HIDPI) {
sourceX *= 2; sourceX *= 2;
sourceY *= 2; sourceY *= 2;
...@@ -1830,18 +1740,9 @@ Trex.prototype = { ...@@ -1830,18 +1740,9 @@ Trex.prototype = {
sourceX += this.spritePos.x; sourceX += this.spritePos.x;
sourceY += this.spritePos.y; 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. // Ducking.
if (this.ducking && this.status != Trex.status.CRASHED) { if (this.ducking && this.status != Trex.status.CRASHED) {
this.canvasCtx.drawImage(this.imageSprite, sourceX, sourceY, this.canvasCtx.drawImage(Runner.imageSprite, sourceX, sourceY,
sourceWidth, sourceHeight, sourceWidth, sourceHeight,
this.xPos, this.yPos, this.xPos, this.yPos,
this.config.WIDTH_DUCK, outputHeight); this.config.WIDTH_DUCK, outputHeight);
...@@ -1851,7 +1752,7 @@ Trex.prototype = { ...@@ -1851,7 +1752,7 @@ Trex.prototype = {
this.xPos++; this.xPos++;
} }
// Standing / running // Standing / running
this.canvasCtx.drawImage(this.imageSprite, sourceX, sourceY, this.canvasCtx.drawImage(Runner.imageSprite, sourceX, sourceY,
sourceWidth, sourceHeight, sourceWidth, sourceHeight,
this.xPos, this.yPos, this.xPos, this.yPos,
this.config.WIDTH, outputHeight); this.config.WIDTH, outputHeight);
...@@ -2251,10 +2152,9 @@ DistanceMeter.prototype = { ...@@ -2251,10 +2152,9 @@ DistanceMeter.prototype = {
* Similar to an obstacle object but without collision boxes. * Similar to an obstacle object but without collision boxes.
* @param {HTMLCanvasElement} canvas Canvas element. * @param {HTMLCanvasElement} canvas Canvas element.
* @param {Object} spritePos Position of image in sprite. * @param {Object} spritePos Position of image in sprite.
* @param {boolean} isBalloon Switch Cloud to balloon.
* @param {number} containerWidth * @param {number} containerWidth
*/ */
function Cloud(canvas, spritePos, containerWidth, isBalloon) { function Cloud(canvas, spritePos, containerWidth) {
this.canvas = canvas; this.canvas = canvas;
this.canvasCtx = this.canvas.getContext('2d'); this.canvasCtx = this.canvas.getContext('2d');
this.spritePos = spritePos; this.spritePos = spritePos;
...@@ -2264,8 +2164,6 @@ function Cloud(canvas, spritePos, containerWidth, isBalloon) { ...@@ -2264,8 +2164,6 @@ function Cloud(canvas, spritePos, containerWidth, isBalloon) {
this.remove = false; this.remove = false;
this.cloudGap = getRandomNum(Cloud.config.MIN_CLOUD_GAP, this.cloudGap = getRandomNum(Cloud.config.MIN_CLOUD_GAP,
Cloud.config.MAX_CLOUD_GAP); Cloud.config.MAX_CLOUD_GAP);
this.isBalloon = isBalloon;
this.imageSprite = isBalloon ? Runner.bdayImageSprite : Runner.imageSprite;
this.init(); this.init();
}; };
...@@ -2277,13 +2175,11 @@ function Cloud(canvas, spritePos, containerWidth, isBalloon) { ...@@ -2277,13 +2175,11 @@ function Cloud(canvas, spritePos, containerWidth, isBalloon) {
*/ */
Cloud.config = { Cloud.config = {
HEIGHT: 14, HEIGHT: 14,
HEIGHT_BALLOON: 34,
MAX_CLOUD_GAP: 400, MAX_CLOUD_GAP: 400,
MAX_SKY_LEVEL: 30, MAX_SKY_LEVEL: 30,
MIN_CLOUD_GAP: 100, MIN_CLOUD_GAP: 100,
MIN_SKY_LEVEL: 71, MIN_SKY_LEVEL: 71,
WIDTH: 46, WIDTH: 46
WIDTH_BALLOON: 16
}; };
...@@ -2302,10 +2198,8 @@ Cloud.prototype = { ...@@ -2302,10 +2198,8 @@ Cloud.prototype = {
*/ */
draw: function() { draw: function() {
this.canvasCtx.save(); this.canvasCtx.save();
var sourceWidth = this.isBalloon ? Cloud.config.WIDTH_BALLOON : var sourceWidth = Cloud.config.WIDTH;
Cloud.config.WIDTH; var sourceHeight = Cloud.config.HEIGHT;
var sourceHeight = this.isBalloon ? Cloud.config.HEIGHT_BALLOON :
Cloud.config.HEIGHT;
var outputWidth = sourceWidth; var outputWidth = sourceWidth;
var outputHeight = sourceHeight; var outputHeight = sourceHeight;
if (IS_HIDPI) { if (IS_HIDPI) {
...@@ -2313,7 +2207,7 @@ Cloud.prototype = { ...@@ -2313,7 +2207,7 @@ Cloud.prototype = {
sourceHeight = sourceHeight * 2; sourceHeight = sourceHeight * 2;
} }
this.canvasCtx.drawImage(this.imageSprite, this.spritePos.x, this.canvasCtx.drawImage(Runner.imageSprite, this.spritePos.x,
this.spritePos.y, this.spritePos.y,
sourceWidth, sourceHeight, sourceWidth, sourceHeight,
this.xPos, this.yPos, this.xPos, this.yPos,
...@@ -2655,7 +2549,6 @@ function Horizon(canvas, spritePos, dimensions, gapCoefficient) { ...@@ -2655,7 +2549,6 @@ function Horizon(canvas, spritePos, dimensions, gapCoefficient) {
this.cloudFrequency = this.config.CLOUD_FREQUENCY; this.cloudFrequency = this.config.CLOUD_FREQUENCY;
this.spritePos = spritePos; this.spritePos = spritePos;
this.nightMode = null; this.nightMode = null;
this.bdayModeActive = false;
// Cloud // Cloud
this.clouds = []; this.clouds = [];
...@@ -2691,14 +2584,6 @@ Horizon.prototype = { ...@@ -2691,14 +2584,6 @@ Horizon.prototype = {
this.dimensions.WIDTH); this.dimensions.WIDTH);
}, },
/**
* Enable additional items.
*/
enableBdayMode: function() {
this.bdayModeActive = true;
this.removeFirstObstacle();
},
/** /**
* @param {number} deltaTime * @param {number} deltaTime
* @param {number} currentSpeed * @param {number} currentSpeed
...@@ -2795,10 +2680,7 @@ Horizon.prototype = { ...@@ -2795,10 +2680,7 @@ Horizon.prototype = {
* @param {number} currentSpeed * @param {number} currentSpeed
*/ */
addNewObstacle: function(currentSpeed) { addNewObstacle: function(currentSpeed) {
var obstacleCount = Runner.isBdayModeEnabled() && var obstacleTypeIndex = getRandomNum(0, Obstacle.types.length - 1);
!this.bdayModeActive ? Obstacle.types.length - 1 :
Obstacle.types.length - 2;
var obstacleTypeIndex = getRandomNum(0, obstacleCount);
var obstacleType = Obstacle.types[obstacleTypeIndex]; var obstacleType = Obstacle.types[obstacleTypeIndex];
// Check for multiples of the same type of obstacle. // Check for multiples of the same type of obstacle.
...@@ -2860,10 +2742,8 @@ Horizon.prototype = { ...@@ -2860,10 +2742,8 @@ Horizon.prototype = {
* Add a new cloud to the horizon. * Add a new cloud to the horizon.
*/ */
addCloud: function() { addCloud: function() {
var cloudType = this.bdayModeActive && getRandomNum(0, 1) > 0 ? this.clouds.push(new Cloud(this.canvas, this.spritePos.CLOUD,
this.spritePos.BALLOON : this.spritePos.CLOUD; this.dimensions.WIDTH));
this.clouds.push(new Cloud(this.canvas, cloudType,
this.dimensions.WIDTH, cloudType == this.spritePos.BALLOON));
} }
}; };
})(); })();
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