1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
|
using TimeHACK.Properties;
using System;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using TimeHACK.OS.Win95;
using TimeHACK.OS.Win98;
using TimeHACK.Engine;
using static TimeHACK.Engine.SaveSystem;
using TimeHACK.SaveDialogs;
namespace TimeHACK
{
public partial class TitleScreen : Form
{
public static System.Drawing.Text.PrivateFontCollection pfc = new System.Drawing.Text.PrivateFontCollection();
public static Windows95 frm95;
public static Windows98 frm98;
public static string username;
public static string progress = "95";
public static DirectoryInfo thfolder;
public static DirectoryInfo datafolder;
public static DirectoryInfo profilefolder;
public static NewGameDialog newGameBox;
public static LoadGameDialog loadGameBox;
public void StartGame()
{
//TODO: You may want to handle story stuff to decide what OS to boot here.
if (Convert.ToInt32(VM_Width.Text) == 1337 && Convert.ToInt32(VM_Height.Text) == 1337)
{
leet();
}
else {
// Time to decide which OS to start up!
switch (CurrentSave.CurrentOS)
{
case "95":
frm95 = new Windows95();
frm95.TopMost = true;
frm95.FormBorderStyle = FormBorderStyle.None;
frm95.WindowState = FormWindowState.Maximized;
//if (vm_mode.Checked == true)
//{
// frm95.Size = new Size(Convert.ToInt32(VM_Width.Text), Convert.ToInt32(VM_Height.Text));
// frm95.FormBorderStyle = FormBorderStyle.Fixed3D;
//}
frm95.Show();
Hide();
break;
case "98":
frm98 = new Windows98();
frm98.TopMost = true;
frm98.FormBorderStyle = FormBorderStyle.None;
frm98.WindowState = FormWindowState.Maximized;
if (vm_mode.Checked == true)
{
frm98.Size = new Size(Convert.ToInt32(VM_Width.Text), Convert.ToInt32(VM_Height.Text));
frm98.FormBorderStyle = FormBorderStyle.Fixed3D;
}
frm98.Show();
Hide();
break;
default:
MessageBox.Show("WARNING! It looks like this save is corrupt!");
MessageBox.Show("We will now open the Save troubleshooter");
SaveFileTroubleShooter troubleshooter = new SaveFileTroubleShooter();
troubleshooter.ShowDialog();
break;
}
}
}
public TitleScreen()
{
InitializeComponent();
}
private void closebutton_Click(object sender, EventArgs e)
{
Close();
}
private void VM_WidthHeight_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) &&
(e.KeyChar != '.'))
{
e.Handled = true;
}
// only allow one decimal point
if ((e.KeyChar == '.') && ((sender as TextBox).Text.IndexOf('.') > -1))
{
e.Handled = true;
}
}
// When the TitleScreen Loads
private void TitleScreen_Load(object sender, EventArgs e)
{
if (!Directory.Exists(GameDirectory))
Directory.CreateDirectory(GameDirectory);
thfolder = new DirectoryInfo(GameDirectory);
string Data = Path.Combine(thfolder.FullName, "Data");
if (!Directory.Exists(Data))
Directory.CreateDirectory(Data);
string Profiles = Path.Combine(thfolder.FullName, "Profiles");
if (!Directory.Exists(Profiles))
Directory.CreateDirectory(Profiles);
Resources.google.Save(Path.Combine(Data, "google.jpg"));
profilefolder = Directory.CreateDirectory(Path.Combine(thfolder.FullName, "\\Profiles"));
// Set GameVersion
gameversion.Text = "TimeHACK " + Program.gameID;
// Initialize Font
File.WriteAllBytes(Data + "\\LeviWindows.ttf", Resources.LeviWindows);
File.WriteAllBytes(Data + "\\windows_command_prompt.ttf", Resources.windows_command_prompt);
pfc.AddFontFile(Data + "\\LeviWindows.ttf");
pfc.AddFontFile(Data + "\\windows_command_prompt.ttf");
gameversion.Font = new Font(pfc.Families[0], 16F, FontStyle.Bold, GraphicsUnit.Point, (0));
// Start the VM Mode timer
vmModeTimer.Start();
}
private static void leet()
{
WindowManager wm = new WindowManager();
UserControl leet = new UserControl();
leet.Width = 500;
leet.Height = 500;
Label label1 = new Label();
label1.Parent = leet;
label1.AutoSize = true;
label1.Text = "Thank you for making TimeHACK possible.";
wm.startWin95(leet, "Thank You", null, true, true);
}
// The VM Mode timer / checker. Updates every 100ms
private void vmModeTimer_Tick(object sender, EventArgs e)
{
// Check for VM mode
if (vm_mode.Checked == true)
{
VM_Width.Visible = true;
VM_Height.Visible = true;
}
// If VM Mode is disabled
else
{
VM_Width.Visible = false;
VM_Height.Visible = false;
}
}
#region Menu Buttons
#region NewGame
// When NewGame is Clicked
private void NewGame_Click(object sender, EventArgs e)
{
newGameBox = new NewGameDialog();
newGameBox.ShowDialog();
if (newGameBox.Successful == true)
{
NewGame();
StartGame();
}
}
public void BSODRewind(object sender, EventArgs e)
{
if (progress == "95")
{
frm95.Close();
frm95 = null;
try
{
// Time to close all the game applications
foreach (Form frm in Application.OpenForms)
{
if (frm.Tag.ToString() != "ignoreFormOnTaskbar")
{
frm.Close();
}
}
} catch {
}
// If VM Mode is not enabled
if (vm_mode.Checked != true)
{
// Generate fullscreen desktop
frm95 = new Windows95();
frm95.TopMost = true;
frm95.FormBorderStyle = FormBorderStyle.None;
frm95.WindowState = FormWindowState.Maximized;
frm95.Show();
Hide();
}
// If VM Mode is enabled
else
{
// Generate desktop with size entered by user
frm95 = new Windows95();
frm95.FormBorderStyle = FormBorderStyle.None;
frm95.Size = new Size(Convert.ToInt32(VM_Width.Text), Convert.ToInt32(VM_Height.Text));
frm95.FormBorderStyle = FormBorderStyle.Fixed3D;
frm95.Show();
Hide();
}
}
}
private void NewGame_MouseEnter(object sender, EventArgs e)
{
NewGame.Image = Resources.MSNewGame;
}
private void NewGame_MouseLeave(object sender, EventArgs e)
{
NewGame.Image = Resources.NewGame;
}
#endregion
#region LoadGame
private void LoadGame_Click(object sender, EventArgs e)
{
loadGameBox = new LoadGameDialog();
loadGameBox.ShowDialog();
//var result = LoadSave();
//if(result == false)
//{
// MessageBox.Show(caption: "No save found.", text: "No save was found on your system. However, we have created a new one, and we will start it up for you.");
//}
if (loadGameBox.successful == true)
{
LoadSave();
StartGame();
}
}
private void LoadGame_Enter(object sender, EventArgs e)
{
LoadGame.Image = Resources.MSLoadGame;
}
private void LoadGame_Leave(object sender, EventArgs e)
{
LoadGame.Image = Resources.LoadGame;
}
#endregion
#region ExitButton
private void Exit_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void Exit_Enter(object sender, EventArgs e)
{
Exit.Image = Resources.MSExit;
}
private void Exit_Leave(object sender, EventArgs e)
{
Exit.Image = Resources.Exit;
}
#endregion
#endregion
private void gameversion_MouseHover(object sender, EventArgs e)
{
gameversion.Text = "There are no easter eggs here!";
}
private void gameversion_MouseLeave(object sender, EventArgs e)
{
gameversion.Text = "TimeHACK " + Program.gameID;
}
private void startbutton_Click(object sender, EventArgs e)
{
if (DevMode == true)
{
DevMode = false;
gameversion.Text = "Developer Mode Deactivated";
} else {
DevMode = true;
gameversion.Text = "Developer Mode Activated";
}
}
}
}
|