From e1dcc263bea147e9236543a50141af02e7e22a92 Mon Sep 17 00:00:00 2001 From: gustav Date: Wed, 21 Mar 2012 13:40:46 +0100 Subject: [PATCH] Fixed hold piece bug and issues with vanish zone --- www/css/style.css | 4 ++++ www/js/player.js | 2 +- www/js/playerview.js | 6 +++--- www/js/specials.js | 6 +++--- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/www/css/style.css b/www/css/style.css index 5dc3bb0..172862b 100644 --- a/www/css/style.css +++ b/www/css/style.css @@ -315,6 +315,10 @@ em.self { /* your name */ width: 192px; height: 2px; overflow: hidden; + display: none; +} +.self .toprow-wrapper { + display: block; } .row { float: left; diff --git a/www/js/player.js b/www/js/player.js index 03c99f1..e9a889b 100644 --- a/www/js/player.js +++ b/www/js/player.js @@ -264,7 +264,7 @@ Player.prototype.setCurrentBlock = function(block) { } Player.prototype.hold = function() { - if (this.holdPossible) { + if (this.holdPossible && this.currentBlock) { this.holdPossible = false; if (this.holdBlock) { var newBlock = this.holdBlock; diff --git a/www/js/playerview.js b/www/js/playerview.js index 7a270e7..427f2c2 100644 --- a/www/js/playerview.js +++ b/www/js/playerview.js @@ -101,12 +101,12 @@ PlayerView.prototype.render = function() { // update board var toprow = ''; if(this.isPlayer) { - toprow += '
'; + toprow += '
'; for(x = 0; x < this.player.width; ++x) { b = this.player.at(x,Board.VANISH_ZONE_HEIGHT-1); toprow += '
'; } - toprow += '
'; + toprow += '
'; } for(y = Board.VANISH_ZONE_HEIGHT; y < this.player.height; ++y) { html += '
'; @@ -116,7 +116,7 @@ PlayerView.prototype.render = function() { } html += '
'; } - this.el.find('.board').html('
'+toprow+'
'+html+'
'); + this.el.find('.board').html(toprow+'
'+html+'
'); if(!this.isPlayer) return; diff --git a/www/js/specials.js b/www/js/specials.js index 05d10fb..da1f7d1 100644 --- a/www/js/specials.js +++ b/www/js/specials.js @@ -217,7 +217,7 @@ Special.registerSpecial( } } for(var i = 0; i < around.length; ++i) { - var yy = 6 + Math.floor(Math.random() * (player.height - 6)); + var yy = Board.VANISH_ZONE_HEIGHT + 6 + Math.floor(Math.random() * (player.height - Board.VANISH_ZONE_HEIGHT - 6)); var xx = Math.floor(Math.random() * player.width); player.data[yy*player.width + xx] = around[i]; } @@ -236,7 +236,7 @@ Special.registerSpecial( function(player, msg) { if(msg.data) { player.data = msg.data; - for(var y = 0; y < 5; ++y) { + for(var y = 0; y < Board.VANISH_ZONE_HEIGHT + 6; ++y) { for(var x = 0; x < player.width; ++x) { player.data[y * player.width + x] = 0; } @@ -421,7 +421,7 @@ Special.registerSpecial( for(var x = 0; x < player.width; ++x) player.data[y * player.width + x] = player.data[y * player.width + x] ? 0 : 1 + Math.floor(Math.random() * Block.blockData.length); player.emit(Board.EVENT_CHANGE); - if(--y >= 6) + if(--y >= Board.VANISH_ZONE_HEIGHT + 6) setTimeout(invertRow, 50); } }