From 74695c00605c6b5fa5c2bdd2c82d29f1affe46aa Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Tue, 29 Aug 2017 23:27:52 +0200 Subject: [PATCH 01/50] Added appveyor.yml --- appveyor.yml | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..b16fd92 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,48 @@ +version: 1.0.{build} +build_script: +- cmd: >- + set MINGW=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32 + + + set PATH=%MINGW%\bin;C:\MinGW\msys\1.0\bin;%PATH% + + set ARCH=MINGW + + + echo === Download zlib ================================================== + + cd .. + + wget http://zlib.net/zlib128-dll.zip + + mkdir zlib-1.2.8 + + cd zlib-1.2.8 + + unzip ../zlib128-dll.zip + + cd .. + + + echo === Download SDL =================================================== + + curl -s https://www.libsdl.org/release/SDL2-devel-2.0.3-mingw.tar.gz | tar -xz + + + echo === Build Digger =================================================== + + cd digger + + make + + + echo === Create Artifact ================================================ + + copy ..\zlib-1.2.8\zlib1.dll + + copy ..\SDL2-2.0.3\i686-w64-mingw32\bin\SDL2.dll + + + zip -j digger-win32.zip digger.exe digger.txt zlib1.dll SDL2.dll +artifacts: +- path: digger-win32.zip From 7ded218aab45c3214a61ab432e3fe572ddee3ca6 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Tue, 29 Aug 2017 23:49:35 +0200 Subject: [PATCH 02/50] Changed the Makefile so "windres" gets invoked on Windows, not "i686-w64-mingw32-windres". --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6287d89..d7b1078 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ ARCH ?= LINUX ifeq ($(ARCH),MINGW) MINGW_DEPS_ROOT ?= ../ CC = i686-w64-mingw32-gcc -WINDRES = i686-w64-mingw32-windres +WINDRES = windres RCFLAGS += -DMINGW -Dmain=SDL_main -I${MINGW_DEPS_ROOT}/zlib-1.2.8/include -I${MINGW_DEPS_ROOT}/SDL2-2.0.3/include LIBS += -mwindows -lmingw32 -L${MINGW_DEPS_ROOT}/SDL2-2.0.3/i686-w64-mingw32/lib -lSDL2main -lSDL2 -luser32 -lgdi32 -lwinmm -L${MINGW_DEPS_ROOT}/zlib-1.2.8/lib -lzdll -lm ESUFFIX = .exe From 0d4c5757eabe1df516231f9b61f3a03458ccef85 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Wed, 30 Aug 2017 00:00:02 +0200 Subject: [PATCH 03/50] Added a status badge for AppVeyor --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e03631..570999c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/sobomax/digger.svg?branch=master)](https://travis-ci.org/sobomax/digger) +[![Build Status](https://travis-ci.org/sobomax/digger.svg?branch=master)](https://travis-ci.org/sobomax/digger) [![Build status](https://ci.appveyor.com/api/projects/status/j89k9v2qrxqp6mgt/branch/master?svg=true)](https://ci.appveyor.com/project/michaelknigge/digger/branch/master) # This is Digger Reloaded, aka UNIX/Linux Digger, however it also works on Windows. From a27d359a933cb7b13d914236cb95cc9a08c086f3 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Wed, 30 Aug 2017 00:32:57 +0200 Subject: [PATCH 04/50] Changes travis.yml so Travis-CI will just invoke "make" to build digger - and not the Shell-Skript "do-test.sh". As a result, Travis-CI no longer builds the Windows version of digger. The Windows-Version is built on AppVeyor. --- .travis.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7a709e9..dad0995 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,9 @@ +before_install: + - sudo apt-add-repository --yes ppa:zoogie/sdl2-snapshots + - sudo apt-get -qq update + - sudo apt-get install -qq libsdl2-dev language: c compiler: - - clang - gcc script: - sh -x ./scripts/do-test.sh - + make From fa1b28ae9aca1d96d270ff18dfb9de465535f561 Mon Sep 17 00:00:00 2001 From: Michael Knigge Date: Wed, 30 Aug 2017 00:39:13 +0200 Subject: [PATCH 05/50] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 570999c..79a542e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/sobomax/digger.svg?branch=master)](https://travis-ci.org/sobomax/digger) [![Build status](https://ci.appveyor.com/api/projects/status/j89k9v2qrxqp6mgt/branch/master?svg=true)](https://ci.appveyor.com/project/michaelknigge/digger/branch/master) +[![Build Status](https://travis-ci.org/michaelknigge/digger.svg?branch=master)](https://travis-ci.org/michaelknigge/digger) [![Build status](https://ci.appveyor.com/api/projects/status/j89k9v2qrxqp6mgt/branch/master?svg=true)](https://ci.appveyor.com/project/michaelknigge/digger/branch/master) # This is Digger Reloaded, aka UNIX/Linux Digger, however it also works on Windows. From 569449f4641005e83545378e06fb3df4a17ea7b2 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Thu, 31 Aug 2017 00:04:39 +0200 Subject: [PATCH 06/50] Under Windows the command line option /F (fullscreen) is now supported, too. --- main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.c b/main.c index 63d1c4a..1250e99 100644 --- a/main.c +++ b/main.c @@ -705,6 +705,8 @@ void parsecmd(int argc,char *argv[]) if (word[0]=='/' || word[0]=='-') { #if defined(UNIX) && defined(_SDL) argch = getarg(word[1], "FOUH?QM2BCKVL:R:P:S:E:G:X:A:I:", &hasopt); +#elif defined(_SDL) + argch = getarg(word[1], "FOUH?QM2BCKVL:R:P:S:E:G:A:I:", &hasopt); #else argch = getarg(word[1], "OUH?QM2BCKVL:R:P:S:E:G:A:I:", &hasopt); #endif @@ -726,6 +728,9 @@ void parsecmd(int argc,char *argv[]) x11_parent = strtol (&word[i], 0, 0); sdl_set_x11_parent(x11_parent); } +#endif + +#if defined(_SDL) if (argch == 'F') { sdl_enable_fullscreen(); } From 4aa30af82f0d51c5b0518b57d061aefebb5a534d Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Thu, 31 Aug 2017 00:36:58 +0200 Subject: [PATCH 07/50] On systems that use SDL, you can now toggle Window-Mode and Full-Screen mode using F11. --- input.c | 6 +++++- input.h | 2 +- main.c | 6 ++++++ sdl_kbd.h | 3 ++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/input.c b/input.c index 9cefd40..d11948a 100644 --- a/input.c +++ b/input.c @@ -12,7 +12,7 @@ #endif /* global variables first */ -bool escape=false,firepflag=false,fire2pflag=false,pausef=false; +bool escape=false,firepflag=false,fire2pflag=false,pausef=false,toggle=false; bool krdf[17]={false,false,false,false,false,false,false,false,false,false, false,false,false,false,false,false,false}; @@ -329,6 +329,10 @@ void checkkeyb(void) } if (akeypressed==ASCIIF8) /* Save DRF */ savedrf=true; +#if defined(_SDL) + if (akeypressed==ASCIIF11) /* Toggle Full-Screen / Window */ + toggle=true; +#endif if (akeypressed!=27 && akeypressed!='n' && akeypressed!='N') start=true; /* Change number of players */ } diff --git a/input.h b/input.h index 25f8aa5..421a5cf 100644 --- a/input.h +++ b/input.h @@ -10,7 +10,7 @@ void flushkeybuf(void); void findkey(int kn); void clearfire(int n); -extern bool firepflag,fire2pflag,escape; +extern bool firepflag,fire2pflag,escape,toggle; extern int8_t keypressed; extern int16_t akeypressed; diff --git a/main.c b/main.c index 1250e99..36cf65a 100644 --- a/main.c +++ b/main.c @@ -457,6 +457,11 @@ int mainprog(void) if (frame>250) frame=0; } + if (toggle) { + switchmode(); + toggle=false; + continue; + } if (savedrf) { if (gotgame) { recsavedrf(); @@ -476,6 +481,7 @@ int mainprog(void) } savedrf=false; escape=false; + toggle=false; } while (!escape); finish(); return 0; diff --git a/sdl_kbd.h b/sdl_kbd.h index a57dd38..cc5228a 100644 --- a/sdl_kbd.h +++ b/sdl_kbd.h @@ -36,7 +36,8 @@ bool GetAsyncKeyState(int); extern int keycodes[17][5]; -#define ASCIIF8 SDL_SCANCODE_F8 +#define ASCIIF8 SDL_SCANCODE_F8 +#define ASCIIF11 SDL_SCANCODE_F11 #define rightpressed (GetAsyncKeyState(keycodes[0][0])) #define uppressed (GetAsyncKeyState(keycodes[1][0])) From 9a93035e4597fa021fb304357fef3b53d479a681 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Thu, 31 Aug 2017 00:43:41 +0200 Subject: [PATCH 08/50] Fixed the help that is shown with option /? --- main.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 36cf65a..4c76b0d 100644 --- a/main.c +++ b/main.c @@ -795,17 +795,21 @@ void parsecmd(int argc,char *argv[]) " [/A:device,port,irq,dma,rate,length] [/V] [/U] " "[/I:level] " #if defined(UNIX) && defined(_SDL) - "[/X:xid]" + "[/X:xid] " +#endif + +#if defined(_SDL) + "[/F]" #endif "\n\n" #ifndef UNIX "/C = Use CGA graphics\n" "/B = Use BIOS palette functions for CGA (slow!)\n" #endif - "/Q = Quiet mode (no sound at all) " + "/Q = Quiet mode (no sound at all)\n" "/M = No music\n" "/R = Record graphics to file\n" - "/P = Playback and restart program " + "/P = Playback and restart program\n" "/E = Playback and exit program\n" "/O = Loop to beginning of command line\n" "/K = Redefine keyboard\n" @@ -817,6 +821,9 @@ void parsecmd(int argc,char *argv[]) #endif #if defined(UNIX) && defined(_SDL) "/X = Embed in window\n" +#endif +#if defined(_SDL) + "/F = Full-Screen\n" #endif "/U = Allow unlimited lives\n" "/I = Start on a level other than 1\n"); From 61dc297a7334599db6379da0b230e69cf79a6b5e Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Thu, 31 Aug 2017 00:48:47 +0200 Subject: [PATCH 09/50] Added a URL to the GitHub repository of the source code since the code on www.digger.org is completely outdated. --- main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main.c b/main.c index 4c76b0d..b83ecf3 100644 --- a/main.c +++ b/main.c @@ -785,6 +785,7 @@ void parsecmd(int argc,char *argv[]) "Acorn port by Julian Brown\n" #endif "http://www.digger.org\n" + "https://github.com/sobomax/digger\n" "Version: "DIGGER_VERSION"\n\n" "Command line syntax:\n" From aa1c157b99b431a4fa814e23e71547142dce3bb5 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Thu, 31 Aug 2017 20:57:05 +0200 Subject: [PATCH 10/50] F11 (to toggle between Full-Screen and Window-Mode) works now while playing, too. --- main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.c b/main.c index b83ecf3..21bc36c 100644 --- a/main.c +++ b/main.c @@ -228,6 +228,10 @@ void game(void) readdirect(i); while (!alldead && !gamedat[curplayer].levdone && !escape && !timeout) { penalty=0; + if (toggle) { + switchmode(); + toggle=false; + } dodigger(ddap); domonsters(ddap); dobags(ddap); From 8607a6e20bd49a4468fb59b1e03a81384b15222a Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Thu, 31 Aug 2017 22:25:34 +0200 Subject: [PATCH 11/50] On the title screen the Hobbin will now come in as a Hobbin. In previous releases the Hobbin came first in as a Nobbin and then, after a short time, mutated to a Hobbin. This was no bug - it was implemented this way. But from the users view it looked like a bug (and the 1983 Digger worked as it is implemented now). --- main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main.c b/main.c index 21bc36c..f514b5d 100644 --- a/main.c +++ b/main.c @@ -398,6 +398,7 @@ int mainprog(void) } hobbin = monster_obj_ctor(1, MON_NOBBIN, DIR_LEFT, 292, 82); CALL_METHOD(hobbin, put); + CALL_METHOD(hobbin, mutate); } if (frame>90 && frame<=117) { CALL_METHOD(hobbin, getpos, &newpos); @@ -407,9 +408,6 @@ int mainprog(void) } CALL_METHOD(hobbin, setpos, &newpos); } - if (frame == 100) { - CALL_METHOD(hobbin, mutate); - } if (frame > 90) { CALL_METHOD(hobbin, animate); } From 1d5603145fe4f0948bf2c4ee71f4c679b540175c Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Thu, 31 Aug 2017 22:32:01 +0200 Subject: [PATCH 12/50] Removed the "damage" and "kill" effect of the Nobbin and Hobbin just before the right part of the title screen gets blanked. Those effects looked like a gfx bug/glitch so I have removed them. Even the 1983 Digger did not show an effect like this. --- main.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/main.c b/main.c index f514b5d..76a71b5 100644 --- a/main.c +++ b/main.c @@ -442,18 +442,6 @@ int mainprog(void) drawbonus(184,158); if (frame==223) outtext(ddap, "BONUS",216,159,2); - if (frame == 235) { - CALL_METHOD(nobbin, damage); - } - if (frame == 239) { - CALL_METHOD(nobbin, kill); - } - if (frame == 242) { - CALL_METHOD(hobbin, damage); - } - if (frame == 246) { - CALL_METHOD(hobbin, kill); - } newframe(); frame++; if (frame>250) From 1c20ddbfbb4557e7409f16e1fc729987c55617d2 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Thu, 31 Aug 2017 23:12:13 +0200 Subject: [PATCH 13/50] Removed the option /A because it is completely useless nowadays. The sampling rate and buffer size may sill be set in the DIGGER.INI file. I guess this is useless, too.... but who knows. --- device.h | 2 +- digger.txt | 22 +--------------------- fbsd_snd.c | 2 +- main.c | 47 ++++++++++++++++++++++++++--------------------- newsnd.c | 4 ++-- newsnd.h | 2 +- sdl_snd.c | 2 +- 7 files changed, 33 insertions(+), 48 deletions(-) diff --git a/device.h b/device.h index 42e3801..7937623 100644 --- a/device.h +++ b/device.h @@ -9,6 +9,6 @@ extern uint8_t *buffer; extern uint16_t firsts,last,size; -bool setsounddevice(int base,int irq,int dma,uint16_t samprate,uint16_t bufsize); +bool setsounddevice(uint16_t samprate,uint16_t bufsize); bool initsounddevice(void); void killsounddevice(void); diff --git a/digger.txt b/digger.txt index 25c449c..4e4e6da 100644 --- a/digger.txt +++ b/digger.txt @@ -407,8 +407,6 @@ The command line options are: /G:time = Gauntlet mode. /2 = Put two diggers on screen at once. /? = Display this list. - /A:1,port,irq, dma,rate,length - = Use SoundBlaster sound, e.g. /A:1,220,7,1,20000,128. /V = Synchronize timing to screen refresh. /U = Allow unlimited lives. /I:level= Start on the specified level instead of level 1. You can't go on @@ -460,24 +458,6 @@ versions. When one digger dies the other can continue, and after a while the digger that died will be reincarnated (if he has any lives left). He will flash for a short time after being reincarnated. During this time, he is invincible. -/A may eventually be used to enable many different sound cards. However, the -only one currently supported is SoundBlaster, but most sound cards seem to be -able emulate this one. If you do not have a genuine SoundBlaster card, ensure -that your sound card is set up to emulate SoundBlaster before you run the game. -How you do this will depend on your card. If you've set up games before, you -should know how to do this. You should also know the port address, IRQ number -and DMA channel that your card uses. Factory defaults are usually 220,7,1. To -enable SoundBlaster sound, use the /A option as follows: -/A:1,220,7,1,20000,128. The first "1", after the colon, means SoundBlaster. No -other values for the first option have any meaning at the moment. The second -"1" (the fourth option) is the DMA channel, so if you use port 210, IRQ 5 and -DMA channel 3, the option is /A:1,210,5,3,20000,128. The 20000 is the sample -rate (this means 20,000 samples per second). You can change this: higher -numbers give better sound quality, but if this number is too high the sound may -break up. The last option is the buffer length. If the sound is breaking up you -can try increasing this instead of decreasing the sample rate. If the sound -seems to "lag" behind the action, decrease this value. - /U gives you the ability to save up as many lives as you like. See the FAQ section for more information about this. @@ -535,7 +515,7 @@ and Windows with Cygwin toolkit) then do the following: * Make sure that you have the SDL library installed, if not then install it. The SDL library can be found at http://www.devolution.com/~slouken/SDL/ * Build it using "make -f Makefile.sdl". -* Have fun with Digger. To enable sound start it with "/A" option. +* Have fun with Digger. NOTE: If you are using FreeBSD, then it would be much easier for your to check official ports collection first, as it is likely that when you are reading this diff --git a/fbsd_snd.c b/fbsd_snd.c index c28ba4f..922185a 100644 --- a/fbsd_snd.c +++ b/fbsd_snd.c @@ -6,7 +6,7 @@ bool initsounddevice(void) return(0); } -bool setsounddevice(int base, int irq, int dma, uint16_t samprate, uint16_t bufsize) +bool setsounddevice(uint16_t samprate, uint16_t bufsize) { FIXME("setsounddevice called"); return(0); diff --git a/main.c b/main.c index 76a71b5..4ec6762 100644 --- a/main.c +++ b/main.c @@ -305,7 +305,7 @@ void game(void) } static bool quiet=false; -static uint16_t sound_device,sound_port,sound_irq,sound_dma,sound_rate,sound_length; +static sound_rate,sound_length; #if defined(UNIX) && defined(_SDL) #include "sdl_vid.h" @@ -398,7 +398,6 @@ int mainprog(void) } hobbin = monster_obj_ctor(1, MON_NOBBIN, DIR_LEFT, 292, 82); CALL_METHOD(hobbin, put); - CALL_METHOD(hobbin, mutate); } if (frame>90 && frame<=117) { CALL_METHOD(hobbin, getpos, &newpos); @@ -408,6 +407,9 @@ int mainprog(void) } CALL_METHOD(hobbin, setpos, &newpos); } + if (frame == 100) { + CALL_METHOD(hobbin, mutate); + } if (frame > 90) { CALL_METHOD(hobbin, animate); } @@ -442,6 +444,18 @@ int mainprog(void) drawbonus(184,158); if (frame==223) outtext(ddap, "BONUS",216,159,2); + if (frame == 235) { + CALL_METHOD(nobbin, damage); + } + if (frame == 239) { + CALL_METHOD(nobbin, kill); + } + if (frame == 242) { + CALL_METHOD(hobbin, damage); + } + if (frame == 246) { + CALL_METHOD(hobbin, kill); + } newframe(); frame++; if (frame>250) @@ -700,11 +714,11 @@ void parsecmd(int argc,char *argv[]) word=argv[arg]; if (word[0]=='/' || word[0]=='-') { #if defined(UNIX) && defined(_SDL) - argch = getarg(word[1], "FOUH?QM2BCKVL:R:P:S:E:G:X:A:I:", &hasopt); + argch = getarg(word[1], "FOUH?QM2BCKVL:R:P:S:E:G:X:I:", &hasopt); #elif defined(_SDL) - argch = getarg(word[1], "FOUH?QM2BCKVL:R:P:S:E:G:A:I:", &hasopt); + argch = getarg(word[1], "FOUH?QM2BCKVL:R:P:S:E:G:I:", &hasopt); #else - argch = getarg(word[1], "OUH?QM2BCKVL:R:P:S:E:G:A:I:", &hasopt); + argch = getarg(word[1], "OUH?QM2BCKVL:R:P:S:E:G:I:", &hasopt); #endif i = 2; if (argch != -1 && hasopt && word[2] == ':') { @@ -783,16 +797,16 @@ void parsecmd(int argc,char *argv[]) "[/P:playback file]\n" " [/E:playback file] [/R:record file] [/O] [/K[A]] " "[/G[:time]] [/2]\n" - " [/A:device,port,irq,dma,rate,length] [/V] [/U] " - "[/I:level] " + " [/V] [/U] [/I:level] " + #if defined(UNIX) && defined(_SDL) - "[/X:xid] " + "[/X:xid] " #endif #if defined(_SDL) - "[/F]" + "[/F]" #endif - "\n\n" + "\n\n" #ifndef UNIX "/C = Use CGA graphics\n" "/B = Use BIOS palette functions for CGA (slow!)\n" @@ -806,7 +820,6 @@ void parsecmd(int argc,char *argv[]) "/K = Redefine keyboard\n" "/G = Gauntlet mode\n" "/2 = Two player simultaneous mode\n" - "/A = Use alternate sound device\n" #ifndef UNIX "/V = Synchronize timing to vertical retrace\n" #endif @@ -848,9 +861,6 @@ void parsecmd(int argc,char *argv[]) else redefkeyb(false); } - if (argch =='A') - sscanf(word+i,"%hu,%hx,%hu,%hu,%hu,%hu",&sound_device,&sound_port,&sound_irq, - &sound_dma,&sound_rate,&sound_length); if (argch == 'Q') quiet=true; if (argch == 'V') @@ -967,13 +977,8 @@ void inir(void) } soundflag=GetINIBool(INI_SOUND_SETTINGS,"SoundOn",true,ININAME); musicflag=GetINIBool(INI_SOUND_SETTINGS,"MusicOn",true,ININAME); - sound_device=(int)GetINIInt(INI_SOUND_SETTINGS,"Device",DEF_SND_DEV,ININAME); - sound_port=(int)GetINIInt(INI_SOUND_SETTINGS,"Port",544,ININAME); - sound_irq=(int)GetINIInt(INI_SOUND_SETTINGS,"Irq",5,ININAME); - sound_dma=(int)GetINIInt(INI_SOUND_SETTINGS,"DMA",1,ININAME); sound_rate=(int)GetINIInt(INI_SOUND_SETTINGS,"Rate",22050,ININAME); - sound_length=(int)GetINIInt(INI_SOUND_SETTINGS,"BufferSize",DEFAULT_BUFFER, - ININAME); + sound_length=(int)GetINIInt(INI_SOUND_SETTINGS,"BufferSize",DEFAULT_BUFFER,ININAME); #if !defined(UNIX) && !defined(_SDL) if (sound_device==1) { @@ -992,7 +997,7 @@ void inir(void) timer0=s1timer0; settimer2=s1settimer2; timer2=s1timer2; - soundinitglob(sound_port,sound_irq,sound_dma,sound_length,sound_rate); + soundinitglob(sound_length,sound_rate); } dx_sound_volume=(int)GetINIInt(INI_SOUND_SETTINGS,"SoundVolume",0,ININAME); g_bWindowed=true; diff --git a/newsnd.c b/newsnd.c index b243965..9cc046b 100644 --- a/newsnd.c +++ b/newsnd.c @@ -50,10 +50,10 @@ uint8_t getsample(void); to take into account. bufsize should also be a power of 2. */ -void soundinitglob(int port,int irq,int dma,uint16_t bufsize,uint16_t samprate) +void soundinitglob(uint16_t bufsize,uint16_t samprate) { int i; - setsounddevice(port,irq,dma,samprate,bufsize); + setsounddevice(samprate,bufsize); buffer=malloc((bufsize<<1)*sizeof(uint8_t)); rate=(int)(0x1234ddul/(uint32_t)samprate); firsts=0; diff --git a/newsnd.h b/newsnd.h index c00412a..ab2c83b 100644 --- a/newsnd.h +++ b/newsnd.h @@ -3,7 +3,7 @@ #include "device.h" -void soundinitglob(int port,int irq,int dma,uint16_t bufsize,uint16_t samprate); +void soundinitglob(uint16_t bufsize,uint16_t samprate); void s1setupsound(void); void s1killsound(void); void s1fillbuffer(void); diff --git a/sdl_snd.c b/sdl_snd.c index e48f8cc..c20ceed 100644 --- a/sdl_snd.c +++ b/sdl_snd.c @@ -27,7 +27,7 @@ struct sudata { struct bqd_filter *hp_fltr; }; -bool setsounddevice(int base, int irq, int dma, uint16_t samprate, uint16_t bufsize) +bool setsounddevice(uint16_t samprate, uint16_t bufsize) { SDL_AudioSpec wanted; struct sudata *sud; From 3b9240df42df0c7264120f007a04d2fef4cfd8d3 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Thu, 31 Aug 2017 23:20:28 +0200 Subject: [PATCH 14/50] Removed the completely useless option /B (BIOS palette) --- main.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/main.c b/main.c index 4ec6762..4fbf6a3 100644 --- a/main.c +++ b/main.c @@ -42,7 +42,6 @@ bool started; char levfname[132]; bool levfflag=false; -static bool biosflag=false; FILE *digger_log; void shownplayers(void); @@ -714,11 +713,11 @@ void parsecmd(int argc,char *argv[]) word=argv[arg]; if (word[0]=='/' || word[0]=='-') { #if defined(UNIX) && defined(_SDL) - argch = getarg(word[1], "FOUH?QM2BCKVL:R:P:S:E:G:X:I:", &hasopt); + argch = getarg(word[1], "FOUH?QM2CKVL:R:P:S:E:G:X:I:", &hasopt); #elif defined(_SDL) - argch = getarg(word[1], "FOUH?QM2BCKVL:R:P:S:E:G:I:", &hasopt); + argch = getarg(word[1], "FOUH?QM2CKVL:R:P:S:E:G:I:", &hasopt); #else - argch = getarg(word[1], "OUH?QM2BCKVL:R:P:S:E:G:I:", &hasopt); + argch = getarg(word[1], "OUH?QM2CKVL:R:P:S:E:G:I:", &hasopt); #endif i = 2; if (argch != -1 && hasopt && word[2] == ':') { @@ -793,7 +792,7 @@ void parsecmd(int argc,char *argv[]) "Version: "DIGGER_VERSION"\n\n" "Command line syntax:\n" - " DIGGER [[/S:]speed] [[/L:]level file] [/C] [/B] [/Q] [/M] " + " DIGGER [[/S:]speed] [[/L:]level file] [/C] [/Q] [/M] " "[/P:playback file]\n" " [/E:playback file] [/R:record file] [/O] [/K[A]] " "[/G[:time]] [/2]\n" @@ -809,7 +808,6 @@ void parsecmd(int argc,char *argv[]) "\n\n" #ifndef UNIX "/C = Use CGA graphics\n" - "/B = Use BIOS palette functions for CGA (slow!)\n" #endif "/Q = Quiet mode (no sound at all)\n" "/M = No music\n" @@ -850,8 +848,6 @@ void parsecmd(int argc,char *argv[]) ddap->gputim=cgaputim; ddap->gwrite=cgawrite; ddap->gtitle=cgatitle; - if (argch == 'B') - biosflag=true; ddap->ginit(); ddap->gpal(0); } @@ -1007,8 +1003,7 @@ void inir(void) ININAME); synchvid=GetINIBool(INI_GRAPHICS_SETTINGS,"Synch",false,ININAME); cgaflag=GetINIBool(INI_GRAPHICS_SETTINGS,"CGA",false,ININAME); - biosflag=GetINIBool(INI_GRAPHICS_SETTINGS,"BIOSPalette",false,ININAME); - if (cgaflag || biosflag) { + if (cgaflag) { ddap->ginit=cgainit; ddap->gpal=cgapal; ddap->ginten=cgainten; From ede6d9341ed82ae717aedd3aec3ce407535160fb Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Thu, 31 Aug 2017 23:30:28 +0200 Subject: [PATCH 15/50] Removed documentation of command line option /B --- digger.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/digger.txt b/digger.txt index 4e4e6da..455cb4a 100644 --- a/digger.txt +++ b/digger.txt @@ -393,9 +393,6 @@ The command line options are: /C = Use CGA graphics - these are faster than VGA but this is only really noticeable if you have a slower computer or are playing at high speeds. - /B = Use CGA graphics with BIOS palette functions (try this if the - palette doesn't work properly with the /C option, but be warned: it - might cause a crash if you get a high score). /Q = Quiet mode (no sound at all). /M = Turn background music off. /R:name = Record game to file "name". From 27a055bd90487e987f6dcd5e95ffb06170b39b71 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Thu, 31 Aug 2017 23:40:59 +0200 Subject: [PATCH 16/50] The settings GauntletMode, Players, SoundOn and MusicOn can no longer be specified in the DIGGER.INI file. Currently if they are presend, they are considered. But there are also command line options that assign values to this settings. So... who should win? If the DIGGER.INI conatins "SoundOn=false", how should th user turn the sounds on? If the DIGGER.INI conatains "Players=2", how to play in single user mode? So let's ignore those settings. This also makes the command line options "/G" and "/2" work again. --- main.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/main.c b/main.c index 4fbf6a3..192f719 100644 --- a/main.c +++ b/main.c @@ -958,21 +958,6 @@ void inir(void) if (ftime == 0) { ftime=GetINIInt(INI_GAME_SETTINGS,"Speed",80000l,ININAME); } - gauntlet=GetINIBool(INI_GAME_SETTINGS,"GauntletMode",false,ININAME); - GetINIString(INI_GAME_SETTINGS,"Players","1",vbuf,80,ININAME); - strupr(vbuf); - if (vbuf[0]=='2' && vbuf[1]=='S') { - diggers=2; - nplayers=1; - } - else { - diggers=1; - nplayers=atoi(vbuf); - if (nplayers<1 || nplayers>2) - nplayers=1; - } - soundflag=GetINIBool(INI_SOUND_SETTINGS,"SoundOn",true,ININAME); - musicflag=GetINIBool(INI_SOUND_SETTINGS,"MusicOn",true,ININAME); sound_rate=(int)GetINIInt(INI_SOUND_SETTINGS,"Rate",22050,ININAME); sound_length=(int)GetINIInt(INI_SOUND_SETTINGS,"BufferSize",DEFAULT_BUFFER,ININAME); From ce0031d0c15e83ce5e0afaeb0d0afc923fdb9a8e Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Thu, 31 Aug 2017 23:46:38 +0200 Subject: [PATCH 17/50] In a previous commit I messed up the title screen - now the Hobbin comes in as a Hobbin again and the "effects" before the right half of the screen gets blanked are removed again. --- main.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/main.c b/main.c index 192f719..66266c6 100644 --- a/main.c +++ b/main.c @@ -397,6 +397,7 @@ int mainprog(void) } hobbin = monster_obj_ctor(1, MON_NOBBIN, DIR_LEFT, 292, 82); CALL_METHOD(hobbin, put); + CALL_METHOD(hobbin, mutate); } if (frame>90 && frame<=117) { CALL_METHOD(hobbin, getpos, &newpos); @@ -406,9 +407,6 @@ int mainprog(void) } CALL_METHOD(hobbin, setpos, &newpos); } - if (frame == 100) { - CALL_METHOD(hobbin, mutate); - } if (frame > 90) { CALL_METHOD(hobbin, animate); } @@ -443,18 +441,6 @@ int mainprog(void) drawbonus(184,158); if (frame==223) outtext(ddap, "BONUS",216,159,2); - if (frame == 235) { - CALL_METHOD(nobbin, damage); - } - if (frame == 239) { - CALL_METHOD(nobbin, kill); - } - if (frame == 242) { - CALL_METHOD(hobbin, damage); - } - if (frame == 246) { - CALL_METHOD(hobbin, kill); - } newframe(); frame++; if (frame>250) From ead638db552e178be0dbf3252a9b603f37ab4e7d Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Fri, 1 Sep 2017 00:11:46 +0200 Subject: [PATCH 18/50] When pressing "x" the game no longer toggles between one and two player mode. Instead the game toggles between all possible game modes. --- main.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index 66266c6..c0a4d07 100644 --- a/main.c +++ b/main.c @@ -361,8 +361,7 @@ int mainprog(void) teststart(); while (!started) { started=teststart(); - if ((akeypressed==27 || akeypressed=='n' || akeypressed=='N') && - !gauntlet && diggers==1) { + if (akeypressed==27 || akeypressed=='n' || akeypressed=='N') { switchnplayers(); shownplayers(); akeypressed=0; @@ -487,6 +486,9 @@ void finish(void) void shownplayers(void) { + outtext(ddap, " ",180,25,3); + outtext(ddap, " ",170,39,3); + if (diggers==2) if (gauntlet) { outtext(ddap, "TWO PLAYER",180,25,3); @@ -522,7 +524,21 @@ int getalllives(void) void switchnplayers(void) { - nplayers=3-nplayers; + if (!gauntlet && nplayers==1 && diggers==1) { + nplayers=2; + } else if (!gauntlet && nplayers==2 && diggers==1) { + diggers=2; + } else if (!gauntlet && nplayers==2 && diggers==2) { + gauntlet=true; + diggers=1; + nplayers=1; + } else if (gauntlet && nplayers==1 && diggers==1) { + diggers=2; + } else { + gauntlet=false; + nplayers=1; + diggers=1; + } } void initlevel(void) From 5fbe26f9fd71f343eca430a9cbf2a01d7f8cfd7e Mon Sep 17 00:00:00 2001 From: Michael Knigge Date: Fri, 1 Sep 2017 16:22:17 +0200 Subject: [PATCH 19/50] Added a link to www.digger.org the the README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 79a542e..0155176 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,9 @@ copy-protected, bootable 5.25" floppy disk for the IBM PC. As it requires a genuine CGA card, it didn't work on modern PCs. In 1998, Andrew Jenner , created Digger Remastered, which runs -on all PCs with CGA or better and plays just like the original. +on all PCs with CGA or better and plays just like the original. See http://digger.org for +more information about his remake, the history of the game as well as the history +of Winmill Software and their other games. Later on, Maksym Sobolyev , ported Adnrew's code to run on Linux/FreeBSD/Windows using SDL library, or on FreeBSD console using From 873a03e3822d52fed7dd55c9e867e2a83c7298f8 Mon Sep 17 00:00:00 2001 From: Michael Knigge Date: Fri, 1 Sep 2017 16:23:31 +0200 Subject: [PATCH 20/50] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0155176..bf781ee 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ genuine CGA card, it didn't work on modern PCs. In 1998, Andrew Jenner , created Digger Remastered, which runs on all PCs with CGA or better and plays just like the original. See http://digger.org for more information about his remake, the history of the game as well as the history -of Winmill Software and their other games. +of Windmill Software and their other games. Later on, Maksym Sobolyev , ported Adnrew's code to run on Linux/FreeBSD/Windows using SDL library, or on FreeBSD console using From 39f17d1a0ce1cf9a4d64627b5f01df593d2390bd Mon Sep 17 00:00:00 2001 From: Michael Knigge Date: Fri, 1 Sep 2017 21:35:40 +0200 Subject: [PATCH 21/50] Update README.md --- README.md | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index bf781ee..af956e8 100644 --- a/README.md +++ b/README.md @@ -19,25 +19,21 @@ developed to move Digger into XXI century. Some plans for the future releases include: - 2.0, aka "Digger Reset" - - o SDL 2.0 port (done); - o further code cleanup (i.e. elimination of the d3adc0d3: WIN16, ETC), more - logic moved into high-level objects (in-progress); - o headless (VNC?) mode; - o network play for 2 players; - o screen update framerate that is independent of game perceived speed, - "sub-pixel" updates. + - [x] SDL 2.0 port + - [ ] further code cleanup (in-progress) + - [ ] headless (VNC?) mode + - [ ] network play for 2 players + - [ ] screen update framerate that is independent of game perceived speed, "sub-pixel" updates - 3.0, aka "Digger Reloaded" - o bigger (open?) game world; - o MMOG mode; - o deathmatch mode; - o new capabilities to the characters (i.e. superpowers), and interactions between - them (i.e. gradual damage); - o few types of diggers: scout, soldier, sniper etc. - o monster AI 2.0? - o digger AI to make teamplay/deathmatch interesting even in single-player mode. - o teamplay. + - [ ] bigger (open?) game world; + - [ ] MMOG mode; + - [ ] deathmatch mode; + - [ ] new capabilities to the characters (i.e. superpowers), and interactions between them (i.e. gradual damage); + - [ ] few types of diggers: scout, soldier, sniper etc. + - [ ] monster AI 2.0? + - [ ] digger AI to make teamplay/deathmatch interesting even in single-player mode. + - [ ] teamplay. We plan to keep the source code free and open at all times. From 3bb8ba210186fa6c32ac2926d5207c313ef20d27 Mon Sep 17 00:00:00 2001 From: Michael Knigge Date: Fri, 1 Sep 2017 21:36:12 +0200 Subject: [PATCH 22/50] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index af956e8..44c7ceb 100644 --- a/README.md +++ b/README.md @@ -27,13 +27,13 @@ Some plans for the future releases include: - 3.0, aka "Digger Reloaded" - - [ ] bigger (open?) game world; - - [ ] MMOG mode; - - [ ] deathmatch mode; - - [ ] new capabilities to the characters (i.e. superpowers), and interactions between them (i.e. gradual damage); + - [ ] bigger (open?) game world + - [ ] MMOG mode + - [ ] deathmatch mode + - [ ] new capabilities to the characters (i.e. superpowers), and interactions between them (i.e. gradual damage) - [ ] few types of diggers: scout, soldier, sniper etc. - [ ] monster AI 2.0? - - [ ] digger AI to make teamplay/deathmatch interesting even in single-player mode. - - [ ] teamplay. + - [ ] digger AI to make teamplay/deathmatch interesting even in single-player mode + - [ ] teamplay We plan to keep the source code free and open at all times. From dc021c489e409b0c06a3ada59dc310c525d598eb Mon Sep 17 00:00:00 2001 From: Michael Knigge Date: Fri, 1 Sep 2017 21:48:05 +0200 Subject: [PATCH 23/50] Update README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 44c7ceb..0670bf0 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,16 @@ Some plans for the future releases include: - 2.0, aka "Digger Reset" - [x] SDL 2.0 port + - [x] fullscreen mode for Windows + - [x] toggle fullscreen and window mode with F11 + - [ ] installer for Windows + - [ ] make CGA graphics available again (for nostalgia) - [ ] further code cleanup (in-progress) + - [x] move logicinto high-level objects + - [x] remove obsolete command line options + - [ ] remove obsolete DOS functions (i. e. function s0setupsound() and so on) + - [ ] remove ARM specific code (SDL 2.0 is not available on ARM, so the ARM specific code is useless) + - [ ] remove DIGGER_VERSION and give Digger a regular version number - [ ] headless (VNC?) mode - [ ] network play for 2 players - [ ] screen update framerate that is independent of game perceived speed, "sub-pixel" updates From 72c64c234dafbb1458fc5c89e9b5f2634e1b2dc0 Mon Sep 17 00:00:00 2001 From: Michael Knigge Date: Fri, 1 Sep 2017 21:50:06 +0200 Subject: [PATCH 24/50] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0670bf0..5339647 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Some plans for the future releases include: - [ ] installer for Windows - [ ] make CGA graphics available again (for nostalgia) - [ ] further code cleanup (in-progress) - - [x] move logicinto high-level objects + - [x] move logic into high-level objects - [x] remove obsolete command line options - [ ] remove obsolete DOS functions (i. e. function s0setupsound() and so on) - [ ] remove ARM specific code (SDL 2.0 is not available on ARM, so the ARM specific code is useless) From 0ee897aecf582eaa82a6b4e3b75d36971a36c50c Mon Sep 17 00:00:00 2001 From: Michael Knigge Date: Fri, 1 Sep 2017 21:54:50 +0200 Subject: [PATCH 25/50] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 5339647..f80c54d 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,7 @@ Some plans for the future releases include: - [ ] headless (VNC?) mode - [ ] network play for 2 players - [ ] screen update framerate that is independent of game perceived speed, "sub-pixel" updates + - [ ] build Digger on FreeBSD automatically, see http://erouault.blogspot.de/2016/09/running-freebsd-in-travis-ci.html - 3.0, aka "Digger Reloaded" From 8ad92ddd5f8e4a768343364de49483f2b0983ae7 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Fri, 1 Sep 2017 22:28:55 +0200 Subject: [PATCH 26/50] Reverted the build-strategy on the CI-Servers. Digger is now built for Linux *AND* Windows on Travis-CI (running Linux) again. On AppVeyor Digger is also built for Windows using Visual Studio. Note that the executable of the utility windres is named differently on Linux and Windows. We use the "Linux-Name" in the Makefile and override the name for Windows in the file appveyor.yml --- .travis.yml | 8 +++----- Makefile | 6 +++--- appveyor.yml | 2 ++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index dad0995..7f37502 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,7 @@ -before_install: - - sudo apt-add-repository --yes ppa:zoogie/sdl2-snapshots - - sudo apt-get -qq update - - sudo apt-get install -qq libsdl2-dev +sudo: required language: c compiler: + - clang - gcc script: - make + sh -x ./scripts/do-test.sh diff --git a/Makefile b/Makefile index d7b1078..845d3cb 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CC ?= gcc +CC ?= gcc CFLAGS += -O -g -pipe -DDIGGER_DEBUG RCFLAGS = -D_SDL -std=c99 -Wall OBJS = main.o digger.o drawing.o sprite.o scores.o record.o sound.o \ @@ -14,8 +14,8 @@ ARCH ?= LINUX ifeq ($(ARCH),MINGW) MINGW_DEPS_ROOT ?= ../ -CC = i686-w64-mingw32-gcc -WINDRES = windres +CC = i686-w64-mingw32-gcc +WINDRES ?= i686-w64-mingw32-windres RCFLAGS += -DMINGW -Dmain=SDL_main -I${MINGW_DEPS_ROOT}/zlib-1.2.8/include -I${MINGW_DEPS_ROOT}/SDL2-2.0.3/include LIBS += -mwindows -lmingw32 -L${MINGW_DEPS_ROOT}/SDL2-2.0.3/i686-w64-mingw32/lib -lSDL2main -lSDL2 -luser32 -lgdi32 -lwinmm -L${MINGW_DEPS_ROOT}/zlib-1.2.8/lib -lzdll -lm ESUFFIX = .exe diff --git a/appveyor.yml b/appveyor.yml index b16fd92..3cac862 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,6 +8,8 @@ build_script: set ARCH=MINGW + set WINDRES=windres + echo === Download zlib ================================================== From 87b4a83b8418c3cf04eb32a5d252fd6536902558 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Fri, 1 Sep 2017 22:37:50 +0200 Subject: [PATCH 27/50] Fixed compiling with CLang --- main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index c0a4d07..b9acba0 100644 --- a/main.c +++ b/main.c @@ -227,10 +227,12 @@ void game(void) readdirect(i); while (!alldead && !gamedat[curplayer].levdone && !escape && !timeout) { penalty=0; +#if defined(_SDL) if (toggle) { switchmode(); toggle=false; } +#endif dodigger(ddap); domonsters(ddap); dobags(ddap); @@ -304,9 +306,9 @@ void game(void) } static bool quiet=false; -static sound_rate,sound_length; +static int sound_rate,sound_length; -#if defined(UNIX) && defined(_SDL) +#if defined(_SDL) #include "sdl_vid.h" #endif @@ -445,11 +447,13 @@ int mainprog(void) if (frame>250) frame=0; } +#if defined(_SDL) if (toggle) { switchmode(); toggle=false; continue; } +#endif if (savedrf) { if (gotgame) { recsavedrf(); From 83e82021b97ec8883fac06ce40a7a307376d6e61 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Fri, 1 Sep 2017 22:42:33 +0200 Subject: [PATCH 28/50] Fixed compiling with CLang (now hopefully really) --- main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.c b/main.c index b9acba0..2f58fb8 100644 --- a/main.c +++ b/main.c @@ -25,6 +25,10 @@ #include "ini.h" #include "draw_api.h" +#if defined(_SDL) +#include "sdl_vid.h" +#endif + /* global variables */ char pldispbuf[14]; int16_t curplayer=0,nplayers=1,penalty=0,diggers=1,startlev=1; @@ -308,10 +312,6 @@ void game(void) static bool quiet=false; static int sound_rate,sound_length; -#if defined(_SDL) -#include "sdl_vid.h" -#endif - void maininit(void) { static int maininited = 0; From e354705fa8b8d895de0eecb8e5da44080113882e Mon Sep 17 00:00:00 2001 From: Michael Knigge Date: Fri, 1 Sep 2017 23:02:42 +0200 Subject: [PATCH 29/50] Added a GPLv2 Badge. The original Digger Remastered source code was release under the GPL (see http://digger.org/faq.html) in 1998. Since the GPL v3 was released 2007, I guess that GPLv2 is the correct licence. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f80c54d..4e4005d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/michaelknigge/digger.svg?branch=master)](https://travis-ci.org/michaelknigge/digger) [![Build status](https://ci.appveyor.com/api/projects/status/j89k9v2qrxqp6mgt/branch/master?svg=true)](https://ci.appveyor.com/project/michaelknigge/digger/branch/master) +[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) [![Build Status](https://travis-ci.org/michaelknigge/digger.svg?branch=master)](https://travis-ci.org/michaelknigge/digger) [![Build status](https://ci.appveyor.com/api/projects/status/j89k9v2qrxqp6mgt/branch/master?svg=true)](https://ci.appveyor.com/project/michaelknigge/digger/branch/master) # This is Digger Reloaded, aka UNIX/Linux Digger, however it also works on Windows. From 3132bb6fbac15daa9255a41f635154957a2d730b Mon Sep 17 00:00:00 2001 From: Michael Knigge Date: Fri, 1 Sep 2017 23:07:48 +0200 Subject: [PATCH 30/50] Added a Download-Link for the Windows-Version --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e4005d..bf4051b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) [![Build Status](https://travis-ci.org/michaelknigge/digger.svg?branch=master)](https://travis-ci.org/michaelknigge/digger) [![Build status](https://ci.appveyor.com/api/projects/status/j89k9v2qrxqp6mgt/branch/master?svg=true)](https://ci.appveyor.com/project/michaelknigge/digger/branch/master) +[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) +[![Build Status](https://travis-ci.org/michaelknigge/digger.svg?branch=master)](https://travis-ci.org/michaelknigge/digger) +[![Build status](https://ci.appveyor.com/api/projects/status/j89k9v2qrxqp6mgt/branch/master?svg=true)](https://ci.appveyor.com/project/michaelknigge/digger/branch/master) +[![Download ZIP](https://img.shields.io/badge/Windows-Download_ZIP-orange.svg)](https://ci.appveyor.com/api/projects/michaelknigge/digger/artifacts/digger-win32.zip?branch=master) # This is Digger Reloaded, aka UNIX/Linux Digger, however it also works on Windows. From 1d19417032404f51871b768a84600befede7f792 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Fri, 1 Sep 2017 23:22:24 +0200 Subject: [PATCH 31/50] Upgraded SDL from 2.0.3 to 2.0.5 --- Makefile | 8 ++++---- appveyor.yml | 4 ++-- scripts/do-test.sh | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 845d3cb..f419334 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CC ?= gcc +CC ?= gcc CFLAGS += -O -g -pipe -DDIGGER_DEBUG RCFLAGS = -D_SDL -std=c99 -Wall OBJS = main.o digger.o drawing.o sprite.o scores.o record.o sound.o \ @@ -14,10 +14,10 @@ ARCH ?= LINUX ifeq ($(ARCH),MINGW) MINGW_DEPS_ROOT ?= ../ -CC = i686-w64-mingw32-gcc +CC = i686-w64-mingw32-gcc WINDRES ?= i686-w64-mingw32-windres -RCFLAGS += -DMINGW -Dmain=SDL_main -I${MINGW_DEPS_ROOT}/zlib-1.2.8/include -I${MINGW_DEPS_ROOT}/SDL2-2.0.3/include -LIBS += -mwindows -lmingw32 -L${MINGW_DEPS_ROOT}/SDL2-2.0.3/i686-w64-mingw32/lib -lSDL2main -lSDL2 -luser32 -lgdi32 -lwinmm -L${MINGW_DEPS_ROOT}/zlib-1.2.8/lib -lzdll -lm +RCFLAGS += -DMINGW -Dmain=SDL_main -I${MINGW_DEPS_ROOT}/zlib-1.2.8/include -I${MINGW_DEPS_ROOT}/SDL2-2.0.5/i686-w64-mingw32/include/SDL2 +LIBS += -mwindows -lmingw32 -L${MINGW_DEPS_ROOT}/SDL2-2.0.5/i686-w64-mingw32/lib -lSDL2main -lSDL2 -luser32 -lgdi32 -lwinmm -L${MINGW_DEPS_ROOT}/zlib-1.2.8/lib -lzdll -lm ESUFFIX = .exe OBJS += digger.res endif diff --git a/appveyor.yml b/appveyor.yml index 3cac862..29052ac 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -28,7 +28,7 @@ build_script: echo === Download SDL =================================================== - curl -s https://www.libsdl.org/release/SDL2-devel-2.0.3-mingw.tar.gz | tar -xz + curl -s https://www.libsdl.org/release/SDL2-devel-2.0.5-mingw.tar.gz | tar -xz echo === Build Digger =================================================== @@ -42,7 +42,7 @@ build_script: copy ..\zlib-1.2.8\zlib1.dll - copy ..\SDL2-2.0.3\i686-w64-mingw32\bin\SDL2.dll + copy ..\SDL2-2.0.5\i686-w64-mingw32\bin\SDL2.dll zip -j digger-win32.zip digger.exe digger.txt zlib1.dll SDL2.dll diff --git a/scripts/do-test.sh b/scripts/do-test.sh index 5c98af2..b5f5996 100755 --- a/scripts/do-test.sh +++ b/scripts/do-test.sh @@ -10,8 +10,8 @@ sudo apt-get remove -qq -y mingw32 sudo apt-get install -qq libsdl2-dev mingw-w64 mkdir deps cd deps -wget https://www.libsdl.org/release/SDL2-devel-2.0.3-mingw.tar.gz -tar xfz SDL2-devel-2.0.3-mingw.tar.gz +wget https://www.libsdl.org/release/SDL2-devel-2.0.5-mingw.tar.gz +tar xfz SDL2-devel-2.0.5-mingw.tar.gz wget http://zlib.net/zlib128-dll.zip mkdir zlib-1.2.8 cd zlib-1.2.8 From a57aaf17353d686e0a2e13e14021dfc76936db94 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Fri, 1 Sep 2017 23:33:47 +0200 Subject: [PATCH 32/50] Added note of the license of Digger Remastered. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bf4051b..9ee3cf4 100644 --- a/README.md +++ b/README.md @@ -49,4 +49,4 @@ Some plans for the future releases include: - [ ] digger AI to make teamplay/deathmatch interesting even in single-player mode - [ ] teamplay -We plan to keep the source code free and open at all times. +We plan to keep the source code free and open at all times. Digger Remastered is licensed under the terms of GNU General Public License version 2. From eb766d7f880c1b37f34ea6640911b906c08e8062 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Fri, 1 Sep 2017 23:40:11 +0200 Subject: [PATCH 33/50] Removed -DDIGGER_DEBUG from the Makefiles because building Digger should do not build in debug stuff. Furthermore, the debug messages are (sometimes) written to stderr which is not visible under Windows for a GUI application (so it is completely useless). To compile with defined DIGGER_DEBUG one can still invoke "make CFLAGS=-DDIGGER_DEBUG" --- Makefile | 2 +- Makefile.fbsd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f419334..d2fd111 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CC ?= gcc -CFLAGS += -O -g -pipe -DDIGGER_DEBUG +CFLAGS += -O -g -pipe RCFLAGS = -D_SDL -std=c99 -Wall OBJS = main.o digger.o drawing.o sprite.o scores.o record.o sound.o \ newsnd.o ini.o input.o monster.o bags.o alpha.o vgagrafx.o \ diff --git a/Makefile.fbsd b/Makefile.fbsd index 52727ae..3d5227e 100644 --- a/Makefile.fbsd +++ b/Makefile.fbsd @@ -6,7 +6,7 @@ SRCS= main.c digger.c drawing.c sprite.c scores.c record.c sound.c \ monster_obj.h digger_obj.c digger_obj.h bullet_obj.c \ bullet_obj.h -CFLAGS+= -DFREEBSD -DDIGGER_DEBUG +CFLAGS+= -DFREEBSD LDADD+= -lz -lm From 6e2c165a22ecc70fbc0f695bb2a02e1eafb9bbcc Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Fri, 1 Sep 2017 23:59:40 +0200 Subject: [PATCH 34/50] When building on AppVeyor we use version 1.2.11 of zlib instead of the outdated version 1.2.8. First of security reasons and second because the currently used version 1.2.8 is (afaik) no official release of zlib ("official" within the meaning that the link to the file http://zlib.net/zlib128-dll.zip is not documented on th zlib web site). --- Makefile | 4 ++-- appveyor.yml | 41 ++++++++++++++++++++++++++++++++++++----- scripts/do-test.sh | 4 ++-- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index d2fd111..474e889 100644 --- a/Makefile +++ b/Makefile @@ -16,8 +16,8 @@ ifeq ($(ARCH),MINGW) MINGW_DEPS_ROOT ?= ../ CC = i686-w64-mingw32-gcc WINDRES ?= i686-w64-mingw32-windres -RCFLAGS += -DMINGW -Dmain=SDL_main -I${MINGW_DEPS_ROOT}/zlib-1.2.8/include -I${MINGW_DEPS_ROOT}/SDL2-2.0.5/i686-w64-mingw32/include/SDL2 -LIBS += -mwindows -lmingw32 -L${MINGW_DEPS_ROOT}/SDL2-2.0.5/i686-w64-mingw32/lib -lSDL2main -lSDL2 -luser32 -lgdi32 -lwinmm -L${MINGW_DEPS_ROOT}/zlib-1.2.8/lib -lzdll -lm +RCFLAGS += -DMINGW -Dmain=SDL_main -I${MINGW_DEPS_ROOT}/zlib/include -I${MINGW_DEPS_ROOT}/SDL2-2.0.5/i686-w64-mingw32/include/SDL2 +LIBS += -mwindows -lmingw32 -L${MINGW_DEPS_ROOT}/SDL2-2.0.5/i686-w64-mingw32/lib -lSDL2main -lSDL2 -luser32 -lgdi32 -lwinmm -L${MINGW_DEPS_ROOT}/zlib/lib -lzdll -lm ESUFFIX = .exe OBJS += digger.res endif diff --git a/appveyor.yml b/appveyor.yml index 29052ac..d1bac48 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,13 +15,44 @@ build_script: cd .. - wget http://zlib.net/zlib128-dll.zip + curl -s https://zlib.net/zlib-1.2.11.tar.gz | tar xz - mkdir zlib-1.2.8 - cd zlib-1.2.8 + echo === Build zlib ===================================================== + + ren zlib-1.2.11 zlib + + cd zlib + + call "%VS90COMNTOOLS%\vsvars32.bat" + + nmake -f win32/Makefile.msc + + + echo === Copy zlib include files ======================================== + + mkdir include + + copy zlib.h include + + copy zconf.h include + + + echo === Copy zlib import libraries ===================================== + + mkdir lib + + copy zlib.lib lib + + copy zdll.lib lib + + + echo === Copy zlib binary =============================================== + + mkdir bin + + copy zlib1.dll bin - unzip ../zlib128-dll.zip cd .. @@ -40,7 +71,7 @@ build_script: echo === Create Artifact ================================================ - copy ..\zlib-1.2.8\zlib1.dll + copy ..\zlib\zlib1.dll copy ..\SDL2-2.0.5\i686-w64-mingw32\bin\SDL2.dll diff --git a/scripts/do-test.sh b/scripts/do-test.sh index b5f5996..03a4d6e 100755 --- a/scripts/do-test.sh +++ b/scripts/do-test.sh @@ -13,8 +13,8 @@ cd deps wget https://www.libsdl.org/release/SDL2-devel-2.0.5-mingw.tar.gz tar xfz SDL2-devel-2.0.5-mingw.tar.gz wget http://zlib.net/zlib128-dll.zip -mkdir zlib-1.2.8 -cd zlib-1.2.8 +mkdir zlib +cd zlib unzip ../zlib128-dll.zip cd ../.. From 8ad5d82d8330d096c53418d3fbf22d749b304753 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Sat, 2 Sep 2017 00:57:09 +0200 Subject: [PATCH 35/50] Added a LICENSE file (GPL v2) --- LICENSE | 280 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 280 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d8cf7d4 --- /dev/null +++ b/LICENSE @@ -0,0 +1,280 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS From 5a4d0b064dd89886c46bb0f9bf976dc4c885008a Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Sat, 2 Sep 2017 00:58:14 +0200 Subject: [PATCH 36/50] When AppVeyor builds Digger, an Installer for Microsoft Windows will be created, too --- README.txt | 20 ++++++++++++++++++++ appveyor.yml | 17 +++++++++++++++++ digger.iss | 29 +++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 README.txt create mode 100644 digger.iss diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..c03d95b --- /dev/null +++ b/README.txt @@ -0,0 +1,20 @@ +Digger was originally created by Windmill Software in 1983 and released as a +copy-protected, bootable 5.25" floppy disk for the IBM PC. As it requires a +genuine CGA card, it didn't work on modern PCs. + +In 1998, Andrew Jenner , created Digger Remastered, which runs +on all PCs with CGA or better and plays just like the original. See his site +http://digger.org for more information about his remake, the history of the +game as well as the history of Windmill Software and their other games. + +Later on, Maksym Sobolyev , ported Adnrew's code to run +on Linux/FreeBSD/Windows using SDL library, or on FreeBSD console using +native "VGL" VESA graphics interface. That version is now being actively +developed to move Digger into XXI century. + +Furthermore, Michael Knigge , provided some minor +enhancements (i. e. switching fullscreen and window mode with F11), cleaned +up the code a little bit, fixed some minor bugs and provided an Installer +Microsoft for Windows. + +Digger Remastered is licensed under the terms of GNU General Public License version 2. diff --git a/appveyor.yml b/appveyor.yml index d1bac48..3024558 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,6 +10,13 @@ build_script: set WINDRES=windres + echo === Environment ==================================================== + + echo APPVEYOR_PROJECT_NAME=%APPVEYOR_PROJECT_NAME% + + echo APPVEYOR_BUILD_NUMBER=%APPVEYOR_BUILD_NUMBER% + + echo APPVEYOR_BUILD_VERSION=%APPVEYOR_BUILD_VERSION% echo === Download zlib ================================================== @@ -77,5 +84,15 @@ build_script: zip -j digger-win32.zip digger.exe digger.txt zlib1.dll SDL2.dll + + + echo === Create Installer =============================================== + + touch digger.sco + + touch digger.ini + + "C:\Program Files (x86)\Inno Setup 5\iscc.exe" digger.iss artifacts: - path: digger-win32.zip +- path: DiggerRemastered-Setup.exe diff --git a/digger.iss b/digger.iss new file mode 100644 index 0000000..f5b25b8 --- /dev/null +++ b/digger.iss @@ -0,0 +1,29 @@ +[Setup] +AppName=Digger Remastered +AppVerName=Digger Remastered {#GetEnv("APPVEYOR_BUILD_VERSION")} +AppVersion={#GetEnv("APPVEYOR_BUILD_VERSION")} +AppContact=michael.knigge@gmx.de +AppPublisher=Michael Knigge +AppPublisherURL=https://github.com/michaelknigge/digger + +DefaultDirName={pf}\Digger Remastered +DefaultGroupName=Digger Remastered + +OutputBaseFilename=DiggerRemastered-Setup +OutputDir=. + +[Icons] +Name: "{group}\Digger Remastered (Window)"; Filename: "{app}\digger.exe"; WorkingDir: "{app}" +Name: "{group}\Digger Remastered (Fullscreen)"; Filename: "{app}\digger.exe"; WorkingDir: "{app}"; Parameters: "/F" +Name: "{group}\Uninstall"; Filename: "{uninstallexe}" + +[Files] +Source: "README.txt"; DestDir: "{app}"; DestName: "README.txt"; Flags: isreadme +Source: "LICENSE"; DestDir: "{app}" + +Source: "digger.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "SDL2.dll"; DestDir: "{app}"; Flags: ignoreversion + +Source: "digger.sco"; DestDir: "{app}"; Permissions: everyone-modify; Flags: onlyifdoesntexist +Source: "digger.ini"; DestDir: "{app}"; Permissions: everyone-modify; Flags: onlyifdoesntexist From 5f26746ecb0637341a9d744e5b71d78edcdc4672 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Sat, 2 Sep 2017 01:06:16 +0200 Subject: [PATCH 37/50] Do not convert CRLF for README.txt because Notepad.exe is not able to handle files that have LF line endings, --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..04f203c --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +README.txt eol=crlf From 0c5b2f5d852fb8fcf64fb453afee4b1086be49b6 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Sat, 2 Sep 2017 01:06:35 +0200 Subject: [PATCH 38/50] Corrected the README.txt --- README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.txt b/README.txt index c03d95b..7d42973 100644 --- a/README.txt +++ b/README.txt @@ -15,6 +15,6 @@ developed to move Digger into XXI century. Furthermore, Michael Knigge , provided some minor enhancements (i. e. switching fullscreen and window mode with F11), cleaned up the code a little bit, fixed some minor bugs and provided an Installer -Microsoft for Windows. +for Microsoft Windows. Digger Remastered is licensed under the terms of GNU General Public License version 2. From c61cd916ef52a7413b004ed406426b46f8f3f7a9 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Sat, 2 Sep 2017 01:13:37 +0200 Subject: [PATCH 39/50] Changed the Start-Menu entries created by the Windows Installer. --- digger.iss | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/digger.iss b/digger.iss index f5b25b8..000e648 100644 --- a/digger.iss +++ b/digger.iss @@ -6,16 +6,20 @@ AppContact=michael.knigge@gmx.de AppPublisher=Michael Knigge AppPublisherURL=https://github.com/michaelknigge/digger -DefaultDirName={pf}\Digger Remastered -DefaultGroupName=Digger Remastered +DefaultDirName={pf}\Digger +DefaultGroupName=Digger OutputBaseFilename=DiggerRemastered-Setup OutputDir=. [Icons] -Name: "{group}\Digger Remastered (Window)"; Filename: "{app}\digger.exe"; WorkingDir: "{app}" -Name: "{group}\Digger Remastered (Fullscreen)"; Filename: "{app}\digger.exe"; WorkingDir: "{app}"; Parameters: "/F" -Name: "{group}\Uninstall"; Filename: "{uninstallexe}" +Name: "{group}\Digger"; Filename: "{app}\digger.exe"; WorkingDir: "{app}" +Name: "{group}\Digger (Two-Player Simultaneous)"; Filename: "{app}\digger.exe"; WorkingDir: "{app}"; Parameters: "/2" +Name: "{group}\Digger (Gauntlet Mode)"; Filename: "{app}\digger.exe"; WorkingDir: "{app}"; Parameters: "/G" +Name: "{group}\Redefine Keyboard (One Player)"; Filename: "{app}\digger.exe"; WorkingDir: "{app}"; Parameters: "/K" +Name: "{group}\Redefine Keyboard (Two Players)"; Filename: "{app}\digger.exe"; WorkingDir: "{app}"; Parameters: "/KA" +Name: "{group}\Read Me"; Filename: "{app}\README.txt" +Name: "{group}\Uninstall"; Filename: "{uninstallexe}" [Files] Source: "README.txt"; DestDir: "{app}"; DestName: "README.txt"; Flags: isreadme From 797bc0413c58c32cbfe8d065d977094ecf568960 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Sat, 2 Sep 2017 01:20:23 +0200 Subject: [PATCH 40/50] Fixed the Start Menu entry for the Two-Player Keyboad setup --- digger.iss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/digger.iss b/digger.iss index 000e648..6c819a5 100644 --- a/digger.iss +++ b/digger.iss @@ -17,7 +17,7 @@ Name: "{group}\Digger"; Filename: "{app}\digger.exe"; Name: "{group}\Digger (Two-Player Simultaneous)"; Filename: "{app}\digger.exe"; WorkingDir: "{app}"; Parameters: "/2" Name: "{group}\Digger (Gauntlet Mode)"; Filename: "{app}\digger.exe"; WorkingDir: "{app}"; Parameters: "/G" Name: "{group}\Redefine Keyboard (One Player)"; Filename: "{app}\digger.exe"; WorkingDir: "{app}"; Parameters: "/K" -Name: "{group}\Redefine Keyboard (Two Players)"; Filename: "{app}\digger.exe"; WorkingDir: "{app}"; Parameters: "/KA" +Name: "{group}\Redefine Keyboard (Two Players)"; Filename: "{app}\digger.exe"; WorkingDir: "{app}"; Parameters: "/2 /K" Name: "{group}\Read Me"; Filename: "{app}\README.txt" Name: "{group}\Uninstall"; Filename: "{uninstallexe}" From bdb262f39a6ae4ea9610dab5a6641a36e85f6825 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Sat, 2 Sep 2017 01:21:03 +0200 Subject: [PATCH 41/50] Added a Download-Link for the latest Windows Installer --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 9ee3cf4..f67ab00 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Build Status](https://travis-ci.org/michaelknigge/digger.svg?branch=master)](https://travis-ci.org/michaelknigge/digger) [![Build status](https://ci.appveyor.com/api/projects/status/j89k9v2qrxqp6mgt/branch/master?svg=true)](https://ci.appveyor.com/project/michaelknigge/digger/branch/master) [![Download ZIP](https://img.shields.io/badge/Windows-Download_ZIP-orange.svg)](https://ci.appveyor.com/api/projects/michaelknigge/digger/artifacts/digger-win32.zip?branch=master) +[![Download Installer](https://img.shields.io/badge/Windows-Download_Installer-orange.svg)](https://ci.appveyor.com/api/projects/michaelknigge/digger/artifacts/DiggerRemastered-Setup.exe?branch=master) # This is Digger Reloaded, aka UNIX/Linux Digger, however it also works on Windows. @@ -19,6 +20,11 @@ on Linux/FreeBSD/Windows using SDL library, or on FreeBSD console using native "VGL" VESA graphics interface. That version is now being actively developed to move Digger into XXI century. +Furthermore, Michael Knigge , did some minor enhancements (i. e. switching +fullscreen and window mode with F11), cleaned up the code a little bit, fixed some minor bugs +and provided an Installer for Microsoft Windows. + + Some plans for the future releases include: - 2.0, aka "Digger Reset" From 1dc7909a62bda7a7cf2c7fe986ae8029cea80cf5 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Sat, 2 Sep 2017 01:26:41 +0200 Subject: [PATCH 42/50] Updated the README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f67ab00..24152e8 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Some plans for the future releases include: - [x] SDL 2.0 port - [x] fullscreen mode for Windows - [x] toggle fullscreen and window mode with F11 - - [ ] installer for Windows + - [x] installer for Windows - [ ] make CGA graphics available again (for nostalgia) - [ ] further code cleanup (in-progress) - [x] move logic into high-level objects @@ -55,4 +55,4 @@ Some plans for the future releases include: - [ ] digger AI to make teamplay/deathmatch interesting even in single-player mode - [ ] teamplay -We plan to keep the source code free and open at all times. Digger Remastered is licensed under the terms of GNU General Public License version 2. +The source code will be free and open at all times. Digger Remastered is licensed under the terms of GNU General Public License version 2. From 67d0ef49f54976ecef2a4780c53aa7a464e5576d Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Sun, 3 Sep 2017 17:15:37 +0200 Subject: [PATCH 43/50] Removed unused variable fireheight. --- drawing.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drawing.h b/drawing.h index 6872749..fa52f92 100644 --- a/drawing.h +++ b/drawing.h @@ -26,4 +26,3 @@ void drawfurryblob(int16_t x,int16_t y); void drawsquareblob(int16_t x,int16_t y); extern int16_t field[]; -extern int16_t fireheight; From 77ed07532e04967ad4978932aaae85db093d57d9 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Sun, 3 Sep 2017 18:54:33 +0200 Subject: [PATCH 44/50] Revised the "Redefine Keyboard" dialog. The code was a mess and if you tried to redefine alle keys for two players (command line options "/KA /2") then the dialog was broken (drawed outside the visible window). --- README.md | 5 +-- digger.txt | 13 ++----- drawing.c | 20 ++++++++++- drawing.h | 4 +++ main.c | 104 +++++++++++++++++------------------------------------ 5 files changed, 61 insertions(+), 85 deletions(-) diff --git a/README.md b/README.md index 24152e8..b09d93f 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,8 @@ native "VGL" VESA graphics interface. That version is now being actively developed to move Digger into XXI century. Furthermore, Michael Knigge , did some minor enhancements (i. e. switching -fullscreen and window mode with F11), cleaned up the code a little bit, fixed some minor bugs -and provided an Installer for Microsoft Windows. +fullscreen and window mode with F11), cleaned up the code a little bit, fixed some minor bugs, gave the +"redefine keyboard" dialog a new look and feel and provided an Installer for Microsoft Windows. Some plans for the future releases include: @@ -32,6 +32,7 @@ Some plans for the future releases include: - [x] fullscreen mode for Windows - [x] toggle fullscreen and window mode with F11 - [x] installer for Windows + - [x] revised redefine keyboard - [ ] make CGA graphics available again (for nostalgia) - [ ] further code cleanup (in-progress) - [x] move logic into high-level objects diff --git a/digger.txt b/digger.txt index 455cb4a..c32c398 100644 --- a/digger.txt +++ b/digger.txt @@ -400,7 +400,7 @@ The command line options are: /E:name = Playback game file "name" and exit program. /O = Go back to the beginning of the command line and start again. Handy for playing recorded games as screensavers. - /K = Redefine keyboard. To redefine all the redefinable keys, use /KA. + /K = Redefine keyboard. /G:time = Gauntlet mode. /2 = Put two diggers on screen at once. /? = Display this list. @@ -420,15 +420,8 @@ with the F9 and F7 keys. the program will let you redefine the keys to move Digger around and fire, but if you override another key (by making the space bar fire, for example) other keys will be redefined. If you specify the /K option, the program enters -keyboard redefinition mode before the title screen appears. In keyboard -redefinition mode, the name of each action which needs a key comes up on the -screen in red, and changes to green once you've pressed the key for that -action. Note that the name of the key does not appear on the screen: it would -be too complicated to program Digger with knowledge of all known keyboard -layouts. However, I may program it with knowledge of some of the keys in a -future version. I do not recommend redefining N, Esc or F8 as anything else, as -these keys cannot currently be redefined so this could cause confusion. To -return all the keys to their defaults, delete the DIGGER.INI file. +keyboard redefinition mode before the title screen appears. To return all the +keys to their defaults, delete the DIGGER.INI file. /G starts Gauntlet mode: infinite lives but only finite time. You can specify a time on the command line, for example "DIGGER /G:60" for one minute play. If diff --git a/drawing.c b/drawing.c index bb48bc5..55262e0 100644 --- a/drawing.c +++ b/drawing.c @@ -23,18 +23,36 @@ uint16_t bitmasks[12]={0xfffe,0xfffd,0xfffb,0xfff7,0xffef,0xffdf,0xffbf,0xff7f, int16_t digspr[DIGGERS],digspd[DIGGERS],firespr[FIREBALLS]; +int16_t charwidth = 12; +int16_t rowheight = 12; + void drawlife(int16_t t,int16_t x,int16_t y); void createdbfspr(void); void initdbfspr(void); void drawbackg(int16_t l); void drawfield(void); +void eraseline(struct digger_draw_api *ddap, int16_t y) +{ + // A line can contain nearly 27 characters, so we just draw 27 spaces to erase the whole line + outtext(ddap, " ", 0, y, 0); +} + +void outtextcentered(struct digger_draw_api *ddap, char *p,int16_t y,int16_t c) +{ + if (strlen(p) >= 27) { + outtext(ddap, p, 0, y, c); + } else { + outtext(ddap, p, ((27 - strlen(p)) / 2)*charwidth, y, c); + } +} + void outtext(struct digger_draw_api *ddap, char *p,int16_t x,int16_t y,int16_t c) { int16_t i; for (i=0;p[i];i++) { ddap->gwrite(x,y,isalnum(p[i]) ? p[i] : ' ',c); - x+=12; + x+=charwidth; } } diff --git a/drawing.h b/drawing.h index fa52f92..96c0ae1 100644 --- a/drawing.h +++ b/drawing.h @@ -4,6 +4,8 @@ struct digger_draw_api; void outtext(struct digger_draw_api *, char *p,int16_t x,int16_t y,int16_t c); +void outtextcentered(struct digger_draw_api *, char *p,int16_t y,int16_t c); +void eraseline(struct digger_draw_api *, int16_t y); void creatembspr(void); void initmbspr(void); @@ -26,3 +28,5 @@ void drawfurryblob(int16_t x,int16_t y); void drawsquareblob(int16_t x,int16_t y); extern int16_t field[]; +extern int16_t charwidth; +extern int16_t rowheight; \ No newline at end of file diff --git a/main.c b/main.c index 2f58fb8..14d220e 100644 --- a/main.c +++ b/main.c @@ -354,7 +354,7 @@ int mainprog(void) detectjoy(); ddap->gclear(); ddap->gtitle(); - outtext(ddap, "D I G G E R",100,0,3); + outtextcentered(ddap, "D I G G E R",0,3); shownplayers(); showtable(ddap); started=false; @@ -1014,32 +1014,46 @@ void inir(void) void redefkeyb(bool allf) { - int i,j,k,l,z,y=0; - bool f; + int i,j,k,l,keyrow,errorrow1,errorrow2,playerrow,color; char kbuf[80],vbuf[80]; maininit(); + + outtextcentered(ddap, "D I G G E R",0,3); + outtextcentered(ddap, "REDEFINE KEYBOARD",3*rowheight,1); + + playerrow=5*rowheight; + keyrow=8*rowheight; + errorrow1=11*rowheight; + errorrow2=13*rowheight; + color=3; - if (diggers==2) { - outtext(ddap, "PLAYER 1:",0,y,3); - y+=12; - } + for (i=0;i<17;i++) { + eraseline(ddap, playerrow); + eraseline(ddap, keyrow); - outtext(ddap, "PRESS NEW KEY FOR",0,y,3); - y+=12; + if (i < 5) + outtextcentered(ddap, "PLAYER 1",playerrow,2); + else if (i < 10) + outtextcentered(ddap, "PLAYER 2",playerrow,2); + else + outtextcentered(ddap, "MISELLANEOUS",playerrow,2); -/* Step one: redefine keys that are always redefined. */ + outtextcentered(ddap, keynames[i],keyrow,color); - for (i=0;i<5;i++) { - outtext(ddap, keynames[i],0,y,2); /* Red first */ findkey(i); - outtext(ddap, keynames[i],0,y,1); /* Green once got */ - y+=12; + + eraseline(ddap, errorrow1); + eraseline(ddap, errorrow2); + color=3; + for (j=0;j Date: Sun, 3 Sep 2017 18:57:49 +0200 Subject: [PATCH 45/50] The string "D I G G E R" on the main screen will now be drawn a little bit lower. On Windows, the characters of "D I G G E R" touched the title bar which is white per default. This looked a little bit bad when the yellow chars hit the white title bar. Just eye candy, but it looks way better now. --- main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 14d220e..203c13c 100644 --- a/main.c +++ b/main.c @@ -354,7 +354,7 @@ int mainprog(void) detectjoy(); ddap->gclear(); ddap->gtitle(); - outtextcentered(ddap, "D I G G E R",0,3); + outtextcentered(ddap, "D I G G E R",2,3); shownplayers(); showtable(ddap); started=false; @@ -1019,7 +1019,7 @@ void redefkeyb(bool allf) maininit(); - outtextcentered(ddap, "D I G G E R",0,3); + outtextcentered(ddap, "D I G G E R",2,3); outtextcentered(ddap, "REDEFINE KEYBOARD",3*rowheight,1); playerrow=5*rowheight; From 6f5c168614bd5b36080c767be2ab5cab0f3af8f8 Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Sun, 3 Sep 2017 23:41:05 +0200 Subject: [PATCH 46/50] Make reading the level file mor robust (it was possible to read a recorded game as a level file - with funny effects). --- main.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/main.c b/main.c index 203c13c..3fbf8e0 100644 --- a/main.c +++ b/main.c @@ -649,35 +649,37 @@ static int read_levf(char *levfname) { FILE *levf; + char data[12003]; levf = fopen(levfname, "rb"); if (levf == NULL) { - strcat(levfname,".DLF"); + strcat(levfname, ".DLF"); levf = fopen(levfname,"rb"); } + if (levf == NULL) { #if defined(DIGGER_DEBUG) fprintf(digger_log, "read_levf: levels file open error\n"); #endif return (-1); } - if (fread(&bonusscore, 2, 1, levf) < 1) { -#if defined(DIGGER_DEBUG) - fprintf(digger_log, "read_levf: levels load error 1\n"); -#endif - goto eout_0; - } - if (fread(leveldat, 1200, 1, levf) <= 0) { + + // read into a temp buffer - so if we read garbare we do not have + // messed up the internal level data. Not the trick: We try to read + // 12003 bytes. Each level file is 12002 bytes in length . If we read + // less or more then this is probably not or a corrupted level file. + if (fread(&data, 1, 1203, levf) == 1202) { + memcpy((char *)&bonusscore, data, 2); + memcpy(leveldat, data + 2, 1200); + fclose(levf); + return(0); + } else { #if defined(DIGGER_DEBUG) - fprintf(digger_log, "read_levf: levels load error 2\n"); + fprintf(digger_log, "read_levf: levels load error\n"); #endif - goto eout_0; + fclose(levf); + return(-1); } - fclose(levf); - return (0); -eout_0: - fclose(levf); - return (-1); } static int From 848ec5e6ad89f4dc7e44b6151dadf0bcf553fb0f Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Sun, 3 Sep 2017 23:42:45 +0200 Subject: [PATCH 47/50] Create a all-writable digger.log in the Windows Installer so Digger can write its log file under Windows. --- appveyor.yml | 2 ++ digger.iss | 1 + 2 files changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 3024558..85fd9cf 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -92,6 +92,8 @@ build_script: touch digger.ini + touch digger.log + "C:\Program Files (x86)\Inno Setup 5\iscc.exe" digger.iss artifacts: - path: digger-win32.zip diff --git a/digger.iss b/digger.iss index 6c819a5..4fb60c1 100644 --- a/digger.iss +++ b/digger.iss @@ -29,5 +29,6 @@ Source: "digger.exe"; DestDir: "{app}"; Flags: ignoreversion Source: "zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "SDL2.dll"; DestDir: "{app}"; Flags: ignoreversion +Source: "digger.log"; DestDir: "{app}"; Permissions: everyone-modify Source: "digger.sco"; DestDir: "{app}"; Permissions: everyone-modify; Flags: onlyifdoesntexist Source: "digger.ini"; DestDir: "{app}"; Permissions: everyone-modify; Flags: onlyifdoesntexist From 7869ec8186b4b6043b3e6f8fd0094747dfe15c2b Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Sun, 3 Sep 2017 23:44:59 +0200 Subject: [PATCH 48/50] Log level loading (always, not just when compiled with debug settings). --- main.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/main.c b/main.c index 3fbf8e0..f0a74cc 100644 --- a/main.c +++ b/main.c @@ -658,9 +658,7 @@ read_levf(char *levfname) } if (levf == NULL) { -#if defined(DIGGER_DEBUG) - fprintf(digger_log, "read_levf: levels file open error\n"); -#endif + fprintf(digger_log, "read_levf: levels file %s open error\n", levfname); return (-1); } @@ -671,12 +669,11 @@ read_levf(char *levfname) if (fread(&data, 1, 1203, levf) == 1202) { memcpy((char *)&bonusscore, data, 2); memcpy(leveldat, data + 2, 1200); + fprintf(digger_log, "read_levf: levels loaded from file %s\n", levfname); fclose(levf); return(0); } else { -#if defined(DIGGER_DEBUG) - fprintf(digger_log, "read_levf: levels load error\n"); -#endif + fprintf(digger_log, "read_levf: levels load error, file %s\n", levfname); fclose(levf); return(-1); } From 0b0be42362c8a45f8367fb9771efcc4e5fab401b Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Sun, 3 Sep 2017 23:46:22 +0200 Subject: [PATCH 49/50] Do not append ".DLF" to the level file if the open fails. The code contained a potentional buffer overflow. --- main.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/main.c b/main.c index f0a74cc..1747637 100644 --- a/main.c +++ b/main.c @@ -651,13 +651,8 @@ read_levf(char *levfname) FILE *levf; char data[12003]; - levf = fopen(levfname, "rb"); - if (levf == NULL) { - strcat(levfname, ".DLF"); - levf = fopen(levfname,"rb"); - } - if (levf == NULL) { + if ((levf = fopen(levfname, "rb")) == NULL) { fprintf(digger_log, "read_levf: levels file %s open error\n", levfname); return (-1); } From 77aa6fce184f23d23040a91b147d74ff74d0ec2d Mon Sep 17 00:00:00 2001 From: michaelknigge Date: Thu, 14 Sep 2017 23:19:20 +0200 Subject: [PATCH 50/50] Resolved conflicts --- .travis.yml | 3 +- Makefile | 46 ++++++- README.md | 50 +++++--- appveyor.yml | 42 ++---- drawing.c | 50 ++++---- drawing.h | 9 +- input.c | 262 ++++--------------------------------- main.c | 314 ++++++++++++++++++++------------------------- scripts/do-test.sh | 41 +++--- sdl_kbd.h | 5 - 10 files changed, 299 insertions(+), 523 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7f37502..510bfb3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,4 +4,5 @@ compiler: - clang - gcc script: - sh -x ./scripts/do-test.sh + make do-test + diff --git a/Makefile b/Makefile index 474e889..b4edac0 100644 --- a/Makefile +++ b/Makefile @@ -1,25 +1,48 @@ CC ?= gcc -CFLAGS += -O -g -pipe +CFLAGS += -pipe +ifeq (${BUILD_TYPE},production) +CFLAGS += -O3 +else +CFLAGS += -O0 -g3 -DDIGGER_DEBUG +endif RCFLAGS = -D_SDL -std=c99 -Wall OBJS = main.o digger.o drawing.o sprite.o scores.o record.o sound.o \ newsnd.o ini.o input.o monster.o bags.o alpha.o vgagrafx.o \ title_gz.o icon.o sdl_kbd.o sdl_vid.o sdl_timer.o sdl_snd.o \ digger_math.o monster_obj.o digger_obj.o bullet_obj.o \ - cgagrafx.o + cgagrafx.o keyboard.o ARCH ?= LINUX #ARCH ?= MINGW #ARCH ?= FREEBSD #ARCH ?= FooOS +SDL_VER ?= 2.0.5 +ZLIB_VER ?= 1.2.11 +MGW_PREF ?= i686-w64-mingw32 +MINGW_DEPS_ROOT ?= ../ +MGW64_PREF ?= x86_64-w64-mingw32 ifeq ($(ARCH),MINGW) -MINGW_DEPS_ROOT ?= ../ -CC = i686-w64-mingw32-gcc -WINDRES ?= i686-w64-mingw32-windres -RCFLAGS += -DMINGW -Dmain=SDL_main -I${MINGW_DEPS_ROOT}/zlib/include -I${MINGW_DEPS_ROOT}/SDL2-2.0.5/i686-w64-mingw32/include/SDL2 -LIBS += -mwindows -lmingw32 -L${MINGW_DEPS_ROOT}/SDL2-2.0.5/i686-w64-mingw32/lib -lSDL2main -lSDL2 -luser32 -lgdi32 -lwinmm -L${MINGW_DEPS_ROOT}/zlib/lib -lzdll -lm +CC = ${MGW_PREF}-gcc +WINDRES ?= ${MGW_PREF}-windres +STRIP ?= ${MGW_PREF}-strip +RCFLAGS += -DMINGW -Dmain=SDL_main -I${MINGW_DEPS_ROOT}/zlib-${ZLIB_VER} -I${MINGW_DEPS_ROOT}/SDL2-${SDL_VER}/${MGW_PREF}/include/SDL2 +LIBS += -mwindows -lmingw32 -L${MINGW_DEPS_ROOT}/SDL2-${SDL_VER}/${MGW_PREF}/lib -lSDL2main -lSDL2 -luser32 -lgdi32 -lwinmm -L${MINGW_DEPS_ROOT}/zlib-${ZLIB_VER} -lz -lm ESUFFIX = .exe OBJS += digger.res +VPATH += ./pkg/windows +endif + +ifeq ($(ARCH),MINGW64) +CC = ${MGW64_PREF}-gcc +WINDRES ?= ${MGW64_PREF}-windres +STRIP ?= ${MGW64_PREF}-strip +RCFLAGS += -DMINGW -Dmain=SDL_main -I${MINGW_DEPS_ROOT}/zlib-${ZLIB_VER} -I${MINGW_DEPS_ROOT}/SDL2-${SDL_VER}/${MGW64_PREF}/include/SDL2 +LIBS += -mwindows -lmingw32 -L${MINGW_DEPS_ROOT}/SDL2-${SDL_VER}/${MGW64_PREF}/lib -lSDL2main -lSDL2 -luser32 -lgdi32 -lwinmm \ + -L${MINGW_DEPS_ROOT}/zlib-${ZLIB_VER}/${MGW64_PREF} -lz -lm +ESUFFIX = .exe +OBJS += digger.res +VPATH += ./pkg/windows endif ifeq ($(ARCH),FREEBSD) @@ -43,10 +66,15 @@ LIBS += # insert here libs required to compile like zlib, SDL etc ESUFFIX = # insert here suffix of the executable on your platform if any (like ".exe" on Win32) endif +STRIP ?= strip + all: digger$(ESUFFIX) digger$(ESUFFIX): $(OBJS) $(CC) -o digger$(ESUFFIX) $(OBJS) $(LIBS) +ifeq (${BUILD_TYPE},production) + $(STRIP) --strip-unneeded digger$(ESUFFIX) +endif %.o : %.c $(CC) -c $(RCFLAGS) $(CFLAGS) $< -o $@ @@ -56,3 +84,7 @@ digger$(ESUFFIX): $(OBJS) clean: rm -f $(OBJS) digger$(ESUFFIX) + +do-test: + SDL_VER=${SDL_VER} ZLIB_VER=${ZLIB_VER} MGW_PREF="${MGW_PREF}" \ + MGW64_PREF="${MGW64_PREF}" sh -x ./scripts/do-test.sh diff --git a/README.md b/README.md index b09d93f..77e4451 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ -[![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) -[![Build Status](https://travis-ci.org/michaelknigge/digger.svg?branch=master)](https://travis-ci.org/michaelknigge/digger) -[![Build status](https://ci.appveyor.com/api/projects/status/j89k9v2qrxqp6mgt/branch/master?svg=true)](https://ci.appveyor.com/project/michaelknigge/digger/branch/master) -[![Download ZIP](https://img.shields.io/badge/Windows-Download_ZIP-orange.svg)](https://ci.appveyor.com/api/projects/michaelknigge/digger/artifacts/digger-win32.zip?branch=master) -[![Download Installer](https://img.shields.io/badge/Windows-Download_Installer-orange.svg)](https://ci.appveyor.com/api/projects/michaelknigge/digger/artifacts/DiggerRemastered-Setup.exe?branch=master) +[![Build Status](https://travis-ci.org/sobomax/digger.svg?branch=master)](https://travis-ci.org/sobomax/digger) +[![Build status](https://ci.appveyor.com/api/projects/status/s3nmvbv7xnt9uuyh/branch/master?svg=true)](https://ci.appveyor.com/project/sobomax/digger/branch/master) +[![Download ZIP](https://img.shields.io/badge/Windows-Download_ZIP-orange.svg)](https://ci.appveyor.com/api/projects/sobomax/digger/artifacts/digger-win32.zip?branch=master) +[![Download Installer](https://img.shields.io/badge/Windows-Download_Installer-orange.svg)](https://ci.appveyor.com/api/projects/sobomax/digger/artifacts/DiggerRemastered-Setup.exe?branch=master) # This is Digger Reloaded, aka UNIX/Linux Digger, however it also works on Windows. @@ -11,18 +10,19 @@ copy-protected, bootable 5.25" floppy disk for the IBM PC. As it requires a genuine CGA card, it didn't work on modern PCs. In 1998, Andrew Jenner , created Digger Remastered, which runs -on all PCs with CGA or better and plays just like the original. See http://digger.org for -more information about his remake, the history of the game as well as the history -of Windmill Software and their other games. +on all PCs with CGA or better and plays just like the original. See +http://digger.org for more information about his remake, the history of the +game as well as the history of Windmill Software and their other games. Later on, Maksym Sobolyev , ported Adnrew's code to run on Linux/FreeBSD/Windows using SDL library, or on FreeBSD console using native "VGL" VESA graphics interface. That version is now being actively developed to move Digger into XXI century. -Furthermore, Michael Knigge , did some minor enhancements (i. e. switching -fullscreen and window mode with F11), cleaned up the code a little bit, fixed some minor bugs, gave the -"redefine keyboard" dialog a new look and feel and provided an Installer for Microsoft Windows. +Furthermore, Michael Knigge , did some minor +enhancements, cleaned up the code a little bit, fixed some minor bugs, gave +the "redefine keyboard" dialog a new look and feel and provided an Installer +for Microsoft Windows along with the Appveyor CI scripts. Some plans for the future releases include: @@ -30,30 +30,38 @@ Some plans for the future releases include: - 2.0, aka "Digger Reset" - [x] SDL 2.0 port - [x] fullscreen mode for Windows - - [x] toggle fullscreen and window mode with F11 + - [x] toggle fullscreen and window mode with Alt-Enter - [x] installer for Windows - - [x] revised redefine keyboard - - [ ] make CGA graphics available again (for nostalgia) + - [ ] revised redefine keyboard + - [ ] make CGA graphics available again (for nostalgia) - [ ] further code cleanup (in-progress) - [x] move logic into high-level objects - - [x] remove obsolete command line options - - [ ] remove obsolete DOS functions (i. e. function s0setupsound() and so on) - - [ ] remove ARM specific code (SDL 2.0 is not available on ARM, so the ARM specific code is useless) + - [x] remove obsolete command line options + - [x] 64-bit Windows build + - [ ] remove obsolete DOS functions (i. e. function s0setupsound() and + so on) + - [ ] remove ARM specific code (SDL 2.0 is not available on ARM, so the + ARM specific code is useless) - [ ] remove DIGGER_VERSION and give Digger a regular version number - [ ] headless (VNC?) mode - [ ] network play for 2 players - - [ ] screen update framerate that is independent of game perceived speed, "sub-pixel" updates - - [ ] build Digger on FreeBSD automatically, see http://erouault.blogspot.de/2016/09/running-freebsd-in-travis-ci.html + - [ ] screen update framerate that is independent of game perceived speed, + "sub-pixel" updates - 3.0, aka "Digger Reloaded" - [ ] bigger (open?) game world - [ ] MMOG mode - [ ] deathmatch mode - - [ ] new capabilities to the characters (i.e. superpowers), and interactions between them (i.e. gradual damage) + - [ ] new capabilities to the characters (i.e. superpowers), and interactions + between them (i.e. gradual damage) - [ ] few types of diggers: scout, soldier, sniper etc. - [ ] monster AI 2.0? - [ ] digger AI to make teamplay/deathmatch interesting even in single-player mode - [ ] teamplay -The source code will be free and open at all times. Digger Remastered is licensed under the terms of GNU General Public License version 2. +The source code will be free and open at all times. Digger Remastered is +source code has been contributed by different people and licensed under the +terms of several licenses including Public Domain, Beer-Ware, 2-clause BSD +and GNU General Public License version 2. Please refer to a specific source +file as well as source code history to find out more. diff --git a/appveyor.yml b/appveyor.yml index 85fd9cf..1a27032 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -27,43 +27,14 @@ build_script: echo === Build zlib ===================================================== - ren zlib-1.2.11 zlib - - cd zlib + cd zlib-1.2.11 call "%VS90COMNTOOLS%\vsvars32.bat" nmake -f win32/Makefile.msc - - echo === Copy zlib include files ======================================== - - mkdir include - - copy zlib.h include - - copy zconf.h include - - - echo === Copy zlib import libraries ===================================== - - mkdir lib - - copy zlib.lib lib - - copy zdll.lib lib - - - echo === Copy zlib binary =============================================== - - mkdir bin - - copy zlib1.dll bin - - cd .. - echo === Download SDL =================================================== curl -s https://www.libsdl.org/release/SDL2-devel-2.0.5-mingw.tar.gz | tar -xz @@ -73,12 +44,14 @@ build_script: cd digger - make + make STRIP=strip BUILD_TYPE=debug clean all + + make STRIP=strip BUILD_TYPE=production clean all echo === Create Artifact ================================================ - copy ..\zlib\zlib1.dll + copy ..\zlib-1.2.11\zlib1.dll copy ..\SDL2-2.0.5\i686-w64-mingw32\bin\SDL2.dll @@ -94,7 +67,10 @@ build_script: touch digger.log - "C:\Program Files (x86)\Inno Setup 5\iscc.exe" digger.iss + "C:\Program Files (x86)\Inno Setup 5\iscc.exe" pkg\windows\digger.iss + + copy pkg\windows\DiggerRemastered-Setup.exe + artifacts: - path: digger-win32.zip - path: DiggerRemastered-Setup.exe diff --git a/drawing.c b/drawing.c index 55262e0..04c2a0b 100644 --- a/drawing.c +++ b/drawing.c @@ -1,9 +1,13 @@ /* Digger Remastered Copyright (c) Andrew Jenner 1998-2004 */ +#include #include #include #include +#include + +#include "alpha.h" #include "def.h" #include "draw_api.h" #include "drawing.h" @@ -23,37 +27,37 @@ uint16_t bitmasks[12]={0xfffe,0xfffd,0xfffb,0xfff7,0xffef,0xffdf,0xffbf,0xff7f, int16_t digspr[DIGGERS],digspd[DIGGERS],firespr[FIREBALLS]; -int16_t charwidth = 12; -int16_t rowheight = 12; - void drawlife(int16_t t,int16_t x,int16_t y); void createdbfspr(void); void initdbfspr(void); void drawbackg(int16_t l); void drawfield(void); -void eraseline(struct digger_draw_api *ddap, int16_t y) +const char empty_line[MAX_TEXT_LEN + 1] = " "; + +static void outtextl(struct digger_draw_api *ddap, const char *p,int16_t x,int16_t y,int16_t c, int16_t l) { - // A line can contain nearly 27 characters, so we just draw 27 spaces to erase the whole line - outtext(ddap, " ", 0, y, 0); + int16_t i; + +#if defined(DIGGER_DEBUG) + assert(l > 0 && l <= MAX_TEXT_LEN); +#endif + for (i=0;i < l;i++) { + ddap->gwrite(x,y,isvalchar(p[i]) ? p[i] : ' ',c); + x+=CHR_W; + } } -void outtextcentered(struct digger_draw_api *ddap, char *p,int16_t y,int16_t c) +void outtext(struct digger_draw_api *ddap, const char *p,int16_t x,int16_t y,int16_t c) { - if (strlen(p) >= 27) { - outtext(ddap, p, 0, y, c); - } else { - outtext(ddap, p, ((27 - strlen(p)) / 2)*charwidth, y, c); - } + + outtextl(ddap, p, x, y, c, strlen(p)); } -void outtext(struct digger_draw_api *ddap, char *p,int16_t x,int16_t y,int16_t c) +void erasetext(struct digger_draw_api *ddap, int16_t n, int16_t x, int16_t y, int16_t c) { - int16_t i; - for (i=0;p[i];i++) { - ddap->gwrite(x,y,isalnum(p[i]) ? p[i] : ' ',c); - x+=charwidth; - } + + outtextl(ddap, empty_line, x, y, c, n); } void makefield(void) @@ -364,7 +368,7 @@ void drawlives(struct digger_draw_api *ddap) return; } n=getlives(0)-1; - outtext(ddap, " ",96,0,2); + erasetext(ddap, 5, 96,0,2); if (n>4) { drawlife(0,80,0); sprintf(buf,"X%i",n); @@ -376,11 +380,11 @@ void drawlives(struct digger_draw_api *ddap) n--; } if (nplayers==2) { - outtext(ddap, " ",164,0,2); + erasetext(ddap, 5, 164,0,2); n=getlives(1)-1; if (n>4) { sprintf(buf,"%iX",n); - outtext(ddap, buf,220-strlen(buf)*12,0,2); + outtext(ddap, buf,220-strlen(buf)*CHR_W,0,2); drawlife(1,224,0); } else @@ -390,11 +394,11 @@ void drawlives(struct digger_draw_api *ddap) } } if (diggers==2) { - outtext(ddap, " ",164,0,1); + erasetext(ddap, 5, 164,0,1); n=getlives(1)-1; if (n>4) { sprintf(buf,"%iX",n); - outtext(ddap, buf,220-strlen(buf)*12,0,1); + outtext(ddap, buf,220-strlen(buf)*CHR_W,0,1); drawlife(3,224,0); } else diff --git a/drawing.h b/drawing.h index 96c0ae1..31f44f8 100644 --- a/drawing.h +++ b/drawing.h @@ -1,11 +1,12 @@ /* Digger Remastered Copyright (c) Andrew Jenner 1998-2004 */ +#define MAX_TEXT_LEN (MAX_W / CHR_W) + struct digger_draw_api; -void outtext(struct digger_draw_api *, char *p,int16_t x,int16_t y,int16_t c); -void outtextcentered(struct digger_draw_api *, char *p,int16_t y,int16_t c); -void eraseline(struct digger_draw_api *, int16_t y); +void outtext(struct digger_draw_api *, const char *p,int16_t x,int16_t y,int16_t c); +void erasetext(struct digger_draw_api *ddap, int16_t n, int16_t x, int16_t y, int16_t c); void creatembspr(void); void initmbspr(void); @@ -28,5 +29,3 @@ void drawfurryblob(int16_t x,int16_t y); void drawsquareblob(int16_t x,int16_t y); extern int16_t field[]; -extern int16_t charwidth; -extern int16_t rowheight; \ No newline at end of file diff --git a/input.c b/input.c index d11948a..80ef5f6 100644 --- a/input.c +++ b/input.c @@ -2,6 +2,7 @@ Copyright (c) Andrew Jenner 1998-2004 */ #include "def.h" +#include "input.h" #include "main.h" #include "sound.h" #include "hardware.h" @@ -9,12 +10,14 @@ #include "digger.h" #ifdef _SDL #include "sdl_kbd.h" +#elif defined(_VGL) +#include "fbsd_kbd.h" #endif /* global variables first */ -bool escape=false,firepflag=false,fire2pflag=false,pausef=false,toggle=false; -bool krdf[17]={false,false,false,false,false,false,false,false,false,false, - false,false,false,false,false,false,false}; +bool escape=false,firepflag=false,fire2pflag=false,pausef=false,mode_change=false; +bool krdf[NKEYS]={false,false,false,false,false,false,false,false,false,false, + false,false,false,false,false,false,false,false}; static bool aleftpressed=false,arightpressed=false, auppressed=false,adownpressed=false,start=false,af1pressed=false; @@ -32,228 +35,6 @@ static int16_t keydir=0,keydir2=0,jleftthresh=0,jupthresh=0,jrightthresh=0, static bool joyflag=false; - -#ifdef ARM - -#include "C:kernel.h" -#define rightpressed (_kernel_osbyte(129,keycodes[0][0],255)&0xff==0xff) -#define uppressed (_kernel_osbyte(129,keycodes[1][0],255)&0xff==0xff) -#define leftpressed (_kernel_osbyte(129,keycodes[2][0],255)&0xff==0xff) -#define downpressed (_kernel_osbyte(129,keycodes[3][0],255)&0xff==0xff) -#define f1pressed (_kernel_osbyte(129,keycodes[4][0],255)&0xff==0xff) -#define right2pressed (_kernel_osbyte(129,keycodes[5][0],255)&0xff==0xff) -#define up2pressed (_kernel_osbyte(129,keycodes[6][0],255)&0xff==0xff) -#define left2pressed (_kernel_osbyte(129,keycodes[7][0],255)&0xff==0xff) -#define down2pressed (_kernel_osbyte(129,keycodes[8][0],255)&0xff==0xff) -#define f12pressed (_kernel_osbyte(129,keycodes[9][0],255)&0xff==0xff) - -/* Default key codes for ARM */ - -int keycodes[17][5]={{134,0,-2,-2,-2}, /* 1 Right */ - {198,0,-2,-2,-2}, /* 1 Up */ - {230,0,-2,-2,-2}, /* 1 Left */ - {214,0,-2,-2,-2}, /* 1 Down */ - {142,0,-2,-2,-2}, /* 1 Fire */ - {134,0,-2,-2,-2}, /* 2 Right */ - {198,0,-2,-2,-2}, /* 2 Up */ - {230,0,-2,-2,-2}, /* 2 Left */ - {214,0,-2,-2,-2}, /* 2 Down */ - {142,0,-2,-2,-2}, /* 2 Fire */ - {20,-2,-2,-2,-2}, /* Cheat */ - {43,-2,-2,-2,-2}, /* Accelerate */ - {45,-2,-2,-2,-2}, /* Brake */ - {137,-2,-2,-2,-2}, /* Music */ - {139,-2,-2,-2,-2}, /* Sound */ - {140,-2,-2,-2,-2}, /* Exit */ - {32,-2,-2,-2,-2}}; /* Pause */ - -#define ASCIIF8 138 - -/* This function exclusively used in keyboard redefinition */ -void findkey(int kn) -{ - int k=0,i,j; - bool f=false; - do { - for (i=130;i<256 && !f;i++) - if (_kernel_osbyte(129,i,255)&0xff==0xff) - f=true; - gretrace(); - if (kbhit()) - k=getkey(true); - } while (k==0 && !f); - j=i-1; - if (k==0) k=-2; - if (k>='a' && k<='z') - k-='a'-'A'; - for (i=0;i<5;i++) - keycodes[kn][i]=-2; - if (kn>9) - i=0; - else { - i=2; - keycodes[kn][0]=j; - keycodes[kn][1]=0; - } - keycodes[kn][i++]=k; - if (k>='A' && k<='Z') { - keycodes[kn][i++]=k-('A'-'a'); /* lower case */ - keycodes[kn][i++]=k-'@'; /* ctrl code */ - } - krdf[kn]=true; -} - -#else - -#ifdef _VGL - -bool GetAsyncKeyState(int); - -#define RIGHTKEY 98+128 -#define UPKEY 95+128 -#define LEFTKEY 97+128 -#define DOWNKEY 100+128 -#define F1KEY 59+128 -#define TABKEY 15+128 -#define ADDKEY 78+128 -#define SUBKEY 74+128 -#define F7KEY 65+128 -#define F8KEY 66+128 -#define F9KEY 67+128 -#define F10KEY 68+128 - -int keycodes[17][5]={{RIGHTKEY,-2,-2,-2,-2}, /* 1 Right */ - {UPKEY,-2,-2,-2,-2}, /* 1 Up */ - {LEFTKEY,-2,-2,-2,-2}, /* 1 Left */ - {DOWNKEY,-2,-2,-2,-2}, /* 1 Down */ - {F1KEY,-2,-2,-2,-2}, /* 1 Fire */ - {'s',-2,-2,-2,-2}, /* 2 Right */ - {'w',-2,-2,-2,-2}, /* 2 Up */ - {'a',-2,-2,-2,-2}, /* 2 Left */ - {'z',-2,-2,-2,-2}, /* 2 Down */ - {TABKEY,-2,-2,-2,-2}, /* 2 Fire */ - {'t',-2,-2,-2,-2}, /* Cheat */ - {ADDKEY,-2,-2,-2,-2}, /* Accelerate */ - {SUBKEY,-2,-2,-2,-2}, /* Brake */ - {F7KEY,-2,-2,-2,-2}, /* Music */ - {F9KEY,-2,-2,-2,-2}, /* Sound */ - {F10KEY,-2,-2,-2,-2}, /* Exit */ - {' ',-2,-2,-2,-2}}; /* Pause */ - -#define rightpressed (GetAsyncKeyState(keycodes[0][0])) -#define uppressed (GetAsyncKeyState(keycodes[1][0])) -#define leftpressed (GetAsyncKeyState(keycodes[2][0])) -#define downpressed (GetAsyncKeyState(keycodes[3][0])) -#define f1pressed (GetAsyncKeyState(keycodes[4][0])) -#define right2pressed (GetAsyncKeyState(keycodes[5][0])) -#define up2pressed (GetAsyncKeyState(keycodes[6][0])) -#define left2pressed (GetAsyncKeyState(keycodes[7][0])) -#define down2pressed (GetAsyncKeyState(keycodes[8][0])) -#define f12pressed (GetAsyncKeyState(keycodes[9][0])) - -#define ASCIIF8 F8KEY - -#else - -#ifndef _SDL - -bool leftpressed=false,rightpressed=false,uppressed=false,downpressed=false, - f1pressed=false,left2pressed=false,right2pressed=false,up2pressed=false, - down2pressed=false,f12pressed=false; - -/* Default key codes */ - -int keycodes[17][5]={{0x4d,0xcd,0x14d,-2,-2}, /* 1 Right */ - {0x48,0xc8,0x148,-2,-2}, /* 1 Up */ - {0x4b,0xcb,0x14b,-2,-2}, /* 1 Left */ - {0x50,0xd0,0x150,-2,-2}, /* 1 Down */ - {0x3b,0xbb,0x13b,-2,-2}, /* 1 Fire */ - {31,159,83,115,19}, /* 2 Right */ - {17,145,87,119,23}, /* 2 Up */ - {30,158,65,97,1}, /* 2 Left */ - {44,172,90,122,26}, /* 2 Down */ - {15,143,9,-2,-2}, /* 2 Fire */ - {20,-2,-2,-2,-2}, /* Cheat */ - {43,-2,-2,-2,-2}, /* Accelerate */ - {45,-2,-2,-2,-2}, /* Brake */ - {321,-2,-2,-2,-2}, /* Music */ - {323,-2,-2,-2,-2}, /* Sound */ - {324,-2,-2,-2,-2}, /* Exit */ - {32,-2,-2,-2,-2}}; /* Pause */ - -#define ASCIIF8 322 - -#endif -#endif - -#if !defined(_SDL) && !defined(_VGL) -static uint16_t scancode; -#endif - -#if !defined(_SDL) && !defined(_VGL) -static int pki; - -static bool *flagp[10]={ - &rightpressed,&uppressed,&leftpressed,&downpressed,&f1pressed, - &right2pressed,&up2pressed,&left2pressed,&down2pressed,&f12pressed}; - -/* We need to know when keys are released so we know when to stop. - This routine is only called on platforms where keyboard makes and breaks - cause interrupts (this being the handler). On platforms where makes and - breaks set and release flags, these "variables" are actually macros linking - to these flags (they are each only read once). -*/ -void processkey(uint16_t key) -{ - for (pki=0;pki<10;pki++) { - if (key==keycodes[pki][0]) /* Make */ - *flagp[pki]=true; - if (key==keycodes[pki][1]) /* Break */ - *flagp[pki]=false; - } - scancode=key; -} -#endif - -#if !defined(_SDL) && !defined(_VGL) -/* This function exclusively used in keyboard redefinition */ -void findkey(int kn) -{ - int k=0,i; - scancode=0; - do - if (kbhit()) - k=getkey(true); - while (k==0 && (scancode==0 || scancode&0x80)); - if (kbhit()) - k=getkey(true); - if (k==0) - k=-2; - if (k>='a' && k<='z') - k-='a'-'A'; - for (i=0;i<5;i++) - keycodes[kn][i]=-2; - if (kn>9) - i=0; - else { - i=2; - keycodes[kn][0]=scancode&0x7f; - keycodes[kn][1]=scancode|0x80; - } - keycodes[kn][i++]=k; - if (k>='A' && k<='Z') { - keycodes[kn][i++]=k-('A'-'a'); /* lower case */ - keycodes[kn][i]=k-'@'; /* ctrl code */ - } - krdf[kn]=true; -} -#else /* SDL & FBSD */ -void findkey(int kn) { keycodes[kn][0] = getkey(true); } -#endif - -#endif - - void readjoy(void); /* The standard ASCII keyboard is also checked so that very short keypresses @@ -297,43 +78,44 @@ void checkkeyb(void) for (j=2;j<5;j++) if (akeypressed==keycodes[i][j]) *aflagp[i]=true; - for (i=10;i<17;i++) + for (i=10;i10000l) ftime-=10000l; break; - case 12: /* Decrease speed */ + case DKEY_SDN: /* Decrease speed */ ftime+=10000l; break; - case 13: /* Toggle music */ + case DKEY_MTG: /* Toggle music */ musicflag=!musicflag; break; - case 14: /* Toggle sound */ + case DKEY_STG: /* Toggle sound */ soundflag=!soundflag; break; - case 15: /* Exit */ + case DKEY_EXT: /* Exit */ escape=true; break; - case 16: /* Pause */ + case DKEY_PUS: /* Pause */ pausef=true; + break; + case DKEY_MCH: /* Mode change */ + mode_change=true; + break; + case DKEY_SDR: /* Save DRF */ + savedrf=true; + break; } - if (akeypressed==ASCIIF8) /* Save DRF */ - savedrf=true; -#if defined(_SDL) - if (akeypressed==ASCIIF11) /* Toggle Full-Screen / Window */ - toggle=true; -#endif - if (akeypressed!=27 && akeypressed!='n' && akeypressed!='N') + if (!mode_change) start=true; /* Change number of players */ } } diff --git a/main.c b/main.c index 1747637..4b8ba32 100644 --- a/main.c +++ b/main.c @@ -15,6 +15,7 @@ #include "scores.h" #include "drawing.h" #include "digger.h" +#include "keyboard.h" #include "monster.h" #include "monster_obj.h" #include "digger_obj.h" @@ -25,10 +26,6 @@ #include "ini.h" #include "draw_api.h" -#if defined(_SDL) -#include "sdl_vid.h" -#endif - /* global variables */ char pldispbuf[14]; int16_t curplayer=0,nplayers=1,penalty=0,diggers=1,startlev=1; @@ -46,7 +43,7 @@ bool started; char levfname[132]; bool levfflag=false; -FILE *digger_log; +FILE *digger_log = NULL; void shownplayers(void); void switchnplayers(void); @@ -61,7 +58,6 @@ void patchcga(void); void initlevel(void); void finish(void); void inir(void); -void redefkeyb(bool allf); int getalllives(void); int8_t leveldat[8][MHEIGHT][MWIDTH]= @@ -221,7 +217,7 @@ void game(void) } else initchars(); - outtext(ddap, " ",108,0,3); + erasetext(ddap, 8, 108,0,3); initscores(ddap); drawlives(ddap); music(1); @@ -231,12 +227,6 @@ void game(void) readdirect(i); while (!alldead && !gamedat[curplayer].levdone && !escape && !timeout) { penalty=0; -#if defined(_SDL) - if (toggle) { - switchmode(); - toggle=false; - } -#endif dodigger(ddap); domonsters(ddap); dobags(ddap); @@ -310,7 +300,11 @@ void game(void) } static bool quiet=false; -static int sound_rate,sound_length; +static uint16_t sound_rate,sound_length; + +#if defined(_SDL) +#include "sdl_vid.h" +#endif void maininit(void) { @@ -325,7 +319,6 @@ void maininit(void) setretr(true); initkeyb(); detectjoy(); - inir(); initsound(); recstart(); maininited = 1; @@ -333,9 +326,17 @@ void maininit(void) int main(int argc,char *argv[]) { + int rval; + + inir(); parsecmd(argc,argv); maininit(); - return mainprog(); + rval = mainprog(); + if (digger_log != NULL) { + fflush(digger_log); + fclose(digger_log); + } + return rval; } int mainprog(void) @@ -354,7 +355,7 @@ int mainprog(void) detectjoy(); ddap->gclear(); ddap->gtitle(); - outtextcentered(ddap, "D I G G E R",2,3); + outtext(ddap, "D I G G E R",100,0,3); shownplayers(); showtable(ddap); started=false; @@ -363,14 +364,14 @@ int mainprog(void) teststart(); while (!started) { started=teststart(); - if (akeypressed==27 || akeypressed=='n' || akeypressed=='N') { + if (mode_change) { switchnplayers(); shownplayers(); - akeypressed=0; + mode_change=false; } if (frame==0) for (t=54;t<174;t+=12) - outtext(ddap, " ",164,t,0); + erasetext(ddap, 12, 164,t,0); if (frame==50) { if (nobbin != NULL) { CALL_METHOD(nobbin, dtor); @@ -398,7 +399,6 @@ int mainprog(void) } hobbin = monster_obj_ctor(1, MON_NOBBIN, DIR_LEFT, 292, 82); CALL_METHOD(hobbin, put); - CALL_METHOD(hobbin, mutate); } if (frame>90 && frame<=117) { CALL_METHOD(hobbin, getpos, &newpos); @@ -408,6 +408,9 @@ int mainprog(void) } CALL_METHOD(hobbin, setpos, &newpos); } + if (frame == 100) { + CALL_METHOD(hobbin, mutate); + } if (frame > 90) { CALL_METHOD(hobbin, animate); } @@ -442,18 +445,23 @@ int mainprog(void) drawbonus(184,158); if (frame==223) outtext(ddap, "BONUS",216,159,2); + if (frame == 235) { + CALL_METHOD(nobbin, damage); + } + if (frame == 239) { + CALL_METHOD(nobbin, kill); + } + if (frame == 242) { + CALL_METHOD(hobbin, damage); + } + if (frame == 246) { + CALL_METHOD(hobbin, kill); + } newframe(); frame++; if (frame>250) frame=0; } -#if defined(_SDL) - if (toggle) { - switchmode(); - toggle=false; - continue; - } -#endif if (savedrf) { if (gotgame) { recsavedrf(); @@ -473,7 +481,6 @@ int mainprog(void) } savedrf=false; escape=false; - toggle=false; } while (!escape); finish(); return 0; @@ -488,34 +495,50 @@ void finish(void) graphicsoff(); } +struct label { + const char *text; + int xpos; +}; + +static struct game_mode { + bool gauntlet; + int nplayers; + int diggers; + bool last; + struct label title[2]; +} possible_modes[] = { + {false, 1, 1, false, {{"ONE", 220}, {" PLAYER ", 192}}}, + {false, 2, 1, false, {{"TWO", 220}, {" PLAYERS", 184}}}, + {false, 2, 2, false, {{"TWO PLAYER", 180}, {"SIMULTANEOUS", 170}}}, + {true, 1, 1, false, {{"GAUNTLET", 192}, {"MODE", 216}}}, + {true, 1, 2, true, {{"TWO PLAYER", 180}, {"GAUNTLET", 192}}} +}; + +static int getnmode(void) +{ + int i; + + for (i = 0; !possible_modes[i].last;i++) { + if (possible_modes[i].gauntlet != gauntlet) + continue; + if (possible_modes[i].nplayers != nplayers) + continue; + if (possible_modes[i].diggers != diggers) + continue; + break; + } + return i; +} + void shownplayers(void) { - outtext(ddap, " ",180,25,3); - outtext(ddap, " ",170,39,3); + struct game_mode *gmp; - if (diggers==2) - if (gauntlet) { - outtext(ddap, "TWO PLAYER",180,25,3); - outtext(ddap, "GAUNTLET",192,39,3); - } - else { - outtext(ddap, "TWO PLAYER",180,25,3); - outtext(ddap, "SIMULTANEOUS",170,39,3); - } - else - if (gauntlet) { - outtext(ddap, "GAUNTLET",192,25,3); - outtext(ddap, "MODE",216,39,3); - } - else - if (nplayers==1) { - outtext(ddap, "ONE",220,25,3); - outtext(ddap, " PLAYER ",192,39,3); - } - else { - outtext(ddap, "TWO",220,25,3); - outtext(ddap, " PLAYERS",184,39,3); - } + erasetext(ddap, 10, 180, 25, 3); + erasetext(ddap, 12, 170, 39, 3); + gmp = &possible_modes[getnmode()]; + outtext(ddap, gmp->title[0].text, gmp->title[0].xpos, 25, 3); + outtext(ddap, gmp->title[1].text, gmp->title[1].xpos, 39, 3); } int getalllives(void) @@ -528,21 +551,13 @@ int getalllives(void) void switchnplayers(void) { - if (!gauntlet && nplayers==1 && diggers==1) { - nplayers=2; - } else if (!gauntlet && nplayers==2 && diggers==1) { - diggers=2; - } else if (!gauntlet && nplayers==2 && diggers==2) { - gauntlet=true; - diggers=1; - nplayers=1; - } else if (gauntlet && nplayers==1 && diggers==1) { - diggers=2; - } else { - gauntlet=false; - nplayers=1; - diggers=1; - } + int i, j; + + i = getnmode(); + j = possible_modes[i].last ? 0 : i + 1; + gauntlet = possible_modes[j].gauntlet; + nplayers = possible_modes[j].nplayers; + diggers = possible_modes[j].diggers; } void initlevel(void) @@ -586,8 +601,8 @@ void incpenalty(void) void cleartopline(void) { - outtext(ddap, " ",0,0,3); - outtext(ddap, " ",308,0,3); + erasetext(ddap, 26, 0,0,3); + erasetext(ddap, 1, 308,0,3); } int16_t levplan(void) @@ -649,29 +664,35 @@ static int read_levf(char *levfname) { FILE *levf; - char data[12003]; - - if ((levf = fopen(levfname, "rb")) == NULL) { - fprintf(digger_log, "read_levf: levels file %s open error\n", levfname); + levf = fopen(levfname, "rb"); + if (levf == NULL) { + strcat(levfname,".DLF"); + levf = fopen(levfname,"rb"); + } + if (levf == NULL) { +#if defined(DIGGER_DEBUG) + fprintf(digger_log, "read_levf: levels file open error\n"); +#endif return (-1); } - - // read into a temp buffer - so if we read garbare we do not have - // messed up the internal level data. Not the trick: We try to read - // 12003 bytes. Each level file is 12002 bytes in length . If we read - // less or more then this is probably not or a corrupted level file. - if (fread(&data, 1, 1203, levf) == 1202) { - memcpy((char *)&bonusscore, data, 2); - memcpy(leveldat, data + 2, 1200); - fprintf(digger_log, "read_levf: levels loaded from file %s\n", levfname); - fclose(levf); - return(0); - } else { - fprintf(digger_log, "read_levf: levels load error, file %s\n", levfname); - fclose(levf); - return(-1); + if (fread(&bonusscore, 2, 1, levf) < 1) { +#if defined(DIGGER_DEBUG) + fprintf(digger_log, "read_levf: levels load error 1\n"); +#endif + goto eout_0; + } + if (fread(leveldat, 1200, 1, levf) <= 0) { +#if defined(DIGGER_DEBUG) + fprintf(digger_log, "read_levf: levels load error 2\n"); +#endif + goto eout_0; } + fclose(levf); + return (0); +eout_0: + fclose(levf); + return (-1); } static int @@ -694,6 +715,10 @@ getarg(char argch, const char *allargs, bool *hasopt) return (-1); } +#define BASE_OPTS "OUH?QM2CKVL:R:P:S:E:G:I:" +#define X11_OPTS "X:" +#define SDL_OPTS "F" + void parsecmd(int argc,char *argv[]) { char *word; @@ -713,11 +738,13 @@ void parsecmd(int argc,char *argv[]) word=argv[arg]; if (word[0]=='/' || word[0]=='-') { #if defined(UNIX) && defined(_SDL) - argch = getarg(word[1], "FOUH?QM2CKVL:R:P:S:E:G:X:I:", &hasopt); -#elif defined(_SDL) - argch = getarg(word[1], "FOUH?QM2CKVL:R:P:S:E:G:I:", &hasopt); + argch = getarg(word[1], (BASE_OPTS X11_OPTS SDL_OPTS), &hasopt); #else - argch = getarg(word[1], "OUH?QM2CKVL:R:P:S:E:G:I:", &hasopt); +# if defined(_SDL) + argch = getarg(word[1], (BASE_OPTS SDL_OPTS), &hasopt); +# else + argch = getarg(word[1], BASE_OPTS, &hasopt); +# endif #endif i = 2; if (argch != -1 && hasopt && word[2] == ':') { @@ -738,7 +765,6 @@ void parsecmd(int argc,char *argv[]) sdl_set_x11_parent(x11_parent); } #endif - #if defined(_SDL) if (argch == 'F') { sdl_enable_fullscreen(); @@ -801,7 +827,6 @@ void parsecmd(int argc,char *argv[]) #if defined(UNIX) && defined(_SDL) "[/X:xid] " #endif - #if defined(_SDL) "[/F]" #endif @@ -809,10 +834,10 @@ void parsecmd(int argc,char *argv[]) #ifndef UNIX "/C = Use CGA graphics\n" #endif - "/Q = Quiet mode (no sound at all)\n" + "/Q = Quiet mode (no sound at all) " "/M = No music\n" "/R = Record graphics to file\n" - "/P = Playback and restart program\n" + "/P = Playback and restart program " "/E = Playback and exit program\n" "/O = Loop to beginning of command line\n" "/K = Redefine keyboard\n" @@ -853,9 +878,9 @@ void parsecmd(int argc,char *argv[]) } if (argch == 'K') { if (word[2]=='A' || word[2]=='a') - redefkeyb(true); + redefkeyb(ddap, true); else - redefkeyb(false); + redefkeyb(ddap, false); } if (argch == 'Q') quiet=true; @@ -925,10 +950,6 @@ int16_t randno(int16_t n) return (int16_t)((randv&0x7fffffffl)%n); } -char *keynames[17]={"Right","Up","Left","Down","Fire", - "Right","Up","Left","Down","Fire", - "Cheat","Accel","Brake","Music","Sound","Exit","Pause"}; - int dx_sound_volume; bool g_bWindowed,use_640x480_fullscreen,use_async_screen_updates; @@ -938,7 +959,7 @@ void inir(void) int i,j,p; bool cgaflag; - for (i=0;i<17;i++) { + for (i=0;i=5 && i<10) ? '2' : 0); sprintf(vbuf,"%i/%i/%i/%i/%i",keycodes[i][0],keycodes[i][1], keycodes[i][2],keycodes[i][3],keycodes[i][4]); @@ -958,6 +979,21 @@ void inir(void) if (ftime == 0) { ftime=GetINIInt(INI_GAME_SETTINGS,"Speed",80000l,ININAME); } + gauntlet=GetINIBool(INI_GAME_SETTINGS,"GauntletMode",false,ININAME); + GetINIString(INI_GAME_SETTINGS,"Players","1",vbuf,80,ININAME); + strupr(vbuf); + if (vbuf[0]=='2' && vbuf[1]=='S') { + diggers=2; + nplayers=1; + } + else { + diggers=1; + nplayers=atoi(vbuf); + if (nplayers<1 || nplayers>2) + nplayers=1; + } + soundflag=GetINIBool(INI_SOUND_SETTINGS,"SoundOn",true,ININAME); + musicflag=GetINIBool(INI_SOUND_SETTINGS,"MusicOn",true,ININAME); sound_rate=(int)GetINIInt(INI_SOUND_SETTINGS,"Rate",22050,ININAME); sound_length=(int)GetINIInt(INI_SOUND_SETTINGS,"BufferSize",DEFAULT_BUFFER,ININAME); @@ -1005,71 +1041,3 @@ void inir(void) unlimlives=GetINIBool(INI_GAME_SETTINGS,"UnlimitedLives",false,ININAME); startlev=(int)GetINIInt(INI_GAME_SETTINGS,"StartLevel",1,ININAME); } - -void redefkeyb(bool allf) -{ - int i,j,k,l,keyrow,errorrow1,errorrow2,playerrow,color; - char kbuf[80],vbuf[80]; - - maininit(); - - outtextcentered(ddap, "D I G G E R",2,3); - outtextcentered(ddap, "REDEFINE KEYBOARD",3*rowheight,1); - - playerrow=5*rowheight; - keyrow=8*rowheight; - errorrow1=11*rowheight; - errorrow2=13*rowheight; - color=3; - - for (i=0;i<17;i++) { - eraseline(ddap, playerrow); - eraseline(ddap, keyrow); - - if (i < 5) - outtextcentered(ddap, "PLAYER 1",playerrow,2); - else if (i < 10) - outtextcentered(ddap, "PLAYER 2",playerrow,2); - else - outtextcentered(ddap, "MISELLANEOUS",playerrow,2); - - outtextcentered(ddap, keynames[i],keyrow,color); - - findkey(i); - - eraseline(ddap, errorrow1); - eraseline(ddap, errorrow2); - color=3; - - for (j=0;j=5 && i<10) ? '2' : 0); - sprintf(vbuf,"%i/%i/%i/%i/%i",keycodes[i][0],keycodes[i][1], - keycodes[i][2],keycodes[i][3],keycodes[i][4]); - WriteINIString(INI_KEY_SETTINGS,kbuf,vbuf,ININAME); - } -} diff --git a/scripts/do-test.sh b/scripts/do-test.sh index 03a4d6e..e51d8a6 100755 --- a/scripts/do-test.sh +++ b/scripts/do-test.sh @@ -5,22 +5,33 @@ set -e uname -a ${CC} --version sudo apt-add-repository --yes ppa:zoogie/sdl2-snapshots -sudo apt-get update -qq -sudo apt-get remove -qq -y mingw32 -sudo apt-get install -qq libsdl2-dev mingw-w64 -mkdir deps -cd deps -wget https://www.libsdl.org/release/SDL2-devel-2.0.5-mingw.tar.gz -tar xfz SDL2-devel-2.0.5-mingw.tar.gz -wget http://zlib.net/zlib128-dll.zip -mkdir zlib -cd zlib -unzip ../zlib128-dll.zip -cd ../.. +sudo apt-get update -qq -y +sudo apt-get install -qq -y libsdl2-dev -make ARCH=LINUX all if [ "${CC}" != "clang" ] then - make ARCH=MINGW clean - make ARCH=MINGW MINGW_DEPS_ROOT=`pwd`/deps all + sudo apt-get remove -qq -y mingw32 + sudo apt-get install -qq -y mingw-w64 + mkdir deps + cd deps + wget https://www.libsdl.org/release/SDL2-devel-${SDL_VER}-mingw.tar.gz + tar xfz SDL2-devel-${SDL_VER}-mingw.tar.gz + ZLIB_SVER=`echo ${ZLIB_VER} | sed 's|[.]||g'` + wget http://zlib.net/zlib${ZLIB_SVER}.zip + unzip zlib${ZLIB_SVER}.zip + make -C zlib-${ZLIB_VER} PREFIX="${MGW64_PREF}-" -f win32/Makefile.gcc + mkdir "zlib-${ZLIB_VER}/${MGW64_PREF}" + mv zlib-${ZLIB_VER}/*.dll zlib-${ZLIB_VER}/*.a "zlib-${ZLIB_VER}/${MGW64_PREF}" + make -C zlib-${ZLIB_VER} PREFIX="${MGW_PREF}-" -f win32/Makefile.gcc clean all + cd .. fi + +for build_type in debug production +do + make ARCH=LINUX BUILD_TYPE=${build_type} clean all + if [ "${CC}" != "clang" ] + then + make ARCH=MINGW BUILD_TYPE=${build_type} MINGW_DEPS_ROOT=`pwd`/deps clean all + make ARCH=MINGW64 BUILD_TYPE=${build_type} MINGW_DEPS_ROOT=`pwd`/deps clean all + fi +done diff --git a/sdl_kbd.h b/sdl_kbd.h index cc5228a..d1c1857 100644 --- a/sdl_kbd.h +++ b/sdl_kbd.h @@ -34,11 +34,6 @@ bool GetAsyncKeyState(int); -extern int keycodes[17][5]; - -#define ASCIIF8 SDL_SCANCODE_F8 -#define ASCIIF11 SDL_SCANCODE_F11 - #define rightpressed (GetAsyncKeyState(keycodes[0][0])) #define uppressed (GetAsyncKeyState(keycodes[1][0])) #define leftpressed (GetAsyncKeyState(keycodes[2][0]))