From d6c29e19abbc05d3017c582ab80520ded2444e5d Mon Sep 17 00:00:00 2001 From: Alam Ed Arias Date: Tue, 5 Aug 2014 19:59:40 -0400 Subject: [PATCH] SRB2 2.1.10 release --- readme.txt | 2 +- src/command.c | 8 ++++- src/d_clisrv.c | 10 ++++-- src/d_main.c | 4 +-- src/d_netcmd.c | 2 +- src/doomdef.h | 6 ++-- src/info.c | 6 ++-- src/lua_baselib.c | 2 +- src/lua_script.c | 11 ++++--- src/p_mobj.c | 20 +++++++----- src/p_spec.c | 2 +- src/p_user.c | 31 +++++++------------ .../macosx/Srb2mac.xcodeproj/project.pbxproj | 4 +-- .../macosx/Srb2mac.xcodeproj/project.pbxproj | 4 +-- src/z_zone.c | 9 ++++-- src/z_zone.h | 12 ++++--- tools/wadzip/wadzip.c | 4 ++- 17 files changed, 76 insertions(+), 61 deletions(-) diff --git a/readme.txt b/readme.txt index 176d29241..2a34380bb 100644 --- a/readme.txt +++ b/readme.txt @@ -1,4 +1,4 @@ -Here it is! SRB2 v2.1.9 source code! +Here it is! SRB2 v2.1.10 source code! (why do we keep the version number up to date when everything else in this file is hilariously old? - Inuyasha) diff --git a/src/command.c b/src/command.c index e62795570..14c5faae8 100644 --- a/src/command.c +++ b/src/command.c @@ -379,7 +379,13 @@ void COM_AddCommand(const char *name, com_func_t func) { if (!stricmp(name, cmd->name)) //case insensitive now that we have lower and uppercase! { - I_Error("Command %s already exists\n", name); + // don't I_Error for Lua commands + // Lua commands can replace game commands, and they have priority. + // BUT, if for some reason we screwed up and made two console commands with the same name, + // it's good to have this here so we find out. + if (cmd->function != COM_Lua_f) + I_Error("Command %s already exists\n", name); + return; } } diff --git a/src/d_clisrv.c b/src/d_clisrv.c index b086077d4..3adba9efd 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -769,7 +769,7 @@ static inline void resynch_write_ctf(resynchend_pak *rst) } if (j == MAXPLAYERS) // fine, no I_Error { - CONS_Alert(CONS_ERROR, "One of the flags has gone completely missing..."); + CONS_Alert(CONS_ERROR, "One of the flags has gone completely missing...\n"); rst->flagplayer[i] = -2; } continue; @@ -1527,7 +1527,7 @@ static void CL_LoadReceivedSavegame(void) Z_Free(savebuffer); save_p = NULL; if (unlink(tmpsave) == -1) - CONS_Alert(CONS_ERROR, M_GetText("Can't delete %s"), tmpsave); + CONS_Alert(CONS_ERROR, M_GetText("Can't delete %s\n"), tmpsave); return; } @@ -1535,7 +1535,7 @@ static void CL_LoadReceivedSavegame(void) Z_Free(savebuffer); save_p = NULL; if (unlink(tmpsave) == -1) - CONS_Alert(CONS_ERROR, M_GetText("Can't delete %s"), tmpsave); + CONS_Alert(CONS_ERROR, M_GetText("Can't delete %s\n"), tmpsave); consistancy[gametic%BACKUPTICS] = Consistancy(); CON_ToggleOff(); } @@ -2309,6 +2309,10 @@ void CL_Reset(void) SV_StopServer(); SV_ResetServer(); + // make sure we don't leave any fileneeded gunk over from a failed join + fileneedednum = 0; + memset(fileneeded, 0, sizeof(fileneeded)); + // D_StartTitle should get done now, but the calling function will handle it } diff --git a/src/d_main.c b/src/d_main.c index 42734fbc9..42799b7d3 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -1087,14 +1087,14 @@ void D_SRB2Main(void) #endif D_CleanFile(); -#if 1 // md5s last updated 8/03/14 +#if 1 // md5s last updated 8/05/14 // Check MD5s of autoloaded files W_VerifyFileMD5(0, "ac309fb3c7d4b5b685e2cd26beccf0e8"); // srb2.srb/srb2.wad W_VerifyFileMD5(1, "e956466eff2c79f7b1cdefad24761bce"); // zones.dta W_VerifyFileMD5(2, "95a4cdbed287323dd361243f357a5fd2"); // player.dta W_VerifyFileMD5(3, "85901ad4bf94637e5753d2ac2c03ea26"); // rings.dta - W_VerifyFileMD5(4, "636e4c7b71e770e8368b48fcfe07bbd8"); // patch.dta + W_VerifyFileMD5(4, "01735733412bf68c42f4669e964fc952"); // patch.dta // don't check music.dta because people like to modify it, and it doesn't matter if they do // ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for. #endif diff --git a/src/d_netcmd.c b/src/d_netcmd.c index dd7435bde..13cf2fed9 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -3901,7 +3901,7 @@ static void Command_Cheats_f(void) if (CV_CheatsEnabled()) { CONS_Printf(M_GetText("At least one CHEAT-marked variable has been changed -- Cheats are enabled.\n")); - CONS_Printf(M_GetText("Type CHEATS OFF to reset all cheat variables to default.")); + CONS_Printf(M_GetText("Type CHEATS OFF to reset all cheat variables to default.\n")); } else CONS_Printf(M_GetText("No CHEAT-marked variables are changed -- Cheats are disabled.\n")); diff --git a/src/doomdef.h b/src/doomdef.h index 96590fb2c..06f6ba121 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -144,8 +144,8 @@ extern FILE *logstream; #define VERSIONSTRING "Trunk" #else #define VERSION 201 // Game version -#define SUBVERSION 9 // more precise version number -#define VERSIONSTRING "v2.1.9" +#define SUBVERSION 10 // more precise version number +#define VERSIONSTRING "v2.1.10" #endif // Modification options @@ -201,7 +201,7 @@ extern FILE *logstream; // it's only for detection of the version the player is using so the MS can alert them of an update. // Only set it higher, not lower, obviously. // Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1". -#define MODVERSION 14 +#define MODVERSION 15 diff --git a/src/info.c b/src/info.c index a964ae80e..a15646f01 100644 --- a/src/info.c +++ b/src/info.c @@ -12525,12 +12525,12 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] = sfx_None, // deathsound 0, // speed 16*FRACUNIT, // radius - 56*FRACUNIT, // height + 48*FRACUNIT, // height 0, // display offset 1000, // mass 0, // damage sfx_None, // activesound - MF_NOCLIP|MF_NOGRAVITY|MF_NOBLOCKMAP, // flags + MF_NOCLIP|MF_NOGRAVITY, // flags S_NULL // raisestate }, @@ -14398,7 +14398,7 @@ void P_ResetData(INT32 flags) { #ifndef ALLOW_RESETDATA (void)flags; - CONS_Alert(CONS_NOTICE, M_GetText("P_ResetData(): not supported in this build.")); + CONS_Alert(CONS_NOTICE, M_GetText("P_ResetData(): not supported in this build.\n")); #else if (flags & 1) { diff --git a/src/lua_baselib.c b/src/lua_baselib.c index d84d3b3a6..6124b3498 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -1842,7 +1842,7 @@ static int lib_gTicsToMilliseconds(lua_State *L) static luaL_Reg lib[] = { {"print", lib_print}, - {"EvalMath", lib_evalMath,}, + {"EvalMath", lib_evalMath}, // m_random {"P_Random",lib_pRandom}, diff --git a/src/lua_script.c b/src/lua_script.c index b50bd0977..8b40d9f00 100644 --- a/src/lua_script.c +++ b/src/lua_script.c @@ -55,12 +55,13 @@ static lua_CFunction liblist[] = { // Lua asks for memory using this. static void *LUA_Alloc(void *ud, void *ptr, size_t osize, size_t nsize) { - (void)ud; (void)osize; + (void)ud; if (nsize == 0) { - Z_Free(ptr); + if (osize != 0) + Z_Free(ptr); return NULL; } else - return Z_Realloc(ptr, nsize, PU_STATIC, NULL); + return Z_Realloc(ptr, nsize, PU_LUA, NULL); } // Panic function Lua calls when there's an unprotected error. @@ -183,7 +184,7 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump) char *name; f.wad = wad; f.size = W_LumpLengthPwad(wad, lump); - f.data = Z_Malloc(f.size, PU_STATIC, NULL); + f.data = Z_Malloc(f.size, PU_LUA, NULL); W_ReadLumpPwad(wad, lump, f.data); f.curpos = f.data; @@ -307,7 +308,7 @@ fixed_t LUA_EvalMath(const char *word) p = lua_tostring(L, -1); while (*p++ != ':' && *p) ; p += 3; // "1: " - CONS_Alert(CONS_WARNING, "%s", p); + CONS_Alert(CONS_WARNING, "%s\n", p); } else res = lua_tointeger(L, -1); diff --git a/src/p_mobj.c b/src/p_mobj.c index b4db48f20..9241e559f 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3520,7 +3520,7 @@ static void P_Boss3Thinker(mobj_t *mobj) mobj_t *dummy; SINT8 way = mobj->threshold - 1; // 0 through 4. SINT8 way2; - + i = 0; // reset i to 0 so we can check how many clones we've removed // scan the thinkers to make sure all the old pinch dummies are gone before making new ones @@ -5780,12 +5780,18 @@ void P_MobjThinker(mobj_t *mobj) #ifdef HAVE_BLUA // Check for a Lua thinker first - if (!mobj->player && LUAh_MobjThinker(mobj)) - return; - else if (mobj->player && !mobj->player->spectator) + if (!mobj->player) + { + if (LUAh_MobjThinker(mobj) || P_MobjWasRemoved(mobj)) + return; + } + else if (!mobj->player->spectator) + { + // You cannot short-circuit the player thinker like you can other thinkers. LUAh_MobjThinker(mobj); - if (P_MobjWasRemoved(mobj)) - return; + if (P_MobjWasRemoved(mobj)) + return; + } #endif // if it's pushable, or if it would be pushable other than temporary disablement, use the // separate thinker @@ -8262,7 +8268,7 @@ void P_SpawnMapThing(mapthing_t *mthing) { if ((i == MT_BLUEFLAG && blueflag) || (i == MT_REDFLAG && redflag)) { - CONS_Alert(CONS_ERROR, M_GetText("Only one flag per team allowed in CTF!")); + CONS_Alert(CONS_ERROR, M_GetText("Only one flag per team allowed in CTF!\n")); return; } } diff --git a/src/p_spec.c b/src/p_spec.c index c29e47fa2..ad0b397e0 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -2978,7 +2978,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo) #ifdef HAVE_BLUA LUAh_LinedefExecute(line, mo); #else - CONS_Alert(CONS_ERROR, "The map is trying to run a Lua script, but this exe was not compiled with Lua support!"); + CONS_Alert(CONS_ERROR, "The map is trying to run a Lua script, but this exe was not compiled with Lua support!\n"); #endif break; diff --git a/src/p_user.c b/src/p_user.c index 5c8f2d91f..69d30cf67 100644 --- a/src/p_user.c +++ b/src/p_user.c @@ -4747,7 +4747,6 @@ static void P_ShootLine(mobj_t *source, mobj_t *dest, fixed_t height) static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t radius) { - mobj_t* targ; if (player->pflags & PF_TRANSFERTOCLOSEST) { const angle_t fa = R_PointToAngle2(player->axis1->x, player->axis1->y, player->axis2->x, player->axis2->y); @@ -4763,17 +4762,14 @@ static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t rad if (player->exiting) return; - // You're welcome, Rob. -Red - targ = player->mo->target; - if (!P_TryMove(player->mo, player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, true)) + // You're welcome, Rob. (Now with slightly less horrendous hacking -Red + player->mo->tracer->flags &= ~MF_NOCLIP; + player->mo->tracer->z = player->mo->z; + if (!P_TryMove(player->mo->tracer, player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, true)) { + player->mo->tracer->flags |= MF_NOCLIP; return; - else - P_TeleportMove(player->mo, player->mo->x-player->mo->momx, player->mo->y-player->mo->momy, player->mo->z); - - if (!(player->pflags & PF_TRANSFERTOCLOSEST) && !player->mo->target) { - P_SetTarget(&player->mo->target, targ); - P_SetMobjState(player->mo->tracer, S_SUPERTRANS1); } + player->mo->tracer->flags |= MF_NOCLIP; { const INT32 sequence = player->mo->target->threshold; mobj_t *transfer1 = NULL; @@ -5735,14 +5731,6 @@ static void P_NiGHTSMovement(player_t *player) P_NightsTransferPoints(player, xspeed, radius); - // Check here after transferring because the game can be dumb sometimes -Red - if (player->mo->tracer->state >= &states[S_SUPERTRANS1] - && player->mo->tracer->state <= &states[S_SUPERTRANS9]) - { - player->mo->momx = player->mo->momy = player->mo->momz = 0; - return; - } - if (still) player->mo->momz = -FRACUNIT; else @@ -7221,8 +7209,11 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius) { fa = (i*(FINEANGLES/16)); mo = P_SpawnMobj(inflictor->x, inflictor->y, inflictor->z, MT_SUPERSPARK); - mo->momx = FixedMul(FINESINE(fa),ns); - mo->momy = FixedMul(FINECOSINE(fa),ns); + if (!P_MobjWasRemoved(mo)) + { + mo->momx = FixedMul(FINESINE(fa),ns); + mo->momy = FixedMul(FINECOSINE(fa),ns); + } } for (think = thinkercap.next; think != &thinkercap; think = think->next) diff --git a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj index b2d687e24..93da46bc1 100644 --- a/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1214,7 +1214,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.9; + CURRENT_PROJECT_VERSION = 2.1.10; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", NORMALSRB2, @@ -1226,7 +1226,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.9; + CURRENT_PROJECT_VERSION = 2.1.10; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PREPROCESSOR_DEFINITIONS = ( diff --git a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj index b2d687e24..93da46bc1 100644 --- a/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj +++ b/src/sdl12/macosx/Srb2mac.xcodeproj/project.pbxproj @@ -1214,7 +1214,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.9; + CURRENT_PROJECT_VERSION = 2.1.10; GCC_PREPROCESSOR_DEFINITIONS = ( "$(inherited)", NORMALSRB2, @@ -1226,7 +1226,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.1.9; + CURRENT_PROJECT_VERSION = 2.1.10; GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_PREPROCESSOR_DEFINITIONS = ( diff --git a/src/z_zone.c b/src/z_zone.c index 5a145cd3c..a4a6e206f 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -167,9 +167,6 @@ void Z_Free(void *ptr) if (ptr == NULL) return; -#ifdef HAVE_BLUA - LUA_InvalidateUserdata(ptr); -#endif #ifdef ZDEBUG2 CONS_Debug(DBG_MEMORY, "Z_Free %s:%d\n", file, line); @@ -186,6 +183,12 @@ void Z_Free(void *ptr) CONS_Debug(DBG_MEMORY, "Z_Free at %s:%d\n", file, line); #endif +#ifdef HAVE_BLUA + // anything that isn't by lua gets passed to lua just in case. + if (block->tag != PU_LUA) + LUA_InvalidateUserdata(ptr); +#endif + // TODO: if zdebugging, make sure no other block has a user // that is about to be freed. diff --git a/src/z_zone.h b/src/z_zone.h index 23ad4d19a..26a9c04dc 100644 --- a/src/z_zone.h +++ b/src/z_zone.h @@ -34,12 +34,14 @@ // PU - purge tags. // Tags < PU_LEVEL are not purged until freed explicitly. #define PU_STATIC 1 // static entire execution time -#define PU_SOUND 2 // static while playing -#define PU_MUSIC 3 // static while playing -#define PU_HUDGFX 4 // static until WAD added +#define PU_LUA 2 // static entire execution time -- used by lua so it doesn't get caught in loops forever -#define PU_HWRPATCHINFO 5 // Hardware GLPatch_t struct for OpenGL texture cache -#define PU_HWRPATCHCOLMIPMAP 6 // Hardware GLMipmap_t struct colromap variation of patch +#define PU_SOUND 11 // static while playing +#define PU_MUSIC 12 // static while playing +#define PU_HUDGFX 13 // static until WAD added + +#define PU_HWRPATCHINFO 21 // Hardware GLPatch_t struct for OpenGL texture cache +#define PU_HWRPATCHCOLMIPMAP 22 // Hardware GLMipmap_t struct colromap variation of patch #define PU_HWRCACHE 48 // static until unlocked #define PU_CACHE 49 // static until unlocked diff --git a/tools/wadzip/wadzip.c b/tools/wadzip/wadzip.c index 9b60f1a9b..c8dae9b61 100644 --- a/tools/wadzip/wadzip.c +++ b/tools/wadzip/wadzip.c @@ -252,7 +252,9 @@ void writewad(const wad_t *wad, const char *fname, int compress) } } - if (fwrite(cbuf, csize, 1, fp) < 1) + if (!csize) + ; // inu: 0 length markers aren't to be written + else if (fwrite(cbuf, csize, 1, fp) < 1) { err(1, "cannot write lump %lu to %s", (unsigned long)ix, fname);