diff --git a/.gitattributes b/.gitattributes index 777bf189a..ef775b912 100644 --- a/.gitattributes +++ b/.gitattributes @@ -29,4 +29,6 @@ /libs/zlib/nintendods/README -whitespace /libs/zlib/watcom/watcom_f.mak -crlf -whitespace /libs/zlib/watcom/watcom_l.mak -crlf -whitespace +#Appveyor +/appveyor.yml -crlf -whitespace # Other diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 000000000..70f186667 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,70 @@ +version: 2.1.14.{branch}-{build} +os: MinGW + +environment: + CC: i686-w64-mingw32-gcc + WINDRES: windres + MINGW_SDK: c:\msys64\mingw32 + SDL2_URL: http://libsdl.org/release/SDL2-devel-2.0.4-mingw.tar.gz + SDL2_ARCHIVE: SDL2-devel-2.0.4-mingw.tar + SDL2_MOVE: SDL2-2.0.4\i686-w64-mingw32 + SDL2_MIXER_URL: https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.1-mingw.tar.gz + SDL2_MIXER_ARCHIVE: SDL2_mixer-devel-2.0.1-mingw.tar + SDL2_MIXER_MOVE: SDL2_mixer-2.0.1\i686-w64-mingw32 + +cache: +- SDL2-devel-2.0.4-mingw.tar.gz +- SDL2_mixer-devel-2.0.1-mingw.tar.gz + +install: +#Download SDL2 +- if not exist "%SDL2_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_URL%" -FileName "%SDL2_ARCHIVE%.gz" +- 7z x -y "%SDL2_ARCHIVE%.gz" -o%TMP% >null +- 7z x -y "%TMP%\%SDL2_ARCHIVE%" -o%TMP% >null +- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%SDL2_MOVE% %MINGW_SDK% || exit 0 +- ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\bin\sdl2-config"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\bin\sdl2-config")) +- ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\cmake\SDL2\sdl2-config.cmake"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\cmake\SDL2\sdl2-config.cmake")) +- ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MOVE%\lib\pkgconfig\sdl2.pc"))) | ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\sdl2.pc")) +#Download SDL2_Mixer +- if not exist "%SDL2_MIXER_ARCHIVE%.gz" appveyor DownloadFile "%SDL2_MIXER_URL%" -FileName "%SDL2_MIXER_ARCHIVE%.gz" +- 7z x -y "%SDL2_MIXER_ARCHIVE%.gz" -o%TMP% >null +- 7z x -y "%TMP%\%SDL2_MIXER_ARCHIVE%" -o%TMP% >null +- robocopy /S /xx /ns /nc /nfl /ndl /np /njh /njs %TMP%\%SDL2_MIXER_MOVE% %MINGW_SDK% || exit 0 +- ps: (Get-Content ([System.Environment]::ExpandEnvironmentVariables("%TMP%\%SDL2_MIXER_MOVE%\lib\pkgconfig\SDL2_mixer.pc")))| ForEach-Object { $_ -replace "/usr/local/cross-tools/i686-w64-mingw32", ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%")) } | Set-Content ([System.Environment]::ExpandEnvironmentVariables("%MINGW_SDK%\lib\pkgconfig\SDL2_mixer.pc")) + +before_build: +- set SDL_PKGCONFIG=%MINGW_SDK%\lib\pkgconfig\sdl2.pc +- set Path=%MINGW_SDK%\bin;%Path% +- i686-w64-mingw32-gcc --version +- mingw32-make --version + +build_script: +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 clean +- cmd: mingw32-make.exe -C src MINGW=1 WARNINGMODE=1 NOASM=1 NOUPX=1 GCC52=1 SDL=1 ERRORMODE=1 + +after_build: +- cmd: git rev-parse --short %APPVEYOR_REPO_COMMIT%>%TMP%/gitshort.txt +- cmd: set /P GITSHORT=<%TMP%/gitshort.txt +- set BUILD_ARCHIVE=%APPVEYOR_REPO_BRANCH%-%GITSHORT%.7z +- cmd: 7z a %BUILD_ARCHIVE% bin\Mingw\Release -xr!.gitignore +- appveyor PushArtifact %BUILD_ARCHIVE% + +test: off + +deploy: + - provider: FTP + protocol: ftps + host: + secure: NsLJEPIBvmwCOj8Tg8RoRQ== + username: + secure: ejxi5mvk7oLYu7QtbYojajEPigMy0mokaKhuEVuDZcA= + password: + secure: Hbn6Uy3lT0YZ88yFJ3aW4w== + folder: appveyor + application: + active_mode: false + + +on_finish: +#- cmd: echo xfreerdp /u:appveyor /cert-ignore +clipboard /v:: +#- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) diff --git a/src/Makefile.cfg b/src/Makefile.cfg index 1ea96df92..fa8896a7c 100644 --- a/src/Makefile.cfg +++ b/src/Makefile.cfg @@ -7,6 +7,22 @@ # and other things # +ifdef GCC53 +GCC52=1 +endif + +ifdef GCC52 +GCC51=1 +endif + +ifdef GCC51 +GCC49=1 +endif + +ifdef GCC49 +GCC48=1 +endif + ifdef GCC48 GCC47=1 endif @@ -139,6 +155,10 @@ WFLAGS+=-Wformat-security ifndef GCC29 #WFLAGS+=-Winit-self endif +ifdef GCC46 +WFLAGS+=-Wno-suggest-attribute=noreturn +endif + ifndef MINGW ifdef GCC45 WFLAGS+=-Wunsuffixed-float-constants @@ -155,6 +175,7 @@ ifdef GCC43 endif WFLAGS+=$(OLDWFLAGS) + #indicate platform and what interface use with ifndef WINCE ifndef XBOX diff --git a/src/console.c b/src/console.c index e77c400b3..fcac0e6de 100644 --- a/src/console.c +++ b/src/console.c @@ -202,7 +202,7 @@ static void CONS_Bind_f(void) } key = G_KeyStringtoNum(COM_Argv(1)); - if (!key) + if (key <= 0 || key >= NUMINPUTS) { CONS_Alert(CONS_NOTICE, M_GetText("Invalid key name\n")); return; diff --git a/src/g_game.c b/src/g_game.c index 6d0ef5a5b..72cfe4a57 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -5571,7 +5571,7 @@ boolean G_CheckDemoStatus(void) free(demobuffer); demorecording = false; - if (!modeattacking == ATTACKING_RECORD) + if (modeattacking != ATTACKING_RECORD) { if (saved) CONS_Printf(M_GetText("Demo %s recorded\n"), demoname); diff --git a/src/g_input.c b/src/g_input.c index f12ddb711..79e6fb94b 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -1042,13 +1042,13 @@ INT32 G_KeyStringtoNum(const char *keystr) if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z') return keystr[0]; + if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9') + return atoi(&keystr[3]); + for (j = 0; j < NUMKEYNAMES; j++) if (!stricmp(keynames[j].name, keystr)) return keynames[j].keynum; - if (strlen(keystr) > 3) - return atoi(&keystr[3]); - return 0; } diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index d14324c30..e23b3eebf 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -2371,7 +2371,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (void) Clamp2D(GL_TEXTURE_WRAP_S); Clamp2D(GL_TEXTURE_WRAP_T); #ifndef KOS_GL_COMPATIBILITY - pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0); + pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0); #endif tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now @@ -2399,7 +2399,7 @@ EXPORT void HWRAPI(MakeScreenFinalTexture) (void) Clamp2D(GL_TEXTURE_WRAP_S); Clamp2D(GL_TEXTURE_WRAP_T); #ifndef KOS_GL_COMPATIBILITY - pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, texsize, texsize, 0); + pglCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, texsize, texsize, 0); #endif tex_downloaded = 0; // 0 so it knows it doesn't have any of the cached patches downloaded right now diff --git a/src/lua_maplib.c b/src/lua_maplib.c index 0a12478ca..38920c223 100644 --- a/src/lua_maplib.c +++ b/src/lua_maplib.c @@ -1157,14 +1157,11 @@ static int mapheaderinfo_get(lua_State *L) { mapheader_t *header = *((mapheader_t **)luaL_checkudata(L, 1, META_MAPHEADER)); const char *field = luaL_checkstring(L, 2); - //INT16 i; - if (fastcmp(field,"lvlttl")) { - //for (i = 0; i < 21; i++) - // if (!header->lvlttl[i]) - // break; - lua_pushlstring(L, header->lvlttl, 21); - } else if (fastcmp(field,"subttl")) - lua_pushlstring(L, header->subttl, 32); + INT16 i; + if (fastcmp(field,"lvlttl")) + lua_pushstring(L, header->lvlttl); + else if (fastcmp(field,"subttl")) + lua_pushstring(L, header->subttl); else if (fastcmp(field,"actnum")) lua_pushinteger(L, header->actnum); else if (fastcmp(field,"typeoflevel")) @@ -1176,7 +1173,7 @@ static int mapheaderinfo_get(lua_State *L) else if (fastcmp(field,"musicslottrack")) lua_pushinteger(L, header->musicslottrack); else if (fastcmp(field,"forcecharacter")) - lua_pushlstring(L, header->forcecharacter, 16); + lua_pushstring(L, header->forcecharacter); else if (fastcmp(field,"weather")) lua_pushinteger(L, header->weather); else if (fastcmp(field,"skynum")) @@ -1187,12 +1184,15 @@ static int mapheaderinfo_get(lua_State *L) lua_pushinteger(L, header->skybox_scaley); else if (fastcmp(field,"skybox_scalez")) lua_pushinteger(L, header->skybox_scalez); - else if (fastcmp(field,"interscreen")) - lua_pushlstring(L, header->interscreen, 8); - else if (fastcmp(field,"runsoc")) - lua_pushlstring(L, header->runsoc, 32); + else if (fastcmp(field,"interscreen")) { + for (i = 0; i < 8; i++) + if (!header->interscreen[i]) + break; + lua_pushlstring(L, header->interscreen, i); + } else if (fastcmp(field,"runsoc")) + lua_pushstring(L, header->runsoc); else if (fastcmp(field,"scriptname")) - lua_pushlstring(L, header->scriptname, 32); + lua_pushstring(L, header->scriptname); else if (fastcmp(field,"precutscenenum")) lua_pushinteger(L, header->precutscenenum); else if (fastcmp(field,"cutscenenum")) @@ -1217,11 +1217,11 @@ static int mapheaderinfo_get(lua_State *L) else { // Read custom vars now // (note: don't include the "LUA." in your lua scripts!) - UINT8 i = 0; - for (;i < header->numCustomOptions && !fastcmp(field, header->customopts[i].option); ++i); + UINT8 j = 0; + for (;j < header->numCustomOptions && !fastcmp(field, header->customopts[j].option); ++j); - if(i < header->numCustomOptions) - lua_pushlstring(L, header->customopts[i].value, 255); + if(j < header->numCustomOptions) + lua_pushstring(L, header->customopts[j].value); else lua_pushnil(L); } diff --git a/src/lua_mathlib.c b/src/lua_mathlib.c index f4b5ca5fe..fd00180d5 100644 --- a/src/lua_mathlib.c +++ b/src/lua_mathlib.c @@ -166,7 +166,7 @@ static int lib_all7emeralds(lua_State *L) // Returns both color and frame numbers! static int lib_coloropposite(lua_State *L) { - int colornum = ((int)luaL_checkinteger(L, 1)) & MAXSKINCOLORS; + int colornum = ((int)luaL_checkinteger(L, 1)) % MAXSKINCOLORS; lua_pushinteger(L, Color_Opposite[colornum*2]); // push color lua_pushinteger(L, Color_Opposite[colornum*2+1]); // push frame return 2; diff --git a/src/m_cheat.c b/src/m_cheat.c index bc32e6cfa..473fbbf75 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -880,12 +880,33 @@ static boolean OP_HeightOkay(player_t *player, UINT8 ceiling) static mapthing_t *OP_CreateNewMapThing(player_t *player, UINT16 type, boolean ceiling) { - mapthing_t *mt; + mapthing_t *mt = mapthings; + #ifdef HAVE_BLUA LUA_InvalidateMapthings(); #endif mapthings = Z_Realloc(mapthings, ++nummapthings * sizeof (*mapthings), PU_LEVEL, NULL); + + // as Z_Realloc can relocate mapthings, quickly go through thinker list and correct + // the spawnpoints of any objects that have them to the new location + if (mt != mapthings) + { + thinker_t *th; + mobj_t *mo; + + for (th = thinkercap.next; th != &thinkercap; th = th->next) + { + if (th->function.acp1 != (actionf_p1)P_MobjThinker) + continue; + + mo = (mobj_t *)th; + // get offset from mt, which points to old mapthings, then add new location + if (mo->spawnpoint) + mo->spawnpoint = (mo->spawnpoint - mt) + mapthings; + } + } + mt = (mapthings+nummapthings-1); mt->type = type; diff --git a/src/p_spec.c b/src/p_spec.c index cac822ac8..81994d46c 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -4671,11 +4671,11 @@ void P_UpdateSpecials(void) // ANIMATE TEXTURES for (anim = anims; anim < lastanim; anim++) { - for (i = anim->basepic; i < anim->basepic + anim->numpics; i++) + for (i = 0; i < anim->numpics; i++) { pic = anim->basepic + ((leveltime/anim->speed + i) % anim->numpics); if (anim->istexture) - texturetranslation[i] = pic; + texturetranslation[anim->basepic+i] = pic; } } diff --git a/src/r_bsp.c b/src/r_bsp.c index badf8bdac..c547713be 100644 --- a/src/r_bsp.c +++ b/src/r_bsp.c @@ -935,14 +935,14 @@ static void R_Subsector(size_t num) ffloor[numffloors].plane = NULL; ffloor[numffloors].polyobj = NULL; - - floorcenterz = + + floorcenterz = #ifdef ESLOPE frontsector->f_slope ? P_GetZAt(frontsector->f_slope, frontsector->soundorg.x, frontsector->soundorg.y) : #endif frontsector->floorheight; - - ceilingcenterz = + + ceilingcenterz = #ifdef ESLOPE frontsector->c_slope ? P_GetZAt(frontsector->c_slope, frontsector->soundorg.x, frontsector->soundorg.y) : #endif @@ -953,8 +953,8 @@ static void R_Subsector(size_t num) *rover->b_slope ? P_GetZAt(*rover->b_slope, viewx, viewy) : #endif *rover->bottomheight; - - planecenterz = + + planecenterz = #ifdef ESLOPE *rover->b_slope ? P_GetZAt(*rover->b_slope, frontsector->soundorg.x, frontsector->soundorg.y) : #endif @@ -966,7 +966,7 @@ static void R_Subsector(size_t num) { light = R_GetPlaneLight(frontsector, planecenterz, viewz < *rover->bottomheight); - + ffloor[numffloors].plane = R_FindPlane(*rover->bottomheight, *rover->bottompic, *frontsector->lightlist[light].lightlevel, *rover->bottomxoffs, *rover->bottomyoffs, *rover->bottomangle, frontsector->lightlist[light].extra_colormap, rover @@ -1002,8 +1002,8 @@ static void R_Subsector(size_t num) *rover->t_slope ? P_GetZAt(*rover->t_slope, viewx, viewy) : #endif *rover->topheight; - - planecenterz = + + planecenterz = #ifdef ESLOPE *rover->t_slope ? P_GetZAt(*rover->t_slope, frontsector->soundorg.x, frontsector->soundorg.y) : #endif @@ -1014,7 +1014,7 @@ static void R_Subsector(size_t num) || (viewz < heightcheck && (rover->flags & FF_BOTHPLANES)))) { light = R_GetPlaneLight(frontsector, planecenterz, viewz < *rover->topheight); - + ffloor[numffloors].plane = R_FindPlane(*rover->topheight, *rover->toppic, *frontsector->lightlist[light].lightlevel, *rover->topxoffs, *rover->topyoffs, *rover->topangle, frontsector->lightlist[light].extra_colormap, rover diff --git a/src/sdl/i_main.c b/src/sdl/i_main.c index 976f7eb35..c157a6be7 100644 --- a/src/sdl/i_main.c +++ b/src/sdl/i_main.c @@ -55,6 +55,10 @@ PSP_MAIN_THREAD_STACK_SIZE_KB(256); #include "i_ttf.h" #endif +#if defined (_WIN32) && !defined (main) +#define SDLMAIN +#endif + #ifdef SDLMAIN #include "SDL_main.h" #elif defined(FORCESDLMAIN) @@ -132,7 +136,6 @@ static inline VOID MakeCodeWritable(VOID) \return int */ -FUNCNORETURN #if defined (_XBOX) && defined (__GNUC__) void XBoxStartup() { @@ -141,8 +144,10 @@ void XBoxStartup() myargv = NULL; #else #ifdef FORCESDLMAIN +FUNCNORETURN int SDL_main(int argc, char **argv) #else +FUNCNORETURN int main(int argc, char **argv) #endif {