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

Function ObjInitPositionHistory

Descent3/object.cpp:1752–1780  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1750}
1751
1752void ObjInitPositionHistory(object *obj) {
1753 ASSERT(Object_map_position_history[OBJNUM(obj)] == -1);
1754
1755 // If it is one of the types of object's that we have to sample positions for
1756 // Initialize that
1757 switch (obj->type) {
1758 case OBJ_ROBOT:
1759 case OBJ_WEAPON:
1760 case OBJ_DEBRIS:
1761 if (Num_free_object_position_history > 0) {
1762 // we have a free slot
1763 Num_free_object_position_history--;
1764 int free_slot = Object_map_position_free_slots[Num_free_object_position_history];
1765 Object_map_position_history[OBJNUM(obj)] = free_slot;
1766 int i;
1767 for (i = 0; i < MAX_POSITION_HISTORY; i++) {
1768 Object_position_samples[free_slot].pos[i] = obj->pos;
1769 }
1770 } else {
1771 // out of slots!
1772 Object_map_position_history[OBJNUM(obj)] = -1;
1773 }
1774 break;
1775 default:
1776 // not saving positions
1777 Object_map_position_history[OBJNUM(obj)] = -1;
1778 break;
1779 }
1780}
1781
1782void ObjFreePositionHistory(object *obj) {
1783 int objnum = OBJNUM(obj);

Callers 3

LoadLevelFunction · 0.85
ObjCreateFunction · 0.85
ObjReInitPositionHistoryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected