- 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)
This commit is contained in:
Randy Heit 2006-10-20 01:58:26 +00:00
parent 7c1fbe7ee5
commit 35ca16ba4f
8 changed files with 47 additions and 61 deletions

View file

@ -1,4 +1,22 @@
October 19, 2006 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 - Modified the way autosaves are done. Instead of setting gameaction to
ga_autosave, write DEM_CHECKAUTOSAVE to the net stream. When this is 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 processed, it will check if it's okay to do an autosave. If it is, it writes

View file

@ -2526,6 +2526,8 @@ bool G_CheckDemoStatus (void)
playeringame[i] = 0; playeringame[i] = 0;
} }
consoleplayer = 0; consoleplayer = 0;
players[0].camera = NULL;
StatusBar->AttachToPlayer (&players[0]);
if (singledemo || timingdemo) if (singledemo || timingdemo)
{ {

View file

@ -96,9 +96,6 @@ static SOCKET mysocket = INVALID_SOCKET;
static sockaddr_in sendaddress[MAXNETNODES]; static sockaddr_in sendaddress[MAXNETNODES];
static BYTE sendplayer[MAXNETNODES]; static BYTE sendplayer[MAXNETNODES];
void (*netget) (void);
void (*netsend) (void);
#ifdef __WIN32__ #ifdef __WIN32__
char *neterror (void); char *neterror (void);
#else #else
@ -351,8 +348,6 @@ void StartNetwork (bool autoPort)
atterm (CloseNetwork); atterm (CloseNetwork);
netsend = PacketSend;
netget = PacketGet;
netgame = true; netgame = true;
multiplayer = true; multiplayer = true;
@ -828,11 +823,11 @@ void I_NetCmd (void)
{ {
if (doomcom.command == CMD_SEND) if (doomcom.command == CMD_SEND)
{ {
netsend (); PacketSend ();
} }
else if (doomcom.command == CMD_GET) else if (doomcom.command == CMD_GET)
{ {
netget (); PacketGet ();
} }
else else
I_Error ("Bad net cmd: %i\n",doomcom.command); I_Error ("Bad net cmd: %i\n",doomcom.command);

View file

@ -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); actor = Spawn (info, x, y, z, ALLOW_REPLACE);
if (actor != NULL) if (actor != NULL)
{ {
DWORD oldFlags2 = actor->flags2;
actor->flags2 |= MF2_PASSMOBJ;
if (P_TestMobjLocation (actor)) if (P_TestMobjLocation (actor))
{ {
actor->angle = angle << 24; 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 (); actor->AddToHash ();
if (actor->flags & MF_SPECIAL) if (actor->flags & MF_SPECIAL)
actor->flags |= MF_DROPPED; // Don't respawn actor->flags |= MF_DROPPED; // Don't respawn
actor->flags2 = oldFlags2;
} }
else else
{ {

View file

@ -1318,7 +1318,6 @@ static void P_SlopeLineToPoint (int lineid, fixed_t x, fixed_t y, fixed_t z, boo
return; return;
} }
VectorNormalize (cross); VectorNormalize (cross);
// Fix backward normals // Fix backward normals
if ((cross[2] < 0 && !slopeCeil) || (cross[2] > 0 && slopeCeil)) if ((cross[2] < 0 && !slopeCeil) || (cross[2] > 0 && slopeCeil))
{ {

View file

@ -88,7 +88,6 @@ enum ExpOp
EX_Random, // random (min, max) EX_Random, // random (min, max)
EX_Sin, // sin (angle) EX_Sin, // sin (angle)
EX_Cos, // cos (angle) EX_Cos, // cos (angle)
EX_InvCount, // invcount (type)
EX_ActionSpecial, EX_ActionSpecial,
EX_Right, EX_Right,
}; };
@ -264,10 +263,7 @@ struct ExpData
{ {
if (Children[i]) if (Children[i])
{ {
if (Type == EX_InvCount) delete Children[i];
free (Children[i]);
else
delete Children[i];
} }
} }
} }
@ -307,7 +303,7 @@ struct ExpData
delete data; 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) if (Children[0]->Type == EX_Const && Children[1]->Type == EX_Const)
{ {
@ -751,22 +747,6 @@ static ExpData *ParseExpressionA ()
return data; 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 ()) else if (SC_CheckNumber ())
{ {
ExpData *data = new ExpData; ExpData *data = new ExpData;
@ -1473,24 +1453,6 @@ static ExpVal EvalExpression (ExpData *data, AActor *self)
} }
break; 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: case EX_ActionSpecial:
{ {
int parms[5] = { 0, 0, 0, 0 }; int parms[5] = { 0, 0, 0, 0 };

View file

@ -942,7 +942,14 @@ void V_Shutdown()
} }
EXTERN_CVAR (Bool, vid_tft) 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 // Tries to guess the physical dimensions of the screen based on the
// screen's pixel dimensions. Can return: // screen's pixel dimensions. Can return:

View file

@ -64,39 +64,39 @@ int VectorCompare (const vec3_t v1, const vec3_t v2)
vec_t VectorNormalize (vec3_t v) 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 = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
length = sqrtf (length); length = sqrt (length);
if (length) if (length)
{ {
ilength = 1/length; ilength = 1/length;
v[0] *= ilength; v[0] = vec_t(v[0] * ilength);
v[1] *= ilength; v[1] = vec_t(v[1] * ilength);
v[2] *= ilength; v[2] = vec_t(v[2] * ilength);
} }
return length; return vec_t(length);
} }
vec_t VectorNormalize2 (const vec3_t v, vec3_t out) 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 = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
length = sqrtf (length); length = sqrt (length);
if (length) if (length)
{ {
ilength = 1/length; ilength = 1/length;
out[0] = v[0]*ilength; out[0] = vec_t(v[0] * ilength);
out[1] = v[1]*ilength; out[1] = vec_t(v[1] * ilength);
out[2] = v[2]*ilength; out[2] = vec_t(v[2] * ilength);
} }
return length; return vec_t(length);
} }