Skip to content

Commit d703fca

Browse files
authored
Move processing of thrust keys to be within the same block as the throttle keys (#4501)
* Remove do_thrust_keys() function * Clean up documentation of Viewer_mode flags
1 parent ddef6ea commit d703fca

File tree

2 files changed

+25
-30
lines changed

2 files changed

+25
-30
lines changed

code/globalincs/systemvars.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,23 @@
3131
#define GM_CAMPAIGN_MODE (1 << 10) // are we currently in a campaign.
3232
#define GM_LAB (1 << 11) // We are currently in the F3 lab
3333

34-
#define VM_EXTERNAL (1 << 0) // Set if not viewing from player position.
35-
#define VM_TRACK (1 << 1) // Set if viewer is tracking target.
36-
#define VM_DEAD_VIEW (1 << 2) // Set if viewer is watching from dead view.
37-
#define VM_CHASE (1 << 3) // Chase view.
38-
#define VM_OTHER_SHIP (1 << 4) // View from another ship.
39-
#define VM_CAMERA_LOCKED (1 << 5) // Set if player does not have control of the camera
40-
#define VM_WARP_CHASE (1 << 6) // View while warping out (form normal view mode)
41-
#define VM_PADLOCK_UP (1 << 7)
42-
#define VM_PADLOCK_REAR (1 << 8)
43-
#define VM_PADLOCK_LEFT (1 << 9)
44-
#define VM_PADLOCK_RIGHT (1 << 10)
45-
#define VM_WARPIN_ANCHOR (1 << 11) // special warpin camera mode
46-
#define VM_TOPDOWN (1 << 12) //Camera is looking down on ship
47-
#define VM_FREECAMERA (1 << 13) //Camera is not attached to any particular object, probably under SEXP control
48-
#define VM_CENTERING (1 << 14) // View is springing to center
49-
50-
#define VM_PADLOCK_ANY (VM_PADLOCK_UP|VM_PADLOCK_REAR|VM_PADLOCK_LEFT|VM_PADLOCK_RIGHT)
34+
#define VM_EXTERNAL (1 << 0) // Set if not viewing from player position.
35+
#define VM_TRACK (1 << 1) // Set if viewer is tracking target.
36+
#define VM_DEAD_VIEW (1 << 2) // Set if viewer is watching from dead view.
37+
#define VM_CHASE (1 << 3) // Chase view.
38+
#define VM_OTHER_SHIP (1 << 4) // View from another ship.
39+
#define VM_CAMERA_LOCKED (1 << 5) // Set if player does not have control of the camera
40+
#define VM_WARP_CHASE (1 << 6) // View while warping out (form normal view mode)
41+
#define VM_PADLOCK_UP (1 << 7) // Set when player is looking up
42+
#define VM_PADLOCK_REAR (1 << 8) // Set when player is looking behind
43+
#define VM_PADLOCK_LEFT (1 << 9) // Set when player is looking left
44+
#define VM_PADLOCK_RIGHT (1 << 10) // Set when player is looking right
45+
#define VM_WARPIN_ANCHOR (1 << 11) // special warpin camera mode
46+
#define VM_TOPDOWN (1 << 12) // Camera is looking down on ship
47+
#define VM_FREECAMERA (1 << 13) // Camera is not attached to any particular object, probably under SEXP control
48+
#define VM_CENTERING (1 << 14) // View is springing to center
49+
50+
#define VM_PADLOCK_ANY (VM_PADLOCK_UP | VM_PADLOCK_REAR | VM_PADLOCK_LEFT | VM_PADLOCK_RIGHT)
5151

5252
//-----Cutscene stuff
5353
//No bars

code/playerman/playercontrol.cpp

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -510,16 +510,6 @@ void do_view_external()
510510
Viewer_external_info.angles.h = PI2 + Viewer_external_info.angles.h;
511511
}
512512

513-
/**
514-
* Separate out the reading of thrust keys, so we can call this from external view as well as from normal view
515-
*/
516-
void do_thrust_keys(control_info *ci)
517-
{
518-
ci->forward = check_control_timef(FORWARD_THRUST) - check_control_timef(REVERSE_THRUST);
519-
ci->sideways = (check_control_timef(RIGHT_SLIDE_THRUST) - check_control_timef(LEFT_SLIDE_THRUST));//for slideing-Bobboau
520-
ci->vertical = (check_control_timef(UP_SLIDE_THRUST) - check_control_timef(DOWN_SLIDE_THRUST));//for slideing-Bobboau
521-
}
522-
523513
/**
524514
* Called by single and multiplayer modes to reset information inside of control info structure
525515
*/
@@ -552,12 +542,12 @@ void read_keyboard_controls( control_info * ci, float frame_time, physics_info *
552542

553543
// Camera & View controls
554544
if ( Viewer_mode & VM_EXTERNAL ) {
545+
// External mode
555546
control_used(VIEW_EXTERNAL);
556-
557547
do_view_external();
558-
do_thrust_keys(ci);
559548

560549
} else if ( Viewer_mode & VM_CHASE ) {
550+
// Chase mode
561551
do_view_chase();
562552

563553
} else {
@@ -570,7 +560,6 @@ void read_keyboard_controls( control_info * ci, float frame_time, physics_info *
570560
// Ship controls
571561
if (Viewer_mode & VM_CAMERA_LOCKED) {
572562
// From keyboard...
573-
do_thrust_keys(ci);
574563
if ( check_control(BANK_WHEN_PRESSED) ) {
575564
ci->bank = check_control_timef(BANK_LEFT) + check_control_timef(YAW_LEFT) - check_control_timef(YAW_RIGHT) - check_control_timef(BANK_RIGHT);
576565
ci->heading = 0.0f;
@@ -609,6 +598,12 @@ void read_keyboard_controls( control_info * ci, float frame_time, physics_info *
609598
}
610599

611600
if (!(Game_mode & GM_DEAD)) {
601+
// Thrust controls
602+
ci->forward = check_control_timef(FORWARD_THRUST) - check_control_timef(REVERSE_THRUST);
603+
ci->sideways = (check_control_timef(RIGHT_SLIDE_THRUST) - check_control_timef(LEFT_SLIDE_THRUST)); // for slideing-Bobboau
604+
ci->vertical = (check_control_timef(UP_SLIDE_THRUST) - check_control_timef(DOWN_SLIDE_THRUST)); // for slideing-Bobboau
605+
606+
// Throttle controls
612607
if ( button_info_query(&Player->bi, ONE_THIRD_THROTTLE) ) {
613608
control_used(ONE_THIRD_THROTTLE);
614609
player_clear_speed_matching();

0 commit comments

Comments
 (0)