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

Function SetNormalizedTimeAnimTimed

model/polymodel.cpp:2358–2385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2356}
2357
2358void SetNormalizedTimeAnimTimed(float frame, float *normalized_time, poly_model *pm) {
2359 int i, j;
2360
2361 ASSERT(!(pm->flags & PMF_NOT_RESIDENT));
2362
2363 for (i = 0; i < pm->n_models; i++) {
2364 bsp_info *sm = &pm->submodel[i];
2365
2366 if (frame <= sm->rot_track_min)
2367 normalized_time[i] = 0.0;
2368 else if (frame >= sm->rot_track_max)
2369 normalized_time[i] = 1.0;
2370 else {
2371 float total_time = sm->rot_track_max - sm->rot_track_min;
2372 normalized_time[i] = (frame - sm->rot_track_min) / total_time;
2373 }
2374 }
2375
2376 // Now, override angles of weapon bank turrets
2377 for (i = 0; i < pm->num_wbs; i++) {
2378 for (j = 0; j < pm->poly_wb[i].num_turrets; j++) {
2379 int sobj_index;
2380
2381 sobj_index = pm->poly_wb[i].turret_index[j];
2382 normalized_time[sobj_index] = 0.0;
2383 }
2384 }
2385}
2386
2387// This is for non-rotated turrets or rotators
2388void SetNormalizedTimeAnim(float anim_frame, float *normalized_time, poly_model *pm) {

Callers 1

SetNormalizedTimeAnimFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected