mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-21 11:11:16 +00:00
- handle the portals in Duke and Blood.
This commit is contained in:
parent
0e628ed222
commit
b53e4b824e
4 changed files with 10 additions and 28 deletions
|
@ -34,17 +34,6 @@ inline void portalClear()
|
||||||
allPortals.Clear();
|
allPortals.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int portalAdd(int type, int target, int dx = 0, int dy = 0, int dz = 0)
|
|
||||||
{
|
|
||||||
auto& pt = allPortals[allPortals.Reserve(1)];
|
|
||||||
pt.type = type;
|
|
||||||
if (target >= 0) pt.targets.Push(target);
|
|
||||||
pt.dx = dx;
|
|
||||||
pt.dy = dy;
|
|
||||||
pt.dz = dz;
|
|
||||||
return allPortals.Size() - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline int portalAdd(int type, int target, const DVector3& offset)
|
inline int portalAdd(int type, int target, const DVector3& offset)
|
||||||
{
|
{
|
||||||
auto& pt = allPortals[allPortals.Reserve(1)];
|
auto& pt = allPortals[allPortals.Reserve(1)];
|
||||||
|
@ -52,7 +41,7 @@ inline int portalAdd(int type, int target, const DVector3& offset)
|
||||||
if (target >= 0) pt.targets.Push(target);
|
if (target >= 0) pt.targets.Push(target);
|
||||||
pt.dx = offset.X * worldtoint;
|
pt.dx = offset.X * worldtoint;
|
||||||
pt.dy = offset.Y * worldtoint;
|
pt.dy = offset.Y * worldtoint;
|
||||||
pt.dz = offset.Y * zworldtoint;
|
pt.dz = offset.Z * zworldtoint;
|
||||||
return allPortals.Size() - 1;
|
return allPortals.Size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,9 +87,7 @@ struct MIRROR
|
||||||
{
|
{
|
||||||
int type;
|
int type;
|
||||||
int link;
|
int link;
|
||||||
int dx;
|
DVector3 diff;
|
||||||
int dy;
|
|
||||||
int dz;
|
|
||||||
int wallnum;
|
int wallnum;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -128,24 +128,20 @@ void InitMirrors(void)
|
||||||
if (sectj->ceilingpicnum != 504)
|
if (sectj->ceilingpicnum != 504)
|
||||||
I_Error("Lower link sector %d doesn't have mirror picnum\n", j);
|
I_Error("Lower link sector %d doesn't have mirror picnum\n", j);
|
||||||
mirror[mirrorcnt].type = 2;
|
mirror[mirrorcnt].type = 2;
|
||||||
mirror[mirrorcnt].dx = link2->int_pos().X - link->int_pos().X;
|
mirror[mirrorcnt].diff = link2->spr.pos - link->spr.pos;
|
||||||
mirror[mirrorcnt].dy = link2->int_pos().Y - link->int_pos().Y;
|
|
||||||
mirror[mirrorcnt].dz = link2->int_pos().Z - link->int_pos().Z;
|
|
||||||
mirror[mirrorcnt].wallnum = i;
|
mirror[mirrorcnt].wallnum = i;
|
||||||
mirror[mirrorcnt].link = j;
|
mirror[mirrorcnt].link = j;
|
||||||
secti->floorpicnum = 4080 + mirrorcnt;
|
secti->floorpicnum = 4080 + mirrorcnt;
|
||||||
secti->portalflags = PORTAL_SECTOR_FLOOR;
|
secti->portalflags = PORTAL_SECTOR_FLOOR;
|
||||||
secti->portalnum = portalAdd(PORTAL_SECTOR_FLOOR, j, mirror[mirrorcnt].dx, mirror[mirrorcnt].dy, mirror[mirrorcnt].dz);
|
secti->portalnum = portalAdd(PORTAL_SECTOR_FLOOR, j, mirror[mirrorcnt].diff);
|
||||||
mirrorcnt++;
|
mirrorcnt++;
|
||||||
mirror[mirrorcnt].type = 1;
|
mirror[mirrorcnt].type = 1;
|
||||||
mirror[mirrorcnt].dx = link->int_pos().X - link2->int_pos().X;
|
mirror[mirrorcnt].diff = link->spr.pos - link2->spr.pos;
|
||||||
mirror[mirrorcnt].dy = link->int_pos().Y - link2->int_pos().Y;
|
|
||||||
mirror[mirrorcnt].dz = link->int_pos().Z - link2->int_pos().Z;
|
|
||||||
mirror[mirrorcnt].wallnum = j;
|
mirror[mirrorcnt].wallnum = j;
|
||||||
mirror[mirrorcnt].link = i;
|
mirror[mirrorcnt].link = i;
|
||||||
sectj->ceilingpicnum = 4080 + mirrorcnt;
|
sectj->ceilingpicnum = 4080 + mirrorcnt;
|
||||||
sectj->portalflags = PORTAL_SECTOR_CEILING;
|
sectj->portalflags = PORTAL_SECTOR_CEILING;
|
||||||
sectj->portalnum = portalAdd(PORTAL_SECTOR_CEILING, i, mirror[mirrorcnt].dx, mirror[mirrorcnt].dy, mirror[mirrorcnt].dz);
|
sectj->portalnum = portalAdd(PORTAL_SECTOR_CEILING, i, mirror[mirrorcnt].diff);
|
||||||
mirrorcnt++;
|
mirrorcnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,9 +161,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, MIRROR& w, MIRROR*
|
||||||
{
|
{
|
||||||
arc("type", w.type)
|
arc("type", w.type)
|
||||||
("link", w.link)
|
("link", w.link)
|
||||||
("dx", w.dx)
|
("diff", w.diff)
|
||||||
("dy", w.dy)
|
|
||||||
("dz", w.dz)
|
|
||||||
("wallnum", w.wallnum)
|
("wallnum", w.wallnum)
|
||||||
.EndObject();
|
.EndObject();
|
||||||
}
|
}
|
||||||
|
|
|
@ -877,8 +877,9 @@ static void SpawnPortals()
|
||||||
sectortype* s1 = act->sector(), *s2 = act2->sector();
|
sectortype* s1 = act->sector(), *s2 = act2->sector();
|
||||||
s1->portalflags = PORTAL_SECTOR_FLOOR;
|
s1->portalflags = PORTAL_SECTOR_FLOOR;
|
||||||
s2->portalflags = PORTAL_SECTOR_CEILING;
|
s2->portalflags = PORTAL_SECTOR_CEILING;
|
||||||
s1->portalnum = portalAdd(PORTAL_SECTOR_FLOOR, sectnum(s2), act2->int_pos().X - act->int_pos().X, act2->int_pos().Y - act->int_pos().Y, act->spr.hitag);
|
DVector2 diff = act->spr.pos.XY() - act2->spr.pos.XY();
|
||||||
s2->portalnum = portalAdd(PORTAL_SECTOR_CEILING, sectnum(s1), act->int_pos().X - act2->int_pos().X, act->int_pos().Y - act2->int_pos().Y, act->spr.hitag);
|
s1->portalnum = portalAdd(PORTAL_SECTOR_FLOOR, sectnum(s2), DVector3(-diff, act->spr.hitag * zmaptoworld));
|
||||||
|
s2->portalnum = portalAdd(PORTAL_SECTOR_CEILING, sectnum(s1), DVector3(diff, act->spr.hitag * zmaptoworld));
|
||||||
processedTags.Push(act->spr.hitag);
|
processedTags.Push(act->spr.hitag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue