This commit is contained in:
Christoph Oelckers 2016-10-06 21:21:46 +02:00
commit fc246be03e
12 changed files with 47 additions and 12 deletions

View file

@ -1999,7 +1999,7 @@ void G_DoLoadGame ()
{ {
// delete the resource file if anything goes wrong in here. // delete the resource file if anything goes wrong in here.
if (resfile != nullptr) delete resfile; if (resfile != nullptr) delete resfile;
return; throw;
} }
} }

View file

@ -1512,7 +1512,11 @@ void G_UnSnapshotLevel (bool hubLoad)
if (level.info->isValid()) if (level.info->isValid())
{ {
FSerializer arc; FSerializer arc;
if (!arc.OpenReader(&level.info->Snapshot)) return; if (!arc.OpenReader(&level.info->Snapshot))
{
I_Error("Failed to load savegame");
return;
}
G_SerializeLevel (arc, hubLoad); G_SerializeLevel (arc, hubLoad);
level.FromSnapshot = true; level.FromSnapshot = true;

View file

@ -23,6 +23,8 @@
#include "serializer.h" #include "serializer.h"
static FRandom pr_restore ("RestorePos"); static FRandom pr_restore ("RestorePos");
CVAR(Bool, r_pickupflash, true, CVAR_ARCHIVE);
IMPLEMENT_CLASS(PClassInventory) IMPLEMENT_CLASS(PClassInventory)
@ -1089,7 +1091,7 @@ void AInventory::Touch (AActor *toucher)
if (player != NULL) if (player != NULL)
{ {
PlayPickupSound (player->mo); PlayPickupSound (player->mo);
if (!(ItemFlags & IF_NOSCREENFLASH)) if (!(ItemFlags & IF_NOSCREENFLASH) && r_pickupflash)
{ {
player->bonuscount = BONUSADD; player->bonuscount = BONUSADD;
} }

View file

@ -214,6 +214,12 @@ DCeiling::DCeiling (sector_t *sec, double speed1, double speed2, int silent)
m_Speed = m_Speed1 = speed1; m_Speed = m_Speed1 = speed1;
m_Speed2 = speed2; m_Speed2 = speed2;
m_Silent = silent; m_Silent = silent;
m_BottomHeight = 0;
m_TopHeight = 0;
m_Direction = 0;
m_Texture = FNullTextureID();
m_Tag = 0;
m_OldDirection = 0;
} }
//============================================================================ //============================================================================

View file

@ -685,11 +685,30 @@ bool AActor::TakeInventory(PClassActor *itemclass, int amount, bool fromdecorate
void AActor::DestroyAllInventory () void AActor::DestroyAllInventory ()
{ {
while (Inventory != NULL) AInventory *inv = Inventory;
if (inv != nullptr)
{ {
AInventory *item = Inventory; TArray<AInventory *> toDelete;
item->Destroy ();
assert (item != Inventory); // Delete the list in a two stage approach.
// This is necessary because an item may destroy another item (e.g. sister weapons)
// which would break the list and leave parts of it undestroyed, maybe doing bad things later.
while (inv != nullptr)
{
toDelete.Push(inv);
AInventory *item = inv->Inventory;
inv->Inventory = nullptr;
inv->Owner = nullptr;
inv = item;
}
for (auto p : toDelete)
{
// the item may already have been deleted by another one, so check this here to avoid problems.
if (!(p->ObjectFlags & OF_EuthanizeMe))
{
p->Destroy();
}
}
} }
} }

View file

@ -657,7 +657,7 @@ DWORD *HMISong::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptrdi
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND) if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)
{ {
len = ReadVarLen(track); len = ReadVarLen(track);
if (len >= (MAX_EVENTS-1)*3*4) if (len >= (MAX_EVENTS-1)*3*4 || DeviceType == MDEV_SNDSYS)
{ // This message will never fit. Throw it away. { // This message will never fit. Throw it away.
track->TrackP += len; track->TrackP += len;
} }

View file

@ -598,7 +598,7 @@ DWORD *MIDISong2::SendCommand (DWORD *events, TrackInfo *track, DWORD delay, ptr
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND) if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)
{ {
len = track->ReadVarLen(); len = track->ReadVarLen();
if (len >= (MAX_EVENTS-1)*3*4) if (len >= (MAX_EVENTS-1)*3*4 || DeviceType == MDEV_SNDSYS)
{ // This message will never fit. Throw it away. { // This message will never fit. Throw it away.
track->TrackP += len; track->TrackP += len;
} }

View file

@ -528,7 +528,7 @@ DWORD *XMISong::SendCommand (DWORD *events, EventSource due, DWORD delay, ptrdif
if (event == MIDI_SYSEX || event == MIDI_SYSEXEND) if (event == MIDI_SYSEX || event == MIDI_SYSEXEND)
{ {
len = track->ReadVarLen(); len = track->ReadVarLen();
if (len >= (MAX_EVENTS-1)*3*4) if (len >= (MAX_EVENTS-1)*3*4 || DeviceType == MDEV_SNDSYS)
{ // This message will never fit. Throw it away. { // This message will never fit. Throw it away.
track->EventP += len; track->EventP += len;
} }

View file

@ -162,11 +162,11 @@ ZCC_OpProto *ZCC_OpInfoType::FindBestProto(
// [[float32 (op) int]] will choose the integer version instead of the floating point // [[float32 (op) int]] will choose the integer version instead of the floating point
// version, which we do not want. // version, which we do not want.
int test_dist1 = dist1, test_dist2 = dist2; int test_dist1 = dist1, test_dist2 = dist2;
if (routes[0][cur_route1][0]->ConvertConstant == FtoD) if (test_dist1 > 0 && routes[0][cur_route1][0]->ConvertConstant == FtoD)
{ {
test_dist1--; test_dist1--;
} }
if (routes[1][cur_route2][0]->ConvertConstant == FtoD) if (test_dist2 > 0 && routes[1][cur_route2][0]->ConvertConstant == FtoD)
{ {
test_dist2--; test_dist2--;
} }

View file

@ -75,12 +75,14 @@ ACTOR PointPusher
{ {
+NOBLOCKMAP +NOBLOCKMAP
+INVISIBLE +INVISIBLE
+NOCLIP
} }
ACTOR PointPuller ACTOR PointPuller
{ {
+NOBLOCKMAP +NOBLOCKMAP
+INVISIBLE +INVISIBLE
+NOCLIP
} }
// Bloody gibs ------------------------------------------------------------- // Bloody gibs -------------------------------------------------------------

View file

@ -1803,6 +1803,7 @@ DSPLYMNU_DIMCOLOR = "Dim color";
DSPLYMNU_MOVEBOB = "View bob amount while moving"; DSPLYMNU_MOVEBOB = "View bob amount while moving";
DSPLYMNU_STILLBOB = "View bob amount while not moving"; DSPLYMNU_STILLBOB = "View bob amount while not moving";
DSPLYMNU_BOBSPEED = "Weapon bob speed"; DSPLYMNU_BOBSPEED = "Weapon bob speed";
DSPLYMNU_PIFLASH = "Show pickup screen flash";
// HUD Options // HUD Options
HUDMNU_TITLE = "HUD Options"; HUDMNU_TITLE = "HUD Options";

View file

@ -688,6 +688,7 @@ OptionMenu "VideoOptions"
Option "$DSPLYMNU_STRETCHSKY", "r_stretchsky", "OnOff" Option "$DSPLYMNU_STRETCHSKY", "r_stretchsky", "OnOff"
Option "$DSPLYMNU_DRAWFUZZ", "r_drawfuzz", "Fuzziness" Option "$DSPLYMNU_DRAWFUZZ", "r_drawfuzz", "Fuzziness"
Slider "$DSPLYMNU_TRANSSOUL", "transsouls", 0.25, 1.0, 0.05, 2 Slider "$DSPLYMNU_TRANSSOUL", "transsouls", 0.25, 1.0, 0.05, 2
Option "$DSPLYMNU_PIFLASH", "r_pickupflash", "OnOff"
Option "$DSPLYMNU_FAKECONTRAST", "r_fakecontrast", "Contrast" Option "$DSPLYMNU_FAKECONTRAST", "r_fakecontrast", "Contrast"
Option "$DSPLYMNU_ROCKETTRAILS", "cl_rockettrails", "RocketTrailTypes" Option "$DSPLYMNU_ROCKETTRAILS", "cl_rockettrails", "RocketTrailTypes"
Option "$DSPLYMNU_BLOODTYPE", "cl_bloodtype", "BloodTypes" Option "$DSPLYMNU_BLOODTYPE", "cl_bloodtype", "BloodTypes"