mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-03-03 07:21:05 +00:00
actors.cpp: Change demo camera path following behaviour to search for locators based on a hitag channel to avoid locator lotag contention.
Now, destination and subject locators should be assigned one hitag channel. Destination locators will be visited starting from lotag 0 and counting upward. Subject locators can have any lotag within the same hitag channel, and may also be a destination if the lotag is not separated from the destination locator ids. Destination locators must now specify their subject locator in their owner field by lotag. git-svn-id: https://svn.eduke32.com/eduke32@7739 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
cfa0ea2a65
commit
458124a237
2 changed files with 21 additions and 12 deletions
|
@ -3763,6 +3763,17 @@ static int A_FindLocator(int const tag, int const sectNum)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int A_FindLocatorWithHiLoTags(int const hitag, int const tag, int const sectNum)
|
||||||
|
{
|
||||||
|
for (bssize_t SPRITES_OF(STAT_LOCATOR, spriteNum))
|
||||||
|
{
|
||||||
|
if ((sectNum == -1 || sectNum == SECT(spriteNum)) && tag == SLT(spriteNum) && hitag == SHT(spriteNum))
|
||||||
|
return spriteNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
ACTOR_STATIC void G_MoveActors(void)
|
ACTOR_STATIC void G_MoveActors(void)
|
||||||
{
|
{
|
||||||
int spriteNum = headspritestat[STAT_ACTOR];
|
int spriteNum = headspritestat[STAT_ACTOR];
|
||||||
|
@ -7575,7 +7586,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
||||||
findCameraDestination:
|
findCameraDestination:
|
||||||
if (pSprite->owner == spriteNum)
|
if (pSprite->owner == spriteNum)
|
||||||
{
|
{
|
||||||
pSprite->owner = A_FindLocator(pSprite->hitag, -1);
|
pSprite->owner = A_FindLocatorWithHiLoTags(pSprite->hitag, pData[0], -1);
|
||||||
|
|
||||||
//reset our elapsed time since reaching a locator
|
//reset our elapsed time since reaching a locator
|
||||||
pData[1] = 0;
|
pData[1] = 0;
|
||||||
|
@ -7588,14 +7599,11 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
||||||
if (pSprite->owner != -1)
|
if (pSprite->owner != -1)
|
||||||
{
|
{
|
||||||
spritetype* const destLocator = &sprite[pSprite->owner];
|
spritetype* const destLocator = &sprite[pSprite->owner];
|
||||||
int32_t subjectLocatorIndex = A_FindLocator(destLocator->hitag, -1);
|
int32_t subjectLocatorIndex = A_FindLocatorWithHiLoTags(pSprite->hitag, destLocator->owner, -1);
|
||||||
if (subjectLocatorIndex == -1)
|
pData[7] = G_GetAngleDelta(pData[5], destLocator->ang);
|
||||||
{
|
//level the camera out by default (pData[8] stores our destination up/down angle)
|
||||||
pData[7] = pSprite->ang;
|
pData[8] = 100;
|
||||||
//level the camera out by default (pData[8] stores our destination up/down angle)
|
if (subjectLocatorIndex != -1)
|
||||||
pData[8] = 100;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
spritetype* const subjectLocator = &sprite[subjectLocatorIndex];
|
spritetype* const subjectLocator = &sprite[subjectLocatorIndex];
|
||||||
const vec3_t cameraDirection = {subjectLocator->x - destLocator->x,
|
const vec3_t cameraDirection = {subjectLocator->x - destLocator->x,
|
||||||
|
@ -7615,11 +7623,11 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
spritetype* const destLocator = &sprite[pSprite->owner];
|
spritetype* const destLocator = &sprite[pSprite->owner];
|
||||||
if (pData[1] == destLocator->extra)
|
if (pData[1] == destLocator->extra)
|
||||||
{
|
{
|
||||||
pSprite->owner = spriteNum;
|
pSprite->owner = spriteNum;
|
||||||
++pSprite->hitag;
|
++pData[0];
|
||||||
goto findCameraDestination;
|
goto findCameraDestination;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7634,7 +7642,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
|
||||||
pSprite->z = pData[4]+interpolation*heading.z;
|
pSprite->z = pData[4]+interpolation*heading.z;
|
||||||
pSprite->ang = pData[5]+interpolation*pData[7];
|
pSprite->ang = pData[5]+interpolation*pData[7];
|
||||||
pSprite->yvel = (pData[6]+((int32_t) interpolation*pData[8])+100)%400-100;
|
pSprite->yvel = (pData[6]+((int32_t) interpolation*pData[8])+100)%400-100;
|
||||||
|
|
||||||
//increment elapsed time
|
//increment elapsed time
|
||||||
++pData[1];
|
++pData[1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -2942,6 +2942,7 @@ int A_Spawn(int spriteNum, int tileNum)
|
||||||
sector[sectNum].ceilingz = pSprite->z;
|
sector[sectNum].ceilingz = pSprite->z;
|
||||||
break;
|
break;
|
||||||
case SE_27_DEMO_CAM:
|
case SE_27_DEMO_CAM:
|
||||||
|
T1(newSprite) = 0;
|
||||||
if (ud.recstat == 1)
|
if (ud.recstat == 1)
|
||||||
{
|
{
|
||||||
pSprite->xrepeat=pSprite->yrepeat=64;
|
pSprite->xrepeat=pSprite->yrepeat=64;
|
||||||
|
|
Loading…
Reference in a new issue