+2013-10-23
+ * version 3.3.1.0 released
+
+2013-10-21
+ * version number set to 3.3.1.0
+
+2012-10-13
+ * fixed display of level time switching from ascending to descending
+ when making use of the "time orb bug" (see element setting in editor)
+ (see level 053 of set "rnd_equinox_tetrachloride_ii" for an example)
+ * fixed graphics performance problems (especially on Mac OS X) by using
+ whole-playfield redraw on SDL target, while still using the previous
+ single-tile redraw method on X11 target (using redraw tiles threshold)
+
+2011-10-07
+ * fixed code (esp. random/tape handling) when compiled on 64-bit systems
+ (by replacing all "long" types by "int" types)
+
+2010-11-19
+ * fixed nasty bug (affecting crumbled graphics) after adding new special
+ graphics suffix ".TAPE" (and messing some things up in src/main.c)
+
+2010-08-04
+ * fixed wrong argument order in DrawTextBuffer() in gadgets.c
+ (this caused fonts in envelope config in level editor being invisible)
+
+2010-07-19
+ * fixed some problems with half tile size and even tile sized playfields
+
+2010-07-12
+ * added level selection screen (when clicking on main menu level number)
+ * added level tracing (played, solved) for use in level selection screen
+ (to display already played or solved levels in different font color)
+
+2010-06-24
+ * added alternative game mode for playing with half size playfield tiles
+ * fixed another memory violation bug in the native Supaplex game engine
+ (this potential memory bug was also in the original Megaplex code, but
+ apparently only occured under rare conditions triggered by using the
+ additional added preceding playfield memory area to make a few strange
+ levels using dirty off-playfield tricks (bugs) like "12s033.sp" also
+ solvable (this all worked fine in the classic DOS version, of course))
+
+2010-06-23
+ * added graphics performance optimization to native Supaplex game engine
+ * fixed bug with accidentally removing preceding buffer in SP engine
+ * moved some editor graphics from "RocksDoor.pcx" to "RocksMore.pcx"
+ (to prevent compatibility mapping of these newer graphics to older
+ (custom) versions of "RocksDoor.pcx" which did not contain them yet)
+
+2010-06-18
+ * added separately configurable game panel background to graphics config
+ * fixed displaying Supaplex time (now based on 35 fps instead of 50 fps)
+
+2010-06-16
+ * added tape panel graphics and screen positions to graphics config
+
+2010-06-15
+ * added compatibility stuff for redefined "global.door" (which affects
+ all parts of that image that have their own graphics definition now)
+
+2010-06-14
+ * added sound button graphics to graphics config
+
+2010-06-13
+ * added tape button graphics and screen positions to graphics config
+
+2010-06-09
+ * improved single step mode in R'n'D, EM and SP engines
+
+2010-06-08
+ * version number set to 3.3.0.2
+
2010-06-08
* version 3.3.0.1 released
# =============================================================================
# Rocks'n'Diamonds Makefile
# -----------------------------------------------------------------------------
-# (c) 1995-2007 Holger Schemel <info@artsoft.org>
+# (c) 1995-2013 Holger Schemel <info@artsoft.org>
# =============================================================================
# -----------------------------------------------------------------------------
dist-build-macosx:
# (this is done by "dist-package-macosx" target)
+dist-build-macosx-ppc:
+ # (this is done by "dist-package-macosx-ppc" target)
+
dist-package-unix:
./Scripts/make_dist.sh unix .
dist-package-macosx:
./Scripts/make_dist.sh mac . $(MAKE)
+dist-package-macosx-ppc:
+ ./Scripts/make_dist.sh mac-ppc . $(MAKE)
+
dist-upload-unix:
./Scripts/make_dist.sh unix . upload
dist-upload-macosx:
./Scripts/make_dist.sh mac . upload
+dist-upload-macosx-ppc:
+ ./Scripts/make_dist.sh mac-ppc . upload
+
dist-build-all:
$(MAKE) clean
$(MAKE) dist-build-unix ; $(MAKE) dist-clean
$(MAKE) dist-package-unix
$(MAKE) dist-package-win32
$(MAKE) dist-package-macosx
+ $(MAKE) dist-package-macosx-ppc
# $(MAKE) dist-package-msdos
dist-upload-all:
$(MAKE) dist-upload-unix
$(MAKE) dist-upload-win32
$(MAKE) dist-upload-macosx
+ $(MAKE) dist-upload-macosx-ppc
# $(MAKE) dist-upload-msdos
dist-all: dist-build-all dist-package-all
ETAGS = etags
RM = rm -f
-BMP2ICO = bmp2ico
+CONVERT = convert
WINDRES = windres
+CONVERT_ICON_ARGS = -transparent black -background transparent
+
PROGBASE = rocksndiamonds
ifdef SPECIAL_EDITION # create special edition
ifeq ($(TARGET),sdl-static) # compiling for SDL target (static)
SYS_CFLAGS = -DTARGET_SDL $(shell sdl-config --cflags)
-SDL_LIBS = -lSDL_image -lSDL_mixer -lSDL_net -lsmpeg
+SDL_LIBS = -lSDL_image -lSDL_mixer -lSDL_net -lsmpeg -lmikmod
SYS_LDFLAGS = $(SDL_LIBS) $(shell sdl-config --static-libs)
endif
GAME_SP = $(GAME_SP_DIR)/game_sp.a
RNDLIBS = $(LIBGAME) $(GAME_EM) $(GAME_SP)
+AUTOCONF = conf_gfx.h conf_snd.h conf_mus.h
ICONBASE = windows_icon
+ICON_BASEPATH = ../Special/Icons/windows_icons
ifeq ($(PLATFORM),cross-win32)
ifdef SPECIAL_EDITION
-ICONSUFFIX = 32x32_$(SPECIAL_EDITION)
+# ICONSUFFIX = 32x32_$(SPECIAL_EDITION)
+ICON_PATH = $(ICON_BASEPATH)/$(SPECIAL_EDITION)
else
-ICONSUFFIX = 32x32
+# ICONSUFFIX = 32x32
+ICON_PATH = $(ICON_BASEPATH)/default
endif
-ICON32X32 = ../graphics/$(ICONBASE)_$(ICONSUFFIX).bmp
+# ICON32X32 = ../graphics/$(ICONBASE)_$(ICONSUFFIX).bmp
ICON = $(ICONBASE).o
endif
# build targets
# -----------------------------------------------------------------------------
-all: libgame_dir game_em_dir game_sp_dir $(PROGNAME)
+all: $(AUTOCONF) libgame_dir game_em_dir game_sp_dir $(PROGNAME)
$(PROGNAME): $(RNDLIBS) $(TIMESTAMP_FILE) $(OBJS) $(ICON)
$(CC) $(PROFILING) $(OBJS) $(ICON) $(RNDLIBS) $(LDFLAGS) -o $(PROGNAME)
> $(TIMESTAMP_FILE)
$(ICON):
- $(BMP2ICO) -transparent $(ICONBASE).ico $(ICON32X32)
+# $(CONVERT) $(ICON32X32) $(CONVERT_ICON_ARGS) $(ICONBASE).ico
+ $(CONVERT) $(ICON_PATH)/*.png $(CONVERT_ICON_ARGS) $(ICONBASE).ico
echo "$(ICONBASE) ICON $(ICONBASE).ico" | $(WINDRES) -o $(ICON)
.c.o:
FONT_TEXT_1, GFX_SPECIAL_ARG_LEVELS,
IMG_FONT_TEXT_1_LEVELS
},
+ {
+ FONT_TEXT_1, GFX_SPECIAL_ARG_LEVELNR,
+ IMG_FONT_TEXT_1_LEVELNR
+ },
{
FONT_TEXT_1, GFX_SPECIAL_ARG_SETUP,
IMG_FONT_TEXT_1_SETUP
FONT_TEXT_2, GFX_SPECIAL_ARG_LEVELS,
IMG_FONT_TEXT_2_LEVELS
},
+ {
+ FONT_TEXT_2, GFX_SPECIAL_ARG_LEVELNR,
+ IMG_FONT_TEXT_2_LEVELNR
+ },
{
FONT_TEXT_2, GFX_SPECIAL_ARG_SETUP,
IMG_FONT_TEXT_2_SETUP
FONT_TEXT_3, GFX_SPECIAL_ARG_LEVELS,
IMG_FONT_TEXT_3_LEVELS
},
+ {
+ FONT_TEXT_3, GFX_SPECIAL_ARG_LEVELNR,
+ IMG_FONT_TEXT_3_LEVELNR
+ },
{
FONT_TEXT_3, GFX_SPECIAL_ARG_SETUP,
IMG_FONT_TEXT_3_SETUP
FONT_TEXT_4, GFX_SPECIAL_ARG_LEVELS,
IMG_FONT_TEXT_4_LEVELS
},
+ {
+ FONT_TEXT_4, GFX_SPECIAL_ARG_LEVELNR,
+ IMG_FONT_TEXT_4_LEVELNR
+ },
{
FONT_TEXT_4, GFX_SPECIAL_ARG_SETUP,
IMG_FONT_TEXT_4_SETUP
{ ".sort_priority", ARG_UNDEFINED, TYPE_INTEGER },
{ ".class", ARG_UNDEFINED, TYPE_STRING },
{ ".style", ARG_UNDEFINED, TYPE_STRING },
+ { ".active_xoffset", "0", TYPE_INTEGER },
+ { ".active_yoffset", "0", TYPE_INTEGER },
+ { ".pressed_xoffset", "0", TYPE_INTEGER },
+ { ".pressed_yoffset", "0", TYPE_INTEGER },
{ NULL, NULL, 0 }
};
{ "menu.scrollbar.active.ypos", "10" },
{ "menu.scrollbar.active.frames", "1" },
+ { "game.button.gfx.stop", "RocksDoor.pcx" },
+ { "game.button.gfx.stop.x", "305" },
+ { "game.button.gfx.stop.y", "185" },
+ { "game.button.gfx.stop.width", "30" },
+ { "game.button.gfx.stop.height", "30" },
+ { "game.button.gfx.stop.pressed_xoffset", "-100" },
+ { "game.button.gfx.pause", "RocksDoor.pcx" },
+ { "game.button.gfx.pause.x", "335" },
+ { "game.button.gfx.pause.y", "185" },
+ { "game.button.gfx.pause.width", "30" },
+ { "game.button.gfx.pause.height", "30" },
+ { "game.button.gfx.pause.pressed_xoffset", "-100" },
+ { "game.button.gfx.play", "RocksDoor.pcx" },
+ { "game.button.gfx.play.x", "365" },
+ { "game.button.gfx.play.y", "185" },
+ { "game.button.gfx.play.width", "30" },
+ { "game.button.gfx.play.height", "30" },
+ { "game.button.gfx.play.pressed_xoffset", "-100" },
+ { "game.button.gfx.sound_music", "RocksDoor.pcx" },
+ { "game.button.gfx.sound_music.x", "305" },
+ { "game.button.gfx.sound_music.y", "245" },
+ { "game.button.gfx.sound_music.width", "30" },
+ { "game.button.gfx.sound_music.height", "30" },
+ { "game.button.gfx.sound_music.pressed_xoffset", "-100" },
+ { "game.button.gfx.sound_music.active_yoffset", "-30" },
+ { "game.button.gfx.sound_loops", "RocksDoor.pcx" },
+ { "game.button.gfx.sound_loops.x", "335" },
+ { "game.button.gfx.sound_loops.y", "245" },
+ { "game.button.gfx.sound_loops.width", "30" },
+ { "game.button.gfx.sound_loops.height", "30" },
+ { "game.button.gfx.sound_loops.pressed_xoffset", "-100" },
+ { "game.button.gfx.sound_loops.active_yoffset", "-30" },
+ { "game.button.gfx.sound_simple", "RocksDoor.pcx" },
+ { "game.button.gfx.sound_simple.x", "365" },
+ { "game.button.gfx.sound_simple.y", "245" },
+ { "game.button.gfx.sound_simple.width", "30" },
+ { "game.button.gfx.sound_simple.height", "30" },
+ { "game.button.gfx.sound_simple.pressed_xoffset", "-100" },
+ { "game.button.gfx.sound_simple.active_yoffset", "-30" },
+
+ { "tape.button.gfx.eject", "RocksDoor.pcx" },
+ { "tape.button.gfx.eject.x", "305" },
+ { "tape.button.gfx.eject.y", "357" },
+ { "tape.button.gfx.eject.width", "18" },
+ { "tape.button.gfx.eject.height", "18" },
+ { "tape.button.gfx.eject.pressed_xoffset", "-100" },
+ { "tape.button.gfx.extra", "RocksDoor.pcx" },
+ { "tape.button.gfx.extra.x", "505" },
+ { "tape.button.gfx.extra.y", "357" },
+ { "tape.button.gfx.extra.width", "18" },
+ { "tape.button.gfx.extra.height", "18" },
+ { "tape.button.gfx.extra.pressed_xoffset", "-100" },
+ { "tape.button.gfx.stop", "RocksDoor.pcx" },
+ { "tape.button.gfx.stop.x", "323" },
+ { "tape.button.gfx.stop.y", "357" },
+ { "tape.button.gfx.stop.width", "18" },
+ { "tape.button.gfx.stop.height", "18" },
+ { "tape.button.gfx.stop.pressed_xoffset", "-100" },
+ { "tape.button.gfx.pause", "RocksDoor.pcx" },
+ { "tape.button.gfx.pause.x", "341" },
+ { "tape.button.gfx.pause.y", "357" },
+ { "tape.button.gfx.pause.width", "18" },
+ { "tape.button.gfx.pause.height", "18" },
+ { "tape.button.gfx.pause.pressed_xoffset", "-100" },
+ { "tape.button.gfx.record", "RocksDoor.pcx" },
+ { "tape.button.gfx.record.x", "359" },
+ { "tape.button.gfx.record.y", "357" },
+ { "tape.button.gfx.record.width", "18" },
+ { "tape.button.gfx.record.height", "18" },
+ { "tape.button.gfx.record.pressed_xoffset", "-100" },
+ { "tape.button.gfx.play", "RocksDoor.pcx" },
+ { "tape.button.gfx.play.x", "377" },
+ { "tape.button.gfx.play.y", "357" },
+ { "tape.button.gfx.play.width", "18" },
+ { "tape.button.gfx.play.height", "18" },
+ { "tape.button.gfx.play.pressed_xoffset", "-100" },
+
+ { "tape.symbol.gfx.eject", UNDEFINED_FILENAME },
+ { "tape.symbol.gfx.stop", UNDEFINED_FILENAME },
+ { "tape.symbol.gfx.pause", "RocksDoor.pcx" },
+ { "tape.symbol.gfx.pause.x", "340" },
+ { "tape.symbol.gfx.pause.y", "321" },
+ { "tape.symbol.gfx.pause.width", "17" },
+ { "tape.symbol.gfx.pause.height", "13" },
+ { "tape.symbol.gfx.record", "RocksDoor.pcx" },
+ { "tape.symbol.gfx.record.x", "325" },
+ { "tape.symbol.gfx.record.y", "321" },
+ { "tape.symbol.gfx.record.width", "16" },
+ { "tape.symbol.gfx.record.height", "16" },
+ { "tape.symbol.gfx.play", "RocksDoor.pcx" },
+ { "tape.symbol.gfx.play.x", "357" },
+ { "tape.symbol.gfx.play.y", "321" },
+ { "tape.symbol.gfx.play.width", "11" },
+ { "tape.symbol.gfx.play.height", "13" },
+ { "tape.symbol.gfx.fast_forward", "RocksDoor.pcx" },
+ { "tape.symbol.gfx.fast_forward.x", "539" },
+ { "tape.symbol.gfx.fast_forward.y", "193" },
+ { "tape.symbol.gfx.fast_forward.width", "27" },
+ { "tape.symbol.gfx.fast_forward.height", "13" },
+ { "tape.symbol.gfx.warp_forward", "RocksDoor.pcx" },
+ { "tape.symbol.gfx.warp_forward.x", "539" },
+ { "tape.symbol.gfx.warp_forward.y", "152" },
+ { "tape.symbol.gfx.warp_forward.width", "27" },
+ { "tape.symbol.gfx.warp_forward.height", "13" },
+ { "tape.symbol.gfx.warp_forward_blind", "RocksDoor.pcx" },
+ { "tape.symbol.gfx.warp_forward_blind.x", "539" },
+ { "tape.symbol.gfx.warp_forward_blind.y", "165" },
+ { "tape.symbol.gfx.warp_forward_blind.width", "27" },
+ { "tape.symbol.gfx.warp_forward_blind.height","13" },
+ { "tape.symbol.gfx.pause_before_end", "RocksDoor.pcx" },
+ { "tape.symbol.gfx.pause_before_end.x", "539" },
+ { "tape.symbol.gfx.pause_before_end.y", "221" },
+ { "tape.symbol.gfx.pause_before_end.width", "27" },
+ { "tape.symbol.gfx.pause_before_end.height", "13" },
+ { "tape.symbol.gfx.single_step", UNDEFINED_FILENAME },
+
+ { "tape.label.gfx.eject", UNDEFINED_FILENAME },
+ { "tape.label.gfx.stop", UNDEFINED_FILENAME },
+ { "tape.label.gfx.pause", "RocksDoor.pcx" },
+ { "tape.label.gfx.pause.x", "305" },
+ { "tape.label.gfx.pause.y", "341" },
+ { "tape.label.gfx.pause.width", "35" },
+ { "tape.label.gfx.pause.height", "8" },
+ { "tape.label.gfx.record", "RocksDoor.pcx" },
+ { "tape.label.gfx.record.x", "305" },
+ { "tape.label.gfx.record.y", "321" },
+ { "tape.label.gfx.record.width", "20" },
+ { "tape.label.gfx.record.height", "12" },
+ { "tape.label.gfx.play", "RocksDoor.pcx" },
+ { "tape.label.gfx.play.x", "370" },
+ { "tape.label.gfx.play.y", "321" },
+ { "tape.label.gfx.play.width", "22" },
+ { "tape.label.gfx.play.height", "12" },
+ { "tape.label.gfx.fast_forward", "RocksDoor.pcx" },
+ { "tape.label.gfx.fast_forward.x", "505" },
+ { "tape.label.gfx.fast_forward.y", "193" },
+ { "tape.label.gfx.fast_forward.width", "40" },
+ { "tape.label.gfx.fast_forward.height", "28" },
+ { "tape.label.gfx.warp_forward", "RocksDoor.pcx" },
+ { "tape.label.gfx.warp_forward.x", "505" },
+ { "tape.label.gfx.warp_forward.y", "165" },
+ { "tape.label.gfx.warp_forward.width", "40" },
+ { "tape.label.gfx.warp_forward.height", "28" },
+ { "tape.label.gfx.warp_forward_blind", "RocksDoor.pcx" },
+ { "tape.label.gfx.warp_forward_blind.x", "505" },
+ { "tape.label.gfx.warp_forward_blind.y", "165" },
+ { "tape.label.gfx.warp_forward_blind.width", "40" },
+ { "tape.label.gfx.warp_forward_blind.height", "28" },
+ { "tape.label.gfx.pause_before_end", "RocksDoor.pcx" },
+ { "tape.label.gfx.pause_before_end.x", "505" },
+ { "tape.label.gfx.pause_before_end.y", "221" },
+ { "tape.label.gfx.pause_before_end.width", "40" },
+ { "tape.label.gfx.pause_before_end.height", "28" },
+ { "tape.label.gfx.single_step", "RocksDoor.pcx" },
+ { "tape.label.gfx.single_step.x", "557" },
+ { "tape.label.gfx.single_step.y", "139" },
+ { "tape.label.gfx.single_step.width", "38" },
+ { "tape.label.gfx.single_step.height", "13" },
+
+ { "tape.label.gfx.date", "RocksDoor.pcx" },
+ { "tape.label.gfx.date.x", "305" },
+ { "tape.label.gfx.date.y", "285" },
+ { "tape.label.gfx.date.width", "90" },
+ { "tape.label.gfx.date.height", "13" },
+ { "tape.label.gfx.time", UNDEFINED_FILENAME },
+
{ "font.initial_1", "RocksFontSmall.pcx" },
{ "font.initial_1.x", "0" },
{ "font.initial_1.y", "0" },
{ "font.text_1.LEVELS.y", "0" },
{ "font.text_1.LEVELS.width", "16" },
{ "font.text_1.LEVELS.height", "32" },
+ { "font.text_1.LEVELNR", UNDEFINED_FILENAME },
+ { "font.text_1.LEVELNR.clone_from", "font.text_1.LEVELS" },
{ "font.text_1.SETUP", UNDEFINED_FILENAME },
{ "font.text_1.SETUP.clone_from", "font.text_1.LEVELS" },
{ "font.text_1.PREVIEW", "RocksFontEM.pcx" },
{ "font.text_2.LEVELS.y", "160" },
{ "font.text_2.LEVELS.width", "16" },
{ "font.text_2.LEVELS.height", "32" },
+ { "font.text_2.LEVELNR", UNDEFINED_FILENAME },
+ { "font.text_2.LEVELNR.clone_from", "font.text_2.LEVELS" },
{ "font.text_2.SETUP", UNDEFINED_FILENAME },
{ "font.text_2.SETUP.clone_from", "font.text_2.LEVELS" },
{ "font.text_2.PREVIEW", "RocksFontEM.pcx" },
{ "font.text_3.LEVELS.y", "320" },
{ "font.text_3.LEVELS.width", "16" },
{ "font.text_3.LEVELS.height", "32" },
+ { "font.text_3.LEVELNR", UNDEFINED_FILENAME },
+ { "font.text_3.LEVELNR.clone_from", "font.text_3.LEVELS" },
{ "font.text_3.SETUP", UNDEFINED_FILENAME },
{ "font.text_3.SETUP.clone_from", "font.text_3.LEVELS" },
{ "font.text_3.PREVIEW", "RocksFontEM.pcx" },
{ "font.text_4.LEVELS.y", "480" },
{ "font.text_4.LEVELS.width", "16" },
{ "font.text_4.LEVELS.height", "32" },
+ { "font.text_4.LEVELNR", UNDEFINED_FILENAME },
+ { "font.text_4.LEVELNR.clone_from", "font.text_4.LEVELS" },
{ "font.text_4.SETUP", UNDEFINED_FILENAME },
{ "font.text_4.SETUP.clone_from", "font.text_4.LEVELS" },
{ "font.text_4.SCORES", "RocksFontMedium.pcx" },
{ "global.busy.frames_per_line", "7" },
{ "global.busy.delay", "2" },
- { "editor.element_border", "RocksElements.pcx" },
- { "editor.element_border.x", "0" },
- { "editor.element_border.y", "0" },
+ { "editor.element_border", "RocksMore.pcx" },
+ { "editor.element_border.xpos", "0" },
+ { "editor.element_border.ypos", "2" },
- { "editor.element_border_input", "RocksDoor.pcx" },
- { "editor.element_border_input.x", "740" },
- { "editor.element_border_input.y", "48" },
+ { "editor.element_border_input", "RocksMore.pcx" },
+ { "editor.element_border_input.xpos", "10" },
+ { "editor.element_border_input.ypos", "7" },
- { "editor.cascade_list", "RocksDoor.pcx" },
- { "editor.cascade_list.x", "708" },
- { "editor.cascade_list.y", "80" },
+ { "editor.cascade_list", "RocksMore.pcx" },
+ { "editor.cascade_list.xpos", "9" },
+ { "editor.cascade_list.ypos", "8" },
{ "editor.cascade_list.frames", "1" },
- { "editor.cascade_list.active", "RocksDoor.pcx" },
- { "editor.cascade_list.active.x", "740" },
- { "editor.cascade_list.active.y", "80" },
+ { "editor.cascade_list.active", "RocksMore.pcx" },
+ { "editor.cascade_list.active.xpos", "10" },
+ { "editor.cascade_list.active.ypos", "8" },
{ "editor.cascade_list.active.frames", "1" },
{ "background", UNDEFINED_FILENAME },
{ "background.TITLE", UNDEFINED_FILENAME },
{ "background.MAIN", UNDEFINED_FILENAME },
{ "background.LEVELS", UNDEFINED_FILENAME },
+ { "background.LEVELNR", UNDEFINED_FILENAME },
{ "background.SCORES", UNDEFINED_FILENAME },
{ "background.EDITOR", UNDEFINED_FILENAME },
{ "background.INFO", UNDEFINED_FILENAME },
{ "background.SETUP", UNDEFINED_FILENAME },
{ "background.PLAYING", UNDEFINED_FILENAME },
{ "background.DOOR", UNDEFINED_FILENAME },
+ { "background.TAPE", "RocksDoor.pcx" },
+ { "background.TAPE.x", "200" },
+ { "background.TAPE.y", "280" },
+ { "background.TAPE.width", "100" },
+ { "background.TAPE.height", "100" },
+ { "background.PANEL", "RocksDoor.pcx" },
+ { "background.PANEL.x", "400" },
+ { "background.PANEL.y", "0" },
+ { "background.PANEL.width", "100" },
+ { "background.PANEL.height", "280" },
{ "background.titlescreen_initial_1", UNDEFINED_FILENAME },
{ "background.titlescreen_initial_2", UNDEFINED_FILENAME },
{ "border.draw_masked.TITLE", "false" },
{ "border.draw_masked.MAIN", "false" },
{ "border.draw_masked.LEVELS", "false" },
+ { "border.draw_masked.LEVELNR", "false" },
{ "border.draw_masked.SCORES", "false" },
{ "border.draw_masked.EDITOR", "false" },
{ "border.draw_masked.INFO", "false" },
{ "menu.draw_yoffset.MAIN", "0" },
{ "menu.draw_xoffset.LEVELS", "0" },
{ "menu.draw_yoffset.LEVELS", "0" },
+ { "menu.draw_xoffset.LEVELNR", "0" },
+ { "menu.draw_yoffset.LEVELNR", "0" },
{ "menu.draw_xoffset.SCORES", "0" },
{ "menu.draw_yoffset.SCORES", "0" },
{ "menu.draw_xoffset.EDITOR", "0" },
{ "menu.list_size", "-1" },
{ "menu.list_size.LEVELS", "-1" },
+ { "menu.list_size.LEVELNR", "-1" },
{ "menu.list_size.SCORES", "-1" },
{ "menu.list_size.INFO", "-1" },
{ "menu.list_size.SETUP", "-1" },
{ "game.button.sound_simple.x", "65" },
{ "game.button.sound_simple.y", "245" },
+ { "tape.button.eject.x", "5" },
+ { "tape.button.eject.y", "77" },
+ { "tape.button.stop.x", "23" },
+ { "tape.button.stop.y", "77" },
+ { "tape.button.pause.x", "41" },
+ { "tape.button.pause.y", "77" },
+ { "tape.button.record.x", "59" },
+ { "tape.button.record.y", "77" },
+ { "tape.button.play.x", "77" },
+ { "tape.button.play.y", "77" },
+
+ { "tape.symbol.eject.x", "-1" },
+ { "tape.symbol.eject.y", "-1" },
+ { "tape.symbol.stop.x", "-1" },
+ { "tape.symbol.stop.y", "-1" },
+ { "tape.symbol.pause.x", "40" },
+ { "tape.symbol.pause.y", "41" },
+ { "tape.symbol.record.x", "25" },
+ { "tape.symbol.record.y", "41" },
+ { "tape.symbol.play.x", "57" },
+ { "tape.symbol.play.y", "41" },
+ { "tape.symbol.fast_forward.x", "39" },
+ { "tape.symbol.fast_forward.y", "42" },
+ { "tape.symbol.warp_forward.x", "39" },
+ { "tape.symbol.warp_forward.y", "42" },
+ { "tape.symbol.warp_forward_blind.x", "39" },
+ { "tape.symbol.warp_forward_blind.y", "42" },
+ { "tape.symbol.pause_before_end.x", "39" },
+ { "tape.symbol.pause_before_end.y", "42" },
+ { "tape.symbol.single_step.x", "-1" },
+ { "tape.symbol.single_step.y", "-1" },
+
+ { "tape.label.eject.x", "-1" },
+ { "tape.label.eject.y", "-1" },
+ { "tape.label.stop.x", "-1" },
+ { "tape.label.stop.y", "-1" },
+ { "tape.label.pause.x", "5" },
+ { "tape.label.pause.y", "61" },
+ { "tape.label.record.x", "5" },
+ { "tape.label.record.y", "41" },
+ { "tape.label.play.x", "70" },
+ { "tape.label.play.y", "41" },
+ { "tape.label.fast_forward.x", "5" },
+ { "tape.label.fast_forward.y", "42" },
+ { "tape.label.warp_forward.x", "-1" },
+ { "tape.label.warp_forward.y", "-1" },
+ { "tape.label.warp_forward_blind.x", "5" },
+ { "tape.label.warp_forward_blind.y", "42" },
+ { "tape.label.pause_before_end.x", "5" },
+ { "tape.label.pause_before_end.y", "42" },
+ { "tape.label.single_step.x", "57" },
+ { "tape.label.single_step.y", "42" },
+
+ { "tape.label.date.x", "5" },
+ { "tape.label.date.y", "5" },
+ { "tape.label.time.x", "-1" },
+ { "tape.label.time.y", "-1" },
+
+ { "tape.text.date.x", "7" },
+ { "tape.text.date.y", "19" },
+ { "tape.text.date.align", "left" },
+ { "tape.text.date.valign", "top" },
+ { "tape.text.date.digits", "-1" },
+ { "tape.text.date.font", "font.tape_recorder" },
+
+ { "tape.text.time.x", "44" },
+ { "tape.text.time.y", "55" },
+ { "tape.text.time.align", "left" },
+ { "tape.text.time.valign", "top" },
+ { "tape.text.time.digits", "-1" },
+ { "tape.text.time.font", "font.tape_recorder" },
+
{ "game.forced_scroll_delay_value", "-1" },
{ "game.use_native_emc_graphics_engine", "false" },
{ "game.use_native_sp_graphics_engine", "true" },
{ "game.use_masked_pushing", "false" },
+ { "game.tile_size", "32" },
{ "[player].boring_delay_fixed", "1000" },
{ "[player].boring_delay_random", "1000" },
#define IMG_MENU_BUTTON_QUIT_ACTIVE 1678
#define IMG_MENU_SCROLLBAR 1679
#define IMG_MENU_SCROLLBAR_ACTIVE 1680
-#define IMG_FONT_INITIAL_1 1681
-#define IMG_FONT_INITIAL_2 1682
-#define IMG_FONT_INITIAL_3 1683
-#define IMG_FONT_INITIAL_4 1684
-#define IMG_FONT_TITLE_1 1685
-#define IMG_FONT_TITLE_2 1686
-#define IMG_FONT_TITLE_2_SETUP 1687
-#define IMG_FONT_MENU_1 1688
-#define IMG_FONT_MENU_1_ACTIVE 1689
-#define IMG_FONT_MENU_2 1690
-#define IMG_FONT_MENU_2_ACTIVE 1691
-#define IMG_FONT_TEXT_1 1692
-#define IMG_FONT_TEXT_1_MAIN 1693
-#define IMG_FONT_TEXT_1_LEVELS 1694
-#define IMG_FONT_TEXT_1_SETUP 1695
-#define IMG_FONT_TEXT_1_PREVIEW 1696
-#define IMG_FONT_TEXT_1_SCORES 1697
-#define IMG_FONT_TEXT_1_ACTIVE_SCORES 1698
-#define IMG_FONT_TEXT_1_PANEL 1699
-#define IMG_FONT_TEXT_1_DOOR 1700
-#define IMG_FONT_TEXT_2 1701
-#define IMG_FONT_TEXT_2_MAIN 1702
-#define IMG_FONT_TEXT_2_LEVELS 1703
-#define IMG_FONT_TEXT_2_SETUP 1704
-#define IMG_FONT_TEXT_2_PREVIEW 1705
-#define IMG_FONT_TEXT_2_SCORES 1706
-#define IMG_FONT_TEXT_2_ACTIVE_SCORES 1707
-#define IMG_FONT_TEXT_3 1708
-#define IMG_FONT_TEXT_3_LEVELS 1709
-#define IMG_FONT_TEXT_3_SETUP 1710
-#define IMG_FONT_TEXT_3_PREVIEW 1711
-#define IMG_FONT_TEXT_3_SCORES 1712
-#define IMG_FONT_TEXT_3_ACTIVE_SCORES 1713
-#define IMG_FONT_TEXT_4 1714
-#define IMG_FONT_TEXT_4_MAIN 1715
-#define IMG_FONT_TEXT_4_LEVELS 1716
-#define IMG_FONT_TEXT_4_SETUP 1717
-#define IMG_FONT_TEXT_4_SCORES 1718
-#define IMG_FONT_TEXT_4_ACTIVE_SCORES 1719
-#define IMG_FONT_ENVELOPE_1 1720
-#define IMG_FONT_ENVELOPE_2 1721
-#define IMG_FONT_ENVELOPE_3 1722
-#define IMG_FONT_ENVELOPE_4 1723
-#define IMG_FONT_INPUT_1 1724
-#define IMG_FONT_INPUT_1_MAIN 1725
-#define IMG_FONT_INPUT_1_ACTIVE 1726
-#define IMG_FONT_INPUT_1_ACTIVE_MAIN 1727
-#define IMG_FONT_INPUT_1_ACTIVE_SETUP 1728
-#define IMG_FONT_INPUT_2 1729
-#define IMG_FONT_INPUT_2_ACTIVE 1730
-#define IMG_FONT_OPTION_OFF 1731
-#define IMG_FONT_OPTION_ON 1732
-#define IMG_FONT_VALUE_1 1733
-#define IMG_FONT_VALUE_2 1734
-#define IMG_FONT_VALUE_OLD 1735
-#define IMG_FONT_LEVEL_NUMBER 1736
-#define IMG_FONT_LEVEL_NUMBER_ACTIVE 1737
-#define IMG_FONT_TAPE_RECORDER 1738
-#define IMG_FONT_GAME_INFO 1739
-#define IMG_FONT_INFO_ELEMENTS 1740
-#define IMG_FONT_INFO_LEVELSET 1741
-#define IMG_GLOBAL_BORDER 1742
-#define IMG_GLOBAL_DOOR 1743
-#define IMG_GLOBAL_BUSY 1744
-#define IMG_EDITOR_ELEMENT_BORDER 1745
-#define IMG_EDITOR_ELEMENT_BORDER_INPUT 1746
-#define IMG_EDITOR_CASCADE_LIST 1747
-#define IMG_EDITOR_CASCADE_LIST_ACTIVE 1748
-#define IMG_BACKGROUND 1749
-#define IMG_BACKGROUND_TITLE_INITIAL 1750
-#define IMG_BACKGROUND_TITLE 1751
-#define IMG_BACKGROUND_MAIN 1752
-#define IMG_BACKGROUND_LEVELS 1753
-#define IMG_BACKGROUND_SCORES 1754
-#define IMG_BACKGROUND_EDITOR 1755
-#define IMG_BACKGROUND_INFO 1756
-#define IMG_BACKGROUND_INFO_ELEMENTS 1757
-#define IMG_BACKGROUND_INFO_MUSIC 1758
-#define IMG_BACKGROUND_INFO_CREDITS 1759
-#define IMG_BACKGROUND_INFO_PROGRAM 1760
-#define IMG_BACKGROUND_INFO_VERSION 1761
-#define IMG_BACKGROUND_INFO_LEVELSET 1762
-#define IMG_BACKGROUND_SETUP 1763
-#define IMG_BACKGROUND_PLAYING 1764
-#define IMG_BACKGROUND_DOOR 1765
-#define IMG_BACKGROUND_TITLESCREEN_INITIAL_1 1766
-#define IMG_BACKGROUND_TITLESCREEN_INITIAL_2 1767
-#define IMG_BACKGROUND_TITLESCREEN_INITIAL_3 1768
-#define IMG_BACKGROUND_TITLESCREEN_INITIAL_4 1769
-#define IMG_BACKGROUND_TITLESCREEN_INITIAL_5 1770
-#define IMG_BACKGROUND_TITLESCREEN_1 1771
-#define IMG_BACKGROUND_TITLESCREEN_2 1772
-#define IMG_BACKGROUND_TITLESCREEN_3 1773
-#define IMG_BACKGROUND_TITLESCREEN_4 1774
-#define IMG_BACKGROUND_TITLESCREEN_5 1775
-#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_1 1776
-#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_2 1777
-#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_3 1778
-#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_4 1779
-#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_5 1780
-#define IMG_BACKGROUND_TITLEMESSAGE_1 1781
-#define IMG_BACKGROUND_TITLEMESSAGE_2 1782
-#define IMG_BACKGROUND_TITLEMESSAGE_3 1783
-#define IMG_BACKGROUND_TITLEMESSAGE_4 1784
-#define IMG_BACKGROUND_TITLEMESSAGE_5 1785
-#define IMG_BACKGROUND_ENVELOPE_1 1786
-#define IMG_BACKGROUND_ENVELOPE_2 1787
-#define IMG_BACKGROUND_ENVELOPE_3 1788
-#define IMG_BACKGROUND_ENVELOPE_4 1789
-#define IMG_TITLESCREEN_INITIAL_1 1790
-#define IMG_TITLESCREEN_INITIAL_2 1791
-#define IMG_TITLESCREEN_INITIAL_3 1792
-#define IMG_TITLESCREEN_INITIAL_4 1793
-#define IMG_TITLESCREEN_INITIAL_5 1794
-#define IMG_TITLESCREEN_1 1795
-#define IMG_TITLESCREEN_2 1796
-#define IMG_TITLESCREEN_3 1797
-#define IMG_TITLESCREEN_4 1798
-#define IMG_TITLESCREEN_5 1799
+#define IMG_GAME_BUTTON_GFX_STOP 1681
+#define IMG_GAME_BUTTON_GFX_PAUSE 1682
+#define IMG_GAME_BUTTON_GFX_PLAY 1683
+#define IMG_GAME_BUTTON_GFX_SOUND_MUSIC 1684
+#define IMG_GAME_BUTTON_GFX_SOUND_LOOPS 1685
+#define IMG_GAME_BUTTON_GFX_SOUND_SIMPLE 1686
+#define IMG_TAPE_BUTTON_GFX_EJECT 1687
+#define IMG_TAPE_BUTTON_GFX_EXTRA 1688
+#define IMG_TAPE_BUTTON_GFX_STOP 1689
+#define IMG_TAPE_BUTTON_GFX_PAUSE 1690
+#define IMG_TAPE_BUTTON_GFX_RECORD 1691
+#define IMG_TAPE_BUTTON_GFX_PLAY 1692
+#define IMG_TAPE_SYMBOL_GFX_EJECT 1693
+#define IMG_TAPE_SYMBOL_GFX_STOP 1694
+#define IMG_TAPE_SYMBOL_GFX_PAUSE 1695
+#define IMG_TAPE_SYMBOL_GFX_RECORD 1696
+#define IMG_TAPE_SYMBOL_GFX_PLAY 1697
+#define IMG_TAPE_SYMBOL_GFX_FAST_FORWARD 1698
+#define IMG_TAPE_SYMBOL_GFX_WARP_FORWARD 1699
+#define IMG_TAPE_SYMBOL_GFX_WARP_FORWARD_BLIND 1700
+#define IMG_TAPE_SYMBOL_GFX_PAUSE_BEFORE_END 1701
+#define IMG_TAPE_SYMBOL_GFX_SINGLE_STEP 1702
+#define IMG_TAPE_LABEL_GFX_EJECT 1703
+#define IMG_TAPE_LABEL_GFX_STOP 1704
+#define IMG_TAPE_LABEL_GFX_PAUSE 1705
+#define IMG_TAPE_LABEL_GFX_RECORD 1706
+#define IMG_TAPE_LABEL_GFX_PLAY 1707
+#define IMG_TAPE_LABEL_GFX_FAST_FORWARD 1708
+#define IMG_TAPE_LABEL_GFX_WARP_FORWARD 1709
+#define IMG_TAPE_LABEL_GFX_WARP_FORWARD_BLIND 1710
+#define IMG_TAPE_LABEL_GFX_PAUSE_BEFORE_END 1711
+#define IMG_TAPE_LABEL_GFX_SINGLE_STEP 1712
+#define IMG_TAPE_LABEL_GFX_DATE 1713
+#define IMG_TAPE_LABEL_GFX_TIME 1714
+#define IMG_FONT_INITIAL_1 1715
+#define IMG_FONT_INITIAL_2 1716
+#define IMG_FONT_INITIAL_3 1717
+#define IMG_FONT_INITIAL_4 1718
+#define IMG_FONT_TITLE_1 1719
+#define IMG_FONT_TITLE_2 1720
+#define IMG_FONT_TITLE_2_SETUP 1721
+#define IMG_FONT_MENU_1 1722
+#define IMG_FONT_MENU_1_ACTIVE 1723
+#define IMG_FONT_MENU_2 1724
+#define IMG_FONT_MENU_2_ACTIVE 1725
+#define IMG_FONT_TEXT_1 1726
+#define IMG_FONT_TEXT_1_MAIN 1727
+#define IMG_FONT_TEXT_1_LEVELS 1728
+#define IMG_FONT_TEXT_1_LEVELNR 1729
+#define IMG_FONT_TEXT_1_SETUP 1730
+#define IMG_FONT_TEXT_1_PREVIEW 1731
+#define IMG_FONT_TEXT_1_SCORES 1732
+#define IMG_FONT_TEXT_1_ACTIVE_SCORES 1733
+#define IMG_FONT_TEXT_1_PANEL 1734
+#define IMG_FONT_TEXT_1_DOOR 1735
+#define IMG_FONT_TEXT_2 1736
+#define IMG_FONT_TEXT_2_MAIN 1737
+#define IMG_FONT_TEXT_2_LEVELS 1738
+#define IMG_FONT_TEXT_2_LEVELNR 1739
+#define IMG_FONT_TEXT_2_SETUP 1740
+#define IMG_FONT_TEXT_2_PREVIEW 1741
+#define IMG_FONT_TEXT_2_SCORES 1742
+#define IMG_FONT_TEXT_2_ACTIVE_SCORES 1743
+#define IMG_FONT_TEXT_3 1744
+#define IMG_FONT_TEXT_3_LEVELS 1745
+#define IMG_FONT_TEXT_3_LEVELNR 1746
+#define IMG_FONT_TEXT_3_SETUP 1747
+#define IMG_FONT_TEXT_3_PREVIEW 1748
+#define IMG_FONT_TEXT_3_SCORES 1749
+#define IMG_FONT_TEXT_3_ACTIVE_SCORES 1750
+#define IMG_FONT_TEXT_4 1751
+#define IMG_FONT_TEXT_4_MAIN 1752
+#define IMG_FONT_TEXT_4_LEVELS 1753
+#define IMG_FONT_TEXT_4_LEVELNR 1754
+#define IMG_FONT_TEXT_4_SETUP 1755
+#define IMG_FONT_TEXT_4_SCORES 1756
+#define IMG_FONT_TEXT_4_ACTIVE_SCORES 1757
+#define IMG_FONT_ENVELOPE_1 1758
+#define IMG_FONT_ENVELOPE_2 1759
+#define IMG_FONT_ENVELOPE_3 1760
+#define IMG_FONT_ENVELOPE_4 1761
+#define IMG_FONT_INPUT_1 1762
+#define IMG_FONT_INPUT_1_MAIN 1763
+#define IMG_FONT_INPUT_1_ACTIVE 1764
+#define IMG_FONT_INPUT_1_ACTIVE_MAIN 1765
+#define IMG_FONT_INPUT_1_ACTIVE_SETUP 1766
+#define IMG_FONT_INPUT_2 1767
+#define IMG_FONT_INPUT_2_ACTIVE 1768
+#define IMG_FONT_OPTION_OFF 1769
+#define IMG_FONT_OPTION_ON 1770
+#define IMG_FONT_VALUE_1 1771
+#define IMG_FONT_VALUE_2 1772
+#define IMG_FONT_VALUE_OLD 1773
+#define IMG_FONT_LEVEL_NUMBER 1774
+#define IMG_FONT_LEVEL_NUMBER_ACTIVE 1775
+#define IMG_FONT_TAPE_RECORDER 1776
+#define IMG_FONT_GAME_INFO 1777
+#define IMG_FONT_INFO_ELEMENTS 1778
+#define IMG_FONT_INFO_LEVELSET 1779
+#define IMG_GLOBAL_BORDER 1780
+#define IMG_GLOBAL_DOOR 1781
+#define IMG_GLOBAL_BUSY 1782
+#define IMG_EDITOR_ELEMENT_BORDER 1783
+#define IMG_EDITOR_ELEMENT_BORDER_INPUT 1784
+#define IMG_EDITOR_CASCADE_LIST 1785
+#define IMG_EDITOR_CASCADE_LIST_ACTIVE 1786
+#define IMG_BACKGROUND 1787
+#define IMG_BACKGROUND_TITLE_INITIAL 1788
+#define IMG_BACKGROUND_TITLE 1789
+#define IMG_BACKGROUND_MAIN 1790
+#define IMG_BACKGROUND_LEVELS 1791
+#define IMG_BACKGROUND_LEVELNR 1792
+#define IMG_BACKGROUND_SCORES 1793
+#define IMG_BACKGROUND_EDITOR 1794
+#define IMG_BACKGROUND_INFO 1795
+#define IMG_BACKGROUND_INFO_ELEMENTS 1796
+#define IMG_BACKGROUND_INFO_MUSIC 1797
+#define IMG_BACKGROUND_INFO_CREDITS 1798
+#define IMG_BACKGROUND_INFO_PROGRAM 1799
+#define IMG_BACKGROUND_INFO_VERSION 1800
+#define IMG_BACKGROUND_INFO_LEVELSET 1801
+#define IMG_BACKGROUND_SETUP 1802
+#define IMG_BACKGROUND_PLAYING 1803
+#define IMG_BACKGROUND_DOOR 1804
+#define IMG_BACKGROUND_TAPE 1805
+#define IMG_BACKGROUND_PANEL 1806
+#define IMG_BACKGROUND_TITLESCREEN_INITIAL_1 1807
+#define IMG_BACKGROUND_TITLESCREEN_INITIAL_2 1808
+#define IMG_BACKGROUND_TITLESCREEN_INITIAL_3 1809
+#define IMG_BACKGROUND_TITLESCREEN_INITIAL_4 1810
+#define IMG_BACKGROUND_TITLESCREEN_INITIAL_5 1811
+#define IMG_BACKGROUND_TITLESCREEN_1 1812
+#define IMG_BACKGROUND_TITLESCREEN_2 1813
+#define IMG_BACKGROUND_TITLESCREEN_3 1814
+#define IMG_BACKGROUND_TITLESCREEN_4 1815
+#define IMG_BACKGROUND_TITLESCREEN_5 1816
+#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_1 1817
+#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_2 1818
+#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_3 1819
+#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_4 1820
+#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_5 1821
+#define IMG_BACKGROUND_TITLEMESSAGE_1 1822
+#define IMG_BACKGROUND_TITLEMESSAGE_2 1823
+#define IMG_BACKGROUND_TITLEMESSAGE_3 1824
+#define IMG_BACKGROUND_TITLEMESSAGE_4 1825
+#define IMG_BACKGROUND_TITLEMESSAGE_5 1826
+#define IMG_BACKGROUND_ENVELOPE_1 1827
+#define IMG_BACKGROUND_ENVELOPE_2 1828
+#define IMG_BACKGROUND_ENVELOPE_3 1829
+#define IMG_BACKGROUND_ENVELOPE_4 1830
+#define IMG_TITLESCREEN_INITIAL_1 1831
+#define IMG_TITLESCREEN_INITIAL_2 1832
+#define IMG_TITLESCREEN_INITIAL_3 1833
+#define IMG_TITLESCREEN_INITIAL_4 1834
+#define IMG_TITLESCREEN_INITIAL_5 1835
+#define IMG_TITLESCREEN_1 1836
+#define IMG_TITLESCREEN_2 1837
+#define IMG_TITLESCREEN_3 1838
+#define IMG_TITLESCREEN_4 1839
+#define IMG_TITLESCREEN_5 1840
-#define NUM_IMAGE_FILES 1800
+#define NUM_IMAGE_FILES 1841
#endif /* CONF_GFX_H */
"border.draw_masked.LEVELS",
&border.draw_masked[GFX_SPECIAL_ARG_LEVELS]
},
+ {
+ "border.draw_masked.LEVELNR",
+ &border.draw_masked[GFX_SPECIAL_ARG_LEVELNR]
+ },
{
"border.draw_masked.SCORES",
&border.draw_masked[GFX_SPECIAL_ARG_SCORES]
"menu.draw_yoffset.LEVELS",
&menu.draw_yoffset[GFX_SPECIAL_ARG_LEVELS]
},
+ {
+ "menu.draw_xoffset.LEVELNR",
+ &menu.draw_xoffset[GFX_SPECIAL_ARG_LEVELNR]
+ },
+ {
+ "menu.draw_yoffset.LEVELNR",
+ &menu.draw_yoffset[GFX_SPECIAL_ARG_LEVELNR]
+ },
{
"menu.draw_xoffset.SCORES",
&menu.draw_xoffset[GFX_SPECIAL_ARG_SCORES]
"menu.list_size.LEVELS",
&menu.list_size[GFX_SPECIAL_ARG_LEVELS]
},
+ {
+ "menu.list_size.LEVELNR",
+ &menu.list_size[GFX_SPECIAL_ARG_LEVELNR]
+ },
{
"menu.list_size.SCORES",
&menu.list_size[GFX_SPECIAL_ARG_SCORES]
"game.button.sound_simple.y",
&game.button.sound_simple.y
},
+ {
+ "tape.button.eject.x",
+ &tape.button.eject.x
+ },
+ {
+ "tape.button.eject.y",
+ &tape.button.eject.y
+ },
+ {
+ "tape.button.stop.x",
+ &tape.button.stop.x
+ },
+ {
+ "tape.button.stop.y",
+ &tape.button.stop.y
+ },
+ {
+ "tape.button.pause.x",
+ &tape.button.pause.x
+ },
+ {
+ "tape.button.pause.y",
+ &tape.button.pause.y
+ },
+ {
+ "tape.button.record.x",
+ &tape.button.record.x
+ },
+ {
+ "tape.button.record.y",
+ &tape.button.record.y
+ },
+ {
+ "tape.button.play.x",
+ &tape.button.play.x
+ },
+ {
+ "tape.button.play.y",
+ &tape.button.play.y
+ },
+ {
+ "tape.symbol.eject.x",
+ &tape.symbol.eject.x
+ },
+ {
+ "tape.symbol.eject.y",
+ &tape.symbol.eject.y
+ },
+ {
+ "tape.symbol.stop.x",
+ &tape.symbol.stop.x
+ },
+ {
+ "tape.symbol.stop.y",
+ &tape.symbol.stop.y
+ },
+ {
+ "tape.symbol.pause.x",
+ &tape.symbol.pause.x
+ },
+ {
+ "tape.symbol.pause.y",
+ &tape.symbol.pause.y
+ },
+ {
+ "tape.symbol.record.x",
+ &tape.symbol.record.x
+ },
+ {
+ "tape.symbol.record.y",
+ &tape.symbol.record.y
+ },
+ {
+ "tape.symbol.play.x",
+ &tape.symbol.play.x
+ },
+ {
+ "tape.symbol.play.y",
+ &tape.symbol.play.y
+ },
+ {
+ "tape.symbol.fast_forward.x",
+ &tape.symbol.fast_forward.x
+ },
+ {
+ "tape.symbol.fast_forward.y",
+ &tape.symbol.fast_forward.y
+ },
+ {
+ "tape.symbol.warp_forward.x",
+ &tape.symbol.warp_forward.x
+ },
+ {
+ "tape.symbol.warp_forward.y",
+ &tape.symbol.warp_forward.y
+ },
+ {
+ "tape.symbol.warp_forward_blind.x",
+ &tape.symbol.warp_forward_blind.x
+ },
+ {
+ "tape.symbol.warp_forward_blind.y",
+ &tape.symbol.warp_forward_blind.y
+ },
+ {
+ "tape.symbol.pause_before_end.x",
+ &tape.symbol.pause_before_end.x
+ },
+ {
+ "tape.symbol.pause_before_end.y",
+ &tape.symbol.pause_before_end.y
+ },
+ {
+ "tape.symbol.single_step.x",
+ &tape.symbol.single_step.x
+ },
+ {
+ "tape.symbol.single_step.y",
+ &tape.symbol.single_step.y
+ },
+ {
+ "tape.label.eject.x",
+ &tape.label.eject.x
+ },
+ {
+ "tape.label.eject.y",
+ &tape.label.eject.y
+ },
+ {
+ "tape.label.stop.x",
+ &tape.label.stop.x
+ },
+ {
+ "tape.label.stop.y",
+ &tape.label.stop.y
+ },
+ {
+ "tape.label.pause.x",
+ &tape.label.pause.x
+ },
+ {
+ "tape.label.pause.y",
+ &tape.label.pause.y
+ },
+ {
+ "tape.label.record.x",
+ &tape.label.record.x
+ },
+ {
+ "tape.label.record.y",
+ &tape.label.record.y
+ },
+ {
+ "tape.label.play.x",
+ &tape.label.play.x
+ },
+ {
+ "tape.label.play.y",
+ &tape.label.play.y
+ },
+ {
+ "tape.label.fast_forward.x",
+ &tape.label.fast_forward.x
+ },
+ {
+ "tape.label.fast_forward.y",
+ &tape.label.fast_forward.y
+ },
+ {
+ "tape.label.warp_forward.x",
+ &tape.label.warp_forward.x
+ },
+ {
+ "tape.label.warp_forward.y",
+ &tape.label.warp_forward.y
+ },
+ {
+ "tape.label.warp_forward_blind.x",
+ &tape.label.warp_forward_blind.x
+ },
+ {
+ "tape.label.warp_forward_blind.y",
+ &tape.label.warp_forward_blind.y
+ },
+ {
+ "tape.label.pause_before_end.x",
+ &tape.label.pause_before_end.x
+ },
+ {
+ "tape.label.pause_before_end.y",
+ &tape.label.pause_before_end.y
+ },
+ {
+ "tape.label.single_step.x",
+ &tape.label.single_step.x
+ },
+ {
+ "tape.label.single_step.y",
+ &tape.label.single_step.y
+ },
+ {
+ "tape.label.date.x",
+ &tape.label.date.x
+ },
+ {
+ "tape.label.date.y",
+ &tape.label.date.y
+ },
+ {
+ "tape.label.time.x",
+ &tape.label.time.x
+ },
+ {
+ "tape.label.time.y",
+ &tape.label.time.y
+ },
+ {
+ "tape.text.date.x",
+ &tape.text.date.x
+ },
+ {
+ "tape.text.date.y",
+ &tape.text.date.y
+ },
+ {
+ "tape.text.date.align",
+ &tape.text.date.align
+ },
+ {
+ "tape.text.date.valign",
+ &tape.text.date.valign
+ },
+ {
+ "tape.text.date.digits",
+ &tape.text.date.size
+ },
+ {
+ "tape.text.date.font",
+ &tape.text.date.font
+ },
+ {
+ "tape.text.time.x",
+ &tape.text.time.x
+ },
+ {
+ "tape.text.time.y",
+ &tape.text.time.y
+ },
+ {
+ "tape.text.time.align",
+ &tape.text.time.align
+ },
+ {
+ "tape.text.time.valign",
+ &tape.text.time.valign
+ },
+ {
+ "tape.text.time.digits",
+ &tape.text.time.size
+ },
+ {
+ "tape.text.time.font",
+ &tape.text.time.font
+ },
{
"game.forced_scroll_delay_value",
&game.forced_scroll_delay_value
"game.use_masked_pushing",
&game.use_masked_pushing
},
+ {
+ "game.tile_size",
+ &game.tile_size
+ },
{
"[player].boring_delay_fixed",
&game.player_boring_delay_fixed
-#define COMPILE_DATE_STRING "2010-06-08 22:20"
+#define COMPILE_DATE_STRING "2013-10-23 22:33"
#define RANDOM_USE_QUANTITY 1
/* maximal size of level editor drawing area */
+#if NEW_TILESIZE
+#define MAX_ED_FIELDX (SCR_FIELDX)
+#define MAX_ED_FIELDY (SCR_FIELDY - 1)
+#else
#define MAX_ED_FIELDX (2 * SCR_FIELDX)
#define MAX_ED_FIELDY (2 * SCR_FIELDY - 1)
+#endif
/*
GADGET_ID_CONTINUOUS_SNAPPING, GADGET_ID_NONE,
&level.continuous_snapping,
NULL,
- "continuos snapping", "use snapping without releasing key"
+ "continuous snapping", "use snapping without releasing key"
},
{
ED_ELEMENT_SETTINGS_XPOS(0), ED_ELEMENT_SETTINGS_YPOS(7),
int by2 = TILEY - by;
int i;
- getGraphicSource(border_graphic, 0, &src_bitmap, &src_x, &src_y);
+ getFixedGraphicSource(border_graphic, 0, &src_bitmap, &src_x, &src_y);
BlitBitmap(src_bitmap, drawto, src_x, src_y,
bx, by, dest_x - bx, dest_y - by);
{
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
struct GadgetInfo *gi;
- unsigned long event_mask;
+ unsigned int event_mask;
int i;
/* create toolbox buttons */
int gd_xoffset;
int gd_x, gd_x1, gd_x2, gd_y;
int x_size, y_size;
- unsigned long event_mask;
+ unsigned int event_mask;
char infotext[max_infotext_len + 1];
event_mask = GD_EVENT_PRESSED | GD_EVENT_REPEATED;
for (i = 0; i < ED_NUM_DRAWING_AREAS; i++)
{
struct GadgetInfo *gi;
- unsigned long event_mask;
+ unsigned int event_mask;
int id = drawingarea_info[i].gadget_id;
int x = SX + drawingarea_info[i].x;
int y = SY + drawingarea_info[i].y;
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
int gd_x, gd_y;
struct GadgetInfo *gi;
- unsigned long event_mask;
+ unsigned int event_mask;
char infotext[MAX_OUTPUT_LINESIZE + 1];
int id = textinput_info[i].gadget_id;
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
int gd_x, gd_y;
struct GadgetInfo *gi;
- unsigned long event_mask;
+ unsigned int event_mask;
char infotext[MAX_OUTPUT_LINESIZE + 1];
int id = textarea_info[i].gadget_id;
int area_xsize = textarea_info[i].xsize;
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
int gd_x, gd_y;
struct GadgetInfo *gi;
- unsigned long event_mask;
+ unsigned int event_mask;
char infotext[MAX_OUTPUT_LINESIZE + 1];
int id = selectbox_info[i].gadget_id;
int x = SX + selectbox_info[i].x;
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
int gd_x1, gd_x2, gd_y1, gd_y2;
struct GadgetInfo *gi;
- unsigned long event_mask;
+ unsigned int event_mask;
char infotext[MAX_OUTPUT_LINESIZE + 1];
int id = textbutton_info[i].gadget_id;
int x = SX + textbutton_info[i].x;
{
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
struct GadgetInfo *gi;
- unsigned long event_mask;
+ unsigned int event_mask;
int i;
/* create buttons for scrolling of drawing area and element list */
int gd_x1, gd_x2, gd_y1, gd_y2;
struct GadgetInfo *gi;
int items_max, items_visible, item_position;
- unsigned long event_mask;
+ unsigned int event_mask;
if (i == ED_SCROLLBAR_ID_LIST_VERTICAL)
{
{
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
struct GadgetInfo *gi;
- unsigned long event_mask;
+ unsigned int event_mask;
int gd_x1, gd_x2, gd_x3, gd_x4, gd_y;
int i;
{
Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
struct GadgetInfo *gi;
- unsigned long event_mask;
+ unsigned int event_mask;
int gd_x1, gd_x2, gd_x3, gd_x4, gd_y;
int i;
ANIM_MODE(graphic) == ANIM_CE_SCORE ?
custom_element.collect_score_initial : FrameCounter);
- DrawGraphicAnimationExt(drawto, x, y, graphic, frame, NO_MASKING);
+ DrawFixedGraphicAnimationExt(drawto, x, y, graphic, frame, NO_MASKING);
}
static void DrawEditorElementName(int x, int y, int element)
static int DrawLevelText(int sx, int sy, char letter, int mode)
{
static short delete_buffer[MAX_LEV_FIELDX];
- static int start_sx, start_sy;
+ static int start_sx;
+#if 0
+ static int start_sy;
+#endif
static int last_sx, last_sy;
static boolean typing = FALSE;
int letter_element = EL_CHAR_ASCII0 + letter;
DrawLevelText(0, 0, 0, TEXT_END);
typing = TRUE;
- start_sx = last_sx = sx;
- start_sy = last_sy = sy;
+ start_sx = sx;
+#if 0
+ start_sy = sy;
+#endif
+ last_sx = sx;
+ last_sy = sy;
DrawLevelText(sx, sy, 0, TEXT_SETCURSOR);
break;
gi->y + sy * MINI_TILEY,
el2edimg(new_element));
else
- DrawGraphicExt(drawto,
- gi->x + sx * TILEX,
- gi->y + sy * TILEY,
- el2img(new_element), 0);
+ DrawFixedGraphicExt(drawto,
+ gi->x + sx * TILEX,
+ gi->y + sy * TILEY,
+ el2img(new_element), 0);
if (id == GADGET_ID_CUSTOM_GRAPHIC)
new_element = GFX_ELEMENT(new_element);
void HandleLevelEditorIdle()
{
- static unsigned long action_delay = 0;
- unsigned long action_delay_value = GameFrameDelay;
+ static unsigned int action_delay = 0;
+ unsigned int action_delay_value = GameFrameDelay;
int xpos = 1, ypos = 2;
int i;
extern void PlayLevelSound_EM(int, int, int, int);
extern void InitGraphicInfo_EM(void);
-extern void CheckSingleStepMode_EM(byte action[], int, boolean);
+extern void CheckSingleStepMode_EM(byte action[], int, boolean, boolean);
void SetGfxAnimation_EM(struct GraphicInfo_EM *, int, int, int, int);
void getGraphicSourceObjectExt_EM(struct GraphicInfo_EM *, int, int, int, int);
extern void SetBitmaps_SP(Bitmap **);
#endif
-void CheckSingleStepMode_SP(boolean);
+void CheckSingleStepMode_SP(boolean, boolean);
void getGraphicSource_SP(struct GraphicInfo_SP *, int, int, int, int);
int getGraphicInfo_Delay(int);
static boolean cursor_inside_playfield = FALSE;
static boolean playfield_cursor_set = FALSE;
-static unsigned long playfield_cursor_delay = 0;
+static unsigned int playfield_cursor_delay = 0;
/* event filter especially needed for SDL event filtering due to
break;
case GAME_MODE_LEVELS:
- HandleChooseLevel(mx, my, 0, 0, button);
+ HandleChooseLevelSet(mx, my, 0, 0, button);
+ break;
+
+ case GAME_MODE_LEVELNR:
+ HandleChooseLevelNr(mx, my, 0, 0, button);
break;
case GAME_MODE_SCORES:
if (game_status == GAME_MODE_PLAYING)
{
/* only needed for single-step tape recording mode */
- static boolean clear_button_2[MAX_PLAYERS] = { FALSE,FALSE,FALSE,FALSE };
+ static boolean clear_snap_button[MAX_PLAYERS] = { FALSE,FALSE,FALSE,FALSE };
+ static boolean clear_drop_button[MAX_PLAYERS] = { FALSE,FALSE,FALSE,FALSE };
+ static boolean element_snapped[MAX_PLAYERS] = { FALSE,FALSE,FALSE,FALSE };
static boolean element_dropped[MAX_PLAYERS] = { FALSE,FALSE,FALSE,FALSE };
int pnr;
- ssi = setup.shortcut;
-
for (pnr = 0; pnr < MAX_PLAYERS; pnr++)
{
byte key_action = 0;
if (key == *key_info[i].key_custom)
key_action |= key_info[i].action;
- for (i = 0; i < NUM_DIRECTIONS; i++)
- if (key == *key_info[i].key_snap)
- key_action |= key_info[i].action | JOY_BUTTON_SNAP;
+ /* use combined snap+direction keys for the first player only */
+ if (pnr == 0)
+ {
+ ssi = setup.shortcut;
- if (tape.single_step && clear_button_2[pnr])
+ for (i = 0; i < NUM_DIRECTIONS; i++)
+ if (key == *key_info[i].key_snap)
+ key_action |= key_info[i].action | JOY_BUTTON_SNAP;
+ }
+
+ /* clear delayed snap and drop actions in single step mode (see below) */
+ if (tape.single_step)
{
- stored_player[pnr].action &= ~KEY_BUTTON_2;
- clear_button_2[pnr] = FALSE;
+ if (clear_snap_button[pnr])
+ {
+ stored_player[pnr].action &= ~KEY_BUTTON_SNAP;
+ clear_snap_button[pnr] = FALSE;
+ }
+
+ if (clear_drop_button[pnr])
+ {
+ stored_player[pnr].action &= ~KEY_BUTTON_DROP;
+ clear_drop_button[pnr] = FALSE;
+ }
}
if (key_status == KEY_PRESSED)
if (tape.single_step && tape.recording && tape.pausing)
{
- if (key_status == KEY_PRESSED &&
- (key_action & (KEY_MOTION | KEY_BUTTON_1)))
+ if (key_status == KEY_PRESSED && key_action & KEY_MOTION)
{
TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
- if (key_action & KEY_MOTION)
+ /* if snap key already pressed, don't snap when releasing (below) */
+ if (stored_player[pnr].action & KEY_BUTTON_SNAP)
+ element_snapped[pnr] = TRUE;
+
+ /* if drop key already pressed, don't drop when releasing (below) */
+ if (stored_player[pnr].action & KEY_BUTTON_DROP)
+ element_dropped[pnr] = TRUE;
+ }
+#if 1
+ else if (key_status == KEY_PRESSED && key_action & KEY_BUTTON_DROP)
+ {
+ if (level.game_engine_type == GAME_ENGINE_TYPE_EM ||
+ level.game_engine_type == GAME_ENGINE_TYPE_SP)
{
- if (stored_player[pnr].action & KEY_BUTTON_2)
- element_dropped[pnr] = TRUE;
+#if 0
+ printf("::: drop key pressed\n");
+#endif
+
+ if (level.game_engine_type == GAME_ENGINE_TYPE_SP &&
+ getRedDiskReleaseFlag_SP() == 0)
+ stored_player[pnr].action &= ~KEY_BUTTON_DROP;
+
+ TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
}
}
- else if (key_status == KEY_RELEASED &&
- (key_action & KEY_BUTTON_2))
+#endif
+ else if (key_status == KEY_RELEASED && key_action & KEY_BUTTON)
{
- if (!element_dropped[pnr])
+ if (key_action & KEY_BUTTON_SNAP)
{
- TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
+ /* if snap key was released without moving (see above), snap now */
+ if (!element_snapped[pnr])
+ {
+ TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
- stored_player[pnr].action |= KEY_BUTTON_2;
- clear_button_2[pnr] = TRUE;
+ stored_player[pnr].action |= KEY_BUTTON_SNAP;
+
+ /* clear delayed snap button on next event */
+ clear_snap_button[pnr] = TRUE;
+ }
+
+ element_snapped[pnr] = FALSE;
}
- element_dropped[pnr] = FALSE;
+#if 1
+ if (key_action & KEY_BUTTON_DROP &&
+ level.game_engine_type == GAME_ENGINE_TYPE_RND)
+ {
+ /* if drop key was released without moving (see above), drop now */
+ if (!element_dropped[pnr])
+ {
+ TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
+
+ if (level.game_engine_type != GAME_ENGINE_TYPE_SP ||
+ getRedDiskReleaseFlag_SP() != 0)
+ stored_player[pnr].action |= KEY_BUTTON_DROP;
+
+ /* clear delayed drop button on next event */
+ clear_drop_button[pnr] = TRUE;
+ }
+
+ element_dropped[pnr] = FALSE;
+ }
+#endif
}
}
-#if 1
else if (tape.recording && tape.pausing)
{
/* prevent key release events from un-pausing a paused game */
- if (key_status == KEY_PRESSED &&
- (key_action & KEY_ACTION))
+ if (key_status == KEY_PRESSED && key_action & KEY_ACTION)
TapeTogglePause(TAPE_TOGGLE_MANUAL);
}
-#else
- else if (tape.recording && tape.pausing && (key_action & KEY_ACTION))
- TapeTogglePause(TAPE_TOGGLE_MANUAL);
-#endif
}
}
else
case GAME_MODE_TITLE:
case GAME_MODE_MAIN:
case GAME_MODE_LEVELS:
+ case GAME_MODE_LEVELNR:
case GAME_MODE_SETUP:
case GAME_MODE_INFO:
case GAME_MODE_SCORES:
else if (game_status == GAME_MODE_MAIN)
HandleMainMenu(0, 0, 0, 0, MB_MENU_CHOICE);
else if (game_status == GAME_MODE_LEVELS)
- HandleChooseLevel(0, 0, 0, 0, MB_MENU_CHOICE);
+ HandleChooseLevelSet(0, 0, 0, 0, MB_MENU_CHOICE);
+ else if (game_status == GAME_MODE_LEVELNR)
+ HandleChooseLevelNr(0, 0, 0, 0, MB_MENU_CHOICE);
else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0, 0, 0, 0, MB_MENU_CHOICE);
else if (game_status == GAME_MODE_INFO)
if (game_status == GAME_MODE_TITLE)
HandleTitleScreen(0, 0, 0, 0, MB_MENU_LEAVE);
else if (game_status == GAME_MODE_LEVELS)
- HandleChooseLevel(0, 0, 0, 0, MB_MENU_LEAVE);
+ HandleChooseLevelSet(0, 0, 0, 0, MB_MENU_LEAVE);
+ else if (game_status == GAME_MODE_LEVELNR)
+ HandleChooseLevelNr(0, 0, 0, 0, MB_MENU_LEAVE);
else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0, 0, 0, 0, MB_MENU_LEAVE);
else if (game_status == GAME_MODE_INFO)
case KSYM_Page_Up:
if (game_status == GAME_MODE_LEVELS)
- HandleChooseLevel(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK);
+ HandleChooseLevelSet(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK);
+ else if (game_status == GAME_MODE_LEVELNR)
+ HandleChooseLevelNr(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK);
else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK);
else if (game_status == GAME_MODE_INFO)
case KSYM_Page_Down:
if (game_status == GAME_MODE_LEVELS)
- HandleChooseLevel(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK);
+ HandleChooseLevelSet(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK);
+ else if (game_status == GAME_MODE_LEVELNR)
+ HandleChooseLevelNr(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK);
else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK);
else if (game_status == GAME_MODE_INFO)
}
break;
- case KSYM_S:
+ case KSYM_s:
if (!global.fps_slowdown)
{
global.fps_slowdown = TRUE;
break;
case KSYM_f:
- ScrollStepSize = TILEX/8;
+ ScrollStepSize = TILEX / 8;
printf("ScrollStepSize == %d (1/8)\n", ScrollStepSize);
break;
case KSYM_g:
- ScrollStepSize = TILEX/4;
+ ScrollStepSize = TILEX / 4;
printf("ScrollStepSize == %d (1/4)\n", ScrollStepSize);
break;
case KSYM_h:
- ScrollStepSize = TILEX/2;
+ ScrollStepSize = TILEX / 2;
printf("ScrollStepSize == %d (1/2)\n", ScrollStepSize);
break;
case GAME_MODE_TITLE:
case GAME_MODE_MAIN:
case GAME_MODE_LEVELS:
+ case GAME_MODE_LEVELNR:
case GAME_MODE_SETUP:
case GAME_MODE_INFO:
{
- static unsigned long joystickmove_delay = 0;
+ static unsigned int joystickmove_delay = 0;
if (joystick && !button &&
!DelayReached(&joystickmove_delay, GADGET_FRAME_DELAY))
else if (game_status == GAME_MODE_MAIN)
HandleMainMenu(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
else if (game_status == GAME_MODE_LEVELS)
- HandleChooseLevel(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
+ HandleChooseLevelSet(0,0,dx,dy,newbutton?MB_MENU_CHOICE : MB_MENU_MARK);
+ else if (game_status == GAME_MODE_LEVELNR)
+ HandleChooseLevelNr(0,0,dx,dy,newbutton? MB_MENU_CHOICE : MB_MENU_MARK);
else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK);
else if (game_status == GAME_MODE_INFO)
change->post_change_function = NULL;
}
-static void setLevelInfoToDefaults(struct LevelInfo *level)
+#if 1
+
+static void setLevelInfoToDefaults_Level(struct LevelInfo *level)
+{
+ int i, x, y;
+
+ li = *level; /* copy level data into temporary buffer */
+ setConfigToDefaultsFromConfigList(chunk_config_INFO);
+ *level = li; /* copy temporary buffer back to level data */
+
+ setLevelInfoToDefaults_EM();
+ setLevelInfoToDefaults_SP();
+
+ level->native_em_level = &native_em_level;
+ level->native_sp_level = &native_sp_level;
+
+ level->file_version = FILE_VERSION_ACTUAL;
+ level->game_version = GAME_VERSION_ACTUAL;
+
+ level->creation_date = getCurrentDate();
+
+ level->encoding_16bit_field = TRUE;
+ level->encoding_16bit_yamyam = TRUE;
+ level->encoding_16bit_amoeba = TRUE;
+
+ for (x = 0; x < MAX_LEV_FIELDX; x++)
+ for (y = 0; y < MAX_LEV_FIELDY; y++)
+ level->field[x][y] = EL_SAND;
+
+ for (i = 0; i < MAX_LEVEL_NAME_LEN; i++)
+ level->name[i] = '\0';
+ for (i = 0; i < MAX_LEVEL_AUTHOR_LEN; i++)
+ level->author[i] = '\0';
+
+ strcpy(level->name, NAMELESS_LEVEL_NAME);
+ strcpy(level->author, ANONYMOUS_NAME);
+
+ level->field[0][0] = EL_PLAYER_1;
+ level->field[STD_LEV_FIELDX - 1][STD_LEV_FIELDY - 1] = EL_EXIT_CLOSED;
+
+ BorderElement = EL_STEELWALL;
+
+ /* set all bug compatibility flags to "false" => do not emulate this bug */
+ level->use_action_after_change_bug = FALSE;
+
+ if (leveldir_current)
+ {
+ /* try to determine better author name than 'anonymous' */
+ if (!strEqual(leveldir_current->author, ANONYMOUS_NAME))
+ {
+ strncpy(level->author, leveldir_current->author, MAX_LEVEL_AUTHOR_LEN);
+ level->author[MAX_LEVEL_AUTHOR_LEN] = '\0';
+ }
+ else
+ {
+ switch (LEVELCLASS(leveldir_current))
+ {
+ case LEVELCLASS_TUTORIAL:
+ strcpy(level->author, PROGRAM_AUTHOR_STRING);
+ break;
+
+ case LEVELCLASS_CONTRIB:
+ strncpy(level->author, leveldir_current->name, MAX_LEVEL_AUTHOR_LEN);
+ level->author[MAX_LEVEL_AUTHOR_LEN] = '\0';
+ break;
+
+ case LEVELCLASS_PRIVATE:
+ strncpy(level->author, getRealName(), MAX_LEVEL_AUTHOR_LEN);
+ level->author[MAX_LEVEL_AUTHOR_LEN] = '\0';
+ break;
+
+ default:
+ /* keep default value */
+ break;
+ }
+ }
+ }
+}
+
+static void setLevelInfoToDefaults_Elements(struct LevelInfo *level)
+{
+ static boolean clipboard_elements_initialized = FALSE;
+ int i;
+
+ InitElementPropertiesStatic();
+
+ li = *level; /* copy level data into temporary buffer */
+ setConfigToDefaultsFromConfigList(chunk_config_ELEM);
+ *level = li; /* copy temporary buffer back to level data */
+
+ for (i = 0; i < MAX_NUM_ELEMENTS; i++)
+ {
+ int element = i;
+ struct ElementInfo *ei = &element_info[element];
+
+ /* never initialize clipboard elements after the very first time */
+ /* (to be able to use clipboard elements between several levels) */
+ if (IS_CLIPBOARD_ELEMENT(element) && clipboard_elements_initialized)
+ continue;
+
+ if (IS_ENVELOPE(element))
+ {
+ int envelope_nr = element - EL_ENVELOPE_1;
+
+ setConfigToDefaultsFromConfigList(chunk_config_NOTE);
+
+ level->envelope[envelope_nr] = xx_envelope;
+ }
+
+ if (IS_CUSTOM_ELEMENT(element) ||
+ IS_GROUP_ELEMENT(element) ||
+ IS_INTERNAL_ELEMENT(element))
+ {
+ xx_ei = *ei; /* copy element data into temporary buffer */
+
+ setConfigToDefaultsFromConfigList(chunk_config_CUSX_base);
+
+ *ei = xx_ei;
+ }
+
+ setElementChangePages(ei, 1);
+ setElementChangeInfoToDefaults(ei->change);
+
+ if (IS_CUSTOM_ELEMENT(element) ||
+ IS_GROUP_ELEMENT(element) ||
+ IS_INTERNAL_ELEMENT(element))
+ {
+ setElementDescriptionToDefault(ei);
+
+ ei->modified_settings = FALSE;
+ }
+
+ if (IS_CUSTOM_ELEMENT(element) ||
+ IS_INTERNAL_ELEMENT(element))
+ {
+ /* internal values used in level editor */
+
+ ei->access_type = 0;
+ ei->access_layer = 0;
+ ei->access_protected = 0;
+ ei->walk_to_action = 0;
+ ei->smash_targets = 0;
+ ei->deadliness = 0;
+
+ ei->can_explode_by_fire = FALSE;
+ ei->can_explode_smashed = FALSE;
+ ei->can_explode_impact = FALSE;
+
+ ei->current_change_page = 0;
+ }
+
+ if (IS_GROUP_ELEMENT(element) ||
+ IS_INTERNAL_ELEMENT(element))
+ {
+ struct ElementGroupInfo *group;
+
+ /* initialize memory for list of elements in group */
+ if (ei->group == NULL)
+ ei->group = checked_malloc(sizeof(struct ElementGroupInfo));
+
+ group = ei->group;
+
+ xx_group = *group; /* copy group data into temporary buffer */
+
+ setConfigToDefaultsFromConfigList(chunk_config_GRPX);
+
+ *group = xx_group;
+ }
+ }
+
+ clipboard_elements_initialized = TRUE;
+}
+
+static void setLevelInfoToDefaults(struct LevelInfo *level,
+ boolean level_info_only)
+{
+ setLevelInfoToDefaults_Level(level);
+
+ if (!level_info_only)
+ setLevelInfoToDefaults_Elements(level);
+
+ level->no_valid_file = FALSE;
+
+ level->changed = FALSE;
+}
+
+#else
+
+static void setLevelInfoToDefaults(struct LevelInfo *level,
+ boolean level_info_only)
{
static boolean clipboard_elements_initialized = FALSE;
int i, x, y;
+ if (level_info_only)
+ return;
+
InitElementPropertiesStatic();
li = *level; /* copy level data into temporary buffer */
/* set all bug compatibility flags to "false" => do not emulate this bug */
level->use_action_after_change_bug = FALSE;
- if (leveldir_current == NULL) /* only when dumping level */
- return;
-
- /* try to determine better author name than 'anonymous' */
- if (!strEqual(leveldir_current->author, ANONYMOUS_NAME))
+ if (leveldir_current)
{
- strncpy(level->author, leveldir_current->author, MAX_LEVEL_AUTHOR_LEN);
- level->author[MAX_LEVEL_AUTHOR_LEN] = '\0';
- }
- else
- {
- switch (LEVELCLASS(leveldir_current))
+ /* try to determine better author name than 'anonymous' */
+ if (!strEqual(leveldir_current->author, ANONYMOUS_NAME))
{
- case LEVELCLASS_TUTORIAL:
- strcpy(level->author, PROGRAM_AUTHOR_STRING);
- break;
-
- case LEVELCLASS_CONTRIB:
- strncpy(level->author, leveldir_current->name, MAX_LEVEL_AUTHOR_LEN);
- level->author[MAX_LEVEL_AUTHOR_LEN] = '\0';
- break;
-
- case LEVELCLASS_PRIVATE:
- strncpy(level->author, getRealName(), MAX_LEVEL_AUTHOR_LEN);
- level->author[MAX_LEVEL_AUTHOR_LEN] = '\0';
- break;
-
- default:
- /* keep default value */
- break;
+ strncpy(level->author, leveldir_current->author, MAX_LEVEL_AUTHOR_LEN);
+ level->author[MAX_LEVEL_AUTHOR_LEN] = '\0';
+ }
+ else
+ {
+ switch (LEVELCLASS(leveldir_current))
+ {
+ case LEVELCLASS_TUTORIAL:
+ strcpy(level->author, PROGRAM_AUTHOR_STRING);
+ break;
+
+ case LEVELCLASS_CONTRIB:
+ strncpy(level->author, leveldir_current->name, MAX_LEVEL_AUTHOR_LEN);
+ level->author[MAX_LEVEL_AUTHOR_LEN] = '\0';
+ break;
+
+ case LEVELCLASS_PRIVATE:
+ strncpy(level->author, getRealName(), MAX_LEVEL_AUTHOR_LEN);
+ level->author[MAX_LEVEL_AUTHOR_LEN] = '\0';
+ break;
+
+ default:
+ /* keep default value */
+ break;
+ }
}
}
}
+#endif
+
static void setFileInfoToDefaults(struct LevelFileInfo *level_file_info)
{
level_file_info->nr = 0;
{
int i, x, y;
int element;
- int num_contents, content_xsize, content_ysize;
+ int num_contents;
+#if 0
+ int content_xsize, content_ysize;
+#endif
int content_array[MAX_ELEMENT_CONTENTS][3][3];
element = getMappedElement(getFile16BitBE(file));
num_contents = getFile8Bit(file);
+#if 1
+ getFile8Bit(file); /* content x size (unused) */
+ getFile8Bit(file); /* content y size (unused) */
+#else
content_xsize = getFile8Bit(file);
content_ysize = getFile8Bit(file);
+#endif
ReadUnusedBytesFromFile(file, LEVEL_CHUNK_CNT2_UNUSED);
}
static void LoadLevelFromFileInfo_RND(struct LevelInfo *level,
- struct LevelFileInfo *level_file_info)
+ struct LevelFileInfo *level_file_info,
+ boolean level_info_only)
{
char *filename = level_file_info->filename;
char cookie[MAX_LINE_LEN];
level->no_valid_file = TRUE;
#if 1
- Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
+ if (!level_info_only)
+ Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
#else
if (level != &level_template)
Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
else /* check for pre-2.0 file format with cookie string */
{
strcpy(cookie, chunk_name);
- fgets(&cookie[4], MAX_LINE_LEN - 4, file);
+ if (fgets(&cookie[4], MAX_LINE_LEN - 4, file) == NULL)
+ cookie[4] = '\0';
if (strlen(cookie) > 0 && cookie[strlen(cookie) - 1] == '\n')
cookie[strlen(cookie) - 1] = '\0';
}
static void LoadLevelFromFileInfo_SP(struct LevelInfo *level,
- struct LevelFileInfo *level_file_info)
+ struct LevelFileInfo *level_file_info,
+ boolean level_info_only)
{
char *filename = level_file_info->filename;
FILE *file;
{
level->no_valid_file = TRUE;
- Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
+ if (!level_info_only)
+ Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
return;
}
}
static void LoadLevelFromFileInfo_DC(struct LevelInfo *level,
- struct LevelFileInfo *level_file_info)
+ struct LevelFileInfo *level_file_info,
+ boolean level_info_only)
{
char *filename = level_file_info->filename;
FILE *file;
{
level->no_valid_file = TRUE;
- Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
+ if (!level_info_only)
+ Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
return;
}
if (level_file_info->packed)
{
/* read "magic bytes" from start of file */
- fgets(magic_bytes, num_magic_bytes + 1, file);
+ if (fgets(magic_bytes, num_magic_bytes + 1, file) == NULL)
+ magic_bytes[0] = '\0';
/* check "magic bytes" for correct file format */
if (!strPrefix(magic_bytes, "DC2"))
{
level->no_valid_file = TRUE;
- Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
+ if (!level_info_only)
+ Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
return;
}
}
static void LoadLevelFromFileInfo_SB(struct LevelInfo *level,
- struct LevelFileInfo *level_file_info)
+ struct LevelFileInfo *level_file_info,
+ boolean level_info_only)
{
char *filename = level_file_info->filename;
char line[MAX_LINE_LEN], line_raw[MAX_LINE_LEN], previous_line[MAX_LINE_LEN];
{
level->no_valid_file = TRUE;
- Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
+ if (!level_info_only)
+ Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
return;
}
/* ------------------------------------------------------------------------- */
static void LoadLevelFromFileInfo_EM(struct LevelInfo *level,
- struct LevelFileInfo *level_file_info)
+ struct LevelFileInfo *level_file_info,
+ boolean level_info_only)
{
- if (!LoadNativeLevel_EM(level_file_info->filename))
+ if (!LoadNativeLevel_EM(level_file_info->filename, level_info_only))
level->no_valid_file = TRUE;
}
static void LoadLevelFromFileInfo_SP(struct LevelInfo *level,
- struct LevelFileInfo *level_file_info)
+ struct LevelFileInfo *level_file_info,
+ boolean level_info_only)
{
int pos = 0;
if (level_file_info->packed)
pos = level_file_info->nr - leveldir_current->first_level;
- if (!LoadNativeLevel_SP(level_file_info->filename, pos))
+ if (!LoadNativeLevel_SP(level_file_info->filename, pos, level_info_only))
level->no_valid_file = TRUE;
}
/* functions for loading generic level */
/* ------------------------------------------------------------------------- */
-void LoadLevelFromFileInfo(struct LevelInfo *level,
- struct LevelFileInfo *level_file_info)
+static void LoadLevelFromFileInfo(struct LevelInfo *level,
+ struct LevelFileInfo *level_file_info,
+ boolean level_info_only)
{
/* always start with reliable default values */
- setLevelInfoToDefaults(level);
+ setLevelInfoToDefaults(level, level_info_only);
switch (level_file_info->type)
{
case LEVEL_FILE_TYPE_RND:
- LoadLevelFromFileInfo_RND(level, level_file_info);
+ LoadLevelFromFileInfo_RND(level, level_file_info, level_info_only);
break;
case LEVEL_FILE_TYPE_EM:
- LoadLevelFromFileInfo_EM(level, level_file_info);
+ LoadLevelFromFileInfo_EM(level, level_file_info, level_info_only);
level->game_engine_type = GAME_ENGINE_TYPE_EM;
break;
case LEVEL_FILE_TYPE_SP:
- LoadLevelFromFileInfo_SP(level, level_file_info);
+ LoadLevelFromFileInfo_SP(level, level_file_info, level_info_only);
level->game_engine_type = GAME_ENGINE_TYPE_SP;
break;
case LEVEL_FILE_TYPE_DC:
- LoadLevelFromFileInfo_DC(level, level_file_info);
+ LoadLevelFromFileInfo_DC(level, level_file_info, level_info_only);
break;
case LEVEL_FILE_TYPE_SB:
- LoadLevelFromFileInfo_SB(level, level_file_info);
+ LoadLevelFromFileInfo_SB(level, level_file_info, level_info_only);
break;
default:
- LoadLevelFromFileInfo_RND(level, level_file_info);
+ LoadLevelFromFileInfo_RND(level, level_file_info, level_info_only);
break;
}
/* if level file is invalid, restore level structure to default values */
if (level->no_valid_file)
- setLevelInfoToDefaults(level);
+ {
+ setLevelInfoToDefaults(level, level_info_only);
+
+ level->no_valid_file = TRUE; /* but keep "no valid file" flag */
+ }
if (level->game_engine_type == GAME_ENGINE_TYPE_UNKNOWN)
level->game_engine_type = GAME_ENGINE_TYPE_RND;
level_file_info.type = LEVEL_FILE_TYPE_RND; /* no others supported yet */
level_file_info.filename = filename;
- LoadLevelFromFileInfo(level, &level_file_info);
+ LoadLevelFromFileInfo(level, &level_file_info, FALSE);
}
static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename)
setLevelFileInfo(&level_template.file_info, nr);
filename = level_template.file_info.filename;
- LoadLevelFromFileInfo(&level_template, &level_template.file_info);
+ LoadLevelFromFileInfo(&level_template, &level_template.file_info, FALSE);
LoadLevel_InitVersion(&level_template, filename);
LoadLevel_InitElements(&level_template, filename);
setLevelFileInfo(&level.file_info, nr);
filename = level.file_info.filename;
- LoadLevelFromFileInfo(&level, &level.file_info);
+ LoadLevelFromFileInfo(&level, &level.file_info, FALSE);
if (level.use_custom_template)
LoadLevelTemplate(-1);
LoadLevel_InitNativeEngines(&level, filename);
}
+void LoadLevelInfoOnly(int nr)
+{
+#if 0
+ char *filename;
+#endif
+
+ setLevelFileInfo(&level.file_info, nr);
+#if 0
+ filename = level.file_info.filename;
+#endif
+
+ LoadLevelFromFileInfo(&level, &level.file_info, TRUE);
+}
+
static int SaveLevel_VERS(FILE *file, struct LevelInfo *level)
{
int chunk_size = 0;
else /* check for pre-2.0 file format with cookie string */
{
strcpy(cookie, chunk_name);
- fgets(&cookie[4], MAX_LINE_LEN - 4, file);
+ if (fgets(&cookie[4], MAX_LINE_LEN - 4, file) == NULL)
+ cookie[4] = '\0';
if (strlen(cookie) > 0 && cookie[strlen(cookie) - 1] == '\n')
cookie[strlen(cookie) - 1] = '\0';
return;
/* check file identifier */
- fgets(cookie, MAX_LINE_LEN, file);
+ if (fgets(cookie, MAX_LINE_LEN, file) == NULL)
+ cookie[0] = '\0';
if (strlen(cookie) > 0 && cookie[strlen(cookie) - 1] == '\n')
cookie[strlen(cookie) - 1] = '\0';
for (i = 0; i < MAX_SCORE_ENTRIES; i++)
{
- fscanf(file, "%d", &highscore[i].Score);
- fgets(line, MAX_LINE_LEN, file);
+ if (fscanf(file, "%d", &highscore[i].Score) == EOF)
+ Error(ERR_WARN, "fscanf() failed; %s", strerror(errno));
+ if (fgets(line, MAX_LINE_LEN, file) == NULL)
+ line[0] = '\0';
- if (line[strlen(line) - 1] == '\n')
+ if (strlen(line) > 0 && line[strlen(line) - 1] == '\n')
line[strlen(line) - 1] = '\0';
for (line_ptr = line; *line_ptr; line_ptr++)
#define SETUP_TOKEN_PREFER_AGA_GRAPHICS 23
#define SETUP_TOKEN_GAME_FRAME_DELAY 24
#define SETUP_TOKEN_SP_SHOW_BORDER_ELEMENTS 25
-#define SETUP_TOKEN_GRAPHICS_SET 26
-#define SETUP_TOKEN_SOUNDS_SET 27
-#define SETUP_TOKEN_MUSIC_SET 28
-#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 29
-#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 30
-#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 31
+#define SETUP_TOKEN_SMALL_GAME_GRAPHICS 26
+#define SETUP_TOKEN_GRAPHICS_SET 27
+#define SETUP_TOKEN_SOUNDS_SET 28
+#define SETUP_TOKEN_MUSIC_SET 29
+#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 30
+#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 31
+#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 32
-#define NUM_GLOBAL_SETUP_TOKENS 32
+#define NUM_GLOBAL_SETUP_TOKENS 33
/* editor setup */
#define SETUP_TOKEN_EDITOR_EL_BOULDERDASH 0
#define SETUP_TOKEN_SHORTCUT_FOCUS_PLAYER_4 6
#define SETUP_TOKEN_SHORTCUT_FOCUS_PLAYER_ALL 7
#define SETUP_TOKEN_SHORTCUT_TAPE_EJECT 8
-#define SETUP_TOKEN_SHORTCUT_TAPE_STOP 9
-#define SETUP_TOKEN_SHORTCUT_TAPE_PAUSE 10
-#define SETUP_TOKEN_SHORTCUT_TAPE_RECORD 11
-#define SETUP_TOKEN_SHORTCUT_TAPE_PLAY 12
-#define SETUP_TOKEN_SHORTCUT_SOUND_SIMPLE 13
-#define SETUP_TOKEN_SHORTCUT_SOUND_LOOPS 14
-#define SETUP_TOKEN_SHORTCUT_SOUND_MUSIC 15
-#define SETUP_TOKEN_SHORTCUT_SNAP_LEFT 16
-#define SETUP_TOKEN_SHORTCUT_SNAP_RIGHT 17
-#define SETUP_TOKEN_SHORTCUT_SNAP_UP 18
-#define SETUP_TOKEN_SHORTCUT_SNAP_DOWN 19
-
-#define NUM_SHORTCUT_SETUP_TOKENS 20
+#define SETUP_TOKEN_SHORTCUT_TAPE_EXTRA 9
+#define SETUP_TOKEN_SHORTCUT_TAPE_STOP 10
+#define SETUP_TOKEN_SHORTCUT_TAPE_PAUSE 11
+#define SETUP_TOKEN_SHORTCUT_TAPE_RECORD 12
+#define SETUP_TOKEN_SHORTCUT_TAPE_PLAY 13
+#define SETUP_TOKEN_SHORTCUT_SOUND_SIMPLE 14
+#define SETUP_TOKEN_SHORTCUT_SOUND_LOOPS 15
+#define SETUP_TOKEN_SHORTCUT_SOUND_MUSIC 16
+#define SETUP_TOKEN_SHORTCUT_SNAP_LEFT 17
+#define SETUP_TOKEN_SHORTCUT_SNAP_RIGHT 18
+#define SETUP_TOKEN_SHORTCUT_SNAP_UP 19
+#define SETUP_TOKEN_SHORTCUT_SNAP_DOWN 20
+
+#define NUM_SHORTCUT_SETUP_TOKENS 21
/* player setup */
#define SETUP_TOKEN_PLAYER_USE_JOYSTICK 0
{ TYPE_SWITCH, &si.prefer_aga_graphics, "prefer_aga_graphics" },
{ TYPE_INTEGER,&si.game_frame_delay, "game_frame_delay" },
{ TYPE_SWITCH, &si.sp_show_border_elements, "sp_show_border_elements" },
+ { TYPE_SWITCH, &si.small_game_graphics, "small_game_graphics" },
{ TYPE_STRING, &si.graphics_set, "graphics_set" },
{ TYPE_STRING, &si.sounds_set, "sounds_set" },
{ TYPE_STRING, &si.music_set, "music_set" },
{ TYPE_KEY_X11, &ssi.focus_player[3], "shortcut.focus_player_4" },
{ TYPE_KEY_X11, &ssi.focus_player_all,"shortcut.focus_player_all" },
{ TYPE_KEY_X11, &ssi.tape_eject, "shortcut.tape_eject" },
+ { TYPE_KEY_X11, &ssi.tape_extra, "shortcut.tape_extra" },
{ TYPE_KEY_X11, &ssi.tape_stop, "shortcut.tape_stop" },
{ TYPE_KEY_X11, &ssi.tape_pause, "shortcut.tape_pause" },
{ TYPE_KEY_X11, &ssi.tape_record, "shortcut.tape_record" },
si->prefer_aga_graphics = TRUE;
si->game_frame_delay = GAME_FRAME_DELAY;
si->sp_show_border_elements = FALSE;
+ si->small_game_graphics = FALSE;
si->graphics_set = getStringCopy(GFX_DEFAULT_SUBDIR);
si->sounds_set = getStringCopy(SND_DEFAULT_SUBDIR);
si->shortcut.focus_player_all = DEFAULT_KEY_FOCUS_PLAYER_ALL;
si->shortcut.tape_eject = DEFAULT_KEY_TAPE_EJECT;
+ si->shortcut.tape_extra = DEFAULT_KEY_TAPE_EXTRA;
si->shortcut.tape_stop = DEFAULT_KEY_TAPE_STOP;
si->shortcut.tape_pause = DEFAULT_KEY_TAPE_PAUSE;
si->shortcut.tape_record = DEFAULT_KEY_TAPE_RECORD;
filename1 = getPath2(global.create_images_dir, basename1);
filename2 = getPath2(global.create_images_dir, basename2);
- getGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y);
- BlitBitmap(src_bitmap, bitmap1, src_x, src_y, TILEX, TILEY, 0, 0);
+ getFixedGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y);
+ BlitBitmap(src_bitmap, bitmap1, src_x, src_y, TILEX, TILEY,
+ 0, 0);
if (SDL_SaveBMP(bitmap1->surface, filename1) != 0)
Error(ERR_EXIT, "cannot save level sketch image file '%s'", filename1);
TILEY * (NUM_CUSTOM_ELEMENTS + NUM_GROUP_ELEMENTS) / 16,
DEFAULT_DEPTH);
- getGraphicSource(dummy_graphic, 0, &src_bitmap, &src_x, &src_y);
+ getFixedGraphicSource(dummy_graphic, 0, &src_bitmap, &src_x, &src_y);
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
{
BlitBitmap(src_bitmap, bitmap, 0, 0, TILEX, TILEY,
TILEX * x, TILEY * y + yoffset_ce);
- BlitBitmap(src_bitmap, bitmap, 0, TILEY, TILEX, TILEY,
- TILEX * x + TILEX * 16, TILEY * y + yoffset_ce);
+ BlitBitmap(src_bitmap, bitmap, 0, TILEY,
+ TILEX, TILEY,
+ TILEX * x + TILEX * 16,
+ TILEY * y + yoffset_ce);
for (j = 2; j >= 0; j--)
{
int c = ii % 10;
- BlitBitmap(src_bitmap, bitmap, TILEX + c * 7, 0, 6, 10,
+ BlitBitmap(src_bitmap, bitmap,
+ TILEX + c * 7, 0, 6, 10,
TILEX * x + 6 + j * 7,
TILEY * y + 11 + yoffset_ce);
- BlitBitmap(src_bitmap, bitmap, TILEX + c * 8, TILEY, 6, 10,
+ BlitBitmap(src_bitmap, bitmap,
+ TILEX + c * 8, TILEY, 6, 10,
TILEX * 16 + TILEX * x + 6 + j * 8,
TILEY * y + 10 + yoffset_ce);
BlitBitmap(src_bitmap, bitmap, 0, 0, TILEX, TILEY,
TILEX * x, TILEY * y + yoffset_ge);
- BlitBitmap(src_bitmap, bitmap, 0, TILEY, TILEX, TILEY,
- TILEX * x + TILEX * 16, TILEY * y + yoffset_ge);
+ BlitBitmap(src_bitmap, bitmap, 0, TILEY,
+ TILEX, TILEY,
+ TILEX * x + TILEX * 16,
+ TILEY * y + yoffset_ge);
for (j = 1; j >= 0; j--)
{
TILEX * x + 6 + j * 10,
TILEY * y + 11 + yoffset_ge);
- BlitBitmap(src_bitmap, bitmap, TILEX + c * 8, TILEY + 12, 6, 10,
+ BlitBitmap(src_bitmap, bitmap,
+ TILEX + c * 8, TILEY + 12, 6, 10,
TILEX * 16 + TILEX * x + 10 + j * 8,
TILEY * y + 10 + yoffset_ge);
void LoadLevelFromFilename(struct LevelInfo *, char *);
void LoadLevel(int);
void LoadLevelTemplate(int);
+void LoadLevelInfoOnly(int);
void SaveLevel(int);
void SaveLevelTemplate();
void SaveNativeLevel(struct LevelInfo *);
#define PANEL_XPOS(p) (DX + ALIGNED_TEXT_XPOS(p))
#define PANEL_YPOS(p) (DY + ALIGNED_TEXT_YPOS(p))
-/* special positions in the game control window (relative to control window) */
-#define XX_LEVEL1 (PANEL_XPOS(game.panel.level))
-#define XX_LEVEL2 (PANEL_XPOS(game.panel.level) - 1)
-#define XX_LEVEL (PANEL_XPOS(game.panel.level))
-#define YY_LEVEL (PANEL_YPOS(game.panel.level))
-#define XX_EMERALDS (PANEL_XPOS(game.panel.gems))
-#define YY_EMERALDS (PANEL_YPOS(game.panel.gems))
-#define XX_DYNAMITE (PANEL_XPOS(game.panel.inventory))
-#define YY_DYNAMITE (PANEL_YPOS(game.panel.inventory))
-#define XX_KEYS (PANEL_XPOS(game.panel.keys))
-#define YY_KEYS (PANEL_YPOS(game.panel.keys))
-#define XX_SCORE (PANEL_XPOS(game.panel.score))
-#define YY_SCORE (PANEL_YPOS(game.panel.score))
-#define XX_TIME1 (PANEL_XPOS(game.panel.time))
-#define XX_TIME2 (PANEL_XPOS(game.panel.time) + 1)
-#define XX_TIME (PANEL_XPOS(game.panel.time))
-#define YY_TIME (PANEL_YPOS(game.panel.time))
-
-/* special positions in the game control window (relative to main window) */
-#define DX_LEVEL1 (DX + XX_LEVEL1)
-#define DX_LEVEL2 (DX + XX_LEVEL2)
-#define DX_LEVEL (DX + XX_LEVEL)
-#define DY_LEVEL (DY + YY_LEVEL)
-#define DX_EMERALDS (DX + XX_EMERALDS)
-#define DY_EMERALDS (DY + YY_EMERALDS)
-#define DX_DYNAMITE (DX + XX_DYNAMITE)
-#define DY_DYNAMITE (DY + YY_DYNAMITE)
-#define DX_KEYS (DX + XX_KEYS)
-#define DY_KEYS (DY + YY_KEYS)
-#define DX_SCORE (DX + XX_SCORE)
-#define DY_SCORE (DY + YY_SCORE)
-#define DX_TIME1 (DX + XX_TIME1)
-#define DX_TIME2 (DX + XX_TIME2)
-#define DX_TIME (DX + XX_TIME)
-#define DY_TIME (DY + YY_TIME)
-
-#if 1
/* game panel display and control definitions */
-
#define GAME_PANEL_LEVEL_NUMBER 0
#define GAME_PANEL_GEMS 1
#define GAME_PANEL_INVENTORY_COUNT 2
-1,
}
};
-#endif
-
/* values for delayed check of falling and moving elements and for collision */
#define CHECK_DELAY_MOVING 3
*/
}
-#if 1
-
static int get_key_element_from_nr(int key_nr)
{
int key_base_element = (key_nr >= STD_NUM_KEYS ? EL_EMC_KEY_5 - STD_NUM_KEYS :
level.native_em_level->lev->time :
level.game_engine_type == GAME_ENGINE_TYPE_SP ?
level.native_sp_level->game_sp->time_played :
- level.time == 0 ? TimePlayed : TimeLeft);
+ game.no_time_limit ? TimePlayed : TimeLeft);
int score = (local_player->LevelSolved ?
local_player->LevelSolved_CountingScore :
level.game_engine_type == GAME_ENGINE_TYPE_EM ?
return;
/* copy default game door content to main double buffer */
+#if 1
+ /* !!! CHECK AGAIN !!! */
+ SetPanelBackground();
+ // SetDoorBackgroundImage(IMG_BACKGROUND_PANEL);
+ DrawBackground(DX, DY, DXSIZE, DYSIZE);
+#else
BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
+#endif
/* redraw game control buttons */
#if 1
void DrawGameValue_Emeralds(int value)
{
struct TextPosInfo *pos = &game.panel.gems;
-#if 1
int font_nr = pos->font;
-#else
- int font_nr = FONT_TEXT_2;
-#endif
int font_width = getFontWidth(font_nr);
int chars = pos->size;
void DrawGameValue_Dynamite(int value)
{
struct TextPosInfo *pos = &game.panel.inventory_count;
-#if 1
int font_nr = pos->font;
-#else
- int font_nr = FONT_TEXT_2;
-#endif
int font_width = getFontWidth(font_nr);
int chars = pos->size;
void DrawGameValue_Score(int value)
{
struct TextPosInfo *pos = &game.panel.score;
-#if 1
int font_nr = pos->font;
-#else
- int font_nr = FONT_TEXT_2;
-#endif
int font_width = getFontWidth(font_nr);
int chars = pos->size;
int chars1 = 3;
int chars2 = 4;
int chars = pos->size;
-#if 1
int font1_nr = pos->font;
int font2_nr = pos->font_alt;
-#else
- int font1_nr = FONT_TEXT_2;
- int font2_nr = FONT_TEXT_1;
-#endif
int font_nr = font1_nr;
boolean use_dynamic_chars = (chars == -1 ? TRUE : FALSE);
int chars1 = 2;
int chars2 = 3;
int chars = pos->size;
-#if 1
int font1_nr = pos->font;
int font2_nr = pos->font_alt;
-#else
- int font1_nr = FONT_TEXT_2;
- int font2_nr = FONT_TEXT_1;
-#endif
int font_nr = font1_nr;
boolean use_dynamic_chars = (chars == -1 ? TRUE : FALSE);
void DrawGameValue_Keys(int key[MAX_NUM_KEYS])
{
-#if 0
- struct TextPosInfo *pos = &game.panel.keys;
-#endif
-#if 0
- int base_key_graphic = EL_KEY_1;
-#endif
int i;
#if 1
return; /* !!! USE NEW STUFF !!! */
#endif
-#if 0
- if (PANEL_DEACTIVATED(pos))
- return;
-#endif
-
-#if 0
- if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
- base_key_graphic = EL_EM_KEY_1;
-#endif
-
-#if 0
- pos->width = 4 * MINI_TILEX;
-#endif
-
-#if 1
for (i = 0; i < MAX_NUM_KEYS; i++)
-#else
- /* currently only 4 of 8 possible keys are displayed */
- for (i = 0; i < STD_NUM_KEYS; i++)
-#endif
{
-#if 1
struct TextPosInfo *pos = &game.panel.key[i];
-#endif
int src_x = DOOR_GFX_PAGEX5 + 18 + (i % 4) * MINI_TILEX;
int src_y = DOOR_GFX_PAGEY1 + 123;
-#if 1
int dst_x = PANEL_XPOS(pos);
int dst_y = PANEL_YPOS(pos);
-#else
- int dst_x = PANEL_XPOS(pos) + i * MINI_TILEX;
- int dst_y = PANEL_YPOS(pos);
-#endif
-#if 1
int element = (i >= STD_NUM_KEYS ? EL_EMC_KEY_5 - 4 :
level.game_engine_type == GAME_ENGINE_TYPE_EM ? EL_EM_KEY_1 :
EL_KEY_1) + i;
int graphic = el2edimg(element);
-#endif
-#if 1
if (PANEL_DEACTIVATED(pos))
continue;
-#endif
#if 0
/* masked blit with tiles from half-size scaled bitmap does not work yet
if (key[i])
{
-#if 0
- int graphic = el2edimg(base_key_graphic + i);
-#endif
Bitmap *src_bitmap;
int src_x, src_y;
dst_x, dst_y);
}
#else
-#if 1
if (key[i])
DrawMiniGraphicExt(drawto, dst_x, dst_y, graphic);
else
BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto, src_x, src_y,
MINI_TILEX, MINI_TILEY, dst_x, dst_y);
-#else
- if (key[i])
- DrawMiniGraphicExt(drawto, dst_x, dst_y, el2edimg(base_key_graphic + i));
- else
- BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto, src_x, src_y,
- MINI_TILEX, MINI_TILEY, dst_x, dst_y);
-#endif
-#endif
- }
-}
-
-#else
-
-void DrawGameValue_Emeralds(int value)
-{
- int font_nr = FONT_TEXT_2;
- int xpos = (3 * 14 - 3 * getFontWidth(font_nr)) / 2;
-
- if (PANEL_DEACTIVATED(game.panel.gems))
- return;
-
- DrawText(DX_EMERALDS + xpos, DY_EMERALDS, int2str(value, 3), font_nr);
-}
-
-void DrawGameValue_Dynamite(int value)
-{
- int font_nr = FONT_TEXT_2;
- int xpos = (3 * 14 - 3 * getFontWidth(font_nr)) / 2;
-
- if (PANEL_DEACTIVATED(game.panel.inventory_count))
- return;
-
- DrawText(DX_DYNAMITE + xpos, DY_DYNAMITE, int2str(value, 3), font_nr);
-}
-
-void DrawGameValue_Score(int value)
-{
- int font_nr = FONT_TEXT_2;
- int xpos = (5 * 14 - 5 * getFontWidth(font_nr)) / 2;
-
- if (PANEL_DEACTIVATED(game.panel.score))
- return;
-
- DrawText(DX_SCORE + xpos, DY_SCORE, int2str(value, 5), font_nr);
-}
-
-void DrawGameValue_Time(int value)
-{
- int font1_nr = FONT_TEXT_2;
-#if 1
- int font2_nr = FONT_TEXT_1;
-#else
- int font2_nr = FONT_LEVEL_NUMBER;
#endif
- int xpos3 = (3 * 14 - 3 * getFontWidth(font1_nr)) / 2;
- int xpos4 = (4 * 10 - 4 * getFontWidth(font2_nr)) / 2;
-
- if (PANEL_DEACTIVATED(game.panel.time))
- return;
-
- /* clear background if value just changed its size */
- if (value == 999 || value == 1000)
- ClearRectangleOnBackground(drawto, DX_TIME1, DY_TIME, 14 * 3, 14);
-
- if (value < 1000)
- DrawText(DX_TIME1 + xpos3, DY_TIME, int2str(value, 3), font1_nr);
- else
- DrawText(DX_TIME2 + xpos4, DY_TIME, int2str(value, 4), font2_nr);
-}
-
-void DrawGameValue_Level(int value)
-{
- int font1_nr = FONT_TEXT_2;
-#if 1
- int font2_nr = FONT_TEXT_1;
-#else
- int font2_nr = FONT_LEVEL_NUMBER;
-#endif
-
- if (PANEL_DEACTIVATED(game.panel.level))
- return;
-
- if (level_nr < 100)
- DrawText(DX_LEVEL1, DY_LEVEL, int2str(value, 2), font1_nr);
- else
- DrawText(DX_LEVEL2, DY_LEVEL, int2str(value, 3), font2_nr);
-}
-
-void DrawGameValue_Keys(int key[MAX_NUM_KEYS])
-{
- int base_key_graphic = EL_KEY_1;
- int i;
-
- if (PANEL_DEACTIVATED(game.panel.keys))
- return;
-
- if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
- base_key_graphic = EL_EM_KEY_1;
-
- /* currently only 4 of 8 possible keys are displayed */
- for (i = 0; i < STD_NUM_KEYS; i++)
- {
- int x = XX_KEYS + i * MINI_TILEX;
- int y = YY_KEYS;
-
- if (key[i])
- DrawMiniGraphicExt(drawto, DX + x,DY + y, el2edimg(base_key_graphic + i));
- else
- BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
- DOOR_GFX_PAGEX5 + x, y, MINI_TILEX, MINI_TILEY, DX + x,DY + y);
}
}
-#endif
-
void DrawAllGameValues(int emeralds, int dynamite, int score, int time,
int key_bits)
{
void DrawGameDoorValues_OLD()
{
- int time_value = (level.time == 0 ? TimePlayed : TimeLeft);
+ int time_value = (game.no_time_limit ? TimePlayed : TimeLeft);
int dynamite_value = 0;
int score_value = (local_player->LevelSolved ? local_player->score_final :
local_player->score);
AllPlayersGone = FALSE;
+ game.no_time_limit = (level.time == 0);
+
game.yamyam_content_nr = 0;
game.robot_wheel_active = FALSE;
game.magic_wall_active = FALSE;
SBY_Lower = lev_fieldy - SCR_FIELDY + 1;
}
+#if NEW_TILESIZE
+
+ if (lev_fieldx + (SBX_Left < 0 ? 2 : 0) <= SCR_FIELDX)
+ SBX_Left = SBX_Right = -1 * (SCR_FIELDX - lev_fieldx) / 2;
+
+ if (lev_fieldy + (SBY_Upper < 0 ? 2 : 0) <= SCR_FIELDY)
+ SBY_Upper = SBY_Lower = -1 * (SCR_FIELDY - lev_fieldy) / 2;
+
+ if (EVEN(SCR_FIELDX))
+ SBX_Left--;
+ if (EVEN(SCR_FIELDY))
+ SBY_Upper--;
+
+#else
+
if (lev_fieldx + (SBX_Left == -1 ? 2 : 0) <= SCR_FIELDX)
SBX_Left = SBX_Right = -1 * (SCR_FIELDX - lev_fieldx) / 2;
if (lev_fieldy + (SBY_Upper == -1 ? 2 : 0) <= SCR_FIELDY)
SBY_Upper = SBY_Lower = -1 * (SCR_FIELDY - lev_fieldy) / 2;
+#endif
/* if local player not found, look for custom element that might create
the player (make some assumptions about the right custom element) */
local_player->jy - MIDPOSY);
}
+#if 0
+ printf("::: %d, %d (initial)\n", scroll_x, scroll_y);
+#endif
+
#if 0
/* do not use PLAYING mask for fading out from main screen */
game_status = GAME_MODE_MAIN;
if (game.timegate_time_left == 0)
CloseAllOpenTimegates();
+#if NEW_TILESIZE
+ BlitScreenToBitmap(backbuffer);
+#else
/* blit playfield from scroll buffer to normal back buffer for fading in */
if (setup.soft_scrolling)
BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
+#endif
redraw_mask |= REDRAW_FROM_BACKBUFFER;
}
if (!game.restart_level)
{
/* copy default game door content to main double buffer */
+#if 1
+#if 1
+ /* !!! CHECK AGAIN !!! */
+ SetPanelBackground();
+ // SetDoorBackgroundImage(IMG_BACKGROUND_PANEL);
+ DrawBackground(DX, DY, DXSIZE, DYSIZE);
+#else
+ struct GraphicInfo *gfx = &graphic_info[IMG_BACKGROUND_PANEL];
+
+ /* (ClearRectangle() only needed if panel bitmap is smaller than panel) */
+ ClearRectangle(drawto, DX, DY, DXSIZE, DYSIZE);
+ BlitBitmap(gfx->bitmap, drawto, gfx->src_x, gfx->src_y,
+ MIN(gfx->width, DXSIZE), MIN(gfx->height, DYSIZE), DX, DY);
+#endif
+#else
BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto,
DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY);
+#endif
}
SetPanelBackground();
MapTapeButtons();
#endif
+ if (!game.restart_level && !tape.playing)
+ {
+ LevelStats_incPlayed(level_nr);
+
+ SaveLevelSetup_SeriesInfo();
+
+#if 0
+ printf("::: PLAYING LEVEL (%d)\n", LevelStats_getPlayed(level_nr));
+#endif
+ }
+
game.restart_level = FALSE;
}
player->score_final = (level.game_engine_type == GAME_ENGINE_TYPE_EM ?
level.native_em_level->lev->score : player->score);
- player->LevelSolved_CountingTime = (level.time == 0 ? TimePlayed : TimeLeft);
+ player->LevelSolved_CountingTime = (game.no_time_limit ? TimePlayed :
+ TimeLeft);
player->LevelSolved_CountingScore = player->score_final;
}
local_player->LevelSolved_SaveTape = tape.recording;
local_player->LevelSolved_SaveScore = !tape.playing;
+ if (!tape.playing)
+ {
+ LevelStats_incSolved(level_nr);
+
+ SaveLevelSetup_SeriesInfo();
+
+#if 0
+ printf("::: LEVEL SOLVED (%d)\n", LevelStats_getSolved(level_nr));
+#endif
+ }
+
if (tape.auto_play) /* tape might already be stopped here */
tape.auto_play_level_solved = TRUE;
game_over_delay_1 = game_over_delay_value_1;
game_over_delay_2 = game_over_delay_value_2;
- time = time_final = (level.time == 0 ? TimePlayed : TimeLeft);
+ time = time_final = (game.no_time_limit ? TimePlayed : TimeLeft);
score = score_final = local_player->score_final;
if (TimeLeft > 0)
time_final = 0;
score_final += TimeLeft * level.score[SC_TIME_BONUS];
}
- else if (level.time == 0 && TimePlayed < 999)
+ else if (game.no_time_limit && TimePlayed < 999)
{
time_final = 999;
score_final += (999 - TimePlayed) * level.score[SC_TIME_BONUS];
if (level_nr == leveldir_current->handicap_level)
{
leveldir_current->handicap_level++;
+
SaveLevelSetup_SeriesInfo();
}
else if (Feld[x][y + 1] == EL_MAGIC_WALL_ACTIVE)
{
if (!MovDelay[x][y])
- MovDelay[x][y] = TILEY/4 + 1;
+ MovDelay[x][y] = TILEY / 4 + 1;
if (MovDelay[x][y])
{
else if (Feld[x][y + 1] == EL_BD_MAGIC_WALL_ACTIVE)
{
if (!MovDelay[x][y])
- MovDelay[x][y] = TILEY/4 + 1;
+ MovDelay[x][y] = TILEY / 4 + 1;
if (MovDelay[x][y])
{
else if (Feld[x][y + 1] == EL_DC_MAGIC_WALL_ACTIVE)
{
if (!MovDelay[x][y])
- MovDelay[x][y] = TILEY/4 + 1;
+ MovDelay[x][y] = TILEY / 4 + 1;
if (MovDelay[x][y])
{
void AmoebeWaechst(int x, int y)
{
- static unsigned long sound_delay = 0;
- static unsigned long sound_delay_value = 0;
+ static unsigned int sound_delay = 0;
+ static unsigned int sound_delay_value = 0;
if (!MovDelay[x][y]) /* start new growing cycle */
{
void AmoebaDisappearing(int x, int y)
{
- static unsigned long sound_delay = 0;
- static unsigned long sound_delay_value = 0;
+ static unsigned int sound_delay = 0;
+ static unsigned int sound_delay_value = 0;
if (!MovDelay[x][y]) /* start new shrinking cycle */
{
}
}
+static void CheckSingleStepMode(struct PlayerInfo *player)
+{
+ if (tape.single_step && tape.recording && !tape.pausing)
+ {
+ /* as it is called "single step mode", just return to pause mode when the
+ player stopped moving after one tile (or never starts moving at all) */
+ if (!player->is_moving && !player->is_pushing)
+ {
+ TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
+ SnapField(player, 0, 0); /* stop snapping */
+ }
+ }
+}
+
static byte PlayerActions(struct PlayerInfo *player, byte player_action)
{
- boolean moved = FALSE, snapped = FALSE, dropped = FALSE;
int left = player_action & JOY_LEFT;
int right = player_action & JOY_RIGHT;
int up = player_action & JOY_UP;
if (player_action)
{
if (button1)
- snapped = SnapField(player, dx, dy);
+ SnapField(player, dx, dy);
else
{
if (button2)
- dropped = DropElement(player);
+ DropElement(player);
- moved = MovePlayer(player, dx, dy);
+ MovePlayer(player, dx, dy);
}
- if (tape.single_step && tape.recording && !tape.pausing)
- {
-#if 1
- /* as it is called "single step mode", just return to pause mode when the
- player stopped moving after one tile (or never starts moving at all) */
- if (!player->is_moving)
-#else
- /* this is buggy: there are quite some cases where the single step mode
- does not return to pause mode (like pushing things that don't move
- or simply by trying to run against a wall) */
- if (button1 || (dropped && !moved))
-#endif
- {
- TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
- SnapField(player, 0, 0); /* stop snapping */
- }
- }
+ CheckSingleStepMode(player);
SetPlayerWaiting(player, FALSE);
player->is_dropping_pressed = FALSE;
player->drop_pressed_delay = 0;
+ CheckSingleStepMode(player);
+
return 0;
}
}
PlaySound(SND_GAME_RUNNING_OUT_OF_TIME);
#if 1
+ /* this does not make sense: game_panel_controls[GAME_PANEL_TIME].value
+ is reset from other values in UpdateGameDoorValues() -- FIX THIS */
+
game_panel_controls[GAME_PANEL_TIME].value = TimeLeft;
- DisplayGameControlValues();
+ /* (already called by UpdateAndDisplayGameControlValues() below) */
+ // DisplayGameControlValues();
#else
DrawGameValue_Time(TimeLeft);
#endif
}
}
#if 1
- else if (level.time == 0 && !AllPlayersGone) /* level w/o time limit */
+ else if (game.no_time_limit && !AllPlayersGone) /* level w/o time limit */
{
game_panel_controls[GAME_PANEL_TIME].value = TimePlayed;
- DisplayGameControlValues();
+ /* (already called by UpdateAndDisplayGameControlValues() below) */
+ // DisplayGameControlValues();
}
#else
- else if (level.time == 0 && !AllPlayersGone) /* level w/o time limit */
+ else if (game.no_time_limit && !AllPlayersGone) /* level w/o time limit */
DrawGameValue_Time(TimePlayed);
#endif
level.native_em_level->lev->time =
- (level.time == 0 ? TimePlayed : TimeLeft);
+ (game.no_time_limit ? TimePlayed : TimeLeft);
}
if (tape.recording || tape.playing)
}
void StartGameActions(boolean init_network_game, boolean record_tape,
- long random_seed)
+ int random_seed)
{
- unsigned long new_random_seed = InitRND(random_seed);
+ unsigned int new_random_seed = InitRND(random_seed);
if (record_tape)
TapeStartRecording(new_random_seed);
void GameActions()
{
- static unsigned long game_frame_delay = 0;
- unsigned long game_frame_delay_value;
+ static unsigned int game_frame_delay = 0;
+ unsigned int game_frame_delay_value;
byte *recorded_player_action;
byte summarized_player_action = 0;
byte tape_action[MAX_PLAYERS];
/* new experimental amoeba growth stuff */
if (!(FrameCounter % 8))
{
- static unsigned long random = 1684108901;
+ static unsigned int random = 1684108901;
for (i = 0; i < level.amoeba_speed * 28 / 8; i++)
{
if (options.debug) /* calculate frames per second */
{
- static unsigned long fps_counter = 0;
+ static unsigned int fps_counter = 0;
static int fps_frames = 0;
- unsigned long fps_delay_ms = Counter() - fps_counter;
+ unsigned int fps_delay_ms = Counter() - fps_counter;
fps_frames++;
#else
+#if NEW_TILESIZE
+#if NEW_SCROLL
+ int softscroll_offset = (setup.soft_scrolling ? 2 * TILEX_VAR : 0);
+#else
+ int softscroll_offset = (setup.soft_scrolling ? TILEX_VAR : 0);
+#endif
+#else
+#if NEW_SCROLL
+ int softscroll_offset = (setup.soft_scrolling ? 2 * TILEX : 0);
+#else
int softscroll_offset = (setup.soft_scrolling ? TILEX : 0);
+#endif
+#endif
+#if NEW_TILESIZE
+ BlitBitmap(drawto_field, drawto_field,
+ FX + TILEX_VAR * (dx == -1) - softscroll_offset,
+ FY + TILEY_VAR * (dy == -1) - softscroll_offset,
+ SXSIZE - TILEX_VAR * (dx != 0) + 2 * softscroll_offset,
+ SYSIZE - TILEY_VAR * (dy != 0) + 2 * softscroll_offset,
+ FX + TILEX_VAR * (dx == 1) - softscroll_offset,
+ FY + TILEY_VAR * (dy == 1) - softscroll_offset);
+#else
BlitBitmap(drawto_field, drawto_field,
FX + TILEX * (dx == -1) - softscroll_offset,
FY + TILEY * (dy == -1) - softscroll_offset,
FX + TILEX * (dx == 1) - softscroll_offset,
FY + TILEY * (dy == 1) - softscroll_offset);
#endif
+
+#endif
#endif
if (dx != 0)
int original_move_delay_value = player->move_delay_value;
#if DEBUG
- printf("THIS SHOULD ONLY HAPPEN WITH PRE-1.2 LEVEL TAPES. [%ld]\n",
+ printf("THIS SHOULD ONLY HAPPEN WITH PRE-1.2 LEVEL TAPES. [%d]\n",
tape.counter);
#endif
KillPlayer(&stored_player[i]);
}
#if 1
- else if (level.time == 0 && !AllPlayersGone) /* level w/o time limit */
+ else if (game.no_time_limit && !AllPlayersGone) /* level w/o time limit */
{
game_panel_controls[GAME_PANEL_TIME].value = TimePlayed;
DisplayGameControlValues();
}
#else
- else if (level.time == 0 && !AllPlayersGone) /* level w/o time limit */
+ else if (game.no_time_limit && !AllPlayersGone) /* level w/o time limit */
DrawGameValue_Time(TimePlayed);
#endif
}
void ScrollScreen(struct PlayerInfo *player, int mode)
{
- static unsigned long screen_frame_counter = 0;
+ static unsigned int screen_frame_counter = 0;
if (mode == SCROLL_INIT)
{
if (level.time > 0 || level.use_time_orb_bug)
{
TimeLeft += level.time_orb_time;
+ game.no_time_limit = FALSE;
#if 1
game_panel_controls[GAME_PANEL_TIME].value = TimeLeft;
if (IS_CUSTOM_ELEMENT(new_element) && CAN_MOVE(new_element) &&
element_info[new_element].move_pattern == MV_WHEN_DROPPED)
{
- int move_direction, nextx, nexty;
+#if 0
+ int move_direction;
+ int nextx, nexty;
+#endif
if (element_info[new_element].move_direction_initial == MV_START_AUTOMATIC)
MovDir[dropx][dropy] = drop_direction;
+#if 0
move_direction = MovDir[dropx][dropy];
nextx = dropx + GET_DX_FROM_DIR(move_direction);
nexty = dropy + GET_DY_FROM_DIR(move_direction);
+#endif
ChangeCount[dropx][dropy] = 0; /* allow at least one more change */
PlayLevelSoundElementAction(x, y, element, action);
}
-#if 0
-void ChangeTime(int value)
-{
- int *time = (level.time == 0 ? &TimePlayed : &TimeLeft);
-
- *time += value;
-
- /* EMC game engine uses value from time counter of RND game engine */
- level.native_em_level->lev->time = *time;
-
- DrawGameValue_Time(*time);
-}
-
-void RaiseScore(int value)
-{
- /* EMC game engine and RND game engine have separate score counters */
- int *score = (level.game_engine_type == GAME_ENGINE_TYPE_EM ?
- &level.native_em_level->lev->score : &local_player->score);
-
- *score += value;
-
- DrawGameValue_Score(*score);
-}
-#endif
-
void RaiseScore(int value)
{
local_player->score += value;
/* random generator functions */
/* ------------------------------------------------------------------------- */
-unsigned int InitEngineRandom_RND(long seed)
+unsigned int InitEngineRandom_RND(int seed)
{
game.num_random_calls = 0;
static void LoadEngineSnapshotValues_RND()
{
- unsigned long num_random_calls = game.num_random_calls;
+ unsigned int num_random_calls = game.num_random_calls;
int i, j;
for (i = 0; i < NUM_CUSTOM_ELEMENTS; i++)
/* ---------- new game button stuff ---------------------------------------- */
-/* graphic position values for game buttons */
-#define GAME_BUTTON_XSIZE 30
-#define GAME_BUTTON_YSIZE 30
-#define GAME_BUTTON_XPOS 5
-#define GAME_BUTTON_YPOS 215
-#define SOUND_BUTTON_XPOS 5
-#define SOUND_BUTTON_YPOS (GAME_BUTTON_YPOS + GAME_BUTTON_YSIZE)
-
-#define GAME_BUTTON_STOP_XPOS (GAME_BUTTON_XPOS + 0 * GAME_BUTTON_XSIZE)
-#define GAME_BUTTON_PAUSE_XPOS (GAME_BUTTON_XPOS + 1 * GAME_BUTTON_XSIZE)
-#define GAME_BUTTON_PLAY_XPOS (GAME_BUTTON_XPOS + 2 * GAME_BUTTON_XSIZE)
-#define SOUND_BUTTON_MUSIC_XPOS (SOUND_BUTTON_XPOS + 0 * GAME_BUTTON_XSIZE)
-#define SOUND_BUTTON_LOOPS_XPOS (SOUND_BUTTON_XPOS + 1 * GAME_BUTTON_XSIZE)
-#define SOUND_BUTTON_SIMPLE_XPOS (SOUND_BUTTON_XPOS + 2 * GAME_BUTTON_XSIZE)
-
static struct
{
- int *x, *y;
- int gd_x, gd_y;
+ int graphic;
+ struct Rect *pos;
int gadget_id;
char *infotext;
} gamebutton_info[NUM_GAME_BUTTONS] =
{
-#if 1
{
- &game.button.stop.x, &game.button.stop.y,
- GAME_BUTTON_STOP_XPOS, GAME_BUTTON_YPOS,
- GAME_CTRL_ID_STOP,
- "stop game"
+ IMG_GAME_BUTTON_GFX_STOP, &game.button.stop,
+ GAME_CTRL_ID_STOP, "stop game"
},
{
- &game.button.pause.x, &game.button.pause.y,
- GAME_BUTTON_PAUSE_XPOS, GAME_BUTTON_YPOS,
- GAME_CTRL_ID_PAUSE,
- "pause game"
+ IMG_GAME_BUTTON_GFX_PAUSE, &game.button.pause,
+ GAME_CTRL_ID_PAUSE, "pause game"
},
{
- &game.button.play.x, &game.button.play.y,
- GAME_BUTTON_PLAY_XPOS, GAME_BUTTON_YPOS,
- GAME_CTRL_ID_PLAY,
- "play game"
+ IMG_GAME_BUTTON_GFX_PLAY, &game.button.play,
+ GAME_CTRL_ID_PLAY, "play game"
},
{
- &game.button.sound_music.x, &game.button.sound_music.y,
- SOUND_BUTTON_MUSIC_XPOS, SOUND_BUTTON_YPOS,
- SOUND_CTRL_ID_MUSIC,
- "background music on/off"
+ IMG_GAME_BUTTON_GFX_SOUND_MUSIC, &game.button.sound_music,
+ SOUND_CTRL_ID_MUSIC, "background music on/off"
},
{
- &game.button.sound_loops.x, &game.button.sound_loops.y,
- SOUND_BUTTON_LOOPS_XPOS, SOUND_BUTTON_YPOS,
- SOUND_CTRL_ID_LOOPS,
- "sound loops on/off"
+ IMG_GAME_BUTTON_GFX_SOUND_LOOPS, &game.button.sound_loops,
+ SOUND_CTRL_ID_LOOPS, "sound loops on/off"
},
{
- &game.button.sound_simple.x,&game.button.sound_simple.y,
- SOUND_BUTTON_SIMPLE_XPOS, SOUND_BUTTON_YPOS,
- SOUND_CTRL_ID_SIMPLE,
- "normal sounds on/off"
+ IMG_GAME_BUTTON_GFX_SOUND_SIMPLE, &game.button.sound_simple,
+ SOUND_CTRL_ID_SIMPLE, "normal sounds on/off"
}
-#else
- {
- GAME_BUTTON_STOP_XPOS, GAME_BUTTON_YPOS,
- GAME_CTRL_ID_STOP,
- "stop game"
- },
- {
- GAME_BUTTON_PAUSE_XPOS, GAME_BUTTON_YPOS,
- GAME_CTRL_ID_PAUSE,
- "pause game"
- },
- {
- GAME_BUTTON_PLAY_XPOS, GAME_BUTTON_YPOS,
- GAME_CTRL_ID_PLAY,
- "play game"
- },
- {
- SOUND_BUTTON_MUSIC_XPOS, SOUND_BUTTON_YPOS,
- SOUND_CTRL_ID_MUSIC,
- "background music on/off"
- },
- {
- SOUND_BUTTON_LOOPS_XPOS, SOUND_BUTTON_YPOS,
- SOUND_CTRL_ID_LOOPS,
- "sound loops on/off"
- },
- {
- SOUND_BUTTON_SIMPLE_XPOS, SOUND_BUTTON_YPOS,
- SOUND_CTRL_ID_SIMPLE,
- "normal sounds on/off"
- }
-#endif
};
void CreateGameButtons()
for (i = 0; i < NUM_GAME_BUTTONS; i++)
{
- Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
+ struct GraphicInfo *gfx = &graphic_info[gamebutton_info[i].graphic];
+ struct Rect *pos = gamebutton_info[i].pos;
struct GadgetInfo *gi;
int button_type;
boolean checked;
- unsigned long event_mask;
- int x, y;
- int gd_xoffset, gd_yoffset;
- int gd_x1, gd_x2, gd_y1, gd_y2;
+ unsigned int event_mask;
+ int gd_x = gfx->src_x;
+ int gd_y = gfx->src_y;
+ int gd_xp = gfx->src_x + gfx->pressed_xoffset;
+ int gd_yp = gfx->src_y + gfx->pressed_yoffset;
+ int gd_xa = gfx->src_x + gfx->active_xoffset;
+ int gd_ya = gfx->src_y + gfx->active_yoffset;
+ int gd_xap = gfx->src_x + gfx->active_xoffset + gfx->pressed_xoffset;
+ int gd_yap = gfx->src_y + gfx->active_yoffset + gfx->pressed_yoffset;
int id = i;
- x = DX + *gamebutton_info[i].x;
- y = DY + *gamebutton_info[i].y;
- gd_xoffset = gamebutton_info[i].gd_x;
- gd_yoffset = gamebutton_info[i].gd_y;
- gd_x1 = DOOR_GFX_PAGEX4 + gd_xoffset;
- gd_x2 = DOOR_GFX_PAGEX3 + gd_xoffset;
-
if (id == GAME_CTRL_ID_STOP ||
id == GAME_CTRL_ID_PAUSE ||
id == GAME_CTRL_ID_PLAY)
button_type = GD_TYPE_NORMAL_BUTTON;
checked = FALSE;
event_mask = GD_EVENT_RELEASED;
- gd_y1 = DOOR_GFX_PAGEY1 + gd_yoffset - GAME_BUTTON_YSIZE;
- gd_y2 = DOOR_GFX_PAGEY1 + gd_yoffset - GAME_BUTTON_YSIZE;
}
else
{
(id == SOUND_CTRL_ID_LOOPS && setup.sound_loops) ||
(id == SOUND_CTRL_ID_SIMPLE && setup.sound_simple) ? TRUE : FALSE);
event_mask = GD_EVENT_PRESSED;
- gd_y1 = DOOR_GFX_PAGEY1 + gd_yoffset;
- gd_y2 = DOOR_GFX_PAGEY1 + gd_yoffset - GAME_BUTTON_YSIZE;
}
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_INFO_TEXT, gamebutton_info[i].infotext,
-#if 1
- GDI_X, x,
- GDI_Y, y,
-#else
- GDI_X, DX + gd_xoffset,
- GDI_Y, DY + gd_yoffset,
-#endif
- GDI_WIDTH, GAME_BUTTON_XSIZE,
- GDI_HEIGHT, GAME_BUTTON_YSIZE,
+ GDI_X, DX + pos->x,
+ GDI_Y, DY + pos->y,
+ GDI_WIDTH, gfx->width,
+ GDI_HEIGHT, gfx->height,
GDI_TYPE, button_type,
GDI_STATE, GD_BUTTON_UNPRESSED,
GDI_CHECKED, checked,
- GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y1,
- GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y1,
- GDI_ALT_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y2,
- GDI_ALT_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y2,
+ GDI_DESIGN_UNPRESSED, gfx->bitmap, gd_x, gd_y,
+ GDI_DESIGN_PRESSED, gfx->bitmap, gd_xp, gd_yp,
+ GDI_ALT_DESIGN_UNPRESSED, gfx->bitmap, gd_xa, gd_ya,
+ GDI_ALT_DESIGN_PRESSED, gfx->bitmap, gd_xap, gd_yap,
GDI_DIRECT_DRAW, FALSE,
GDI_EVENT_MASK, event_mask,
GDI_CALLBACK_ACTION, HandleGameButtons,
struct GameButtonInfo
{
- struct MenuPosInfo stop;
- struct MenuPosInfo pause;
- struct MenuPosInfo play;
- struct MenuPosInfo sound_music;
- struct MenuPosInfo sound_loops;
- struct MenuPosInfo sound_simple;
+ struct Rect stop;
+ struct Rect pause;
+ struct Rect play;
+ struct Rect sound_music;
+ struct Rect sound_loops;
+ struct Rect sound_simple;
};
#else
boolean use_masked_pushing;
int forced_scroll_delay_value;
int scroll_delay_value;
+ int tile_size;
/* values for engine initialization */
int default_push_delay_fixed;
boolean gravity;
boolean explosions_delayed;
boolean envelope_active;
+ boolean no_time_limit; /* (variable only in very special case) */
/* values for the new EMC elements */
int lenses_time_left;
boolean set_centered_player;
/* values for random number generator initialization after snapshot */
- unsigned long num_random_calls;
+ unsigned int num_random_calls;
};
struct PlayerInfo
int push_delay;
int push_delay_value;
- unsigned long actual_frame_counter;
+ unsigned int actual_frame_counter;
int drop_delay;
int drop_pressed_delay;
void Blocked2Moving(int, int, int *, int *);
void DrawDynamite(int, int);
-void StartGameActions(boolean, boolean, long);
+void StartGameActions(boolean, boolean, int);
void GameActions(void);
void GameActions_EM_Main();
void RequestQuitGameExt(boolean, boolean, char *);
void RequestQuitGame(boolean);
-unsigned int InitEngineRandom_RND(long);
+unsigned int InitEngineRandom_RND(int);
unsigned int RND(int);
void FreeEngineSnapshot();
#define MAX_EM_LEVEL_SIZE 16384
-boolean LoadNativeLevel_EM(char *filename)
+boolean LoadNativeLevel_EM(char *filename, boolean level_info_only)
{
unsigned char raw_leveldata[MAX_EM_LEVEL_SIZE];
int raw_leveldata_length;
if (!(file = fopen(filename, MODE_READ)))
{
- Error(ERR_WARN, "cannot open level '%s' -- using empty level", filename);
+ if (!level_info_only)
+ Error(ERR_WARN, "cannot open level '%s' -- using empty level", filename);
return FALSE;
}
struct EngineSnapshotInfo_EM
{
struct GameInfo_EM game_em;
- unsigned long RandomEM;
+ unsigned int RandomEM;
struct LEVEL lev;
struct PLAYER ply[MAX_PLAYERS];
short Array[4][EM_MAX_CAVE_HEIGHT][EM_MAX_CAVE_WIDTH];
extern void em_open_all();
extern void em_close_all();
+extern void InitGfxBuffers_EM();
+
extern void InitGameEngine_EM();
extern void GameActions_EM(byte *, boolean);
-extern unsigned int InitEngineRandom_EM(long);
+extern unsigned int InitEngineRandom_EM(int);
extern void setLevelInfoToDefaults_EM();
-extern boolean LoadNativeLevel_EM(char *);
+extern boolean LoadNativeLevel_EM(char *, boolean);
extern void BackToFront_EM(void);
extern void BlitScreenToBitmap_EM(Bitmap *);
extern char *progname;
extern char *arg_basedir;
+#if 0
+extern int TILEX, TILEY;
+#endif
+
extern int frame;
extern short ulaw_to_linear[256];
void sound_play(void);
int cave_convert(char *);
-boolean LoadNativeLevel_EM(char *);
void game_init_vars(void);
void game_play_init(int, char *);
void prepare_em_level(void);
int sound_thread(void);
-int read_sample(char *, short **, long *);
+int read_sample(char *, short **, int *);
void read_cave_list(void);
void free_cave_list(void);
#define USE_EXTENDED_GRAPHICS_ENGINE 1
+
+#if 0
+int TILEX = ORIG_TILEX * ZOOM_FACTOR;
+int TILEY = ORIG_TILEY * ZOOM_FACTOR;
+#endif
+
int frame; /* current screen frame */
int screen_x, screen_y; /* current scroll position */
{
int x = screen_x % (MAX_BUF_XSIZE * TILEX);
int y = screen_y % (MAX_BUF_YSIZE * TILEY);
+ int sx, sy, sxsize, sysize;
+ int xsize = SXSIZE;
+ int ysize = SYSIZE;
+ int full_xsize = lev.width * TILEX;
+ int full_ysize = lev.height * TILEY;
+
+ sxsize = (full_xsize < xsize ? full_xsize : xsize);
+ sysize = (full_ysize < ysize ? full_ysize : ysize);
+ sx = SX + (full_xsize < xsize ? (xsize - full_xsize) / 2 : 0);
+ sy = SY + (full_ysize < ysize ? (ysize - full_ysize) / 2 : 0);
+
+#if 0
+ printf("::: %d, %d\n", screenBitmap->width, screenBitmap->height);
+ BlitBitmap(screenBitmap, target_bitmap, 0, 0, 544, 544, SX, SY);
+ return;
+#endif
+#if 1
+ if (x < 2 * TILEX && y < 2 * TILEY)
+ {
+ BlitBitmap(screenBitmap, target_bitmap, x, y,
+ sxsize, sysize, sx, sy);
+ }
+ else if (x < 2 * TILEX && y >= 2 * TILEY)
+ {
+ BlitBitmap(screenBitmap, target_bitmap, x, y,
+ sxsize, MAX_BUF_YSIZE * TILEY - y,
+ sx, sy);
+ BlitBitmap(screenBitmap, target_bitmap, x, 0,
+ sxsize, y - 2 * TILEY,
+ sx, sy + MAX_BUF_YSIZE * TILEY - y);
+ }
+ else if (x >= 2 * TILEX && y < 2 * TILEY)
+ {
+ BlitBitmap(screenBitmap, target_bitmap, x, y,
+ MAX_BUF_XSIZE * TILEX - x, sysize,
+ sx, sy);
+ BlitBitmap(screenBitmap, target_bitmap, 0, y,
+ x - 2 * TILEX, sysize,
+ sx + MAX_BUF_XSIZE * TILEX - x, sy);
+ }
+ else
+ {
+ BlitBitmap(screenBitmap, target_bitmap, x, y,
+ MAX_BUF_XSIZE * TILEX - x, MAX_BUF_YSIZE * TILEY - y,
+ sx, sy);
+ BlitBitmap(screenBitmap, target_bitmap, 0, y,
+ x - 2 * TILEX, MAX_BUF_YSIZE * TILEY - y,
+ sx + MAX_BUF_XSIZE * TILEX - x, sy);
+ BlitBitmap(screenBitmap, target_bitmap, x, 0,
+ MAX_BUF_XSIZE * TILEX - x, y - 2 * TILEY,
+ sx, sy + MAX_BUF_YSIZE * TILEY - y);
+ BlitBitmap(screenBitmap, target_bitmap, 0, 0,
+ x - 2 * TILEX, y - 2 * TILEY,
+ sx + MAX_BUF_XSIZE * TILEX - x, sy + MAX_BUF_YSIZE * TILEY - y);
+ }
+#else
if (x < 2 * TILEX && y < 2 * TILEY)
{
BlitBitmap(screenBitmap, target_bitmap, x, y,
x - 2 * TILEX, y - 2 * TILEY,
SX + MAX_BUF_XSIZE * TILEX - x, SY + MAX_BUF_YSIZE * TILEY - y);
}
+#endif
}
void BackToFront_EM(void)
boolean half_shifted_y = (EVEN(SCR_FIELDY) && screen_y % TILEY != 0);
#endif
+ int sx, sy;
+#if 0
+ int sxsize, sysize;
+#endif
+ int xsize = SXSIZE;
+ int ysize = SYSIZE;
+ int full_xsize = lev.width * TILEX;
+ int full_ysize = lev.height * TILEY;
+
+#if 0
+ sxsize = (full_xsize < xsize ? full_xsize : xsize);
+ sysize = (full_ysize < ysize ? full_ysize : ysize);
+#endif
+ sx = SX + (full_xsize < xsize ? (xsize - full_xsize) / 2 : 0);
+ sy = SY + (full_ysize < ysize ? (ysize - full_ysize) / 2 : 0);
+
#if 0
#if 1
printf("::: %d, %d\n", EVEN(SCR_FIELDX), screen_x);
if (redraw[xx][yy])
BlitBitmap(screenBitmap, window,
xx * TILEX, yy * TILEY, TILEX, TILEY,
- SX + x * TILEX - scroll_xoffset,
- SY + y * TILEY - scroll_yoffset);
+ sx + x * TILEX - scroll_xoffset,
+ sy + y * TILEY - scroll_yoffset);
}
}
boolean draw_masked)
{
struct GraphicInfo_EM *g = getObjectGraphic(x, y);
+#if NEW_TILESIZE
+ int src_x = g->src_x + g->src_offset_x * TILESIZE_VAR / TILESIZE;
+ int src_y = g->src_y + g->src_offset_y * TILESIZE_VAR / TILESIZE;
+ int dst_x = sx * TILEX + g->dst_offset_x * TILESIZE_VAR / TILESIZE;
+ int dst_y = sy * TILEY + g->dst_offset_y * TILESIZE_VAR / TILESIZE;
+ int width = g->width * TILESIZE_VAR / TILESIZE;
+ int height = g->height * TILESIZE_VAR / TILESIZE;
+#else
int src_x = g->src_x + g->src_offset_x;
int src_y = g->src_y + g->src_offset_y;
int dst_x = sx * TILEX + g->dst_offset_x;
int dst_y = sy * TILEY + g->dst_offset_y;
int width = g->width;
int height = g->height;
+#endif
int left = screen_x / TILEX;
int top = screen_y / TILEY;
#else
struct GraphicInfo_EM *g = getObjectGraphic(x, y);
#endif
+ int crumbled_border_size;
int left = screen_x / TILEX;
int top = screen_y / TILEY;
int i;
g = getObjectGraphic(x, y);
#endif
+ crumbled_border_size = g->crumbled_border_size;
+
+#if NEW_TILESIZE
+ crumbled_border_size = crumbled_border_size * TILESIZE_VAR / TILESIZE;
+#endif
+
#if 0
if (x == 3 && y == 3 && frame == 0)
printf("::: %d, %d\n",
if (i == 1 || i == 2)
{
- width = g->crumbled_border_size;
+ width = crumbled_border_size;
height = TILEY;
- cx = (i == 2 ? TILEX - g->crumbled_border_size : 0);
+ cx = (i == 2 ? TILEX - crumbled_border_size : 0);
cy = 0;
}
else
{
width = TILEX;
- height = g->crumbled_border_size;
+ height = crumbled_border_size;
cx = 0;
- cy = (i == 3 ? TILEY - g->crumbled_border_size : 0);
+ cy = (i == 3 ? TILEY - crumbled_border_size : 0);
}
if (width > 0 && height > 0)
if (draw_new_player_location && !quick_relocation)
{
#if 1
- unsigned long game_frame_delay_value = getGameFrameDelay_EM(20);
+ unsigned int game_frame_delay_value = getGameFrameDelay_EM(20);
#else
- unsigned long game_frame_delay_value = getGameFrameDelay_EM(25);
+ unsigned int game_frame_delay_value = getGameFrameDelay_EM(25);
#endif
int wait_delay_value = game_frame_delay_value;
int screen_xx = VALID_SCREEN_X(sx);
static int sound_pid = -1;
int sound_pipe[2] = { -1, -1 }; /* for communication */
short *sound_data[SAMPLE_MAX]; /* pointer to sound data */
-long sound_length[SAMPLE_MAX]; /* length of sound data */
+int sound_length[SAMPLE_MAX]; /* length of sound data */
static const char *sound_names[SAMPLE_MAX] =
{
sprmaskBitmap = emc_bitmaps[1]->clip_mask;
#endif
+#if 0
+ printf("::: CreateBitmap: %d, %d => %d\n",
+ MAX_BUF_XSIZE, TILEX, MAX_BUF_XSIZE * TILEX);
+
screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY,
DEFAULT_DEPTH);
global_em_info.screenbuffer = screenBitmap;
+#endif
#endif
return(0);
}
+void InitGfxBuffers_EM()
+{
+
+#if 1
+
+#if 0
+ printf("::: InitGfxBuffers_EM: %d, %d => %d\n",
+ MAX_BUF_XSIZE, TILEX, MAX_BUF_XSIZE * TILEX);
+#endif
+
+ ReCreateBitmap(&screenBitmap, MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY,
+ DEFAULT_DEPTH);
+
+ global_em_info.screenbuffer = screenBitmap;
+
+#else
+
+ printf("::: CreateBitmap: %d, %d => %d\n",
+ MAX_BUF_XSIZE, TILEX, MAX_BUF_XSIZE * TILEX);
+
+ screenBitmap = CreateBitmap(MAX_BUF_XSIZE * TILEX, MAX_BUF_YSIZE * TILEY,
+ DEFAULT_DEPTH);
+
+ global_em_info.screenbuffer = screenBitmap;
+#endif
+}
+
void em_open_all()
{
/* pre-calculate some data */
clear_mem(play, sizeof(play));
}
-unsigned int InitEngineRandom_EM(long seed)
+unsigned int InitEngineRandom_EM(int seed)
{
if (seed == NEW_RANDOMIZE)
{
#include "main_em.h"
-unsigned long RandomEM;
+unsigned int RandomEM;
struct LEVEL lev;
struct PLAYER ply[MAX_PLAYERS];
void GameActions_EM(byte action[MAX_PLAYERS], boolean warp_mode)
{
int i;
+ boolean player_is_dropping = FALSE;
#if 0
static int foo = -1;
DrawGameDoorValues_EM();
}
- CheckSingleStepMode_EM(action, frame, game_em.any_player_moving);
+ for (i = 0; i < MAX_PLAYERS; i++)
+ if (ply[i].joy_drop &&
+ ply[i].dynamite &&
+ ply[i].dynamite_cnt > 0 &&
+ ply[i].dynamite_cnt < 5)
+ player_is_dropping = TRUE;
+
+ CheckSingleStepMode_EM(action, frame, game_em.any_player_moving,
+ player_is_dropping);
#if 1
game_animscreen();
/* screen sizes and positions for EM engine */
+#define NEW_TILESIZE 1
+
+#define ORIG_TILESIZE 16
+
#define ORIG_TILEX 16
#define ORIG_TILEY 16
#define ORIG_SCOREX 8
#define ORIG_MENUFONTX 12
#define ORIG_MENUFONTY 16
+#if NEW_TILESIZE
+#define ZOOM_FACTOR (2 * TILESIZE_VAR / TILESIZE)
+#else
#define ZOOM_FACTOR 2
+#endif
+#define TILESIZE 32
+
+#if NEW_TILESIZE
+extern int TILESIZE_VAR;
+#define TILEX TILESIZE_VAR
+#define TILEY TILESIZE_VAR
+#else
#define TILEX (ORIG_TILEX * ZOOM_FACTOR)
#define TILEY (ORIG_TILEY * ZOOM_FACTOR)
+#endif
#define SCOREX (ORIG_SCOREX * ZOOM_FACTOR)
#define SCOREY (ORIG_SCOREY * ZOOM_FACTOR)
#define GFXMENUFONTX (ORIG_GFXMENUFONTX * ZOOM_FACTOR)
/* exported variables */
/* ------------------------------------------------------------------------- */
-extern unsigned long RandomEM;
+extern unsigned int RandomEM;
extern struct LEVEL lev;
extern struct PLAYER ply[MAX_PLAYERS];
extern char play[SAMPLE_MAX];
extern int sound_pipe[2];
extern short *sound_data[SAMPLE_MAX];
-extern long sound_length[SAMPLE_MAX];
+extern int sound_length[SAMPLE_MAX];
#define MIXER_MAX 4 /* maximum number of samples we can play at once */
{
int audio_fd; /* file descriptor of /dev/audio or -1 if not open */
int audio_format;
- int sample_rate;
+ // int sample_rate;
int fragment_size;
unsigned char *audio_buffer; /* actual buffer pumped to /dev/audio */
short *mix_buffer;
char sound_play[SAMPLE_MAX]; /* if set, we should be playing these sounds */
- long sound_pos[SAMPLE_MAX]; /* position in the sound */
+ int sound_pos[SAMPLE_MAX]; /* position in the sound */
int mix_play[MIXER_MAX]; /* which sounds we have chosen to mix (calculated each time) */
int mix_count;
int i;
audio_fd = -1;
audio_format = AUDIO_ULAW; /* defaults for non-OSS /dev/audio */
- sample_rate = 8000;
+ // sample_rate = 8000;
fragment_size = 256;
audio_buffer = 0;
mix_buffer = 0;
goto reset;
}
- sample_rate = i;
+ // sample_rate = i;
if (ioctl(audio_fd, SNDCTL_DSP_GETBLKSIZE, &i) == -1)
{
Error(ERR_WARN, "unable to get block size in sound thread");
register short *mix_ptr = mix_buffer;
register short *sound_ptr =
sound_data[mix_play[i]] + sound_pos[mix_play[i]];
- register long count =
+ register int count =
sound_length[mix_play[i]] - sound_pos[mix_play[i]];
if (count > fragment_size)
return(0);
}
-int read_sample(char *name, short **data, long *length)
+int read_sample(char *name, short **data, int *length)
{
int result;
FILE *file = 0;
short *dataptr = 0;
- long datalength;
+ int datalength;
int i, actual, ch;
unsigned char buffer[24];
- unsigned long temp;
+ unsigned int temp;
file = fopen(name, "rb");
if (file == 0)
temp = buffer[12] << 24 | buffer[13] << 16 | buffer[14] << 8 | buffer[15];
if (temp != 1)
{
- fprintf(stderr, "%s: \"%s\": %s (%ld != 1)\n", progname, name,
+ fprintf(stderr, "%s: \"%s\": %s (%d != 1)\n", progname, name,
"bad encoding type", temp);
result = 1;
goto fail;
temp = buffer[16] << 24 | buffer[17] << 16 | buffer[18] << 8 | buffer[19];
if (temp != 8000)
{
- fprintf(stderr, "%s: \"%s\": %s (%ld != 8000)\n", progname, name,
+ fprintf(stderr, "%s: \"%s\": %s (%d != 8000)\n", progname, name,
"bad sample rate", temp);
result = 1;
goto fail;
temp = buffer[20] << 24 | buffer[21] << 16 | buffer[22] << 8 | buffer[23];
if (temp != 1)
{
- fprintf(stderr, "%s: \"%s\": %s (%ld != 1)\n", progname, name,
+ fprintf(stderr, "%s: \"%s\": %s (%d != 1)\n", progname, name,
"unsupported channels", temp);
result = 1;
goto fail;
int oldy = ply->y;
int x = oldx;
int y = oldy;
- int anim = 0;
int dx = 0, dy = 0;
game_em.last_player_direction[ply->num] = MV_NONE;
{
x--;
dx = -1;
- anim = 3;
}
else if (ply->joy_e) /* east */
{
x++;
dx = 1;
- anim = 1;
}
if (ply->joy_n) /* north */
{
y--;
dy = -1;
- anim = 0;
}
else if (ply->joy_s) /* south */
{
y++;
dy = 1;
- anim = 2;
}
#else
{
y--;
dy = -1;
- anim = 0;
}
else if (ply->joy_e) /* east */
{
x++;
dx = 1;
- anim = 1;
}
else if (ply->joy_s) /* south */
{
y++;
dy = 1;
- anim = 2;
}
else if (ply->joy_w) /* west */
{
x--;
dx = -1;
- anim = 3;
}
}
else
{
x--;
dx = -1;
- anim = 3;
}
else if (ply->joy_s) /* south */
{
y++;
dy = 1;
- anim = 2;
}
else if (ply->joy_e) /* east */
{
x++;
dx = 1;
- anim = 1;
}
else if (ply->joy_n) /* north */
{
y--;
dy = -1;
- anim = 0;
}
}
#endif
{
int x = 0;
int y = 1;
- unsigned long random = RandomEM;
+ unsigned int random = RandomEM;
short *cave_cache = Cave[y]; /* might be a win */
int score = 0;
void subRandomize()
{
- long Tick = MyGetTickCount();
+ int Tick = MyGetTickCount();
RandomSeed = (Tick ^ (Tick >> 16)) & 0xFFFF;
}
#include <math.h>
-long mScrollX, mScrollY;
-long mScrollX_last, mScrollY_last;
+int mScrollX, mScrollY;
+int mScrollX_last, mScrollY_last;
#if 1
-long ScreenBuffer[2 + MAX_PLAYFIELD_WIDTH + 2][2 + MAX_PLAYFIELD_HEIGHT + 2];
+int ScreenBuffer[2 + MAX_PLAYFIELD_WIDTH + 2][2 + MAX_PLAYFIELD_HEIGHT + 2];
boolean redraw[2 + MAX_PLAYFIELD_WIDTH + 2][2 + MAX_PLAYFIELD_HEIGHT + 2];
#else
-long ScreenBuffer[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
+int ScreenBuffer[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
#endif
int y2 = mScrollY_last / TILEY + (SCR_FIELDY - 1) + 2;
int x, y;
+#if NEW_TILESIZE
+ BlitBitmap(bitmap_db_field_sp, bitmap_db_field_sp,
+ TILEX_VAR * (dx == -1),
+ TILEY_VAR * (dy == -1),
+ (MAX_BUF_XSIZE * TILEX_VAR) - TILEX_VAR * (dx != 0),
+ (MAX_BUF_YSIZE * TILEY_VAR) - TILEY_VAR * (dy != 0),
+ TILEX_VAR * (dx == 1),
+ TILEY_VAR * (dy == 1));
+#else
BlitBitmap(bitmap_db_field_sp, bitmap_db_field_sp,
TILEX * (dx == -1),
TILEY * (dy == -1),
(MAX_BUF_YSIZE * TILEY) - TILEY * (dy != 0),
TILEX * (dx == 1),
TILEY * (dy == 1));
+#endif
/* when scrolling the whole playfield, do not redraw single tiles */
+#if 1
+ for (x = 0; x < 2 + MAX_PLAYFIELD_WIDTH + 2; x++)
+ for (y = 0; y < 2 + MAX_PLAYFIELD_HEIGHT + 2; y++)
+ redraw[x][y] = FALSE;
+#else
for (x = 0; x < MAX_BUF_XSIZE; x++)
for (y = 0; y < MAX_BUF_YSIZE; y++)
redraw[x][y] = FALSE;
+#endif
redraw_tiles = 0;
DrawFrameIfNeeded();
int sx = x - x1;
int sy = y - y1;
int tsi = GetSI(x, y);
- long id = ((PlayField16[tsi]) |
- (PlayField8[tsi] << 16) |
- (DisPlayField[tsi] << 24));
+ int id = ((PlayField16[tsi]) |
+ (PlayField8[tsi] << 16) |
+ (DisPlayField[tsi] << 24));
if ((dx == -1 && x == x2) ||
(dx == +1 && x == x1) ||
ScrollPlayfieldIfNeededExt(TRUE);
}
+#define DEBUG_REDRAW 0
+
void UpdatePlayfield(boolean force_redraw)
{
int x, y;
-#if 1
+
+#if DEBUG_REDRAW
int num_redrawn = 0;
#endif
int sync_frame = GfxFrame[x][y];
boolean redraw = force_redraw;
+#if DEBUG_REDRAW
#if 0
redraw = TRUE; // !!! TEST ONLY -- ALWAYS REDRAW !!!
+#endif
#endif
if (graphic < 0)
int sx = x * StretchWidth;
int sy = y * StretchWidth;
+#if DEBUG_REDRAW
#if 0
printf("::: REDRAW (%d, %d): %d, %d\n", x, y, graphic, sync_frame);
+#endif
#endif
DDSpriteBuffer_BltImg(sx, sy, graphic, sync_frame);
-#if 1
+#if DEBUG_REDRAW
num_redrawn++;
#endif
}
}
}
-#if 0
+#if DEBUG_REDRAW
printf("::: FRAME %d: %d redrawn\n", FrameCounter, num_redrawn);
#endif
}
int xsize = SXSIZE;
int ysize = SYSIZE;
+#if NEW_TILESIZE
+ int full_xsize = (FieldWidth - (menBorder ? 0 : 1)) * TILEX_VAR;
+ int full_ysize = (FieldHeight - (menBorder ? 0 : 1)) * TILEY_VAR;
+#else
int full_xsize = (FieldWidth - (menBorder ? 0 : 1)) * TILEX;
int full_ysize = (FieldHeight - (menBorder ? 0 : 1)) * TILEY;
+#endif
+
+#if NEW_TILESIZE
+
+#endif
sxsize = (full_xsize < xsize ? full_xsize : xsize);
sysize = (full_ysize < ysize ? full_ysize : ysize);
}
#endif
+#if NEW_TILESIZE
+ px = px * TILESIZE_VAR / TILESIZE;
+ py = py * TILESIZE_VAR / TILESIZE;
+#endif
+
+#if 0
+ printf("::: (%d, %d) (%d, %d) (%d, %d) [%d / %d]\n",
+ px, py, sxsize, sysize, sx, sy,
+ FieldHeight, menBorder);
+#endif
+
+#if 0
+ printf("::: (%d, %d)\n",
+ bitmap_db_field_sp->width, bitmap_db_field_sp->height);
+#endif
+
BlitBitmap(bitmap_db_field_sp, target_bitmap, px, py, sxsize, sysize, sx, sy);
}
void BackToFront_SP(void)
{
+ static int scroll_x_last = -1, scroll_y_last = -1;
static boolean scrolling_last = FALSE;
- int left = mScrollX / TILEX;
- int top = mScrollY / TILEY;
+ static boolean ExplosionShakeMurphy_last = -1;
+#if 1
+ boolean scrolling = (mScrollX != scroll_x_last || mScrollY != scroll_y_last);
+ // boolean scrolling = (mScrollX != mScrollX_last || mScrollY != mScrollY_last);
+#else
boolean scrolling = (mScrollX % TILEX != 0 || mScrollY % TILEY != 0);
+#endif
int x, y;
+#if 0
+ printf("::: %d, %d / %d, %d [%d, %d]\n",
+ mScrollX, mScrollY,
+ mScrollX_last, mScrollY_last,
+ game_sp.scroll_xoffset, game_sp.scroll_yoffset);
+#endif
+
SyncDisplay();
- if (1 ||
- redraw_tiles > REDRAWTILES_THRESHOLD || scrolling || scrolling_last)
+ if (0 ||
+ redraw_tiles > REDRAWTILES_THRESHOLD || scrolling || scrolling_last ||
+ ExplosionShakeMurphy != 0 || ExplosionShakeMurphy_last != 0)
{
BlitScreenToBitmap_SP(window);
}
else
{
- for (x = 0; x < SCR_FIELDX; x++)
+ int scroll_xoffset = mScrollX - mScrollX_last + game_sp.scroll_xoffset;
+ int scroll_yoffset = mScrollY - mScrollY_last + game_sp.scroll_yoffset;
+ int x1 = 0, x2 = SCR_FIELDX - (scroll_xoffset != 0 ? 0 : 1);
+ int y1 = 0, y2 = SCR_FIELDY - (scroll_yoffset != 0 ? 0 : 1);
+#if NEW_TILESIZE
+ int full_xsize = (FieldWidth - (menBorder ? 0 : 1)) * TILEX_VAR;
+ int full_ysize = (FieldHeight - (menBorder ? 0 : 1)) * TILEY_VAR;
+#else
+ int full_xsize = (FieldWidth - (menBorder ? 0 : 1)) * TILEX;
+ int full_ysize = (FieldHeight - (menBorder ? 0 : 1)) * TILEY;
+#endif
+#if 1
+ int xsize = SXSIZE;
+ int ysize = SYSIZE;
+ int sxsize = (full_xsize < xsize ? full_xsize : xsize);
+ int sysize = (full_ysize < ysize ? full_ysize : ysize);
+ int sx = SX + (full_xsize < xsize ? (xsize - full_xsize) / 2 : 0);
+ int sy = SY + (full_ysize < ysize ? (ysize - full_ysize) / 2 : 0);
+#else
+ int sx = SX + (full_xsize < SXSIZE ? (SXSIZE - full_xsize) / 2 : 0);
+ int sy = SY + (full_ysize < SYSIZE ? (SYSIZE - full_ysize) / 2 : 0);
+#endif
+
+#if 1
+ InitGfxClipRegion(TRUE, sx, sy, sxsize, sysize);
+#else
+ InitGfxClipRegion(TRUE, SX, SY, SXSIZE, SYSIZE);
+#endif
+
+#if NEW_TILESIZE
+ scroll_xoffset = scroll_xoffset * TILESIZE_VAR / TILESIZE;
+ scroll_yoffset = scroll_yoffset * TILESIZE_VAR / TILESIZE;
+#endif
+
+ for (x = x1; x <= x2; x++)
{
- for (y = 0; y < SCR_FIELDY; y++)
+ for (y = y1; y <= y2; y++)
{
- int xx = (left + x) % MAX_BUF_XSIZE;
- int yy = (top + y) % MAX_BUF_YSIZE;
+ int xx = 2 + x;
+ int yy = 2 + y;
+#if NEW_TILESIZE
+ if (redraw[xx][yy])
+ BlitBitmap(bitmap_db_field_sp, window,
+ xx * TILEX_VAR, yy * TILEY_VAR, TILEX_VAR, TILEY_VAR,
+ sx + x * TILEX_VAR - scroll_xoffset,
+ sy + y * TILEY_VAR - scroll_yoffset);
+#else
if (redraw[xx][yy])
BlitBitmap(bitmap_db_field_sp, window,
xx * TILEX, yy * TILEY, TILEX, TILEY,
- SX + x * TILEX, SY + y * TILEY);
+ sx + x * TILEX - scroll_xoffset,
+ sy + y * TILEY - scroll_yoffset);
+#endif
}
}
+
+ InitGfxClipRegion(FALSE, -1, -1, -1, -1);
}
FlushDisplay();
+#if 1
+ for (x = 0; x < 2 + MAX_PLAYFIELD_WIDTH + 2; x++)
+ for (y = 0; y < 2 + MAX_PLAYFIELD_HEIGHT + 2; y++)
+ redraw[x][y] = FALSE;
+#else
for (x = 0; x < MAX_BUF_XSIZE; x++)
for (y = 0; y < MAX_BUF_YSIZE; y++)
redraw[x][y] = FALSE;
+#endif
redraw_tiles = 0;
+ scroll_x_last = mScrollX;
+ scroll_y_last = mScrollY;
scrolling_last = scrolling;
+ ExplosionShakeMurphy_last = ExplosionShakeMurphy;
}
void DDScrollBuffer_ScrollTo(int X, int Y)
ScrollPlayfieldIfNeeded();
}
-void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS)
+void DDScrollBuffer_SoftScrollTo(int X, int Y, int TimeMS, int FPS)
{
double dx, dY;
- long dT, StepCount;
+#if 0
+ int dT;
+#endif
+ int StepCount;
double T, tStep;
- long oldX, oldY, maxD;
+ int oldX, oldY, maxD;
static boolean AlreadyRunning = False;
if (NoDisplayFlag)
if (StepCount == 0)
StepCount = 1;
+#if 0
dT = 1000 / FPS;
+#endif
tStep = (double)1 / StepCount;
oldX = mScrollX;
oldY = mScrollY;
#include "global.h"
-extern long mScrollX, mScrollY;
-extern long mScrollX_last, mScrollY_last;
+extern int mScrollX, mScrollY;
+extern int mScrollX_last, mScrollY_last;
#if 1
extern boolean redraw[2 + MAX_PLAYFIELD_WIDTH + 2][2 + MAX_PLAYFIELD_HEIGHT + 2];
extern void InitScrollPlayfield();
-extern void UpdatePlayfield();
+extern void UpdatePlayfield(boolean);
extern void RestorePlayfield();
extern void DDScrollBuffer_ScrollTo(int X, int Y);
extern void DDScrollBuffer_ScrollTowards(int X, int Y, double Step);
-extern void DDScrollBuffer_SoftScrollTo(int X, int Y, long TimeMS, int FPS);
+extern void DDScrollBuffer_SoftScrollTo(int X, int Y, int TimeMS, int FPS);
#endif /* DDSCROLLBUFFER_H */
static void Blt(int pX, int pY, Bitmap *bitmap, int SpriteX, int SpriteY)
{
+#if NEW_TILESIZE
+#if 0
+ int pseudo_sxsize = SXSIZE * TILESIZE / TILESIZE_VAR;
+ int pseudo_sysize = SYSIZE * TILESIZE / TILESIZE_VAR;
+#endif
+#endif
int scx = (mScrollX_last < 0 ? 0 : mScrollX_last);
int scy = (mScrollY_last < 0 ? 0 : mScrollY_last);
int sx1 = scx - 2 * TILEX;
int sy1 = scy - 2 * TILEY;
+#if NEW_TILESIZE
+#if 1
+ int sx2 = scx + (SCR_FIELDX + 1) * TILEX;
+ int sy2 = scy + (SCR_FIELDY + 1) * TILEY;
+#else
+ int sx2 = scx + pseudo_sxsize + 1 * TILEX;
+ int sy2 = scy + pseudo_sysize + 1 * TILEY;
+#endif
+#else
int sx2 = scx + SXSIZE + 1 * TILEX;
int sy2 = scy + SYSIZE + 1 * TILEY;
-
+#endif
int sx = pX - sx1;
int sy = pY - sy1;
+ int tile_x = sx / TILESIZE;
+ int tile_y = sy / TILESIZE;
+ int move_x = (sx + TILESIZE - 1) / TILESIZE;
+ int move_y = (sy + TILESIZE - 1) / TILESIZE;
if (NoDisplayFlag)
return;
if (pX < sx1 || pX > sx2 || pY < sy1 || pY > sy2)
return;
+#if NEW_TILESIZE
+
+#if 0
+ SpriteX = SpriteX * TILESIZE_VAR / TILESIZE;
+ SpriteY = SpriteY * TILESIZE_VAR / TILESIZE;
+#endif
+
+ sx = sx * TILESIZE_VAR / TILESIZE;
+ sy = sy * TILESIZE_VAR / TILESIZE;
+
+ BlitBitmap(bitmap, bitmap_db_field_sp, SpriteX, SpriteY,
+ TILEX_VAR, TILEY_VAR, sx, sy);
+#else
BlitBitmap(bitmap, bitmap_db_field_sp, SpriteX, SpriteY,
TILEX, TILEY, sx, sy);
+#endif
+
+ redraw[tile_x][tile_y] = TRUE;
+ redraw_tiles++;
+
+ if (move_x != tile_x)
+ {
+ redraw[move_x][tile_y] = TRUE;
+ redraw_tiles++;
+ }
+ else if (move_y != tile_y)
+ {
+ redraw[tile_x][move_y] = TRUE;
+ redraw_tiles++;
+ }
}
void DDSpriteBuffer_BltImg(int pX, int pY, int graphic, int sync_frame)
int ExplosionShake, ExplosionShakeMurphy;
boolean NoDisplayFlag;
-long DisplayMinX, DisplayMaxX;
-long DisplayMinY, DisplayMaxY;
+int DisplayMinX, DisplayMaxX;
+int DisplayMinY, DisplayMaxY;
void subDisplayLevel()
DDScrollBuffer_ScrollTowards(X, Y, 2 * ZoomFactor);
}
-void SoftScrollTo(int X, int Y, long TimeMS, int FPS)
+void SoftScrollTo(int X, int Y, int TimeMS, int FPS)
{
if (NoDisplayFlag)
return;
extern int ExplosionShake, ExplosionShakeMurphy;
extern boolean NoDisplayFlag;
-extern long DisplayMinX, DisplayMaxX;
-extern long DisplayMinY, DisplayMaxY;
+extern int DisplayMinX, DisplayMaxX;
+extern int DisplayMinY, DisplayMaxY;
extern void subDisplayLevel();
extern void ScrollTo(int, int);
extern void ScrollTowards(int, int);
-extern void SoftScrollTo(int, int, long, int);
+extern void SoftScrollTo(int, int, int, int);
#endif /* DISPLAY_H */
void subAnimateExplosion(int si)
{
- int ax, bl, X, Y;
+ int ax, bl;
+#if 0
+ int X, Y;
+#endif
if (LowByte(PlayField16[si]) != fiExplosion)
return;
MovHighByte(&PlayField16[si], bl);
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+#if 0
X = GetStretchX(si);
Y = GetStretchY(si);
+#endif
GfxGraphic[GetX(si)][GetY(si)] = aniDefaultExplosion;
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MovHighByte(&PlayField16[si], bl);
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+#if 0
X = GetStretchX(si);
Y = GetStretchY(si);
+#endif
GfxGraphic[GetX(si)][GetY(si)] = aniElectronExplosion;
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
{
int al;
- if (tsi < (-FieldWidth))
+ if (tsi < -FieldWidth)
return;
al = LowByte(PlayField16[tsi]);
void subClearFieldDueToExplosion(int si)
{
+#if 0
int X, Y;
+#endif
if (LowByte(PlayField16[si]) == fiExplosion)
return;
PlayField16[si] = 0;
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+#if 0
X = GetStretchX(si);
Y = GetStretchY(si);
+#endif
GfxGraphic[GetX(si)][GetY(si)] = aniSpace;
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
}
int FieldHeight; // standard size = 24
int HeaderSize; // standard size = 96
int FieldMax, LevelMax;
-long FileMax;
+#if 0
+int FileMax;
+#endif
#if 1
-int PlayField16[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
-byte PlayField8[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
+int *PlayField16;
+byte *PlayField8;
+// int PlayField16[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
+// byte PlayField8[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
byte DisPlayField[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
#else
int *PlayField16;
int MurphyScreenXPos, MurphyScreenYPos;
int MurphyExplodePos, SplitMoveFlag, RedDiskReleaseMurphyPos;
int KillMurphyFlag, MurphyMoveCounter;
-long YawnSleepCounter;
+int YawnSleepCounter;
int MurphyVarFaceLeft;
int ScratchGravity, GravityFlag;
int RedDiskReleaseFlag, MovingPictureSequencePhase;
void InitGlobals()
{
+ InitPrecedingPlayfieldMemory();
+
AutoScrollFlag = True;
FreezeZonks = 0;
LevelLoaded = False;
bPlaying = False;
menBorder = False;
+ /* add preceding playfield buffer (as large as preceding memory area) */
+ PlayField16 = checked_calloc((game_sp.preceding_buffer_size +
+ SP_MAX_PLAYFIELD_SIZE +
+ SP_HEADER_SIZE) * sizeof(int));
+ PlayField16 = &PlayField16[game_sp.preceding_buffer_size];
+
+ /* add preceding playfield buffer (as large as one playfield row) */
+ PlayField8 = checked_calloc((SP_MAX_PLAYFIELD_WIDTH +
+ SP_MAX_PLAYFIELD_SIZE +
+ SP_HEADER_SIZE) * sizeof(byte));
+ PlayField8 = &PlayField8[SP_MAX_PLAYFIELD_WIDTH];
+
#if 0
/* these defaults will be changed after reading a Supaplex level file */
PlayField8 = REDIM_1D(sizeof(byte), 0, FieldMax);
#define True (!False)
#endif
-#define ScrollDelta ((long)1)
+#define ScrollDelta ((int)1)
+#if NEW_TILESIZE
+// #define ZoomFactor (ZOOM_FACTOR)
#define ZoomFactor (2)
+#else
+#define ZoomFactor (2)
+#endif
#define StretchWidth (ZoomFactor * 16)
#define TwoPixels (ZoomFactor * 2)
{
int Width;
int Height;
- long OffSet;
- long Size;
+ int OffSet;
+ int Size;
} LevelDescriptor;
#define HAS_LevelDescriptor
#endif
extern boolean menBorder;
#if 1
-extern int PlayField16[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
-extern byte PlayField8[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
+extern int *PlayField16;
+extern byte *PlayField8;
+// extern int PlayField16[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
+// extern byte PlayField8[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
extern byte DisPlayField[SP_MAX_PLAYFIELD_SIZE + SP_HEADER_SIZE];
#else
extern int *PlayField16;
extern int TimerVar;
extern short RandomSeed;
-extern long FileMax;
+#if 0
+extern int FileMax;
+#endif
extern LevelInfoType LInfo;
extern int ScrollMinX, ScrollMaxX, ScrollMinY, ScrollMaxY;
extern int ScratchGravity, GravityFlag;
extern int SnikSnaksElectronsFrozen;
extern int YellowDisksExploded;
-extern long YawnSleepCounter;
+extern int YawnSleepCounter;
#endif /* GLOBALS_H */
void SetScrollEdges()
{
+#if NEW_TILESIZE
+#if 0
+ int pseudo_sxsize = SXSIZE * TILESIZE / TILESIZE_VAR;
+ int pseudo_sysize = SYSIZE * TILESIZE / TILESIZE_VAR;
+#endif
+#endif
int border1_offset = (menBorder ? 1 : 2);
int border2_offset = (menBorder ? 0 : TILESIZE / 2);
/* scroll correction for border frame (1 tile) or border element (2 tiles) */
ScrollMinX = 0;
ScrollMinY = 0;
+#if NEW_TILESIZE
+#if 1
+ ScrollMaxX = (DisplayMaxX + border1_offset - SCR_FIELDX) * TILEX;
+ ScrollMaxY = (DisplayMaxY + border1_offset - SCR_FIELDY) * TILEY;
+#else
+ ScrollMaxX = (DisplayMaxX + border1_offset) * TILEX - pseudo_sxsize;
+ ScrollMaxY = (DisplayMaxY + border1_offset) * TILEY - pseudo_sysize;
+#endif
+#else
ScrollMaxX = (DisplayMaxX + border1_offset) * TILEX - SXSIZE;
ScrollMaxY = (DisplayMaxY + border1_offset) * TILEY - SYSIZE;
+#endif
/* scroll correction for border element (half tile on left and right side) */
ScrollMinX += border2_offset;
}
} // loc_g_5E8B:
+#if 0
+ printf("::: RedDiskReleaseFlag == %d\n", RedDiskReleaseFlag);
+#endif
+
bl = DemoKeyCode;
if (bl != 0) // a key was pressed!
goto locKeyPressed5FCF;
int score;
/* needed for engine snapshots */
+ char **preceding_buffer;
int preceding_buffer_size;
int scroll_xoffset, scroll_yoffset;
extern void sp_open_all();
extern void sp_close_all();
+extern void InitPrecedingPlayfieldMemory();
extern void InitGfxBuffers_SP();
extern void InitGameEngine_SP();
extern void GameActions_SP(byte *, boolean);
-extern unsigned int InitEngineRandom_SP(long);
+extern unsigned int InitEngineRandom_SP(int);
extern void setLevelInfoToDefaults_SP();
extern void copyInternalEngineVars_SP();
-extern boolean LoadNativeLevel_SP(char *, int);
+extern boolean LoadNativeLevel_SP(char *, int, boolean);
extern void SaveNativeLevel_SP(char *);
extern void BackToFront_SP(void);
extern int map_key_RND_to_SP(int);
extern int map_key_SP_to_RND(int);
+extern int getRedDiskReleaseFlag_SP();
+
#endif /* GAME_SP_EXPORT_H */
void copyInternalEngineVars_SP()
{
- char *preceding_playfield_memory[] =
- {
- "95 89 95 89 95 89 3b 8a 3b 8a 3b 8a 3b 8a 3b 8a", // |......;.;.;.;.;.|
- "3b 8a 3b 8a 3b 8a e8 8a e8 8a e8 8a e8 8a e8 8a", // |;.;.;.è.è.è.è.è.|
- "e8 8a e8 8a e8 8a b1 8b b1 8b b1 8b b1 8b b1 8b", // |è.è.è.±.±.±.±.±.|
- "b1 8b b1 8b b1 8b 85 8c 85 8c 85 8c 85 8c 85 8c", // |±.±.±...........|
- "85 8c 85 8c 85 8c 5b 8d 5b 8d 5b 8d 5b 8d 5b 8d", // |......[.[.[.[.[.|
- "5b 8d 5b 8d 5b 8d 06 8e 06 8e 06 8e 06 8e 06 8e", // |[.[.[...........|
- "06 8e 06 8e 06 8e ac 8e ac 8e ac 8e ac 8e ac 8e", // |......¬.¬.¬.¬.¬.|
- "ac 8e ac 8e ac 8e 59 8f 59 8f 59 8f 59 8f 59 8f", // |¬.¬.¬.Y.Y.Y.Y.Y.|
- "59 8f 59 8f 59 8f 00 00 70 13 00 00 00 00 e8 17", // |Y.Y.Y...p.....è.|
- "00 00 00 00 00 00 69 38 00 00 00 00 00 00 00 00", // |......i8........|
- "00 00 00 00 00 00 00 00 d0 86 00 00 b2 34 00 00", // |........Ð...²4..|
- "00 00 00 00 00 00 8f 8b 1d 34 00 00 00 00 00 00", // |.........4......|
- "00 00 00 00 23 39 09 09 00 0c 00 08 00 58 00 00", // |....#9.......X..|
- "00 00 00 25 77 06 7f 00 00 00 01 00 00 00 00 00", // |...%w...........|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 ec 06 26 05 00 00 00", // |.........ì.&....|
- "00 00 00 01 00 00 00 00 31 32 33 34 35 36 37 38", // |........12345678|
- "39 30 2d 00 08 00 51 57 45 52 54 59 55 49 4f 50", // |90-...QWERTYUIOP|
- "00 00 0a 00 41 53 44 46 47 48 4a 4b 4c 00 00 00", // |....ASDFGHJKL...|
- "00 00 5a 58 43 56 42 4e 4d 00 00 00 00 00 00 20", // |..ZXCVBNM...... |
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 2e 00 1e 00 31 00 14 00 39 00", // |..........1...9.|
- "1f 00 14 00 18 00 ff ff 01 00 01 4c 45 56 45 4c", // |......ÿÿ...LEVEL|
- "53 2e 44 41 54 00 00 00 00 00 00 00 00 00 00 00", // |S.DAT...........|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
- "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
-
- NULL
- };
- int preceding_buffer_size = 0;
int count;
int i, x, y;
- for (i = 0; preceding_playfield_memory[i] != NULL; i++)
- preceding_buffer_size += 8; /* eight 16-bit integer values */
-
- /* needed for engine snapshots */
- game_sp.preceding_buffer_size = preceding_buffer_size;
-
LInfo = native_sp_level.header;
FieldWidth = native_sp_level.width;
FieldMax = (FieldWidth * FieldHeight) + HeaderSize - 1;
LevelMax = (FieldWidth * FieldHeight) - 1;
+#if 0
/* (add one byte for the level number stored as first byte of demo data) */
FileMax = FieldMax + native_sp_level.demo.length + 1;
+#endif
#if 0
PlayField8 = REDIM_1D(sizeof(byte), 0, FileMax);
DisPlayField = REDIM_1D(sizeof(byte), 0, FieldMax);
- PlayField16 = REDIM_1D(sizeof(int), -preceding_buffer_size, FieldMax);
+ PlayField16 = REDIM_1D(sizeof(int), -game_sp.preceding_buffer_size, FieldMax);
#endif
+ /* initialize preceding playfield buffer */
+ for (i = -game_sp.preceding_buffer_size; i < 0; i++)
+ PlayField16[i] = 0;
+
+ /* initialize preceding playfield buffer */
+ for (i = -SP_MAX_PLAYFIELD_WIDTH; i < 0; i++)
+ PlayField8[i] = 0;
+
count = 0;
- for (i = 0; preceding_playfield_memory[i] != NULL; i++)
+ for (i = 0; game_sp.preceding_buffer[i] != NULL; i++)
{
- char *s = preceding_playfield_memory[i];
+ char *s = game_sp.preceding_buffer[i];
boolean hi_byte = FALSE; /* little endian data => start with low byte */
while (s[0] != '\0' && s[1] != '\0')
if (hi_byte)
byte <<= 8;
- PlayField16[-preceding_buffer_size + count] |= byte;
+ PlayField16[-game_sp.preceding_buffer_size + count] |= byte;
if (hi_byte)
count++;
}
}
-boolean LoadNativeLevel_SP(char *filename, int level_pos)
+boolean LoadNativeLevel_SP(char *filename, int level_pos,
+ boolean level_info_only)
{
FILE *file;
int i, l, x, y;
if (!(file = fopen(filename, MODE_READ)))
{
- Error(ERR_WARN, "cannot open file '%s' -- using empty level", filename);
+ if (!level_info_only)
+ Error(ERR_WARN, "cannot open file '%s' -- using empty level", filename);
return FALSE;
}
#include "global.h"
+char *preceding_playfield_memory[] =
+{
+ "95 89 95 89 95 89 3b 8a 3b 8a 3b 8a 3b 8a 3b 8a", // |......;.;.;.;.;.|
+ "3b 8a 3b 8a 3b 8a e8 8a e8 8a e8 8a e8 8a e8 8a", // |;.;.;.è.è.è.è.è.|
+ "e8 8a e8 8a e8 8a b1 8b b1 8b b1 8b b1 8b b1 8b", // |è.è.è.±.±.±.±.±.|
+ "b1 8b b1 8b b1 8b 85 8c 85 8c 85 8c 85 8c 85 8c", // |±.±.±...........|
+ "85 8c 85 8c 85 8c 5b 8d 5b 8d 5b 8d 5b 8d 5b 8d", // |......[.[.[.[.[.|
+ "5b 8d 5b 8d 5b 8d 06 8e 06 8e 06 8e 06 8e 06 8e", // |[.[.[...........|
+ "06 8e 06 8e 06 8e ac 8e ac 8e ac 8e ac 8e ac 8e", // |......¬.¬.¬.¬.¬.|
+ "ac 8e ac 8e ac 8e 59 8f 59 8f 59 8f 59 8f 59 8f", // |¬.¬.¬.Y.Y.Y.Y.Y.|
+ "59 8f 59 8f 59 8f 00 00 70 13 00 00 00 00 e8 17", // |Y.Y.Y...p.....è.|
+ "00 00 00 00 00 00 69 38 00 00 00 00 00 00 00 00", // |......i8........|
+ "00 00 00 00 00 00 00 00 d0 86 00 00 b2 34 00 00", // |........Ð...²4..|
+ "00 00 00 00 00 00 8f 8b 1d 34 00 00 00 00 00 00", // |.........4......|
+ "00 00 00 00 23 39 09 09 00 0c 00 08 00 58 00 00", // |....#9.......X..|
+ "00 00 00 25 77 06 7f 00 00 00 01 00 00 00 00 00", // |...%w...........|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 ec 06 26 05 00 00 00", // |.........ì.&....|
+ "00 00 00 01 00 00 00 00 31 32 33 34 35 36 37 38", // |........12345678|
+ "39 30 2d 00 08 00 51 57 45 52 54 59 55 49 4f 50", // |90-...QWERTYUIOP|
+ "00 00 0a 00 41 53 44 46 47 48 4a 4b 4c 00 00 00", // |....ASDFGHJKL...|
+ "00 00 5a 58 43 56 42 4e 4d 00 00 00 00 00 00 20", // |..ZXCVBNM...... |
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 2e 00 1e 00 31 00 14 00 39 00", // |..........1...9.|
+ "1f 00 14 00 18 00 ff ff 01 00 01 4c 45 56 45 4c", // |......ÿÿ...LEVEL|
+ "53 2e 44 41 54 00 00 00 00 00 00 00 00 00 00 00", // |S.DAT...........|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+ "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00", // |................|
+
+ NULL
+};
+
+
Bitmap *bitmap_db_field_sp;
struct EngineSnapshotInfo_SP engine_snapshot_sp;
{
}
+void InitPrecedingPlayfieldMemory()
+{
+ int preceding_buffer_size = 0;
+ int i;
+
+ for (i = 0; preceding_playfield_memory[i] != NULL; i++)
+ preceding_buffer_size += 8; /* eight 16-bit integer values */
+
+ game_sp.preceding_buffer = preceding_playfield_memory;
+ game_sp.preceding_buffer_size = preceding_buffer_size;
+}
+
void InitGfxBuffers_SP()
{
ReCreateBitmap(&bitmap_db_field_sp, FXSIZE, FYSIZE, DEFAULT_DEPTH);
}
-unsigned int InitEngineRandom_SP(long seed)
+unsigned int InitEngineRandom_SP(int seed)
{
if (seed == NEW_RANDOMIZE)
{
subRandomize();
- seed = (long)RandomSeed;
+ seed = (int)RandomSeed;
}
RandomSeed = (short)seed;
SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FieldHeight));
SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FieldMax));
SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(LevelMax));
+#if 0
SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(FileMax));
+#endif
SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(TimerVar));
SaveEngineSnapshotBuffer(ARGS_ADDRESS_AND_SIZEOF(RandomSeed));
void DrawGameDoorValues_SP()
{
- game_sp.time_played = TimerVar / setup.game_frame_delay;
+#if 1
+ // game_sp.time_played = TimerVar / FRAMES_PER_SECOND_SP;
+ game_sp.time_played = TimerVar / FRAMES_PER_SECOND;
+#else
+ game_sp.time_played = TimerVar * setup.game_frame_delay / 1000;
+#endif
game_sp.infotrons_still_needed = InfotronsNeeded;
game_sp.red_disk_count = RedDiskCount;
game_sp.score = 0; // (currently no score in Supaplex engine)
+
+#if 0
+ printf("::: %d, %d => %d\n",
+ TimerVar, setup.game_frame_delay, game_sp.time_played);
+#endif
}
void GameActions_SP(byte action[MAX_PLAYERS], boolean warp_mode)
if (!warp_mode) /* do not redraw values in warp mode */
DrawGameDoorValues_SP();
- CheckSingleStepMode_SP(PlayField16[MurphyPosIndex] != fiMurphy);
+ CheckSingleStepMode_SP(PlayField16[MurphyPosIndex] == fiMurphy,
+ HighByte(PlayField16[MurphyPosIndex]) == 0x2A);
for (x = DisplayMinX; x <= DisplayMaxX; x++)
for (y = DisplayMinY; y <= DisplayMaxY; y++)
GfxFrame[x][y]++;
}
+
+int getRedDiskReleaseFlag_SP()
+{
+ return RedDiskReleaseFlag;
+}
/* screen sizes and positions for SP engine */
+#define NEW_TILESIZE 1
+
#define ORIG_TILESIZE 16
+#if NEW_TILESIZE
+#define ZOOM_FACTOR (2 * TILESIZE_VAR / TILESIZE)
+#else
#define ZOOM_FACTOR 2
+#endif
+#if NEW_TILESIZE
+extern int TILESIZE_VAR;
+#define TILESIZE 32
+#define TILEX TILESIZE
+#define TILEY TILESIZE
+#define TILEX_VAR TILESIZE_VAR
+#define TILEY_VAR TILESIZE_VAR
+#else
#define TILESIZE (ORIG_TILESIZE * ZOOM_FACTOR)
#define TILEX TILESIZE
#define TILEY TILESIZE
+#endif
#define ORIG_SCR_MENUX 20
#define ORIG_SCR_MENUY 12
#define SX 8
#define SY 8
#endif
+
+#if NEW_TILESIZE
+#define SXSIZE (SCR_FIELDX * TILEX_VAR)
+#define SYSIZE (SCR_FIELDY * TILEY_VAR)
+#define FXSIZE (MAX_BUF_XSIZE * TILEX_VAR)
+#define FYSIZE (MAX_BUF_YSIZE * TILEY_VAR)
+#else
#define SXSIZE (SCR_FIELDX * TILEX)
#define SYSIZE (SCR_FIELDY * TILEY)
#define FXSIZE (MAX_BUF_XSIZE * TILEX)
#define FYSIZE (MAX_BUF_YSIZE * TILEY)
+#endif
#if 1
extern int REAL_SX, REAL_SY;
}
#endif
-long MyGetTickCount()
+int MyGetTickCount()
{
return random_linux_libc(RANDOM_SIMPLE);
}
extern void *REDIM_1D(int, int, int);
#endif
-extern long MyGetTickCount();
+extern int MyGetTickCount();
#endif /* VB_LIB_H */
#define CONFIG_TOKEN_GLOBAL_BUSY "global.busy"
#define DEBUG_PRINT_INIT_TIMESTAMPS TRUE
-#define DEBUG_PRINT_INIT_TIMESTAMPS_DEPTH 1
+#define DEBUG_PRINT_INIT_TIMESTAMPS_DEPTH 0
static struct FontBitmapInfo font_initial[NUM_INITIAL_FONTS];
{
struct GraphicInfo *graphic_info_last = graphic_info;
int graphic = 0;
- static unsigned long action_delay = 0;
- unsigned long action_delay_value = GameFrameDelay;
+ static unsigned int action_delay = 0;
+ unsigned int action_delay_value = GameFrameDelay;
int sync_frame = FrameCounter;
int x, y;
#if 0
{
- static unsigned long last_counter = -1;
- unsigned long current_counter = Counter();
- unsigned long delay = current_counter - last_counter;
+ static unsigned int last_counter = -1;
+ unsigned int current_counter = Counter();
+ unsigned int delay = current_counter - last_counter;
if (last_counter != -1 && delay > action_delay_value + 5)
printf("::: DrawInitAnim: DELAY TOO LONG: %ld\n", delay);
int height = graphic_info[graphic].height;
int frame = getGraphicAnimationFrame(graphic, sync_frame);
- getGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
+ getFixedGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
BlitBitmap(src_bitmap, window, src_x, src_y, width, height, x, y);
#else
/* !!! this can only draw TILEX/TILEY size animations !!! */
if (swap_movement_tiles_always || swap_movement_tiles_autodetected)
{
/* get current (wrong) backside tile coordinates */
- getGraphicSourceExt(graphic, 0, &dummy, &src_x_back, &src_y_back,
- TRUE);
+ getFixedGraphicSourceExt(graphic, 0, &dummy,
+ &src_x_back, &src_y_back, TRUE);
/* set frontside tile coordinates to backside tile coordinates */
g->src_x = src_x_back;
if (parameter[GFX_ARG_HEIGHT] != ARG_UNDEFINED_VALUE)
g->height = parameter[GFX_ARG_HEIGHT];
+ if (src_bitmap)
+ {
+ if (g->width <= 0)
+ {
+ Error(ERR_INFO_LINE, "-");
+ Error(ERR_WARN, "invalid value %d for '%s.width' (fallback done to %d)",
+ g->width, getTokenFromImageID(graphic), TILEX);
+ Error(ERR_INFO_LINE, "-");
+
+ g->width = TILEX; /* will be checked to be inside bitmap later */
+ }
+
+ if (g->height <= 0)
+ {
+ Error(ERR_INFO_LINE, "-");
+ Error(ERR_WARN, "invalid value %d for '%s.height' (fallback done to %d)",
+ g->height, getTokenFromImageID(graphic), TILEY);
+ Error(ERR_INFO_LINE, "-");
+
+ g->height = TILEY; /* will be checked to be inside bitmap later */
+ }
+ }
+
#if 0
/* optional zoom factor for scaling up the image to a larger size */
if (parameter[GFX_ARG_SCALE_UP_FACTOR] != ARG_UNDEFINED_VALUE)
g->class = parameter[GFX_ARG_CLASS];
if (parameter[GFX_ARG_STYLE] != ARG_UNDEFINED_VALUE)
g->style = parameter[GFX_ARG_STYLE];
+
+ /* this is only used for drawing menu buttons and text */
+ g->active_xoffset = parameter[GFX_ARG_ACTIVE_XOFFSET];
+ g->active_yoffset = parameter[GFX_ARG_ACTIVE_YOFFSET];
+ g->pressed_xoffset = parameter[GFX_ARG_PRESSED_XOFFSET];
+ g->pressed_yoffset = parameter[GFX_ARG_PRESSED_YOFFSET];
}
static void set_graphic_parameters(int graphic)
static boolean clipmasks_initialized = FALSE;
Pixmap src_pixmap;
XGCValues clip_gc_values;
- unsigned long clip_gc_valuemask;
+ unsigned int clip_gc_valuemask;
GC copy_clipmask_gc = None;
#endif
IMG_BACKGROUND_TITLE,
IMG_BACKGROUND_MAIN,
IMG_BACKGROUND_LEVELS,
+ IMG_BACKGROUND_LEVELNR,
IMG_BACKGROUND_SCORES,
IMG_BACKGROUND_EDITOR,
IMG_BACKGROUND_INFO,
IMG_BACKGROUND_INFO_LEVELSET,
IMG_BACKGROUND_SETUP,
IMG_BACKGROUND_DOOR,
+ IMG_BACKGROUND_TAPE,
+ IMG_BACKGROUND_PANEL,
IMG_TITLESCREEN_INITIAL_1,
IMG_TITLESCREEN_INITIAL_2,
/* check if first animation frame is inside specified bitmap */
first_frame = 0;
- getGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
+ getFixedGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
#if 1
/* this avoids calculating wrong start position for out-of-bounds frame */
/* check if last animation frame is inside specified bitmap */
last_frame = graphic_info[i].anim_frames - 1;
- getGraphicSource(i, last_frame, &src_bitmap, &src_x, &src_y);
+ getFixedGraphicSource(i, last_frame, &src_bitmap, &src_x, &src_y);
if (src_x < 0 || src_y < 0 ||
src_x + width > src_bitmap_width ||
Error(ERR_INFO,
"error: last animation frame (%d) out of bounds (%d, %d) [%d, %d]",
last_frame, src_x, src_y, src_bitmap_width, src_bitmap_height);
+ Error(ERR_INFO, "::: %d, %d", width, height);
Error(ERR_INFO, "custom graphic rejected for this element/action");
if (i == fallback_graphic)
#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
/* currently we only need a tile clip mask from the first frame */
- getGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
+ getFixedGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
if (copy_clipmask_gc == None)
{
#endif
}
+static void InitGraphicCompatibilityInfo()
+{
+ struct FileInfo *fi_global_door =
+ getImageListEntryFromImageID(IMG_GLOBAL_DOOR);
+ int num_images = getImageListSize();
+ int i;
+
+ /* the following compatibility handling is needed for the following case:
+ versions up to 3.3.0.0 used one large bitmap "global.door" for various
+ graphics mainly used for door and panel graphics, like editor, tape and
+ in-game buttons with hard-coded bitmap positions and button sizes; as
+ these graphics now have individual definitions, redefining "global.door"
+ to change all these graphics at once like before does not work anymore
+ (because all those individual definitions still have their default values);
+ to solve this, remap all those individual definitions that are not
+ redefined to the new bitmap of "global.door" if it was redefined */
+
+ /* special compatibility handling if image "global.door" was redefined */
+ if (fi_global_door->redefined)
+ {
+ for (i = 0; i < num_images; i++)
+ {
+ struct FileInfo *fi = getImageListEntryFromImageID(i);
+
+ /* process only those images that still use the default settings */
+ if (!fi->redefined)
+ {
+ /* process all images which default to same image as "global.door" */
+ if (strEqual(fi->default_filename, fi_global_door->default_filename))
+ {
+ // printf("::: special treatment needed for token '%s'\n", fi->token);
+
+ graphic_info[i].bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
+ }
+ }
+ }
+ }
+
+#if 0
+ for (i = 0; i < num_images; i++)
+ {
+ struct FileInfo *fi = getImageListEntryFromImageID(i);
+
+ if (i == IMG_GLOBAL_DOOR)
+ {
+ printf("::: %s, %s, %d\n",
+ fi->default_filename,
+ fi->filename,
+ fi->redefined);
+ }
+ }
+#endif
+}
+
static void InitElementSoundInfo()
{
struct PropertyMapping *property_mapping = getSoundListPropertyMapping();
InitGraphicInfo_EM(); /* graphic mapping for EM engine */
print_timestamp_time("InitGraphicInfo_EM");
+ InitGraphicCompatibilityInfo();
+ print_timestamp_time("InitGraphicCompatibilityInfo");
+
SetMainBackgroundImage(IMG_BACKGROUND);
print_timestamp_time("SetMainBackgroundImage");
SetDoorBackgroundImage(IMG_BACKGROUND_DOOR);
global.fading_status = GAME_MODE_MAIN;
global.fading_type = TYPE_ENTER_MENU;
#endif
+
+ global.use_envelope_request = FALSE; /* !!! MOVE TO ARTWORK CONFIG !!! */
}
void Execute_Command(char *command)
InitGfxScrollbufferInfo(FXSIZE, FYSIZE);
InitGfxClipRegion(FALSE, -1, -1, -1, -1);
+ InitGfxBuffers_EM();
InitGfxBuffers_SP();
}
InitSetup();
+ print_timestamp_time("[init setup/config stuff (1)]");
+
InitGameInfo();
+ print_timestamp_time("[init setup/config stuff (2)]");
InitPlayerInfo();
+ print_timestamp_time("[init setup/config stuff (3)]");
InitArtworkInfo(); /* needed before loading gfx, sound & music */
+ print_timestamp_time("[init setup/config stuff (4)]");
InitArtworkConfig(); /* needed before forking sound child process */
+ print_timestamp_time("[init setup/config stuff (5)]");
InitMixer();
+ print_timestamp_time("[init setup/config stuff (6)]");
#if 0
InitCounter();
/* gadget text value */
#if 1
DrawTextBuffer(gi->x + border_x, gi->y + border_y, gi->textarea.value,
- font_nr, gi->textarea.xsize, 0, -1, gi->textarea.ysize,
+ font_nr, gi->textarea.xsize, -1, gi->textarea.ysize, 0,
BLIT_ON_BACKGROUND, FALSE, FALSE, FALSE);
#else
DrawTextToTextArea(gi->x + border_x, gi->y + border_y,
static boolean insideSelectboxLine(struct GadgetInfo *gi, int mx, int my)
{
- return(gi != NULL &&
- gi->type & GD_TYPE_SELECTBOX &&
- mx >= gi->x && mx < gi->x + gi->width &&
- my >= gi->y && my < gi->y + gi->height);
+ return (gi != NULL &&
+ gi->type & GD_TYPE_SELECTBOX &&
+ mx >= gi->x && mx < gi->x + gi->width &&
+ my >= gi->y && my < gi->y + gi->height);
}
static boolean insideSelectboxArea(struct GadgetInfo *gi, int mx, int my)
{
- return(gi != NULL &&
- gi->type & GD_TYPE_SELECTBOX &&
- mx >= gi->selectbox.x && mx < gi->selectbox.x + gi->selectbox.width &&
- my >= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height);
+ return (gi != NULL &&
+ gi->type & GD_TYPE_SELECTBOX &&
+ mx >= gi->selectbox.x && mx < gi->selectbox.x + gi->selectbox.width &&
+ my >= gi->selectbox.y && my < gi->selectbox.y + gi->selectbox.height);
}
void ClickOnGadget(struct GadgetInfo *gi, int button)
boolean HandleGadgets(int mx, int my, int button)
{
- static unsigned long pressed_delay = 0;
- static unsigned long pressed_delay_value = GADGET_FRAME_DELAY;
+ static unsigned int pressed_delay = 0;
+ static unsigned int pressed_delay_value = GADGET_FRAME_DELAY;
static int last_button = 0;
static int last_mx = 0, last_my = 0;
static int pressed_mx = 0, pressed_my = 0;
boolean gadget_dragging;
boolean gadget_released;
boolean gadget_released_inside;
+#if 0
boolean gadget_released_inside_select_line;
+#endif
boolean gadget_released_inside_select_area;
boolean gadget_released_off_borders;
boolean changed_position = FALSE;
/* when handling selectbox, set additional state values */
if (gadget_released_inside && (last_gi->type & GD_TYPE_SELECTBOX))
{
+#if 0
gadget_released_inside_select_line = insideSelectboxLine(last_gi, mx, my);
+#endif
gadget_released_inside_select_area = insideSelectboxArea(last_gi, mx, my);
}
else
{
+#if 0
gadget_released_inside_select_line = FALSE;
+#endif
gadget_released_inside_select_area = FALSE;
}
struct GadgetEvent
{
- unsigned long type; /* event type */
+ unsigned int type; /* event type */
int button; /* button number for button events */
int x, y; /* gadget position at event time */
boolean off_borders; /* mouse pointer outside gadget? */
note: the internal format is big endian */
#define memory_to_value(ptr, len) ( \
-(len) == 1 ? (unsigned long)( *( (byte *)(ptr)) ) : \
-(len) == 2 ? (unsigned long)(((unsigned long)(*( (byte *)(ptr)) ))<< 8) \
- + ( *(((byte *)(ptr))+1) ) : \
-(len) == 3 ? (unsigned long)(((unsigned long)(*( (byte *)(ptr)) ))<<16) \
- + (((unsigned long)(*(((byte *)(ptr))+1)))<< 8) \
- + ( *(((byte *)(ptr))+2) ) : \
- (unsigned long)(((unsigned long)(*( (byte *)(ptr)) ))<<24) \
- + (((unsigned long)(*(((byte *)(ptr))+1)))<<16) \
- + (((unsigned long)(*(((byte *)(ptr))+2)))<< 8) \
- + ( *(((byte *)(ptr))+3) ) )
+(len) == 1 ? (unsigned int)( *( (byte *)(ptr)) ) : \
+(len) == 2 ? (unsigned int)(((unsigned int)(*( (byte *)(ptr)) ))<< 8) \
+ + ( *(((byte *)(ptr))+1) ) : \
+(len) == 3 ? (unsigned int)(((unsigned int)(*( (byte *)(ptr)) ))<<16) \
+ + (((unsigned int)(*(((byte *)(ptr))+1)))<< 8) \
+ + ( *(((byte *)(ptr))+2) ) : \
+ (unsigned int)(((unsigned int)(*( (byte *)(ptr)) ))<<24) \
+ + (((unsigned int)(*(((byte *)(ptr))+1)))<<16) \
+ + (((unsigned int)(*(((byte *)(ptr))+2)))<< 8) \
+ + ( *(((byte *)(ptr))+3) ) )
#define value_to_memory(value, ptr, len) ( \
(len) == 1 ? (*( (byte *)(ptr) ) = ( value ) ) : \
-(len) == 2 ? (*( (byte *)(ptr) ) = (((unsigned long)(value))>> 8), \
+(len) == 2 ? (*( (byte *)(ptr) ) = (((unsigned int)(value))>> 8), \
*(((byte *)(ptr))+1) = ( value ) ) : \
-(len) == 3 ? (*( (byte *)(ptr) ) = (((unsigned long)(value))>>16), \
- *(((byte *)(ptr))+1) = (((unsigned long)(value))>> 8), \
+(len) == 3 ? (*( (byte *)(ptr) ) = (((unsigned int)(value))>>16), \
+ *(((byte *)(ptr))+1) = (((unsigned int)(value))>> 8), \
*(((byte *)(ptr))+2) = ( value ) ) : \
- (*( (byte *)(ptr) ) = (((unsigned long)(value))>>24), \
- *(((byte *)(ptr))+1) = (((unsigned long)(value))>>16), \
- *(((byte *)(ptr))+2) = (((unsigned long)(value))>> 8), \
+ (*( (byte *)(ptr) ) = (((unsigned int)(value))>>24), \
+ *(((byte *)(ptr))+1) = (((unsigned int)(value))>>16), \
+ *(((byte *)(ptr))+2) = (((unsigned int)(value))>> 8), \
*(((byte *)(ptr))+3) = ( value ) ))
static Pixmap Image_to_Mask(Image *image, Display *display, Window window)
#define IMAGETYPE_RGB 1 /* RGB image with colormap */
#define IMAGETYPE_TRUECOLOR 2 /* true-color image */
-#define TRUECOLOR_RED(pixel) (((unsigned long)((pixel) & 0xff0000)) >> 16)
-#define TRUECOLOR_GREEN(pixel) (((unsigned long)((pixel) & 0xff00)) >> 8)
-#define TRUECOLOR_BLUE(pixel) ( (unsigned long)((pixel) & 0xff))
-#define RGB_TO_TRUECOLOR(r,g,b) ((((unsigned long)((r) & 0xff00)) << 8) | ((g) & 0xff00) | (((unsigned short)(b)) >> 8))
+#define TRUECOLOR_RED(pixel) (((unsigned int)((pixel) & 0xff0000)) >> 16)
+#define TRUECOLOR_GREEN(pixel) (((unsigned int)((pixel) & 0xff00)) >> 8)
+#define TRUECOLOR_BLUE(pixel) ( (unsigned int)((pixel) & 0xff))
+#define RGB_TO_TRUECOLOR(r,g,b) ((((unsigned int)((r) & 0xff00)) << 8) | ((g) & 0xff00) | (((unsigned short)(b)) >> 8))
Image *newImage(unsigned int, unsigned int, unsigned int);
void freeImage(Image *);
static int JoystickPositionPercent(int center, int border, int actual)
{
- long range, position;
+ int range, position;
int percent;
if (border < center && actual > center)
/* ------------------------------------------------------------------------- */
#if defined(PLATFORM_MSDOS)
-volatile unsigned long counter = 0;
+volatile unsigned int counter = 0;
void increment_counter()
{
#if 1
#ifdef TARGET_SDL
-static unsigned long getCurrentMS()
+static unsigned int getCurrentMS()
{
return SDL_GetTicks();
}
#else /* !TARGET_SDL */
#if defined(PLATFORM_UNIX)
-static unsigned long getCurrentMS()
+static unsigned int getCurrentMS()
{
struct timeval current_time;
#endif /* PLATFORM_UNIX */
#endif /* !TARGET_SDL */
-static unsigned long mainCounter(int mode)
+static unsigned int mainCounter(int mode)
{
- static unsigned long base_ms = 0;
- unsigned long current_ms;
+ static unsigned int base_ms = 0;
+ unsigned int current_ms;
/* get current system milliseconds */
current_ms = getCurrentMS();
#else
#ifdef TARGET_SDL
-static unsigned long mainCounter(int mode)
+static unsigned int mainCounter(int mode)
{
- static unsigned long base_ms = 0;
- unsigned long current_ms;
- unsigned long counter_ms;
+ static unsigned int base_ms = 0;
+ unsigned int current_ms;
+ unsigned int counter_ms;
current_ms = SDL_GetTicks();
#else /* !TARGET_SDL */
#if defined(PLATFORM_UNIX)
-static unsigned long mainCounter(int mode)
+static unsigned int mainCounter(int mode)
{
static struct timeval base_time = { 0, 0 };
struct timeval current_time;
- unsigned long counter_ms;
+ unsigned int counter_ms;
gettimeofday(¤t_time, NULL);
#endif
}
-unsigned long Counter() /* get milliseconds since last call of InitCounter() */
+unsigned int Counter() /* get milliseconds since last call of InitCounter() */
{
#if !defined(PLATFORM_MSDOS)
return mainCounter(READ_COUNTER);
#endif
}
-static void sleep_milliseconds(unsigned long milliseconds_delay)
+static void sleep_milliseconds(unsigned int milliseconds_delay)
{
boolean do_busy_waiting = (milliseconds_delay < 5 ? TRUE : FALSE);
therefore it's better to do a short interval of busy waiting
to get our sleeping time more accurate */
- unsigned long base_counter = Counter(), actual_counter = Counter();
+ unsigned int base_counter = Counter(), actual_counter = Counter();
while (actual_counter < base_counter + milliseconds_delay &&
actual_counter >= base_counter)
}
}
-void Delay(unsigned long delay) /* Sleep specified number of milliseconds */
+void Delay(unsigned int delay) /* Sleep specified number of milliseconds */
{
sleep_milliseconds(delay);
}
-boolean FrameReached(unsigned long *frame_counter_var,
- unsigned long frame_delay)
+boolean FrameReached(unsigned int *frame_counter_var,
+ unsigned int frame_delay)
{
- unsigned long actual_frame_counter = FrameCounter;
+ unsigned int actual_frame_counter = FrameCounter;
if (actual_frame_counter >= *frame_counter_var &&
actual_frame_counter < *frame_counter_var + frame_delay)
return TRUE;
}
-boolean DelayReached(unsigned long *counter_var,
- unsigned long delay)
+boolean DelayReached(unsigned int *counter_var,
+ unsigned int delay)
{
- unsigned long actual_counter = Counter();
+ unsigned int actual_counter = Counter();
if (actual_counter >= *counter_var &&
actual_counter < *counter_var + delay)
return TRUE;
}
-void WaitUntilDelayReached(unsigned long *counter_var, unsigned long delay)
+void WaitUntilDelayReached(unsigned int *counter_var, unsigned int delay)
{
- unsigned long actual_counter;
+ unsigned int actual_counter;
while (1)
{
/* random generator functions */
/* ------------------------------------------------------------------------- */
-unsigned int init_random_number(int nr, long seed)
+unsigned int init_random_number(int nr, int seed)
{
if (seed == NEW_RANDOMIZE)
{
/* default random seed */
- seed = (long)time(NULL); // seconds since the epoch
+ seed = (int)time(NULL); // seconds since the epoch
#if !defined(PLATFORM_WIN32)
/* add some more randomness */
gettimeofday(¤t_time, NULL);
- seed += (long)current_time.tv_usec; // microseconds since the epoch
+ seed += (int)current_time.tv_usec; // microseconds since the epoch
#endif
#if defined(TARGET_SDL)
/* add some more randomness */
- seed += (long)SDL_GetTicks(); // milliseconds since SDL init
+ seed += (int)SDL_GetTicks(); // milliseconds since SDL init
#endif
#if 1
char *to_ptr = real_name_new;
/* copy the name string, but not more than MAX_USERNAME_LEN characters */
- while (*from_ptr && (long)(to_ptr - real_name_new) < MAX_USERNAME_LEN - 1)
+ while (*from_ptr && (int)(to_ptr - real_name_new) < MAX_USERNAME_LEN - 1)
{
/* the name field read from "passwd" file may also contain additional
user information, separated by commas, which will be removed here */
options.special_flags = getStringCopy(&option[2]);
#else
char *flags_string = &option[2];
- unsigned long flags_value;
+ unsigned int flags_value;
if (*flags_string == '\0')
Error(ERR_EXIT_HELP, "empty flag ignored");
/* checked memory allocation and freeing functions */
/* ------------------------------------------------------------------------- */
-void *checked_malloc(unsigned long size)
+void *checked_malloc(unsigned int size)
{
void *ptr;
return ptr;
}
-void *checked_calloc(unsigned long size)
+void *checked_calloc(unsigned int size)
{
void *ptr;
return ptr;
}
-void *checked_realloc(void *ptr, unsigned long size)
+void *checked_realloc(void *ptr, unsigned int size)
{
ptr = realloc(ptr, size);
free(ptr);
}
-void clear_mem(void *ptr, unsigned long size)
+void clear_mem(void *ptr, unsigned int size)
{
#if defined(PLATFORM_WIN32)
/* for unknown reason, memset() sometimes crashes when compiled with MinGW */
const int chunk_name_length = 4;
/* read chunk name */
- fgets(chunk_name, chunk_name_length + 1, file);
+ if (fgets(chunk_name, chunk_name_length + 1, file) == NULL)
+ return FALSE;
if (chunk_size != NULL)
{
return 4;
}
-void ReadBytesFromFile(FILE *file, byte *buffer, unsigned long bytes)
+void ReadBytesFromFile(FILE *file, byte *buffer, unsigned int bytes)
{
int i;
buffer[i] = fgetc(file);
}
-void WriteBytesToFile(FILE *file, byte *buffer, unsigned long bytes)
+void WriteBytesToFile(FILE *file, byte *buffer, unsigned int bytes)
{
int i;
fputc(buffer[i], file);
}
-void ReadUnusedBytesFromFile(FILE *file, unsigned long bytes)
+void ReadUnusedBytesFromFile(FILE *file, unsigned int bytes)
{
while (bytes-- && !feof(file))
fgetc(file);
}
-void WriteUnusedBytesToFile(FILE *file, unsigned long bytes)
+void WriteUnusedBytesToFile(FILE *file, unsigned int bytes)
{
while (bytes--)
fputc(0, file);
while (translate_key[++i].x11name);
if (!translate_key[i].x11name)
- sprintf(name_buffer, "0x%04lx", (unsigned long)key);
+ sprintf(name_buffer, "0x%04x", (unsigned int)key);
}
*x11name = name_buffer;
}
else if (strPrefix(name_ptr, "0x"))
{
- unsigned long value = 0;
+ unsigned int value = 0;
name_ptr += 2;
counter[counter_nr][0] = Counter_Microseconds();
#else
- static long counter[DEBUG_NUM_TIMESTAMPS][2];
+ static int counter[DEBUG_NUM_TIMESTAMPS][2];
char *unit = "s";
counter[counter_nr][0] = Counter();
boolean getTokenValueFromString(char *, char **, char **);
void InitCounter(void);
-unsigned long Counter(void);
-void Delay(unsigned long);
-boolean FrameReached(unsigned long *, unsigned long);
-boolean DelayReached(unsigned long *, unsigned long);
-void WaitUntilDelayReached(unsigned long *, unsigned long);
+unsigned int Counter(void);
+void Delay(unsigned int);
+boolean FrameReached(unsigned int *, unsigned int);
+boolean DelayReached(unsigned int *, unsigned int);
+void WaitUntilDelayReached(unsigned int *, unsigned int);
-unsigned int init_random_number(int, long);
+unsigned int init_random_number(int, int);
unsigned int get_random_number(int, int);
char *getLoginName(void);
char *GetError(void);
void Error(int, char *, ...);
-void *checked_malloc(unsigned long);
-void *checked_calloc(unsigned long);
-void *checked_realloc(void *, unsigned long);
+void *checked_malloc(unsigned int);
+void *checked_calloc(unsigned int);
+void *checked_realloc(void *, unsigned int);
void checked_free(void *);
-void clear_mem(void *, unsigned long);
+void clear_mem(void *, unsigned int);
void swap_numbers(int *, int *);
void swap_number_pairs(int *, int *, int *, int *);
int getFileVersion(FILE *);
int putFileVersion(FILE *, int);
-void ReadBytesFromFile(FILE *, byte *, unsigned long);
-void WriteBytesToFile(FILE *, byte *, unsigned long);
+void ReadBytesFromFile(FILE *, byte *, unsigned int);
+void WriteBytesToFile(FILE *, byte *, unsigned int);
-void ReadUnusedBytesFromFile(FILE *, unsigned long);
-void WriteUnusedBytesToFile(FILE *, unsigned long);
+void ReadUnusedBytesFromFile(FILE *, unsigned int);
+void WriteUnusedBytesToFile(FILE *, unsigned int);
#define getFile8Bit(f) getFile8BitInteger(f)
#define putFile8Bit(f,x) putFile8BitInteger(f,x)
Window XCreateSimpleWindow(Display *display, Window parent, int x, int y,
unsigned int width, unsigned int height,
- unsigned int border_width, unsigned long border,
- unsigned long background)
+ unsigned int border_width, unsigned int border,
+ unsigned int background)
{
video_bitmap = create_video_bitmap(XRES, YRES);
clear_to_color(video_bitmap, background);
checked_free(data);
}
-GC XCreateGC(Display *display, Drawable d, unsigned long value_mask,
+GC XCreateGC(Display *display, Drawable d, unsigned int value_mask,
XGCValues *values)
{
XGCValues *gcv;
return 0;
}
-void XSetForeground(Display *display, GC gc, unsigned long pixel)
+void XSetForeground(Display *display, GC gc, unsigned int pixel)
{
XGCValues *gcv = (XGCValues *)gc;
#define BlackPixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->black_pixel)
#define WhitePixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->white_pixel)
#define RootWindow(dpy, scr) (ScreenOfDisplay(dpy,scr)->root)
-#define AllPlanes ((unsigned long)~0L)
+#define AllPlanes ((unsigned int)~0L)
#define DefaultVisual(dpy, scr) (NULL)
#define DefaultDepth(dpy, scr) (NULL)
#define XGetPixel(ximage, x, y) \
((*((ximage)->f.get_pixel))((ximage), (x), (y)))
-typedef unsigned long Pixel; /* Index into colormap */
-typedef unsigned long XID;
+typedef unsigned int Pixel; /* Index into colormap */
+typedef unsigned int XID;
typedef XID Window;
typedef XID Drawable;
typedef XID Pixmap;
typedef XID KeySym;
typedef XID GContext;
typedef struct _XDisplay Display;
-typedef long Visual;
-typedef long XVisualInfo;
-typedef long Atom;
+typedef int Visual;
+typedef int XVisualInfo;
+typedef int Atom;
typedef int Status;
typedef int Bool;
typedef int XComposeStatus; /* we don't need the real type */
{
Colormap cmap; /* default color map */
Window root; /* root window id */
- unsigned long white_pixel; /* white pixel value */
- unsigned long black_pixel; /* black pixel value */
+ unsigned int white_pixel; /* white pixel value */
+ unsigned int black_pixel; /* black pixel value */
int x;
int y;
unsigned int width;
{
struct funcs
{
- unsigned long (*get_pixel) (struct _XImage *, int, int);
+ unsigned int (*get_pixel) (struct _XImage *, int, int);
} f;
} XImage;
typedef struct
{
- long flags; /* marks which fields in this structure are defined */
+ int flags; /* marks which fields in this structure are defined */
int width, height; /* should set so old wm's don't mess up */
int min_width, min_height;
int max_width, max_height;
typedef struct
{
- long flags; /* marks which fields in this structure are defined */
+ int flags; /* marks which fields in this structure are defined */
Bool input; /* does this application rely on the window manager to
get keyboard input? */
int initial_state; /* see below */
typedef struct
{
- unsigned long foreground; /* foreground pixel */
- unsigned long background; /* background pixel */
+ unsigned int foreground; /* foreground pixel */
+ unsigned int background; /* background pixel */
Bool graphics_exposures; /* boolean, should exposures be generated */
Pixmap clip_mask; /* bitmap clipping; other calls for rects */
int clip_x_origin; /* x origin for clipping */
int clip_y_origin; /* y origin for clipping */
- unsigned long value_mask;
+ unsigned int value_mask;
int line_width; /* line width */
int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */
int cap_style; /* CapNotLast, CapButt,
Display *XOpenDisplay(char *);
Window XCreateSimpleWindow(Display *, Window, int, int,
unsigned int, unsigned int, unsigned int,
- unsigned long, unsigned long);
+ unsigned int, unsigned int);
Status XStringListToTextProperty(char **, int, XTextProperty *);
void XFree(void *);
-GC XCreateGC(Display *, Drawable, unsigned long, XGCValues *);
+GC XCreateGC(Display *, Drawable, unsigned int, XGCValues *);
void XSetClipMask(Display *, GC, Pixmap);
void XSetClipOrigin(Display *, GC, int, int);
void XFillRectangle(Display *, Drawable, GC, int, int,
int XPending(Display *);
KeySym XLookupKeysym(XKeyEvent *, int);
int XLookupString(XKeyEvent *, char *, int, KeySym *, XComposeStatus *);
-void XSetForeground(Display *, GC, unsigned long);
+void XSetForeground(Display *, GC, unsigned int);
void XDrawLine(Display *, Drawable, GC, int, int, int, int);
void XDestroyImage(XImage *);
void XDestroyWindow(Display *, Window);
position of the rear pointer is just
(MAX_TYPES * (rptr - state)) + TYPE_3 == TYPE_3. */
-static long int randtbl_0[DEG_3 + 1] =
+static int randtbl_0[DEG_3 + 1] =
{
TYPE_3,
-851904987, -43806228, -2029755270, 1390239686, -1912102820,
-607508183, -205999574, -1696891592, 1492211999, -1528267240,
-952028296, -189082757, 362343714, 1424981831, 2039449641,
};
-static long int randtbl_1[DEG_3 + 1] =
+static int randtbl_1[DEG_3 + 1] =
{
TYPE_3,
-851904987, -43806228, -2029755270, 1390239686, -1912102820,
in the initialization of randtbl) because the state table pointer is set
to point to randtbl[1] (as explained below).) */
-static long int *fptr[2] = { &randtbl_0[SEP_3 + 1], &randtbl_1[SEP_3 + 1] };
-static long int *rptr[2] = { &randtbl_0[1], &randtbl_1[1] };
+static int *fptr[2] = { &randtbl_0[SEP_3 + 1], &randtbl_1[SEP_3 + 1] };
+static int *rptr[2] = { &randtbl_0[1], &randtbl_1[1] };
indexing every time to find the address of the last element to see if
the front and rear pointers have wrapped. */
-static long int *state[2] = { &randtbl_0[1], &randtbl_1[1] };
+static int *state[2] = { &randtbl_0[1], &randtbl_1[1] };
static int rand_type[2] = { TYPE_3, TYPE_3 };
static int rand_deg[2] = { DEG_3, DEG_3 };
static int rand_sep[2] = { SEP_3, SEP_3 };
-static long int *end_ptr[2] =
+static int *end_ptr[2] =
{
&randtbl_0[sizeof(randtbl_0) / sizeof(randtbl_0[0])],
&randtbl_1[sizeof(randtbl_1) / sizeof(randtbl_1[0])]
if (rand_type[nr] != TYPE_0)
{
- register long int i;
+ register int i;
for (i = 1; i < rand_deg[nr]; ++i)
state[nr][i] = (1103515145 * state[nr][i - 1]) + 12345;
rear pointers can't wrap on the same call by not testing the rear
pointer if the front one has wrapped. Returns a 31-bit random number. */
-long int random_linux_libc(int nr)
+int random_linux_libc(int nr)
{
if (rand_type[nr] == TYPE_0)
{
- state[nr][0] = ((state[nr][0] * 1103515245) + 12345) & LONG_MAX;
+ state[nr][0] = ((state[nr][0] * 1103515245) + 12345) & INT_MAX;
return state[nr][0];
}
else
{
- long int i;
+ int i;
*fptr[nr] += *rptr[nr];
/* Chucking least random bit. */
- i = (*fptr[nr] >> 1) & LONG_MAX;
+ i = (*fptr[nr] >> 1) & INT_MAX;
fptr[nr]++;
if (fptr[nr] >= end_ptr[nr])
#define RANDOM_H
void srandom_linux_libc(int, unsigned int);
-long int random_linux_libc(int);
+int random_linux_libc(int);
#endif
{
int x, y;
tColorRGBA *sp, *csp, *dp;
- int sgap, dgap;
+#if 0
+ int sgap;
+#endif
+ int dgap;
/* pointer setup */
sp = csp = (tColorRGBA *) src->pixels;
dp = (tColorRGBA *) dst->pixels;
+#if 0
sgap = src->pitch - src->w * 4;
+#endif
dgap = dst->pitch - dst->w * 4;
for (y = 0; y < dst->h; y++)
{
int x, y, sx, sy, *sax, *say, *csax, *csay, csx, csy;
tColorRGBA *sp, *csp, *dp;
- int sgap, dgap;
+#if 0
+ int sgap;
+#endif
+ int dgap;
/* use specialized zoom function when scaling down to exactly half size */
if (src->w == 2 * dst->w &&
/* pointer setup */
sp = csp = (tColorRGBA *) src->pixels;
dp = (tColorRGBA *) dst->pixels;
+#if 0
sgap = src->pitch - src->w * 4;
+#endif
dgap = dst->pitch - dst->w * 4;
csay = say;
return addListEntry(list->next, token, value);
}
+#if 0
#ifdef DEBUG
static void printSetupFileList(SetupFileList *list)
{
printSetupFileList(list->next);
}
#endif
+#endif
#ifdef DEBUG
DEFINE_HASHTABLE_INSERT(insert_hash_entry, char, char);
return ti_copy;
}
-static void freeTreeInfo(TreeInfo *ti)
+void freeTreeInfo(TreeInfo *ti)
{
if (ti == NULL)
return;
char *directory_name)
{
#if 0
- static unsigned long progress_delay = 0;
- unsigned long progress_delay_value = 100; /* (in milliseconds) */
+ static unsigned int progress_delay = 0;
+ unsigned int progress_delay_value = 100; /* (in milliseconds) */
#endif
char *directory_path = getPath2(level_directory, directory_name);
char *filename = getPath2(directory_path, LEVELINFO_FILENAME);
LevelDirTree *level_node)
{
#if 0
- static unsigned long progress_delay = 0;
- unsigned long progress_delay_value = 100; /* (in milliseconds) */
+ static unsigned int progress_delay = 0;
+ unsigned int progress_delay_value = 100; /* (in milliseconds) */
#endif
int type = (*artwork_node)->type;
{
static char *level_directory = NULL;
DIR *dir;
+#if 0
struct dirent *dir_entry;
+#endif
/* check for more levels besides the 'levels' field of 'levelinfo.conf' */
if ((dir = opendir(level_directory)) == NULL)
{
Error(ERR_WARN, "cannot read level directory '%s'", level_directory);
+
return;
}
+#if 0
while ((dir_entry = readdir(dir)) != NULL) /* last directory entry */
{
if (strlen(dir_entry->d_name) > 4 &&
levelnum_value = atoi(levelnum_str);
-#if 0
if (levelnum_value < leveldir_current->first_level)
{
Error(ERR_WARN, "additional level %d found", levelnum_value);
Error(ERR_WARN, "additional level %d found", levelnum_value);
leveldir_current->last_level = levelnum_value;
}
-#endif
}
}
+#endif
closedir(dir);
}
char *filename;
SetupFileHash *level_setup_hash = NULL;
char *level_subdir = leveldir_current->subdir;
+ int i;
/* always start with reliable default values */
level_nr = leveldir_current->first_level;
+ for (i = 0; i < MAX_LEVELS; i++)
+ {
+ LevelStats_setPlayed(i, 0);
+ LevelStats_setSolved(i, 0);
+ }
+
checkSeriesInfo(leveldir_current);
/* ----------------------------------------------------------------------- */
{
char *token_value;
+ /* get last played level in this level set */
+
token_value = getHashEntry(level_setup_hash, TOKEN_STR_LAST_PLAYED_LEVEL);
if (token_value)
level_nr = leveldir_current->last_level;
}
+ /* get handicap level in this level set */
+
token_value = getHashEntry(level_setup_hash, TOKEN_STR_HANDICAP_LEVEL);
if (token_value)
leveldir_current->handicap_level = level_nr;
}
+ /* get number of played and solved levels in this level set */
+
+ BEGIN_HASH_ITERATION(level_setup_hash, itr)
+ {
+ char *token = HASH_ITERATION_TOKEN(itr);
+ char *value = HASH_ITERATION_VALUE(itr);
+
+ if (strlen(token) == 3 &&
+ token[0] >= '0' && token[0] <= '9' &&
+ token[1] >= '0' && token[1] <= '9' &&
+ token[2] >= '0' && token[2] <= '9')
+ {
+ int level_nr = atoi(token);
+
+ if (value != NULL)
+ LevelStats_setPlayed(level_nr, atoi(value)); /* read 1st column */
+
+ value = strchr(value, ' ');
+
+ if (value != NULL)
+ LevelStats_setSolved(level_nr, atoi(value)); /* read 2nd column */
+ }
+ }
+ END_HASH_ITERATION(hash, itr)
+
checkSetupFileHashIdentifier(level_setup_hash, filename,
getCookie("LEVELSETUP"));
char *level_nr_str = int2str(level_nr, 0);
char *handicap_level_str = int2str(leveldir_current->handicap_level, 0);
FILE *file;
+ int i;
/* ----------------------------------------------------------------------- */
/* ~/.<program>/levelsetup/<level series>/levelsetup.conf */
getCookie("LEVELSETUP")));
fprintf(file, "%s\n", getFormattedSetupEntry(TOKEN_STR_LAST_PLAYED_LEVEL,
level_nr_str));
- fprintf(file, "%s\n", getFormattedSetupEntry(TOKEN_STR_HANDICAP_LEVEL,
- handicap_level_str));
+ fprintf(file, "%s\n\n", getFormattedSetupEntry(TOKEN_STR_HANDICAP_LEVEL,
+ handicap_level_str));
+
+ for (i = leveldir_current->first_level; i <= leveldir_current->last_level;
+ i++)
+ {
+ if (LevelStats_getPlayed(i) > 0 ||
+ LevelStats_getSolved(i) > 0)
+ {
+ char token[16];
+ char value[16];
+
+ sprintf(token, "%03d", i);
+ sprintf(value, "%d %d", LevelStats_getPlayed(i), LevelStats_getSolved(i));
+
+ fprintf(file, "%s\n", getFormattedSetupEntry(token, value));
+ }
+ }
fclose(file);
free(filename);
}
+
+int LevelStats_getPlayed(int nr)
+{
+ return (nr >= 0 && nr < MAX_LEVELS ? level_stats[nr].played : 0);
+}
+
+int LevelStats_getSolved(int nr)
+{
+ return (nr >= 0 && nr < MAX_LEVELS ? level_stats[nr].solved : 0);
+}
+
+void LevelStats_setPlayed(int nr, int value)
+{
+ if (nr >= 0 && nr < MAX_LEVELS)
+ level_stats[nr].played = value;
+}
+
+void LevelStats_setSolved(int nr, int value)
+{
+ if (nr >= 0 && nr < MAX_LEVELS)
+ level_stats[nr].solved = value;
+}
+
+void LevelStats_incPlayed(int nr)
+{
+ if (nr >= 0 && nr < MAX_LEVELS)
+ level_stats[nr].played++;
+}
+
+void LevelStats_incSolved(int nr)
+{
+ if (nr >= 0 && nr < MAX_LEVELS)
+ level_stats[nr].solved++;
+}
int (*compare_function)(const void *,
const void *));
void sortTreeInfo(TreeInfo **);
+void freeTreeInfo(TreeInfo *);
char *getHomeDir(void);
char *getCommonDataDir(void);
void LoadLevelSetup_SeriesInfo(void);
void SaveLevelSetup_SeriesInfo(void);
+int LevelStats_getPlayed(int);
+int LevelStats_getSolved(int);
+void LevelStats_setPlayed(int, int);
+void LevelStats_setSolved(int, int);
+void LevelStats_incPlayed(int);
+void LevelStats_incSolved(int);
+
#endif /* MISC_H */
#include <dirent.h>
#include <signal.h>
#include <math.h>
+#include <errno.h>
#include "platform.h"
{
unsigned short compression_code;
unsigned short num_channels;
- unsigned long sample_rate;
- unsigned long bytes_per_second;
+ unsigned int sample_rate;
+ unsigned int bytes_per_second;
unsigned short block_align;
unsigned short bits_per_sample;
};
int type;
int format;
void *data_ptr; /* pointer to first sample (8 or 16 bit) */
- long data_len; /* number of samples, NOT number of bytes */
+ int data_len; /* number of samples, NOT number of bytes */
int num_channels; /* mono: 1 channel, stereo: 2 channels */
};
typedef struct SampleInfo SoundInfo;
int state;
- unsigned long playing_starttime;
- unsigned long playing_pos;
+ unsigned int playing_starttime;
+ unsigned int playing_pos;
int type;
int format;
void *data_ptr; /* pointer to first sample (8 or 16 bit) */
- long data_len; /* number of samples, NOT number of bytes */
+ int data_len; /* number of samples, NOT number of bytes */
int num_channels; /* mono: 1 channel, stereo: 2 channels */
#if defined(TARGET_ALLEGRO)
SoundControl snd_ctrl;
TreeInfo *ti = (type == SND_CTRL_RELOAD_SOUNDS ? artwork.snd_current :
artwork.mus_current);
- unsigned long str_size1 = strlen(leveldir_current->fullpath) + 1;
- unsigned long str_size2 = strlen(leveldir_current->sounds_path) + 1;
- unsigned long str_size3 = strlen(leveldir_current->music_path) + 1;
- unsigned long str_size4 = strlen(ti->basepath) + 1;
- unsigned long str_size5 = strlen(ti->fullpath) + 1;
+ unsigned int str_size1 = strlen(leveldir_current->fullpath) + 1;
+ unsigned int str_size2 = strlen(leveldir_current->sounds_path) + 1;
+ unsigned int str_size3 = strlen(leveldir_current->music_path) + 1;
+ unsigned int str_size4 = strlen(ti->basepath) + 1;
+ unsigned int str_size5 = strlen(ti->fullpath) + 1;
boolean override_level_artwork = (type == SND_CTRL_RELOAD_SOUNDS ?
gfx.override_level_sounds :
gfx.override_level_music);
write(audio.mixer_pipe[1], ti,
sizeof(TreeInfo)) < 0 ||
write(audio.mixer_pipe[1], &str_size1,
- sizeof(unsigned long)) < 0 ||
+ sizeof(unsigned int)) < 0 ||
write(audio.mixer_pipe[1], &str_size2,
- sizeof(unsigned long)) < 0 ||
+ sizeof(unsigned int)) < 0 ||
write(audio.mixer_pipe[1], &str_size3,
- sizeof(unsigned long)) < 0 ||
+ sizeof(unsigned int)) < 0 ||
write(audio.mixer_pipe[1], &str_size4,
- sizeof(unsigned long)) < 0 ||
+ sizeof(unsigned int)) < 0 ||
write(audio.mixer_pipe[1], &str_size5,
- sizeof(unsigned long)) < 0 ||
+ sizeof(unsigned int)) < 0 ||
write(audio.mixer_pipe[1], leveldir_current->fullpath,
str_size1) < 0 ||
write(audio.mixer_pipe[1], leveldir_current->sounds_path,
TreeInfo **ti_ptr = ((snd_ctrl->state & SND_CTRL_RELOAD_SOUNDS) ?
&artwork.snd_current : &artwork.mus_current);
TreeInfo *ti = *ti_ptr;
- unsigned long str_size1, str_size2, str_size3, str_size4, str_size5;
+ unsigned int str_size1, str_size2, str_size3, str_size4, str_size5;
static char *set_identifier = NULL;
boolean *override_level_artwork = (snd_ctrl->state & SND_CTRL_RELOAD_SOUNDS ?
&gfx.override_level_sounds :
read(audio.mixer_pipe[0], ti,
sizeof(TreeInfo)) != sizeof(TreeInfo) ||
read(audio.mixer_pipe[0], &str_size1,
- sizeof(unsigned long)) != sizeof(unsigned long) ||
+ sizeof(unsigned int)) != sizeof(unsigned int) ||
read(audio.mixer_pipe[0], &str_size2,
- sizeof(unsigned long)) != sizeof(unsigned long) ||
+ sizeof(unsigned int)) != sizeof(unsigned int) ||
read(audio.mixer_pipe[0], &str_size3,
- sizeof(unsigned long)) != sizeof(unsigned long) ||
+ sizeof(unsigned int)) != sizeof(unsigned int) ||
read(audio.mixer_pipe[0], &str_size4,
- sizeof(unsigned long)) != sizeof(unsigned long) ||
+ sizeof(unsigned int)) != sizeof(unsigned int) ||
read(audio.mixer_pipe[0], &str_size5,
- sizeof(unsigned long)) != sizeof(unsigned long))
+ sizeof(unsigned int)) != sizeof(unsigned int))
Error(ERR_EXIT_SOUND_SERVER, "broken pipe -- no sounds");
leveldir_current->fullpath = checked_calloc(str_size1);
/* don't play sound more than n times simultaneously (with n == 2 for now) */
if (k >= 2)
{
- unsigned long playing_current = Counter();
+ unsigned int playing_current = Counter();
int longest = 0, longest_nr = audio.first_sound_channel;
/* look for oldest equal sound */
if (mixer_active_channels ==
audio.num_channels - (mixer[audio.music_channel].active ? 0 : 1))
{
- unsigned long playing_current = Counter();
+ unsigned int playing_current = Counter();
int longest = 0, longest_nr = audio.first_sound_channel;
#if 0
/* print some debugging information about audio channel usage */
for (i = audio.first_sound_channel; i < audio.num_channels; i++)
{
- Error(ERR_INFO, "Mixer_InsertSound: %d [%d]: %ld (%ld)",
- i, mixer[i].active, mixer[i].data_len, (long)mixer[i].data_ptr);
+ Error(ERR_INFO, "Mixer_InsertSound: %d [%d]: %d (%d)",
+ i, mixer[i].active, mixer[i].data_len, (int)mixer[i].data_ptr);
}
#endif
#endif
static void Mixer_Main_DSP()
{
static short premix_first_buffer[DEFAULT_AUDIO_FRAGMENT_SIZE];
- static long premix_last_buffer[DEFAULT_AUDIO_FRAGMENT_SIZE];
+ static int premix_last_buffer[DEFAULT_AUDIO_FRAGMENT_SIZE];
static byte playing_buffer[DEFAULT_AUDIO_FRAGMENT_SIZE];
boolean stereo;
int fragment_size;
/* first clear the last premixing buffer */
clear_mem(premix_last_buffer,
- max_sample_size * num_output_channels * sizeof(long));
+ max_sample_size * num_output_channels * sizeof(int));
for (i = 0; i < audio.num_channels; i++)
{
- void *sample_ptr;
+ // void *sample_ptr;
int sample_len;
int sample_pos;
int sample_size;
}
/* pointer, lenght and actual playing position of sound sample */
- sample_ptr = mixer[i].data_ptr;
+ // sample_ptr = mixer[i].data_ptr;
sample_len = mixer[i].data_len;
sample_pos = mixer[i].playing_pos;
sample_size = MIN(max_sample_size, sample_len - sample_pos);
if (mixer[i].volume != SOUND_MAX_VOLUME)
for (j = 0; j < sample_size * num_output_channels; j++)
premix_first_buffer[j] =
- mixer[i].volume * (long)premix_first_buffer[j] / SOUND_MAX_VOLUME;
+ mixer[i].volume * (int)premix_first_buffer[j] / SOUND_MAX_VOLUME;
/* adjust left and right channel volume due to stereo sound position */
if (stereo)
}
/* finally play the sound fragment */
- write(audio.device_fd, playing_buffer, fragment_size);
+ if (write(audio.device_fd, playing_buffer, fragment_size) == -1)
+ Error(ERR_WARN, "write() failed; %s", strerror(errno));
if (!mixer_active_channels)
CloseAudioDevice(&audio.device_fd);
if (mixer[i].volume != SOUND_MAX_VOLUME)
for (j = 0; j < sample_size; j++)
premix_first_buffer[j] =
- mixer[i].volume * (long)premix_first_buffer[j] / SOUND_MAX_VOLUME;
+ mixer[i].volume * (int)premix_first_buffer[j] / SOUND_MAX_VOLUME;
/* might be needed for u-law /dev/audio */
for (j = 0; j < sample_size; j++)
printf("WAV file: '%s'\n", filename);
printf(" Compression code: %d'\n", header.compression_code);
printf(" Number of channels: %d'\n", header.num_channels);
- printf(" Sample rate: %ld'\n", header.sample_rate);
- printf(" Average bytes per second: %ld'\n", header.bytes_per_second);
+ printf(" Sample rate: %d'\n", header.sample_rate);
+ printf(" Average bytes per second: %d'\n", header.bytes_per_second);
printf(" Block align: %d'\n", header.block_align);
printf(" Significant bits per sample: %d'\n", header.bits_per_sample);
#endif
LevelDirTree *leveldir_current = NULL;
int level_nr;
+struct LevelStats level_stats[MAX_LEVELS];
+
Display *display = NULL;
Visual *visual = NULL;
int screen = 0;
gfx.draw_background_mask = draw_background_mask;
}
+#if 0
+
static void DrawBitmapFromTile(Bitmap *bitmap, Bitmap *tile,
int dest_x, int dest_y, int width, int height)
{
}
}
+#else
+
+void SetBackgroundBitmap(Bitmap *background_bitmap_tile, int mask)
+{
+ if (background_bitmap_tile != NULL)
+ gfx.background_bitmap_mask |= mask;
+ else
+ gfx.background_bitmap_mask &= ~mask;
+
+#if 0
+ if (gfx.background_bitmap == NULL)
+ gfx.background_bitmap = CreateBitmap(video.width, video.height,
+ DEFAULT_DEPTH);
+#endif
+
+ if (background_bitmap_tile == NULL) /* empty background requested */
+ return;
+
+ if (mask == REDRAW_ALL)
+ BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap, 0, 0, 0, 0,
+ 0, 0, video.width, video.height);
+ else if (mask == REDRAW_FIELD)
+ BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap, 0, 0, 0, 0,
+ gfx.real_sx, gfx.real_sy, gfx.full_sxsize, gfx.full_sysize);
+ else if (mask == REDRAW_DOOR_1)
+ {
+ BlitBitmapTiled(background_bitmap_tile, gfx.background_bitmap, 0, 0, 0, 0,
+ gfx.dx, gfx.dy, gfx.dxsize, gfx.dysize);
+ }
+}
+
+#endif
+
void SetWindowBackgroundBitmap(Bitmap *background_bitmap_tile)
{
/* remove every mask before setting mask for window */
#endif
#endif
+#if 0
+ if (dst_x < gfx.sx + gfx.sxsize)
+ printf("::: %d: BlitBitmap(%d, %d, %d, %d)\n",
+ FrameCounter, dst_x, dst_y, width, height);
+#endif
+
sysCopyArea(src_bitmap, dst_bitmap,
src_x, src_y, width, height, dst_x, dst_y, BLIT_OPAQUE);
}
+void BlitBitmapTiled(Bitmap *src_bitmap, Bitmap *dst_bitmap,
+ int src_x, int src_y, int src_width, int src_height,
+ int dst_x, int dst_y, int dst_width, int dst_height)
+{
+ int src_xsize = (src_width == 0 ? src_bitmap->width : src_width);
+ int src_ysize = (src_height == 0 ? src_bitmap->height : src_height);
+ int dst_xsize = dst_width;
+ int dst_ysize = dst_height;
+ int src_xsteps = (dst_xsize + src_xsize - 1) / src_xsize;
+ int src_ysteps = (dst_ysize + src_ysize - 1) / src_ysize;
+ int x, y;
+
+ for (y = 0; y < src_ysteps; y++)
+ {
+ for (x = 0; x < src_xsteps; x++)
+ {
+ int draw_x = dst_x + x * src_xsize;
+ int draw_y = dst_y + y * src_ysize;
+ int draw_xsize = MIN(src_xsize, dst_xsize - x * src_xsize);
+ int draw_ysize = MIN(src_ysize, dst_ysize - y * src_ysize);
+
+ BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y, draw_xsize, draw_ysize,
+ draw_x, draw_y);
+ }
+ }
+}
+
void FadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height,
int fade_mode, int fade_delay, int post_delay,
void (*draw_border_function)(void))
int width_4, height_4;
int width_8, height_8;
int width_16, height_16;
+#if 0
int width_32, height_32;
+#endif
int new_width, new_height;
/* calculate new image dimensions for normal sized image */
height_8 = height_1 / 8;
width_16 = width_1 / 16;
height_16 = height_1 / 16;
+#if 0
width_32 = width_1 / 32;
height_32 = height_1 / 32;
+#endif
UPDATE_BUSY_STATE();
#define DEFAULT_KEY_FOCUS_PLAYER_4 KSYM_F8
#define DEFAULT_KEY_FOCUS_PLAYER_ALL KSYM_F9
#define DEFAULT_KEY_TAPE_EJECT KSYM_UNDEFINED
+#define DEFAULT_KEY_TAPE_EXTRA KSYM_UNDEFINED
#define DEFAULT_KEY_TAPE_STOP KSYM_UNDEFINED
#define DEFAULT_KEY_TAPE_PAUSE KSYM_UNDEFINED
#define DEFAULT_KEY_TAPE_RECORD KSYM_UNDEFINED
REDRAW_TILES | \
REDRAW_MICROLEVEL)
#define REDRAW_FPS (1 << 11)
+
+#if defined(TARGET_X11)
+/* on old-style, classic and potentially slow graphics systems, redraw single
+ tiles instead of the whole playfield unless a certain threshold is reached;
+ when using the X11 target, this method should still be fast on all systems */
#define REDRAWTILES_THRESHOLD (SCR_FIELDX * SCR_FIELDY / 2)
+#else
+/* on modern graphics systems and when using the SDL target, this tile redraw
+ optimization can slow things down a lot due to many small blits compared to
+ one single playfield-sized blit (especially observed on Mac OS X with SDL) */
+#define REDRAWTILES_THRESHOLD 0
+#endif
#define IN_GFX_SCREEN(x, y) (x >= gfx.sx && x < gfx.sx + gfx.sxsize && \
y >= gfx.sy && y < gfx.sy + gfx.sysize)
#define GAME_FRAME_DELAY 20 /* frame delay in milliseconds */
#define FFWD_FRAME_DELAY 10 /* 200% speed for fast forward */
#define FRAMES_PER_SECOND (ONE_SECOND_DELAY / GAME_FRAME_DELAY)
+#define FRAMES_PER_SECOND_SP 35
/* maximum playfield size supported by libgame functions */
#define MAX_PLAYFIELD_WIDTH 128
/* maximum allowed length of player name */
#define MAX_PLAYER_NAME_LEN 10
+/* maximum number of levels in a level set */
+#define MAX_LEVELS 1000
+
/* default name for empty highscore entry */
#define EMPTY_PLAYER_NAME "no name"
#define TREE_TYPE_SOUNDS_DIR ARTWORK_TYPE_SOUNDS
#define TREE_TYPE_MUSIC_DIR ARTWORK_TYPE_MUSIC
#define TREE_TYPE_LEVEL_DIR 3
+#define TREE_TYPE_LEVEL_NR 4
-#define NUM_TREE_TYPES 4
+#define NUM_TREE_TYPES 5
#define INFOTEXT_UNDEFINED ""
#define INFOTEXT_GRAPHICS_DIR "Custom Graphics"
#define INFOTEXT_SOUNDS_DIR "Custom Sounds"
#define INFOTEXT_MUSIC_DIR "Custom Music"
#define INFOTEXT_LEVEL_DIR "Level Sets"
+#define INFOTEXT_LEVEL_NR "Levels"
-#define TREE_INFOTEXT(t) ((t) == TREE_TYPE_LEVEL_DIR ? \
+#define TREE_INFOTEXT(t) ((t) == TREE_TYPE_LEVEL_NR ? \
+ INFOTEXT_LEVEL_NR : \
+ (t) == TREE_TYPE_LEVEL_DIR ? \
INFOTEXT_LEVEL_DIR : \
(t) == TREE_TYPE_GRAPHICS_DIR ? \
INFOTEXT_GRAPHICS_DIR : \
Key focus_player_all;
Key tape_eject;
+ Key tape_extra;
Key tape_stop;
Key tape_pause;
Key tape_record;
boolean prefer_aga_graphics;
int game_frame_delay;
boolean sp_show_border_elements;
+ boolean small_game_graphics;
char *graphics_set;
char *sounds_set;
int id;
};
+struct LevelStats
+{
+ int played;
+ int solved;
+};
+
/* ========================================================================= */
/* exported variables */
extern LevelDirTree *leveldir_current;
extern int level_nr;
+extern struct LevelStats level_stats[];
+
extern Display *display;
extern Visual *visual;
extern int screen;
void ReCreateBitmap(Bitmap **, int, int, int);
void FreeBitmap(Bitmap *);
void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int);
+void BlitBitmapTiled(Bitmap *, Bitmap *, int, int, int, int, int, int, int,int);
void FadeRectangle(Bitmap *bitmap, int, int, int, int, int, int, int,
void (*draw_border_function)(void));
void FillRectangle(Bitmap *, int, int, int, int, Pixel);
static void InitFontClipmasks()
{
XGCValues clip_gc_values;
- unsigned long clip_gc_valuemask;
+ unsigned int clip_gc_valuemask;
GC copy_clipmask_gc;
int i, j;
void DrawInitTextExt(char *text, int ypos, int font_nr, boolean force)
{
- static unsigned long progress_delay = 0;
- unsigned long progress_delay_value = 100; /* (in milliseconds) */
+ static unsigned int progress_delay = 0;
+ unsigned int progress_delay_value = 100; /* (in milliseconds) */
UPDATE_BUSY_STATE();
boolean AnimateToon(int toon_nr, boolean restart)
{
- static unsigned long animation_frame_counter = 0;
+ static unsigned int animation_frame_counter = 0;
static int pos_x = 0, pos_y = 0;
static int delta_x = 0, delta_y = 0;
static int frame = 0;
static boolean horiz_move, vert_move;
- static unsigned long anim_delay = 0;
- static unsigned long anim_delay_value = 0;
+ static unsigned int anim_delay = 0;
+ static unsigned int anim_delay_value = 0;
static int width,height;
static int pad_x,pad_y;
static int cut_x,cut_y;
void HandleAnimation(int mode)
{
- static unsigned long animstart_delay = -1;
- static unsigned long animstart_delay_value = 0;
+ static unsigned int animstart_delay = -1;
+ static unsigned int animstart_delay_value = 0;
static boolean anim_running = FALSE;
static boolean anim_restart = TRUE;
static boolean reset_delay = TRUE;
DrawWindow *new_window = CreateBitmapStruct();
unsigned int border_width = 4;
XGCValues gc_values;
- unsigned long gc_valuemask;
+ unsigned int gc_valuemask;
#if !defined(PLATFORM_MSDOS)
XTextProperty windowName, iconName;
Pixmap icon_pixmap, iconmask_pixmap;
XClassHint class_hints;
char *window_name = program.window_title;
char *icon_name = program.window_title;
- long window_event_mask;
+ int window_event_mask;
Atom proto_atom = None, delete_atom = None;
#endif
int screen_width, screen_height;
int win_xpos, win_ypos;
- unsigned long pen_fg = WhitePixel(display, screen);
- unsigned long pen_bg = BlackPixel(display, screen);
+ unsigned int pen_fg = WhitePixel(display, screen);
+ unsigned int pen_bg = BlackPixel(display, screen);
const int width = video.width, height = video.height;
int i;
char *error = "Read_PCX_to_Pixmap(): %s '%s'";
int pcx_err;
XGCValues clip_gc_values;
- unsigned long clip_gc_valuemask;
+ unsigned int clip_gc_valuemask;
pcx_err = Read_PCX_to_Pixmap(display, window->drawable, window->gc, filename,
&new_bitmap->drawable, &new_bitmap->clip_mask);
int key_joystick_mapping = 0;
#if 1
+#if NEW_SCROLL
+boolean redraw[2 + MAX_LEV_FIELDX + 2][2 + MAX_LEV_FIELDY + 2];
+#else
boolean redraw[MAX_LEV_FIELDX + 2][MAX_LEV_FIELDY + 2];
+#endif
#else
boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
#endif
int VX = 566, VY = 400;
int EX = 566, EY = 356;
int dDX, dDY;
+int SXSIZE = 17 * TILEX; /* SCR_FIELDX * TILEX */
+int SYSIZE = 17 * TILEY; /* SCR_FIELDY * TILEY */
+int FULL_SXSIZE = 2 + 17 * TILEX + 2; /* 2 + SXSIZE + 2 */
+int FULL_SYSIZE = 2 + 17 * TILEY + 2; /* 2 + SYSIZE + 2 */
+int TILESIZE_VAR = TILESIZE;
#if 1
int FX, FY;
{ ".TITLE", GFX_SPECIAL_ARG_TITLE, },
{ ".MAIN", GFX_SPECIAL_ARG_MAIN, },
{ ".LEVELS", GFX_SPECIAL_ARG_LEVELS },
+ { ".LEVELNR", GFX_SPECIAL_ARG_LEVELNR },
{ ".SCORES", GFX_SPECIAL_ARG_SCORES, },
{ ".EDITOR", GFX_SPECIAL_ARG_EDITOR, },
{ ".INFO", GFX_SPECIAL_ARG_INFO, },
{ ".SETUP", GFX_SPECIAL_ARG_SETUP, },
{ ".PLAYING", GFX_SPECIAL_ARG_PLAYING, },
{ ".DOOR", GFX_SPECIAL_ARG_DOOR, },
+ { ".TAPE", GFX_SPECIAL_ARG_TAPE, },
{ ".PANEL", GFX_SPECIAL_ARG_PANEL, },
{ ".PREVIEW", GFX_SPECIAL_ARG_PREVIEW, },
{ ".CRUMBLED", GFX_SPECIAL_ARG_CRUMBLED, },
#include "conf_mus.h" /* include auto-generated data structure definitions */
+#define NEW_TILESIZE 1
+#define NEW_SCROLL 1
+
#define IMG_UNDEFINED (-1)
#define IMG_EMPTY IMG_EMPTY_SPACE
#define IMG_SP_EMPTY IMG_EMPTY_SPACE
#define TILESIZE 32
#define TILEX TILESIZE
#define TILEY TILESIZE
+#define TILEX_VAR TILESIZE_VAR
+#define TILEY_VAR TILESIZE_VAR
#define MINI_TILESIZE (TILESIZE / 2)
#define MINI_TILEX MINI_TILESIZE
#define MINI_TILEY MINI_TILESIZE
#define MICRO_TILEY MICRO_TILESIZE
#define MIDPOSX (SCR_FIELDX / 2)
#define MIDPOSY (SCR_FIELDY / 2)
+#if NEW_TILESIZE
+#if NEW_SCROLL
+#if 0
+#define SXSIZE (SCR_FIELDX * TILEX_VAR)
+#define SYSIZE (SCR_FIELDY * TILEY_VAR)
+#endif
+#define FXSIZE ((2 + SCR_FIELDX + 2) * TILEX_VAR)
+#define FYSIZE ((2 + SCR_FIELDY + 2) * TILEY_VAR)
+#else
+#if 0
+#define SXSIZE (SCR_FIELDX * TILEX_VAR)
+#define SYSIZE (SCR_FIELDY * TILEY_VAR)
+#endif
+#define FXSIZE ((SCR_FIELDX + 2) * TILEX_VAR)
+#define FYSIZE ((SCR_FIELDY + 2) * TILEY_VAR)
+#endif
+#else
+#if NEW_SCROLL
+#if 0
#define SXSIZE (SCR_FIELDX * TILEX)
#define SYSIZE (SCR_FIELDY * TILEY)
+#endif
+#define FXSIZE ((2 + SCR_FIELDX + 2) * TILEX)
+#define FYSIZE ((2 + SCR_FIELDY + 2) * TILEY)
+#else
+#if 0
+#define SXSIZE (SCR_FIELDX * TILEX)
+#define SYSIZE (SCR_FIELDY * TILEY)
+#endif
#define FXSIZE ((SCR_FIELDX + 2) * TILEX)
#define FYSIZE ((SCR_FIELDY + 2) * TILEY)
+#endif
+#endif
#define DXSIZE 100
#define DYSIZE 280
#define VXSIZE DXSIZE
#define VYSIZE 100
#define EXSIZE DXSIZE
#define EYSIZE (VYSIZE + 44)
+#if 0
#define FULL_SXSIZE (2 + SXSIZE + 2)
#define FULL_SYSIZE (2 + SYSIZE + 2)
+#endif
#define MICROLEVEL_XSIZE ((STD_LEV_FIELDX + 2) * MICRO_TILEX)
#define MICROLEVEL_YSIZE ((STD_LEV_FIELDY + 2) * MICRO_TILEY)
#define MICROLEVEL_XPOS (SX + (SXSIZE - MICROLEVEL_XSIZE) / 2)
#define GFX_SPECIAL_ARG_TITLE 3
#define GFX_SPECIAL_ARG_MAIN 4
#define GFX_SPECIAL_ARG_LEVELS 5
-#define GFX_SPECIAL_ARG_SCORES 6
-#define GFX_SPECIAL_ARG_EDITOR 7
-#define GFX_SPECIAL_ARG_INFO 8
-#define GFX_SPECIAL_ARG_SETUP 9
-#define GFX_SPECIAL_ARG_PLAYING 10
-#define GFX_SPECIAL_ARG_DOOR 11
-#define GFX_SPECIAL_ARG_PANEL 12
-#define GFX_SPECIAL_ARG_PREVIEW 13
-#define GFX_SPECIAL_ARG_CRUMBLED 14
-
-#define NUM_SPECIAL_GFX_ARGS 15
+#define GFX_SPECIAL_ARG_LEVELNR 6
+#define GFX_SPECIAL_ARG_SCORES 7
+#define GFX_SPECIAL_ARG_EDITOR 8
+#define GFX_SPECIAL_ARG_INFO 9
+#define GFX_SPECIAL_ARG_SETUP 10
+#define GFX_SPECIAL_ARG_PLAYING 11
+#define GFX_SPECIAL_ARG_DOOR 12
+#define GFX_SPECIAL_ARG_TAPE 13
+#define GFX_SPECIAL_ARG_PANEL 14
+#define GFX_SPECIAL_ARG_PREVIEW 15
+#define GFX_SPECIAL_ARG_CRUMBLED 16
+
+#define NUM_SPECIAL_GFX_ARGS 17
/* these additional definitions are currently only used for draw offsets */
#define GFX_SPECIAL_ARG_INFO_MAIN 0
#define GFX_ARG_SORT_PRIORITY 45
#define GFX_ARG_CLASS 46
#define GFX_ARG_STYLE 47
+#define GFX_ARG_ACTIVE_XOFFSET 48
+#define GFX_ARG_ACTIVE_YOFFSET 49
+#define GFX_ARG_PRESSED_XOFFSET 50
+#define GFX_ARG_PRESSED_YOFFSET 51
-#define NUM_GFX_ARGS 48
+#define NUM_GFX_ARGS 52
/* values for sound configuration suffixes */
#define GAME_MODE_TITLE 3
#define GAME_MODE_MAIN 4
#define GAME_MODE_LEVELS 5
-#define GAME_MODE_SCORES 6
-#define GAME_MODE_EDITOR 7
-#define GAME_MODE_INFO 8
-#define GAME_MODE_SETUP 9
-#define GAME_MODE_PLAYING 10
-#define GAME_MODE_PSEUDO_DOOR 11
-#define GAME_MODE_PSEUDO_PANEL 12
-#define GAME_MODE_PSEUDO_PREVIEW 13
-#define GAME_MODE_PSEUDO_CRUMBLED 14
+#define GAME_MODE_LEVELNR 6
+#define GAME_MODE_SCORES 7
+#define GAME_MODE_EDITOR 8
+#define GAME_MODE_INFO 9
+#define GAME_MODE_SETUP 10
+#define GAME_MODE_PLAYING 11
+#define GAME_MODE_PSEUDO_DOOR 12
+#define GAME_MODE_PSEUDO_TAPE 13
+#define GAME_MODE_PSEUDO_PANEL 14
+#define GAME_MODE_PSEUDO_PREVIEW 15
+#define GAME_MODE_PSEUDO_CRUMBLED 16
/* there are no special config file suffixes for these modes */
-#define GAME_MODE_PSEUDO_TYPENAME 15
-#define GAME_MODE_QUIT 16
+#define GAME_MODE_PSEUDO_TYPENAME 17
+#define GAME_MODE_QUIT 18
/* special definitions currently only used for custom artwork configuration */
#define MUSIC_PREFIX_BACKGROUND 0
#define NUM_MUSIC_PREFIXES 1
-#define MAX_LEVELS 1000
/* definitions for demo animation lists */
#define HELPANIM_LIST_NEXT -1
/* program information and versioning definitions */
#define PROGRAM_VERSION_MAJOR 3
#define PROGRAM_VERSION_MINOR 3
-#define PROGRAM_VERSION_PATCH 0
-#define PROGRAM_VERSION_BUILD 1
+#define PROGRAM_VERSION_PATCH 1
+#define PROGRAM_VERSION_BUILD 0
#define PROGRAM_TITLE_STRING "Rocks'n'Diamonds"
#define PROGRAM_AUTHOR_STRING "Holger Schemel"
int fading_status;
int fading_type;
#endif
+
+ boolean use_envelope_request;
};
struct ElementChangeInfo
/* ---------- special element property values ---------- */
- unsigned long properties[NUM_EP_BITFIELDS]; /* element base properties */
+ unsigned int properties[NUM_EP_BITFIELDS]; /* element base properties */
boolean use_gfx_element; /* use custom graphic element */
int gfx_element_initial; /* initial optional custom graphic element */
int class;
int style;
+ int active_xoffset;
+ int active_yoffset;
+ int pressed_xoffset;
+ int pressed_yoffset;
+
boolean use_image_size; /* use image size as default width and height */
#if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
extern int key_joystick_mapping;
#if 1
+#if NEW_SCROLL
+extern boolean redraw[2 + MAX_LEV_FIELDX + 2][2 + MAX_LEV_FIELDY + 2];
+#else
extern boolean redraw[MAX_LEV_FIELDX + 2][MAX_LEV_FIELDY + 2];
+#endif
#else
extern boolean redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
#endif
extern int VX, VY;
extern int EX, EY;
extern int dDX, dDY;
+extern int SXSIZE, SYSIZE;
+extern int FULL_SXSIZE, FULL_SYSIZE;
+extern int TILESIZE_VAR;
extern int FX, FY;
extern int ScrollStepSize;
static int interrupt;
-static unsigned long ServerFrameCounter = 0;
+static unsigned int ServerFrameCounter = 0;
static void addtobuffer(struct NetworkServerPlayerInfo *player,
unsigned char *b, int len)
#if defined(TARGET_SDL)
SDLNet_TCP_Send(player->fd, player->writbuffer, player->nwrite);
#else
- write(player->fd, player->writbuffer, player->nwrite);
+ if (write(player->fd, player->writbuffer, player->nwrite) == -1)
+ Error(ERR_WARN, "write() failed; %s", strerror(errno));
#endif
player->nwrite = 0;
}
setsid();
if (fork())
exit(0);
- chdir("/");
+ if (chdir("/") == -1)
+ Error(ERR_WARN, "chdir() failed; %s", strerror(errno));
/* open a fake stdin, stdout, stderr, just in case */
open("/dev/null", O_RDONLY);
#if defined(TARGET_SDL)
SDLNet_TCP_Send(sfd, writbuffer, nwrite);
#else
- write(sfd, writbuffer, nwrite);
+ if (write(sfd, writbuffer, nwrite) == -1)
+ Error(ERR_WARN, "write() failed; %s", strerror(errno));
#endif
nwrite = 0;
}
void SendToServer_StartPlaying()
{
- unsigned long new_random_seed = InitRND(level.random_seed);
+ unsigned int new_random_seed = InitRND(level.random_seed);
int dummy = 0; /* !!! HAS NO MEANING ANYMORE !!! */
/* the name of the level must be enough */
{
LevelDirTree *new_leveldir;
int new_level_nr;
- int dummy;
- unsigned long new_random_seed;
+ unsigned int new_random_seed;
char *new_leveldir_identifier;
new_level_nr = (buffer[2] << 8) + buffer[3];
- dummy = (buffer[4] << 8) + buffer[5]; /* (obsolete) */
new_random_seed =
(buffer[6] << 24) | (buffer[7] << 16) | (buffer[8] << 8) | (buffer[9]);
new_leveldir_identifier = (char *)&buffer[10];
static void execSetupArtwork(void);
static void HandleChooseTree(int, int, int, int, int, TreeInfo **);
-static void DrawChooseLevel(void);
+static void DrawChooseLevelSet(void);
+static void DrawChooseLevelNr(void);
static void DrawInfoScreen(void);
static void DrawAndFadeInInfoScreen(int);
static void DrawSetupScreen(void);
static TreeInfo *game_speeds = NULL;
static TreeInfo *game_speed_current = NULL;
+static TreeInfo *level_number = NULL;
+static TreeInfo *level_number_current = NULL;
+
static struct
{
int value;
if (pos_text != NULL) /* (x/y may be -1/-1 here) */
{
+#if 1
+ /* calculate size for non-clickable text -- needed for text alignment */
+ boolean calculate_text_size = (pos_button == NULL && text != NULL);
+#else
/* calculate width for non-clickable text -- needed for text alignment */
boolean calculate_text_width = (pos_button == NULL && text != NULL);
+#endif
if (visibleMenuPos(pos_button))
{
pos_text->y = pos_button->y;
}
+#if 1
+ if (pos_text->width == -1 || calculate_text_size)
+ pos_text->width = text_width;
+ if (pos_text->height == -1 || calculate_text_size)
+ pos_text->height = text_height;
+#else
if (pos_text->width == -1 || calculate_text_width)
pos_text->width = text_width;
if (pos_text->height == -1)
pos_text->height = text_height;
+#endif
}
if (pos_input != NULL) /* (x/y may be -1/-1 here) */
int y = mSY + pos->y;
DrawBackgroundForGraphic(x, y, pos->width, pos->height, button_graphic);
- DrawGraphicThruMaskExt(drawto, x, y, button_graphic, 0);
+ DrawFixedGraphicThruMaskExt(drawto, x, y, button_graphic, 0);
}
if (visibleTextPos(pos_text) && text != NULL)
int rect_x = ALIGNED_TEXT_XPOS(rect);
int rect_y = ALIGNED_TEXT_YPOS(rect);
+#if 0
+ printf("::: insideTextPosRect: (%d, %d), (%d, %d) [%d, %d] (%d, %d) => %d\n",
+ x, y, rect_x, rect_y, rect->x, rect->y, rect->width, rect->height,
+ (x >= rect_x && x < rect_x + rect->width &&
+ y >= rect_y && y < rect_y + rect->height));
+#endif
+
return (x >= rect_x && x < rect_x + rect->width &&
y >= rect_y && y < rect_y + rect->height);
}
graphic = BUTTON_ACTIVE(graphic);
DrawBackgroundForGraphic(x, y, TILEX, TILEY, graphic);
- DrawGraphicThruMaskExt(drawto, x, y, graphic, 0);
+ DrawFixedGraphicThruMaskExt(drawto, x, y, graphic, 0);
}
static void initCursor(int ypos, int graphic)
void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
{
- static unsigned long title_delay = 0;
+ static unsigned int title_delay = 0;
static int title_screen_nr = 0;
static int last_sound = -1, last_music = -1;
boolean return_to_main_menu = FALSE;
for (i = 0; main_controls[i].nr != -1; i++)
{
+#if 0
+ printf("::: check click (%d, %d) for %d [%d] ...\n",
+ mx - mSX, my - mSY, i, main_controls[i].nr);
+#endif
+
if (insideMenuPosRect(main_controls[i].pos_button, mx - mSX, my - mSY) ||
insideTextPosRect(main_controls[i].pos_text, mx - mSX, my - mSY) ||
insideTextPosRect(main_controls[i].pos_input, mx - mSX, my - mSY))
{
+#if 0
+ printf("::: inside %d\n", i);
+#endif
+
pos = main_controls[i].nr;
break;
{
HandleMainMenu_SelectLevel(1, dx < 0 ? -1 : +1);
}
+ else if (pos == MAIN_CONTROL_FIRST_LEVEL && !button)
+ {
+ HandleMainMenu_SelectLevel(MAX_LEVELS, -1);
+ }
+ else if (pos == MAIN_CONTROL_LAST_LEVEL && !button)
+ {
+ HandleMainMenu_SelectLevel(MAX_LEVELS, +1);
+ }
+ else if (pos == MAIN_CONTROL_LEVEL_NUMBER && !button)
+ {
+ game_status = GAME_MODE_LEVELNR;
+
+ DrawChooseLevelNr();
+ }
else if (pos >= MAIN_CONTROL_NAME && pos <= MAIN_CONTROL_QUIT)
{
if (button)
gotoTopLevelDir();
#endif
- DrawChooseLevel();
+ DrawChooseLevelSet();
}
}
else if (pos == MAIN_CONTROL_SCORES)
ClearRectangleOnBackground(drawto, xstart, ystart2 + (i - start) * ystep,
TILEX, TILEY);
- DrawGraphicAnimationExt(drawto, xstart, ystart2 + (i - start) * ystep,
- graphic, sync_frame, USE_MASKING);
+ DrawFixedGraphicAnimationExt(drawto, xstart, ystart2 + (i - start) * ystep,
+ graphic, sync_frame, USE_MASKING);
if (init)
DrawInfoScreen_HelpText(element, action, direction, i - start);
void HandleInfoScreen_Elements(int button)
{
- static unsigned long info_delay = 0;
+ static unsigned int info_delay = 0;
static int num_anims;
static int num_pages;
static int page;
char *title_string = NULL;
int yoffset_sets = MENU_TITLE1_YPOS;
int yoffset_setup = 16;
- int yoffset = (ti->type == TREE_TYPE_LEVEL_DIR ? yoffset_sets :
- yoffset_setup);
+ int yoffset = (ti->type == TREE_TYPE_LEVEL_DIR ||
+ ti->type == TREE_TYPE_LEVEL_NR ? yoffset_sets : yoffset_setup);
int last_game_status = game_status; /* save current game status */
title_string = ti->infotext;
int ypos = MENU_TITLE2_YPOS;
int font_nr = FONT_TITLE_2;
+ if (ti->type == TREE_TYPE_LEVEL_NR)
+ DrawTextFCentered(ypos, font_nr, leveldir_current->name);
+
if (ti->type != TREE_TYPE_LEVEL_DIR)
return;
DrawBackgroundForFont(SX, SY + ypos, SXSIZE, getFontHeight(font_nr), font_nr);
+#if 1
+ if (node->parent_link)
+ DrawTextFCentered(ypos, font_nr, "leave \"%s\"",
+ node->node_parent->name);
+ else if (node->level_group)
+ DrawTextFCentered(ypos, font_nr, "enter \"%s\"",
+ node->name);
+ else if (ti->type == TREE_TYPE_LEVEL_DIR)
+ DrawTextFCentered(ypos, font_nr, "%3d %s (%s)",
+ node->levels, (node->levels > 1 ? "levels" : "level"),
+ node->class_desc);
+#else
if (node->parent_link)
DrawTextFCentered(ypos, font_nr, "leave group \"%s\"",
node->class_desc);
else if (ti->type == TREE_TYPE_LEVEL_DIR)
DrawTextFCentered(ypos, font_nr, "%3d levels (%s)",
node->levels, node->class_desc);
+#endif
/* let BackToFront() redraw only what is needed */
redraw_mask = last_redraw_mask | REDRAW_TILES;
}
else
{
+ if (game_status == GAME_MODE_LEVELNR)
+ level_nr = atoi(level_number_current->identifier);
+
game_status = GAME_MODE_MAIN;
DrawMainMenuExt(REDRAW_FIELD, FALSE);
}
else
{
+ if (game_status == GAME_MODE_LEVELNR)
+ level_nr = atoi(level_number_current->identifier);
+
game_status = GAME_MODE_MAIN;
+
DrawMainMenu();
}
}
}
}
-void DrawChooseLevel()
+void DrawChooseLevelSet()
{
SetMainBackgroundImage(IMG_BACKGROUND_LEVELS);
PlayMenuMusic();
}
-void HandleChooseLevel(int mx, int my, int dx, int dy, int button)
+void HandleChooseLevelSet(int mx, int my, int dx, int dy, int button)
{
HandleChooseTree(mx, my, dx, dy, button, &leveldir_current);
DoAnimation();
}
+void DrawChooseLevelNr()
+{
+ int i;
+
+ if (level_number != NULL)
+ {
+ freeTreeInfo(level_number);
+
+ level_number = NULL;
+ }
+
+ for (i = leveldir_current->first_level; i <= leveldir_current->last_level;i++)
+ {
+ TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_LEVEL_NR);
+ char identifier[32], name[32];
+ int value = i;
+
+ /* temporarily load level info to get level name */
+ LoadLevelInfoOnly(i);
+
+ ti->node_top = &level_number;
+ ti->sort_priority = 10000 + value;
+ ti->color = (level.no_valid_file ? FC_BLUE :
+ LevelStats_getSolved(i) ? FC_GREEN :
+ LevelStats_getPlayed(i) ? FC_YELLOW : FC_RED);
+
+ sprintf(identifier, "%d", value);
+ sprintf(name, "%03d: %s", value,
+ (level.no_valid_file ? "(no file)" : level.name));
+
+ setString(&ti->identifier, identifier);
+ setString(&ti->name, name);
+ setString(&ti->name_sorting, name);
+
+ pushTreeInfo(&level_number, ti);
+ }
+
+ /* sort level number values to start with lowest level number */
+ sortTreeInfo(&level_number);
+
+ /* set current level number to current level number */
+ level_number_current =
+ getTreeInfoFromIdentifier(level_number, i_to_a(level_nr));
+
+ /* if that also fails, set current level number to first available level */
+ if (level_number_current == NULL)
+ level_number_current = level_number;
+
+ SetMainBackgroundImage(IMG_BACKGROUND_LEVELNR);
+
+#if 1
+ DrawChooseTree(&level_number_current);
+#else
+ DrawChooseTree(&leveldir_current);
+#endif
+
+ PlayMenuSound();
+ PlayMenuMusic();
+}
+
+void HandleChooseLevelNr(int mx, int my, int dx, int dy, int button)
+{
+#if 1
+ HandleChooseTree(mx, my, dx, dy, button, &level_number_current);
+#else
+ HandleChooseTree(mx, my, dx, dy, button, &leveldir_current);
+#endif
+
+ DoAnimation();
+}
+
void DrawHallOfFame(int highlight_position)
{
UnmapAllGadgets();
{ TYPE_SWITCH, &setup.toons, "Show Toons:" },
{ TYPE_ECS_AGA, &setup.prefer_aga_graphics,"EMC graphics preference:" },
{ TYPE_SWITCH, &setup.sp_show_border_elements,"Supaplex Border Elements:" },
+ { TYPE_SWITCH, &setup.small_game_graphics, "Small Game Graphics:" },
{ TYPE_EMPTY, NULL, "" },
{ TYPE_LEAVE_MENU, execSetupMain, "Back" },
static struct TokenInfo setup_info_shortcuts[] =
{
- { TYPE_ENTER_MENU, execSetupShortcuts1, "Various Keys" },
- { TYPE_ENTER_MENU, execSetupShortcuts2, "Player Focus" },
- { TYPE_ENTER_MENU, execSetupShortcuts3, "Tape Buttons" },
- { TYPE_ENTER_MENU, execSetupShortcuts4, "Sound & Music" },
- { TYPE_ENTER_MENU, execSetupShortcuts5, "TAS Snap Keys" },
+ { TYPE_ENTER_MENU, execSetupShortcuts1, "Various Keys" },
+ { TYPE_ENTER_MENU, execSetupShortcuts2, "Player Focus" },
+ { TYPE_ENTER_MENU, execSetupShortcuts3, "Tape Buttons" },
+ { TYPE_ENTER_MENU, execSetupShortcuts4, "Sound & Music" },
+ { TYPE_ENTER_MENU, execSetupShortcuts5, "TAS Snap Keys" },
{ TYPE_EMPTY, NULL, "" },
{ TYPE_LEAVE_MENU, execSetupMain, "Back" },
static struct TokenInfo setup_info_shortcuts_3[] =
{
- { TYPE_KEYTEXT, NULL, "Tape Eject:", },
+ { TYPE_KEYTEXT, NULL, "Eject Tape:", },
{ TYPE_KEY, &setup.shortcut.tape_eject, "" },
- { TYPE_KEYTEXT, NULL, "Tape Stop:", },
+ { TYPE_KEYTEXT, NULL, "Warp / Single Step:", },
+ { TYPE_KEY, &setup.shortcut.tape_extra, "" },
+ { TYPE_KEYTEXT, NULL, "Stop Tape:", },
{ TYPE_KEY, &setup.shortcut.tape_stop, "" },
- { TYPE_KEYTEXT, NULL, "Tape Pause:", },
+ { TYPE_KEYTEXT, NULL, "Pause / Unpause Tape:",},
{ TYPE_KEY, &setup.shortcut.tape_pause, "" },
- { TYPE_KEYTEXT, NULL, "Tape Record:", },
+ { TYPE_KEYTEXT, NULL, "Record Tape:", },
{ TYPE_KEY, &setup.shortcut.tape_record, "" },
- { TYPE_KEYTEXT, NULL, "Tape Play:", },
+ { TYPE_KEYTEXT, NULL, "Play Tape:", },
{ TYPE_KEY, &setup.shortcut.tape_play, "" },
{ TYPE_EMPTY, NULL, "" },
{ TYPE_LEAVE_MENU, execSetupShortcuts, "Back" },
static struct TokenInfo setup_info_shortcuts_4[] =
{
- { TYPE_KEYTEXT, NULL, "Sound Effects (Normal):", },
+ { TYPE_KEYTEXT, NULL, "Toggle Sound Effects (Normal):", },
{ TYPE_KEY, &setup.shortcut.sound_simple, "" },
- { TYPE_KEYTEXT, NULL, "Sound Effects (Looping):", },
+ { TYPE_KEYTEXT, NULL, "Toggle Sound Effects (Looping):", },
{ TYPE_KEY, &setup.shortcut.sound_loops, "" },
- { TYPE_KEYTEXT, NULL, "Music:", },
+ { TYPE_KEYTEXT, NULL, "Toggle Music:", },
{ TYPE_KEY, &setup.shortcut.sound_music, "" },
{ TYPE_EMPTY, NULL, "" },
{ TYPE_LEAVE_MENU, execSetupShortcuts, "Back" },
int ypos = MENU_SCREEN_START_YPOS + pos;
int startx = mSX + xpos * 32;
int starty = mSY + ypos * 32;
- int font_nr, font_width, font_height;
+ int font_nr, font_width;
+#if 0
+ int font_height;
+#endif
int type = setup_info[pos].type;
void *value = setup_info[pos].value;
char *value_string = getSetupValue(type, value);
starty = mSY + ypos * 32;
font_nr = getSetupValueFont(type, value);
font_width = getFontWidth(font_nr);
+#if 0
font_height = getFontHeight(font_nr);
+#endif
/* downward compatibility correction for Juergen Bonhagen's menu settings */
if (setup_mode != SETUP_MODE_INPUT)
ClearRectangleOnBackground(drawto, mSX + 8 * TILEX, mSY + 2 * TILEY,
TILEX, TILEY);
- DrawGraphicThruMaskExt(drawto, mSX + 8 * TILEX, mSY + 2 * TILEY,
- PLAYER_NR_GFX(IMG_PLAYER_1, player_nr), 0);
+ DrawFixedGraphicThruMaskExt(drawto, mSX + 8 * TILEX, mSY + 2 * TILEY,
+ PLAYER_NR_GFX(IMG_PLAYER_1, player_nr), 0);
if (setup.input[player_nr].use_joystick)
{
{
for (x = 0; x < 3; x++)
{
- DrawGraphic(xpos + x - 1, ypos + y - 1, IMG_MENU_CALIBRATE_BLUE, 0);
+ DrawFixedGraphic(xpos + x - 1, ypos + y - 1, IMG_MENU_CALIBRATE_BLUE, 0);
check[x][y] = FALSE;
}
}
new_joystick_xmiddle = joy_x;
new_joystick_ymiddle = joy_y;
- DrawGraphic(xpos + last_x, ypos + last_y, IMG_MENU_CALIBRATE_RED, 0);
+ DrawFixedGraphic(xpos + last_x, ypos + last_y, IMG_MENU_CALIBRATE_RED, 0);
FadeIn(REDRAW_FIELD);
if (x != last_x || y != last_y)
{
- DrawGraphic(xpos + last_x, ypos + last_y, IMG_MENU_CALIBRATE_YELLOW, 0);
- DrawGraphic(xpos + x, ypos + y, IMG_MENU_CALIBRATE_RED, 0);
+ DrawFixedGraphic(xpos + last_x, ypos + last_y,
+ IMG_MENU_CALIBRATE_YELLOW, 0);
+ DrawFixedGraphic(xpos + x, ypos + y,
+ IMG_MENU_CALIBRATE_RED, 0);
last_x = x;
last_y = y;
static void CreateScreenMenubuttons()
{
struct GadgetInfo *gi;
- unsigned long event_mask;
+ unsigned int event_mask;
int i;
for (i = 0; i < NUM_SCREEN_MENUBUTTONS; i++)
static void CreateScreenScrollbuttons()
{
struct GadgetInfo *gi;
- unsigned long event_mask;
+ unsigned int event_mask;
int i;
/* these values are not constant, but can change at runtime */
int gd_x1, gd_x2, gd_y1, gd_y2;
struct GadgetInfo *gi;
int items_max, items_visible, item_position;
- unsigned long event_mask;
+ unsigned int event_mask;
int num_page_entries = NUM_MENU_ENTRIES_ON_SCREEN;
int id = scrollbar_info[i].gadget_id;
case SCREEN_CTRL_ID_SCROLL_UP:
if (game_status == GAME_MODE_LEVELS)
- HandleChooseLevel(0,0, 0, -1 * SCROLL_LINE, MB_MENU_MARK);
+ HandleChooseLevelSet(0,0, 0, -1 * SCROLL_LINE, MB_MENU_MARK);
+ else if (game_status == GAME_MODE_LEVELNR)
+ HandleChooseLevelNr(0,0, 0, -1 * SCROLL_LINE, MB_MENU_MARK);
else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0,0, 0, -1 * SCROLL_LINE, MB_MENU_MARK);
break;
case SCREEN_CTRL_ID_SCROLL_DOWN:
if (game_status == GAME_MODE_LEVELS)
- HandleChooseLevel(0,0, 0, +1 * SCROLL_LINE, MB_MENU_MARK);
+ HandleChooseLevelSet(0,0, 0, +1 * SCROLL_LINE, MB_MENU_MARK);
+ else if (game_status == GAME_MODE_LEVELNR)
+ HandleChooseLevelNr(0,0, 0, +1 * SCROLL_LINE, MB_MENU_MARK);
else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0,0, 0, +1 * SCROLL_LINE, MB_MENU_MARK);
break;
case SCREEN_CTRL_ID_SCROLL_VERTICAL:
if (game_status == GAME_MODE_LEVELS)
- HandleChooseLevel(0,0, 999,gi->event.item_position,MB_MENU_INITIALIZE);
+ HandleChooseLevelSet(0,0,999,gi->event.item_position,MB_MENU_INITIALIZE);
+ else if (game_status == GAME_MODE_LEVELNR)
+ HandleChooseLevelNr(0,0,999,gi->event.item_position,MB_MENU_INITIALIZE);
else if (game_status == GAME_MODE_SETUP)
HandleSetupScreen(0,0, 999,gi->event.item_position,MB_MENU_INITIALIZE);
break;
void HandleTitleScreen(int, int, int, int, int);
void HandleMainMenu(int, int, int, int, int);
-void HandleChooseLevel(int, int, int, int, int);
+void HandleChooseLevelSet(int, int, int, int, int);
+void HandleChooseLevelNr(int, int, int, int, int);
void HandleHallOfFame(int, int, int, int, int);
void HandleInfoScreen(int, int, int, int, int);
void HandleSetupScreen(int, int, int, int, int);
/* video display functions */
/* ========================================================================= */
-void DrawVideoDisplay(unsigned long state, unsigned long value)
+void DrawVideoDisplay(unsigned int state, unsigned int value)
{
int i, j, k;
static char *monatsname[12] =
"JAN", "FEB", "MAR", "APR", "MAY", "JUN",
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC"
};
+
+#if 0
static struct
{
int gd_x1, gd_y1;
}
},
};
+#endif
+
+#if 1
+ static struct
+ {
+ int graphic;
+ struct Rect *pos;
+ }
+ video_pos[NUM_TAPE_FUNCTIONS][NUM_TAPE_FUNCTION_PARTS] =
+ {
+ {
+ { IMG_TAPE_LABEL_GFX_PLAY, &tape.label.play },
+ { IMG_TAPE_SYMBOL_GFX_PLAY, &tape.symbol.play },
+ },
+ {
+ { IMG_TAPE_LABEL_GFX_RECORD, &tape.label.record },
+ { IMG_TAPE_SYMBOL_GFX_RECORD, &tape.symbol.record },
+ },
+ {
+ { IMG_TAPE_LABEL_GFX_PAUSE, &tape.label.pause },
+ { IMG_TAPE_SYMBOL_GFX_PAUSE, &tape.symbol.pause },
+ },
+ {
+ { IMG_TAPE_LABEL_GFX_DATE, &tape.label.date },
+ { -1, NULL },
+ },
+ {
+ { IMG_TAPE_LABEL_GFX_TIME, &tape.label.time },
+ { -1, NULL },
+ },
+ {
+ { IMG_TAPE_LABEL_GFX_FAST_FORWARD, &tape.label.fast_forward },
+ { IMG_TAPE_SYMBOL_GFX_FAST_FORWARD, &tape.symbol.fast_forward },
+ },
+ {
+ { IMG_TAPE_LABEL_GFX_PAUSE_BEFORE_END, &tape.label.pause_before_end },
+ { IMG_TAPE_SYMBOL_GFX_PAUSE_BEFORE_END, &tape.symbol.pause_before_end },
+ },
+ {
+ { IMG_TAPE_LABEL_GFX_WARP_FORWARD_BLIND, &tape.label.warp_forward_blind},
+ { IMG_TAPE_SYMBOL_GFX_WARP_FORWARD_BLIND, &tape.symbol.warp_forward_blind},
+ },
+ {
+ { IMG_TAPE_LABEL_GFX_WARP_FORWARD, &tape.label.warp_forward },
+ { IMG_TAPE_SYMBOL_GFX_WARP_FORWARD, &tape.symbol.warp_forward },
+ },
+ {
+ { IMG_TAPE_LABEL_GFX_SINGLE_STEP, &tape.label.single_step },
+ { IMG_TAPE_SYMBOL_GFX_SINGLE_STEP, &tape.symbol.single_step },
+ },
+ };
+
+ for (k = 0; k < NUM_TAPE_FUNCTION_STATES; k++) /* on or off states */
+ {
+ for (i = 0; i < NUM_TAPE_FUNCTIONS; i++) /* record, play, ... */
+ {
+ for (j = 0; j < NUM_TAPE_FUNCTION_PARTS; j++) /* label or symbol */
+ {
+ if (video_pos[i][j].graphic == -1 ||
+ video_pos[i][j].pos->x < 0 ||
+ video_pos[i][j].pos->y < 0)
+ continue;
+
+ if (state & (1 << (i * 2 + k)))
+ {
+ struct GraphicInfo *gfx_bg = &graphic_info[IMG_BACKGROUND_TAPE];
+ struct GraphicInfo *gfx = &graphic_info[video_pos[i][j].graphic];
+ struct Rect *pos = video_pos[i][j].pos;
+ Bitmap *gd_bitmap;
+ int gd_x, gd_y;
+ int skip_value =
+ (j == 0 ? VIDEO_DISPLAY_SYMBOL_ONLY : VIDEO_DISPLAY_LABEL_ONLY);
+
+ if (value == skip_value)
+ continue;
+
+ if (k == 1) /* on */
+ {
+ gd_bitmap = gfx->bitmap;
+ gd_x = gfx->src_x;
+ gd_y = gfx->src_y;
+ }
+ else /* off */
+ {
+ gd_bitmap = gfx_bg->bitmap;
+ gd_x = gfx_bg->src_x + pos->x;
+ gd_y = gfx_bg->src_y + pos->y;
+ }
+
+ /* some tape graphics may be undefined -- only draw if defined */
+ if (gd_bitmap != NULL)
+ BlitBitmap(gd_bitmap, drawto, gd_x, gd_y, gfx->width, gfx->height,
+ VX + pos->x, VY + pos->y);
+ }
+ }
+ }
+ }
+
+#else
for (k = 0; k < NUM_TAPE_FUNCTION_STATES; k++) /* on or off states */
{
}
}
}
+#endif
+
+#if 1
+ if (state & VIDEO_STATE_DATE_ON)
+ {
+ struct TextPosInfo *pos = &tape.text.date;
+ int tag = value % 100;
+ int monat = (value/100) % 100;
+ int jahr = (value/10000);
+
+ DrawText(VX + pos->x, VY + pos->y, int2str(tag, 2), pos->font);
+ DrawText(VX + pos->x + 27, VY + pos->y, monatsname[monat], pos->font);
+ DrawText(VX + pos->x + 64, VY + pos->y, int2str(jahr, 2), pos->font);
+ }
+
+ if (state & VIDEO_STATE_TIME_ON)
+ {
+ struct TextPosInfo *pos = &tape.text.time;
+ int min = value / 60;
+ int sec = value % 60;
+
+ DrawText(VX + pos->x, VY + pos->y, int2str(min, 2), pos->font);
+ DrawText(VX + pos->x + 27, VY + pos->y, int2str(sec, 2), pos->font);
+ }
+
+#else
if (state & VIDEO_STATE_DATE_ON)
{
DrawText(VX + VIDEO_TIME_XPOS + 27, VY + VIDEO_TIME_YPOS,
int2str(sec, 2), FONT_TAPE_RECORDER);
}
+#endif
redraw_mask |= REDRAW_DOOR_2;
}
InitRND(tape.random_seed);
}
-static void TapeSetRandomSeed(long random_seed)
+static void TapeSetRandomSeed(int random_seed)
{
tape.random_seed = InitRND(random_seed);
}
-void TapeStartRecording(long random_seed)
+void TapeStartRecording(int random_seed)
{
if (!TAPE_IS_STOPPED(tape))
TapeStop();
static int num_levels_solved = 0;
static int num_tape_missing = 0;
static boolean level_failed[MAX_TAPES_PER_SET];
+#if 0
static boolean tape_missing[MAX_TAPES_PER_SET];
+#endif
int i;
if (autoplay_initialized)
for (i = 0; i < MAX_TAPES_PER_SET; i++)
{
level_failed[i] = FALSE;
+#if 0
tape_missing[i] = FALSE;
+#endif
}
autoplay_initialized = TRUE;
if (tape.no_valid_file)
{
num_tape_missing++;
+#if 0
if (level_nr >= 0 && level_nr < MAX_TAPES_PER_SET)
tape_missing[level_nr] = TRUE;
+#endif
printf("(no tape)\n");
continue;
/* ---------- new tape button stuff ---------------------------------------- */
-/* graphic position values for tape buttons */
-#define TAPE_BUTTON_XSIZE 18
-#define TAPE_BUTTON_YSIZE 18
-#define TAPE_BUTTON_XPOS 5
-#define TAPE_BUTTON_YPOS 77
-
-#define TAPE_BUTTON_EJECT_XPOS (TAPE_BUTTON_XPOS + 0 * TAPE_BUTTON_XSIZE)
-#define TAPE_BUTTON_EXTRA_XPOS (TAPE_BUTTON_XPOS + 0 * TAPE_BUTTON_XSIZE)
-#define TAPE_BUTTON_STOP_XPOS (TAPE_BUTTON_XPOS + 1 * TAPE_BUTTON_XSIZE)
-#define TAPE_BUTTON_PAUSE_XPOS (TAPE_BUTTON_XPOS + 2 * TAPE_BUTTON_XSIZE)
-#define TAPE_BUTTON_RECORD_XPOS (TAPE_BUTTON_XPOS + 3 * TAPE_BUTTON_XSIZE)
-#define TAPE_BUTTON_PLAY_XPOS (TAPE_BUTTON_XPOS + 4 * TAPE_BUTTON_XSIZE)
-
static struct
{
- int x, y;
+ int graphic;
+ struct Rect *pos;
int gadget_id;
char *infotext;
} tapebutton_info[NUM_TAPE_BUTTONS] =
{
{
- TAPE_BUTTON_EJECT_XPOS, TAPE_BUTTON_YPOS,
- TAPE_CTRL_ID_EJECT,
- "eject tape"
+ IMG_TAPE_BUTTON_GFX_EJECT, &tape.button.eject,
+ TAPE_CTRL_ID_EJECT, "eject tape"
},
{
- TAPE_BUTTON_EXTRA_XPOS, TAPE_BUTTON_YPOS,
- TAPE_CTRL_ID_EXTRA,
- "extra functions"
+ /* (same position as "eject" button) */
+ IMG_TAPE_BUTTON_GFX_EXTRA, &tape.button.eject,
+ TAPE_CTRL_ID_EXTRA, "extra functions"
},
{
- TAPE_BUTTON_STOP_XPOS, TAPE_BUTTON_YPOS,
- TAPE_CTRL_ID_STOP,
- "stop tape"
+ IMG_TAPE_BUTTON_GFX_STOP, &tape.button.stop,
+ TAPE_CTRL_ID_STOP, "stop tape"
},
{
- TAPE_BUTTON_PAUSE_XPOS, TAPE_BUTTON_YPOS,
- TAPE_CTRL_ID_PAUSE,
- "pause tape"
+ IMG_TAPE_BUTTON_GFX_PAUSE, &tape.button.pause,
+ TAPE_CTRL_ID_PAUSE, "pause tape"
},
{
- TAPE_BUTTON_RECORD_XPOS, TAPE_BUTTON_YPOS,
- TAPE_CTRL_ID_RECORD,
- "record tape"
+ IMG_TAPE_BUTTON_GFX_RECORD, &tape.button.record,
+ TAPE_CTRL_ID_RECORD, "record tape"
},
{
- TAPE_BUTTON_PLAY_XPOS, TAPE_BUTTON_YPOS,
- TAPE_CTRL_ID_PLAY,
- "play tape"
+ IMG_TAPE_BUTTON_GFX_PLAY, &tape.button.play,
+ TAPE_CTRL_ID_PLAY, "play tape"
}
};
for (i = 0; i < NUM_TAPE_BUTTONS; i++)
{
- Bitmap *gd_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap;
+ struct GraphicInfo *gfx = &graphic_info[tapebutton_info[i].graphic];
+ struct Rect *pos = tapebutton_info[i].pos;
struct GadgetInfo *gi;
- int gd_xoffset, gd_yoffset;
- int gd_x1, gd_x2, gd_y;
+ int gd_x = gfx->src_x;
+ int gd_y = gfx->src_y;
+ int gd_xp = gfx->src_x + gfx->pressed_xoffset;
+ int gd_yp = gfx->src_y + gfx->pressed_yoffset;
int id = i;
- gd_xoffset = tapebutton_info[i].x;
- gd_yoffset = tapebutton_info[i].y;
- gd_x1 = DOOR_GFX_PAGEX4 + gd_xoffset;
- gd_x2 = DOOR_GFX_PAGEX3 + gd_xoffset;
- gd_y = DOOR_GFX_PAGEY2 + gd_yoffset;
-
- if (i == TAPE_CTRL_ID_EXTRA)
- {
- gd_x1 = DOOR_GFX_PAGEX6 + gd_xoffset;
- gd_x2 = DOOR_GFX_PAGEX5 + gd_xoffset;
- }
-
gi = CreateGadget(GDI_CUSTOM_ID, id,
GDI_INFO_TEXT, tapebutton_info[i].infotext,
- GDI_X, VX + gd_xoffset,
- GDI_Y, VY + gd_yoffset,
- GDI_WIDTH, TAPE_BUTTON_XSIZE,
- GDI_HEIGHT, TAPE_BUTTON_YSIZE,
+ GDI_X, VX + pos->x,
+ GDI_Y, VY + pos->y,
+ GDI_WIDTH, gfx->width,
+ GDI_HEIGHT, gfx->height,
GDI_TYPE, GD_TYPE_NORMAL_BUTTON,
GDI_STATE, GD_BUTTON_UNPRESSED,
- GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y,
- GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y,
+ GDI_DESIGN_UNPRESSED, gfx->bitmap, gd_x, gd_y,
+ GDI_DESIGN_PRESSED, gfx->bitmap, gd_xp, gd_yp,
GDI_DIRECT_DRAW, FALSE,
GDI_EVENT_MASK, GD_EVENT_RELEASED,
GDI_CALLBACK_ACTION, HandleTapeButtons,
void HandleTapeButtonKeys(Key key)
{
- boolean use_extra = (tape.recording || tape.playing);
+ boolean eject_button_is_active = TAPE_IS_STOPPED(tape);
+ boolean extra_button_is_active = !eject_button_is_active;
- if (key == setup.shortcut.tape_eject)
- HandleTapeButtonsExt(use_extra ? TAPE_CTRL_ID_EXTRA : TAPE_CTRL_ID_EJECT);
+ if (key == setup.shortcut.tape_eject && eject_button_is_active)
+ HandleTapeButtonsExt(TAPE_CTRL_ID_EJECT);
+ else if (key == setup.shortcut.tape_extra && extra_button_is_active)
+ HandleTapeButtonsExt(TAPE_CTRL_ID_EXTRA);
else if (key == setup.shortcut.tape_stop)
HandleTapeButtonsExt(TAPE_CTRL_ID_STOP);
else if (key == setup.shortcut.tape_pause)
#define VIDEO_DISPLAY_SYMBOL_ONLY -2
+struct TapeButtonInfo
+{
+ struct Rect eject;
+ struct Rect stop;
+ struct Rect pause;
+ struct Rect record;
+ struct Rect play;
+};
+
+struct TapeSymbolInfo
+{
+ struct Rect eject;
+ struct Rect stop;
+ struct Rect pause;
+ struct Rect record;
+ struct Rect play;
+ struct Rect fast_forward;
+ struct Rect warp_forward;
+ struct Rect warp_forward_blind;
+ struct Rect pause_before_end;
+ struct Rect single_step;
+};
+
+struct TapeLabelInfo
+{
+ struct Rect eject;
+ struct Rect stop;
+ struct Rect pause;
+ struct Rect record;
+ struct Rect play;
+ struct Rect fast_forward;
+ struct Rect warp_forward;
+ struct Rect warp_forward_blind;
+ struct Rect pause_before_end;
+ struct Rect single_step;
+ struct Rect date;
+ struct Rect time;
+};
+
+struct TapeTextInfo
+{
+ struct TextPosInfo date;
+ struct TextPosInfo time;
+};
+
struct TapeInfo
{
int file_version; /* file format version the tape is stored with */
char *level_identifier;
int level_nr;
- unsigned long random_seed;
- unsigned long date;
- unsigned long counter;
- unsigned long length;
- unsigned long length_seconds;
+ unsigned int random_seed;
+ unsigned int date;
+ unsigned int counter;
+ unsigned int length;
+ unsigned int length_seconds;
unsigned int delay_played;
boolean pause_before_death;
boolean recording, playing, pausing;
byte delay;
} pos[MAX_TAPE_LEN];
+ struct TapeButtonInfo button;
+ struct TapeSymbolInfo symbol;
+ struct TapeLabelInfo label;
+ struct TapeTextInfo text;
+
boolean no_valid_file; /* set when tape file missing or invalid */
};
-void DrawVideoDisplay(unsigned long, unsigned long);
+void DrawVideoDisplay(unsigned int, unsigned int);
void DrawCompleteVideoDisplay(void);
void TapeDeactivateDisplayOn();
void TapeSetDateFromEpochSeconds(time_t);
void TapeSetDateFromNow();
-void TapeStartRecording(long);
+void TapeStartRecording(int);
void TapeHaltRecording(void);
void TapeStopRecording(void);
void TapeRecordAction(byte *);
{
if (mode == DRAW_BUFFERED && setup.soft_scrolling)
{
+#if NEW_TILESIZE
+#if NEW_SCROLL
+ FX = 2 * TILEX_VAR;
+ FY = 2 * TILEY_VAR;
+ BX1 = -2;
+ BY1 = -2;
+ BX2 = SCR_FIELDX + 1;
+ BY2 = SCR_FIELDY + 1;
+ redraw_x1 = 2;
+ redraw_y1 = 2;
+#else
+ FX = TILEX_VAR;
+ FY = TILEY_VAR;
+ BX1 = -1;
+ BY1 = -1;
+ BX2 = SCR_FIELDX;
+ BY2 = SCR_FIELDY;
+ redraw_x1 = 1;
+ redraw_y1 = 1;
+#endif
+#else
+#if NEW_SCROLL
+ FX = 2 * TILEX;
+ FY = 2 * TILEY;
+ BX1 = -2;
+ BY1 = -2;
+ BX2 = SCR_FIELDX + 1;
+ BY2 = SCR_FIELDY + 1;
+ redraw_x1 = 2;
+ redraw_y1 = 2;
+#else
FX = TILEX;
FY = TILEY;
BX1 = -1;
BY2 = SCR_FIELDY;
redraw_x1 = 1;
redraw_y1 = 1;
+#endif
+#endif
drawto_field = fieldbuffer;
}
effectiveGameStatus() == GAME_MODE_TITLE)
return;
+ /* never draw masked screen borders when displaying request outside door */
+ if (effectiveGameStatus() == GAME_MODE_PSEUDO_DOOR &&
+ global.use_envelope_request)
+ return;
+
if (redraw_mask & REDRAW_ALL)
DrawMaskedBorder_ALL();
else
}
}
+void BlitScreenToBitmap(Bitmap *target_bitmap)
+{
+ DrawBuffer *buffer = (drawto_field == window ? backbuffer : drawto_field);
+ int fx = FX, fy = FY;
+
+#if NEW_TILESIZE
+ int dx = (ScreenMovDir & (MV_LEFT | MV_RIGHT) ? ScreenGfxPos : 0);
+ int dy = (ScreenMovDir & (MV_UP | MV_DOWN) ? ScreenGfxPos : 0);
+ int dx_var = dx * TILESIZE_VAR / TILESIZE;
+ int dy_var = dy * TILESIZE_VAR / TILESIZE;
+ int ffx, ffy;
+
+ // fx += dx * TILESIZE_VAR / TILESIZE;
+ // fy += dy * TILESIZE_VAR / TILESIZE;
+#else
+ fx += (ScreenMovDir & (MV_LEFT | MV_RIGHT) ? ScreenGfxPos : 0);
+ fy += (ScreenMovDir & (MV_UP | MV_DOWN) ? ScreenGfxPos : 0);
+#endif
+
+ ffx = (scroll_x - SBX_Left) * TILEX_VAR + dx_var;
+ ffy = (scroll_y - SBY_Upper) * TILEY_VAR + dy_var;
+
+ if (EVEN(SCR_FIELDX))
+ {
+ if (ffx < SBX_Right * TILEX_VAR + TILEX_VAR / 2 + TILEX_VAR)
+ fx += dx_var - MIN(ffx, TILEX_VAR / 2) + TILEX_VAR;
+ else
+ fx += (dx_var > 0 ? TILEX_VAR : 0);
+ }
+ else
+ {
+ fx += dx_var;
+ }
+
+ if (EVEN(SCR_FIELDY))
+ {
+ if (ffy < SBY_Lower * TILEY_VAR + TILEY_VAR / 2 + TILEY_VAR)
+ fy += dy_var - MIN(ffy, TILEY_VAR / 2) + TILEY_VAR;
+ else
+ fy += (dy_var > 0 ? TILEY_VAR : 0);
+ }
+ else
+ {
+ fy += dy_var;
+ }
+
+#if 0
+ printf("::: (%d, %d) [(%d / %d, %d / %d)] => %d, %d\n",
+ scroll_x, scroll_y,
+ SBX_Left, SBX_Right,
+ SBY_Upper, SBY_Lower,
+ fx, fy);
+#endif
+
+ if (border.draw_masked[GAME_MODE_PLAYING])
+ {
+ if (buffer != backbuffer)
+ {
+ /* copy playfield buffer to backbuffer to add masked border */
+ BlitBitmap(buffer, backbuffer, fx, fy, SXSIZE, SYSIZE, SX, SY);
+ DrawMaskedBorder(REDRAW_FIELD);
+ }
+
+ BlitBitmap(backbuffer, target_bitmap,
+ REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE,
+ REAL_SX, REAL_SY);
+ }
+ else
+ {
+ BlitBitmap(buffer, target_bitmap, fx, fy, SXSIZE, SYSIZE, SX, SY);
+ }
+}
+
void BackToFront()
{
int x, y;
if (redraw_mask & REDRAW_TILES && redraw_tiles > REDRAWTILES_THRESHOLD)
redraw_mask |= REDRAW_FIELD;
+#if 0
+ // never redraw single tiles, always redraw the whole field
+ // (redrawing single tiles up to a certain threshold was faster on old,
+ // now legacy graphics, but slows things down on modern graphics now)
+ // UPDATE: this is now globally defined by value of REDRAWTILES_THRESHOLD
+ if (redraw_mask & REDRAW_TILES)
+ redraw_mask |= REDRAW_FIELD;
+#endif
+
+#if 0
+ /* !!! TEST ONLY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+ /* (force full redraw) */
+ if (game_status == GAME_MODE_PLAYING)
+ redraw_mask |= REDRAW_FIELD;
+#endif
+
if (redraw_mask & REDRAW_FIELD)
redraw_mask &= ~REDRAW_TILES;
if (redraw_mask == REDRAW_NONE)
return;
+#if 0
+ printf("::: ");
+ if (redraw_mask & REDRAW_ALL)
+ printf("[REDRAW_ALL]");
+ if (redraw_mask & REDRAW_FIELD)
+ printf("[REDRAW_FIELD]");
+ if (redraw_mask & REDRAW_TILES)
+ printf("[REDRAW_TILES]");
+ if (redraw_mask & REDRAW_DOOR_1)
+ printf("[REDRAW_DOOR_1]");
+ if (redraw_mask & REDRAW_DOOR_2)
+ printf("[REDRAW_DOOR_2]");
+ if (redraw_mask & REDRAW_FROM_BACKBUFFER)
+ printf("[REDRAW_FROM_BACKBUFFER]");
+ printf(" [%d]\n", FrameCounter);
+#endif
+
if (redraw_mask & REDRAW_TILES &&
game_status == GAME_MODE_PLAYING &&
border.draw_masked[GAME_MODE_PLAYING])
SyncDisplay();
- /* prevent drawing masked border to backbuffer when using playfield buffer */
+ /* never draw masked border to backbuffer when using playfield buffer */
if (game_status != GAME_MODE_PLAYING ||
redraw_mask & REDRAW_FROM_BACKBUFFER ||
buffer == backbuffer)
}
else
{
+#if 1
+ BlitScreenToBitmap(window);
+#else
int fx = FX, fy = FY;
- if (setup.soft_scrolling)
+#if NEW_TILESIZE
+ int dx = (ScreenMovDir & (MV_LEFT | MV_RIGHT) ? ScreenGfxPos : 0);
+ int dy = (ScreenMovDir & (MV_UP | MV_DOWN) ? ScreenGfxPos : 0);
+ int dx_var = dx * TILESIZE_VAR / TILESIZE;
+ int dy_var = dy * TILESIZE_VAR / TILESIZE;
+ int ffx, ffy;
+
+ // fx += dx * TILESIZE_VAR / TILESIZE;
+ // fy += dy * TILESIZE_VAR / TILESIZE;
+#else
+ fx += (ScreenMovDir & (MV_LEFT | MV_RIGHT) ? ScreenGfxPos : 0);
+ fy += (ScreenMovDir & (MV_UP | MV_DOWN) ? ScreenGfxPos : 0);
+#endif
+
+ /* !!! THIS WORKS !!! */
+
+ printf("::: %d, %d\n", scroll_x, scroll_y);
+
+ ffx = (scroll_x - SBX_Left) * TILEX_VAR + dx_var;
+ ffy = (scroll_y - SBY_Upper) * TILEY_VAR + dy_var;
+
+ if (EVEN(SCR_FIELDX))
{
- fx += (ScreenMovDir & (MV_LEFT | MV_RIGHT) ? ScreenGfxPos : 0);
- fy += (ScreenMovDir & (MV_UP | MV_DOWN) ? ScreenGfxPos : 0);
+ if (ffx < SBX_Right * TILEX_VAR + TILEX_VAR / 2 + TILEX_VAR)
+ fx += dx_var - MIN(ffx, TILEX_VAR / 2) + TILEX_VAR;
+ else
+ fx += (dx > 0 ? TILEX_VAR : 0);
}
-
- if (setup.soft_scrolling ||
- ABS(ScreenMovPos) + ScrollStepSize == TILEX ||
- ABS(ScreenMovPos) == ScrollStepSize ||
- redraw_tiles > REDRAWTILES_THRESHOLD)
+ else
{
- if (border.draw_masked[GAME_MODE_PLAYING])
- {
- if (buffer != backbuffer)
- {
- /* copy playfield buffer to backbuffer to add masked border */
- BlitBitmap(buffer, backbuffer, fx, fy, SXSIZE, SYSIZE, SX, SY);
- DrawMaskedBorder(REDRAW_FIELD);
- }
+ fx += dx;
+ }
- BlitBitmap(backbuffer, window,
- REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE,
- REAL_SX, REAL_SY);
- }
+ if (EVEN(SCR_FIELDY))
+ {
+ if (ffy < SBY_Lower * TILEY_VAR + TILEY_VAR / 2 + TILEY_VAR)
+ fy += dy_var - MIN(ffy, TILEY_VAR / 2) + TILEY_VAR;
else
+ fy += (dy > 0 ? TILEY_VAR : 0);
+ }
+ else
+ {
+ fy += dy;
+ }
+
+ if (border.draw_masked[GAME_MODE_PLAYING])
+ {
+ if (buffer != backbuffer)
{
- BlitBitmap(buffer, window, fx, fy, SXSIZE, SYSIZE, SX, SY);
+ /* copy playfield buffer to backbuffer to add masked border */
+ BlitBitmap(buffer, backbuffer, fx, fy, SXSIZE, SYSIZE, SX, SY);
+ DrawMaskedBorder(REDRAW_FIELD);
}
+ BlitBitmap(backbuffer, window,
+ REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE,
+ REAL_SX, REAL_SY);
+ }
+ else
+ {
+ BlitBitmap(buffer, window, fx, fy, SXSIZE, SYSIZE, SX, SY);
+ }
+#endif
+
#if 0
#ifdef DEBUG
- printf("redrawing all (ScreenGfxPos == %d) because %s\n",
- ScreenGfxPos,
- (setup.soft_scrolling ?
- "setup.soft_scrolling" :
- ABS(ScreenGfxPos) + ScrollStepSize == TILEX ?
- "ABS(ScreenGfxPos) + ScrollStepSize == TILEX" :
- ABS(ScreenGfxPos) == ScrollStepSize ?
- "ABS(ScreenGfxPos) == ScrollStepSize" :
- "redraw_tiles > REDRAWTILES_THRESHOLD"));
+ printf("redrawing all (ScreenGfxPos == %d) because %s\n",
+ ScreenGfxPos,
+ (setup.soft_scrolling ?
+ "setup.soft_scrolling" :
+ ABS(ScreenGfxPos) + ScrollStepSize == TILEX ?
+ "ABS(ScreenGfxPos) + ScrollStepSize == TILEX" :
+ ABS(ScreenGfxPos) == ScrollStepSize ?
+ "ABS(ScreenGfxPos) == ScrollStepSize" :
+ "redraw_tiles > REDRAWTILES_THRESHOLD"));
#endif
#endif
- }
}
redraw_mask &= ~REDRAW_MAIN;
printf("::: REDRAW_TILES\n");
#endif
+#if NEW_TILESIZE
+
+#if 1
+ InitGfxClipRegion(TRUE, SX, SY, SXSIZE, SYSIZE);
+
+ {
+ int sx = SX; // - (EVEN(SCR_FIELDX) ? TILEX_VAR / 2 : 0);
+ int sy = SY; // + (EVEN(SCR_FIELDY) ? TILEY_VAR / 2 : 0);
+
+ int dx = 0, dy = 0;
+ int dx_var = dx * TILESIZE_VAR / TILESIZE;
+ int dy_var = dy * TILESIZE_VAR / TILESIZE;
+ int ffx, ffy;
+ int fx = FX, fy = FY;
+
+ int scr_fieldx = SCR_FIELDX + (EVEN(SCR_FIELDX) ? 2 : 0);
+ int scr_fieldy = SCR_FIELDY + (EVEN(SCR_FIELDY) ? 2 : 0);
+
+ ffx = (scroll_x - SBX_Left) * TILEX_VAR + dx_var;
+ ffy = (scroll_y - SBY_Upper) * TILEY_VAR + dy_var;
+
+ if (EVEN(SCR_FIELDX))
+ {
+ if (ffx < SBX_Right * TILEX_VAR + TILEX_VAR / 2 + TILEX_VAR)
+ {
+ fx += dx_var - MIN(ffx, TILEX_VAR / 2) + TILEX_VAR;
+
+ if (fx % TILEX_VAR)
+ sx -= TILEX_VAR / 2;
+ else
+ sx -= TILEX_VAR;
+ }
+ else
+ {
+ fx += (dx_var > 0 ? TILEX_VAR : 0);
+ }
+ }
+
+ if (EVEN(SCR_FIELDY))
+ {
+ if (ffy < SBY_Lower * TILEY_VAR + TILEY_VAR / 2 + TILEY_VAR)
+ {
+ fy += dy_var - MIN(ffy, TILEY_VAR / 2) + TILEY_VAR;
+
+ if (fy % TILEY_VAR)
+ sy -= TILEY_VAR / 2;
+ else
+ sy -= TILEY_VAR;
+ }
+ else
+ {
+ fy += (dy_var > 0 ? TILEY_VAR : 0);
+ }
+ }
+
+#if 0
+ printf("::: %d, %d, %d, %d\n", sx, sy, SCR_FIELDX, SCR_FIELDY);
+#endif
+
+ for (x = 0; x < scr_fieldx; x++)
+ for (y = 0 ; y < scr_fieldy; y++)
+ if (redraw[redraw_x1 + x][redraw_y1 + y])
+ BlitBitmap(buffer, window,
+ FX + x * TILEX_VAR, FY + y * TILEY_VAR,
+ TILEX_VAR, TILEY_VAR,
+ sx + x * TILEX_VAR, sy + y * TILEY_VAR);
+ }
+
+ InitGfxClipRegion(FALSE, -1, -1, -1, -1);
+#else
+ for (x = 0; x < SCR_FIELDX; x++)
+ for (y = 0 ; y < SCR_FIELDY; y++)
+ if (redraw[redraw_x1 + x][redraw_y1 + y])
+ BlitBitmap(buffer, window,
+ FX + x * TILEX_VAR, FY + y * TILEY_VAR,
+ TILEX_VAR, TILEY_VAR,
+ SX + x * TILEX_VAR, SY + y * TILEY_VAR);
+#endif
+
+#else
for (x = 0; x < SCR_FIELDX; x++)
for (y = 0 ; y < SCR_FIELDY; y++)
if (redraw[redraw_x1 + x][redraw_y1 + y])
BlitBitmap(buffer, window,
FX + x * TILEX, FY + y * TILEY, TILEX, TILEY,
SX + x * TILEX, SY + y * TILEY);
+#endif
}
if (redraw_mask & REDRAW_FPS) /* display frames per second */
void SetPanelBackground()
{
+#if 1
+ struct GraphicInfo *gfx = &graphic_info[IMG_BACKGROUND_PANEL];
+
+#if 1
+ BlitBitmapTiled(gfx->bitmap, bitmap_db_panel, gfx->src_x, gfx->src_y,
+ gfx->width, gfx->height, 0, 0, DXSIZE, DYSIZE);
+#else
+ /* (ClearRectangle() only needed if panel bitmap is smaller than panel) */
+ ClearRectangle(bitmap_db_panel, DX, DY, DXSIZE, DYSIZE);
+ BlitBitmap(gfx->bitmap, bitmap_db_panel, gfx->src_x, gfx->src_y,
+ MIN(gfx->width, DXSIZE), MIN(gfx->height, DYSIZE), 0, 0);
+#endif
+#else
BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, bitmap_db_panel,
DOOR_GFX_PAGEX5, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, 0, 0);
+#endif
SetDoorBackgroundBitmap(bitmap_db_panel);
}
ClearRectangleOnBackground(backbuffer, x, y, width, height);
#endif
+#if 1
+ /* (this only works for the current arrangement of playfield and panels) */
+ if (x < gfx.dx)
+ redraw_mask |= REDRAW_FIELD;
+ else if (y < gfx.vy)
+ redraw_mask |= REDRAW_DOOR_1;
+ else
+ redraw_mask |= REDRAW_DOOR_2;
+#else
+ /* (this is just wrong (when drawing to one of the two door panel areas)) */
redraw_mask |= REDRAW_FIELD;
+#endif
}
void DrawBackgroundForFont(int x, int y, int width, int height, int font_nr)
sync_frame);
}
-void getSizedGraphicSource(int graphic, int frame, int tilesize_raw,
- Bitmap **bitmap, int *x, int *y)
+void getSizedGraphicSourceExt(int graphic, int frame, int tilesize_raw,
+ Bitmap **bitmap, int *x, int *y,
+ boolean get_backside)
{
struct
{
int height_div = offset_calc[offset_calc_pos].height_div;
int startx = src_bitmap->width * width_mult / width_div;
int starty = src_bitmap->height * height_mult / height_div;
+#if NEW_TILESIZE
+ int src_x = (g->src_x + (get_backside ? g->offset2_x : 0)) *
+ tilesize / TILESIZE;
+ int src_y = (g->src_y + (get_backside ? g->offset2_y : 0)) *
+ tilesize / TILESIZE;
+#else
int src_x = g->src_x * tilesize / TILESIZE;
int src_y = g->src_y * tilesize / TILESIZE;
+#endif
int width = g->width * tilesize / TILESIZE;
int height = g->height * tilesize / TILESIZE;
int offset_x = g->offset_x * tilesize / TILESIZE;
*y = starty + src_y;
}
+void getFixedGraphicSourceExt(int graphic, int frame, Bitmap **bitmap,
+ int *x, int *y, boolean get_backside)
+{
+ getSizedGraphicSourceExt(graphic, frame, TILESIZE, bitmap, x, y,
+ get_backside);
+}
+
+void getSizedGraphicSource(int graphic, int frame, int tilesize_raw,
+ Bitmap **bitmap, int *x, int *y)
+{
+ getSizedGraphicSourceExt(graphic, frame, tilesize_raw, bitmap, x, y, FALSE);
+}
+
+void getFixedGraphicSource(int graphic, int frame,
+ Bitmap **bitmap, int *x, int *y)
+{
+ getSizedGraphicSourceExt(graphic, frame, TILESIZE, bitmap, x, y, FALSE);
+}
+
void getMiniGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y)
{
#if 1
int src_x = g->src_x + (get_backside ? g->offset2_x : 0);
int src_y = g->src_y + (get_backside ? g->offset2_y : 0);
+#if NEW_TILESIZE
+ if (TILESIZE_VAR != TILESIZE)
+ return getSizedGraphicSourceExt(graphic, frame, TILESIZE_VAR, bitmap, x, y,
+ get_backside);
+#endif
+
*bitmap = g->bitmap;
if (g->offset_y == 0) /* frames are ordered horizontally */
}
#endif
+#if NEW_TILESIZE
+ DrawGraphicExt(drawto_field, FX + x * TILEX_VAR, FY + y * TILEY_VAR, graphic,
+ frame);
+#else
DrawGraphicExt(drawto_field, FX + x * TILEX, FY + y * TILEY, graphic, frame);
+#endif
+ MarkTileDirty(x, y);
+}
+
+void DrawFixedGraphic(int x, int y, int graphic, int frame)
+{
+#if DEBUG
+ if (!IN_SCR_FIELD(x, y))
+ {
+ printf("DrawGraphic(): x = %d, y = %d, graphic = %d\n", x, y, graphic);
+ printf("DrawGraphic(): This should never happen!\n");
+ return;
+ }
+#endif
+
+ DrawFixedGraphicExt(drawto_field, FX + x * TILEX, FY + y * TILEY, graphic,
+ frame);
MarkTileDirty(x, y);
}
int src_x, src_y;
getGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
+#if NEW_TILESIZE
+ BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y, TILEX_VAR, TILEY_VAR, x, y);
+#else
+ BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y, TILEX, TILEY, x, y);
+#endif
+}
+
+void DrawFixedGraphicExt(DrawBuffer *dst_bitmap, int x, int y, int graphic,
+ int frame)
+{
+ Bitmap *src_bitmap;
+ int src_x, src_y;
+
+ getFixedGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y, TILEX, TILEY, x, y);
}
}
#endif
- DrawGraphicThruMaskExt(drawto_field, FX + x * TILEX, FY + y *TILEY, graphic,
+#if NEW_TILESIZE
+ DrawGraphicThruMaskExt(drawto_field, FX + x * TILEX_VAR, FY + y * TILEY_VAR,
+ graphic, frame);
+#else
+ DrawGraphicThruMaskExt(drawto_field, FX + x * TILEX, FY + y * TILEY, graphic,
frame);
+#endif
+ MarkTileDirty(x, y);
+}
+
+void DrawFixedGraphicThruMask(int x, int y, int graphic, int frame)
+{
+#if DEBUG
+ if (!IN_SCR_FIELD(x, y))
+ {
+ printf("DrawGraphicThruMask(): x = %d,y = %d, graphic = %d\n",x,y,graphic);
+ printf("DrawGraphicThruMask(): This should never happen!\n");
+ return;
+ }
+#endif
+
+ DrawFixedGraphicThruMaskExt(drawto_field, FX + x * TILEX, FY + y * TILEY,
+ graphic, frame);
MarkTileDirty(x, y);
}
getGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
+ SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc,
+ dst_x - src_x, dst_y - src_y);
+#if NEW_TILESIZE
+ BlitBitmapMasked(src_bitmap, d, src_x, src_y, TILEX_VAR, TILEY_VAR,
+ dst_x, dst_y);
+#else
+ BlitBitmapMasked(src_bitmap, d, src_x, src_y, TILEX, TILEY, dst_x, dst_y);
+#endif
+}
+
+void DrawFixedGraphicThruMaskExt(DrawBuffer *d, int dst_x, int dst_y,
+ int graphic, int frame)
+{
+ Bitmap *src_bitmap;
+ int src_x, src_y;
+
+ getFixedGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
+
SetClipOrigin(src_bitmap, src_bitmap->stored_clip_gc,
dst_x - src_x, dst_y - src_y);
BlitBitmapMasked(src_bitmap, d, src_x, src_y, TILEX, TILEY, dst_x, dst_y);
}
#endif
+#if NEW_TILESIZE
+ width = width * TILESIZE_VAR / TILESIZE;
+ height = height * TILESIZE_VAR / TILESIZE;
+ cx = cx * TILESIZE_VAR / TILESIZE;
+ cy = cy * TILESIZE_VAR / TILESIZE;
+ dx = dx * TILESIZE_VAR / TILESIZE;
+ dy = dy * TILESIZE_VAR / TILESIZE;
+#endif
+
if (width > 0 && height > 0)
{
getGraphicSource(graphic, frame, &src_bitmap, &src_x, &src_y);
src_x += cx;
src_y += cy;
+#if NEW_TILESIZE
+ dst_x = FX + x * TILEX_VAR + dx;
+ dst_y = FY + y * TILEY_VAR + dy;
+#else
dst_x = FX + x * TILEX + dx;
dst_y = FY + y * TILEY + dy;
+#endif
if (mask_mode == USE_MASKING)
{
Bitmap *src_bitmap;
int src_x, src_y;
int dst_x, dst_y;
+#if NEW_TILESIZE
+ int width = TILEX_VAR, height = TILEY_VAR;
+#else
int width = TILEX, height = TILEY;
+#endif
int x1 = x;
int y1 = y;
int x2 = x + SIGN(dx);
{
getGraphicSourceExt(graphic, frame, &src_bitmap, &src_x, &src_y, TRUE);
+#if NEW_TILESIZE
+ dst_x = FX + x1 * TILEX_VAR;
+ dst_y = FY + y1 * TILEY_VAR;
+#else
dst_x = FX + x1 * TILEX;
dst_y = FY + y1 * TILEY;
+#endif
if (mask_mode == USE_MASKING)
{
{
getGraphicSourceExt(graphic, frame, &src_bitmap, &src_x, &src_y, FALSE);
+#if NEW_TILESIZE
+ dst_x = FX + x2 * TILEX_VAR;
+ dst_y = FY + y2 * TILEY_VAR;
+#else
dst_x = FX + x2 * TILEX;
dst_y = FY + y2 * TILEY;
+#endif
if (mask_mode == USE_MASKING)
{
getGraphicSource(graphic, 1, &src_bitmap, &src_x, &src_y);
+#if NEW_TILESIZE
+ width = crumbled_border_size * TILESIZE_VAR / TILESIZE;
+ height = crumbled_border_size * TILESIZE_VAR / TILESIZE;
+ cx = (dx > 0 ? TILEX - crumbled_border_size : 0) * TILESIZE_VAR / TILESIZE;
+ cy = (dy > 0 ? TILEY - crumbled_border_size : 0) * TILESIZE_VAR / TILESIZE;
+
+ BlitBitmap(src_bitmap, drawto_field, src_x + cx, src_y + cy,
+ width, height, FX + sx * TILEX_VAR + cx, FY + sy * TILEY_VAR + cy);
+#else
width = crumbled_border_size;
height = crumbled_border_size;
cx = (dx > 0 ? TILEX - crumbled_border_size : 0);
BlitBitmap(src_bitmap, drawto_field, src_x + cx, src_y + cy,
width, height, FX + sx * TILEX + cx, FY + sy * TILEY + cy);
+#endif
}
static void DrawLevelFieldCrumbledBorders(int x, int y, int graphic, int frame,
}
#endif
+#if NEW_TILESIZE
+ BlitBitmap(src_bitmap, drawto_field,
+ src_x + cx * TILESIZE_VAR / TILESIZE,
+ src_y + cy * TILESIZE_VAR / TILESIZE,
+ width * TILESIZE_VAR / TILESIZE,
+ height * TILESIZE_VAR / TILESIZE,
+ FX + sx * TILEX_VAR + cx * TILESIZE_VAR / TILESIZE,
+ FY + sy * TILEY_VAR + cy * TILESIZE_VAR / TILESIZE);
+#else
BlitBitmap(src_bitmap, drawto_field, src_x + cx, src_y + cy,
width, height, FX + sx * TILEX + cx, FY + sy * TILEY + cy);
+#endif
/* (remaining middle border part must be at least as big as corner part) */
if (!(graphic_info[graphic].style & STYLE_ACCURATE_BORDERS) ||
by = cy;
}
+#if NEW_TILESIZE
+ BlitBitmap(src_bitmap, drawto_field,
+ src_x + bx * TILESIZE_VAR / TILESIZE,
+ src_y + by * TILESIZE_VAR / TILESIZE,
+ width * TILESIZE_VAR / TILESIZE,
+ height * TILESIZE_VAR / TILESIZE,
+ FX + sx * TILEX_VAR + cx * TILESIZE_VAR / TILESIZE,
+ FY + sy * TILEY_VAR + cy * TILESIZE_VAR / TILESIZE);
+#else
BlitBitmap(src_bitmap, drawto_field, src_x + bx, src_y + by,
width, height, FX + sx * TILEX + cx, FY + sy * TILEY + cy);
+#endif
}
}
#else
int inner_sy = (height >= 3 * font_height ? font_height : 0);
boolean draw_masked = graphic_info[graphic].draw_masked;
- getGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y);
+ getFixedGraphicSource(graphic, 0, &src_bitmap, &src_x, &src_y);
if (src_bitmap == NULL || width < font_width || height < font_height)
{
int mask_mode = (src_bitmap != NULL ? BLIT_MASKED : BLIT_ON_BACKGROUND);
boolean ffwd_delay = (tape.playing && tape.fast_forward);
boolean no_delay = (tape.warp_forward);
- unsigned long anim_delay = 0;
+ unsigned int anim_delay = 0;
int frame_delay_value = (ffwd_delay ? FfwdFrameDelay : GameFrameDelay);
int anim_delay_value = (no_delay ? 0 : frame_delay_value);
int font_nr = FONT_ENVELOPE_1 + envelope_nr;
int mask_mode = (src_bitmap != NULL ? BLIT_MASKED : BLIT_ON_BACKGROUND);
boolean ffwd_delay = (tape.playing && tape.fast_forward);
boolean no_delay = (tape.warp_forward);
- unsigned long anim_delay = 0;
+ unsigned int anim_delay = 0;
int frame_delay_value = (ffwd_delay ? FfwdFrameDelay : GameFrameDelay);
int anim_delay_value = (no_delay ? 0 : frame_delay_value);
#if 1
game.envelope_active = FALSE;
#if 1
- game_status = last_game_status; /* restore current game status */
+ // game_status = last_game_status; /* restore current game status */
if (action == ACTION_CLOSING)
{
BackToFront();
+ /* (important: after "BackToFront()", but before "SetDrawtoField()") */
+ game_status = last_game_status; /* restore current game status */
+
if (game_status == GAME_MODE_PLAYING &&
level.game_engine_type == GAME_ENGINE_TYPE_RND)
SetDrawtoField(DRAW_BUFFERED);
void DrawPreviewLevel(boolean restart)
{
- static unsigned long scroll_delay = 0;
- static unsigned long label_delay = 0;
+ static unsigned int scroll_delay = 0;
+ static unsigned int label_delay = 0;
static int from_x, from_y, scroll_direction;
static int label_state, label_counter;
- unsigned long scroll_delay_value = preview.step_delay;
+ unsigned int scroll_delay_value = preview.step_delay;
boolean show_level_border = (BorderElement != EL_EMPTY);
int level_xsize = lev_fieldx + (show_level_border ? 2 : 0);
int level_ysize = lev_fieldy + (show_level_border ? 2 : 0);
DrawGraphicExt(dst_bitmap, x, y, graphic, frame);
}
+inline void DrawFixedGraphicAnimationExt(DrawBuffer *dst_bitmap, int x, int y,
+ int graphic, int sync_frame,
+ int mask_mode)
+{
+ int frame = getGraphicAnimationFrame(graphic, sync_frame);
+
+ if (mask_mode == USE_MASKING)
+ DrawFixedGraphicThruMaskExt(dst_bitmap, x, y, graphic, frame);
+ else
+ DrawFixedGraphicExt(dst_bitmap, x, y, graphic, frame);
+}
+
inline void DrawGraphicAnimation(int x, int y, int graphic)
{
int lx = LEVELX(x), ly = LEVELY(y);
if (!IN_SCR_FIELD(x, y))
return;
+#if NEW_TILESIZE
+ DrawGraphicAnimationExt(drawto_field, FX + x * TILEX_VAR, FY + y * TILEY_VAR,
+ graphic, GfxFrame[lx][ly], NO_MASKING);
+#else
+ DrawGraphicAnimationExt(drawto_field, FX + x * TILEX, FY + y * TILEY,
+ graphic, GfxFrame[lx][ly], NO_MASKING);
+#endif
+ MarkTileDirty(x, y);
+}
+
+inline void DrawFixedGraphicAnimation(int x, int y, int graphic)
+{
+ int lx = LEVELX(x), ly = LEVELY(y);
+
+ if (!IN_SCR_FIELD(x, y))
+ return;
+
DrawGraphicAnimationExt(drawto_field, FX + x * TILEX, FY + y * TILEY,
graphic, GfxFrame[lx][ly], NO_MASKING);
MarkTileDirty(x, y);
int last_game_status = game_status; /* save current game status */
int max_request_line_len = MAX_REQUEST_LINE_FONT1_LEN;
int font_nr = FONT_TEXT_2;
- boolean use_envelope_request = TRUE * 0;
#if 0
int max_word_len = 0;
#endif
char *text_ptr;
int i;
+#if 1
+ global.use_envelope_request = 0;
+#endif
+
#if 1
if (maxWordLengthInString(text) > MAX_REQUEST_LINE_FONT1_LEN)
{
UnmapAllGadgets();
-#if 1
- if (old_door_state & DOOR_OPEN_1 && !use_envelope_request)
+ /* draw released gadget before proceeding */
+ // BackToFront();
+
+#if 0
+ if (old_door_state & DOOR_OPEN_1 && !global.use_envelope_request)
#else
if (old_door_state & DOOR_OPEN_1)
#endif
{
+#if 1
+ if (!global.use_envelope_request)
+ CloseDoor(DOOR_CLOSE_1);
+#else
CloseDoor(DOOR_CLOSE_1);
+#endif
/* save old door content */
BlitBitmap(bitmap_db_door, bitmap_db_door,
game_status = last_game_status; /* restore current game status */
#if 1
- if (use_envelope_request)
+ if (global.use_envelope_request)
{
/* !!! TMP !!! */
FreeToolButtons();
DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
#if 1
- if (use_envelope_request)
+ if (global.use_envelope_request)
{
ShowEnvelopeDoor(text, ACTION_OPENING);
#endif
#if 1
- if (!use_envelope_request)
+ if (!global.use_envelope_request)
OpenDoor(DOOR_OPEN_1);
#else
OpenDoor(DOOR_OPEN_1);
}
#if 1
- if (game_status != GAME_MODE_MAIN && !use_envelope_request)
+ if (game_status != GAME_MODE_MAIN && !global.use_envelope_request)
InitAnimation();
#else
if (game_status != GAME_MODE_MAIN)
Delay(10);
}
+#if 1
+ game_status = GAME_MODE_PSEUDO_DOOR;
+#endif
+
BackToFront();
+#if 1
+ game_status = last_game_status; /* restore current game status */
+#endif
+
#else
DoAnimation();
UnmapToolButtons();
#if 1
- if (use_envelope_request)
+ if (global.use_envelope_request)
ShowEnvelopeDoor(text, ACTION_CLOSING);
#endif
#if 1
- if (!(req_state & REQ_STAY_OPEN) && !use_envelope_request)
+ if (!(req_state & REQ_STAY_OPEN) && !global.use_envelope_request)
#else
if (!(req_state & REQ_STAY_OPEN))
#endif
{
static int door1 = DOOR_OPEN_1;
static int door2 = DOOR_CLOSE_2;
- unsigned long door_delay = 0;
- unsigned long door_delay_value;
+ unsigned int door_delay = 0;
+ unsigned int door_delay_value;
int stepsize = 1;
if (door_1.width < 0 || door_1.width > DXSIZE)
Bitmap *deco_bitmap = None;
int deco_x = 0, deco_y = 0, deco_xpos = 0, deco_ypos = 0;
struct GadgetInfo *gi;
- unsigned long event_mask;
+ unsigned int event_mask;
int gd_xoffset, gd_yoffset;
int gd_x1, gd_x2, gd_y;
int id = i;
return game_frame_delay_value;
}
-unsigned int InitRND(long seed)
+unsigned int InitRND(int seed)
{
if (level.game_engine_type == GAME_ENGINE_TYPE_EM)
return InitEngineRandom_EM(seed);
return (frame_em > 5 ? EL_EMPTY : element);
#if 0
+ /* !!! FIX !!! */
case Ydiamond_stone:
// if (!game.use_native_emc_graphics_engine)
return EL_ROCK;
}
void CheckSingleStepMode_EM(byte action[MAX_PLAYERS], int frame,
- boolean any_player_moving)
+ boolean any_player_moving,
+ boolean player_is_dropping)
{
- int i;
-
if (tape.single_step && tape.recording && !tape.pausing)
{
+#if 0
boolean active_players = FALSE;
+ int i;
for (i = 0; i < MAX_PLAYERS; i++)
if (action[i] != JOY_NO_ACTION)
active_players = TRUE;
+#endif
- if (frame == 0)
+ // if (frame == 0)
+ if (frame == 0 && !player_is_dropping)
TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
}
}
-void CheckSingleStepMode_SP(boolean murphy_is_moving)
+void CheckSingleStepMode_SP(boolean murphy_is_waiting,
+ boolean murphy_is_dropping)
{
+#if 0
+ printf("::: waiting: %d, dropping: %d\n",
+ murphy_is_waiting, murphy_is_dropping);
+#endif
+
if (tape.single_step && tape.recording && !tape.pausing)
{
- if (!murphy_is_moving)
+ // if (murphy_is_waiting || murphy_is_dropping)
+ if (murphy_is_waiting)
+ {
+#if 0
+ printf("::: murphy is waiting -> pause mode\n");
+#endif
+
TapeTogglePause(TAPE_TOGGLE_AUTOMATIC);
+ }
}
}
int border_size = vp_playfield->border_size;
int new_sx = vp_playfield->x + border_size;
int new_sy = vp_playfield->y + border_size;
+ int new_sxsize = vp_playfield->width - 2 * border_size;
+ int new_sysize = vp_playfield->height - 2 * border_size;
+ int new_real_sx = vp_playfield->x;
+ int new_real_sy = vp_playfield->y;
+ int new_full_sxsize = vp_playfield->width;
+ int new_full_sysize = vp_playfield->height;
+#if NEW_TILESIZE
+ int new_tilesize_var = TILESIZE / (setup.small_game_graphics ? 2 : 1);
+ int tilesize = (gfx_game_mode == GAME_MODE_PLAYING ? new_tilesize_var :
+ gfx_game_mode == GAME_MODE_EDITOR ? MINI_TILESIZE : TILESIZE);
+ int new_scr_fieldx = new_sxsize / tilesize;
+ int new_scr_fieldy = new_sysize / tilesize;
+ int new_scr_fieldx_buffers = new_sxsize / new_tilesize_var;
+ int new_scr_fieldy_buffers = new_sysize / new_tilesize_var;
+#else
int new_scr_fieldx = (vp_playfield->width - 2 * border_size) / TILESIZE;
int new_scr_fieldy = (vp_playfield->height - 2 * border_size) / TILESIZE;
+#endif
+ boolean init_gfx_buffers = FALSE;
+ boolean init_video_buffer = FALSE;
+ boolean init_gadgets_and_toons = FALSE;
#if 0
/* !!! TEST ONLY !!! */
WIN_XSIZE = viewport.window.width;
WIN_YSIZE = viewport.window.height;
+#if 1
+ init_video_buffer = TRUE;
+ init_gfx_buffers = TRUE;
+#else
InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen);
InitGfxBuffers();
// RedrawBackground();
#endif
+#endif
+
+ // printf("::: video: init_video_buffer, init_gfx_buffers\n");
}
if (new_scr_fieldx != SCR_FIELDX ||
- new_scr_fieldy != SCR_FIELDY ||
- new_sx != SX ||
+ new_scr_fieldy != SCR_FIELDY)
+ {
+ /* this always toggles between MAIN and GAME when using small tile size */
+
+ SCR_FIELDX = new_scr_fieldx;
+ SCR_FIELDY = new_scr_fieldy;
+
+ // printf("::: new_scr_fieldx != SCR_FIELDX ...\n");
+ }
+
+#if 0
+ if (new_tilesize_var != TILESIZE_VAR &&
+ gfx_game_mode == GAME_MODE_PLAYING)
+ {
+ /* doing this outside GAME_MODE_PLAYING would give wrong playfield size */
+
+ TILESIZE_VAR = new_tilesize_var;
+
+ init_gfx_buffers = TRUE;
+
+ // printf("::: tilesize: init_gfx_buffers\n");
+ }
+#endif
+
+ if (new_sx != SX ||
new_sy != SY ||
- vp_playfield->x != REAL_SX ||
- vp_playfield->y != REAL_SY ||
+ new_sxsize != SXSIZE ||
+ new_sysize != SYSIZE ||
+ new_real_sx != REAL_SX ||
+ new_real_sy != REAL_SY ||
+ new_full_sxsize != FULL_SXSIZE ||
+ new_full_sysize != FULL_SYSIZE ||
+ new_tilesize_var != TILESIZE_VAR ||
vp_door_1->x != *door_1_x ||
vp_door_1->y != *door_1_y ||
vp_door_2->x != *door_2_x ||
vp_door_2->y != *door_2_y)
{
- SCR_FIELDX = new_scr_fieldx;
- SCR_FIELDY = new_scr_fieldy;
SX = new_sx;
SY = new_sy;
- REAL_SX = vp_playfield->x;
- REAL_SY = vp_playfield->y;
+ SXSIZE = new_sxsize;
+ SYSIZE = new_sysize;
+ REAL_SX = new_real_sx;
+ REAL_SY = new_real_sy;
+ FULL_SXSIZE = new_full_sxsize;
+ FULL_SYSIZE = new_full_sysize;
+ TILESIZE_VAR = new_tilesize_var;
+
+#if 0
+ printf("::: %d, %d, %d [%d]\n",
+ SCR_FIELDX, SCR_FIELDY, TILESIZE_VAR,
+ setup.small_game_graphics);
+#endif
*door_1_x = vp_door_1->x;
*door_1_y = vp_door_1->y;
*door_2_x = vp_door_2->x;
*door_2_y = vp_door_2->y;
+#if 1
+ init_gfx_buffers = TRUE;
+
+ // printf("::: viewports: init_gfx_buffers\n");
+#else
InitGfxBuffers();
+#endif
if (gfx_game_mode == GAME_MODE_MAIN)
{
+#if 1
+ init_gadgets_and_toons = TRUE;
+
+ // printf("::: viewports: init_gadgets_and_toons\n");
+#else
InitGadgets();
InitToons();
+#endif
}
}
+ if (init_gfx_buffers)
+ {
+ // printf("::: init_gfx_buffers\n");
+
+ SCR_FIELDX = new_scr_fieldx_buffers;
+ SCR_FIELDY = new_scr_fieldy_buffers;
+
+ InitGfxBuffers();
+
+ SCR_FIELDX = new_scr_fieldx;
+ SCR_FIELDY = new_scr_fieldy;
+ }
+
+ if (init_video_buffer)
+ {
+ // printf("::: init_video_buffer\n");
+
+ InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen);
+
+ SetDrawDeactivationMask(REDRAW_NONE);
+ SetDrawBackgroundMask(REDRAW_FIELD);
+ }
+
+ if (init_gadgets_and_toons)
+ {
+ // printf("::: init_gadgets_and_toons\n");
+
+ InitGadgets();
+ InitToons();
+ }
+
#if 0
printf("::: %d, %d / %d, %d [%d]\n", VX, VY, EX, EY, game_status);
#endif
void SetDrawtoField(int);
void RedrawPlayfield(boolean, int, int, int, int);
+void BlitScreenToBitmap(Bitmap *);
void BackToFront();
void FadeIn(int);
void SetRandomAnimationValue(int, int);
int getGraphicAnimationFrame(int, int);
-void DrawGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
+
void DrawGraphicAnimation(int, int, int);
+void DrawGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
+
+void DrawFixedGraphicAnimation(int, int, int);
+void DrawFixedGraphicAnimationExt(DrawBuffer *, int, int, int, int, int);
+
void DrawLevelGraphicAnimation(int, int, int);
void DrawLevelElementAnimation(int, int, int);
void DrawLevelGraphicAnimationIfNeeded(int, int, int);
void DrawPlayerField(int, int);
void DrawPlayer(struct PlayerInfo *);
+void getSizedGraphicSourceExt(int, int, int, Bitmap **, int *, int *, boolean);
+void getFixedGraphicSourceExt(int, int, Bitmap **, int *, int *, boolean);
void getSizedGraphicSource(int, int, int, Bitmap **, int *, int *);
+void getFixedGraphicSource(int, int, Bitmap **, int *, int *);
void getMiniGraphicSource(int, Bitmap **, int *, int *);
void getGraphicSourceExt(int, int, Bitmap **, int *, int *, boolean);
void getGraphicSource(int, int, Bitmap **, int *, int *);
+
void DrawGraphic(int, int, int, int);
void DrawGraphicExt(DrawBuffer *, int, int, int, int);
void DrawGraphicThruMask(int, int, int, int);
void DrawGraphicThruMaskExt(DrawBuffer *, int, int, int, int);
+void DrawFixedGraphic(int, int, int, int);
+void DrawFixedGraphicExt(DrawBuffer *, int, int, int, int);
+void DrawFixedGraphicThruMask(int, int, int, int);
+void DrawFixedGraphicThruMaskExt(DrawBuffer *, int, int, int, int);
+
void DrawSizedGraphic(int, int, int, int, int);
void DrawSizedGraphicExt(DrawBuffer *, int, int, int, int, int);
+
void DrawMiniGraphic(int, int, int);
void DrawMiniGraphicExt(DrawBuffer *, int, int, int);
int getBeltSwitchElementFromBeltNrAndBeltDirNr(int, int);
int getBeltSwitchElementFromBeltNrAndBeltDir(int, int);
-unsigned int InitRND(long);
+unsigned int InitRND(int);
void InitGraphicInfo_EM(void);
void PlayMenuSoundExt(int);