GRP selection from JonoF

git-svn-id: https://svn.eduke32.com/eduke32@214 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-07-07 18:41:05 +00:00
parent 7a742f1646
commit 6bab975972
18 changed files with 909 additions and 571 deletions

View file

@ -6,13 +6,13 @@ Type=0
Ver=1 Ver=1
ObjFiles= ObjFiles=
Includes=..\include Includes=..\include
Libs=C:\sdks\msc\dx7\include Libs=C:\sdks\directx\dx7\include
PrivateResource=Build_private.rc PrivateResource=Build_private.rc
ResourceIncludes=..\ ResourceIncludes=..\;..\include
MakeIncludes= MakeIncludes=
Compiler=-DRENDERTYPEWIN=1_@@_-DSUPERBUILD_@@_-DPOLYMOST_@@_-DUSE_OPENGL_@@_-DDYNAMIC_OPENGL_@@_-DNO_GCC_BUILTINS_@@_-DUNDERSCORES_@@_-funsigned-char_@@_ Compiler=-DRENDERTYPEWIN=1_@@_-DSUPERBUILD_@@_-DPOLYMOST_@@_-DUSE_OPENGL_@@_-DDYNAMIC_OPENGL_@@_-DNO_GCC_BUILTINS_@@_-DUNDERSCORES_@@_-funsigned-char_@@_-fno-strict-aliasing_@@_
CppCompiler= CppCompiler=
Linker=libeditor.a_@@_libengine.a_@@_-ldxguid_@@_-lws2_32_@@_ Linker=libeditor.a_@@_libengine.a_@@_-ldxguid_@@_-lws2_32_@@_-lcomctl32_@@_
IsCpp=0 IsCpp=0
Icon= Icon=
ExeOutput=..\devcpp ExeOutput=..\devcpp
@ -48,17 +48,8 @@ ProductVersion=
AutoIncBuildNr=0 AutoIncBuildNr=0
[Unit1] [Unit1]
FileName=..\src\bstub.c
CompileCpp=0
Folder=KenBuild Editor
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit2]
FileName=..\src\misc\buildres.rc FileName=..\src\misc\buildres.rc
CompileCpp=0
Folder=KenBuild Editor Folder=KenBuild Editor
Compile=1 Compile=1
Link=0 Link=0
@ -66,3 +57,13 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit2]
FileName=..\testgame\bstub.c
Folder=KenBuild Editor
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
CompileCpp=0

View file

@ -5,14 +5,14 @@ UnitCount=5
Type=0 Type=0
Ver=1 Ver=1
ObjFiles= ObjFiles=
Includes=..\include;C:\sdks\fmodapi373win\api\inc Includes=..\include;..\testgame;..\..\jfaud\inc
Libs=C:\sdks\msc\dx7\include;C:\sdks\fmodapi373win\api\lib Libs=C:\sdks\directx\dx7\include;..\..\jfaud
PrivateResource=Game_private.rc PrivateResource=Game_private.rc
ResourceIncludes=..\ ResourceIncludes=..\;..\testgame
MakeIncludes= MakeIncludes=
Compiler=-DRENDERTYPEWIN=1_@@_-DSUPERBUILD_@@_-DPOLYMOST_@@_-DUSE_OPENGL_@@_-DDYNAMIC_OPENGL_@@_-DNO_GCC_BUILTINS_@@_-DUNDERSCORES_@@_-funsigned-char_@@_ Compiler=-DRENDERTYPEWIN=1_@@_-DSUPERBUILD_@@_-DPOLYMOST_@@_-DUSE_OPENGL_@@_-DDYNAMIC_OPENGL_@@_-DNO_GCC_BUILTINS_@@_-DUNDERSCORES_@@_-funsigned-char_@@_-fno-strict-aliasing_@@_
CppCompiler= CppCompiler=
Linker=libeditor.a_@@_libengine.a_@@_-ldxguid_@@_-lws2_32_@@_-lfmod_@@_ Linker=libeditor.a_@@_libengine.a_@@_-ldxguid_@@_-lws2_32_@@_-lsupc++_@@_-lcomctl32_@@_-ljfaud_@@_-lwinmm_@@_
IsCpp=0 IsCpp=0
Icon= Icon=
ExeOutput=..\devcpp ExeOutput=..\devcpp
@ -48,9 +48,9 @@ ProductVersion=
AutoIncBuildNr=0 AutoIncBuildNr=0
[Unit3] [Unit3]
FileName=..\src\sound.c FileName=..\testgame\startwin.game.c
CompileCpp=0 CompileCpp=0
Folder=KenBuild Editor Folder=KenBuild Game
Compile=1 Compile=1
Link=1 Link=1
Priority=1000 Priority=1000
@ -58,13 +58,14 @@ OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit4] [Unit4]
FileName=..\src\misc\gameres.rc FileName=..\testgame\jfaud_sound.cpp
Folder=KenBuild Game Folder=KenBuild Game
Compile=1 Compile=1
Link=0 Link=1
Priority=1000 Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
CompileCpp=0
[Unit1] [Unit1]
FileName=..\src\config.c FileName=..\src\config.c
@ -76,18 +77,8 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit2]
FileName=..\src\game.c
CompileCpp=0
Folder=KenBuild Editor
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit5] [Unit5]
FileName=..\src\gamestartwin.c FileName=..\testgame\game.c
CompileCpp=0 CompileCpp=0
Folder=KenBuild Game Folder=KenBuild Game
Compile=1 Compile=1
@ -96,3 +87,22 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit6]
FileName=..\testgame\game.c
CompileCpp=0
Folder=KenBuild Game
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit2]
FileName=..\src\misc\gameres.rc
Folder=KenBuild Game
Compile=1
Link=0
Priority=1000
OverrideBuildCmd=0
BuildCmd=

