Commits

Anonymous committed 0434e39

moved data into maze subproject

  • Participants
  • Parent commits a5882cd

Comments (0)

Files changed (48)

File Makefile

-SDL_OPTS=-libs bigarray,sdl,sdlloader,sdlttf,sdlmixer -cflags -I,+sdl -lflags -I,+sdl
-
-all: sdlmills
-
-clean:
-	rm -rf _build
-	rm *.native
-
-sdlmaze:
-	ocamlbuild -I maze ${SDL_OPTS} sdlmaze.native
-
-sdlmemory:
-	ocamlbuild -I memory ${SDL_OPTS} memory.native
-
-sdlmills:
-	ocamlbuild -I mills ${SDL_OPTS} sdlmills.native
-
-#uncomment when sdlloader becomes available to ocamlfind
-#ocamlbuild -I maze -use-ocamlfind -pkgs bigarray,sdl,sdl.sdlttf,sdl.sdlmixer,sdl.sdlloader sdlmaze.native

File data/maze/bullet/bullet_blue.png

Removed
Old image

File data/maze/bullet/bullet_dragon.png

Removed
Old image

File data/maze/bullet/bullet_green.png

Removed
Old image

File data/maze/bullet/bullet_orange.png

Removed
Old image

File data/maze/bullet/bullet_pink.png

Removed
Old image

File data/maze/bullet/bullet_purple.png

Removed
Old image

File data/maze/bullet/bullet_red.png

Removed
Old image

File data/maze/bullet/bullet_star.png

Removed
Old image

File data/maze/bullet/bullet_yellow.png

Removed
Old image

File data/maze/castle.png

Removed
Old image

File data/maze/dragon.png

Removed
Old image

File data/maze/flag/flag_blue.png

Removed
Old image

File data/maze/flag/flag_green.png

Removed
Old image

File data/maze/flag/flag_orange.png

Removed
Old image

File data/maze/flag/flag_pink.png

Removed
Old image

File data/maze/flag/flag_purple.png

Removed
Old image

File data/maze/flag/flag_red.png

Removed
Old image

File data/maze/flag/flag_yellow.png

Removed
Old image

File data/maze/knight.png

Removed
Old image

File data/maze/sfx/error.wav

Binary file removed.

File data/maze/sfx/failure.wav

Binary file removed.

File data/maze/sfx/step.wav

Binary file removed.

File data/maze/sfx/success.wav

Binary file removed.

File maze/images/bullet/bullet_blue.png

Added
New image

File maze/images/bullet/bullet_dragon.png

Added
New image

File maze/images/bullet/bullet_green.png

Added
New image

File maze/images/bullet/bullet_orange.png

Added
New image

File maze/images/bullet/bullet_pink.png

Added
New image

File maze/images/bullet/bullet_purple.png

Added
New image

File maze/images/bullet/bullet_red.png

Added
New image

File maze/images/bullet/bullet_star.png

Added
New image

File maze/images/bullet/bullet_yellow.png

Added
New image

File maze/images/castle.png

Added
New image

File maze/images/dragon.png

Added
New image

File maze/images/flag/flag_blue.png

Added
New image

File maze/images/flag/flag_green.png

Added
New image

File maze/images/flag/flag_orange.png

Added
New image

File maze/images/flag/flag_pink.png

Added
New image

File maze/images/flag/flag_purple.png

Added
New image

File maze/images/flag/flag_red.png

Added
New image

File maze/images/flag/flag_yellow.png

Added
New image

File maze/images/knight.png

Added
New image

File maze/sdlmaze.ml

 module Sfx = struct
   open Sdlmixer
   
+  let datadir = if Sys.file_exists "sfx" then "sfx/" else "maze/sfx/"
+  
   let step = ref None
   let error = ref None
   let failure = ref None
   let success = ref None
   
   let load () =
-    step := Some (loadWAV "data/maze/sfx/step.wav");
-    error := Some (loadWAV "data/maze/sfx/error.wav");
-    failure := Some (loadWAV "data/maze/sfx/failure.wav");
-    success := Some (loadWAV "data/maze/sfx/success.wav")
+    step := Some (loadWAV (datadir ^ "step.wav"));
+    error := Some (loadWAV (datadir ^ "error.wav"));
+    failure := Some (loadWAV (datadir ^ "failure.wav"));
+    success := Some (loadWAV (datadir ^ "success.wav"))
   
   let play sfxref = match !sfxref with
     | None -> failwith "sound not initialized"
   open Sdlvideo
   open Sdlloader
   
+  let datadir = if Sys.file_exists "images" then "images/" else "maze/images/"
   let tilesize = 32
   let colors = [|"blue";"green";"orange";"pink";"purple";"red";"yellow" |]
   
     colors.(index)
   
   let load color =
-    castle := Some (load_image "data/maze/castle.png");
-    knight := Some (load_image "data/maze/knight.png");
-    dragon := Some (load_image "data/maze/dragon.png");
-    flag := Some (load_image ("data/maze/flag/flag_" ^ color ^ ".png"));
-    star_bullet := Some (load_image "data/maze/bullet/bullet_star.png");
-    dragon_bullet := Some (load_image ("data/maze/bullet/bullet_dragon.png"));
-    player_bullet := Some (load_image
-        ("data/maze/bullet/bullet_" ^ color ^ ".png"))
+    castle := Some (load_image (datadir ^ "castle.png"));
+    knight := Some (load_image (datadir ^ "knight.png"));
+    dragon := Some (load_image (datadir ^ "dragon.png"));
+    flag := Some (load_image (datadir ^ "flag/flag_" ^ color ^ ".png"));
+    star_bullet := Some (load_image (datadir ^ "bullet/bullet_star.png"));
+    dragon_bullet := Some (load_image (datadir ^ "bullet/bullet_dragon.png"));
+    player_bullet := Some (load_image (datadir ^ "bullet/bullet_" ^ color ^ ".png"))
   
   let blit dst dst_rect imgref = match !imgref with
     | None -> failwith "image not initialized"

File maze/sfx/error.wav

Binary file added.

File maze/sfx/failure.wav

Binary file added.

File maze/sfx/step.wav

Binary file added.

File maze/sfx/success.wav

Binary file added.