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

Method DoThinkFrame

Descent3/matcen.cpp:1306–1439  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1304#define MATCEN_FORCE 60000.0f
1305
1306void matcen::DoThinkFrame() {
1307 if ((Game_mode & GM_MULTI) && Netgame.local_role != LR_SERVER)
1308 return;
1309
1310 if (m_type == MT_UNASSIGNED)
1311 return;
1312
1313 // If disabled and not finishing up a production...
1314 if ((m_prod_mode == MMODE_NOTPROD) && (m_status & MSTAT_DISABLED))
1315 return;
1316
1317 if (m_type == MT_OBJECT) {
1318 object *parent = ObjGet(m_objref);
1319
1320 if (!parent) {
1321 m_prod_mode_time = 0.0f;
1322 m_prod_mode = MMODE_NOTPROD;
1323 m_cur_saturation_count = 0;
1324
1325 m_type = MT_UNASSIGNED;
1326 return;
1327 }
1328
1329 if ((m_prod_mode != MMODE_NOTPROD &&
1330 (parent->movement_type == MT_PHYSICS || parent->movement_type == MT_WALKING)) ||
1331 (m_status & MSTAT_COMPUTE_CREATE_PNT_EVERY_FRAME)) {
1332 ComputeCreatePnt();
1333 }
1334 }
1335
1336 // Increment time
1337 m_prod_mode_time += Frametime;
1338
1339 // Do alive children frame
1340 if (m_max_alive_children > 0) {
1341 DoAliveListFrame();
1342 }
1343
1344 // Determine if it is time to start a production
1345 switch (m_prod_mode) {
1346 case MMODE_NOTPROD: {
1347 if (!(m_status & (MSTAT_DONE_PROD | MSTAT_ACTIVE_PAUSE)) && (m_num_alive != m_max_alive_children)) {
1348
1349 if (Gametime >= m_next_active_check_time) {
1350 CheckActivateStatus();
1351 }
1352
1353 if ((m_status & MSTAT_ACTIVE) && (Gametime >= m_cached_prod_time) && (m_cached_prod_index >= 0)) {
1354 StartObjProd();
1355 }
1356 } else if ((m_status & MSTAT_DONE_PROD) && (m_status & MSTAT_ACTIVE)) {
1357 Sound_system.StopSoundLooping(m_sound_active_handle);
1358 m_status &= ~MSTAT_ACTIVE;
1359 }
1360 } break;
1361
1362 case MMODE_PREPROD: {
1363 if (m_prod_mode_time >= m_preprod_time)

Callers 1

DoMatcensFrameFunction · 0.80

Calls 6

ObjGetFunction · 0.85
GetTerrainRoomFromPosFunction · 0.85
vm_NormalizeVectorFunction · 0.85
ApplyDamageToPlayerFunction · 0.85
PhysicsDoSimLinearFunction · 0.85
StopSoundLoopingMethod · 0.80

Tested by

no test coverage detected