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:
|
||||
switch (event.cmd) {
|
||||
case kCmdOff:
|
||||
|
@ -5946,12 +5954,19 @@ bool modernTypeOperateWall(int nWall, walltype* pWall, XWALL* pXWall, EVENT even
|
|||
default:
|
||||
return false; // no modern type found to work with, go normal OperateWall();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
bool txIsRanged(XSPRITE* pXSource) {
|
||||
if (pXSource->data1 > 0 && pXSource->data2 <= 0 && pXSource->data3 <= 0 && pXSource->data4 > 0) {
|
||||
if (pXSource->data1 > pXSource->data4) {
|
||||
if (pXSource->data1 > 0 && pXSource->data2 <= 0 && pXSource->data3 <= 0 && pXSource->data4 > 0)
|
||||
{
|
||||
if (pXSource->data1 > pXSource->data4)
|
||||
{
|
||||
// data1 must be less than data4
|
||||
int tmp = pXSource->data1; pXSource->data1 = pXSource->data4;
|
||||
pXSource->data4 = tmp;
|
||||
|
@ -5961,28 +5976,43 @@ bool txIsRanged(XSPRITE* pXSource) {
|
|||
return false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void seqTxSendCmdAll(XSPRITE* pXSource, int nIndex, COMMAND_ID cmd, bool modernSend) {
|
||||
auto actor = &bloodActors[nIndex];
|
||||
bool ranged = txIsRanged(pXSource);
|
||||
if (ranged) {
|
||||
for (pXSource->txID = pXSource->data1; pXSource->txID <= pXSource->data4; pXSource->txID++) {
|
||||
if (ranged)
|
||||
{
|
||||
for (pXSource->txID = pXSource->data1; pXSource->txID <= pXSource->data4; pXSource->txID++)
|
||||
{
|
||||
if (pXSource->txID <= 0 || pXSource->txID >= kChannelUserMax) continue;
|
||||
else if (!modernSend) evSendActor(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);
|
||||
if (pXSource->txID <= 0 || pXSource->txID >= kChannelUserMax) continue;
|
||||
else if (!modernSend) evSendActor(actor, pXSource->txID, cmd);
|
||||
else modernTypeSendCommand(actor, pXSource->txID, cmd);
|
||||
}
|
||||
}
|
||||
|
||||
pXSource->txID = pXSource->sysData1 = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void useRandomTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
||||
|
||||
auto sourceactor = &bloodActors[pXSource->reference];
|
||||
|
@ -5990,12 +6020,16 @@ void useRandomTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
|||
int tx = 0; int maxRetries = kMaxRandomizeRetries;
|
||||
|
||||
if (txIsRanged(pXSource)) {
|
||||
while (maxRetries-- >= 0) {
|
||||
while (maxRetries-- >= 0)
|
||||
{
|
||||
if ((tx = nnExtRandom(pXSource->data1, pXSource->data4)) != pXSource->txID)
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
while (maxRetries-- >= 0) {
|
||||
}
|
||||
else
|
||||
{
|
||||
while (maxRetries-- >= 0)
|
||||
{
|
||||
if ((tx = randomGetDataValue(sourceactor, kRandomizeTX)) > 0 && tx != pXSource->txID)
|
||||
break;
|
||||
}
|
||||
|
@ -6007,49 +6041,66 @@ void useRandomTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
|||
//evSendActor(pSource->index, pXSource->txID, (COMMAND_ID)pXSource->command);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
void useSequentialTx(XSPRITE* pXSource, COMMAND_ID cmd, bool setState) {
|
||||
|
||||
auto sourceactor = &bloodActors[pXSource->reference];
|
||||
spritetype* pSource = &sourceactor->s();
|
||||
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.
|
||||
if (pXSource->sysData1 < pXSource->data1) pXSource->sysData1 = pXSource->data1;
|
||||
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.
|
||||
if (pXSource->sysData1 > 3) pXSource->sysData1 = 0;
|
||||
else if (pXSource->sysData1 < 0) pXSource->sysData1 = 3;
|
||||
|
||||
}
|
||||
|
||||
switch (cmd) {
|
||||
switch (cmd)
|
||||
{
|
||||
case kCmdOff:
|
||||
if (!range) {
|
||||
while (cnt-- >= 0) { // skip empty data fields
|
||||
if (!range)
|
||||
{
|
||||
while (cnt-- >= 0) // skip empty data fields
|
||||
{
|
||||
if (pXSource->sysData1-- < 0) pXSource->sysData1 = 3;
|
||||
if ((tx = GetDataVal(sourceactor, pXSource->sysData1)) <= 0) continue;
|
||||
else break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (--pXSource->sysData1 < pXSource->data1) pXSource->sysData1 = pXSource->data4;
|
||||
tx = pXSource->sysData1;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!range) {
|
||||
while (cnt-- >= 0) { // skip empty data fields
|
||||
if (!range)
|
||||
{
|
||||
while (cnt-- >= 0) // skip empty data fields
|
||||
{
|
||||
if (pXSource->sysData1 > 3) pXSource->sysData1 = 0;
|
||||
if ((tx = GetDataVal(sourceactor, pXSource->sysData1++)) <= 0) continue;
|
||||
else break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
tx = pXSource->sysData1;
|
||||
if (pXSource->sysData1 >= pXSource->data4) {
|
||||
if (pXSource->sysData1 >= pXSource->data4)
|
||||
{
|
||||
pXSource->sysData1 = pXSource->data1;
|
||||
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];
|
||||
int objType = event.type;
|
||||
int objIndex = event.index_;
|
||||
|
|
Loading…
Reference in a new issue