mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 05:40:44 +00:00
Merge branch 'master' of https://github.com/rheit/zdoom
This commit is contained in:
commit
024efc9e61
8 changed files with 88 additions and 58 deletions
|
@ -1167,7 +1167,7 @@ private:
|
||||||
bool FixMapthingPos();
|
bool FixMapthingPos();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void LinkToWorld (bool spawningmapthing=false, FPortalGroupArray *groups = NULL, sector_t *sector = NULL);
|
void LinkToWorld (bool spawningmapthing=false, sector_t *sector = NULL);
|
||||||
void UnlinkFromWorld ();
|
void UnlinkFromWorld ();
|
||||||
void AdjustFloorClip ();
|
void AdjustFloorClip ();
|
||||||
virtual void SetOrigin (fixed_t x, fixed_t y, fixed_t z, bool moving = false);
|
virtual void SetOrigin (fixed_t x, fixed_t y, fixed_t z, bool moving = false);
|
||||||
|
|
|
@ -2505,9 +2505,9 @@ static bool DoDehPatch()
|
||||||
{
|
{
|
||||||
if (PatchFile[25] < '3')
|
if (PatchFile[25] < '3')
|
||||||
{
|
{
|
||||||
|
Printf (PRINT_BOLD, "\"%s\" is an old and unsupported DeHackEd patch\n", PatchName);
|
||||||
delete[] PatchName;
|
delete[] PatchName;
|
||||||
delete[] PatchFile;
|
delete[] PatchFile;
|
||||||
Printf (PRINT_BOLD, "\"%s\" is an old and unsupported DeHackEd patch\n", PatchFile);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// fix for broken WolfenDoom patches which contain \0 characters in some places.
|
// fix for broken WolfenDoom patches which contain \0 characters in some places.
|
||||||
|
|
|
@ -381,13 +381,15 @@ int FIWadManager::CheckIWAD (const char *doomwaddir, WadStuff *wads)
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
|
static bool havepicked = false;
|
||||||
|
|
||||||
int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad, const char *zdoom_wad)
|
int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad, const char *zdoom_wad)
|
||||||
{
|
{
|
||||||
TArray<WadStuff> wads;
|
TArray<WadStuff> wads;
|
||||||
TArray<size_t> foundwads;
|
TArray<size_t> foundwads;
|
||||||
const char *iwadparm = Args->CheckValue ("-iwad");
|
const char *iwadparm = Args->CheckValue ("-iwad");
|
||||||
size_t numwads;
|
|
||||||
int pickwad;
|
int pickwad;
|
||||||
|
size_t numwads;
|
||||||
size_t i;
|
size_t i;
|
||||||
bool iwadparmfound = false;
|
bool iwadparmfound = false;
|
||||||
FString custwad;
|
FString custwad;
|
||||||
|
@ -536,26 +538,29 @@ int FIWadManager::IdentifyVersion (TArray<FString> &wadfiles, const char *iwad,
|
||||||
{
|
{
|
||||||
for (i = 0; i < numwads; ++i)
|
for (i = 0; i < numwads; ++i)
|
||||||
{
|
{
|
||||||
FString basename = ExtractFileBase (wads[i].Path);
|
FString basename = ExtractFileBase(wads[i].Path);
|
||||||
if (stricmp (basename, defaultiwad) == 0)
|
if (stricmp(basename, defaultiwad) == 0)
|
||||||
{
|
{
|
||||||
defiwad = (int)i;
|
defiwad = (int)i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pickwad = I_PickIWad (&wads[0], (int)numwads, queryiwad, defiwad);
|
if (!havepicked) // just use the first IWAD if the restart doesn't have a -iwad parameter. We cannot open the picker in fullscreen mode.
|
||||||
if (pickwad >= 0)
|
|
||||||
{
|
{
|
||||||
// The newly selected IWAD becomes the new default
|
pickwad = I_PickIWad(&wads[0], (int)numwads, queryiwad, defiwad);
|
||||||
FString basename = ExtractFileBase (wads[pickwad].Path);
|
if (pickwad >= 0)
|
||||||
defaultiwad = basename;
|
{
|
||||||
|
// The newly selected IWAD becomes the new default
|
||||||
|
FString basename = ExtractFileBase(wads[pickwad].Path);
|
||||||
|
defaultiwad = basename;
|
||||||
|
}
|
||||||
|
if (pickwad < 0)
|
||||||
|
exit(0);
|
||||||
|
havepicked = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pickwad < 0)
|
|
||||||
exit (0);
|
|
||||||
|
|
||||||
// zdoom.pk3 must always be the first file loaded and the IWAD second.
|
// zdoom.pk3 must always be the first file loaded and the IWAD second.
|
||||||
wadfiles.Clear();
|
wadfiles.Clear();
|
||||||
D_AddFile (wadfiles, zdoom_wad);
|
D_AddFile (wadfiles, zdoom_wad);
|
||||||
|
|
|
@ -5250,7 +5250,7 @@ void P_RadiusAttack(AActor *bombspot, AActor *bombsource, int bombdamage, int bo
|
||||||
double bombdistancefloat = 1.f / (double)(bombdistance - fulldamagedistance);
|
double bombdistancefloat = 1.f / (double)(bombdistance - fulldamagedistance);
|
||||||
double bombdamagefloat = (double)bombdamage;
|
double bombdamagefloat = (double)bombdamage;
|
||||||
|
|
||||||
FPortalGroupArray grouplist;
|
FPortalGroupArray grouplist(FPortalGroupArray::PGA_Full3d);
|
||||||
FMultiBlockThingsIterator it(grouplist, bombspot->X(), bombspot->Y(), bombspot->Z() - bombdistfix, bombspot->height + bombdistfix*2, bombdistfix);
|
FMultiBlockThingsIterator it(grouplist, bombspot->X(), bombspot->Y(), bombspot->Z() - bombdistfix, bombspot->height + bombdistfix*2, bombdistfix);
|
||||||
FMultiBlockThingsIterator::CheckResult cres;
|
FMultiBlockThingsIterator::CheckResult cres;
|
||||||
|
|
||||||
|
|
|
@ -435,7 +435,7 @@ bool AActor::FixMapthingPos()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void AActor::LinkToWorld (bool spawningmapthing, FPortalGroupArray *groups, sector_t *sector)
|
void AActor::LinkToWorld(bool spawningmapthing, sector_t *sector)
|
||||||
{
|
{
|
||||||
if (spawningmapthing && (flags4 & MF4_FIXMAPTHINGPOS) && sector == NULL)
|
if (spawningmapthing && (flags4 & MF4_FIXMAPTHINGPOS) && sector == NULL)
|
||||||
{
|
{
|
||||||
|
@ -457,7 +457,7 @@ void AActor::LinkToWorld (bool spawningmapthing, FPortalGroupArray *groups, sect
|
||||||
Sector = sector;
|
Sector = sector;
|
||||||
subsector = R_PointInSubsector(X(), Y()); // this is from the rendering nodes, not the gameplay nodes!
|
subsector = R_PointInSubsector(X(), Y()); // this is from the rendering nodes, not the gameplay nodes!
|
||||||
|
|
||||||
if ( !(flags & MF_NOSECTOR) )
|
if (!(flags & MF_NOSECTOR))
|
||||||
{
|
{
|
||||||
// invisible things don't go into the sector links
|
// invisible things don't go into the sector links
|
||||||
// killough 8/11/98: simpler scheme using pointer-to-pointer prev
|
// killough 8/11/98: simpler scheme using pointer-to-pointer prev
|
||||||
|
@ -482,51 +482,60 @@ void AActor::LinkToWorld (bool spawningmapthing, FPortalGroupArray *groups, sect
|
||||||
// When a node is deleted, its sector links (the links starting
|
// When a node is deleted, its sector links (the links starting
|
||||||
// at sector_t->touching_thinglist) are broken. When a node is
|
// at sector_t->touching_thinglist) are broken. When a node is
|
||||||
// added, new sector links are created.
|
// added, new sector links are created.
|
||||||
P_CreateSecNodeList (this, X(), Y());
|
P_CreateSecNodeList(this, X(), Y());
|
||||||
touching_sectorlist = sector_list; // Attach to thing
|
touching_sectorlist = sector_list; // Attach to thing
|
||||||
sector_list = NULL; // clear for next time
|
sector_list = NULL; // clear for next time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// link into blockmap (inert things don't need to be in the blockmap)
|
// link into blockmap (inert things don't need to be in the blockmap)
|
||||||
if ( !(flags & MF_NOBLOCKMAP) )
|
if (!(flags & MF_NOBLOCKMAP))
|
||||||
{
|
{
|
||||||
int x1 = GetSafeBlockX(X() - radius - bmaporgx);
|
FPortalGroupArray check(FPortalGroupArray::PGA_NoSectorPortals);
|
||||||
int x2 = GetSafeBlockX(X() + radius - bmaporgx);
|
|
||||||
int y1 = GetSafeBlockY(Y() - radius - bmaporgy);
|
|
||||||
int y2 = GetSafeBlockY(Y() + radius - bmaporgy);
|
|
||||||
|
|
||||||
if (x1 >= bmapwidth || x2 < 0 || y1 >= bmapheight || y2 < 0)
|
P_CollectConnectedGroups(Sector->PortalGroup, Pos(), Top(), radius, check);
|
||||||
{ // thing is off the map
|
|
||||||
BlockNode = NULL;
|
for (int i = -1; i < (int)check.Size(); i++)
|
||||||
}
|
{
|
||||||
else
|
fixedvec3 pos = i==-1? Pos() : PosRelative(check[i]);
|
||||||
{ // [RH] Link into every block this actor touches, not just the center one
|
|
||||||
FBlockNode **alink = &this->BlockNode;
|
int x1 = GetSafeBlockX(pos.x - radius - bmaporgx);
|
||||||
x1 = MAX (0, x1);
|
int x2 = GetSafeBlockX(pos.x + radius - bmaporgx);
|
||||||
y1 = MAX (0, y1);
|
int y1 = GetSafeBlockY(pos.y - radius - bmaporgy);
|
||||||
x2 = MIN (bmapwidth - 1, x2);
|
int y2 = GetSafeBlockY(pos.y + radius - bmaporgy);
|
||||||
y2 = MIN (bmapheight - 1, y2);
|
|
||||||
for (int y = y1; y <= y2; ++y)
|
if (x1 >= bmapwidth || x2 < 0 || y1 >= bmapheight || y2 < 0)
|
||||||
{
|
{ // thing is off the map
|
||||||
for (int x = x1; x <= x2; ++x)
|
BlockNode = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{ // [RH] Link into every block this actor touches, not just the center one
|
||||||
|
FBlockNode **alink = &this->BlockNode;
|
||||||
|
x1 = MAX(0, x1);
|
||||||
|
y1 = MAX(0, y1);
|
||||||
|
x2 = MIN(bmapwidth - 1, x2);
|
||||||
|
y2 = MIN(bmapheight - 1, y2);
|
||||||
|
for (int y = y1; y <= y2; ++y)
|
||||||
{
|
{
|
||||||
FBlockNode **link = &blocklinks[y*bmapwidth + x];
|
for (int x = x1; x <= x2; ++x)
|
||||||
FBlockNode *node = FBlockNode::Create (this, x, y, this->Sector->PortalGroup);
|
|
||||||
|
|
||||||
// Link in to block
|
|
||||||
if ((node->NextActor = *link) != NULL)
|
|
||||||
{
|
{
|
||||||
(*link)->PrevActor = &node->NextActor;
|
FBlockNode **link = &blocklinks[y*bmapwidth + x];
|
||||||
}
|
FBlockNode *node = FBlockNode::Create(this, x, y, this->Sector->PortalGroup);
|
||||||
node->PrevActor = link;
|
|
||||||
*link = node;
|
|
||||||
|
|
||||||
// Link in to actor
|
// Link in to block
|
||||||
node->PrevBlock = alink;
|
if ((node->NextActor = *link) != NULL)
|
||||||
node->NextBlock = NULL;
|
{
|
||||||
(*alink) = node;
|
(*link)->PrevActor = &node->NextActor;
|
||||||
alink = &node->NextBlock;
|
}
|
||||||
|
node->PrevActor = link;
|
||||||
|
*link = node;
|
||||||
|
|
||||||
|
// Link in to actor
|
||||||
|
node->PrevBlock = alink;
|
||||||
|
node->NextBlock = NULL;
|
||||||
|
(*alink) = node;
|
||||||
|
alink = &node->NextBlock;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -456,7 +456,7 @@ void AActor::Serialize (FArchive &arc)
|
||||||
if (arc.IsLoading ())
|
if (arc.IsLoading ())
|
||||||
{
|
{
|
||||||
touching_sectorlist = NULL;
|
touching_sectorlist = NULL;
|
||||||
LinkToWorld (false, NULL, Sector);
|
LinkToWorld (false, Sector);
|
||||||
AddToHash ();
|
AddToHash ();
|
||||||
SetShade (fillcolor);
|
SetShade (fillcolor);
|
||||||
if (player)
|
if (player)
|
||||||
|
|
|
@ -1107,7 +1107,25 @@ void P_CreateLinkedPortals()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//BuildBlockmap();
|
if (linkedPortals.Size() > 0)
|
||||||
|
{
|
||||||
|
// We need to relink all actors that may touch a linked line portal
|
||||||
|
TThinkerIterator<AActor> it;
|
||||||
|
AActor *actor;
|
||||||
|
while ((actor = it.Next()))
|
||||||
|
{
|
||||||
|
if (!(actor->flags & MF_NOBLOCKMAP))
|
||||||
|
{
|
||||||
|
FPortalGroupArray check(FPortalGroupArray::PGA_NoSectorPortals);
|
||||||
|
P_CollectConnectedGroups(actor->Sector->PortalGroup, actor->Pos(), actor->Top(), actor->radius, check);
|
||||||
|
if (check.Size() > 0)
|
||||||
|
{
|
||||||
|
actor->UnlinkFromWorld();
|
||||||
|
actor->LinkToWorld();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1208,7 +1226,7 @@ bool P_CollectConnectedGroups(int startgroup, const fixedvec3 &position, fixed_t
|
||||||
wsec = P_PointInSector(dx, dy); // get lower sector at the exact spot we want to check and repeat
|
wsec = P_PointInSector(dx, dy); // get lower sector at the exact spot we want to check and repeat
|
||||||
retval = true;
|
retval = true;
|
||||||
}
|
}
|
||||||
if (out.method == FPortalGroupArray::PGA_Full3d)
|
if (out.method == FPortalGroupArray::PGA_Full3d && PortalBlockmap.hasLinkedSectorPortals)
|
||||||
{
|
{
|
||||||
groupsToCheck.Clear();
|
groupsToCheck.Clear();
|
||||||
groupsToCheck.Push(startgroup);
|
groupsToCheck.Push(startgroup);
|
||||||
|
|
|
@ -5024,9 +5024,7 @@ void A_Weave(AActor *self, int xyspeed, int zspeed, fixed_t xydist, fixed_t zdis
|
||||||
{
|
{
|
||||||
self->UnlinkFromWorld ();
|
self->UnlinkFromWorld ();
|
||||||
self->flags |= MF_NOBLOCKMAP;
|
self->flags |= MF_NOBLOCKMAP;
|
||||||
// the following 4 lines are for future-proofing this for both interpolation overhaul and line portals.
|
// We need to do portal offsetting here explicitly, because SetXY cannot do that.
|
||||||
// For portals we need to calculate the destination including the portal offset
|
|
||||||
// and for interpolation we need to set the performed movement explicitly, because SetXY cannot do that.
|
|
||||||
newX -= self->X();
|
newX -= self->X();
|
||||||
newY -= self->Y();
|
newY -= self->Y();
|
||||||
self->SetXY(self->Vec2Offset(newX, newY));
|
self->SetXY(self->Vec2Offset(newX, newY));
|
||||||
|
|
Loading…
Reference in a new issue