From 69209c38968c6f4066a772e0a51a2928749217de Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Fri, 9 Dec 2011 19:00:23 +0000 Subject: Re-indenting the code to use standard tabs. Yes, I know this is pretty pointless, but who cares? --- Stars45/JoyDlg.cpp | 244 ++++++++++++++++++++++++++--------------------------- 1 file changed, 122 insertions(+), 122 deletions(-) (limited to 'Stars45/JoyDlg.cpp') diff --git a/Stars45/JoyDlg.cpp b/Stars45/JoyDlg.cpp index 0815690..95f41a5 100644 --- a/Stars45/JoyDlg.cpp +++ b/Stars45/JoyDlg.cpp @@ -1,14 +1,14 @@ /* Project Starshatter 4.5 - Destroyer Studios LLC - Copyright © 1997-2004. All Rights Reserved. + Destroyer Studios LLC + Copyright © 1997-2004. All Rights Reserved. - SUBSYSTEM: Stars.exe - FILE: JoyDlg.cpp - AUTHOR: John DiCamillo + SUBSYSTEM: Stars.exe + FILE: JoyDlg.cpp + AUTHOR: John DiCamillo - OVERVIEW - ======== + OVERVIEW + ======== */ #include "MemDebug.h" @@ -32,14 +32,14 @@ DEF_MAP_CLIENT(JoyDlg, OnCancel); DEF_MAP_CLIENT(JoyDlg, OnAxis); static const char* joy_axis_names[] = { - "JoyDlg.axis.0", - "JoyDlg.axis.1", - "JoyDlg.axis.2", - "JoyDlg.axis.3", - "JoyDlg.axis.4", - "JoyDlg.axis.5", - "JoyDlg.axis.6", - "JoyDlg.axis.7" + "JoyDlg.axis.0", + "JoyDlg.axis.1", + "JoyDlg.axis.2", + "JoyDlg.axis.3", + "JoyDlg.axis.4", + "JoyDlg.axis.5", + "JoyDlg.axis.6", + "JoyDlg.axis.7" }; static int selected_axis = -1; @@ -51,10 +51,10 @@ static int map_axis[4]; // +--------------------------------------------------------------------+ JoyDlg::JoyDlg(Screen* s, FormDef& def, BaseScreen* mgr) - : FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr), - apply(0), cancel(0), message(0) +: FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr), +apply(0), cancel(0), message(0) { - Init(def); + Init(def); } JoyDlg::~JoyDlg() @@ -64,24 +64,24 @@ JoyDlg::~JoyDlg() void JoyDlg::RegisterControls() { - if (apply) - return; + if (apply) + return; - for (int i = 0; i < 4; i++) { - axis_button[i] = (Button*) FindControl(201 + i); - invert_checkbox[i] = (Button*) FindControl(301 + i); + for (int i = 0; i < 4; i++) { + axis_button[i] = (Button*) FindControl(201 + i); + invert_checkbox[i] = (Button*) FindControl(301 + i); - if (axis_button[i]) - REGISTER_CLIENT(EID_CLICK, axis_button[i], JoyDlg, OnAxis); - } + if (axis_button[i]) + REGISTER_CLIENT(EID_CLICK, axis_button[i], JoyDlg, OnAxis); + } - message = FindControl(11); + message = FindControl(11); - apply = (Button*) FindControl(1); - REGISTER_CLIENT(EID_CLICK, apply, JoyDlg, OnApply); + apply = (Button*) FindControl(1); + REGISTER_CLIENT(EID_CLICK, apply, JoyDlg, OnApply); - cancel = (Button*) FindControl(2); - REGISTER_CLIENT(EID_CLICK, cancel, JoyDlg, OnCancel); + cancel = (Button*) FindControl(2); + REGISTER_CLIENT(EID_CLICK, cancel, JoyDlg, OnCancel); } // +--------------------------------------------------------------------+ @@ -89,38 +89,38 @@ JoyDlg::RegisterControls() void JoyDlg::ExecFrame() { - if (selected_axis >= 0 && selected_axis < 4) { - Joystick* joystick = Joystick::GetInstance(); - if (joystick) { - joystick->Acquire(); + if (selected_axis >= 0 && selected_axis < 4) { + Joystick* joystick = Joystick::GetInstance(); + if (joystick) { + joystick->Acquire(); - int delta = 1000; + int delta = 1000; - for (int i = 0; i < 8; i++) { - int a = Joystick::ReadRawAxis(i + KEY_JOY_AXIS_X); + for (int i = 0; i < 8; i++) { + int a = Joystick::ReadRawAxis(i + KEY_JOY_AXIS_X); - int d = a - samples[i]; - if (d < 0) d = -d; + int d = a - samples[i]; + if (d < 0) d = -d; - if (d > delta && samples[i] < 1e6) { - delta = d; - sample_axis = i; - } + if (d > delta && samples[i] < 1e6) { + delta = d; + sample_axis = i; + } - samples[i] = a; - } + samples[i] = a; + } - Button* b = axis_button[selected_axis]; + Button* b = axis_button[selected_axis]; - if (sample_axis >= 0) { - b->SetText(Game::GetText(joy_axis_names[sample_axis])); - map_axis[selected_axis] = sample_axis; - } + if (sample_axis >= 0) { + b->SetText(Game::GetText(joy_axis_names[sample_axis])); + map_axis[selected_axis] = sample_axis; + } - else - b->SetText(Game::GetText("JoyDlg.select")); - } - } + else + b->SetText(Game::GetText("JoyDlg.select")); + } + } } // +--------------------------------------------------------------------+ @@ -128,29 +128,29 @@ JoyDlg::ExecFrame() void JoyDlg::Show() { - FormWindow::Show(); + FormWindow::Show(); - for (int i = 0; i < 4; i++) { - Button* b = axis_button[i]; - if (b) { - int map = Joystick::GetAxisMap(i) - KEY_JOY_AXIS_X; - int inv = Joystick::GetAxisInv(i); + for (int i = 0; i < 4; i++) { + Button* b = axis_button[i]; + if (b) { + int map = Joystick::GetAxisMap(i) - KEY_JOY_AXIS_X; + int inv = Joystick::GetAxisInv(i); - if (map >= 0 && map < 8) { - b->SetText(Game::GetText(joy_axis_names[map])); - map_axis[i] = map; - } - else { - b->SetText(Game::GetText("JoyDlg.unmapped")); - } + if (map >= 0 && map < 8) { + b->SetText(Game::GetText(joy_axis_names[map])); + map_axis[i] = map; + } + else { + b->SetText(Game::GetText("JoyDlg.unmapped")); + } - b->SetButtonState(0); + b->SetButtonState(0); - invert_checkbox[i]->SetButtonState(inv ? 1 : 0); - } - } + invert_checkbox[i]->SetButtonState(inv ? 1 : 0); + } + } - SetFocus(); + SetFocus(); } // +--------------------------------------------------------------------+ @@ -158,37 +158,37 @@ JoyDlg::Show() void JoyDlg::OnAxis(AWEvent* event) { - for (int i = 0; i < 4; i++) { - int map = map_axis[i]; - Text name = Game::GetText("JoyDlg.unmapped"); - Button* b = axis_button[i]; - - if (map >= 0 && map < 8) - name = Game::GetText(joy_axis_names[map]); - - if (b) { - if (b == event->window) { - if (selected_axis == i) { - b->SetText(name); - b->SetButtonState(0); - selected_axis = -1; - } - else { - b->SetText(Game::GetText("JoyDlg.select")); - b->SetButtonState(1); - selected_axis = i; - } - } - else { - b->SetText(name); - b->SetButtonState(0); - } - } - } - - for (int i = 0; i < 8; i++) { - samples[i] = 10000000; - } + for (int i = 0; i < 4; i++) { + int map = map_axis[i]; + Text name = Game::GetText("JoyDlg.unmapped"); + Button* b = axis_button[i]; + + if (map >= 0 && map < 8) + name = Game::GetText(joy_axis_names[map]); + + if (b) { + if (b == event->window) { + if (selected_axis == i) { + b->SetText(name); + b->SetButtonState(0); + selected_axis = -1; + } + else { + b->SetText(Game::GetText("JoyDlg.select")); + b->SetButtonState(1); + selected_axis = i; + } + } + else { + b->SetText(name); + b->SetButtonState(0); + } + } + } + + for (int i = 0; i < 8; i++) { + samples[i] = 10000000; + } } // +--------------------------------------------------------------------+ @@ -196,35 +196,35 @@ JoyDlg::OnAxis(AWEvent* event) void JoyDlg::OnApply(AWEvent* event) { - Starshatter* stars = Starshatter::GetInstance(); + Starshatter* stars = Starshatter::GetInstance(); - if (stars) { - KeyMap& keymap = stars->GetKeyMap(); + if (stars) { + KeyMap& keymap = stars->GetKeyMap(); - keymap.Bind(KEY_AXIS_YAW, map_axis[0]+KEY_JOY_AXIS_X, 0); - keymap.Bind(KEY_AXIS_PITCH, map_axis[1]+KEY_JOY_AXIS_X, 0); - keymap.Bind(KEY_AXIS_ROLL, map_axis[2]+KEY_JOY_AXIS_X, 0); - keymap.Bind(KEY_AXIS_THROTTLE, map_axis[3]+KEY_JOY_AXIS_X, 0); + keymap.Bind(KEY_AXIS_YAW, map_axis[0]+KEY_JOY_AXIS_X, 0); + keymap.Bind(KEY_AXIS_PITCH, map_axis[1]+KEY_JOY_AXIS_X, 0); + keymap.Bind(KEY_AXIS_ROLL, map_axis[2]+KEY_JOY_AXIS_X, 0); + keymap.Bind(KEY_AXIS_THROTTLE, map_axis[3]+KEY_JOY_AXIS_X, 0); - keymap.Bind(KEY_AXIS_YAW_INVERT, invert_checkbox[0]->GetButtonState(), 0); - keymap.Bind(KEY_AXIS_PITCH_INVERT, invert_checkbox[1]->GetButtonState(), 0); - keymap.Bind(KEY_AXIS_ROLL_INVERT, invert_checkbox[2]->GetButtonState(), 0); - keymap.Bind(KEY_AXIS_THROTTLE_INVERT, invert_checkbox[3]->GetButtonState(), 0); + keymap.Bind(KEY_AXIS_YAW_INVERT, invert_checkbox[0]->GetButtonState(), 0); + keymap.Bind(KEY_AXIS_PITCH_INVERT, invert_checkbox[1]->GetButtonState(), 0); + keymap.Bind(KEY_AXIS_ROLL_INVERT, invert_checkbox[2]->GetButtonState(), 0); + keymap.Bind(KEY_AXIS_THROTTLE_INVERT, invert_checkbox[3]->GetButtonState(), 0); - keymap.SaveKeyMap("key.cfg", 256); + keymap.SaveKeyMap("key.cfg", 256); - stars->MapKeys(); - } + stars->MapKeys(); + } - if (manager) - manager->ShowCtlDlg(); + if (manager) + manager->ShowCtlDlg(); } void JoyDlg::OnCancel(AWEvent* event) { - if (manager) - manager->ShowCtlDlg(); + if (manager) + manager->ShowCtlDlg(); } // +--------------------------------------------------------------------+ -- cgit v1.1