View file

@ -1,5 +0,0 @@
const char _engine_cflags[] = "Dev-C++ made this";
const char _engine_libs[] = "Dev-C++ made this";
const char _engine_uname[] = "Dev-C++";
const char _engine_compiler[] = "Dev-C++";
const char _engine_date[] = __DATE__ " " __TIME__;

View file

@ -48,9 +48,9 @@ ProductVersion=
AutoIncBuildNr=0 AutoIncBuildNr=0
[Unit3] [Unit3]
FileName=..\src\buildstartwin.c FileName=..\src\startwin.editor.c
CompileCpp=0 CompileCpp=0
Folder=KenBuild Editor Folder=Build Editor library
Compile=1 Compile=1
Link=1 Link=1
Priority=1000 Priority=1000

View file

@ -1,16 +1,16 @@
[Project] [Project]
FileName=libEngine.dev FileName=libEngine.dev
Name=Build Engine library Name=Build Engine library
UnitCount=15 UnitCount=18
Type=2 Type=2
Ver=1 Ver=1
ObjFiles= ObjFiles=
Includes=..\include;..\src;C:\sdks\msc\dx7\include Includes=..\include;..\src;C:\sdks\directx\dx7\include
Libs= Libs=
PrivateResource= PrivateResource=
ResourceIncludes= ResourceIncludes=
MakeIncludes= MakeIncludes=
Compiler=-DRENDERTYPEWIN=1_@@_-DSUPERBUILD_@@_-DPOLYMOST_@@_-DUSE_OPENGL_@@_-DDYNAMIC_OPENGL_@@_-DNO_GCC_BUILTINS_@@_-DUNDERSCORES_@@_-DKSFORBUILD_@@_-funsigned-char_@@_ Compiler=-DRENDERTYPEWIN=1_@@_-DSUPERBUILD_@@_-DPOLYMOST_@@_-DUSE_OPENGL_@@_-DDYNAMIC_OPENGL_@@_-DNO_GCC_BUILTINS_@@_-DUNDERSCORES_@@_-DKSFORBUILD_@@_-funsigned-char_@@_-fno-strict-aliasing_@@_
CppCompiler= CppCompiler=
Linker= Linker=
IsCpp=0 IsCpp=0
@ -196,3 +196,33 @@ Priority=1000
OverrideBuildCmd=0 OverrideBuildCmd=0
BuildCmd= BuildCmd=
[Unit16]
FileName=..\src\md4.c
CompileCpp=0
Folder=Build Engine library
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit17]
FileName=..\src\lzf_d.c
CompileCpp=0
Folder=Build Engine library
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=
[Unit18]
FileName=..\src\lzf_c.c
CompileCpp=0
Folder=Build Engine library
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

View file

@ -355,6 +355,7 @@ OTHER VARIABLES:
you call the loadboard function. you call the loadboard function.
***************************************************************************/ ***************************************************************************/
int preinitengine(void); // a partial setup of the engine used for launch windows
int initengine(void); int initengine(void);
void uninitengine(void); void uninitengine(void);
void initspritelists(void); void initspritelists(void);

View file

@ -20,6 +20,7 @@ int scriptfile_getbraces(scriptfile *sf, char **braceend);
scriptfile *scriptfile_fromfile(char *fn); scriptfile *scriptfile_fromfile(char *fn);
scriptfile *scriptfile_fromstring(char *string); scriptfile *scriptfile_fromstring(char *string);
void scriptfile_close(scriptfile *sf); void scriptfile_close(scriptfile *sf);
int scriptfile_eof(scriptfile *sf);
int scriptfile_getsymbolvalue(char *name, int *val); int scriptfile_getsymbolvalue(char *name, int *val);
int scriptfile_addsymbolvalue(char *name, int val); int scriptfile_addsymbolvalue(char *name, int val);

View file

