Undo most of ZzZombo's changes

- "If it ain't broke, don't fix it."
- Some of the changes were downright wrong and some were pointless, so undo
  everything that doesn't look like an actual improvement.
This commit is contained in:
Randy Heit 2015-02-08 20:39:55 -06:00
parent 2d7592c2c3
commit fd7ed2bc25
21 changed files with 89 additions and 66 deletions

View File

@ -1234,16 +1234,9 @@ void AM_initVariables ()
for (pnum=0;pnum<MAXPLAYERS;pnum++)
if (playeringame[pnum])
break;
// [ZzZombo] no access out of bounds.
if(pnum>=MAXPLAYERS)
{
m_x=m_y=0;
}
else
{
m_x = (players[pnum].camera->x >> FRACTOMAPBITS) - m_w/2;
m_y = (players[pnum].camera->y >> FRACTOMAPBITS) - m_h/2;
}
assert(pnum >= 0 && pnum < MAXPLAYERS);
m_x = (players[pnum].camera->x >> FRACTOMAPBITS) - m_w/2;
m_y = (players[pnum].camera->y >> FRACTOMAPBITS) - m_h/2;
AM_changeWindowLoc();
// for saving & restoring

View File

@ -61,8 +61,8 @@ void DBot::Serialize (FArchive &arc)
if (SaveVersion < 4515)
{
angle_t savedyaw=0;
int savedpitch=0;
angle_t savedyaw;
int savedpitch;
arc << savedyaw
<< savedpitch;
}

View File

@ -439,7 +439,7 @@ static BYTE HexToByte (const char *hex)
UCVarValue FBaseCVar::FromString (const char *value, ECVarType type)
{
UCVarValue ret;
int i=0;
int i;
switch (type)
{
@ -475,8 +475,11 @@ UCVarValue FBaseCVar::FromString (const char *value, ECVarType type)
// 0 1 2 3
ret.pGUID = NULL;
if(value)
for (; i < 38; i++)
if (value == NULL)
{
break;
}
for (i = 0; value[i] != 0 && i < 38; i++)
{
switch (i)
{
@ -1685,7 +1688,7 @@ void FBaseCVar::ListVars (const char *filter, bool plain)
flags & CVAR_MOD ? 'M' : ' ',
flags & CVAR_IGNORE ? 'X' : ' ',
var->GetName(),
var->GetGenericRep (CVAR_String).String);
var->GetGenericRep(CVAR_String).String);
}
}
var = var->m_Next;

View File

@ -20,11 +20,11 @@ struct FCompatValues
struct FMD5HashTraits
{
hash_t Hash(const FMD5Holder &key)
hash_t Hash(const FMD5Holder key)
{
return key.Hash;
}
int Compare(const FMD5Holder &left, const FMD5Holder &right)
int Compare(const FMD5Holder left, const FMD5Holder right)
{
return left.DWords[0] != right.DWords[0] ||
left.DWords[1] != right.DWords[1] ||

View File

@ -50,11 +50,12 @@ static FRandom pr_endtag;
//
//====================================================================
FConfigFile::FConfigFile () : PathName(NAME_None)
FConfigFile::FConfigFile ()
{
Sections = CurrentSection = NULL;
LastSectionPtr = &Sections;
CurrentEntry = NULL;
PathName = "";
OkayToWrite = true;
FileExisted = true;
}

View File

@ -1022,8 +1022,9 @@ FDecalLib::FTranslation *FDecalLib::GenerateTranslation (DWORD start, DWORD end)
return trans;
}
FDecalBase::FDecalBase () : Name(NAME_None)
FDecalBase::FDecalBase ()
{
Name = NAME_None;
}
FDecalBase::~FDecalBase ()
@ -1136,8 +1137,9 @@ const FDecalTemplate *FDecalGroup::GetDecal () const
return static_cast<const FDecalTemplate *>(remember);
}
FDecalAnimator::FDecalAnimator (const char *name) : Name(name)
FDecalAnimator::FDecalAnimator (const char *name)
{
Name = name;
}
FDecalAnimator::~FDecalAnimator ()

View File

@ -24,7 +24,7 @@ struct PSymbol
FName SymbolName;
protected:
PSymbol(FName name, ESymbolType type):SymbolName(name) { SymbolType = type; }
PSymbol(FName name, ESymbolType type) { SymbolType = type; SymbolName = name; }
};
// A constant value ---------------------------------------------------------

View File

