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

Function ObjDoFrameAll

Descent3/object.cpp:2944–3023  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2942// Process all objects for the current frame
2943#define OBJ_POS_SAMPLE_TIME (1.0f / (((float)MAX_POSITION_HISTORY) * 20.0f)) // super sample at 20 fps
2944void ObjDoFrameAll() {
2945 int i;
2946 object *objp;
2947 int objs_live = 0;
2948 bool update_position_history = false;
2949
2950 if (Last_position_history_update_time > Gametime) {
2951 // the Gametime rolled over (new level)
2952 update_position_history = true;
2953 }
2954
2955 if (Gametime >= Last_position_history_update_time + OBJ_POS_SAMPLE_TIME) {
2956 update_position_history = true;
2957 }
2958
2959 if (update_position_history) {
2960 Object_position_head--;
2961 if (Object_position_head == 255)
2962 Object_position_head = MAX_POSITION_HISTORY - 1;
2963
2964 Last_position_history_update[Object_position_head] = Gametime;
2965 Last_position_history_update_time = Gametime;
2966 }
2967
2968 // MT: seed code removed 9/20/99 because it breaks the randomness of the
2969 // ambient sound patterns.
2970 // IMPORTANT NOTE: Because this code could have far-reaching consequences,
2971 // please DO NOT check this in until after the regular patches for D3 are
2972 // done. This code should only go in for the Mercenary patch, which will
2973 // get adequate testing to make sure nothing serious has broken.
2974 //@@ // Seed timer for this frame
2975 //@@ int seed=Gametime*1000;
2976 //@@ ps_srand (seed);
2977
2978 // Does control for soar objects
2979 if (Soar_active)
2980 SoarTick(Frametime);
2981
2982 Physics_NumLinked = 0;
2983
2984 // Process each object
2985 for (i = 0, objp = Objects; i <= Highest_object_index; i++, objp++) {
2986 if ((objp->type != OBJ_NONE) && (!(objp->flags & OF_DEAD))) {
2987 RTP_STARTINCTIME(obj_do_frm);
2988 ObjDoFrame(objp);
2989
2990 if (update_position_history) {
2991 int slot = Object_map_position_history[OBJNUM(objp)];
2992 if (slot != -1) {
2993 Object_position_samples[slot].pos[Object_position_head] = objp->pos;
2994 }
2995 }
2996
2997 RTP_ENDINCTIME(obj_do_frm);
2998 objs_live++;
2999 }
3000 }
3001

Callers 1

GameFrameFunction · 0.85

Calls 5

ObjDoFrameFunction · 0.85
DoPhysLinkedFrameFunction · 0.85
VisEffectMoveAllFunction · 0.85
BlendAllLightingEdgesFunction · 0.85
ObjDeleteDeadFunction · 0.85

Tested by

no test coverage detected