mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-16 01:11:44 +00:00
- convert info to an event object in condCheckMixed before doing any checks.
This commit is contained in:
parent
2b2a8c3ec8
commit
da4ec51782
1 changed files with 29 additions and 45 deletions
|
@ -3831,40 +3831,30 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
|
||||||
int objType = -1; int objIndex = -1;
|
int objType = -1; int objIndex = -1;
|
||||||
DBloodActor* objActor = nullptr;
|
DBloodActor* objActor = nullptr;
|
||||||
condUnserialize(aCond, &objType, &objIndex, &objActor);
|
condUnserialize(aCond, &objType, &objIndex, &objActor);
|
||||||
|
EventObject eob; eob.fromElements(objType, objIndex, objActor);
|
||||||
|
|
||||||
switch (cond)
|
switch (cond)
|
||||||
{
|
{
|
||||||
case 0: return (objType == OBJ_SECTOR && validSectorIndex(objIndex)); // is a sector?
|
case 0: return (eob.isSector());
|
||||||
case 5: return (objType == OBJ_WALL && validWallIndex(objIndex)); // is a wall?
|
case 5: return (eob.isWall());
|
||||||
case 10: return (objType == OBJ_SPRITE && objActor != nullptr); // is a sprite?
|
case 10: return (eob.isActor() && eob.actor());
|
||||||
case 15: // x-index is fine?
|
case 15: // x-index is fine?
|
||||||
switch (objType)
|
if (eob.isWall()) return eob.wall()->hasX();
|
||||||
{
|
if (eob.isSector()) return eob.sector()->hasX();
|
||||||
case OBJ_WALL: return wall[objIndex].hasX();
|
if (eob.isActor()) return eob.actor() && eob.actor()->hasX();
|
||||||
case OBJ_SPRITE: return objActor && objActor->hasX();
|
|
||||||
case OBJ_SECTOR: return sector[objIndex].hasX();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 20: // type in a range?
|
case 20: // type in a range?
|
||||||
switch (objType)
|
if (eob.isWall()) return condCmp(eob.wall()->type, arg1, arg2, cmpOp);
|
||||||
{
|
if (eob.isSector()) return condCmp(eob.sector()->type, arg1, arg2, cmpOp);
|
||||||
case OBJ_WALL:
|
if (eob.isActor()) return eob.actor() && condCmp(eob.actor()->s().type, arg1, arg2, cmpOp);
|
||||||
return condCmp(wall[objIndex].type, arg1, arg2, cmpOp);
|
|
||||||
case OBJ_SPRITE:
|
|
||||||
return condCmp(objActor->s().type, arg1, arg2, cmpOp);
|
|
||||||
case OBJ_SECTOR:
|
|
||||||
return condCmp(sector[objIndex].type, arg1, arg2, cmpOp);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 24:
|
case 24:
|
||||||
case 25: case 26: case 27:
|
case 25: case 26: case 27:
|
||||||
case 28: case 29: case 30:
|
case 28: case 29: case 30:
|
||||||
case 31: case 32: case 33:
|
case 31: case 32: case 33:
|
||||||
switch (objType)
|
if (eob.isWall())
|
||||||
{
|
{
|
||||||
case OBJ_WALL:
|
walltype* pObj = eob.wall();
|
||||||
{
|
|
||||||
walltype* pObj = &wall[objIndex];
|
|
||||||
switch (cond)
|
switch (cond)
|
||||||
{
|
{
|
||||||
case 24: return condCmp(surfType[pObj->picnum], arg1, arg2, cmpOp);
|
case 24: return condCmp(surfType[pObj->picnum], arg1, arg2, cmpOp);
|
||||||
|
@ -3878,11 +3868,11 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
|
||||||
case 32: return condCmp(pObj->yrepeat, arg1, arg2, cmpOp);
|
case 32: return condCmp(pObj->yrepeat, arg1, arg2, cmpOp);
|
||||||
case 33: return condCmp(pObj->ypan(), arg1, arg2, cmpOp);
|
case 33: return condCmp(pObj->ypan(), arg1, arg2, cmpOp);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case OBJ_SPRITE:
|
else if (eob.isActor())
|
||||||
{
|
{
|
||||||
spritetype* pObj = &objActor->s();
|
if (!eob.actor()) break;
|
||||||
|
spritetype* pObj = &eob.actor()->s();
|
||||||
switch (cond)
|
switch (cond)
|
||||||
{
|
{
|
||||||
case 24: return condCmp(surfType[pObj->picnum], arg1, arg2, cmpOp);
|
case 24: return condCmp(surfType[pObj->picnum], arg1, arg2, cmpOp);
|
||||||
|
@ -3896,11 +3886,10 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
|
||||||
case 32: return condCmp(pObj->yrepeat, arg1, arg2, cmpOp);
|
case 32: return condCmp(pObj->yrepeat, arg1, arg2, cmpOp);
|
||||||
case 33: return condCmp(pObj->yoffset, arg1, arg2, cmpOp);
|
case 33: return condCmp(pObj->yoffset, arg1, arg2, cmpOp);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case OBJ_SECTOR:
|
else if (eob.sector())
|
||||||
{
|
{
|
||||||
sectortype* pObj = §or[objIndex];
|
sectortype* pObj = eob.sector();
|
||||||
switch (cond)
|
switch (cond)
|
||||||
{
|
{
|
||||||
case 24:
|
case 24:
|
||||||
|
@ -3949,9 +3938,7 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
|
||||||
case 32: return condCmp(pObj->floorypan(), arg1, arg2, cmpOp);
|
case 32: return condCmp(pObj->floorypan(), arg1, arg2, cmpOp);
|
||||||
case 33: return condCmp(pObj->ceilingypan(), arg1, arg2, cmpOp);
|
case 33: return condCmp(pObj->ceilingypan(), arg1, arg2, cmpOp);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 41: case 42: case 43:
|
case 41: case 42: case 43:
|
||||||
case 44: case 50: case 51:
|
case 44: case 50: case 51:
|
||||||
|
@ -3959,14 +3946,12 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
|
||||||
case 55: case 56: case 57:
|
case 55: case 56: case 57:
|
||||||
case 58: case 59: case 70:
|
case 58: case 59: case 70:
|
||||||
case 71:
|
case 71:
|
||||||
switch (objType)
|
if (eob.isWall())
|
||||||
{
|
{
|
||||||
case OBJ_WALL:
|
auto pObj = eob.wall();
|
||||||
{
|
if (!pObj->hasX())
|
||||||
if (!wall[objIndex].hasX())
|
|
||||||
return condCmp(0, arg1, arg2, cmpOp);
|
return condCmp(0, arg1, arg2, cmpOp);
|
||||||
|
|
||||||
auto pObj = &wall[objIndex];
|
|
||||||
XWALL* pXObj = &pObj->xw();
|
XWALL* pXObj = &pObj->xw();
|
||||||
switch (cond)
|
switch (cond)
|
||||||
{
|
{
|
||||||
|
@ -3998,9 +3983,11 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case OBJ_SPRITE: {
|
else if (eob.isActor())
|
||||||
|
{
|
||||||
|
auto objActor = eob.actor();
|
||||||
|
if (!objActor) break;
|
||||||
if (!objActor->hasX())
|
if (!objActor->hasX())
|
||||||
return condCmp(0, arg1, arg2, cmpOp);
|
return condCmp(0, arg1, arg2, cmpOp);
|
||||||
|
|
||||||
|
@ -4009,7 +3996,7 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
|
||||||
{
|
{
|
||||||
case 41: case 42:
|
case 41: case 42:
|
||||||
case 43: case 44:
|
case 43: case 44:
|
||||||
return condCmp(getDataFieldOfObject(OBJ_SPRITE, objIndex, objActor, 1 + cond - 41), arg1, arg2, cmpOp);
|
return condCmp(getDataFieldOfObject(eob, 1 + cond - 41), arg1, arg2, cmpOp);
|
||||||
case 50: return condCmp(pXObj->rxID, arg1, arg2, cmpOp);
|
case 50: return condCmp(pXObj->rxID, arg1, arg2, cmpOp);
|
||||||
case 51: return condCmp(pXObj->txID, arg1, arg2, cmpOp);
|
case 51: return condCmp(pXObj->txID, arg1, arg2, cmpOp);
|
||||||
case 52: return pXObj->locked;
|
case 52: return pXObj->locked;
|
||||||
|
@ -4023,15 +4010,14 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
|
||||||
case 70: return condCmp(seqGetID(objActor), arg1, arg2, cmpOp);
|
case 70: return condCmp(seqGetID(objActor), arg1, arg2, cmpOp);
|
||||||
case 71: return condCmp(seqGetStatus(objActor), arg1, arg2, cmpOp);
|
case 71: return condCmp(seqGetStatus(objActor), arg1, arg2, cmpOp);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case OBJ_SECTOR:
|
else if (eob.isSector())
|
||||||
{
|
{
|
||||||
if (!sector[objIndex].hasX())
|
auto pObj = eob.sector();
|
||||||
|
if (!pObj->hasX())
|
||||||
return condCmp(0, arg1, arg2, cmpOp);
|
return condCmp(0, arg1, arg2, cmpOp);
|
||||||
|
|
||||||
auto pObj = §or[objIndex];
|
XSECTOR* pXObj = &pObj->xs();
|
||||||
XSECTOR* pXObj = §or[objIndex].xs();
|
|
||||||
switch (cond) {
|
switch (cond) {
|
||||||
case 41: return condCmp(pXObj->data, arg1, arg2, cmpOp);
|
case 41: return condCmp(pXObj->data, arg1, arg2, cmpOp);
|
||||||
case 50: return condCmp(pXObj->rxID, arg1, arg2, cmpOp);
|
case 50: return condCmp(pXObj->rxID, arg1, arg2, cmpOp);
|
||||||
|
@ -4062,9 +4048,7 @@ bool condCheckMixed(DBloodActor* aCond, const EVENT& event, int cmpOp, bool PUSH
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 99: return condCmp(event.cmd, arg1, arg2, cmpOp); // this codition received specified command?
|
case 99: return condCmp(event.cmd, arg1, arg2, cmpOp); // this codition received specified command?
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue