Reads the controls for the automap, and adjusts viewpoint accordingly
| 569 | |
| 570 | // Reads the controls for the automap, and adjusts viewpoint accordingly |
| 571 | void TCAMReadControls() { |
| 572 | Frametime = last_frametime; |
| 573 | int save_mode = Game_interface_mode; |
| 574 | game_controls controls; |
| 575 | |
| 576 | controls.toggle_slide = 0; |
| 577 | controls.toggle_bank = 0; |
| 578 | Game_interface_mode = GAME_INTERFACE; |
| 579 | |
| 580 | PollControls(); |
| 581 | DoMovement(&controls); |
| 582 | |
| 583 | // Do translational movement |
| 584 | AM_view_pos += (controls.forward_thrust * last_frametime * AM_TRANSLATION_SCALAR) * AM_view_orient.fvec; |
| 585 | AM_view_pos += (controls.vertical_thrust * last_frametime * AM_TRANSLATION_SCALAR) * AM_view_orient.uvec; |
| 586 | AM_view_pos += (controls.sideways_thrust * last_frametime * AM_TRANSLATION_SCALAR) * AM_view_orient.rvec; |
| 587 | |
| 588 | // Do rotational movement |
| 589 | |
| 590 | matrix newmat; |
| 591 | float norm = ((65536 / 360) * AM_ROTATIONAL_SCALAR) * last_frametime; |
| 592 | |
| 593 | AM_pitch += (norm * controls.pitch_thrust); |
| 594 | AM_heading += (norm * controls.heading_thrust); |
| 595 | |
| 596 | if (AM_pitch < 0) |
| 597 | AM_pitch += 65536; |
| 598 | if (AM_pitch >= 65536) |
| 599 | AM_pitch -= 65536; |
| 600 | |
| 601 | if (AM_heading < 0) |
| 602 | AM_heading += 65536; |
| 603 | if (AM_heading >= 65536) |
| 604 | AM_heading -= 65536; |
| 605 | |
| 606 | vm_AnglesToMatrix(&newmat, (uint16_t)AM_pitch, (uint16_t)AM_heading, 0); |
| 607 | AM_view_orient = newmat; |
| 608 | |
| 609 | vm_Orthogonalize(&AM_view_orient); |
| 610 | Game_interface_mode = save_mode; |
| 611 | } |
| 612 | |
| 613 | // Renders the low-res terrain for the automap |
| 614 | void TCAMRenderTerrain() { |
no test coverage detected