diff --git a/.htaccess b/.htaccess index 512d211..6617d2f 100644 --- a/.htaccess +++ b/.htaccess @@ -1 +1,3 @@ AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript text/css application/javascript application/json + +# you need to add to WAMP apache mod_filter,mod_deflate for these to work \ No newline at end of file diff --git a/build/build_release.sh b/build/build_release.sh index c387f0e..510fc09 100644 --- a/build/build_release.sh +++ b/build/build_release.sh @@ -5,31 +5,32 @@ if [ ! -d "release" ]; then fi #increment build number -bldnum=`cat work/build_number.js | tr -cd '[:digit:]'` +bldnum=`cat src/build_number.js | tr -cd '[:digit:]'` bldnum=$((bldnum+1)) echo build number $bldnum -echo // this file is created by the build script > work/build_number.js -echo var BUILD_NUMBER=$bldnum\; >> work/build_number.js +echo // this file is created by the build script > src/build_number.js +echo var BUILD_NUMBER=$bldnum\; >> src/build_number.js jslist=" -work/jquery.cookie.js -work/browserDetect.js -work/webgl-utils.js -work/glMatrix-0.9.4.min.js -work/pUtils.js -work/transform.js -work/shaders.js -work/player.js -work/userInput.js -work/geomProcess.js -work/aiControl.js -work/sfx.js -work/viewPoint.js -work/screens2d.js -work/build_number.js -work/gameControl.js -work/loadManager.js -work/main.js" +src/jquery.cookie.js +src/browserDetect.js +src/webgl-utils.js +src/glMatrix-0.9.4.min.js +src/pUtils.js +src/transform.js +src/shaders.js +src/player.js +src/userInput.js +src/geomProcess.js +src/aiControl.js +src/sfx.js +src/viewPoint.js +src/widgets2d.js +src/screens2d.js +src/build_number.js +src/gameControl.js +src/loadManager.js +src/main.js" minjsout=release/cycleblob.min.js @@ -38,17 +39,48 @@ acnt=($cnt) echo original: echo ${acnt[0]} lines, ${acnt[1]} bytes -cat $jslist | ./minify/UglifyJS/bin/uglifyjs -mt -nc --max-line-len 600 --reserved-names webGLStart -o $minjsout +#./node_modules/uglify-js/bin/uglifyjs --help +./node_modules/uglify-js/bin/uglifyjs $jslist -mt -nc --max-line-len 600 --reserved-names webGLStart -o $minjsout cnt=`cat $minjsout | wc -l -c` acnt=($cnt) echo minified: echo ${acnt[0]} lines, ${acnt[1]} bytes -cp work/release.html release/index.html -cp work/shaders.html release/ -cp work/about.php release/ -cp work/contact.php release/ +cp ./release.html release/index.html +cp ./src/jquery-1.4.4.min.js release/ + +reclist=" +img/title_text9.svg +img/speaker_on.svg +img/speaker_off.svg +img/icon_Refresh.png +img/icon_Playb.png +img/icon_Desktop.png +img/icon_Forward.png +img/instructions3.svgz +img/instructions_header.png +img/rep_image.png +img/.htaccess +sound/turn5.ogg +sound/turn5.mp3 +sound/powerup2.ogg +sound/powerup2.mp3 +sound/crash2.ogg +sound/crash2.mp3 +sound/coin_up3.ogg +sound/coin_up3.mp3 +./shaders.html +./about.php +./contact.php +./page.css +./.htaccess +" + +cp --parents $reclist release/ + + + # count all identifiers: # cat release/cycleblob.min.js | tr -c '[:alnum:]' '\n' | sort | uniq -c | sort -r > _count1.txt diff --git a/instructions.txt b/instructions.txt index d3649ff..7a9936c 100644 --- a/instructions.txt +++ b/instructions.txt @@ -1,2 +1,10 @@ -install node.js installer for windows -extract node-modules to this directory where the build script is \ No newline at end of file +install mingw, add msys package (install cygwin, default packages) +download nodejs executable for windows +extract node-modules.zip to the git root +copy node.exe to C:\MinGW\msys\1.0\bin (C:\cygwin64\bin) +run C:\MinGW\msys\1.0\msys.bat / cygwin terminal +in terminal: + cd to the git root /c/projects/webgl/cycleblob/work (/cygdrive/c/projects/webgl/cycleblob/work) + where \build is + run ./build/build_release.sh + diff --git a/page.html b/page.html index 4597c0b..b58c8d7 100644 --- a/page.html +++ b/page.html @@ -36,7 +36,7 @@ @@ -143,21 +143,33 @@

You have JavaScript disabled

--> - - - - + + + + - + - - + + diff --git a/release.html b/release.html index 0021672..1906cdb 100644 --- a/release.html +++ b/release.html @@ -20,7 +20,7 @@ })(); - +
@@ -42,20 +42,32 @@

You have JavaScript disabled

