Merge remote-tracking branch 'origin/master' into next

This commit is contained in:
yellowtd 2014-08-05 20:23:01 -04:00
commit e53aedcb45
17 changed files with 76 additions and 61 deletions

View file

@ -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 (why do we keep the version number up to date
when everything else in this file is hilariously old? when everything else in this file is hilariously old?
- Inuyasha) - Inuyasha)

View file

@ -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! 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; return;
} }
} }

View file

@ -769,7 +769,7 @@ static inline void resynch_write_ctf(resynchend_pak *rst)
} }
if (j == MAXPLAYERS) // fine, no I_Error 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; rst->flagplayer[i] = -2;
} }
continue; continue;
@ -1527,7 +1527,7 @@ static void CL_LoadReceivedSavegame(void)
Z_Free(savebuffer); Z_Free(savebuffer);
save_p = NULL; save_p = NULL;
if (unlink(tmpsave) == -1) 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; return;
} }
@ -1535,7 +1535,7 @@ static void CL_LoadReceivedSavegame(void)
Z_Free(savebuffer); Z_Free(savebuffer);
save_p = NULL; save_p = NULL;
if (unlink(tmpsave) == -1) 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(); consistancy[gametic%BACKUPTICS] = Consistancy();
CON_ToggleOff(); CON_ToggleOff();
} }
@ -2309,6 +2309,10 @@ void CL_Reset(void)
SV_StopServer(); SV_StopServer();
SV_ResetServer(); 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 // D_StartTitle should get done now, but the calling function will handle it
} }

View file

@ -1087,14 +1087,14 @@ void D_SRB2Main(void)
#endif #endif
D_CleanFile(); D_CleanFile();
#if 1 // md5s last updated 8/03/14 #if 1 // md5s last updated 8/05/14
// Check MD5s of autoloaded files // Check MD5s of autoloaded files
W_VerifyFileMD5(0, "ac309fb3c7d4b5b685e2cd26beccf0e8"); // srb2.srb/srb2.wad W_VerifyFileMD5(0, "ac309fb3c7d4b5b685e2cd26beccf0e8"); // srb2.srb/srb2.wad
W_VerifyFileMD5(1, "e956466eff2c79f7b1cdefad24761bce"); // zones.dta W_VerifyFileMD5(1, "e956466eff2c79f7b1cdefad24761bce"); // zones.dta
W_VerifyFileMD5(2, "95a4cdbed287323dd361243f357a5fd2"); // player.dta W_VerifyFileMD5(2, "95a4cdbed287323dd361243f357a5fd2"); // player.dta
W_VerifyFileMD5(3, "85901ad4bf94637e5753d2ac2c03ea26"); // rings.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 // 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. // ...except it does if they slip maps in there, and that's what W_VerifyNMUSlumps is for.
#endif #endif

View file

