diff options
author | Aki <please@ignore.pl> | 2022-04-01 21:23:39 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-01 21:23:39 +0200 |
commit | 3c487c5cd69c53d6fea948643c0a76df03516605 (patch) | |
tree | 72730c7b8b26a5ef8fc9a987ec4c16129efd5aac /Stars45/FirstTimeDlg.cpp | |
parent | 8f353abd0bfe18baddd8a8250ab7c4f2d1c83a6e (diff) | |
download | starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.zip starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.gz starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.bz2 |
Moved Stars45 to StarsEx
Diffstat (limited to 'Stars45/FirstTimeDlg.cpp')
-rw-r--r-- | Stars45/FirstTimeDlg.cpp | 145 |
1 files changed, 0 insertions, 145 deletions
diff --git a/Stars45/FirstTimeDlg.cpp b/Stars45/FirstTimeDlg.cpp deleted file mode 100644 index 4376243..0000000 --- a/Stars45/FirstTimeDlg.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* Starshatter: The Open Source Project - Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors - Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors - Copyright (c) 1997-2006, Destroyer Studios LLC. - - AUTHOR: John DiCamillo - - - OVERVIEW - ======== - Main Menu Dialog Active Window class -*/ - -#include "FirstTimeDlg.h" -#include "Player.h" -#include "MenuScreen.h" -#include "Ship.h" -#include "Starshatter.h" -#include "KeyMap.h" -#include "Random.h" - -#include "DataLoader.h" -#include "Button.h" -#include "EditBox.h" -#include "ComboBox.h" -#include "Video.h" -#include "Keyboard.h" -#include "MachineInfo.h" - -// +--------------------------------------------------------------------+ -// DECLARE MAPPING FUNCTIONS: - -DEF_MAP_CLIENT(FirstTimeDlg, OnApply); - -// +--------------------------------------------------------------------+ - -FirstTimeDlg::FirstTimeDlg(Screen* s, FormDef& def, MenuScreen* mgr) -: FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr) -{ - Init(def); -} - -FirstTimeDlg::~FirstTimeDlg() -{ -} - -// +--------------------------------------------------------------------+ - -void -FirstTimeDlg::RegisterControls() -{ - edt_name = (EditBox*) FindControl(200); - cmb_playstyle = (ComboBox*) FindControl(201); - cmb_experience = (ComboBox*) FindControl(202); - - btn_apply = (Button*) FindControl(1); - REGISTER_CLIENT(EID_CLICK, btn_apply, FirstTimeDlg, OnApply); -} - -// +--------------------------------------------------------------------+ - -void -FirstTimeDlg::Show() -{ - if (!IsShown()) - FormWindow::Show(); - - if (edt_name) - edt_name->SetText("Noobie"); -} - -// +--------------------------------------------------------------------+ - -void -FirstTimeDlg::ExecFrame() -{ -} - -// +--------------------------------------------------------------------+ - -void -FirstTimeDlg::OnApply(AWEvent* event) -{ - Starshatter* stars = Starshatter::GetInstance(); - Player* player = Player::GetCurrentPlayer(); - - if (player) { - if (edt_name) { - char password[16]; - sprintf_s(password, "%08x", (DWORD) Random(0, 2e9)); - - player->SetName(edt_name->GetText()); - player->SetPassword(password); - } - - if (cmb_playstyle) { - // ARCADE: - if (cmb_playstyle->GetSelectedIndex() == 0) { - player->SetFlightModel(2); - player->SetLandingModel(1); - player->SetHUDMode(0); - player->SetGunsight(1); - - if (stars) { - KeyMap& keymap = stars->GetKeyMap(); - - keymap.Bind(KEY_CONTROL_MODEL, 1, 0); - keymap.SaveKeyMap("key.cfg", 256); - - stars->MapKeys(); - } - - Ship::SetControlModel(1); - } - - // HARDCORE: - else { - player->SetFlightModel(0); - player->SetLandingModel(0); - player->SetHUDMode(0); - player->SetGunsight(0); - - if (stars) { - KeyMap& keymap = stars->GetKeyMap(); - - keymap.Bind(KEY_CONTROL_MODEL, 0, 0); - keymap.SaveKeyMap("key.cfg", 256); - - stars->MapKeys(); - } - - Ship::SetControlModel(0); - } - } - - if (cmb_experience && cmb_experience->GetSelectedIndex() > 0) { - player->SetRank(2); // Lieutenant - player->SetTrained(255); // Fully Trained - } - - Player::Save(); - } - - manager->ShowMenuDlg(); -} |