MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / zConditional_Evaluate

Function zConditional_Evaluate

src/SB/Game/zConditional.cpp:50–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50U32 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
99S32 zConditionalEventCB(xBase* arg1, xBase* arg2, U32 toEvent, const F32* fp, xBase* other)
100{

Callers 1

zConditionalEventCBFunction · 0.70

Calls 1

zSceneFindObjectFunction · 0.85

Tested by

no test coverage detected