From 42b4208d1e47bab69e5dd205ff4f80828db7418e Mon Sep 17 00:00:00 2001 From: terminx Date: Sat, 1 Jul 2006 01:40:18 +0000 Subject: [PATCH] New startup window from JonoF + some other stuff This was not at all pleasant to merge, and problems should be expected. ;) git-svn-id: https://svn.eduke32.com/eduke32@194 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/Makefile | 21 +- polymer/build/Makefile.deps | 12 +- polymer/build/Makefile.msvc | 16 +- polymer/build/Makefile.shared | 2 +- polymer/build/Makefile.watcom | 14 +- polymer/build/build.cfg | 104 -- polymer/build/game.cfg | 97 -- polymer/build/include/baselayer.h | 11 +- polymer/build/include/compat.h | 1 + polymer/build/include/editor.h | 2 +- polymer/build/include/engineinfo.h | 6 - polymer/build/include/gtkbits.h | 6 - polymer/build/include/osxmain.h | 11 + polymer/build/include/pragmas.h | 1061 +++++++++-------- polymer/build/include/startwin.editor.h | 19 + polymer/build/include/winlayer.h | 28 - .../build/src/StartupWinController.editor.m | 189 +++ polymer/build/src/StartupWinController.game.m | 189 +++ polymer/build/src/baselayer.c | 20 - polymer/build/src/build.c | 19 +- polymer/build/src/buildstartwin.c | 178 --- polymer/build/src/compat.c | 52 +- polymer/build/src/config.c | 8 +- polymer/build/src/engine.c | 144 ++- polymer/build/src/game.c | 71 +- polymer/build/src/gamestartwin.c | 144 --- polymer/build/src/glbuild.c | 12 +- polymer/build/src/gtkbits.c | 163 +-- polymer/build/src/kplib.c | 340 ++++-- polymer/build/src/mdsprite.c | 8 +- polymer/build/src/misc/buildres.rc | 36 +- polymer/build/src/misc/gameres.rc | 32 +- .../src/misc/gtkstartwin/gtkstartwin.glade | 450 +++++++ .../src/misc/gtkstartwin/gtkstartwin.gladep | 11 + .../src/misc/gtkstartwin/pixmaps/game.bmp | Bin 0 -> 40960 bytes polymer/build/src/osxbits.m | 29 +- polymer/build/src/polymost.c | 14 +- polymer/build/src/pragmas.c | 136 +-- polymer/build/src/sdlayer.c | 44 +- polymer/build/src/startgtk.editor.c | 607 ++++++++++ polymer/build/src/startgtk.game.c | 540 +++++++++ polymer/build/src/startwin.editor.c | 442 +++++++ polymer/build/src/startwin.game.c | 415 +++++++ polymer/build/src/startwin.game.h | 18 + polymer/build/src/winlayer.c | 277 +---- polymer/eduke32/ChangeLog | 27 + polymer/eduke32/Makefile | 7 +- polymer/eduke32/Makefile.deps | 5 +- polymer/eduke32/build.cfg | 104 -- polymer/eduke32/source/actors.c | 2 +- polymer/eduke32/source/astub.c | 2 +- polymer/eduke32/source/config.c | 9 +- polymer/eduke32/source/config.h | 3 +- polymer/eduke32/source/funct.h | 2 +- polymer/eduke32/source/game.c | 50 +- polymer/eduke32/source/menus.c | 2 +- polymer/eduke32/source/misc/buildres.rc | 35 +- polymer/eduke32/source/misc/gameres.rc | 43 +- .../source/misc/gtkstartwin/gtkstartwin.glade | 551 +++++++++ .../misc/gtkstartwin/gtkstartwin.gladep | 11 + .../source/misc/gtkstartwin/pixmaps/game.bmp | Bin 0 -> 29080 bytes polymer/eduke32/source/premap.c | 1 + polymer/eduke32/source/startgtk.game.c | 642 ++++++++++ polymer/eduke32/source/startwin.game.c | 431 +++++++ polymer/eduke32/source/startwin.game.h | 23 + 65 files changed, 5852 insertions(+), 2097 deletions(-) delete mode 100644 polymer/build/build.cfg delete mode 100644 polymer/build/game.cfg delete mode 100644 polymer/build/include/engineinfo.h create mode 100755 polymer/build/include/osxmain.h create mode 100755 polymer/build/include/startwin.editor.h create mode 100755 polymer/build/src/StartupWinController.editor.m create mode 100755 polymer/build/src/StartupWinController.game.m delete mode 100644 polymer/build/src/buildstartwin.c delete mode 100644 polymer/build/src/gamestartwin.c create mode 100755 polymer/build/src/misc/gtkstartwin/gtkstartwin.glade create mode 100755 polymer/build/src/misc/gtkstartwin/gtkstartwin.gladep create mode 100755 polymer/build/src/misc/gtkstartwin/pixmaps/game.bmp create mode 100755 polymer/build/src/startgtk.editor.c create mode 100755 polymer/build/src/startgtk.game.c create mode 100755 polymer/build/src/startwin.editor.c create mode 100755 polymer/build/src/startwin.game.c create mode 100755 polymer/build/src/startwin.game.h delete mode 100644 polymer/eduke32/build.cfg create mode 100755 polymer/eduke32/source/misc/gtkstartwin/gtkstartwin.glade create mode 100755 polymer/eduke32/source/misc/gtkstartwin/gtkstartwin.gladep create mode 100755 polymer/eduke32/source/misc/gtkstartwin/pixmaps/game.bmp create mode 100755 polymer/eduke32/source/startgtk.game.c create mode 100755 polymer/eduke32/source/startwin.game.c create mode 100755 polymer/eduke32/source/startwin.game.h diff --git a/polymer/build/Makefile b/polymer/build/Makefile index 5c4eda6d5..e144eb912 100644 --- a/polymer/build/Makefile +++ b/polymer/build/Makefile @@ -82,7 +82,6 @@ ENGINEOBJS+= \ $(OBJ)crc32.$o \ $(OBJ)defs.$o \ $(OBJ)engine.$o \ - $(OBJ)engineinfo.$o \ $(OBJ)glbuild.$o \ $(OBJ)kplib.$o \ $(OBJ)lzf_c.$o \ @@ -139,7 +138,8 @@ ifeq ($(RENDERTYPE),SDL) ifeq (1,$(HAVE_GTK2)) OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) ENGINEOBJS+= $(OBJ)gtkbits.$o - GAMEEXEOBJS+= $(OBJ)game_banner.$o + EDITOROBJS+= $(OBJ)startgtk.editor.$o + GAMEEXEOBJS+= $(OBJ)game_banner.$o $(OBJ)startgtk.game.$o EDITOREXEOBJS+= $(OBJ)editor_banner.$o endif @@ -148,8 +148,8 @@ ifeq ($(RENDERTYPE),SDL) endif ifeq ($(RENDERTYPE),WIN) ENGINEOBJS+= $(OBJ)winlayer.$o - EDITOROBJS+= $(OBJ)buildstartwin.$o - GAMEEXEOBJS+= $(OBJ)gameres.$(res) $(OBJ)gamestartwin.$o + EDITOROBJS+= $(OBJ)startwin.editor.$o + GAMEEXEOBJS+= $(OBJ)gameres.$(res) $(OBJ)startwin.game.$o EDITOREXEOBJS+= $(OBJ)buildres.$(res) endif @@ -160,7 +160,7 @@ endif OURCFLAGS+= $(BUILDCFLAGS) -.PHONY: clean veryclean all utils writeengineinfo enginelib editorlib +.PHONY: clean veryclean all utils enginelib editorlib # TARGETS @@ -221,15 +221,6 @@ enumdisplay$(EXESUFFIX): src/misc/enumdisplay.c # DEPENDENCIES include Makefile.deps -.PHONY: $(OBJ)engineinfo.$o -$(OBJ)engineinfo.$o: - echo "const char _engine_cflags[] = \"$(CFLAGS) $(OURCFLAGS)\";" > $(SRC)tmp/engineinfo.c - echo "const char _engine_libs[] = \"$(LIBS)\";" >> $(SRC)tmp/engineinfo.c - echo "const char _engine_uname[] = \"$(shell uname -a)\";" >> $(SRC)tmp/engineinfo.c - echo "const char _engine_compiler[] = \"$(CC) $(shell $(CC) -dumpversion) $(shell $(CC) -dumpmachine)\";" >> $(SRC)tmp/engineinfo.c - echo "const char _engine_date[] = __DATE__ \" \" __TIME__;" >> $(SRC)tmp/engineinfo.c - $(CC) $(CFLAGS) $(OURCFLAGS) -c $(SRC)tmp/engineinfo.c -o $@ 2>&1 - # RULES $(OBJ)%.$o: $(SRC)%.nasm $(AS) $(ASFLAGS) $< -o $@ @@ -244,7 +235,7 @@ $(OBJ)%.$o: $(SRC)tmp/%.c $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1 $(OBJ)%.$o: $(SRC)misc/%.rc - $(RC) -i $^ -o $@ + $(RC) -i $< -o $@ --include-dir=$(INC) --include-dir=$(SRC) $(OBJ)%.$o: $(SRC)util/%.c $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1 diff --git a/polymer/build/Makefile.deps b/polymer/build/Makefile.deps index d558f306f..75cf6eeb7 100644 --- a/polymer/build/Makefile.deps +++ b/polymer/build/Makefile.deps @@ -21,7 +21,7 @@ $(OBJ)lzwnew.$o: $(SRC)lzwnew.c $(OBJ)md4.$o: $(SRC)md4.c $(INC)md4.h $(INC)compat.h $(OBJ)mmulti_null.$o: $(SRC)mmulti_null.c $(INC)mmulti.h $(OBJ)mmulti.$o: $(SRC)mmulti.c -$(OBJ)osd.$o: $(SRC)osd.c $(INC)build.h $(INC)osd.h $(INC)compat.h $(INC)engineinfo.h $(INC)baselayer.h +$(OBJ)osd.$o: $(SRC)osd.c $(INC)build.h $(INC)osd.h $(INC)compat.h $(INC)baselayer.h $(OBJ)pragmas.$o: $(SRC)pragmas.c $(INC)compat.h $(OBJ)scriptfile.$o: $(SRC)scriptfile.c $(INC)scriptfile.h $(INC)cache1d.h $(INC)compat.h $(OBJ)sdlayer.$o: $(SRC)sdlayer.c $(INC)compat.h $(INC)sdlayer.h $(INC)baselayer.h $(INC)cache1d.h $(INC)pragmas.h $(INC)a.h $(INC)build.h $(INC)osd.h $(INC)glbuild.h @@ -29,10 +29,12 @@ $(OBJ)sound.$o: $(SRC)sound.c $(INC)osd.h $(INC)compat.h $(INC)cache1d.h $(OBJ)winlayer.$o: $(SRC)winlayer.c $(INC)compat.h $(INC)winlayer.h $(INC)baselayer.h $(INC)pragmas.h $(INC)build.h $(INC)a.h $(INC)osd.h $(INC)dxdidf.h $(INC)glbuild.h $(OBJ)gtkbits.$o: $(SRC)gtkbits.c $(INC)baselayer.h $(INC)build.h -$(OBJ)gameres.$(res): $(SRC)misc/gameres.rc -$(OBJ)buildres.$(res): $(SRC)misc/buildres.rc -$(OBJ)gamestartwin.$o: $(SRC)gamestartwin.c $(INC)winlayer.h $(INC)build.h $(INC)compat.h -$(OBJ)buildstartwin.$o: $(SRC)buildstartwin.c $(INC)winlayer.h $(INC)build.h $(INC)compat.h +$(OBJ)gameres.$(res): $(SRC)misc/gameres.rc $(SRC)startwin.game.h +$(OBJ)buildres.$(res): $(SRC)misc/buildres.rc $(INC)startwin.editor.h +$(OBJ)startwin.editor.$o: $(SRC)startwin.editor.c $(INC)build.h $(INC)editor.h $(INC)winlayer.h $(INC)compat.h $(INC)startwin.editor.h +$(OBJ)startwin.game.$o: $(SRC)startwin.game.c $(INC)build.h $(INC)editor.h $(INC)winlayer.h $(INC)compat.h $(SRC)startwin.game.h +$(OBJ)startgtk.editor.$o: $(SRC)startgtk.editor.c $(INC)baselayer.h $(INC)build.h $(INC)editor.h $(INC)compat.h +$(OBJ)startgtk.game.$o: $(SRC)startgtk.game.c $(INC)baselayer.h $(INC)build.h $(INC)compat.h $(OBJ)game_icon.$o: $(RSRC)game_icon.c $(OBJ)build_icon.$o: $(RSRC)build_icon.c diff --git a/polymer/build/Makefile.msvc b/polymer/build/Makefile.msvc index 853745cd0..bddf00f1a 100644 --- a/polymer/build/Makefile.msvc +++ b/polymer/build/Makefile.msvc @@ -58,7 +58,6 @@ ENGINEOBJS=$(OBJ)a.$o \ $(OBJ)crc32.$o \ $(OBJ)defs.$o \ $(OBJ)engine.$o \ - $(OBJ)engineinfo.$o \ $(OBJ)glbuild.$o \ $(OBJ)kplib.$o \ $(OBJ)lzf_c.$o \ @@ -72,13 +71,13 @@ ENGINEOBJS=$(OBJ)a.$o \ $(OBJ)winlayer.$o EDITOROBJS=$(OBJ)build.$o \ - $(OBJ)buildstartwin.$o \ + $(OBJ)startwin.editor.$o \ $(OBJ)config.$o GAMEEXEOBJS=$(OBJ)config.$o \ $(OBJ)game.$o \ $(OBJ)gameres.$(res) \ - $(OBJ)gamestartwin.$o \ + $(OBJ)startwin.game.$o \ $(OBJ)sound.$o \ $(OBJ)$(ENGINELIB) @@ -149,17 +148,6 @@ wad2art$(EXESUFFIX): $(OBJ)wad2art.$o $(OBJ)pragmas.$o $(OBJ)compat.$o # DEPENDENCIES !include Makefile.deps -$(OBJ)engineinfo.$o: writeengineinfo $(SRC)tmp\engineinfo.c - -writeengineinfo: - copy /y << $(SRC)tmp\engineinfo.c -const char _engine_cflags[] = "$(CFLAGS:\=\\)"; -const char _engine_libs[] = "$(LIBS)"; -const char _engine_uname[] = "unknown"; -const char _engine_compiler[] = "$(CC)"; -const char _engine_date[] = __DATE__ " " __TIME__; -< $(SRC)tmp\engineinfo.c - echo const char _engine_libs[] = "$(LIBS:\=\\)"; >> $(SRC)tmp\engineinfo.c - echo const char _engine_uname[] = "unknown"; >> $(SRC)tmp\engineinfo.c - echo const char _engine_compiler[] = "$(CC)"; >> $(SRC)tmp\engineinfo.c - echo const char _engine_date[] = __DATE__ " " __TIME__; >> $(SRC)tmp\engineinfo.c - # PHONIES clean: .SYMBOLIC -erase /q $(OBJ)* game$(EXESUFFIX) build$(EXESUFFIX) $(UTILS) *.err diff --git a/polymer/build/build.cfg b/polymer/build/build.cfg deleted file mode 100644 index fd0ff4ec4..000000000 --- a/polymer/build/build.cfg +++ /dev/null @@ -1,104 +0,0 @@ -; Build editor configuration - -; Video mode selection -; 0 - Windowed -; 1 - Fullscreen -fullscreen = 0 - -; Video resolution selection -; 0 - 320 x 200 -; 1 - 360 x 200 -; 2 - 320 x 240 -; 3 - 360 x 240 -; 4 - 320 x 400 -; 5 - 360 x 400 -; 6 - 640 x 350 -; 7 - 640 x 400 -; 8 - 640 x 480 -; 9 - 800 x 600 -; 10 - 1024 x 768 -; 11 - 1280 x 1024 -; 12 - 1600 x 1200 -; You can select a seperate 2D editor resolution by -; removing the semicolon from the second line below -; and selecting a mode number. The minimum 2D mode -; is 640x480 (mode #8) -resolution = 8 -;2dresolution = 8 - -; 3D-mode colour depth -bpp = 8 - -; Maximum OpenGL mode refresh rate (Windows only, in Hertz) -maxrefreshfreq = 60 - -; 3D mode brightness setting -; 0 - lowest -; 15 - highest -brightness = 0 - -; Sound sample frequency -; 0 - 6 KHz -; 1 - 8 KHz -; 2 - 11.025 KHz -; 3 - 16 KHz -; 4 - 22.05 KHz -; 5 - 32 KHz -; 6 - 44.1 KHz -samplerate = 4 - -; Music playback -; 0 - Off -; 1 - On -music = 1 - -; Enable mouse -; 0 - No -; 1 - Yes -mouse = 1 - -; Mouse sensitivity -mousesensitivity = 1.0 - -; Key Settings -; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex! -; +---------------------------------------------------------------------------------------------+ -; | 01 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46 | -; |ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL | -; | | -; |29 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E D2 C7 C9 45 B5 37 4A | -; | ` '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' - = BACK INS HOME PGUP NUMLK KP/ KP* KP- | -; | | -; | 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 2B D3 CF D1 47 48 49 4E | -; |TAB Q W E R T Y U I O P [ ] \ DEL END PGDN KP7 KP8 KP9 KP+ | -; | | -; | 3A 1E 1F 20 21 22 23 24 25 26 27 28 1C 4B 4C 4D | -; |CAPS A S D F G H J K L ; ' ENTER KP4 KP5 KP6 9C | -; | KPENTER| -; | 2A 2C 2D 2E 2F 30 31 32 33 34 35 36 C8 4F 50 51 | -; |LSHIFT Z X C V B N M , . / RSHIFT UP KP1 KP2 KP3 | -; | | -; | 1D 38 39 B8 9D CB D0 CD 52 53 | -; |LCTRL LALT SPACE RALT RCTRL LEFT DOWN RIGHT KP0 KP. | -; +---------------------------------------------------------------------------------------------+ - -keyforward = C8 -keybackward = D0 -keyturnleft = CB -keyturnright = CD -keyrun = 2A -keystrafe = 9D -keyfire = 1D -keyuse = 39 -keystandhigh = 1E -keystandlow = 2C -keylookup = D1 -keylookdown = C9 -keystrafeleft = 33 -keystraferight = 34 -key2dmode = 9C -keyviewcycle = 1C -key2dzoomin = D -key2dzoomout = C -keychat = F - diff --git a/polymer/build/game.cfg b/polymer/build/game.cfg deleted file mode 100644 index 5dc3bf6cd..000000000 --- a/polymer/build/game.cfg +++ /dev/null @@ -1,97 +0,0 @@ -; KenBuild configuration - -; Video mode selection -; 0 - Windowed -; 1 - Fullscreen -fullscreen = 0 - -; Video resolution selection -; 0 - 320 x 200 -; 1 - 360 x 200 -; 2 - 320 x 240 -; 3 - 360 x 240 -; 4 - 320 x 400 -; 5 - 360 x 400 -; 6 - 640 x 350 -; 7 - 640 x 400 -; 8 - 640 x 480 -; 9 - 800 x 600 -; 10 - 1024 x 768 -; 11 - 1280 x 1024 -; 12 - 1600 x 1200 -resolution = 8 - -; 3D-mode colour depth -bpp = 8 - -; 3D mode brightness setting -; 0 - lowest -; 15 - highest -brightness = 0 - -; Maximum OpenGL mode refresh rate (Windows only, in Hertz) -maxrefreshfreq = 60 - -; Sound sample frequency -; 0 - 6 KHz -; 1 - 8 KHz -; 2 - 11.025 KHz -; 3 - 16 KHz -; 4 - 22.05 KHz -; 5 - 32 KHz -; 6 - 44.1 KHz -samplerate = 4 - -; Music playback -; 0 - Off -; 1 - On -music = 1 - -; Enable mouse -; 0 - No -; 1 - Yes -mouse = 1 - -; Key Settings -; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex! -; +---------------------------------------------------------------------------------------------+ -; | 01 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46 | -; |ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL | -; | | -; |29 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E D2 C7 C9 45 B5 37 4A | -; | ` '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' - = BACK INS HOME PGUP NUMLK KP/ KP* KP- | -; | | -; | 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 2B D3 CF D1 47 48 49 4E | -; |TAB Q W E R T Y U I O P [ ] \ DEL END PGDN KP7 KP8 KP9 KP+ | -; | | -; | 3A 1E 1F 20 21 22 23 24 25 26 27 28 1C 4B 4C 4D | -; |CAPS A S D F G H J K L ; ' ENTER KP4 KP5 KP6 9C | -; | KPENTER| -; | 2A 2C 2D 2E 2F 30 31 32 33 34 35 36 C8 4F 50 51 | -; |LSHIFT Z X C V B N M , . / RSHIFT UP KP1 KP2 KP3 | -; | | -; | 1D 38 39 B8 9D CB D0 CD 52 53 | -; |LCTRL LALT SPACE RALT RCTRL LEFT DOWN RIGHT KP0 KP. | -; +---------------------------------------------------------------------------------------------+ - -keyforward = C8 -keybackward = D0 -keyturnleft = CB -keyturnright = CD -keyrun = 2A -keystrafe = 9D -keyfire = 1D -keyuse = 39 -keystandhigh = 1E -keystandlow = 2C -keylookup = D1 -keylookdown = C9 -keystrafeleft = 33 -keystraferight = 34 -key2dmode = 9C -keyviewcycle = 1C -key2dzoomin = D -key2dzoomout = C -keychat = F -keyconsole = 29 - diff --git a/polymer/build/include/baselayer.h b/polymer/build/include/baselayer.h index d4d47cf41..cf3893e33 100644 --- a/polymer/build/include/baselayer.h +++ b/polymer/build/include/baselayer.h @@ -14,8 +14,13 @@ extern char **_buildargv; extern char quitevent, appactive; -extern char *startwin_labeltext; - +// NOTE: these are implemented in game-land so they may be overridden in game specific ways +extern int startwin_open(void); +extern int startwin_close(void); +extern int startwin_puts(const char *); +extern int startwin_settitle(const char *); +extern int startwin_idle(void *); + // video extern long xres, yres, bpp, fullscreen, bytesperline, imageSize, frameplace; extern char offscreenrendering; @@ -96,7 +101,7 @@ unsigned long getticks(void); int gettimerfreq(void); void (*installusertimercallback(void (*callback)(void)))(void); -int checkvideomode(int *x, int *y, int c, int fs); +int checkvideomode(int *x, int *y, int c, int fs, int forced); int setvideomode(int x, int y, int c, int fs); void getvalidmodes(void); void resetvideomode(void); diff --git a/polymer/build/include/compat.h b/polymer/build/include/compat.h index 9d9e82d87..bae819d30 100644 --- a/polymer/build/include/compat.h +++ b/polymer/build/include/compat.h @@ -411,6 +411,7 @@ char *Bgetenv(const char *name); #endif char *Bgethomedir(void); +char *Bgetsupportdir(int global); unsigned int Bgetsysmemsize(void); int Bcorrectfilename(char *filename, int removefn); int Bcanonicalisefilename(char *filename, int removefn); diff --git a/polymer/build/include/editor.h b/polymer/build/include/editor.h index 130dfa3a2..6120e4e43 100644 --- a/polymer/build/include/editor.h +++ b/polymer/build/include/editor.h @@ -22,7 +22,7 @@ extern char somethingintab; extern char buildkeys[NUMBUILDKEYS]; -extern long ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d; +extern long ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d, forcesetup; extern int ExtInit(void); diff --git a/polymer/build/include/engineinfo.h b/polymer/build/include/engineinfo.h deleted file mode 100644 index 75adc1b4f..000000000 --- a/polymer/build/include/engineinfo.h +++ /dev/null @@ -1,6 +0,0 @@ -extern const char _engine_cflags[]; -extern const char _engine_libs[]; -extern const char _engine_uname[]; -extern const char _engine_compiler[]; -extern const char _engine_date[]; - diff --git a/polymer/build/include/gtkbits.h b/polymer/build/include/gtkbits.h index 08581b9c3..d073f2fda 100644 --- a/polymer/build/include/gtkbits.h +++ b/polymer/build/include/gtkbits.h @@ -5,11 +5,5 @@ extern void gtkbuild_init(int *argc, char ***argv); extern void gtkbuild_exit(int r); extern int gtkbuild_msgbox(char *name, char *msg); extern int gtkbuild_ynbox(char *name, char *msg); -extern void gtkbuild_create_startwin(void); -extern void gtkbuild_settitle_startwin(const char *title); -extern void gtkbuild_puts_startwin(const char *str); -extern void gtkbuild_close_startwin(void); -extern void gtkbuild_update_startwin(void); -extern void *gtkbuild_get_app_icon(void); #endif diff --git a/polymer/build/include/osxmain.h b/polymer/build/include/osxmain.h new file mode 100755 index 000000000..4683df57a --- /dev/null +++ b/polymer/build/include/osxmain.h @@ -0,0 +1,11 @@ +/* SDLMain.m - main entry point for our Cocoa-ized SDL app + Initial Version: Darrell Walisser + Non-NIB-Code & other changes: Max Horn + + Feel free to customize this file to suit your needs +*/ + +#import + +@interface SDLMain : NSObject +@end diff --git a/polymer/build/include/pragmas.h b/polymer/build/include/pragmas.h index df51e0f0c..9b4afa429 100644 --- a/polymer/build/include/pragmas.h +++ b/polymer/build/include/pragmas.h @@ -7,107 +7,7 @@ extern long dmval; -#if defined(NOASM) - -// -// Generic C -// - -#define qw(x) ((int64)(x)) // quadword cast -#define dw(x) ((long)(x)) // doubleword cast -#define wo(x) ((short)(x)) // word cast -#define by(x) ((char)(x)) // byte cast - -#define _scaler(a) \ -static inline long mulscale##a(long eax, long edx) \ -{ \ - return dw((qw(eax) * qw(edx)) >> a); \ -} \ -\ -static inline long divscale##a(long eax, long ebx) \ -{ \ - return dw((qw(eax) << a) / qw(ebx)); \ -} \ -\ -static inline long dmulscale##a(long eax, long edx, long esi, long edi) \ -{ \ - return dw(((qw(eax) * qw(edx)) + (qw(esi) * qw(edi))) >> a); \ -} \ -\ -static inline long tmulscale##a(long eax, long edx, long ebx, long ecx, long esi, long edi) \ -{ \ - return dw(((qw(eax) * qw(edx)) + (qw(ebx) * qw(ecx)) + (qw(esi) * qw(edi))) >> a); \ -} \ - -_scaler(1) _scaler(2) _scaler(3) _scaler(4) -_scaler(5) _scaler(6) _scaler(7) _scaler(8) -_scaler(9) _scaler(10) _scaler(11) _scaler(12) -_scaler(13) _scaler(14) _scaler(15) _scaler(16) -_scaler(17) _scaler(18) _scaler(19) _scaler(20) -_scaler(21) _scaler(22) _scaler(23) _scaler(24) -_scaler(25) _scaler(26) _scaler(27) _scaler(28) -_scaler(29) _scaler(30) _scaler(31) _scaler(32) - -static inline void swapchar(void* a, void* b) { char t = *((char*)b); *((char*)b) = *((char*)a); *((char*)a) = t; } -static inline void swapchar2(void* a, void* b, long s) { swapchar(a,b); swapchar((char*)a+1,(char*)b+s); } -static inline void swapshort(void* a, void* b) { short t = *((short*)b); *((short*)b) = *((short*)a); *((short*)a) = t; } -static inline void swaplong(void* a, void* b) { long t = *((long*)b); *((long*)b) = *((long*)a); *((long*)a) = t; } -static inline void swap64bit(void* a, void* b) { int64 t = *((int64*)b); *((int64*)b) = *((int64*)a); *((int64*)a) = t; } - -static inline char readpixel(void* s) { return (*((char*)(s))); } -static inline void drawpixel(void* s, char a) { *((char*)(s)) = a; } -static inline void drawpixels(void* s, short a) { *((short*)(s)) = a; } -static inline void drawpixelses(void* s, long a) { *((long*)(s)) = a; } - -static inline long mul3(long a) { return (a<<1)+a; } -static inline long mul5(long a) { return (a<<2)+a; } -static inline long mul9(long a) { return (a<<3)+a; } - -static inline long divmod(long a, long b) { unsigned long _a=(unsigned long)a, _b=(unsigned long)b; dmval = _a%_b; return _a/_b; } -static inline long moddiv(long a, long b) { unsigned long _a=(unsigned long)a, _b=(unsigned long)b; dmval = _a/_b; return _a%_b; } - -static inline long klabs(long a) { if (a < 0) return -a; return a; } -static inline long ksgn(long a) { if (a > 0) return 1; if (a < 0) return -1; return 0; } - -static inline long umin(long a, long b) { if ((unsigned long)a < (unsigned long)b) return a; return b; } -static inline long umax(long a, long b) { if ((unsigned long)a < (unsigned long)b) return b; return a; } -static inline long kmin(long a, long b) { if ((signed long)a < (signed long)b) return a; return b; } -static inline long kmax(long a, long b) { if ((signed long)a < (signed long)b) return b; return a; } - -static inline long sqr(long eax) { return (eax) * (eax); } -static inline long scale(long eax, long edx, long ecx) { return dw((qw(eax) * qw(edx)) / qw(ecx)); } -static inline long mulscale(long eax, long edx, long ecx) { return dw((qw(eax) * qw(edx)) >> by(ecx)); } -static inline long divscale(long eax, long ebx, long ecx) { return dw((qw(eax) << by(ecx)) / qw(ebx)); } -static inline long dmulscale(long eax, long edx, long esi, long edi, long ecx) { return dw(((qw(eax) * qw(edx)) + (qw(esi) * qw(edi))) >> by(ecx)); } - -static inline long boundmulscale(long a, long d, long c) -{ // courtesy of Ken - int64 p; - p = (((int64)a)*((int64)d))>>c; - if (p >= longlong(2147483647)) p = longlong(2147483647); - if (p < longlong(-2147483648)) p = longlong(-2147483648); - return((long)p); -} - -#undef qw -#undef dw -#undef wo -#undef by -#undef _scaler - -void qinterpolatedown16 (long bufptr, long num, long val, long add); -void qinterpolatedown16short (long bufptr, long num, long val, long add); - -void clearbuf(void* d, long c, long a); -void copybuf(void* s, void* d, long c); -void swapbuf4(void* a, void* b, long c); - -void clearbufbyte(void *D, long c, long a); -void copybufbyte(void *S, void *D, long c); -void copybufreverse(void *S, void *D, long c); - - -#elif defined(__GNUC__) && defined(__i386__) // NOASM +#if defined(__GNUC__) && defined(__i386__) && !defined(NOASM) // // GCC Inline Assembler version @@ -1164,7 +1064,7 @@ void copybufreverse(void *S, void *D, long c); //}}} -#elif defined(__WATCOMC__) // __GNUC__ && __i386__ +#elif defined(__WATCOMC__) && !defined(NOASM) // __GNUC__ && __i386__ // // Watcom C inline assembler @@ -3014,7 +2914,7 @@ long swap64bit(void*,void*); long swapchar2(void*,void*,long); //}}} -#elif defined(_MSC_VER) // __WATCOMC__ +#elif defined(_MSC_VER) && !defined(NOASM) // __WATCOMC__ // // Microsoft C inline assembler @@ -3023,31 +2923,39 @@ long swapchar2(void*,void*,long); //{{{ static __inline long sqr(long a) { - _asm mov eax, a - _asm imul eax, eax + _asm { + mov eax, a + imul eax, eax + } } static __inline long scale(long a, long d, long c) { - _asm mov eax, a - _asm imul d - _asm idiv c + _asm { + mov eax, a + imul d + idiv c + } } static __inline long mulscale(long a, long d, long c) { - _asm mov ecx, c - _asm mov eax, a - _asm imul d - _asm shrd eax, edx, cl + _asm { + mov ecx, c + mov eax, a + imul d + shrd eax, edx, cl + } } #define MULSCALE(x) \ static __inline long mulscale##x (long a, long d) \ { \ - _asm mov eax, a \ - _asm imul d \ - _asm shrd eax, edx, x \ + _asm { \ + mov eax, a \ + imul d \ + shrd eax, edx, x \ + } \ } MULSCALE(1) MULSCALE(2) MULSCALE(3) MULSCALE(4) @@ -3061,37 +2969,43 @@ MULSCALE(29) MULSCALE(30) MULSCALE(31) #undef MULSCALE static __inline long mulscale32(long a, long d) { - _asm mov eax, a - _asm imul d - _asm mov eax, edx + _asm { + mov eax, a + imul d + mov eax, edx + } } static __inline long dmulscale(long a, long d, long S, long D, long c) { - _asm mov ecx, c - _asm mov eax, a - _asm imul d - _asm mov ebx, eax - _asm mov eax, S - _asm mov esi, edx - _asm imul D - _asm add eax, ebx - _asm adc edx, esi - _asm shrd eax, edx, cl + _asm { + mov ecx, c + mov eax, a + imul d + mov ebx, eax + mov eax, S + mov esi, edx + imul D + add eax, ebx + adc edx, esi + shrd eax, edx, cl + } } #define DMULSCALE(x) \ static __inline long dmulscale##x (long a, long d, long S, long D) \ { \ - _asm mov eax, a \ - _asm imul d \ - _asm mov ebx, eax \ - _asm mov eax, S \ - _asm mov esi, edx \ - _asm imul D \ - _asm add eax, ebx \ - _asm adc edx, esi \ - _asm shrd eax, edx, x \ + _asm { \ + mov eax, a \ + imul d \ + mov ebx, eax \ + mov eax, S \ + mov esi, edx \ + imul D \ + add eax, ebx \ + adc edx, esi \ + shrd eax, edx, x \ + } \ } DMULSCALE(1) DMULSCALE(2) DMULSCALE(3) DMULSCALE(4) @@ -3105,33 +3019,38 @@ DMULSCALE(29) DMULSCALE(30) DMULSCALE(31) #undef DMULSCALE static __inline long dmulscale32(long a, long d, long S, long D) { - _asm mov eax, a - _asm imul d - _asm mov ebx, eax - _asm mov eax, S - _asm mov esi, edx - _asm imul D - _asm add eax, ebx - _asm adc edx, esi - _asm mov eax, edx + _asm { + mov eax, a + imul d + mov ebx, eax + mov eax, S + mov esi, edx + imul D + add eax, ebx + adc edx, esi + mov eax, edx + } } #define TMULSCALE(x) \ static __inline long tmulscale##x (long a, long d, long b, long c, long S, long D) \ { \ - _asm mov eax, a \ - _asm mov ebx, b \ - _asm imul d \ - _asm xchg eax, ebx \ - _asm mov ecx, c \ - _asm xchg edx, ecx \ - _asm imul edx \ - _asm add ebx, eax \ - _asm adc ecx, edx \ - _asm mov eax, S \ - _asm imul D \ - _asm add eax, ebx \ - _asm adc edx, ecx \ + _asm { \ + mov eax, a \ + mov ebx, b \ + imul d \ + xchg eax, ebx \ + mov ecx, c \ + xchg edx, ecx \ + imul edx \ + add ebx, eax \ + adc ecx, edx \ + mov eax, S \ + imul D \ + add eax, ebx \ + adc edx, ecx \ + shrd eax, edx, x \ + } \ } TMULSCALE(1) TMULSCALE(2) TMULSCALE(3) TMULSCALE(4) @@ -3145,89 +3064,102 @@ TMULSCALE(29) TMULSCALE(30) TMULSCALE(31) #undef TMULSCALE static __inline long tmulscale32(long a, long d, long b, long c, long S, long D) { - _asm mov eax, a - _asm mov ebx, b - _asm imul d - _asm xchg eax, ebx - _asm mov ecx, c - _asm xchg edx, ecx - _asm imul edx - _asm add ebx, eax - _asm adc ecx, edx - _asm mov eax, S - _asm imul D - _asm add eax, ebx - _asm adc edx, ecx - _asm mov eax, edx + _asm { + mov eax, a + mov ebx, b + imul d + xchg eax, ebx + mov ecx, c + xchg edx, ecx + imul edx + add ebx, eax + adc ecx, edx + mov eax, S + imul D + add eax, ebx + adc edx, ecx + mov eax, edx + } } static __inline long boundmulscale(long a, long b, long c) { - _asm mov eax, a - _asm mov ecx, c - _asm imul b - _asm mov ebx, edx - _asm shrd eax, edx, cl - _asm sar edx, cl - _asm xor edx, eax - _asm js checkit - _asm xor edx, eax - _asm jz skipboundit - _asm cmp edx, 0xffffffff - _asm je skipboundit + _asm { + mov eax, a + mov ecx, c + imul b + mov ebx, edx + shrd eax, edx, cl + sar edx, cl + xor edx, eax + js checkit + xor edx, eax + jz skipboundit + cmp edx, 0xffffffff + je skipboundit checkit: - _asm mov eax, ebx - _asm sar eax, 31 - _asm xor eax, 0x7fffffff + mov eax, ebx + sar eax, 31 + xor eax, 0x7fffffff skipboundit: - ; + } } static __inline long divscale(long a, long b, long c) { - _asm mov eax, a - _asm mov ecx, c - _asm mov edx, eax - _asm shl eax, cl - _asm neg cl - _asm sar edx, cl - _asm idiv b + _asm { + mov eax, a + mov ecx, c + mov edx, eax + shl eax, cl + neg cl + sar edx, cl + idiv b + } } static __inline long divscale1(long a, long b) { - _asm mov eax, a - _asm add eax, eax - _asm sbb edx, edx - _asm idiv b + _asm { + mov eax, a + add eax, eax + sbb edx, edx + idiv b + } } static __inline long divscale2(long a, long b) { - _asm mov eax, a - _asm mov edx, eax - _asm sar edx, 30 - _asm lea eax, [eax*4] - _asm idiv b + _asm { + mov eax, a + mov edx, eax + sar edx, 30 + lea eax, [eax*4] + idiv b + } } static __inline long divscale3(long a, long b) { - _asm mov eax, a - _asm mov edx, eax - _asm sar edx, 29 - _asm lea eax, [eax*8] - _asm idiv b + _asm { + mov eax, a + mov edx, eax + sar edx, 29 + lea eax, [eax*8] + idiv b + } } #define DIVSCALE(x,y) \ static __inline long divscale##y(long a, long b) \ { \ - _asm mov eax, a \ - _asm mov edx, eax \ - _asm sar edx, x \ - _asm shl eax, y \ - _asm idiv b \ + _asm { \ + mov eax, a \ + mov edx, eax \ + sar edx, x \ + shl eax, y \ + idiv b \ + } \ } DIVSCALE(28,4) DIVSCALE(27,5) DIVSCALE(26,6) DIVSCALE(25,7) @@ -3240,463 +3172,560 @@ DIVSCALE(4,28) DIVSCALE(3,29) DIVSCALE(2,30) DIVSCALE(1,31) static __inline long divscale32(long d, long b) { - _asm mov edx, d - _asm xor eax, eax - _asm idiv b + _asm { + mov edx, d + xor eax, eax + idiv b + } } static __inline char readpixel(void *d) { - _asm mov edx, d - _asm mov al, byte ptr [edx] + _asm { + mov edx, d + mov al, byte ptr [edx] + } } static __inline void drawpixel(void *d, char a) { - _asm mov edx, d - _asm mov al, a - _asm mov byte ptr [edx], al + _asm { + mov edx, d + mov al, a + mov byte ptr [edx], al + } } static __inline void drawpixels(void *d, short a) { - _asm mov edx, d - _asm mov ax, a - _asm mov word ptr [edx], ax + _asm { + mov edx, d + mov ax, a + mov word ptr [edx], ax + } } static __inline void drawpixelses(void *d, long a) { - _asm mov edx, d - _asm mov eax, a - _asm mov dword ptr [edx], eax + _asm { + mov edx, d + mov eax, a + mov dword ptr [edx], eax + } } static __inline void clearbuf(void *d, long c, long a) { - _asm mov edi, d - _asm mov ecx, c - _asm mov eax, a - _asm rep stosd + _asm { + mov edi, d + mov ecx, c + mov eax, a + rep stosd + } } static __inline void clearbufbyte(void *d, long c, long a) { - _asm mov edi, d - _asm mov ecx, c - _asm mov eax, a _asm { - cmp ecx, 4 - jae longcopy - test cl, 1 - jz preskip - stosb - } + mov edi, d + mov ecx, c + mov eax, a + cmp ecx, 4 + jae longcopy + test cl, 1 + jz preskip + stosb preskip: - _asm { - shr ecx, 1 - rep stosw - jmp endit - } + shr ecx, 1 + rep stosw + jmp endit longcopy: - _asm { - test edi, 1 - jz skip1 - stosb - dec ecx - } + test edi, 1 + jz skip1 + stosb + dec ecx skip1: - _asm { - test edi, 2 - jz skip2 - stosw - sub ecx, 2 - } + test edi, 2 + jz skip2 + stosw + sub ecx, 2 skip2: - _asm { - mov ebx, ecx - shr ecx, 2 - rep stosd - test bl, 2 - jz skip3 - stosw - } + mov ebx, ecx + shr ecx, 2 + rep stosd + test bl, 2 + jz skip3 + stosw skip3: - _asm { - test bl, 1 - jz endit - stosb - } + test bl, 1 + jz endit + stosb endit: - ; + } } static __inline void copybuf(void *s, void *d, long c) { - _asm mov esi, s - _asm mov edi, d - _asm mov ecx, c - _asm rep movsd + _asm { + mov esi, s + mov edi, d + mov ecx, c + rep movsd + } } static __inline void copybufbyte(void *s, void *d, long c) { - _asm mov esi, s - _asm mov edi, d - _asm mov ecx, c _asm { - cmp ecx, 4 - jae longcopy - test cl, 1 - jz preskip - movsb - } + mov esi, s + mov edi, d + mov ecx, c + cmp ecx, 4 + jae longcopy + test cl, 1 + jz preskip + movsb preskip: - _asm { - shr ecx, 1 - rep movsw - jmp endit - } + shr ecx, 1 + rep movsw + jmp endit longcopy: - _asm { - test edi, 1 - jz skip1 - movsb - dec ecx - } + test edi, 1 + jz skip1 + movsb + dec ecx skip1: - _asm { - test edi, 2 - jz skip2 - movsw - sub ecx, 2 - } + test edi, 2 + jz skip2 + movsw + sub ecx, 2 skip2: - _asm { - mov ebx, ecx - shr ecx, 2 - rep movsd - test bl, 2 - jz skip3 - movsw - } + mov ebx, ecx + shr ecx, 2 + rep movsd + test bl, 2 + jz skip3 + movsw skip3: - _asm { - test bl, 1 - jz endit - movsb - } + test bl, 1 + jz endit + movsb endit: - ; + } } static __inline void copybufreverse(void *s, void *d, long c) { - _asm mov esi, s - _asm mov edi, d - _asm mov ecx, c _asm { - shr ecx, 1 - jnc skipit1 - mov al, byte ptr [esi] - dec esi - mov byte ptr [edi], al - inc edi - } + mov esi, s + mov edi, d + mov ecx, c + shr ecx, 1 + jnc skipit1 + mov al, byte ptr [esi] + dec esi + mov byte ptr [edi], al + inc edi skipit1: - _asm { - shr ecx, 1 - jnc skipit2 - mov ax, word ptr [esi-1] - sub esi, 2 - ror ax, 8 - mov word ptr [edi], ax - add edi, 2 - } + shr ecx, 1 + jnc skipit2 + mov ax, word ptr [esi-1] + sub esi, 2 + ror ax, 8 + mov word ptr [edi], ax + add edi, 2 skipit2: - _asm { - test ecx, ecx - jz endloop - } + test ecx, ecx + jz endloop begloop: - _asm { - mov eax, dword ptr [esi-3] - sub esi, 4 - bswap eax - mov dword ptr [edi], eax - add edi, 4 - dec ecx - jnz begloop - } + mov eax, dword ptr [esi-3] + sub esi, 4 + bswap eax + mov dword ptr [edi], eax + add edi, 4 + dec ecx + jnz begloop endloop: - ; + } } static __inline void qinterpolatedown16(long a, long c, long d, long s) { - _asm mov eax, a - _asm mov ecx, c - _asm mov edx, d - _asm mov esi, s _asm { - mov ebx, ecx - shr ecx, 1 - jz skipbegcalc - } + mov eax, a + mov ecx, c + mov edx, d + mov esi, s + mov ebx, ecx + shr ecx, 1 + jz skipbegcalc begqcalc: - _asm { - lea edi, [edx+esi] - sar edx, 16 - mov dword ptr [eax], edx - lea edx, [edi+esi] - sar edi, 16 - mov dword ptr [eax+4], edi - add eax, 8 - dec ecx - jnz begqcalc - test ebx, 1 - jz skipbegqcalc2 - } + lea edi, [edx+esi] + sar edx, 16 + mov dword ptr [eax], edx + lea edx, [edi+esi] + sar edi, 16 + mov dword ptr [eax+4], edi + add eax, 8 + dec ecx + jnz begqcalc + test ebx, 1 + jz skipbegqcalc2 skipbegcalc: - _asm { - sar edx, 16 - mov dword ptr [eax], edx - } + sar edx, 16 + mov dword ptr [eax], edx skipbegqcalc2: - ; + } } static __inline void qinterpolatedown16short(long a, long c, long d, long s) { - _asm mov eax, a - _asm mov ecx, c - _asm mov edx, d - _asm mov esi, s _asm { - test ecx, ecx - jz endit - test al, 2 - jz skipalignit - mov ebx, edx - sar ebx, 16 - mov word ptr [eax], bx - add edx, esi - add eax, 2 - dec ecx - jz endit - } + mov eax, a + mov ecx, c + mov edx, d + mov esi, s + test ecx, ecx + jz endit + test al, 2 + jz skipalignit + mov ebx, edx + sar ebx, 16 + mov word ptr [eax], bx + add edx, esi + add eax, 2 + dec ecx + jz endit skipalignit: - _asm { - sub ecx, 2 - jc finishit - } + sub ecx, 2 + jc finishit begqcalc: - _asm { - mov ebx, edx - add edx, esi - sar ebx, 16 - mov edi, edx - and edi, 0ffff0000h - add edx, esi - add ebx, edi - mov dword ptr [eax], ebx - add eax, 4 - sub ecx, 2 - jnc begqcalc - test cl, 1 - jz endit - } + mov ebx, edx + add edx, esi + sar ebx, 16 + mov edi, edx + and edi, 0ffff0000h + add edx, esi + add ebx, edi + mov dword ptr [eax], ebx + add eax, 4 + sub ecx, 2 + jnc begqcalc + test cl, 1 + jz endit finishit: - _asm { - mov ebx, edx - sar ebx, 16 - mov word ptr [eax], bx - } + mov ebx, edx + sar ebx, 16 + mov word ptr [eax], bx endit: - ; + } } static __inline long mul3(long a) { - _asm mov eax, a - _asm lea eax, [eax+eax*2] + _asm { + mov eax, a + lea eax, [eax+eax*2] + } } static __inline long mul5(long a) { - _asm mov eax, a - _asm lea eax, [eax+eax*4] + _asm { + mov eax, a + lea eax, [eax+eax*4] + } } static __inline long mul9(long a) { - _asm mov eax, a - _asm lea eax, [eax+eax*8] + _asm { + mov eax, a + lea eax, [eax+eax*8] + } } //returns eax/ebx, dmval = eax%edx; static __inline long divmod(long a, long b) { - _asm mov eax, a - _asm xor edx, edx - _asm div b - _asm mov dmval, edx + _asm { + mov eax, a + xor edx, edx + div b + mov dmval, edx + } } //returns eax%ebx, dmval = eax/edx; static __inline long moddiv(long a, long b) { - _asm mov eax, a - _asm xor edx, edx - _asm div b - _asm mov dmval, eax - _asm mov eax, edx + _asm { + mov eax, a + xor edx, edx + div b + mov dmval, eax + mov eax, edx + } } static __inline long klabs(long a) { - _asm mov eax, a - _asm test eax, eax - _asm jns skipnegate - _asm neg eax + _asm { + mov eax, a + test eax, eax + jns skipnegate + neg eax skipnegate: - ; + } } static __inline long ksgn(long b) { - _asm mov ebx, b - _asm add ebx, ebx - _asm sbb eax, eax - _asm cmp eax, ebx - _asm adc al, 0 + _asm { + mov ebx, b + add ebx, ebx + sbb eax, eax + cmp eax, ebx + adc al, 0 + } } //eax = (unsigned min)umin(eax,ebx) static __inline long umin(long a, long b) { - _asm mov eax, a - _asm sub eax, b - _asm sbb ecx, ecx - _asm and eax, ecx - _asm add eax, b + _asm { + mov eax, a + sub eax, b + sbb ecx, ecx + and eax, ecx + add eax, b + } } //eax = (unsigned max)umax(eax,ebx) static __inline long umax(long a, long b) { - _asm mov eax, a - _asm sub eax, b - _asm sbb ecx, ecx - _asm xor ecx, 0xffffffff - _asm and eax, ecx - _asm add eax, b + _asm { + mov eax, a + sub eax, b + sbb ecx, ecx + xor ecx, 0xffffffff + and eax, ecx + add eax, b + } } static __inline long kmin(long a, long b) { - _asm mov eax, a - _asm mov ebx, b - _asm cmp eax, ebx - _asm jl skipit - _asm mov eax, ebx + _asm { + mov eax, a + mov ebx, b + cmp eax, ebx + jl skipit + mov eax, ebx skipit: - ; + } } static __inline long kmax(long a, long b) { - _asm mov eax, a - _asm mov ebx, b - _asm cmp eax, ebx - _asm jg skipit - _asm mov eax, ebx + _asm { + mov eax, a + mov ebx, b + cmp eax, ebx + jg skipit + mov eax, ebx skipit: - ; + } } static __inline void swapchar(void *a, void *b) { - _asm mov eax, a - _asm mov ebx, b - _asm mov cl, [eax] - _asm mov ch, [ebx] - _asm mov [ebx], cl - _asm mov [eax], ch + _asm { + mov eax, a + mov ebx, b + mov cl, [eax] + mov ch, [ebx] + mov [ebx], cl + mov [eax], ch + } } static __inline void swapshort(void *a, void *b) { - _asm mov eax, a - _asm mov ebx, b - _asm mov cx, [eax] - _asm mov dx, [ebx] - _asm mov [ebx], cx - _asm mov [eax], dx + _asm { + mov eax, a + mov ebx, b + mov cx, [eax] + mov dx, [ebx] + mov [ebx], cx + mov [eax], dx + } } static __inline void swaplong(void *a, void *b) { - _asm mov eax, a - _asm mov ebx, b - _asm mov ecx, [eax] - _asm mov edx, [ebx] - _asm mov [ebx], ecx - _asm mov [eax], edx + _asm { + mov eax, a + mov ebx, b + mov ecx, [eax] + mov edx, [ebx] + mov [ebx], ecx + mov [eax], edx + } } static __inline void swapbuf4(void *a, void *b, long c) { - _asm mov eax, a - _asm mov ebx, b - _asm mov ecx, c - begswap: _asm { - mov esi, [eax] - mov edi, [ebx] - mov [ebx], esi - mov [eax], edi - add eax, 4 - add ebx, 4 - dec ecx - jnz short begswap + mov eax, a + mov ebx, b + mov ecx, c + begswap: + mov esi, [eax] + mov edi, [ebx] + mov [ebx], esi + mov [eax], edi + add eax, 4 + add ebx, 4 + dec ecx + jnz short begswap } } static __inline void swap64bit(void *a, void *b) { - _asm mov eax, a - _asm mov ebx, b - _asm mov ecx, [eax] - _asm mov edx, [ebx] - _asm mov [ebx], ecx - _asm mov ecx, [eax+4] - _asm mov [eax], edx - _asm mov edx, [ebx+4] - _asm mov [ebx+4], ecx - _asm mov [eax+4], edx + _asm { + mov eax, a + mov ebx, b + mov ecx, [eax] + mov edx, [ebx] + mov [ebx], ecx + mov ecx, [eax+4] + mov [eax], edx + mov edx, [ebx+4] + mov [ebx+4], ecx + mov [eax+4], edx + } } //swapchar2(ptr1,ptr2,xsiz); is the same as: //swapchar(ptr1,ptr2); swapchar(ptr1+1,ptr2+xsiz); static __inline void swapchar2(void *a, void *b, long s) { - _asm mov eax, a - _asm mov ebx, b - _asm mov esi, s - _asm add esi, ebx - _asm mov cx, [eax] - _asm mov dl, [ebx] - _asm mov [ebx], cl - _asm mov dh, [esi] - _asm mov [esi], ch - _asm mov [eax], dx + _asm { + mov eax, a + mov ebx, b + mov esi, s + add esi, ebx + mov cx, [eax] + mov dl, [ebx] + mov [ebx], cl + mov dh, [esi] + mov [esi], ch + mov [eax], dx + } } //}}} #else // _MSC_VER -#error Unsupported compiler or architecture. +// +// Generic C +// + +#define qw(x) ((int64)(x)) // quadword cast +#define dw(x) ((long)(x)) // doubleword cast +#define wo(x) ((short)(x)) // word cast +#define by(x) ((char)(x)) // byte cast + +#define _scaler(a) \ +static inline long mulscale##a(long eax, long edx) \ +{ \ + return dw((qw(eax) * qw(edx)) >> a); \ +} \ +\ +static inline long divscale##a(long eax, long ebx) \ +{ \ + return dw((qw(eax) << a) / qw(ebx)); \ +} \ +\ +static inline long dmulscale##a(long eax, long edx, long esi, long edi) \ +{ \ + return dw(((qw(eax) * qw(edx)) + (qw(esi) * qw(edi))) >> a); \ +} \ +\ +static inline long tmulscale##a(long eax, long edx, long ebx, long ecx, long esi, long edi) \ +{ \ + return dw(((qw(eax) * qw(edx)) + (qw(ebx) * qw(ecx)) + (qw(esi) * qw(edi))) >> a); \ +} \ + +_scaler(1) _scaler(2) _scaler(3) _scaler(4) +_scaler(5) _scaler(6) _scaler(7) _scaler(8) +_scaler(9) _scaler(10) _scaler(11) _scaler(12) +_scaler(13) _scaler(14) _scaler(15) _scaler(16) +_scaler(17) _scaler(18) _scaler(19) _scaler(20) +_scaler(21) _scaler(22) _scaler(23) _scaler(24) +_scaler(25) _scaler(26) _scaler(27) _scaler(28) +_scaler(29) _scaler(30) _scaler(31) _scaler(32) + +static inline void swapchar(void* a, void* b) { char t = *((char*)b); *((char*)b) = *((char*)a); *((char*)a) = t; } +static inline void swapchar2(void* a, void* b, long s) { swapchar(a,b); swapchar((char*)a+1,(char*)b+s); } +static inline void swapshort(void* a, void* b) { short t = *((short*)b); *((short*)b) = *((short*)a); *((short*)a) = t; } +static inline void swaplong(void* a, void* b) { long t = *((long*)b); *((long*)b) = *((long*)a); *((long*)a) = t; } +static inline void swap64bit(void* a, void* b) { int64 t = *((int64*)b); *((int64*)b) = *((int64*)a); *((int64*)a) = t; } + +static inline char readpixel(void* s) { return (*((char*)(s))); } +static inline void drawpixel(void* s, char a) { *((char*)(s)) = a; } +static inline void drawpixels(void* s, short a) { *((short*)(s)) = a; } +static inline void drawpixelses(void* s, long a) { *((long*)(s)) = a; } + +static inline long mul3(long a) { return (a<<1)+a; } +static inline long mul5(long a) { return (a<<2)+a; } +static inline long mul9(long a) { return (a<<3)+a; } + +static inline long divmod(long a, long b) { unsigned long _a=(unsigned long)a, _b=(unsigned long)b; dmval = _a%_b; return _a/_b; } +static inline long moddiv(long a, long b) { unsigned long _a=(unsigned long)a, _b=(unsigned long)b; dmval = _a/_b; return _a%_b; } + +static inline long klabs(long a) { if (a < 0) return -a; return a; } +static inline long ksgn(long a) { if (a > 0) return 1; if (a < 0) return -1; return 0; } + +static inline long umin(long a, long b) { if ((unsigned long)a < (unsigned long)b) return a; return b; } +static inline long umax(long a, long b) { if ((unsigned long)a < (unsigned long)b) return b; return a; } +static inline long kmin(long a, long b) { if ((signed long)a < (signed long)b) return a; return b; } +static inline long kmax(long a, long b) { if ((signed long)a < (signed long)b) return b; return a; } + +static inline long sqr(long eax) { return (eax) * (eax); } +static inline long scale(long eax, long edx, long ecx) { return dw((qw(eax) * qw(edx)) / qw(ecx)); } +static inline long mulscale(long eax, long edx, long ecx) { return dw((qw(eax) * qw(edx)) >> by(ecx)); } +static inline long divscale(long eax, long ebx, long ecx) { return dw((qw(eax) << by(ecx)) / qw(ebx)); } +static inline long dmulscale(long eax, long edx, long esi, long edi, long ecx) { return dw(((qw(eax) * qw(edx)) + (qw(esi) * qw(edi))) >> by(ecx)); } + +static inline long boundmulscale(long a, long d, long c) +{ // courtesy of Ken + int64 p; + p = (((int64)a)*((int64)d))>>c; + if (p >= longlong(2147483647)) p = longlong(2147483647); + if (p < longlong(-2147483648)) p = longlong(-2147483648); + return((long)p); +} + +#undef qw +#undef dw +#undef wo +#undef by +#undef _scaler + +void qinterpolatedown16 (long bufptr, long num, long val, long add); +void qinterpolatedown16short (long bufptr, long num, long val, long add); + +void clearbuf(void* d, long c, long a); +void copybuf(void* s, void* d, long c); +void swapbuf4(void* a, void* b, long c); + +void clearbufbyte(void *D, long c, long a); +void copybufbyte(void *S, void *D, long c); +void copybufreverse(void *S, void *D, long c); #endif diff --git a/polymer/build/include/startwin.editor.h b/polymer/build/include/startwin.editor.h new file mode 100755 index 000000000..de855590b --- /dev/null +++ b/polymer/build/include/startwin.editor.h @@ -0,0 +1,19 @@ +// resource ids +#define WIN_STARTWIN 1000 +#define WIN_STARTWINPAGE_CONFIG 2000 +#define WIN_STARTWIN_BITMAP 100 // banner bitmap +#define WIN_STARTWIN_TABCTL 101 +#define WIN_STARTWIN_CANCEL 102 +#define WIN_STARTWIN_START 103 + +#define WIN_STARTWIN_MESSAGES 104 // output list box + +#define RSRC_ICON 100 +#define RSRC_BMP 200 + +// config page +#define IDCFULLSCREEN 100 +#define IDC2DVMODE 101 +#define IDC3DVMODE 102 +#define IDCALWAYSSHOW 103 + diff --git a/polymer/build/include/winlayer.h b/polymer/build/include/winlayer.h index 415b4f74c..a25bde625 100644 --- a/polymer/build/include/winlayer.h +++ b/polymer/build/include/winlayer.h @@ -13,37 +13,9 @@ extern int glusecds; long win_gethwnd(void); long win_gethinstance(void); -// resource ids -#define WIN_STARTWIN 1000 -#define WIN_STARTWIN_ITEMBITMAP 100 // banner bitmap -#define WIN_STARTWIN_ITEMTEXT 101 // text header -#define WIN_STARTWIN_ITEMLIST 102 // output list box -#define WIN_STARTWINBMP 200 - - // *hwnd - receives the window handle to the startup dialog box - // saferect[] - receives the safe area to draw controls over (l,t,w,h) - // onclose - called before the startup window closes - // returns 0 if successful, 1 if the window isn't open -int win_getstartupwin(long *hwnd, long saferect[4], void (*onclose)(void)); -int win_getstartupcommand(void); - void win_allowtaskswitching(int onf); int win_checkinstance(void); -/* -#ifdef KENBUILD -#define DISCLAIMER "IMPORTANT:\n" \ - "\tThis is a source port by Jonathon Fowler (jonof@edgenetwk.com) of the Build Engine, " \ - "editor and test game by Ken Silverman to the Windows and Linux operating systems. It is " \ - "distributed under the terms listed in BUILDLIC.TXT included with this package." -#endif -#ifdef DUKE3D -#define DISCLAIMER "IMPORTANT:\n" \ - "\tThis port of Duke Nukem 3D was done by Jonathon Fowler (jonof@edgenetwk.com) and is not " \ - "endorsed or supported by 3D Realms or Apogee. They will not provide support for it. Visit " \ - "http://jonof.edgenetwk.com/buildport/duke3d/ for details." -#endif -*/ #include "baselayer.h" #else diff --git a/polymer/build/src/StartupWinController.editor.m b/polymer/build/src/StartupWinController.editor.m new file mode 100755 index 000000000..9723b8cb2 --- /dev/null +++ b/polymer/build/src/StartupWinController.editor.m @@ -0,0 +1,189 @@ +#import + +#include "baselayer.h" + +@interface StartupWinController : NSWindowController +{ + IBOutlet NSButton *alwaysShowButton; + IBOutlet NSButton *fullscreenButton; + IBOutlet NSTextView *messagesView; + IBOutlet NSTabView *tabView; + IBOutlet NSComboBox *videoModeCbox; + + IBOutlet NSButton *cancelButton; + IBOutlet NSButton *startButton; +} + +- (IBAction)alwaysShowClicked:(id)sender; +- (IBAction)fullscreenClicked:(id)sender; + +- (IBAction)cancel:(id)sender; +- (IBAction)start:(id)sender; + +- (void)setupRunMode; +- (void)setupMessagesMode; +- (void)putsMessage:(NSString *)str; +- (void)setTitle:(NSString *)str; +@end + +@implementation StartupWinController + +- (IBAction)alwaysShowClicked:(id)sender +{ +} + +- (IBAction)fullscreenClicked:(id)sender +{ + // XXX: recalculate the video modes list to take into account the fullscreen status +} + +- (IBAction)cancel:(id)sender +{ + [NSApp abortModal]; +} + +- (IBAction)start:(id)sender +{ + // XXX: write the states of the form controls to their respective homes + [NSApp stopModal]; +} + +- (void)setupRunMode +{ + // XXX: populate the lists and set everything up to represent the current options + + // enable all the controls on the Configuration page + NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator]; + NSControl *control; + while (control = [enumerator nextObject]) + [control setEnabled:true]; + + [cancelButton setEnabled:true]; + [startButton setEnabled:true]; + + [tabView selectTabViewItemAtIndex:0]; +} + +- (void)setupMessagesMode +{ + [tabView selectTabViewItemAtIndex:1]; + + // disable all the controls on the Configuration page except "always show", so the + // user can enable it if they want to while waiting for something else to happen + NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator]; + NSControl *control; + while (control = [enumerator nextObject]) { + if (control == alwaysShowButton) continue; + [control setEnabled:false]; + } + + [cancelButton setEnabled:false]; + [startButton setEnabled:false]; +} + +- (void)putsMessage:(NSString *)str +{ + NSRange end; + NSTextStorage *text = [messagesView textStorage]; + BOOL shouldAutoScroll; + + shouldAutoScroll = ((int)NSMaxY([messagesView bounds]) == (int)NSMaxY([messagesView visibleRect])); + + end.location = [text length]; + end.length = 0; + + [text beginEditing]; + [messagesView replaceCharactersInRange:end withString:str]; + [text endEditing]; + + if (shouldAutoScroll) { + end.location = [text length]; + end.length = 0; + [messagesView scrollRangeToVisible:end]; + } +} + +- (void)setTitle:(NSString *)str +{ + [[self window] setTitle:str]; +} + +@end + +static StartupWinController *startwin = nil; + +int startwin_open(void) +{ + if (startwin != nil) return 1; + + startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.editor"]; + if (startwin == nil) return -1; + + [startwin showWindow:nil]; + [startwin setupMessagesMode]; + + return 0; +} + +int startwin_close(void) +{ + if (startwin == nil) return 1; + + [startwin close]; + startwin = nil; + + return 0; +} + +int startwin_puts(const char *s) +{ + NSString *ns; + + if (!s) return -1; + if (startwin == nil) return 1; + + ns = [[NSString alloc] initWithCString:s]; + [startwin putsMessage:ns]; + [ns release]; + + return 0; +} + +int startwin_settitle(const char *s) +{ + NSString *ns; + + if (!s) return -1; + if (startwin == nil) return 1; + + ns = [[NSString alloc] initWithCString:s]; + [startwin setTitle:ns]; + [ns release]; + + return 0; +} + +int startwin_idle(void *v) +{ + if (startwin) [[startwin window] displayIfNeeded]; + return 0; +} + +int startwin_run(void) +{ + int retval; + + if (startwin == nil) return 0; + + [startwin setupRunMode]; + + switch ([NSApp runModalForWindow:[startwin window]]) { + case NSRunStoppedResponse: retval = 1; break; + case NSRunAbortedResponse: retval = 0; break; + default: retval = -1; + } + + [startwin setupMessagesMode]; + + return retval; +} diff --git a/polymer/build/src/StartupWinController.game.m b/polymer/build/src/StartupWinController.game.m new file mode 100755 index 000000000..2581fbebe --- /dev/null +++ b/polymer/build/src/StartupWinController.game.m @@ -0,0 +1,189 @@ +#import + +#include "baselayer.h" + +@interface StartupWinController : NSWindowController +{ + IBOutlet NSButton *alwaysShowButton; + IBOutlet NSButton *fullscreenButton; + IBOutlet NSTextView *messagesView; + IBOutlet NSTabView *tabView; + IBOutlet NSComboBox *videoModeCbox; + + IBOutlet NSButton *cancelButton; + IBOutlet NSButton *startButton; +} + +- (IBAction)alwaysShowClicked:(id)sender; +- (IBAction)fullscreenClicked:(id)sender; + +- (IBAction)cancel:(id)sender; +- (IBAction)start:(id)sender; + +- (void)setupRunMode; +- (void)setupMessagesMode; +- (void)putsMessage:(NSString *)str; +- (void)setTitle:(NSString *)str; +@end + +@implementation StartupWinController + +- (IBAction)alwaysShowClicked:(id)sender +{ +} + +- (IBAction)fullscreenClicked:(id)sender +{ + // XXX: recalculate the video modes list to take into account the fullscreen status +} + +- (IBAction)cancel:(id)sender +{ + [NSApp abortModal]; +} + +- (IBAction)start:(id)sender +{ + // XXX: write the states of the form controls to their respective homes + [NSApp stopModal]; +} + +- (void)setupRunMode +{ + // XXX: populate the lists and set everything up to represent the current options + + // enable all the controls on the Configuration page + NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator]; + NSControl *control; + while (control = [enumerator nextObject]) + [control setEnabled:true]; + + [cancelButton setEnabled:true]; + [startButton setEnabled:true]; + + [tabView selectTabViewItemAtIndex:0]; +} + +- (void)setupMessagesMode +{ + [tabView selectTabViewItemAtIndex:1]; + + // disable all the controls on the Configuration page except "always show", so the + // user can enable it if they want to while waiting for something else to happen + NSEnumerator *enumerator = [[[[tabView tabViewItemAtIndex:0] view] subviews] objectEnumerator]; + NSControl *control; + while (control = [enumerator nextObject]) { + if (control == alwaysShowButton) continue; + [control setEnabled:false]; + } + + [cancelButton setEnabled:false]; + [startButton setEnabled:false]; +} + +- (void)putsMessage:(NSString *)str +{ + NSRange end; + NSTextStorage *text = [messagesView textStorage]; + BOOL shouldAutoScroll; + + shouldAutoScroll = ((int)NSMaxY([messagesView bounds]) == (int)NSMaxY([messagesView visibleRect])); + + end.location = [text length]; + end.length = 0; + + [text beginEditing]; + [messagesView replaceCharactersInRange:end withString:str]; + [text endEditing]; + + if (shouldAutoScroll) { + end.location = [text length]; + end.length = 0; + [messagesView scrollRangeToVisible:end]; + } +} + +- (void)setTitle:(NSString *)str +{ + [[self window] setTitle:str]; +} + +@end + +static StartupWinController *startwin = nil; + +int startwin_open(void) +{ + if (startwin != nil) return 1; + + startwin = [[StartupWinController alloc] initWithWindowNibName:@"startwin.game"]; + if (startwin == nil) return -1; + + [startwin showWindow:nil]; + [startwin setupMessagesMode]; + + return 0; +} + +int startwin_close(void) +{ + if (startwin == nil) return 1; + + [startwin close]; + startwin = nil; + + return 0; +} + +int startwin_puts(const char *s) +{ + NSString *ns; + + if (!s) return -1; + if (startwin == nil) return 1; + + ns = [[NSString alloc] initWithCString:s]; + [startwin putsMessage:ns]; + [ns release]; + + return 0; +} + +int startwin_settitle(const char *s) +{ + NSString *ns; + + if (!s) return -1; + if (startwin == nil) return 1; + + ns = [[NSString alloc] initWithCString:s]; + [startwin setTitle:ns]; + [ns release]; + + return 0; +} + +int startwin_idle(void *v) +{ + if (startwin) [[startwin window] displayIfNeeded]; + return 0; +} + +int startwin_run(void) +{ + int retval; + + if (startwin == nil) return 0; + + [startwin setupRunMode]; + + switch ([NSApp runModalForWindow:[startwin window]]) { + case NSRunStoppedResponse: retval = 1; break; + case NSRunAbortedResponse: retval = 0; break; + default: retval = -1; + } + + [startwin setupMessagesMode]; + + return retval; +} diff --git a/polymer/build/src/baselayer.c b/polymer/build/src/baselayer.c index 98482c283..9999f7479 100644 --- a/polymer/build/src/baselayer.c +++ b/polymer/build/src/baselayer.c @@ -1,7 +1,6 @@ #include "compat.h" #include "osd.h" #include "build.h" -#include "engineinfo.h" #include "baselayer.h" #ifdef RENDERTYPEWIN @@ -25,24 +24,6 @@ struct glinfo glinfo = { }; #endif -static int osdfunc_dumpbuildinfo(const osdfuncparm_t *parm) -{ - OSD_Printf( - "Build engine compilation:\n" - " CFLAGS: %s\n" - " LIBS: %s\n" - " Host: %s\n" - " Compiler: %s\n" - " Built: %s\n", - _engine_cflags, - _engine_libs, - _engine_uname, - _engine_compiler, - _engine_date); - - return OSDCMD_OK; -} - static void onvideomodechange(int newmode) { } void (*baselayer_onvideomodechange)(int) = onvideomodechange; @@ -188,7 +169,6 @@ int baselayer_init(void) , osdfunc_setrendermode); #endif - OSD_RegisterFunction("dumpbuildinfo","dumpbuildinfo: outputs engine compilation information",osdfunc_dumpbuildinfo); OSD_RegisterFunction("screencaptureformat","screencaptureformat: sets the output format for screenshots (TGA or PCX)",osdcmd_vars); #ifdef SUPERBUILD OSD_RegisterFunction("novoxmips","novoxmips: turn off/on the use of mipmaps when rendering 8-bit voxels",osdcmd_vars); diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index 06279976a..47b62f275 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -81,6 +81,7 @@ extern long startposx, startposy, startposz; extern short startang, startsectnum; extern long frameplace, ydim16, halfxdim16, midydim16; long xdim2d = 640, ydim2d = 480, xdimgame = 640, ydimgame = 480, bppgame = 8; +long forcesetup = 1; extern long cachesize, artsize; @@ -237,14 +238,12 @@ static int osdcmd_vidmode(const osdfuncparm_t *parm) return OSDCMD_OK; } -#ifdef RENDERTYPEWIN -int DoLaunchWindow(int initval); // buildstartwin.c -#endif +extern int startwin_run(void); extern char *defsfilename; // set in bstub.c int app_main(int argc, char **argv) { - char ch, quitflag, forcesetup = 0, grpstoadd = 0; + char ch, quitflag, cmdsetup = 0, grpstoadd = 0; char **grps = NULL; long i, j, k; @@ -267,7 +266,7 @@ int app_main(int argc, char **argv) boardfilename[0] = 0; for (i=1; i 0) { diff --git a/polymer/build/src/buildstartwin.c b/polymer/build/src/buildstartwin.c deleted file mode 100644 index 1971ddd42..000000000 --- a/polymer/build/src/buildstartwin.c +++ /dev/null @@ -1,178 +0,0 @@ -#ifndef RENDERTYPEWIN -#error Only for Windows -#endif - -#include "build.h" -#include "editor.h" -#include "winlayer.h" -#include "compat.h" - -#define WIN32_LEAN_AND_MEAN -#include -#include -#include - - -#define IDCFULLSCREEN 100 -#define IDC2DVMODE 101 -#define IDC3DVMODE 102 - -static void PopulateVideoModeLists(int fs, HWND list2d, HWND list3d) -{ - int i,j; - char buf[64]; - - ComboBox_ResetContent(list2d); - ComboBox_ResetContent(list3d); - for (i=0; i 0) { - if (!IsWindow(hwndLaunch) || quitevent) break; - if (IsDialogMessage(hwndStart, &msg) /*|| IsDialogMessage(hwndLaunch, &msg)*/) continue; - - TranslateMessage(&msg); - DispatchMessage(&msg); - } -#else - while (IsWindow(hwndLaunch) && !quitevent) { - x = win_getstartupcommand(); - if (x != 0) LaunchWindowProc(hwndLaunch, WM_COMMAND, x, 0); - handleevents(); - } -#endif - EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),TRUE); - } - if (quitevent) return 1; - return 0; -} - diff --git a/polymer/build/src/compat.c b/polymer/build/src/compat.c index c45d7066b..d9ef2c66e 100644 --- a/polymer/build/src/compat.c +++ b/polymer/build/src/compat.c @@ -26,6 +26,11 @@ #include #include +#ifdef __APPLE__ +# include +# include +#endif + #if defined(__WATCOMC__) # include #elif defined(_MSC_VER) @@ -327,15 +332,25 @@ char *Bgethomedir(void) #ifdef _WIN32 TCHAR appdata[MAX_PATH]; - //# if defined SHGetFolderPath - // if (SUCCEEDED(SHGetFolderPathA(NULL, CSIDL_APPDATA, NULL, 0, appdata))) - //# if defined SHGetSpecialFolderPath if (SUCCEEDED(SHGetSpecialFolderPathA(NULL, appdata, CSIDL_APPDATA, FALSE))) - //# else - //# error Cannot find SHGetFolderPath or SHGetSpecialFolderPath. Perhaps your shlobj.h is ancient? - //# endif return strdup(appdata); return NULL; +#elif defined __APPLE__ + FSRef ref; + CFStringRef str; + CFURLRef base; + char *s; + + if (FSFindFolder(kUserDomain, kVolumeRootFolderType, kDontCreateFolder, &ref) < 0) return NULL; + base = CFURLCreateFromFSRef(NULL, &ref); + if (!base) return NULL; + str = CFURLCopyFileSystemPath(base, kCFURLPOSIXPathStyle); + CFRelease(base); + if (!str) return NULL; + s = (char*)CFStringGetCStringPtr(str,CFStringGetSystemEncoding()); + if (s) s = strdup(s); + CFRelease(str); + return s; #else char *e = getenv("HOME"); if (!e) return NULL; @@ -343,6 +358,31 @@ char *Bgethomedir(void) #endif } +char *Bgetsupportdir(int global) +{ +#ifndef __APPLE__ + return Bgethomedir(); +#else + FSRef ref; + CFStringRef str; + CFURLRef base; + char *s; + + if (FSFindFolder(global ? kLocalDomain : kUserDomain, + kApplicationSupportFolderType, + kDontCreateFolder, &ref) < 0) return NULL; + base = CFURLCreateFromFSRef(NULL, &ref); + if (!base) return NULL; + str = CFURLCopyFileSystemPath(base, kCFURLPOSIXPathStyle); + CFRelease(base); + if (!str) return NULL; + s = (char*)CFStringGetCStringPtr(str,CFStringGetSystemEncoding()); + if (s) s = strdup(s); + CFRelease(str); + return s; +#endif +} + int Bcorrectfilename(char *filename, int removefn) { char *fn; diff --git a/polymer/build/src/config.c b/polymer/build/src/config.c index 02a9089f1..b8a38de19 100644 --- a/polymer/build/src/config.c +++ b/polymer/build/src/config.c @@ -106,6 +106,7 @@ int loadsetup(const char *fn) if ((fp = Bfopen(fn, "rt")) == NULL) return -1; +if (readconfig(fp, "forcesetup", val, VL) > 0) { if (Batoi(val) != 0) forcesetup = 1; else forcesetup = 0; } if (readconfig(fp, "fullscreen", val, VL) > 0) { if (Batoi(val) != 0) fullscreen = 1; else fullscreen = 0; } if (readconfig(fp, "resolution", val, VL) > 0) { i = Batoi(val) & 0x0f; @@ -195,6 +196,11 @@ int writesetup(const char *fn) if (!fp) return -1; Bfprintf(fp, + "; Always show configuration options on startup\n" + "; 0 - No\n" + "; 1 - Yes\n" + "forcesetup = %ld\n" + "\n" "; Video mode selection\n" "; 0 - Windowed\n" "; 1 - Fullscreen\n" @@ -292,7 +298,7 @@ int writesetup(const char *fn) "keyconsole = %X\n" "\n", - fullscreen, xdim2d, ydim2d, xdimgame, ydimgame, bppgame, + forcesetup, fullscreen, xdim2d, ydim2d, xdimgame, ydimgame, bppgame, #if defined(POLYMOST) && defined(USE_OPENGL) glusetexcache, glusetexcachecompression, #endif diff --git a/polymer/build/src/engine.c b/polymer/build/src/engine.c index 364e8ca3f..38a162a0f 100644 --- a/polymer/build/src/engine.c +++ b/polymer/build/src/engine.c @@ -123,77 +123,7 @@ static char kensmessage[128]; char *engineerrstr = "No error"; -#if defined(NOASM) - -static inline unsigned long nsqrtasm(unsigned long a) -{ // JBF 20030901: This was a damn lot simpler to reverse engineer than - // msqrtasm was. Really, it was just like simplifying an algebra equation. - unsigned short c; - - if (a & 0xff000000) { // test eax, 0xff000000 / jnz short over24 - c = shlookup[(a >> 24) + 4096]; // mov ebx, eax - // over24: shr ebx, 24 - // mov cx, word ptr shlookup[ebx*2+8192] - } else { - c = shlookup[a >> 12]; // mov ebx, eax - // shr ebx, 12 - // mov cx, word ptr shlookup[ebx*2] - // jmp short under24 - } - a >>= c&0xff; // under24: shr eax, cl - a = (a&0xffff0000)|(sqrtable[a]); // mov ax, word ptr sqrtable[eax*2] - a >>= ((c&0xff00) >> 8); // mov cl, ch - // shr eax, cl - return a; -} - -static inline long msqrtasm(unsigned long c) -{ - unsigned long a,b; - - a = 0x40000000l; // mov eax, 0x40000000 - b = 0x20000000l; // mov ebx, 0x20000000 - do { // begit: - if (c >= a) { // cmp ecx, eax / jl skip - c -= a; // sub ecx, eax - a += b*4; // lea eax, [eax+ebx*4] - } // skip: - a -= b; // sub eax, ebx - a >>= 1; // shr eax, 1 - b >>= 2; // shr ebx, 2 - } while (b); // jnz begit - if (c >= a) // cmp ecx, eax - a++; // sbb eax, -1 - a >>= 1; // shr eax, 1 - return a; -} - -static inline void setgotpic(long tilenume) -{ - if (walock[tilenume] < 200) walock[tilenume] = 199; - gotpic[tilenume>>3] |= pow2char[tilenume&7]; -} - -static inline long krecipasm(long i) -{ // Ken did this - float f = (float)i; i = *(long *)&f; - return((reciptable[(i>>12)&2047]>>(((i-0x3f800000)>>23)&31))^(i>>31)); -} - - -static inline long getclipmask(long a, long b, long c, long d) -{ // Ken did this - d = ((a<0)*8) + ((b<0)*4) + ((c<0)*2) + (d<0); - return(((d<<4)^0xf0)|d); -} - -inline long getkensmessagecrc(long b) -{ - return 0x56c764d4l; - b=b; -} - -#elif defined(__WATCOMC__) +#if defined(__WATCOMC__) && !defined(NOASM) // // Watcom Inline Assembly Routines @@ -297,7 +227,7 @@ long getclipmask(long,long,long,long); modify exact [eax ebx ecx edx] long getkensmessagecrc(long); -#elif defined(_MSC_VER) // __WATCOMC__ +#elif defined(_MSC_VER) && !defined(NOASM) // __WATCOMC__ // // Microsoft C Inline Assembly Routines @@ -434,7 +364,7 @@ static inline long getkensmessagecrc(void *b) } } -#elif defined(__GNUC__) && defined(__i386__) // _MSC_VER +#elif defined(__GNUC__) && defined(__i386__) && !defined(NOASM) // _MSC_VER // // GCC "Inline" Assembly Routines @@ -539,7 +469,73 @@ static inline long getkensmessagecrc(void *b) #else // __GNUC__ && __i386__ -#error Unsupported compiler or architecture. +static inline unsigned long nsqrtasm(unsigned long a) +{ // JBF 20030901: This was a damn lot simpler to reverse engineer than + // msqrtasm was. Really, it was just like simplifying an algebra equation. + unsigned short c; + + if (a & 0xff000000) { // test eax, 0xff000000 / jnz short over24 + c = shlookup[(a >> 24) + 4096]; // mov ebx, eax + // over24: shr ebx, 24 + // mov cx, word ptr shlookup[ebx*2+8192] + } else { + c = shlookup[a >> 12]; // mov ebx, eax + // shr ebx, 12 + // mov cx, word ptr shlookup[ebx*2] + // jmp short under24 + } + a >>= c&0xff; // under24: shr eax, cl + a = (a&0xffff0000)|(sqrtable[a]); // mov ax, word ptr sqrtable[eax*2] + a >>= ((c&0xff00) >> 8); // mov cl, ch + // shr eax, cl + return a; +} + +static inline long msqrtasm(unsigned long c) +{ + unsigned long a,b; + + a = 0x40000000l; // mov eax, 0x40000000 + b = 0x20000000l; // mov ebx, 0x20000000 + do { // begit: + if (c >= a) { // cmp ecx, eax / jl skip + c -= a; // sub ecx, eax + a += b*4; // lea eax, [eax+ebx*4] + } // skip: + a -= b; // sub eax, ebx + a >>= 1; // shr eax, 1 + b >>= 2; // shr ebx, 2 + } while (b); // jnz begit + if (c >= a) // cmp ecx, eax + a++; // sbb eax, -1 + a >>= 1; // shr eax, 1 + return a; +} + +static inline void setgotpic(long tilenume) +{ + if (walock[tilenume] < 200) walock[tilenume] = 199; + gotpic[tilenume>>3] |= pow2char[tilenume&7]; +} + +static inline long krecipasm(long i) +{ // Ken did this + float f = (float)i; i = *(long *)&f; + return((reciptable[(i>>12)&2047]>>(((i-0x3f800000)>>23)&31))^(i>>31)); +} + + +static inline long getclipmask(long a, long b, long c, long d) +{ // Ken did this + d = ((a<0)*8) + ((b<0)*4) + ((c<0)*2) + (d<0); + return(((d<<4)^0xf0)|d); +} + +inline long getkensmessagecrc(long b) +{ + return 0x56c764d4l; + b=b; +} #endif diff --git a/polymer/build/src/game.c b/polymer/build/src/game.c index 8651ca75c..bca758180 100644 --- a/polymer/build/src/game.c +++ b/polymer/build/src/game.c @@ -131,6 +131,7 @@ char keys[NUMKEYS] = 0x9c,0x1c,0xd,0xc,0xf }; long xdimgame = 320, ydimgame = 200, bppgame = 8, xdim2d = 640, ydim2d = 480; // JBF 20050318: config.c expects to find these +long forcesetup = 1; static long digihz[8] = {6000,8000,11025,16000,22050,32000,44100,48000}; @@ -387,15 +388,11 @@ static int osdcmd_vidmode(const osdfuncparm_t *parm) return OSDCMD_OK; } -#ifdef RENDERTYPEWIN -int DoLaunchWindow(void); // gamestartwin.c -#endif - -char *startwin_labeltext = "Starting KenBuild..."; +extern int startwin_run(void); long app_main(long argc, char *argv[]) { - long i, j, k, l, fil, waitplayers, x1, y1, x2, y2; + long cmdsetup = 0, i, j, k, l, fil, waitplayers, x1, y1, x2, y2; long other, packleng, netparm; #ifdef USE_OPENGL @@ -416,33 +413,31 @@ long app_main(long argc, char *argv[]) } if (isvalidipaddress(argv[i])) continue; } else { - Bstrcpy(boardfilename, argv[i]); - if (!Bstrrchr(boardfilename,'.')) Bstrcat(boardfilename,".map"); + if (!Bstrcasecmp(argv[i], "-setup")) cmdsetup = 1; + else { + Bstrcpy(boardfilename, argv[i]); + if (!Bstrrchr(boardfilename,'.')) Bstrcat(boardfilename,".map"); + } } } OSD_SetLogFile("console.txt"); - /* - if ((fil = open("setup.dat",O_BINARY|O_RDWR,S_IREAD)) != -1) - { - read(fil,&option[0],NUMOPTIONS); - read(fil,&keys[0],NUMKEYS); - close(fil); - } - */ - if (loadsetup("game.cfg") < 0) initprintf("Configuration file not found, using defaults.\n"); - initgroupfile("stuff.dat"); if (initengine()) { initprintf("There was a problem initialising the engine.\n"); return -1; } -#ifdef RENDERTYPEWIN - if (DoLaunchWindow()) return -1; - writesetup("game.cfg"); + if ((i = loadsetup("game.cfg")) < 0) + initprintf("Configuration file not found, using defaults.\n"); + +#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2) + if (i || forcesetup || cmdsetup) { + if (!startwin_run()) return -1; + } #endif + writesetup("game.cfg"); initinput(); if (option[3] != 0) initmouse(); @@ -3633,13 +3628,13 @@ void drawscreen(short snum, long dasmoothratio) y2 = y1 + scale(screensize,ydim-32,xdim)-1; setview(x1,y1,x2,y2); - // (ox1,oy1)ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ - // ³ (x1,y1) ³ - // ³ ÚÄÄÄÄÄ¿ ³ - // ³ ³ ³ ³ - // ³ ÀÄÄÄÄÄÙ ³ - // ³ (x2,y2) ³ - // ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ(ox2,oy2) + // (ox1,oy1)℃ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒø + // ≥ (x1,y1) ≥ + // ≥ ℃ƒƒƒƒø ≥ + // ≥ ≥ ≥ ≥ + // ≥ ¿ƒƒƒƒƒŸ ≥ + // ≥ (x2,y2) ≥ + // ¿ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒŸ(ox2,oy2) drawtilebackground(0L,0L,BACKGROUND,8,ox1,oy1,x1-1,oy2,0); drawtilebackground(0L,0L,BACKGROUND,8,x2+1,oy1,ox2,oy2,0); @@ -3801,7 +3796,7 @@ void drawscreen(short snum, long dasmoothratio) else setviewtotile(MAXTILES-2,320L>>detailmode,320L>>detailmode); if ((tiltlock&1023) == 512) - { //Block off unscreen section of 90ø tilted screen + { //Block off unscreen section of 90¯ tilted screen j = ((320-60)>>detailmode); for(i=(60>>detailmode)-1;i>=0;i--) { @@ -4907,13 +4902,7 @@ void initlava(void) lavanumframes = 0; } -#if defined(NOASM) -inline long addlava(long bx) -{ - char *b = (char *)bx; - return b[-133] + b[-132] + b[-131] + b[1] + b[-1] + b[131] + b[132]; -} -#elif defined(__WATCOMC__) +#if defined(__WATCOMC__) && !defined(NOASM) #pragma aux addlava =\ "mov al, byte ptr [ebx-133]",\ "mov dl, byte ptr [ebx-1]",\ @@ -4926,7 +4915,7 @@ inline long addlava(long bx) parm [ebx]\ modify exact [eax edx] long addlava(long); -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) && !defined(NOASM) inline long addlava(long b) { _asm { @@ -4941,7 +4930,7 @@ inline long addlava(long b) add al, dl } } -#elif defined(__GNUC__) && defined(__i386__) +#elif defined(__GNUC__) && defined(__i386__) && !defined(NOASM) inline long addlava(long b) { long r; @@ -4960,7 +4949,11 @@ inline long addlava(long b) return r; } #else -#error Unsupported compiler or architecture +inline long addlava(long bx) +{ + char *b = (char *)bx; + return b[-133] + b[-132] + b[-131] + b[1] + b[-1] + b[131] + b[132]; +} #endif void movelava(char *dapic) diff --git a/polymer/build/src/gamestartwin.c b/polymer/build/src/gamestartwin.c deleted file mode 100644 index a65b0dcb5..000000000 --- a/polymer/build/src/gamestartwin.c +++ /dev/null @@ -1,144 +0,0 @@ -#ifndef RENDERTYPEWIN -#error Only for Windows -#endif - -#include "build.h" -#include "editor.h" -#include "winlayer.h" -#include "compat.h" - -#define WIN32_LEAN_AND_MEAN -#include -#include -#include - - -#define IDCFULLSCREEN 100 -#define IDCVMODE 101 - -static void PopulateVideoModeLists(int fs, HWND list3d) -{ - int i,j; - char buf[64]; - - ComboBox_ResetContent(list3d); - for (i=0; i 0) { - if (!IsWindow(hwndLaunch) || quitevent) break; - if (IsDialogMessage(hwndStart, &msg) /*|| IsDialogMessage(hwndLaunch, &msg)*/) continue; - - TranslateMessage(&msg); - DispatchMessage(&msg); - } - EnableWindow(GetDlgItem(hwndStart,WIN_STARTWIN_ITEMLIST),TRUE); - } - if (quitevent) return 1; - return 0; -} - diff --git a/polymer/build/src/glbuild.c b/polymer/build/src/glbuild.c index fe97899fd..8e14b0866 100644 --- a/polymer/build/src/glbuild.c +++ b/polymer/build/src/glbuild.c @@ -6,8 +6,12 @@ #if defined USE_OPENGL -#ifdef RENDERTYPESDL -#include "SDL.h" + #ifdef RENDERTYPESDL +# ifdef __APPLE__ +# include +# else + #include "SDL.h" + #endif #endif void (APIENTRY * bglClearColor)( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); @@ -131,8 +135,10 @@ int loadgldriver(const char *driver) #endif if (!driver) { -#ifdef _WIN32 + #ifdef _WIN32 driver = "OPENGL32.DLL"; +#elif defined __APPLE__ + driver = "OpenGLLibrary"; #else driver = "libGL.so"; #endif diff --git a/polymer/build/src/gtkbits.c b/polymer/build/src/gtkbits.c index 83866e5fa..810dbcef2 100644 --- a/polymer/build/src/gtkbits.c +++ b/polymer/build/src/gtkbits.c @@ -13,164 +13,10 @@ #include "baselayer.h" #include "build.h" -static int gtkenabled = 0; +int gtkenabled = 0; -extern const GdkPixdata startbanner_pixdata; -static GtkWidget *startwin = NULL; static GdkPixbuf *appicon = NULL; -#define GLADE_HOOKUP_OBJECT(component,widget,name) \ - g_object_set_data_full (G_OBJECT (component), name, \ - gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) - -#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ - g_object_set_data (G_OBJECT (component), name, widget) - -#define lookup_widget(x,w) \ - (GtkWidget*) g_object_get_data(G_OBJECT(x), w) - -static gboolean on_startwin_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data) -{ - quitevent++; - return TRUE; // FALSE would let the event go through. we want the game to decide when to close -} - -void gtkbuild_create_startwin(void) -{ - GtkWidget *banner, *label, *content, *scroll; - GtkWidget *hbox1, *fixed1; - GdkPixbuf *startbanner_pixbuf; - - if (!gtkenabled) return; - - startwin = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (startwin), apptitle); - gtk_window_set_position (GTK_WINDOW (startwin), GTK_WIN_POS_CENTER); - gtk_window_set_resizable (GTK_WINDOW (startwin), FALSE); - gtk_window_set_type_hint (GTK_WINDOW (startwin), GDK_WINDOW_TYPE_HINT_DIALOG); - - hbox1 = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox1); - gtk_container_add (GTK_CONTAINER (startwin), hbox1); - - startbanner_pixbuf = gdk_pixbuf_from_pixdata(&startbanner_pixdata, FALSE, NULL); - banner = gtk_image_new_from_pixbuf(startbanner_pixbuf); - g_object_unref((gpointer)startbanner_pixbuf); - gtk_widget_show (banner); - gtk_box_pack_start (GTK_BOX (hbox1), banner, FALSE, FALSE, 0); - - fixed1 = gtk_fixed_new (); - gtk_widget_show (fixed1); - gtk_box_pack_start (GTK_BOX (hbox1), fixed1, TRUE, TRUE, 0); - gtk_widget_set_size_request (fixed1, 390, -1); - - label = gtk_label_new (startwin_labeltext); - gtk_widget_show (label); - gtk_fixed_put (GTK_FIXED (fixed1), label, 6, 6); - gtk_widget_set_size_request (label, 378, 16); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER); - - scroll = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_show (scroll); - gtk_fixed_put (GTK_FIXED (fixed1), scroll, 6, 28); - gtk_widget_set_size_request (scroll, 378, 248); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); - - content = gtk_text_view_new (); - gtk_widget_show (content); - gtk_container_add (GTK_CONTAINER(scroll), content); - //gtk_fixed_put (GTK_FIXED (fixed1), content, 6, 28); - gtk_widget_set_size_request (content, 378, 248); - gtk_text_view_set_editable (GTK_TEXT_VIEW (content), FALSE); - gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (content), GTK_WRAP_WORD); - gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (content), FALSE); - - g_signal_connect ((gpointer) startwin, "delete_event", - G_CALLBACK (on_startwin_delete_event), - NULL); - - /* Store pointers to all widgets, for use by lookup_widget(). */ - GLADE_HOOKUP_OBJECT_NO_REF (startwin, startwin, "startwin"); - GLADE_HOOKUP_OBJECT (startwin, banner, "banner"); - GLADE_HOOKUP_OBJECT (startwin, label, "label"); - GLADE_HOOKUP_OBJECT (startwin, scroll, "scroll"); - GLADE_HOOKUP_OBJECT (startwin, content, "content"); - - g_signal_connect((gpointer)startwin, "destroy", G_CALLBACK(gtk_widget_destroyed), (gpointer)&startwin); - gtk_widget_show (startwin); - gtk_main_iteration_do (FALSE); -} - -void gtkbuild_settitle_startwin(const char *title) -{ - if (!gtkenabled || !startwin) return; - gtk_window_set_title (GTK_WINDOW (startwin), title); -} - -void gtkbuild_puts_startwin(const char *str) -{ - GtkWidget *textview; - GtkTextBuffer *textbuffer; - GtkTextIter enditer; - GtkTextMark *mark; - const char *aptr, *bptr; - - if (!gtkenabled || !startwin || !str) return; - if (!(textview = lookup_widget(startwin, "content"))) return; - textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); - - gtk_text_buffer_get_end_iter(textbuffer, &enditer); - for (aptr = bptr = str; *aptr != 0; ) { - switch (*bptr) { - case '\b': - if (bptr > aptr) - gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1); -#if GTK_CHECK_VERSION(2,6,0) - gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE); -#else - { - GtkTextIter iter2 = enditer; - gtk_text_iter_backward_cursor_position(&iter2); - //FIXME: this seems be deleting one too many chars somewhere! - if (!gtk_text_iter_equal(&iter2, &enditer)) - gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE); - } -#endif - aptr = ++bptr; - break; - case 0: - if (bptr > aptr) - gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)); - aptr = bptr; - break; - case '\r': // FIXME - default: - bptr++; - break; - } - } - - mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1); - gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), mark, 0.0, FALSE, 0.0, 1.0); - gtk_text_buffer_delete_mark(textbuffer, mark); -} - -void gtkbuild_close_startwin(void) -{ - if (!gtkenabled) return; - if (startwin) { - gtk_widget_destroy (startwin); - startwin = NULL; - } -} - -void gtkbuild_update_startwin(void) -{ - if (!gtkenabled) return; - gtk_main_iteration_do (FALSE); -} - - int gtkbuild_msgbox(char *name, char *msg) { GtkWidget *dialog; @@ -213,7 +59,7 @@ int gtkbuild_ynbox(char *name, char *msg) #include "sdlayer.h" extern struct sdlappicon sdlappicon; #endif -void gtkbuild_init(int argc, char **argv) +void gtkbuild_init(int *argc, char ***argv) { gtkenabled = gtk_init_check(argc, argv); if (!gtkenabled) return; @@ -231,8 +77,3 @@ void gtkbuild_exit(int r) if (appicon) g_object_unref((gpointer)appicon); //gtk_exit(r); } - -void *gtkbuild_get_app_icon(void) -{ - return appicon; -} diff --git a/polymer/build/src/kplib.c b/polymer/build/src/kplib.c index 25a5f11ab..eaed118f5 100644 --- a/polymer/build/src/kplib.c +++ b/polymer/build/src/kplib.c @@ -1,10 +1,10 @@ /************************************************************************************************** KPLIB.C: Ken's Picture LIBrary written by Ken Silverman -Copyright (c) 1998-2005 Ken Silverman +Copyright (c) 1998-2006 Ken Silverman Ken Silverman's official web site: http://advsys.net/ken Features of KPLIB.C: - * Routines for decoding JPG, PNG, GIF, PCX, TGA, BMP, CEL. + * Routines for decoding JPG, PNG, GIF, PCX, TGA, BMP, DDS, CEL. See kpgetdim(), kprender(), and optional helper function: kpzload(). * Routines for ZIP decompression. All ZIP functions start with the letters "kz". * Multi-platform support: Dos/Windows/Linux/Mac/etc.. @@ -20,6 +20,7 @@ Brief history: 2003: Added support for BMP 05/18/2004: Added support for 8&24 bit PCX 12/09/2005: Added support for progressive JPEG +01/05/2006: Added support for DDS I offer this code to the community for free use - all I ask is that my name be included in the credits. @@ -153,8 +154,8 @@ static kzfilestate kzfs; // pow2mask 128* // dcflagor 64 -long palcol[256] ASMNAME("palcol"), paleng; -unsigned char coltype, bitdepth; +long palcol[256] ASMNAME("palcol"), paleng, bakcol, numhufblocks, zlibcompflags; +signed char coltype, filtype, bitdepth; //============================ KPNGILIB begins =============================== @@ -169,7 +170,7 @@ unsigned char coltype, bitdepth; // * Some useless ancillary chunks, like: gAMA(gamma) & pHYs(aspect ratio) //.PNG specific variables: -static long bakcol = 0xff808080, bakr = 0x80, bakg = 0x80, bakb = 0x80; //this used to be public... +static long bakr = 0x80, bakg = 0x80, bakb = 0x80; //this used to be public... static long gslidew = 0, gslider = 0, xm, xmn[4], xr0, xr1, xplc, yplc, nfplace; static long clen[320], cclen[19], bitpos, filt, xsiz, ysiz; static long xsizbpl, ixsiz, ixoff, iyoff, ixstp, iystp, intlac, nbpl, trnsrgb ASMNAME("trnsrgb"); @@ -186,25 +187,7 @@ static long gotcmov = -2, abstab10[1024] ASMNAME("abstab10"); static long qhufval0[1<>8) + ((a&0xff00)<<8) + (a<<24) + (a>>24)); -} - -static inline long bitrev (long b, long c) -{ - long i, j; - for(i=1,j=0,c=(1<>8) + ((a&0xff00)<<8) + (a<<24) + (a>>24)); +} + +static inline long bitrev (long b, long c) +{ + long i, j; + for(i=1,j=0,c=(1<xr1;p+=ixstp,x-=3) *(long *)p = (*(long *)&olinbuf[x])|LSWAPIB(0xff000000); - return; - } - for(;x>xr1;p+=ixstp,x-=3) - { - i = (*(long *)&olinbuf[x])|LSWAPIB(0xff000000); - if (i == trnsrgb) i &= LSWAPIB(0xffffff); - *(long *)p = i; - } -} - -static inline void pal8hlineasm (long x, long xr1, long p, long ixstp) -{ - for(;x>xr1;p+=ixstp,x--) *(long *)p = palcol[olinbuf[x]]; -} - -#elif defined(__WATCOMC__) +#if defined(__WATCOMC__) && !defined(NOASM) //NOTE: cmov now has correctly ordered registers (thx to bug fix in 11.0c!) long Paeth686 (long, long, long); @@ -669,7 +638,7 @@ void pal8hlineasm (long, long, long, long); modify exact [eax ecx edi]\ value -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) && !defined(NOASM) static _inline long Paeth686 (long a, long b, long c) { @@ -746,7 +715,7 @@ static _inline void pal8hlineasm (long c, long d, long t, long b) } } -#elif defined(__GNUC__) && defined(__i386__) +#elif defined(__GNUC__) && defined(__i386__) && !defined(NOASM) static inline long Paeth686 (long a, long b, long c) { @@ -791,10 +760,43 @@ static inline void pal8hlineasm (long c, long d, long t, long b) #else -#error Unsupported compiler or architecture. +static inline long Paeth686 (long a, long b, long c) +{ + return(Paeth(a,b,c)); +} + +static inline void rgbhlineasm (long x, long xr1, long p, long ixstp) +{ + long i; + if (!trnsrgb) + { + for(;x>xr1;p+=ixstp,x-=3) *(long *)p = (*(long *)&olinbuf[x])|LSWAPIB(0xff000000); + return; + } + for(;x>xr1;p+=ixstp,x-=3) + { + i = (*(long *)&olinbuf[x])|LSWAPIB(0xff000000); + if (i == trnsrgb) i &= LSWAPIB(0xffffff); + *(long *)p = i; + } +} + +static inline void pal8hlineasm (long x, long xr1, long p, long ixstp) +{ + for(;x>xr1;p+=ixstp,x--) *(long *)p = palcol[olinbuf[x]]; +} #endif +//Autodetect filter +// /f0: 0000000... +// /f1: 1111111... +// /f2: 2222222... +// /f3: 1333333... +// /f3: 3333333... +// /f4: 4444444... +// /f5: 0142321... +static long filter1st, filterest; static void putbuf (const unsigned char *buf, long leng) { long i, x, p; @@ -802,7 +804,9 @@ static void putbuf (const unsigned char *buf, long leng) if (filt < 0) { if (leng <= 0) return; - filt = buf[0]; if (filt == gotcmov) filt = 5; + filt = buf[0]; + if (filter1st < 0) filter1st = filt; else filterest |= (1<= globyoffs+ysiz)) { intlac--; initpass(); } - if (i < leng) { filt = buf[i++]; if (filt == gotcmov) filt = 5; } else filt = -1; + if (i < leng) + { + filt = buf[i++]; + if (filter1st < 0) filter1st = filt; else filterest |= (1<= slider) { putbuf(&slidebuf[(slider-16384)&32767],16384); slider += 16384; - if ((yplc >= yres) && (intlac < 2)) return(0); + if ((yplc >= yres) && (intlac < 2)) goto kpngrend_goodret; } slidebuf[(slidew++)&32767] = (char)getbits(8); } @@ -1153,7 +1163,7 @@ static long kpngrend (const char *kfilebuf, long kfilength, if (slidew >= slider) { putbuf(&slidebuf[(slider-16384)&32767],16384); slider += 16384; - if ((yplc >= yres) && (intlac < 2)) return(0); + if ((yplc >= yres) && (intlac < 2)) goto kpngrend_goodret; } k = peekbits(LOGQHUFSIZ0); @@ -1181,6 +1191,12 @@ static long kpngrend (const char *kfilebuf, long kfilength, putbuf(&slidebuf[slider&32767],(-slider)&32767); putbuf(slidebuf,slidew&32767); } + +kpngrend_goodret:; + if (!(filterest&~(1<>24)); -} - -static inline long mulshr32 (long a, long b) -{ - return((long)((((__int64)a)*((__int64)b))>>32)); -} - -#elif defined(__WATCOMC__) +#if defined(__WATCOMC__) && !defined(NOASM) long mulshr24 (long, long); #pragma aux mulshr24 =\ @@ -1233,7 +1237,7 @@ long mulshr32 (long, long); modify exact [eax edx]\ value [edx] -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) && !defined(NOASM) static _inline long mulshr24 (long a, long d) { @@ -1255,7 +1259,7 @@ static _inline long mulshr32 (long a, long d) } } -#elif defined(__GNUC__) && defined(__i386__) +#elif defined(__GNUC__) && defined(__i386__) && !defined(NOASM) #define mulshr24(a,d) \ ({ long __a=(a), __d=(d); \ @@ -1271,7 +1275,15 @@ static _inline long mulshr32 (long a, long d) #else -#error Unsupported compiler or architecture. +static inline long mulshr24 (long a, long b) +{ + return((long)((((__int64)a)*((__int64)b))>>24)); +} + +static inline long mulshr32 (long a, long b) +{ + return((long)((((__int64)a)*((__int64)b))>>32)); +} #endif @@ -2263,7 +2275,8 @@ if (ysiz < 0) { ysiz = -ysiz; } else { cptr = &cptr[(ysiz-1)*cptrinc]; cptrinc = } return(0); } - +//=============================== BMP ends ================================== +//============================== PCX begins ================================= //Note: currently only supports 8 and 24 bit PCX static long kpcxrend (const char *buf, long fleng, long daframeplace, long dabytesperline, long daxres, long dayres, @@ -2343,7 +2356,127 @@ static long kpcxrend (const char *buf, long fleng, return(0); } -//=============================== BMP ends ================================== +//=============================== PCX ends ================================== +//============================== DDS begins ================================= + +//Note:currently supports: DXT1,DXT2,DXT3,DXT4,DXT5,A8R8G8B8 +static long kddsrend (const char *buf, long leng, + long frameptr, long bpl, long xdim, long ydim, long xoff, long yoff) +{ + long x, y, z, xx, yy, xsiz, ysiz, dxt, al[2], ai, j, k, v, c0, c1, stride; + unsigned long lut[256], r[4], g[4], b[4], a[8], rr, gg, bb; + unsigned char *uptr, *wptr; + + xsiz = LSWAPIB(*(long *)&buf[16]); + ysiz = LSWAPIB(*(long *)&buf[12]); + if ((*(long *)&buf[80])&LSWAPIB(64)) //Uncompressed supports only A8R8G8B8 for now + { + if ((*(long *)&buf[88]) != LSWAPIB(32)) return(-1); + if ((*(long *)&buf[92]) != LSWAPIB(0x00ff0000)) return(-1); + if ((*(long *)&buf[96]) != LSWAPIB(0x0000ff00)) return(-1); + if ((*(long *)&buf[100]) != LSWAPIB(0x000000ff)) return(-1); + if ((*(long *)&buf[104]) != LSWAPIB(0xff000000)) return(-1); + buf += 128; + + j = yoff*bpl + (xoff<<2) + frameptr; xx = (xsiz<<2); + if (xoff < 0) { j -= (xoff<<2); buf -= (xoff<<2); xsiz += xoff; } + xsiz = (min(xsiz,xdim-xoff)<<2); ysiz = min(ysiz,ydim); + for(y=0;y= (unsigned long)ydim) continue; + memcpy((void *)j,(void *)buf,xsiz); + } + return(0); + } + if (!((*(long *)&buf[80])&LSWAPIB(4))) return(-1); //FOURCC invalid + dxt = buf[87]-'0'; + if ((buf[84] != 'D') || (buf[85] != 'X') || (buf[86] != 'T') || (dxt < 1) || (dxt > 5)) return(-1); + buf += 128; + + if (!(dxt&1)) + { + for(z=256-1;z>0;z--) lut[z] = (255<<16)/z; + lut[0] = (1<<16); + } + if (dxt == 1) stride = (xsiz<<1); else stride = (xsiz<<2); + + for(y=0;y>8)&0xf8); g[0] = ((c0>>3)&0xfc); b[0] = ((c0<<3)&0xfc); a[0] = 255; + c1 = SSWAPIB(*(unsigned short *)&uptr[2]); + r[1] = ((c1>>8)&0xf8); g[1] = ((c1>>3)&0xfc); b[1] = ((c1<<3)&0xfc); a[1] = 255; + if ((c0 > c1) || (dxt != 1)) + { + r[2] = (((r[0]*2 + r[1] + 1)*(65536/3))>>16); + g[2] = (((g[0]*2 + g[1] + 1)*(65536/3))>>16); + b[2] = (((b[0]*2 + b[1] + 1)*(65536/3))>>16); a[2] = 255; + r[3] = (((r[0] + r[1]*2 + 1)*(65536/3))>>16); + g[3] = (((g[0] + g[1]*2 + 1)*(65536/3))>>16); + b[3] = (((b[0] + b[1]*2 + 1)*(65536/3))>>16); a[3] = 255; + } + else + { + r[2] = (r[0] + r[1])>>1; + g[2] = (g[0] + g[1])>>1; + b[2] = (b[0] + b[1])>>1; a[2] = 255; + r[3] = g[3] = b[3] = a[3] = 0; //Transparent + } + v = LSWAPIB(*(long *)&uptr[4]); + if (dxt >= 4) + { + a[0] = uptr[-8]; a[1] = uptr[-7]; k = a[1]-a[0]; + if (k < 0) + { + z = a[0]*6 + a[1] + 3; + for(j=2;j<8;j++) { a[j] = ((z*(65536/7))>>16); z += k; } + } + else + { + z = a[0]*4 + a[1] + 2; + for(j=2;j<6;j++) { a[j] = ((z*(65536/5))>>16); z += k; } + a[6] = 0; a[7] = 255; + } + al[0] = LSWAPIB(*(long *)&uptr[-6]); + al[1] = LSWAPIB(*(long *)&uptr[-3]); + } + wptr = (unsigned char *)((y+yoff)*bpl + ((x+xoff)<<2) + frameptr); + ai = 0; + for(yy=0;yy<4;yy++,wptr+=bpl) + { + if ((unsigned long)(y+yy+yoff) >= (unsigned long)ydim) { ai += 4; continue; } + for(xx=0;xx<4;xx++,ai++) + { + if ((unsigned long)(x+xx+xoff) >= (unsigned long)xdim) continue; + + j = ((v>>(ai<<1))&3); + switch(dxt) + { + case 1: z = a[j]; break; + case 2: case 3: z = (( uptr[(ai>>1)-8] >> ((xx&1)<<2) )&15)*17; break; + case 4: case 5: z = a[( al[yy>>1] >> ((ai&7)*3) )&7]; break; + } + rr = r[j]; gg = g[j]; bb = b[j]; + if (!(dxt&1)) + { + bb = min((bb*lut[z])>>16,255); + gg = min((gg*lut[z])>>16,255); + rr = min((rr*lut[z])>>16,255); + } + wptr[(xx<<2)+0] = bb; + wptr[(xx<<2)+1] = gg; + wptr[(xx<<2)+2] = rr; + wptr[(xx<<2)+3] = z; + } + } + } + return(0); +} + +//=============================== DDS ends ================================== //=================== External picture interface begins ====================== void kpgetdim (const char *buf, long leng, long *xsiz, long *ysiz) @@ -2410,6 +2543,11 @@ void kpgetdim (const char *buf, long leng, long *xsiz, long *ysiz) (*xsiz) = SSWAPIB(*(short *)&buf[ 8])-SSWAPIB(*(short *)&buf[4])+1; (*ysiz) = SSWAPIB(*(short *)&buf[10])-SSWAPIB(*(short *)&buf[6])+1; } + else if ((*(long *)ubuf == LSWAPIB(0x20534444)) && (*(long *)&ubuf[4] == LSWAPIB(124))) //.DDS + { + (*xsiz) = LSWAPIB(*(long *)&buf[16]); + (*ysiz) = LSWAPIB(*(long *)&buf[12]); + } else { //Unreliable .TGA identification - this MUST be final case! if ((leng >= 20) && (!(ubuf[1]&0xfe))) @@ -2428,6 +2566,8 @@ long kprender (const char *buf, long leng, long frameptr, long bpl, { unsigned char *ubuf = (unsigned char *)buf; + paleng = 0; bakcol = 0; numhufblocks = zlibcompflags = 0; filtype = -1; + if ((ubuf[0] == 0x89) && (ubuf[1] == 0x50)) //.PNG return(kpngrend(buf,leng,frameptr,bpl,xdim,ydim,xoff,yoff)); @@ -2446,6 +2586,9 @@ long kprender (const char *buf, long leng, long frameptr, long bpl, if (*(long *)ubuf == LSWAPIB(0x0801050a)) //.PCX return(kpcxrend(buf,leng,frameptr,bpl,xdim,ydim,xoff,yoff)); + if ((*(long *)ubuf == LSWAPIB(0x20534444)) && (*(long *)&ubuf[4] == LSWAPIB(124))) //.DDS + return(kddsrend(buf,leng,frameptr,bpl,xdim,ydim,xoff,yoff)); + //Unreliable .TGA identification - this MUST be final case! if ((leng >= 20) && (!(ubuf[1]&0xfe))) if ((ubuf[2] < 12) && ((1<d_name); - if (stat(filnam,&st) < 0) continue; - if (st.st_mode & S_IFDIR) - { if (findata->d_name[0] == '.' && !findata->d_name[1]) continue; } //skip . - else if ((st.st_mode & S_IFREG) || (st.st_mode & S_IFLNK)) - { if (findata->d_name[0] == '.') continue; } //skip hidden (dot) files - else continue; //skip devices and fifos and such - if (!wildmatch(findata->d_name,&wildst[wildstpathleng])) continue; - if (st.st_mode & S_IFDIR) strcat(&filnam[i],"/"); - } + if ((findata = readdir(hfind)) == NULL) + { closedir(hfind); hfind = NULL; if (!kzhashbuf) return 0; srchstat = kzlastfnam; break; } + i = wildstpathleng; + if (findata->d_type == DT_DIR) + { if (findata->d_name[0] == '.' && !findata->d_name[1]) continue; } //skip . + else if ((findata->d_type == DT_REG) || (findata->d_type == DT_LNK)) + { if (findata->d_name[0] == '.') continue; } //skip hidden (dot) files + else continue; //skip devices and fifos and such + if (!wildmatch(findata->d_name,&wildst[wildstpathleng])) continue; + strcpy(&filnam[i],findata->d_name); + if (findata->d_type == DT_DIR) strcat(&filnam[i],"/"); #endif return(1); } diff --git a/polymer/build/src/mdsprite.c b/polymer/build/src/mdsprite.c index e12c18657..374ec4402 100644 --- a/polymer/build/src/mdsprite.c +++ b/polymer/build/src/mdsprite.c @@ -561,7 +561,7 @@ long mdloadskin_trytexcache(char *fn, long len, char effect, texcacheheader *hea return -1; } - md4once(fn, strlen(fn), mdsum); + md4once((unsigned char *)fn, strlen(fn), mdsum); for (cp = cachefn, fp = 0; (*cp = TEXCACHEDIR[fp]); cp++,fp++); *(cp++) = '/'; for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2); @@ -2233,9 +2233,9 @@ kread(fil,&i,4); if (B_LITTLE32(i) != 0x6c78764b) { kclose(fil); return(-1); } / kread(fil,&xsiz,4); xsiz = B_LITTLE32(xsiz); kread(fil,&ysiz,4); ysiz = B_LITTLE32(ysiz); kread(fil,&zsiz,4); zsiz = B_LITTLE32(zsiz); - kread(fil,&xpiv,4); xpiv = B_LITTLE32(xpiv); - kread(fil,&ypiv,4); ypiv = B_LITTLE32(ypiv); - kread(fil,&zpiv,4); zpiv = B_LITTLE32(zpiv); + kread(fil,&i,4); xpiv = (float)(B_LITTLE32(i)); + kread(fil,&i,4); ypiv = (float)(B_LITTLE32(i)); + kread(fil,&i,4); zpiv = (float)(B_LITTLE32(i)); kread(fil,&numvoxs,4); numvoxs = B_LITTLE32(numvoxs); ylen = (unsigned short *)malloc(xsiz*ysiz*sizeof(short)); diff --git a/polymer/build/src/misc/buildres.rc b/polymer/build/src/misc/buildres.rc index 0a5c4b6be..22c1ef82c 100644 --- a/polymer/build/src/misc/buildres.rc +++ b/polymer/build/src/misc/buildres.rc @@ -1,31 +1,33 @@ #include +#include +#include "startwin.editor.h" -100 ICON "rsrc/build_icon.ico" -200 BITMAP "rsrc/build.bmp" +RSRC_ICON ICON "rsrc/build_icon.ico" +RSRC_BMP BITMAP "rsrc/build.bmp" -1000 DIALOGEX DISCARDABLE 20, 40, 265, 233 +WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200 STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU CAPTION "Startup" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", 100, "STATIC", SS_BITMAP | SS_SUNKEN | WS_CHILD | WS_VISIBLE, 5, 5, 255, 255 - CONTROL "Starting Build Editor...", 101, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE, 5, 79, 255, 8 - //CONTROL "", 102, "LISTBOX", LBS_HASSTRINGS | LBS_NOSEL | LBS_USETABSTOPS | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | LBS_DISABLENOSCROLL, 5, 92, 255, 138 - CONTROL "", 102, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL, 5, 92, 255, 138 + CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 32, 32 + CONTROL "", WIN_STARTWIN_TABCTL, WC_TABCONTROL, WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 5, 250, 170 + CONTROL "&Start", WIN_STARTWIN_START, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 180, 48, 14 + CONTROL "&Cancel", WIN_STARTWIN_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 207, 180, 48, 14 + + CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32 END -2000 DIALOGEX DISCARDABLE 20, 40, 279, 168 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | DS_CONTROL +WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD CAPTION "Dialog" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "Video mode", -1, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 5, 3, 128, 64 - CONTROL "&Fullscreen", 100, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 45, 15, 49, 10 - CONTROL "&2D mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 12, 30, 37, 8 - CONTROL "", 101, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 50, 28, 75, 56 - CONTROL "&3D mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 12, 47, 37, 8 - CONTROL "", 102, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 50, 46, 75, 56 - CONTROL "&Continue", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 140, 145, 64, 17 - CONTROL "E&xit", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 208, 145, 64, 17 + CONTROL "&2D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8 + CONTROL "", IDC2DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 6, 80, 56 + CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 49, 10 + CONTROL "&3D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 24, 50, 8 + CONTROL "", IDC3DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 22, 80, 56 + CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8 END diff --git a/polymer/build/src/misc/gameres.rc b/polymer/build/src/misc/gameres.rc index 8ea227aea..1e1ebf54a 100644 --- a/polymer/build/src/misc/gameres.rc +++ b/polymer/build/src/misc/gameres.rc @@ -1,29 +1,31 @@ #include +#include +#include "startwin.game.h" -100 ICON "rsrc/game_icon.ico" -200 BITMAP "rsrc/game.bmp" +RSRC_ICON ICON "rsrc/game_icon.ico" +RSRC_BMP BITMAP "rsrc/game.bmp" -1000 DIALOGEX DISCARDABLE 20, 40, 265, 233 +WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200 STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU CAPTION "Startup" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", 100, "STATIC", SS_BITMAP | SS_SUNKEN | WS_CHILD | WS_VISIBLE, 5, 5, 255, 255 - CONTROL "Starting KenBuild...", 101, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE, 5, 79, 255, 8 - //CONTROL "", 102, "LISTBOX", LBS_HASSTRINGS | LBS_NOSEL | LBS_USETABSTOPS | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL | LBS_DISABLENOSCROLL, 5, 92, 255, 138 - CONTROL "", 102, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL, 5, 92, 255, 138 + CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 32, 32 + CONTROL "", WIN_STARTWIN_TABCTL, WC_TABCONTROL, WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 5, 250, 170 + CONTROL "&Start", WIN_STARTWIN_START, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 180, 48, 14 + CONTROL "&Cancel", WIN_STARTWIN_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 207, 180, 48, 14 + + CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32 END -2000 DIALOGEX DISCARDABLE 20, 40, 279, 168 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | DS_CONTROL +WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD CAPTION "Dialog" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "Video mode", -1, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 5, 3, 128, 46 - CONTROL "&Fullscreen", 100, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 45, 15, 49, 10 - CONTROL "&Mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 12, 30, 37, 8 - CONTROL "", 101, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 50, 28, 75, 56 - CONTROL "&Continue", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 140, 145, 64, 17 - CONTROL "E&xit", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 208, 145, 64, 17 + CONTROL "&Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8 + CONTROL "", IDC3DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 6, 80, 56 + CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 49, 10 + CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8 END diff --git a/polymer/build/src/misc/gtkstartwin/gtkstartwin.glade b/polymer/build/src/misc/gtkstartwin/gtkstartwin.glade new file mode 100755 index 000000000..ce1187f4d --- /dev/null +++ b/polymer/build/src/misc/gtkstartwin/gtkstartwin.glade @@ -0,0 +1,450 @@ + + + + + + + True + Startup + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER + False + False + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + + + + + True + False + 0 + + + + + 0 + False + False + + + + + + True + False + 0 + + + + 4 + True + True + True + True + GTK_POS_TOP + False + False + + + + True + False + 0 + + + + 6 + True + + + + 88 + 29 + True + _2D Video mode: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + vmode2dcombo + + + 0 + 0 + + + + + + 88 + 29 + True + _3D Video mode: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + vmode3dcombo + + + 0 + 32 + + + + + + 85 + 29 + True + True + _Fullscreen + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + + 248 + 0 + + + + + + 150 + 29 + True + + + + + + 96 + 0 + + + + + + 150 + 29 + True + + + + + 96 + 32 + + + + + 0 + True + True + + + + + + True + True + _Always show configuration on start + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + + 0 + False + False + + + + + False + True + + + + + + True + Configuration + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_WORD + False + 0 + 0 + 0 + 2 + 2 + 0 + + + + + + False + True + + + + + + True + Messages + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + 0 + True + True + + + + + + 3 + True + GTK_BUTTONBOX_END + 0 + + + + True + True + True + GTK_RELIEF_NORMAL + True + + + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-cancel + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Cancel + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + + True + True + True + GTK_RELIEF_NORMAL + True + + + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-execute + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Start + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + 0 + False + True + + + + + 0 + True + True + + + + + + + diff --git a/polymer/build/src/misc/gtkstartwin/gtkstartwin.gladep b/polymer/build/src/misc/gtkstartwin/gtkstartwin.gladep new file mode 100755 index 000000000..e27cd5bd5 --- /dev/null +++ b/polymer/build/src/misc/gtkstartwin/gtkstartwin.gladep @@ -0,0 +1,11 @@ + + + + + Gtkstartwin + gtkstartwin + FALSE + FALSE + FALSE + FALSE + diff --git a/polymer/build/src/misc/gtkstartwin/pixmaps/game.bmp b/polymer/build/src/misc/gtkstartwin/pixmaps/game.bmp new file mode 100755 index 0000000000000000000000000000000000000000..c079eef46a85321cdf1dbb0b5c46b7307b0c65aa GIT binary patch literal 40960 zcmZ|23EY-tnfHI4=XKxD!vlgofXX8KrYKK}h=QP?DTo^?3TU{?h>>D0Xt<#wD(;wD zI+?hXHs!cAX6u;Qq~$xN<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BuwplI0u$I+a4+QiWG-bU2{^v(58B&9QwnSka>l&&N z+kHneVLo?`OnX_R?)7spX!F{eJe16#Eja43LMLI_EbC^^b}nl;~h zvO&bqmThe){TWIdOTc1nve1zkoRl?8cNi?frXnYSp^ZmQ@Q0uPw*{=h^Yd9Q_7 zd(}rba@TuCh()5`f{ls;hBndSak3^d&b2((7M$mCZ>)at8eZgFs`=cJi!lIep>4mn z_zHaHlfsx*3uA43o)zu!9I+P(G7Q2R)_jL-r~W|5Co^@%l3WlD<%%=KFs_@#YI4u;!N8mW{!|e`Bg>l9s5<8s;{+Lw_*j zikCIi7;1fYOO!gB9dQK<8N-&h^0OM>3oCseH|UJaqhE@HRpt7HCTxLXQeCtab`!e# zspE-=OfhQ{{V#cFvo%#zR0D{^jtTS!XRi`Hq^ zg1(SbtVQnR1ncJvM741Y)&r3%3X=l0vnpZ{$$bsSQ)Q(s-VZeIfnJRaX>8;T(!XJ;}&K+iF7T%2*V!N{@`Fl^1cZu<}2!RO$Z%J3}K4 literal 0 HcmV?d00001 diff --git a/polymer/build/src/osxbits.m b/polymer/build/src/osxbits.m index 781dc4b1f..0fdab83e4 100644 --- a/polymer/build/src/osxbits.m +++ b/polymer/build/src/osxbits.m @@ -1,37 +1,52 @@ #include "osxbits.h" -#include +#import + +#ifndef MAC_OS_VERSION_10_3 +# define MAC_OS_VERSION_10_3 1030 +#endif int osx_msgbox(char *name, char *msg) { - NSAlert *alert = [[NSAlert alloc] init]; NSString *mmsg = [[NSString alloc] initWithCString: msg]; + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 + NSAlert *alert = [[NSAlert alloc] init]; [alert addButtonWithTitle: @"OK"]; - [alert setMessageText: mmsg]; + [alert setInformativeText: mmsg]; [alert setAlertStyle: NSInformationalAlertStyle]; [alert runModal]; [alert release]; + +#else + NSRunAlertPanel(nil, mmsg, @"OK", nil, nil); +#endif + [mmsg release]; - return 0; } int osx_ynbox(char *name, char *msg) { - NSAlert *alert = [[NSAlert alloc] init]; NSString *mmsg = [[NSString alloc] initWithCString: msg]; int r; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 + NSAlert *alert = [[NSAlert alloc] init]; + [alert addButtonWithTitle:@"Yes"]; [alert addButtonWithTitle:@"No"]; - [alert setMessageText: mmsg]; + [alert setInformativeText: mmsg]; [alert setAlertStyle: NSInformationalAlertStyle]; r = ([alert runModal] == NSAlertFirstButtonReturn); [alert release]; +#else + r = (NSRunAlertPanel(nil, mmsg, @"Yes", @"No", nil) == NSAlertDefaultReturn); +#endif + [mmsg release]; - return r; } diff --git a/polymer/build/src/polymost.c b/polymer/build/src/polymost.c index 1edc3830e..a9043636a 100644 --- a/polymer/build/src/polymost.c +++ b/polymer/build/src/polymost.c @@ -856,7 +856,7 @@ long trytexcache(char *fn, long len, long dameth, char effect, texcacheheader *h return -1; } - md4once(fn, strlen(fn), mdsum); + md4once((unsigned char *)fn, strlen(fn), mdsum); for (cp = cachefn, fp = 0; (*cp = TEXCACHEDIR[fp]); cp++,fp++); *(cp++) = '/'; for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2); @@ -929,7 +929,7 @@ void writexcache(char *fn, long len, long dameth, char effect, texcacheheader *h bglGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, &gi); if (gi != GL_TRUE) return; - md4once(fn, strlen(fn), mdsum); + md4once((unsigned char *)fn, strlen(fn), mdsum); for (cp = cachefn, fp = 0; (*cp = TEXCACHEDIR[fp]); cp++,fp++); *(cp++) = '/'; for (fp = 0; fp < 16; phex(mdsum[fp++], cp), cp+=2); @@ -2757,11 +2757,11 @@ static void polymost_drawalls (long bunch) if ((oy < cy0) && (oy < cy1)) domost(x1,oy,x0,oy); else if ((oy < cy0) != (oy < cy1)) { /* cy1 cy0 - // / \ - //oy---------- oy--------- - // / \ - // cy0 cy1 - */ + // / \ + //oy---------- oy--------- + // / \ + // cy0 cy1 + */ ox = (oy-cy0)*(x1-x0)/(cy1-cy0) + x0; if (oy < cy0) { domost(ox,oy,x0,oy); domost(x1,cy1,ox,oy); } else { domost(ox,oy,x0,cy0); domost(x1,oy,ox,oy); } diff --git a/polymer/build/src/pragmas.c b/polymer/build/src/pragmas.c index 5b8edbf70..963f98228 100644 --- a/polymer/build/src/pragmas.c +++ b/polymer/build/src/pragmas.c @@ -12,73 +12,7 @@ long dmval; -#if defined(NOASM) - -// -// Generic C version -// - -void qinterpolatedown16(long bufptr, long num, long val, long add) -{ // gee, I wonder who could have provided this... - long i, *lptr = (long *)bufptr; - for(i=0;i>16); val += add; } -} - -void qinterpolatedown16short(long bufptr, long num, long val, long add) -{ // ...maybe the same person who provided this too? - long i; short *sptr = (short *)bufptr; - for(i=0;i>16); val += add; } -} - -void clearbuf(void *d, long c, long a) -{ - long *p = (long*)d; - while ((c--) > 0) *(p++) = a; -} - -void copybuf(void *s, void *d, long c) -{ - long *p = (long*)s, *q = (long*)d; - while ((c--) > 0) *(q++) = *(p++); -} - -void swapbuf4(void *a, void *b, long c) -{ - long *p = (long*)a, *q = (long*)b; - long x, y; - while ((c--) > 0) { - x = *q; - y = *p; - *(q++) = y; - *(p++) = x; - } -} - -void clearbufbyte(void *D, long c, long a) -{ // Cringe City - char *p = (char*)D; - long m[4] = { 0xffl,0xff00l,0xff0000l,0xff000000l }; - long n[4] = { 0,8,16,24 }; - long z=0; - while ((c--) > 0) { - *(p++) = (char)((a & m[z])>>n[z]); - z=(z+1)&3; - } -} - -void copybufbyte(void *S, void *D, long c) -{ - char *p = (char*)S, *q = (char*)D; - while((c--) > 0) *(q++) = *(p++); -} - -void copybufreverse(void *S, void *D, long c) -{ - char *p = (char*)S, *q = (char*)D; - while((c--) > 0) *(q++) = *(p--); -} - -#elif defined(__GNUC__) && defined(__i386__) // NOASM +#if defined(__GNUC__) && defined(__i386__) && !defined(NOASM) // NOASM // // GCC Inline Assembler version @@ -229,13 +163,13 @@ void copybufreverse(void *S, void *D, long c) ); } -#elif defined(__WATCOMC__) // __GNUC__ && __i386__ +#elif defined(__WATCOMC__) && !defined(NOASM) // __GNUC__ && __i386__ // // Watcom C Inline Assembler version // -#elif defined(_MSC_VER) // __WATCOMC__ +#elif defined(_MSC_VER) && !defined(NOASM) // __WATCOMC__ // // Microsoft C Inline Assembler version @@ -243,7 +177,69 @@ void copybufreverse(void *S, void *D, long c) #else // _MSC_VER -#error Unsupported compiler or architecture. +// +// Generic C version +// + +void qinterpolatedown16(long bufptr, long num, long val, long add) +{ // gee, I wonder who could have provided this... + long i, *lptr = (long *)bufptr; + for(i=0;i>16); val += add; } +} + +void qinterpolatedown16short(long bufptr, long num, long val, long add) +{ // ...maybe the same person who provided this too? + long i; short *sptr = (short *)bufptr; + for(i=0;i>16); val += add; } +} + +void clearbuf(void *d, long c, long a) +{ + long *p = (long*)d; + while ((c--) > 0) *(p++) = a; +} + +void copybuf(void *s, void *d, long c) +{ + long *p = (long*)s, *q = (long*)d; + while ((c--) > 0) *(q++) = *(p++); +} + +void swapbuf4(void *a, void *b, long c) +{ + long *p = (long*)a, *q = (long*)b; + long x, y; + while ((c--) > 0) { + x = *q; + y = *p; + *(q++) = y; + *(p++) = x; + } +} + +void clearbufbyte(void *D, long c, long a) +{ // Cringe City + char *p = (char*)D; + long m[4] = { 0xffl,0xff00l,0xff0000l,0xff000000l }; + long n[4] = { 0,8,16,24 }; + long z=0; + while ((c--) > 0) { + *(p++) = (char)((a & m[z])>>n[z]); + z=(z+1)&3; + } +} + +void copybufbyte(void *S, void *D, long c) +{ + char *p = (char*)S, *q = (char*)D; + while((c--) > 0) *(q++) = *(p++); +} + +void copybufreverse(void *S, void *D, long c) +{ + char *p = (char*)S, *q = (char*)D; + while((c--) > 0) *(q++) = *(p--); +} #endif diff --git a/polymer/build/src/sdlayer.c b/polymer/build/src/sdlayer.c index 70bfcad4e..988953893 100644 --- a/polymer/build/src/sdlayer.c +++ b/polymer/build/src/sdlayer.c @@ -26,6 +26,12 @@ # include "osxbits.h" #elif defined HAVE_GTK2 # include "gtkbits.h" +#else +int startwin_open(void) { return 0; } +int startwin_close(void) { return 0; } +int startwin_puts(const char *s) { s=s; return 0; } +int startwin_idle(void *s) { return 0; } +int startwin_settitle(const char *s) { s=s; return 0; } #endif #define SURFACE_FLAGS (SDL_SWSURFACE|SDL_HWPALETTE|SDL_HWACCEL) @@ -130,9 +136,7 @@ void wm_setapptitle(char *name) SDL_WM_SetCaption(apptitle, NULL); -#ifdef HAVE_GTK2 - gtkbuild_settitle_startwin(apptitle); -#endif + startwin_settitle(apptitle); } @@ -154,8 +158,8 @@ int main(int argc, char *argv[]) #ifdef HAVE_GTK2 gtkbuild_init(&argc, &argv); - gtkbuild_create_startwin(); #endif + startwin_open(); _buildargc = argc; _buildargv = (char**)argv; @@ -165,8 +169,8 @@ int main(int argc, char *argv[]) baselayer_init(); r = app_main(argc, argv); + startwin_close(); #ifdef HAVE_GTK2 - gtkbuild_close_startwin(); gtkbuild_exit(r); #endif return r; @@ -280,10 +284,8 @@ void initprintf(const char *f, ...) va_end(va); OSD_Printf(buf); -#ifdef HAVE_GTK2 - gtkbuild_puts_startwin(buf); - gtkbuild_update_startwin(); -#endif + startwin_puts(buf); + startwin_idle(NULL); } @@ -689,6 +691,9 @@ void getvalidmodes(void) // do fullscreen modes first for (j=0; cdepths[j]; j++) { +#ifdef USE_OPENGL + if (nogl && cdepths[j] > 8) continue; +#endif pf.BitsPerPixel = cdepths[j]; pf.BytesPerPixel = cdepths[j] >> 3; @@ -722,6 +727,9 @@ void getvalidmodes(void) // add windowed modes next for (j=0; cdepths[j]; j++) { +#ifdef USE_OPENGL + if (nogl && cdepths[j] > 8) continue; +#endif if (cdepths[j] < 0) continue; for (i=0; defaultres[i][0]; i++) CHECK(defaultres[i][0],defaultres[i][1]) @@ -740,7 +748,7 @@ void getvalidmodes(void) // // checkvideomode() -- makes sure the video mode passed is legal // -int checkvideomode(int *x, int *y, int c, int fs) +int checkvideomode(int *x, int *y, int c, int fs, int forced) { int i, nearest=-1, dx, dy, odx=9999, ody=9999; @@ -775,10 +783,10 @@ int checkvideomode(int *x, int *y, int c, int fs) } } -#ifdef ANY_WINDOWED_SIZE - if ((fs&1) == 0 && (nearest < 0 || (validmode[nearest].xdim!=*x || validmode[nearest].ydim!=*y))) + #ifdef ANY_WINDOWED_SIZE + if (!forced && (fs&1) == 0 && (nearest < 0 || (validmode[nearest].xdim!=*x || validmode[nearest].ydim!=*y))) return 0x7fffffffl; -#endif + #endif if (nearest < 0) { // no mode that will match (eg. if no fullscreen modes) @@ -806,11 +814,9 @@ int setvideomode(int x, int y, int c, int fs) return 0; } - if (checkvideomode(&x,&y,c,fs) < 0) return -1; + if (checkvideomode(&x,&y,c,fs,0) < 0) return -1; -#ifdef HAVE_GTK2 - gtkbuild_close_startwin(); -#endif + startwin_close(); if (mouseacquired) { regrab = 1; @@ -1365,9 +1371,7 @@ int handleevents(void) sampletimer(); -#ifdef HAVE_GTK2 - gtkbuild_update_startwin(); -#endif + startwin_idle(NULL); #undef SetKey diff --git a/polymer/build/src/startgtk.editor.c b/polymer/build/src/startgtk.editor.c new file mode 100755 index 000000000..2cddd44a8 --- /dev/null +++ b/polymer/build/src/startgtk.editor.c @@ -0,0 +1,607 @@ +/* NOTE: Glade will generate code for a dialogue box which you should + * then patch into this file whenever you make a change to the Glade + * template. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "baselayer.h" +#include "compat.h" +#include "build.h" +#include "editor.h" + +#define TAB_CONFIG 0 +#define TAB_MESSAGES 1 + +static struct { + int fullscreen; + int xdim2d, ydim2d; + int xdim3d, ydim3d, bpp3d; + int forcesetup; +} settings; + +extern int gtkenabled; + +static GtkWidget *startwin = NULL; +static int retval = -1, mode = 0; + +// -- SUPPORT FUNCTIONS ------------------------------------------------------- + +#define GLADE_HOOKUP_OBJECT(component,widget,name) \ + g_object_set_data_full (G_OBJECT (component), name, \ + gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) + +#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ + g_object_set_data (G_OBJECT (component), name, widget) + +#define lookup_widget(x,w) \ + (GtkWidget*) g_object_get_data(G_OBJECT(x), w) + +static GdkPixbuf *load_banner(void) +{ + extern const GdkPixdata startbanner_pixdata; + return gdk_pixbuf_from_pixdata(&startbanner_pixdata, FALSE, NULL); +} + +static void SetPage(int n) +{ + if (!gtkenabled || !startwin) return; + gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), n); +} + +static void EnableConfig(int n) +{ + // each control in the config page vertical layout plus the dialogue buttons should be made (in)sensitive + mode = n; + gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"buttons")), + (GtkCallback)gtk_widget_set_sensitive, (gpointer)mode); + gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"configvlayout")), + (GtkCallback)gtk_widget_set_sensitive, (gpointer)mode); +} + +static void on_vmode2dcombo_changed(GtkComboBox *, gpointer); +static void on_vmode3dcombo_changed(GtkComboBox *, gpointer); +static void PopulateForm(void) +{ + int mode2d, mode3d, i; + GtkListStore *modes2d, *modes3d; + GtkTreeIter iter; + GtkComboBox *box2d, *box3d; + char buf[64]; + + mode2d = checkvideomode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1); + mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); + if (mode2d < 0) mode2d = 0; + if (mode3d < 0) { + int i, cd[] = { 32, 24, 16, 15, 8, 0 }; + for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp3d) i++; else break; } + for ( ; cd[i]; i++) { + mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); + if (mode3d < 0) continue; + settings.bpp3d = cd[i]; + break; + } + } + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"fullscreencheck")), settings.fullscreen); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"alwaysshowcheck")), settings.forcesetup); + + box2d = GTK_COMBO_BOX(lookup_widget(startwin,"vmode2dcombo")); + box3d = GTK_COMBO_BOX(lookup_widget(startwin,"vmode3dcombo")); + modes2d = GTK_LIST_STORE(gtk_combo_box_get_model(box2d)); + modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(box3d)); + gtk_list_store_clear(modes2d); + gtk_list_store_clear(modes3d); + + for (i=0; i aptr) + gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1); +#if GTK_CHECK_VERSION(2,6,0) + gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE); +#else + { + GtkTextIter iter2 = enditer; + gtk_text_iter_backward_cursor_position(&iter2); + //FIXME: this seems be deleting one too many chars somewhere! + if (!gtk_text_iter_equal(&iter2, &enditer)) + gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE); + } +#endif + aptr = ++bptr; + break; + case 0: + if (bptr > aptr) + gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)); + aptr = bptr; + break; + case '\r': // FIXME + default: + bptr++; + break; + } + } + + mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1); + gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), mark, 0.0, FALSE, 0.0, 1.0); + gtk_text_buffer_delete_mark(textbuffer, mark); + + return 0; +} + +int startwin_settitle(const char *title) +{ + if (!gtkenabled) return 0; + if (!startwin) return 1; + gtk_window_set_title (GTK_WINDOW (startwin), title); + return 0; +} + +int startwin_idle(void *s) +{ + if (!gtkenabled) return 0; + //if (!startwin) return 1; + gtk_main_iteration_do (FALSE); + return 0; +} + +int startwin_run(void) +{ + if (!gtkenabled) return 0; + if (!startwin) return 1; + + SetPage(TAB_CONFIG); + EnableConfig(TRUE); + + settings.fullscreen = fullscreen; + settings.xdim2d = xdim2d; + settings.ydim2d = ydim2d; + settings.xdim3d = xdimgame; + settings.ydim3d = ydimgame; + settings.bpp3d = bppgame; + settings.forcesetup = forcesetup; + PopulateForm(); + + gtk_main(); + + SetPage(TAB_MESSAGES); + EnableConfig(FALSE); + if (retval) { + fullscreen = settings.fullscreen; + xdim2d = settings.xdim2d; + ydim2d = settings.ydim2d; + xdimgame = settings.xdim3d; + ydimgame = settings.ydim3d; + bppgame = settings.bpp3d; + forcesetup = settings.forcesetup; + } + + return retval; +} + diff --git a/polymer/build/src/startgtk.game.c b/polymer/build/src/startgtk.game.c new file mode 100755 index 000000000..4a4e1d222 --- /dev/null +++ b/polymer/build/src/startgtk.game.c @@ -0,0 +1,540 @@ +/* NOTE: Glade will generate code for a dialogue box which you should + * then patch into this file whenever you make a change to the Glade + * template. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "baselayer.h" +#include "compat.h" +#include "build.h" + +#define TAB_CONFIG 0 +#define TAB_MESSAGES 1 + +static struct { + int fullscreen; + int xdim3d, ydim3d, bpp3d; + int forcesetup; +} settings; + +extern int gtkenabled; + +static GtkWidget *startwin = NULL; +static int retval = -1, mode = 0; + +// -- SUPPORT FUNCTIONS ------------------------------------------------------- + +#define GLADE_HOOKUP_OBJECT(component,widget,name) \ + g_object_set_data_full (G_OBJECT (component), name, \ + gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) + +#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ + g_object_set_data (G_OBJECT (component), name, widget) + +#define lookup_widget(x,w) \ + (GtkWidget*) g_object_get_data(G_OBJECT(x), w) + +static GdkPixbuf *load_banner(void) +{ + extern const GdkPixdata startbanner_pixdata; + return gdk_pixbuf_from_pixdata(&startbanner_pixdata, FALSE, NULL); +} + +static void SetPage(int n) +{ + if (!gtkenabled || !startwin) return; + gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), n); +} + +static void EnableConfig(int n) +{ + // each control in the config page vertical layout plus the dialogue buttons should be made (in)sensitive + mode = n; + gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"buttons")), + (GtkCallback)gtk_widget_set_sensitive, (gpointer)mode); + gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"configvlayout")), + (GtkCallback)gtk_widget_set_sensitive, (gpointer)mode); +} + +static void on_vmode3dcombo_changed(GtkComboBox *, gpointer); +static void PopulateForm(void) +{ + int mode3d, i; + GtkListStore *modes3d; + GtkTreeIter iter; + GtkComboBox *box3d; + char buf[64]; + + mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); + if (mode3d < 0) { + int i, cd[] = { 32, 24, 16, 15, 8, 0 }; + for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp3d) i++; else break; } + for ( ; cd[i]; i++) { + mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); + if (mode3d < 0) continue; + settings.bpp3d = cd[i]; + break; + } + } + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"fullscreencheck")), settings.fullscreen); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"alwaysshowcheck")), settings.forcesetup); + + box3d = GTK_COMBO_BOX(lookup_widget(startwin,"vmode3dcombo")); + modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(box3d)); + gtk_list_store_clear(modes3d); + + for (i=0; i aptr) + gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1); +#if GTK_CHECK_VERSION(2,6,0) + gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE); +#else + { + GtkTextIter iter2 = enditer; + gtk_text_iter_backward_cursor_position(&iter2); + //FIXME: this seems be deleting one too many chars somewhere! + if (!gtk_text_iter_equal(&iter2, &enditer)) + gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE); + } +#endif + aptr = ++bptr; + break; + case 0: + if (bptr > aptr) + gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)); + aptr = bptr; + break; + case '\r': // FIXME + default: + bptr++; + break; + } + } + + mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1); + gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), mark, 0.0, FALSE, 0.0, 1.0); + gtk_text_buffer_delete_mark(textbuffer, mark); + + return 0; +} + +int startwin_settitle(const char *title) +{ + if (!gtkenabled) return 0; + if (!startwin) return 1; + gtk_window_set_title (GTK_WINDOW (startwin), title); + return 0; +} + +int startwin_idle(void *s) +{ + if (!gtkenabled) return 0; + //if (!startwin) return 1; + gtk_main_iteration_do (FALSE); + return 0; +} + +extern int xdimgame, ydimgame, bppgame, forcesetup; + +int startwin_run(void) +{ + if (!gtkenabled) return 0; + if (!startwin) return 1; + + SetPage(TAB_CONFIG); + EnableConfig(TRUE); + + settings.fullscreen = fullscreen; + settings.xdim3d = xdimgame; + settings.ydim3d = ydimgame; + settings.bpp3d = bppgame; + settings.forcesetup = forcesetup; + PopulateForm(); + + gtk_main(); + + SetPage(TAB_MESSAGES); + EnableConfig(FALSE); + if (retval) { + fullscreen = settings.fullscreen; + xdimgame = settings.xdim3d; + ydimgame = settings.ydim3d; + bppgame = settings.bpp3d; + forcesetup = settings.forcesetup; + } + + return retval; +} + diff --git a/polymer/build/src/startwin.editor.c b/polymer/build/src/startwin.editor.c new file mode 100755 index 000000000..657b94cb7 --- /dev/null +++ b/polymer/build/src/startwin.editor.c @@ -0,0 +1,442 @@ +#ifndef RENDERTYPEWIN +#error Only for Windows +#endif + +#include "build.h" +#include "editor.h" +#include "winlayer.h" +#include "compat.h" + +#define WIN32_LEAN_AND_MEAN +#include +#include +#define _WIN32_IE 0x0300 +#include +#include + +#include "startwin.editor.h" + +#define TAB_CONFIG 0 +#define TAB_MESSAGES 1 + +static struct { + int fullscreen; + int xdim2d, ydim2d; + int xdim3d, ydim3d, bpp3d; + int forcesetup; +} settings; + +static HWND startupdlg = NULL; +static HWND pages[2] = { NULL, NULL}; +static int done = -1; + +static void PopulateForm(void) +{ + int i,j; + char buf[64]; + int mode2d, mode3d; + HWND hwnd2d, hwnd3d; + + hwnd2d = GetDlgItem(pages[TAB_CONFIG], IDC2DVMODE); + hwnd3d = GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE); + + mode2d = checkvideomode(&settings.xdim2d, &settings.ydim2d, 8, settings.fullscreen, 1); + mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); + if (mode2d < 0) mode2d = 0; + if (mode3d < 0) { + int cd[] = { 32, 24, 16, 15, 8, 0 }; + for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp3d) i++; else break; } + for ( ; cd[i]; i++) { + mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); + if (mode3d < 0) continue; + settings.bpp3d = cd[i]; + break; + } + } + + Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), (settings.fullscreen ? BST_CHECKED : BST_UNCHECKED)); + Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED)); + + ComboBox_ResetContent(hwnd2d); + ComboBox_ResetContent(hwnd3d); + for (i=0; iidFrom != WIN_STARTWIN_TABCTL) break; + cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0); + switch (nmhdr->code) { + case TCN_SELCHANGING: { + if (cur < 0 || !pages[cur]) break; + ShowWindow(pages[cur],SW_HIDE); + return TRUE; + } + case TCN_SELCHANGE: { + if (cur < 0 || !pages[cur]) break; + ShowWindow(pages[cur],SW_SHOW); + return TRUE; + } + } + break; + } + + case WM_CLOSE: + done = 0; + return TRUE; + + case WM_DESTROY: + if (hbmp) { + DeleteObject(hbmp); + hbmp = NULL; + } + + if (pages[TAB_CONFIG]) { + DestroyWindow(pages[TAB_CONFIG]); + pages[TAB_CONFIG] = NULL; + } + + startupdlg = NULL; + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case WIN_STARTWIN_CANCEL: done = 0; return TRUE; + case WIN_STARTWIN_START: done = 1; return TRUE; + } + return FALSE; + + case WM_CTLCOLORSTATIC: + if ((HWND)lParam == pages[TAB_MESSAGES]) + return (BOOL)GetSysColorBrush(COLOR_WINDOW); + break; + + default: break; + } + + return FALSE; +} + + +int startwin_open(void) +{ + INITCOMMONCONTROLSEX icc; + if (startupdlg) return 1; + icc.dwSize = sizeof(icc); + icc.dwICC = ICC_TAB_CLASSES; + InitCommonControlsEx(&icc); + startupdlg = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWIN), NULL, startup_dlgproc); + if (startupdlg) { + SetPage(TAB_MESSAGES); + EnableConfig(0); + return 0; + } + return -1; +} + +int startwin_close(void) +{ + if (!startupdlg) return 1; + DestroyWindow(startupdlg); + startupdlg = NULL; + return 0; +} + +int startwin_puts(const char *buf) +{ + const char *p = NULL, *q = NULL; + char workbuf[1024]; + static int newline = 0; + int curlen, linesbefore, linesafter; + HWND edctl; + int vis; + + if (!startupdlg) return 1; + + edctl = pages[TAB_MESSAGES]; + if (!edctl) return -1; + + vis = ((int)SendMessage(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL), TCM_GETCURSEL,0,0) == TAB_MESSAGES); + + if (vis) SendMessage(edctl, WM_SETREDRAW, FALSE,0); + curlen = SendMessage(edctl, WM_GETTEXTLENGTH, 0,0); + SendMessage(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen); + linesbefore = SendMessage(edctl, EM_GETLINECOUNT, 0,0); + p = buf; + while (*p) { + if (newline) { + SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n"); + newline = 0; + } + q = p; + while (*q && *q != '\n') q++; + memcpy(workbuf, p, q-p); + if (*q == '\n') { + if (!q[1]) { + newline = 1; + workbuf[q-p] = 0; + } else { + workbuf[q-p] = '\r'; + workbuf[q-p+1] = '\n'; + workbuf[q-p+2] = 0; + } + p = q+1; + } else { + workbuf[q-p] = 0; + p = q; + } + SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)workbuf); + } + linesafter = SendMessage(edctl, EM_GETLINECOUNT, 0,0); + SendMessage(edctl, EM_LINESCROLL, 0, linesafter-linesbefore); + if (vis) SendMessage(edctl, WM_SETREDRAW, TRUE,0); + return 0; +} + +int startwin_settitle(const char *str) +{ + if (!startupdlg) return 1; + SetWindowText(startupdlg, str); + return 0; +} + +int startwin_idle(void *v) +{ + if (!startupdlg || !IsWindow(startupdlg)) return 0; + if (IsDialogMessage(startupdlg, (MSG*)v)) return 1; + return 0; +} + +int startwin_run(void) +{ + MSG msg; + if (!startupdlg) return 1; + + done = -1; + + SetPage(TAB_CONFIG); + EnableConfig(1); + + settings.fullscreen = fullscreen; + settings.xdim2d = xdim2d; + settings.ydim2d = ydim2d; + settings.xdim3d = xdimgame; + settings.ydim3d = ydimgame; + settings.bpp3d = bppgame; + settings.forcesetup = forcesetup; + PopulateForm(); + + while (done < 0) { + switch (GetMessage(&msg, NULL, 0,0)) { + case 0: done = 1; break; + case -1: return -1; + default: + if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break; + TranslateMessage(&msg); + DispatchMessage(&msg); + break; + } + } + + SetPage(TAB_MESSAGES); + EnableConfig(0); + if (done) { + fullscreen = settings.fullscreen; + xdim2d = settings.xdim2d; + ydim2d = settings.ydim2d; + xdimgame = settings.xdim3d; + ydimgame = settings.ydim3d; + bppgame = settings.bpp3d; + forcesetup = settings.forcesetup; + } + + return done; +} + diff --git a/polymer/build/src/startwin.game.c b/polymer/build/src/startwin.game.c new file mode 100755 index 000000000..efbe8b8e4 --- /dev/null +++ b/polymer/build/src/startwin.game.c @@ -0,0 +1,415 @@ +#ifndef RENDERTYPEWIN +#error Only for Windows +#endif + +#include "build.h" +#include "winlayer.h" +#include "compat.h" + +#define WIN32_LEAN_AND_MEAN +#include +#include +#define _WIN32_IE 0x0300 +#include +#include + +#include "startwin.game.h" + +#define TAB_CONFIG 0 +#define TAB_MESSAGES 1 + +static struct { + int fullscreen; + int xdim3d, ydim3d, bpp3d; + int forcesetup; +} settings; + +static HWND startupdlg = NULL; +static HWND pages[2] = { NULL, NULL}; +static int done = -1; + +static void PopulateForm(void) +{ + int i,j; + char buf[64]; + int mode3d; + HWND hwnd3d; + + hwnd3d = GetDlgItem(pages[TAB_CONFIG], IDC3DVMODE); + + mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); + if (mode3d < 0) { + int cd[] = { 32, 24, 16, 15, 8, 0 }; + for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp3d) i++; else break; } + for ( ; cd[i]; i++) { + mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); + if (mode3d < 0) continue; + settings.bpp3d = cd[i]; + break; + } + } + + Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), (settings.fullscreen ? BST_CHECKED : BST_UNCHECKED)); + Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED)); + + ComboBox_ResetContent(hwnd3d); + for (i=0; iidFrom != WIN_STARTWIN_TABCTL) break; + cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0); + switch (nmhdr->code) { + case TCN_SELCHANGING: { + if (cur < 0 || !pages[cur]) break; + ShowWindow(pages[cur],SW_HIDE); + return TRUE; + } + case TCN_SELCHANGE: { + if (cur < 0 || !pages[cur]) break; + ShowWindow(pages[cur],SW_SHOW); + return TRUE; + } + } + break; + } + + case WM_CLOSE: + done = 0; + return TRUE; + + case WM_DESTROY: + if (hbmp) { + DeleteObject(hbmp); + hbmp = NULL; + } + + if (pages[TAB_CONFIG]) { + DestroyWindow(pages[TAB_CONFIG]); + pages[TAB_CONFIG] = NULL; + } + + startupdlg = NULL; + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case WIN_STARTWIN_CANCEL: done = 0; return TRUE; + case WIN_STARTWIN_START: done = 1; return TRUE; + } + return FALSE; + + case WM_CTLCOLORSTATIC: + if ((HWND)lParam == pages[TAB_MESSAGES]) + return (BOOL)GetSysColorBrush(COLOR_WINDOW); + break; + + default: break; + } + + return FALSE; +} + + +int startwin_open(void) +{ + INITCOMMONCONTROLSEX icc; + if (startupdlg) return 1; + icc.dwSize = sizeof(icc); + icc.dwICC = ICC_TAB_CLASSES; + InitCommonControlsEx(&icc); + startupdlg = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWIN), NULL, startup_dlgproc); + if (startupdlg) { + SetPage(TAB_MESSAGES); + EnableConfig(0); + return 0; + } + return -1; +} + +int startwin_close(void) +{ + if (!startupdlg) return 1; + DestroyWindow(startupdlg); + startupdlg = NULL; + return 0; +} + +int startwin_puts(const char *buf) +{ + const char *p = NULL, *q = NULL; + char workbuf[1024]; + static int newline = 0; + int curlen, linesbefore, linesafter; + HWND edctl; + int vis; + + if (!startupdlg) return 1; + + edctl = pages[TAB_MESSAGES]; + if (!edctl) return -1; + + vis = ((int)SendMessage(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL), TCM_GETCURSEL,0,0) == TAB_MESSAGES); + + if (vis) SendMessage(edctl, WM_SETREDRAW, FALSE,0); + curlen = SendMessage(edctl, WM_GETTEXTLENGTH, 0,0); + SendMessage(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen); + linesbefore = SendMessage(edctl, EM_GETLINECOUNT, 0,0); + p = buf; + while (*p) { + if (newline) { + SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n"); + newline = 0; + } + q = p; + while (*q && *q != '\n') q++; + memcpy(workbuf, p, q-p); + if (*q == '\n') { + if (!q[1]) { + newline = 1; + workbuf[q-p] = 0; + } else { + workbuf[q-p] = '\r'; + workbuf[q-p+1] = '\n'; + workbuf[q-p+2] = 0; + } + p = q+1; + } else { + workbuf[q-p] = 0; + p = q; + } + SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)workbuf); + } + linesafter = SendMessage(edctl, EM_GETLINECOUNT, 0,0); + SendMessage(edctl, EM_LINESCROLL, 0, linesafter-linesbefore); + if (vis) SendMessage(edctl, WM_SETREDRAW, TRUE,0); + return 0; +} + +int startwin_settitle(const char *str) +{ + if (!startupdlg) return 1; + SetWindowText(startupdlg, str); + return 0; +} + +int startwin_idle(void *v) +{ + if (!startupdlg || !IsWindow(startupdlg)) return 0; + if (IsDialogMessage(startupdlg, (MSG*)v)) return 1; + return 0; +} + +extern int xdimgame, ydimgame, bppgame, forcesetup; + +int startwin_run(void) +{ + MSG msg; + if (!startupdlg) return 1; + + done = -1; + + SetPage(TAB_CONFIG); + EnableConfig(1); + + settings.fullscreen = fullscreen; + settings.xdim3d = xdimgame; + settings.ydim3d = ydimgame; + settings.bpp3d = bppgame; + settings.forcesetup = forcesetup; + PopulateForm(); + + while (done < 0) { + switch (GetMessage(&msg, NULL, 0,0)) { + case 0: done = 1; break; + case -1: return -1; + default: + if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break; + TranslateMessage(&msg); + DispatchMessage(&msg); + break; + } + } + + SetPage(TAB_MESSAGES); + EnableConfig(0); + if (done) { + fullscreen = settings.fullscreen; + xdimgame = settings.xdim3d; + ydimgame = settings.ydim3d; + bppgame = settings.bpp3d; + forcesetup = settings.forcesetup; + } + + return done; +} + diff --git a/polymer/build/src/startwin.game.h b/polymer/build/src/startwin.game.h new file mode 100755 index 000000000..ee446bf2a --- /dev/null +++ b/polymer/build/src/startwin.game.h @@ -0,0 +1,18 @@ +// resource ids +#define WIN_STARTWIN 1000 +#define WIN_STARTWINPAGE_CONFIG 2000 +#define WIN_STARTWIN_BITMAP 100 // banner bitmap +#define WIN_STARTWIN_TABCTL 101 +#define WIN_STARTWIN_CANCEL 102 +#define WIN_STARTWIN_START 103 + +#define WIN_STARTWIN_MESSAGES 104 // output list box + +#define RSRC_ICON 100 +#define RSRC_BMP 200 + +// config page +#define IDCFULLSCREEN 100 +#define IDC3DVMODE 101 +#define IDCALWAYSSHOW 102 + diff --git a/polymer/build/src/winlayer.c b/polymer/build/src/winlayer.c index 90578d368..3160abe3c 100644 --- a/polymer/build/src/winlayer.c +++ b/polymer/build/src/winlayer.c @@ -56,10 +56,6 @@ static HWND hWindow = 0; static BOOL window_class_registered = FALSE; static HANDLE instanceflag = NULL; -static HWND startupdlg = NULL; -static long startupdlgsaferect[4] = { -1,-1,-1,-1 }; -static int startupdlgcommand = 0; -static void (*startupdlgonclose)(void) = NULL; int backgroundidle = 1; static WORD sysgamma[3][256]; @@ -233,11 +229,7 @@ void wm_setapptitle(char *name) } if (hWindow) SetWindowText(hWindow, apptitle); - if (startupdlg) { - char buf[1000]; - Bsnprintf(buf, 1000, "%s Startup", apptitle); - SetWindowText(startupdlg, buf); - } + startwin_settitle(apptitle); } // @@ -256,143 +248,6 @@ static void SignalHandler(int signum) } } - -// -// startup_dlgproc() -- dialog procedure for the initialisation dialog -// -#define FIELDSWIDE 366 -#define PADWIDE 5 // 5 units of padding -// An overlayed child dialog should have the DS_CONTROL style - -static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - static HBITMAP hbmp = NULL; - RECT rdlg, rbmp, rtxt; - HDC hdc; - int height=5; - - switch (uMsg) { - case WM_INITDIALOG: - // set the bitmap - hbmp = LoadBitmap(hInstance, MAKEINTRESOURCE(WIN_STARTWINBMP)); - SendDlgItemMessage(hwndDlg, WIN_STARTWIN_ITEMBITMAP, STM_SETIMAGE, IMAGE_BITMAP, (LPARAM)hbmp); - - // fetch the adjusted size - GetClientRect(GetDlgItem(hwndDlg,WIN_STARTWIN_ITEMBITMAP), &rbmp); - rbmp.right++; rbmp.bottom++; - - GetClientRect(GetDlgItem(hwndDlg,WIN_STARTWIN_ITEMTEXT), &rtxt); - rtxt.bottom++; - - // move the bitmap to the top of the client area - MoveWindow(GetDlgItem(hwndDlg,WIN_STARTWIN_ITEMBITMAP), - 0,0, rbmp.right,rbmp.bottom, - FALSE); - - // move the label - MoveWindow(GetDlgItem(hwndDlg,WIN_STARTWIN_ITEMTEXT), - rbmp.right+PADWIDE,PADWIDE, FIELDSWIDE,rtxt.bottom, - FALSE); - - // move the list box - MoveWindow(GetDlgItem(hwndDlg,WIN_STARTWIN_ITEMLIST), - rbmp.right+PADWIDE,PADWIDE+rtxt.bottom+PADWIDE, - FIELDSWIDE,rbmp.bottom-(PADWIDE+rtxt.bottom+PADWIDE+PADWIDE), - FALSE); - - SendDlgItemMessage(hwndDlg,WIN_STARTWIN_ITEMLIST, EM_LIMITTEXT, 0,0); - { - RECT rg; - GetWindowRect(GetDlgItem(hwndDlg,WIN_STARTWIN_ITEMLIST),&rg); - rg.right -= rg.left + GetSystemMetrics(SM_CXVSCROLL)+4; - rg.bottom -= rg.top; - rg.left = rg.top = 0; - SendDlgItemMessage(hwndDlg,WIN_STARTWIN_ITEMLIST, EM_SETRECTNP,0,(LPARAM)&rg); - } - - rdlg.left = 0; - rdlg.top = 0; - rdlg.right = rbmp.right+PADWIDE+FIELDSWIDE+PADWIDE; - rdlg.bottom = rbmp.bottom; - - AdjustWindowRect(&rdlg, - GetWindowLong(hwndDlg, GWL_STYLE), - FALSE); - - rdlg.right -= rdlg.left; - rdlg.bottom -= rdlg.top; - - hdc = GetDC(NULL); - rdlg.left = (GetDeviceCaps(hdc, HORZRES) - rdlg.right) / 2; - rdlg.top = (GetDeviceCaps(hdc, VERTRES) - rdlg.bottom) / 2; - ReleaseDC(NULL, hdc); - - SetWindowPos(hwndDlg,NULL, - rdlg.left,rdlg.top, - rdlg.right,rdlg.bottom, - SWP_NOREPOSITION); - - // save the safe region of the window - startupdlgsaferect[0] = rbmp.right; // left - startupdlgsaferect[1] = 0; // top - startupdlgsaferect[2] = PADWIDE+FIELDSWIDE+PADWIDE; // width - startupdlgsaferect[3] = rbmp.bottom; // height - - return TRUE; - - case WM_CLOSE: - quitevent = 1; - return TRUE; - - case WM_DESTROY: - if (hbmp) { - DeleteObject(hbmp); - hbmp = NULL; - } - - if (startupdlgonclose) startupdlgonclose(); - - startupdlg = NULL; - return TRUE; - - case WM_COMMAND: - startupdlgcommand = LOWORD(wParam); - return FALSE; - - case WM_CTLCOLORSTATIC: - switch (GetDlgCtrlID((HWND)lParam)) { - case WIN_STARTWIN_ITEMLIST: - return (BOOL)GetSysColorBrush(COLOR_WINDOW); - default: break; - } - break; - - default: break; - } - - return FALSE; -} - - -int win_getstartupwin(long *hwnd, long saferect[4], void (*onclose)(void)) -{ - if (!startupdlg) return 1; - - *hwnd = (long)startupdlg; - memcpy(saferect, startupdlgsaferect, sizeof(long)*4); - startupdlgonclose = onclose; - - return 0; -} - -int win_getstartupcommand(void) -{ - int t = startupdlgcommand; - startupdlgcommand = 0; - return t; -} - - // // WinMain() -- main Windows entry point // @@ -502,16 +357,16 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC atexit(uninitsystem); - baselayer_init(); - instanceflag = CreateSemaphore(NULL, 1,1, WindowClass); - startupdlg = CreateDialog(hInstance, MAKEINTRESOURCE(WIN_STARTWIN), NULL, startup_dlgproc); + startwin_open(); + baselayer_init(); r = app_main(_buildargc, _buildargv); fclose(stdout); + startwin_close(); if (instanceflag) CloseHandle(instanceflag); if (argvbuf) free(argvbuf); @@ -593,9 +448,7 @@ void uninitsystem(void) { DestroyAppWindow(); - if (startupdlg) { - DestroyWindow(startupdlg); - } + startwin_close(); uninitinput(); uninittimer(); @@ -615,57 +468,12 @@ void initprintf(const char *f, ...) { va_list va; char buf[1024],*p=NULL,*q=NULL,workbuf[1024]; - //int i = 0; - - static int newline = 0;//1; - // int overwriteline = -1; va_start(va, f); Bvsnprintf(buf, 1024, f, va); va_end(va); OSD_Printf(buf); - if (!startupdlg) return; - - { - int curlen, linesbefore, linesafter; - HWND edctl; - - edctl = GetDlgItem(startupdlg,102); - if (!edctl) return; - - SendMessage(edctl, WM_SETREDRAW, FALSE,0); - curlen = SendMessage(edctl, WM_GETTEXTLENGTH, 0,0); - SendMessage(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen); - linesbefore = SendMessage(edctl, EM_GETLINECOUNT, 0,0); - p = buf; - while (*p) { - if (newline) { - SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n"); - newline = 0; - } - q = p; - while (*q && *q != '\n') q++; - memcpy(workbuf, p, q-p); - if (*q == '\n') { - if (!q[1]) { - newline = 1; - workbuf[q-p] = 0; - } else { - workbuf[q-p] = '\r'; - workbuf[q-p+1] = '\n'; - workbuf[q-p+2] = 0; - } - p = q+1; - } else { - workbuf[q-p] = 0; - p = q; - } - SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)workbuf); - } - linesafter = SendMessage(edctl, EM_GETLINECOUNT, 0,0); - SendMessage(edctl, EM_LINESCROLL, 0, linesafter-linesbefore); - SendMessage(edctl, WM_SETREDRAW, TRUE,0); - } + startwin_puts(buf); handleevents(); } @@ -705,7 +513,7 @@ int handleevents(void) if (msg.message == WM_QUIT) quitevent = 1; - if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) continue; + if (startwin_idle((void*)&msg) > 0) continue; TranslateMessage(&msg); DispatchMessage(&msg); @@ -1531,67 +1339,6 @@ static void ProcessInputDevices(void) for (i=0; i shiftkey=1, shiftkeycount=0\n"); - } - } else { - if ((thiskey == (SHIFT|UP)) && (nextkey == (NUMPAD|DOWN))) { - shiftkeycount--; - initprintf("shift is up and next key is numpad and down, shiftkeycount=%d\n", - shiftkeycount); - continue; - } else if (thiskey & SHIFT) { - if (thiskey & DOWN) { - shiftkeycount++; - initprintf("shift key down, shiftkeycount=%d\n", shiftkeycount); - continue; - } else { - if (shiftkeycount == 0) { - shiftkey = 0; - initprintf("shift key up and shiftkeycount == 0, shiftkey=0\n"); - } else { - shiftkeycount--; - initprintf("shift key up and shiftkeycount=%d\n",shiftkeycount); - continue; - } - } - } - } -#undef NUMPAD -#undef SHIFT -#undef UP -#undef DOWN - } -#endif - if (k == DIK_PAUSE) continue; // fucking pause // hook in the osd @@ -1960,7 +1707,7 @@ static int getgammaramp(WORD gt[3][256]); // // checkvideomode() -- makes sure the video mode passed is legal // -int checkvideomode(int *x, int *y, int c, int fs) +int checkvideomode(int *x, int *y, int c, int fs, int forced) { int i, nearest=-1, dx, dy, odx=9999, ody=9999; @@ -1990,7 +1737,7 @@ int checkvideomode(int *x, int *y, int c, int fs) } #ifdef ANY_WINDOWED_SIZE - if ((fs&1) == 0 && (nearest < 0 || validmode[nearest].xdim!=*x || validmode[nearest].ydim!=*y)) { + if (!forced && (fs&1) == 0 && (nearest < 0 || validmode[nearest].xdim!=*x || validmode[nearest].ydim!=*y)) { // check the colour depth is recognised at the very least for (i=0;i&1 $(OBJ)%.$o: $(SRC)misc/%.rc - windres -i $< -o $@ + windres -i $< -o $@ --include-dir=$(EINC) --include-dir=$(SRC) $(OBJ)%.$o: $(SRC)util/%.c $(CC) $(CFLAGS) $(OURCFLAGS) -c $< -o $@ 2>&1 diff --git a/polymer/eduke32/Makefile.deps b/polymer/eduke32/Makefile.deps index 401b5a001..dbfaf4126 100644 --- a/polymer/eduke32/Makefile.deps +++ b/polymer/eduke32/Makefile.deps @@ -27,8 +27,9 @@ $(OBJ)astub.$o: $(SRC)astub.c $(EINC)build.h $(EINC)pragmas.h $(EINC)compat.h $( $(OBJ)game_icon.$o: $(RSRC)game_icon.c $(OBJ)build_icon.$o: $(RSRC)build_icon.c -$(OBJ)gameres.$o: $(SRC)misc/gameres.rc $(RSRC)game.bmp $(RSRC)game_icon.ico -$(OBJ)buildres.$o: $(SRC)misc/buildres.rc $(RSRC)build.bmp $(RSRC)build_icon.ico +$(OBJ)gameres.$o: $(SRC)misc/gameres.rc $(SRC)startwin.game.h $(RSRC)game.bmp $(RSRC)game_icon.ico +$(OBJ)buildres.$o: $(SRC)misc/buildres.rc $(EINC)startwin.editor.h $(RSRC)build.bmp $(RSRC)build_icon.ico +$(OBJ)startwin.game.$o: $(SRC)startwin.game.c $(duke3d_h) $(EINC)build.h $(EINC)winlayer.h $(EINC)compat.h # jMACT objects $(OBJ)animlib.$o: $(SRC)jmact/animlib.c $(SRC)jmact/types.h $(INC)develop.h $(SRC)jmact/util_lib.h $(SRC)jmact/animlib.h $(EINC)compat.h diff --git a/polymer/eduke32/build.cfg b/polymer/eduke32/build.cfg deleted file mode 100644 index 60c444b2d..000000000 --- a/polymer/eduke32/build.cfg +++ /dev/null @@ -1,104 +0,0 @@ -; Build editor configuration - -; Video mode selection -; 0 - Windowed -; 1 - Fullscreen -fullscreen = 0 - -; Video resolution selection -; 0 - 320 x 200 -; 1 - 360 x 200 -; 2 - 320 x 240 -; 3 - 360 x 240 -; 4 - 320 x 400 -; 5 - 360 x 400 -; 6 - 640 x 350 -; 7 - 640 x 400 -; 8 - 640 x 480 -; 9 - 800 x 600 -; 10 - 1024 x 768 -; 11 - 1280 x 1024 -; 12 - 1600 x 1200 -; You can select a seperate 2D editor resolution by -; removing the semicolon from the second line below -; and selecting a mode number. The minimum 2D mode -; is 640x480 (mode #8) -resolution = 8 -;2dresolution = 8 - -; 3D mode colour depth -bpp = 8 - -; Maximum OpenGL mode refresh rate (Windows only, in Hertz) -maxrefreshfreq = 60 - -; 3D mode brightness setting -; 0 - lowest -; 15 - highest -brightness = 0 - -; Sound sample frequency -; 0 - 6 KHz -; 1 - 8 KHz -; 2 - 11.025 KHz -; 3 - 16 KHz -; 4 - 22.05 KHz -; 5 - 32 KHz -; 6 - 44.1 KHz -samplerate = 4 - -; Music playback -; 0 - Off -; 1 - On -music = 1 - -; Enable mouse -; 0 - No -; 1 - Yes -mouse = 1 - -; Mouse sensitivity -mousesensitivity = 1.0 - -; Key Settings -; Here's a map of all the keyboard scan codes: NOTE: values are listed in hex! -; +---------------------------------------------------------------------------------------------+ -; | 01 3B 3C 3D 3E 3F 40 41 42 43 44 57 58 46 | -; |ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 SCROLL | -; | | -; |29 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E D2 C7 C9 45 B5 37 4A | -; | ` '1' '2' '3' '4' '5' '6' '7' '8' '9' '0' - = BACK INS HOME PGUP NUMLK KP/ KP* KP- | -; | | -; | 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 2B D3 CF D1 47 48 49 4E | -; |TAB Q W E R T Y U I O P [ ] \ DEL END PGDN KP7 KP8 KP9 KP+ | -; | | -; | 3A 1E 1F 20 21 22 23 24 25 26 27 28 1C 4B 4C 4D | -; |CAPS A S D F G H J K L ; ' ENTER KP4 KP5 KP6 9C | -; | KPENTER| -; | 2A 2C 2D 2E 2F 30 31 32 33 34 35 36 C8 4F 50 51 | -; |LSHIFT Z X C V B N M , . / RSHIFT UP KP1 KP2 KP3 | -; | | -; | 1D 38 39 B8 9D CB D0 CD 52 53 | -; |LCTRL LALT SPACE RALT RCTRL LEFT DOWN RIGHT KP0 KP. | -; +---------------------------------------------------------------------------------------------+ - -keyforward = C8 -keybackward = D0 -keyturnleft = CB -keyturnright = CD -keyrun = 2A -keystrafe = 9D -keyfire = 1D -keyuse = 39 -keystandhigh = 1E -keystandlow = 2C -keylookup = D1 -keylookdown = C9 -keystrafeleft = 33 -keystraferight = 34 -key2dmode = 9C -keyviewcycle = 1C -key2dzoomin = D -key2dzoomout = C -keychat = F - diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 20858d591..6386467e3 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -2429,7 +2429,7 @@ void moveweapons(void) dax = s->x; day = s->y; daz = s->z; - if(thisprojectile[i].range > 0) + if(thisprojectile[i].workslike & PROJECTILE_FLAG_TIMED && thisprojectile[i].range > 0) { if (!(hittype[i].temp_data[8])) hittype[i].temp_data[8] = 1; diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index d3689d8c3..f4835520c 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -4220,7 +4220,7 @@ int ExtInit(void) long rv = 0; char *duke3dgrp = "duke3d.grp"; -#if 1 // defined(_WIN32) +#if defined(_WIN32) if (!access("user_profiles_enabled", F_OK)) #endif { diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 71ebf5fc1..9b1ed1a6d 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -95,6 +95,7 @@ int32 ScreenWidth = 800; int32 ScreenHeight = 600; int32 ScreenBPP = 8; #endif +int32 ForceSetup = 1; static char setupfilename[256]={SETUPFILENAME}; int32 scripthandle = -1; @@ -558,7 +559,7 @@ void readsavenames(void) =================== */ -void CONFIG_ReadSetup( void ) +int32 CONFIG_ReadSetup( void ) { int32 dummy, i; char commmacro[] = "CommbatMacro# "; @@ -572,6 +573,8 @@ void CONFIG_ReadSetup( void ) if (SafeFileExists(setupfilename)) // JBF 20031211 scripthandle = SCRIPT_Load( setupfilename ); + if (scripthandle < 0) return -1; + if (scripthandle >= 0) { for(dummy = 0;dummy < 10;dummy++) @@ -639,6 +642,7 @@ void CONFIG_ReadSetup( void ) SCRIPT_GetNumber( scripthandle, "Misc", "Executions",&ud.executions); ud.executions++; + SCRIPT_GetNumber( scripthandle, "Setup", "ForceSetup",&ForceSetup); SCRIPT_GetNumber( scripthandle, "Misc", "RunMode",&RunMode); SCRIPT_GetNumber( scripthandle, "Misc", "Crosshairs",&ud.crosshair); SCRIPT_GetNumber( scripthandle, "Misc", "StatusBarScale",&ud.statusbarscale); @@ -702,8 +706,8 @@ void CONFIG_ReadSetup( void ) //CONFIG_SetupMouse(scripthandle); //CONFIG_SetupJoystick(scripthandle); - setupread = 1; + return 0; } /* @@ -742,6 +746,7 @@ void CONFIG_WriteSetup( void ) SCRIPT_PutNumber( scripthandle, "Misc", "Crosshairs",ud.crosshair,false,false); SCRIPT_PutNumber( scripthandle, "Misc", "DemoCams",ud.democams,false,false); SCRIPT_PutNumber( scripthandle, "Misc", "Executions",ud.executions,false,false); + SCRIPT_PutNumber( scripthandle, "Setup", "ForceSetup",ForceSetup,false,false); SCRIPT_PutNumber( scripthandle, "Misc", "IDPlayers",ud.idplayers,false,false); SCRIPT_PutNumber( scripthandle, "Misc", "MPMessageDisplayTime",ud.msgdisptime,false,false); SCRIPT_PutNumber( scripthandle, "Misc", "RunMode",RunMode,false,false); diff --git a/polymer/eduke32/source/config.h b/polymer/eduke32/source/config.h index 1f9daffc2..8b0ca323a 100644 --- a/polymer/eduke32/source/config.h +++ b/polymer/eduke32/source/config.h @@ -52,6 +52,7 @@ extern int32 ScreenMode; extern int32 ScreenWidth; extern int32 ScreenHeight; extern int32 ScreenBPP; +extern int32 ForceSetup; extern byte KeyboardKeys[NUMGAMEFUNCTIONS][2]; extern int32 MouseFunctions[MAXMOUSEBUTTONS][2]; @@ -65,7 +66,7 @@ extern int32 JoystickAnalogueScale[MAXJOYAXES]; extern int32 JoystickAnalogueDead[MAXJOYAXES]; extern int32 JoystickAnalogueSaturate[MAXJOYAXES]; -void CONFIG_ReadSetup( void ); +int32 CONFIG_ReadSetup( void ); void CONFIG_GetSetupFilename( void ); void CONFIG_WriteSetup( void ); void CONFIG_SetupMouse( void ); diff --git a/polymer/eduke32/source/funct.h b/polymer/eduke32/source/funct.h index def333cdf..467e9738b 100644 --- a/polymer/eduke32/source/funct.h +++ b/polymer/eduke32/source/funct.h @@ -260,7 +260,7 @@ extern char *CONFIG_AnalogNumToName(int32 func); extern void CONFIG_SetDefaults(void ); extern void CONFIG_ReadKeys(void ); extern void readsavenames(void ); -extern void CONFIG_ReadSetup(void ); +extern int32 CONFIG_ReadSetup(void ); extern void CONFIG_WriteSetup(void ); extern void CheckAnimStarted(char *funcname); extern uint16 findpage(uint16 framenumber); diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index a991e3738..f903bac16 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "util_lib.h" -#define VERSION " 1.4.0svn" +#define VERSION " 1.4.0 beta 2" #define HEAD "EDuke32"VERSION" (shareware mode)" #define HEAD2 "EDuke32"VERSION @@ -56,8 +56,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. long cameradist = 0, cameraclock = 0; char playerswhenstarted; -char qe,cp; +char qe,cp,usecwd = 0; +static int32 CommandSetup = 0; static int32 CommandSoundToggleOff = 0; static int32 CommandMusicToggleOff = 0; static char *CommandMap = NULL; @@ -7611,7 +7612,11 @@ void comlinehelp(char **argv) "-map FILE\tUse a map FILE\n" "-name NAME\tFoward NAME\n" "-net\t\tNet mode game\n" + "-setup\t\tDisplays the configuration dialog\n" "-nD\t\tDump game definitions to gamevars.txt\n" +#if !defined(_WIN32) + "-usecwd\t\tRead game data and configuration file from working directory\n" +#endif "-condebug, -z#\tLine-by-line CON compilation debugging"; wm_msgbox(apptitle,s); } @@ -7757,6 +7762,11 @@ void checkcommandline(int argc,char **argv) c = argv[i]; if (((*c == '/') || (*c == '-')) && (!firstnet)) { + if (!Bstrcasecmp(c+1,"setup")) { + CommandSetup = 1; + i++; + continue; + } if (!Bstrcasecmp(c+1,"keepaddr")) { keepaddr = 1; i++; @@ -7895,6 +7905,13 @@ void checkcommandline(int argc,char **argv) i++; continue; } +#if !defined(_WIN32) + if (!Bstrcasecmp(c+1,"usecwd")) { + usecwd = 1; + i++; + continue; + } +#endif } if (firstnet > 0) { @@ -8494,6 +8511,8 @@ void sanitizegametype() // initprintf("ud.m_coop=%i after sanitisation\n",ud.m_coop); } +extern int startwin_run(void); + void Startup(void) { int i; @@ -8502,7 +8521,22 @@ void Startup(void) compilecons(); - CONFIG_ReadSetup(); + i = CONFIG_ReadSetup(); + + if (initengine()) { + wm_msgbox("Build Engine Initialisation Error", + "There was a problem initialising the Build engine: %s", engineerrstr); + exit(1); + } + +#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2) + if (i < 0 || ForceSetup || CommandSetup) { + if (!startwin_run()) { + uninitengine(); + exit(0); + } + } +#endif setupdynamictostatic(); @@ -8558,12 +8592,6 @@ void Startup(void) if(ud.executions >= 50) initprintf("IT IS NOW TIME TO UPGRADE TO THE COMPLETE VERSION!!!\n"); } - if (initengine()) { - wm_msgbox("Build Engine Initialisation Error", - "There was a problem initialising the Build engine: %s", engineerrstr); - exit(1); - } - if (CONTROL_Startup( 1, &GetTime, TICRATE )) { uninitengine(); exit(1); @@ -8811,8 +8839,10 @@ void app_main(int argc,char **argv) OSD_SetLogFile("eduke32.log"); -#if 1 // defined(_WIN32) +#if defined(_WIN32) if (!access("user_profiles_enabled", F_OK)) +#else + if (usecwd == 0) #endif { char cwd[BMAX_PATH]; diff --git a/polymer/eduke32/source/menus.c b/polymer/eduke32/source/menus.c index 2aae0b5ea..76ed54776 100644 --- a/polymer/eduke32/source/menus.c +++ b/polymer/eduke32/source/menus.c @@ -2432,7 +2432,7 @@ cheat_for_port_credits: case 2: { int dax = xdim, day = ydim, daz; - curvidmode = newvidmode = checkvideomode(&dax,&day,bpp,fullscreen); + curvidmode = newvidmode = checkvideomode(&dax,&day,bpp,fullscreen,0); if (newvidmode == 0x7fffffffl) newvidmode = validmodecnt; newfullscreen = fullscreen; changesmade = 0; diff --git a/polymer/eduke32/source/misc/buildres.rc b/polymer/eduke32/source/misc/buildres.rc index 5f22e6354..22c1ef82c 100644 --- a/polymer/eduke32/source/misc/buildres.rc +++ b/polymer/eduke32/source/misc/buildres.rc @@ -1,30 +1,33 @@ #include +#include +#include "startwin.editor.h" -100 ICON "rsrc/build_icon.ico" -200 BITMAP "rsrc/build.bmp" +RSRC_ICON ICON "rsrc/build_icon.ico" +RSRC_BMP BITMAP "rsrc/build.bmp" -1000 DIALOGEX DISCARDABLE 20, 40, 265, 233 +WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200 STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU CAPTION "Startup" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", 100, "STATIC", SS_BITMAP | SS_SUNKEN | WS_CHILD | WS_VISIBLE, 5, 5, 255, 255 - CONTROL "Starting Build Editor for Duke Nukem 3D...", 101, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE, 5, 79, 255, 8 - CONTROL "", 102, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL, 5, 92, 255, 138 + CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 32, 32 + CONTROL "", WIN_STARTWIN_TABCTL, WC_TABCONTROL, WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 5, 250, 170 + CONTROL "&Start", WIN_STARTWIN_START, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 180, 48, 14 + CONTROL "&Cancel", WIN_STARTWIN_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 207, 180, 48, 14 + + CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32 END -2000 DIALOGEX DISCARDABLE 20, 40, 279, 168 -STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | DS_CONTROL +WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD CAPTION "Dialog" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "Video mode", -1, "BUTTON", BS_GROUPBOX | WS_CHILD | WS_VISIBLE, 5, 3, 128, 64 - CONTROL "&Fullscreen", 100, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 45, 15, 49, 10 - CONTROL "&2D mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 12, 30, 37, 8 - CONTROL "", 101, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 50, 28, 75, 56 - CONTROL "&3D mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 12, 47, 37, 8 - CONTROL "", 102, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 50, 46, 75, 56 - CONTROL "&Continue", IDOK, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 140, 145, 64, 17 - CONTROL "E&xit", IDCANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 208, 145, 64, 17 + CONTROL "&2D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8 + CONTROL "", IDC2DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 6, 80, 56 + CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 49, 10 + CONTROL "&3D Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 24, 50, 8 + CONTROL "", IDC3DVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 22, 80, 56 + CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8 END diff --git a/polymer/eduke32/source/misc/gameres.rc b/polymer/eduke32/source/misc/gameres.rc index df1d1c2f2..4f720717e 100644 --- a/polymer/eduke32/source/misc/gameres.rc +++ b/polymer/eduke32/source/misc/gameres.rc @@ -1,14 +1,45 @@ #include +#include +#include "startwin.game.h" -100 ICON "rsrc/game_icon.ico" -200 BITMAP "rsrc/game.bmp" +RSRC_ICON ICON "rsrc/game_icon.ico" +RSRC_ICON+1 ICON "rsrc/game_icon.ico" +RSRC_ICON+2 ICON "rsrc/game_icon.ico" +RSRC_BMP BITMAP "rsrc/game.bmp" -1000 DIALOGEX DISCARDABLE 20, 40, 265, 233 +WIN_STARTWIN DIALOGEX DISCARDABLE 20, 40, 260, 200 STYLE DS_MODALFRAME | DS_CENTER | DS_SETFONT | DS_FIXEDSYS | WS_OVERLAPPED | WS_CAPTION | WS_VISIBLE | WS_SYSMENU CAPTION "Startup" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", 100, "STATIC", SS_BITMAP | SS_SUNKEN | WS_CHILD | WS_VISIBLE, 5, 5, 255, 255 - CONTROL "Starting EDuke32...", 101, "STATIC", SS_CENTER | WS_CHILD | WS_VISIBLE, 5, 79, 255, 8 - CONTROL "", 102, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL, 5, 92, 255, 138 + CONTROL "", WIN_STARTWIN_BITMAP, "STATIC", SS_BITMAP | WS_CHILD | WS_VISIBLE, 0, 0, 32, 32 + CONTROL "", WIN_STARTWIN_TABCTL, WC_TABCONTROL, WS_CLIPSIBLINGS | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 5, 5, 250, 170 + CONTROL "&Start", WIN_STARTWIN_START, "BUTTON", BS_DEFPUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 154, 180, 48, 14 + CONTROL "&Cancel", WIN_STARTWIN_CANCEL, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 207, 180, 48, 14 + + CONTROL "", WIN_STARTWIN_MESSAGES, "EDIT", ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VSCROLL, 0, 0, 32, 32 END + +WIN_STARTWINPAGE_CONFIG DIALOGEX DISCARDABLE 20, 40, 279, 168 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD +CAPTION "Dialog" +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "&Video mode:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 8, 50, 8 + CONTROL "", IDCVMODE, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 6, 80, 56 + CONTROL "&Fullscreen", IDCFULLSCREEN, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 148, 8, 49, 10 + + CONTROL "S&ound driver:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 28, 50, 8 + CONTROL "", IDCSOUNDDRV, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 26, 110, 56 + CONTROL "&MIDI device:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 44, 50, 8 + CONTROL "", IDCMIDIDEV, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 42, 110, 56 + CONTROL "C&D drive:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 60, 50, 8 + CONTROL "", IDCCDADEV, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 58, 40, 56 + + CONTROL "Input devices:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 80, 50, 8 + CONTROL "Mo&use", IDCINPUTMOUSE, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 60, 80, 49, 8 + CONTROL "&Joystick", IDCINPUTJOY, "BUTTON", BS_CHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 110, 80, 49, 8 + + CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8 +END + diff --git a/polymer/eduke32/source/misc/gtkstartwin/gtkstartwin.glade b/polymer/eduke32/source/misc/gtkstartwin/gtkstartwin.glade new file mode 100755 index 000000000..f0c32fa17 --- /dev/null +++ b/polymer/eduke32/source/misc/gtkstartwin/gtkstartwin.glade @@ -0,0 +1,551 @@ + + + + + + + True + Startup + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_CENTER + False + False + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + + + + + True + False + 0 + + + + + 0 + False + False + + + + + + True + False + 0 + + + + 4 + True + True + True + True + GTK_POS_TOP + False + False + + + + True + False + 0 + + + + 6 + True + + + + 85 + 29 + True + True + _Fullscreen + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + + 248 + 0 + + + + + + 88 + 29 + True + _Video mode: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + vmode3dcombo + + + 0 + 0 + + + + + + 88 + 20 + True + Input devices: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 120 + + + + + + 88 + 29 + True + S_ound driver: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + sounddrvcombo + + + 0 + 40 + + + + + + 88 + 29 + True + C_D drive: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + cddrvcombo + + + 0 + 72 + + + + + + 31 + 30 + True + + + + + 88 + 40 + + + + + + 31 + 30 + True + + + + 88 + 72 + + + + + + 80 + 20 + True + True + Mo_use + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + + 88 + 120 + + + + + + 80 + 20 + True + True + _Joystick + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + + 168 + 120 + + + + + + 150 + 29 + True + + + + + 88 + 0 + + + + + 0 + True + True + + + + + + True + True + _Always show configuration on start + True + GTK_RELIEF_NORMAL + True + False + False + True + + + + + 0 + False + False + + + + + False + True + + + + + + True + Configuration + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_WORD + False + 0 + 0 + 0 + 2 + 2 + 0 + + + + + + False + True + + + + + + True + Messages + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + 0 + True + True + + + + + + 3 + True + GTK_BUTTONBOX_END + 0 + + + + True + True + True + GTK_RELIEF_NORMAL + True + + + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-cancel + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Cancel + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + + True + True + True + GTK_RELIEF_NORMAL + True + + + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-execute + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Start + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + 0 + False + True + + + + + 0 + True + True + + + + + + + diff --git a/polymer/eduke32/source/misc/gtkstartwin/gtkstartwin.gladep b/polymer/eduke32/source/misc/gtkstartwin/gtkstartwin.gladep new file mode 100755 index 000000000..e27cd5bd5 --- /dev/null +++ b/polymer/eduke32/source/misc/gtkstartwin/gtkstartwin.gladep @@ -0,0 +1,11 @@ + + + + + Gtkstartwin + gtkstartwin + FALSE + FALSE + FALSE + FALSE + diff --git a/polymer/eduke32/source/misc/gtkstartwin/pixmaps/game.bmp b/polymer/eduke32/source/misc/gtkstartwin/pixmaps/game.bmp new file mode 100755 index 0000000000000000000000000000000000000000..db0f6b5ba3c76b6989d61c87d7860b83a8098651 GIT binary patch literal 29080 zcmb7t3qVw5+W#R96(Rc~uu`n@I>(*-XOJBhlmTIs+3zvp?+83u3py~E6$xjn!4_uSt1 zocF?<;NmwVE`J&+NuD@*7594_B*{S<&F?Q;DM@#Y6?c9^e)#p*UnMW+yQO=_I!mUE zENP$5G|747NU6ZdQPNBpFX^0bmsU94E}7g%OEd9&kK;(GFmSf?NB6rW({vAM;{)R) ztKYrS;}hJa%9n#A&#|{lU5}2EGAB7o>%GQHZ#+C+GKKg_CBMI2TJAMb`s`6h=|77m zNnbzbE*WRLO4WhCmy-VUfD|?3_fqRVjdbO-MLHWWS}O2ymICe_C6)TSNgE!&N4mUX zy7bZ?@0Ff?&|O-e6es=t&yG^Tw2{)x@uQ?m4IfGSKG`XKd+dmmGIgYs@tCvJvwVtl zF!X-u<>~iJeHB^KbAR%ZrcLpXerRu$uKaLX8vOSKY3odU*LS4!n&<7(7Ypu?-txOc zIvVw`wA^okWG#MOx>WIwbb9F>(hre$N`G`4Em@NNq%YG$rBzFwmwtG4r1aTyBc-<= z8!7!5<0R!i=_py2jg#7z+$rq~xkJi$(pd_6aI|zOWr|b;u9rT`m0k&Y68t)))31z_ z%&L)+{)LfJB7Xlvtg|$@`cA3y)jOoke|DC#1KgyZw1=g^4S$l(tbbbC2kvDNk4oR= z{Y7d>drtc22T@Yro>b|wr9~Pzc|BFPykSx~RmB_pLe$lg64{GP=7iFZh+ zWABhGvHvA~9_A*sMc*s!UhE;2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QhvGsvEhZ5)&s*3=Q?3ITIK&XU_NDJKqgc zVxcWC@#eW~VB?0lrE@|GF|0~zOH9O8J6odxg^hlo49F!A+Q|R~qA>})vO%NXgFXI< zKQsWR^`1Bn3ImR}tB;$T8)`2c%xCXjO!@R77jT{rI-5flrAA;zG%1d^aY*|B|1d#~ zWtJ7NCSQ$ zg(=BN^n3d|$rRvXhY#A}zo2|msE?bAqvSQwJM`X(;Na!u3FUZ0Yh(^@nvh4eXB492 z-6CN2tBTyJT2=#$*n{)-kbMM68 zO_>NHJ}$1Vj*k4cql?>Zt_Ty>8LUobf;!>V&OUqjr3)1R(i494t5RqAUxy8Q3iS$| zIR!yJ#cQUI%eZllj*j@pV)zL*r9o|p0&59}AOrx|$JN_a$aZm?|21O}f~=Qe!sQoG ziuYzuBtr0T9QXCF_&RF!s{}9sGoOXCuR%+|x^2Fzt6Y5mj9?yIvFnNF_q;*@5IS+@ zOj!H!*FQ)Slm!I*o3zVU@JK+nIfDYVlPnpUfi=dB8{y)Jn+yELg=z$0H)P@!>NREN z#Chm7cza7ffWQynA&eq^Mi6i;(jO_uZQQu|BSw7vwabXFN04^$cS92Rz?;kg z-|~W@sbY>J?0C~ZeRI6cdmQZI?CQE#))5p&b_NN;8R0U5Xx|JY)N>+bD>O`dy>1)l zGR|=XS0B=`-H~)zl18|CLmY_Ack#ij^>L8z3fCtPN5>IB7%{>|{02aK_s*M$eCXxn z=C;?%d%i1b#f414wHx8%{3~O)IKqAR!l@YN>v2F~I)DO;n-TFuN0HJW#klwU`A?2; z{N}0Ipa#= 0 && FXDevice >= 0 && SoundToggle) while(issoundplaying(-1,globalskillsound)) { handleevents(); getpackets(); } + else { handleevents(); getpackets(); } globalskillsound = -1; waitforeverybody(); diff --git a/polymer/eduke32/source/startgtk.game.c b/polymer/eduke32/source/startgtk.game.c new file mode 100755 index 000000000..c89dbc9d9 --- /dev/null +++ b/polymer/eduke32/source/startgtk.game.c @@ -0,0 +1,642 @@ +/* NOTE: Glade will generate code for a dialogue box which you should + * then patch into this file whenever you make a change to the Glade + * template. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "duke3d.h" +#include "build.h" +#include "compat.h" +#include "baselayer.h" + +#define TAB_CONFIG 0 +#define TAB_MESSAGES 1 + +static struct { + int fullscreen; + int xdim3d, ydim3d, bpp3d; + int forcesetup; + int usemouse, usejoy; +} settings; + +extern int gtkenabled; + +static GtkWidget *startwin = NULL; +static int retval = -1, mode = 0; + +// -- SUPPORT FUNCTIONS ------------------------------------------------------- + +#define GLADE_HOOKUP_OBJECT(component,widget,name) \ + g_object_set_data_full (G_OBJECT (component), name, \ + gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref) + +#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \ + g_object_set_data (G_OBJECT (component), name, widget) + +#define lookup_widget(x,w) \ + (GtkWidget*) g_object_get_data(G_OBJECT(x), w) + +static GdkPixbuf *load_banner(void) +{ + extern const GdkPixdata startbanner_pixdata; + return gdk_pixbuf_from_pixdata(&startbanner_pixdata, FALSE, NULL); +} + +static void SetPage(int n) +{ + if (!gtkenabled || !startwin) return; + gtk_notebook_set_current_page(GTK_NOTEBOOK(lookup_widget(startwin,"tabs")), n); +} + +static void EnableConfig(int n) +{ + // each control in the config page vertical layout plus the dialogue buttons should be made (in)sensitive + mode = n; + gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"buttons")), + (GtkCallback)gtk_widget_set_sensitive, (gpointer)mode); + gtk_container_foreach(GTK_CONTAINER(lookup_widget(startwin,"configvlayout")), + (GtkCallback)gtk_widget_set_sensitive, (gpointer)mode); +} + +static void on_vmode3dcombo_changed(GtkComboBox *, gpointer); +static void PopulateForm(void) +{ + int mode3d, i; + GtkListStore *modes3d; + GtkTreeIter iter; + GtkComboBox *box3d; + char buf[64]; + + mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); + if (mode3d < 0) { + int i, cd[] = { 32, 24, 16, 15, 8, 0 }; + for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp3d) i++; else break; } + for ( ; cd[i]; i++) { + mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, cd[i], settings.fullscreen, 1); + if (mode3d < 0) continue; + settings.bpp3d = cd[i]; + break; + } + } + + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"fullscreencheck")), settings.fullscreen); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"alwaysshowcheck")), settings.forcesetup); + + box3d = GTK_COMBO_BOX(lookup_widget(startwin,"vmode3dcombo")); + modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(box3d)); + gtk_list_store_clear(modes3d); + + for (i=0; i aptr) + gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)-1); +#if GTK_CHECK_VERSION(2,6,0) + gtk_text_buffer_backspace(textbuffer, &enditer, FALSE, TRUE); +#else + { + GtkTextIter iter2 = enditer; + gtk_text_iter_backward_cursor_position(&iter2); + //FIXME: this seems be deleting one too many chars somewhere! + if (!gtk_text_iter_equal(&iter2, &enditer)) + gtk_text_buffer_delete_interactive(textbuffer, &iter2, &enditer, TRUE); + } +#endif + aptr = ++bptr; + break; + case 0: + if (bptr > aptr) + gtk_text_buffer_insert(textbuffer, &enditer, (const gchar *)aptr, (gint)(bptr-aptr)); + aptr = bptr; + break; + case '\r': // FIXME + default: + bptr++; + break; + } + } + + mark = gtk_text_buffer_create_mark(textbuffer, NULL, &enditer, 1); + gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(textview), mark, 0.0, FALSE, 0.0, 1.0); + gtk_text_buffer_delete_mark(textbuffer, mark); + + return 0; +} + +int startwin_settitle(const char *title) +{ + if (!gtkenabled) return 0; + if (!startwin) return 1; + gtk_window_set_title (GTK_WINDOW (startwin), title); + return 0; +} + +int startwin_idle(void *s) +{ + if (!gtkenabled) return 0; + //if (!startwin) return 1; + gtk_main_iteration_do (FALSE); + return 0; +} + +extern int xdimgame, ydimgame, bppgame, forcesetup; + +int startwin_run(void) +{ + if (!gtkenabled) return 0; + if (!startwin) return 1; + + SetPage(TAB_CONFIG); + EnableConfig(TRUE); + + settings.fullscreen = ScreenMode; + settings.xdim3d = ScreenWidth; + settings.ydim3d = ScreenHeight; + settings.bpp3d = ScreenBPP; + settings.forcesetup = ForceSetup; + settings.usemouse = UseMouse; + settings.usejoy = UseJoystick; + PopulateForm(); + + gtk_main(); + + SetPage(TAB_MESSAGES); + EnableConfig(FALSE); + if (retval) { + ScreenMode = settings.fullscreen; + ScreenWidth = settings.xdim3d; + ScreenHeight = settings.ydim3d; + ScreenBPP = settings.bpp3d; + ForceSetup = settings.forcesetup; + UseMouse = settings.usemouse; + UseJoystick = settings.usejoy; + } + + return retval; +} + diff --git a/polymer/eduke32/source/startwin.game.c b/polymer/eduke32/source/startwin.game.c new file mode 100755 index 000000000..b5dc6ceb8 --- /dev/null +++ b/polymer/eduke32/source/startwin.game.c @@ -0,0 +1,431 @@ +#ifndef RENDERTYPEWIN +#error Only for Windows +#endif + +#include "duke3d.h" + +#include "build.h" +#include "winlayer.h" +#include "compat.h" + +#define WIN32_LEAN_AND_MEAN +#include +#include +#define _WIN32_IE 0x0300 +#include +#include + +#include "startwin.game.h" + +#define TAB_CONFIG 0 +#define TAB_MESSAGES 1 + +static struct { + int fullscreen; + int xdim, ydim, bpp; + int forcesetup; + int usemouse, usejoy; +} settings; + +static HWND startupdlg = NULL; +static HWND pages[2] = { NULL, NULL}; +static int done = -1; + +static void PopulateForm(void) +{ + int i,j; + char buf[64]; + int mode; + HWND hwnd; + + hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE); + + mode = checkvideomode(&settings.xdim, &settings.ydim, settings.bpp, settings.fullscreen, 1); + if (mode < 0) { + int cd[] = { 32, 24, 16, 15, 8, 0 }; + for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp) i++; else break; } + for ( ; cd[i]; i++) { + mode = checkvideomode(&settings.xdim, &settings.ydim, cd[i], settings.fullscreen, 1); + if (mode < 0) continue; + settings.bpp = cd[i]; + break; + } + } + + Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCFULLSCREEN), (settings.fullscreen ? BST_CHECKED : BST_UNCHECKED)); + Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCALWAYSSHOW), (settings.forcesetup ? BST_CHECKED : BST_UNCHECKED)); + + ComboBox_ResetContent(hwnd); + for (i=0; iidFrom != WIN_STARTWIN_TABCTL) break; + cur = (int)SendMessage(nmhdr->hwndFrom, TCM_GETCURSEL,0,0); + switch (nmhdr->code) { + case TCN_SELCHANGING: { + if (cur < 0 || !pages[cur]) break; + ShowWindow(pages[cur],SW_HIDE); + return TRUE; + } + case TCN_SELCHANGE: { + if (cur < 0 || !pages[cur]) break; + ShowWindow(pages[cur],SW_SHOW); + return TRUE; + } + } + break; + } + + case WM_CLOSE: + done = 0; + return TRUE; + + case WM_DESTROY: + if (hbmp) { + DeleteObject(hbmp); + hbmp = NULL; + } + + if (pages[TAB_CONFIG]) { + DestroyWindow(pages[TAB_CONFIG]); + pages[TAB_CONFIG] = NULL; + } + + startupdlg = NULL; + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case WIN_STARTWIN_CANCEL: done = 0; return TRUE; + case WIN_STARTWIN_START: done = 1; return TRUE; + } + return FALSE; + + case WM_CTLCOLORSTATIC: + if ((HWND)lParam == pages[TAB_MESSAGES]) + return (BOOL)GetSysColorBrush(COLOR_WINDOW); + break; + + default: break; + } + + return FALSE; +} + + +int startwin_open(void) +{ + INITCOMMONCONTROLSEX icc; + if (startupdlg) return 1; + icc.dwSize = sizeof(icc); + icc.dwICC = ICC_TAB_CLASSES; + InitCommonControlsEx(&icc); + startupdlg = CreateDialog((HINSTANCE)win_gethinstance(), MAKEINTRESOURCE(WIN_STARTWIN), NULL, startup_dlgproc); + if (startupdlg) { + SetPage(TAB_MESSAGES); + EnableConfig(0); + return 0; + } + return -1; +} + +int startwin_close(void) +{ + if (!startupdlg) return 1; + DestroyWindow(startupdlg); + startupdlg = NULL; + return 0; +} + +int startwin_puts(const char *buf) +{ + const char *p = NULL, *q = NULL; + char workbuf[1024]; + static int newline = 0; + int curlen, linesbefore, linesafter; + HWND edctl; + int vis; + + if (!startupdlg) return 1; + + edctl = pages[TAB_MESSAGES]; + if (!edctl) return -1; + + vis = ((int)SendMessage(GetDlgItem(startupdlg, WIN_STARTWIN_TABCTL), TCM_GETCURSEL,0,0) == TAB_MESSAGES); + + if (vis) SendMessage(edctl, WM_SETREDRAW, FALSE,0); + curlen = SendMessage(edctl, WM_GETTEXTLENGTH, 0,0); + SendMessage(edctl, EM_SETSEL, (WPARAM)curlen, (LPARAM)curlen); + linesbefore = SendMessage(edctl, EM_GETLINECOUNT, 0,0); + p = buf; + while (*p) { + if (newline) { + SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)"\r\n"); + newline = 0; + } + q = p; + while (*q && *q != '\n') q++; + memcpy(workbuf, p, q-p); + if (*q == '\n') { + if (!q[1]) { + newline = 1; + workbuf[q-p] = 0; + } else { + workbuf[q-p] = '\r'; + workbuf[q-p+1] = '\n'; + workbuf[q-p+2] = 0; + } + p = q+1; + } else { + workbuf[q-p] = 0; + p = q; + } + SendMessage(edctl, EM_REPLACESEL, 0, (LPARAM)workbuf); + } + linesafter = SendMessage(edctl, EM_GETLINECOUNT, 0,0); + SendMessage(edctl, EM_LINESCROLL, 0, linesafter-linesbefore); + if (vis) SendMessage(edctl, WM_SETREDRAW, TRUE,0); + return 0; +} + +int startwin_settitle(const char *str) +{ + if (!startupdlg) return 1; + SetWindowText(startupdlg, str); + return 0; +} + +int startwin_idle(void *v) +{ + if (!startupdlg || !IsWindow(startupdlg)) return 0; + if (IsDialogMessage(startupdlg, (MSG*)v)) return 1; + return 0; +} + +int startwin_run(void) +{ + MSG msg; + if (!startupdlg) return 1; + + done = -1; + + SetPage(TAB_CONFIG); + EnableConfig(1); + + settings.fullscreen = ScreenMode; + settings.xdim = ScreenWidth; + settings.ydim = ScreenHeight; + settings.bpp = ScreenBPP; + settings.forcesetup = ForceSetup; + settings.usemouse = UseMouse; + settings.usejoy = UseJoystick; + PopulateForm(); + + while (done < 0) { + switch (GetMessage(&msg, NULL, 0,0)) { + case 0: done = 1; break; + case -1: return -1; + default: + if (IsWindow(startupdlg) && IsDialogMessage(startupdlg, &msg)) break; + TranslateMessage(&msg); + DispatchMessage(&msg); + break; + } + } + + SetPage(TAB_MESSAGES); + EnableConfig(0); + if (done) { + ScreenMode = settings.fullscreen; + ScreenWidth = settings.xdim; + ScreenHeight = settings.ydim; + ScreenBPP = settings.bpp; + ForceSetup = settings.forcesetup; + UseMouse = settings.usemouse; + UseJoystick = settings.usejoy; + } + + return done; +} + diff --git a/polymer/eduke32/source/startwin.game.h b/polymer/eduke32/source/startwin.game.h new file mode 100755 index 000000000..358ed0135 --- /dev/null +++ b/polymer/eduke32/source/startwin.game.h @@ -0,0 +1,23 @@ +// resource ids +#define WIN_STARTWIN 1000 +#define WIN_STARTWINPAGE_CONFIG 2000 +#define WIN_STARTWIN_BITMAP 100 // banner bitmap +#define WIN_STARTWIN_TABCTL 101 +#define WIN_STARTWIN_CANCEL 102 +#define WIN_STARTWIN_START 103 + +#define WIN_STARTWIN_MESSAGES 104 // output list box + +#define RSRC_ICON 100 +#define RSRC_BMP 200 + +// config page +#define IDCFULLSCREEN 100 +#define IDCVMODE 101 +#define IDCSOUNDDRV 102 +#define IDCMIDIDEV 103 +#define IDCCDADEV 104 +#define IDCINPUTMOUSE 105 +#define IDCINPUTJOY 106 +#define IDCALWAYSSHOW 107 +