From 35ca16ba4f648da0acd402278131cecab7874f2c Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 20 Oct 2006 01:58:26 +0000 Subject: [PATCH] - Added the MF2_PASSMOBJ for P_Thing_Spawn() from January 4, 2003, to DLevelScript::DoSpawn(). - Changed VectorNormalize() (and VectorNormalize2) to use doubles for storing the vector lengths, fixing desyncs between GCC/VC++ games that happened because the two compilers produced slightly different results for some slopes. GCC kept them in registers, so they were never truncated to floats. VC++ stored them to memory and reloaded them in order to truncate them to the defined precision. Lesson learned: Floating point numbers in local variables should always be doubles to produce the best code with VC++ that has the best chance of matching GCC's default behavior. - Removed netget and netsend function pointers. PacketGet and PacketSend are now called directly. - Fixed: Watching a demo from the point of view of someone other than the first player could cause a crash when the demo ended. - Removed invcount from the expression evaluator at Grubber's suggestion, because it doesn't work. - Fixed: vid_nowidescreen should fire off setsizeneeded so that changes to it can happen immediately instead of at the next resolution change. SVN r355 (trunk) --- docs/rh-log.txt | 18 ++++++++++++++++++ src/g_game.cpp | 2 ++ src/i_net.cpp | 9 ++------- src/p_acs.cpp | 3 +++ src/p_setup.cpp | 1 - src/thingdef_exp.cpp | 42 ++---------------------------------------- src/v_video.cpp | 9 ++++++++- src/vectors.cpp | 24 ++++++++++++------------ 8 files changed, 47 insertions(+), 61 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 2d3e29aa8f..fd50a226c3 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,22 @@ October 19, 2006 +- Added the MF2_PASSMOBJ for P_Thing_Spawn() from January 4, 2003, to + DLevelScript::DoSpawn(). +- Changed VectorNormalize() (and VectorNormalize2) to use doubles for storing + the vector lengths, fixing desyncs between GCC/VC++ games that happened + because the two compilers produced slightly different results for some + slopes. GCC kept them in registers, so they were never truncated to floats. + VC++ stored them to memory and reloaded them in order to truncate them to + the defined precision. Lesson learned: Floating point numbers in local + variables should always be doubles to produce the best code with VC++ that + has the best chance of matching GCC's default behavior. +- Removed netget and netsend function pointers. PacketGet and PacketSend are + now called directly. +- Fixed: Watching a demo from the point of view of someone other than the + first player could cause a crash when the demo ended. +- Removed invcount from the expression evaluator at Grubber's suggestion, + because it doesn't work. +- Fixed: vid_nowidescreen should fire off setsizeneeded so that changes to it + can happen immediately instead of at the next resolution change. - Modified the way autosaves are done. Instead of setting gameaction to ga_autosave, write DEM_CHECKAUTOSAVE to the net stream. When this is processed, it will check if it's okay to do an autosave. If it is, it writes diff --git a/src/g_game.cpp b/src/g_game.cpp index cd14cc7db4..ef4c4af756 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -2526,6 +2526,8 @@ bool G_CheckDemoStatus (void) playeringame[i] = 0; } consoleplayer = 0; + players[0].camera = NULL; + StatusBar->AttachToPlayer (&players[0]); if (singledemo || timingdemo) { diff --git a/src/i_net.cpp b/src/i_net.cpp index bb7120bdae..5bfc07e18f 100644 --- a/src/i_net.cpp +++ b/src/i_net.cpp @@ -96,9 +96,6 @@ static SOCKET mysocket = INVALID_SOCKET; static sockaddr_in sendaddress[MAXNETNODES]; static BYTE sendplayer[MAXNETNODES]; -void (*netget) (void); -void (*netsend) (void); - #ifdef __WIN32__ char *neterror (void); #else @@ -351,8 +348,6 @@ void StartNetwork (bool autoPort) atterm (CloseNetwork); - netsend = PacketSend; - netget = PacketGet; netgame = true; multiplayer = true; @@ -828,11 +823,11 @@ void I_NetCmd (void) { if (doomcom.command == CMD_SEND) { - netsend (); + PacketSend (); } else if (doomcom.command == CMD_GET) { - netget (); + PacketGet (); } else I_Error ("Bad net cmd: %i\n",doomcom.command); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index c11fd21a75..ac7532fba3 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -1908,6 +1908,8 @@ int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, i actor = Spawn (info, x, y, z, ALLOW_REPLACE); if (actor != NULL) { + DWORD oldFlags2 = actor->flags2; + actor->flags2 |= MF2_PASSMOBJ; if (P_TestMobjLocation (actor)) { actor->angle = angle << 24; @@ -1915,6 +1917,7 @@ int DLevelScript::DoSpawn (int type, fixed_t x, fixed_t y, fixed_t z, int tid, i actor->AddToHash (); if (actor->flags & MF_SPECIAL) actor->flags |= MF_DROPPED; // Don't respawn + actor->flags2 = oldFlags2; } else { diff --git a/src/p_setup.cpp b/src/p_setup.cpp index cbac55f4f0..7337e78eda 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -1318,7 +1318,6 @@ static void P_SlopeLineToPoint (int lineid, fixed_t x, fixed_t y, fixed_t z, boo return; } VectorNormalize (cross); - // Fix backward normals if ((cross[2] < 0 && !slopeCeil) || (cross[2] > 0 && slopeCeil)) { diff --git a/src/thingdef_exp.cpp b/src/thingdef_exp.cpp index 23c8c2c957..2ae21248a9 100644 --- a/src/thingdef_exp.cpp +++ b/src/thingdef_exp.cpp @@ -88,7 +88,6 @@ enum ExpOp EX_Random, // random (min, max) EX_Sin, // sin (angle) EX_Cos, // cos (angle) - EX_InvCount, // invcount (type) EX_ActionSpecial, EX_Right, }; @@ -264,10 +263,7 @@ struct ExpData { if (Children[i]) { - if (Type == EX_InvCount) - free (Children[i]); - else - delete Children[i]; + delete Children[i]; } } } @@ -307,7 +303,7 @@ struct ExpData delete data; } } - else if (Type != EX_Random && Type != EX_Sin && Type != EX_Cos && Type != EX_InvCount && Type != EX_ActionSpecial) + else if (Type != EX_Random && Type != EX_Sin && Type != EX_Cos && Type != EX_ActionSpecial) { if (Children[0]->Type == EX_Const && Children[1]->Type == EX_Const) { @@ -751,22 +747,6 @@ static ExpData *ParseExpressionA () return data; } - else if (SC_CheckString ("invcount")) - { - if (!SC_CheckString ("(")) - SC_ScriptError ("'(' expected"); - - ExpData *data = new ExpData; - data->Type = EX_InvCount; - - SC_MustGetString (); - data->Children[0] = (ExpData *)strdup (sc_String); - - if (!SC_CheckString (")")) - SC_ScriptError ("')' expected"); - - return data; - } else if (SC_CheckNumber ()) { ExpData *data = new ExpData; @@ -1473,24 +1453,6 @@ static ExpVal EvalExpression (ExpData *data, AActor *self) } break; - case EX_InvCount: - { - const char *name = (const char *)data->Children[0]; - const PClass *type = PClass::FindClass (name); - - val.Type = VAL_Int; - val.Int = 0; - - if (!type) - break; - - AInventory *item = self->FindInventory (type); - - if (item) - val.Int = item->Amount; - } - break; - case EX_ActionSpecial: { int parms[5] = { 0, 0, 0, 0 }; diff --git a/src/v_video.cpp b/src/v_video.cpp index 29c4942175..aac21ebf84 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -942,7 +942,14 @@ void V_Shutdown() } EXTERN_CVAR (Bool, vid_tft) -CVAR (Bool, vid_nowidescreen, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) +CUSTOM_CVAR (Bool, vid_nowidescreen, false, CVAR_GLOBALCONFIG|CVAR_ARCHIVE) +{ + setsizeneeded = true; + if (StatusBar != NULL) + { + StatusBar->ScreenSizeChanged(); + } +} // Tries to guess the physical dimensions of the screen based on the // screen's pixel dimensions. Can return: diff --git a/src/vectors.cpp b/src/vectors.cpp index c6976d414f..455b975382 100644 --- a/src/vectors.cpp +++ b/src/vectors.cpp @@ -64,39 +64,39 @@ int VectorCompare (const vec3_t v1, const vec3_t v2) vec_t VectorNormalize (vec3_t v) { - float length, ilength; + double length, ilength; length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; - length = sqrtf (length); + length = sqrt (length); if (length) { ilength = 1/length; - v[0] *= ilength; - v[1] *= ilength; - v[2] *= ilength; + v[0] = vec_t(v[0] * ilength); + v[1] = vec_t(v[1] * ilength); + v[2] = vec_t(v[2] * ilength); } - return length; + return vec_t(length); } vec_t VectorNormalize2 (const vec3_t v, vec3_t out) { - float length, ilength; + double length, ilength; length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; - length = sqrtf (length); + length = sqrt (length); if (length) { ilength = 1/length; - out[0] = v[0]*ilength; - out[1] = v[1]*ilength; - out[2] = v[2]*ilength; + out[0] = vec_t(v[0] * ilength); + out[1] = vec_t(v[1] * ilength); + out[2] = vec_t(v[2] * ilength); } - return length; + return vec_t(length); }