- - - - + + + + - + - + diff --git a/sound/coin_up3.mp3 b/sound/coin_up3.mp3 new file mode 100644 index 0000000..a33a1b4 Binary files /dev/null and b/sound/coin_up3.mp3 differ diff --git a/sound/crash2.mp3 b/sound/crash2.mp3 new file mode 100644 index 0000000..9940735 Binary files /dev/null and b/sound/crash2.mp3 differ diff --git a/sound/powerup2.mp3 b/sound/powerup2.mp3 new file mode 100644 index 0000000..b574479 Binary files /dev/null and b/sound/powerup2.mp3 differ diff --git a/sound/coin_up.ogg b/sound/prev/coin_up.ogg similarity index 100% rename from sound/coin_up.ogg rename to sound/prev/coin_up.ogg diff --git a/sound/coin_up2.ogg b/sound/prev/coin_up2.ogg similarity index 100% rename from sound/coin_up2.ogg rename to sound/prev/coin_up2.ogg diff --git a/sound/crash.ogg b/sound/prev/crash.ogg similarity index 100% rename from sound/crash.ogg rename to sound/prev/crash.ogg diff --git a/sound/powerup1.ogg b/sound/prev/powerup1.ogg similarity index 100% rename from sound/powerup1.ogg rename to sound/prev/powerup1.ogg diff --git a/sound/turn1.ogg b/sound/prev/turn1.ogg similarity index 100% rename from sound/turn1.ogg rename to sound/prev/turn1.ogg diff --git a/sound/turn2.ogg b/sound/prev/turn2.ogg similarity index 100% rename from sound/turn2.ogg rename to sound/prev/turn2.ogg diff --git a/sound/turn3.ogg b/sound/prev/turn3.ogg similarity index 100% rename from sound/turn3.ogg rename to sound/prev/turn3.ogg diff --git a/sound/turn4.ogg b/sound/prev/turn4.ogg similarity index 100% rename from sound/turn4.ogg rename to sound/prev/turn4.ogg diff --git a/sound/turn5.mp3 b/sound/turn5.mp3 new file mode 100644 index 0000000..cb6f3ec Binary files /dev/null and b/sound/turn5.mp3 differ diff --git a/src/build_number.js b/src/build_number.js index 0f65c1e..3c49b62 100644 --- a/src/build_number.js +++ b/src/build_number.js @@ -1,2 +1,2 @@ - // this file is created by the build script -var BUILD_NUMBER=166 \ No newline at end of file +// this file is created by the build script +var BUILD_NUMBER=182; diff --git a/src/main.js b/src/main.js index 91bb0d0..9abaf55 100644 --- a/src/main.js +++ b/src/main.js @@ -323,11 +323,16 @@ function animate(elapsed) { world.staticDraw[si].advance(elapsed); } for(var bi in world.bonuses) { - world.bonuses[bi].advance(elapsed); + if (!world.bonuses[bi].advance(elapsed)) { + delete world.bonuses[bi] + } } - world.background.advance(elapsed); + if (!game.isPaused() || game._startPause) // on the start we want to animate the back + world.background.advance(elapsed); // 3d background stripes + if (c2d.menuAnim) + c2d.menuAnim(elapsed) return doDraw; //writeDebug(elapsed + " " + iterCount ); @@ -390,7 +395,8 @@ function tick() { if (enabled3d) // enabled3d can change in animate drawScene(); - if (gameConf.printFps) dispFps(elapsed); + if (gameConf.printFps) + dispFps(elapsed); } @@ -401,6 +407,7 @@ function deployBonus() { if (!world.ready || !resources._ready || !enabled3d || game.isPaused()) return; + //var chance = 100 var chance = (world.bonuses.length > 0)?0.2:3 // 5% chance every 500 msec is 1 in 10 sec // 2% chance every 500 msec is 1 in 25 sec diff --git a/src/screens2d.js b/src/screens2d.js index a483d96..0954d38 100644 --- a/src/screens2d.js +++ b/src/screens2d.js @@ -267,9 +267,26 @@ C2d.prototype.verbosePauseScreen = function() return true; } - this.drawGameState(); + this.fadeIn() + //this.drawGameState(); +} + +C2d.prototype.fadeIn = function() +{ + canvas2d.style.opacity = 0 + this.menuAnim = function(elapsed) { + op = parseFloat(canvas2d.style.opacity) + elapsed * 0.008 + if (op >= 1) { + op = 1 + c2d.menuAnim = null + } + //writeDebug(op) + canvas2d.style.opacity = op + this.drawGameState(); + } } + C2d.prototype.loadingScreen = function(pc) { this.blankScr("black"); @@ -774,16 +791,20 @@ LifesRenderable.ROTX_SPEED = 90 / 1000; LifesRenderable.ROTY_SPEED = 180 / 1000; // a pass is either a death or a new life LifesRenderable.PASS_PEAK_LIGHT = 3; -LifesRenderable.PASS_PEAK_TIME = 1000; -LifesRenderable.PASS_TOTAL_TIME = 2000; // starting from the beginning +LifesRenderable.PASS_PEAK_TIME = 500; //1000; +LifesRenderable.PASS_TOTAL_TIME = 1000; //2000; // starting from the beginning // static function. // climb from 1 to 3 and then back to 0 again // if its time for the end of the animation, call onstop. -// this is better than using a return value because I don't need to checn the return value when this function returns. -LifesRenderable.getLightFactor = function(msec, onstop) { - +// this is better than using a return value because I don't need to check the return value when this function returns. +LifesRenderable.getLightFactor = function(msec, onstop) { if (msec >= 0) { + d = 1 + 2*Math.sin(msec/LifesRenderable.PASS_TOTAL_TIME * Math.PI) + //writeDebug(msec + " " + d) + if (d > 0) + return d; // when it goes negative, time to remove it + if (msec <= LifesRenderable.PASS_PEAK_TIME) return 1 + (LifesRenderable.PASS_PEAK_LIGHT / LifesRenderable.PASS_PEAK_TIME) * msec; else if (msec <= LifesRenderable.PASS_TOTAL_TIME) @@ -840,7 +861,6 @@ LifesRenderable.prototype.startDeath = function() { this.activeDeath = 0; } LifesRenderable.prototype.startOneUp = function() { - this.activeOneUp = 0; } diff --git a/src/sfx.js b/src/sfx.js index 108aa42..c9159d9 100644 --- a/src/sfx.js +++ b/src/sfx.js @@ -192,8 +192,15 @@ function LifeBonus(index) { this.angley = 0; this.elapsed = 0; this.inflate = 0; // range [0, 1] - c2d.addMessage("Life bonus appeared"); - + this.active = true; + this.removeElapsed = -1; // remove animation + this.alpha = null; + c2d.addMessage("Life bonus appeared"); +} + +LifeBonus.prototype.startRemove = function() { + this.removeElapsed = 0; + this.alpha = 1.0; } LifeBonus.prototype.getColor = function(angle) { @@ -216,15 +223,26 @@ LifeBonus.prototype.draw = function() { mv.scale(s * this.inflate); mv.rotateY(this.anglex); mv.rotateX(this.angley); - - shaderProg.setColorv(this.getColor(this.anglex)); + color = this.getColor(this.anglex) + if (this.alpha == null) { + shaderProg.setColorv(color); + } + else { + gl.enable(gl.BLEND); + shaderProg.setColor4(color[0], color[1], color[2], this.alpha); + } renderModel(resources.life); + if (this.alpha != null) { + gl.disable(gl.BLEND); + } + mv.popMatrix(); } LifeBonus.INFLATE_TIME = 500; // time it takes for the bonus to grow from tiny to full size +LifeBonus.REMOVE_TIME = 500; // time it takes for the bonus to be removed after it is taken LifeBonus.prototype.advance = function(elapsed) { LifesRenderable.prototype.rotate.call(this, elapsed); @@ -233,8 +251,18 @@ LifeBonus.prototype.advance = function(elapsed) { this.elapsed = Math.min(this.elapsed + elapsed, LifeBonus.INFLATE_TIME); this.inflate = this.elapsed * (1/LifeBonus.INFLATE_TIME); } + else if (this.removeElapsed != -1) { + this.removeElapsed = Math.min(this.removeElapsed + elapsed, LifeBonus.REMOVE_TIME); + var et = this.removeElapsed * (1/LifeBonus.REMOVE_TIME) + this.inflate = 1 + 3 * et; + this.alpha = 1 - et; + if (et >= 1) { + return false; // remove the bonus item. + } + } else this.inflate = 1; + return true; } // called when player takes this bonus @@ -246,7 +274,8 @@ LifeBonus.prototype.action = function(player) { for(var ni in this.occupy) world.map.unset(this.occupy[ni]); - delete world.bonuses[this.index]; + //delete world.bonuses[this.index]; + world.bonuses[this.index].startRemove() playBonusSound(player); c2d.addMessage(player.prettyName() + " found a life bonus"); diff --git a/src/widgets2d.js b/src/widgets2d.js index 386f547..617b81a 100644 --- a/src/widgets2d.js +++ b/src/widgets2d.js @@ -135,7 +135,9 @@ function C2d() { this.has3dContent = false; this.render3d = []; // 3d renderables this.mainMenu = null; // points to the function which draw the menu from which we came. either the start menu or the custom level menu - + this.menuAnim = null; + + // TBD - move this to the main anim func... window.setInterval(function () { c2d.checkMessageQueue(); }, 200); } @@ -611,6 +613,8 @@ C2d.prototype.drawWidgets = function () { this.wnd.draw(this.curPage.sel) // if the selected widget has associated text, display the text win the text box + if (this.curPage.widgets.length == 0) + return // can happen if the dialog was cleared var text = this.curPage.widgets[this.curPage.sel].text; if (this.curPage.selTextBox && text) { this.backgroundRect(this.curPage.selTextBox);