Last active
October 15, 2018 01:53
-
-
Save benhall-7/cbcfff499826f90e744fd22d98bee7a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int aiParam.selectSituation(AI ai, int index_start, int index_end, int type) | |
{ | |
int current_index = index_start;//r31 | |
int r27 = 0;//unknown | |
if (current_index < index_end) | |
{ | |
int sits_remain = index_end - index_start;//r26 | |
while (sits_remain >= 0) | |
{ | |
AI.Param param_data; | |
if (type == 0) | |
param_data = ai.param; | |
else | |
param_data = ai.param_cmn;//common param data? I haven't checked | |
Situation st = param_data.situations[current_index]; | |
if (r27 > 0 && (st.flags & 0x8 || --r27 > 0)) | |
{ | |
if (st.count == 0) | |
r27++; | |
sits_remain--; | |
current_index++; | |
continue; | |
} | |
int cond_index = 0;//r28 | |
bool condition; | |
for (conds_remain = 2; conds_remain > 0; conds_remain--)//r23 | |
{ | |
bool condition = aiParam.chkSituation(AI ai, st.conditions[cond_index]); | |
if (cond_index == 0) | |
{ | |
if (st.flags & 0x1) | |
condition = !condition | |
} | |
else if (st.flags & 0x2) | |
condition = !condition | |
if (condition) | |
{ | |
if (st.flags & 0x4) | |
break; | |
} | |
else if (!(st.flags & 0x4)) | |
break; | |
cond_index++; | |
} | |
if (condition) | |
{ | |
if (st.count == 0) | |
r27 = 1 | |
else break; | |
} | |
sits_remain--; | |
current_index++; | |
} | |
} | |
return current_index; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment