MCPcopy Create free account
hub / github.com/JACoders/OpenJK / LoadFromEntitiesAndSaveToFile

Method LoadFromEntitiesAndSaveToFile

code/game/g_navigator.cpp:1512–2152  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

1510//
1511////////////////////////////////////////////////////////////////////////////////////////
1512bool NAV::LoadFromEntitiesAndSaveToFile(const char *filename, int checksum)
1513{
1514 if (mGraph.size_nodes()<=3)
1515 {
1516 return true;
1517 }
1518 mUser.ClearActor();
1519
1520 mMoveTraceCount = 0;
1521 mViewTraceCount = 0;
1522 mConnectTraceCount = 0;
1523 mConnectTime = gi.Milliseconds();
1524
1525 // PHASE 0: SCAN ALL ENTITIES AND TEMPORARLY CLOSE / TURN THEM ON
1526 //================================================================
1527 TEntBits Doors;
1528 TEntBits Walls;
1529 TEntBits NPCs;
1530 if (CHECK_START_OPEN)
1531 {
1532 for (int curEnt=0; curEnt<MAX_GENTITIES; curEnt++)
1533 {
1534 gentity_t* ent = &g_entities[curEnt];
1535
1536 if (!ent || !ent->inuse)
1537 {
1538 continue;
1539 }
1540
1541 // Is It An NPC or Vehicle?
1542 //--------------------------------------
1543 if (ent->NPC || (ent->NPC_type && Q_stricmp(ent->NPC_type, "atst")==0))
1544 {
1545 NPCs.set_bit(curEnt);
1546 ent->lastMoveTime = ent->contents;
1547 ent->contents = 0;
1548 gi.linkentity(ent);
1549 }
1550
1551
1552
1553 // Is This Ent "Start Off" or "Start Open"?
1554 //------------------------------------------
1555 if (!(ent->spawnflags&1))
1556 {
1557 continue;
1558 }
1559
1560
1561 // Is It A Door? Then Close It
1562 //--------------------------------------
1563 if (!Q_stricmp("func_door", ent->classname))
1564 {
1565 Doors.set_bit(curEnt);
1566 VectorCopy(ent->pos2, ent->currentOrigin);
1567 gi.linkentity(ent);
1568 }
1569

Callers

nothing calls this directly

Calls 15

Q_stricmpFunction · 0.85
VectorCopyFunction · 0.85
ViewTraceFunction · 0.85
size_nodesMethod · 0.80
ClearActorMethod · 0.80
fill_cells_nodesMethod · 0.80
nodes_beginMethod · 0.80
nodes_endMethod · 0.80
get_edge_acrossMethod · 0.80
setup_edgeMethod · 0.80
connect_nodeMethod · 0.80
DistMethod · 0.80

Tested by

no test coverage detected