From ff66ad0a21846d4f55f549ae1995bcb4343fac94 Mon Sep 17 00:00:00 2001 From: Andreas Peters Date: Fri, 20 Nov 2020 17:05:05 +0100 Subject: [PATCH 1/3] add PM support for os/2 --- src/main.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 0b7bc6e..f47a88a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,6 +15,7 @@ Copyright (C) 1995-2019 David Joffe /*--------------------------------------------------------------------------*/ + #include "mmgr/mmgr.h" #include // for srand() @@ -52,6 +53,10 @@ Copyright (C) 1995-2019 David Joffe #include //SetProcessDPIAware(); #endif //#endif +#ifdef __OS2__ +#define INCL_DOS +#include +#endif #ifndef NOSOUND #include //For background music stuff @@ -75,6 +80,19 @@ void CheckHighScores( int score ); // check if high score table is beaten, void InitMainMenu(); void KillMainMenu(); +#ifdef __OS2__ +void MorphToPM() +{ + PPIB pib; + PTIB tib; + + DosGetInfoBlocks(&tib, &pib); + + // Change flag from VIO to PM: + if (pib->pib_ultype==2) pib->pib_ultype = 3; +} +#endif + /*--------------------------------------------------------------------------*/ // Main menu [NB, warning, the handling code uses indexes :/ .. so if you add/remove items, must update there too - dj2016-10] struct SMenuItem mainMenuItems[] = @@ -107,6 +125,12 @@ CMenu mainMenu ( "main.cpp:mainMenu" ); // This is the 'main' function. The big cheese. int main ( int argc, char** argv ) { + + +#ifdef __OS2__ + MorphToPM(); +#endif + // Check commandline args bool bfullscreen = false; bool b640 = false; From 14914f64cfe6bbf260fa50f039125d8425e1d381 Mon Sep 17 00:00:00 2001 From: Andreas Peters Date: Fri, 20 Nov 2020 17:06:21 +0100 Subject: [PATCH 2/3] add makefile to build under os/2 --- Makefile.os2 | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Makefile.os2 diff --git a/Makefile.os2 b/Makefile.os2 new file mode 100644 index 0000000..de18c38 --- /dev/null +++ b/Makefile.os2 @@ -0,0 +1,75 @@ +# +# David Joffe +# Copyright 1998-2002 David Joffe +# 1998/12 +# makefile for Dave Gnukem +# + +CPP = g++ +CC = gcc + + +#CFLAGS = -O -Wall $(INCLUDEDIRS) + +# Un/recomment as needed for removing sound support, optimizations etc +# If you don't -DDATA_DIR to a valid dir, then data files will be assumed +# to be in current directory +#CFLAGS = -Wall -I/@unixroot/usr/include -DHAVE_SOUND -DDEBUG -O -m486 +CFLAGS = -DUSESDL $(INCLUDEDIRS) -I/@unixroot/usr/include +#Release version: +#CFLAGS = -O -Wall -I/@unixroot/usr/include -DHAVE_SOUND $(INCLUDEDIRS) + +LIBS = -lSDL_mixer -lsdl -Zexe -lpthread +BIN = davegnukem.exe +BINED = ed + +OBJFILES = src/main.o src/graph.o src/game.o src/menu.o\ + src/block.o src/credits.o src/instructions.o src/djstring.o \ + src/djimage.o src/djlog.o src/inventory.o src/mission.o\ + src/hiscores.o src/mixins.o src/thing.o src/hero.o \ + src/thing_monsters.o src/gameending.o \ + src/level.o src/settings.o src/keys.o \ + src/djtypes.o src/bullet.o \ + src/ed.o src/ed_DrawBoxContents.o src/ed_common.o src/ed_lvled.o \ + src/ed_macros.o src/ed_spred.o \ + src/sdl/djgraph.o src/sdl/djinput.o src/sdl/djsound.o \ + src/sdl/djtime.o \ + src/sys_error.o src/sys_log.o src/m_misc.cpp + +OBJFILESED = src/graph.o src/ed_standalone_original.o \ + src/block.o src/djstring.o \ + src/djimage.o src/djlog.o src/mission.o\ + src/mixins.o src/level.o \ + src/djtypes.o \ + src/sdl/djgraph.o src/sdl/djinput.o src/sdl/djsound.o \ + src/sdl/djtime.o \ + src/sys_error.o src/sys_log.o src/m_misc.o + +default: djg + +djg: $(OBJFILES) + $(CPP) -o $(BIN) $(OBJFILES) $(LIBS) + +ed: $(OBJFILESED) + $(CPP) -o $(BINED) $(OBJFILESED) $(LIBS) + +clean: + rm -f $(BIN) $(BINED) *~ core \#* + find src -name '*.o' | xargs rm -f + +dist: + rm -f core *~ \#* + find src -name '*.o' | xargs rm -f + +linecount: + cat src/*.cpp src/*.h src/linux/*.cpp | wc -l + +fixme: + ls src/*.c src/*.cpp src/linux/*.cpp src/*.h | xargs grep -i fixme + +%.o: %.c + $(CPP) $(CFLAGS) -c $< -o $@ + +%.o: %.cpp + $(CPP) $(CFLAGS) -c $< -o $@ + From 566b5d4f2b98d37f15cafb42e5807fde722a50e7 Mon Sep 17 00:00:00 2001 From: Andreas Peters Date: Sun, 22 Nov 2020 13:52:33 +0100 Subject: [PATCH 3/3] change SDL includes to support OS2 --- .gitignore | 2 ++ src/djgraph.h | 4 ++++ src/game.cpp | 4 ++++ src/graph.cpp | 4 ++++ src/keys.cpp | 4 ++++ src/main.cpp | 4 ++++ src/sdl/djgraph.cpp | 4 ++++ src/sdl/djsound.cpp | 9 +++++++++ src/sdl/djtime.cpp | 4 ++++ 9 files changed, 39 insertions(+) diff --git a/.gitignore b/.gitignore index c17fe1b..8d9f682 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,5 @@ # Temporary local Visual Studio settings and cached stuff eg precompiled headers that should not be committed /src/vcDave/.vs/ +/**/*.o +/*.exe diff --git a/src/djgraph.h b/src/djgraph.h index 7517754..0d374b8 100644 --- a/src/djgraph.h +++ b/src/djgraph.h @@ -9,7 +9,11 @@ Copyright (C) 1998-2018 David Joffe #ifndef _DJGRAPH_H_ #define _DJGRAPH_H_ +#ifdef __OS2__ +#include +#else #include "SDL.h" +#endif #include "mmgr/mmgr.h" #include "djimage.h" diff --git a/src/game.cpp b/src/game.cpp index 18f61de..ab2d167 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -45,7 +45,11 @@ using namespace std; #include "instructions.h"//Slightly don't like this dependency. For ShowInstructions() from in-game menu. [dj2017-08] #ifndef NOSOUND +#ifdef __OS2__ +#include +#else #include //For background music stuff +#endif Mix_Music* g_pGameMusic=NULL; #endif diff --git a/src/graph.cpp b/src/graph.cpp index 6ea30c1..dfdc28c 100644 --- a/src/graph.cpp +++ b/src/graph.cpp @@ -15,7 +15,11 @@ Copyright (C) 1998-2019 David Joffe #include #include #include +#ifdef __OS2__ +#include +#else #include "SDL.h" +#endif #include "sys_log.h"//Log #include "djstring.h"//djStrPrintf diff --git a/src/keys.cpp b/src/keys.cpp index abf8fbc..44c2f78 100644 --- a/src/keys.cpp +++ b/src/keys.cpp @@ -8,7 +8,11 @@ Created: 09/2001 #include "keys.h" #include "settings.h" +#ifdef __OS2__ +#include +#else #include "SDL.h" +#endif #include using namespace std; diff --git a/src/main.cpp b/src/main.cpp index f47a88a..915416e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,8 +59,12 @@ Copyright (C) 1995-2019 David Joffe #endif #ifndef NOSOUND +#ifdef __OS2__ +#include +#else #include //For background music stuff #endif +#endif #include #include diff --git a/src/sdl/djgraph.cpp b/src/sdl/djgraph.cpp index 959e80a..fb0331a 100644 --- a/src/sdl/djgraph.cpp +++ b/src/sdl/djgraph.cpp @@ -15,7 +15,11 @@ Copyright (C) 1997-2020 David Joffe #include "../djgraph.h" #include "../sys_log.h" +#ifdef __OS2__ +#include +#else #include "SDL.h" +#endif #include "../config.h"//[For CFG_APPLICATION_RENDER_RES_W etc. dj2019-06 slightly ugly dependency direction, conceptually, but not the biggest thing in the world to worry about now, maybe later.] #include diff --git a/src/sdl/djsound.cpp b/src/sdl/djsound.cpp index 4fbb662..e3bd321 100644 --- a/src/sdl/djsound.cpp +++ b/src/sdl/djsound.cpp @@ -7,11 +7,20 @@ Copyright (C) 1999-2018 David Joffe and Kent Mein #include "../djsound.h" #include "../djstring.h" #include "../djlog.h" +#ifdef __OS2__ +#include +#include +#else #include #include +#endif #ifndef NOSOUND +#ifdef __OS2__ +#include +#else #include #endif +#endif #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) #include //Fixing malloc.h 'not found' error compiling on Mac [dj2016-10] diff --git a/src/sdl/djtime.cpp b/src/sdl/djtime.cpp index 2fa173d..ee6385f 100644 --- a/src/sdl/djtime.cpp +++ b/src/sdl/djtime.cpp @@ -5,7 +5,11 @@ Copyright (C) 1999-2018 David Joffe */ #include "../djtime.h" +#ifdef __OS2__ +#include +#else #include "SDL.h" +#endif #ifdef WIN32 #include #include