@ -5454,13 +5454,38 @@ static void sighandler(int sig, const siginfo_t *info, void *ctx)
} }
#endif #endif
//
// preinitengine
//
static int preinitcalled = 0;
int preinitengine(void)
{
char *e;
if (initsystem()) exit(1);
if ((e = Bgetenv("BUILD_NOP6")) != NULL)
if (!Bstrcasecmp(e, "TRUE")) {
Bprintf("Disabling P6 optimizations.\n");
dommxoverlay = 0;
}
if (dommxoverlay) mmxoverlay();
validmodecnt = 0;
getvalidmodes();
initcrc32table();
preinitcalled = 1;
return 0;
}
// //
// initengine // initengine
// //
int initengine(void) int initengine(void)
{ {
long i, j; long i, j;
char *e;
#if !defined _WIN32 && defined DEBUGGINGAIDS #if !defined _WIN32 && defined DEBUGGINGAIDS
struct sigaction sigact, oldact; struct sigaction sigact, oldact;
@ -5469,15 +5494,10 @@ int initengine(void)
sigact.sa_flags = SA_SIGINFO; sigact.sa_flags = SA_SIGINFO;
sigaction(SIGFPE, &sigact, &oldact); sigaction(SIGFPE, &sigact, &oldact);
#endif #endif
if (!preinitcalled) {
if (initsystem()) exit(1); i = preinitengine();
if (i) return i;
if ((e = Bgetenv("BUILD_NOP6")) != NULL) }
if (!Bstrcasecmp(e, "TRUE")) {
Bprintf("Disabling P6 optimizations.\n");
dommxoverlay = 0;
}
if (dommxoverlay) mmxoverlay();
if (loadtables()) return 1; if (loadtables()) return 1;
@ -5518,8 +5538,6 @@ int initengine(void)
clearbuf(&show2dwall[0],(long)((MAXWALLS+3)>>5),0L); clearbuf(&show2dwall[0],(long)((MAXWALLS+3)>>5),0L);
automapping = 0; automapping = 0;
validmodecnt = 0;
pointhighlight = -1; pointhighlight = -1;
linehighlight = -1; linehighlight = -1;
highlightcnt = 0; highlightcnt = 0;
@ -5531,14 +5549,11 @@ int initengine(void)
captureformat = 0; captureformat = 0;
loadpalette(); loadpalette();
getvalidmodes();
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
if (!hicfirstinit) hicinit(); if (!hicfirstinit) hicinit();
if (!mdinited) mdinit(); if (!mdinited) mdinit();
#endif #endif
initcrc32table();
return 0; return 0;
} }

View file

@ -321,6 +321,12 @@ void scriptfile_close(scriptfile *sf)
free(sf); free(sf);
} }
int scriptfile_eof(scriptfile *sf)
{
skipoverws(sf);
if (sf->textptr >= sf->eof) return 1;
return 0;
}
#define SYMBTABSTARTSIZE 256 #define SYMBTABSTARTSIZE 256
static int symbtablength=0, symbtaballoclength=0; static int symbtablength=0, symbtaballoclength=0;

View file

@ -106,7 +106,7 @@ EDITOROBJS=$(OBJ)astub.$o
ifeq ($(PLATFORM),WINDOWS) ifeq ($(PLATFORM),WINDOWS)
OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include OURCFLAGS+= -DUNDERSCORES -I$(DXROOT)/include
NASMFLAGS+= -DUNDERSCORES -f win32 NASMFLAGS+= -DUNDERSCORES -f win32
GAMEOBJS+= $(OBJ)gameres.$o $(OBJ)winbits.$o $(OBJ)startwin.game.$o GAMEOBJS+= $(OBJ)gameres.$o $(OBJ)winbits.$o $(OBJ)startwin.game.$o $(OBJ)startdlg.$o
EDITOROBJS+= $(OBJ)buildres.$o EDITOROBJS+= $(OBJ)buildres.$o
endif endif
@ -121,7 +121,7 @@ ifeq ($(RENDERTYPE),SDL)
ifeq (1,$(HAVE_GTK2)) ifeq (1,$(HAVE_GTK2))
OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0) OURCFLAGS+= -DHAVE_GTK2 $(shell pkg-config --cflags gtk+-2.0)
GAMEOBJS+= $(OBJ)game_banner.$o $(OBJ)startgtk.game.$o GAMEOBJS+= $(OBJ)game_banner.$o $(OBJ)startgtk.game.$o $(OBJ)startdlg.$o
EDITOROBJS+= $(OBJ)editor_banner.$o EDITOROBJS+= $(OBJ)editor_banner.$o
endif endif

View file

@ -27,9 +27,12 @@ $(OBJ)astub.$o: $(SRC)astub.c $(EINC)build.h $(EINC)pragmas.h $(EINC)compat.h $(
$(OBJ)game_icon.$o: $(RSRC)game_icon.c $(OBJ)game_icon.$o: $(RSRC)game_icon.c
$(OBJ)build_icon.$o: $(RSRC)build_icon.c $(OBJ)build_icon.$o: $(RSRC)build_icon.c
$(OBJ)startdlg.$o: $(SRC)startdlg.c $(EINC)compat.h $(EINC)baselayer.h $(EINC)scriptfile.h $(EINC)cache1d.h $(EINC)crc32.h $(INC)startdlg.h
$(OBJ)gameres.$o: $(SRC)misc/gameres.rc $(SRC)startwin.game.h $(RSRC)game.bmp $(RSRC)game_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)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 $(OBJ)startwin.game.$o: $(SRC)startwin.game.c $(duke3d_h) $(EINC)build.h $(EINC)winlayer.h $(EINC)compat.h $(INC)startdlg.h
$(OBJ)startgtk.game.$o: $(SRC)startgtk.game.c $(duke3d_h) $(EINC)dynamicgtk.h $(EINC)build.h $(EINC)baselayer.h $(EINC)compat.h
# jMACT objects # 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 $(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

