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

Function KeyframeAnimateCockpit

Descent3/cockpit.cpp:550–589  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////////// adjusts current keyframe and dormancy

Source from the content-addressed store, hash-verified

548//
549// adjusts current keyframe and dormancy
550float KeyframeAnimateCockpit() {
551 float newkeyframe;
552
553 newkeyframe = Cockpit_info.this_keyframe + (Cockpit_info.next_keyframe - Cockpit_info.this_keyframe) *
554 (Cockpit_info.frame_time / COCKPIT_ANIM_TIME);
555 // mprintf(0, "this=%.1f next=%.1f ft=%.1f\n", Cockpit_info.this_keyframe, Cockpit_info.next_keyframe, Cockpit_info.frame_time)); // going up in keyframes
556 if (Cockpit_info.this_keyframe < Cockpit_info.next_keyframe) {
557 if (newkeyframe >= Cockpit_info.next_keyframe) {
558 Cockpit_info.frame_time = 0.0f;
559 Cockpit_info.this_keyframe = Cockpit_info.next_keyframe;
560 }
561 }
562 // going down in keyframes
563 else if (Cockpit_info.this_keyframe > Cockpit_info.next_keyframe) {
564 if (newkeyframe <= Cockpit_info.next_keyframe) {
565 Cockpit_info.frame_time = 0.0f;
566 Cockpit_info.this_keyframe = Cockpit_info.next_keyframe;
567 }
568 } else {
569 Cockpit_info.animating = false;
570 return newkeyframe;
571 }
572
573 // decide if we can process cockpit
574 Cockpit_info.animating = true;
575 if (Cockpit_info.this_keyframe != Cockpit_info.next_keyframe) {
576 Cockpit_info.frame_time += Frametime;
577 }
578 if (Cockpit_info.this_keyframe == COCKPIT_COMPLETE_FRAME &&
579 Cockpit_info.next_keyframe == Cockpit_info.this_keyframe) {
580 FlagGaugesFunctional(STAT_ALL);
581 Cockpit_info.state = COCKPIT_STATE_FUNCTIONAL;
582 } else if (Cockpit_info.this_keyframe == COCKPIT_DORMANT_FRAME &&
583 Cockpit_info.next_keyframe == COCKPIT_DORMANT_FRAME) {
584 Cockpit_info.state = COCKPIT_STATE_DORMANT;
585 } else {
586 Cockpit_info.state = COCKPIT_STATE_QUASI;
587 }
588 return newkeyframe;
589}
590//////////////////////////////////////////////////////////////////////////////
591//
592// returns the submodel number of the monitor requested

Callers 1

RenderCockpitFunction · 0.85

Calls 1

FlagGaugesFunctionalFunction · 0.85

Tested by

no test coverage detected