mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 20:42:11 +00:00
- premap.cpp + premap_d.cpp
This commit is contained in:
parent
e76e28cdea
commit
1f40dfa411
2 changed files with 61 additions and 69 deletions
|
@ -573,8 +573,6 @@ void resetpspritevars(int g)
|
|||
DukeStatIterator it(STAT_PLAYER);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
s = act->s;
|
||||
|
||||
if (numplayersprites == MAXPLAYERS)
|
||||
I_Error("Too many player sprites (max 16.)");
|
||||
|
||||
|
@ -584,57 +582,57 @@ void resetpspritevars(int g)
|
|||
firsty = ps[0].pos.y;
|
||||
}
|
||||
|
||||
po[numplayersprites].ox = s->x;
|
||||
po[numplayersprites].oy = s->y;
|
||||
po[numplayersprites].oz = s->z;
|
||||
po[numplayersprites].oa = s->ang;
|
||||
po[numplayersprites].os = s->sector();
|
||||
po[numplayersprites].ox = act->spr.x;
|
||||
po[numplayersprites].oy = act->spr.y;
|
||||
po[numplayersprites].oz = act->spr.z;
|
||||
po[numplayersprites].oa = act->spr.ang;
|
||||
po[numplayersprites].os = act->spr.sector();
|
||||
|
||||
numplayersprites++;
|
||||
if (j >= 0)
|
||||
{
|
||||
act->SetOwner(act);
|
||||
s->shade = 0;
|
||||
s->xrepeat = isRR() ? 24 : 42;
|
||||
s->yrepeat = isRR() ? 17 : 36;
|
||||
s->cstat = CSTAT_SPRITE_BLOCK_ALL;
|
||||
s->xoffset = 0;
|
||||
s->clipdist = 64;
|
||||
act->spr.shade = 0;
|
||||
act->spr.xrepeat = isRR() ? 24 : 42;
|
||||
act->spr.yrepeat = isRR() ? 17 : 36;
|
||||
act->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
|
||||
act->spr.xoffset = 0;
|
||||
act->spr.clipdist = 64;
|
||||
|
||||
if (ps[j].last_extra == 0)
|
||||
{
|
||||
ps[j].last_extra = gs.max_player_health;
|
||||
s->extra = gs.max_player_health;
|
||||
act->spr.extra = gs.max_player_health;
|
||||
}
|
||||
else s->extra = ps[j].last_extra;
|
||||
else act->spr.extra = ps[j].last_extra;
|
||||
|
||||
s->yvel = j;
|
||||
act->spr.yvel = j;
|
||||
|
||||
if (ud.last_level == -1)
|
||||
{
|
||||
if (s->pal == 0)
|
||||
if (act->spr.pal == 0)
|
||||
{
|
||||
s->pal = ps[j].palookup = which_palookup;
|
||||
act->spr.pal = ps[j].palookup = which_palookup;
|
||||
ud.user_pals[j] = which_palookup;
|
||||
which_palookup++;
|
||||
if (which_palookup == 17) which_palookup = 9;
|
||||
}
|
||||
else ud.user_pals[j] = ps[j].palookup = s->pal;
|
||||
else ud.user_pals[j] = ps[j].palookup = act->spr.pal;
|
||||
}
|
||||
else
|
||||
s->pal = ps[j].palookup = ud.user_pals[j];
|
||||
act->spr.pal = ps[j].palookup = ud.user_pals[j];
|
||||
|
||||
ps[j].actor = act;
|
||||
ps[j].frag_ps = j;
|
||||
act->SetOwner(act);
|
||||
|
||||
ps[j].bobposx = ps[j].oposx = ps[j].pos.x = s->x;
|
||||
ps[j].bobposy = ps[j].oposy = ps[j].pos.y = s->y;
|
||||
ps[j].oposz = ps[j].pos.z = s->z;
|
||||
s->backuppos();
|
||||
ps[j].angle.oang = ps[j].angle.ang = buildang(s->ang);
|
||||
ps[j].bobposx = ps[j].oposx = ps[j].pos.x = act->spr.x;
|
||||
ps[j].bobposy = ps[j].oposy = ps[j].pos.y = act->spr.y;
|
||||
ps[j].oposz = ps[j].pos.z = act->spr.z;
|
||||
act->spr.backuppos();
|
||||
ps[j].angle.oang = ps[j].angle.ang = buildang(act->spr.ang);
|
||||
|
||||
updatesector(s->x, s->y, &ps[j].cursector);
|
||||
updatesector(act->spr.x, act->spr.y, &ps[j].cursector);
|
||||
|
||||
j = connectpoint2[j];
|
||||
|
||||
|
@ -834,33 +832,31 @@ static void SpawnPortals()
|
|||
DukeStatIterator it(STAT_RAROR);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
auto spr = act->s;
|
||||
if (spr->picnum == SECTOREFFECTOR && spr->lotag == tag)
|
||||
if (act->spr.picnum == SECTOREFFECTOR && act->spr.lotag == tag)
|
||||
{
|
||||
if (processedTags.Find(spr->hitag) == processedTags.Size())
|
||||
if (processedTags.Find(act->spr.hitag) == processedTags.Size())
|
||||
{
|
||||
DukeStatIterator it2(STAT_RAROR);
|
||||
while (auto act2 = it2.Next())
|
||||
{
|
||||
auto spr2 = act2->s;
|
||||
if (spr2->picnum == SECTOREFFECTOR && spr2->lotag == tag + 1 && spr2->hitag == spr->hitag)
|
||||
if (act2->spr.picnum == SECTOREFFECTOR && act2->spr.lotag == tag + 1 && act2->spr.hitag == act->spr.hitag)
|
||||
{
|
||||
if (processedTags.Find(spr->hitag) == processedTags.Size())
|
||||
if (processedTags.Find(act->spr.hitag) == processedTags.Size())
|
||||
{
|
||||
sectortype* s1 = spr->sector(), *s2 = spr2->sector();
|
||||
sectortype* s1 = act->spr.sector(), *s2 = act2->spr.sector();
|
||||
s1->portalflags = PORTAL_SECTOR_FLOOR;
|
||||
s1->portalflags = PORTAL_SECTOR_CEILING;
|
||||
s2->portalnum = portalAdd(PORTAL_SECTOR_FLOOR, sectnum(s2), spr2->x - spr->x, spr2->y - spr->y, spr->hitag);
|
||||
s2->portalnum = portalAdd(PORTAL_SECTOR_CEILING, sectnum(s1), spr->x - spr2->x, spr->y - spr2->y, spr->hitag);
|
||||
processedTags.Push(spr->hitag);
|
||||
s2->portalnum = portalAdd(PORTAL_SECTOR_FLOOR, sectnum(s2), act2->spr.x - act->spr.x, act2->spr.y - act->spr.y, act->spr.hitag);
|
||||
s2->portalnum = portalAdd(PORTAL_SECTOR_CEILING, sectnum(s1), act->spr.x - act2->spr.x, act->spr.y - act2->spr.y, act->spr.hitag);
|
||||
processedTags.Push(act->spr.hitag);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (auto& p : allPortals)
|
||||
{
|
||||
if (p.type == PORTAL_SECTOR_FLOOR && p.dz == spr->hitag)
|
||||
if (p.type == PORTAL_SECTOR_FLOOR && p.dz == act->spr.hitag)
|
||||
{
|
||||
p.targets.Push(spr2->sectno());
|
||||
p.targets.Push(act2->spr.sectno());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -871,9 +867,9 @@ static void SpawnPortals()
|
|||
{
|
||||
for (auto& p : allPortals)
|
||||
{
|
||||
if (p.type == PORTAL_SECTOR_CEILING && p.dz == spr->hitag)
|
||||
if (p.type == PORTAL_SECTOR_CEILING && p.dz == act->spr.hitag)
|
||||
{
|
||||
p.targets.Push(spr->sectno());
|
||||
p.targets.Push(act->spr.sectno());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,17 +53,17 @@ inline void tloadtile(int tilenum, int palnum = 0)
|
|||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static void cachespritenum(spritetype *spr)
|
||||
static void cachespritenum(DDukeActor* actor)
|
||||
{
|
||||
int maxc;
|
||||
int j;
|
||||
int pal = spr->pal;
|
||||
int pal = actor->spr.pal;
|
||||
|
||||
if(ud.monsters_off && badguy(spr)) return;
|
||||
if(ud.monsters_off && badguy(actor)) return;
|
||||
|
||||
maxc = 1;
|
||||
|
||||
switch(spr->picnum)
|
||||
switch(actor->spr.picnum)
|
||||
{
|
||||
case HYDRENT:
|
||||
tloadtile(BROKEFIREHYDRENT);
|
||||
|
@ -165,7 +165,7 @@ static void cachespritenum(spritetype *spr)
|
|||
break;
|
||||
}
|
||||
|
||||
for(j = spr->picnum; j < (spr->picnum+maxc); j++)
|
||||
for(j = actor->spr.picnum; j < (actor->spr.picnum+maxc); j++)
|
||||
tloadtile(j, pal);
|
||||
}
|
||||
|
||||
|
@ -254,10 +254,10 @@ void cacheit_d(void)
|
|||
}
|
||||
|
||||
DukeSectIterator it(§);
|
||||
while (auto j = it.Next())
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
if (j->spr.xrepeat != 0 && j->spr.yrepeat != 0 && (j->spr.cstat & CSTAT_SPRITE_INVISIBLE) == 0)
|
||||
cachespritenum(j->s);
|
||||
if (act->spr.xrepeat != 0 && act->spr.yrepeat != 0 && (act->spr.cstat & CSTAT_SPRITE_INVISIBLE) == 0)
|
||||
cachespritenum(act);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -285,30 +285,29 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
|
|||
DukeStatIterator it(STAT_DEFAULT);
|
||||
while (auto ac = it.Next())
|
||||
{
|
||||
auto si = ac->s;
|
||||
LoadActor(ac, -1, -1);
|
||||
|
||||
if (si->lotag == -1 && (si->cstat & CSTAT_SPRITE_ALIGNMENT_WALL))
|
||||
if (ac->spr.lotag == -1 && (ac->spr.cstat & CSTAT_SPRITE_ALIGNMENT_WALL))
|
||||
{
|
||||
ps[0].exitx = si->x;
|
||||
ps[0].exity = si->y;
|
||||
ps[0].exitx = ac->spr.x;
|
||||
ps[0].exity = ac->spr.y;
|
||||
}
|
||||
else switch (si->picnum)
|
||||
else switch (ac->spr.picnum)
|
||||
{
|
||||
case GPSPEED:
|
||||
si->sector()->extra = si->lotag;
|
||||
ac->spr.sector()->extra = ac->spr.lotag;
|
||||
deletesprite(ac);
|
||||
break;
|
||||
|
||||
case CYCLER:
|
||||
if (numcyclers >= MAXCYCLERS)
|
||||
I_Error("Too many cycling sectors.");
|
||||
cyclers[numcyclers].sector = si->sector();
|
||||
cyclers[numcyclers].lotag = si->lotag;
|
||||
cyclers[numcyclers].shade1 = si->shade;
|
||||
cyclers[numcyclers].shade2 = si->sector()->floorshade;
|
||||
cyclers[numcyclers].hitag = si->hitag;
|
||||
cyclers[numcyclers].state = (si->ang == 1536);
|
||||
cyclers[numcyclers].sector = ac->spr.sector();
|
||||
cyclers[numcyclers].lotag = ac->spr.lotag;
|
||||
cyclers[numcyclers].shade1 = ac->spr.shade;
|
||||
cyclers[numcyclers].shade2 = ac->spr.sector()->floorshade;
|
||||
cyclers[numcyclers].hitag = ac->spr.hitag;
|
||||
cyclers[numcyclers].state = (ac->spr.ang == 1536);
|
||||
numcyclers++;
|
||||
deletesprite(ac);
|
||||
break;
|
||||
|
@ -320,8 +319,7 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
|
|||
{
|
||||
if (actor->exists())
|
||||
{
|
||||
auto spr = actor->s;
|
||||
if (spr->picnum == SECTOREFFECTOR && spr->lotag == SE_14_SUBWAY_CAR)
|
||||
if (actor->spr.picnum == SECTOREFFECTOR && actor->spr.lotag == SE_14_SUBWAY_CAR)
|
||||
continue;
|
||||
spriteinit_d(actor, actors);
|
||||
}
|
||||
|
@ -331,8 +329,7 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
|
|||
{
|
||||
if (actor->exists())
|
||||
{
|
||||
auto spr = actor->s;
|
||||
if (spr->picnum == SECTOREFFECTOR && spr->lotag == SE_14_SUBWAY_CAR)
|
||||
if (actor->spr.picnum == SECTOREFFECTOR && actor->spr.lotag == SE_14_SUBWAY_CAR)
|
||||
spriteinit_d(actor, actors);
|
||||
}
|
||||
}
|
||||
|
@ -341,8 +338,7 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
|
|||
it.Reset(STAT_DEFAULT);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
auto spr = actor->s;
|
||||
switch (spr->picnum)
|
||||
switch (actor->spr.picnum)
|
||||
{
|
||||
case DIPSWITCH + 1:
|
||||
case DIPSWITCH2 + 1:
|
||||
|
@ -358,12 +354,12 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
|
|||
case LOCKSWITCH1 + 1:
|
||||
case POWERSWITCH2 + 1:
|
||||
for (j = 0; j < lotaglist; j++)
|
||||
if (spr->lotag == lotags[j])
|
||||
if (actor->spr.lotag == lotags[j])
|
||||
break;
|
||||
|
||||
if (j == lotaglist)
|
||||
{
|
||||
lotags[lotaglist] = spr->lotag;
|
||||
lotags[lotaglist] = actor->spr.lotag;
|
||||
lotaglist++;
|
||||
if (lotaglist > 64)
|
||||
I_Error("Too many switches (64 max).");
|
||||
|
@ -371,7 +367,7 @@ void prelevel_d(int g, TArray<DDukeActor*>& actors)
|
|||
DukeStatIterator it1(STAT_EFFECTOR);
|
||||
while (auto ac = it1.Next())
|
||||
{
|
||||
if (ac->spr.lotag == 12 && ac->spr.hitag == spr->lotag)
|
||||
if (ac->spr.lotag == 12 && ac->spr.hitag == actor->spr.lotag)
|
||||
ac->temp_data[0] = 1;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue