Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
FirstTimeDlg.cpp
Go to the documentation of this file.
1
/* Project Starshatter 4.5
2
Destroyer Studios LLC
3
Copyright © 1997-2004. All Rights Reserved.
4
5
SUBSYSTEM: Stars.exe
6
FILE: FirstTimeDlg.cpp
7
AUTHOR: John DiCamillo
8
9
10
OVERVIEW
11
========
12
Main Menu Dialog Active Window class
13
*/
14
15
#include "
MemDebug.h
"
16
#include "
FirstTimeDlg.h
"
17
#include "
Player.h
"
18
#include "
MenuScreen.h
"
19
#include "
Ship.h
"
20
#include "
Starshatter.h
"
21
#include "
KeyMap.h
"
22
#include "
Random.h
"
23
24
#include "
DataLoader.h
"
25
#include "
Button.h
"
26
#include "
EditBox.h
"
27
#include "
ComboBox.h
"
28
#include "
Video.h
"
29
#include "
Keyboard.h
"
30
#include "
MachineInfo.h
"
31
32
// +--------------------------------------------------------------------+
33
// DECLARE MAPPING FUNCTIONS:
34
35
DEF_MAP_CLIENT
(
FirstTimeDlg
, OnApply);
36
37
// +--------------------------------------------------------------------+
38
39
FirstTimeDlg::FirstTimeDlg
(
Screen
* s,
FormDef
& def,
MenuScreen
* mgr)
40
:
FormWindow
(s, 0, 0, s->Width(), s->Height()), manager(mgr)
41
{
42
Init
(def);
43
}
44
45
FirstTimeDlg::~FirstTimeDlg
()
46
{
47
}
48
49
// +--------------------------------------------------------------------+
50
51
void
52
FirstTimeDlg::RegisterControls
()
53
{
54
edt_name
= (
EditBox
*)
FindControl
(200);
55
cmb_playstyle
= (
ComboBox
*)
FindControl
(201);
56
cmb_experience
= (
ComboBox
*)
FindControl
(202);
57
58
btn_apply
= (
Button
*)
FindControl
(1);
59
REGISTER_CLIENT
(
EID_CLICK
,
btn_apply
,
FirstTimeDlg
,
OnApply
);
60
}
61
62
// +--------------------------------------------------------------------+
63
64
void
65
FirstTimeDlg::Show
()
66
{
67
if
(!
IsShown
())
68
FormWindow::Show
();
69
70
if
(
edt_name
)
71
edt_name
->
SetText
(
"Noobie"
);
72
}
73
74
// +--------------------------------------------------------------------+
75
76
void
77
FirstTimeDlg::ExecFrame
()
78
{
79
}
80
81
// +--------------------------------------------------------------------+
82
83
void
84
FirstTimeDlg::OnApply
(
AWEvent
* event)
85
{
86
Starshatter
* stars =
Starshatter::GetInstance
();
87
Player
* player =
Player::GetCurrentPlayer
();
88
89
if
(player) {
90
if
(
edt_name
) {
91
char
password[16];
92
sprintf_s(password,
"%08x"
, (DWORD)
Random
(0, 2e9));
93
94
player->
SetName
(
edt_name
->
GetText
());
95
player->
SetPassword
(password);
96
}
97
98
if
(
cmb_playstyle
) {
99
// ARCADE:
100
if
(
cmb_playstyle
->
GetSelectedIndex
() == 0) {
101
player->
SetFlightModel
(2);
102
player->
SetLandingModel
(1);
103
player->
SetHUDMode
(0);
104
player->
SetGunsight
(1);
105
106
if
(stars) {
107
KeyMap
& keymap = stars->
GetKeyMap
();
108
109
keymap.
Bind
(
KEY_CONTROL_MODEL
, 1, 0);
110
keymap.
SaveKeyMap
(
"key.cfg"
, 256);
111
112
stars->
MapKeys
();
113
}
114
115
Ship::SetControlModel
(1);
116
}
117
118
// HARDCORE:
119
else
{
120
player->
SetFlightModel
(0);
121
player->
SetLandingModel
(0);
122
player->
SetHUDMode
(0);
123
player->
SetGunsight
(0);
124
125
if
(stars) {
126
KeyMap
& keymap = stars->
GetKeyMap
();
127
128
keymap.
Bind
(
KEY_CONTROL_MODEL
, 0, 0);
129
keymap.
SaveKeyMap
(
"key.cfg"
, 256);
130
131
stars->
MapKeys
();
132
}
133
134
Ship::SetControlModel
(0);
135
}
136
}
137
138
if
(
cmb_experience
&&
cmb_experience
->
GetSelectedIndex
() > 0) {
139
player->
SetRank
(2);
// Lieutenant
140
player->
SetTrained
(255);
// Fully Trained
141
}
142
143
Player::Save
();
144
}
145
146
manager
->
ShowMenuDlg
();
147
}
Stars45
FirstTimeDlg.cpp
Generated on Tue Jun 5 2012 20:46:53 for Starshatter_Open by
1.8.1