@ -78,8 +78,9 @@ DMover::DMover ()
}
DMover::DMover (sector_t *sector)
: DSectorEffect (sector), interpolation(NULL)
: DSectorEffect (sector)
{
interpolation = NULL;
}
void DMover::Destroy()

View File

@ -241,7 +241,7 @@ struct FOptionalMapinfoData
{
FOptionalMapinfoData *Next;
FName identifier;
FOptionalMapinfoData():identifier(NAME_None) { Next = NULL; }
FOptionalMapinfoData() { Next = NULL; identifier = NAME_None; }
virtual ~FOptionalMapinfoData() {}
virtual FOptionalMapinfoData *Clone() const = 0;
};

View File

@ -16,7 +16,7 @@ class FWeaponSlot
{
public:
FWeaponSlot() { Clear(); }
FWeaponSlot(const FWeaponSlot &other):Weapons(other.Weapons) {}
FWeaponSlot(const FWeaponSlot &other) { Weapons = other.Weapons; }
FWeaponSlot &operator= (const FWeaponSlot &other) { Weapons = other.Weapons; return *this; }
void Clear() { Weapons.Clear(); }
bool AddWeapon (const char *type);

View File

@ -238,7 +238,7 @@ void PacketSend (void)
else
{
// Printf("send %d\n", doomcom.datalength);
/*c = */sendto(mysocket, (char *)doomcom.data, doomcom.datalength,
c = sendto(mysocket, (char *)doomcom.data, doomcom.datalength,
0, (sockaddr *)&sendaddress[doomcom.remotenode],
sizeof(sendaddress[doomcom.remotenode]));
}

View File

@ -55,8 +55,8 @@ DArgs::DArgs()
//
//===========================================================================
DArgs::DArgs(const DArgs &other):Argv(other.Argv),
DObject()
DArgs::DArgs(const DArgs &other)
: DObject(), Argv(other.Argv)
{
}

View File

@ -261,10 +261,11 @@ protected:
public:
bool mEnabled;
FListMenuItem(int xpos = 0, int ypos = 0, FName action = NAME_None):mAction(action)
FListMenuItem(int xpos = 0, int ypos = 0, FName action = NAME_None)
{
mXpos = xpos;
mYpos = ypos;
mAction = action;
mEnabled = true;
}

View File

@ -660,7 +660,10 @@ void ACSStringPool::ReadStrings(PNGHandle *png, DWORD id)
i++;
j = arc.ReadCount();
}
delete[] str;
if (str != NULL)
{
delete[] str;
}
FindFirstFreeEntry(0);
}
}
@ -5845,7 +5848,7 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
bool canraiseall = true;
while ((actor = iterator.Next()))
{
canraiseall = P_Thing_CanRaise(actor) && canraiseall;
canraiseall = P_Thing_CanRaise(actor) & canraiseall;
}
return canraiseall;

View File

@ -924,7 +924,7 @@ public:
{
const char *speakerName;
int x, y, linesize;
int width=screen->GetWidth(), height=screen->GetHeight(), fontheight;
int width, fontheight;
player_t *cp = &players[consoleplayer];
@ -949,8 +949,8 @@ public:
{
screen->DrawTexture (TexMan(CurNode->Backdrop), 0, 0, DTA_320x200, true, TAG_DONE);
}
x = 16 * width / 320;
y = 16 * height / 200;
x = 16 * screen->GetWidth() / 320;
y = 16 * screen->GetHeight() / 200;
linesize = 10 * CleanYfac;
// Who is talking to you?
@ -970,16 +970,16 @@ public:
int i;
for (i = 0; mDialogueLines[i].Width >= 0; ++i)
{ }
screen->Dim (0, 0.45f, 14 * width / 320, 13 * height / 200,
308 * width / 320 - 14 * width / 320,
screen->Dim (0, 0.45f, 14 * screen->GetWidth() / 320, 13 * screen->GetHeight() / 200,
308 * screen->GetWidth() / 320 - 14 * screen->GetWidth () / 320,
speakerName == NULL ? linesize * i + 6 * CleanYfac
: linesize * i + 6 * CleanYfac + linesize * 3/2);
}
// Dim the screen behind the PC's choices.
screen->Dim (0, 0.45f, (24-160) * CleanXfac + width/2,
(mYpos - 2 - 100) * CleanYfac + height/2,
screen->Dim (0, 0.45f, (24-160) * CleanXfac + screen->GetWidth()/2,
(mYpos - 2 - 100) * CleanYfac + screen->GetHeight()/2,
272 * CleanXfac,
MIN<int>(mResponseLines.Size() * OptionSettings.mLinespacing + 4, 200 - mYpos) * CleanYfac);
@ -989,7 +989,7 @@ public:
DTA_CleanNoMove, true, TAG_DONE);
y += linesize * 3 / 2;
}
x = 24 * width / 320;
x = 24 * screen->GetWidth() / 320;
for (int i = 0; mDialogueLines[i].Width >= 0; ++i)
{
screen->DrawText (SmallFont, CR_UNTRANSLATED, x, y, mDialogueLines[i].Text,
@ -1019,6 +1019,7 @@ public:
int response = 0;
for (unsigned i = 0; i < mResponseLines.Size(); i++, y += fontheight)
{
width = SmallFont->StringWidth(mResponseLines[i]);
x = 64;
screen->DrawText (SmallFont, CR_GREEN, x, y, mResponseLines[i], DTA_Clean, true, TAG_DONE);
@ -1036,8 +1037,8 @@ public:
{
int color = ((DMenu::MenuTime%8) < 4) || DMenu::CurrentMenu != this ? CR_RED:CR_GREY;
x = (50 + 3 - 160) * CleanXfac + width / 2;
int yy = (y + fontheight/2 - 5 - 100) * CleanYfac + height / 2;
x = (50 + 3 - 160) * CleanXfac + screen->GetWidth() / 2;
int yy = (y + fontheight/2 - 5 - 100) * CleanYfac + screen->GetHeight() / 2;
screen->DrawText (ConFont, color, x, yy, "\xd",
DTA_CellX, 8 * CleanXfac,
DTA_CellY, 8 * CleanYfac,

View File

@ -900,12 +900,12 @@ DElevator::DElevator ()
}
DElevator::DElevator (sector_t *sec)
: m_Interp_Floor(sec->SetInterpolation(sector_t::FloorMove, true)),
m_Interp_Ceiling(sec->SetInterpolation(sector_t::CeilingMove, true)),
Super (sec)
: Super (sec)
{
sec->floordata = this;
sec->ceilingdata = this;
m_Interp_Floor = sec->SetInterpolation(sector_t::FloorMove, true);
m_Interp_Ceiling = sec->SetInterpolation(sector_t::CeilingMove, true);
}
void DElevator::Serialize (FArchive &arc)

View File

@ -1977,9 +1977,9 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
{
bool tg = (mo->target != NULL);
bool blockingtg = (BlockingMobj->target != NULL);
if (BlockingMobj->flags7 & MF7_AIMREFLECT && (tg || blockingtg))
if ((BlockingMobj->flags7 & MF7_AIMREFLECT) && (tg | blockingtg))
{
AActor *origin=tg ? mo->target : BlockingMobj->target;
AActor *origin = tg ? mo->target : BlockingMobj->target;
float speed = (float)(mo->Speed);
//dest->x - source->x
@ -1991,7 +1991,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
}
else
{
if (BlockingMobj->flags7 & MF7_MIRRORREFLECT && (tg || blockingtg))
if ((BlockingMobj->flags7 & MF7_MIRRORREFLECT) && (tg | blockingtg))
{
mo->angle += ANGLE_180;
mo->velx = -mo->velx / 2;
@ -3498,7 +3498,7 @@ void AActor::Tick ()
// Check 3D floors as well
floorplane = P_FindFloorPlane(floorsector, x, y, floorz);
#else
floorplane = floorsector->floorplane;
floorplane = floorsector->floorplane;
#endif
if (floorplane.c < STEEPSLOPE &&
@ -5629,24 +5629,30 @@ static fixed_t GetDefaultSpeed(const PClass *type)
AActor *P_SpawnMissile (AActor *source, AActor *dest, const PClass *type, AActor *owner)
{
if(!source)
if (source == NULL)
{
return NULL;
}
return P_SpawnMissileXYZ (source->x, source->y, source->z + 32*FRACUNIT + source->GetBobOffset(),
source, dest, type, true, owner);
}
AActor *P_SpawnMissileZ (AActor *source, fixed_t z, AActor *dest, const PClass *type)
{
if(!source)
if (source == NULL)
{
return NULL;
}
return P_SpawnMissileXYZ (source->x, source->y, z, source, dest, type);
}
AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
AActor *source, AActor *dest, const PClass *type, bool checkspawn, AActor *owner)
{
if(!source)
if (source == NULL)
{
return NULL;
}
if (dest == NULL)
{
@ -5717,8 +5723,10 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z,
AActor * P_OldSpawnMissile(AActor * source, AActor * owner, AActor * dest, const PClass *type)
{
if(!source)
if (source == NULL)
{
return NULL;
}
angle_t an;
fixed_t dist;
AActor *th = Spawn (type, source->x, source->y, source->z + 4*8*FRACUNIT, ALLOW_REPLACE);
@ -5760,8 +5768,10 @@ AActor * P_OldSpawnMissile(AActor * source, AActor * owner, AActor * dest, const
AActor *P_SpawnMissileAngle (AActor *source, const PClass *type,
angle_t angle, fixed_t velz)
{
if(!source)
if (source == NULL)
{
return NULL;
}
return P_SpawnMissileAngleZSpeed (source, source->z + 32*FRACUNIT + source->GetBobOffset(),
type, angle, velz, GetDefaultSpeed (type));
}
@ -5769,16 +5779,16 @@ AActor *P_SpawnMissileAngle (AActor *source, const PClass *type,
AActor *P_SpawnMissileAngleZ (AActor *source, fixed_t z,
const PClass *type, angle_t angle, fixed_t velz)
{
if(!source)
return NULL;
return P_SpawnMissileAngleZSpeed (source, z, type, angle, velz,
GetDefaultSpeed (type));
}
AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, const PClass *type)
{
if(!source)
if (source == NULL)
{
return NULL;
}
angle_t an;
fixed_t dist;
fixed_t speed;
@ -5809,8 +5819,10 @@ AActor *P_SpawnMissileZAimed (AActor *source, fixed_t z, AActor *dest, const PCl
AActor *P_SpawnMissileAngleSpeed (AActor *source, const PClass *type,
angle_t angle, fixed_t velz, fixed_t speed)
{
if(!source)
if (source == NULL)
{
return NULL;
}
return P_SpawnMissileAngleZSpeed (source, source->z + 32*FRACUNIT + source->GetBobOffset(),
type, angle, velz, speed);
}
@ -5818,11 +5830,13 @@ AActor *P_SpawnMissileAngleSpeed (AActor *source, const PClass *type,
AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z,
const PClass *type, angle_t angle, fixed_t velz, fixed_t speed, AActor *owner, bool checkspawn)
{
if(!source)
if (source == NULL)
{
return NULL;
}
AActor *mo;
if (z != ONFLOORZ && z != ONCEILINGZ && source != NULL)
if (z != ONFLOORZ && z != ONCEILINGZ)
{
z -= source->floorclip;
}
@ -5857,8 +5871,10 @@ AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z,
AActor *P_SpawnPlayerMissile (AActor *source, const PClass *type)
{
if(!source)
if (source == NULL)
{
return NULL;
}
return P_SpawnPlayerMissile (source, 0, 0, 0, type, source->angle);
}

View File

@ -3042,14 +3042,13 @@ void P_LoadBlockMap (MapData * map)
blockmap = blockmaplump+4;
}
line_t** linebuffer;
//
// P_GroupLines
// Builds sector line lists and subsector sector numbers.
// Finds block bounding boxes for sectors.
// [RH] Handles extra lights.
// [RH] Handles extra lights
//
line_t** linebuffer;
static void P_GroupLines (bool buildmap)
{

View File

@ -188,7 +188,7 @@ bool P_Teleport (AActor *thing, fixed_t x, fixed_t y, fixed_t z, angle_t angle,
// Spawn teleport fog at source and destination
if (sourceFog && !predicting)
{
P_SpawnTeleportFog(thing, oldx, oldy, oldz, true, true); //Passes the actor through then pulls the TeleFog metadata types based on properties.
P_SpawnTeleportFog(thing, oldx, oldy, oldz, true, true); //Passes the actor through which then pulls the TeleFog metadata types based on properties.
}
if (useFog)
{

View File

@ -101,10 +101,11 @@ FPlayerClass::FPlayerClass ()
Flags = 0;
}
FPlayerClass::FPlayerClass (const FPlayerClass &other) : Skins(other.Skins)
FPlayerClass::FPlayerClass (const FPlayerClass &other)
{
Type = other.Type;
Flags = other.Flags;
Skins = other.Skins;
}
FPlayerClass::~FPlayerClass ()

View File

@ -152,9 +152,11 @@ struct ExpVal
class FxExpression
{
protected:
FxExpression(const FScriptPosition &pos):ScriptPosition(pos)
FxExpression(const FScriptPosition &pos)
: ScriptPosition(pos)
{
isresolved = false;
ScriptPosition = pos;
}
public:
virtual ~FxExpression() {}