Initial commit
authorJimmy Christensen <dusted@dusted.dk>
Mon, 1 Feb 2016 18:44:56 +0000 (19:44 +0100)
committerJimmy Christensen <dusted@dusted.dk>
Mon, 1 Feb 2016 18:44:56 +0000 (19:44 +0100)
140 files changed:
.gitignore [new file with mode: 0644]
game/data/gl/2d_fragment.js [new file with mode: 0644]
game/data/gl/2d_fragment_sat.js [new file with mode: 0644]
game/data/gl/2d_vertex.js [new file with mode: 0644]
game/data/img/DstEng.jpg [new file with mode: 0644]
game/data/img/main.jpg [new file with mode: 0644]
game/data/packs/000_wizznic/complete.png [new file with mode: 0644]
game/data/packs/000_wizznic/countdown.png [new file with mode: 0644]
game/data/packs/000_wizznic/finished.png [new file with mode: 0644]
game/data/packs/000_wizznic/icon.png [new file with mode: 0644]
game/data/packs/000_wizznic/info.ini [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level000.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level000.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level001.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level001.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level002.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level002.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level003.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level003.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level004.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level004.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level005.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level005.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level006.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level006.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level007.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level007.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level008.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level008.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level009.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level009.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level010.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level010.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level011.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level011.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level012.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level012.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level013.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level013.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level014.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level014.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level015.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level015.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level016.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level016.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level017.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level017.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level018.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level018.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level019.wzp [new file with mode: 0644]
game/data/packs/000_wizznic/levels/level019.wzp.png [new file with mode: 0644]
game/data/packs/000_wizznic/music/Sean Hawk - 7 Nights.ogg [new file with mode: 0644]
game/data/packs/000_wizznic/music/Sean Hawk - Imperia.ogg [new file with mode: 0644]
game/data/packs/000_wizznic/music/Sean Hawk - In Rome.ogg [new file with mode: 0644]
game/data/packs/000_wizznic/music/Sean Hawk - Mysteria.ogg [new file with mode: 0644]
game/data/packs/000_wizznic/music/Sean Hawk - Sexaine.ogg [new file with mode: 0644]
game/data/packs/000_wizznic/music/Sean Hawk - Smash It.ogg [new file with mode: 0644]
game/data/packs/000_wizznic/music/Sean Hawk - Wizz 2.ogg [new file with mode: 0644]
game/data/packs/000_wizznic/music/Sean Hawk - Wizz 3.ogg [new file with mode: 0644]
game/data/packs/000_wizznic/skipleveldialog-hl0.png [new file with mode: 0644]
game/data/packs/000_wizznic/skipleveldialog-hl1.png [new file with mode: 0644]
game/data/packs/000_wizznic/skipleveldialog.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/chars/green0.png [new file with mode: 0755]
game/data/packs/000_wizznic/themes/chars/green1.png [new file with mode: 0755]
game/data/packs/000_wizznic/themes/chars/thor0.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/chars/thor1.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/cursors/cyberpunk.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/cursors/red.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/cursors/thor.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/oldskool/bg/cyberpunk1.png [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/bg/cyberpunk2.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/oldskool/expl/melt00.png [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/expl/melt01.png [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/expl/melt02.png [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/expl/melt03.png [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/expl/melt04.png [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/expl/melt05.png [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/expl/melt06.png [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/expl/melt07.png [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/expl/melt08.png [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/expl/melt09.png [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/snd/brickbreak.ogg [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/snd/brickgrab.ogg [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/snd/brickmove.ogg [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/snd/click.ogg [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/snd/countdown.ogg [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/snd/loser.ogg [new file with mode: 0644]
game/data/packs/000_wizznic/themes/oldskool/snd/onewaymove.ogg [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/snd/scoretick.ogg [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/snd/start.ogg [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/snd/switchactivate.ogg [new file with mode: 0644]
game/data/packs/000_wizznic/themes/oldskool/snd/switchinactive.ogg [new file with mode: 0644]
game/data/packs/000_wizznic/themes/oldskool/snd/teleported.ogg [new file with mode: 0644]
game/data/packs/000_wizznic/themes/oldskool/snd/timeout.ogg [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/snd/victory.ogg [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/snd/winner.ogg [new file with mode: 0644]
game/data/packs/000_wizznic/themes/oldskool/tiles/cyberpunk.png [new file with mode: 0755]
game/data/packs/000_wizznic/themes/oldskool/walls/blue.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/bg/BG01.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/bg/BG02.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/bg/BG03.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/bg/BG04.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/bg/BG05.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/bg/BG06.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/bg/BG07.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/bg/BG08.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/bg/BG09.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/bg/BG10.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/expl/tomb00.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/expl/tomb01.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/expl/tomb02.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/expl/tomb03.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/expl/tomb04.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/expl/tomb05.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/expl/tomb06.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/expl/tomb07.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/expl/tomb08.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/expl/tomb09.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/tiles/thor-tile00.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/tiles/thor-tile01.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/tiles/thor-tile10.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/tiles/thor-tile11.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/tiles/thor-tile17.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/tiles/thor-tile18.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/tiles/thor-tile19.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/tiles/thor-tile20.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/tiles/thor-tile21.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/tiles/thor-tile22.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/tiles/thor-tile23.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/tiles/thor.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/walls/goldstone.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/walls/lightstone.png [new file with mode: 0644]
game/data/packs/000_wizznic/themes/thor/walls/silverstone.png [new file with mode: 0644]
game/index.htm [new file with mode: 0644]
game/src/DstEng-first.js [new file with mode: 0644]
game/src/DstEng.js [new file with mode: 0644]
game/src/DstEng2.js [new file with mode: 0644]
game/src/Wizznic.js [new file with mode: 0644]
package.json [new file with mode: 0644]
src/server.js [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..c2658d7
--- /dev/null
@@ -0,0 +1 @@
+node_modules/
diff --git a/game/data/gl/2d_fragment.js b/game/data/gl/2d_fragment.js
new file mode 100644 (file)
index 0000000..aaf20b5
--- /dev/null
@@ -0,0 +1,13 @@
+precision lowp float;
+// our texture
+uniform sampler2D u_image; 
+// the texCoords passed in from the vertex shader.
+varying vec2 v_texCoord;
+
+//Color
+
+void main() {
+   // Look up a color from the texture.
+   gl_FragColor = texture2D(u_image, v_texCoord);
+}
\ No newline at end of file
diff --git a/game/data/gl/2d_fragment_sat.js b/game/data/gl/2d_fragment_sat.js
new file mode 100644 (file)
index 0000000..1d4b371
--- /dev/null
@@ -0,0 +1,26 @@
+
+precision highp float;
+// our texture
+uniform sampler2D u_image; 
+// the texCoords passed in from the vertex shader.
+varying vec2 v_texCoord;
+
+uniform float u_sat;
+
+void main() {
+   // Look up a color from the texture.
+   vec4 col = texture2D(u_image, v_texCoord);
+   
+   float avg =(col[0]+col[1]+col[2])/3.0;
+   vec3 a = vec3(
+   
+
+   (col[0]*u_sat) + (avg*(1.0-u_sat)),
+   (col[1]*u_sat)+ (avg*(1.0-u_sat)),
+   (col[2]*u_sat)+ (avg*(1.0-u_sat)) );
+   
+   
+   
+   gl_FragColor = vec4(a[0],a[1],a[2],1);
+}
\ No newline at end of file
diff --git a/game/data/gl/2d_vertex.js b/game/data/gl/2d_vertex.js
new file mode 100644 (file)
index 0000000..587047d
--- /dev/null
@@ -0,0 +1,31 @@
+attribute vec2 a_texCoord;
+attribute vec2 a_position;
+
+uniform vec2 u_frameSize;
+uniform vec2 u_frameGridPos;
+uniform vec2 u_resolution;
+uniform vec2 u_translation;
+
+varying vec2 v_texCoord;
+
+
+
+void main() {
+    // convert the rectangle from pixels to 0.0 to 1.0
+    vec2 position = a_position + u_translation;
+  //  vec2 position = a_position + floor(u_translation);
+    
+    vec2 zeroToOne = position / u_resolution;
+    // convert from 0->1 to 0->2
+    vec2 zeroToTwo = zeroToOne * 2.0;
+    // convert from 0->2 to -1->+1 (clipspace)
+    vec2 clipSpace = zeroToTwo - 1.0;
+
+    gl_Position =  vec4(clipSpace * vec2(1, -1), 0, 1);
+    
+       // pass the texCoord to the fragment shader
+   // The GPU will interpolate this value between points
+   v_texCoord = (a_texCoord + (u_frameSize*u_frameGridPos) );
+}
diff --git a/game/data/img/DstEng.jpg b/game/data/img/DstEng.jpg
new file mode 100644 (file)
index 0000000..e730aec
Binary files /dev/null and b/game/data/img/DstEng.jpg differ
diff --git a/game/data/img/main.jpg b/game/data/img/main.jpg
new file mode 100644 (file)
index 0000000..63cb4c8
Binary files /dev/null and b/game/data/img/main.jpg differ
diff --git a/game/data/packs/000_wizznic/complete.png b/game/data/packs/000_wizznic/complete.png
new file mode 100644 (file)
index 0000000..a8f818e
Binary files /dev/null and b/game/data/packs/000_wizznic/complete.png differ
diff --git a/game/data/packs/000_wizznic/countdown.png b/game/data/packs/000_wizznic/countdown.png
new file mode 100644 (file)
index 0000000..7b0b0c0
Binary files /dev/null and b/game/data/packs/000_wizznic/countdown.png differ
diff --git a/game/data/packs/000_wizznic/finished.png b/game/data/packs/000_wizznic/finished.png
new file mode 100644 (file)
index 0000000..139b87f
Binary files /dev/null and b/game/data/packs/000_wizznic/finished.png differ
diff --git a/game/data/packs/000_wizznic/icon.png b/game/data/packs/000_wizznic/icon.png
new file mode 100644 (file)
index 0000000..4abcc8f
Binary files /dev/null and b/game/data/packs/000_wizznic/icon.png differ
diff --git a/game/data/packs/000_wizznic/info.ini b/game/data/packs/000_wizznic/info.ini
new file mode 100644 (file)
index 0000000..b704278
--- /dev/null
@@ -0,0 +1,17 @@
+#Author name
+author=DST/VMD
+
+#Package name
+packname=Wizznic! 1
+
+#Comment, dont make it longer | than 23. (where the | is)
+comment=Official Pack, Stage 1
+
+#Playlist, mus=XX-XX,song name
+mus=00-04,music/Sean Hawk - Wizz 2.ogg
+mus=05-09,music/Sean Hawk - Wizz 3.ogg
+mus=10-14,music/Sean Hawk - Sexaine.ogg
+mus=15-19,music/Sean Hawk - 7 Nights.ogg
+
+#Number of lives player have to complete this pack.
+lives=5
diff --git a/game/data/packs/000_wizznic/levels/level000.wzp b/game/data/packs/000_wizznic/levels/level000.wzp
new file mode 100644 (file)
index 0000000..47ed0f5
--- /dev/null
@@ -0,0 +1,34 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname=The Tutorial
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG01.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/lightstone
+sounddir=oldskool/snd
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+showtelepath=1
+showswitchpath=0
+
+#The level-data block
+[data]
+0016161616161616161600
+0016161616161616161600
+0016020016000000001600
+0016160016000000001600
+0016160216020000021600
+0016161616161616161600
+0016020000000000001600
+0016161616160002001600
+0016000000000215001600
+0016000000001516001600
+0016161616161616161600
diff --git a/game/data/packs/000_wizznic/levels/level000.wzp.png b/game/data/packs/000_wizznic/levels/level000.wzp.png
new file mode 100644 (file)
index 0000000..4a1f0c4
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level000.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level001.wzp b/game/data/packs/000_wizznic/levels/level001.wzp
new file mode 100644 (file)
index 0000000..f0a4466
--- /dev/null
@@ -0,0 +1,36 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname= 
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG03.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/lightstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+#The level-data block
+[data]
+0000000000000000000000
+0000000000000000000000
+0000000000000000000000
+0000000000000000000000
+0000000000000000000000
+0000000000000000010200
+0000000000000000161616
+0200000000000000160000
+1616011616161615160000
+0016161600001616160000
+0000000000000000000000
diff --git a/game/data/packs/000_wizznic/levels/level001.wzp.png b/game/data/packs/000_wizznic/levels/level001.wzp.png
new file mode 100644 (file)
index 0000000..0474d8b
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level001.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level002.wzp b/game/data/packs/000_wizznic/levels/level002.wzp
new file mode 100644 (file)
index 0000000..38c7856
--- /dev/null
@@ -0,0 +1,36 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname=
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG02.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/lightstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+#The level-data block
+[data]
+0000000000000000000000
+0000000000000000000000
+0000000000000000000000
+0016161616161616161600
+0016000016161600001600
+0016020100000003041600
+0016160200040002161600
+0016161603020116161600
+0016161616161616161600
+0000000000000000000000
+0000000000000000000000
diff --git a/game/data/packs/000_wizznic/levels/level002.wzp.png b/game/data/packs/000_wizznic/levels/level002.wzp.png
new file mode 100644 (file)
index 0000000..0f33338
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level002.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level003.wzp b/game/data/packs/000_wizznic/levels/level003.wzp
new file mode 100644 (file)
index 0000000..e02f868
--- /dev/null
@@ -0,0 +1,36 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname= 
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG01.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/lightstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+#The level-data block
+[data]
+0000000000000000000000
+0000001600000016000000
+0000161616161616160000
+0000001603000116000000
+0000001602000416000000
+0000161616031616160000
+0000001604010016000000
+0000001601020016000000
+0000161616161616160000
+0000001600000016000000
+0000000000000000000000
diff --git a/game/data/packs/000_wizznic/levels/level003.wzp.png b/game/data/packs/000_wizznic/levels/level003.wzp.png
new file mode 100644 (file)
index 0000000..95481b2
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level003.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level004.wzp b/game/data/packs/000_wizznic/levels/level004.wzp
new file mode 100644 (file)
index 0000000..958df04
--- /dev/null
@@ -0,0 +1,36 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname=
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG01.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/lightstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+#The level-data block
+[data]
+0000000000000000000000
+0000000000000000000000
+0000161616000000000000
+0000160016160000000000
+0000160400161600000000
+0000160100041616000000
+0000160300020016160000
+0000160204030001160000
+0000161616161616160000
+0000000000000000000000
+0000000000000000000000
diff --git a/game/data/packs/000_wizznic/levels/level004.wzp.png b/game/data/packs/000_wizznic/levels/level004.wzp.png
new file mode 100644 (file)
index 0000000..1b9ece3
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level004.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level005.wzp b/game/data/packs/000_wizznic/levels/level005.wzp
new file mode 100644 (file)
index 0000000..60d5204
--- /dev/null
@@ -0,0 +1,37 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname= 
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG05.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/silverstone
+
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+#The level-data block
+[data]
+0000000000000000000000
+0000000000000000000000
+0000000000000000000000
+0000000000161616160000
+0000001616160403160000
+0000161602001116160000
+0000160401000016000000
+0000160316010216000000
+0000161616161616000000
+0000000000000000000000
+0000000000000000000000
diff --git a/game/data/packs/000_wizznic/levels/level005.wzp.png b/game/data/packs/000_wizznic/levels/level005.wzp.png
new file mode 100644 (file)
index 0000000..bffd0f8
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level005.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level006.wzp b/game/data/packs/000_wizznic/levels/level006.wzp
new file mode 100644 (file)
index 0000000..950b0b2
--- /dev/null
@@ -0,0 +1,36 @@
+#Level Author
+author=Heroic
+
+#Level Name
+levelname=Heroic Ruuulez!
+
+#Seconds to complete
+seconds=200
+
+bgfile=thor/bg/BG04.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/silverstone
+
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+[data]
+1616161616161616161616
+1600000000000000000516
+1616160201000504161616
+1600161616001616160016
+1600161616001616000016
+1600001616001616000016
+1600000004030000000016
+1600001616021616000016
+1600161616041616160016
+1601160004050300160016
+1616161616161616161616
diff --git a/game/data/packs/000_wizznic/levels/level006.wzp.png b/game/data/packs/000_wizznic/levels/level006.wzp.png
new file mode 100644 (file)
index 0000000..5ad1e28
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level006.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level007.wzp b/game/data/packs/000_wizznic/levels/level007.wzp
new file mode 100644 (file)
index 0000000..8cd9359
--- /dev/null
@@ -0,0 +1,36 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname= 
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG04.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/lightstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+#The level-data block
+[data]
+0000000000000000000000
+0000000000000000000000
+0000000001000000000000
+0000000002000500000000
+0000001603000416000000
+0000160016001600160000
+0016000000000000001600
+1600000000000000000016
+0000050000000000000006
+1603160216061601160416
+0016001600160016001600
diff --git a/game/data/packs/000_wizznic/levels/level007.wzp.png b/game/data/packs/000_wizznic/levels/level007.wzp.png
new file mode 100644 (file)
index 0000000..2831002
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level007.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level008.wzp b/game/data/packs/000_wizznic/levels/level008.wzp
new file mode 100644 (file)
index 0000000..ad34d11
--- /dev/null
@@ -0,0 +1,37 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname= 
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG05.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/silverstone
+
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+#The level-data block
+[data]
+0000000000000000000000
+0000000000000000000000
+0000161616161616160000
+0000161616001616160000
+0000161605040016160000
+0000160607050004160000
+0000161604060016160000
+0000161616071616160000
+0000161616161616160000
+0000000000000000000000
+0000000000000000000000
diff --git a/game/data/packs/000_wizznic/levels/level008.wzp.png b/game/data/packs/000_wizznic/levels/level008.wzp.png
new file mode 100644 (file)
index 0000000..13a4ab0
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level008.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level009.wzp b/game/data/packs/000_wizznic/levels/level009.wzp
new file mode 100644 (file)
index 0000000..e7b8d81
--- /dev/null
@@ -0,0 +1,36 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname= 
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG06.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/silverstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+#The level-data block
+[data]
+0000000000000000000000
+0000000000000000000000
+0000161616161616160000
+0000160000000908160000
+0000160600001616160000
+0000160816000005160000
+0000161616000006160000
+0000160900000509160000
+0000161616161616160000
+0000000000000000000000
+0000000000000000000000
diff --git a/game/data/packs/000_wizznic/levels/level009.wzp.png b/game/data/packs/000_wizznic/levels/level009.wzp.png
new file mode 100644 (file)
index 0000000..3fd0fb6
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level009.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level010.wzp b/game/data/packs/000_wizznic/levels/level010.wzp
new file mode 100644 (file)
index 0000000..06e546f
--- /dev/null
@@ -0,0 +1,36 @@
+#Level Author
+author=KML
+
+#Level Name
+levelname=No Comment.
+
+#Seconds to complete
+seconds=240
+
+bgfile=thor/bg/BG06.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/silverstone
+
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+[data]
+1616161616161616161616
+1616161616161616161616
+1616000016161600001616
+1600000000160000000016
+1600000000000000010016
+1602030000000000020316
+1616010000000002011616
+1616160203000001161616
+1616161601000316161616
+1616161616021616161616
+1616161616161616161616
diff --git a/game/data/packs/000_wizznic/levels/level010.wzp.png b/game/data/packs/000_wizznic/levels/level010.wzp.png
new file mode 100644 (file)
index 0000000..85f15f4
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level010.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level011.wzp b/game/data/packs/000_wizznic/levels/level011.wzp
new file mode 100644 (file)
index 0000000..a55de45
--- /dev/null
@@ -0,0 +1,36 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname= 
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG03.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/lightstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+#The level-data block
+[data]
+0000000000000000000000
+0000000000000000000000
+0000000000000000000000
+0000000000000000000000
+0000000000000000000000
+0105020000000000000000
+0504050004000500030000
+1616161603160216011616
+0000001616161616161600
+0000000000000000000000
+0000000000000000000000
diff --git a/game/data/packs/000_wizznic/levels/level011.wzp.png b/game/data/packs/000_wizznic/levels/level011.wzp.png
new file mode 100644 (file)
index 0000000..292758a
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level011.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level012.wzp b/game/data/packs/000_wizznic/levels/level012.wzp
new file mode 100644 (file)
index 0000000..2e04e2d
--- /dev/null
@@ -0,0 +1,36 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname= 
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG07.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/silverstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+#The level-data block
+[data]
+0000000000000000000000
+0000001616160000000000
+0000001600161600000000
+0000001600001600000000
+0016161600001616160000
+0016080700000306160000
+0016070900000503160000
+0016161606051616160000
+0000001608071600000000
+0000001616091600000000
+0000000016161600000000
diff --git a/game/data/packs/000_wizznic/levels/level012.wzp.png b/game/data/packs/000_wizznic/levels/level012.wzp.png
new file mode 100644 (file)
index 0000000..272a4b0
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level012.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level013.wzp b/game/data/packs/000_wizznic/levels/level013.wzp
new file mode 100644 (file)
index 0000000..83e94a2
--- /dev/null
@@ -0,0 +1,37 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname= 
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG07.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/goldstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+
+#The level-data block
+[data]
+0000000000000000000000
+0000000000000000000000
+0000000000000000000000
+0000161616161616000000
+0000160508000016000000
+0000160603060316000000
+0000160816041116000000
+0000160416160516000000
+0000161616161616000000
+0000000000000000000000
+0000000000000000000000
diff --git a/game/data/packs/000_wizznic/levels/level013.wzp.png b/game/data/packs/000_wizznic/levels/level013.wzp.png
new file mode 100644 (file)
index 0000000..03fd41d
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level013.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level014.wzp b/game/data/packs/000_wizznic/levels/level014.wzp
new file mode 100644 (file)
index 0000000..d3b7f22
--- /dev/null
@@ -0,0 +1,36 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname= 
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG08.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/goldstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+#The level-data block
+[data]
+0000000000000000000000
+0000001616161600000000
+0000001607001600000000
+0000161606001616000000
+0000160807000016160000
+0016161616000004160000
+0016080500000005160000
+0016160600001616160000
+0016080704001600000000
+0016161616161600000000
+0000000000000000000000
diff --git a/game/data/packs/000_wizznic/levels/level014.wzp.png b/game/data/packs/000_wizznic/levels/level014.wzp.png
new file mode 100644 (file)
index 0000000..d1050d7
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level014.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level015.wzp b/game/data/packs/000_wizznic/levels/level015.wzp
new file mode 100644 (file)
index 0000000..6c764cd
--- /dev/null
@@ -0,0 +1,39 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname= 
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG08.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/goldstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+#Teleports
+teleport=6,7:8,3
+
+#The level-data block
+[data]
+0000000000000000000000
+0000161616161616161600
+0000161001000000101600
+0000161616000000031600
+0000161600001616161600
+0000160000000000001600
+0000160200000000001600
+0000160301160004001600
+0000160104161616021600
+0000161616160016161600
+0000000000000000000000
diff --git a/game/data/packs/000_wizznic/levels/level015.wzp.png b/game/data/packs/000_wizznic/levels/level015.wzp.png
new file mode 100644 (file)
index 0000000..70434cf
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level015.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level016.wzp b/game/data/packs/000_wizznic/levels/level016.wzp
new file mode 100644 (file)
index 0000000..96ffa47
--- /dev/null
@@ -0,0 +1,36 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname= 
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG09.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/goldstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+#The level-data block
+[data]
+0000000000000000000000
+0000000000000000000000
+0000050000000000000000
+0000060000000000000000
+0000020000000000000100
+0000010000000500000200
+1600161616131616061616
+1600000000000016161600
+1600000000000016000000
+1600000000161616000000
+1616161616160000000000
diff --git a/game/data/packs/000_wizznic/levels/level016.wzp.png b/game/data/packs/000_wizznic/levels/level016.wzp.png
new file mode 100644 (file)
index 0000000..b7f1094
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level016.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level017.wzp b/game/data/packs/000_wizznic/levels/level017.wzp
new file mode 100644 (file)
index 0000000..65e8e46
--- /dev/null
@@ -0,0 +1,35 @@
+#Level Author
+author=KML
+
+#Level Name
+levelname=No Comment
+
+#Seconds to complete
+seconds=240
+
+bgfile=thor/bg/BG09.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/goldstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+[data]
+0000000000000000000000
+0000000000000000000000
+0000161616161616161600
+0016160000000000001600
+0016000000000000001600
+0016000000030000001600
+0016000316020000021600
+0016000100010000041600
+0016160416020000161600
+0016161616161616160000
+0000000000000000000000
diff --git a/game/data/packs/000_wizznic/levels/level017.wzp.png b/game/data/packs/000_wizznic/levels/level017.wzp.png
new file mode 100644 (file)
index 0000000..72a66eb
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level017.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level018.wzp b/game/data/packs/000_wizznic/levels/level018.wzp
new file mode 100644 (file)
index 0000000..c0ba8dd
--- /dev/null
@@ -0,0 +1,36 @@
+#Author of level
+author=DusteD
+
+#Name of the level
+levelname= 
+
+#Seconds to complete level
+seconds=300
+
+bgfile=thor/bg/BG10.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/goldstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+#The level-data block
+[data]
+0000000000000000000000
+0000000000000000000000
+1616161616161616161616
+1600040005000000000116
+1600031616000000000316
+1600010004000000050216
+1602160016000000161616
+1616161616161616160000
+0000000000000000000000
+0000000000000000000000
+0000000000000000000000
diff --git a/game/data/packs/000_wizznic/levels/level018.wzp.png b/game/data/packs/000_wizznic/levels/level018.wzp.png
new file mode 100644 (file)
index 0000000..7d80184
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level018.wzp.png differ
diff --git a/game/data/packs/000_wizznic/levels/level019.wzp b/game/data/packs/000_wizznic/levels/level019.wzp
new file mode 100644 (file)
index 0000000..f5e0451
--- /dev/null
@@ -0,0 +1,35 @@
+#Level Author
+author=KML
+
+#Level Name
+levelname=No Comment
+
+#Seconds to complete
+seconds=240
+
+bgfile=thor/bg/BG10.png
+tilebase=thor/tiles/thor
+explbase=thor/expl/tomb
+wallbase=thor/walls/goldstone
+sounddir=oldskool/snd
+
+charbase=thor
+cursorfile=thor.png
+startimage=none
+stopimage=none
+
+brickdieparticles=1
+brickdietime=750
+
+[data]
+0000000000000000000000
+0000000000000000000000
+0000161616161616161600
+0016160000000000001600
+0016000000010000001600
+0016000000040000001600
+0016000300020000021600
+0016000104030000031600
+0016161616020000161600
+0016161616161616160000
+0000000000000000000000
diff --git a/game/data/packs/000_wizznic/levels/level019.wzp.png b/game/data/packs/000_wizznic/levels/level019.wzp.png
new file mode 100644 (file)
index 0000000..13a15e5
Binary files /dev/null and b/game/data/packs/000_wizznic/levels/level019.wzp.png differ
diff --git a/game/data/packs/000_wizznic/music/Sean Hawk - 7 Nights.ogg b/game/data/packs/000_wizznic/music/Sean Hawk - 7 Nights.ogg
new file mode 100644 (file)
index 0000000..c89a047
Binary files /dev/null and b/game/data/packs/000_wizznic/music/Sean Hawk - 7 Nights.ogg differ
diff --git a/game/data/packs/000_wizznic/music/Sean Hawk - Imperia.ogg b/game/data/packs/000_wizznic/music/Sean Hawk - Imperia.ogg
new file mode 100644 (file)
index 0000000..93d19ff
Binary files /dev/null and b/game/data/packs/000_wizznic/music/Sean Hawk - Imperia.ogg differ
diff --git a/game/data/packs/000_wizznic/music/Sean Hawk - In Rome.ogg b/game/data/packs/000_wizznic/music/Sean Hawk - In Rome.ogg
new file mode 100644 (file)
index 0000000..4013356
Binary files /dev/null and b/game/data/packs/000_wizznic/music/Sean Hawk - In Rome.ogg differ
diff --git a/game/data/packs/000_wizznic/music/Sean Hawk - Mysteria.ogg b/game/data/packs/000_wizznic/music/Sean Hawk - Mysteria.ogg
new file mode 100644 (file)
index 0000000..d7033fe
Binary files /dev/null and b/game/data/packs/000_wizznic/music/Sean Hawk - Mysteria.ogg differ
diff --git a/game/data/packs/000_wizznic/music/Sean Hawk - Sexaine.ogg b/game/data/packs/000_wizznic/music/Sean Hawk - Sexaine.ogg
new file mode 100644 (file)
index 0000000..129adb3
Binary files /dev/null and b/game/data/packs/000_wizznic/music/Sean Hawk - Sexaine.ogg differ
diff --git a/game/data/packs/000_wizznic/music/Sean Hawk - Smash It.ogg b/game/data/packs/000_wizznic/music/Sean Hawk - Smash It.ogg
new file mode 100644 (file)
index 0000000..b91c9fc
Binary files /dev/null and b/game/data/packs/000_wizznic/music/Sean Hawk - Smash It.ogg differ
diff --git a/game/data/packs/000_wizznic/music/Sean Hawk - Wizz 2.ogg b/game/data/packs/000_wizznic/music/Sean Hawk - Wizz 2.ogg
new file mode 100644 (file)
index 0000000..9ae3b96
Binary files /dev/null and b/game/data/packs/000_wizznic/music/Sean Hawk - Wizz 2.ogg differ
diff --git a/game/data/packs/000_wizznic/music/Sean Hawk - Wizz 3.ogg b/game/data/packs/000_wizznic/music/Sean Hawk - Wizz 3.ogg
new file mode 100644 (file)
index 0000000..6c8b283
Binary files /dev/null and b/game/data/packs/000_wizznic/music/Sean Hawk - Wizz 3.ogg differ
diff --git a/game/data/packs/000_wizznic/skipleveldialog-hl0.png b/game/data/packs/000_wizznic/skipleveldialog-hl0.png
new file mode 100644 (file)
index 0000000..b64cd47
Binary files /dev/null and b/game/data/packs/000_wizznic/skipleveldialog-hl0.png differ
diff --git a/game/data/packs/000_wizznic/skipleveldialog-hl1.png b/game/data/packs/000_wizznic/skipleveldialog-hl1.png
new file mode 100644 (file)
index 0000000..f358f79
Binary files /dev/null and b/game/data/packs/000_wizznic/skipleveldialog-hl1.png differ
diff --git a/game/data/packs/000_wizznic/skipleveldialog.png b/game/data/packs/000_wizznic/skipleveldialog.png
new file mode 100644 (file)
index 0000000..1cc8d6c
Binary files /dev/null and b/game/data/packs/000_wizznic/skipleveldialog.png differ
diff --git a/game/data/packs/000_wizznic/themes/chars/green0.png b/game/data/packs/000_wizznic/themes/chars/green0.png
new file mode 100755 (executable)
index 0000000..0d15267
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/chars/green0.png differ
diff --git a/game/data/packs/000_wizznic/themes/chars/green1.png b/game/data/packs/000_wizznic/themes/chars/green1.png
new file mode 100755 (executable)
index 0000000..c48a1d7
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/chars/green1.png differ
diff --git a/game/data/packs/000_wizznic/themes/chars/thor0.png b/game/data/packs/000_wizznic/themes/chars/thor0.png
new file mode 100644 (file)
index 0000000..245938a
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/chars/thor0.png differ
diff --git a/game/data/packs/000_wizznic/themes/chars/thor1.png b/game/data/packs/000_wizznic/themes/chars/thor1.png
new file mode 100644 (file)
index 0000000..33af75b
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/chars/thor1.png differ
diff --git a/game/data/packs/000_wizznic/themes/cursors/cyberpunk.png b/game/data/packs/000_wizznic/themes/cursors/cyberpunk.png
new file mode 100644 (file)
index 0000000..8808f78
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/cursors/cyberpunk.png differ
diff --git a/game/data/packs/000_wizznic/themes/cursors/red.png b/game/data/packs/000_wizznic/themes/cursors/red.png
new file mode 100644 (file)
index 0000000..874ec05
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/cursors/red.png differ
diff --git a/game/data/packs/000_wizznic/themes/cursors/thor.png b/game/data/packs/000_wizznic/themes/cursors/thor.png
new file mode 100644 (file)
index 0000000..9de0fae
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/cursors/thor.png differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/bg/cyberpunk1.png b/game/data/packs/000_wizznic/themes/oldskool/bg/cyberpunk1.png
new file mode 100755 (executable)
index 0000000..fa203db
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/bg/cyberpunk1.png differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/bg/cyberpunk2.png b/game/data/packs/000_wizznic/themes/oldskool/bg/cyberpunk2.png
new file mode 100644 (file)
index 0000000..039fdd3
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/bg/cyberpunk2.png differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/expl/melt00.png b/game/data/packs/000_wizznic/themes/oldskool/expl/melt00.png
new file mode 100755 (executable)
index 0000000..e81d313
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/expl/melt00.png differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/expl/melt01.png b/game/data/packs/000_wizznic/themes/oldskool/expl/melt01.png
new file mode 100755 (executable)
index 0000000..3d9bf61
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/expl/melt01.png differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/expl/melt02.png b/game/data/packs/000_wizznic/themes/oldskool/expl/melt02.png
new file mode 100755 (executable)
index 0000000..d675b15
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/expl/melt02.png differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/expl/melt03.png b/game/data/packs/000_wizznic/themes/oldskool/expl/melt03.png
new file mode 100755 (executable)
index 0000000..9e647ee
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/expl/melt03.png differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/expl/melt04.png b/game/data/packs/000_wizznic/themes/oldskool/expl/melt04.png
new file mode 100755 (executable)
index 0000000..a3b459c
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/expl/melt04.png differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/expl/melt05.png b/game/data/packs/000_wizznic/themes/oldskool/expl/melt05.png
new file mode 100755 (executable)
index 0000000..77ad8a3
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/expl/melt05.png differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/expl/melt06.png b/game/data/packs/000_wizznic/themes/oldskool/expl/melt06.png
new file mode 100755 (executable)
index 0000000..7df6121
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/expl/melt06.png differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/expl/melt07.png b/game/data/packs/000_wizznic/themes/oldskool/expl/melt07.png
new file mode 100755 (executable)
index 0000000..3980506
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/expl/melt07.png differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/expl/melt08.png b/game/data/packs/000_wizznic/themes/oldskool/expl/melt08.png
new file mode 100755 (executable)
index 0000000..652f742
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/expl/melt08.png differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/expl/melt09.png b/game/data/packs/000_wizznic/themes/oldskool/expl/melt09.png
new file mode 100755 (executable)
index 0000000..8788af4
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/expl/melt09.png differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/brickbreak.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/brickbreak.ogg
new file mode 100755 (executable)
index 0000000..dad2889
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/brickbreak.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/brickgrab.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/brickgrab.ogg
new file mode 100755 (executable)
index 0000000..d06283a
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/brickgrab.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/brickmove.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/brickmove.ogg
new file mode 100755 (executable)
index 0000000..cdcd8dd
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/brickmove.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/click.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/click.ogg
new file mode 100755 (executable)
index 0000000..dad2889
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/click.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/countdown.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/countdown.ogg
new file mode 100755 (executable)
index 0000000..244029d
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/countdown.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/loser.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/loser.ogg
new file mode 100644 (file)
index 0000000..afbc3d9
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/loser.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/onewaymove.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/onewaymove.ogg
new file mode 100755 (executable)
index 0000000..49c6462
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/onewaymove.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/scoretick.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/scoretick.ogg
new file mode 100755 (executable)
index 0000000..dad2889
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/scoretick.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/start.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/start.ogg
new file mode 100755 (executable)
index 0000000..eec32a7
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/start.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/switchactivate.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/switchactivate.ogg
new file mode 100644 (file)
index 0000000..68c7557
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/switchactivate.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/switchinactive.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/switchinactive.ogg
new file mode 100644 (file)
index 0000000..3847634
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/switchinactive.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/teleported.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/teleported.ogg
new file mode 100644 (file)
index 0000000..192a8c1
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/teleported.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/timeout.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/timeout.ogg
new file mode 100755 (executable)
index 0000000..dad2889
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/timeout.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/victory.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/victory.ogg
new file mode 100755 (executable)
index 0000000..dad2889
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/victory.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/snd/winner.ogg b/game/data/packs/000_wizznic/themes/oldskool/snd/winner.ogg
new file mode 100644 (file)
index 0000000..56e2f69
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/snd/winner.ogg differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/tiles/cyberpunk.png b/game/data/packs/000_wizznic/themes/oldskool/tiles/cyberpunk.png
new file mode 100755 (executable)
index 0000000..5eefc63
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/tiles/cyberpunk.png differ
diff --git a/game/data/packs/000_wizznic/themes/oldskool/walls/blue.png b/game/data/packs/000_wizznic/themes/oldskool/walls/blue.png
new file mode 100644 (file)
index 0000000..67439f1
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/oldskool/walls/blue.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/bg/BG01.png b/game/data/packs/000_wizznic/themes/thor/bg/BG01.png
new file mode 100644 (file)
index 0000000..f7958e1
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/bg/BG01.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/bg/BG02.png b/game/data/packs/000_wizznic/themes/thor/bg/BG02.png
new file mode 100644 (file)
index 0000000..d023d8a
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/bg/BG02.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/bg/BG03.png b/game/data/packs/000_wizznic/themes/thor/bg/BG03.png
new file mode 100644 (file)
index 0000000..42070aa
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/bg/BG03.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/bg/BG04.png b/game/data/packs/000_wizznic/themes/thor/bg/BG04.png
new file mode 100644 (file)
index 0000000..1b5eab4
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/bg/BG04.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/bg/BG05.png b/game/data/packs/000_wizznic/themes/thor/bg/BG05.png
new file mode 100644 (file)
index 0000000..781a2cd
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/bg/BG05.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/bg/BG06.png b/game/data/packs/000_wizznic/themes/thor/bg/BG06.png
new file mode 100644 (file)
index 0000000..a5463dd
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/bg/BG06.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/bg/BG07.png b/game/data/packs/000_wizznic/themes/thor/bg/BG07.png
new file mode 100644 (file)
index 0000000..26a5ece
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/bg/BG07.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/bg/BG08.png b/game/data/packs/000_wizznic/themes/thor/bg/BG08.png
new file mode 100644 (file)
index 0000000..3d3340b
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/bg/BG08.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/bg/BG09.png b/game/data/packs/000_wizznic/themes/thor/bg/BG09.png
new file mode 100644 (file)
index 0000000..95682f7
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/bg/BG09.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/bg/BG10.png b/game/data/packs/000_wizznic/themes/thor/bg/BG10.png
new file mode 100644 (file)
index 0000000..57b00af
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/bg/BG10.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/expl/tomb00.png b/game/data/packs/000_wizznic/themes/thor/expl/tomb00.png
new file mode 100644 (file)
index 0000000..7c2d10b
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/expl/tomb00.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/expl/tomb01.png b/game/data/packs/000_wizznic/themes/thor/expl/tomb01.png
new file mode 100644 (file)
index 0000000..d0be0b9
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/expl/tomb01.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/expl/tomb02.png b/game/data/packs/000_wizznic/themes/thor/expl/tomb02.png
new file mode 100644 (file)
index 0000000..f9c661b
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/expl/tomb02.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/expl/tomb03.png b/game/data/packs/000_wizznic/themes/thor/expl/tomb03.png
new file mode 100644 (file)
index 0000000..361d9f2
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/expl/tomb03.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/expl/tomb04.png b/game/data/packs/000_wizznic/themes/thor/expl/tomb04.png
new file mode 100644 (file)
index 0000000..6dc9949
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/expl/tomb04.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/expl/tomb05.png b/game/data/packs/000_wizznic/themes/thor/expl/tomb05.png
new file mode 100644 (file)
index 0000000..873bf8c
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/expl/tomb05.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/expl/tomb06.png b/game/data/packs/000_wizznic/themes/thor/expl/tomb06.png
new file mode 100644 (file)
index 0000000..ff30fd0
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/expl/tomb06.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/expl/tomb07.png b/game/data/packs/000_wizznic/themes/thor/expl/tomb07.png
new file mode 100644 (file)
index 0000000..fd3b7e2
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/expl/tomb07.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/expl/tomb08.png b/game/data/packs/000_wizznic/themes/thor/expl/tomb08.png
new file mode 100644 (file)
index 0000000..10ed24c
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/expl/tomb08.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/expl/tomb09.png b/game/data/packs/000_wizznic/themes/thor/expl/tomb09.png
new file mode 100644 (file)
index 0000000..119555f
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/expl/tomb09.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile00.png b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile00.png
new file mode 100644 (file)
index 0000000..145fc13
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile00.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile01.png b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile01.png
new file mode 100644 (file)
index 0000000..8c23eb9
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile01.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile10.png b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile10.png
new file mode 100644 (file)
index 0000000..91cd3fb
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile10.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile11.png b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile11.png
new file mode 100644 (file)
index 0000000..ae4fcb0
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile11.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile17.png b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile17.png
new file mode 100644 (file)
index 0000000..f1da4c4
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile17.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile18.png b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile18.png
new file mode 100644 (file)
index 0000000..5e1dd1f
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile18.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile19.png b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile19.png
new file mode 100644 (file)
index 0000000..c397432
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile19.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile20.png b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile20.png
new file mode 100644 (file)
index 0000000..d35bce5
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile20.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile21.png b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile21.png
new file mode 100644 (file)
index 0000000..725997c
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile21.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile22.png b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile22.png
new file mode 100644 (file)
index 0000000..2be50f8
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile22.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile23.png b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile23.png
new file mode 100644 (file)
index 0000000..a4f45ed
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/tiles/thor-tile23.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/tiles/thor.png b/game/data/packs/000_wizznic/themes/thor/tiles/thor.png
new file mode 100644 (file)
index 0000000..0d41384
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/tiles/thor.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/walls/goldstone.png b/game/data/packs/000_wizznic/themes/thor/walls/goldstone.png
new file mode 100644 (file)
index 0000000..7fa67ac
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/walls/goldstone.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/walls/lightstone.png b/game/data/packs/000_wizznic/themes/thor/walls/lightstone.png
new file mode 100644 (file)
index 0000000..d7bfbf4
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/walls/lightstone.png differ
diff --git a/game/data/packs/000_wizznic/themes/thor/walls/silverstone.png b/game/data/packs/000_wizznic/themes/thor/walls/silverstone.png
new file mode 100644 (file)
index 0000000..462cad4
Binary files /dev/null and b/game/data/packs/000_wizznic/themes/thor/walls/silverstone.png differ
diff --git a/game/index.htm b/game/index.htm
new file mode 100644 (file)
index 0000000..5e9def5
--- /dev/null
@@ -0,0 +1,108 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
+    <script src="/src/DstEng.js"></script>
+    <script src="/src/Wizznic.js"></script>
+</head>
+
+<body>
+    <center>
+        <br>
+        <canvas id="screen" style="cursor: none;">You need WebGL, get a proper browser</canvas>
+    </center>
+    <pre id="log"></pre>
+</body>
+
+<script>
+    var eng;
+
+    function inspectObj(obj, r) {
+        var out = '';
+
+        var len = Object.keys(obj).length;
+        var cur = 0;
+
+        for (key in obj) {
+            var val = obj[key];
+            var typ = typeof(val);
+
+            if (r > 0) {
+                out += key + ':';
+            }
+            out += ' ';
+
+            if (Array.isArray(val)) {
+                out += '[' + val.join() + ']';
+            } else if (typ === 'object') {
+
+
+                if (r < 1) {
+                    out += '{' + inspectObj(val, ++r) + '}';
+                } else {
+                    out += '{..}';
+                }
+            } else if (typ === 'function') {
+                out += '(function ' + val.name + ')';
+            } else if (typ === 'string' && r > 0) {
+                out += '\'' + val + '\'';
+            } else {
+                out += val;
+            }
+            if (++cur != len && r > 0) {
+                out += ', ';
+            }
+        }
+
+        return (out);
+    }
+
+    function log() {
+        $('#log').append(inspectObj(arguments, 0) + '<br>');
+
+    }
+
+    var exampleSocket = new WebSocket("ws://localhost:3000/");
+    exampleSocket.onopen = function(event) {
+        exampleSocket.send("new connection");
+    };
+
+    function reload() {
+        log('Reloading in 500 ms...');
+        setTimeout(function() {
+            location.reload();
+        }, 500);
+    }
+    exampleSocket.onclose = function(event) {
+        log('Socket closed.');
+        if (status) {
+            eng.stop(reload);
+        } else {
+            reload();
+        }
+    };
+
+    function rdyCb(status) {
+
+        if (!status) {
+            log('Init went wrong:', new Error("trace"));
+        } else {
+            log('DstEng init Ok');
+            new Wizznic(eng);
+        }
+
+    }
+
+    var config = {
+        screen: document.getElementById('screen'),
+        width: 800,
+        height: 600,
+        readyCallback: rdyCb
+    };
+
+    DstEng.prototype.log = log;
+    eng = new DstEng(config);
+</script>
+
+</html>
\ No newline at end of file
diff --git a/game/src/DstEng-first.js b/game/src/DstEng-first.js
new file mode 100644 (file)
index 0000000..8348cb0
--- /dev/null
@@ -0,0 +1,656 @@
+/* globals $ */
+
+var timeScale=1;
+
+function DstEng(config) {
+this.accTs =0;
+    this.res = {};
+
+
+    this.state = {
+        timeDelta: 0,
+        tdAvg: 0.0,
+        lastTime: 0,
+        frame: 0,
+        virtRes: [320, 240],
+        pointer: {
+            pos: [0, 0],
+            down: false
+        }
+    };
+
+
+    var ok = true;
+    this.cfg = config;
+
+    this.log("DstEng Startup:", this.cfg);
+
+    this.cfg.screen.width = this.cfg.width;
+    this.cfg.screen.height = this.cfg.height;
+    console.log(this.cfg.screen.height);
+
+    if (this.initGl()) {
+        this.log("Configured gl rendering");
+    } else {
+        this.log("Fail, no rendering available");
+        ok = false;
+    }
+
+    if (ok) {
+        this.preLoad();
+    } else {
+        this.cfg.readyCallback(false);
+    }
+
+
+
+}
+
+DstEng.prototype.log = function() {
+    console.log.apply(console, arguments);
+};
+
+DstEng.prototype.initGl = function() {
+    try {
+        this.gl = this.cfg.screen.getContext("experimental-webgl");
+        this.gl.viewportWidth = this.cfg.screen.width;
+        this.gl.viewportHeight = this.cfg.screen.height;
+    } catch (e) {}
+
+    return !!this.gl;
+};
+
+
+
+DstEng.prototype.isPowerOf2 = function(value) {
+    return (value & (value - 1)) === 0;
+};
+
+DstEng.prototype.setupTextureFiltering = function(width, height) {
+    if (this.isPowerOf2(width) && this.isPowerOf2(height)) {
+        // the dimensions are power of 2 so generate mips and turn on 
+        // tri-linear filtering.
+        this.gl.generateMipmap(this.gl.TEXTURE_2D);
+        //             this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR_MIPMAP_LINEAR);
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.NEAREST_MIPMAP_NEAREST);
+    } else {
+        // at least one of the dimensions is not a power of 2 so set the filtering
+        // so WebGL will render it.
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE);
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE);
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR);
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.NEAREST);
+    }
+};
+
+
+DstEng.prototype.imgLoader = function(obj, cb) {
+
+    var image = new Image();
+    image.src = obj.url;
+    image.addEventListener('load', function() {
+
+        var texture = this.gl.createTexture();
+        this.gl.bindTexture(this.gl.TEXTURE_2D, texture);
+        // Fill the texture with a 1x1 blue pixel.
+        this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, 1, 1, 0, this.gl.RGBA, this.gl.UNSIGNED_BYTE,
+            new Uint8Array([0, 0, 255, 255]));
+        // Asynchronously load an image
+
+        this.gl.bindTexture(this.gl.TEXTURE_2D, texture);
+        this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, this.gl.RGBA, this.gl.UNSIGNED_BYTE, image);
+
+        this.setupTextureFiltering(image.width, image.height);
+
+        cb({
+            valid: true,
+            resType: 'img',
+            image: image,
+            texture: texture
+        });
+    }.bind(this));
+    image.addEventListener('error', function(e) {
+        cb({
+            valid: false,
+            error: 'Could not load the image'
+        });
+    });
+};
+
+DstEng.prototype.compileShader = function(gl, shaderSource, shaderType) {
+    // Create the shader object
+    var obj = {
+        valid: true
+    };
+    var shader = gl.createShader(shaderType);
+
+
+    // Set the shader source code.
+    gl.shaderSource(shader, shaderSource);
+
+    // Compile the shader
+    gl.compileShader(shader);
+
+    // Check if it compiled
+    var success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
+    if (!success) {
+        // Something went wrong during compilation; get the error
+        obj.valid = false;
+        obj.error = 'Compilation failed: ' + gl.getShaderInfoLog(shader);
+
+    } else {
+        obj.shaderType = shaderType;
+        obj.resType = (shaderType === gl.FRAGMENT_SHADER) ? 'fragment_shader' : 'vertex_shader';
+        obj.shader = shader;
+    }
+
+    return obj;
+};
+
+DstEng.prototype.createProgram = function(gl, vertexShader, fragmentShader) {
+    // create a program.
+    var program = gl.createProgram();
+
+    // attach the shaders.
+    gl.attachShader(program, vertexShader);
+    gl.attachShader(program, fragmentShader);
+
+    // link the program.
+    gl.linkProgram(program);
+
+    // Check if it linked.
+    var success = gl.getProgramParameter(program, gl.LINK_STATUS);
+    if (!success) {
+        // something went wrong with the link
+        throw ("program failed to link:" + gl.getProgramInfoLog(program));
+    }
+
+    var resObj = {
+        resType: 'shader_program',
+        program: program,
+        a_texCoord: gl.getAttribLocation(program, "a_texCoord"),
+        a_pos: gl.getAttribLocation(program, "a_position"),
+        u_frameSize: gl.getUniformLocation(program, "u_frameSize"),
+        u_frameGridPos: gl.getUniformLocation(program, "u_frameGridPos"),
+        u_res: gl.getUniformLocation(program, "u_resolution"),
+        u_translation: gl.getUniformLocation(program, "u_translation")
+    };
+
+    //Enable textures and verticies for out programs
+    gl.enableVertexAttribArray(resObj.a_pos);
+    gl.enableVertexAttribArray(resObj.a_texCoord);
+
+    //Set default resolution
+    gl.useProgram(program);
+    gl.uniform2fv(resObj.u_res, this.state.virtRes);
+
+    return resObj;
+};
+
+
+DstEng.prototype.shaderLoader = function(obj, cb) {
+    $.ajax({
+        url: obj.url,
+        dataType: 'text',
+        success: function(data) {
+            cb(this.compileShader(this.gl, data, obj.shaderType));
+        }.bind(this),
+        error: function(e) {
+            cb({
+                valid: false,
+                error: e.status + ' ' + e.statusText
+            });
+        }
+    });
+};
+
+
+DstEng.prototype.resLoader = function(loadList, done) {
+    var left = loadList.length;
+    var loaded = 0;
+
+    loadList.forEach(function(r) {
+        r.loader(r, function(data) {
+            if (data) {
+                this.addRes(r.name, data);
+                loaded++;
+            }
+            left--;
+
+            if (!data.valid) {
+                this.log('Resource loading failed for "' + r.name + '" from "' + r.url + '" error:', data.error);
+            }
+            if (left === 0) {
+                done((loaded != loadList.length));
+            }
+        }.bind(this));
+    }, this);
+};
+
+DstEng.prototype.preLoad = function() {
+    var res = [{
+            name: 'img_DstEng',
+            url: '/data/img/DstEng.jpg',
+            loader: this.imgLoader.bind(this)
+        }, {
+            name: 'img_tiles',
+            url: '/data/packs/000_wizznic/themes/thor/tiles/thor.png',
+            loader: this.imgLoader.bind(this)
+        }, {
+            name: 'shader_vertex2d',
+            url: '/data/gl/2d_vertex.js',
+            shaderType: this.gl.VERTEX_SHADER,
+            loader: this.shaderLoader.bind(this)
+        }, {
+            name: 'shader_fragment2d',
+            url: '/data/gl/2d_fragment.js',
+            shaderType: this.gl.FRAGMENT_SHADER,
+            loader: this.shaderLoader.bind(this)
+        }, {
+            name: 'shader_fragment2d_sat',
+            url: '/data/gl/2d_fragment_sat.js',
+            shaderType: this.gl.FRAGMENT_SHADER,
+            loader: this.shaderLoader.bind(this)
+        }
+
+    ];
+
+    this.resLoader(res, function(err) {
+        if (!err) {
+            this.startLoader();
+        } else {
+            this.cfg.readyCallback(true);
+        }
+    }.bind(this));
+
+
+};
+
+DstEng.prototype.realCoordsToGl = function(evt) {
+    var r = this.cfg.screen.getBoundingClientRect();
+    var sx = this.state.virtRes[0] / this.cfg.screen.width;
+    var sy = this.state.virtRes[1] / this.cfg.screen.height;
+    return ([(evt.clientX - r.left) * sx, (evt.clientY - r.top) * sy]);
+};
+
+DstEng.prototype.setPointerState = function(e) {
+    this.state.pointer.pos = this.realCoordsToGl(e);
+};
+
+
+DstEng.prototype.onMouseMove = function(cb) {
+    this.cfg.screen.addEventListener('mousemove', function(e) {
+        this.setPointerState(e);
+        cb(this.state.pointer);
+    }.bind(this));
+};
+
+DstEng.prototype.onMouseClick = function(cb) {
+    this.cfg.screen.addEventListener('mousedown', function(e) {
+        this.setPointerState(e);
+        this.state.pointer.down = true;
+        cb(this.state.pointer);
+    }.bind(this));
+
+    this.cfg.screen.addEventListener('mouseup', function(e) {
+        this.setPointerState(e);
+        this.state.pointer.down = false;
+        cb(this.state.pointer);
+    }.bind(this));
+};
+
+
+DstEng.prototype.randomInt = function(range) {
+    return Math.floor(Math.random() * range);
+};
+
+DstEng.prototype.addRes = function(name, resource) {
+
+    if (this.res.hasOwnProperty(name)) {
+        this.log('Note: Overriding existing resource ' + name);
+        this.log('Ow: ', this.res[name]);
+        this.log('By: ', resource);
+
+    }
+    if (resource.type) {
+        this.log('No type defined for ' + name);
+    }
+
+    this.res[name] = resource;
+
+    return (resource);
+};
+
+
+DstEng.prototype.startLoader = function() {
+
+    this.addRes('glPrg', this.createProgram(this.gl, this.res.shader_vertex2d.shader, this.res.shader_fragment2d.shader));
+    this.addRes('glPrgSat', this.createProgram(this.gl, this.res.shader_vertex2d.shader, this.res.shader_fragment2d_sat.shader));
+
+    //this.gl.useProgram( this.res.glPrg.program );
+
+    // The idea is to have:
+    // DrawGroups, each member of this group will be drawn using the same program
+    //  - PolyGroups, each member will be drawn using the same program and vertex geometry
+    //     - TexGroups, each member will be drawn using the same program, vertex, geometry and texture, it will contain an array of texCoord arrays to be used
+    //        - Sprite, each sprite will be drawn at a desired position, using the desired texCoord array, optional array of program params may be supplied
+    // Usage:
+    // Create a vertexbuffers
+    // Create a dg
+    // Create a pg and add to dg
+    // Create a tg and add to pg
+    // Create a sp and add to tg
+    // draw dgs
+
+    // "Add object: thisProgram, thatimage, " = { dg, pg, tg, sp } ?
+
+
+    /*...*/
+
+    var texture = new this.Texture(this.gl, {
+        img: this.res.img_DstEng,
+        cut: [0, 0, 160, 120],
+        numFrames: 1,
+        animate: false,
+        frameTime: 0
+    });
+
+
+
+
+    var drawGroup = new this.DrawGroup(this.gl, this.res.glPrg);
+
+
+
+    var w = 320,
+        h = 240;
+
+    var polyBuffer = this.gl.createBuffer();
+    this.gl.bindBuffer(this.gl.ARRAY_BUFFER, polyBuffer);
+    this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array([
+        0, 0,
+        0.0, 0.0,
+        w, 0,
+        1.0, 0.0,
+        0, h,
+        0.0, 1.0,
+        0, h,
+        0.0, 1.0,
+        w, 0,
+        1.0, 0.0,
+        w, h,
+        1.0, 1.0
+    ]), this.gl.STATIC_DRAW);
+
+    var brick = this.gl.createBuffer();
+    this.gl.bindBuffer(this.gl.ARRAY_BUFFER, brick);
+    w = h = 20;
+    var glw = 20 / 480;
+    this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array([
+        0, 0,
+        0.0, 0.0,
+        w, 0,
+        glw, 0.0,
+        0, h,
+        0.0, 1.0,
+        0, h,
+        0.0, 1.0,
+        w, 0,
+        glw, 0.0,
+        w, h,
+        glw, 1.0
+    ]), this.gl.STATIC_DRAW);
+
+    var bricks = new this.PolyGroup(brick);
+    var brickTex = new this.Texture(this.gl, {
+        img: this.res.img_tiles,
+        cut: [0, 0, 20, 20],
+        numFrames: 10,
+        frameTime: 100,
+        animate: true
+    });
+
+
+
+    var brickTexGroup = new this.TexGroup(brickTex);
+
+    var sprite;
+    this.Sprite.prototype.animate = function() {
+        this.pos[0] += this.vx*timeScale;
+        this.pos[1] += this.vy*timeScale;
+
+        if (this.pos[0] < 0) {
+            this.pos[0] = 0;
+            this.vx *= -1;
+            this.frameGridPos[0]++;
+            if(this.frameGridPos[0] > 9) {
+                this.frameGridPos[0]=0;
+            }
+        } else if (this.pos[0] > 320 - 20) {
+            this.pos[0] = 320 - 20;
+            this.vx *= -1;
+//            this.frameGridPos = [Math.floor(Math.random() * 10), 0];
+            this.frameGridPos[0]++;
+            if(this.frameGridPos[0] > 9) {
+                this.frameGridPos[0]=0;
+            }
+        }
+
+        if (this.pos[1] < 0) {
+            this.frameGridPos[0]++;
+            if(this.frameGridPos[0] > 9) {
+                this.frameGridPos[0]=0;
+            }
+  //          this.frameGridPos = [Math.floor(Math.random() * 10), 0];
+            this.pos[1] = 0;
+            this.vy *= -1;
+        } else if (this.pos[1] > 240 - 20) {
+    //        this.frameGridPos = [Math.floor(Math.random() * 10), 0];
+            this.frameGridPos[0]++;
+            if(this.frameGridPos[0] > 9) {
+                this.frameGridPos[0]=0;
+            }
+            this.pos[1] = 240 - 20;
+            this.vy *= -1;
+        }
+
+    };
+
+    for (var i = 0; i < 100000; ++i) {
+        sprite = new this.Sprite();
+        sprite.frameGridPos = [Math.floor(Math.random() * 10), 0];
+        sprite.vx = Math.random()*4-2;
+        sprite.vy = Math.random()*4-2;
+        
+       // sprite.animate = animate.bind(sprite);
+        brickTexGroup.addSprite(sprite);
+    }
+
+
+    bricks.addTexGroup(brickTexGroup);
+
+    var backgrounds = new this.PolyGroup(polyBuffer);
+
+    drawGroup.addPolyGroup(backgrounds);
+
+    drawGroup.addPolyGroup(bricks);
+
+    var bgTexSingle = new this.TexGroup(texture);
+
+
+    //Add an empty s
+    bgTexSingle.addSprite(new this.Sprite());
+
+
+    backgrounds.addTexGroup(bgTexSingle);
+
+
+
+
+    this.dg = drawGroup;
+
+
+
+    this.drawFrame();
+    //Say we are ready
+    this.cfg.readyCallback(true);
+};
+
+DstEng.prototype.Texture = (function() {
+    function Tex(gl, setup) {
+
+        if (!gl) {
+            throw Error('Need gl');
+        }
+
+        if (!setup.img.resType) {
+            throw Error('Required: img.');
+        }
+
+        if (!setup.img.image || !setup.img.image.height) {
+            throw Error('Invalid or no image in setup.img');
+        }
+
+        this.w = setup.img.image.width;
+        this.h = setup.img.image.height;
+
+        this.numFrames = setup.numFrames || 1;
+        this.animate = setup.animate || false;
+        this.frameTime = setup.frameTime || false;
+
+        this.pxCut = setup.cut || [0, 0, this.w, this.h];
+
+        this.glTex = setup.img.texture;
+
+        this.glFrameSize = new Float32Array([(this.pxCut[2] / this.w), (this.pxCut[3] / this.h)]);
+
+    }
+
+    return Tex;
+}());
+
+DstEng.prototype.DrawGroup = (function() {
+    function Dg(gl, prgInfo) {
+        this.prgInfo = prgInfo;
+        this.polyGroups = [];
+    }
+
+    Dg.prototype.addPolyGroup = function(pg) {
+        this.polyGroups.push(pg);
+    };
+
+    Dg.prototype.draw = function(gl) {
+
+        //Program is same for all drawGroups
+        var prgInfo = this.prgInfo;
+        gl.useProgram(prgInfo.program);
+
+        this.polyGroups.forEach(function drawPolyGroup(pg) {
+
+            //VertexBuffer is the same for a polygroup
+            gl.bindBuffer(gl.ARRAY_BUFFER, pg.buffer);
+            gl.vertexAttribPointer(prgInfo.a_pos, 2, gl.FLOAT, false, pg.stride, pg.vertexOffset);
+            gl.vertexAttribPointer(prgInfo.a_texCoord, 2, gl.FLOAT, false, pg.stride, pg.texCoordOffset);
+
+            pg.texGroups.forEach(function drawTexGroup(tg) {
+                //Texture is the same for each texGroup
+                gl.bindTexture(gl.TEXTURE_2D, tg.texture.glTex);
+
+                gl.uniform2fv(prgInfo.u_frameSize, tg.texture.glFrameSize);
+                tg.sprites.forEach(function drawSprite(spr) {
+                    //Set geometry location and texture location
+                    if (spr.vx) spr.animate();
+
+                    gl.uniform2fv(prgInfo.u_translation, spr.pos);
+                    gl.uniform2fv(prgInfo.u_frameGridPos, spr.frameGridPos);
+
+
+
+                    gl.drawArrays(gl.TRIANGLES, 0, 6);
+                });
+            });
+        });
+    };
+
+    return Dg;
+}());
+
+DstEng.prototype.PolyGroup = (function() {
+    function Pg(buffer) {
+        this.buffer = buffer;
+        this.vertexOffset = 0;
+        this.texCoordOffset = Float32Array.BYTES_PER_ELEMENT * 2;
+        this.stride = Float32Array.BYTES_PER_ELEMENT * 4;
+        this.texGroups = [];
+    }
+
+    Pg.prototype.addTexGroup = function(tg) {
+        this.texGroups.push(tg);
+    };
+
+    return Pg;
+}());
+
+DstEng.prototype.TexGroup = (function() {
+    function Tg(texture) {
+        this.texture = texture;
+        this.sprites = [];
+    }
+
+    Tg.prototype.addSprite = function(spr) {
+        this.sprites.push(spr);
+    };
+
+    return Tg;
+}());
+
+
+DstEng.prototype.Sprite = (function() {
+    function Spr() {
+        this.pos = new Float32Array([0, 0]);
+        this.frameGridPos = [0, 0];
+    }
+
+    Spr.prototype.setPos = function(pos) {
+        this.pos = pos;
+    };
+
+
+    return Spr;
+}());
+
+
+
+DstEng.prototype.drawFrame = function(timeStamp) {
+
+    timeStamp = timeStamp || 16.0;
+
+    this.state.timeDelta = timeStamp - this.state.lastTime;
+    
+    timeScale = this.state.timeDelta/16.00;
+    this.accTs +=timeScale;
+  //  console.log(timeScale);
+    
+    this.state.lastTime = timeStamp;
+
+    this.state.frame++;
+    this.state.tdAvg += this.state.timeDelta;
+
+
+
+
+    if (this.state.frame % 120 === 0) {
+        this.state.fps = 1000 / this.state.timeDelta;
+        console.log(this.state.fps, (1000.0 / (this.state.tdAvg / this.state.frame)), this.state.tdAvg - timeStamp, this.state.frame, this.accTs/this.state.frame);
+    }
+
+
+    //  this.spr.pos = this.state.pointer.pos;
+    //    this.spr.frameGridPos = [ Math.floor(this.state.pointer.pos[0]) % 10, 0 ];
+    this.dg.draw(this.gl);
+
+
+    window.requestAnimationFrame(this.drawFrame.bind(this));
+
+};
\ No newline at end of file
diff --git a/game/src/DstEng.js b/game/src/DstEng.js
new file mode 100644 (file)
index 0000000..ad05e81
--- /dev/null
@@ -0,0 +1,736 @@
+/* globals $ */
+
+var timeScale = 1;
+
+function DstEng(config) {
+    this.accTs = 0;
+    this.res = {};
+
+    this.state = {
+        timeDelta: 0,
+        time: 0.0,
+        lastTime: 0,
+        frame: 0,
+        virtRes: [320, 240],
+        pointer: {
+            pos: [0, 0],
+            down: false
+        }
+    };
+
+    this.drawFrameRequestId = null;
+    this.pauseState = false;
+
+    var ok = true;
+    this.cfg = config;
+
+    this.log("DstEng Startup:", this.cfg);
+
+    this.cfg.screen.width = this.cfg.width;
+    this.cfg.screen.height = this.cfg.height;
+
+    if (this.initGl()) {
+        this.log("Configured gl rendering");
+    } else {
+        this.log("Fail, no rendering available");
+        ok = false;
+    }
+
+    if (ok) {
+        this.preLoad();
+    } else {
+        this.cfg.readyCallback(false);
+    }
+
+}
+
+DstEng.prototype.log = function() {
+    console.log.apply(console, arguments);
+};
+
+DstEng.prototype.initGl = function() {
+    try {
+        this.gl = this.cfg.screen.getContext("experimental-webgl");
+        this.gl.viewportWidth = this.cfg.screen.width;
+        this.gl.viewportHeight = this.cfg.screen.height;
+    } catch (e) {}
+
+    return !!this.gl;
+};
+
+
+
+DstEng.prototype.isPowerOf2 = function(value) {
+    return (value & (value - 1)) === 0;
+};
+
+DstEng.prototype.setupTextureFiltering = function(width, height) {
+    if (this.isPowerOf2(width) && this.isPowerOf2(height)) {
+        // the dimensions are power of 2 so generate mips and turn on 
+        // tri-linear filtering.
+        this.gl.generateMipmap(this.gl.TEXTURE_2D);
+        //             this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR_MIPMAP_LINEAR);
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.NEAREST_MIPMAP_NEAREST);
+    } else {
+        // at least one of the dimensions is not a power of 2 so set the filtering
+        // so WebGL will render it.
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE);
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE);
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR);
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.NEAREST);
+    }
+};
+
+
+DstEng.prototype.imgLoader = function(obj, cb) {
+
+    var image = new Image();
+    image.src = obj.url;
+    image.addEventListener('load', function() {
+
+        var texture = this.gl.createTexture();
+        this.gl.bindTexture(this.gl.TEXTURE_2D, texture);
+        // Fill the texture with a 1x1 blue pixel.
+        this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, 1, 1, 0, this.gl.RGBA, this.gl.UNSIGNED_BYTE,
+            new Uint8Array([0, 0, 255, 255]));
+        // Asynchronously load an image
+
+        this.gl.bindTexture(this.gl.TEXTURE_2D, texture);
+        this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, this.gl.RGBA, this.gl.UNSIGNED_BYTE, image);
+
+        this.setupTextureFiltering(image.width, image.height);
+
+        cb({
+            valid: true,
+            resType: 'img',
+            image: image,
+            texture: texture
+        });
+    }.bind(this));
+    image.addEventListener('error', function(e) {
+        cb({
+            valid: false,
+            error: 'Could not load the image'
+        });
+    });
+};
+
+DstEng.prototype.compileShader = function(gl, shaderSource, shaderType) {
+    // Create the shader object
+    var obj = {
+        valid: true
+    };
+    var shader = gl.createShader(shaderType);
+
+
+    // Set the shader source code.
+    gl.shaderSource(shader, shaderSource);
+
+    // Compile the shader
+    gl.compileShader(shader);
+
+    // Check if it compiled
+    var success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
+    if (!success) {
+        // Something went wrong during compilation; get the error
+        obj.valid = false;
+        obj.error = 'Compilation failed: ' + gl.getShaderInfoLog(shader);
+
+    } else {
+        obj.shaderType = shaderType;
+        obj.resType = (shaderType === gl.FRAGMENT_SHADER) ? 'fragment_shader' : 'vertex_shader';
+        obj.shader = shader;
+    }
+
+    return obj;
+};
+
+DstEng.prototype.createProgram = function(gl, vertexShader, fragmentShader) {
+    // create a program.
+    var program = gl.createProgram();
+
+    // attach the shaders.
+    gl.attachShader(program, vertexShader);
+    gl.attachShader(program, fragmentShader);
+
+    // link the program.
+    gl.linkProgram(program);
+
+    // Check if it linked.
+    var success = gl.getProgramParameter(program, gl.LINK_STATUS);
+    if (!success) {
+        // something went wrong with the link
+        throw ("program failed to link:" + gl.getProgramInfoLog(program));
+    }
+
+    var resObj = {
+        resType: 'shader_program',
+        program: program,
+        a_texCoord: gl.getAttribLocation(program, "a_texCoord"),
+        a_pos: gl.getAttribLocation(program, "a_position"),
+        u_frameSize: gl.getUniformLocation(program, "u_frameSize"),
+        u_frameGridPos: gl.getUniformLocation(program, "u_frameGridPos"),
+        u_res: gl.getUniformLocation(program, "u_resolution"),
+        u_translation: gl.getUniformLocation(program, "u_translation")
+    };
+
+    //Enable textures and verticies for out programs
+    gl.enableVertexAttribArray(resObj.a_pos);
+    gl.enableVertexAttribArray(resObj.a_texCoord);
+
+    //Set default resolution
+    gl.useProgram(program);
+    gl.uniform2fv(resObj.u_res, this.state.virtRes);
+
+    window.onfocus = this.unpause.bind(this);
+    window.onblur = this.pause.bind(this);
+
+    return resObj;
+};
+
+
+DstEng.prototype.shaderLoader = function(obj, cb) {
+    $.ajax({
+        url: obj.url,
+        dataType: 'text',
+        success: function(data) {
+            cb(this.compileShader(this.gl, data, obj.shaderType));
+        }.bind(this),
+        error: function(e) {
+            cb({
+                valid: false,
+                error: e.status + ' ' + e.statusText
+            });
+        }
+    });
+};
+
+
+DstEng.prototype.resLoader = function(loadList, done) {
+    var left = loadList.length;
+    var loaded = 0;
+
+    loadList.forEach(function(r) {
+        r.loader(r, function(data) {
+            if (data) {
+                this.addRes(r.name, data);
+                loaded++;
+            }
+            left--;
+
+            if (!data.valid) {
+                this.log('Resource loading failed for "' + r.name + '" from "' + r.url + '" error:', data.error);
+            }
+            if (left === 0) {
+                done((loaded != loadList.length));
+            }
+        }.bind(this));
+    }, this);
+};
+
+DstEng.prototype.sndLoader = function(obj, cb) {
+
+    var request = new XMLHttpRequest();
+    request.open('GET', obj.url, true);
+    request.responseType = 'arraybuffer';
+
+    // Decode asynchronously
+    request.onload = function() {
+
+        this.audio.ctx.decodeAudioData(request.response, function(buffer) {
+            var snd = {
+                valid: true,
+                resType: 'snd',
+                sound: this.audio.add(buffer)
+            };
+
+
+
+            console.log(snd);
+            cb(snd);
+
+        }.bind(this));
+
+    }.bind(this);
+
+    request.send();
+
+};
+
+DstEng.prototype.audio = (function() {
+    function Aud() {
+        this.sounds = [];
+        window.AudioContext = window.AudioContext || window.webkitAudioContext;
+        this.ctx = new AudioContext();
+    }
+
+    Aud.prototype.play = function(idx) {
+        var source = this.ctx.createBufferSource();
+        source.buffer = this.sounds[idx];
+        source.connect(this.ctx.destination);
+        source.start(0);
+    };
+
+    Aud.prototype.add = function(buffer) {
+        return this.sounds.push(buffer) - 1;
+    };
+
+    return new Aud();
+}());
+
+
+
+DstEng.prototype.preLoad = function() {
+    var res = [{
+            name: 'img_DstEng',
+            url: '/data/img/DstEng.jpg',
+            loader: this.imgLoader.bind(this)
+        }, {
+            name: 'img_tiles',
+            url: '/data/packs/000_wizznic/themes/thor/tiles/thor.png',
+            loader: this.imgLoader.bind(this)
+        }, {
+            name: 'snd_click',
+            url: '/data/packs/000_wizznic/themes/oldskool/snd/click.ogg',
+            loader: this.sndLoader.bind(this)
+        }, {
+            name: 'shader_vertex2d',
+            url: '/data/gl/2d_vertex.js',
+            shaderType: this.gl.VERTEX_SHADER,
+            loader: this.shaderLoader.bind(this)
+        }, {
+            name: 'shader_fragment2d',
+            url: '/data/gl/2d_fragment.js',
+            shaderType: this.gl.FRAGMENT_SHADER,
+            loader: this.shaderLoader.bind(this)
+        }, {
+            name: 'shader_fragment2d_sat',
+            url: '/data/gl/2d_fragment_sat.js',
+            shaderType: this.gl.FRAGMENT_SHADER,
+            loader: this.shaderLoader.bind(this)
+        }
+
+    ];
+
+    this.resLoader(res, function(err) {
+        if (!err) {
+            this.startLoader();
+        } else {
+            this.cfg.readyCallback(true);
+        }
+    }.bind(this));
+
+
+};
+
+DstEng.prototype.realCoordsToGl = function(evt) {
+    var r = this.cfg.screen.getBoundingClientRect();
+    var sx = this.state.virtRes[0] / this.cfg.screen.width;
+    var sy = this.state.virtRes[1] / this.cfg.screen.height;
+    return ([(evt.clientX - r.left) * sx, (evt.clientY - r.top) * sy]);
+};
+
+DstEng.prototype.setPointerState = function(e) {
+    this.state.pointer.pos = this.realCoordsToGl(e);
+};
+
+
+DstEng.prototype.onMouseMove = function(cb) {
+    this.cfg.screen.addEventListener('mousemove', function(e) {
+        this.setPointerState(e);
+        cb(this.state.pointer);
+    }.bind(this));
+};
+
+DstEng.prototype.pause = function() {
+    this.pauseState = true;
+
+    if (this.drawFrameRequestId) {
+        window.cancelAnimationFrame(this.drawFrameRequestId);
+    }
+};
+
+DstEng.prototype.unpause = function() {
+    if (this.pauseState) {
+        this.drawFrame();
+        this.pauseState = false;
+    }
+};
+
+DstEng.prototype.onMouseClick = function(cb) {
+    this.cfg.screen.addEventListener('mousedown', function(e) {
+        this.setPointerState(e);
+        this.state.pointer.down = true;
+        cb(this.state.pointer);
+    }.bind(this));
+
+    this.cfg.screen.addEventListener('mouseup', function(e) {
+        this.setPointerState(e);
+        this.state.pointer.down = false;
+        cb(this.state.pointer);
+    }.bind(this));
+};
+
+
+DstEng.prototype.randomInt = function(range) {
+    return Math.floor(Math.random() * range);
+};
+
+DstEng.prototype.addRes = function(name, resource) {
+
+    if (this.res.hasOwnProperty(name)) {
+        this.log('Note: Overriding existing resource ' + name);
+        this.log('Ow: ', this.res[name]);
+        this.log('By: ', resource);
+
+    }
+    if (resource.type) {
+        this.log('No type defined for ' + name);
+    }
+
+    this.res[name] = resource;
+
+    return (resource);
+};
+
+
+DstEng.prototype.startLoader = function() {
+
+    this.addRes('glPrg', this.createProgram(this.gl, this.res.shader_vertex2d.shader, this.res.shader_fragment2d.shader));
+    this.addRes('glPrgSat', this.createProgram(this.gl, this.res.shader_vertex2d.shader, this.res.shader_fragment2d_sat.shader));
+
+    //this.gl.useProgram( this.res.glPrg.program );
+
+    // The idea is to have:
+    // DrawGroups, each member of this group will be drawn using the same program
+    //  - PolyGroups, each member will be drawn using the same program and vertex geometry
+    //     - TexGroups, each member will be drawn using the same program, vertex, geometry and texture, it will contain an array of texCoord arrays to be used
+    //        - Sprite, each sprite will be drawn at a desired position, using the desired texCoord array, optional array of program params may be supplied
+    // Usage:
+    // Create a vertexbuffers
+    // Create a dg
+    // Create a pg and add to dg
+    // Create a tg and add to pg
+    // Create a sp and add to tg
+    // draw dgs
+
+    // "Add object: thisProgram, thatimage, " = { dg, pg, tg, sp } ?
+
+
+    /*...*/
+
+    var texture = new this.Texture(this.gl, {
+        img: this.res.img_DstEng,
+        cut: [0, 0, 160, 120],
+        numFrames: 1,
+        animate: false,
+        frameTime: 0
+    });
+
+
+
+
+    var drawGroup = new this.DrawGroup(this.gl, this.res.glPrg);
+
+
+
+    var w = 320,
+        h = 240;
+
+    var polyBuffer = this.gl.createBuffer();
+    this.gl.bindBuffer(this.gl.ARRAY_BUFFER, polyBuffer);
+    this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array([
+        0, 0,
+        0.0, 0.0,
+        w, 0,
+        1.0, 0.0,
+        0, h,
+        0.0, 1.0,
+        0, h,
+        0.0, 1.0,
+        w, 0,
+        1.0, 0.0,
+        w, h,
+        1.0, 1.0
+    ]), this.gl.STATIC_DRAW);
+
+    var brick = this.gl.createBuffer();
+    this.gl.bindBuffer(this.gl.ARRAY_BUFFER, brick);
+    w = h = 20;
+    var glw = 20 / 480;
+    this.gl.bufferData(this.gl.ARRAY_BUFFER, new Float32Array([
+        0, 0,
+        0.0, 0.0,
+        w, 0,
+        glw, 0.0,
+        0, h,
+        0.0, 1.0,
+        0, h,
+        0.0, 1.0,
+        w, 0,
+        glw, 0.0,
+        w, h,
+        glw, 1.0
+    ]), this.gl.STATIC_DRAW);
+
+    var bricks = new this.PolyGroup(brick);
+    var brickTex = new this.Texture(this.gl, {
+        img: this.res.img_tiles,
+        cut: [0, 0, 20, 20],
+        numFrames: 10,
+        frameTime: 100,
+        animate: true
+    });
+
+
+
+    var brickTexGroup = new this.TexGroup(brickTex);
+
+    var sprite;
+
+    var audio = this.audio;
+
+    this.Sprite.prototype.animate = function() {
+        this.pos[0] += this.vx * timeScale;
+        this.pos[1] += this.vy * timeScale;
+
+        if (this.pos[0] < 0) {
+            this.pos[0] = 0;
+            this.vx *= -1;
+            audio.play(0);
+            this.frameGridPos[0]++;
+            if (this.frameGridPos[0] > 9) {
+                this.frameGridPos[0] = 0;
+            }
+        } else if (this.pos[0] > 320 - 20) {
+            this.pos[0] = 320 - 20;
+            this.vx *= -1;
+            //            this.frameGridPos = [Math.floor(Math.random() * 10), 0];
+            this.frameGridPos[0]++;
+            if (this.frameGridPos[0] > 9) {
+                this.frameGridPos[0] = 0;
+            }
+        }
+
+        if (this.pos[1] < 0) {
+            this.frameGridPos[0]++;
+            if (this.frameGridPos[0] > 9) {
+                this.frameGridPos[0] = 0;
+            }
+            //          this.frameGridPos = [Math.floor(Math.random() * 10), 0];
+            this.pos[1] = 0;
+            this.vy *= -1;
+        } else if (this.pos[1] > 240 - 20) {
+            //        this.frameGridPos = [Math.floor(Math.random() * 10), 0];
+            this.frameGridPos[0]++;
+            if (this.frameGridPos[0] > 9) {
+                this.frameGridPos[0] = 0;
+            }
+            this.pos[1] = 240 - 20;
+            this.vy *= -1;
+        }
+
+    };
+
+    for (var i = 0; i < 10; ++i) {
+        sprite = new this.Sprite([300, 220]);
+        sprite.frameGridPos = [Math.floor(Math.random() * 10), 0];
+        sprite.vx = Math.random() * 16 - 8;
+        sprite.vy = Math.random() * 16 - 8;
+
+        // sprite.animate = animate.bind(sprite);
+        brickTexGroup.addSprite(sprite);
+    }
+
+
+    bricks.addTexGroup(brickTexGroup);
+
+    var backgrounds = new this.PolyGroup(polyBuffer);
+
+    drawGroup.addPolyGroup(backgrounds);
+
+    drawGroup.addPolyGroup(bricks);
+
+    var bgTexSingle = new this.TexGroup(texture);
+
+
+    //Add an empty s
+    bgTexSingle.addSprite(new this.Sprite());
+
+
+    backgrounds.addTexGroup(bgTexSingle);
+
+
+
+
+    this.dg = drawGroup;
+
+
+
+    this.drawFrame();
+    //Say we are ready
+    this.cfg.readyCallback(true);
+};
+
+DstEng.prototype.Texture = (function() {
+    function Tex(gl, setup) {
+
+        if (!gl) {
+            throw Error('Need gl');
+        }
+
+        if (!setup.img.resType) {
+            throw Error('Required: img.');
+        }
+
+        if (!setup.img.image || !setup.img.image.height) {
+            throw Error('Invalid or no image in setup.img');
+        }
+
+        this.w = setup.img.image.width;
+        this.h = setup.img.image.height;
+
+        this.numFrames = setup.numFrames || 1;
+        this.animate = setup.animate || false;
+        this.frameTime = setup.frameTime || false;
+
+        this.pxCut = setup.cut || [0, 0, this.w, this.h];
+
+        this.glTex = setup.img.texture;
+
+        this.glFrameSize = new Float32Array([(this.pxCut[2] / this.w), (this.pxCut[3] / this.h)]);
+
+    }
+
+    return Tex;
+}());
+
+DstEng.prototype.DrawGroup = (function() {
+    function Dg(gl, prgInfo) {
+        this.prgInfo = prgInfo;
+        this.polyGroups = [];
+    }
+
+    Dg.prototype.addPolyGroup = function(pg) {
+        this.polyGroups.push(pg);
+    };
+
+    Dg.prototype.draw = function(gl) {
+
+        //Program is same for all drawGroups
+        var prgInfo = this.prgInfo;
+        gl.useProgram(prgInfo.program);
+
+        this.polyGroups.forEach(function drawPolyGroup(pg) {
+
+            //VertexBuffer is the same for a polygroup
+            gl.bindBuffer(gl.ARRAY_BUFFER, pg.buffer);
+            gl.vertexAttribPointer(prgInfo.a_pos, 2, gl.FLOAT, false, pg.stride, pg.vertexOffset);
+            gl.vertexAttribPointer(prgInfo.a_texCoord, 2, gl.FLOAT, false, pg.stride, pg.texCoordOffset);
+
+            pg.texGroups.forEach(function drawTexGroup(tg) {
+                //Texture is the same for each texGroup
+                gl.bindTexture(gl.TEXTURE_2D, tg.texture.glTex);
+
+                gl.uniform2fv(prgInfo.u_frameSize, tg.texture.glFrameSize);
+                tg.sprites.forEach(function drawSprite(spr) {
+                    //Set geometry location and texture location
+                    if (spr.vx) spr.animate();
+
+                    gl.uniform2fv(prgInfo.u_translation, spr.pos);
+                    gl.uniform2fv(prgInfo.u_frameGridPos, spr.frameGridPos);
+
+
+
+                    gl.drawArrays(gl.TRIANGLES, 0, 6);
+                });
+            });
+        });
+    };
+
+    return Dg;
+}());
+
+DstEng.prototype.PolyGroup = (function() {
+    function Pg(buffer) {
+        this.buffer = buffer;
+        this.vertexOffset = 0;
+        this.texCoordOffset = Float32Array.BYTES_PER_ELEMENT * 2;
+        this.stride = Float32Array.BYTES_PER_ELEMENT * 4;
+        this.texGroups = [];
+    }
+
+    Pg.prototype.addTexGroup = function(tg) {
+        this.texGroups.push(tg);
+    };
+
+    return Pg;
+}());
+
+DstEng.prototype.TexGroup = (function() {
+    function Tg(texture) {
+        this.texture = texture;
+        this.sprites = [];
+    }
+
+    Tg.prototype.addSprite = function(spr) {
+        this.sprites.push(spr);
+    };
+
+    return Tg;
+}());
+
+
+DstEng.prototype.Sprite = (function() {
+    function Spr() {
+        this.pos = new Float32Array([0, 0]);
+        this.frameGridPos = [0, 0];
+    }
+
+    Spr.prototype.setPos = function(pos) {
+        this.pos = pos;
+    };
+
+    return Spr;
+}());
+
+
+
+DstEng.prototype.drawFrame = function(timeStamp) {
+
+    if (timeStamp) {
+        this.state.timeDelta = timeStamp - this.state.lastTime;
+        this.state.lastTime = timeStamp;
+    } else {
+        this.state.timeDelta = 16.0;
+        this.state.lastTime = performance.now();
+        console.log('aa', this.state.timeDelta, this.state.lastTime);
+    }
+
+
+    timeScale = this.state.timeDelta / 16.00;
+    this.accTs += timeScale;
+
+
+    this.state.frame++;
+    this.state.time += this.state.timeDelta;
+
+
+    if (timeScale > 10) {
+        console.log('warning, timescale is large', timeScale);
+    }
+
+
+    /*    if (this.state.frame % 60 === 0) {
+            this.state.fps = 1000 / this.state.timeDelta;
+            console.log(this.state.fps, (1000.0 / (this.state.time / this.state.frame)), this.state.time - timeStamp, this.state.frame, this.accTs / this.state.frame);
+        }*/
+
+
+    //  this.spr.pos = this.state.pointer.pos;
+    //    this.spr.frameGridPos = [ Math.floor(this.state.pointer.pos[0]) % 10, 0 ];
+    this.dg.draw(this.gl);
+
+    this.drawFrameRequestId = window.requestAnimationFrame(this.drawFrame.bind(this));
+
+};
\ No newline at end of file
diff --git a/game/src/DstEng2.js b/game/src/DstEng2.js
new file mode 100644 (file)
index 0000000..68b01e9
--- /dev/null
@@ -0,0 +1,632 @@
+/* globals $ */
+
+var timeScale = 1;
+
+function DstEng(config) {
+    this.accTs = 0;
+    this.res = {};
+
+    this.drawGroups = [];
+
+    this.timeScale = 1.0;
+
+    this.state = {
+        timeDelta: 0,
+        tdAvg: 0.0,
+        lastTime: 0,
+        frame: 0,
+        virtRes: [320, 240],
+        pointer: {
+            pos: [0, 0],
+            down: false
+        }
+    };
+
+
+    var ok = true;
+    this.cfg = config;
+
+    this.log("DstEng Startup:", this.cfg);
+
+    this.cfg.screen.width = this.cfg.width;
+    this.cfg.screen.height = this.cfg.height;
+
+    if (this.initGl()) {
+        this.log("Configured gl rendering");
+    } else {
+        this.log("Fail, no rendering available");
+        ok = false;
+    }
+
+    if (ok) {
+        this.preLoad();
+    } else {
+        this.cfg.readyCallback(false);
+    }
+
+
+
+}
+
+DstEng.prototype.log = function() {
+    console.log.apply(console, arguments);
+};
+
+DstEng.prototype.initGl = function() {
+    try {
+        this.gl = this.cfg.screen.getContext("experimental-webgl");
+        this.gl.viewportWidth = this.cfg.screen.width;
+        this.gl.viewportHeight = this.cfg.screen.height;
+    } catch (e) {}
+
+    return !!this.gl;
+};
+
+
+
+DstEng.prototype.isPowerOf2 = function(value) {
+    return (value & (value - 1)) === 0;
+};
+
+DstEng.prototype.setupTextureFiltering = function(width, height) {
+    if (this.isPowerOf2(width) && this.isPowerOf2(height)) {
+        // the dimensions are power of 2 so generate mips and turn on 
+        // tri-linear filtering.
+        this.gl.generateMipmap(this.gl.TEXTURE_2D);
+        //             this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR_MIPMAP_LINEAR);
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.NEAREST_MIPMAP_NEAREST);
+    } else {
+        // at least one of the dimensions is not a power of 2 so set the filtering
+        // so WebGL will render it.
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_S, this.gl.CLAMP_TO_EDGE);
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_WRAP_T, this.gl.CLAMP_TO_EDGE);
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MIN_FILTER, this.gl.LINEAR);
+        this.gl.texParameteri(this.gl.TEXTURE_2D, this.gl.TEXTURE_MAG_FILTER, this.gl.NEAREST);
+    }
+};
+
+
+DstEng.prototype.imgLoader = function(obj, cb) {
+
+    var image = new Image();
+    image.src = obj.url;
+    image.addEventListener('load', function() {
+
+        var texture = this.gl.createTexture();
+        this.gl.bindTexture(this.gl.TEXTURE_2D, texture);
+        // Fill the texture with a 1x1 blue pixel.
+        this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, 1, 1, 0, this.gl.RGBA, this.gl.UNSIGNED_BYTE,
+            new Uint8Array([0, 0, 255, 255]));
+        // Asynchronously load an image
+
+        this.gl.bindTexture(this.gl.TEXTURE_2D, texture);
+        this.gl.texImage2D(this.gl.TEXTURE_2D, 0, this.gl.RGBA, this.gl.RGBA, this.gl.UNSIGNED_BYTE, image);
+
+        this.setupTextureFiltering(image.width, image.height);
+
+        cb({
+            valid: true,
+            resType: 'img',
+            image: image,
+            texture: texture
+        });
+    }.bind(this));
+    image.addEventListener('error', function(e) {
+        cb({
+            valid: false,
+            error: 'Could not load the image'
+        });
+    });
+};
+
+DstEng.prototype.compileShader = function(gl, shaderSource, shaderType) {
+    // Create the shader object
+    var obj = {
+        valid: true
+    };
+    var shader = gl.createShader(shaderType);
+
+
+    // Set the shader source code.
+    gl.shaderSource(shader, shaderSource);
+
+    // Compile the shader
+    gl.compileShader(shader);
+
+    // Check if it compiled
+    var success = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
+    if (!success) {
+        // Something went wrong during compilation; get the error
+        obj.valid = false;
+        obj.error = 'Compilation failed: ' + gl.getShaderInfoLog(shader);
+
+    } else {
+        obj.shaderType = shaderType;
+        obj.resType = (shaderType === gl.FRAGMENT_SHADER) ? 'fragment_shader' : 'vertex_shader';
+        obj.shader = shader;
+    }
+
+    return obj;
+};
+
+DstEng.prototype.createProgram = function(gl, vertexShader, fragmentShader) {
+    // create a program.
+    var program = gl.createProgram();
+
+    // attach the shaders.
+    gl.attachShader(program, vertexShader);
+    gl.attachShader(program, fragmentShader);
+
+    // link the program.
+    gl.linkProgram(program);
+
+    // Check if it linked.
+    var success = gl.getProgramParameter(program, gl.LINK_STATUS);
+    if (!success) {
+        // something went wrong with the link
+        throw ("program failed to link:" + gl.getProgramInfoLog(program));
+    }
+
+    var resObj = {
+        resType: 'shader_program',
+        program: program,
+        a_texCoord: gl.getAttribLocation(program, "a_texCoord"),
+        a_pos: gl.getAttribLocation(program, "a_position"),
+        u_frameSize: gl.getUniformLocation(program, "u_frameSize"),
+        u_frameGridPos: gl.getUniformLocation(program, "u_frameGridPos"),
+        u_res: gl.getUniformLocation(program, "u_resolution"),
+        u_translation: gl.getUniformLocation(program, "u_translation")
+    };
+
+    //Enable textures and verticies for out programs
+    gl.enableVertexAttribArray(resObj.a_pos);
+    gl.enableVertexAttribArray(resObj.a_texCoord);
+
+    //Set default resolution
+    gl.useProgram(program);
+    gl.uniform2fv(resObj.u_res, this.state.virtRes);
+
+    return resObj;
+};
+
+
+DstEng.prototype.shaderLoader = function(obj, cb) {
+    $.ajax({
+        url: obj.url,
+        dataType: 'text',
+        success: function(data) {
+            cb(this.compileShader(this.gl, data, obj.shaderType));
+        }.bind(this),
+        error: function(e) {
+            cb({
+                valid: false,
+                error: e.status + ' ' + e.statusText
+            });
+        }
+    });
+};
+
+
+DstEng.prototype.resLoader = function(loadList, done) {
+    var left = loadList.length;
+    var loaded = 0;
+
+    loadList.forEach(function(r) {
+        r.loader(r, function(data) {
+            if (data) {
+                this.addRes(r.name, data);
+                loaded++;
+            }
+            left--;
+
+            if (!data.valid) {
+                this.log('Resource loading failed for "' + r.name + '" from "' + r.url + '" error:', data.error);
+            }
+            if (left === 0) {
+                done((loaded != loadList.length));
+            }
+        }.bind(this));
+    }, this);
+};
+
+DstEng.prototype.preLoad = function() {
+    var res = [{
+            name: 'img_DstEng',
+            url: '/data/img/DstEng.jpg',
+            loader: this.imgLoader.bind(this)
+        }, {
+            name: 'img_tiles',
+            url: '/data/packs/000_wizznic/themes/thor/tiles/thor.png',
+            loader: this.imgLoader.bind(this)
+        }, {
+            name: 'shader_vertex2d',
+            url: '/data/gl/2d_vertex.js',
+            shaderType: this.gl.VERTEX_SHADER,
+            loader: this.shaderLoader.bind(this)
+        }, {
+            name: 'shader_fragment2d',
+            url: '/data/gl/2d_fragment.js',
+            shaderType: this.gl.FRAGMENT_SHADER,
+            loader: this.shaderLoader.bind(this)
+        }, {
+            name: 'shader_fragment2d_sat',
+            url: '/data/gl/2d_fragment_sat.js',
+            shaderType: this.gl.FRAGMENT_SHADER,
+            loader: this.shaderLoader.bind(this)
+        }
+
+    ];
+
+    this.resLoader(res, function(err) {
+        if (!err) {
+            this.startLoader();
+        } else {
+            this.cfg.readyCallback(true);
+        }
+    }.bind(this));
+
+
+};
+
+DstEng.prototype.realCoordsToGl = function(evt) {
+    var r = this.cfg.screen.getBoundingClientRect();
+    var sx = this.state.virtRes[0] / this.cfg.screen.width;
+    var sy = this.state.virtRes[1] / this.cfg.screen.height;
+    return ([(evt.clientX - r.left) * sx, (evt.clientY - r.top) * sy]);
+};
+
+DstEng.prototype.setPointerState = function(e) {
+    this.state.pointer.pos = this.realCoordsToGl(e);
+};
+
+
+DstEng.prototype.onMouseMove = function(cb) {
+    this.cfg.screen.addEventListener('mousemove', function(e) {
+        this.setPointerState(e);
+        cb(this.state.pointer);
+    }.bind(this));
+};
+
+DstEng.prototype.onMouseClick = function(cb) {
+    this.cfg.screen.addEventListener('mousedown', function(e) {
+        this.setPointerState(e);
+        this.state.pointer.down = true;
+        cb(this.state.pointer);
+    }.bind(this));
+
+    this.cfg.screen.addEventListener('mouseup', function(e) {
+        this.setPointerState(e);
+        this.state.pointer.down = false;
+        cb(this.state.pointer);
+    }.bind(this));
+};
+
+
+DstEng.prototype.randomInt = function(range) {
+    return Math.floor(Math.random() * range);
+};
+
+DstEng.prototype.addRes = function(name, resource) {
+
+    if (this.res.hasOwnProperty(name)) {
+        this.log('Note: Overriding existing resource ' + name);
+        this.log('old: ', this.res[name]);
+        this.log('new: ', resource);
+
+    }
+    if (resource.type) {
+        this.log('No type defined for ' + name);
+    }
+
+    this.res[name] = resource;
+
+    return (resource);
+};
+
+
+DstEng.prototype.startLoader = function() {
+
+    this.addRes('glPrg', this.createProgram(this.gl, this.res.shader_vertex2d.shader, this.res.shader_fragment2d.shader));
+    this.addRes('glPrgSat', this.createProgram(this.gl, this.res.shader_vertex2d.shader, this.res.shader_fragment2d_sat.shader));
+
+    //this.gl.useProgram( this.res.glPrg.program );
+
+    // The idea is to have:
+    // DrawGroup (program)
+    //  - SpriteGroup (vertex, tex)
+    //    - Sprite, each sprite will be drawn at a desired position, using the desired texCoord array, optional array of program params may be supplied
+    // Usage:
+    // Create a vertexbuffer
+    // Create a dg
+    // Create a sg and add to dg
+    // Create a sp and add to sg
+    // draw dg
+
+    // newSprite( program, tex ) = { dg, sg, sp }
+    // newPsys( program, tex, type )
+
+
+    /*...*/
+
+    var texture = new this.Texture(this.gl, {
+        img: this.res.img_DstEng,
+        cut: [0, 0, 320, 240],
+        numFrames: 1,
+        animate: false,
+        frameTime: 0
+    });
+
+    var brickTex = new this.Texture(this.gl, {
+        img: this.res.img_tiles,
+        cut: [20, 0, 40, 20],
+        numFrames: 10,
+        frameTime: 100,
+        animate: true
+    });
+
+
+    var sprInfo = this.newSprite(this.gl, this.res.glPrg, texture, [0, 0]);
+
+
+
+    this.Sprite.prototype.aniCallback = function(ts) {
+        this.pos[0]+= this.vl[0]*ts;
+        this.pos[1]+= this.vl[1]*ts;
+        if(this.pos[0] > 320-this.size[0]) {
+            this.pos[0]=320-this.size[0];
+            this.vl[0] *= -1;
+            this.frameGridPos = [ this.frameGridPos[0]+1, 0 ];
+            if( this.frameGridPos[0] > 10 ) {
+                this.frameGridPos[0]=0;
+            }
+        } else if(this.pos[0] < 0) {
+            this.pos[0]=0;
+            this.vl[0] *= -1;
+        }
+        
+        if(this.pos[1] > 240-this.size[1]) {
+            this.pos[1]=240-this.size[1];
+            this.vl[1] *= -1;
+        } else if(this.pos[1] < 0) {
+            this.pos[1]=0;
+            this.vl[1] *= -1;
+        }
+        
+    };
+    
+    for(var i=0; i < 1000;++i) {
+        sprInfo.sp.vl = [Math.random()*4-2,Math.random()*4-2];
+        sprInfo = this.newSprite(this.gl, this.res.glPrg, brickTex, [160, 120]);
+    }
+
+
+    //
+
+    //Say we are ready
+    this.cfg.readyCallback(true);
+    
+    this.drawFrame();
+};
+
+DstEng.prototype.newSprite = function(gl, program, tex, pos) {
+
+    var useDg = null;
+    var useSg = null;
+
+    //Find dg using this program
+    for (var dgi = 0, dgl = this.drawGroups.length; dgi < dgl; ++dgi) {
+        if (this.drawGroups[dgi].prgInfo === program) {
+            useDg = this.drawGroups[dgi];
+            break;
+        }
+    }
+
+    if (!useDg) {
+        useDg = new this.DrawGroup(program);
+        this.drawGroups.push(useDg);
+    }
+
+    //Find sg using this texture
+    for (var sgi = 0, sgl = useDg.spriteGroups.length; sgi < sgl; ++sgi) {
+        if (useDg.spriteGroups[sgi].tex === tex) {
+            useSg = useDg.spriteGroups[sgi];
+            break;
+        }
+    }
+
+    if (!useSg) {
+        useSg = new this.SpriteGroup(gl, tex);
+        useDg.addSpriteGroup(useSg);
+    }
+
+    var sprite = useSg.addSprite(new this.Sprite(pos));
+
+    return {
+        dg: useDg,
+        sg: useSg,
+        sp: sprite
+    };
+};
+
+
+DstEng.prototype.Texture = (function() {
+    function Tex(gl, setup) {
+
+        if (!gl) {
+            throw Error('Need gl');
+        }
+
+        if (!setup.img.resType) {
+            throw Error('Required: img.');
+        }
+
+        if (!setup.img.image || !setup.img.image.height) {
+            throw Error('Invalid or no image in setup.img');
+        }
+
+        this.w = setup.img.image.width;
+        this.h = setup.img.image.height;
+
+        this.numFrames = setup.numFrames || 1;
+        this.animate = setup.animate || false;
+        this.frameTime = setup.frameTime || false;
+
+        this.pxFrameSize = [setup.cut[2] - setup.cut[0], setup.cut[3] - setup.cut[1]] || [this.w, this.h];
+
+        this.glTex = setup.img.texture;
+
+        this.glFrameSize = new Float32Array([(this.pxFrameSize[0] / this.w), (this.pxFrameSize[1] / this.h)]);
+
+        this.glCut = [
+            setup.cut[2] / this.w, setup.cut[3] / this.h,
+            setup.cut[0] / this.w, setup.cut[1] / this.h
+        ];
+
+    }
+
+    return Tex;
+}());
+
+DstEng.prototype.DrawGroup = (function() {
+    function Dg(prgInfo) {
+        this.prgInfo = prgInfo;
+        this.spriteGroups = [];
+    }
+
+    Dg.prototype.addSpriteGroup = function(pg) {
+        this.spriteGroups.push(pg);
+    };
+
+    Dg.prototype.draw = function(gl, timeScale) {
+
+        timeScale = timeScale || 1.0;
+
+        //Program is same for all drawGroups
+        var prgInfo = this.prgInfo;
+        gl.useProgram(prgInfo.program);
+
+        for (var sgi = 0, sgl = this.spriteGroups.length; sgi < sgl; ++sgi) {
+            var sg = this.spriteGroups[sgi];
+
+            //VertexBuffer shared by all sprites in group
+            gl.bindBuffer(gl.ARRAY_BUFFER, sg.buffer);
+            gl.vertexAttribPointer(prgInfo.a_pos, 2, gl.FLOAT, false, sg.stride, sg.vertexOffset);
+            gl.vertexAttribPointer(prgInfo.a_texCoord, 2, gl.FLOAT, false, sg.stride, sg.texCoordOffset);
+
+            //Texure info shared by all sprites in group
+            gl.bindTexture(gl.TEXTURE_2D, sg.texture.glTex);
+            gl.uniform2fv(prgInfo.u_frameSize, sg.texture.glFrameSize);
+
+            for (var spi = 0, spl = sg.sprites.length; spi < spl; ++spi) {
+
+                //Set geometry location and texture location
+                var spr = sg.sprites[spi];
+                if (spr.aniCallback) {
+                    spr.aniCallback(timeScale);
+                }
+
+                gl.uniform2fv(prgInfo.u_translation, spr.pos);
+                gl.uniform2fv(prgInfo.u_frameGridPos, spr.frameGridPos);
+                gl.drawArrays(gl.TRIANGLES, 0, 6);
+            }
+        }
+    };
+
+    return Dg;
+}());
+
+DstEng.prototype.SpriteGroup = (function() {
+    function Sg(gl, texture) {
+        this.buffer = gl.createBuffer();
+        var w = texture.pxFrameSize[0];
+        h = texture.pxFrameSize[1];
+
+        var glwa = texture.glCut[0];
+        var glha = texture.glCut[1];
+        var glwb = texture.glCut[2];
+        var glhb = texture.glCut[3];
+
+
+        gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer);
+        gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
+            0, 0,
+            glwb, glhb,
+            w, 0,
+            glwa, glhb,
+            0, h,
+            glwb, glha,
+            0, h,
+            glwb, glha,
+            w, 0,
+            glwa, glhb,
+            w, h,
+            glwa, glha
+        ]), gl.STATIC_DRAW);
+
+
+        this.vertexOffset = 0;
+        this.texCoordOffset = Float32Array.BYTES_PER_ELEMENT * 2;
+        this.stride = Float32Array.BYTES_PER_ELEMENT * 4;
+        this.texture = texture;
+        this.sprites = [];
+    }
+
+    Sg.prototype.addSprite = function(sprite) {
+        sprite.size = this.texture.pxFrameSize;
+        this.sprites.push(sprite);
+        return sprite;
+    };
+
+    return Sg;
+}());
+
+
+DstEng.prototype.Sprite = (function() {
+    function Spr(pos) {
+        this.pos = new Float32Array(pos);
+        this.frameGridPos = [0, 0];
+    }
+
+    Spr.prototype.setPos = function(pos) {
+        this.pos = pos;
+    };
+
+
+    return Spr;
+}());
+
+
+
+DstEng.prototype.drawFrame = function(timeStamp) {
+
+    timeStamp = timeStamp || 16.0;
+
+    this.state.timeDelta = timeStamp - this.state.lastTime;
+
+    this.timeScale = this.state.timeDelta / 16.00;
+    this.accTs += timeScale;
+    //  console.log(timeScale);
+
+    this.state.lastTime = timeStamp;
+
+    this.state.frame++;
+    this.state.tdAvg += this.state.timeDelta;
+
+
+
+
+    if (this.state.frame % 120 === 0) {
+        this.state.fps = 1000 / this.state.timeDelta;
+        console.log(this.state.fps, (1000.0 / (this.state.tdAvg / this.state.frame)), this.state.tdAvg - timeStamp, this.state.frame, this.accTs / this.state.frame);
+    }
+
+
+    //  this.spr.pos = this.state.pointer.pos;
+    //    this.spr.frameGridPos = [ Math.floor(this.state.pointer.pos[0]) % 10, 0 ];
+    
+
+    this.drawGroups[0].draw(this.gl, this.timeScale);
+
+    window.requestAnimationFrame(this.drawFrame.bind(this));
+
+};
\ No newline at end of file
diff --git a/game/src/Wizznic.js b/game/src/Wizznic.js
new file mode 100644 (file)
index 0000000..7c49096
--- /dev/null
@@ -0,0 +1,27 @@
+function Wizznic(dstEng) {
+       this.e = dstEng;
+
+       this.e.onMouseMove( this.onMouseMove.bind(this) );
+       this.e.onMouseClick( this.onMouseClick.bind(this) );
+       
+       //Start by loading the logo
+       
+       //Initialize starfield
+       
+       //enqueue starfield
+       
+       //load menu
+       
+       //load level0 game
+       
+       
+}
+
+Wizznic.prototype.onMouseMove = function(ptr) {
+       
+};
+
+Wizznic.prototype.onMouseClick = function(ptr) {
+
+};
+
diff --git a/package.json b/package.json
new file mode 100644 (file)
index 0000000..9047a20
--- /dev/null
@@ -0,0 +1,22 @@
+{
+  "name": "wizzniconline",
+  "version": "0.0.0",
+  "description": "'",
+  "main": "src/server.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1",
+    "start": "nodemon src/server.js"
+  },
+  "author": "",
+  "license": "ISC",
+  "dependencies": {
+    "express": "^4.13.4",
+    "express-ws": "^1.0.0-rc.2",
+    "grunt": "^0.4.5",
+    "grunt-contrib-jshint": "^0.12.0",
+    "grunt-js-beautify": "^0.1.4",
+    "js-beautify": "^1.5.10",
+    "jshint": "^2.9.1",
+    "nodemon": "^1.8.1"
+  }
+}
diff --git a/src/server.js b/src/server.js
new file mode 100644 (file)
index 0000000..f76b5aa
--- /dev/null
@@ -0,0 +1,20 @@
+var express = require('express');
+var app = express();
+var path = require('path');
+var expressWs = require('express-ws')(app); //app = express app 
+
+var webDir = path.normalize(__dirname + '/../game/');
+app.get('/', function(req, res){
+    res.sendFile(webDir+'index.htm');
+});
+app.use(express.static(webDir));
+
+app.ws('/', function(ws, req) {
+  ws.on('message', function(msg) {
+    console.log(msg + ws.upgradeReq.connection.remoteAddress);
+  });
+});
+
+console.log('Serving files from '+webDir);
+
+app.listen(3000);