mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
- Optimise automap sector loops in Duke/SW automap code.
This commit is contained in:
parent
db5db7d9b3
commit
ab77d77a53
2 changed files with 45 additions and 38 deletions
|
@ -388,19 +388,22 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
|
|||
auto cangvect = cang.ToVector();
|
||||
|
||||
// Draw sprites
|
||||
auto pactor = ps[screenpeek].GetActor();
|
||||
if (gFullMap)
|
||||
{
|
||||
for (unsigned ii = 0; ii < sector.Size(); ii++)
|
||||
{
|
||||
if (!gFullMap || !show2dsector[ii]) continue;
|
||||
if (show2dsector[ii]) continue;
|
||||
DukeSectIterator it(ii);
|
||||
while (auto act = it.Next())
|
||||
{
|
||||
if (act == pactor || (act->spr.cstat & CSTAT_SPRITE_INVISIBLE) || act->spr.cstat == CSTAT_SPRITE_BLOCK_ALL || act->spr.xrepeat == 0) continue;
|
||||
if (act == ps[screenpeek].actor || (act->spr.cstat & CSTAT_SPRITE_INVISIBLE) || act->spr.cstat == CSTAT_SPRITE_BLOCK_ALL || act->spr.xrepeat == 0) continue;
|
||||
|
||||
if ((act->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) != 0)
|
||||
{
|
||||
PalEntry col = act->spr.cstat & CSTAT_SPRITE_BLOCK ? PalEntry(170, 0, 170) : PalEntry(0, 170, 170);
|
||||
auto sprpos = act->spr.pos.XY() - cpos;
|
||||
|
||||
if ((act->spr.cstat & CSTAT_SPRITE_BLOCK_ALL) != 0) switch (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK)
|
||||
switch (act->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK)
|
||||
{
|
||||
case CSTAT_SPRITE_ALIGNMENT_FACING:
|
||||
DrawAutomapAlignmentFacing(act->spr, sprpos, cangvect, czoom, xydim, col);
|
||||
|
@ -417,6 +420,8 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
||||
{
|
||||
|
|
|
@ -1580,16 +1580,17 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
|
|||
auto cangvect = cang.ToVector();
|
||||
|
||||
// Draw sprites
|
||||
if (gFullMap)
|
||||
{
|
||||
for (unsigned i = 0; i < sector.Size(); i++)
|
||||
{
|
||||
SWSectIterator it(i);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
if (gFullMap || (actor->spr.cstat2 & CSTAT2_SPRITE_MAPPED))
|
||||
if (actor->spr.cstat2 & CSTAT2_SPRITE_MAPPED)
|
||||
{
|
||||
// 1=white / 31=black / 44=green / 56=pink / 128=yellow / 210=blue / 248=orange / 255=purple
|
||||
PalEntry col = (actor->spr.cstat & CSTAT_SPRITE_BLOCK) > 0 ? GPalette.BaseColors[248] : actor == Player[screenpeek].actor ? GPalette.BaseColors[31] : GPalette.BaseColors[56];
|
||||
|
||||
auto statnum = actor->spr.statnum;
|
||||
auto sprxy = ((statnum >= 1) && (statnum <= 8) && (statnum != 2) ? actor->interpolatedvec3(smoothratio * (1. / MaxSmoothRatio)) : actor->spr.pos).XY() - cpos;
|
||||
|
||||
|
@ -1605,6 +1606,7 @@ bool GameInterface::DrawAutomapPlayer(const DVector2& mxy, const DVector2& cpos,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue