| 48 | } |
| 49 | |
| 50 | U32 zConditional_Evaluate(_zConditional* c) |
| 51 | { |
| 52 | zVarEntry* v = NULL; |
| 53 | void* context = NULL; |
| 54 | |
| 55 | for (int i = 0; i < 18; ++i) |
| 56 | { |
| 57 | if (c->asset->expr1 == zVarEntryTable[i].varNameID) |
| 58 | { |
| 59 | v = &zVarEntryTable[i]; |
| 60 | if (i == 15 || i == 16 || i == 17) |
| 61 | { |
| 62 | U32 id = c->asset->value_asset; |
| 63 | if (id != 0) |
| 64 | context = zSceneFindObject(id); |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | if (v == NULL) |
| 70 | return 0; |
| 71 | |
| 72 | U32 temp = v->varCB(context); |
| 73 | |
| 74 | switch (c->asset->op) |
| 75 | { |
| 76 | case CONDITION_EQ: |
| 77 | return temp == c->asset->constNum ? 1 : 0; |
| 78 | |
| 79 | case CONDITION_GT: |
| 80 | return temp > c->asset->constNum ? 1 : 0; |
| 81 | |
| 82 | case CONDITION_LT: |
| 83 | return temp < c->asset->constNum ? 1 : 0; |
| 84 | |
| 85 | case CONDITION_GE: |
| 86 | return temp >= c->asset->constNum ? 1 : 0; |
| 87 | |
| 88 | case CONDITION_LE: |
| 89 | return temp <= c->asset->constNum ? 1 : 0; |
| 90 | |
| 91 | case CONDITION_NE: |
| 92 | return temp != c->asset->constNum ? 1 : 0; |
| 93 | |
| 94 | default: |
| 95 | return 0; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | S32 zConditionalEventCB(xBase* arg1, xBase* arg2, U32 toEvent, const F32* fp, xBase* other) |
| 100 | { |
no test coverage detected