From b48f3b44e3b957a103364ac3fafa08dcfaed5f80 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 28 Jul 2014 06:43:16 +0000 Subject: [PATCH] Progress towards KenBuild Editor, part 1. DONT_BUILD. git-svn-id: https://svn.eduke32.com/eduke32@4558 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/Makefile | 4 +- polymer/eduke32/Makefile.msvc | 2 +- polymer/eduke32/build/include/baselayer.h | 6 +- polymer/eduke32/build/include/build.h | 2 + polymer/eduke32/build/include/editor.h | 16 ++--- polymer/eduke32/build/src/build.c | 59 +++++++++++++----- polymer/eduke32/build/src/config.c | 8 +-- polymer/eduke32/build/src/sdlayer.c | 6 +- polymer/eduke32/build/src/winlayer.c | 6 +- polymer/eduke32/source/astub.c | 62 ++++++------------- polymer/eduke32/source/game.c | 11 +--- polymer/eduke32/source/game.h | 1 - polymer/eduke32/source/global.h | 5 +- polymer/eduke32/source/jmact/control.c | 8 +-- polymer/eduke32/source/mapster32.h | 2 + polymer/eduke32/source/osdfuncs.c | 2 +- polymer/eduke32/source/startosx.game.m | 2 - polymer/eduke32/source/testgame/src/bstub.c | 68 ++++++++++----------- polymer/eduke32/source/testgame/src/game.c | 17 ++++-- 19 files changed, 140 insertions(+), 147 deletions(-) diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index 98546ac9d..f0b521df8 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -559,7 +559,7 @@ $(TESTGAME_OBJ)/%.$o: $(TESTGAME_RSRC)/%.rc | $(TESTGAME_OBJ) $(TESTGAME_OBJ)/%.$o: $(TESTGAME_RSRC)/%.c | $(TESTGAME_OBJ) $(COMPILE_STATUS) - $(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(TESTGAME_CFLAGS) -Wno-pointer-sign -c $< -o $@ $(RECIPE_RESULT_COMPILE) + $(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(TESTGAME_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE) $(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/%.c | $(DUKE3D_OBJ) $(COMPILE_STATUS) @@ -587,7 +587,7 @@ $(DUKE3D_OBJ)/%.$o: $(DUKE3D_SRC)/misc/%.rc | $(DUKE3D_OBJ) $(DUKE3D_OBJ)/%.$o: $(DUKE3D_RSRC)/%.c | $(DUKE3D_OBJ) $(COMPILE_STATUS) - $(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -Wno-pointer-sign -c $< -o $@ $(RECIPE_RESULT_COMPILE) + $(RECIPE_IF) $(COMPILER) $(COMMONFLAGS) $(COMPILERFLAGS) $(DUKE3D_CFLAGS) -c $< -o $@ $(RECIPE_RESULT_COMPILE) $(DUKE3D_RSRC)/game_banner.c: $(DUKE3D_RSRC)/game.bmp echo "#include " > $@ diff --git a/polymer/eduke32/Makefile.msvc b/polymer/eduke32/Makefile.msvc index 74920b0dc..1caba8738 100644 --- a/polymer/eduke32/Makefile.msvc +++ b/polymer/eduke32/Makefile.msvc @@ -328,7 +328,7 @@ CHECKDIR_AUDIOLIB=@if not exist "$(AUDIOLIB_OBJ)" mkdir "$(AUDIOLIB_OBJ)" {$(DUKE3D_SRC)\misc}.rc{$(DUKE3D_OBJ)\}.$(res): $(CHECKDIR_DUKE3D) - $(RC) /i$(ENGINE_INC)\ /i$(DUKE3D_SRC)\ /DPOLYMER /fo$@ /r $< + $(RC) /i$(ENGINE_INC)\ /i$(DUKE3D_SRC)\ /i$(DUKE3D_RSRC)\ /DPOLYMER /fo$@ /r $< # TARGETS diff --git a/polymer/eduke32/build/include/baselayer.h b/polymer/eduke32/build/include/baselayer.h index f6196745f..c7e9b959b 100644 --- a/polymer/eduke32/build/include/baselayer.h +++ b/polymer/eduke32/build/include/baselayer.h @@ -198,9 +198,9 @@ extern double vid_gamma, vid_contrast, vid_brightness; //int32_t switchrendermethod(int32_t,int32_t); // 0 = software, 1 = opengl | bool = reinit -int32_t wm_msgbox(char *name, char *fmt, ...) ATTRIBUTE((format(printf,2,3))); -int32_t wm_ynbox(char *name, char *fmt, ...) ATTRIBUTE((format(printf,2,3))); -void wm_setapptitle(char *name); +int32_t wm_msgbox(const char *name, const char *fmt, ...) ATTRIBUTE((format(printf,2,3))); +int32_t wm_ynbox(const char *name, const char *fmt, ...) ATTRIBUTE((format(printf,2,3))); +void wm_setapptitle(const char *name); // baselayer.c int32_t baselayer_init(); diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 94443f64b..3317dffba 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -767,6 +767,8 @@ EXTERN char display_mirror; // totalclocklock: the totalclock value that is backed up once on each // drawrooms() and is used for animateoffs(). EXTERN int32_t totalclock, totalclocklock; +static inline int32_t BGetTime(void) { return totalclock; } + EXTERN int32_t numframes, randomseed; EXTERN int16_t sintable[2048]; EXTERN uint8_t palette[768]; diff --git a/polymer/eduke32/build/include/editor.h b/polymer/eduke32/build/include/editor.h index 2fd02b4f9..b4e647764 100644 --- a/polymer/eduke32/build/include/editor.h +++ b/polymer/eduke32/build/include/editor.h @@ -13,7 +13,7 @@ #define VERSION "2.0.0devel" -#define SETUPFILENAME "mapster32.cfg" +extern const char *defaultsetupfilename; extern char setupfilename[BMAX_PATH]; extern char levelname[BMAX_PATH]; @@ -97,6 +97,9 @@ extern int32_t grid, autogrid; extern int32_t editorgridextent; // in engine.c extern char game_executable[BMAX_PATH]; +extern const char* DefaultGameExec; +extern const char* DefaultGameLocalExec; + extern char program_origcwd[BMAX_PATH]; extern const char *mapster32_fullpath; extern char *testplay_addparam; @@ -266,17 +269,6 @@ void ovhscrcoords(int32_t x, int32_t y, int32_t *scrx, int32_t *scry); extern uint8_t hlsectorbitmap[MAXSECTORS>>3]; -#if defined(_WIN32) -#define DEFAULT_GAME_EXEC "eduke32.exe" -#define DEFAULT_GAME_LOCAL_EXEC "eduke32.exe" -#elif defined(__APPLE__) -#define DEFAULT_GAME_EXEC "EDuke32.app/Contents/MacOS/eduke32" -#define DEFAULT_GAME_LOCAL_EXEC "EDuke32.app/Contents/MacOS/eduke32" -#else -#define DEFAULT_GAME_EXEC "eduke32" -#define DEFAULT_GAME_LOCAL_EXEC "./eduke32" -#endif - void test_map(int32_t mode); diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index a9363de2e..ef12f2249 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -103,7 +103,9 @@ int32_t g_maxCacheSize = 8<<20; #endif static int16_t oldmousebstatus = 0; -char game_executable[BMAX_PATH] = DEFAULT_GAME_LOCAL_EXEC; + +char game_executable[BMAX_PATH] = {0}; + int32_t zlock = 0x7fffffff, zmode = 0, kensplayerheight = 32; //int16_t defaultspritecstat = 0; @@ -540,7 +542,7 @@ int32_t app_main(int32_t argc, const char **argv) OSD_RegisterFunction("vidmode","vidmode : immediately change the video mode",osdcmd_vidmode); #endif - wm_setapptitle("Mapster32"); + wm_setapptitle(AppProperName); editstatus = 1; newaspect_enable = 1; @@ -561,21 +563,20 @@ int32_t app_main(int32_t argc, const char **argv) #endif if (!Bstrcmp(argv[i], "-help") || !Bstrcmp(argv[i], "--help") || !Bstrcmp(argv[i], "-?")) { - char *s = - "Mapster32\n" - "Syntax: mapster32 [options] mapname\n" +#ifdef WM_MSGBOX_WINDOW + wm_msgbox(AppProperName, +#else + Bprintf( +#endif + "%s\n" + "Syntax: %s [options] mapname\n" "Options:\n" "\t-grp\tUse an extra GRP or ZIP file.\n" "\t-g\tSame as above.\n" #ifdef STARTUP_SETUP_WINDOW "\t-setup\tDisplays the configuration dialogue box before entering the editor.\n" #endif - ; -#ifdef WM_MSGBOX_WINDOW - wm_msgbox("Mapster32","%s",s); -#else - puts(s); -#endif + , AppProperName, AppTechnicalName); return 0; } continue; @@ -588,9 +589,20 @@ int32_t app_main(int32_t argc, const char **argv) Bstrcat(boardfilename, ".map"); //Bcanonicalisefilename(boardfilename,0); + OSD_SetFunctions( + NULL, NULL, NULL, NULL, NULL, + COMMON_clearbackground, + BGetTime, + NULL + ); + + OSD_SetParameters(0,2, 0,0, 4,0); + if (!getcwd(program_origcwd,BMAX_PATH)) program_origcwd[0] = '\0'; + Bstrncpy(game_executable, DefaultGameLocalExec, sizeof(game_executable)); + if ((i = CallExtInit()) < 0) return -1; #ifdef STARTUP_SETUP_WINDOW @@ -3892,7 +3904,7 @@ void overheadeditor(void) keystatus[88] = 0; //__clearscreen_beforecapture__ - Bsprintf(tempbuf, "Mapster32 %s", CallExtGetVer()); + Bsnprintf(tempbuf, sizeof(tempbuf), "%s %s", AppProperName, CallExtGetVer()); screencapture("captxxxx.tga", eitherSHIFT, tempbuf); showframe(1); @@ -8786,7 +8798,6 @@ void clearmidstatbar16(void) static void clearministatbar16(void) { int32_t i, col = whitecol - 21; -// static const char *tempbuf = "Mapster32" " " VERSION; begindrawing(); @@ -8803,7 +8814,7 @@ static void clearministatbar16(void) if (xdim >= 800) { - Bsprintf(tempbuf, "Mapster32 %s", CallExtGetVer()); + Bsnprintf(tempbuf, sizeof(tempbuf), "%s %s", AppProperName, CallExtGetVer()); printext16(xdim2d-(Bstrlen(tempbuf)<<3)-3, ydim2d-STATUS2DSIZ2+10, editorcolors[4],-1, tempbuf, 0); printext16(xdim2d-(Bstrlen(tempbuf)<<3)-2, ydim2d-STATUS2DSIZ2+9, editorcolors[12],-1, tempbuf, 0); } @@ -10692,10 +10703,10 @@ void test_map(int32_t mode) slen = fullparam-mapster32_fullpath+1; Bstrncpy(game_executable, mapster32_fullpath, slen); // game_executable is now expected to not be NULL-terminated! - Bstrcpy(game_executable+slen, DEFAULT_GAME_EXEC); + Bstrncpy(game_executable+slen, DefaultGameExec, sizeof(game_executable)); } else - Bstrcpy(game_executable, DEFAULT_GAME_LOCAL_EXEC); + Bstrncpy(game_executable, DefaultGameLocalExec, sizeof(game_executable)); } if (current_cwd[0] != '\0') // Temporarily changing back, @@ -10762,6 +10773,15 @@ void test_map(int32_t mode) printmessage16("Position must be in valid player space to test map!"); } +void app_crashhandler(void) +{ + if (levelname[0]) + { + append_ext_UNSAFE(levelname, "_crash.map"); + SaveBoard(levelname, M32_SB_NOEXT); + } +} + // These will be more useful in the future... static const char *CallExtGetVer(void) { @@ -10803,10 +10823,16 @@ static void CallExtPreLoadMap(void) } static void CallExtSetupMapFilename(const char *mapname) { + Bstrncpy(levelname, mapname, sizeof(levelname)); + + Bsnprintf(tempbuf, sizeof(tempbuf), "%s - %s", AppProperName, mapname); + wm_setapptitle(tempbuf); + ExtSetupMapFilename(mapname); } static void CallExtLoadMap(const char *mapname) { + CallExtSetupMapFilename(mapname); ExtLoadMap(mapname); VM_OnEvent(EVENT_LOADMAP, -1); } @@ -10818,6 +10844,7 @@ static int32_t CallExtPreSaveMap(void) static void CallExtSaveMap(const char *mapname) { ExtSaveMap(mapname); + saveboard("backup.map", &pos, ang, cursectnum); VM_OnEvent(EVENT_SAVEMAP, -1); } static const char *CallExtGetSectorCaption(int16_t sectnum) diff --git a/polymer/eduke32/build/src/config.c b/polymer/eduke32/build/src/config.c index ce3aa4532..852790bae 100644 --- a/polymer/eduke32/build/src/config.c +++ b/polymer/eduke32/build/src/config.c @@ -283,7 +283,7 @@ void writesettings(void) // save binds and aliases to _m32_settings.cfg char *ptr = Xstrdup(setupfilename); char tempbuf[128]; - if (!Bstrcmp(setupfilename, SETUPFILENAME)) + if (!Bstrcmp(setupfilename, defaultsetupfilename)) Bsprintf(tempbuf, "m32_settings.cfg"); else Bsprintf(tempbuf, "%s_m32_settings.cfg", strtok(ptr, ".")); @@ -291,7 +291,7 @@ void writesettings(void) // save binds and aliases to _m32_settings.cfg if (fp) { - Bfprintf(fp,"// this file is automatically generated by Mapster32\n"); + Bfprintf(fp,"// this file is automatically generated by %s\n", AppProperName); Bfprintf(fp,"// these settings take precedence over your main cfg file\n"); Bfprintf(fp,"// do not modify if you lack common sense\n"); @@ -300,7 +300,7 @@ void writesettings(void) // save binds and aliases to _m32_settings.cfg Bfclose(fp); - if (!Bstrcmp(setupfilename, SETUPFILENAME)) + if (!Bstrcmp(setupfilename, defaultsetupfilename)) OSD_Printf("Wrote m32_settings.cfg\n"); else OSD_Printf("Wrote %s_m32_settings.cfg\n",ptr); @@ -308,7 +308,7 @@ void writesettings(void) // save binds and aliases to _m32_settings.cfg return; } - if (!Bstrcmp(setupfilename, SETUPFILENAME)) + if (!Bstrcmp(setupfilename, defaultsetupfilename)) OSD_Printf("Error writing m32_settings.cfg: %s\n", strerror(errno)); else OSD_Printf("Error writing %s_m32_settings.cfg: %s\n",ptr,strerror(errno)); diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index c85d1188b..71292720a 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -149,7 +149,7 @@ HINSTANCE win_gethinstance(void) #endif -int32_t wm_msgbox(char *name, char *fmt, ...) +int32_t wm_msgbox(const char *name, const char *fmt, ...) { char buf[2048]; va_list va; @@ -190,7 +190,7 @@ int32_t wm_msgbox(char *name, char *fmt, ...) return 0; } -int32_t wm_ynbox(char *name, char *fmt, ...) +int32_t wm_ynbox(const char *name, const char *fmt, ...) { char buf[2048]; char c; @@ -257,7 +257,7 @@ int32_t wm_ynbox(char *name, char *fmt, ...) return 0; } -void wm_setapptitle(char *name) +void wm_setapptitle(const char *name) { #ifdef __ANDROID__ initprintf("wm_setapptitle called"); diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index 741c90fe2..9198ddfa9 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -222,7 +222,7 @@ HINSTANCE win_gethinstance(void) // // wm_msgbox/wm_ynbox() -- window-manager-provided message boxes // -int32_t wm_msgbox(char *name, char *fmt, ...) +int32_t wm_msgbox(const char *name, const char *fmt, ...) { char buf[2048]; va_list va; @@ -236,7 +236,7 @@ int32_t wm_msgbox(char *name, char *fmt, ...) } -int32_t wm_ynbox(char *name, char *fmt, ...) +int32_t wm_ynbox(const char *name, const char *fmt, ...) { char buf[2048]; va_list va; @@ -254,7 +254,7 @@ int32_t wm_ynbox(char *name, char *fmt, ...) // // wm_setapptitle() -- changes the window title // -void wm_setapptitle(char *name) +void wm_setapptitle(const char *name) { if (name) Bstrncpyz(apptitle, name, sizeof(apptitle)); diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index ab5ec1d06..22bf32c43 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -78,10 +78,24 @@ extern const char *s_buildInfo; const char* AppProperName = "Mapster32"; const char* AppTechnicalName = "mapster32"; +#if defined(_WIN32) +#define DEFAULT_GAME_EXEC "eduke32.exe" +#define DEFAULT_GAME_LOCAL_EXEC "eduke32.exe" +#elif defined(__APPLE__) +#define DEFAULT_GAME_EXEC "EDuke32.app/Contents/MacOS/eduke32" +#define DEFAULT_GAME_LOCAL_EXEC "EDuke32.app/Contents/MacOS/eduke32" +#else +#define DEFAULT_GAME_EXEC "eduke32" +#define DEFAULT_GAME_LOCAL_EXEC "./eduke32" +#endif + +const char* DefaultGameExec = DEFAULT_GAME_EXEC; +const char* DefaultGameLocalExec = DEFAULT_GAME_LOCAL_EXEC; + static int32_t floor_over_floor; static int32_t g_fillCurSector = 0; -// static char *startwin_labeltext = "Starting Mapster32..."; +const char* defaultsetupfilename = SETUPFILENAME; char setupfilename[BMAX_PATH] = SETUPFILENAME; int32_t fixmaponsave_sprites = 1; @@ -687,19 +701,16 @@ const char *ExtGetVer(void) void ExtSetupMapFilename(const char *mapname) { - Bstrcpy(levelname, mapname); - - Bsprintf(tempbuf, "Mapster32 - %s", mapname); - wm_setapptitle(tempbuf); + UNREFERENCED_PARAMETER(mapname); } void ExtLoadMap(const char *mapname) { + UNREFERENCED_PARAMETER(mapname); + getmessageleng = 0; getmessagetimeoff = 0; - ExtSetupMapFilename(mapname); - // Old-fashioned multi-psky handling setup. G_SetupGlobalPsky(); @@ -714,7 +725,6 @@ void ExtLoadMap(const char *mapname) void ExtSaveMap(const char *mapname) { UNREFERENCED_PARAMETER(mapname); - saveboard("backup.map", &pos, ang, cursectnum); } @@ -8909,8 +8919,6 @@ static int32_t check_filename_casing(void) int32_t ExtPreInit(int32_t argc,const char **argv) { - wm_setapptitle("Mapster32"); - #ifdef _WIN32 { extern int32_t (*check_filename_casing_fn)(void); @@ -9623,22 +9631,6 @@ static int32_t registerosdcommands(void) } -////////// ALL THINGS OSD ////////// -static int32_t GetTime(void) -{ - return totalclock; -} - -static void m32_osdsetfunctions(void) -{ - OSD_SetFunctions( - NULL, NULL, NULL, NULL, NULL, - COMMON_clearbackground, - GetTime, - NULL - ); -} - enum { T_INCLUDE = 0, @@ -10384,9 +10376,6 @@ int32_t ExtInit(void) Bsprintf(apptitle, "Mapster32 %s %s", VERSION, s_buildRev); autosavetimer = totalclock+120*autosave; - m32_osdsetfunctions(); - - OSD_SetParameters(0,2, 0,0, 4,0); registerosdcommands(); { @@ -10454,15 +10443,6 @@ int32_t ExtPostStartupWindow(void) return 0; } -void app_crashhandler(void) -{ - if (levelname[0]) - { - append_ext_UNSAFE(levelname, "_crash.map"); - SaveBoard(levelname, M32_SB_NOEXT); - } -} - void ExtUnInit(void) { // int32_t i; @@ -11088,8 +11068,6 @@ static void Keys2d3d(void) { getmessageleng = 0; getmessagetimeoff = 0; - - m32_osdsetfunctions(); } if (getmessageleng > 0) @@ -11101,8 +11079,6 @@ static void Keys2d3d(void) } } -#undef EDUKE32_EXEC -#undef EDUKE32_LOCALEXEC void ExtCheckKeys(void) { @@ -11255,7 +11231,7 @@ void ExtCheckKeys(void) #else extern int16_t capturecount; - Bsprintf(tempbuf, "Mapster32 %s", ExtGetVer()); + Bsnprintf(tempbuf, sizeof(tempbuf), "%s %s", AppProperName, ExtGetVer()); screencapture("captxxxx.tga", eitherSHIFT, tempbuf); silentmessage("Saved screenshot %04d", capturecount-1); #endif diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 0a50503d8..e6c2b16d8 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -2934,7 +2934,7 @@ void G_GameExit(const char *msg) { char titlebuf[256]; Bsprintf(titlebuf,HEAD2 " %s",s_buildRev); - wm_msgbox(titlebuf, "%s", (char *)msg); + wm_msgbox(titlebuf, "%s", msg); } } @@ -11170,7 +11170,7 @@ int32_t app_main(int32_t argc, const char **argv) GAME_getcolumnwidth, GAME_getrowheight, GAME_clearbackground, - GetTime, + BGetTime, GAME_onshowosd ); @@ -11441,7 +11441,7 @@ int32_t app_main(int32_t argc, const char **argv) if (g_networkMode != NET_DEDICATED_SERVER) { - if (CONTROL_Startup(controltype_keyboardandmouse, &GetTime, TICRATE)) + if (CONTROL_Startup(controltype_keyboardandmouse, &BGetTime, TICRATE)) { ERRprintf("There was an error initializing the CONTROL system.\n"); uninitengine(); @@ -12951,8 +12951,3 @@ static void G_SetupGameButtons(void) CONTROL_DefineFlag(gamefunc_Next_Weapon,FALSE); CONTROL_DefineFlag(gamefunc_Previous_Weapon,FALSE); } - -int32_t GetTime(void) -{ - return totalclock; -} diff --git a/polymer/eduke32/source/game.h b/polymer/eduke32/source/game.h index 234179bc8..76e27716a 100644 --- a/polymer/eduke32/source/game.h +++ b/polymer/eduke32/source/game.h @@ -321,7 +321,6 @@ int32_t G_DoMoveThings(void); //int32_t G_EndOfLevel(void); int32_t G_GameTextLen(int32_t x,const char *t); int32_t G_PrintGameText(int32_t hack,int32_t tile,int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t o,int32_t x1,int32_t y1,int32_t x2,int32_t y2,int32_t z); -int32_t GetTime(void); int32_t kopen4loadfrommod(const char *filename,char searchfirst); extern int32_t minitext_lowercase; int32_t minitext_(int32_t x,int32_t y,const char *t,int32_t s,int32_t p,int32_t sb); diff --git a/polymer/eduke32/source/global.h b/polymer/eduke32/source/global.h index 995045b35..d6abfa725 100644 --- a/polymer/eduke32/source/global.h +++ b/polymer/eduke32/source/global.h @@ -43,14 +43,13 @@ G_EXTERN int32_t g_interpolationLock; G_EXTERN int32_t oldipos[MAXINTERPOLATIONS]; G_EXTERN int32_t *curipos[MAXINTERPOLATIONS]; G_EXTERN int32_t bakipos[MAXINTERPOLATIONS]; -G_EXTERN int32_t connectpoint2[MAXPLAYERS]; + +#include "mmulti.h" #include "duke3d.h" #include "sector.h" #include "quotes.h" -G_EXTERN int32_t myconnectindex, numplayers; - G_EXTERN DukeStatus_t sbar; G_EXTERN actor_t actor[MAXSPRITES]; // g_tile: tile-specific data THAT DOES NOT CHANGE during the course of a game diff --git a/polymer/eduke32/source/jmact/control.c b/polymer/eduke32/source/jmact/control.c index 4658eeff8..fdecb0d7f 100644 --- a/polymer/eduke32/source/jmact/control.c +++ b/polymer/eduke32/source/jmact/control.c @@ -51,7 +51,7 @@ static int32_t CONTROL_MouseButtonClickedTime[MAXMOUSEBUTTONS], CONTROL_JoyBu static int32_t CONTROL_MouseButtonClickedState[MAXMOUSEBUTTONS], CONTROL_JoyButtonClickedState[MAXJOYBUTTONS]; static int32_t CONTROL_MouseButtonClicked[MAXMOUSEBUTTONS], CONTROL_JoyButtonClicked[MAXJOYBUTTONS]; static uint8_t CONTROL_MouseButtonClickedCount[MAXMOUSEBUTTONS], CONTROL_JoyButtonClickedCount[MAXJOYBUTTONS]; -static int32_t(*GetTime)(void); +static int32_t(*ExtGetTime)(void); int32_t CONTROL_Started = FALSE; //static int32_t ticrate; static int32_t CONTROL_DoubleClickSpeed; @@ -483,7 +483,7 @@ static void DoGetDeviceButtons( static void CONTROL_GetDeviceButtons(void) { - int32_t t = GetTime(); + int32_t t = ExtGetTime(); if (CONTROL_MouseEnabled) { @@ -821,8 +821,8 @@ int32_t CONTROL_Startup(controltype which, int32_t(*TimeFunction)(void), int32_t if (CONTROL_Started) return FALSE; - if (TimeFunction) GetTime = TimeFunction; - else GetTime = CONTROL_GetTime; + if (TimeFunction) ExtGetTime = TimeFunction; + else ExtGetTime = CONTROL_GetTime; // ticrate = ticspersecond; diff --git a/polymer/eduke32/source/mapster32.h b/polymer/eduke32/source/mapster32.h index da91395ab..6f441e92e 100644 --- a/polymer/eduke32/source/mapster32.h +++ b/polymer/eduke32/source/mapster32.h @@ -22,6 +22,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "compat.h" +#define SETUPFILENAME "mapster32.cfg" + #define TICSPERFRAME 3 // #define VULGARITY diff --git a/polymer/eduke32/source/osdfuncs.c b/polymer/eduke32/source/osdfuncs.c index d051751e3..fff6e5caa 100644 --- a/polymer/eduke32/source/osdfuncs.c +++ b/polymer/eduke32/source/osdfuncs.c @@ -107,7 +107,7 @@ void GAME_drawosdcursor(int32_t x, int32_t y, int32_t type, int32_t lastkeypress if (type) ac = SMALLFNTCURSOR; else ac = '_'-'!'+STARTALPHANUM; - if (((GetTime()-lastkeypress) & 0x40)==0) + if (((BGetTime()-lastkeypress) & 0x40)==0) rotatesprite_fs(OSD_SCALE(9*x<<16), OSD_SCALE(((y<<3)+(type?-1:2))<<16), OSD_SCALE(65536.f), 0, ac, 0, 8, 8|16); diff --git a/polymer/eduke32/source/startosx.game.m b/polymer/eduke32/source/startosx.game.m index e9d203456..07ec7a579 100644 --- a/polymer/eduke32/source/startosx.game.m +++ b/polymer/eduke32/source/startosx.game.m @@ -2,10 +2,8 @@ #import -#define GetTime xGetTime #include "duke3d.h" #include "game.h" -#undef GetTime #include "common.h" #include "common_game.h" #include "build.h" diff --git a/polymer/eduke32/source/testgame/src/bstub.c b/polymer/eduke32/source/testgame/src/bstub.c index 2e5576f70..b116c2792 100644 --- a/polymer/eduke32/source/testgame/src/bstub.c +++ b/polymer/eduke32/source/testgame/src/bstub.c @@ -17,14 +17,18 @@ #include "common_game.h" -const char* AppProperName = "Build Editor"; +const char* AppProperName = "KenBuild Editor"; const char* AppTechnicalName = "testeditor"; +#define SETUPFILENAME "testeditor.cfg" +const char *defaultsetupfilename = SETUPFILENAME; +char setupfilename[BMAX_PATH] = SETUPFILENAME; + static char tempbuf[256]; #define NUMOPTIONS 9 char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0}; -unsigned char keys[NUMBUILDKEYS] = +unsigned char default_buildkeys[NUMBUILDKEYS] = { 0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39, 0x1e,0x2c,0xd1,0xc9,0x33,0x34, @@ -32,7 +36,7 @@ unsigned char keys[NUMBUILDKEYS] = }; -static char levelname[BMAX_PATH] = ""; + //static int hang = 0; @@ -63,21 +67,21 @@ static unsigned int frameval[AVERAGEFRAMES]; static int framecnt = 0; const char *defsfilename = "kenbuild.def"; -const char *startwin_labeltext = "Starting Build Editor..."; int nextvoxid = 0; +const char *ExtGetVer(void) +{ + return s_buildRev; +} + int32_t ExtPreInit(int32_t argc,const char **argv) { UNREFERENCED_PARAMETER(argc); UNREFERENCED_PARAMETER(argv); - wm_setapptitle("BUILD by Ken Silverman"); - - G_ExtPreInit(); - OSD_SetLogFile("testeditor.log"); - initprintf("KenBuild Editor %s %s\n", s_buildRev, s_buildInfo); + initprintf("%s %s %s\n", AppProperName, s_buildRev, s_buildInfo); initprintf("Compiled %s\n", s_buildTimestamp); return 0; @@ -99,16 +103,9 @@ int ExtInit(void) initgroupfile("stuff.dat"); bpp = 8; - if (loadsetup("build.cfg") < 0) buildputs("Configuration file not found, using defaults.\n"), rv = 1; - Bmemcpy((void *)buildkeys,(void *)keys,NUMBUILDKEYS); //Trick to make build use setup.dat keys + if (loadsetup("testeditor.cfg") < 0) buildputs("Configuration file not found, using defaults.\n"), rv = 1; + Bmemcpy(buildkeys, default_buildkeys, NUMBUILDKEYS); //Trick to make build use setup.dat keys if (option[4] > 0) option[4] = 0; - if (initengine()) { - wm_msgbox("Build Engine Initialisation Error", - "There was a problem initialising the Build engine: %s", engineerrstr); - return -1; - } - initinput(); - initmouse(); //You can load your own palette lookup tables here if you just //copy the right code! @@ -121,7 +118,7 @@ int ExtInit(void) setbasepaltable(basepaltable, 1); - G_InitMultiPsky(); + Ken_InitMultiPsky(); tiletovox[PLAYER] = nextvoxid++; tiletovox[BROWNMONSTER] = nextvoxid++; @@ -175,6 +172,20 @@ void ExtPreCheckKeys(void) } } + if (keystatus[buildkeys[BK_MODE2D_3D]]) // Enter + { + getmessageleng = 0; + getmessagetimeoff = 0; + } + + if (getmessageleng > 0) + { + if (!in3dmode()) + printmessage16("%s", getmessage); + if (totalclock > getmessagetimeoff) + getmessageleng = 0; + } + #if 0 if (keystatus[0x2a]|keystatus[0x36]) { @@ -346,17 +357,12 @@ void ExtPreLoadMap(void) void ExtSetupMapFilename(const char *mapname) { - char title[256]; - - Bstrncpy(levelname, mapname, sizeof(levelname)); - - Bsnprintf(title, 256, "BUILD by Ken Silverman - %s", mapname); - wm_setapptitle(title); + UNREFERENCED_PARAMETER(mapname); } void ExtLoadMap(const char *mapname) { - ExtSetupMapFilename(mapname); + UNREFERENCED_PARAMETER(mapname); } int32_t ExtPreSaveMap(void) @@ -367,7 +373,6 @@ int32_t ExtPreSaveMap(void) void ExtSaveMap(const char *mapname) { UNREFERENCED_PARAMETER(mapname); - saveboard("backup.map", &pos, ang, cursectnum); } const char *ExtGetSectorCaption(short sectnum) @@ -558,15 +563,6 @@ void faketimerhandler(void) void M32RunScript(const char *s) { UNREFERENCED_PARAMETER(s); } void G_Polymer_UnInit(void) { } -void app_crashhandler(void) -{ - if (levelname[0]) - { - append_ext_UNSAFE(levelname, "_crash.map"); - SaveBoard(levelname, M32_SB_NOEXT); - } -} - //Just thought you might want my getnumber16 code /* getnumber16(char namestart[80], short num, int maxnumber) diff --git a/polymer/eduke32/source/testgame/src/game.c b/polymer/eduke32/source/testgame/src/game.c index 48a7ff966..edbc26900 100644 --- a/polymer/eduke32/source/testgame/src/game.c +++ b/polymer/eduke32/source/testgame/src/game.c @@ -463,10 +463,17 @@ int32_t app_main(int32_t argc, const char **argv) int i, j, k /*, l, fil, waitplayers, x1, y1, x2, y2*/; int /*other, packleng,*/ netparm; - G_ExtPreInit(); + OSD_SetFunctions( + NULL, NULL, NULL, NULL, NULL, + COMMON_clearbackground, + BGetTime, + NULL + ); + + OSD_SetParameters(0,2, 0,0, 4,0); OSD_SetLogFile("testgame.log"); - initprintf("KenBuild %s %s\n", s_buildRev, s_buildInfo); + initprintf("%s %s %s\n", AppProperName, s_buildRev, s_buildInfo); initprintf("Compiled %s\n", s_buildTimestamp); #ifdef USE_OPENGL @@ -475,7 +482,7 @@ int32_t app_main(int32_t argc, const char **argv) OSD_RegisterFunction("map", "map [filename]: load a map", osdcmd_map); #endif - wm_setapptitle("KenBuild by Ken Silverman"); + wm_setapptitle(AppProperName); Bstrcpy(boardfilename, "nukeland.map"); j = 0; netparm = argc; @@ -507,12 +514,12 @@ int32_t app_main(int32_t argc, const char **argv) return -1; } - if ((i = loadsetup("game.cfg")) < 0) + if ((i = loadsetup("testgame.cfg")) < 0) buildputs("Configuration file not found, using defaults.\n"); setbasepaltable(basepaltable, 1); - G_InitMultiPsky(); + Ken_InitMultiPsky(); #if defined STARTUP_SETUP_WINDOW if (i || forcesetup || cmdsetup) {