mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 12:30:40 +00:00
- txIsRanged and several of its callers.
This commit is contained in:
parent
174783e57b
commit
24a11b3f2f
2 changed files with 30 additions and 25 deletions
|
@ -4721,15 +4721,15 @@ void modernTypeTrigger(int destObjType, int destObjIndex, DBloodActor* destactor
|
||||||
switch (pSpr->type)
|
switch (pSpr->type)
|
||||||
{
|
{
|
||||||
case kModernRandomTX:
|
case kModernRandomTX:
|
||||||
useRandomTx(pXSpr, (COMMAND_ID)pXSource->command, false); // set random TX id
|
useRandomTx(destactor, (COMMAND_ID)pXSource->command, false); // set random TX id
|
||||||
break;
|
break;
|
||||||
case kModernSequentialTX:
|
case kModernSequentialTX:
|
||||||
if (pSpr->flags & kModernTypeFlag1)
|
if (pSpr->flags & kModernTypeFlag1)
|
||||||
{
|
{
|
||||||
seqTxSendCmdAll(pXSpr, pSource->index, (COMMAND_ID)pXSource->command, true);
|
seqTxSendCmdAll(destactor, event.actor, (COMMAND_ID)pXSource->command, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
useSequentialTx(pXSpr, (COMMAND_ID)pXSource->command, false); // set next TX id
|
useSequentialTx(destactor, (COMMAND_ID)pXSource->command, false); // set next TX id
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (pXSpr->txID <= 0 || pXSpr->txID >= kChannelUserMax) return;
|
if (pXSpr->txID <= 0 || pXSpr->txID >= kChannelUserMax) return;
|
||||||
|
@ -5548,12 +5548,12 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT event)
|
||||||
switch (pSprite->type)
|
switch (pSprite->type)
|
||||||
{
|
{
|
||||||
case kModernRandomTX:
|
case kModernRandomTX:
|
||||||
useRandomTx(pXSprite, (COMMAND_ID)pXSprite->command, true);
|
useRandomTx(actor, (COMMAND_ID)pXSprite->command, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kModernSequentialTX:
|
case kModernSequentialTX:
|
||||||
if (!(pSprite->flags & kModernTypeFlag1)) useSequentialTx(pXSprite, (COMMAND_ID)pXSprite->command, true);
|
if (!(pSprite->flags & kModernTypeFlag1)) useSequentialTx(actor, (COMMAND_ID)pXSprite->command, true);
|
||||||
else seqTxSendCmdAll(pXSprite, pSprite->index, (COMMAND_ID)pXSprite->command, false);
|
else seqTxSendCmdAll(actor, actor, (COMMAND_ID)pXSprite->command, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -5962,7 +5962,10 @@ bool modernTypeOperateWall(int nWall, walltype* pWall, XWALL* pXWall, EVENT even
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool txIsRanged(XSPRITE* pXSource) {
|
bool txIsRanged(DBloodActor* source)
|
||||||
|
{
|
||||||
|
if (!source->hasX()) return false;
|
||||||
|
auto pXSource = &source->x();
|
||||||
if (pXSource->data1 > 0 && pXSource->data2 <= 0 && pXSource->data3 <= 0 && pXSource->data4 > 0)
|
if (pXSource->data1 > 0 && pXSource->data2 <= 0 && pXSource->data3 <= 0 && pXSource->data4 > 0)
|
||||||
{
|
{
|
||||||
if (pXSource->data1 > pXSource->data4)
|
if (pXSource->data1 > pXSource->data4)
|
||||||
|
@ -5982,9 +5985,10 @@ bool txIsRanged(XSPRITE* pXSource) {
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void seqTxSendCmdAll(XSPRITE* pXSource, int nIndex, COMMAND_ID cmd, bool modernSend) {
|
void seqTxSendCmdAll(DBloodActor* source, DBloodActor* actor, COMMAND_ID cmd, bool modernSend)
|
||||||
auto actor = &bloodActors[nIndex];
|
{
|
||||||
bool ranged = txIsRanged(pXSource);
|
bool ranged = txIsRanged(source);
|
||||||
|
auto pXSource = &source->x();
|
||||||
if (ranged)
|
if (ranged)
|
||||||
{
|
{
|
||||||
for (pXSource->txID = pXSource->data1; pXSource->txID <= pXSource->data4; pXSource->txID++)
|
for (pXSource->txID = pXSource->data1; pXSource->txID <= pXSource->data4; pXSource->txID++)
|
||||||
|
@ -6013,13 +6017,14 @@ void seqTxSendCmdAll(XSPRITE* pXSource, int nIndex, COMMAND_ID cmd, bool modernS
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void useRandomTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
void useRandomTx(DBloodActor* sourceactor, COMMAND_ID cmd, bool setState)
|
||||||
|
{
|
||||||
auto sourceactor = &bloodActors[pXSource->reference];
|
|
||||||
spritetype* pSource = &sourceactor->s();
|
spritetype* pSource = &sourceactor->s();
|
||||||
|
auto pXSource = &sourceactor->x();
|
||||||
int tx = 0; int maxRetries = kMaxRandomizeRetries;
|
int tx = 0; int maxRetries = kMaxRandomizeRetries;
|
||||||
|
|
||||||
if (txIsRanged(pXSource)) {
|
if (txIsRanged(sourceactor))
|
||||||
|
{
|
||||||
while (maxRetries-- >= 0)
|
while (maxRetries-- >= 0)
|
||||||
{
|
{
|
||||||
if ((tx = nnExtRandom(pXSource->data1, pXSource->data4)) != pXSource->txID)
|
if ((tx = nnExtRandom(pXSource->data1, pXSource->data4)) != pXSource->txID)
|
||||||
|
@ -6037,7 +6042,7 @@ void useRandomTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
||||||
|
|
||||||
pXSource->txID = (tx > 0 && tx < kChannelUserMax) ? tx : 0;
|
pXSource->txID = (tx > 0 && tx < kChannelUserMax) ? tx : 0;
|
||||||
if (setState)
|
if (setState)
|
||||||
SetSpriteState(pSource->index, pXSource, pXSource->state ^ 1);
|
SetSpriteState(sourceactor, pXSource->state ^ 1);
|
||||||
//evSendActor(pSource->index, pXSource->txID, (COMMAND_ID)pXSource->command);
|
//evSendActor(pSource->index, pXSource->txID, (COMMAND_ID)pXSource->command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6047,11 +6052,12 @@ void useRandomTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
||||||
//
|
//
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void useSequentialTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
void useSequentialTx(DBloodActor* sourceactor, COMMAND_ID cmd, bool setState)
|
||||||
|
{
|
||||||
auto sourceactor = &bloodActors[pXSource->reference];
|
|
||||||
spritetype* pSource = &sourceactor->s();
|
spritetype* pSource = &sourceactor->s();
|
||||||
bool range = txIsRanged(pXSource); int cnt = 3; int tx = 0;
|
auto pXSource = &sourceactor->x();
|
||||||
|
|
||||||
|
bool range = txIsRanged(sourceactor); int cnt = 3; int tx = 0;
|
||||||
|
|
||||||
if (range)
|
if (range)
|
||||||
{
|
{
|
||||||
|
@ -6111,7 +6117,7 @@ void useSequentialTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
||||||
|
|
||||||
pXSource->txID = (tx > 0 && tx < kChannelUserMax) ? tx : 0;
|
pXSource->txID = (tx > 0 && tx < kChannelUserMax) ? tx : 0;
|
||||||
if (setState)
|
if (setState)
|
||||||
SetSpriteState(pSource->index, pXSource, pXSource->state ^ 1);
|
SetSpriteState(sourceactor, pXSource->state ^ 1);
|
||||||
//evSendActor(pSource->index, pXSource->txID, (COMMAND_ID)pXSource->command);
|
//evSendActor(pSource->index, pXSource->txID, (COMMAND_ID)pXSource->command);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8491,7 +8497,7 @@ void aiPatrolThink(DBloodActor* actor) {
|
||||||
// ------------------------------------------------
|
// ------------------------------------------------
|
||||||
|
|
||||||
int listTx(XSPRITE* pXRedir, int tx) {
|
int listTx(XSPRITE* pXRedir, int tx) {
|
||||||
if (txIsRanged(pXRedir)) {
|
if (txIsRanged(&bloodActors[pXRedir->reference])) {
|
||||||
if (tx == -1) tx = pXRedir->data1;
|
if (tx == -1) tx = pXRedir->data1;
|
||||||
else if (tx < pXRedir->data4) tx++;
|
else if (tx < pXRedir->data4) tx++;
|
||||||
else tx = -1;
|
else tx = -1;
|
||||||
|
|
|
@ -329,12 +329,11 @@ void useDataChanger(XSPRITE* pXSource, int objType, int objIndex);
|
||||||
void useSectorLigthChanger(XSPRITE* pXSource, XSECTOR* pXSector);
|
void useSectorLigthChanger(XSPRITE* pXSource, XSECTOR* pXSector);
|
||||||
void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite);
|
void useTargetChanger(XSPRITE* pXSource, spritetype* pSprite);
|
||||||
void usePictureChanger(XSPRITE* pXSource, int objType, int objIndex);
|
void usePictureChanger(XSPRITE* pXSource, int objType, int objIndex);
|
||||||
void useSequentialTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState);
|
void useSequentialTx(DBloodActor* pXSource, COMMAND_ID cmd, bool setState);
|
||||||
void useRandomTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState);
|
void useRandomTx(DBloodActor* sourceactor, COMMAND_ID cmd, bool setState);
|
||||||
void useDudeSpawn(DBloodActor* pXSource, DBloodActor* pSprite);
|
void useDudeSpawn(DBloodActor* pXSource, DBloodActor* pSprite);
|
||||||
void useCustomDudeSpawn(DBloodActor* pXSource, DBloodActor* pSprite);
|
void useCustomDudeSpawn(DBloodActor* pXSource, DBloodActor* pSprite);
|
||||||
bool txIsRanged(XSPRITE* pXSource);
|
void seqTxSendCmdAll(DBloodActor* pXSource, DBloodActor* nIndex, COMMAND_ID cmd, bool modernSend);
|
||||||
void seqTxSendCmdAll(XSPRITE* pXSource, int nIndex, COMMAND_ID cmd, bool modernSend);
|
|
||||||
// ------------------------------------------------------------------------- //
|
// ------------------------------------------------------------------------- //
|
||||||
void trPlayerCtrlLink(DBloodActor* pXSource, PLAYER* pPlayer, bool checkCondition);
|
void trPlayerCtrlLink(DBloodActor* pXSource, PLAYER* pPlayer, bool checkCondition);
|
||||||
void trPlayerCtrlStopScene(PLAYER* pPlayer);
|
void trPlayerCtrlStopScene(PLAYER* pPlayer);
|
||||||
|
|
Loading…
Reference in a new issue