From 2b65ec99f743dde3ee41083cf89623d4d9b8740e Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 20 Aug 2004 03:28:25 +0200 Subject: [PATCH] rnd-20040820-1-src --- src/Makefile | 36 ++--- src/conftime.h | 2 +- src/{libem => game_em}/Makefile | 14 +- src/{libem => game_em}/cave.c | 6 +- src/{libem => game_em}/convert.c | 13 +- src/{libem => game_em}/display.h | 34 +++-- src/{libem => game_em}/file.h | 0 src/game_em/game_em.h | 21 +++ src/{libem => game_em}/global.h | 0 src/{libem => game_em}/graphics.c | 184 +++++++++---------------- src/{libem => game_em}/init.c | 17 ++- src/{libem => game_em}/input.c | 6 +- src/{libem => game_em}/level.h | 0 src/{libem => game_em}/main.c | 6 +- src/{libem => game_em}/sample.h | 0 src/{libem => game_em}/sound.c | 6 +- src/{libem => game_em}/synchro_1.c | 6 +- src/{libem => game_em}/synchro_2.c | 6 +- src/{libem => game_em}/synchro_3.c | 6 +- src/{libem => game_em}/tab_generate.c | 16 ++- src/{libem => game_em}/tile.h | 0 src/{libem => game_em}/ulaw_generate.c | 6 +- src/libgame/image.c | 45 +----- src/main.h | 2 +- 24 files changed, 199 insertions(+), 233 deletions(-) rename src/{libem => game_em}/Makefile (90%) rename src/{libem => game_em}/cave.c (100%) rename src/{libem => game_em}/convert.c (99%) rename src/{libem => game_em}/display.h (61%) rename src/{libem => game_em}/file.h (100%) create mode 100644 src/game_em/game_em.h rename src/{libem => game_em}/global.h (100%) rename src/{libem => game_em}/graphics.c (79%) rename src/{libem => game_em}/init.c (99%) rename src/{libem => game_em}/input.c (100%) rename src/{libem => game_em}/level.h (100%) rename src/{libem => game_em}/main.c (100%) rename src/{libem => game_em}/sample.h (100%) rename src/{libem => game_em}/sound.c (100%) rename src/{libem => game_em}/synchro_1.c (100%) rename src/{libem => game_em}/synchro_2.c (100%) rename src/{libem => game_em}/synchro_3.c (100%) rename src/{libem => game_em}/tab_generate.c (99%) rename src/{libem => game_em}/tile.h (100%) rename src/{libem => game_em}/ulaw_generate.c (100%) diff --git a/src/Makefile b/src/Makefile index 2fdc412c..af44a1aa 100644 --- a/src/Makefile +++ b/src/Makefile @@ -194,13 +194,13 @@ CNFS_CMD = ../Scripts/create_element_defs.pl TIMESTAMP_FILE = conftime.h -LIBGAMEDIR = libgame -LIBGAME = $(LIBGAMEDIR)/libgame.a +LIBGAME_DIR = libgame +LIBGAME = $(LIBGAME_DIR)/libgame.a -LIBEMDIR = libem -LIBEM = $(LIBEMDIR)/libem.a +GAME_EM_DIR = game_em +GAME_EM = $(GAME_EM_DIR)/game_em.a -RNDLIBS = $(LIBGAME) $(LIBEM) +RNDLIBS = $(LIBGAME) $(GAME_EM) ICONBASE = windows_icon ifeq ($(PLATFORM),cross-win32) @@ -213,20 +213,20 @@ endif # build targets # ----------------------------------------------------------------------------- -all: libgame_dir libem_dir $(PROGNAME) +all: libgame_dir game_em_dir $(PROGNAME) $(PROGNAME): $(RNDLIBS) $(TIMESTAMP_FILE) $(OBJS) $(ICON) $(CC) $(PROFILING) $(OBJS) $(ICON) $(RNDLIBS) $(LDFLAGS) -o $(PROGNAME) libgame_dir: - @$(MAKE) -C $(LIBGAMEDIR) + @$(MAKE) -C $(LIBGAME_DIR) $(LIBGAME): - @$(MAKE) -C $(LIBGAMEDIR) + @$(MAKE) -C $(LIBGAME_DIR) -libem_dir: - @$(MAKE) -C $(LIBEMDIR) -$(LIBEM): - @$(MAKE) -C $(LIBEMDIR) +game_em_dir: + @$(MAKE) -C $(GAME_EM_DIR) +$(GAME_EM): + @$(MAKE) -C $(GAME_EM_DIR) auto-conf: @for i in $(CNFS); do \ @@ -243,7 +243,7 @@ conf_snd.h: conf_snd.c conf_mus.h: conf_mus.c @$(MAKE) auto-conf -$(TIMESTAMP_FILE): $(SRCS) $(LIBGAME) $(LIBEM) +$(TIMESTAMP_FILE): $(SRCS) $(LIBGAME) $(GAME_EM) @date '+"[%Y-%m-%d %H:%M]"' \ | sed -e 's/^/#define COMPILE_DATE_STRING /' \ > $(TIMESTAMP_FILE) @@ -256,11 +256,11 @@ $(ICON): $(CC) $(PROFILING) $(CFLAGS) -c $*.c clean-obj: - $(MAKE) -C $(LIBGAMEDIR) clean - $(MAKE) -C $(LIBEMDIR) clean + $(MAKE) -C $(LIBGAME_DIR) clean + $(MAKE) -C $(GAME_EM_DIR) clean $(RM) $(OBJS) $(RM) $(LIBGAME) - $(RM) $(LIBEM) + $(RM) $(GAME_EM) clean-ico: $(RM) $(ICONBASE).ico @@ -280,8 +280,8 @@ clean: clean-obj clean-ico clean-bin dist-clean: clean-obj depend: - $(MAKE) -C $(LIBGAMEDIR) depend - $(MAKE) -C $(LIBEMDIR) depend + $(MAKE) -C $(LIBGAME_DIR) depend + $(MAKE) -C $(GAME_EM_DIR) depend for i in $(SRCS); do $(CPP) $(CFLAGS) -M $$i; done > .depend ifeq (.depend,$(wildcard .depend)) diff --git a/src/conftime.h b/src/conftime.h index 6b1b5880..82b05f04 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2004-08-19 03:34]" +#define COMPILE_DATE_STRING "[2004-08-20 03:27]" diff --git a/src/libem/Makefile b/src/game_em/Makefile similarity index 90% rename from src/libem/Makefile rename to src/game_em/Makefile index 489737ab..876cb345 100644 --- a/src/libem/Makefile +++ b/src/game_em/Makefile @@ -1,5 +1,5 @@ # ============================================================================= -# Rocks'n'Diamonds Makefile (libem) +# Rocks'n'Diamonds Makefile (game_em) # ----------------------------------------------------------------------------- # (c) 1995-2004 Holger Schemel # ----------------------------------------------------------------------------- @@ -36,25 +36,25 @@ OBJS = cave.o \ tab_generate.o \ ulaw_generate.o -LIBEM = libem.a +GAME_EM = game_em.a # ----------------------------------------------------------------------------- # build targets # ----------------------------------------------------------------------------- -all: $(LIBEM) +all: $(GAME_EM) -$(LIBEM): $(OBJS) - $(AR) cru $(LIBEM) $(OBJS) - $(RANLIB) $(LIBEM) +$(GAME_EM): $(OBJS) + $(AR) cru $(GAME_EM) $(OBJS) + $(RANLIB) $(GAME_EM) .c.o: $(CC) $(PROFILING) $(CFLAGS) -c $*.c clean: $(RM) $(OBJS) - $(RM) $(LIBEM) + $(RM) $(GAME_EM) # ----------------------------------------------------------------------------- diff --git a/src/libem/cave.c b/src/game_em/cave.c similarity index 100% rename from src/libem/cave.c rename to src/game_em/cave.c index 60478c28..759d6dc3 100644 --- a/src/libem/cave.c +++ b/src/game_em/cave.c @@ -1,6 +1,3 @@ - -#if defined(TARGET_X11) - /* 2000-08-10T16:43:50Z * * cave data structures @@ -18,6 +15,9 @@ #include "level.h" #include "file.h" + +#if defined(TARGET_X11) + struct cave_node *cave_list; static void clear(void); diff --git a/src/libem/convert.c b/src/game_em/convert.c similarity index 99% rename from src/libem/convert.c rename to src/game_em/convert.c index 18f52e18..6fbc4834 100644 --- a/src/libem/convert.c +++ b/src/game_em/convert.c @@ -1,6 +1,3 @@ - -#if defined(TARGET_X11) - /* 2000-08-20T09:41:18Z * * identify all emerald mine caves and turn them into v6 format. @@ -10,6 +7,13 @@ * and clean up v6 caves (acid, number limits) which should(!) be inconsequential, * but no doubt it will break some caves. */ + +#include "tile.h" +#include "level.h" + + +#if defined(TARGET_X11) + static unsigned char remap_v6[256] = { /* filter crap for v6 */ 0,0,2,2,4,4,118,118,8,9,10,11,12,13,14,15,16,16,18,18,20,21,22,23,24,25,26,27,28, 28,118,28,0,16,2,18,36,37,37,37,40,41,42,43,44,45,128,128,128,148,148,148,45,45,45, @@ -164,9 +168,6 @@ v6: * the force code for initially moving spring. i will follow this in my editor. */ -#include "tile.h" -#include "level.h" - static unsigned short remap_emerald[256] = { Xstone, Xstone, Xdiamond, Xdiamond, Xalien, Xalien, Xblank, Xblank, Xtank_n, Xtank_e, Xtank_s, Xtank_w, Xtank_gon, Xtank_goe, Xtank_gos, Xtank_gow, diff --git a/src/libem/display.h b/src/game_em/display.h similarity index 61% rename from src/libem/display.h rename to src/game_em/display.h index 171f73e4..9a6ca203 100644 --- a/src/libem/display.h +++ b/src/game_em/display.h @@ -1,21 +1,35 @@ #ifndef DISPLAY_H #define DISPLAY_H -#if 1 -#define TILEX 32 -#define TILEY 32 -#else -#define TILEX 16 -#define TILEY 16 -#endif -#define SCOREX 8 -#define SCOREY 9 - #include #include #include #include +#define ORIG_TILEX 16 +#define ORIG_TILEY 16 +#define ORIG_SCOREX 8 +#define ORIG_SCOREY 9 +#define ORIG_GFXMENUFONTX 14 +#define ORIG_GFXMENUFONTY 16 +#define ORIG_MENUFONTX 12 +#define ORIG_MENUFONTY 16 + +#define ZOOM_FACTOR 2 + +#define TILEX (ORIG_TILEX * ZOOM_FACTOR) +#define TILEY (ORIG_TILEY * ZOOM_FACTOR) +#define SCOREX (ORIG_SCOREX * ZOOM_FACTOR) +#define SCOREY (ORIG_SCOREY * ZOOM_FACTOR) +#define GFXMENUFONTX (ORIG_GFXMENUFONTX * ZOOM_FACTOR) +#define GFXMENUFONTY (ORIG_GFXMENUFONTY * ZOOM_FACTOR) +#define MENUFONTX (ORIG_MENUFONTX * ZOOM_FACTOR) +#define MENUFONTY (ORIG_MENUFONTY * ZOOM_FACTOR) + +/* often used screen positions */ +#define SX 8 +#define SY 8 + #if 0 extern Display *display; diff --git a/src/libem/file.h b/src/game_em/file.h similarity index 100% rename from src/libem/file.h rename to src/game_em/file.h diff --git a/src/game_em/game_em.h b/src/game_em/game_em.h new file mode 100644 index 00000000..50d64e7e --- /dev/null +++ b/src/game_em/game_em.h @@ -0,0 +1,21 @@ +/*********************************************************** +* Artsoft Retro-Game Library * +*----------------------------------------------------------* +* (c) 1994-2002 Artsoft Entertainment * +* Holger Schemel * +* Detmolder Strasse 189 * +* 33604 Bielefeld * +* Germany * +* e-mail: info@artsoft.org * +*----------------------------------------------------------* +* game_em.h * +***********************************************************/ + +#ifndef GAME_EM_H +#define GAME_EM_H + +#define GAME_EM_VERSION_1_0_0 + +extern void em_main(); + +#endif /* GAME_EM_H */ diff --git a/src/libem/global.h b/src/game_em/global.h similarity index 100% rename from src/libem/global.h rename to src/game_em/global.h diff --git a/src/libem/graphics.c b/src/game_em/graphics.c similarity index 79% rename from src/libem/graphics.c rename to src/game_em/graphics.c index c9dc1593..f7f099a5 100644 --- a/src/libem/graphics.c +++ b/src/game_em/graphics.c @@ -1,6 +1,3 @@ - -#if defined(TARGET_X11) - /* 2000-08-13T14:36:17Z * * graphics manipulation crap @@ -15,6 +12,9 @@ #include + +#if defined(TARGET_X11) + unsigned int frame; /* current frame */ unsigned int screen_x; /* current scroll position */ unsigned int screen_y; @@ -67,21 +67,21 @@ void blitscreen(void) display, screenPixmap, xwindow, screenGC); #endif - XCopyArea(display, screenPixmap, xwindow, screenGC, x, y, 20 * TILEX, 12 * TILEY, 0, 0); + XCopyArea(display, screenPixmap, xwindow, screenGC, x, y, 20 * TILEX, 12 * TILEY, SX, SY); } else if (x < 2 * TILEX && y >= 2 * TILEY) { - XCopyArea(display, screenPixmap, xwindow, screenGC, x, y, 20 * TILEX, 14 * TILEY - y, 0, 0); - XCopyArea(display, screenPixmap, xwindow, screenGC, x, 0, 20 * TILEX, y - 2 * TILEY, 0, 14 * TILEY - y); + XCopyArea(display, screenPixmap, xwindow, screenGC, x, y, 20 * TILEX, 14 * TILEY - y, SX, SY); + XCopyArea(display, screenPixmap, xwindow, screenGC, x, 0, 20 * TILEX, y - 2 * TILEY, SX, SY + 14 * TILEY - y); } else if (x >= 2 * TILEX && y < 2 * TILEY) { - XCopyArea(display, screenPixmap, xwindow, screenGC, x, y, 22 * TILEX - x, 12 * TILEY, 0, 0); - XCopyArea(display, screenPixmap, xwindow, screenGC, 0, y, x - 2 * TILEX, 12 * TILEY, 22 * TILEX - x, 0); + XCopyArea(display, screenPixmap, xwindow, screenGC, x, y, 22 * TILEX - x, 12 * TILEY, SX, SY); + XCopyArea(display, screenPixmap, xwindow, screenGC, 0, y, x - 2 * TILEX, 12 * TILEY, SX + 22 * TILEX - x, SY); } else { - XCopyArea(display, screenPixmap, xwindow, screenGC, x, y, 22 * TILEX - x, 14 * TILEY - y, 0, 0); - XCopyArea(display, screenPixmap, xwindow, screenGC, 0, y, x - 2 * TILEX, 14 * TILEY - y, 22 * TILEX - x, 0); - XCopyArea(display, screenPixmap, xwindow, screenGC, x, 0, 22 * TILEX - x, y - 2 * TILEY, 0, 14 * TILEY - y); - XCopyArea(display, screenPixmap, xwindow, screenGC, 0, 0, x - 2 * TILEX, y - 2 * TILEY, 22 * TILEX - x, 14 * TILEY - y); + XCopyArea(display, screenPixmap, xwindow, screenGC, x, y, 22 * TILEX - x, 14 * TILEY - y, SX, SY); + XCopyArea(display, screenPixmap, xwindow, screenGC, 0, y, x - 2 * TILEX, 14 * TILEY - y, SX + 22 * TILEX - x, SY); + XCopyArea(display, screenPixmap, xwindow, screenGC, x, 0, 22 * TILEX - x, y - 2 * TILEY, SX, SY + 14 * TILEY - y); + XCopyArea(display, screenPixmap, xwindow, screenGC, 0, 0, x - 2 * TILEX, y - 2 * TILEY, SX + 22 * TILEX - x, SY + 14 * TILEY - y); } - XCopyArea(display, scorePixmap, xwindow, scoreGC, 0, 0, 20 * TILEX, SCOREY, 0, 12 * TILEY); + XCopyArea(display, scorePixmap, xwindow, scoreGC, 0, 0, 20 * TILEX, SCOREY, SX, SY + 12 * TILEY); XFlush(display); xdebug("blitscreen - done"); @@ -182,55 +182,6 @@ static void blitplayer(struct PLAYER *ply) x, y - 14 * TILEY); XSetClipMask(display, screenGC, None); } - - -#if 0 - -#if 0 - printf("::: %ld, %ld\n", objmaskBitmap, sprmaskBitmap); -#endif - - if (sprmaskBitmap) - { - int width = 16 * 4; - int height = 16 * 4; - XImage *src_ximage = XGetImage(display, sprmaskBitmap, 0, 0, - width, height, AllPlanes, ZPixmap); - XImage *dst_ximage = XGetImage(display, xwindow, 0, 0, - width, height, AllPlanes, ZPixmap); - int x, y; - - if (src_ximage == NULL) - { - printf("src_ximage failed\n"); - exit(1); - } - - if (dst_ximage == NULL) - { - printf("dst_ximage failed\n"); - exit(1); - } - - for (x=0; x M5.1: xwindow == %ld\n", xwindow); -#endif - frame = 6; screen_x = 0; screen_y = 0; -#if 0 - printf("--> M5.2: &window == %ld\n", &window); - printf("--> M5.2: xwindow == %ld\n", xwindow); - printf("--> M5.2: &xwindow == %ld\n", &xwindow); - printf("--> M5.2: screen == %ld\n", screen); - printf("--> M5.2: &screentiles[0][0] == %ld\n", &screentiles[0][0]); -#endif - for (y = 0; y < 14; y++) { for (x = 0; x < 22; x++) { -#if 0 - printf("--> M5.2.A: xwindow == %ld [%d,%d]\n", xwindow, x,y); -#endif screentiles[y][x] = -1; -#if 0 - printf("--> M5.2.B: xwindow == %ld [%d,%d]\n", xwindow, x,y); -#endif } } -#if 0 - printf("--> M5.3: xwindow == %ld\n", xwindow); -#endif - colour_shuffle(); colours[0] += 16; colours[1] += 16; colours[2] += 16; colour_anim = 0; -#if 0 - printf("--> M5.4: xwindow == %ld\n", xwindow); -#endif - XFillRectangle(display, scorePixmap, scoreGC, 0, 0, 20 * TILEX, SCOREY); XCopyArea(display, botPixmap, scorePixmap, scoreGC, 11 * SCOREX, colours[0] * SCOREY, 3 * SCOREX, SCOREY, 1 * SCOREX, 0); /* 0-63 time */ XCopyArea(display, botPixmap, scorePixmap, scoreGC, 18 * SCOREX, colours[0] * SCOREY, 6 * SCOREX, SCOREY, 15 * SCOREX, 0); /* 112-207 diamonds */ XCopyArea(display, botPixmap, scorePixmap, scoreGC, 14 * SCOREX, colours[0] * SCOREY, 4 * SCOREX, SCOREY, 32 * SCOREX, 0); /* 256-319 score */ - -#if 0 - printf("--> M5.X: xwindow == %ld\n", xwindow); -#endif } void game_blitscore(void) @@ -419,31 +340,62 @@ void title_animscreen(void) Random = Random * 129 + 1; } -void title_string(unsigned int y, unsigned int left, unsigned int right, char *string) +static int ttl_map[] = { - int i; - unsigned int x; - - xdebug("title_string"); - - y *= TILEY; left *= SCOREX; right *= SCOREX; - x = (left + right - strlen(string) * 12) / 2; - if (x < left || x >= right) x = left; - - XCopyArea(display, ttlPixmap, screenPixmap, screenGC, left, y, right - left, TILEY, left, y); - if (ttlmaskBitmap) XSetClipMask(display, screenGC, ttlmaskBitmap); - for (i = 0; string[i] && x < right; i++) { - unsigned short ch_pos, ch_x, ch_y; - ch_pos = map_ttl[string[i] & 127]; - if (ch_pos < 640) { - ch_x = (ch_pos % 320); - ch_y = (ch_pos / 320 + 12) * TILEY; - if (ttlmaskBitmap) XSetClipOrigin(display, screenGC, x - ch_x, y - ch_y); - XCopyArea(display, ttlPixmap, screenPixmap, screenGC, ch_x, ch_y, 12, TILEY, x, y); - } - x += 12; - } - XSetClipMask(display, screenGC, None); + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, + -1,0,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,2,3,4,-1, /* !',-. */ + 5,6,7,8,9,10,11,12,13,14,15,-1,-1,-1,-1,16, /* 0123456789:? */ + -1,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, /* ABCDEFGHIJKLMNO */ + 32,33,34,35,36,37,38,39,40,41,42,-1,-1,-1,-1,-1, /* PQRSTUVWXYZ */ + -1,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, /* abcdefghijklmno */ + 32,33,34,35,36,37,38,39,40,41,42,-1,-1,-1,-1,-1 /* pqrstuvwxyz */ +}; + +void title_string(unsigned int y, unsigned int left, unsigned int right, + char *string) +{ + int i; + unsigned int x; + + xdebug("title_string"); + + y *= TILEY; + left *= SCOREX; + right *= SCOREX; + + x = (left + right - strlen(string) * MENUFONTX) / 2; + if (x < left || x >= right) x = left; + + /* restore background graphic where text will be drawn */ + XCopyArea(display, ttlPixmap, screenPixmap, screenGC, + left, y, right - left, MENUFONTY, left, y); + + if (ttlmaskBitmap) + XSetClipMask(display, screenGC, ttlmaskBitmap); + + for (i = 0; string[i] && x < right; i++) + { + int ch_pos, ch_x, ch_y; + + ch_pos = ttl_map[string[i] & 127]; + + if (ch_pos == -1 || ch_pos > 22 * 2) + continue; /* no graphic for this character */ + + ch_x = (ch_pos % 22) * GFXMENUFONTX; + ch_y = (ch_pos / 22 + 12) * TILEY; + + if (ttlmaskBitmap) + XSetClipOrigin(display, screenGC, x - ch_x, y - ch_y); + + XCopyArea(display, ttlPixmap, screenPixmap, screenGC, + ch_x, ch_y, MENUFONTX, MENUFONTY, x, y); + + x += MENUFONTX; + } + + XSetClipMask(display, screenGC, None); } #endif diff --git a/src/libem/init.c b/src/game_em/init.c similarity index 99% rename from src/libem/init.c rename to src/game_em/init.c index 0cbaacf5..cc2f6534 100644 --- a/src/libem/init.c +++ b/src/game_em/init.c @@ -1,6 +1,3 @@ - -#if defined(TARGET_X11) - /* 2000-08-10T18:03:54Z * * open X11 display and sound @@ -37,6 +34,9 @@ #include "display.h" #include "sample.h" + +#if defined(TARGET_X11) + #if 0 Display *display; Window xwindow; @@ -169,6 +169,7 @@ static const int sound_volume[SAMPLE_MAX] = { 100 }; +#if 0 static void xdebug(char *msg) { #if 1 @@ -176,6 +177,7 @@ static void xdebug(char *msg) printf("EM DEBUG: %s\n", msg); #endif } +#endif int open_all(void) { @@ -414,9 +416,12 @@ int open_all(void) } #endif - pcxBitmapsX2[i] = ZoomBitmap(pcxBitmaps[i], - pcxBitmaps[i]->width * 2, - pcxBitmaps[i]->height * 2); + if (ZOOM_FACTOR > 1) + pcxBitmapsX2[i] = ZoomBitmap(pcxBitmaps[i], + pcxBitmaps[i]->width * ZOOM_FACTOR, + pcxBitmaps[i]->height * ZOOM_FACTOR); + else + pcxBitmapsX2[i] = pcxBitmaps[i]; #if 1 diff --git a/src/libem/input.c b/src/game_em/input.c similarity index 100% rename from src/libem/input.c rename to src/game_em/input.c index 2aafb665..9bcc5c10 100644 --- a/src/libem/input.c +++ b/src/game_em/input.c @@ -1,6 +1,3 @@ - -#if defined(TARGET_X11) - /* 2000-08-13T15:29:40Z * * handle input from x11 and keyboard and joystick @@ -22,6 +19,9 @@ #include "display.h" #include "level.h" + +#if defined(TARGET_X11) + unsigned long Random; struct PLAYER ply1; diff --git a/src/libem/level.h b/src/game_em/level.h similarity index 100% rename from src/libem/level.h rename to src/game_em/level.h diff --git a/src/libem/main.c b/src/game_em/main.c similarity index 100% rename from src/libem/main.c rename to src/game_em/main.c index 71376b28..dc29189e 100644 --- a/src/libem/main.c +++ b/src/game_em/main.c @@ -1,6 +1,3 @@ - -#if defined(TARGET_X11) - /* Emerald Mine * * David Tritscher @@ -18,6 +15,9 @@ #include "global.h" + +#if defined(TARGET_X11) + char *progname; char *arg_basedir; char *arg_display; diff --git a/src/libem/sample.h b/src/game_em/sample.h similarity index 100% rename from src/libem/sample.h rename to src/game_em/sample.h diff --git a/src/libem/sound.c b/src/game_em/sound.c similarity index 100% rename from src/libem/sound.c rename to src/game_em/sound.c index 4f89139e..67407282 100644 --- a/src/libem/sound.c +++ b/src/game_em/sound.c @@ -1,6 +1,3 @@ - -#if defined(TARGET_X11) - /* 2000-08-10T17:39:15Z * * handle sounds in emerald mine @@ -8,6 +5,9 @@ #include "../libgame/platform.h" + +#if defined(TARGET_X11) + #if defined(PLATFORM_LINUX) || defined(PLATFORM_BSD) #ifdef PLATFORM_LINUX diff --git a/src/libem/synchro_1.c b/src/game_em/synchro_1.c similarity index 100% rename from src/libem/synchro_1.c rename to src/game_em/synchro_1.c index 9f4309c5..d47c71c3 100644 --- a/src/libem/synchro_1.c +++ b/src/game_em/synchro_1.c @@ -1,6 +1,3 @@ - -#if defined(TARGET_X11) - /* first part of synchro. * * game logic for players. @@ -12,6 +9,9 @@ #include "level.h" #include "sample.h" + +#if defined(TARGET_X11) + static void player(struct PLAYER *); static int test(struct PLAYER *); static void die(struct PLAYER *); diff --git a/src/libem/synchro_2.c b/src/game_em/synchro_2.c similarity index 100% rename from src/libem/synchro_2.c rename to src/game_em/synchro_2.c index 8dc78463..6c9cf8f0 100644 --- a/src/libem/synchro_2.c +++ b/src/game_em/synchro_2.c @@ -1,6 +1,3 @@ - -#if defined(TARGET_X11) - /* second part of synchro. * * game logic for monsters. @@ -15,6 +12,9 @@ #include "level.h" #include "sample.h" + +#if defined(TARGET_X11) + extern unsigned int screen_x; extern unsigned int screen_y; diff --git a/src/libem/synchro_3.c b/src/game_em/synchro_3.c similarity index 100% rename from src/libem/synchro_3.c rename to src/game_em/synchro_3.c index e0b86f97..45022e44 100644 --- a/src/libem/synchro_3.c +++ b/src/game_em/synchro_3.c @@ -1,6 +1,3 @@ - -#if defined(TARGET_X11) - /* third part of synchro. * * handle global elements. @@ -12,6 +9,9 @@ #include "level.h" #include "sample.h" + +#if defined(TARGET_X11) + void synchro_3(void) { register unsigned int x; diff --git a/src/libem/tab_generate.c b/src/game_em/tab_generate.c similarity index 99% rename from src/libem/tab_generate.c rename to src/game_em/tab_generate.c index 22ffef4c..0d9b8706 100644 --- a/src/libem/tab_generate.c +++ b/src/game_em/tab_generate.c @@ -1,6 +1,3 @@ - -#if defined(TARGET_X11) - /* 2000-04-19T13:26:05Z * * construct some tables to be included directly in emerald mine source. @@ -17,6 +14,9 @@ #include #include "tile.h" + +#if defined(TARGET_X11) + /* ---------------------------------------------------------------------- */ /* 0=stop 1=blank */ @@ -4274,6 +4274,7 @@ SPR_still,1, 113,113,113,113,113,113,113,113, SPR_MAX }; +#if 0 int ttl_map[] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, @@ -4284,6 +4285,7 @@ int ttl_map[] = { -1,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, /* abcdefghijklmno */ 32,33,34,35,36,37,38,39,40,41,42,-1,-1,-1,-1,-1 /* pqrstuvwxyz */ }; +#endif /* ---------------------------------------------------------------------- */ @@ -4649,6 +4651,7 @@ void create_spr() void create_ttl() { +#if 0 int i, j, k; int buffer[128]; @@ -4660,14 +4663,21 @@ void create_ttl() } else { +#if 1 + j = (ttl_map[i] % 22) * (14 * 2); + k = (ttl_map[i] / 22); + buffer[i] = k * (320 * 2) + j; +#else j = (ttl_map[i] % 22) * 14; k = (ttl_map[i] / 22); buffer[i] = k * 320 + j; +#endif } } for (i = 0; i < 128; i++) map_ttl[i] = buffer[i]; +#endif } void tab_generate() diff --git a/src/libem/tile.h b/src/game_em/tile.h similarity index 100% rename from src/libem/tile.h rename to src/game_em/tile.h diff --git a/src/libem/ulaw_generate.c b/src/game_em/ulaw_generate.c similarity index 100% rename from src/libem/ulaw_generate.c rename to src/game_em/ulaw_generate.c index 5a8453c9..05ab83e9 100644 --- a/src/libem/ulaw_generate.c +++ b/src/game_em/ulaw_generate.c @@ -1,6 +1,3 @@ - -#if defined(TARGET_X11) - /* 2000-08-10T04:29:10Z * * generate ulaw<->linear conversion tables to be included @@ -9,6 +6,9 @@ #include "../libgame/platform.h" + +#if defined(TARGET_X11) + #if defined(PLATFORM_LINUX) || defined(PLATFORM_BSD) #include diff --git a/src/libgame/image.c b/src/libgame/image.c index 4088af3b..8ddcc687 100644 --- a/src/libgame/image.c +++ b/src/libgame/image.c @@ -636,6 +636,8 @@ XImageInfo *Image_to_Pixmap(Display *display, int screen, Visual *visual, Important note: The scaling code currently only supports scaling of the image up or down by a power of 2 -- other scaling factors currently not supported! + Also not supported is scaling of pixmap masks (with depth 1); to scale them, + better use Pixmap_to_Mask() for now. ----------------------------------------------------------------------------- */ @@ -648,13 +650,9 @@ void ZoomPixmap(Display *display, GC gc, Pixmap src_pixmap, Pixmap dst_pixmap, int bits_per_pixel; int bytes_per_pixel; int x, y, xx, yy, i; -#if 1 - boolean scale_down = (src_width > dst_width); - int zoom_factor; -#else - int zoom_factor = src_width / dst_width; /* currently very limited! */ -#endif int row_skip, col_skip; + int zoom_factor; + boolean scale_down = (src_width > dst_width); if (scale_down) { @@ -706,33 +704,6 @@ void ZoomPixmap(Display *display, GC gc, Pixmap src_pixmap, Pixmap dst_pixmap, { row_skip = src_width * bytes_per_pixel; -#if 0 - printf("::: %d, %d -> %d, %d [%d / %d]\n[%ld -> %ld (%ld)] [%ld -> %ld (%ld)]\n", - src_width, src_height, - dst_width, dst_height, - zoom_factor, bytes_per_pixel, - src_ptr, - src_ptr + src_width * src_height * bytes_per_pixel, - src_width * src_height * bytes_per_pixel, - dst_ptr, - dst_ptr + dst_width * dst_height * bytes_per_pixel, - dst_width * dst_height * bytes_per_pixel); - - printf("A\n"); - - for (i = 0; i < src_width * src_height * bytes_per_pixel; - i++) - { - byte x = *(byte *)(src_ptr + i); - - printf("::: %d ...\n", i); - - x = x * 1; - } - - printf("B\n"); -#endif - /* scale image up by scaling factor 'zoom_factor' */ for (y = 0; y < src_height; y++) { @@ -741,19 +712,11 @@ void ZoomPixmap(Display *display, GC gc, Pixmap src_pixmap, Pixmap dst_pixmap, if (yy > 0) src_ptr -= row_skip; -#if 0 - printf("::: [%d -> %ld / %ld]\n", y, src_ptr, dst_ptr); -#endif - for (x = 0; x < src_width; x++) { for (xx = 0; xx < zoom_factor; xx++) for (i = 0; i < bytes_per_pixel; i++) -#if 1 *dst_ptr++ = *(src_ptr + i); -#else - *dst_ptr++ = 0; -#endif src_ptr += i; } diff --git a/src/main.h b/src/main.h index 170a1fe5..cf064727 100644 --- a/src/main.h +++ b/src/main.h @@ -23,7 +23,7 @@ #include #include "libgame/libgame.h" -#include "libem/libem.h" +#include "game_em/game_em.h" #include "conf_gfx.h" /* include auto-generated data structure definitions */ #include "conf_snd.h" /* include auto-generated data structure definitions */ -- 2.34.1