View file

@ -127,7 +127,7 @@ void pitch_test( void );
char restorepalette,screencapt,nomorelogohack; char restorepalette,screencapt,nomorelogohack;
int sendmessagecommand = -1; int sendmessagecommand = -1;
static char *duke3dgrp = "duke3d.grp"; // JBF 20030925 char *duke3dgrp = "duke3d.grp"; // JBF 20030925
static char *duke3ddef = "duke3d.def"; static char *duke3ddef = "duke3d.def";
extern long lastvisinc; extern long lastvisinc;
@ -7763,7 +7763,6 @@ void checkcommandline(int argc,char **argv)
if (((*c == '/') || (*c == '-')) && (!firstnet)) if (((*c == '/') || (*c == '-')) && (!firstnet))
{ {
if (!Bstrcasecmp(c+1,"setup")) { if (!Bstrcasecmp(c+1,"setup")) {
CommandSetup = 1;
i++; i++;
continue; continue;
} }
@ -7927,23 +7926,12 @@ void checkcommandline(int argc,char **argv)
continue; continue;
} }
if(*c == '?')
{
comlinehelp(argv);
exit(-1);
}
if((*c == '/') || (*c == '-')) if((*c == '/') || (*c == '-'))
{ {
c++; c++;
switch(*c) switch(*c)
{ {
default: default: break;
// printf("Unknown command line parameter '%s'\n",argv[i]);
case '?':
comlinehelp(argv);
exit(0);
case 'x': case 'x':
case 'X': case 'X':
c++; c++;
@ -8525,7 +8513,7 @@ void Startup(void)
compilecons(); compilecons();
i = CONFIG_ReadSetup(); // i = CONFIG_ReadSetup();
if (initengine()) { if (initengine()) {
wm_msgbox("Build Engine Initialisation Error", wm_msgbox("Build Engine Initialisation Error",
@ -8534,16 +8522,6 @@ void Startup(void)
exit(1); exit(1);
} }
#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)
if (i < 0 || (netparamcount == 0 && ForceSetup) || CommandSetup) {
if (quitevent | !startwin_run()) {
uninitengine();
freeconmem();
exit(0);
}
}
#endif
setupdynamictostatic(); setupdynamictostatic();
if (ud.multimode > 1) sanitizegametype(); if (ud.multimode > 1) sanitizegametype();
@ -8814,8 +8792,6 @@ void backtomenu(void)
int shareware = 0; int shareware = 0;
char *startwin_labeltext = "Starting EDuke32...";
int load_script(char *szScript) int load_script(char *szScript)
{ {
FILE* fp = fopenfrompath(szScript, "r"); FILE* fp = fopenfrompath(szScript, "r");
@ -8888,6 +8864,34 @@ void app_main(int argc,char **argv)
duke3dgrp = getenv("DUKE3DGRP"); duke3dgrp = getenv("DUKE3DGRP");
initprintf("Using `%s' as main GRP file\n", duke3dgrp); initprintf("Using `%s' as main GRP file\n", duke3dgrp);
} }
for (i=1;i<argc;i++) {
if (argv[i][0] != '-' && argv[i][0] != '/') continue;
if (!Bstrcasecmp(argv[i]+1, "setup")) CommandSetup = TRUE;
else if (!Bstrcasecmp(argv[i]+1, "?")) {
comlinehelp(argv);
exit(0);
}
}
wm_setapptitle("EDuke32");
if (preinitengine()) {
wm_msgbox("Build Engine Initialisation Error",
"There was a problem initialising the Build engine: %s", engineerrstr);
exit(1);
}
i = CONFIG_ReadSetup();
#if defined RENDERTYPEWIN || (defined RENDERTYPESDL && !defined __APPLE__ && defined HAVE_GTK2)
if (i < 0 || ForceSetup || CommandSetup) {
if (quitevent || !startwin_run()) {
uninitengine();
exit(0);
}
}
#endif
initgroupfile(duke3dgrp); initgroupfile(duke3dgrp);
i = kopen4load("DUKESW.BIN",1); // JBF 20030810 i = kopen4load("DUKESW.BIN",1); // JBF 20030810
if (i!=-1) { if (i!=-1) {

View file

@ -33,8 +33,6 @@ BEGIN
CONTROL "", IDCSOUNDDRV, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_DISABLED | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 26, 110, 56 CONTROL "", IDCSOUNDDRV, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_DISABLED | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 26, 110, 56
CONTROL "&MIDI device:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_DISABLED | WS_VISIBLE, 5, 44, 50, 8 CONTROL "&MIDI device:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_DISABLED | WS_VISIBLE, 5, 44, 50, 8
CONTROL "", IDCMIDIDEV, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_DISABLED | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 42, 110, 56 CONTROL "", IDCMIDIDEV, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_DISABLED | WS_VISIBLE | WS_VSCROLL | WS_TABSTOP, 60, 42, 110, 56
CONTROL "C&D drive:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_DISABLED | WS_VISIBLE, 5, 60, 50, 8
CONTROL "", IDCCDADEV, "COMBOBOX", CBS_DROPDOWNLIST | WS_CHILD | WS_DISABLED | 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 "Input devices:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 80, 50, 8
CONTROL "Mo&use", IDCINPUTMOUSE, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 60, 80, 49, 8 CONTROL "Mo&use", IDCINPUTMOUSE, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 60, 80, 49, 8
@ -43,4 +41,13 @@ BEGIN
CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8 CONTROL "&Always show configuration on start", IDCALWAYSSHOW, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 118, 116, 140, 8
END END
WIN_STARTWINPAGE_GAME DIALOGEX DISCARDABLE 20, 40, 279, 168
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
CAPTION "Dialog"
FONT 8, "MS Shell Dlg"
BEGIN
CONTROL "&Game or addon:", -1, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 5, 5, 100, 8
CONTROL "", IDGDATA, "LISTBOX", LBS_NOINTEGRALHEIGHT | LBS_USETABSTOPS | LBS_SORT | WS_CHILD | WS_BORDER | WS_VISIBLE | WS_TABSTOP, 10, 15, 226, 50
END
1 24 "rsrc/manifest.game.xml" 1 24 "rsrc/manifest.game.xml"

180
polymer/eduke32/source/startdlg.c Executable file
View file

@ -0,0 +1,180 @@
#include "compat.h"
#include "baselayer.h"
#include "scriptfile.h"
#include "cache1d.h"
#include "crc32.h"
#include "startdlg.h"
struct grpfile grpfiles[numgrpfiles] = {
{ "Registered Version 1.3d", 0xBBC9CE44, 26524524, NULL },
{ "Registered Version 1.4", 0x00000000, 0, NULL },
{ "Registered Version 1.5", 0xFD3DCFF1, 44356548, NULL },
{ "Shareware Version", 0x983AD923, 11035779, NULL },
{ "Mac Shareware Version", 0xC5F71561, 10444391, NULL },
{ "Mac Registered Version", 0x00000000, 0, NULL },
};
struct grpfile *foundgrps = NULL;
#define GRPCACHEFILE "grpfiles.cache"
static struct grpcache {
struct grpcache *next;
char name[BMAX_PATH+1];
int size;
int mtime;
int crcval;
} *grpcache = NULL, *usedgrpcache = NULL;
static int LoadGroupsCache(void)
{
struct grpcache *fg;
int fsize, fmtime, fcrcval;
char *fname;
scriptfile *script;
script = scriptfile_fromfile(GRPCACHEFILE);
if (!script) return -1;
while (!scriptfile_eof(script)) {
if (scriptfile_getstring(script, &fname)) break; // filename
if (scriptfile_getnumber(script, &fsize)) break; // filesize
if (scriptfile_getnumber(script, &fmtime)) break; // modification time
if (scriptfile_getnumber(script, &fcrcval)) break; // crc checksum
fg = calloc(1, sizeof(struct grpcache));
fg->next = grpcache;
grpcache = fg;
strncpy(fg->name, fname, BMAX_PATH);
fg->size = fsize;
fg->mtime = fmtime;
fg->crcval = fcrcval;
}
scriptfile_close(script);
return 0;
}
static void FreeGroupsCache(void)
{
struct grpcache *fg;
while (grpcache) {
fg = grpcache->next;
free(grpcache);
grpcache = fg;
}
}
int ScanGroups(void)
{
CACHE1D_FIND_REC *srch, *sidx;
struct grpcache *fg, *fgg;
struct grpfile *grp;
char *fn;
struct Bstat st;
initprintf("Scanning for GRP files...\n");
LoadGroupsCache();
srch = klistpath("/", "*.grp", CACHE1D_FIND_FILE);
for (sidx = srch; sidx; sidx = sidx->next) {
for (fg = grpcache; fg; fg = fg->next) {
if (!Bstrcmp(fg->name, sidx->name)) break;
}
if (fg) {
if (findfrompath(sidx->name, &fn)) continue; // failed to resolve the filename
if (Bstat(fn, &st)) { free(fn); continue; } // failed to stat the file
free(fn);
if (fg->size == st.st_size && fg->mtime == st.st_mtime) {
grp = (struct grpfile *)calloc(1, sizeof(struct grpfile));
grp->name = strdup(sidx->name);
grp->crcval = fg->crcval;
grp->size = fg->size;
grp->next = foundgrps;
foundgrps = grp;
fgg = (struct grpcache *)calloc(1, sizeof(struct grpcache));
strcpy(fgg->name, fg->name);
fgg->size = fg->size;
fgg->mtime = fg->mtime;
fgg->crcval = fg->crcval;
fgg->next = usedgrpcache;
usedgrpcache = fgg;
continue;
}
}
{
int b, fh;
int crcval;
char buf[16*512];
fh = openfrompath(sidx->name, BO_RDONLY|BO_BINARY, BS_IREAD);
if (fh < 0) continue;
if (fstat(fh, &st)) continue;
initprintf(" Checksumming %s...", sidx->name);
crc32init((unsigned long *)&crcval);
do {
b = read(fh, buf, sizeof(buf));
if (b > 0) crc32block((unsigned long *)&crcval, buf, b);
} while (b == sizeof(buf));
crc32finish((unsigned long *)&crcval);
close(fh);
initprintf(" Done\n");
grp = (struct grpfile *)calloc(1, sizeof(struct grpfile));
grp->name = strdup(sidx->name);
grp->crcval = crcval;
grp->size = st.st_size;
grp->next = foundgrps;
foundgrps = grp;
fgg = (struct grpcache *)calloc(1, sizeof(struct grpcache));
strncpy(fgg->name, sidx->name, BMAX_PATH);
fgg->size = st.st_size;
fgg->mtime = st.st_mtime;
fgg->crcval = crcval;
fgg->next = usedgrpcache;
usedgrpcache = fgg;
}
}
klistfree(srch);
FreeGroupsCache();
if (usedgrpcache) {
FILE *fp;
fp = fopen(GRPCACHEFILE, "wt");
if (fp) {
for (fg = usedgrpcache; fg; fg=fgg) {
fgg = fg->next;
fprintf(fp, "\"%s\" %d %d %d\n", fg->name, fg->size, fg->mtime, fg->crcval);
free(fg);
}
fclose(fp);
}
}
return 0;
}
void FreeGroups(void)
{
struct grpfile *fg;
while (foundgrps) {
fg = foundgrps->next;
free((char*)foundgrps->name);
free(foundgrps);
foundgrps = fg;
}
}

View file

@ -0,0 +1,12 @@
// List of internally-known GRP files
#define numgrpfiles 6
struct grpfile {
const char *name;
int crcval;
int size;
struct grpfile *next;
} grpfiles[numgrpfiles], *foundgrps;
int ScanGroups(void);
void FreeGroups(void);

File diff suppressed because it is too large Load diff

View file

@ -8,6 +8,8 @@
#include "winlayer.h" #include "winlayer.h"
#include "compat.h" #include "compat.h"
#include "startdlg.h"
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#include <windowsx.h> #include <windowsx.h>
@ -18,56 +20,79 @@
#include "startwin.game.h" #include "startwin.game.h"
#define TAB_CONFIG 0 #define TAB_CONFIG 0
#define TAB_MESSAGES 1 #define TAB_GAME 1
#define TAB_MESSAGES 2
static struct { static struct {
int fullscreen; int fullscreen;
int xdim, ydim, bpp; int xdim, ydim, bpp;
int forcesetup; int forcesetup;
int usemouse, usejoy; int usemouse, usejoy;
char selectedgrp[BMAX_PATH+1];
} settings; } settings;
static HWND startupdlg = NULL; static HWND startupdlg = NULL;
static HWND pages[2] = { NULL, NULL}; static HWND pages[3] = { NULL, NULL, NULL };
static int done = -1, mode = TAB_CONFIG; static int done = -1, mode = TAB_CONFIG;
static void PopulateForm(void) static void PopulateForm(int pgs)
{ {
int i,j;
char buf[64];
int mode;
HWND hwnd; HWND hwnd;
if (pgs & (1<<TAB_CONFIG)) {
int i,j;
char buf[64];
int mode;
hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE); hwnd = GetDlgItem(pages[TAB_CONFIG], IDCVMODE);
mode = checkvideomode(&settings.xdim, &settings.ydim, settings.bpp, settings.fullscreen, 1); mode = checkvideomode(&settings.xdim, &settings.ydim, settings.bpp, settings.fullscreen, 1);
if (mode < 0) { if (mode < 0) {
int cd[] = { 32, 24, 16, 15, 8, 0 }; int cd[] = { 32, 24, 16, 15, 8, 0 };
for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp) i++; else break; } for (i=0; cd[i]; ) { if (cd[i] >= settings.bpp) i++; else break; }
for ( ; cd[i]; i++) { for ( ; cd[i]; i++) {
mode = checkvideomode(&settings.xdim, &settings.ydim, cd[i], settings.fullscreen, 1); mode = checkvideomode(&settings.xdim, &settings.ydim, cd[i], settings.fullscreen, 1);
if (mode < 0) continue; if (mode < 0) continue;
settings.bpp = cd[i]; settings.bpp = cd[i];
break; 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; i<validmodecnt; i++) {
if (validmode[i].fs != settings.fullscreen) continue;
// all modes get added to the 3D mode list
Bsprintf(buf, "%ld x %ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
j = ComboBox_AddString(hwnd, buf);
ComboBox_SetItemData(hwnd, j, i);
if (i == mode) ComboBox_SetCurSel(hwnd, j);
}
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCINPUTMOUSE), (settings.usemouse ? BST_CHECKED : BST_UNCHECKED));
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCINPUTJOY), (settings.usejoy ? BST_CHECKED : BST_UNCHECKED));
}
if (pgs & (1<<TAB_GAME)) {
struct grpfile *fg;
int i, j;
char buf[128+BMAX_PATH];
hwnd = GetDlgItem(pages[TAB_GAME], IDGDATA);
for (fg = foundgrps; fg; fg=fg->next) {
for (i = 0; i<numgrpfiles; i++)
if (fg->crcval == grpfiles[i].crcval) break;
if (i == numgrpfiles) continue; // unrecognised grp file
Bsprintf(buf, "%s\t%s", grpfiles[i].name, fg->name);
j = ListBox_AddString(hwnd, buf);
ListBox_SetItemData(hwnd, j, (LPARAM)fg);
if (!Bstrcasecmp(fg->name, settings.selectedgrp)) ListBox_SetCurSel(hwnd, j);
} }
} }
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; i<validmodecnt; i++) {
if (validmode[i].fs != settings.fullscreen) continue;
// all modes get added to the 3D mode list
Bsprintf(buf, "%ld x %ld %dbpp", validmode[i].xdim, validmode[i].ydim, validmode[i].bpp);
j = ComboBox_AddString(hwnd, buf);
ComboBox_SetItemData(hwnd, j, i);
if (i == mode) ComboBox_SetCurSel(hwnd, j);
}
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCINPUTMOUSE), (settings.usemouse ? BST_CHECKED : BST_UNCHECKED));
Button_SetCheck(GetDlgItem(pages[TAB_CONFIG], IDCINPUTJOY), (settings.usejoy ? BST_CHECKED : BST_UNCHECKED));
} }
static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
@ -77,7 +102,7 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
switch (LOWORD(wParam)) { switch (LOWORD(wParam)) {
case IDCFULLSCREEN: case IDCFULLSCREEN:
settings.fullscreen = !settings.fullscreen; settings.fullscreen = !settings.fullscreen;
PopulateForm(); PopulateForm(1<<TAB_CONFIG);
return TRUE; return TRUE;
case IDCVMODE: case IDCVMODE:
if (HIWORD(wParam) == CBN_SELCHANGE) { if (HIWORD(wParam) == CBN_SELCHANGE) {
@ -108,6 +133,26 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
return FALSE; return FALSE;
} }
static INT_PTR CALLBACK GamePageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg) {
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDGDATA: {
int i;
i = ListBox_GetCurSel((HWND)lParam);
if (i != CB_ERR) i = ListBox_GetItemData((HWND)lParam, i);
if (i != CB_ERR) strcpy(settings.selectedgrp, ((struct grpfile*)i)->name);
return TRUE;
}
default: break;
}
break;
default: break;
}
return FALSE;
}
static void SetPage(int n) static void SetPage(int n)
@ -132,6 +177,8 @@ static void EnableConfig(int n)
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCVMODE), n); EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCVMODE), n);
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCINPUTMOUSE), n); EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCINPUTMOUSE), n);
EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCINPUTJOY), n); EnableWindow(GetDlgItem(pages[TAB_CONFIG], IDCINPUTJOY), n);
EnableWindow(GetDlgItem(pages[TAB_GAME], IDGDATA), n);
} }
static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
@ -208,10 +255,13 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
ZeroMemory(&tab, sizeof(tab)); ZeroMemory(&tab, sizeof(tab));
tab.mask = TCIF_TEXT; tab.mask = TCIF_TEXT;
tab.pszText = TEXT("Configuration"); tab.pszText = TEXT("Configuration");
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)0, (LPARAM)&tab); SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_CONFIG, (LPARAM)&tab);
tab.mask = TCIF_TEXT;
tab.pszText = TEXT("Game");
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_GAME, (LPARAM)&tab);
tab.mask = TCIF_TEXT; tab.mask = TCIF_TEXT;
tab.pszText = TEXT("Messages"); tab.pszText = TEXT("Messages");
SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)1, (LPARAM)&tab); SendMessage(hwnd, TCM_INSERTITEM, (WPARAM)TAB_MESSAGES, (LPARAM)&tab);
// Work out the position and size of the area inside the tab control for the pages // Work out the position and size of the area inside the tab control for the pages
ZeroMemory(&r, sizeof(r)); ZeroMemory(&r, sizeof(r));
@ -225,8 +275,11 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
// Create the pages and position them in the tab control, but hide them // Create the pages and position them in the tab control, but hide them
pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(), pages[TAB_CONFIG] = CreateDialog((HINSTANCE)win_gethinstance(),
MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc); MAKEINTRESOURCE(WIN_STARTWINPAGE_CONFIG), hwndDlg, ConfigPageProc);
pages[TAB_GAME] = CreateDialog((HINSTANCE)win_gethinstance(),
MAKEINTRESOURCE(WIN_STARTWINPAGE_GAME), hwndDlg, GamePageProc);
pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES); pages[TAB_MESSAGES] = GetDlgItem(hwndDlg, WIN_STARTWIN_MESSAGES);
SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW); SetWindowPos(pages[TAB_CONFIG], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
SetWindowPos(pages[TAB_GAME], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW); SetWindowPos(pages[TAB_MESSAGES], hwnd,r.left,r.top,r.right,r.bottom,SWP_HIDEWINDOW);
// Tell the editfield acting as the console to exclude the width of the scrollbar // Tell the editfield acting as the console to exclude the width of the scrollbar
@ -235,7 +288,14 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
r.left = r.top = 0; r.left = r.top = 0;
SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r); SendMessage(pages[TAB_MESSAGES], EM_SETRECTNP,0,(LPARAM)&r);
// Set a tab stop in the game data listbox
{
DWORD tabs[1] = { 150 };
ListBox_SetTabStops(GetDlgItem(pages[TAB_GAME], IDGDATA), 1, tabs);
}
SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START)); SetFocus(GetDlgItem(hwndDlg, WIN_STARTWIN_START));
SetWindowText(hwndDlg, apptitle);
} }
return FALSE; return FALSE;
} }
@ -261,8 +321,8 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
} }
case WM_CLOSE: case WM_CLOSE:
if (mode == TAB_CONFIG) done = 0; if (mode == TAB_CONFIG) done = 0;
else quitevent++; else quitevent++;
return TRUE; return TRUE;
case WM_DESTROY: case WM_DESTROY:
@ -271,6 +331,11 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
hbmp = NULL; hbmp = NULL;
} }
if (pages[TAB_GAME]) {
DestroyWindow(pages[TAB_GAME]);
pages[TAB_GAME] = NULL;
}
if (pages[TAB_CONFIG]) { if (pages[TAB_CONFIG]) {
DestroyWindow(pages[TAB_CONFIG]); DestroyWindow(pages[TAB_CONFIG]);
pages[TAB_CONFIG] = NULL; pages[TAB_CONFIG] = NULL;
@ -281,10 +346,10 @@ static INT_PTR CALLBACK startup_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam,
case WM_COMMAND: case WM_COMMAND:
switch (LOWORD(wParam)) { switch (LOWORD(wParam)) {
case WIN_STARTWIN_CANCEL: case WIN_STARTWIN_CANCEL:
if (mode == TAB_CONFIG) done = 0; if (mode == TAB_CONFIG) done = 0;
else quitevent++; else quitevent++;
return TRUE; return TRUE;
case WIN_STARTWIN_START: done = 1; return TRUE; case WIN_STARTWIN_START: done = 1; return TRUE;
} }
return FALSE; return FALSE;
@ -390,6 +455,8 @@ int startwin_idle(void *v)
return 0; return 0;
} }
extern char *duke3dgrp;
int startwin_run(void) int startwin_run(void)
{ {
MSG msg; MSG msg;
@ -397,6 +464,8 @@ int startwin_run(void)
done = -1; done = -1;
ScanGroups();
SetPage(TAB_CONFIG); SetPage(TAB_CONFIG);
EnableConfig(1); EnableConfig(1);
@ -407,7 +476,8 @@ int startwin_run(void)
settings.forcesetup = ForceSetup; settings.forcesetup = ForceSetup;
settings.usemouse = UseMouse; settings.usemouse = UseMouse;
settings.usejoy = UseJoystick; settings.usejoy = UseJoystick;
PopulateForm(); strncpy(settings.selectedgrp, duke3dgrp, BMAX_PATH);
PopulateForm(-1);
while (done < 0) { while (done < 0) {
switch (GetMessage(&msg, NULL, 0,0)) { switch (GetMessage(&msg, NULL, 0,0)) {
@ -431,6 +501,7 @@ int startwin_run(void)
ForceSetup = settings.forcesetup; ForceSetup = settings.forcesetup;
UseMouse = settings.usemouse; UseMouse = settings.usemouse;
UseJoystick = settings.usejoy; UseJoystick = settings.usejoy;
duke3dgrp = settings.selectedgrp;
} }
return done; return done;

View file

@ -1,6 +1,7 @@
// resource ids // resource ids
#define WIN_STARTWIN 1000 #define WIN_STARTWIN 1000
#define WIN_STARTWINPAGE_CONFIG 2000 #define WIN_STARTWINPAGE_CONFIG 2000
#define WIN_STARTWINPAGE_GAME 3000
#define WIN_STARTWIN_BITMAP 100 // banner bitmap #define WIN_STARTWIN_BITMAP 100 // banner bitmap
#define WIN_STARTWIN_TABCTL 101 #define WIN_STARTWIN_TABCTL 101
#define WIN_STARTWIN_CANCEL IDCANCEL #define WIN_STARTWIN_CANCEL IDCANCEL
@ -21,3 +22,6 @@
#define IDCINPUTJOY 106 #define IDCINPUTJOY 106
#define IDCALWAYSSHOW 107 #define IDCALWAYSSHOW 107
// game page
#define IDGDATA 100