diff --git a/.depend b/.depend
new file mode 100644
index 0000000..7daea29
--- /dev/null
+++ b/.depend
@@ -0,0 +1,368 @@
+player.o: src/player.c \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_main.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_stdinc.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_config.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_platform.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/begin_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/close_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_audio.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_error.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_endian.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mutex.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_thread.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_rwops.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cdrom.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cpuinfo.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_events.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_active.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keyboard.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keysym.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mouse.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_video.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_joystick.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_quit.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_loadso.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_timer.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_version.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_image.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ src/../include/game.h src/../include/../include/constant.h \
+ src/../include/../include/misc.h src/../include/../include/map.h \
+ src/../include/../include/player.h \
+ src/../include/../include/../include/constant.h \
+ src/../include/../include/bomb.h src/../include/../include/monsters.h \
+ src/../include/../include/flamme.h
+game_time.o: src/game_time.c src/../include/game_time.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_main.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_stdinc.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_config.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_platform.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/begin_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/close_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_audio.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_error.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_endian.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mutex.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_thread.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_rwops.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cdrom.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cpuinfo.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_events.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_active.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keyboard.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keysym.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mouse.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_video.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_joystick.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_quit.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_loadso.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_timer.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_version.h \
+ src/../include/constant.h
+flamme.o: src/flamme.c \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_main.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_stdinc.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_config.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_platform.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/begin_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/close_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_audio.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_error.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_endian.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mutex.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_thread.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_rwops.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cdrom.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cpuinfo.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_events.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_active.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keyboard.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keysym.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mouse.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_video.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_joystick.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_quit.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_loadso.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_timer.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_version.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_image.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ src/../include/game.h src/../include/../include/constant.h \
+ src/../include/../include/misc.h src/../include/../include/map.h \
+ src/../include/../include/player.h \
+ src/../include/../include/../include/constant.h \
+ src/../include/../include/bomb.h src/../include/../include/monsters.h \
+ src/../include/../include/flamme.h
+game.o: src/game.c src/../include/game.h \
+ src/../include/../include/constant.h src/../include/../include/misc.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_main.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_stdinc.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_config.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_platform.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/begin_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/close_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_audio.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_error.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_endian.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mutex.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_thread.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_rwops.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cdrom.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cpuinfo.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_events.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_active.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keyboard.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keysym.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mouse.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_video.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_joystick.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_quit.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_loadso.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_timer.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_version.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_image.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ src/../include/../include/map.h src/../include/../include/player.h \
+ src/../include/../include/../include/constant.h \
+ src/../include/../include/bomb.h src/../include/../include/monsters.h \
+ src/../include/../include/flamme.h src/../include/game_time.h \
+ src/../include/misc.h src/../include/player.h src/../include/bomb.h \
+ src/../include/monsters.h src/../include/flamme.h
+niveau.o: src/niveau.c \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_main.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_stdinc.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_config.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_platform.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/begin_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/close_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_audio.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_error.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_endian.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mutex.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_thread.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_rwops.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cdrom.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cpuinfo.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_events.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_active.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keyboard.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keysym.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mouse.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_video.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_joystick.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_quit.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_loadso.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_timer.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_version.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_image.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ src/../include/editeur.h src/../include/misc.h src/../include/constant.h \
+ src/../include/niveau.h
+misc.o: src/misc.c src/../include/misc.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_main.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_stdinc.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_config.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_platform.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/begin_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/close_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_audio.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_error.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_endian.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mutex.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_thread.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_rwops.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cdrom.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cpuinfo.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_events.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_active.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keyboard.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keysym.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mouse.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_video.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_joystick.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_quit.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_loadso.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_timer.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_version.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_image.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ src/../include/constant.h
+main.o: src/main.c \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_main.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_stdinc.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_config.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_platform.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/begin_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/close_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_audio.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_error.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_endian.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mutex.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_thread.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_rwops.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cdrom.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cpuinfo.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_events.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_active.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keyboard.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keysym.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mouse.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_video.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_joystick.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_quit.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_loadso.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_timer.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_version.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_image.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ src/../include/constant.h src/../include/game.h \
+ src/../include/../include/constant.h src/../include/../include/misc.h \
+ src/../include/../include/map.h src/../include/../include/player.h \
+ src/../include/../include/../include/constant.h \
+ src/../include/../include/bomb.h src/../include/../include/monsters.h \
+ src/../include/../include/flamme.h src/../include/game_time.h \
+ src/../include/editeur.h src/../include/niveau.h
+editeur.o: src/editeur.c \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_main.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_stdinc.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_config.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_platform.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/begin_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/close_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_audio.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_error.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_endian.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mutex.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_thread.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_rwops.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cdrom.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cpuinfo.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_events.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_active.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keyboard.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keysym.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mouse.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_video.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_joystick.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_quit.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_loadso.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_timer.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_version.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_image.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ src/../include/constant.h src/../include/editeur.h src/../include/map.h \
+ src/../include/misc.h
+monsters.o: src/monsters.c \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_main.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_stdinc.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_config.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_platform.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/begin_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/close_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_audio.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_error.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_endian.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mutex.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_thread.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_rwops.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cdrom.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cpuinfo.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_events.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_active.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keyboard.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keysym.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mouse.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_video.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_joystick.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_quit.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_loadso.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_timer.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_version.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_image.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ src/../include/game.h src/../include/../include/constant.h \
+ src/../include/../include/misc.h src/../include/../include/map.h \
+ src/../include/../include/player.h \
+ src/../include/../include/../include/constant.h \
+ src/../include/../include/bomb.h src/../include/../include/monsters.h \
+ src/../include/../include/flamme.h
+map.o: src/map.c \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_main.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_stdinc.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_config.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_platform.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/begin_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/close_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_audio.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_error.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_endian.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mutex.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_thread.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_rwops.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cdrom.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cpuinfo.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_events.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_active.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keyboard.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keysym.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mouse.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_video.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_joystick.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_quit.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_loadso.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_timer.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_version.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_image.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ src/../include/constant.h src/../include/map.h src/../include/misc.h \
+ src/../include/game_time.h src/../include/game.h \
+ src/../include/../include/constant.h src/../include/../include/misc.h \
+ src/../include/../include/map.h src/../include/../include/player.h \
+ src/../include/../include/../include/constant.h \
+ src/../include/../include/bomb.h src/../include/../include/monsters.h \
+ src/../include/../include/flamme.h
+bomb.o: src/bomb.c \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_main.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_stdinc.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_config.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_platform.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/begin_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/close_code.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_audio.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_error.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_endian.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mutex.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_thread.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_rwops.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cdrom.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_cpuinfo.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_events.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_active.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keyboard.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_keysym.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_mouse.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_video.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_joystick.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_quit.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_loadso.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_timer.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_version.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL_image.h \
+ /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/../../usr/include/SDL/SDL.h \
+ src/../include/game.h src/../include/../include/constant.h \
+ src/../include/../include/misc.h src/../include/../include/map.h \
+ src/../include/../include/player.h \
+ src/../include/../include/../include/constant.h \
+ src/../include/../include/bomb.h src/../include/../include/monsters.h \
+ src/../include/../include/flamme.h
diff --git a/Bomberman.cbp b/Bomberman.cbp
new file mode 100644
index 0000000..01f2e62
--- /dev/null
+++ b/Bomberman.cbp
@@ -0,0 +1,425 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Bomberman.depend b/Bomberman.depend
new file mode 100644
index 0000000..481eff8
--- /dev/null
+++ b/Bomberman.depend
@@ -0,0 +1,346 @@
+# depslib dependency file v1.0
+1275819069 source:c:\vincent\textes\enseirb\bomberman\bomberman\src\bomb.c
+
+
+
+ "SDL.h"
+ "SDL_image.h"
+ "../include/game.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl.h
+ "SDL_main.h"
+ "SDL_stdinc.h"
+ "SDL_audio.h"
+ "SDL_cdrom.h"
+ "SDL_cpuinfo.h"
+ "SDL_endian.h"
+ "SDL_error.h"
+ "SDL_events.h"
+ "SDL_loadso.h"
+ "SDL_mutex.h"
+ "SDL_rwops.h"
+ "SDL_thread.h"
+ "SDL_timer.h"
+ "SDL_video.h"
+ "SDL_version.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_main.h
+ "SDL_stdinc.h"
+ "begin_code.h"
+ "close_code.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_stdinc.h
+ "SDL_config.h"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ "begin_code.h"
+
+
+
+
+
+ "close_code.h"
+
+1255800464 c:\program files\codeblocks\sdl-1.2.14\include\sdl_config.h
+ "SDL_platform.h"
+
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_platform.h
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\begin_code.h
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\close_code.h
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_audio.h
+ "SDL_stdinc.h"
+ "SDL_error.h"
+ "SDL_endian.h"
+ "SDL_mutex.h"
+ "SDL_thread.h"
+ "SDL_rwops.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_error.h
+ "SDL_stdinc.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_endian.h
+ "SDL_stdinc.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_mutex.h
+ "SDL_stdinc.h"
+ "SDL_error.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_thread.h
+ "SDL_stdinc.h"
+ "SDL_error.h"
+ "SDL_mutex.h"
+ "begin_code.h"
+
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_rwops.h
+ "SDL_stdinc.h"
+ "SDL_error.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_cdrom.h
+ "SDL_stdinc.h"
+ "SDL_error.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_cpuinfo.h
+ "SDL_stdinc.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_events.h
+ "SDL_stdinc.h"
+ "SDL_error.h"
+ "SDL_active.h"
+ "SDL_keyboard.h"
+ "SDL_mouse.h"
+ "SDL_joystick.h"
+ "SDL_quit.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_active.h
+ "SDL_stdinc.h"
+ "SDL_error.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_keyboard.h
+ "SDL_stdinc.h"
+ "SDL_error.h"
+ "SDL_keysym.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_keysym.h
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_mouse.h
+ "SDL_stdinc.h"
+ "SDL_error.h"
+ "SDL_video.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_video.h
+ "SDL_stdinc.h"
+ "SDL_error.h"
+ "SDL_rwops.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_joystick.h
+ "SDL_stdinc.h"
+ "SDL_error.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_quit.h
+ "SDL_stdinc.h"
+ "SDL_error.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_loadso.h
+ "SDL_stdinc.h"
+ "SDL_error.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_timer.h
+ "SDL_stdinc.h"
+ "SDL_error.h"
+ "begin_code.h"
+ "close_code.h"
+
+1255800450 c:\program files\codeblocks\sdl-1.2.14\include\sdl_version.h
+ "SDL_stdinc.h"
+ "begin_code.h"
+ "close_code.h"
+
+1258246278 c:\program files\codeblocks\sdl-1.2.14\include\sdl_image.h
+ "SDL.h"
+ "SDL_version.h"
+ "begin_code.h"
+ "close_code.h"
+
+1275650570 c:\vincent\textes\enseirb\bomberman\bomberman\include\game.h
+
+ "../include/constant.h"
+ "../include/misc.h"
+ "../include/map.h"
+ "../include/player.h"
+ "../include/bomb.h"
+ "../include/monsters.h"
+ "../include/flamme.h"
+
+1275757102 c:\vincent\textes\enseirb\bomberman\bomberman\include\constant.h
+
+1270050516 c:\vincent\textes\enseirb\bomberman\bomberman\include\misc.h
+
+
+
+
+ "SDL.h"
+ "SDL_image.h"
+
+1275395843 c:\vincent\textes\enseirb\bomberman\bomberman\include\map.h
+
+
+ "SDL.h"
+ "SDL_image.h"
+
+1274546933 c:\vincent\textes\enseirb\bomberman\bomberman\include\player.h
+
+
+ "SDL.h"
+ "SDL_image.h"
+ "../include/constant.h"
+
+1274106383 c:\vincent\textes\enseirb\bomberman\bomberman\include\bomb.h
+
+
+ "SDL.h"
+ "SDL_image.h"
+ "../include/constant.h"
+
+1274650779 c:\vincent\textes\enseirb\bomberman\bomberman\include\monsters.h
+
+
+ "SDL.h"
+ "SDL_image.h"
+ "../include/constant.h"
+
+1273580077 c:\vincent\textes\enseirb\bomberman\bomberman\include\flamme.h
+
+
+ "SDL.h"
+ "SDL_image.h"
+ "../include/constant.h"
+
+1275863168 source:c:\vincent\textes\enseirb\bomberman\bomberman\src\editeur.c
+
+
+
+ "SDL_image.h"
+ "../include/constant.h"
+ "../include/editeur.h"
+ "../include/map.h"
+ "../include/misc.h"
+
+1274529286 c:\vincent\textes\enseirb\bomberman\bomberman\include\editeur.h
+
+1275819057 source:c:\vincent\textes\enseirb\bomberman\bomberman\src\flamme.c
+
+
+
+ "SDL.h"
+ "SDL_image.h"
+ "../include/game.h"
+
+1275893015 source:c:\vincent\textes\enseirb\bomberman\bomberman\src\game.c
+
+
+
+ "../include/game.h"
+ "../include/game_time.h"
+ "../include/misc.h"
+ "../include/player.h"
+ "../include/bomb.h"
+ "../include/monsters.h"
+ "../include/flamme.h"
+
+1271699230 c:\vincent\textes\enseirb\bomberman\bomberman\include\game_time.h
+
+
+1275819045 source:c:\vincent\textes\enseirb\bomberman\bomberman\src\game_time.c
+ "../include/game_time.h"
+ "../include/constant.h"
+
+1275870093 source:c:\vincent\textes\enseirb\bomberman\bomberman\src\main.c
+
+
+
+
+
+
+
+ "../include/game.h"
+ "../include/game_time.h"
+ "../include/editeur.h"
+ "../include/niveau.h"
+
+1275819034 source:c:\vincent\textes\enseirb\bomberman\bomberman\src\map.c
+
+
+
+
+ "SDL_image.h"
+
+ "../include/constant.h"
+ "../include/map.h"
+ "../include/misc.h"
+ "../include/game_time.h"
+ "../include/game.h"
+
+1275819030 source:c:\vincent\textes\enseirb\bomberman\bomberman\src\misc.c
+ "../include/misc.h"
+ "../include/constant.h"
+
+1275819025 source:c:\vincent\textes\enseirb\bomberman\bomberman\src\monsters.c
+
+
+
+ "SDL.h"
+ "SDL_image.h"
+ "../include/game.h"
+
+1275819015 source:c:\vincent\textes\enseirb\bomberman\bomberman\src\player.c
+
+
+
+ "SDL.h"
+ "SDL_image.h"
+ "../include/game.h"
+
+1275649538 c:\vincent\textes\enseirb\bomberman\bomberman\include\niveau.h
+
+1275862812 source:c:\vincent\textes\enseirb\bomberman\bomberman\src\niveau.c
+
+
+
+ "SDL_image.h"
+ "../include/editeur.h"
+ "../include/misc.h"
+ "../include/constant.h"
+ "../include/niveau.h"
+
diff --git a/Bomberman.layout b/Bomberman.layout
new file mode 100644
index 0000000..e33cf04
--- /dev/null
+++ b/Bomberman.layout
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..deb1119
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,47 @@
+CC = $(CROSS_COMPILE)gcc -g
+
+
+TARGET_FUNKEY ?= 1
+
+
+ifeq ($(TARGET_FUNKEY),1)
+ SDL_INCLUDES = $(shell /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/sdl-config --cflags)
+ SDL_LIBS = $(shell /opt/FunKey-sdk-2.0.0/arm-funkey-linux-musleabihf/sysroot/usr/bin/sdl-config --libs) -Wl,--as-needed -Wl,--gc-sections -Wl,-O1,--sort-common -flto -s
+else
+ SDL_INCLUDES = `sdl-config --cflags`
+ SDL_LIBS = `sdl-config --libs`
+endif
+
+DEPFLAGS = $(SDL_INCLUDES)
+CFLAGS = -Wall -O -std=c99 $(SDL_INCLUDES)
+LDFLAGS = $(SDL_LIBS) -lSDL_image -lSDL_mixer
+
+SRC = $(wildcard src/*.c)
+OBJ = $(SRC:.c=.o)
+EXEC = bomber
+
+
+.PHONY: all dep clean mrproper
+
+all : dep $(EXEC)
+dep: .depend
+.depend: $(SRC)
+ @touch .depend
+ $(CC) -MM $(DEPFLAGS) $(SRC) > $@
+
+$(EXEC): $(OBJ)
+ $(CC) -o $@ $^ $(LDFLAGS)
+
+%.o: %.c
+ $(CC) -c $(CFLAGS) $< -o $@
+
+clean:
+ -rm -f *~ $(OBJ)
+
+mrproper: clean
+ -rm -f *~ $(EXEC) .depend
+
+
+ifneq ($(wildcard .depend),)
+include .depend
+endif
diff --git a/audio/bomb.wav b/audio/bomb.wav
new file mode 100644
index 0000000..9578542
Binary files /dev/null and b/audio/bomb.wav differ
diff --git a/audio/mix_1_p.mid b/audio/mix_1_p.mid
new file mode 100644
index 0000000..8ef014b
Binary files /dev/null and b/audio/mix_1_p.mid differ
diff --git a/audio/mm2air.mid b/audio/mm2air.mid
new file mode 100644
index 0000000..f1f9b72
Binary files /dev/null and b/audio/mm2air.mid differ
diff --git a/audio/mm2boss.mid b/audio/mm2boss.mid
new file mode 100644
index 0000000..836d995
Binary files /dev/null and b/audio/mm2boss.mid differ
diff --git a/audio/mm2bubbl.mid b/audio/mm2bubbl.mid
new file mode 100644
index 0000000..2be3abf
Binary files /dev/null and b/audio/mm2bubbl.mid differ
diff --git a/audio/mm2cras2.mid b/audio/mm2cras2.mid
new file mode 100644
index 0000000..2823563
Binary files /dev/null and b/audio/mm2cras2.mid differ
diff --git a/audio/mm2crash.mid b/audio/mm2crash.mid
new file mode 100644
index 0000000..36d3428
Binary files /dev/null and b/audio/mm2crash.mid differ
diff --git a/audio/mm2end.mid b/audio/mm2end.mid
new file mode 100644
index 0000000..d9c5a30
Binary files /dev/null and b/audio/mm2end.mid differ
diff --git a/audio/mm2flas2.mid b/audio/mm2flas2.mid
new file mode 100644
index 0000000..3f6b33c
Binary files /dev/null and b/audio/mm2flas2.mid differ
diff --git a/audio/mm2flash.mid b/audio/mm2flash.mid
new file mode 100644
index 0000000..3ef9b6f
Binary files /dev/null and b/audio/mm2flash.mid differ
diff --git a/audio/mm2heat.mid b/audio/mm2heat.mid
new file mode 100644
index 0000000..2dbd4fa
Binary files /dev/null and b/audio/mm2heat.mid differ
diff --git a/audio/mm2intro.mid b/audio/mm2intro.mid
new file mode 100644
index 0000000..ce0345b
Binary files /dev/null and b/audio/mm2intro.mid differ
diff --git a/audio/mm2meta2.mid b/audio/mm2meta2.mid
new file mode 100644
index 0000000..33b4be9
Binary files /dev/null and b/audio/mm2meta2.mid differ
diff --git a/audio/mm2metal.mid b/audio/mm2metal.mid
new file mode 100644
index 0000000..d19d159
Binary files /dev/null and b/audio/mm2metal.mid differ
diff --git a/audio/mm2passw.mid b/audio/mm2passw.mid
new file mode 100644
index 0000000..ceae607
Binary files /dev/null and b/audio/mm2passw.mid differ
diff --git a/audio/mm2quick.mid b/audio/mm2quick.mid
new file mode 100644
index 0000000..61ac6b8
Binary files /dev/null and b/audio/mm2quick.mid differ
diff --git a/audio/mm2selec.mid b/audio/mm2selec.mid
new file mode 100644
index 0000000..a53d611
Binary files /dev/null and b/audio/mm2selec.mid differ
diff --git a/audio/mm2titl2.mid b/audio/mm2titl2.mid
new file mode 100644
index 0000000..ebd2533
Binary files /dev/null and b/audio/mm2titl2.mid differ
diff --git a/audio/mm2title.mid b/audio/mm2title.mid
new file mode 100644
index 0000000..cd18057
Binary files /dev/null and b/audio/mm2title.mid differ
diff --git a/audio/mm2w1rm.mid b/audio/mm2w1rm.mid
new file mode 100644
index 0000000..936dca3
Binary files /dev/null and b/audio/mm2w1rm.mid differ
diff --git a/audio/mm2wily1.mid b/audio/mm2wily1.mid
new file mode 100644
index 0000000..13f2598
Binary files /dev/null and b/audio/mm2wily1.mid differ
diff --git a/audio/mm2wood.mid b/audio/mm2wood.mid
new file mode 100644
index 0000000..622dd85
Binary files /dev/null and b/audio/mm2wood.mid differ
diff --git a/audio/mm2wy1.mid b/audio/mm2wy1.mid
new file mode 100644
index 0000000..8583743
Binary files /dev/null and b/audio/mm2wy1.mid differ
diff --git a/bibi.workspace b/bibi.workspace
new file mode 100644
index 0000000..c7658ad
--- /dev/null
+++ b/bibi.workspace
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/cb.bmp b/cb.bmp
new file mode 100644
index 0000000..f912a9e
Binary files /dev/null and b/cb.bmp differ
diff --git a/data/level1.lvl b/data/level1.lvl
new file mode 100644
index 0000000..ead5de8
--- /dev/null
+++ b/data/level1.lvl
@@ -0,0 +1,141 @@
+12:15
+666686676696666
+400000000000000
+012121212121210
+020202020202020
+012121212121210
+020202020202020
+012121232121210
+020202020202020
+012121212121210
+020202020202020
+012121212121210
+000000000000000
+-
+10:11
+k4000000000
+60020202020
+70212121212
+60020202020
+80212121212
+60020202020
+90212121212
+60020202020
+60212121212
+k0020202023
+-
+13:15
+666667686966666
+640022222222556
+612121212121216
+622000000000226
+610121212121016
+620220222022226
+610121252121016
+622220222022026
+610121212121016
+622000002000226
+612121212121216
+655222222222236
+666666666666666
+-
+14:13
+6668667669666
+6500000002206
+6000000100006
+6000401102206
+6211102002006
+6120022211006
+6220222200116
+6001222112006
+6221221102206
+6001120022216
+6101201100226
+6102001022126
+6002001100136
+6666666666666
+-
+9:20
+60000100010001000103
+60022222222222222200
+70020202020202020200
+60022121212121212200
+84020202020202020200
+60022121212121212200
+90020202020202020200
+60022222222222222200
+60010001000100010003
+-
+13:15
+102020261101224
+201021061200220
+212212062201222
+221221050001110
+120122172200022
+010022261120211
+666566686665666
+321200262122121
+222101092101020
+221221052121212
+222122160102010
+221210262211112
+202020260202020
+-
+13:15
+666676686696666
+600222222222036
+601212121112106
+622002221110226
+621110121110126
+621112000222226
+621112121211126
+620222000211126
+621011121211126
+622011122200226
+601211101012106
+640222202222006
+666666666666666
+-
+13:17
+66666766866966666
+01121121121121100
+04101202201202200
+01121121121121100
+01121121121121122
+02202202102202123
+01121121121121122
+01121121121121100
+02201202201202200
+01121121121121100
+01121121121121122
+02102202102202132
+01121121121121122
+-
+9:20
+62202120202100022005
+62122212212212212200
+70212221221221221220
+63111020202120202122
+81111111111111111102
+64010222010220010022
+62012010212012210221
+90210212010212212211
+62022010222012222011
+-
+15:19
+0000066668666600000
+0007662204022669000
+0066222222222226600
+0662222222222222660
+6622222222222222266
+6222266666666622226
+6222600000000062226
+6226006600066006226
+6226006600066006226
+6226006600066006226
+6226006600066006226
+6622600000000062266
+0662266666666622660
+0066222223222226600
+0006666666666666000
+-
diff --git a/data/level13.lvl b/data/level13.lvl
new file mode 100644
index 0000000..7faadf3
--- /dev/null
+++ b/data/level13.lvl
@@ -0,0 +1,87 @@
+9:20
+k000010001000100013l
+60020202020202022206
+70020202020202020207
+60020202020202022206
+80020202020202020208
+60020202020202022206
+90020202020202020209
+64020202020202022206
+60j10001000100010006
+-
+13:13
+j022222222204
+0121212121210
+0000000000000
+2121212121212
+2222222222222
+2121212121212
+0000000000000
+2121212121212
+2222222222222
+0000000000000
+2222222222222
+2121212121212
+0000003000000
+-
+14:13
+k678941jl6789
+5210002000125
+0110002000110
+0000211200000
+2000020000002
+1111102111111
+2222220222222
+2000000500000
+2022222222220
+2020000000020
+2020222222020
+2020200002020
+2020202202020
+2000203200020
+-
+13:17
+k666676686696666k
+22222021111111111
+20220002200000200
+21111011111120200
+01511011115102002
+21520200025120120
+21222222222111202
+212041j0211110010
+01201110210020120
+21222222210111202
+01111111112020020
+00200000000001111
+3l66676686696666l
+-
+13:13
+6420000020006
+6020200020206
+6020202020206
+k02020002020l
+6020202020206
+7020200020207
+6020202020206
+8020200020208
+6020202020206
+9020200020209
+6020202020206
+6020200020206
+60002000002j6
+-
+13:13
+k66676869666k
+4000000000000
+0111111111100
+0022222222200
+0022000002200
+0022122212200
+0022123212200
+0022122212200
+0022000002200
+0022222222200
+0011111111110
+000000000000j
+l66676869666l
+-
diff --git a/data/niveaux.lvl b/data/niveaux.lvl
new file mode 100644
index 0000000..ed7ef5b
--- /dev/null
+++ b/data/niveaux.lvl
@@ -0,0 +1,86 @@
+10:11
+22232002222
+20000000022
+00000000002
+00000000022
+22000400022
+20000000002
+20000000002
+20000000022
+22000220002
+20202022222
+-
+9:20
+60000100010001000103
+60022222222222222200
+70020202020202020200
+60022121212121212200
+84020202020202020200
+60022121212121212200
+90020202020202020200
+60022222222222222200
+60010001000100010003
+-
+13:13
+0111111111110
+0122220222210
+0123020203210
+0122220222210
+0111200021110
+0001200021000
+0001200021000
+0001200021000
+0001200021000
+0001200021000
+0001222221000
+0000220220000
+0000j22240000
+-
+14:13
+k678941jl6789
+5210002000125
+0110002000110
+0000211200000
+2000020000002
+1111102111111
+2222220222222
+2000000500000
+2022222222220
+2020000000020
+2020222222020
+2020200002020
+2020202202020
+2000203200020
+-
+15:19
+0000066668666600000
+0007662204022669000
+0066222222222226600
+0662222222222222660
+6622222222222222266
+6222266666666622226
+6222600000000062226
+6226006600066006226
+6226006600066006226
+6226006600066006226
+6226006600066006226
+6622600000000062266
+0662266666666622660
+0066222223222226600
+0006666666666666000
+-
+13:17
+k666676686696666k
+22222021111111111
+20220002200000200
+21111011111120200
+01511011115102002
+21520200025120120
+21222222222111202
+212041j0211110010
+01201110210020120
+21222222210111202
+01111111112020020
+00200000000001111
+3l66676686696666l
+-
diff --git a/include/bomb.h b/include/bomb.h
new file mode 100644
index 0000000..7095ca7
--- /dev/null
+++ b/include/bomb.h
@@ -0,0 +1,37 @@
+#ifndef BOMB_H_
+#define BOMB_H_
+
+#include
+#include
+#include "SDL.h"
+#include "SDL_image.h"
+#include "../include/constant.h"
+
+typedef struct s_bomb * t_bomb;
+
+// Creates a new bomb at a given place
+extern t_bomb bomb_init(t_bomb list_bombs, int x, int y, int portee, int joueur);
+extern void bomb_free(t_bomb bomb);
+
+// Returns the current position of a bomb
+extern int bomb_get_x(t_bomb bomb);
+extern int bomb_get_y(t_bomb bomb);
+extern int bomb_get_joueur(t_bomb bomb);
+extern int bomb_get_portee(t_bomb bomb);
+
+//management of the following bomb
+extern t_bomb get_next_bomb(t_bomb bomb);
+void set_next_bomb(t_bomb bomb, t_bomb nxt_bomb);
+
+// Set the next image of a bomb
+extern void bomb_set_current_time(t_bomb bomb, int time);
+extern int bomb_get_current_time(t_bomb bomb);
+
+// Display a bomb on the screen
+extern void bomb_display(t_bomb bomb, SDL_Surface *screen);
+
+
+
+
+
+#endif /* BOMB_H_ */
diff --git a/include/constant.h b/include/constant.h
new file mode 100644
index 0000000..cd0f26d
--- /dev/null
+++ b/include/constant.h
@@ -0,0 +1,172 @@
+#ifndef CONSTANT_H_
+#define CONSTANT_H_
+
+
+
+// Use Sound ?
+//#define SOUND_FMOD_ACTIVATED
+//#define SOUND_SDL_ACTIVATED
+
+// Resize ?
+#define HW_SCREEN_RESIZE
+#define HW_SCREEN_WIDTH 240
+#define HW_SCREEN_HEIGHT 240
+
+#define WINDOW_BPP 16
+
+// Size (# of pixels) of a cell of the map
+#define SIZE_BLOC 40
+
+// Time management
+#define MAX_SKIPPED_FRAMES 100
+#define DEFAULT_GAME_SPEED 8 // the more, the faster
+#define BOMBS_SPEED 5 // the less, the faster
+#define MONSTER_SPEED 7 // the less, the faster
+#define ANIMATION_SPEED 2
+
+// General sprites
+#define IMG_MAP_WALL "sprite/wall.png"
+#define IMG_MAP_BOX "sprite/box.png"
+#define IMG_MAP_GOAL "sprite/objectif.png"
+
+//Menu sprites
+#define IMG_MENU_EMPTY "sprite/menu_empty.png"
+#define IMG_MENU_PLAYER_1 "sprite/menu_player_1.png"
+#define IMG_MENU_PLAYER_2 "sprite/menu_player_2.png"
+#define IMG_MENU_LIVES_0 "sprite/lives_0.png"
+#define IMG_MENU_LIVES_1 "sprite/lives_1.png"
+#define IMG_MENU_LIVES_2 "sprite/lives_2.png"
+#define IMG_MENU_LIVES_3 "sprite/lives_3.png"
+#define IMG_MENU_LIVES_4 "sprite/lives_4.png"
+#define IMG_MENU_BOMBS_0 "sprite/bombs_0.png"
+#define IMG_MENU_BOMBS_1 "sprite/bombs_1.png"
+#define IMG_MENU_BOMBS_2 "sprite/bombs_2.png"
+#define IMG_MENU_BOMBS_3 "sprite/bombs_3.png"
+#define IMG_MENU_BOMBS_4 "sprite/bombs_4.png"
+#define IMG_MENU_BOMBS_5 "sprite/bombs_5.png"
+#define IMG_MENU_RANGE_0 "sprite/range_0.png"
+#define IMG_MENU_RANGE_1 "sprite/range_1.png"
+#define IMG_MENU_RANGE_2 "sprite/range_2.png"
+#define IMG_MENU_RANGE_3 "sprite/range_3.png"
+#define IMG_MENU_RANGE_4 "sprite/range_4.png"
+#define IMG_MENU_RANGE_5 "sprite/range_5.png"
+
+// Bombs
+#define IMG_BOMB_TTL1 "sprite/bomb1.png"
+#define IMG_BOMB_TTL2 "sprite/bomb2.png"
+#define IMG_BOMB_TTL3 "sprite/bomb3.png"
+#define IMG_BOMB_TTL4 "sprite/bomb4.png"
+
+#define IMG_BONUS_BOMB_RANGE_INC "sprite/bonus_bomb_range_inc.png"
+#define IMG_BONUS_BOMB_RANGE_DEC "sprite/bonus_bomb_range_dec.png"
+#define IMG_BONUS_BOMB_NB_INC "sprite/bonus_bomb_nb_inc.png"
+#define IMG_BONUS_BOMB_NB_DEC "sprite/bonus_bomb_nb_dec.png"
+#define IMG_BONUS_LIFE_INC "sprite/bonus_life_inc.png"
+
+
+// Players
+#define IMG_PLAYER_LEFT "sprite/player_left.png"
+#define IMG_PLAYER_UP "sprite/player_up.png"
+#define IMG_PLAYER_RIGHT "sprite/player_right.png"
+#define IMG_PLAYER_DOWN "sprite/player_down.png"
+#define IMG_PLAYER_2_LEFT "sprite/player_left_2.png"
+#define IMG_PLAYER_2_UP "sprite/player_up_2.png"
+#define IMG_PLAYER_2_RIGHT "sprite/player_right_2.png"
+#define IMG_PLAYER_2_DOWN "sprite/player_down_2.png"
+
+//Monsters
+#define IMG_MONSTER_LEFT "sprite/monster_left.png"
+#define IMG_MONSTER_UP "sprite/monster_up.png"
+#define IMG_MONSTER_RIGHT "sprite/monster_right.png"
+#define IMG_MONSTER_DOWN "sprite/monster_down.png"
+
+
+
+//flamme
+#define IMG_FLAMME_THIN_HAUT "sprite/ThinUp.png"
+#define IMG_FLAMME_THIN_BAS "sprite/ThinDown.png"
+#define IMG_FLAMME_THIN_GAUCHE "sprite/ThinLeft.png"
+#define IMG_FLAMME_THIN_DROITE "sprite/ThinRight.png"
+#define IMG_FLAMME_THIN_HRZ "sprite/ThinHrz.png"
+#define IMG_FLAMME_THIN_VERT "sprite/ThinVert.png"
+#define IMG_FLAMME_THIN_CENTER "sprite/ThinCenter.png"
+#define IMG_FLAMME_THIN_MONSTER_BAS "sprite/monster_down_TV.png"
+#define IMG_FLAMME_THIN_MONSTER_HAUT "sprite/monster_up_TV.png"
+#define IMG_FLAMME_THIN_MONSTER_GAUCHE "sprite/monster_left_TV.png"
+#define IMG_FLAMME_THIN_MONSTER_DROITE "sprite/monster_right_TV.png"
+#define IMG_FLAMME_MEDIUM_HAUT "sprite/FireUp.png"
+#define IMG_FLAMME_MEDIUM_BAS "sprite/FireDown.png"
+#define IMG_FLAMME_MEDIUM_GAUCHE "sprite/FireLeft.png"
+#define IMG_FLAMME_MEDIUM_DROITE "sprite/FireRight.png"
+#define IMG_FLAMME_MEDIUM_HRZ "sprite/FireHrz.png"
+#define IMG_FLAMME_MEDIUM_VERT "sprite/FireVert.png"
+#define IMG_FLAMME_MEDIUM_CENTER "sprite/FireCenter.png"
+#define IMG_FLAMME_MEDIUM_MONSTER_BAS "sprite/monster_down_FV.png"
+#define IMG_FLAMME_MEDIUM_MONSTER_HAUT "sprite/monster_up_FV.png"
+#define IMG_FLAMME_MEDIUM_MONSTER_GAUCHE "sprite/monster_left_FV.png"
+#define IMG_FLAMME_MEDIUM_MONSTER_DROITE "sprite/monster_right_FV.png"
+#define IMG_FLAMME_FIRE_HAUT "sprite/LargeUp.png"
+#define IMG_FLAMME_FIRE_BAS "sprite/LargeDown.png"
+#define IMG_FLAMME_FIRE_GAUCHE "sprite/LargeLeft.png"
+#define IMG_FLAMME_FIRE_DROITE "sprite/LargeRight.png"
+#define IMG_FLAMME_FIRE_HRZ "sprite/LargeHrz.png"
+#define IMG_FLAMME_FIRE_VERT "sprite/LargeVert.png"
+#define IMG_FLAMME_FIRE_CENTER "sprite/LargeCenter.png"
+#define IMG_FLAMME_FIRE_MONSTER_BAS "sprite/monster_down_LV.png"
+#define IMG_FLAMME_FIRE_MONSTER_HAUT "sprite/monster_up_LV.png"
+#define IMG_FLAMME_FIRE_MONSTER_GAUCHE "sprite/monster_left_LV.png"
+#define IMG_FLAMME_FIRE_MONSTER_DROITE "sprite/monster_right_LV.png"
+#define IMG_FLAMME_LARGE_HAUT "sprite/XLUP.png"
+#define IMG_FLAMME_LARGE_BAS "sprite/XLDOWN.png"
+#define IMG_FLAMME_LARGE_GAUCHE "sprite/XLLEFT.png"
+#define IMG_FLAMME_LARGE_DROITE "sprite/XLRIGHT.png"
+#define IMG_FLAMME_LARGE_HRZ "sprite/XLHRZ.png"
+#define IMG_FLAMME_LARGE_VERT "sprite/XLVERT.png"
+#define IMG_FLAMME_LARGE_CENTER "sprite/XLCENTER.png"
+#define IMG_FLAMME_LARGE_MONSTER_BAS "sprite/monster_down_XLV.png"
+#define IMG_FLAMME_LARGE_MONSTER_HAUT "sprite/monster_up_XLV.png"
+#define IMG_FLAMME_LARGE_MONSTER_GAUCHE "sprite/monster_left_XLV.png"
+#define IMG_FLAMME_LARGE_MONSTER_DROITE "sprite/monster_right_XLV.png"
+
+// Maximum lives for a player
+#define MAXIMUM_LIVES 4
+
+//Nombre de décès avant game over
+#define NB_DECES 3
+
+// Maximum power of a bomb
+#define BOMB_RANGE_MAX 4
+
+// Maximum number of bombs available
+#define BOMB_NUMBER_MAX 5
+
+// Bonus
+// Probability that a box contains a bonus
+#define PROBA_BONUS 60
+
+#define PROBA_BONUS_BOMB_RANGE 30
+
+// Increase the power of a bomb +1
+#define PROBA_BONUS_BOMB_RANGE_INC 50
+
+// Decrease the power of a bomb -1
+#define PROBA_BONUS_BOMB_RANGE_DEC 50
+
+#define PROBA_BONUS_BOMB_NB 30
+
+// Increase the number of bombs
+#define PROBA_BONUS_BOMB_NB_INC 30
+// Decrease the number of bombs
+#define PROBA_BONUS_BOMB_NB_DEC 70
+
+#define PROBA_BONUS_LIFE_INC 10
+
+#define PROBA_BONUS_MONSTER 30
+
+// Name of the file that contains the map
+#define SRC_MAP "data/level1.lvl"
+
+
+
+
+#endif /* CONSTANT */
diff --git a/include/editeur.h b/include/editeur.h
new file mode 100644
index 0000000..c2cc4e3
--- /dev/null
+++ b/include/editeur.h
@@ -0,0 +1,6 @@
+#ifndef DEF_EDITEUR
+#define DEF_EDITEUR
+
+ extern void editeur(SDL_Surface *screen, int niveau);
+
+#endif
diff --git a/include/flamme.h b/include/flamme.h
new file mode 100644
index 0000000..aaa3f90
--- /dev/null
+++ b/include/flamme.h
@@ -0,0 +1,35 @@
+#ifndef FLAMME_H_
+#define FLAMME_H_
+
+#include
+#include
+#include "SDL.h"
+#include "SDL_image.h"
+#include "../include/constant.h"
+
+enum e_type_flamme {
+ HAUT = 0, BAS, GAUCHE, DROITE, HRZLEFT, HRZRIGHT, VERTUP, VERTDOWN, CENTER, M_HAUT, M_BAS, M_GAUCHE, M_DROITE
+};
+
+typedef struct s_flamme * t_flamme;
+
+extern t_flamme flamme_init(t_flamme list_flammes, int x, int y, int portee, enum e_type_flamme type);
+extern void flamme_free(t_flamme flamme);
+
+// Returns the current position of a flamme
+extern int flamme_get_x(t_flamme flamme);
+extern int flamme_get_y(t_flamme flamme);
+extern int flamme_get_portee(t_flamme flamme);
+extern enum e_type_flamme flamme_get_type(t_flamme flamme);
+extern t_flamme get_next_flamme(t_flamme flamme);
+void set_next_flamme(t_flamme flamme, t_flamme nxt_flamme);
+
+// Set the next image of a flamme
+extern void flamme_decrease_current_time(t_flamme flamme);
+extern int flamme_get_current_time(t_flamme flamme);
+
+// Display a flamme on the screen
+extern void flamme_display(t_flamme flamme, SDL_Surface *screen);
+
+#endif /* FLAMME_H_ */
+
diff --git a/include/game.h b/include/game.h
new file mode 100644
index 0000000..c91b853
--- /dev/null
+++ b/include/game.h
@@ -0,0 +1,66 @@
+/*
+ * game.h
+ *
+ * Created on: 15 mars 2010
+ * Author: reveillere
+ */
+
+#ifndef GAME_H_
+#define GAME_H_
+
+#include "../include/constant.h"
+#include "../include/misc.h"
+
+#include "../include/map.h"
+#include "../include/player.h"
+#include "../include/bomb.h"
+#include "../include/monsters.h"
+#include "../include/flamme.h"
+
+#ifdef SOUND_FMOD_ACTIVATED
+ #include
+#endif //SOUND_FMOD_ACTIVATED
+
+typedef struct s_game * t_game;
+
+// Create a new game
+extern t_game game_new(int nb_joueur, int niveau, int mode, int kill_bomb);
+extern void game_free(t_game game);
+
+
+// Return the player of the current game
+extern t_player game_get_player1(t_game game);
+extern t_player game_get_player2(t_game game);
+// Return the map of the current game
+extern t_map game_the_map(t_game game);
+
+// Return a bomb of the current game
+extern void game_init_bomb(t_game game, int x, int y, int portee, int joueur);
+extern t_monster game_return_monster(t_game game, int monster_number);
+
+// Generate a random bonus after an explosion
+extern void generate_bonus(t_game game, int x, int y);
+t_bonus_type return_bonus();
+
+// Display the game on the screen
+extern void game_display(t_game game, SDL_Surface *screen);
+
+//manage the bombs
+extern void bombs_management (t_game game, int all_bombs);
+
+//manage the flammes
+extern void flamme_management(t_game game);
+extern void flamme_continue(t_flamme flamme, t_game game);
+extern void flamme_check_right(int x, int y, int portee, t_game game);
+extern void flamme_check_left(int x, int y, int portee, t_game game);
+extern void flamme_check_up(int x, int y, int portee, t_game game);
+extern void flamme_check_down(int x, int y, int portee, t_game game);
+
+//manage the monsters
+extern void monsters_management(t_game game, int nb_joueur);
+extern t_monster kill_monster(t_monster list_monsters, int x, int y);
+
+//explose a bomb
+extern void kill_bomb(t_game game, int x, int y);
+
+#endif /* GAME_H_ */
diff --git a/include/game_time.h b/include/game_time.h
new file mode 100644
index 0000000..ff15916
--- /dev/null
+++ b/include/game_time.h
@@ -0,0 +1,24 @@
+#ifndef __TIME_H__
+#define __TIME_H__
+
+#include
+
+// Number of cycles to process before displaying an image
+extern Uint16 game_time_get_cycles_to_calculate();
+
+// Current speed of the game
+extern Uint16 game_time_get_speed();
+
+// Duration of a cycle (in ms)
+extern Uint16 game_time_get_cycles_length();
+
+// Time initialization
+extern void game_time_init();
+
+// Set the speed of the game
+extern void game_time_set_speed(Uint16 speed);
+
+// Compute the current time of the game
+extern void game_time_update();
+
+#endif /* __TIME_H__ */
diff --git a/include/map.h b/include/map.h
new file mode 100644
index 0000000..dd5d5e0
--- /dev/null
+++ b/include/map.h
@@ -0,0 +1,55 @@
+/*
+ * map.h
+ *
+ * Created on: 16 mars 2010
+ * Author: BUSO, GROSSE
+ */
+
+#ifndef MAP_H_
+#define MAP_H_
+
+#include
+#include
+#include "SDL.h"
+#include "SDL_image.h"
+
+
+typedef enum {
+ CELL_EMPTY = 0, CELL_GOAL, CELL_WALL, CELL_PLAYER, CELL_PLAYER_2, CELL_BOX,
+ CELL_BONUS, CELL_MONSTER, CELL_BOMB, CELL_FLAMME, CELL_MENU_EMPTY,CELL_MENU_PLAYER_1,
+ CELL_MENU_PLAYER_2,CELL_MENU_LIVES, CELL_MENU_BOMBS, CELL_MENU_RANGE} t_cell_type;
+
+typedef enum {
+ BONUS_BOMB_RANGE_INC = 1, BONUS_BOMB_RANGE_DEC, BONUS_BOMB_NB_INC, BONUS_BOMB_NB_DEC, BONUS_MONSTER, BONUS_LIFE_INC, NO_BONUS
+} t_bonus_type;
+
+typedef struct t_map * t_map;
+
+// Create a new empty map
+extern t_map map_new(int width, int height);
+extern void map_free(t_map map);
+
+// Return the height and width of a map
+extern int map_get_width(t_map map);
+extern int map_get_height(t_map map);
+
+// Return the type of a cell
+extern t_cell_type map_get_cell_type(t_map map, int x, int y);
+// Set the type of a cell
+extern void map_set_cell_type(t_map map, int x, int y, t_cell_type type);
+
+// Test if (x,y) is within the map'
+extern int map_is_inside(t_map map, int x, int y);
+
+// Load a static pre-calculated map
+//extern t_map map_load_static(void);
+
+// Load a dynamic map
+extern t_map map_load_dynamic(FILE* fd, int niveau, int nb_joueur);
+// Load a map
+extern void sauvegarderNiveau(t_map map, int niveau);
+
+// Display the map on the screen
+extern void map_display(t_map map, int lives_player, int bombs_player, int range_player, int lives_player2, int bombs_player2, int range_player2, SDL_Surface *screen);
+
+#endif /* MAP_H_ */
diff --git a/include/misc.h b/include/misc.h
new file mode 100644
index 0000000..25a46e2
--- /dev/null
+++ b/include/misc.h
@@ -0,0 +1,43 @@
+/*
+ * misc.h
+ *
+ * Created on: 15 mars 2010
+ * Author: reveille
+ */
+
+#ifndef MISC_H_
+#define MISC_H_
+
+
+#include
+#include
+#include
+#include
+
+#include
+
+#include "SDL.h"
+#include "SDL_image.h"
+
+#define MAX(x, y) (((x) > (y)) ? (x) : (y))
+#define MIN(x, y) (((x) < (y)) ? (x) : (y))
+
+#ifdef HW_SCREEN_RESIZE
+ extern SDL_Surface *hw_screen;
+#endif //HW_SCREEN_RESIZE
+
+#ifdef SOUND_SDL_ACTIVATED
+ extern bool audio_init_ok;
+#endif //SOUND_SDL_ACTIVATED
+
+
+// Print an error message on stderr and exit
+extern void error(const char *s, ...);
+
+// Load an image, raise an error in case of failure
+extern SDL_Surface *load_image(const char *filename);
+
+// Copy surface with Nearest neighboor scaling
+void flip_NNOptimized_AllowOutOfScreen(SDL_Surface *virtual_screen, SDL_Surface *hardware_screen, int new_w, int new_h);
+
+#endif /* MISC_H_ */
diff --git a/include/monsters.h b/include/monsters.h
new file mode 100644
index 0000000..e79464b
--- /dev/null
+++ b/include/monsters.h
@@ -0,0 +1,37 @@
+#ifndef MONSTERS_H_
+#define MONSTERS_H_
+
+#include
+#include
+#include "SDL.h"
+#include "SDL_image.h"
+#include "../include/constant.h"
+
+typedef struct s_monster * t_monster;
+
+// Creates a new monster
+extern t_monster monster_init(t_monster list_monsters, int x, int y, int portee_monstre);
+extern void monster_free(t_monster monster);
+
+
+// Returns the current position of the monster
+extern int monster_get_x(t_monster monster);
+extern int monster_get_y(t_monster monster);
+
+//management of the following monster
+extern t_monster get_next_monster(t_monster monster);
+void set_next_monster(t_monster monster, t_monster nxt_monster);
+
+
+extern int monster_portee(t_monster monster);
+
+// Set the direction of the next move of the monster
+enum e_way monster_get_current_way(t_monster monster);
+extern void monster_set_current_way(t_monster monster, enum e_way way);
+
+// Move the monster according to the current direction
+extern int monster_move(t_monster monster, t_map map, t_player player, t_player player2, int nb_joueur);
+// Display the monster on the screen
+extern void monster_display(t_monster monster, SDL_Surface *screen);
+
+#endif /* MONSTERS_H_ */
diff --git a/include/niveau.h b/include/niveau.h
new file mode 100644
index 0000000..3d2549a
--- /dev/null
+++ b/include/niveau.h
@@ -0,0 +1,14 @@
+#ifndef NIVEAU_H_
+#define NIVEAU_H_
+
+
+
+extern int niveau_1_joueur(SDL_Surface *screen, int niveau);
+extern int niveau_2_joueur(SDL_Surface *screen, int choix_niveau);
+extern int editeur_choix_niveau(SDL_Surface *screen);
+extern int are_you_sure(SDL_Surface *screen);
+int choix_nb_joueurs(SDL_Surface *screen);
+int options(SDL_Surface *screen);
+
+
+#endif /* NIVEAU_H_ */
diff --git a/include/player.h b/include/player.h
new file mode 100644
index 0000000..66d0e96
--- /dev/null
+++ b/include/player.h
@@ -0,0 +1,63 @@
+#ifndef PLAYER_H_
+#define PLAYER_H_
+
+#include
+#include
+#include "SDL.h"
+#include "SDL_image.h"
+#include "../include/constant.h"
+
+enum e_way {
+ UP = 0, DOWN, LEFT, RIGHT
+};
+
+enum e_player {
+ PLAYER_STD, PLAYER_MONSTER
+};
+
+typedef struct s_player * t_player;
+
+// Creates a new player with a given number of available bombs
+extern t_player player_init(int nb_bomb, int portee_bomb, int lives, int no_joueur);
+extern void player_free(t_player player);
+
+// Returns the current position of the player
+extern int player_get_x(t_player player);
+extern int player_get_y(t_player player);
+
+// Confirm if the player has won the game
+extern int player_win(t_player player);
+
+// Return the caracteristics of the player
+extern int player_portee_bomb(t_player player);
+
+//manage the lives of the player
+extern int player_get_lives(t_player player);
+extern void player_increase_lives(t_player player);
+extern void player_decrease_lives(t_player player);
+extern void player_die(t_player player);
+extern int player_get_dead(t_player player);
+// Set the direction of the next move of the player
+extern void player_set_current_way(t_player player, enum e_way way);
+
+// Load the player position from the map
+extern int player_from_map(t_player player, t_map map);
+extern void player2_from_map(t_player player, t_map map);
+
+// Move the player according to the current direction
+extern int player_move(t_player player, t_map map);
+
+//Manage the number of bombs available
+extern int player_get_nb_bomb(t_player player);
+extern int player_get_nb_bomb_max(t_player player);
+extern void player_set_nb_bomb(t_player player, int bomb_number);
+extern void player_increase_nb_bomb(t_player player);
+extern void player_decrease_nb_bomb(t_player player);
+extern void player_increase_nb_bomb_max(t_player player);
+extern void player_decrease_nb_bomb_max(t_player player);
+
+
+// Display the player on the screen
+extern void player_display(t_player player, SDL_Surface *screen);
+
+#endif /* PLAYER_H_ */
diff --git a/install inno setup.iss b/install inno setup.iss
new file mode 100644
index 0000000..3040ff7
--- /dev/null
+++ b/install inno setup.iss
@@ -0,0 +1,49 @@
+; Script generated by the Inno Setup Script Wizard.
+; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
+
+[Setup]
+; NOTE: The value of AppId uniquely identifies this application.
+; Do not use the same AppId value in installers for other applications.
+; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
+AppId={{497239A5-CDA3-4FCA-B994-D794DDBE52A0}
+AppName=Bombeirb man
+AppVerName=bombeirb man v1.0
+AppPublisher=buso & grosse
+DefaultDirName={pf}\Bombeirb man
+DefaultGroupName=Bombeirb man
+AllowNoIcons=yes
+OutputDir=C:\Documents and Settings\Vincent\Bureau
+OutputBaseFilename=setup
+Compression=lzma
+SolidCompression=yes
+
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+Name: "french"; MessagesFile: "compiler:Languages\French.isl"
+
+[Tasks]
+Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
+
+[Files]
+Source: "C:\Documents and Settings\Vincent\Bureau\bomberman\Bomberman.exe"; DestDir: "{app}"; Flags: ignoreversion
+Source: "C:\Documents and Settings\Vincent\Bureau\bomberman\fmod.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "C:\Documents and Settings\Vincent\Bureau\bomberman\jpeg.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "C:\Documents and Settings\Vincent\Bureau\bomberman\libpng12-0.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "C:\Documents and Settings\Vincent\Bureau\bomberman\libtiff-3.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "C:\Documents and Settings\Vincent\Bureau\bomberman\SDL.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "C:\Documents and Settings\Vincent\Bureau\bomberman\SDL_image.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "C:\Documents and Settings\Vincent\Bureau\bomberman\zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "C:\Documents and Settings\Vincent\Bureau\bomberman\sprite\*"; DestDir: "{app}"; Flags: ignoreversion
+Source: "C:\Documents and Settings\Vincent\Bureau\bomberman\audio\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
+Source: "C:\Documents and Settings\Vincent\Bureau\bomberman\data\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
+Source: "C:\Documents and Settings\Vincent\Bureau\bomberman\sprite\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
+; NOTE: Don't use "Flags: ignoreversion" on any shared system files
+
+[Icons]
+Name: "{group}\Bombeirb man"; Filename: "{app}\Bomberman.exe"
+Name: "{group}\{cm:UninstallProgram,Bombeirb man}"; Filename: "{uninstallexe}"
+Name: "{commondesktop}\Bombeirb man"; Filename: "{app}\Bomberman.exe"; Tasks: desktopicon
+
+[Run]
+Filename: "{app}\Bomberman.exe"; Description: "{cm:LaunchProgram,Bombeirb man}"; Flags: nowait postinstall skipifsilent
+
diff --git a/sprite/BombermanDS.png b/sprite/BombermanDS.png
new file mode 100644
index 0000000..cc31597
Binary files /dev/null and b/sprite/BombermanDS.png differ
diff --git a/sprite/FireCenter.png b/sprite/FireCenter.png
new file mode 100644
index 0000000..d21b02b
Binary files /dev/null and b/sprite/FireCenter.png differ
diff --git a/sprite/FireDown.png b/sprite/FireDown.png
new file mode 100644
index 0000000..20b48a5
Binary files /dev/null and b/sprite/FireDown.png differ
diff --git a/sprite/FireHrz.png b/sprite/FireHrz.png
new file mode 100644
index 0000000..34967ce
Binary files /dev/null and b/sprite/FireHrz.png differ
diff --git a/sprite/FireLeft.png b/sprite/FireLeft.png
new file mode 100644
index 0000000..9ebee36
Binary files /dev/null and b/sprite/FireLeft.png differ
diff --git a/sprite/FireRight.png b/sprite/FireRight.png
new file mode 100644
index 0000000..a22ce2c
Binary files /dev/null and b/sprite/FireRight.png differ
diff --git a/sprite/FireUp.png b/sprite/FireUp.png
new file mode 100644
index 0000000..6e30eb4
Binary files /dev/null and b/sprite/FireUp.png differ
diff --git a/sprite/FireVert.png b/sprite/FireVert.png
new file mode 100644
index 0000000..afd2391
Binary files /dev/null and b/sprite/FireVert.png differ
diff --git a/sprite/LargeCenter.png b/sprite/LargeCenter.png
new file mode 100644
index 0000000..b623ed5
Binary files /dev/null and b/sprite/LargeCenter.png differ
diff --git a/sprite/LargeDown.png b/sprite/LargeDown.png
new file mode 100644
index 0000000..bed3f82
Binary files /dev/null and b/sprite/LargeDown.png differ
diff --git a/sprite/LargeHrz.png b/sprite/LargeHrz.png
new file mode 100644
index 0000000..b624a1d
Binary files /dev/null and b/sprite/LargeHrz.png differ
diff --git a/sprite/LargeLeft.png b/sprite/LargeLeft.png
new file mode 100644
index 0000000..7857494
Binary files /dev/null and b/sprite/LargeLeft.png differ
diff --git a/sprite/LargeRight.png b/sprite/LargeRight.png
new file mode 100644
index 0000000..070ad9e
Binary files /dev/null and b/sprite/LargeRight.png differ
diff --git a/sprite/LargeUp.png b/sprite/LargeUp.png
new file mode 100644
index 0000000..62eaac7
Binary files /dev/null and b/sprite/LargeUp.png differ
diff --git a/sprite/LargeVert.png b/sprite/LargeVert.png
new file mode 100644
index 0000000..f70d7b0
Binary files /dev/null and b/sprite/LargeVert.png differ
diff --git a/sprite/ThinCenter.png b/sprite/ThinCenter.png
new file mode 100644
index 0000000..6b5e271
Binary files /dev/null and b/sprite/ThinCenter.png differ
diff --git a/sprite/ThinDown.png b/sprite/ThinDown.png
new file mode 100644
index 0000000..6a7fce0
Binary files /dev/null and b/sprite/ThinDown.png differ
diff --git a/sprite/ThinHrz.png b/sprite/ThinHrz.png
new file mode 100644
index 0000000..53d49fe
Binary files /dev/null and b/sprite/ThinHrz.png differ
diff --git a/sprite/ThinLeft.png b/sprite/ThinLeft.png
new file mode 100644
index 0000000..6fa2bb7
Binary files /dev/null and b/sprite/ThinLeft.png differ
diff --git a/sprite/ThinRight.png b/sprite/ThinRight.png
new file mode 100644
index 0000000..f9f34d7
Binary files /dev/null and b/sprite/ThinRight.png differ
diff --git a/sprite/ThinUp.png b/sprite/ThinUp.png
new file mode 100644
index 0000000..2339c06
Binary files /dev/null and b/sprite/ThinUp.png differ
diff --git a/sprite/ThinVert.png b/sprite/ThinVert.png
new file mode 100644
index 0000000..432562e
Binary files /dev/null and b/sprite/ThinVert.png differ
diff --git a/sprite/XLCENTER.png b/sprite/XLCENTER.png
new file mode 100644
index 0000000..6c0fac5
Binary files /dev/null and b/sprite/XLCENTER.png differ
diff --git a/sprite/XLDOWN.png b/sprite/XLDOWN.png
new file mode 100644
index 0000000..7c6ae0e
Binary files /dev/null and b/sprite/XLDOWN.png differ
diff --git a/sprite/XLHRZ.png b/sprite/XLHRZ.png
new file mode 100644
index 0000000..6c101aa
Binary files /dev/null and b/sprite/XLHRZ.png differ
diff --git a/sprite/XLLEFT.png b/sprite/XLLEFT.png
new file mode 100644
index 0000000..435d1cc
Binary files /dev/null and b/sprite/XLLEFT.png differ
diff --git a/sprite/XLRIGHT.png b/sprite/XLRIGHT.png
new file mode 100644
index 0000000..7597b05
Binary files /dev/null and b/sprite/XLRIGHT.png differ
diff --git a/sprite/XLUP.png b/sprite/XLUP.png
new file mode 100644
index 0000000..572e5c8
Binary files /dev/null and b/sprite/XLUP.png differ
diff --git a/sprite/XLVERT.png b/sprite/XLVERT.png
new file mode 100644
index 0000000..8b09ef5
Binary files /dev/null and b/sprite/XLVERT.png differ
diff --git a/sprite/bomb1.png b/sprite/bomb1.png
new file mode 100644
index 0000000..d121311
Binary files /dev/null and b/sprite/bomb1.png differ
diff --git a/sprite/bomb2.png b/sprite/bomb2.png
new file mode 100644
index 0000000..6fc576e
Binary files /dev/null and b/sprite/bomb2.png differ
diff --git a/sprite/bomb3.png b/sprite/bomb3.png
new file mode 100644
index 0000000..e4c21b3
Binary files /dev/null and b/sprite/bomb3.png differ
diff --git a/sprite/bomb4.png b/sprite/bomb4.png
new file mode 100644
index 0000000..6138f0c
Binary files /dev/null and b/sprite/bomb4.png differ
diff --git a/sprite/bombs_0.png b/sprite/bombs_0.png
new file mode 100644
index 0000000..fcdf113
Binary files /dev/null and b/sprite/bombs_0.png differ
diff --git a/sprite/bombs_1.png b/sprite/bombs_1.png
new file mode 100644
index 0000000..53bcace
Binary files /dev/null and b/sprite/bombs_1.png differ
diff --git a/sprite/bombs_2.png b/sprite/bombs_2.png
new file mode 100644
index 0000000..e7e2d3e
Binary files /dev/null and b/sprite/bombs_2.png differ
diff --git a/sprite/bombs_3.png b/sprite/bombs_3.png
new file mode 100644
index 0000000..a426fcb
Binary files /dev/null and b/sprite/bombs_3.png differ
diff --git a/sprite/bombs_4.png b/sprite/bombs_4.png
new file mode 100644
index 0000000..e3bef0c
Binary files /dev/null and b/sprite/bombs_4.png differ
diff --git a/sprite/bombs_5.png b/sprite/bombs_5.png
new file mode 100644
index 0000000..b177077
Binary files /dev/null and b/sprite/bombs_5.png differ
diff --git a/sprite/bonus_bomb_nb_dec.png b/sprite/bonus_bomb_nb_dec.png
new file mode 100644
index 0000000..753482d
Binary files /dev/null and b/sprite/bonus_bomb_nb_dec.png differ
diff --git a/sprite/bonus_bomb_nb_inc.png b/sprite/bonus_bomb_nb_inc.png
new file mode 100644
index 0000000..8a1e547
Binary files /dev/null and b/sprite/bonus_bomb_nb_inc.png differ
diff --git a/sprite/bonus_bomb_range_dec.png b/sprite/bonus_bomb_range_dec.png
new file mode 100644
index 0000000..71b5a18
Binary files /dev/null and b/sprite/bonus_bomb_range_dec.png differ
diff --git a/sprite/bonus_bomb_range_inc.png b/sprite/bonus_bomb_range_inc.png
new file mode 100644
index 0000000..d4ef0b4
Binary files /dev/null and b/sprite/bonus_bomb_range_inc.png differ
diff --git a/sprite/bonus_life_inc.png b/sprite/bonus_life_inc.png
new file mode 100644
index 0000000..d311154
Binary files /dev/null and b/sprite/bonus_life_inc.png differ
diff --git a/sprite/box.png b/sprite/box.png
new file mode 100644
index 0000000..c476131
Binary files /dev/null and b/sprite/box.png differ
diff --git a/sprite/egalite.png b/sprite/egalite.png
new file mode 100644
index 0000000..b10fc47
Binary files /dev/null and b/sprite/egalite.png differ
diff --git a/sprite/game_over.png b/sprite/game_over.png
new file mode 100644
index 0000000..07b88b2
Binary files /dev/null and b/sprite/game_over.png differ
diff --git a/sprite/legende_editeur.png b/sprite/legende_editeur.png
new file mode 100644
index 0000000..9ed89cc
Binary files /dev/null and b/sprite/legende_editeur.png differ
diff --git a/sprite/lives_0.png b/sprite/lives_0.png
new file mode 100644
index 0000000..ee3cb7b
Binary files /dev/null and b/sprite/lives_0.png differ
diff --git a/sprite/lives_1.png b/sprite/lives_1.png
new file mode 100644
index 0000000..e6ae396
Binary files /dev/null and b/sprite/lives_1.png differ
diff --git a/sprite/lives_2.png b/sprite/lives_2.png
new file mode 100644
index 0000000..b1d318c
Binary files /dev/null and b/sprite/lives_2.png differ
diff --git a/sprite/lives_3.png b/sprite/lives_3.png
new file mode 100644
index 0000000..d183b61
Binary files /dev/null and b/sprite/lives_3.png differ
diff --git a/sprite/lives_4.png b/sprite/lives_4.png
new file mode 100644
index 0000000..cb95291
Binary files /dev/null and b/sprite/lives_4.png differ
diff --git a/sprite/menu_1_p.png b/sprite/menu_1_p.png
new file mode 100644
index 0000000..ebfa02e
Binary files /dev/null and b/sprite/menu_1_p.png differ
diff --git a/sprite/menu_2_p.png b/sprite/menu_2_p.png
new file mode 100644
index 0000000..20a1ed2
Binary files /dev/null and b/sprite/menu_2_p.png differ
diff --git a/sprite/menu_e.png b/sprite/menu_e.png
new file mode 100644
index 0000000..6936545
Binary files /dev/null and b/sprite/menu_e.png differ
diff --git a/sprite/menu_empty.png b/sprite/menu_empty.png
new file mode 100644
index 0000000..581b5b2
Binary files /dev/null and b/sprite/menu_empty.png differ
diff --git a/sprite/menu_j_e.png b/sprite/menu_j_e.png
new file mode 100644
index 0000000..7077253
Binary files /dev/null and b/sprite/menu_j_e.png differ
diff --git a/sprite/menu_nb_joueur_1.png b/sprite/menu_nb_joueur_1.png
new file mode 100644
index 0000000..c166725
Binary files /dev/null and b/sprite/menu_nb_joueur_1.png differ
diff --git a/sprite/menu_nb_joueur_2.png b/sprite/menu_nb_joueur_2.png
new file mode 100644
index 0000000..70897d8
Binary files /dev/null and b/sprite/menu_nb_joueur_2.png differ
diff --git a/sprite/menu_o.png b/sprite/menu_o.png
new file mode 100644
index 0000000..384d9ea
Binary files /dev/null and b/sprite/menu_o.png differ
diff --git a/sprite/menu_player_1.png b/sprite/menu_player_1.png
new file mode 100644
index 0000000..5586d47
Binary files /dev/null and b/sprite/menu_player_1.png differ
diff --git a/sprite/menu_player_2.png b/sprite/menu_player_2.png
new file mode 100644
index 0000000..5400d58
Binary files /dev/null and b/sprite/menu_player_2.png differ
diff --git a/sprite/menu_q.png b/sprite/menu_q.png
new file mode 100644
index 0000000..89f96d3
Binary files /dev/null and b/sprite/menu_q.png differ
diff --git a/sprite/monster_down.png b/sprite/monster_down.png
new file mode 100644
index 0000000..b2c4154
Binary files /dev/null and b/sprite/monster_down.png differ
diff --git a/sprite/monster_down_FV.png b/sprite/monster_down_FV.png
new file mode 100644
index 0000000..ad443ef
Binary files /dev/null and b/sprite/monster_down_FV.png differ
diff --git a/sprite/monster_down_LV.png b/sprite/monster_down_LV.png
new file mode 100644
index 0000000..f119924
Binary files /dev/null and b/sprite/monster_down_LV.png differ
diff --git a/sprite/monster_down_TV.png b/sprite/monster_down_TV.png
new file mode 100644
index 0000000..4f3681d
Binary files /dev/null and b/sprite/monster_down_TV.png differ
diff --git a/sprite/monster_down_XLV.png b/sprite/monster_down_XLV.png
new file mode 100644
index 0000000..936a1cc
Binary files /dev/null and b/sprite/monster_down_XLV.png differ
diff --git a/sprite/monster_left.png b/sprite/monster_left.png
new file mode 100644
index 0000000..c8c2964
Binary files /dev/null and b/sprite/monster_left.png differ
diff --git a/sprite/monster_left_FV.png b/sprite/monster_left_FV.png
new file mode 100644
index 0000000..5636e4d
Binary files /dev/null and b/sprite/monster_left_FV.png differ
diff --git a/sprite/monster_left_LV.png b/sprite/monster_left_LV.png
new file mode 100644
index 0000000..9ef9d86
Binary files /dev/null and b/sprite/monster_left_LV.png differ
diff --git a/sprite/monster_left_TV.png b/sprite/monster_left_TV.png
new file mode 100644
index 0000000..8d1d937
Binary files /dev/null and b/sprite/monster_left_TV.png differ
diff --git a/sprite/monster_left_XLV.png b/sprite/monster_left_XLV.png
new file mode 100644
index 0000000..ba77d82
Binary files /dev/null and b/sprite/monster_left_XLV.png differ
diff --git a/sprite/monster_right.png b/sprite/monster_right.png
new file mode 100644
index 0000000..e88c8af
Binary files /dev/null and b/sprite/monster_right.png differ
diff --git a/sprite/monster_right_FV.png b/sprite/monster_right_FV.png
new file mode 100644
index 0000000..7a6e3e8
Binary files /dev/null and b/sprite/monster_right_FV.png differ
diff --git a/sprite/monster_right_LV.png b/sprite/monster_right_LV.png
new file mode 100644
index 0000000..1a79ca1
Binary files /dev/null and b/sprite/monster_right_LV.png differ
diff --git a/sprite/monster_right_TV.png b/sprite/monster_right_TV.png
new file mode 100644
index 0000000..460878c
Binary files /dev/null and b/sprite/monster_right_TV.png differ
diff --git a/sprite/monster_right_XLV.png b/sprite/monster_right_XLV.png
new file mode 100644
index 0000000..67cfda8
Binary files /dev/null and b/sprite/monster_right_XLV.png differ
diff --git a/sprite/monster_up.png b/sprite/monster_up.png
new file mode 100644
index 0000000..9f1e8e3
Binary files /dev/null and b/sprite/monster_up.png differ
diff --git a/sprite/monster_up_FV.png b/sprite/monster_up_FV.png
new file mode 100644
index 0000000..a2694a5
Binary files /dev/null and b/sprite/monster_up_FV.png differ
diff --git a/sprite/monster_up_LV.png b/sprite/monster_up_LV.png
new file mode 100644
index 0000000..bedf3a9
Binary files /dev/null and b/sprite/monster_up_LV.png differ
diff --git a/sprite/monster_up_TV.png b/sprite/monster_up_TV.png
new file mode 100644
index 0000000..3552021
Binary files /dev/null and b/sprite/monster_up_TV.png differ
diff --git a/sprite/monster_up_XLV.png b/sprite/monster_up_XLV.png
new file mode 100644
index 0000000..632e6f6
Binary files /dev/null and b/sprite/monster_up_XLV.png differ
diff --git a/sprite/niveau_1.png b/sprite/niveau_1.png
new file mode 100644
index 0000000..0c0dd2d
Binary files /dev/null and b/sprite/niveau_1.png differ
diff --git a/sprite/niveau_10.png b/sprite/niveau_10.png
new file mode 100644
index 0000000..da6752f
Binary files /dev/null and b/sprite/niveau_10.png differ
diff --git a/sprite/niveau_2.p,g.PNG b/sprite/niveau_2.p,g.PNG
new file mode 100644
index 0000000..7cce4b8
Binary files /dev/null and b/sprite/niveau_2.p,g.PNG differ
diff --git a/sprite/niveau_2.png b/sprite/niveau_2.png
new file mode 100644
index 0000000..7cce4b8
Binary files /dev/null and b/sprite/niveau_2.png differ
diff --git a/sprite/niveau_2p_1.png b/sprite/niveau_2p_1.png
new file mode 100644
index 0000000..adc38ed
Binary files /dev/null and b/sprite/niveau_2p_1.png differ
diff --git a/sprite/niveau_2p_2.png b/sprite/niveau_2p_2.png
new file mode 100644
index 0000000..d90c4db
Binary files /dev/null and b/sprite/niveau_2p_2.png differ
diff --git a/sprite/niveau_2p_3.png b/sprite/niveau_2p_3.png
new file mode 100644
index 0000000..3ffe8dc
Binary files /dev/null and b/sprite/niveau_2p_3.png differ
diff --git a/sprite/niveau_2p_4.png b/sprite/niveau_2p_4.png
new file mode 100644
index 0000000..e051717
Binary files /dev/null and b/sprite/niveau_2p_4.png differ
diff --git a/sprite/niveau_2p_5.png b/sprite/niveau_2p_5.png
new file mode 100644
index 0000000..f06f49c
Binary files /dev/null and b/sprite/niveau_2p_5.png differ
diff --git a/sprite/niveau_2p_6.png b/sprite/niveau_2p_6.png
new file mode 100644
index 0000000..e05f3ce
Binary files /dev/null and b/sprite/niveau_2p_6.png differ
diff --git a/sprite/niveau_3.png b/sprite/niveau_3.png
new file mode 100644
index 0000000..fb7f50e
Binary files /dev/null and b/sprite/niveau_3.png differ
diff --git a/sprite/niveau_4.png b/sprite/niveau_4.png
new file mode 100644
index 0000000..3b695fb
Binary files /dev/null and b/sprite/niveau_4.png differ
diff --git a/sprite/niveau_5.png b/sprite/niveau_5.png
new file mode 100644
index 0000000..d995453
Binary files /dev/null and b/sprite/niveau_5.png differ
diff --git a/sprite/niveau_6.png b/sprite/niveau_6.png
new file mode 100644
index 0000000..8cda676
Binary files /dev/null and b/sprite/niveau_6.png differ
diff --git a/sprite/niveau_7.png b/sprite/niveau_7.png
new file mode 100644
index 0000000..6afd3c4
Binary files /dev/null and b/sprite/niveau_7.png differ
diff --git a/sprite/niveau_8.png b/sprite/niveau_8.png
new file mode 100644
index 0000000..6b99f46
Binary files /dev/null and b/sprite/niveau_8.png differ
diff --git a/sprite/niveau_9.png b/sprite/niveau_9.png
new file mode 100644
index 0000000..587dcf1
Binary files /dev/null and b/sprite/niveau_9.png differ
diff --git a/sprite/objectif.png b/sprite/objectif.png
new file mode 100644
index 0000000..bf93ee8
Binary files /dev/null and b/sprite/objectif.png differ
diff --git a/sprite/options.png b/sprite/options.png
new file mode 100644
index 0000000..04bf454
Binary files /dev/null and b/sprite/options.png differ
diff --git a/sprite/options_b_n.png b/sprite/options_b_n.png
new file mode 100644
index 0000000..50826f4
Binary files /dev/null and b/sprite/options_b_n.png differ
diff --git a/sprite/options_b_o.png b/sprite/options_b_o.png
new file mode 100644
index 0000000..2992603
Binary files /dev/null and b/sprite/options_b_o.png differ
diff --git a/sprite/options_s_n.png b/sprite/options_s_n.png
new file mode 100644
index 0000000..9c1e952
Binary files /dev/null and b/sprite/options_s_n.png differ
diff --git a/sprite/options_s_o.png b/sprite/options_s_o.png
new file mode 100644
index 0000000..6e3367e
Binary files /dev/null and b/sprite/options_s_o.png differ
diff --git a/sprite/p_1_win.png b/sprite/p_1_win.png
new file mode 100644
index 0000000..8594194
Binary files /dev/null and b/sprite/p_1_win.png differ
diff --git a/sprite/p_2_win.png b/sprite/p_2_win.png
new file mode 100644
index 0000000..fb46e54
Binary files /dev/null and b/sprite/p_2_win.png differ
diff --git a/sprite/player_down.png b/sprite/player_down.png
new file mode 100644
index 0000000..a2fff39
Binary files /dev/null and b/sprite/player_down.png differ
diff --git a/sprite/player_down_2.png b/sprite/player_down_2.png
new file mode 100644
index 0000000..efa5f59
Binary files /dev/null and b/sprite/player_down_2.png differ
diff --git a/sprite/player_left.png b/sprite/player_left.png
new file mode 100644
index 0000000..f6a5e39
Binary files /dev/null and b/sprite/player_left.png differ
diff --git a/sprite/player_left_2.png b/sprite/player_left_2.png
new file mode 100644
index 0000000..fdbc055
Binary files /dev/null and b/sprite/player_left_2.png differ
diff --git a/sprite/player_right.png b/sprite/player_right.png
new file mode 100644
index 0000000..423faa7
Binary files /dev/null and b/sprite/player_right.png differ
diff --git a/sprite/player_right_2.png b/sprite/player_right_2.png
new file mode 100644
index 0000000..46df92c
Binary files /dev/null and b/sprite/player_right_2.png differ
diff --git a/sprite/player_up.png b/sprite/player_up.png
new file mode 100644
index 0000000..292923f
Binary files /dev/null and b/sprite/player_up.png differ
diff --git a/sprite/player_up_2.png b/sprite/player_up_2.png
new file mode 100644
index 0000000..9a7485c
Binary files /dev/null and b/sprite/player_up_2.png differ
diff --git a/sprite/range_0.png b/sprite/range_0.png
new file mode 100644
index 0000000..ff0350e
Binary files /dev/null and b/sprite/range_0.png differ
diff --git a/sprite/range_1.png b/sprite/range_1.png
new file mode 100644
index 0000000..aea9d52
Binary files /dev/null and b/sprite/range_1.png differ
diff --git a/sprite/range_2.png b/sprite/range_2.png
new file mode 100644
index 0000000..700030c
Binary files /dev/null and b/sprite/range_2.png differ
diff --git a/sprite/range_3.png b/sprite/range_3.png
new file mode 100644
index 0000000..edae028
Binary files /dev/null and b/sprite/range_3.png differ
diff --git a/sprite/range_4.png b/sprite/range_4.png
new file mode 100644
index 0000000..01d4670
Binary files /dev/null and b/sprite/range_4.png differ
diff --git a/sprite/range_5.png b/sprite/range_5.png
new file mode 100644
index 0000000..a16865d
Binary files /dev/null and b/sprite/range_5.png differ
diff --git a/sprite/sure_no.png b/sprite/sure_no.png
new file mode 100644
index 0000000..3a92043
Binary files /dev/null and b/sprite/sure_no.png differ
diff --git a/sprite/sure_yes.png b/sprite/sure_yes.png
new file mode 100644
index 0000000..63fbf79
Binary files /dev/null and b/sprite/sure_yes.png differ
diff --git a/sprite/wall.png b/sprite/wall.png
new file mode 100644
index 0000000..16da0a5
Binary files /dev/null and b/sprite/wall.png differ
diff --git a/sprite/win_the_game.png b/sprite/win_the_game.png
new file mode 100644
index 0000000..a2fc7fc
Binary files /dev/null and b/sprite/win_the_game.png differ
diff --git a/sprite/you_die.png b/sprite/you_die.png
new file mode 100644
index 0000000..0846b9e
Binary files /dev/null and b/sprite/you_die.png differ
diff --git a/sprite/you_die_1.png b/sprite/you_die_1.png
new file mode 100644
index 0000000..d6ad464
Binary files /dev/null and b/sprite/you_die_1.png differ
diff --git a/sprite/you_die_2.png b/sprite/you_die_2.png
new file mode 100644
index 0000000..0901fbd
Binary files /dev/null and b/sprite/you_die_2.png differ
diff --git a/sprite/you_die_3.png b/sprite/you_die_3.png
new file mode 100644
index 0000000..c6154c3
Binary files /dev/null and b/sprite/you_die_3.png differ
diff --git a/sprite/you_win.png b/sprite/you_win.png
new file mode 100644
index 0000000..73a9be6
Binary files /dev/null and b/sprite/you_win.png differ
diff --git a/src/bomb.c b/src/bomb.c
new file mode 100644
index 0000000..9260f56
--- /dev/null
+++ b/src/bomb.c
@@ -0,0 +1,117 @@
+#include
+#include
+#include
+#include "SDL.h"
+#include "SDL_image.h"
+
+#include "../include/game.h"
+
+struct s_bomb {
+ int x, y, portee;
+ int joueur;
+ SDL_Surface * time_image[4];
+ int current_time; //contient 1 2 3 ou 4 selon l'etat de la bombe
+ t_bomb nxt;
+};
+
+
+static void bomb_load_img(t_bomb bomb,int time, const char *filename) {
+ bomb->time_image[time] = IMG_Load(filename);
+ if (!bomb->time_image[time])
+ error("IMG_Load: %s\n", IMG_GetError());
+
+}
+
+t_bomb bomb_init(t_bomb list_bombs, int x, int y, int portee, int joueur) {
+ t_bomb bomb = malloc(sizeof(*bomb));
+ if (!bomb)
+ error("Memory error");
+
+ bomb_load_img(bomb, 0, IMG_BOMB_TTL1);
+ bomb_load_img(bomb, 1, IMG_BOMB_TTL2);
+ bomb_load_img(bomb, 2, IMG_BOMB_TTL3);
+ bomb_load_img(bomb, 3, IMG_BOMB_TTL4);
+
+ bomb->current_time = 3;
+ bomb->x=x;
+ bomb->y=y;
+ bomb->portee=portee;
+ bomb->joueur=joueur;
+ bomb->nxt=NULL;
+
+ if( list_bombs== NULL)
+ {
+ return bomb;
+ }
+ else
+ {
+ t_bomb temp=list_bombs;
+ while(temp->nxt != NULL)
+ {
+ temp = temp->nxt;
+ }
+ temp->nxt = bomb;
+ return list_bombs;
+ }
+}
+
+int bomb_get_x(t_bomb bomb) {
+ assert(bomb != NULL);
+ return bomb->x;
+}
+
+int bomb_get_y(t_bomb bomb) {
+ assert(bomb != NULL);
+ return bomb->y;
+}
+int bomb_get_joueur(t_bomb bomb) {
+ assert(bomb != NULL);
+ return bomb->joueur;
+}
+
+t_bomb get_next_bomb(t_bomb bomb){
+ return bomb->nxt;
+}
+
+void set_next_bomb(t_bomb bomb, t_bomb nxt_bomb){
+ bomb->nxt=nxt_bomb;
+}
+
+int bomb_get_portee(t_bomb bomb) {
+ assert(bomb != NULL);
+ return bomb->portee;
+}
+
+void bomb_set_current_time(t_bomb bomb, int time) {
+ assert(bomb);
+ bomb->current_time = time;
+}
+
+int bomb_get_current_time(t_bomb bomb) {
+ assert(bomb);
+ return(bomb->current_time);
+}
+
+void bomb_free(t_bomb bomb) {
+ if (bomb != NULL){
+ assert(bomb);
+ int i;
+ for (i = 0; i < 4; i++)
+ SDL_FreeSurface(bomb->time_image[i]);
+
+ free(bomb);
+ }
+}
+
+void bomb_display(t_bomb bomb, SDL_Surface *screen) {
+ assert(bomb->time_image[bomb->current_time]);
+ assert(screen);
+
+ SDL_Rect place;
+ place.x = bomb->x * SIZE_BLOC;
+ place.y = bomb->y * SIZE_BLOC;
+
+ SDL_BlitSurface(bomb->time_image[bomb->current_time], NULL, screen,&place);
+}
+
+
diff --git a/src/editeur.c b/src/editeur.c
new file mode 100644
index 0000000..a73bbc8
--- /dev/null
+++ b/src/editeur.c
@@ -0,0 +1,313 @@
+#include
+#include
+
+#include
+#include "SDL_image.h"
+#include "../include/constant.h"
+#include "../include/editeur.h"
+#include "../include/map.h"
+#include "../include/misc.h"
+
+void editeur(SDL_Surface *screen, int niveau)
+{
+ SDL_Surface *wall = NULL, *box = NULL, *goal = NULL, *player = NULL,
+ *player_2 = NULL, *bomb_range_inc= NULL, *menu_empty= NULL, *menu_lives= NULL,
+ *menu_bombs= NULL, *menu_range= NULL, *menu_player_1= NULL, *menu_player_2= NULL, *temp= NULL;
+ SDL_Rect place;
+ SDL_Rect place_joueur_1;
+ SDL_Rect place_mouse;
+ SDL_Event event;
+
+ int continuer = 1, clicGaucheEnCours = 0, clicDroitEnCours = 0;
+ int objetActuel = CELL_WALL;
+ int i, j, xp1, yp1, player1_ok=1, xp2, yp2, player2_ok=1;
+ FILE *level=fopen("data/niveaux.lvl","r");
+ t_map map = map_load_dynamic(level,niveau,2);
+
+
+#ifdef HW_SCREEN_RESIZE
+ //if(screen != NULL) SDL_FreeSurface(screen);
+ screen = SDL_CreateRGBSurface(SDL_SWSURFACE, SIZE_BLOC * map_get_width(map),
+ SIZE_BLOC * map_get_height(map), WINDOW_BPP, 0, 0, 0, 0);
+#else //HW_SCREEN_RESIZE
+ screen = SDL_SetVideoMode(SIZE_BLOC * map_get_width(map),
+ SIZE_BLOC * map_get_height(map), WINDOW_BPP,
+ SDL_HWSURFACE);
+ if (screen == NULL) {
+ error("Can't set video mode: %s\n", SDL_GetError());
+ exit(1);
+ }
+#endif //HW_SCREEN_RESIZE
+
+
+ // Chargement des objets et du niveau
+ wall = load_image(IMG_MAP_WALL);
+ box = load_image(IMG_MAP_BOX);
+ goal = load_image(IMG_MAP_GOAL);
+ player = load_image(IMG_PLAYER_DOWN);
+ player_2 = load_image(IMG_PLAYER_2_DOWN);
+ bomb_range_inc=load_image(IMG_BONUS_BOMB_RANGE_INC);
+ menu_empty=load_image(IMG_MENU_EMPTY);
+ menu_lives=load_image(IMG_MENU_LIVES_1);
+ menu_bombs=load_image(IMG_MENU_BOMBS_1);
+ menu_range=load_image(IMG_MENU_RANGE_1);
+ menu_player_1=load_image(IMG_MENU_PLAYER_1);
+ menu_player_2=load_image(IMG_MENU_PLAYER_2);
+ temp=wall;
+
+ // Boucle infinie de l'éditeur
+ while (continuer)
+ {
+ SDL_WaitEvent(&event);
+ switch(event.type)
+ {
+ case SDL_QUIT:
+ continuer = 0;
+ break;
+ case SDL_MOUSEBUTTONDOWN:
+ if (event.button.button == SDL_BUTTON_LEFT)
+ {
+ // On met l'objet actuellement choisi (wall, box...) à l'endroit du clic
+ if (objetActuel==CELL_PLAYER){
+ if(player1_ok!=1){
+ map_set_cell_type(map, xp1 , yp1, CELL_EMPTY);
+ }
+ map_set_cell_type(map, event.button.x / SIZE_BLOC, event.button.y / SIZE_BLOC, objetActuel);
+ xp1=event.button.x / SIZE_BLOC; yp1=event.button.y / SIZE_BLOC;
+ player1_ok--;
+ }
+ else if (objetActuel==CELL_PLAYER_2){
+ if(player2_ok!=1){
+ map_set_cell_type(map, xp2 , yp2, CELL_EMPTY);
+ }
+ map_set_cell_type(map, event.button.x / SIZE_BLOC, event.button.y / SIZE_BLOC, objetActuel);
+ xp2=event.button.x / SIZE_BLOC; yp2=event.button.y / SIZE_BLOC;
+ player2_ok--;
+ }
+ else {
+ map_set_cell_type(map, event.button.x / SIZE_BLOC, event.button.y / SIZE_BLOC, objetActuel);
+ }
+ clicGaucheEnCours = 1; // On active un booléen pour retenir qu'un bouton est enfoncé
+ }
+ else if (event.button.button == SDL_BUTTON_RIGHT) // Le clic droit sert à effacer
+ {
+ map_set_cell_type(map, event.button.x / SIZE_BLOC, event.button.y / SIZE_BLOC, CELL_EMPTY);
+ clicDroitEnCours = 1;
+ }
+ break;
+ case SDL_MOUSEBUTTONUP: // On désactive le booléen qui disait qu'un bouton était enfoncé
+ if (event.button.button == SDL_BUTTON_LEFT)
+ clicGaucheEnCours = 0;
+ else if (event.button.button == SDL_BUTTON_RIGHT)
+ clicDroitEnCours = 0;
+ break;
+ case SDL_MOUSEMOTION:
+
+ if (clicGaucheEnCours) // Si on déplace la souris et que le bouton gauche de la souris est enfoncé
+ {
+ if (objetActuel==CELL_PLAYER){
+ if(player1_ok!=1){
+ map_set_cell_type(map, xp1 , yp1, CELL_EMPTY);
+ }
+ map_set_cell_type(map, event.button.x / SIZE_BLOC, event.button.y / SIZE_BLOC, objetActuel);
+ xp1=event.button.x / SIZE_BLOC; yp1=event.button.y / SIZE_BLOC;
+ player1_ok--;
+ }
+ else if (objetActuel==CELL_PLAYER_2){
+ if(player2_ok!=1){
+ map_set_cell_type(map, xp2 , yp2, CELL_EMPTY);
+ }
+ map_set_cell_type(map, event.button.x / SIZE_BLOC, event.button.y / SIZE_BLOC, objetActuel);
+ xp2=event.button.x / SIZE_BLOC; yp2=event.button.y / SIZE_BLOC;
+ player2_ok--;
+ }
+ else {
+ map_set_cell_type(map, event.button.x / SIZE_BLOC, event.button.y / SIZE_BLOC, objetActuel);
+ }
+ }
+ else if (clicDroitEnCours) // Pareil pour le bouton droit de la souris
+ {
+ map_set_cell_type(map, event.motion.x / SIZE_BLOC, event.motion.y / SIZE_BLOC, CELL_EMPTY);
+ }
+ break;
+ case SDL_KEYDOWN:
+ switch(event.key.keysym.sym)
+ {
+ case SDLK_ESCAPE:
+ continuer = 0;
+ break;
+ case SDLK_s:
+ sauvegarderNiveau(map,niveau);
+ break;
+ case SDLK_KP1:
+ objetActuel = CELL_WALL;
+ temp=wall;
+ break;
+ case SDLK_KP2:
+ objetActuel = CELL_BOX;
+ temp=box;
+ break;
+ case SDLK_KP3:
+ objetActuel = CELL_GOAL;
+ temp=goal;
+ break;
+ case SDLK_KP4:
+ objetActuel = CELL_PLAYER;
+ temp=player;
+ break;
+
+ case SDLK_KP5:
+ objetActuel = (CELL_BONUS | (BONUS_BOMB_RANGE_INC << 4));
+ temp=bomb_range_inc;
+ break;
+
+ case SDLK_KP6:
+ objetActuel = CELL_MENU_EMPTY;
+ temp=menu_empty;
+ break;
+
+ case SDLK_KP7:
+ objetActuel = CELL_MENU_LIVES;
+ temp=menu_lives;
+ break;
+
+ case SDLK_KP8:
+ objetActuel = CELL_MENU_BOMBS;
+ temp=menu_bombs;
+ break;
+
+ case SDLK_KP9:
+ objetActuel = CELL_MENU_RANGE;
+ temp=menu_range;
+ break;
+
+ case SDLK_j:
+ objetActuel = CELL_PLAYER_2;
+ temp=player_2;
+ break;
+
+ case SDLK_k:
+ objetActuel = CELL_MENU_PLAYER_1;
+ temp=menu_player_1;
+ break;
+
+ case SDLK_l:
+ objetActuel = CELL_MENU_PLAYER_2;
+ temp=menu_player_2;
+ break;
+
+ default :
+ break;
+ }
+ break;
+
+ }
+
+ // Effacement de l'écran
+ SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 255, 255, 255));
+
+
+
+
+ player1_ok=1;
+ player2_ok=1;
+ // Placement des objets à l'écran
+ for (j = 0; j < map_get_height(map); j++) {
+ for (i = 0; i < map_get_width(map); i++) {
+ place.x = i * SIZE_BLOC;
+ place.y = j * SIZE_BLOC;
+ place_joueur_1.x=xp1* SIZE_BLOC;
+ place_joueur_1.y=yp1* SIZE_BLOC;
+
+ t_cell_type type = map_get_cell_type(map, i, j);
+ switch (type & 0x0f) {
+ case CELL_WALL:
+ SDL_BlitSurface(wall, NULL, screen, &place);
+ break;
+ case CELL_BOX:
+ SDL_BlitSurface(box, NULL, screen, &place);
+ break;
+ case CELL_GOAL:
+ SDL_BlitSurface(goal, NULL, screen, &place);
+ break;
+
+ case CELL_PLAYER:
+ if(player1_ok!=1){
+ map_set_cell_type(map, xp1 , yp1, CELL_EMPTY);
+ SDL_BlitSurface(player, NULL, screen, &place);
+ }
+ SDL_BlitSurface(player, NULL, screen, &place);
+ xp1=i; yp1=j;
+ player1_ok--;
+ break;
+
+ case CELL_PLAYER_2:
+ if(player2_ok!=1){
+ map_set_cell_type(map, xp2 , yp2, CELL_EMPTY);
+ SDL_BlitSurface(player, NULL, screen, &place);
+ }
+ SDL_BlitSurface(player_2, NULL, screen, &place);
+ xp2=i; yp2=j;
+ player2_ok--;
+ break;
+
+ case CELL_MENU_EMPTY:
+ SDL_BlitSurface(menu_empty, NULL, screen, &place);
+ break;
+
+ case CELL_MENU_PLAYER_1:
+ SDL_BlitSurface(menu_player_1, NULL, screen, &place);
+ break;
+
+ case CELL_MENU_PLAYER_2:
+ SDL_BlitSurface(menu_player_2, NULL, screen, &place);
+ break;
+
+ case CELL_MENU_LIVES:
+ SDL_BlitSurface(menu_lives, NULL, screen, &place);
+ break;
+
+ case CELL_MENU_BOMBS:
+ SDL_BlitSurface(menu_bombs, NULL, screen, &place);
+ break;
+
+ case CELL_MENU_RANGE:
+ SDL_BlitSurface(menu_range, NULL, screen, &place);
+ break;
+
+
+ case CELL_BONUS:
+ SDL_BlitSurface(bomb_range_inc, NULL, screen, &place);
+ break;
+ }
+ }
+ }
+
+ if(!map_is_inside(map, event.motion.x, event.motion.y)){
+ place_mouse.x = event.motion.x ;
+ place_mouse.y = event.motion.y ;
+ SDL_BlitSurface(temp, NULL, screen, &place_mouse);
+ }
+
+ // Mise à jour de l'écran
+#ifdef HW_SCREEN_RESIZE
+ SDL_FillRect(hw_screen, NULL, 0x000000);
+ flip_NNOptimized_AllowOutOfScreen(screen, hw_screen,
+ HW_SCREEN_WIDTH,
+ MIN(screen->h*HW_SCREEN_WIDTH/screen->w, HW_SCREEN_HEIGHT));
+ SDL_Flip(hw_screen);
+#else //HW_SCREEN_RESIZE
+ SDL_Flip(screen);
+#endif //HW_SCREEN_RESIZE
+ }
+
+ SDL_FreeSurface(wall);
+ SDL_FreeSurface(box);
+ SDL_FreeSurface(goal);
+ SDL_FreeSurface(player);
+ SDL_FreeSurface(bomb_range_inc);
+ SDL_FreeSurface(menu_empty);
+ SDL_FreeSurface(menu_lives);
+ SDL_FreeSurface(menu_bombs);
+ SDL_FreeSurface(menu_range);
+}
diff --git a/src/flamme.c b/src/flamme.c
new file mode 100644
index 0000000..d52def8
--- /dev/null
+++ b/src/flamme.c
@@ -0,0 +1,191 @@
+#include
+#include
+#include
+#include "SDL.h"
+#include "SDL_image.h"
+#include "../include/game.h"
+
+struct s_flamme {
+ enum e_type_flamme type; // Dans l'ordre HAUT BAS GAUCHE DROITE HRZLEFT HRZRIGHT VERTUP VERTDOWN CENTER
+ int portee, x, y;
+ SDL_Surface * type_img[4];
+ int current_time; //contient 1 2 3 ou 4 selon l'etat d'avancement de la flamme
+ t_flamme nxt;
+};
+
+static void flamme_load_img(t_flamme flamme,int place_tableau, const char *filename) {
+ flamme->type_img[place_tableau] = IMG_Load(filename);
+ if (!flamme->type_img[place_tableau])
+ error("IMG_Load: %s\n", IMG_GetError());
+}
+
+t_flamme flamme_init(t_flamme list_flammes, int x, int y, int portee, enum e_type_flamme type) {
+ t_flamme flamme = malloc(sizeof(*flamme));
+ if (!flamme)
+ error("Memory error");
+
+ switch (type) {
+ case HAUT :
+ flamme_load_img(flamme,3 , IMG_FLAMME_THIN_HAUT);
+ flamme_load_img(flamme,2 , IMG_FLAMME_MEDIUM_HAUT);
+ flamme_load_img(flamme,1 , IMG_FLAMME_FIRE_HAUT);
+ flamme_load_img(flamme,0 , IMG_FLAMME_LARGE_HAUT);
+ break;
+ case BAS :
+ flamme_load_img(flamme,3 , IMG_FLAMME_THIN_BAS);
+ flamme_load_img(flamme,2 , IMG_FLAMME_MEDIUM_BAS);
+ flamme_load_img(flamme,1 , IMG_FLAMME_FIRE_BAS);
+ flamme_load_img(flamme,0 , IMG_FLAMME_LARGE_BAS);
+ break;
+ case GAUCHE :
+ flamme_load_img(flamme,3 , IMG_FLAMME_THIN_GAUCHE);
+ flamme_load_img(flamme,2 , IMG_FLAMME_MEDIUM_GAUCHE);
+ flamme_load_img(flamme,1 , IMG_FLAMME_FIRE_GAUCHE);
+ flamme_load_img(flamme,0 , IMG_FLAMME_LARGE_GAUCHE);
+ break;
+ case DROITE :
+ flamme_load_img(flamme,3 , IMG_FLAMME_THIN_DROITE);
+ flamme_load_img(flamme,2 , IMG_FLAMME_MEDIUM_DROITE);
+ flamme_load_img(flamme,1 , IMG_FLAMME_FIRE_DROITE);
+ flamme_load_img(flamme,0 , IMG_FLAMME_LARGE_DROITE);
+ break;
+ case HRZLEFT :
+ flamme_load_img(flamme,3, IMG_FLAMME_THIN_HRZ);
+ flamme_load_img(flamme,2 , IMG_FLAMME_MEDIUM_HRZ);
+ flamme_load_img(flamme,1 , IMG_FLAMME_FIRE_HRZ);
+ flamme_load_img(flamme,0 , IMG_FLAMME_LARGE_HRZ);
+ break;
+ case HRZRIGHT :
+ flamme_load_img(flamme,3 , IMG_FLAMME_THIN_HRZ);
+ flamme_load_img(flamme,2 , IMG_FLAMME_MEDIUM_HRZ);
+ flamme_load_img(flamme,1 , IMG_FLAMME_FIRE_HRZ);
+ flamme_load_img(flamme,0 , IMG_FLAMME_LARGE_HRZ);
+ break;
+ case VERTUP :
+ flamme_load_img(flamme,3 , IMG_FLAMME_THIN_VERT);
+ flamme_load_img(flamme,2 , IMG_FLAMME_MEDIUM_VERT);
+ flamme_load_img(flamme,1 , IMG_FLAMME_FIRE_VERT);
+ flamme_load_img(flamme,0 , IMG_FLAMME_LARGE_VERT);
+ break;
+ case VERTDOWN :
+ flamme_load_img(flamme,3 , IMG_FLAMME_THIN_VERT);
+ flamme_load_img(flamme,2 , IMG_FLAMME_MEDIUM_VERT);
+ flamme_load_img(flamme,1 , IMG_FLAMME_FIRE_VERT);
+ flamme_load_img(flamme,0 , IMG_FLAMME_LARGE_VERT);
+ break;
+ case CENTER :
+ flamme_load_img(flamme,3 , IMG_FLAMME_THIN_CENTER);
+ flamme_load_img(flamme,2 , IMG_FLAMME_MEDIUM_CENTER);
+ flamme_load_img(flamme,1 , IMG_FLAMME_FIRE_CENTER);
+ flamme_load_img(flamme,0 , IMG_FLAMME_LARGE_CENTER);
+ break;
+ case M_BAS :
+ flamme_load_img(flamme,3 , IMG_FLAMME_THIN_MONSTER_BAS);
+ flamme_load_img(flamme,2 , IMG_FLAMME_MEDIUM_MONSTER_BAS);
+ flamme_load_img(flamme,1 , IMG_FLAMME_FIRE_MONSTER_BAS);
+ flamme_load_img(flamme,0 , IMG_FLAMME_LARGE_MONSTER_BAS);
+ break;
+
+ case M_HAUT :
+ flamme_load_img(flamme,3 , IMG_FLAMME_THIN_MONSTER_HAUT);
+ flamme_load_img(flamme,2 , IMG_FLAMME_MEDIUM_MONSTER_HAUT);
+ flamme_load_img(flamme,1 , IMG_FLAMME_FIRE_MONSTER_HAUT);
+ flamme_load_img(flamme,0 , IMG_FLAMME_LARGE_MONSTER_HAUT);
+ break;
+
+ case M_DROITE :
+ flamme_load_img(flamme,3 , IMG_FLAMME_THIN_MONSTER_DROITE);
+ flamme_load_img(flamme,2 , IMG_FLAMME_MEDIUM_MONSTER_DROITE);
+ flamme_load_img(flamme,1 , IMG_FLAMME_FIRE_MONSTER_DROITE);
+ flamme_load_img(flamme,0 , IMG_FLAMME_LARGE_MONSTER_DROITE);
+ break;
+
+ case M_GAUCHE :
+ flamme_load_img(flamme,3 , IMG_FLAMME_THIN_MONSTER_GAUCHE);
+ flamme_load_img(flamme,2 , IMG_FLAMME_MEDIUM_MONSTER_GAUCHE);
+ flamme_load_img(flamme,1 , IMG_FLAMME_FIRE_MONSTER_GAUCHE);
+ flamme_load_img(flamme,0 , IMG_FLAMME_LARGE_MONSTER_GAUCHE);
+ break;
+
+ }
+ flamme->current_time = 3;
+ flamme->type = type;
+ flamme->x=x;
+ flamme->y=y;
+ flamme->portee=portee;
+ flamme->nxt=NULL;
+ if( list_flammes== NULL)
+ {
+ return flamme;
+ }
+ else
+ {
+ t_flamme temp=list_flammes;
+ while(temp->nxt != NULL)
+ {
+ temp = temp->nxt;
+ }
+ temp->nxt = flamme;
+ return list_flammes;
+ }
+}
+
+t_flamme get_next_flamme(t_flamme flamme){
+ return flamme->nxt;
+}
+
+void set_next_flamme(t_flamme flamme, t_flamme nxt_flamme){
+ flamme->nxt=nxt_flamme;
+}
+
+
+int flamme_get_x(t_flamme flamme) {
+ assert(flamme != NULL);
+ return flamme->x;
+}
+
+int flamme_get_y(t_flamme flamme) {
+ assert(flamme != NULL);
+ return flamme->y;
+}
+
+int flamme_get_portee(t_flamme flamme) {
+ assert(flamme != NULL);
+ return flamme->portee;
+}
+
+enum e_type_flamme flamme_get_type(t_flamme flamme) {
+ assert(flamme != NULL);
+ return flamme->type;
+}
+
+void flamme_decrease_current_time(t_flamme flamme) {
+ assert(flamme);
+ if (flamme->current_time >= 0)
+ flamme->current_time--;
+}
+int flamme_get_current_time(t_flamme flamme) {
+ assert(flamme);
+ return(flamme->current_time);
+}
+
+void flamme_free(t_flamme flamme) {
+ if (flamme != NULL){
+ assert(flamme);
+ int i;
+ for (i = 0; i < 36; i++)
+ SDL_FreeSurface(flamme->type_img[i]);
+
+ free(flamme);
+ }
+}
+
+void flamme_display(t_flamme flamme, SDL_Surface *screen) {
+ assert(screen);
+
+ SDL_Rect place;
+ place.x = flamme->x * SIZE_BLOC;
+ place.y = flamme->y * SIZE_BLOC;
+
+ SDL_BlitSurface(flamme->type_img[flamme->current_time], NULL, screen,&place);
+}
diff --git a/src/game.c b/src/game.c
new file mode 100644
index 0000000..7e787e6
--- /dev/null
+++ b/src/game.c
@@ -0,0 +1,1176 @@
+/*
+* game.c
+*
+* Created on: 15 mars 2010
+* Author: reveille
+*/
+
+#include
+#include
+
+#include "../include/game.h"
+#include "../include/game_time.h"
+#include "../include/misc.h"
+#include "../include/player.h"
+#include "../include/bomb.h"
+#include "../include/monsters.h"
+#include "../include/flamme.h"
+
+struct s_game {
+ t_map map;
+ int nb_joueur;
+ int kill_bomb;
+ t_player player1;
+ t_player player2;
+ t_bomb list_bombs;
+ t_flamme list_flammes;
+ t_monster list_monsters;
+};
+
+
+static struct s_game the_game;
+
+t_game game_new(int nb_joueur, int niveau, int mode, int kill_bomb) {
+ game_time_init();
+
+ FILE *level;
+ if (mode==1){
+ if (nb_joueur==1)
+ level=fopen("data/level1.lvl","r");
+ else
+ level=fopen("data/level13.lvl","r");
+ }
+ else{
+ level=fopen("data/niveaux.lvl","r");
+ }
+ the_game.map = map_load_dynamic(level,niveau,nb_joueur);
+ the_game.player1 = player_init(2,1,1,1);
+ player_from_map(the_game.player1, the_game.map);
+ the_game.player2 = NULL;
+ if (nb_joueur==2){
+ the_game.player2 = player_init(2,1,1,2);
+ player2_from_map(the_game.player2, the_game.map);
+ }
+ the_game.kill_bomb=kill_bomb;
+ the_game.list_bombs=NULL;
+ the_game.nb_joueur=nb_joueur;
+ the_game.list_flammes=NULL;
+ the_game.list_monsters=NULL;
+ return &the_game;
+}
+
+
+void game_free(t_game game) {
+ assert(game);
+ t_bomb temp_bomb= game->list_bombs;
+ t_monster temp_monster= game->list_monsters;
+ t_flamme temp_flamme= game->list_flammes;
+ player_free(game->player1);
+ if (game->nb_joueur == 2)
+ player_free(game->player2);
+ map_free(game->map);
+ while(temp_bomb != NULL)
+ {
+ t_bomb tmp=temp_bomb;
+ temp_bomb = get_next_bomb(temp_bomb);
+ bomb_free(tmp);
+ }
+
+ while(temp_monster != NULL)
+ {
+ t_monster tmp=temp_monster;
+ temp_monster = get_next_monster(temp_monster);
+ monster_free(tmp);
+ }
+ while(temp_flamme != NULL)
+ {
+ t_flamme tmp=temp_flamme;
+ temp_flamme = get_next_flamme(temp_flamme);
+ free(tmp);
+ }
+}
+
+t_player game_get_player1(t_game game) {
+ assert(game);
+ return game->player1;
+}
+
+t_player game_get_player2(t_game game) {
+ assert(game);
+ return game->player2;
+}
+
+void game_init_bomb(t_game game, int x, int y, int portee, int joueur) {
+ assert(game);
+ game->list_bombs=bomb_init(game->list_bombs, x, y, portee, joueur);
+}
+
+
+t_map game_the_map(t_game game) {
+ assert(game);
+ return game->map;
+}
+
+//
+//void generate_bonus(t_game game, int x, int y){
+// t_map map = game_the_map(game);
+// int random1=rand() % 100;
+// int random2=rand() % 100;
+// int probacumulee_inf=0;
+// int probacumulee_sup=PROBA_BONUS_BOMB_RANGE * PROBA_BONUS_BOMB_RANGE_INC / 100;
+// if (random1 < PROBA_BONUS){
+// if (probacumulee_inf <= random2 && random2 <= probacumulee_sup)
+// map_set_cell_type(map, x, y, CELL_BONUS | (BONUS_BOMB_RANGE_INC << 4));
+//
+// else{
+// probacumulee_inf=probacumulee_sup;
+// probacumulee_sup += PROBA_BONUS_BOMB_RANGE * PROBA_BONUS_BOMB_RANGE_DEC / 100;
+// if (probacumulee_inf <= random2 && random2 <= probacumulee_sup)
+// map_set_cell_type(map, x, y, CELL_BONUS | (BONUS_BOMB_RANGE_DEC << 4));
+// else{
+// probacumulee_inf=probacumulee_sup;
+// probacumulee_sup += PROBA_BONUS_BOMB_NB * PROBA_BONUS_BOMB_NB_INC / 100;
+// if (probacumulee_inf <= random2 && random2 <= probacumulee_sup)
+// map_set_cell_type(map, x, y, CELL_BONUS | (BONUS_BOMB_NB_INC << 4));
+// else{
+// probacumulee_inf=probacumulee_sup;
+// probacumulee_sup += PROBA_BONUS_BOMB_NB * PROBA_BONUS_BOMB_NB_DEC / 100;
+// if (probacumulee_inf <= random2 && random2 <= probacumulee_sup)
+// map_set_cell_type(map, x, y, CELL_BONUS | (BONUS_BOMB_NB_DEC << 4));
+// else {
+// probacumulee_inf=probacumulee_sup;
+// probacumulee_sup += PROBA_BONUS_LIFE_INC;
+// if (probacumulee_inf <= random2 && random2 <= probacumulee_sup)
+// map_set_cell_type(map, x, y, CELL_BONUS | (BONUS_LIFE_INC << 4));
+// else {
+// map_set_cell_type(map,x,y,CELL_MONSTER);
+// t_monster temp=game->list_monsters;
+// game->list_monsters=monster_init(temp,x,y,1);
+// }
+// }
+// }
+// }
+// }
+// }
+// else map_set_cell_type(map,x,y,CELL_EMPTY);
+//}
+
+t_bonus_type return_bonus(){
+ int random1=rand() % 100;
+ int random2=rand() % 100;
+ int probacumulee_inf=0;
+ int probacumulee_sup=PROBA_BONUS_BOMB_RANGE * PROBA_BONUS_BOMB_RANGE_INC / 100;
+ if (random1 < PROBA_BONUS){
+ if (probacumulee_inf <= random2 && random2 <= probacumulee_sup)
+ return BONUS_BOMB_RANGE_INC;
+
+ else{
+ probacumulee_inf=probacumulee_sup;
+ probacumulee_sup += PROBA_BONUS_BOMB_RANGE * PROBA_BONUS_BOMB_RANGE_DEC / 100;
+ if (probacumulee_inf <= random2 && random2 <= probacumulee_sup)
+ return BONUS_BOMB_RANGE_DEC;
+ else{
+ probacumulee_inf=probacumulee_sup;
+ probacumulee_sup += PROBA_BONUS_BOMB_NB * PROBA_BONUS_BOMB_NB_INC / 100;
+ if (probacumulee_inf <= random2 && random2 <= probacumulee_sup)
+ return BONUS_BOMB_NB_INC;
+ else{
+ probacumulee_inf=probacumulee_sup;
+ probacumulee_sup += PROBA_BONUS_BOMB_NB * PROBA_BONUS_BOMB_NB_DEC / 100;
+ if (probacumulee_inf <= random2 && random2 <= probacumulee_sup)
+ return BONUS_BOMB_NB_DEC;
+ else {
+ probacumulee_inf=probacumulee_sup;
+ probacumulee_sup += PROBA_BONUS_LIFE_INC;
+ if (probacumulee_inf <= random2 && random2 <= probacumulee_sup)
+ return BONUS_LIFE_INC;
+ else {
+ return BONUS_MONSTER;
+ }
+ }
+ }
+ }
+ }
+ }
+ else
+ return NO_BONUS;
+}
+
+
+//Bombs management
+void bombs_management (t_game game, int all_bombs){
+
+
+#ifdef SOUND_FMOD_ACTIVATED
+ FSOUND_SAMPLE *bomb_explose = FSOUND_Sample_Load(FSOUND_FREE, "audio/bomb.wav", 0, 0, 0);
+#endif //SOUND_FMOD_ACTIVATED
+ t_bomb aux=game->list_bombs;
+ t_player player1 = game->player1;
+ t_player player2 = game->player2;
+ if (aux!=NULL){
+ t_bomb aux2=get_next_bomb(aux);
+ while(aux2 != NULL){
+ int current_time = bomb_get_current_time(aux2);
+ int next_time = -- current_time;
+
+ if (next_time>=0){
+ if (all_bombs==1){
+ bomb_set_current_time(aux2, next_time);
+ }
+ aux=get_next_bomb(aux);
+ aux2=get_next_bomb(aux);
+ }
+
+ else{
+#ifdef SOUND_FMOD_ACTIVATED
+ //FSOUND_PlaySound(FSOUND_FREE, bomb_explose);
+#endif //SOUND_FMOD_ACTIVATED
+
+ int xb=bomb_get_x(aux2);
+ int yb=bomb_get_y(aux2);
+ int xp1=player_get_x(player1);
+ int yp1=player_get_y(player1);
+ int xp2;
+ int yp2;
+ int portee=bomb_get_portee(aux2);
+
+ if ( xb==xp1 && yb==yp1){
+ player_decrease_lives(player1);
+ }
+ if ( game->nb_joueur==2){
+ xp2=player_get_x(player2);
+ yp2=player_get_y(player2);
+ if (xb==xp2 && yb==yp2){
+ player_decrease_lives(player2);
+ }
+ }
+ set_next_bomb(aux,(get_next_bomb(aux2)));
+ int joueur=bomb_get_joueur(aux2);
+ free(aux2);
+ aux2=get_next_bomb(aux);
+ map_set_cell_type(game->map, xb, yb, CELL_FLAMME);
+ game->list_flammes = flamme_init(game->list_flammes, xb ,yb, portee, CENTER);
+ t_flamme temp = game->list_flammes;
+ while (get_next_flamme(temp)!=NULL){
+ temp=get_next_flamme(temp);
+ }
+ flamme_continue(temp,game);
+ int bm,b;
+ switch (joueur) {
+ case 1:
+ bm= player_get_nb_bomb_max(player1);
+ b =player_get_nb_bomb(player1);
+ if (b list_bombs!=NULL){
+ aux=game->list_bombs;
+ int current_time = bomb_get_current_time(aux);
+ int next_time = -- current_time;
+ int joueur=bomb_get_joueur(aux);
+ if (next_time>=0){
+ if (all_bombs==1){
+ bomb_set_current_time(aux, next_time);
+ }
+ }
+ else {
+#ifdef SOUND_FMOD_ACTIVATED
+ //FSOUND_PlaySound(FSOUND_FREE, bomb_explose);
+#endif //SOUND_FMOD_ACTIVATED
+ int xb=bomb_get_x(aux);
+ int yb=bomb_get_y(aux);
+ int xp1=player_get_x(player1);
+ int yp1=player_get_y(player1);
+ int xp2;
+ int yp2;
+ int portee=bomb_get_portee(aux);
+
+ if ( xb==xp1 && yb==yp1){
+
+ player_decrease_lives(player1);
+ }
+ if ( game->nb_joueur==2){
+ xp2=player_get_x(player2);
+ yp2=player_get_y(player2);
+ if (xb==xp2 && yb==yp2){
+ player_decrease_lives(player2);
+ }
+ }
+
+ game->list_bombs=get_next_bomb(aux);
+ free(aux);
+ map_set_cell_type(game->map, xb, yb, CELL_FLAMME);
+ game->list_flammes = flamme_init(game->list_flammes, xb ,yb, portee, CENTER);
+ t_flamme temp = game->list_flammes;
+ while (get_next_flamme(temp)!=NULL){
+ temp=get_next_flamme(temp);
+ }
+ flamme_continue(temp,game);
+ int bm,b;
+ switch (joueur) {
+ case 1:
+ bm= player_get_nb_bomb_max(player1);
+ b =player_get_nb_bomb(player1);
+ if (b list_flammes;
+ t_map map=game->map;
+ if(aux != NULL){
+ t_flamme aux2=get_next_flamme(aux);
+ while(aux2 != NULL){
+
+ if (flamme_get_current_time(aux2) > 0){
+ flamme_decrease_current_time(aux2);
+ aux=get_next_flamme(aux);
+ aux2=get_next_flamme(aux);
+ }
+
+ else{
+ if (map_get_cell_type(game->map, flamme_get_x(aux2), flamme_get_y(aux2))!=CELL_MONSTER){
+ switch ((map_get_cell_type(game->map, flamme_get_x(aux2), flamme_get_y(aux2)) & 0xf0) >> 4) {
+ case BONUS_BOMB_RANGE_INC:
+ map_set_cell_type(map, flamme_get_x(aux2), flamme_get_y(aux2), CELL_BONUS | (BONUS_BOMB_RANGE_INC << 4));
+ break;
+ case BONUS_BOMB_RANGE_DEC:
+ map_set_cell_type(map, flamme_get_x(aux2), flamme_get_y(aux2), CELL_BONUS | (BONUS_BOMB_RANGE_DEC << 4));
+ break;
+ case BONUS_BOMB_NB_INC:
+ map_set_cell_type(map, flamme_get_x(aux2), flamme_get_y(aux2), CELL_BONUS | (BONUS_BOMB_NB_INC << 4));
+ break;
+ case BONUS_BOMB_NB_DEC:
+ map_set_cell_type(map, flamme_get_x(aux2), flamme_get_y(aux2), CELL_BONUS | (BONUS_BOMB_NB_DEC << 4));
+ break;
+ case BONUS_MONSTER:
+ map_set_cell_type(map,flamme_get_x(aux2), flamme_get_y(aux2), CELL_MONSTER);
+ t_monster temp=game->list_monsters;
+ game->list_monsters=monster_init(temp,flamme_get_x(aux2), flamme_get_y(aux2),1);
+ break;
+ case BONUS_LIFE_INC:
+ map_set_cell_type(map, flamme_get_x(aux2), flamme_get_y(aux2), CELL_BONUS | (BONUS_LIFE_INC << 4));
+ break;
+ case NO_BONUS:
+ map_set_cell_type(map, flamme_get_x(aux2), flamme_get_y(aux2), CELL_EMPTY);
+ break;
+ default:
+ map_set_cell_type(map, flamme_get_x(aux2), flamme_get_y(aux2), CELL_EMPTY);
+ break;
+ }
+ }
+
+ set_next_flamme(aux,(get_next_flamme(aux2)));
+ free(aux2);
+ aux2=get_next_flamme(aux);
+ }
+ }
+ aux=game->list_flammes;
+ if (flamme_get_current_time(aux) > 0){
+ flamme_decrease_current_time(aux);
+ }
+ else{
+ if (map_get_cell_type(game->map, flamme_get_x(aux), flamme_get_y(aux))!=CELL_MONSTER){
+ switch ((map_get_cell_type(game->map, flamme_get_x(aux), flamme_get_y(aux)) & 0xf0) >> 4) {
+ case BONUS_BOMB_RANGE_INC:
+ map_set_cell_type(map, flamme_get_x(aux), flamme_get_y(aux), CELL_BONUS | (BONUS_BOMB_RANGE_INC << 4));
+ break;
+ case BONUS_BOMB_RANGE_DEC:
+ map_set_cell_type(map, flamme_get_x(aux), flamme_get_y(aux), CELL_BONUS | (BONUS_BOMB_RANGE_DEC << 4));
+ break;
+ case BONUS_BOMB_NB_INC:
+ map_set_cell_type(map, flamme_get_x(aux), flamme_get_y(aux), CELL_BONUS | (BONUS_BOMB_NB_INC << 4));
+ break;
+ case BONUS_BOMB_NB_DEC:
+ map_set_cell_type(map, flamme_get_x(aux), flamme_get_y(aux), CELL_BONUS | (BONUS_BOMB_NB_DEC << 4));
+ break;
+ case BONUS_MONSTER:
+ map_set_cell_type(map,flamme_get_x(aux), flamme_get_y(aux), CELL_MONSTER);
+ t_monster temp=game->list_monsters;
+ game->list_monsters=monster_init(temp,flamme_get_x(aux), flamme_get_y(aux),1);
+ break;
+ case BONUS_LIFE_INC:
+ map_set_cell_type(map, flamme_get_x(aux), flamme_get_y(aux), CELL_BONUS | (BONUS_LIFE_INC << 4));
+ break;
+ case NO_BONUS:
+ map_set_cell_type(map, flamme_get_x(aux), flamme_get_y(aux), CELL_EMPTY);
+ break;
+ default:
+ map_set_cell_type(map, flamme_get_x(aux), flamme_get_y(aux), CELL_EMPTY);
+ break;
+ }
+ }
+ game->list_flammes=get_next_flamme(aux);
+ free(aux);
+ }
+ }
+}
+
+void flamme_continue(t_flamme flamme, t_game game) {
+
+ int x1=flamme_get_x(flamme);
+ int y1=flamme_get_y(flamme);
+ int portee=flamme_get_portee(flamme);
+ if (portee > 0){
+ switch (flamme_get_type(flamme)){
+ case CENTER:
+ flamme_check_right(x1,y1,portee,game);
+ flamme_check_left(x1,y1,portee,game);
+ flamme_check_up(x1,y1,portee,game);
+ flamme_check_down(x1,y1,portee,game);
+ break;
+
+ case HRZRIGHT:
+ flamme_check_right(x1,y1,portee,game);
+ break;
+
+ case HRZLEFT:
+ flamme_check_left(x1,y1,portee,game);
+ break;
+
+ case VERTUP:
+ flamme_check_up(x1,y1,portee,game);
+ break;
+
+ case VERTDOWN:
+ flamme_check_down(x1,y1,portee,game);
+ break;
+
+ case M_BAS:
+ flamme_check_down(x1,y1,portee,game);
+ break;
+
+ case M_HAUT:
+ flamme_check_up(x1,y1,portee,game);
+ break;
+
+ case M_GAUCHE:
+ flamme_check_left(x1,y1,portee,game);
+ break;
+
+ case M_DROITE:
+ flamme_check_right(x1,y1,portee,game);
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+
+void flamme_check_right(int x, int y, int portee, t_game game){
+ t_map map=game->map;
+ int xp1=player_get_x(game->player1);
+ int yp1=player_get_y(game->player1);
+ int xp2=-1;
+ int yp2=-1;
+ if ( game->nb_joueur==2){
+ xp2=player_get_x(game->player2);
+ yp2=player_get_y(game->player2);
+ }
+ if (map_is_inside(map, x + 1, y)){
+ switch ((map_get_cell_type(map, x + 1, y)) & 0x0f ) {
+ case CELL_BOX:
+ switch ((map_get_cell_type(map, x + 1, y) & 0xf0) >> 4) {
+ case BONUS_BOMB_RANGE_INC:
+ map_set_cell_type(map, x + 1, y, CELL_FLAMME | (BONUS_BOMB_RANGE_INC << 4));
+ break;
+ case BONUS_BOMB_RANGE_DEC:
+ map_set_cell_type(map, x + 1, y, CELL_FLAMME | (BONUS_BOMB_RANGE_DEC << 4));
+ break;
+ case BONUS_BOMB_NB_INC:
+ map_set_cell_type(map, x + 1, y, CELL_FLAMME | (BONUS_BOMB_NB_INC << 4));
+ break;
+ case BONUS_BOMB_NB_DEC:
+ map_set_cell_type(map, x + 1, y, CELL_FLAMME | (BONUS_BOMB_NB_DEC << 4));
+ break;
+ case BONUS_MONSTER:
+ map_set_cell_type(map, x + 1, y, CELL_FLAMME | (BONUS_MONSTER << 4));
+ break;
+ case BONUS_LIFE_INC:
+ map_set_cell_type(map, x + 1, y, CELL_FLAMME | (BONUS_LIFE_INC << 4));
+ break;
+ case NO_BONUS:
+ map_set_cell_type(map, x + 1, y, CELL_FLAMME | (NO_BONUS<< 4));
+ break;
+ default:
+ break;
+ }
+ game->list_flammes=flamme_init(game->list_flammes, x + 1, y, portee - 1, DROITE);
+ break;
+
+ case CELL_EMPTY:
+ if (portee == 1){
+ game->list_flammes= flamme_init(game->list_flammes, x + 1, y, portee - 1, DROITE);
+ map_set_cell_type(map, x + 1, y, CELL_FLAMME);
+ }
+ else{
+ map_set_cell_type(map, x + 1, y, CELL_FLAMME);
+ game->list_flammes = flamme_init(game->list_flammes, x + 1, y, portee - 1, HRZRIGHT);
+ t_flamme temp = game->list_flammes;
+ while (get_next_flamme(temp)!=NULL){
+ temp=get_next_flamme(temp);}
+ flamme_continue(temp,game);
+ }
+ break;
+
+ case CELL_FLAMME:
+ if (portee == 1){
+ game->list_flammes= flamme_init(game->list_flammes, x + 1, y, portee - 1, DROITE);
+ map_set_cell_type(map, x + 1, y, CELL_FLAMME);
+ }
+ else{
+ map_set_cell_type(map, x + 1, y, CELL_FLAMME);
+ game->list_flammes = flamme_init(game->list_flammes, x + 1, y, portee - 1, HRZRIGHT);
+ t_flamme temp = game->list_flammes;
+ while (get_next_flamme(temp)!=NULL){
+ temp=get_next_flamme(temp);}
+ flamme_continue(temp,game);
+ }
+ break;
+
+
+ case CELL_BONUS:
+ game->list_flammes= flamme_init(game->list_flammes, x + 1, y, portee - 1, DROITE);
+ map_set_cell_type(map, x + 1, y, CELL_FLAMME);
+ break;
+
+
+ case CELL_MONSTER:
+ game->list_monsters=kill_monster(game->list_monsters,x+1,y);
+ game->list_flammes= flamme_init(game->list_flammes, x + 1, y, portee - 1, DROITE);
+ map_set_cell_type(map, x + 1, y, CELL_FLAMME);
+ break;
+
+ case CELL_PLAYER:
+ game->list_flammes= flamme_init(game->list_flammes, x + 1, y, portee - 1, DROITE);
+ if ( game->nb_joueur==1){
+ player_decrease_lives(game->player1);
+ }
+ else{
+ if (xp1==x+1 && yp1==y) {
+ player_decrease_lives(game->player1);
+ }
+ if (xp2==x+1 && yp2==y) {
+ player_decrease_lives(game->player2);
+ }
+ }
+ break;
+
+ case CELL_PLAYER_2:
+ player_decrease_lives(game->player2);
+ break;
+
+ case CELL_BOMB:
+ if (game->kill_bomb==0){
+ if(player_get_x(game->player1)==x+1 && player_get_y(game->player1)==y)
+ player_decrease_lives(game->player1);
+
+ if(game->nb_joueur==2){
+ if(player_get_x(game->player2)==x+1 && player_get_y(game->player2)==y)
+ player_decrease_lives(game->player2);
+ }
+ }
+ else
+ kill_bomb(game, x+1, y);
+
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+
+void flamme_check_left(int x, int y, int portee, t_game game){
+ t_map map=game->map;
+ int xp1=player_get_x(game->player1);
+ int yp1=player_get_y(game->player1);
+ int xp2=-1;
+ int yp2=-1;
+ if ( game->nb_joueur==2){
+ xp2=player_get_x(game->player2);
+ yp2=player_get_y(game->player2);
+ }
+ if (map_is_inside(map, x - 1, y)){
+ switch ((map_get_cell_type(map, x - 1, y)) & 0x0f) { //Gere le cas vers la droite
+ // peut etre erreur avec le map is inside
+ case CELL_BOX:
+ switch ((map_get_cell_type(map, x - 1, y) & 0xf0) >> 4) {
+ case BONUS_BOMB_RANGE_INC:
+ map_set_cell_type(map, x - 1, y, CELL_FLAMME | (BONUS_BOMB_RANGE_INC << 4));
+ break;
+ case BONUS_BOMB_RANGE_DEC:
+ map_set_cell_type(map, x - 1, y, CELL_FLAMME | (BONUS_BOMB_RANGE_DEC << 4));
+ break;
+ case BONUS_BOMB_NB_INC:
+ map_set_cell_type(map, x - 1, y, CELL_FLAMME | (BONUS_BOMB_NB_INC << 4));
+ break;
+ case BONUS_BOMB_NB_DEC:
+ map_set_cell_type(map, x - 1, y, CELL_FLAMME | (BONUS_BOMB_NB_DEC << 4));
+ break;
+ case BONUS_MONSTER:
+ map_set_cell_type(map, x - 1, y, CELL_FLAMME | (BONUS_MONSTER << 4));
+ break;
+ case BONUS_LIFE_INC:
+ map_set_cell_type(map, x - 1, y, CELL_FLAMME | (BONUS_LIFE_INC << 4));
+ break;
+ case NO_BONUS:
+ map_set_cell_type(map, x - 1, y, CELL_FLAMME | (NO_BONUS<< 4));
+ break;
+ default:
+ break;
+ }
+ game->list_flammes=flamme_init(game->list_flammes, x - 1, y, portee - 1, GAUCHE);
+ break;
+
+ case CELL_EMPTY:
+ if (portee == 1){
+ game->list_flammes= flamme_init(game->list_flammes, x - 1, y, portee - 1, GAUCHE);
+ map_set_cell_type(map, x - 1, y, CELL_FLAMME);
+ }
+ else {
+ map_set_cell_type(map, x - 1, y, CELL_FLAMME);
+ game->list_flammes = flamme_init(game->list_flammes, x - 1, y, portee - 1, HRZLEFT);
+ t_flamme temp = game->list_flammes;
+ while (get_next_flamme(temp)!=NULL){
+ temp=get_next_flamme(temp);}
+ flamme_continue(temp,game);
+ }
+ break;
+
+
+ case CELL_FLAMME:
+ if (portee == 1){
+ game->list_flammes= flamme_init(game->list_flammes, x - 1, y, portee - 1, GAUCHE);
+ map_set_cell_type(map, x - 1, y, CELL_FLAMME);
+ }
+ else {
+ map_set_cell_type(map, x - 1, y, CELL_FLAMME);
+ game->list_flammes = flamme_init(game->list_flammes, x - 1, y, portee - 1, HRZLEFT);
+ t_flamme temp = game->list_flammes;
+ while (get_next_flamme(temp)!=NULL){
+ temp=get_next_flamme(temp);}
+ flamme_continue(temp,game);
+ }
+ break;
+
+
+ case CELL_BONUS:
+ game->list_flammes= flamme_init(game->list_flammes, x - 1, y, portee - 1, GAUCHE);
+ map_set_cell_type(map, x - 1, y, CELL_FLAMME);
+ break;
+
+
+ case CELL_MONSTER:
+ game->list_monsters=kill_monster(game->list_monsters,x-1,y);
+ game->list_flammes= flamme_init(game->list_flammes, x - 1, y, portee - 1, GAUCHE);
+ map_set_cell_type(map, x - 1, y, CELL_FLAMME);
+ break;
+
+ case CELL_PLAYER:
+ game->list_flammes= flamme_init(game->list_flammes, x - 1, y, portee - 1, GAUCHE);
+ if ( game->nb_joueur==1){
+ player_decrease_lives(game->player1);
+ }
+ else{
+ if (xp1==x-1 && yp1==y) {
+ player_decrease_lives(game->player1);
+ }
+ if (xp2==x-1 && yp2==y) {
+ player_decrease_lives(game->player2);
+ }
+ }
+ break;
+
+ case CELL_PLAYER_2:
+ player_decrease_lives(game->player2);
+ break;
+
+ case CELL_BOMB:
+ if (game->kill_bomb==0){
+ if(player_get_x(game->player1)==x-1 && player_get_y(game->player1)==y)
+ player_decrease_lives(game->player1);
+
+ if(game->nb_joueur==2){
+ if(player_get_x(game->player2)==x-1 && player_get_y(game->player2)==y)
+ player_decrease_lives(game->player2);
+ }
+ }
+ else
+ kill_bomb(game, x-1, y);
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+void flamme_check_up(int x, int y, int portee, t_game game){
+ t_map map=game->map;
+ int xp1=player_get_x(game->player1);
+ int yp1=player_get_y(game->player1);
+ int xp2=-1;
+ int yp2=-1;
+ if ( game->nb_joueur==2){
+ xp2=player_get_x(game->player2);
+ yp2=player_get_y(game->player2);
+ }
+ if (map_is_inside(map, x, y - 1)){
+ switch ((map_get_cell_type(map, x, y - 1)) & 0x0f) {
+ case CELL_BOX:
+ switch ((map_get_cell_type(map, x, y-1) & 0xf0) >> 4) {
+ case BONUS_BOMB_RANGE_INC:
+ map_set_cell_type(map, x, y-1, CELL_FLAMME | (BONUS_BOMB_RANGE_INC << 4));
+ break;
+ case BONUS_BOMB_RANGE_DEC:
+ map_set_cell_type(map, x, y-1, CELL_FLAMME | (BONUS_BOMB_RANGE_DEC << 4));
+ break;
+ case BONUS_BOMB_NB_INC:
+ map_set_cell_type(map, x, y-1, CELL_FLAMME | (BONUS_BOMB_NB_INC << 4));
+ break;
+ case BONUS_BOMB_NB_DEC:
+ map_set_cell_type(map, x, y-1, CELL_FLAMME | (BONUS_BOMB_NB_DEC << 4));
+ break;
+ case BONUS_MONSTER:
+ map_set_cell_type(map, x, y-1, CELL_FLAMME | (BONUS_MONSTER << 4));
+ break;
+ case BONUS_LIFE_INC:
+ map_set_cell_type(map, x, y-1, CELL_FLAMME | (BONUS_LIFE_INC << 4));
+ break;
+ case NO_BONUS:
+ map_set_cell_type(map, x, y-1, CELL_FLAMME | (NO_BONUS<< 4));
+ break;
+ default:
+ break;
+ }
+ game->list_flammes=flamme_init(game->list_flammes, x, y - 1, portee - 1, HAUT);
+ break;
+
+ case CELL_EMPTY:
+ if (portee == 1){
+ map_set_cell_type(map, x, y - 1, CELL_FLAMME);
+ game->list_flammes= flamme_init(game->list_flammes, x, y - 1, portee - 1, HAUT);
+ }
+ else{
+ map_set_cell_type(map, x, y - 1, CELL_FLAMME);
+ game->list_flammes = flamme_init(game->list_flammes, x, y - 1, portee - 1, VERTUP);
+ t_flamme temp = game->list_flammes;
+ while (get_next_flamme(temp)!=NULL){
+ temp=get_next_flamme(temp);}
+ flamme_continue(temp,game);
+ }
+ break;
+
+ case CELL_FLAMME:
+ if (portee == 1){
+ map_set_cell_type(map, x, y - 1, CELL_FLAMME);
+ game->list_flammes= flamme_init(game->list_flammes, x, y - 1, portee - 1, HAUT);
+ }
+ else{
+ map_set_cell_type(map, x, y - 1, CELL_FLAMME);
+ game->list_flammes = flamme_init(game->list_flammes, x, y - 1, portee - 1, VERTUP);
+ t_flamme temp = game->list_flammes;
+ while (get_next_flamme(temp)!=NULL){
+ temp=get_next_flamme(temp);}
+ flamme_continue(temp,game);
+ }
+ break;
+
+
+ case CELL_BONUS:
+ map_set_cell_type(map, x, y - 1, CELL_FLAMME);
+ game->list_flammes= flamme_init(game->list_flammes, x, y - 1, portee - 1, HAUT);
+ break;
+
+
+ case CELL_MONSTER:
+ game->list_monsters=kill_monster(game->list_monsters,x,y-1);
+ map_set_cell_type(map, x, y - 1, CELL_FLAMME);
+ game->list_flammes= flamme_init(game->list_flammes, x, y - 1, portee - 1, HAUT);
+ break;
+
+ case CELL_PLAYER:
+ game->list_flammes= flamme_init(game->list_flammes, x, y - 1, portee - 1, HAUT);
+ if ( game->nb_joueur==1){
+ player_decrease_lives(game->player1);
+ }
+ else{
+ if (xp1==x && yp1==y-1) {
+ player_decrease_lives(game->player1);
+ }
+ if (xp2==x && yp2==y-1) {
+ player_decrease_lives(game->player2);
+ }
+ }
+ break;
+
+ case CELL_PLAYER_2:
+ player_decrease_lives(game->player2);
+ break;
+
+ case CELL_BOMB:
+ if (game->kill_bomb==0){
+ if(player_get_x(game->player1)==x && player_get_y(game->player1)==y-1)
+ player_decrease_lives(game->player1);
+
+ if(game->nb_joueur==2){
+ if(player_get_x(game->player2)==x && player_get_y(game->player2)==y-1)
+ player_decrease_lives(game->player2);
+ }
+ }
+ else
+ kill_bomb(game, x, y-1);
+
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+void flamme_check_down (int x, int y, int portee, t_game game){
+ t_map map=game->map;
+ int xp1=player_get_x(game->player1);
+ int yp1=player_get_y(game->player1);
+ int xp2=-1;
+ int yp2=-1;
+ if ( game->nb_joueur==2){
+ xp2=player_get_x(game->player2);
+ yp2=player_get_y(game->player2);
+ }
+ if (map_is_inside(map, x, y + 1)){
+ switch ((map_get_cell_type(map, x, y + 1)) & 0x0f) {
+ case CELL_BOX:
+ switch ((map_get_cell_type(map, x, y+1) & 0xf0) >> 4) {
+ case BONUS_BOMB_RANGE_INC:
+ map_set_cell_type(map, x, y+1, CELL_FLAMME | (BONUS_BOMB_RANGE_INC << 4));
+ break;
+ case BONUS_BOMB_RANGE_DEC:
+ map_set_cell_type(map, x, y+1, CELL_FLAMME | (BONUS_BOMB_RANGE_DEC << 4));
+ break;
+ case BONUS_BOMB_NB_INC:
+ map_set_cell_type(map, x, y+1, CELL_FLAMME | (BONUS_BOMB_NB_INC << 4));
+ break;
+ case BONUS_BOMB_NB_DEC:
+ map_set_cell_type(map, x, y+1, CELL_FLAMME | (BONUS_BOMB_NB_DEC << 4));
+ break;
+ case BONUS_MONSTER:
+ map_set_cell_type(map, x, y+1, CELL_FLAMME | (BONUS_MONSTER << 4));
+ break;
+ case BONUS_LIFE_INC:
+ map_set_cell_type(map, x, y+1, CELL_FLAMME | (BONUS_LIFE_INC << 4));
+ break;
+ case NO_BONUS:
+ map_set_cell_type(map, x, y+1, CELL_FLAMME | (NO_BONUS<< 4));
+ break;
+ default:
+ break;
+ }
+ game->list_flammes=flamme_init(game->list_flammes, x, y + 1, portee - 1, BAS);
+ break;
+
+ case CELL_EMPTY:
+ if (portee == 1){
+ map_set_cell_type(map, x, y + 1, CELL_FLAMME);
+ game->list_flammes= flamme_init(game->list_flammes, x, y + 1, portee - 1, BAS);
+ }
+ else{
+ map_set_cell_type(map, x, y + 1, CELL_FLAMME);
+ game->list_flammes = flamme_init(game->list_flammes, x, y + 1, portee - 1, VERTDOWN);
+ t_flamme temp = game->list_flammes;
+ while (get_next_flamme(temp)!=NULL){
+ temp=get_next_flamme(temp);}
+ flamme_continue(temp,game);
+ }
+ break;
+
+ case CELL_FLAMME:
+ if (portee == 1){
+ map_set_cell_type(map, x, y + 1, CELL_FLAMME);
+ game->list_flammes= flamme_init(game->list_flammes, x, y + 1, portee - 1, BAS);
+ }
+ else{
+ map_set_cell_type(map, x, y + 1, CELL_FLAMME);
+ game->list_flammes = flamme_init(game->list_flammes, x, y + 1, portee - 1, VERTDOWN);
+ t_flamme temp = game->list_flammes;
+ while (get_next_flamme(temp)!=NULL){
+ temp=get_next_flamme(temp);}
+ flamme_continue(temp,game);
+ }
+ break;
+
+
+ case CELL_BONUS:
+ map_set_cell_type(map, x, y + 1, CELL_FLAMME);
+ game->list_flammes=flamme_init(game->list_flammes, x, y + 1, portee - 1, BAS);
+ break;
+
+
+ case CELL_MONSTER:
+ game->list_monsters=kill_monster(game->list_monsters,x,y+1);
+ map_set_cell_type(map, x, y + 1, CELL_FLAMME);
+ game->list_flammes=flamme_init(game->list_flammes, x, y + 1, portee - 1, BAS);
+
+ break;
+
+ case CELL_PLAYER:
+ game->list_flammes=flamme_init(game->list_flammes, x, y + 1, portee - 1, BAS);
+ if ( game->nb_joueur==1){
+ player_decrease_lives(game->player1);
+ }
+ else{
+ if (xp1==x && yp1==y+1) {
+ player_decrease_lives(game->player1);
+ }
+ if (xp2==x && yp2==y+1) {
+ player_decrease_lives(game->player2);
+ }
+ }
+ break;
+
+ case CELL_PLAYER_2:
+ player_decrease_lives(game->player2);
+ break;
+
+ case CELL_BOMB:
+ if (game->kill_bomb==0){
+ if(player_get_x(game->player1)==x && player_get_y(game->player1)==y+1)
+ player_decrease_lives(game->player1);
+
+ if(game->nb_joueur==2){
+ if(player_get_x(game->player2)==x && player_get_y(game->player2)==y+1)
+ player_decrease_lives(game->player2);
+ }
+ }
+ else
+ kill_bomb(game, x, y+1);
+
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+void monsters_management(t_game game, int nb_joueur) {
+ t_monster temp=game->list_monsters;
+ t_map map = game_the_map(game);
+ if (game->list_monsters!=NULL){
+ while(temp != NULL){
+ int random1=rand() % 5;
+ int x= monster_get_x(temp);
+ int y= monster_get_y(temp);
+ int portee=monster_portee(temp);
+ switch (random1) {
+ case 0:
+ monster_set_current_way(temp, UP);
+ monster_move(temp,map,game->player1,game->player2, nb_joueur);
+ break;
+ case 1:
+ monster_set_current_way(temp, RIGHT);
+ monster_move(temp,map,game->player1,game->player2, nb_joueur);
+ break;
+ case 2:
+ monster_set_current_way(temp, DOWN);
+ monster_move(temp,map,game->player1,game->player2, nb_joueur);
+ break;
+ case 3:
+ monster_set_current_way(temp, LEFT);
+ monster_move(temp,map,game->player1,game->player2, nb_joueur);
+ break;
+ case 4:
+ switch (monster_get_current_way(temp)) {
+ case UP:
+ game->list_flammes = flamme_init(game->list_flammes, x, y,portee, M_HAUT);
+ t_flamme aux = game->list_flammes;
+ while (get_next_flamme(aux)!=NULL){
+ aux=get_next_flamme(aux);}
+ flamme_continue(aux,game);
+ map_set_cell_type(map, x, y, CELL_MONSTER);
+ break;
+ case DOWN:
+ game->list_flammes = flamme_init(game->list_flammes, x, y,portee, M_BAS);
+ t_flamme aux2 = game->list_flammes;
+ while (get_next_flamme(aux2)!=NULL){
+ aux2=get_next_flamme(aux2);}
+ flamme_continue(aux2,game);
+ map_set_cell_type(map, x, y, CELL_MONSTER);
+ break;
+ case RIGHT:
+ game->list_flammes = flamme_init(game->list_flammes, x, y,portee, M_DROITE);
+ t_flamme aux3 = game->list_flammes;
+ while (get_next_flamme(aux3)!=NULL){
+ aux3=get_next_flamme(aux3);}
+ flamme_continue(aux3,game);
+ map_set_cell_type(map, x, y, CELL_MONSTER);
+ break;
+ case LEFT:
+ game->list_flammes = flamme_init(game->list_flammes, x, y,portee, M_GAUCHE);
+ t_flamme aux4 = game->list_flammes;
+ while (get_next_flamme(aux4)!=NULL){
+ aux4=get_next_flamme(aux4);}
+ flamme_continue(aux4,game);
+ map_set_cell_type(map, x, y, CELL_MONSTER);
+ break;
+ }
+ }
+ temp=get_next_monster(temp);
+ }
+ }
+}
+
+
+t_monster kill_monster(t_monster list_monsters, int x, int y) {
+ if(list_monsters == NULL)
+ return NULL;
+
+ else{
+
+ if ( monster_get_x(list_monsters) == x && monster_get_y(list_monsters) == y){
+ t_monster tmp = get_next_monster(list_monsters);
+ free(list_monsters);
+ return tmp;
+ }
+ else
+ {
+ t_monster temp=list_monsters;
+ while ( (monster_get_x(get_next_monster(temp)) != x || monster_get_y(get_next_monster(temp)) != y) && get_next_monster(temp)!=NULL){
+ temp = get_next_monster(temp);
+ }
+ if(get_next_monster(temp)!=NULL){
+ t_monster tmp=get_next_monster(get_next_monster(temp));
+ free(get_next_monster(temp));
+ set_next_monster(temp,tmp);
+ }
+ return list_monsters;
+ }
+ }
+}
+
+
+void kill_bomb(t_game game, int x, int y) {
+
+ t_bomb list_bombs=game->list_bombs;
+ if(list_bombs != NULL){
+ t_player player1 = game->player1;
+ t_player player2 = game->player2;
+ int xp1=player_get_x(player1);
+ int yp1=player_get_y(player1);
+ int xp2;
+ int yp2;
+ if ( x==xp1 && y==yp1){
+ player_decrease_lives(player1);
+ }
+ if ( game->nb_joueur==2){
+ xp2=player_get_x(player2);
+ yp2=player_get_y(player2);
+ if (x==xp2 && y==yp2){
+ player_decrease_lives(player2);
+ }
+ }
+ if ( bomb_get_x(list_bombs) == x && bomb_get_y(list_bombs) == y){
+ bomb_set_current_time(list_bombs, 0);
+// bombs_management(game,0);
+ }
+ else
+ {
+ t_bomb temp=list_bombs;
+ while ( bomb_get_x(get_next_bomb(temp)) != x || bomb_get_y(get_next_bomb(temp)) != y){
+ temp = get_next_bomb(temp);
+ }
+ temp = get_next_bomb(temp);
+ bomb_set_current_time(temp, 0);
+// bombs_management(game,0);
+ }
+ }
+}
+
+
+void game_display(t_game game, SDL_Surface *screen) {
+ assert(game);
+ SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 153, 204, 204));
+ t_bomb temp_bomb= game->list_bombs;
+ t_monster temp_monster= game->list_monsters;
+ t_flamme temp_flamme= game->list_flammes;
+ int lives_player1 = player_get_lives(game->player1);
+ int bombs_player1 = player_get_nb_bomb(game->player1);
+ int range_player1 = player_portee_bomb(game->player1);
+ int lives_player2 = 0;
+ int bombs_player2 = 0;
+ int range_player2 = 0;
+ if (game->nb_joueur == 2){
+ lives_player2 = player_get_lives(game->player2);
+ bombs_player2 = player_get_nb_bomb(game->player2);
+ range_player2 = player_portee_bomb(game->player2);
+ }
+ map_display(game->map, lives_player1, bombs_player1, range_player1, lives_player2, bombs_player2, range_player2, screen);
+
+ while(temp_bomb != NULL)
+ {
+ t_bomb tmp=temp_bomb;
+ temp_bomb = get_next_bomb(temp_bomb);
+ bomb_display(tmp,screen);
+ }
+
+ while(temp_monster != NULL)
+ {
+ t_monster tmp=temp_monster;
+ temp_monster = get_next_monster(temp_monster);
+ monster_display(tmp,screen);
+ }
+
+ player_display(game->player1, screen);
+
+ if (game->nb_joueur == 2)
+ player_display(game->player2, screen);
+
+
+ while(temp_flamme != NULL)
+ {
+ t_flamme tmp=temp_flamme;
+ temp_flamme = get_next_flamme(temp_flamme);
+ flamme_display(tmp,screen);
+ }
+
+ /** Flip screen */
+#ifdef HW_SCREEN_RESIZE
+ SDL_FillRect(hw_screen, NULL, 0x000000);
+ flip_NNOptimized_AllowOutOfScreen(screen, hw_screen,
+ HW_SCREEN_WIDTH,
+ MIN(screen->h*HW_SCREEN_WIDTH/screen->w, HW_SCREEN_HEIGHT));
+ SDL_Flip(hw_screen);
+#else //HW_SCREEN_RESIZE
+ SDL_Flip(screen);
+#endif //HW_SCREEN_RESIZE
+}
+
diff --git a/src/game_time.c b/src/game_time.c
new file mode 100644
index 0000000..1729752
--- /dev/null
+++ b/src/game_time.c
@@ -0,0 +1,68 @@
+/*
+* time.c
+*
+* Created on: 16 mars 2010
+* Author: reveille
+*/
+
+#include "../include/game_time.h"
+#include "../include/constant.h"
+
+static Uint32 timer1, timer2;
+
+struct s_game_time {
+ // Number of cycles to process before displaying an image
+ Uint16 cycles_to_calculate;
+
+ // Current speed of the game
+ Uint16 speed;
+
+ // Duration of a cycle (in ms) ~ 14ms
+ Uint16 cycle_length;
+};
+
+static struct s_game_time the_game_time;
+
+Uint16 game_time_get_cycles_to_calculate() {
+ return the_game_time.cycles_to_calculate;
+}
+
+Uint16 game_time_get_speed () {
+ return the_game_time.speed;
+}
+
+Uint16 game_time_get_cycles_length(){
+ return the_game_time.cycle_length;
+}
+
+
+void game_time_init() {
+ the_game_time.cycles_to_calculate = 0;
+ game_time_set_speed(DEFAULT_GAME_SPEED);
+}
+
+// Set the speed of the game (number of cycles per second)
+void game_time_set_speed(Uint16 speed) {
+ if (speed == 0)
+ speed = 1;
+ the_game_time.speed = speed;
+ the_game_time.cycle_length = 1000 / speed;
+ timer1 = SDL_GetTicks();
+}
+
+void game_time_update() {
+ while (1) {
+ timer2 = SDL_GetTicks() - timer1;
+
+ if (timer2 >= the_game_time.cycle_length)
+ break;
+ else
+ SDL_Delay(3);
+ }
+
+ timer1 = SDL_GetTicks() - (timer2 % the_game_time.cycle_length);
+ the_game_time.cycles_to_calculate = timer2 / the_game_time.cycle_length;
+ //printf ("%d \n", the_game_time.cycles_to_calculate);
+ if (the_game_time.cycles_to_calculate > MAX_SKIPPED_FRAMES)
+ the_game_time.cycles_to_calculate = MAX_SKIPPED_FRAMES;
+}
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..5600d57
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,910 @@
+#include
+#include
+#include
+#include
+#include // rand(), srand()
+#include // time()
+#include
+#include
+
+#include "../include/constant.h"
+#include "../include/game.h"
+#include "../include/game_time.h"
+#include "../include/editeur.h"
+#include "../include/niveau.h"
+
+#ifdef SOUND_FMOD_ACTIVATED
+ #include
+#endif //SOUND_FMOD_ACTIVATED
+
+#ifdef SOUND_SDL_ACTIVATED
+ #include "SDL_mixer.h"
+#endif //SOUND_SDL_ACTIVATED
+bool audio_init_ok = false;
+
+#ifdef HW_SCREEN_RESIZE
+ SDL_Surface *hw_screen = NULL;
+#endif //HW_SCREEN_RESIZE
+ SDL_Surface *screen=NULL;
+
+//##################################################### input_update ####################################################################
+//Gere les entrees clavier lors de la phase de jeu.
+int input_update(t_game game, int nb_joueur) {
+ SDL_Event event;
+ t_player player1 = game_get_player1(game);
+ t_player player2 = NULL;
+
+ if (nb_joueur == 2)
+ player2 = game_get_player2(game);
+
+ t_map map = game_the_map(game);
+ int x, y;
+
+ while (SDL_PollEvent(&event)) {
+ switch (event.type) {
+ case SDL_QUIT:
+ return 2;
+
+ case SDL_KEYDOWN:
+ switch (event.key.keysym.sym) {
+ case SDLK_ESCAPE:
+ return 2;
+
+ case SDLK_UP:
+ player_set_current_way(player1, UP);
+ player_move(player1, map);
+ if (player_win(player1)==1){
+ return 1;
+ }
+ break;
+
+ case SDLK_DOWN:
+ player_set_current_way(player1, DOWN);
+ player_move(player1, map);
+ if (player_win(player1)==1){
+ return 1;
+ }
+ break;
+
+ case SDLK_RIGHT:
+ player_set_current_way(player1, RIGHT);
+ player_move(player1, map);
+ if (player_win(player1)==1){
+ return 1;
+ }
+ break;
+
+ case SDLK_LEFT:
+ player_set_current_way(player1, LEFT);
+ player_move(player1, map);
+ if (player_win(player1)==1){
+ return 1;
+ }
+ break;
+
+ case SDLK_END: //sert à poser une bombe pour le joueur 1 (cette touche sert
+ x= player_get_x(player1); //pour les ordinateurs portables qui n'ont pas forcément la touce 0 à côté des flèches directionnelles)
+ y= player_get_y(player1);
+
+ if (player_get_nb_bomb(player1)>0 && map_get_cell_type(map,x,y)!=CELL_BOMB){
+ int portee=player_portee_bomb(player1);
+ game_init_bomb(game,x,y,portee,1);
+ map_set_cell_type(map, x, y, CELL_BOMB);
+ player_decrease_nb_bomb(player1);
+ }
+ break;
+
+
+ case SDLK_KP0: //sert à poser une bombe pour le joueur 1
+ x= player_get_x(player1);
+ y= player_get_y(player1);
+
+ if (player_get_nb_bomb(player1)>0 && map_get_cell_type(map,x,y)!=CELL_BOMB){
+ int portee=player_portee_bomb(player1);
+ game_init_bomb(game,x,y,portee,1);
+ map_set_cell_type(map, x, y, CELL_BOMB);
+ player_decrease_nb_bomb(player1);
+ }
+ break;
+
+ // touches du joueur 2:
+ case SDLK_e:
+ if (nb_joueur == 2){
+ player_set_current_way(player2, UP);
+ player_move(player2, map);
+ if (player_win(player2)==1){
+ return 1;
+ }}
+ break;
+
+ case SDLK_d:
+ if (nb_joueur == 2){
+ player_set_current_way(player2, DOWN);
+ player_move(player2, map);
+ if (player_win(player2)==1){
+ return 1;
+ }}
+ break;
+
+ case SDLK_f:
+ if (nb_joueur == 2){
+ player_set_current_way(player2, RIGHT);
+ player_move(player2, map);
+ if (player_win(player2)==1){
+ return 1;
+ }}
+ break;
+
+ case SDLK_s:
+ if (nb_joueur == 2){
+ player_set_current_way(player2, LEFT);
+ player_move(player2, map);
+ if (player_win(player2)==1){
+ return 1;
+ }
+ }
+ break;
+
+ case SDLK_SPACE: //sert à poser une bombe pour le joueur 2
+ if (nb_joueur == 2){
+ x= player_get_x(player2);
+ y= player_get_y(player2);
+
+ if (player_get_nb_bomb(player2)>0 && map_get_cell_type(map,x,y)!=CELL_BOMB){
+ int portee=player_portee_bomb(player2);
+ game_init_bomb(game,x,y,portee,2);
+ map_set_cell_type(map, x, y, CELL_BOMB);
+ player_decrease_nb_bomb(player2);
+ }
+ }
+ break;
+
+ default: break;
+ }
+
+ break;
+ }
+ }
+ return 0;
+}
+
+
+//##################################################### Main_game ####################################################################
+//Fonction principale une fois qu'une partie est lancee, gere l'actualisation du jeu.
+//Cette fonction retourne un entier qui est le niveau à jouer ensuite (sert pour le mode 1 joueur)
+
+int main_game(SDL_Surface *screen, int nb_joueur, int niveau, int mode, int kill_bomb, int game_over) {
+ //nb_joueur indique le nombre de joueurs
+ //niveau indique le niveau à charger
+ //mode indique si on est en mode jeu principal (dans ce cas mode=1) ou en mode "jouer aux niveaux édités" (mode=2)
+ //kill_bomb indique si les bombes peuvent ou non s'exploser entre elles (non=0, oui(par défault)=1)
+ //game_over indique combien de fois le joueur peut mourrir avant de faire game over. (3,2,1 ou 0)
+
+ srand(time(NULL));
+ SDL_Surface *menu = NULL;
+ SDL_Event event;
+ SDL_Rect positionMenu;
+ positionMenu.x = 0;
+ positionMenu.y = 0;
+ t_game game = game_new(nb_joueur,niveau,mode, kill_bomb); //on lance le jeu
+
+#ifdef HW_SCREEN_RESIZE
+ //if(screen != NULL) SDL_FreeSurface(screen);
+ screen = SDL_CreateRGBSurface(SDL_SWSURFACE, SIZE_BLOC * map_get_width(game_the_map(game)),
+ SIZE_BLOC * map_get_height(game_the_map(game)), WINDOW_BPP,
+ 0, 0, 0, 0);
+#else //HW_SCREEN_RESIZE
+ screen = SDL_SetVideoMode(SIZE_BLOC * map_get_width(game_the_map(game)),
+ SIZE_BLOC * map_get_height(game_the_map(game)), WINDOW_BPP,
+ SDL_HWSURFACE);
+ if (screen == NULL) {
+ error("Can't set video mode: %s\n", SDL_GetError());
+ exit(1);
+ }
+#endif //HW_SCREEN_RESIZE
+
+ game_display(game, screen);
+
+ int done = 0; //variable qui indique quand doit s'arréter la boucle du jeu, elle peut prendre les valeurs 2,1, ou 0.
+ // La boucle s'arrête pour les valeurs 2 et 1.
+ int k=1, l=1, m=1, n=1;
+ t_player player1 = game_get_player1(game);
+ t_player player2=NULL;
+ if (nb_joueur == 2)
+ player2 = game_get_player2(game);
+
+ SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
+
+ if (nb_joueur==1){ // boucle principale d'un jeu à 1 joueur:
+ while (done==0 && player_get_dead(player1)!=0) {
+
+ game_time_update();
+
+ if(player_get_lives(player1)!=0){
+ done = input_update(game, nb_joueur);
+
+ bombs_management(game,0);
+
+ if (k==BOMBS_SPEED){
+ k=1;
+ bombs_management(game,1); //Le management des bombes en jeu se fait tous les "BOMBS_SPEED"
+ // Le pamètre 1 de cette fonction indique qu'elle doit gérer toutes les bombes en jeu
+ }
+ else k++;
+
+
+ if (l==MONSTER_SPEED){
+ l=1;
+ monsters_management(game,1); //Le management des monstres en jeu se fait tous les "MONSTER_SPEED"
+ // Le pamètre 1 de cette fonction indique le nombre de joueurs
+ }
+ else l++;
+ }
+ else if (player_get_lives(player1)==0){
+ if (m==ANIMATION_SPEED){
+ m=1;
+ player_die(player1); // Quand le joueur meurt, le jeu s'arrête et une animation se lance.
+ }
+ else m++;
+ }
+
+ flamme_management(game); // le management des flammes se fait toutes les actualisatons du jeu.
+
+ game_display(game, screen);
+
+ }
+ }
+
+ else if (nb_joueur==2){ // boucle principale d'un jeu à 2 joueurs:
+ while (done==0 && player_get_dead(player1)!=0 && player_get_dead(player2)!=0) {
+
+ game_time_update();
+
+ if( player_get_lives(player1)!=0 && player_get_lives(player2)!=0){
+ done = input_update(game,nb_joueur);
+
+ bombs_management(game,0);
+
+ if (k==BOMBS_SPEED){
+ k=1;
+ bombs_management(game,1);
+ }
+ else k++;
+
+ if (l==MONSTER_SPEED){
+ l=1;
+ monsters_management(game, 2);
+ }
+ else l++;
+ }
+ else{
+ if (player_get_lives(player1)==0){
+ if (m==ANIMATION_SPEED){
+ m=1;
+ player_die(player1);
+ }
+ else m++;
+ }
+
+ if (player_get_lives(player2)==0){
+ if (n==ANIMATION_SPEED){
+ n=1;
+ player_die(player2);
+ }
+ else n++;
+ }
+ }
+
+ flamme_management(game);
+ game_display(game, screen);
+
+ }
+ }
+
+#ifdef HW_SCREEN_RESIZE
+ //if(screen != NULL) SDL_FreeSurface(screen);
+ screen = SDL_CreateRGBSurface(SDL_SWSURFACE, 480,480, WINDOW_BPP, 0, 0, 0, 0);
+#else //HW_SCREEN_RESIZE
+ screen = SDL_SetVideoMode(480,480, WINDOW_BPP,SDL_HWSURFACE);
+ if (screen == NULL) {
+ error("Can't set video mode: %s\n", SDL_GetError());
+ exit(1);
+ }
+#endif //HW_SCREEN_RESIZE
+
+ int boucle=0; //cette variable autorise ou non l'affichage de messages comme "vous avez gagné", "game over", ...
+
+ if (nb_joueur==1 && player_win(player1)==1){
+ menu = IMG_Load("sprite/you_win.png");
+ boucle=1;
+ }
+ if (nb_joueur==1 && player_get_dead(player1)==0 && mode!=2){
+ switch (game_over){
+ case 3:
+ menu = IMG_Load("sprite/you_die_3.png");
+ break;
+ case 2:
+ menu = IMG_Load("sprite/you_die_2.png");
+ break;
+ case 1:
+ menu = IMG_Load("sprite/you_die_1.png");
+ break;
+ case 0:
+ menu = IMG_Load("sprite/game_over.png");
+ break;
+ }
+ boucle=1;
+ }
+ else if (nb_joueur==2){
+ if(player_get_dead(player1)==0 && player_get_dead(player2)==0){
+ menu = IMG_Load("sprite/egalite.png");
+ boucle=1;}
+
+ else if (player_get_dead(player1)==0){
+ menu = IMG_Load("sprite/p_2_win.png");
+ boucle=1;
+ }
+
+ else if (player_get_dead(player2)==0){
+ menu = IMG_Load("sprite/p_1_win.png");
+ boucle=1;
+ }
+ else if(player_win(player1)){
+ menu = IMG_Load("sprite/p_1_win.png");
+ boucle=1;
+ }
+ else if(player_win(player2)){
+ menu = IMG_Load("sprite/p_2_win.png");
+ boucle=1;
+ }
+ }
+ SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+ SDL_BlitSurface(menu, NULL, screen, &positionMenu);
+#ifdef HW_SCREEN_RESIZE
+ SDL_FillRect(hw_screen, NULL, 0x000000);
+ flip_NNOptimized_AllowOutOfScreen(screen, hw_screen,
+ HW_SCREEN_WIDTH,
+ MIN(screen->h*HW_SCREEN_WIDTH/screen->w, HW_SCREEN_HEIGHT));
+ SDL_Flip(hw_screen);
+#else //HW_SCREEN_RESIZE
+ SDL_Flip(screen);
+#endif //HW_SCREEN_RESIZE
+
+ bool continu = false;
+ if (boucle==1){
+ while (!continu)
+ {
+ SDL_WaitEvent(&event);
+ switch(event.type)
+ {
+ case SDL_QUIT:
+ continu = 1;
+ break;
+ case SDL_KEYDOWN:
+ switch(event.key.keysym.sym){
+ case SDLK_ESCAPE:
+ continu = 1;
+ break;
+ case SDLK_RETURN:
+ continu = 1;
+ break;
+ case SDLK_KP_ENTER:
+ continu = 1;
+ break;
+ default: break;
+ }
+ break;
+ }
+ }
+ }
+ SDL_FreeSurface(menu);
+
+ if (nb_joueur==1 && player_win(player1)==1){
+ game_free(game);
+ return niveau; //permet de passer au niveau suivant
+ }
+ else if(game_over==0){
+ game_over=NB_DECES;
+ game_free(game);
+ return 0; // s'il y a game over la valeur retournée est 0 afin de reprendre le jeu depuis le niveau 1
+ }
+ else if(done==2){
+ return -1; // la valeur -1 sert à indiquer que l'utilisateur a appuyé sur échap ou quitter
+ // elle informe qu'il faudra rejouer le niveau sans décrémenter la variable game_over
+ // (donc le nombre de décès autorisés avant d'avoir un game over)
+ }
+ else {
+ game_free(game);
+ return niveau-1; // lorsque le joueur meurt, informe qu'il faut
+ //rejouer le niveau précédent et décrémenter la variable game_over
+ }
+}
+
+
+//##################################################### Main ####################################################################
+//Fonction principale du jeu
+int main(int argc, char *argv[]) {
+ SDL_Surface *menu = NULL;
+ SDL_Event event;
+ SDL_Rect positionMenu;
+ if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
+ error("Can't init SDL: %s\n", SDL_GetError());
+ }
+ SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
+
+ /** Init Video */
+#ifdef HW_SCREEN_RESIZE
+ hw_screen = SDL_SetVideoMode(HW_SCREEN_WIDTH,HW_SCREEN_HEIGHT, WINDOW_BPP, SDL_HWSURFACE|SDL_DOUBLEBUF);
+ if (hw_screen == NULL) {
+ error("Can't set video mode: %s\n", SDL_GetError());
+ }
+ //if(screen != NULL) SDL_FreeSurface(screen);
+ screen = SDL_CreateRGBSurface(SDL_SWSURFACE, 700,500, WINDOW_BPP, 0, 0, 0, 0);
+#else //HW_SCREEN_RESIZE
+ screen = SDL_SetVideoMode(700,500, WINDOW_BPP,SDL_HWSURFACE);
+ if (screen == NULL) {
+ error("Can't set video mode: %s\n", SDL_GetError());
+ }
+#endif //HW_SCREEN_RESIZE
+ SDL_WM_SetIcon(IMG_Load(IMG_PLAYER_DOWN), NULL);
+ SDL_WM_SetCaption("[PG110] Projet 2010", NULL);
+
+
+ /** Load audio */
+#ifdef SOUND_FMOD_ACTIVATED
+ FMUSIC_MODULE *musique_menu_p;
+ FMUSIC_MODULE *musique_editeur;
+ FMUSIC_MODULE *musique_2_p;
+ FMUSIC_MODULE *musique_1_p;
+ FMUSIC_MODULE *musique_p_e;
+
+ if(!FSOUND_Init(11025, 32, 0)){
+ printf("Cannot init audio with FSOUND_Init\n");
+ }
+ else{
+ audio_init_ok = true;
+ musique_menu_p = FMUSIC_LoadSong("audio/mm2titl2.mid");
+ musique_editeur = FMUSIC_LoadSong("audio/mm2crash.mid");
+ musique_2_p = FMUSIC_LoadSong("audio/mm2wy1.mid");
+ musique_1_p = FMUSIC_LoadSong("audio/mix_1_p.mid");
+ musique_p_e = FMUSIC_LoadSong("audio/mm2flash.mid");
+ FMUSIC_SetMasterVolume(musique_menu_p, 130);
+ FMUSIC_SetMasterVolume(musique_p_e, 130);
+ FMUSIC_SetMasterVolume(musique_editeur, 130);
+ FMUSIC_SetMasterVolume(musique_2_p, 130);
+ FMUSIC_SetMasterVolume(musique_1_p, 130);
+ }
+#elif defined(SOUND_SDL_ACTIVATED)
+ // Setup audio mode
+ Mix_Music *musique_menu_p = NULL;
+ Mix_Music *musique_editeur = NULL;
+ Mix_Music *musique_2_p = NULL;
+ Mix_Music *musique_1_p = NULL;
+ Mix_Music *musique_p_e = NULL;
+
+ //if(Mix_OpenAudio(22050, AUDIO_S16SYS, 2, 640)==-1){
+ if(Mix_OpenAudio(44100, MIX_DEFAULT_FORMAT, 2, 1024)==-1){
+ printf("Mix_OpenAudio: %s\n", Mix_GetError());
+ //exit(2);
+ }
+ else{
+ audio_init_ok = true;
+ musique_menu_p = Mix_LoadMUS("audio/mm2titl2.mid");
+ musique_editeur = Mix_LoadMUS("audio/mm2crash.mid");
+ musique_2_p = Mix_LoadMUS("audio/mm2wy1.mid");
+ musique_1_p = Mix_LoadMUS("audio/mix_1_p.mid");
+ musique_p_e = Mix_LoadMUS("audio/mm2flash.mid");
+ }
+#endif //SOUND_SDL_ACTIVATED
+
+ /** Init vars for graphics and game */
+ menu = IMG_Load("sprite/menu_1_p.png");
+ positionMenu.x = 0;
+ positionMenu.y = 0;
+
+ bool done = false; //variable de la boucle principale du bomberman (false: le jeu continu, true: le jeu s'arrête)
+ int niveau_reussi=0, ancien_niveau=1, choix_entrer_dans_niveau, choix_entrer_niveau_2p=1, choix_niveau=1,
+ choix_ancien_niveau, choix_option, nb_joueurs, sure, kill_bomb=1;
+
+ //niveau_reussi sert pour le mode 1 joueur à indiquer à quel niveau se trouve le joueur
+ //ancien_niveau informe à quel niveau se trouvait le joueur avant de lancer main_game
+ //choix_entrer_dans_niveau=0 si le joueur accepte de rentrer dans le niveau indiqué, 1 sinon.
+ //choix_entrer_niveau_2p permet de choisir lequel des 6 niveaux disponibles en 2 joueurs l'utilisateur choisi.
+ //choix_niveau sert à la même chose que choix_entrer_niveau_2p mais pour l'éditeur et le mode "jouer aux jeux édités"
+ //idem pour choix_option sauf que c'est pour le mode option (1:jouer son, 2: arrêter son, 3: les bombes s'explosent
+ //entres elles, 4: les bombes ne s'explosent pas entre elles)
+ //choix_ancien_niveau sert (en deux joueurs et en mode "jouer aux jeux édités) à replacer automatiquement
+ //le curseur sur le niveau qui vien d'être joué.
+ //sure=1 si l'utilisateur est sûr de quitter, 0 sinon.
+ //kill_bomb=0 si les bombes ne s'explosent pas entre elles, 1 sinon.
+ //audio sert pour le son (voir version Windows)
+
+ int choix_actuel=1; //indique la position du curseur dans le menu principal (1: jeu 1 joueur, 2: jeu 2 joueurs,
+ //3:editeur, 4:jouer aux niveaux edités, 5: options, 6: quitter)
+ int game_over=NB_DECES;
+ int resize=0; //Si resize=1 on remet l'écran à la taille 700*500
+
+ int play_music=1;
+ int audio=1;
+
+ while (!done)
+ {
+ if (play_music==1){
+ if(audio_init_ok && audio==1){
+#ifdef SOUND_FMOD_ACTIVATED
+ FMUSIC_PlaySong(musique_menu_p);
+#elif defined(SOUND_SDL_ACTIVATED)
+ Mix_PlayMusic(musique_menu_p, -1);
+#endif //SOUND_SDL_ACTIVATED
+ }
+ play_music=0;
+ }
+
+ SDL_WaitEvent(&event);
+ switch(event.type)
+ {
+ case SDL_QUIT:
+ //FMUSIC_StopSong(musique_menu_p);
+ done = 1;
+ break;
+ case SDL_KEYDOWN:
+
+ if(event.key.keysym.sym==SDLK_ESCAPE){ // Veut arrêter le jeu
+ // FMUSIC_StopSong(musique_menu_p);
+ done = 1;
+ }
+ else if(event.key.keysym.sym==SDLK_UP){
+ switch(choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/menu_q.png");
+ choix_actuel=6;
+ break;
+ case 2:
+ menu = IMG_Load("sprite/menu_1_p.png");
+ choix_actuel=1;
+ break;
+ case 3:
+ menu = IMG_Load("sprite/menu_2_p.png");
+ choix_actuel=2;
+ break;
+ case 4:
+ menu = IMG_Load("sprite/menu_e.png");
+ choix_actuel=3;
+ break;
+ case 5:
+ menu = IMG_Load("sprite/menu_j_e.png");
+ choix_actuel=4;
+ break;
+ case 6:
+ menu = IMG_Load("sprite/menu_o.png");
+ choix_actuel=5;
+ break;
+ }
+ }
+ else if(event.key.keysym.sym==SDLK_DOWN){
+ switch(choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/menu_2_p.png");
+ choix_actuel=2;
+ break;
+ case 2:
+ menu = IMG_Load("sprite/menu_e.png");
+ choix_actuel=3;
+ break;
+ case 3:
+ menu = IMG_Load("sprite/menu_j_e.png");
+ choix_actuel=4;
+ break;
+ case 4:
+ menu = IMG_Load("sprite/menu_o.png");
+ choix_actuel=5;
+ break;
+ case 5:
+ menu = IMG_Load("sprite/menu_q.png");
+ choix_actuel=6;
+ break;
+ case 6:
+ menu = IMG_Load("sprite/menu_1_p.png");
+ choix_actuel=1;
+ break;
+ }
+ }
+ else if(event.key.keysym.sym==SDLK_RETURN || event.key.keysym.sym==SDLK_KP_ENTER){
+ switch(choix_actuel){
+
+ case 1: //on rentre dans le mode 1 joueur.
+ if(audio_init_ok && audio==1){
+#ifdef SOUND_FMOD_ACTIVATED
+ FMUSIC_StopSong(musique_menu_p);
+ FMUSIC_PlaySong(musique_1_p);
+#elif defined(SOUND_SDL_ACTIVATED)
+ Mix_HaltMusic();
+ Mix_PlayMusic(musique_1_p, -1);
+#endif //SOUND_SDL_ACTIVATED
+ }
+ while (niveau_reussi< 10){ //En effet il n'y a que 10 niveaux dans ce jeu
+
+ if(game_over<0){
+ niveau_reussi=0; //après game over le joueur repart du niveau 1;
+ game_over=NB_DECES;
+ }
+
+ choix_entrer_dans_niveau=niveau_1_joueur(screen,niveau_reussi+1);
+ if (choix_entrer_dans_niveau==0){
+ ancien_niveau=niveau_reussi;
+ niveau_reussi=main_game(screen,1,niveau_reussi+1,1, kill_bomb, game_over); // le jeu se lance,
+ //le résultat retourné est stocké dans la variable niveau_reussi.
+
+ if(ancien_niveau==niveau_reussi && ancien_niveau!=0){
+ game_over--; //on regarde si le joueur est mort, dans ce cas on décrémente game_over.
+ }
+
+ else if(niveau_reussi==-1) //si l'utilisateur a fait échap ou quitter durant la partie.
+ niveau_reussi=ancien_niveau;
+
+ if (niveau_reussi>=10){ //si l'utilisateur à gagné le mode 1 joueur
+ choix_entrer_dans_niveau=niveau_1_joueur(screen,0);
+ niveau_reussi=0;
+ game_over=NB_DECES;
+ // FMUSIC_StopSong(musique_1_p);
+ // play_music=1;
+ break;
+ }
+ }
+
+ else{
+ if(are_you_sure(screen)==1){ //si l'utilisateur veut quitter le mode 1 joueur
+ play_music=1;
+ if(audio_init_ok && audio==1){
+#ifdef SOUND_FMOD_ACTIVATED
+ FMUSIC_StopSong(musique_1_p);
+#elif defined(SOUND_SDL_ACTIVATED)
+ Mix_HaltMusic();
+#endif //SOUND_SDL_ACTIVATED
+ }
+ break;
+ }
+ }
+ }
+ resize=1;
+ break;
+
+ case 2:
+ if(audio_init_ok && audio==1){
+#ifdef SOUND_FMOD_ACTIVATED
+ FMUSIC_StopSong(musique_menu_p);
+ FMUSIC_PlaySong(musique_2_p);
+#elif defined(SOUND_SDL_ACTIVATED)
+ Mix_HaltMusic();
+ Mix_PlayMusic(musique_2_p, -1);
+#endif //SOUND_SDL_ACTIVATED
+ }
+ sure=2;
+ choix_entrer_niveau_2p=1;
+ choix_ancien_niveau=choix_entrer_niveau_2p;
+ while (sure!=1){
+ if (choix_entrer_niveau_2p!=0)
+ choix_ancien_niveau=choix_entrer_niveau_2p;
+
+ choix_entrer_niveau_2p=niveau_2_joueur(screen,choix_ancien_niveau);
+
+ if(choix_entrer_niveau_2p==0)
+ sure=are_you_sure(screen);
+ else
+ main_game(screen,2,choix_entrer_niveau_2p,1, kill_bomb, game_over);
+
+
+ }
+
+ play_music=1;
+ if(audio_init_ok && audio==1){
+#ifdef SOUND_FMOD_ACTIVATED
+ FMUSIC_StopSong(musique_2_p);
+#elif defined(SOUND_SDL_ACTIVATED)
+ Mix_HaltMusic();
+#endif //SOUND_SDL_ACTIVATED
+ }
+ resize=1;
+ break;
+
+ case 3:
+ if(audio_init_ok && audio==1){
+#ifdef SOUND_FMOD_ACTIVATED
+ FMUSIC_StopSong(musique_menu_p);
+ FMUSIC_PlaySong(musique_editeur);
+#elif defined(SOUND_SDL_ACTIVATED)
+ Mix_HaltMusic();
+ Mix_PlayMusic(musique_editeur, -1);
+#endif //SOUND_SDL_ACTIVATED
+ }
+ sure=2;
+ choix_niveau=1;
+ choix_ancien_niveau=choix_niveau;
+ while (sure!=1){
+ if (choix_niveau!=0)
+ choix_ancien_niveau=choix_niveau;
+
+ choix_niveau=niveau_2_joueur(screen,choix_ancien_niveau);
+
+ if(choix_niveau==0)
+ sure=are_you_sure(screen);
+ else if (niveau_1_joueur(screen,-1)==0)
+ editeur(screen,choix_niveau);
+
+ }
+
+ play_music=1;
+ if(audio_init_ok && audio==1){
+#ifdef SOUND_FMOD_ACTIVATED
+ FMUSIC_StopSong(musique_editeur);
+#elif defined(SOUND_SDL_ACTIVATED)
+ Mix_HaltMusic();
+#endif //SOUND_SDL_ACTIVATED
+ }
+
+ resize=1;
+ break;
+
+ case 4:
+ if(audio_init_ok && audio==1){
+#ifdef SOUND_FMOD_ACTIVATED
+ FMUSIC_StopSong(musique_menu_p);
+ FMUSIC_PlaySong(musique_p_e);
+#elif defined(SOUND_SDL_ACTIVATED)
+ Mix_HaltMusic();
+ Mix_PlayMusic(musique_p_e, -1);
+#endif //SOUND_SDL_ACTIVATED
+ }
+ sure=2;
+ choix_niveau=1;
+ choix_ancien_niveau=choix_niveau;
+ while (sure!=1){
+ if (choix_niveau!=0){
+ choix_ancien_niveau=choix_niveau;
+ }
+ choix_niveau=niveau_2_joueur(screen,choix_ancien_niveau);
+
+
+ if(choix_niveau==0){
+ sure=are_you_sure(screen);
+ }
+ else{
+
+ nb_joueurs=choix_nb_joueurs(screen);
+
+ if(nb_joueurs!=0 ){
+ main_game(screen,nb_joueurs,choix_niveau,2, kill_bomb, game_over);
+ }
+ }
+
+ }
+
+ play_music=1;
+ if(audio_init_ok && audio==1){
+#ifdef SOUND_FMOD_ACTIVATED
+ FMUSIC_StopSong(musique_p_e);
+#elif defined(SOUND_SDL_ACTIVATED)
+ Mix_HaltMusic();
+#endif //SOUND_SDL_ACTIVATED
+ }
+
+ resize=1;
+ break;
+
+ case 5:
+ choix_option=options(screen);
+
+ switch(choix_option){
+ case 0:
+ break;
+ case 1:
+ if(audio_init_ok){
+#ifdef SOUND_FMOD_ACTIVATED
+ FMUSIC_PlaySong(musique_menu_p);
+#elif defined(SOUND_SDL_ACTIVATED)
+ Mix_PlayMusic(musique_menu_p, -1);
+#endif //SOUND_SDL_ACTIVATED
+ }
+ audio=1;
+ break;
+ case 2:
+ if(audio_init_ok){
+#ifdef SOUND_FMOD_ACTIVATED
+ FMUSIC_StopSong(musique_menu_p);
+#elif defined(SOUND_SDL_ACTIVATED)
+ Mix_HaltMusic();
+#endif //SOUND_SDL_ACTIVATED
+ }
+ audio=0;
+ break;
+ case 3:
+ kill_bomb=1;
+ break;
+ case 4:
+ kill_bomb=0;
+ break;
+ default: break;
+ }
+ resize=1;
+ break;
+
+
+ case 6:
+ if(are_you_sure(screen)==1){
+ if(audio_init_ok && audio==1)
+#ifdef SOUND_FMOD_ACTIVATED
+ FMUSIC_StopSong(musique_menu_p);
+#elif defined(SOUND_SDL_ACTIVATED)
+ Mix_HaltMusic();
+#endif //SOUND_FMOD_ACTIVATED
+ done=1;
+ resize=1;
+ break;
+ }
+ else
+ resize=1;
+ break;
+
+
+ default: break;
+
+ }
+ break;
+ }
+ default: break;
+ }
+
+
+ if (resize==1){
+#ifdef HW_SCREEN_RESIZE
+ //if(screen != NULL) SDL_FreeSurface(screen);
+ screen = SDL_CreateRGBSurface(SDL_SWSURFACE, 700,500, WINDOW_BPP, 0, 0, 0, 0);
+#else //HW_SCREEN_RESIZE
+ screen = SDL_SetVideoMode(700,500, WINDOW_BPP,SDL_HWSURFACE);
+ if (screen == NULL) {
+ error("Can't set video mode: %s\n", SDL_GetError());
+ exit(1);
+ }
+#endif //HW_SCREEN_RESIZE
+ resize=0;
+ }
+
+ // Effacement de l'écran
+ SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+ SDL_BlitSurface(menu, NULL, screen, &positionMenu);
+
+#ifdef HW_SCREEN_RESIZE
+ SDL_FillRect(hw_screen, NULL, 0x000000);
+ flip_NNOptimized_AllowOutOfScreen(screen, hw_screen,
+ HW_SCREEN_WIDTH,
+ MIN(screen->h*HW_SCREEN_WIDTH/screen->w, HW_SCREEN_HEIGHT));
+ SDL_Flip(hw_screen);
+#else //HW_SCREEN_RESIZE
+ SDL_Flip(screen);
+#endif //HW_SCREEN_RESIZE
+
+ }
+
+ if(audio_init_ok){
+#ifdef SOUND_FMOD_ACTIVATED
+ FMUSIC_FreeSong(musique_menu_p);
+ FMUSIC_FreeSong(musique_2_p);
+ FMUSIC_FreeSong(musique_1_p);
+ FMUSIC_FreeSong(musique_p_e);
+ FMUSIC_FreeSong(musique_editeur);
+#elif defined(SOUND_SDL_ACTIVATED)
+ Mix_FreeMusic(musique_menu_p);
+ Mix_FreeMusic(musique_2_p);
+ Mix_FreeMusic(musique_1_p);
+ Mix_FreeMusic(musique_p_e);
+ Mix_FreeMusic(musique_editeur);
+ Mix_CloseAudio();
+#endif //SOUND_SDL_ACTIVATED
+ }
+
+ SDL_FreeSurface(menu);
+ SDL_Quit();
+
+ return EXIT_SUCCESS;
+}
+
diff --git a/src/map.c b/src/map.c
new file mode 100644
index 0000000..f48fab3
--- /dev/null
+++ b/src/map.c
@@ -0,0 +1,597 @@
+#include
+#include
+#include
+#include
+#include "SDL_image.h"
+
+#include
+#include "../include/constant.h"
+#include "../include/map.h"
+#include "../include/misc.h"
+#include "../include/game_time.h"
+#include "../include/game.h"
+
+
+
+
+struct t_map {
+ int width;
+ int height;
+
+ t_cell_type *grid;
+
+ SDL_Surface *img_wall;
+ SDL_Surface *img_box;
+ SDL_Surface *img_goal;
+ SDL_Surface *img_bonus_bomb_range_inc;
+ SDL_Surface *img_bonus_bomb_range_dec;
+ SDL_Surface *img_bonus_bomb_nb_inc;
+ SDL_Surface *img_bonus_bomb_nb_dec;
+ SDL_Surface *img_bonus_life_inc;
+ SDL_Surface *img_menu_lives_0;
+ SDL_Surface *img_menu_lives_1;
+ SDL_Surface *img_menu_lives_2;
+ SDL_Surface *img_menu_lives_3;
+ SDL_Surface *img_menu_lives_4;
+ SDL_Surface *img_menu_bombs_0;
+ SDL_Surface *img_menu_bombs_1;
+ SDL_Surface *img_menu_bombs_2;
+ SDL_Surface *img_menu_bombs_3;
+ SDL_Surface *img_menu_bombs_4;
+ SDL_Surface *img_menu_bombs_5;
+ SDL_Surface *img_menu_range_0;
+ SDL_Surface *img_menu_range_1;
+ SDL_Surface *img_menu_range_2;
+ SDL_Surface *img_menu_range_3;
+ SDL_Surface *img_menu_range_4;
+ SDL_Surface *img_menu_range_5;
+ SDL_Surface *img_menu_empty;
+ SDL_Surface *img_menu_player_1;
+ SDL_Surface *img_menu_player_2;
+
+ int nb_monsters;
+};
+
+#define CELL(i,j) (i + map->width * j)
+
+t_map map_new(int width, int height) {
+ assert(width > 0 && height > 0);
+
+ t_map map = malloc(sizeof(struct t_map));
+ if (map == NULL)
+ exit(EXIT_FAILURE);
+
+ map->width = width;
+ map->height = height;
+ map->nb_monsters = 0;
+
+ map->grid = (t_cell_type *) malloc(height * width * sizeof(t_cell_type));
+ if (map->grid == NULL)
+ exit(EXIT_FAILURE);
+
+ // Grid cleaning
+ int i, j;
+ for (i = 0; i < width; i++) {
+ for (j = 0; j < height; j++) {
+ map->grid[CELL(i,j)] = CELL_EMPTY;
+ }
+ }
+
+ // Sprite loading
+ map->img_wall = load_image(IMG_MAP_WALL);
+ map->img_box = load_image(IMG_MAP_BOX);
+ map->img_goal = load_image(IMG_MAP_GOAL);
+ map->img_bonus_bomb_range_inc = load_image(IMG_BONUS_BOMB_RANGE_INC);
+ map->img_bonus_bomb_range_dec = load_image(IMG_BONUS_BOMB_RANGE_DEC);
+ map->img_bonus_bomb_nb_inc = load_image(IMG_BONUS_BOMB_NB_INC);
+ map->img_bonus_bomb_nb_dec = load_image(IMG_BONUS_BOMB_NB_DEC);
+ map->img_bonus_life_inc = load_image(IMG_BONUS_LIFE_INC);
+ map->img_menu_empty = load_image(IMG_MENU_EMPTY);
+ map->img_menu_lives_0 = load_image(IMG_MENU_LIVES_0);
+ map->img_menu_lives_1 = load_image(IMG_MENU_LIVES_1);
+ map->img_menu_lives_2 = load_image(IMG_MENU_LIVES_2);
+ map->img_menu_lives_3 = load_image(IMG_MENU_LIVES_3);
+ map->img_menu_lives_4 = load_image(IMG_MENU_LIVES_4);
+ map->img_menu_bombs_0 = load_image(IMG_MENU_BOMBS_0);
+ map->img_menu_bombs_1 = load_image(IMG_MENU_BOMBS_1);
+ map->img_menu_bombs_2 = load_image(IMG_MENU_BOMBS_2);
+ map->img_menu_bombs_3 = load_image(IMG_MENU_BOMBS_3);
+ map->img_menu_bombs_4 = load_image(IMG_MENU_BOMBS_4);
+ map->img_menu_bombs_5 = load_image(IMG_MENU_BOMBS_5);
+ map->img_menu_range_0 = load_image(IMG_MENU_RANGE_0);
+ map->img_menu_range_1 = load_image(IMG_MENU_RANGE_1);
+ map->img_menu_range_2 = load_image(IMG_MENU_RANGE_2);
+ map->img_menu_range_3 = load_image(IMG_MENU_RANGE_3);
+ map->img_menu_range_4 = load_image(IMG_MENU_RANGE_4);
+ map->img_menu_range_5 = load_image(IMG_MENU_RANGE_5);
+ map->img_menu_player_1 = load_image(IMG_MENU_PLAYER_1);
+ map->img_menu_player_2 = load_image(IMG_MENU_PLAYER_2);
+
+ return map;
+}
+
+int map_is_inside(t_map map, int x, int y) {
+ assert(map);
+ int width=map_get_width(map);
+ int height=map_get_height(map);
+ if (x<0 || x>=width)
+ return 0;
+ if (y<0 || y>=height)
+ return 0;
+ return 1;
+}
+
+
+void map_free(t_map map) {
+ if (map == NULL)
+ return;
+
+ free(map->grid);
+ SDL_FreeSurface(map->img_wall);
+ SDL_FreeSurface(map->img_box);
+ SDL_FreeSurface(map->img_goal);
+ SDL_FreeSurface(map->img_bonus_bomb_range_inc);
+ SDL_FreeSurface(map->img_bonus_bomb_range_dec);
+ SDL_FreeSurface(map->img_bonus_bomb_nb_inc);
+ SDL_FreeSurface(map->img_bonus_bomb_nb_dec);
+ SDL_FreeSurface(map->img_bonus_life_inc);
+ SDL_FreeSurface(map->img_menu_empty);
+ SDL_FreeSurface(map->img_menu_lives_0);
+ SDL_FreeSurface(map->img_menu_lives_1);
+ SDL_FreeSurface(map->img_menu_lives_2);
+ SDL_FreeSurface(map->img_menu_lives_3);
+ SDL_FreeSurface(map->img_menu_lives_4);
+ SDL_FreeSurface(map->img_menu_bombs_0);
+ SDL_FreeSurface(map->img_menu_bombs_1);
+ SDL_FreeSurface(map->img_menu_bombs_2);
+ SDL_FreeSurface(map->img_menu_bombs_3);
+ SDL_FreeSurface(map->img_menu_bombs_4);
+ SDL_FreeSurface(map->img_menu_bombs_5);
+ SDL_FreeSurface(map->img_menu_range_0);
+ SDL_FreeSurface(map->img_menu_range_1);
+ SDL_FreeSurface(map->img_menu_range_2);
+ SDL_FreeSurface(map->img_menu_range_3);
+ SDL_FreeSurface(map->img_menu_range_4);
+ SDL_FreeSurface(map->img_menu_range_5);
+ SDL_FreeSurface(map->img_menu_player_1);
+ SDL_FreeSurface(map->img_menu_player_2);
+ free(map);
+}
+
+int map_get_width(t_map map) {
+ assert(map != NULL);
+ return map->width;
+}
+
+int map_get_height(t_map map) {
+ assert(map != NULL);
+ return map->height;
+}
+
+t_cell_type map_get_cell_type(t_map map, int x, int y) {
+ assert(map && map_is_inside(map, x, y));
+ return map->grid[CELL(x,y)];
+}
+
+
+void map_set_cell_type(t_map map, int x, int y, t_cell_type type) {
+ assert(map && map_is_inside(map, x, y));
+
+ map->grid[CELL(x,y)] = type;
+}
+
+t_map map_load_dynamic(FILE *fd, int niveau,int nb_joueur) {
+ int width, height;
+ char a;int k=1, i=0, continuer=1;
+ int taille_tableau=0;
+ t_map map =NULL;
+ if (fd) {
+ while (continuer==1){
+ if (k==niveau){
+ fscanf (fd, "%d:%d", &height, &width);
+ taille_tableau= width*height;
+ map = map_new(width, height);
+ while (igrid[i] = CELL_EMPTY;
+ break;
+ case '1':
+ map->grid[i] = CELL_WALL;
+ break;
+ case '2':
+ map->grid[i] = CELL_BOX | (return_bonus() << 4);
+ break;
+ case '3':
+ map->grid[i] = CELL_GOAL;
+ break;
+ case '4':
+ map->grid[i] = CELL_PLAYER;
+ break;
+
+ case 'j':
+ if (nb_joueur==2)
+ map->grid[i] = CELL_PLAYER_2;
+ else
+ map->grid[i] = CELL_EMPTY;
+ break;
+
+ case '5':
+ map->grid[i] = (CELL_BONUS | (BONUS_BOMB_RANGE_INC << 4));
+ break;
+
+ case 'k':
+ map->grid[i] = (CELL_MENU_PLAYER_1);
+ break;
+
+ case 'l':
+ map->grid[i] = (CELL_MENU_PLAYER_2);
+ break;
+
+ case '6':
+ map->grid[i] = (CELL_MENU_EMPTY);
+ break;
+
+ case '7':
+ map->grid[i] = (CELL_MENU_LIVES);
+ break;
+
+ case '8':
+ map->grid[i] = (CELL_MENU_BOMBS);
+ break;
+
+ case '9':
+ map->grid[i] = (CELL_MENU_RANGE);
+ break;
+
+ default: exit(EXIT_FAILURE);
+ }
+ i++;
+ }
+ }
+ continuer=0;
+ }
+ a=fgetc(fd);
+ if (a=='-') k++;
+ }
+
+ fclose(fd);
+ return map;
+ }
+ exit(EXIT_FAILURE);
+}
+
+void sauvegarderNiveau(t_map map, int niveau){
+ FILE* fichier = NULL;
+ int i = 0, j=0, continuer=1,k=1;
+ char a;
+ fichier = fopen("data/niveaux.lvl", "r+");
+ while (continuer==1){
+ if (k==niveau) continuer=0;
+ a=fgetc(fichier);
+ if (a=='-') k++;
+ }
+ if (niveau==1) fseek(fichier, -1, SEEK_CUR);
+ else fseek(fichier, 0, SEEK_CUR);
+ fprintf(fichier, "%d:%d", map->height,map->width);
+ for (j = 0; j < map->height; j++) {
+ fprintf(fichier, "%s", "\n");
+ for (i = 0; i < map->width; i++) {
+ t_cell_type type = map->grid[CELL(i,j)];
+ switch (type & 0x0f) {
+ case CELL_EMPTY:
+ fprintf(fichier, "%d", 0);
+ break;
+
+ case CELL_WALL:
+ fprintf(fichier, "%d", 1);
+ break;
+ case CELL_BOX:
+ fprintf(fichier, "%d", 2);
+ break;
+ case CELL_GOAL:
+ fprintf(fichier, "%d", 3);
+ break;
+ case CELL_PLAYER:
+ fprintf(fichier, "%d", 4);
+ break;
+ case CELL_PLAYER_2:
+ fputc('j', fichier);
+ break;
+ case CELL_BONUS:
+ switch ((type & 0xf0) >> 4) {
+ case BONUS_BOMB_RANGE_INC:
+ fprintf(fichier, "%d", 5);
+ break;
+ default: fprintf(fichier, "%d", 0);
+ }
+ break;
+
+ case CELL_MENU_EMPTY:
+ fprintf(fichier, "%d", 6);
+ break;
+
+ case CELL_MENU_PLAYER_1:
+ fputc('k', fichier);
+ break;
+
+ case CELL_MENU_PLAYER_2:
+ fputc('l', fichier);
+ break;
+
+ case CELL_MENU_LIVES:
+ fprintf(fichier, "%d", 7);
+ break;
+
+ case CELL_MENU_BOMBS:
+ fprintf(fichier, "%d", 8);
+ break;
+
+ case CELL_MENU_RANGE:
+ fprintf(fichier, "%d", 9);
+ break;
+
+ default: fprintf(fichier, "%d", 0);
+ }
+ }
+ }
+
+ fprintf(fichier, "\n-\n");
+ fclose(fichier);
+}
+
+// t_map map_load_static(void) {
+
+// t_map map = map_new(12, 12);
+// t_cell_type
+// themap[144] = { CELL_PLAYER, CELL_BOX, CELL_EMPTY, CELL_EMPTY,
+// CELL_EMPTY, CELL_WALL, CELL_EMPTY, CELL_EMPTY, CELL_EMPTY,
+// CELL_BOX, CELL_BOX, CELL_EMPTY, CELL_EMPTY, CELL_WALL,
+// CELL_WALL, CELL_EMPTY, CELL_EMPTY, CELL_BOX, CELL_EMPTY,
+// CELL_WALL, CELL_EMPTY, CELL_EMPTY, CELL_EMPTY, CELL_EMPTY,
+// CELL_EMPTY, CELL_BOX, CELL_EMPTY, CELL_EMPTY, CELL_WALL,
+// CELL_WALL, CELL_WALL, CELL_WALL, CELL_EMPTY, CELL_BOX,
+// CELL_BOX, CELL_EMPTY, CELL_BOX, CELL_BOX, CELL_WALL,
+// CELL_WALL, CELL_WALL, CELL_EMPTY, CELL_BOX, CELL_EMPTY,
+// CELL_EMPTY, CELL_BOX, CELL_EMPTY, CELL_EMPTY, CELL_BOX,
+// CELL_WALL, CELL_BOX, CELL_EMPTY, CELL_EMPTY, CELL_BOX,
+// CELL_BOX, CELL_BOX, CELL_WALL, CELL_WALL, CELL_EMPTY,
+// CELL_EMPTY, CELL_WALL, CELL_BOX, CELL_BOX, CELL_EMPTY,
+// CELL_BOX, CELL_BOX, CELL_BOX, CELL_BOX, CELL_EMPTY,
+// CELL_EMPTY, CELL_WALL, CELL_WALL, CELL_EMPTY, CELL_EMPTY,
+// CELL_EMPTY, CELL_WALL, CELL_BOX, CELL_BOX, CELL_BOX,
+// CELL_WALL, CELL_WALL, CELL_BOX, CELL_EMPTY, CELL_EMPTY,
+// CELL_EMPTY, CELL_BOX, CELL_BOX, CELL_WALL, CELL_BOX,
+// CELL_BOX, CELL_WALL, CELL_WALL, CELL_EMPTY, CELL_BOX,
+// CELL_BOX, CELL_EMPTY, CELL_BOX, CELL_EMPTY, CELL_EMPTY,
+// CELL_WALL, CELL_WALL, CELL_BOX, CELL_EMPTY, CELL_EMPTY,
+// CELL_BOX, CELL_BOX, CELL_BOX, CELL_WALL, CELL_EMPTY,
+// CELL_WALL, CELL_WALL, CELL_WALL, CELL_BOX, CELL_EMPTY,
+// CELL_WALL, CELL_WALL, CELL_EMPTY, CELL_EMPTY, CELL_BOX,
+// CELL_BOX, CELL_EMPTY, CELL_WALL, CELL_EMPTY, CELL_BOX,
+// CELL_EMPTY, CELL_EMPTY, CELL_WALL, CELL_EMPTY, CELL_BOX,
+// CELL_BOX, CELL_WALL, CELL_BOX, CELL_EMPTY, CELL_EMPTY,
+// CELL_EMPTY, CELL_WALL, CELL_EMPTY, CELL_EMPTY, CELL_WALL,
+// CELL_WALL, CELL_EMPTY, CELL_EMPTY, CELL_WALL, CELL_GOAL };
+// for (int i = 0; i < 144; i++)
+// map->grid[i] = themap[i];
+// return map;
+// }
+
+
+void map_display(t_map map, int lives_player, int bombs_player, int range_player, int lives_player2, int bombs_player2, int range_player2, SDL_Surface *screen) {
+ int i, j, k=0, l=0, m=0;
+
+ assert(map != NULL);
+ assert(screen != NULL);
+ assert(map->height > 0 && map->width > 0);
+ assert(map->img_wall != NULL);
+ assert(map->img_box != NULL);
+ assert(map->img_goal != NULL);
+
+ for (j = 0; j < map->height; j++) {
+ for (i = 0; i < map->width; i++) {
+ SDL_Rect place;
+ place.x = i * SIZE_BLOC;
+ place.y = j * SIZE_BLOC;
+
+ t_cell_type type = map->grid[CELL(i,j)];
+
+ switch (type & 0x0f) {
+ case CELL_WALL:
+ SDL_BlitSurface(map->img_wall, NULL, screen, &place);
+ break;
+ case CELL_BOX:
+ SDL_BlitSurface(map->img_box, NULL, screen, &place);
+ break;
+ case CELL_GOAL:
+ SDL_BlitSurface(map->img_goal, NULL, screen, &place);
+ break;
+
+ case CELL_MENU_EMPTY:
+ SDL_BlitSurface(map->img_menu_empty, NULL, screen, &place);
+ break;
+
+ case CELL_MENU_PLAYER_1:
+ SDL_BlitSurface(map->img_menu_player_1, NULL, screen, &place);
+ break;
+
+ case CELL_MENU_PLAYER_2:
+ SDL_BlitSurface(map->img_menu_player_2, NULL, screen, &place);
+ break;
+
+ case CELL_MENU_LIVES:
+ if (k==0){
+ switch (lives_player){
+ case 0:
+ SDL_BlitSurface(map->img_menu_lives_0, NULL, screen, &place);
+ break;
+ case 1:
+ SDL_BlitSurface(map->img_menu_lives_1, NULL, screen, &place);
+ break;
+ case 2:
+ SDL_BlitSurface(map->img_menu_lives_2, NULL, screen, &place);
+ break;
+ case 3:
+ SDL_BlitSurface(map->img_menu_lives_3, NULL, screen, &place);
+ break;
+ case 4:
+ SDL_BlitSurface(map->img_menu_lives_4, NULL, screen, &place);
+ break;
+ }
+ k++;
+ }
+ else {
+ switch (lives_player2){
+ case 0:
+ SDL_BlitSurface(map->img_menu_lives_0, NULL, screen, &place);
+ break;
+ case 1:
+ SDL_BlitSurface(map->img_menu_lives_1, NULL, screen, &place);
+ break;
+ case 2:
+ SDL_BlitSurface(map->img_menu_lives_2, NULL, screen, &place);
+ break;
+ case 3:
+ SDL_BlitSurface(map->img_menu_lives_3, NULL, screen, &place);
+ break;
+ case 4:
+ SDL_BlitSurface(map->img_menu_lives_4, NULL, screen, &place);
+ break;
+ }
+ }
+ break;
+
+ case CELL_MENU_BOMBS:
+ if (l==0){
+ switch (bombs_player){
+ case 0:
+ SDL_BlitSurface(map->img_menu_bombs_0, NULL, screen, &place);
+ break;
+ case 1:
+ SDL_BlitSurface(map->img_menu_bombs_1, NULL, screen, &place);
+ break;
+ case 2:
+ SDL_BlitSurface(map->img_menu_bombs_2, NULL, screen, &place);
+ break;
+ case 3:
+ SDL_BlitSurface(map->img_menu_bombs_3, NULL, screen, &place);
+ break;
+ case 4:
+ SDL_BlitSurface(map->img_menu_bombs_4, NULL, screen, &place);
+ break;
+ case 5:
+ SDL_BlitSurface(map->img_menu_bombs_5, NULL, screen, &place);
+ break;
+ }
+ l++;
+ }
+ else {
+ switch (bombs_player2){
+ case 0:
+ SDL_BlitSurface(map->img_menu_bombs_0, NULL, screen, &place);
+ break;
+ case 1:
+ SDL_BlitSurface(map->img_menu_bombs_1, NULL, screen, &place);
+ break;
+ case 2:
+ SDL_BlitSurface(map->img_menu_bombs_2, NULL, screen, &place);
+ break;
+ case 3:
+ SDL_BlitSurface(map->img_menu_bombs_3, NULL, screen, &place);
+ break;
+ case 4:
+ SDL_BlitSurface(map->img_menu_bombs_4, NULL, screen, &place);
+ break;
+ case 5:
+ SDL_BlitSurface(map->img_menu_bombs_5, NULL, screen, &place);
+ break;
+ }
+ }
+ break;
+
+ case CELL_MENU_RANGE:
+ if (m==0){
+ switch (range_player){
+ case 0:
+ SDL_BlitSurface(map->img_menu_range_0, NULL, screen, &place);
+ break;
+ case 1:
+ SDL_BlitSurface(map->img_menu_range_1, NULL, screen, &place);
+ break;
+ case 2:
+ SDL_BlitSurface(map->img_menu_range_2, NULL, screen, &place);
+ break;
+ case 3:
+ SDL_BlitSurface(map->img_menu_range_3, NULL, screen, &place);
+ break;
+ case 4:
+ SDL_BlitSurface(map->img_menu_range_4, NULL, screen, &place);
+ break;
+ case 5:
+ SDL_BlitSurface(map->img_menu_range_5, NULL, screen, &place);
+ break;
+ }
+ m++;
+ }
+ else {
+ switch (range_player2){
+ case 0:
+ SDL_BlitSurface(map->img_menu_range_0, NULL, screen, &place);
+ break;
+ case 1:
+ SDL_BlitSurface(map->img_menu_range_1, NULL, screen, &place);
+ break;
+ case 2:
+ SDL_BlitSurface(map->img_menu_range_2, NULL, screen, &place);
+ break;
+ case 3:
+ SDL_BlitSurface(map->img_menu_range_3, NULL, screen, &place);
+ break;
+ case 4:
+ SDL_BlitSurface(map->img_menu_range_4, NULL, screen, &place);
+ break;
+ case 5:
+ SDL_BlitSurface(map->img_menu_range_5, NULL, screen, &place);
+ break;
+ }
+ }
+ break;
+
+
+ case CELL_BONUS:
+ switch ((type & 0xf0) >> 4) {
+ case BONUS_BOMB_RANGE_INC:
+ SDL_BlitSurface(map->img_bonus_bomb_range_inc, NULL,
+ screen, &place);
+ break;
+
+ case BONUS_BOMB_RANGE_DEC:
+ SDL_BlitSurface(map->img_bonus_bomb_range_dec, NULL,
+ screen, &place);
+ break;
+
+ case BONUS_BOMB_NB_INC:
+ SDL_BlitSurface(map->img_bonus_bomb_nb_inc, NULL, screen,
+ &place);
+ break;
+
+ case BONUS_BOMB_NB_DEC:
+ SDL_BlitSurface(map->img_bonus_bomb_nb_dec, NULL, screen,
+ &place);
+ break;
+
+ case BONUS_LIFE_INC:
+ SDL_BlitSurface(map->img_bonus_life_inc, NULL,
+ screen, &place);
+ break;
+ }
+ }
+ }
+ }
+}
+
diff --git a/src/misc.c b/src/misc.c
new file mode 100644
index 0000000..0db03d8
--- /dev/null
+++ b/src/misc.c
@@ -0,0 +1,70 @@
+/*
+* misc.c
+*
+* Created on: 15 mars 2010
+* Author: reveille
+*/
+
+#include "../include/misc.h"
+#include "../include/constant.h"
+
+
+
+void error(const char *s, ...) {
+ va_list ap;
+ va_start(ap, s);
+
+ vfprintf(stderr, s, ap);
+ va_end(ap);
+ exit(EXIT_FAILURE);
+}
+
+SDL_Surface *load_image(const char *filename) {
+ SDL_Surface *img = IMG_Load(filename);
+ if (!img) {
+ error("IMG_Load: %s\n", IMG_GetError());
+ }
+ return img;
+}
+
+/// Nearest neighboor optimized with possible out of screen coordinates (for cropping)
+void flip_NNOptimized_AllowOutOfScreen(SDL_Surface *virtual_screen, SDL_Surface *hardware_screen, int new_w, int new_h){
+ int w1=virtual_screen->w;
+ //int h1=virtual_screen->h;
+ int w2=new_w;
+ int h2=new_h;
+ int x_ratio = (int)((virtual_screen->w<<16)/w2);
+ int y_ratio = (int)((virtual_screen->h<<16)/h2);
+ int x2, y2 ;
+
+ /// --- Compute padding for centering when out of bounds ---
+ int y_padding = (HW_SCREEN_HEIGHT-new_h)/2;
+ int x_padding = 0;
+ if(w2>HW_SCREEN_WIDTH){
+ x_padding = (w2-HW_SCREEN_WIDTH)/2 + 1;
+ }
+ int x_padding_ratio = x_padding*w1/w2;
+ //printf("virtual_screen->h=%d, h2=%d\n", virtual_screen->h, h2);
+
+ for (int i=0;i=HW_SCREEN_HEIGHT){
+ continue;
+ }
+
+ uint16_t* t = (uint16_t*)(hardware_screen->pixels+((i+y_padding)* ((w2>HW_SCREEN_WIDTH)?HW_SCREEN_WIDTH:w2) )*sizeof(uint16_t));
+ y2 = ((i*y_ratio)>>16);
+ uint16_t* p = (uint16_t*)(virtual_screen->pixels + (y2*w1 + x_padding_ratio) *sizeof(uint16_t));
+ int rat = 0;
+ for (int j=0;j=HW_SCREEN_WIDTH){
+ continue;
+ }
+ x2 = (rat>>16);
+ *t++ = p[x2];
+ rat += x_ratio;
+ //printf("y=%d, x=%d, y2=%d, x2=%d, (y2*virtual_screen->w)+x2=%d\n", i, j, y2, x2, (y2*virtual_screen->w)+x2);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/monsters.c b/src/monsters.c
new file mode 100644
index 0000000..02d61ae
--- /dev/null
+++ b/src/monsters.c
@@ -0,0 +1,352 @@
+#include
+#include
+#include
+#include "SDL.h"
+#include "SDL_image.h"
+
+#include "../include/game.h"
+
+
+struct s_monster {
+ int x,y,portee_monstre;
+ SDL_Surface * directed_img[4];
+ enum e_way current_way;
+ t_monster nxt;
+};
+
+static void monster_load_img(t_monster monster, enum e_way way,
+const char *filename) {
+ monster->directed_img[way] = IMG_Load(filename);
+ if (!monster->directed_img[way])
+ error("IMG_Load: %s\n", IMG_GetError());
+}
+
+t_monster monster_init(t_monster list_monsters, int x, int y, int portee_monstre) {
+ t_monster monster = malloc(sizeof(*monster));
+ if (!monster)
+ error("Memory error");
+
+ monster_load_img(monster, LEFT, IMG_MONSTER_LEFT);
+ monster_load_img(monster, RIGHT, IMG_MONSTER_RIGHT);
+ monster_load_img(monster, UP, IMG_MONSTER_UP);
+ monster_load_img(monster, DOWN, IMG_MONSTER_DOWN);
+
+ monster->current_way = DOWN;
+ monster->x=x;
+ monster->y=y;
+ monster->portee_monstre=portee_monstre;
+ monster->nxt=NULL;
+
+ if( list_monsters== NULL)
+ {
+ return monster;
+ }
+ else
+ {
+ t_monster temp=list_monsters;
+ while(temp->nxt != NULL)
+ {
+ temp = temp->nxt;
+ }
+ temp->nxt = monster;
+ return list_monsters;
+ }
+
+}
+
+
+void monster_free(t_monster monster) {
+ if (monster != NULL){
+ assert(monster);
+ int i;
+ for (i = 0; i < 4; i++)
+ SDL_FreeSurface(monster->directed_img[i]);
+ free(monster);
+ }
+}
+
+t_monster get_next_monster(t_monster monster){
+ return monster->nxt;
+}
+
+void set_next_monster(t_monster monster, t_monster nxt_monster){
+ monster->nxt=nxt_monster;
+}
+
+int monster_get_x(t_monster monster) {
+ assert(monster != NULL);
+ return monster->x;
+}
+
+int monster_get_y(t_monster monster) {
+ assert(monster != NULL);
+ return monster->y;
+}
+
+int monster_portee(t_monster monster) {
+ assert(monster != NULL);
+ return monster->portee_monstre;
+}
+
+enum e_way monster_get_current_way(t_monster monster) {
+ assert(monster);
+ return(monster->current_way);
+}
+
+void monster_set_current_way(t_monster monster, enum e_way way) {
+ assert(monster);
+ monster->current_way = way;
+}
+
+void monster_increase_portee(t_monster monster) {
+ assert(monster);
+ if (monster->portee_monstre portee_monstre++;
+}
+
+void monster_decrease_portee(t_monster monster) {
+ assert(monster);
+ if (monster->portee_monstre >1)
+ monster->portee_monstre--;
+}
+
+static int monster_move_aux(t_monster monster, t_player player, t_player player2, int nb_joueur, t_map map, int x1, int y1, int x2,
+int y2) {
+ t_cell_type type;
+ if (!map_is_inside(map, x1, y1))
+ return 0;
+
+ type=map_get_cell_type(map, x1, y1);
+ switch (type & 0x0f) {
+ case CELL_WALL:
+ return 0;
+ break;
+
+
+ case CELL_BOMB:
+ return 0;
+ break;
+
+ case CELL_PLAYER:
+ if ( nb_joueur==1){
+ player_decrease_lives(player);
+ }
+ else{
+ if (player_get_x(player)==x1 && player_get_y(player)==y1) {
+ player_decrease_lives(player);
+ }
+ if (player_get_x(player2)==x1 && player_get_y(player2)==y1) {
+ player_decrease_lives(player2);
+ }
+ }
+ break;
+
+ case CELL_FLAMME:
+ return 0;;
+ break;
+
+ case CELL_MENU_EMPTY:
+ return 0;
+ break;
+
+ case CELL_MENU_LIVES:
+ return 0;
+ break;
+
+ case CELL_MENU_BOMBS:
+ return 0;
+ break;
+
+ case CELL_MENU_RANGE:
+ return 0;
+ break;
+
+ case CELL_BONUS:
+ switch ((type & 0xf0) >> 4) {
+ case BONUS_BOMB_RANGE_INC:
+ monster_increase_portee(monster);
+ break;
+ case BONUS_BOMB_RANGE_DEC:
+ monster_decrease_portee(monster);
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case CELL_BOX:
+
+ if (!map_is_inside(map, x2, y2))
+ return 0;
+ switch (map_get_cell_type(map,x2,y2)& 0x0f){
+ case CELL_WALL:
+ return 0;
+ break;
+
+ case CELL_BOX:
+ return 0;
+ break;
+
+ case CELL_GOAL:
+ return 0;
+ break;
+
+ case CELL_MONSTER:
+ return 0;
+ break;
+
+ case CELL_PLAYER:
+ return 0;
+ break;
+
+ case CELL_PLAYER_2:
+ return 0;
+ break;
+
+ case CELL_BOMB:
+ return 0;
+ break;
+
+ case CELL_MENU_EMPTY:
+ return 0;
+ break;
+
+ case CELL_MENU_LIVES:
+ return 0;
+ break;
+
+ case CELL_MENU_BOMBS:
+ return 0;
+ break;
+
+ case CELL_MENU_RANGE:
+ return 0;
+ break;
+
+ case CELL_MENU_PLAYER_1:
+ return 0;
+ break;
+
+ case CELL_MENU_PLAYER_2:
+ return 0;
+ break;
+
+ default:
+ break;
+ }
+
+ map_set_cell_type(map, x1, y1, CELL_EMPTY);
+
+ switch ((type & 0xf0) >> 4) {
+ case BONUS_BOMB_RANGE_INC:
+ map_set_cell_type(map, x2, y2, CELL_BOX | (BONUS_BOMB_RANGE_INC << 4));
+ break;
+ case BONUS_BOMB_RANGE_DEC:
+ map_set_cell_type(map, x2, y2, CELL_BOX | (BONUS_BOMB_RANGE_DEC << 4));
+ break;
+ case BONUS_BOMB_NB_INC:
+ map_set_cell_type(map, x2, y2, CELL_BOX | (BONUS_BOMB_NB_INC << 4));
+ break;
+ case BONUS_BOMB_NB_DEC:
+ map_set_cell_type(map, x2, y2, CELL_BOX | (BONUS_BOMB_NB_DEC << 4));
+ break;
+ case BONUS_MONSTER:
+ map_set_cell_type(map, x2, y2, CELL_BOX | (BONUS_MONSTER << 4));
+ break;
+ case BONUS_LIFE_INC:
+ map_set_cell_type(map, x2, y2, CELL_BOX | (BONUS_LIFE_INC << 4));
+ break;
+ case NO_BONUS:
+ map_set_cell_type(map, x2, y2, CELL_BOX | (NO_BONUS << 4));
+ break;
+ default:
+ break;
+ }
+ return 1;
+
+ break;
+
+
+ case CELL_GOAL:
+ return 0;
+ break;
+
+ case CELL_MONSTER:
+ return 0;
+ break;
+
+ case CELL_MENU_PLAYER_1:
+ return 0;
+ break;
+
+ case CELL_MENU_PLAYER_2:
+ return 0;
+ break;
+
+ default:
+ break;
+ }
+
+ // monster has moved
+ return 1;
+}
+
+
+
+int monster_move(t_monster monster, t_map map, t_player player, t_player player2, int nb_joueur) {
+ int x = monster->x;
+ int y = monster->y;
+ int move = 0;
+
+ switch (monster->current_way) {
+ case UP:
+ if (monster_move_aux(monster, player, player2,nb_joueur, map, x, y - 1, x, y - 2)) {
+ monster->y--;
+ move = 1;
+ }
+ break;
+
+ case DOWN:
+ if (monster_move_aux(monster, player, player2, nb_joueur, map, x, y + 1, x, y + 2)) {
+ monster->y++;
+ move = 1;
+ }
+ break;
+
+ case LEFT:
+ if (monster_move_aux(monster, player, player2, nb_joueur, map, x - 1, y, x - 2, y)) {
+ monster->x--;
+ move = 1;
+ }
+ break;
+
+ case RIGHT:
+ if (monster_move_aux(monster, player, player2, nb_joueur, map, x + 1, y, x + 2, y)) {
+ monster->x++;
+ move = 1;
+ }
+ break;
+ }
+
+ if (move) {
+ map_set_cell_type(map, x, y, CELL_EMPTY);
+ map_set_cell_type(map, monster->x, monster->y, CELL_MONSTER);
+ }
+ return move;
+}
+
+void monster_display(t_monster monster, SDL_Surface *screen) {
+ assert(monster);
+ assert(monster->directed_img[monster->current_way]);
+ assert(screen);
+
+ SDL_Rect place;
+ place.x = monster->x * SIZE_BLOC;
+ place.y = monster->y * SIZE_BLOC;
+
+ SDL_BlitSurface(monster->directed_img[monster->current_way], NULL, screen,
+ &place);
+
+}
+
+
diff --git a/src/niveau.c b/src/niveau.c
new file mode 100644
index 0000000..9f05a3d
--- /dev/null
+++ b/src/niveau.c
@@ -0,0 +1,687 @@
+#include
+#include
+#include
+#include "SDL_image.h"
+#include "../include/editeur.h"
+#include "../include/misc.h"
+#include "../include/constant.h"
+#include "../include/niveau.h"
+
+#ifdef HW_SCREEN_RESIZE
+ extern SDL_Surface *hw_screen;
+#endif //HW_SCREEN_RESIZE
+
+int niveau_1_joueur(SDL_Surface *screen, int niveau){
+ int continuer = 1;
+ SDL_Surface *menu = NULL;
+ SDL_Event event;
+ SDL_Rect positionMenu;
+
+#ifdef HW_SCREEN_RESIZE
+ //if(screen != NULL) SDL_FreeSurface(screen);
+ screen = SDL_CreateRGBSurface(SDL_SWSURFACE, 480,480, WINDOW_BPP, 0, 0, 0, 0);
+#else //HW_SCREEN_RESIZE
+ screen = SDL_SetVideoMode(480,480, WINDOW_BPP, SDL_HWSURFACE);
+ if (screen == NULL) {
+ error("Can't set video mode: %s\n", SDL_GetError());
+ exit(1);
+ }
+#endif //HW_SCREEN_RESIZE
+
+ switch (niveau){
+ case -1:
+ menu = IMG_Load("sprite/legende_editeur.png");
+ break;
+ case 0:
+ menu = IMG_Load("sprite/win_the_game.png");
+ break;
+ case 1:
+ menu = IMG_Load("sprite/niveau_1.png");
+ break;
+ case 2:
+ menu = IMG_Load("sprite/niveau_2.png");
+ break;
+ case 3:
+ menu = IMG_Load("sprite/niveau_3.png");
+ break;
+ case 4:
+ menu = IMG_Load("sprite/niveau_4.png");
+ break;
+ case 5:
+ menu = IMG_Load("sprite/niveau_5.png");
+ break;
+ case 6:
+ menu = IMG_Load("sprite/niveau_6.png");
+ break;
+ case 7:
+ menu = IMG_Load("sprite/niveau_7.png");
+ break;
+ case 8:
+ menu = IMG_Load("sprite/niveau_8.png");
+ break;
+ case 9:
+ menu = IMG_Load("sprite/niveau_9.png");
+ break;
+ case 10:
+ menu = IMG_Load("sprite/niveau_10.png");
+ break;
+ }
+ positionMenu.x = 0;
+ positionMenu.y = 0;
+
+ while (continuer)
+ {
+ SDL_WaitEvent(&event);
+ switch(event.type)
+ {
+ case SDL_QUIT:
+ SDL_FreeSurface(menu);
+ return 1;
+ break;
+ case SDL_KEYDOWN:
+ switch(event.key.keysym.sym)
+ {
+ case SDLK_ESCAPE:
+ SDL_FreeSurface(menu);
+ return 1;
+ break;
+ case SDLK_RETURN:
+ continuer = 0;
+ break;
+ case SDLK_KP_ENTER:
+ continuer = 0;
+ break;
+ default: break;
+ }
+ }
+ SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+ SDL_BlitSurface(menu, NULL, screen, &positionMenu);
+#ifdef HW_SCREEN_RESIZE
+ SDL_FillRect(hw_screen, NULL, 0x000000);
+ flip_NNOptimized_AllowOutOfScreen(screen, hw_screen,
+ HW_SCREEN_WIDTH,
+ MIN(screen->h*HW_SCREEN_WIDTH/screen->w, HW_SCREEN_HEIGHT));
+ SDL_Flip(hw_screen);
+#else //HW_SCREEN_RESIZE
+ SDL_Flip(screen);
+#endif //HW_SCREEN_RESIZE
+ }
+ SDL_FreeSurface(menu);
+ return 0;
+}
+
+int niveau_2_joueur(SDL_Surface *screen, int choix_niveau){
+
+#ifdef HW_SCREEN_RESIZE
+ //if(screen != NULL) SDL_FreeSurface(screen);
+ screen = SDL_CreateRGBSurface(SDL_SWSURFACE, 480,480, WINDOW_BPP, 0, 0, 0, 0);
+#else //HW_SCREEN_RESIZE
+ screen = SDL_SetVideoMode(480,480, WINDOW_BPP, SDL_HWSURFACE);
+ if (screen == NULL) {
+ error("Can't set video mode: %s\n", SDL_GetError());
+ exit(1);
+ }
+#endif //HW_SCREEN_RESIZE
+ int continuer = 1, choix_actuel=choix_niveau;
+ SDL_Surface *menu = NULL;
+ SDL_Event event;
+ SDL_Rect positionMenu;
+ positionMenu.x = 0;
+ positionMenu.y = 0;
+ switch (choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/niveau_2p_1.png");
+ break;
+ case 2:
+ menu = IMG_Load("sprite/niveau_2p_2.png");
+ break;
+ case 3:
+ menu = IMG_Load("sprite/niveau_2p_3.png");
+ break;
+ case 4:
+ menu = IMG_Load("sprite/niveau_2p_4.png");
+ break;
+ case 5:
+ menu = IMG_Load("sprite/niveau_2p_5.png");
+ break;
+ case 6:
+ menu = IMG_Load("sprite/niveau_2p_6.png");
+ break;
+ default: break;
+ }
+ while (continuer)
+ {
+ SDL_WaitEvent(&event);
+ switch(event.type)
+ {
+ case SDL_QUIT:
+ continuer=0;
+ break;
+ case SDL_KEYDOWN:
+ switch(event.key.keysym.sym)
+ {
+ case SDLK_ESCAPE: // Veut arrêter le jeu
+ continuer=0;
+ break;
+ case SDLK_UP:
+ switch(choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/niveau_2p_6.png");;
+ choix_actuel=6;
+ break;
+ case 2:
+ menu = IMG_Load("sprite/niveau_2p_1.png");
+ choix_actuel=1;
+ break;
+ case 3:
+ menu = IMG_Load("sprite/niveau_2p_2.png");
+ choix_actuel=2;
+ break;
+ case 4:
+ menu = IMG_Load("sprite/niveau_2p_3.png");;
+ choix_actuel=3;
+ break;
+ case 5:
+ menu = IMG_Load("sprite/niveau_2p_4.png");
+ choix_actuel=4;
+ break;
+ case 6:
+ menu = IMG_Load("sprite/niveau_2p_5.png");
+ choix_actuel=5;
+ break;
+ }
+ break;
+ case SDLK_DOWN:
+ switch(choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/niveau_2p_2.png");;
+ choix_actuel=2;
+ break;
+ case 2:
+ menu = IMG_Load("sprite/niveau_2p_3.png");
+ choix_actuel=3;
+ break;
+ case 3:
+ menu = IMG_Load("sprite/niveau_2p_4.png");
+ choix_actuel=4;
+ break;
+ case 4:
+ menu = IMG_Load("sprite/niveau_2p_5.png");;
+ choix_actuel=5;
+ break;
+ case 5:
+ menu = IMG_Load("sprite/niveau_2p_6.png");
+ choix_actuel=6;
+ break;
+ case 6:
+ menu = IMG_Load("sprite/niveau_2p_1.png");
+ choix_actuel=1;
+ break;
+ }
+ break;
+ case SDLK_RETURN:
+ SDL_FreeSurface(menu);
+ return choix_actuel;
+ break;
+ case SDLK_KP_ENTER:
+ SDL_FreeSurface(menu);
+ return choix_actuel;
+ break;
+
+ default : break;
+ }
+ break;
+ }
+
+ SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+ SDL_BlitSurface(menu, NULL, screen, &positionMenu);
+#ifdef HW_SCREEN_RESIZE
+ SDL_FillRect(hw_screen, NULL, 0x000000);
+ flip_NNOptimized_AllowOutOfScreen(screen, hw_screen,
+ HW_SCREEN_WIDTH,
+ MIN(screen->h*HW_SCREEN_WIDTH/screen->w, HW_SCREEN_HEIGHT));
+ SDL_Flip(hw_screen);
+#else //HW_SCREEN_RESIZE
+ SDL_Flip(screen);
+#endif //HW_SCREEN_RESIZE
+ }
+ SDL_FreeSurface(menu);
+ return 0;
+}
+
+int editeur_choix_niveau(SDL_Surface *screen){
+
+#ifdef HW_SCREEN_RESIZE
+ //if(screen != NULL) SDL_FreeSurface(screen);
+ screen = SDL_CreateRGBSurface(SDL_SWSURFACE, 480,480, WINDOW_BPP, 0, 0, 0, 0);
+#else //HW_SCREEN_RESIZE
+ screen = SDL_SetVideoMode(480,480, WINDOW_BPP, SDL_HWSURFACE);
+ if (screen == NULL) {
+ error("Can't set video mode: %s\n", SDL_GetError());
+ exit(1);
+ }
+#endif //HW_SCREEN_RESIZE
+ int continuer = 1, choix_actuel=1;
+ SDL_Surface *menu = NULL;
+ SDL_Event event;
+ SDL_Rect positionMenu;
+ positionMenu.x = 0;
+ positionMenu.y = 0;
+ menu = IMG_Load("sprite/niveau_2p_1.png");
+ while (continuer)
+ {
+ SDL_WaitEvent(&event);
+ switch(event.type)
+ {
+ case SDL_QUIT:
+ continuer=0;
+ break;
+ case SDL_KEYDOWN:
+ switch(event.key.keysym.sym)
+ {
+ case SDLK_ESCAPE: // Veut arrêter le jeu
+ continuer=0;
+ break;
+ case SDLK_UP:
+ switch(choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/niveau_2p_6.png");;
+ choix_actuel=6;
+ break;
+ case 2:
+ menu = IMG_Load("sprite/niveau_2p_1.png");
+ choix_actuel=1;
+ break;
+ case 3:
+ menu = IMG_Load("sprite/niveau_2p_2.png");
+ choix_actuel=2;
+ break;
+ case 4:
+ menu = IMG_Load("sprite/niveau_2p_3.png");;
+ choix_actuel=3;
+ break;
+ case 5:
+ menu = IMG_Load("sprite/niveau_2p_4.png");
+ choix_actuel=4;
+ break;
+ case 6:
+ menu = IMG_Load("sprite/niveau_2p_5.png");
+ choix_actuel=5;
+ break;
+ }
+ break;
+ case SDLK_DOWN:
+ switch(choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/niveau_2p_2.png");;
+ choix_actuel=2;
+ break;
+ case 2:
+ menu = IMG_Load("sprite/niveau_2p_3.png");
+ choix_actuel=3;
+ break;
+ case 3:
+ menu = IMG_Load("sprite/niveau_2p_4.png");
+ choix_actuel=4;
+ break;
+ case 4:
+ menu = IMG_Load("sprite/niveau_2p_5.png");;
+ choix_actuel=5;
+ break;
+ case 5:
+ menu = IMG_Load("sprite/niveau_2p_6.png");
+ choix_actuel=6;
+ break;
+ case 6:
+ menu = IMG_Load("sprite/niveau_2p_1.png");
+ choix_actuel=1;
+ break;
+ }
+ break;
+ case SDLK_RETURN:
+ SDL_FreeSurface(menu);
+ return choix_actuel;
+ break;
+ case SDLK_KP_ENTER:
+ SDL_FreeSurface(menu);
+ return choix_actuel;
+ break;
+
+ default : break;
+ }
+ break;
+ }
+
+ SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+ SDL_BlitSurface(menu, NULL, screen, &positionMenu);
+#ifdef HW_SCREEN_RESIZE
+ SDL_FillRect(hw_screen, NULL, 0x000000);
+ flip_NNOptimized_AllowOutOfScreen(screen, hw_screen,
+ HW_SCREEN_WIDTH,
+ MIN(screen->h*HW_SCREEN_WIDTH/screen->w, HW_SCREEN_HEIGHT));
+ SDL_Flip(hw_screen);
+#else //HW_SCREEN_RESIZE
+ SDL_Flip(screen);
+#endif //HW_SCREEN_RESIZE
+ }
+ SDL_FreeSurface(menu);
+ return 0;
+}
+
+
+int are_you_sure(SDL_Surface *screen){
+
+#ifdef HW_SCREEN_RESIZE
+ //if(screen != NULL) SDL_FreeSurface(screen);
+ screen = SDL_CreateRGBSurface(SDL_SWSURFACE, 480,480, WINDOW_BPP, 0, 0, 0, 0);
+#else //HW_SCREEN_RESIZE
+ screen = SDL_SetVideoMode(480,480, WINDOW_BPP, SDL_HWSURFACE);
+ if (screen == NULL) {
+ error("Can't set video mode: %s\n", SDL_GetError());
+ exit(1);
+ }
+#endif //HW_SCREEN_RESIZE
+ int continuer = 1, choix_actuel=1;
+ SDL_Surface *menu = NULL;
+ SDL_Event event;
+ SDL_Rect positionMenu;
+ positionMenu.x = 0;
+ positionMenu.y = 0;
+ menu = IMG_Load("sprite/sure_yes.png");
+ while (continuer)
+ {
+ SDL_WaitEvent(&event);
+ switch(event.type)
+ {
+ case SDL_QUIT:
+ continuer=0;
+ break;
+ case SDL_KEYDOWN:
+ switch(event.key.keysym.sym)
+ {
+ case SDLK_ESCAPE: // Veut arrêter le jeu
+ continuer=0;
+ break;
+ case SDLK_LEFT:
+ switch(choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/sure_no.png");;
+ choix_actuel=2;
+ break;
+ case 2:
+ menu = IMG_Load("sprite/sure_yes.png");
+ choix_actuel=1;
+ break;
+ }
+ break;
+ case SDLK_RIGHT:
+ switch(choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/sure_no.png");;
+ choix_actuel=2;
+ break;
+ case 2:
+ menu = IMG_Load("sprite/sure_yes.png");
+ choix_actuel=1;
+ break;
+ }
+ break;
+ case SDLK_RETURN:
+ SDL_FreeSurface(menu);
+ return choix_actuel;
+ break;
+ case SDLK_KP_ENTER:
+ SDL_FreeSurface(menu);
+ return choix_actuel;
+ break;
+
+ default : break;
+ }
+ break;
+ }
+
+ SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+ SDL_BlitSurface(menu, NULL, screen, &positionMenu);
+#ifdef HW_SCREEN_RESIZE
+ SDL_FillRect(hw_screen, NULL, 0x000000);
+ flip_NNOptimized_AllowOutOfScreen(screen, hw_screen,
+ HW_SCREEN_WIDTH,
+ MIN(screen->h*HW_SCREEN_WIDTH/screen->w, HW_SCREEN_HEIGHT));
+ SDL_Flip(hw_screen);
+#else //HW_SCREEN_RESIZE
+ SDL_Flip(screen);
+#endif //HW_SCREEN_RESIZE
+ }
+ SDL_FreeSurface(menu);
+ return 0;
+}
+
+int choix_nb_joueurs(SDL_Surface *screen){
+
+#ifdef HW_SCREEN_RESIZE
+ //if(screen != NULL) SDL_FreeSurface(screen);
+ screen = SDL_CreateRGBSurface(SDL_SWSURFACE, 480,480, WINDOW_BPP, 0, 0, 0, 0);
+#else //HW_SCREEN_RESIZE
+ screen = SDL_SetVideoMode(480,480, WINDOW_BPP, SDL_HWSURFACE);
+ if (screen == NULL) {
+ error("Can't set video mode: %s\n", SDL_GetError());
+ exit(1);
+ }
+#endif //HW_SCREEN_RESIZE
+ int continuer = 1, choix_actuel=1;
+ SDL_Surface *menu = NULL;
+ SDL_Event event;
+ SDL_Rect positionMenu;
+ positionMenu.x = 0;
+ positionMenu.y = 0;
+ menu = IMG_Load("sprite/menu_nb_joueur_1.png");
+ while (continuer)
+ {
+ SDL_WaitEvent(&event);
+ switch(event.type)
+ {
+ case SDL_QUIT:
+ continuer=0;
+ break;
+ case SDL_KEYDOWN:
+ switch(event.key.keysym.sym)
+ {
+ case SDLK_ESCAPE: // Veut arrêter le jeu
+ continuer=0;
+ break;
+ case SDLK_UP:
+ switch(choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/menu_nb_joueur_2.png");;
+ choix_actuel=2;
+ break;
+ case 2:
+ menu = IMG_Load("sprite/menu_nb_joueur_1.png");
+ choix_actuel=1;
+ break;
+ }
+ break;
+ case SDLK_DOWN:
+ switch(choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/menu_nb_joueur_2.png");;
+ choix_actuel=2;
+ break;
+ case 2:
+ menu = IMG_Load("sprite/menu_nb_joueur_1.png");
+ choix_actuel=1;
+ break;
+ }
+ break;
+ case SDLK_RETURN:
+ SDL_FreeSurface(menu);
+ return choix_actuel;
+ break;
+ case SDLK_KP_ENTER:
+ SDL_FreeSurface(menu);
+ return choix_actuel;
+ break;
+
+ default : break;
+ }
+ break;
+ }
+
+ SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+ SDL_BlitSurface(menu, NULL, screen, &positionMenu);
+#ifdef HW_SCREEN_RESIZE
+ SDL_FillRect(hw_screen, NULL, 0x000000);
+ flip_NNOptimized_AllowOutOfScreen(screen, hw_screen,
+ HW_SCREEN_WIDTH,
+ MIN(screen->h*HW_SCREEN_WIDTH/screen->w, HW_SCREEN_HEIGHT));
+ SDL_Flip(hw_screen);
+#else //HW_SCREEN_RESIZE
+ SDL_Flip(screen);
+#endif //HW_SCREEN_RESIZE
+ }
+ SDL_FreeSurface(menu);
+ return 0;
+}
+
+int options(SDL_Surface *screen){
+
+#ifdef HW_SCREEN_RESIZE
+ //if(screen != NULL) SDL_FreeSurface(screen);
+ screen = SDL_CreateRGBSurface(SDL_SWSURFACE, 480,480, WINDOW_BPP, 0, 0, 0, 0);
+#else //HW_SCREEN_RESIZE
+ screen = SDL_SetVideoMode(480,480, WINDOW_BPP, SDL_HWSURFACE);
+ if (screen == NULL) {
+ error("Can't set video mode: %s\n", SDL_GetError());
+ exit(1);
+ }
+#endif //HW_SCREEN_RESIZE
+ int continuer = 1, choix_actuel=1;
+ SDL_Surface *menu = NULL;
+ SDL_Event event;
+ SDL_Rect positionMenu;
+ positionMenu.x = 0;
+ positionMenu.y = 0;
+ menu = IMG_Load("sprite/options_s_o.png");
+ while (continuer)
+ {
+ SDL_WaitEvent(&event);
+ switch(event.type)
+ {
+ case SDL_QUIT:
+ continuer=0;
+ break;
+ case SDL_KEYDOWN:
+ switch(event.key.keysym.sym)
+ {
+ case SDLK_ESCAPE: // Veut arrêter le jeu
+ continuer=0;
+ break;
+ case SDLK_LEFT:
+ switch(choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/options_s_n.png");;
+ choix_actuel=2;
+ break;
+ case 2:
+ menu = IMG_Load("sprite/options_s_o.png");
+ choix_actuel=1;
+ break;
+ case 3:
+ menu = IMG_Load("sprite/options_b_n.png");
+ choix_actuel=4;
+ break;
+ case 4:
+ menu = IMG_Load("sprite/options_b_o.png");
+ choix_actuel=3;
+ break;
+ }
+ break;
+ case SDLK_RIGHT:
+ switch(choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/options_s_n.png");;
+ choix_actuel=2;
+ break;
+ case 2:
+ menu = IMG_Load("sprite/options_s_o.png");
+ choix_actuel=1;
+ break;
+ case 3:
+ menu = IMG_Load("sprite/options_b_n.png");
+ choix_actuel=4;
+ break;
+ case 4:
+ menu = IMG_Load("sprite/options_b_o.png");
+ choix_actuel=3;
+ break;
+ }
+ break;
+ case SDLK_UP:
+ switch(choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/options_b_o.png");;
+ choix_actuel=3;
+ break;
+ case 2:
+ menu = IMG_Load("sprite/options_b_o.png");
+ choix_actuel=3;
+ break;
+ case 3:
+ menu = IMG_Load("sprite/options_s_o.png");
+ choix_actuel=1;
+ break;
+ case 4:
+ menu = IMG_Load("sprite/options_s_o.png");
+ choix_actuel=1;
+ break;
+ }
+ break;
+ case SDLK_DOWN:
+ switch(choix_actuel){
+ case 1:
+ menu = IMG_Load("sprite/options_b_o.png");;
+ choix_actuel=3;
+ break;
+ case 2:
+ menu = IMG_Load("sprite/options_b_o.png");
+ choix_actuel=3;
+ break;
+ case 3:
+ menu = IMG_Load("sprite/options_s_o.png");
+ choix_actuel=1;
+ break;
+ case 4:
+ menu = IMG_Load("sprite/options_s_o.png");
+ choix_actuel=1;
+ break;
+ }
+ break;
+ case SDLK_RETURN:
+ SDL_FreeSurface(menu);
+ return choix_actuel;
+ break;
+ case SDLK_KP_ENTER:
+ SDL_FreeSurface(menu);
+ return choix_actuel;
+ break;
+
+ default : break;
+ }
+ break;
+ }
+
+ SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
+ SDL_BlitSurface(menu, NULL, screen, &positionMenu);
+#ifdef HW_SCREEN_RESIZE
+ SDL_FillRect(hw_screen, NULL, 0x000000);
+ flip_NNOptimized_AllowOutOfScreen(screen, hw_screen,
+ HW_SCREEN_WIDTH,
+ MIN(screen->h*HW_SCREEN_WIDTH/screen->w, HW_SCREEN_HEIGHT));
+ SDL_Flip(hw_screen);
+#else //HW_SCREEN_RESIZE
+ SDL_Flip(screen);
+#endif //HW_SCREEN_RESIZE
+ }
+ SDL_FreeSurface(menu);
+ return 0;
+}
diff --git a/src/player.c b/src/player.c
new file mode 100644
index 0000000..a77b887
--- /dev/null
+++ b/src/player.c
@@ -0,0 +1,455 @@
+#include
+#include
+#include
+#include "SDL.h"
+#include "SDL_image.h"
+#include "../include/game.h"
+
+struct s_player {
+ int x, y, portee_bomb, win;
+ SDL_Surface * directed_img[4];
+ enum e_way current_way;
+ int lives;
+ int nb_bomb;
+ int nb_bomb_max;//cette variable est utile pour les bonus. Elle sert à ce que, par exemple, si le joueur a posé toutes ses bombes (disons 2) et qu'avant qu'elles explosent le joueur prend un bonus decrease_nb_bombs, il ne sera autorisé qu'à poser une seule bombe après l'explosion des deux sur la map.
+ int dead;
+};
+
+static void player_load_img(t_player player, enum e_way way,
+const char *filename) {
+ player->directed_img[way] = IMG_Load(filename);
+ if (!player->directed_img[way])
+ error("IMG_Load: %s\n", IMG_GetError());
+}
+
+t_player player_init( int nb_bomb, int portee_bomb, int lives, int no_joueur) {
+ t_player player = malloc(sizeof(*player));
+ if (!player)
+ error("Memory error");
+ switch (no_joueur) {
+ case 1:
+ player_load_img(player, LEFT, IMG_PLAYER_LEFT);
+ player_load_img(player, RIGHT, IMG_PLAYER_RIGHT);
+ player_load_img(player, UP, IMG_PLAYER_UP);
+ player_load_img(player, DOWN, IMG_PLAYER_DOWN);
+ break;
+ case 2:
+ player_load_img(player, LEFT, IMG_PLAYER_2_LEFT);
+ player_load_img(player, RIGHT, IMG_PLAYER_2_RIGHT);
+ player_load_img(player, UP, IMG_PLAYER_2_UP);
+ player_load_img(player, DOWN, IMG_PLAYER_2_DOWN);
+ break;
+ default: break;
+ }
+
+ player->current_way = DOWN;
+ player->win= 0;
+ player->portee_bomb=portee_bomb;
+ player->nb_bomb_max=nb_bomb;
+ player->nb_bomb=nb_bomb;
+ player->lives=lives;
+ player->dead=6;
+ return player;
+}
+
+void player_free(t_player player) {
+ assert(player);
+ int i;
+ for (i = 0; i < 4; i++)
+ SDL_FreeSurface(player->directed_img[i]);
+
+ free(player);
+}
+
+int player_get_x(t_player player) {
+ assert(player != NULL);
+ return player->x;
+}
+
+int player_get_y(t_player player) {
+ assert(player != NULL);
+ return player->y;
+}
+
+int player_win(t_player player){
+ assert(player != NULL);
+ return player->win;
+}
+
+int player_portee_bomb(t_player player){
+ assert(player != NULL);
+ return player->portee_bomb;
+}
+
+void player_set_current_way(t_player player, enum e_way way) {
+ assert(player);
+ player->current_way = way;
+}
+
+void player_increase_lives(t_player player) {
+ assert(player);
+ if (player->lives lives++;
+}
+
+void player_decrease_lives(t_player player) {
+ assert(player);
+ if (player->lives >0)
+ player->lives--;
+}
+
+int player_get_lives(t_player player) {
+ assert(player);
+ return player->lives;
+}
+
+int player_get_nb_bomb(t_player player) {
+ assert(player);
+ return player->nb_bomb;
+}
+
+int player_get_nb_bomb_max(t_player player) {
+ assert(player);
+ return player->nb_bomb_max;
+}
+
+void player_set_nb_bomb(t_player player, int bomb_number) {
+ assert(player);
+ player->nb_bomb= bomb_number;
+}
+
+void player_increase_nb_bomb_max(t_player player) {
+ assert(player);
+ if (player->nb_bomb nb_bomb_max++;
+}
+
+void player_decrease_nb_bomb_max(t_player player) {
+ assert(player);
+ if (player->nb_bomb_max >1)
+ player->nb_bomb_max--;
+}
+
+void player_increase_nb_bomb(t_player player) {
+ assert(player);
+ if (player->nb_bomb nb_bomb++;
+}
+
+void player_decrease_nb_bomb(t_player player) {
+ assert(player);
+ if (player->nb_bomb >0)
+ player->nb_bomb--;
+}
+
+
+void player_increase_portee(t_player player) {
+ assert(player);
+ if (player->portee_bomb portee_bomb++;
+}
+
+void player_decrease_portee(t_player player) {
+ assert(player);
+ if (player->portee_bomb >1)
+ player->portee_bomb--;
+}
+
+
+int player_from_map(t_player player, t_map map) {
+ int i, j;
+ for (i = 0; i < map_get_height(map); i++) {
+ for (j = 0; j < map_get_width(map); j++) {
+ if (map_get_cell_type(map, j, i) == CELL_PLAYER) {
+ player->x = j;
+ player->y = i;
+ return 0;
+ }
+ }
+ }
+ return 0;
+}
+
+void player2_from_map(t_player player, t_map map) {
+ int i, j;
+ for (i = 0; i < map_get_height(map); i++) {
+ for (j = 0; j < map_get_width(map); j++) {
+ if (map_get_cell_type(map, j, i) == CELL_PLAYER_2) {
+ player->x = j;
+ player->y = i;
+ }
+ }
+ }
+}
+
+void player_die(t_player player){
+ if (player->dead>0){
+ switch (player->current_way){
+ case UP:
+ player->current_way=RIGHT;
+ break;
+ case RIGHT:
+ player->current_way=DOWN;
+ break;
+ case DOWN:
+ player->current_way=LEFT;
+ break;
+ case LEFT:
+ player->current_way=UP;
+ break;
+ }
+ player->dead--;
+ }
+}
+
+int player_get_dead(t_player player) {
+ assert(player);
+ return player->dead;
+}
+
+static int player_move_aux(t_player player, t_map map, int x1, int y1, int x2, int y2) {
+ t_cell_type type;
+ if (!map_is_inside(map, x1, y1))
+ return 0;
+
+ type=map_get_cell_type(map, x1, y1);
+ switch (type & 0x0f) {
+ case CELL_WALL:
+ return 0;
+ break;
+
+
+ case CELL_BOMB:
+ return 0;
+ break;
+
+ case CELL_FLAMME:
+ player_decrease_lives(player);
+ break;
+
+ case CELL_MENU_EMPTY:
+ return 0;
+ break;
+
+ case CELL_MENU_LIVES:
+ return 0;
+ break;
+
+ case CELL_MENU_BOMBS:
+ return 0;
+ break;
+
+ case CELL_MENU_RANGE:
+ return 0;
+ break;
+
+ case CELL_BOX:
+
+ if (!map_is_inside(map, x2, y2))
+ return 0;
+ switch (map_get_cell_type(map,x2,y2)& 0x0f){
+ case CELL_WALL:
+ return 0;
+ break;
+
+ case CELL_BOX:
+ return 0;
+ break;
+
+ case CELL_GOAL:
+ return 0;
+ break;
+
+ case CELL_MONSTER:
+ return 0;
+ break;
+
+ case CELL_PLAYER:
+ return 0;
+ break;
+
+ case CELL_PLAYER_2:
+ return 0;
+ break;
+
+ case CELL_BOMB:
+ return 0;
+ break;
+
+ case CELL_MENU_EMPTY:
+ return 0;
+ break;
+
+ case CELL_MENU_LIVES:
+ return 0;
+ break;
+
+ case CELL_MENU_BOMBS:
+ return 0;
+ break;
+
+ case CELL_MENU_RANGE:
+ return 0;
+ break;
+
+ case CELL_MENU_PLAYER_1:
+ return 0;
+ break;
+
+ case CELL_MENU_PLAYER_2:
+ return 0;
+ break;
+
+ default:
+ break;
+ }
+
+ map_set_cell_type(map, x1, y1, CELL_EMPTY);
+
+ switch ((type & 0xf0) >> 4) {
+ case BONUS_BOMB_RANGE_INC:
+ map_set_cell_type(map, x2, y2, CELL_BOX | (BONUS_BOMB_RANGE_INC << 4));
+ break;
+ case BONUS_BOMB_RANGE_DEC:
+ map_set_cell_type(map, x2, y2, CELL_BOX | (BONUS_BOMB_RANGE_DEC << 4));
+ break;
+ case BONUS_BOMB_NB_INC:
+ map_set_cell_type(map, x2, y2, CELL_BOX | (BONUS_BOMB_NB_INC << 4));
+ break;
+ case BONUS_BOMB_NB_DEC:
+ map_set_cell_type(map, x2, y2, CELL_BOX | (BONUS_BOMB_NB_DEC << 4));
+ break;
+ case BONUS_MONSTER:
+ map_set_cell_type(map, x2, y2, CELL_BOX | (BONUS_MONSTER << 4));
+ break;
+ case BONUS_LIFE_INC:
+ map_set_cell_type(map, x2, y2, CELL_BOX | (BONUS_LIFE_INC << 4));
+ break;
+ case NO_BONUS:
+ map_set_cell_type(map, x2, y2, CELL_BOX | (NO_BONUS << 4));
+ break;
+ default:
+ break;
+ }
+ return 1;
+
+ break;
+
+
+
+ case CELL_BONUS:
+ switch ((type & 0xf0) >> 4) {
+ case BONUS_BOMB_RANGE_INC:
+ player_increase_portee(player);
+ break;
+ case BONUS_BOMB_RANGE_DEC:
+ player_decrease_portee(player);
+ break;
+ case BONUS_BOMB_NB_INC:
+ player_increase_nb_bomb_max(player);
+ player_increase_nb_bomb(player);
+ break;
+ case BONUS_BOMB_NB_DEC:
+ player_decrease_nb_bomb_max(player);
+ if (player->nb_bomb>1)
+ player_decrease_nb_bomb(player);
+ break;
+ case BONUS_LIFE_INC:
+ if (player->liveslives++;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case CELL_GOAL:
+ player->win=1;
+ break;
+
+ case CELL_MONSTER:
+ player->lives--;
+ break;
+
+ case CELL_PLAYER:
+ return 0;
+ break;
+
+ case CELL_PLAYER_2:
+ return 0;
+ break;
+
+ case CELL_MENU_PLAYER_1:
+ return 0;
+ break;
+
+ case CELL_MENU_PLAYER_2:
+ return 0;
+ break;
+
+ default:
+ break;
+ }
+
+ // Player has moved
+ return 1;
+}
+
+int player_move(t_player player, t_map map) {
+ int x = player->x;
+ int y = player->y;
+ int move = 0;
+
+ switch (player->current_way) {
+ case UP:
+ if (player_move_aux(player, map, x, y - 1, x, y - 2)) {
+ player->y--;
+ move = 1;
+ }
+ break;
+
+ case DOWN:
+ if (player_move_aux(player, map, x, y + 1, x, y + 2)) {
+ player->y++;
+ move = 1;
+ }
+ break;
+
+ case LEFT:
+ if (player_move_aux(player, map, x - 1, y, x - 2, y)) {
+ player->x--;
+ move = 1;
+ }
+ break;
+
+ case RIGHT:
+ if (player_move_aux(player, map, x + 1, y, x + 2, y)) {
+ player->x++;
+ move = 1;
+ }
+ break;
+ }
+
+ if (move) {
+ if ( map_get_cell_type(map,x,y)==CELL_PLAYER || map_get_cell_type(map,x,y)==CELL_PLAYER_2){
+ map_set_cell_type(map, x, y, CELL_EMPTY);
+ }
+ map_set_cell_type(map, player->x, player->y, CELL_PLAYER);
+ }
+ return move;
+}
+
+void player_display(t_player player, SDL_Surface *screen) {
+ assert(player);
+ assert(player->directed_img[player->current_way]);
+ assert(screen);
+
+ SDL_Rect place;
+ place.x = player->x * SIZE_BLOC;
+ place.y = player->y * SIZE_BLOC;
+
+ SDL_BlitSurface(player->directed_img[player->current_way], NULL, screen,
+ &place);
+}
+