diff --git a/polymer/eduke32/build/include/baselayer.h b/polymer/eduke32/build/include/baselayer.h index 5176b1ae3..221ae4c2d 100644 --- a/polymer/eduke32/build/include/baselayer.h +++ b/polymer/eduke32/build/include/baselayer.h @@ -110,7 +110,7 @@ void setmousepresscallback(void (*callback)(int32_t,int32_t)); void setjoypresscallback(void (*callback)(int32_t,int32_t)); const char *getkeyname(int32_t num); const char *getjoyname(int32_t what, int32_t num); // what: 0=axis, 1=button, 2=hat -char *strtolower(char *str, int32_t len); +char *Bstrtolower(char *str); char bgetchar(void); #define bkbhit() (keyasciififoplc != keyasciififoend) diff --git a/polymer/eduke32/build/include/msvc/stdint.h b/polymer/eduke32/build/include/msvc/stdint.h index 11d8dbfd5..d02608a59 100644 --- a/polymer/eduke32/build/include/msvc/stdint.h +++ b/polymer/eduke32/build/include/msvc/stdint.h @@ -73,20 +73,20 @@ extern "C" { // so we give up on __intX for them. #if (_MSC_VER < 1300) typedef signed char int8_t; - typedef short int16_t; - typedef int int32_t; + typedef signed short int16_t; + typedef signed int int32_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #else typedef signed __int8 int8_t; - typedef __int16 int16_t; - typedef __int32 int32_t; + typedef signed __int16 int16_t; + typedef signed __int32 int32_t; typedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t; typedef unsigned __int32 uint32_t; #endif -typedef __int64 int64_t; +typedef signed __int64 int64_t; typedef unsigned __int64 uint64_t; @@ -112,11 +112,11 @@ typedef uint64_t uint_fast64_t; // 7.18.1.4 Integer types capable of holding object pointers #ifdef _WIN64 // [ - typedef __int64 intptr_t; + typedef signed __int64 intptr_t; typedef unsigned __int64 uintptr_t; #else // _WIN64 ][ - typedef _W64 int intptr_t; - typedef _W64 unsigned int uintptr_t; + typedef _W64 signed int intptr_t; + typedef _W64 unsigned int uintptr_t; #endif // _WIN64 ] // 7.18.1.5 Greatest-width integer types diff --git a/polymer/eduke32/build/include/rawinput.h b/polymer/eduke32/build/include/rawinput.h index 217a8687a..b0c6678d7 100644 --- a/polymer/eduke32/build/include/rawinput.h +++ b/polymer/eduke32/build/include/rawinput.h @@ -3,8 +3,9 @@ #include "compat.h" -void RI_PollDevices(); -int32_t RI_CaptureInput(int32_t grab, HWND target); +void RI_PollDevices(BOOL loop); +void RI_ProcessMessage(MSG *msg); +BOOL RI_CaptureInput(BOOL grab, HWND target); #ifndef VK_LBUTTON #define VK_LBUTTON 0x01 diff --git a/polymer/eduke32/build/src/baselayer.c b/polymer/eduke32/build/src/baselayer.c index 4b62233d2..027603dbf 100644 --- a/polymer/eduke32/build/src/baselayer.c +++ b/polymer/eduke32/build/src/baselayer.c @@ -52,16 +52,23 @@ struct glinfo_t glinfo = }; #endif -char *strtolower(char *str, int32_t len) +char *Bstrtolower(char *str) { - int32_t i = 0; - if (len <= 0) return str; - do + if (!str) return NULL; + { - *(str+i) = Btolower(*(str+i)); - i++; + int32_t i = 0, len = Bstrlen(str); + + if (len <= 0) return str; + + do + { + *(str+i) = Btolower(*(str+i)); + i++; + } + while (--len); } - while (--len); + return str; } diff --git a/polymer/eduke32/build/src/cache1d.c b/polymer/eduke32/build/src/cache1d.c index 7cc5f4cf1..6e0b8b38c 100644 --- a/polymer/eduke32/build/src/cache1d.c +++ b/polymer/eduke32/build/src/cache1d.c @@ -323,6 +323,26 @@ int32_t findfrompath(const char *fn, char **where) *where = Bstrdup(fn); return 0; } + else + { + char *tfn = Bstrtolower(Bstrdup(fn)); + + if (access(tfn, F_OK) >= 0) + { + *where = tfn; + return 0; + } + + Bstrupr(tfn); + + if (access(tfn, F_OK) >= 0) + { + *where = tfn; + return 0; + } + + Bfree(tfn); + } } for (pfn = (char*)fn; toupperlookup[*pfn] == '/'; pfn++); @@ -348,6 +368,8 @@ int32_t findfrompath(const char *fn, char **where) for (sp = searchpathhead; sp; sp = sp->next) { + char *tfn = Bstrdup(ffn); + strcpy(pfn, sp->path); strcat(pfn, ffn); //initprintf("Trying %s\n", pfn); @@ -355,8 +377,35 @@ int32_t findfrompath(const char *fn, char **where) { *where = pfn; Bfree(ffn); + Bfree(tfn); + return 0; + } + + //Check with all lowercase + strcpy(pfn, sp->path); + Bstrtolower(tfn); + strcat(pfn, tfn); + if (access(pfn, F_OK) >= 0) + { + *where = pfn; + Bfree(ffn); + Bfree(tfn); + return 0; + } + + //Check again with uppercase + strcpy(pfn, sp->path); + Bstrupr(tfn); + strcat(pfn, tfn); + if (access(pfn, F_OK) >= 0) + { + *where = pfn; + Bfree(ffn); + Bfree(tfn); return 0; } + + Bfree(tfn); } Bfree(pfn); Bfree(ffn); return -1; diff --git a/polymer/eduke32/build/src/glbuild.c b/polymer/eduke32/build/src/glbuild.c index b3363aa3f..fd899295a 100644 --- a/polymer/eduke32/build/src/glbuild.c +++ b/polymer/eduke32/build/src/glbuild.c @@ -334,13 +334,11 @@ int32_t loadgldriver(const char *driver) #endif } - initprintf("Loading %s\n",driver); - #if defined RENDERTYPESDL - if (SDL_GL_LoadLibrary(driver)) return -1; + if (SDL_GL_LoadLibrary(driver)) goto fail; #elif defined _WIN32 hGLDLL = LoadLibrary(driver); - if (!hGLDLL) return -1; + if (!hGLDLL) goto fail; #endif gldriver = Bstrdup(driver); @@ -471,6 +469,10 @@ int32_t loadgldriver(const char *driver) if (err) unloadgldriver(); return err; + +fail: + initprintf("Failed loading \"%s\"\n",driver); + return -1; } int32_t loadglextensions(void) @@ -921,14 +923,12 @@ int32_t loadglulibrary(const char *driver) #endif } - initprintf("Loading %s\n",driver); - #if defined _WIN32 hGLUDLL = LoadLibrary(driver); - if (!hGLUDLL) return -1; + if (!hGLUDLL) goto fail; #else gluhandle = dlopen(driver, RTLD_NOW|RTLD_GLOBAL); - if (!gluhandle) return -1; + if (!gluhandle) goto fail; #endif glulibrary = Bstrdup(driver); @@ -951,6 +951,10 @@ int32_t loadglulibrary(const char *driver) if (err) unloadglulibrary(); return err; + +fail: + initprintf("Failed loading \"%s\"\n",driver); + return -1; } int32_t unloadglulibrary(void) diff --git a/polymer/eduke32/build/src/osd.c b/polymer/eduke32/build/src/osd.c index 363925c9d..22407c476 100644 --- a/polymer/eduke32/build/src/osd.c +++ b/polymer/eduke32/build/src/osd.c @@ -1816,7 +1816,7 @@ static symbol_t *addnewsymbol(const char *name) } } hash_add(&h_osd, name, osdnumsymbols); - name = strtolower(Bstrdup(name), Bstrlen(name)); + name = Bstrtolower(Bstrdup(name)); hash_add(&h_osd, name, osdnumsymbols); Bfree((void *)name); osdsymbptrs[osdnumsymbols++] = newsymb; @@ -1857,7 +1857,7 @@ static symbol_t *findexactsymbol(const char *name) } // try it again - lname = strtolower(lname, Bstrlen(name)); + Bstrtolower(lname); i = hash_find(&h_osd,lname); Bfree(lname); diff --git a/polymer/eduke32/build/src/rawinput.c b/polymer/eduke32/build/src/rawinput.c index 5527fb724..b21921c9f 100644 --- a/polymer/eduke32/build/src/rawinput.c +++ b/polymer/eduke32/build/src/rawinput.c @@ -80,7 +80,6 @@ static inline void RI_ProcessMouse(const RAWMOUSE* rmouse) static inline void RI_ProcessKeyboard(const RAWKEYBOARD* rkbd) { uint8_t key = rkbd->MakeCode, VKey = rkbd->VKey; - uint8_t buf[2]; // for some reason rkbd->MakeCode is wrong for these // even though rkbd->VKey is right... @@ -147,16 +146,21 @@ static inline void RI_ProcessKeyboard(const RAWKEYBOARD* rkbd) if (rkbd->Flags & RI_KEY_BREAK) return; if (((keyasciififoend+1)&(KEYFIFOSIZ-1)) == keyasciififoplc) return; if ((keyasciififoend - keyasciififoplc) > 0) return; - if (ToAscii(VKey, key, &KeyboardState[0], (LPWORD)&buf[0], 0) != 1) return; - if ((OSD_OSDKey() < 128) && (Btolower(scantoasc[OSD_OSDKey()]) == Btolower(buf[0]))) return; - if (OSD_HandleChar(buf[0]) == 0) return; - keyasciififo[keyasciififoend] = buf[0]; - keyasciififoend = ((keyasciififoend+1)&(KEYFIFOSIZ-1)); + { + uint8_t buf[2]; + + if (ToAscii(VKey, key, &KeyboardState[0], (LPWORD)&buf[0], 0) != 1) return; + if ((OSD_OSDKey() < 128) && (Btolower(scantoasc[OSD_OSDKey()]) == Btolower(buf[0]))) return; + if (OSD_HandleChar(buf[0]) == 0) return; + + keyasciififo[keyasciififoend] = buf[0]; + keyasciififoend = ((keyasciififoend+1)&(KEYFIFOSIZ-1)); + } } // keyboard is always captured regardless of what we tell this function -int32_t RI_CaptureInput(int32_t grab, HWND target) +BOOL RI_CaptureInput(BOOL grab, HWND target) { RAWINPUTDEVICE raw[2]; @@ -175,7 +179,25 @@ int32_t RI_CaptureInput(int32_t grab, HWND target) return (RegisterRawInputDevices(raw, 2, sizeof(raw[0])) == FALSE); } -void RI_PollDevices() +void RI_ProcessMessage(MSG *msg) +{ + if (GET_RAWINPUT_CODE_WPARAM(msg->wParam) == RIM_INPUT) + { + UINT dwSize = sizeof(RAWINPUT); + RAWINPUT raw; + + GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, &raw, &dwSize, sizeof(RAWINPUTHEADER)); + + if (raw.header.dwType == RIM_TYPEKEYBOARD) + RI_ProcessKeyboard(&raw.data.keyboard); + else if (raw.header.dwType == RIM_TYPEMOUSE) + RI_ProcessMouse(&raw.data.mouse); + } + + DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam); +} + +void RI_PollDevices(BOOL loop) { int32_t i; MSG msg; @@ -193,23 +215,8 @@ void RI_PollDevices() MWheel = 0; - while (PeekMessage(&msg, 0, WM_INPUT, WM_INPUT, PM_REMOVE | PM_QS_INPUT)) - { - if (GET_RAWINPUT_CODE_WPARAM(msg.wParam) == RIM_INPUT) - { - UINT dwSize = sizeof(RAWINPUT); - RAWINPUT raw; - - GetRawInputData((HRAWINPUT)msg.lParam, RID_INPUT, &raw, &dwSize, sizeof(RAWINPUTHEADER)); - - if (raw.header.dwType == RIM_TYPEKEYBOARD) - RI_ProcessKeyboard(&raw.data.keyboard); - else if (raw.header.dwType == RIM_TYPEMOUSE) - RI_ProcessMouse(&raw.data.mouse); - } - - DefWindowProc(msg.hwnd, msg.message, msg.wParam, msg.lParam); - } + while (loop && PeekMessage(&msg, 0, WM_INPUT, WM_INPUT, PM_REMOVE | PM_QS_INPUT)) + RI_ProcessMessage(&msg); if (mousegrab && appactive) { diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index 31855dbcc..b37595629 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -491,7 +491,7 @@ static int32_t set_windowpos(const osdfuncparm_t *parm) // initsystem() -- init systems // -static void print_os_version(void) +static void printsysversion(void) { const char *ver = ""; @@ -528,7 +528,7 @@ static void print_os_version(void) break; } - initprintf("OS: Windows %s (%lu.%lu.%lu) %s\n", ver, osv.dwMajorVersion, osv.dwMinorVersion, + initprintf("Running under Windows %s (build %lu.%lu.%lu) %s\n", ver, osv.dwMajorVersion, osv.dwMinorVersion, osv.dwPlatformId == VER_PLATFORM_WIN32_NT ? osv.dwBuildNumber : osv.dwBuildNumber&0xffff, osv.szCSDVersion); @@ -559,7 +559,7 @@ int32_t initsystem(void) frameplace=0; lockcount=0; - print_os_version(); + printsysversion(); #if defined(USE_OPENGL) && defined(POLYMOST) if (loadgldriver(getenv("BUILD_GLDRV"))) @@ -664,7 +664,7 @@ int32_t handleevents(void) //if (frameplace && fullscreen) printf("Offscreen buffer is locked!\n"); - RI_PollDevices(); + RI_PollDevices(TRUE); if (bDInputInited) DI_PollJoysticks(); @@ -676,6 +676,13 @@ int32_t handleevents(void) if (startwin_idle((void*)&msg) > 0) continue; + if (msg.message == WM_INPUT) + { + RI_PollDevices(FALSE); + RI_ProcessMessage(&msg); + continue; + } + TranslateMessage(&msg); DispatchMessage(&msg); } @@ -829,9 +836,10 @@ inline void idle_waitevent(void) if (PeekMessage(&msg, 0, WM_INPUT, WM_INPUT, PM_QS_INPUT)) { - RI_PollDevices(); + RI_PollDevices(TRUE); return; } + Sleep(10); } while (--i); diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 988ce0dad..854061b45 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -9589,7 +9589,9 @@ int32_t ExtInit(void) #if defined(POLYMOST) && defined(USE_OPENGL) glusetexcache = -1; - initprintf("Using config file '%s'.\n",setupfilename); + if (Bstrcmp(setupfilename, "mapster32.cfg")) + initprintf("Using config file '%s'.\n",setupfilename); + if (loadsetup(setupfilename) < 0) initprintf("Configuration file not found, using defaults.\n"), rv = 1; if (glusetexcache == -1) diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 9d90daa70..6f0c444ec 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -61,7 +61,7 @@ int32_t CONFIG_FunctionNameToNum(char * func) if (i < 0) { - char *str = strtolower(Bstrdup(func),Bstrlen(func)); + char *str = Bstrtolower(Bstrdup(func)); i = hash_find(&h_gamefuncs,str); Bfree(str); diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index 0eebf4d60..54706de2b 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -124,7 +124,7 @@ extern int32_t g_scriptVersion, g_Shareware, g_gameType; #include "namesdyn.h" #define TICRATE (120) -#define GAMETICSPERSEC 26 +#define GAMETICSPERSEC 26 // used as a constant to satisfy all of the calculations written with ticrate = 26 in mind #define TICSPERFRAME 4 // this used to be TICRATE/GAMETICSPERSEC which was 4.615~ truncated to 4 by integer division #define REALGAMETICSPERSEC 30 diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 55e987828..f78716754 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -4884,7 +4884,7 @@ int32_t drawing_ror = 0; void G_SE40(int32_t smoothratio) { - if (getrendermode() != 4 && ror_sprite != -1) + if (ror_sprite != -1) { int32_t x, y, z; int16_t sect; @@ -4956,6 +4956,11 @@ void G_SE40(int32_t smoothratio) } } +#ifdef POLYMER + if (getrendermode() == 4) + polymer_setanimatesprites(G_DoSpriteAnimations, ud.camera.x, ud.camera.y, ud.cameraang, smoothratio); +#endif + drawrooms(sprite[sprite2].x + x, sprite[sprite2].y + y, z + renderz, ud.cameraang, ud.camerahoriz, sect); drawing_ror = 1 + level; @@ -5040,7 +5045,6 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) ud.camerasect = p->cursectnum; G_DoInterpolations(smoothratio); - G_AnimateCamSprite(); if (ud.camerasprite >= 0) @@ -5053,15 +5057,17 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) ud.cameraang = actor[ud.camerasprite].tempang+ mulscale16((int32_t)(((s->ang+1024-actor[ud.camerasprite].tempang)&2047)-1024),smoothratio); + G_SE40(smoothratio); + #ifdef POLYMER if (getrendermode() == 4) polymer_setanimatesprites(G_DoSpriteAnimations, s->x, s->y, ud.cameraang, smoothratio); #endif - G_SE40(smoothratio); - drawrooms(s->x,s->y,s->z-(4<<8),ud.cameraang,s->yvel,s->sectnum); + G_DoSpriteAnimations(s->x,s->y,ud.cameraang,smoothratio); + drawmasks(); } else @@ -5231,13 +5237,12 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) gotpic[MIRROR>>3] &= ~(1<<(MIRROR&7)); } + G_SE40(smoothratio); + #ifdef POLYMER if (getrendermode() == 4) - { polymer_setanimatesprites(G_DoSpriteAnimations, ud.camera.x,ud.camera.y,ud.cameraang,smoothratio); - } #endif - G_SE40(smoothratio); drawrooms(ud.camera.x,ud.camera.y,ud.camera.z,ud.cameraang,ud.camerahoriz,ud.camerasect); @@ -5273,6 +5278,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio) } G_DoSpriteAnimations(ud.camera.x,ud.camera.y,ud.cameraang,smoothratio); + drawing_ror = 0; drawmasks(); @@ -11083,7 +11089,7 @@ void app_main(int32_t argc,const char **argv) int32_t i = 0, j; char cwd[BMAX_PATH]; // extern char datetimestring[]; - ENetCallbacks callbacks = { Bmalloc, Bfree, NULL }; + ENetCallbacks callbacks = { Bmalloc, Bfree, NULL, NULL }; #ifdef RENDERTYPEWIN if (argc > 1) @@ -11222,7 +11228,7 @@ void app_main(int32_t argc,const char **argv) hash_init(&h_gamefuncs); for (i=NUMGAMEFUNCTIONS-1; i>=0; i--) { - char *str = strtolower(Bstrdup(gamefunctions[i]),Bstrlen(gamefunctions[i])); + char *str = Bstrtolower(Bstrdup(gamefunctions[i])); hash_add(&h_gamefuncs,gamefunctions[i],i); hash_add(&h_gamefuncs,str,i); Bfree(str); @@ -11291,7 +11297,8 @@ void app_main(int32_t argc,const char **argv) exit(1); } - initprintf("Using config file '%s'.\n",setupfilename); + if (Bstrcmp(setupfilename, SETUPFILENAME)) + initprintf("Using config file '%s'.\n",setupfilename); ScanGroups(); { @@ -11465,7 +11472,7 @@ CLEAN_DIRECTORY: if (i == -1) initprintf("Warning: could not find main group file '%s'!\n",g_grpNamePtr); else - initprintf("Using group file '%s' as main group file.\n", g_grpNamePtr); + initprintf("Using '%s' as main group file.\n", g_grpNamePtr); if (!g_noAutoLoad && !ud.config.NoAutoLoad) { diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 0e0526512..638deb8b4 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -1663,13 +1663,13 @@ static void C_GetNextVarType(int32_t type) /*initprintf("found xxx label of '%s'\n", label+(g_numLabels<<6));*/ if (i == g_iSpriteVarID) - lLabelID=C_GetLabelNameOffset(&actorH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + lLabelID=C_GetLabelNameOffset(&actorH,Bstrtolower(label+(g_numLabels<<6))); else if (i == g_iSectorVarID) - lLabelID=C_GetLabelNameOffset(§orH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + lLabelID=C_GetLabelNameOffset(§orH,Bstrtolower(label+(g_numLabels<<6))); else if (i == g_iWallVarID) - lLabelID=C_GetLabelNameOffset(&wallH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + lLabelID=C_GetLabelNameOffset(&wallH,Bstrtolower(label+(g_numLabels<<6))); else if (i == g_iPlayerVarID) - lLabelID=C_GetLabelNameOffset(&playerH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + lLabelID=C_GetLabelNameOffset(&playerH,Bstrtolower(label+(g_numLabels<<6))); else if (i == g_iActorVarID) lLabelID=GetDefID(label+(g_numLabels<<6)); @@ -2174,7 +2174,7 @@ static int32_t C_ParseCommand(void) C_GetNextLabelName(); //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - lLabelID=C_GetLabelNameOffset(&projectileH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + lLabelID=C_GetLabelNameOffset(&projectileH,Bstrtolower(label+(g_numLabels<<6))); //printf("LabelID is %d\n",lLabelID); if (lLabelID == -1) { @@ -3153,7 +3153,7 @@ static int32_t C_ParseCommand(void) C_GetNextLabelName(); //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - lLabelID=C_GetLabelNameID(SectorLabels,§orH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + lLabelID=C_GetLabelNameID(SectorLabels,§orH,Bstrtolower(label+(g_numLabels<<6))); if (lLabelID == -1) { @@ -3288,7 +3288,7 @@ static int32_t C_ParseCommand(void) C_GetNextLabelName(); //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - lLabelID=C_GetLabelNameID(WallLabels,&wallH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + lLabelID=C_GetLabelNameID(WallLabels,&wallH,Bstrtolower(label+(g_numLabels<<6))); if (lLabelID == -1) { @@ -3355,7 +3355,7 @@ static int32_t C_ParseCommand(void) C_GetNextLabelName(); //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - lLabelID=C_GetLabelNameOffset(&playerH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + lLabelID=C_GetLabelNameOffset(&playerH,Bstrtolower(label+(g_numLabels<<6))); //printf("LabelID is %d\n",lLabelID); if (lLabelID == -1) { @@ -3436,7 +3436,7 @@ static int32_t C_ParseCommand(void) C_GetNextLabelName(); //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - lLabelID=C_GetLabelNameOffset(&inputH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + lLabelID=C_GetLabelNameOffset(&inputH,Bstrtolower(label+(g_numLabels<<6))); //printf("LabelID is %d\n",lLabelID); if (lLabelID == -1) { @@ -3487,7 +3487,7 @@ static int32_t C_ParseCommand(void) C_GetNextLabelName(); //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - lLabelID=C_GetLabelNameID(UserdefsLabels,&userdefH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + lLabelID=C_GetLabelNameID(UserdefsLabels,&userdefH,Bstrtolower(label+(g_numLabels<<6))); if (lLabelID == -1) { @@ -3691,7 +3691,7 @@ static int32_t C_ParseCommand(void) C_GetNextLabelName(); //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - lLabelID=C_GetLabelNameOffset(&actorH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + lLabelID=C_GetLabelNameOffset(&actorH,Bstrtolower(label+(g_numLabels<<6))); //printf("LabelID is %d\n",lLabelID); if (lLabelID == -1) { @@ -3770,7 +3770,7 @@ static int32_t C_ParseCommand(void) C_GetNextLabelName(); //printf("found xxx label of '%s'\n", label+(g_numLabels<<6)); - lLabelID=C_GetLabelNameOffset(&tspriteH,strtolower(label+(g_numLabels<<6),Bstrlen(label+(g_numLabels<<6)))); + lLabelID=C_GetLabelNameOffset(&tspriteH,Bstrtolower(label+(g_numLabels<<6))); //printf("LabelID is %d\n",lLabelID); if (lLabelID == -1) { @@ -5118,7 +5118,7 @@ repeatcase: keydefaults[j*3][i] = '\0'; hash_add(&h_gamefuncs,gamefunctions[j],j); { - char *str = strtolower(Bstrdup(gamefunctions[j]),Bstrlen(gamefunctions[j])); + char *str = Bstrtolower(Bstrdup(gamefunctions[j])); hash_add(&h_gamefuncs,str,j); Bfree(str); } @@ -5976,7 +5976,6 @@ static void C_InitProjectiles(void) int8_t shade, xrepeat, yrepeat, pal; // 4b int8_t velmult; // 1b uint8_t clipdist; // 1b - int8_t filler[6]; // 6b } defaultprojectile_t; defaultprojectile_t DefaultProjectile = @@ -5986,7 +5985,7 @@ static void C_InitProjectiles(void) }; // this will only happen if I forget to update this function... - if (sizeof(projectile_t) != sizeof(DefaultProjectile) || offsetof(projectile_t, filler) != offsetof(defaultprojectile_t, filler)) + if (offsetof(projectile_t, filler) != sizeof(DefaultProjectile)) G_GameExit("ERROR: C_InitProjectiles(): projectile_t mismatch!"); for (i=MAXTILES-1; i>=0; i--) diff --git a/polymer/eduke32/source/gamevars.c b/polymer/eduke32/source/gamevars.c index f166921c3..11aa132ba 100644 --- a/polymer/eduke32/source/gamevars.c +++ b/polymer/eduke32/source/gamevars.c @@ -682,15 +682,18 @@ void __fastcall Gv_SetVar(register int32_t id, register int32_t lValue, register } badvarid: - OSD_Printf(CON_ERROR "Gv_SetVar(): tried to set invalid gamevar ID (%d) from sprite %d (%d), player %d\n",g_errorLineNum,keyw[g_tw],id,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); + OSD_Printf(CON_ERROR "Gv_SetVar(): tried to set invalid gamevar ID (%d) from sprite %d (%d), player %d\n", + g_errorLineNum,keyw[g_tw],id,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); return; badplayer: - OSD_Printf(CON_ERROR "Gv_SetVar(): invalid player (%d) for per-player gamevar %s from sprite %d, player %d\n",g_errorLineNum,keyw[g_tw],iPlayer,aGameVars[id].szLabel,vm.g_i,vm.g_p); + OSD_Printf(CON_ERROR "Gv_SetVar(): invalid player (%d) for per-player gamevar %s from sprite %d, player %d\n", + g_errorLineNum,keyw[g_tw],iPlayer,aGameVars[id].szLabel,vm.g_i,vm.g_p); return; badactor: - OSD_Printf(CON_ERROR "Gv_SetVar(): invalid sprite (%d) for per-actor gamevar %s from sprite %d (%d), player %d\n",g_errorLineNum,keyw[g_tw],iActor,aGameVars[id].szLabel,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); + OSD_Printf(CON_ERROR "Gv_SetVar(): invalid sprite (%d) for per-actor gamevar %s from sprite %d (%d), player %d\n", + g_errorLineNum,keyw[g_tw],iActor,aGameVars[id].szLabel,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); return; } diff --git a/polymer/eduke32/source/global.c b/polymer/eduke32/source/global.c index bac968298..c6225557f 100644 --- a/polymer/eduke32/source/global.c +++ b/polymer/eduke32/source/global.c @@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //------------------------------------------------------------------------- #include "duke3d.h" -const char *s_buildDate = "20100427"; +const char *s_buildDate = "20100514"; char *MusicPtr = NULL; int32_t g_musicSize; diff --git a/polymer/eduke32/source/grpscan.c b/polymer/eduke32/source/grpscan.c index fe066891d..c3262d146 100644 --- a/polymer/eduke32/source/grpscan.c +++ b/polymer/eduke32/source/grpscan.c @@ -93,7 +93,7 @@ int32_t ScanGroups(void) return 0; } - initprintf("Scanning for GRP files...\n"); + initprintf("Scanning for game data...\n"); LoadGroupsCache(); @@ -196,9 +196,12 @@ int32_t ScanGroups(void) Bfree(buf); return 0; } - initprintf("Found no recognized GRP files!\n"); + + initprintf("Found no recognized game data!\n"); + if (buf) Bfree(buf); + return 0; } diff --git a/polymer/eduke32/source/m32def.c b/polymer/eduke32/source/m32def.c index a4c48e370..66d12a776 100644 --- a/polymer/eduke32/source/m32def.c +++ b/polymer/eduke32/source/m32def.c @@ -917,7 +917,7 @@ static void C_GetNextVarType(int32_t type) textptr++; /// now pointing at 'xxx' C_GetNextLabelName(); - lLabelID = C_GetLabelNameID(SpriteLabels, &spriteH, strtolower(tlabel,Bstrlen(tlabel))); + lLabelID = C_GetLabelNameID(SpriteLabels, &spriteH, Bstrtolower(tlabel)); if (lLabelID == -1) { @@ -1018,11 +1018,11 @@ static void C_GetNextVarType(int32_t type) C_GetNextLabelName(); /*initprintf("found xxx label of '%s'\n", label+(g_numLabels*MAXLABELLEN));*/ if (id == g_iSpriteVarID || id==3) - lLabelID = C_GetLabelNameID(SpriteLabels, &spriteH, strtolower(tlabel,Bstrlen(tlabel))); + lLabelID = C_GetLabelNameID(SpriteLabels, &spriteH, Bstrtolower(tlabel)); else if (id == g_iSectorVarID) - lLabelID = C_GetLabelNameID(SectorLabels, §orH, strtolower(tlabel,Bstrlen(tlabel))); + lLabelID = C_GetLabelNameID(SectorLabels, §orH, Bstrtolower(tlabel)); else if (id == g_iWallVarID) - lLabelID = C_GetLabelNameID(WallLabels, &wallH, strtolower(tlabel,Bstrlen(tlabel))); + lLabelID = C_GetLabelNameID(WallLabels, &wallH, Bstrtolower(tlabel)); //printf("LabelID is %d\n",lLabelID); if (lLabelID == -1) { @@ -2233,11 +2233,11 @@ repeatcase: //printf("found xxx label of '%s'\n", label+(g_numLabels*MAXLABELLEN)); if (tw==CON_GETSECTOR || tw==CON_SETSECTOR) - lLabelID = C_GetLabelNameID(SectorLabels, §orH, strtolower(tlabel,Bstrlen(tlabel))); + lLabelID = C_GetLabelNameID(SectorLabels, §orH, Bstrtolower(tlabel)); else if (tw==CON_GETWALL || tw==CON_SETWALL) - lLabelID = C_GetLabelNameID(WallLabels, &wallH, strtolower(tlabel,Bstrlen(tlabel))); + lLabelID = C_GetLabelNameID(WallLabels, &wallH, Bstrtolower(tlabel)); else // if (tw==CON_GETSPRITE || tw==CON_SETSPRITE || tw==CON_GETTSPR || tw==CON_SETTSPR) - lLabelID = C_GetLabelNameID(SpriteLabels, &spriteH, strtolower(tlabel,Bstrlen(tlabel))); + lLabelID = C_GetLabelNameID(SpriteLabels, &spriteH, Bstrtolower(tlabel)); if (lLabelID == -1) { diff --git a/polymer/eduke32/source/premap.c b/polymer/eduke32/source/premap.c index 875ea6bf9..0d97c2a3b 100644 --- a/polymer/eduke32/source/premap.c +++ b/polymer/eduke32/source/premap.c @@ -790,7 +790,7 @@ void P_ResetStatus(int32_t snum) if ((aplWeaponWorksLike[p->curr_weapon][snum] == PISTOL_WEAPON) && (aplWeaponReload[p->curr_weapon][snum] > aplWeaponTotalTime[p->curr_weapon][snum])) - p->kickback_pic = aplWeaponTotalTime[p->curr_weapon][snum]+1; + p->kickback_pic = aplWeaponTotalTime[p->curr_weapon][snum]; else p->kickback_pic = 0; p->weapon_pos = 6; @@ -820,8 +820,8 @@ void P_ResetWeapons(int32_t snum) p->ammo_amount[weapon] = 0; p->weapon_pos = 6; - p->kickback_pic = 5; p->curr_weapon = PISTOL_WEAPON; + p->kickback_pic = aplWeaponTotalTime[p->curr_weapon][snum]; p->gotweapon = ((1<ammo_amount[PISTOL_WEAPON] = min(p->max_ammo_amount[PISTOL_WEAPON], 48); p->last_weapon = -1; @@ -867,7 +867,12 @@ static void resetprestat(int32_t snum,int32_t g) p->max_actors_killed = 0; p->lastrandomspot = 0; p->weapon_pos = 6; - p->kickback_pic = 5; + + if ((aplWeaponWorksLike[p->curr_weapon][snum] == PISTOL_WEAPON) && + (aplWeaponReload[p->curr_weapon][snum] > aplWeaponTotalTime[p->curr_weapon][snum])) + p->kickback_pic = aplWeaponTotalTime[p->curr_weapon][snum]; + else p->kickback_pic = 0; + p->last_weapon = -1; p->weapreccnt = 0; p->interface_toggle_flag = 0;