mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-18 15:11:51 +00:00
Mapster32: after auto-inserting inner sector, change sectnums for sprites now in it.
(Auto-insertion of an inner sector from a loop happens either because the loop is created in an extended sector, or because it has been punched through a ceiling/floor into the upper/lower neighbor sector.) git-svn-id: https://svn.eduke32.com/eduke32@4033 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
4f699a2f21
commit
8d84706dc9
1 changed files with 17 additions and 0 deletions
|
@ -2917,6 +2917,21 @@ static int32_t vec2eq(const vec2_t *v1, const vec2_t *v2)
|
|||
return (v1->x==v2->x && v1->y==v2->y);
|
||||
}
|
||||
|
||||
#ifdef YAX_ENABLE
|
||||
// After auto-creating inner sector <ns> in existing sector <os>, we need to
|
||||
// see if some sprites contained in <os> need to change their sector.
|
||||
static void CorrectSpriteSectnums(int32_t os, int32_t ns)
|
||||
{
|
||||
int32_t i, ni;
|
||||
|
||||
for (SPRITES_OF_SECT_SAFE(os, i, ni))
|
||||
{
|
||||
if (inside(sprite[i].x, sprite[i].y, ns)==1)
|
||||
changespritesect(i, ns);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// precondition: [numwalls, newnumwalls-1] form a new loop (may be of wrong orientation)
|
||||
// ret_ofirstwallofs: if != NULL, *ret_ofirstwallofs will contain the offset of the old
|
||||
// first wall from the new first wall of the sector k, and the automatic
|
||||
|
@ -3006,6 +3021,8 @@ static int32_t AddLoopToSector(int32_t k, int32_t *ret_ofirstwallofs)
|
|||
numwalls = newnumwalls;
|
||||
newnumwalls = -1;
|
||||
numsectors++;
|
||||
|
||||
CorrectSpriteSectnums(k, numsectors-1);
|
||||
}
|
||||
#endif
|
||||
if (ret_ofirstwallofs)
|
||||
|
|
Loading…
Reference in a new issue