This commit is contained in:
Christoph Oelckers 2015-02-08 11:54:39 +01:00
commit 34c4041a44
20 changed files with 95 additions and 81 deletions

View file

@ -2056,6 +2056,8 @@ void FDynamicBuffer::SetData (const BYTE *data, int len)
else
{
m_Len = 0;
M_Free(m_Data);
m_Data = NULL;
}
}

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

@ -73,6 +73,7 @@ CVAR (Bool, hud_showitems, false,CVAR_ARCHIVE); // Show item stats on HUD
CVAR (Bool, hud_showstats, false, CVAR_ARCHIVE); // for stamina and accuracy.
CVAR (Bool, hud_showscore, false, CVAR_ARCHIVE); // for user maintained score
CVAR (Bool, hud_showweapons, true, CVAR_ARCHIVE); // Show weapons collected
CVAR (Int , hud_showammo, 2, CVAR_ARCHIVE); // Show ammo collected
CVAR (Int , hud_showtime, 0, CVAR_ARCHIVE); // Show time on HUD
CVAR (Int , hud_timecolor, CR_GOLD,CVAR_ARCHIVE); // Color of in-game time on HUD
CVAR (Int , hud_showlag, 0, CVAR_ARCHIVE); // Show input latency (maketic - gametic difference)
@ -547,15 +548,28 @@ static int DrawAmmo(player_t *CPlayer, int x, int y)
orderedammos.Clear();
if (0 == hud_showammo)
{
// Show ammo for current weapon if any
if (wi) AddAmmoToList(wi);
}
else
{
// Order ammo by use of weapons in the weapon slots
// Do not check for actual presence in the inventory!
// We want to show all ammo types that can be used by
// the weapons in the weapon slots.
for (k = 0; k < NUM_WEAPON_SLOTS; k++) for(j = 0; j < CPlayer->weapons.Slots[k].Size(); j++)
{
const PClass *weap = CPlayer->weapons.Slots[k].GetWeapon(j);
if (weap) AddAmmoToList((AWeapon*)GetDefaultByType(weap));
if (weap)
{
// Show ammo for available weapons if hud_showammo CVAR is 1
// or show ammo for all weapons if hud_showammo is greater than 1
if (hud_showammo > 1 || CPlayer->mo->FindInventory(weap))
{
AddAmmoToList((AWeapon*)GetDefaultByType(weap));
}
}
}
// Now check for the remaining weapons that are in the inventory but not in the weapon slots
@ -566,6 +580,7 @@ static int DrawAmmo(player_t *CPlayer, int x, int y)
AddAmmoToList((AWeapon*)inv);
}
}
}
// ok, we got all ammo types. Now draw the list back to front (bottom to top)

View file

@ -937,13 +937,10 @@ void FNodeBuilder::SetNodeFromSeg (node_t &node, const FPrivSeg *pseg) const
DWORD FNodeBuilder::SplitSeg (DWORD segnum, int splitvert, int v1InFront)
{
double dx, dy;
FPrivSeg newseg;
int newnum = (int)Segs.Size();
newseg = Segs[segnum];
dx = double(Vertices[splitvert].x - Vertices[newseg.v1].x);
dy = double(Vertices[splitvert].y - Vertices[newseg.v1].y);
if (v1InFront > 0)
{
newseg.v1 = splitvert;
@ -1129,8 +1126,7 @@ int ClassifyLineBackpatchC (node_t &node, const FSimpleVert *v1, const FSimpleVe
long pagesize = sysconf(_SC_PAGESIZE);
char *callerpage = (char *)((intptr_t)calleroffset & ~(pagesize - 1));
size_t protectlen = (intptr_t)calleroffset + sizeof(void*) - (intptr_t)callerpage;
int ptect;
if (!(ptect = mprotect(callerpage, protectlen, PROT_READ|PROT_WRITE|PROT_EXEC)))
if (!mprotect(callerpage, protectlen, PROT_READ|PROT_WRITE|PROT_EXEC))
#endif
{
*calleroffset = diff;

View file

@ -317,7 +317,6 @@ int FNodeBuilder::CloseSubsector (TArray<glseg_t> &segs, int subsector, vertex_t
{
angle_t bestdiff = ANGLE_MAX;
FPrivSeg *bestseg = NULL;
DWORD bestj = DWORD_MAX;
j = first;
do
{
@ -328,14 +327,12 @@ int FNodeBuilder::CloseSubsector (TArray<glseg_t> &segs, int subsector, vertex_t
{
bestdiff = diff;
bestseg = seg;
bestj = j;
break;
}
if (diff < bestdiff && diff > 0)
{
bestdiff = diff;
bestseg = seg;
bestj = j;
}
}
while (++j < max);

View file

@ -176,7 +176,7 @@ void FNodeBuilder::AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset,
{
if (prev != NULL)
{
DWORD fseg1, bseg1, fseg2, bseg2;
DWORD fseg1, bseg1;
DWORD fnseg, bnseg;
// Minisegs should only be added when they can create valid loops on both the front and
@ -186,8 +186,8 @@ void FNodeBuilder::AddMinisegs (const node_t &node, DWORD splitseg, DWORD &fset,
if ((fseg1 = CheckLoopStart (node.dx, node.dy, prev->Info.Vertex, event->Info.Vertex)) != DWORD_MAX &&
(bseg1 = CheckLoopStart (-node.dx, -node.dy, event->Info.Vertex, prev->Info.Vertex)) != DWORD_MAX &&
(fseg2 = CheckLoopEnd (node.dx, node.dy, event->Info.Vertex)) != DWORD_MAX &&
(bseg2 = CheckLoopEnd (-node.dx, -node.dy, prev->Info.Vertex)) != DWORD_MAX)
(CheckLoopEnd (node.dx, node.dy, event->Info.Vertex)) != DWORD_MAX &&
(CheckLoopEnd (-node.dx, -node.dy, prev->Info.Vertex)) != DWORD_MAX)
{
// Add miniseg on the front side
fnseg = AddMiniseg (prev->Info.Vertex, event->Info.Vertex, DWORD_MAX, fseg1, splitseg);

View file

@ -660,10 +660,7 @@ void ACSStringPool::ReadStrings(PNGHandle *png, DWORD id)
i++;
j = arc.ReadCount();
}
if (str != NULL)
{
delete[] str;
}
FindFirstFreeEntry(0);
}
}
@ -2052,7 +2049,6 @@ FBehavior::FBehavior (int lumpnum, FileReader * fr, int len)
}
}
}
i += 4+ArrayStore[arraynum].ArraySize;
}
}
@ -5846,13 +5842,13 @@ doplaysound: if (funcIndex == ACSF_PlayActorSound)
}
FActorIterator iterator(args[0]);
bool canraiseall = false;
bool canraiseall = true;
while ((actor = iterator.Next()))
{
canraiseall = !P_Thing_CanRaise(actor) | canraiseall;
canraiseall = P_Thing_CanRaise(actor) && canraiseall;
}
return !canraiseall;
return canraiseall;
}
break;

View file

@ -924,7 +924,7 @@ public:
{
const char *speakerName;
int x, y, linesize;
int width, fontheight;
int width=screen->GetWidth(), height=screen->GetHeight(), 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 * screen->GetWidth() / 320;
y = 16 * screen->GetHeight() / 200;
x = 16 * width / 320;
y = 16 * height / 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 * screen->GetWidth() / 320, 13 * screen->GetHeight() / 200,
308 * screen->GetWidth() / 320 - 14 * screen->GetWidth () / 320,
screen->Dim (0, 0.45f, 14 * width / 320, 13 * height / 200,
308 * width / 320 - 14 * width / 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 + screen->GetWidth()/2,
(mYpos - 2 - 100) * CleanYfac + screen->GetHeight()/2,
screen->Dim (0, 0.45f, (24-160) * CleanXfac + width/2,
(mYpos - 2 - 100) * CleanYfac + height/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 * screen->GetWidth() / 320;
x = 24 * width / 320;
for (int i = 0; mDialogueLines[i].Width >= 0; ++i)
{
screen->DrawText (SmallFont, CR_UNTRANSLATED, x, y, mDialogueLines[i].Text,
@ -1019,7 +1019,6 @@ 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);
@ -1037,8 +1036,8 @@ public:
{
int color = ((DMenu::MenuTime%8) < 4) || DMenu::CurrentMenu != this ? CR_RED:CR_GREY;
x = (50 + 3 - 160) * CleanXfac + screen->GetWidth() / 2;
int yy = (y + fontheight/2 - 5 - 100) * CleanYfac + screen->GetHeight() / 2;
x = (50 + 3 - 160) * CleanXfac + width / 2;
int yy = (y + fontheight/2 - 5 - 100) * CleanYfac + height / 2;
screen->DrawText (ConFont, color, x, yy, "\xd",
DTA_CellX, 8 * CleanXfac,
DTA_CellY, 8 * CleanYfac,

View file

@ -2544,8 +2544,6 @@ static bool P_CheckForResurrection(AActor *self, bool usevilestates)
// use the current actor's radius instead of the Arch Vile's default.
fixed_t maxdist = corpsehit->GetDefault()->radius + self->radius;
maxdist = corpsehit->GetDefault()->radius + self->radius;
if (abs(corpsehit->x - viletryx) > maxdist ||
abs(corpsehit->y - viletryy) > maxdist)
continue; // not actually touching

View file

@ -900,12 +900,12 @@ DElevator::DElevator ()
}
DElevator::DElevator (sector_t *sec)
: Super (sec)
: m_Interp_Floor(sec->SetInterpolation(sector_t::FloorMove, true)),
m_Interp_Ceiling(sec->SetInterpolation(sector_t::CeilingMove, true)),
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

@ -366,7 +366,7 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags)
if (debugfile && this->player)
{
static int dieticks[MAXPLAYERS];
static int dieticks[MAXPLAYERS]; // [ZzZombo] not used? Except if for peeking in debugger...
int pnum = int(this->player-players);
dieticks[pnum] = gametic;
fprintf (debugfile, "died (%d) on tic %d (%s)\n", pnum, gametic,
@ -1716,14 +1716,12 @@ void P_PoisonDamage (player_t *player, AActor *source, int damage,
bool playPainSound)
{
AActor *target;
AActor *inflictor;
if (player == NULL)
{
return;
}
target = player->mo;
inflictor = source;
if (target->health <= 0)
{
return;

View file

@ -755,12 +755,14 @@ bool PIT_CheckLine(line_t *ld, const FBoundingBox &box, FCheckPosition &tm)
if (!(tm.thing->flags & MF_DROPOFF) &&
!(tm.thing->flags & (MF_NOGRAVITY | MF_NOCLIP)))
{
secplane_t frontplane = ld->frontsector->floorplane;
secplane_t backplane = ld->backsector->floorplane;
secplane_t frontplane, backplane;
#ifdef _3DFLOORS
// Check 3D floors as well
frontplane = P_FindFloorPlane(ld->frontsector, tm.thing->x, tm.thing->y, tm.thing->floorz);
backplane = P_FindFloorPlane(ld->backsector, tm.thing->x, tm.thing->y, tm.thing->floorz);
#else
frontplane = ld->frontsector->floorplane;
backplane = ld->backsector->floorplane;
#endif
if (frontplane.c < STEEPSLOPE || backplane.c < STEEPSLOPE)
{
@ -2964,7 +2966,6 @@ bool FSlide::BounceWall(AActor *mo)
deltaangle = (2 * lineangle) - moveangle;
mo->angle = deltaangle;
lineangle >>= ANGLETOFINESHIFT;
deltaangle >>= ANGLETOFINESHIFT;
movelen = fixed_t(sqrt(double(mo->velx)*mo->velx + double(mo->vely)*mo->vely));
@ -3151,9 +3152,6 @@ bool aim_t::AimTraverse3DFloors(const divline_t &trace, intercept_t * in)
fixed_t trY = trace.y + FixedMul(trace.dy, in->frac);
fixed_t dist = FixedMul(attackrange, in->frac);
int dir = aimpitch < 0 ? 1 : aimpitch > 0 ? -1 : 0;
frontflag = P_PointOnLineSide(shootthing->x, shootthing->y, li);
// 3D floor check. This is not 100% accurate but normally sufficient when

View file

@ -1979,11 +1979,7 @@ fixed_t P_XYMovement (AActor *mo, fixed_t scrollx, fixed_t scrolly)
bool blockingtg = (BlockingMobj->target != NULL);
if (BlockingMobj->flags7 & MF7_AIMREFLECT && (tg || blockingtg))
{
AActor *origin;
if (tg)
origin = mo->target;
else if (blockingtg)
origin = BlockingMobj->target;
AActor *origin=tg ? mo->target : BlockingMobj->target;
float speed = (float)(mo->Speed);
//dest->x - source->x
@ -3496,11 +3492,13 @@ void AActor::Tick ()
velz <= 0 &&
floorz == z)
{
secplane_t floorplane = floorsector->floorplane;
secplane_t floorplane;
#ifdef _3DFLOORS
// Check 3D floors as well
floorplane = P_FindFloorPlane(floorsector, x, y, floorz);
#else
floorplane = floorsector->floorplane;
#endif
if (floorplane.c < STEEPSLOPE &&
@ -5631,18 +5629,25 @@ static fixed_t GetDefaultSpeed(const PClass *type)
AActor *P_SpawnMissile (AActor *source, AActor *dest, const PClass *type, AActor *owner)
{
if(!source)
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)
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)
return NULL;
if (dest == NULL)
{
Printf ("P_SpawnMissilyXYZ: Tried to shoot %s from %s with no dest\n",
@ -5712,6 +5717,8 @@ 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)
return NULL;
angle_t an;
fixed_t dist;
AActor *th = Spawn (type, source->x, source->y, source->z + 4*8*FRACUNIT, ALLOW_REPLACE);
@ -5753,6 +5760,8 @@ 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)
return NULL;
return P_SpawnMissileAngleZSpeed (source, source->z + 32*FRACUNIT + source->GetBobOffset(),
type, angle, velz, GetDefaultSpeed (type));
}
@ -5760,12 +5769,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)
return NULL;
angle_t an;
fixed_t dist;
fixed_t speed;
@ -5796,6 +5809,8 @@ 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)
return NULL;
return P_SpawnMissileAngleZSpeed (source, source->z + 32*FRACUNIT + source->GetBobOffset(),
type, angle, velz, speed);
}
@ -5803,6 +5818,8 @@ 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)
return NULL;
AActor *mo;
if (z != ONFLOORZ && z != ONCEILINGZ && source != NULL)
@ -5840,6 +5857,8 @@ AActor *P_SpawnMissileAngleZSpeed (AActor *source, fixed_t z,
AActor *P_SpawnPlayerMissile (AActor *source, const PClass *type)
{
if(!source)
return NULL;
return P_SpawnPlayerMissile (source, 0, 0, 0, type, source->angle);
}

View file

@ -1362,7 +1362,7 @@ void P_LoadSegs (MapData * map)
}
}
}
catch (badseg bad)
catch (const badseg &bad) // the preferred way is to catch by (const) reference.
{
switch (bad.badtype)
{
@ -1467,7 +1467,6 @@ void P_LoadSubsectors (MapData * map)
void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
{
char fname[9];
int i;
char *msp;
mapsector_t *ms;
@ -1486,7 +1485,6 @@ void P_LoadSectors (MapData *map, FMissingTextureTracker &missingtex)
defSeqType = -1;
fogMap = normMap = NULL;
fname[8] = 0;
msp = new char[lumplen];
map->Read(ML_SECTORS, msp);
@ -3044,16 +3042,14 @@ 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.
//
struct linf { short tag; WORD count; };
line_t** linebuffer;
static void P_GroupLines (bool buildmap)
{
@ -3062,7 +3058,6 @@ static void P_GroupLines (bool buildmap)
int i;
int j;
int total;
int totallights;
line_t* li;
sector_t* sector;
FBoundingBox bbox;
@ -3095,7 +3090,6 @@ static void P_GroupLines (bool buildmap)
// count number of lines in each sector
times[1].Clock();
total = 0;
totallights = 0;
for (i = 0, li = lines; i < numlines; i++, li++)
{
if (li->frontsector == NULL)

View file

@ -529,11 +529,9 @@ static void P_AlignPlane (sector_t *sec, line_t *line, int which)
FVector3 p, v1, v2, cross;
const secplane_t *refplane;
secplane_t *srcplane;
fixed_t srcheight, destheight;
refplane = (which == 0) ? &refsec->floorplane : &refsec->ceilingplane;
srcplane = (which == 0) ? &sec->floorplane : &sec->ceilingplane;
srcheight = (which == 0) ? sec->GetPlaneTexZ(sector_t::floor) : sec->GetPlaneTexZ(sector_t::ceiling);
destheight = (which == 0) ? refsec->GetPlaneTexZ(sector_t::floor) : refsec->GetPlaneTexZ(sector_t::ceiling);

View file

@ -188,8 +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)
{
fixed_t fogDelta = thing->flags & MF_MISSILE ? 0 : TELEFOGHEIGHT;
P_SpawnTeleportFog(thing, oldx, oldy, oldz, true, true); //Passes the actor through which then pulls the TeleFog metadate types based on properties.
P_SpawnTeleportFog(thing, oldx, oldy, oldz, true, true); //Passes the actor through then pulls the TeleFog metadata types based on properties.
}
if (useFog)
{

View file

@ -135,7 +135,6 @@ class USDFParser : public UDMFParserBase
while (!sc.CheckToken('}'))
{
bool block = false;
int costs = 0;
FName key = ParseKey(true, &block);
if (!block)
{

View file

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

View file

@ -438,7 +438,6 @@ void R_MapTiltedPlane (int y, int x1)
}
startu = endu;
startv = endv;
startz = endz;
width -= SPANSIZE;
}
if (width > 0)

View file

@ -795,6 +795,13 @@ OptionValue "AltHUDScale"
2, "Pixel double"
}
OptionValue "AltHUDAmmo"
{
0, "Current weapon"
1, "Available weapons"
2, "All weapons"
}
OptionValue "AltHUDTime"
{
0, "Off"
@ -828,6 +835,7 @@ OptionMenu "AltHUDOptions"
Option "Show stamina and accuracy", "hud_showstats", "OnOff"
Option "Show berserk", "hud_berserk_health", "OnOff"
Option "Show weapons", "hud_showweapons", "OnOff"
Option "Show ammo for", "hud_showammo", "AltHUDAmmo"
Option "Show time", "hud_showtime", "AltHUDTime"
Option "Time color", "hud_timecolor", "TextColors"
Option "Show network latency", "hud_showlag", "AltHUDLag"