MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / Inform

Method Inform

Descent3/levelgoal.cpp:1220–1277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1218}
1219
1220void levelgoals::Inform(char type, int comp_type, int handle) {
1221 int i, j;
1222
1223 for (i = 0; i < m_num_goals; i++) {
1224 int flags;
1225 m_goal[i].GetStatus(i, LO_GET_SPECIFIED, &flags);
1226
1227 if (!(flags & LGF_ENABLED) && (comp_type == LGF_COMP_ACTIVATE || comp_type == LGF_COMP_ENTER ||
1228 comp_type == LGF_COMP_PLAYER_WEAPON || comp_type == LGF_COMP_PLAYER)) {
1229 continue;
1230 }
1231
1232 int cur_comp_type = flags & LGF_COMP_MASK;
1233 int num_items = m_goal[i].GetNumItems();
1234
1235 if (flags != LGF_COMP_DALLAS && cur_comp_type != comp_type) {
1236 continue;
1237 }
1238
1239 for (j = 0; j < num_items; j++) {
1240 char ctype;
1241 int chandle;
1242 bool cdone;
1243
1244 m_goal[i].ItemInfo(j, LO_GET_SPECIFIED, &ctype, &chandle, &cdone);
1245
1246 if (cdone || type != ctype || chandle != handle) {
1247 continue;
1248 }
1249
1250 bool done = true;
1251 m_goal[i].ItemInfo(j, LO_SET_SPECIFIED, NULL, NULL, &done);
1252
1253 int k;
1254 bool f_done = true;
1255
1256 for (k = 0; k < num_items; k++) {
1257 m_goal[i].ItemInfo(j, LO_SET_SPECIFIED, NULL, NULL, &done);
1258 if (!done) {
1259 f_done = false;
1260 break;
1261 }
1262 }
1263
1264 if (f_done) {
1265 int flags = LGF_COMPLETED;
1266 m_goal[i].GetStatus(i, LO_SET_SPECIFIED, &flags);
1267 }
1268
1269 // Make this after the goal complete is done so that designers can say, if this and not
1270 // goal complete
1271 tOSIRISEventInfo ei;
1272 ei.evt_level_goal_item_complete.level_goal_index = i;
1273
1274 Osiris_CallLevelEvent(EVT_LEVEL_GOAL_ITEM_COMPLETE, &ei);
1275 }
1276 }
1277}

Callers 6

check_lg_informFunction · 0.80
msafe_CallFunctionFunction · 0.80
ObjDeleteDeadFunction · 0.80
ObjSetPosFunction · 0.80
AddObjectMethod · 0.80
CheckTriggerFunction · 0.80

Calls 4

Osiris_CallLevelEventFunction · 0.85
ItemInfoMethod · 0.80
GetStatusMethod · 0.45
GetNumItemsMethod · 0.45

Tested by

no test coverage detected