mirror of
https://github.com/DrBeef/Raze.git
synced 2024-11-15 17:01:51 +00:00
- formatting only
This commit is contained in:
parent
a4f7fabbfa
commit
174783e57b
1 changed files with 85 additions and 28 deletions
|
@ -5927,9 +5927,17 @@ bool modernTypeOperateSprite(DBloodActor* actor, EVENT event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool modernTypeOperateWall(int nWall, walltype* pWall, XWALL* pXWall, EVENT event) {
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool modernTypeOperateWall(int nWall, walltype* pWall, XWALL* pXWall, EVENT event)
|
||||||
|
{
|
||||||
|
|
||||||
switch (pWall->type) {
|
switch (pWall->type)
|
||||||
|
{
|
||||||
case kSwitchOneWay:
|
case kSwitchOneWay:
|
||||||
switch (event.cmd) {
|
switch (event.cmd) {
|
||||||
case kCmdOff:
|
case kCmdOff:
|
||||||
|
@ -5946,12 +5954,19 @@ bool modernTypeOperateWall(int nWall, walltype* pWall, XWALL* pXWall, EVENT even
|
||||||
default:
|
default:
|
||||||
return false; // no modern type found to work with, go normal OperateWall();
|
return false; // no modern type found to work with, go normal OperateWall();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool txIsRanged(XSPRITE* pXSource) {
|
bool txIsRanged(XSPRITE* pXSource) {
|
||||||
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)
|
||||||
|
{
|
||||||
// data1 must be less than data4
|
// data1 must be less than data4
|
||||||
int tmp = pXSource->data1; pXSource->data1 = pXSource->data4;
|
int tmp = pXSource->data1; pXSource->data1 = pXSource->data4;
|
||||||
pXSource->data4 = tmp;
|
pXSource->data4 = tmp;
|
||||||
|
@ -5961,28 +5976,43 @@ bool txIsRanged(XSPRITE* pXSource) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void seqTxSendCmdAll(XSPRITE* pXSource, int nIndex, COMMAND_ID cmd, bool modernSend) {
|
void seqTxSendCmdAll(XSPRITE* pXSource, int nIndex, COMMAND_ID cmd, bool modernSend) {
|
||||||
auto actor = &bloodActors[nIndex];
|
auto actor = &bloodActors[nIndex];
|
||||||
bool ranged = txIsRanged(pXSource);
|
bool ranged = txIsRanged(pXSource);
|
||||||
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++)
|
||||||
|
{
|
||||||
if (pXSource->txID <= 0 || pXSource->txID >= kChannelUserMax) continue;
|
if (pXSource->txID <= 0 || pXSource->txID >= kChannelUserMax) continue;
|
||||||
else if (!modernSend) evSendActor(actor, pXSource->txID, cmd);
|
else if (!modernSend) evSendActor(actor, pXSource->txID, cmd);
|
||||||
else modernTypeSendCommand(actor, pXSource->txID, cmd);
|
else modernTypeSendCommand(actor, pXSource->txID, cmd);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
for (int i = 0; i <= 3; i++) {
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i <= 3; i++)
|
||||||
|
{
|
||||||
pXSource->txID = GetDataVal(&bloodActors[pXSource->reference], i);
|
pXSource->txID = GetDataVal(&bloodActors[pXSource->reference], i);
|
||||||
if (pXSource->txID <= 0 || pXSource->txID >= kChannelUserMax) continue;
|
if (pXSource->txID <= 0 || pXSource->txID >= kChannelUserMax) continue;
|
||||||
else if (!modernSend) evSendActor(actor, pXSource->txID, cmd);
|
else if (!modernSend) evSendActor(actor, pXSource->txID, cmd);
|
||||||
else modernTypeSendCommand(actor, pXSource->txID, cmd);
|
else modernTypeSendCommand(actor, pXSource->txID, cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pXSource->txID = pXSource->sysData1 = 0;
|
pXSource->txID = pXSource->sysData1 = 0;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void useRandomTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
void useRandomTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
||||||
|
|
||||||
auto sourceactor = &bloodActors[pXSource->reference];
|
auto sourceactor = &bloodActors[pXSource->reference];
|
||||||
|
@ -5990,12 +6020,16 @@ void useRandomTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
||||||
int tx = 0; int maxRetries = kMaxRandomizeRetries;
|
int tx = 0; int maxRetries = kMaxRandomizeRetries;
|
||||||
|
|
||||||
if (txIsRanged(pXSource)) {
|
if (txIsRanged(pXSource)) {
|
||||||
while (maxRetries-- >= 0) {
|
while (maxRetries-- >= 0)
|
||||||
|
{
|
||||||
if ((tx = nnExtRandom(pXSource->data1, pXSource->data4)) != pXSource->txID)
|
if ((tx = nnExtRandom(pXSource->data1, pXSource->data4)) != pXSource->txID)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
while (maxRetries-- >= 0) {
|
else
|
||||||
|
{
|
||||||
|
while (maxRetries-- >= 0)
|
||||||
|
{
|
||||||
if ((tx = randomGetDataValue(sourceactor, kRandomizeTX)) > 0 && tx != pXSource->txID)
|
if ((tx = randomGetDataValue(sourceactor, kRandomizeTX)) > 0 && tx != pXSource->txID)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -6007,49 +6041,66 @@ void useRandomTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
||||||
//evSendActor(pSource->index, pXSource->txID, (COMMAND_ID)pXSource->command);
|
//evSendActor(pSource->index, pXSource->txID, (COMMAND_ID)pXSource->command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
void useSequentialTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
void useSequentialTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
||||||
|
|
||||||
auto sourceactor = &bloodActors[pXSource->reference];
|
auto sourceactor = &bloodActors[pXSource->reference];
|
||||||
spritetype* pSource = &sourceactor->s();
|
spritetype* pSource = &sourceactor->s();
|
||||||
bool range = txIsRanged(pXSource); int cnt = 3; int tx = 0;
|
bool range = txIsRanged(pXSource); int cnt = 3; int tx = 0;
|
||||||
|
|
||||||
if (range) {
|
if (range)
|
||||||
|
{
|
||||||
// make sure sysData is correct as we store current index of TX ID here.
|
// make sure sysData is correct as we store current index of TX ID here.
|
||||||
if (pXSource->sysData1 < pXSource->data1) pXSource->sysData1 = pXSource->data1;
|
if (pXSource->sysData1 < pXSource->data1) pXSource->sysData1 = pXSource->data1;
|
||||||
else if (pXSource->sysData1 > pXSource->data4) pXSource->sysData1 = pXSource->data4;
|
else if (pXSource->sysData1 > pXSource->data4) pXSource->sysData1 = pXSource->data4;
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// make sure sysData is correct as we store current index of data field here.
|
// make sure sysData is correct as we store current index of data field here.
|
||||||
if (pXSource->sysData1 > 3) pXSource->sysData1 = 0;
|
if (pXSource->sysData1 > 3) pXSource->sysData1 = 0;
|
||||||
else if (pXSource->sysData1 < 0) pXSource->sysData1 = 3;
|
else if (pXSource->sysData1 < 0) pXSource->sysData1 = 3;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd)
|
||||||
|
{
|
||||||
case kCmdOff:
|
case kCmdOff:
|
||||||
if (!range) {
|
if (!range)
|
||||||
while (cnt-- >= 0) { // skip empty data fields
|
{
|
||||||
|
while (cnt-- >= 0) // skip empty data fields
|
||||||
|
{
|
||||||
if (pXSource->sysData1-- < 0) pXSource->sysData1 = 3;
|
if (pXSource->sysData1-- < 0) pXSource->sysData1 = 3;
|
||||||
if ((tx = GetDataVal(sourceactor, pXSource->sysData1)) <= 0) continue;
|
if ((tx = GetDataVal(sourceactor, pXSource->sysData1)) <= 0) continue;
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (--pXSource->sysData1 < pXSource->data1) pXSource->sysData1 = pXSource->data4;
|
if (--pXSource->sysData1 < pXSource->data1) pXSource->sysData1 = pXSource->data4;
|
||||||
tx = pXSource->sysData1;
|
tx = pXSource->sysData1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (!range) {
|
if (!range)
|
||||||
while (cnt-- >= 0) { // skip empty data fields
|
{
|
||||||
|
while (cnt-- >= 0) // skip empty data fields
|
||||||
|
{
|
||||||
if (pXSource->sysData1 > 3) pXSource->sysData1 = 0;
|
if (pXSource->sysData1 > 3) pXSource->sysData1 = 0;
|
||||||
if ((tx = GetDataVal(sourceactor, pXSource->sysData1++)) <= 0) continue;
|
if ((tx = GetDataVal(sourceactor, pXSource->sysData1++)) <= 0) continue;
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
tx = pXSource->sysData1;
|
tx = pXSource->sysData1;
|
||||||
if (pXSource->sysData1 >= pXSource->data4) {
|
if (pXSource->sysData1 >= pXSource->data4)
|
||||||
|
{
|
||||||
pXSource->sysData1 = pXSource->data1;
|
pXSource->sysData1 = pXSource->data1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -6065,8 +6116,14 @@ void useSequentialTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int useCondition(spritetype* pSource, XSPRITE* pXSource, EVENT event) {
|
//---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
int useCondition(spritetype* pSource, XSPRITE* pXSource, EVENT event)
|
||||||
|
{
|
||||||
auto sourceactor = &bloodActors[pSource->index];
|
auto sourceactor = &bloodActors[pSource->index];
|
||||||
int objType = event.type;
|
int objType = event.type;
|
||||||
int objIndex = event.index_;
|
int objIndex = event.index_;
|
||||||
|
|
Loading…
Reference in a new issue