-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathindex.html
More file actions
6852 lines (5400 loc) · 190 KB
/
index.html
File metadata and controls
6852 lines (5400 loc) · 190 KB
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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Герои мата и меха</title>
<style type="text/css">
body { background: black; font: 12pt 'lucida console','menlo',monospace; line-height: 11px; }
div#bug { width: 70px; height: 40px; position: absolute; top: 0px; right: 0px; background: #c0c0c0; padding: 10px; font: 8pt 'tahoma',sans-serif; }
#screen { border-collapse: collapse; }
#screen td { width: 10px; height: 16px; text-align: center; vertical-align: middle; padding: 0px; border: 0px; }
.bg0 {background: #000}
.bg1 {background: #000080}
.bg2 {background: #008000}
.bg3 {background: #008080}
.bg4 {background: #800000}
.bg5 {background: #800080}
.bg6 {background: #808000}
.bg7 {background: #C0C0C0}
.fg0 {color: #000}
.fg1 {color: #000080}
.fg2 {color: #008000}
.fg3 {color: #008080}
.fg4 {color: #800000}
.fg5 {color: #800080}
.fg6 {color: #808000}
.fg7 {color: #C0C0C0}
.fg8 {color: #404040}
.fg9 {color: #00f}
.fg10 {color: #0f0}
.fg11 {color: #0ff}
.fg12 {color: #f00}
.fg13 {color: #f0f}
.fg14 {color: #ff0}
.fg15 {color: #fff}
</style>
<script type="text/javascript" src="https://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
var SERVERLESS = true;
//'use strict';
var local_user_name = '';
function get_user_name()
{
if (local_user_name === '' &&
window.localStorage &&
window.localStorage.nick) {
local_user_name = window.localStorage.nick;
}
return local_user_name;
}
function set_user_name(name)
{
local_user_name = name;
if (window.localStorage) {
window.localStorage.nick = name;
}
}
function send_replay(vars)
{
if (!Replay.is_on() && !SERVERLESS) {
if (vars === undefined) {
vars = {};
}
vars.data = JSON.stringify(Replay.data);
vars.day = day_of_week;
$.ajax({url: 'server.php',
type: 'post',
data: {api: 'put', nick: get_user_name(), data: vars},
success: function(data) {
//alert(data);
},
error: function(e) {
alyarme(e);
}
});
}
}
function get_top()
{
if (!Replay.is_on() && !SERVERLESS) {
$.ajax({url: 'server.php',
data: {api: 'get', nick: get_user_name()},
success: function(data) {
//alert(data);
top_gamers = JSON.parse(data);
},
error: function(e) {
alyarme(e);
}
});
}
}
/* 0xC8, size 0x44; offsets: [6]
0 0x0C8 subject_professor_names
0x11 0x0D9 subject_titles
0x32 0x0FA
0x34 0x0FC
0x36 0x0FE subject_tasks
0x38 0x100
0x3A 0x102 subject_exam_days
0x3C 0x104 subject_exam_min_time
0x3E 0x106 subject_exam_max_time
0x40 0x108 subject_exam_places
0x43 0x10B subject_professor_sex 1=male
*/
var subjects = [];
/* 0x478, sizes 0x1E, 5; offsets: [6][6]
0 0x478 from
2 0x47A to
4 0x47C where
*/
var timesheet = [];
/*
{sasha_has: 1, hero_has: 0} [3]
[i + 0x52E] // is_sasha_has_synopsis
[i + 0x55C] // synopsis_presences
*/
var synopsis = [];
/*
[i * 2 + 0x532] // subject_tasks_done
[i * 2 + 0x544] // subject_pass_day
[i * 2 + 0x550] // subject_knowledges
[i + 0x53E] // byte exam_passed [6]
*/
var hero = {
subject: [],
garlic: 0, // 25498
has_mmheroes_disk: 0, // 2549B
has_inet: 0, // 2549E
is_invited: 0, // 25496
inception: 0, // 254A0
is_working_in_terkom: 0,
got_stipend: 0,
has_ticket: 0,
knows_djug: 0,
brain: 0,
stamina: 0,
charizma: 0,
health: 0,
exams_left: 6
};
/*
0x6A4, size 0x54, offsets: {str:, num:, color:} [16]
0 string
0x51 number
0x53 color
*/
var dialog = [undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined];
/*
0x3B2, size 0x23, offsets: [5]
0 0x3B2 name
0x21 0x3D3 score
*/
var top_gamers = [];
/*
0x676, size 3, offsets: [12]
0 0x676 current_subject
2 0x678 place
0x32C, size 2
0x344, size 2
*/
var classmates = [];
var terkom_has_places; // 2549D
var klimov_timesheet_was_modified; // 25494
/*
not known vars, seems not affects gameplay
word_2559A
word_256CE
word_256D0
asc_256D2
byte_2549F
byte_254A4
*/
var word_2559A, word_256CE, word_256D0, asc_256D2, byte_2549F, byte_254A4;
function _init_vars()
{
var init_subjects = function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11) {
subjects.push({professor: {name: a1, sex: a11}, title: a2, exam_days: a7, exam_min_time: a8, exam_max_time: a9, exam_places: a10, tasks: a5, member0xFA: a3, member0xFC: a4, member0x100: a6});
};
subjects = [];
init_subjects('Всемирнов М.А.', 'Алгебра и Т.Ч.', 0xA, 0x11, 0xC, 3, 4, 2, 4, [1,1,2], 1);
init_subjects('Дубцов Е.С.', 'Мат. Анализ', 8, 0xE, 0xA, 2, 4, 2, 3, [1,1,1], 1);
init_subjects('Подкорытов С.С.', 'Геометрия и Топология', 4, 8, 3, 3, 2, 1, 3, [1,2,2], 1);
init_subjects('Климов А.А.', 'Информатика', 5, 6, 2, 3, 2, 1, 2, [3,3,3], 1);
init_subjects('Влащенко Н.П.', 'English', 7, 0xA, 3, 1, 2, 2, 2, [1,1,1], 0);
init_subjects('Альбинский Е.Г.', 'Физ-ра', 7, 0x14, 1, 1, 2, 1, 1, [1,1,1], 1);
timesheet = [];
for (var i = 0; i < 6; ++i) {
timesheet.push([]);
for (var j = 0; j < 6; ++j) {
timesheet[i].push({from: 0, to: 0, where: 0});
}
}
synopsis = [];
for (var i = 0; i < 3; ++i) {
synopsis.push({sasha_has: 1, hero_has: 0});
}
hero.subject = [];
for (var i = 0; i < 6; ++i) {
hero.subject.push({knowledge: 0, passed: 0, pass_day: -1, tasks_done: 0});
}
/*top_gamers = [];
for (var i = 0; i < 5; ++i) {
top_gamers.push({name: '', score: 0});
}*/
classmates = [];
for (var i = 0; i < 12; ++i) {
classmates.push({current_subject: -1, place: 0,
member0x32C: [0,0,0, 4, 2, 0,0, 6, 0,0,0,0][i],
member0x344: [0,0,0, 8, 0, 0,0, 8, 0,0,0,0][i]
});
}
}
// [i * 0x11 + 2] // four_letters_places
var places = [{title: '----'}, {title: 'ПУНК '}, {title: 'ПОМИ '}, {title: 'Компы'}, {title: 'Общага'}, {title: 'Мавзолей'}];
// 0x74, size 7
var days = ['22.5','23.5','24.5','25.5','26.5','27.5'];
// 0x260, size 0x11
var classmate_names = ['Коля','Паша','Diamond','RAI','Миша','Серж','Саша','NiL','Кузьменко В.Г.','DJuG','Эндрю','Гриша'];
var Kolya = 0, Pasha = 1, Diamond = 2, Rai = 3, Misha = 4, Serzg = 5, Sasha = 6, Nil = 7, Kuzmenko = 8, Djug = 9, Endryu = 10, Grisha = 11;
// 0x9E, size 7
var subject_short_titles = ['АиТЧ','МатАн','ГиТ','Инф','ИнЯз','Физ-ра'];
var dialog_case_count;
var current_color;
var is_end;
var is_god_mode, is_god_mode_available;
var time_of_day, day_of_week, current_place, death_cause;
var current_subject;
var last_subject;
var Algebra = 0, Matan = 1, GiT = 2, Infa = 3, English = 4, Fizra = 5;
// My little and buggy implementation of utilities like STL
function _upper_bound(cont, val)
{
for (var i = 0; i < cont.length; ++i) {
if (cont[i] > val) {
return i;
}
}
return cont.length;
}
// My little and buggy implementation of pascal
var Screen = [];
var ScreenColor = [];
var PositionR = 0, PositionC = 0;
//var Key = -1;
function idiv(x, y) { return Math.floor(x / y); }
function WhereY() { return PositionR; }
function Randomize() {}
function ParamCount() { return 0; }
function ParamStr(num) { return ''; }
function __CrtInit()
{
for (var i = 0; i < 25; ++i) {
Screen.push([]);
ScreenColor.push([]);
for (var j = 0; j < 80; ++j) {
Screen[i].push(' ');
ScreenColor[i].push(0x07);
}
}
}
function TextColor(col) { current_color = current_color & 0xF0 | col; }
function Delay(pause) { /*var start = new Date().getTime(); while (new Date().getTime - start < pause);*/ }
function alyarme(str)
{
var d = Replay.data;
//d.rnds_stack = [];
alert(str + '\r\n\r\n' + get_stack() + '\r\n\r\n' + JSON.stringify(d));
}
function get_stack()
{
try {
throw Error();
} catch (e) {
return e.stack;
}
}
function get_stack_before(func)
{
var s = get_stack().split('\n');
//console.dir(s);
for (var i = s.length - 1; i >= 0; --i) {
if (s[i].indexOf(func) != -1) {
return s[i + 1];
}
}
}
var first_run = true;
var Replay = {
data: {
on: 0,
rnds: [], rnds_up: [], rnds_stack: [], rnds_i: 0,
keys: [], keys_count: 0, keys_i: 0,
dialogs: [], dialogs_i: 0,
strs: [], strs_i: 0,
clrscr_count: 0, clrscr_i: 0,
start: false, end: false,
wait_for_dialog: false
},
is_on: function() { return this.data.on; },
is_start: function() { return this.data.start; },
is_end: function() { return this.data.end; },
start: function() { this.data.start = true; this.data.end = false; },
stop: function() { this.data.start = false; this.data.end = true; },
check_last_cls: function() { ++this.data.clrscr_i; return this.data.clrscr_i >= this.data.clrscr_count; },
record_cls: function() { ++this.data.clrscr_count; },
can_skip_output: function() { return this.data.on && this.data.clrscr_i < this.data.clrscr_count; },
next_rnd: function() { return this.data.rnds[this.data.rnds_i++]; },
record_rnd: function(res, up) { this.data.rnds.push(res); this.data.rnds_up.push(up); /*this.data.rnds_stack.push(get_stack());*/ },
next_key: function() {
//console.log('next_key');
var result = this.data.keys_i >= this.data.keys_count - this.data.keys.length ?
this.data.keys[this.data.keys_i - (this.data.keys_count - this.data.keys.length)] :
32;
++this.data.keys_i;
return result;
},
record_key: function(res) {
//console.log('record_key');
if (this.data.wait_for_dialog) {
this.data.keys.push(res);
}
++this.data.keys_count;
},
next_dialog: function() { return this.data.dialogs[this.data.dialogs_i++]; },
record_dialog: function(res) {
this.data.keys_count -= this.data.keys.length;
this.data.keys = [];
this.data.dialogs.push(res);
},
wait_dialog: function(arg) { this.data.wait_for_dialog = arg; },
next_string: function() { return this.data.strs[this.data.strs_i++]; },
record_string: function(res) { this.data.strs.push(res); },
keys_remains: function() {
return this.data.keys_i < this.data.keys_count;
},
dialogs_remains: function() {
return this.data.dialogs_i < this.data.dialogs.length;
},
strs_remains: function() {
return this.data.strs_i < this.data.strs.length;
},
last: function() {
return !this.keys_remains() && !this.dialogs_remains() && !this.strs_remains();
},
turn_off: function() {
this.data.on = 0; this.data.rnds_i = 0; this.data.keys_i = 0; this.data.dialogs_i = 0; this.data.strs_i = 0; this.data.clrscr_i = 0;
//console.log('replay now off');
},
turn_on: function() {
this.data.on = 1; this.data.rnds_i = 0; this.data.keys_i = 0; this.data.dialogs_i = 0; this.data.strs_i = 0; this.data.clrscr_i = 0;
//console.log('replay now ON');
},
restart: function() {
//console.log('Replay.restart');
this.data.on = 0;
this.data.rnds = []; this.data.rnds_up = []; this.data.rnds_stack = []; this.data.rnds_i = 0;
this.data.keys = []; this.data.keys_count = 0; this.data.keys_i = 0;
this.data.dialogs = []; this.data.dialogs_i = 0;
this.data.strs = []; this.data.strs_i = 0;
this.data.clrscr_count = this.data.clrscr_i = 0;
this.data.wait_for_dialog = false;
}
};
function _update_key(code)
{
if (Replay.is_on() && Replay.is_start()) {
Replay.record_key(code);
if (!Replay.is_end()) {
Main();
}
}
}
function ClrScr()
{
PositionC = 0;
PositionR = 0;
if (Replay.is_on()) {
if (!Replay.check_last_cls()) {
return;
}
} else {
Replay.record_cls();
}
for (var i = 0; i < 25; ++i) {
for (var j = 0; j < 80; ++j) {
Screen[i][j] = ' ';
ScreenColor[i][j] = 0x07;
}
}
}
function _update_screen()
{
var html = '';
html += '<table id="screen">';
for (var i = 0; i < 25; ++i) {
html += '<tr>';
for (var j = 0; j < 80; ++j) {
html += '<td class="fg' + (ScreenColor[i][j] & 0xF) + ' bg' + (ScreenColor[i][j] >> 4) + '">' +
Screen[i][j] + '</td>';
}
html += '</tr>';
}
html += '</table>';
document.getElementById('content').innerHTML = html;
}
function write(str)
{
if (Replay.can_skip_output() || str === undefined) {
return;
}
if (PositionR >= 25) {
alyarme('write at pos ' + PositionR + ',' + PositionC);
}
str = '' + str;
for (var i = 0; i < str.length; ++i) {
Screen[PositionR][PositionC] = str.charAt(i);
ScreenColor[PositionR][PositionC] = current_color;
++PositionC;
}
//_update_screen();
}
function Random(up)
{
if (Replay.is_on()) {
var rec_up = Replay.data.rnds_up[Replay.data.rnds_i];
//var rec_stack = Replay.data.rnds_stack[Replay.data.rnds_i];
//var real_stack = get_stack();
//rec_stack = rec_stack.split('\r\n').slice(4).join('\r\n');
//real_stack = real_stack.split('\r\n').slice(3).join('\r\n');
//if (rec_stack != real_stack) {
// alert(rec_stack + '\r\n\r\n' + real_stack);
// throw 42;
//}
//console.log('replay ' + Replay.data.rnds_i + ', hero.health = ' + hero.health + '; from ' + get_stack_before('Random'));
var res = Replay.next_rnd();
if (rec_up != up || up && res >= up || !up && res > 0) {
alyarme('Replay: Random(' + up + ') = rnds[' + (Replay.data.rnds_i - 1) + '] = ' + res + ', rec_up = ' + rec_up /*+ ', rec_stack = ' + rec_stack*/);
}
return res;
} else {
var res = Math.floor(Math.random() * up);
if (up && res >= up || !up && res > 0) {
alyarme('Random(' + up + ') = ' + res);
}
//if (Replay.data.rnds.length == 78) {
// alyarme('78th');
//}
//console.log('record ' + Replay.data.rnds.length + ' num ' + res + ', up ' + up + ', hero.health = ' + hero.health/* + '; from ' + get_stack_before('Random')*/);
Replay.record_rnd(res, up);
return res;
}
}
function ReadKey_on()
{
// Возвращаем последний нажатый кей, в следующий раз снова придется прерываться
var result = false;
if (Replay.keys_remains()) {
result = Replay.next_key();
}
if (Replay.last()) {
Replay.turn_off();
}
//if (result !== false) {
return result;
//}
}
function ReadKey_off()
{
// Апдейтим экран только когда уходим в режим ожидания
_update_screen();
// Когда в следующий раз вызовется Main, он будет работать в режиме реплея, пока не кончатся клавиши
Replay.turn_on();
throw 42;
}
function ReadKey()
{
if (Replay.is_on()) {
var result = ReadKey_on();
if (result !== false) {
return result;
}
}
ReadKey_off();
}
function readln()
{
if (Replay.is_on()) {
var res = false;
if (Replay.strs_remains()) {
var res = Replay.next_string();
}
if (Replay.last()) {
Replay.turn_off();
}
if (res !== false) {
return res;
}
}
_update_screen();
var res = prompt('Enter string:', get_user_name());
if (res === null) { res = ''; }
Replay.record_string(res);
return res;
}
function dialog_run(x, y)
{
if (Replay.is_on()) {
var result = false;
if (Replay.dialogs_remains()) {
result = Replay.next_dialog();
}
if (Replay.last()) {
Replay.turn_off();
}
if (result !== false) {
return result;
}
}
Replay.wait_dialog(true);
var current_selection = 0;
dialog_show(x, y);
//console.log(dialog);
//console.log(dialog_case_count);
while (1) {
current_color = 0x70;
GotoXY(x, y + current_selection);
write(dialog[current_selection].str);
var key = ReadKey();
//console.log('dialog_run rcvd ' + key);
current_color = dialog[current_selection].color;
GotoXY(x, y + current_selection);
write(dialog[current_selection].str);
if (key == 0x0D) {
current_color = 7;
var result = dialog[current_selection].num;
Replay.record_dialog(result);
Replay.wait_dialog(false);
return result;
} else if (key == 38) { // up
if (current_selection == 0) {
current_selection = dialog_case_count - 1;
} else {
--current_selection;
}
} else if (key == 40) { // down
if (current_selection == dialog_case_count - 1) {
current_selection = 0;
} else {
++current_selection;
}
}
}
} // end function 20B87
function Main()
{
Replay.start();
try {
PROGRAM();
} catch (e) {
if (e != 42) {
console.dir(e);
alert(e + '\r\n' + e.stack);
}
return;
}
Replay.stop();
}
var _color = [
'#000', '#000080', '#008000', '#008080', '#800000', '#800080', '#808000', '#C0C0C0',
'#404040', '#00f', '#0f0', '#0ff', '#f00', '#f0f', '#ff0', '#fff'
];
function _color_to_html_fg(col)
{
return _color[col & 0xF];
}
function _color_to_html_bg(col)
{
return _color[col >> 4];
}
function _crlf() { ++PositionR; PositionC = 0; }
function writeln(str)
{
if (str != undefined) write(str);
_crlf();
}
function GotoXY(x, y) { PositionR = y - 1; PositionC = x - 1; }
function Assign(f, file) {}
function Reset(f, mode) {}
function Rewrite(f, mode) {}
function IOResult() { return 1; }
function Read(f) {}
function Close(f) {}
function Sqrt(x) { return Math.sqrt(x); }
function Trunc(x) { return Math.floor(x); }
function Round(x) { return Math.round(x); }
function jz(a, b) { return a == b; }
function jnz(a, b) { return a != b; }
function jl(a, b) { return a < b; }
function jle(a, b) { return a <= b; }
function jg(a, b) { return a > b; }
function jge(a, b) { return a >= b; }
function jb(a, b) { return a < b; }
function jnb(a, b) { return a >= b; }
function jbe(a, b) { return a <= b; }
function ja(a, b) { return a > b; }
function jna(a, b) { return a <= b; }
function jae(a, b) { return a >= b; }
// from dseg
var aGamma3_14 = 'gamma3.14';
var aXocesPoprobova = 'Хочешь попробовать еще?';
var aDaDaDa = 'ДА!!! ДА!!! ДА!!!';
var aNet___Net___Ne = 'Нет... Нет... Не-э-эт...';
function prompt_for_new_game()
{
ClrScr();
writeln(aXocesPoprobova);
dialog_start();
dialog_case(aDaDaDa, -1);
dialog_case(aNet___Net___Ne, -2);
var result = dialog_run(1, 4) == -2;
ClrScr();
return result;
}
var a3decHappyBirth = '-3dec-happy-birthday-Diamond';
function PROGRAM()
{
_init_vars();
__CrtInit();
dialog_case_count = 0;
Randomize();
if (ParamCount() > 0 && ParamStr(1) == a3decHappyBirth) {
is_god_mode_available = 1;
}
do {
if (!Replay.is_on()) {
read_top_gamers();
Replay.restart();
}
//_init_vars();
if (first_run) {
show_intro_screen();
first_run = false;
}
init_game();
show_dzin_and_timesheet();
do {
scene_router();
check_exams_left_count();
} while (is_end == 0);
game_end();
} while (prompt_for_new_game() == 0);
show_disclaimer();
write_top_gamers();
}
var aDzin = 'ДЗИНЬ!';
var aDddzzzzziiiiii = 'ДДДЗЗЗЗЗИИИИИИННННННЬ !!!!';
var aDdddddzzzzzzzz = 'ДДДДДДЗЗЗЗЗЗЗЗЗЗЗЗЗИИИИИИИИИИННННННННННННЬ !!!!!!!!!!';
var aTiProsipaesSqO = 'Ты просыпаешься от звонка будильника ';
var aGoMaqV800_ = '-го мая в 8:00. ';
var aNeojidannoTiOs = 'Неожиданно ты осознаешь, что началась зачетная неделя,';
var aATvoqGotovnost = 'а твоя готовность к этому моменту практически равна нулю.';
var aNatqgivaqNaSeb = 'Натягивая на себя скромное одеяние студента,';
var aTiVsmatrivaesS = 'ты всматриваешься в заботливо оставленное соседом на стене';
var aRaspisanieKogd = 'расписание: когда и где можно найти искомого препода ?';
function show_dzin_and_timesheet()
{
ClrScr();
TextColor(0x0A);
writeln(aDzin);
Delay(0x1F4);
TextColor(0x0E);
writeln(aDddzzzzziiiiii);
Delay(0x2BC);
TextColor(0x0C);
writeln(aDdddddzzzzzzzz);
Delay(0x3E8);
TextColor(7);
write(aTiProsipaesSqO);
write(0x16);
writeln(aGoMaqV800_);
writeln(aNeojidannoTiOs);
writeln(aATvoqGotovnost);
writeln(aNatqgivaqNaSeb);
writeln(aTiVsmatrivaesS);
writeln(aRaspisanieKogd);
wait_for_key();
ClrScr();
show_timesheet();
wait_for_key();
ClrScr();
} // end function 102EF
var aNowhere_at_tur = 'nowhere_at_turn';
function scene_router()
{
if (current_place == 2) {
if (current_subject != -1) {
scene_exam();
} else {
scene_pomi();
}
} else if (current_place == 1) {
if (current_subject != -1) {
scene_exam();
} else {
scene_punk();
}
} else if (current_place == 5) {
scene_mausoleum();
} else if (current_place == 4) {
scene_obschaga();
} else if (current_place == 3) {
if (current_subject != -1) {
scene_exam();
} else {
scene_kompy();
}
} else if (current_place == 0) {
bug_report(aNowhere_at_tur);
}
} // end function 10433
var aLegceLbomKolot = 'Легче лбом колоть орехи,';
var aCemUcitSqNaMat = 'чем учиться на МАТ-МЕХе.';
function game_end_death()
{
send_replay({death_cause: death_cause});
current_color = 0x0C;
writeln(aLegceLbomKolot);
writeln(aCemUcitSqNaMat);
current_color = 0x0D;
writeln(death_cause);
wait_for_key();
} // end function 104DC
var aUfffffVoVsqkom = 'Уффффф! Во всяком случае, ты еще живой.';
var aYesTiSdelalAto = '********* Yes! Ты сделал это! *********';
var aUTebqNetCelix = 'У тебя нет целых ';
var aZacetov = ' зачетов!';
var aTiOtcislen = 'ТЫ ОТЧИСЛЕН!';
var aNetDvuxZacetov = 'Нет двух зачетов - плохо.';
var aGovorqtUMexani = 'Говорят, у механиков жизнь проще...';
var aZrqGovorqtXalq = '- Зря говорят, ХАЛЯВЫ НЕ БУДЕТ!';
var aNetOdnogoZacet = 'Нет одного зачета.';
var aNicegoOtAtogoE = 'Ничего, от этого еще никто не помирал.';
var aPozdravlquTiMo = 'Поздравляю: ты можешь считать себя настоящим героем Мат-Меха!';
var aUspesnoiTebeSe = 'Успешной тебе сессии !';
var aUTebqNetZaceta = 'У тебя нет зачета по алгебре!';
var aVsemirnovDokan = 'Всемирнов доканал тебя на сессии.';
var aEstestvennoAto = 'Естественно, это повлияло на твои оценки.';
var aUTebqNetDopusk = 'У тебя нет допуска по матану!';
var aUTebqNetZace_0 = 'У тебя нет зачета по геометрии!';
var aKakTebqUgorazd = 'Как тебя угораздило?';
var aKSessiiTiGotov = 'К сессии ты "готовился", "работая" в ТЕРКОМе.';
var aTiResilBolSeNi = 'Ты решил больше никогда так не делать.';
var aTvoqStipuxa = 'Твоя стипуха - ';
var aRub_ = ' руб.';
var aVZanacke = 'В заначке ';
var aDaTiEseIGodNet = 'Да ты еще и GOD! Нет, тебе в таблицу рекордов нельзя.';
var aTebqOstaviliBe = 'Тебя оставили без стипухи.';
function game_end_alive()
{
if (hero.exams_left > 0) {
colored_output(0x0D, aUfffffVoVsqkom);
} else {
colored_output(0x0F, aYesTiSdelalAto);
}
writeln();
writeln();
if (hero.exams_left >= 3) {
colored_output(0x0C, aUTebqNetCelix);
colored_output_white(hero.exams_left);
colored_output(0x0C, aZacetov);
writeln();
colored_output(0x0D, aTiOtcislen);
send_replay();
wait_for_key();
return;
} else if (hero.exams_left == 2) {
colored_output_ln(0x0E, aNetDvuxZacetov);
colored_output_ln(0x0E, aGovorqtUMexani);
colored_output_ln(0x0E, aZrqGovorqtXalq);
} else if (hero.exams_left == 1) {
colored_output_ln(0x0A, aNetOdnogoZacet);
colored_output_ln(0x0A, aNicegoOtAtogoE);
} else if (hero.exams_left == 0) {
colored_output_ln(0x0F, aPozdravlquTiMo);
colored_output_ln(0x0F, aUspesnoiTebeSe);
}
var score = 0;
for (var subj = 0; subj <= 5; ++subj) {
if (hero.subject[subj].pass_day != -1) {
score +=
idiv((6 - hero.subject[subj].pass_day) *
(subjects[subj].tasks + subjects[subj].member0xFA) * 2, 3);
}
}
if (!hero.subject[Algebra].passed) {
current_color = 0x0C;
writeln();
writeln(aUTebqNetZaceta);
writeln(aVsemirnovDokan);
writeln(aEstestvennoAto);
current_color = 7;
score -= (subjects[Algebra].tasks - hero.subject[Algebra].tasks_done) * 4;
if (score < 0) {
score = 0;
}
}
if (!hero.subject[Matan].passed) {
current_color = 0x0C;
writeln();
writeln(aUTebqNetDopusk);
score = idiv(score * 2, 3);
current_color = 7;
}