@ -3901,7 +3901,7 @@ static void Command_Cheats_f(void)
if (CV_CheatsEnabled()) if (CV_CheatsEnabled())
{ {
CONS_Printf(M_GetText("At least one CHEAT-marked variable has been changed -- Cheats are enabled.\n")); 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 else
CONS_Printf(M_GetText("No CHEAT-marked variables are changed -- Cheats are disabled.\n")); CONS_Printf(M_GetText("No CHEAT-marked variables are changed -- Cheats are disabled.\n"));

View file

@ -144,8 +144,8 @@ extern FILE *logstream;
#define VERSIONSTRING "Trunk" #define VERSIONSTRING "Trunk"
#else #else
#define VERSION 201 // Game version #define VERSION 201 // Game version
#define SUBVERSION 9 // more precise version number #define SUBVERSION 10 // more precise version number
#define VERSIONSTRING "v2.1.9" #define VERSIONSTRING "v2.1.10"
#endif #endif
// Modification options // 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. // 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. // 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". // 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

View file

@ -12525,12 +12525,12 @@ mobjinfo_t mobjinfo[NUMMOBJTYPES] =
sfx_None, // deathsound sfx_None, // deathsound
0, // speed 0, // speed
16*FRACUNIT, // radius 16*FRACUNIT, // radius
56*FRACUNIT, // height 48*FRACUNIT, // height
0, // display offset 0, // display offset
1000, // mass 1000, // mass
0, // damage 0, // damage
sfx_None, // activesound sfx_None, // activesound
MF_NOCLIP|MF_NOGRAVITY|MF_NOBLOCKMAP, // flags MF_NOCLIP|MF_NOGRAVITY, // flags
S_NULL // raisestate S_NULL // raisestate
}, },
@ -14398,7 +14398,7 @@ void P_ResetData(INT32 flags)
{ {
#ifndef ALLOW_RESETDATA #ifndef ALLOW_RESETDATA
(void)flags; (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 #else
if (flags & 1) if (flags & 1)
{ {

View file

@ -1842,7 +1842,7 @@ static int lib_gTicsToMilliseconds(lua_State *L)
static luaL_Reg lib[] = { static luaL_Reg lib[] = {
{"print", lib_print}, {"print", lib_print},
{"EvalMath", lib_evalMath,}, {"EvalMath", lib_evalMath},
// m_random // m_random
{"P_Random",lib_pRandom}, {"P_Random",lib_pRandom},

View file

@ -55,12 +55,13 @@ static lua_CFunction liblist[] = {
// Lua asks for memory using this. // Lua asks for memory using this.
static void *LUA_Alloc(void *ud, void *ptr, size_t osize, size_t nsize) static void *LUA_Alloc(void *ud, void *ptr, size_t osize, size_t nsize)
{ {
(void)ud; (void)osize; (void)ud;
if (nsize == 0) { if (nsize == 0) {
Z_Free(ptr); if (osize != 0)
Z_Free(ptr);
return NULL; return NULL;
} else } 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. // Panic function Lua calls when there's an unprotected error.
@ -183,7 +184,7 @@ void LUA_LoadLump(UINT16 wad, UINT16 lump)
char *name; char *name;
f.wad = wad; f.wad = wad;
f.size = W_LumpLengthPwad(wad, lump); 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); W_ReadLumpPwad(wad, lump, f.data);
f.curpos = f.data; f.curpos = f.data;
@ -307,7 +308,7 @@ fixed_t LUA_EvalMath(const char *word)
p = lua_tostring(L, -1); p = lua_tostring(L, -1);
while (*p++ != ':' && *p) ; while (*p++ != ':' && *p) ;
p += 3; // "1: " p += 3; // "1: "
CONS_Alert(CONS_WARNING, "%s", p); CONS_Alert(CONS_WARNING, "%s\n", p);
} }
else else
res = lua_tointeger(L, -1); res = lua_tointeger(L, -1);

View file

@ -5780,12 +5780,18 @@ void P_MobjThinker(mobj_t *mobj)
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
// Check for a Lua thinker first // Check for a Lua thinker first
if (!mobj->player && LUAh_MobjThinker(mobj)) if (!mobj->player)
return; {
else if (mobj->player && !mobj->player->spectator) 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); LUAh_MobjThinker(mobj);
if (P_MobjWasRemoved(mobj)) if (P_MobjWasRemoved(mobj))
return; return;
}
#endif #endif
// if it's pushable, or if it would be pushable other than temporary disablement, use the // if it's pushable, or if it would be pushable other than temporary disablement, use the
// separate thinker // separate thinker
@ -8262,7 +8268,7 @@ void P_SpawnMapThing(mapthing_t *mthing)
{ {
if ((i == MT_BLUEFLAG && blueflag) || (i == MT_REDFLAG && redflag)) 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; return;
} }
} }

View file

@ -2978,7 +2978,7 @@ static void P_ProcessLineSpecial(line_t *line, mobj_t *mo)
#ifdef HAVE_BLUA #ifdef HAVE_BLUA
LUAh_LinedefExecute(line, mo); LUAh_LinedefExecute(line, mo);
#else #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 #endif
break; break;

View file

@ -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) static void P_NightsTransferPoints(player_t *player, fixed_t xspeed, fixed_t radius)
{ {
mobj_t* targ;
if (player->pflags & PF_TRANSFERTOCLOSEST) if (player->pflags & PF_TRANSFERTOCLOSEST)
{ {
const angle_t fa = R_PointToAngle2(player->axis1->x, player->axis1->y, player->axis2->x, player->axis2->y); 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) if (player->exiting)
return; return;
// You're welcome, Rob. -Red // You're welcome, Rob. (Now with slightly less horrendous hacking -Red
targ = player->mo->target; player->mo->tracer->flags &= ~MF_NOCLIP;
if (!P_TryMove(player->mo, player->mo->x+player->mo->momx, player->mo->y+player->mo->momy, true)) 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; 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; const INT32 sequence = player->mo->target->threshold;
mobj_t *transfer1 = NULL; mobj_t *transfer1 = NULL;
@ -5735,14 +5731,6 @@ static void P_NiGHTSMovement(player_t *player)
P_NightsTransferPoints(player, xspeed, radius); 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) if (still)
player->mo->momz = -FRACUNIT; player->mo->momz = -FRACUNIT;
else else
@ -7221,8 +7209,11 @@ void P_NukeEnemies(mobj_t *inflictor, mobj_t *source, fixed_t radius)
{ {
fa = (i*(FINEANGLES/16)); fa = (i*(FINEANGLES/16));
mo = P_SpawnMobj(inflictor->x, inflictor->y, inflictor->z, MT_SUPERSPARK); mo = P_SpawnMobj(inflictor->x, inflictor->y, inflictor->z, MT_SUPERSPARK);
mo->momx = FixedMul(FINESINE(fa),ns); if (!P_MobjWasRemoved(mo))
mo->momy = FixedMul(FINECOSINE(fa),ns); {
mo->momx = FixedMul(FINESINE(fa),ns);
mo->momy = FixedMul(FINECOSINE(fa),ns);
}
} }
for (think = thinkercap.next; think != &thinkercap; think = think->next) for (think = thinkercap.next; think != &thinkercap; think = think->next)

View file

@ -1214,7 +1214,7 @@
C01FCF4B08A954540054247B /* Debug */ = { C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CURRENT_PROJECT_VERSION = 2.1.9; CURRENT_PROJECT_VERSION = 2.1.10;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)", "$(inherited)",
NORMALSRB2, NORMALSRB2,
@ -1226,7 +1226,7 @@
C01FCF4C08A954540054247B /* Release */ = { C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CURRENT_PROJECT_VERSION = 2.1.9; CURRENT_PROJECT_VERSION = 2.1.10;
GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (

View file

@ -1214,7 +1214,7 @@
C01FCF4B08A954540054247B /* Debug */ = { C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CURRENT_PROJECT_VERSION = 2.1.9; CURRENT_PROJECT_VERSION = 2.1.10;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)", "$(inherited)",
NORMALSRB2, NORMALSRB2,
@ -1226,7 +1226,7 @@
C01FCF4C08A954540054247B /* Release */ = { C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration; isa = XCBuildConfiguration;
buildSettings = { buildSettings = {
CURRENT_PROJECT_VERSION = 2.1.9; CURRENT_PROJECT_VERSION = 2.1.10;
GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO; GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (

View file

@ -167,9 +167,6 @@ void Z_Free(void *ptr)
if (ptr == NULL) if (ptr == NULL)
return; return;
#ifdef HAVE_BLUA
LUA_InvalidateUserdata(ptr);
#endif
#ifdef ZDEBUG2 #ifdef ZDEBUG2
CONS_Debug(DBG_MEMORY, "Z_Free %s:%d\n", file, line); 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); CONS_Debug(DBG_MEMORY, "Z_Free at %s:%d\n", file, line);
#endif #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 // TODO: if zdebugging, make sure no other block has a user
// that is about to be freed. // that is about to be freed.

View file

@ -34,12 +34,14 @@
// PU - purge tags. // PU - purge tags.
// Tags < PU_LEVEL are not purged until freed explicitly. // Tags < PU_LEVEL are not purged until freed explicitly.
#define PU_STATIC 1 // static entire execution time #define PU_STATIC 1 // static entire execution time
#define PU_SOUND 2 // static while playing #define PU_LUA 2 // static entire execution time -- used by lua so it doesn't get caught in loops forever
#define PU_MUSIC 3 // static while playing
#define PU_HUDGFX 4 // static until WAD added
#define PU_HWRPATCHINFO 5 // Hardware GLPatch_t struct for OpenGL texture cache #define PU_SOUND 11 // static while playing
#define PU_HWRPATCHCOLMIPMAP 6 // Hardware GLMipmap_t struct colromap variation of patch #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_HWRCACHE 48 // static until unlocked
#define PU_CACHE 49 // static until unlocked #define PU_CACHE 49 // static until unlocked

View file

@ -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, err(1, "cannot write lump %lu to %s", (unsigned long)ix,
fname); fname);