-
Notifications
You must be signed in to change notification settings - Fork 0
/
dungeon.c
1263 lines (1056 loc) · 50.3 KB
/
dungeon.c
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
/*
cl65 -t pet -v -o dungeonPET.prg dungeon.c && xpet dungeonPET.prg > /dev/null
cl65 -t c64 -v -o dungeon64.prg dungeon.c && x64sc dungeon64.prg > /dev/null
cc dungeon.c -o ~/dungeon -lncurses
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdbool.h>
#include <unistd.h>
#include <string.h>
#if defined (__CC65__)
#include<cc65.h>
#include <conio.h>
#if defined __CBM__
#include <cbm.h>
#include <peekpoke.h>
#define VIC_BASE_RAM (0x8000)
#define SCREEN_RAM ((char*)VIC_BASE_RAM+0x0400)
#define CHARMAP_RAM ((char*)VIC_BASE_RAM+0x0800)
#define SCREEN_WIDTH 40
#define SCREEN_HEIGHT 25
#define COLOR_OFFSET (int)(COLOUR_RAM - SCREEN_RAM)
#define CHARS_RAM 0x80
#define CHAR_SPACE 0x20
#define RAM_BLOCK (CHARS_RAM + CHAR_SPACE)
#define CHARMAP_DEST (RAM_BLOCK + 1)
#endif
#else
#include "notconio.h"
#endif
// Global variables due to CC65 not liking local
bool run=true;
bool in_play=false;
bool obstruction=false;
unsigned int timer,delay;
unsigned int key,i,c;
unsigned char x=19;
unsigned char y=8;
unsigned char old_x, old_y, direction_x, direction_y, fx, fy;
unsigned char room=0;
unsigned char buffer [sizeof(int)*8+1];
char output [256];
// Player
unsigned char keys,idols,potion=0;
int health=100;
int magic=0;
unsigned int score=0;
bool sword = false;
// Enemy
unsigned int enemy_count=0;
struct enemy {
unsigned char tile;
unsigned char room;
unsigned char x;
unsigned char y;
unsigned char old_x;
unsigned char old_y;
char health;
unsigned char strength;
unsigned char speed;
unsigned char armour;
};
unsigned int this_enemy = 0;
struct enemy enemies[1000];
#ifdef __PET__
unsigned char title_screen_data[] = {
32, 32, 32, 32, 32, 32,116, 98, 98,123, 98, 98,108, 98,123, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32,116, 97, 32, 97, 97, 32, 32, 97, 32,102,102, 92, 92, 92, 92, 32, 92,102, 92,102, 92,102, 92, 92, 32, 92, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32,116, 97, 32, 97, 97, 32, 32, 97, 32,102, 32, 92, 92, 92,102, 32, 92, 92, 32, 92, 32, 92, 92,102, 32, 92, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32,116, 98, 98, 97,121,121, 32, 97, 32,102, 32, 92, 92, 92, 92, 92, 92, 92, 92,102, 32, 92, 92, 92, 92, 92, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32,116, 97, 32, 32, 97, 32, 32, 97, 32,102, 32, 92, 92, 92, 92,102, 92, 92, 92, 92, 32, 92, 92, 92,102, 92, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32,116, 97, 32, 32, 97, 32, 32, 97, 32,102,102, 92,102, 92, 92, 32, 92,102, 92,102, 92,102, 92, 92, 32, 92, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32,116,126, 32, 32,120,120, 32,126, 32,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32,120,120,120,120,120,120,120,120,120,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 23, 5, 12, 3, 15, 13, 5, 32, 1, 4, 22, 5, 14, 20, 21, 18, 5, 18, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 25, 15, 21, 18, 32, 13, 9, 19, 19, 9, 15, 14, 32, 9, 19, 58, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 90, 32, 18, 5, 3, 15, 22, 5, 18, 32, 20, 8, 5, 32, 9, 4, 15, 12, 19, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 90, 32, 7, 5, 20, 32, 15, 21, 20, 32, 1, 12, 9, 22, 5, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 90, 32, 1, 14, 25, 32, 12, 15, 15, 20, 32, 25, 15, 21, 32, 6, 9, 14, 4, 32, 9, 19, 32, 25, 15, 21, 18, 19, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 2, 25, 32, 3, 8, 18, 9, 19, 32, 7, 1, 18, 18, 5, 20, 20, 32, 50, 48, 50, 51, 32, 21, 19, 9, 14, 7, 32, 3, 3, 54, 53, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
};
#endif
#ifdef __C64__
// C65 key = 37 door = 63, 64 vertical door 66
unsigned char chars[]={
92, 87,233, 89, 57, 30, 20, 54,
16, 40, 40, 68,124, 68,238, 0,
252, 66, 66,124, 66, 66,252, 0,
56, 68,130,128,130, 68, 56, 0,
252, 66, 66, 66, 66, 66,252, 0,
254, 66, 72,120, 72, 66,254, 0,
254, 66, 72,120, 72, 64,224, 0,
60, 66,128,142,130, 66, 60, 0,
238, 68,124, 68, 68, 68,238, 0,
254, 16, 16, 16, 16, 16,254, 0,
124, 16, 16, 16,144,144, 96, 0,
238, 68, 72,112, 72, 68,238, 0,
224, 64, 64, 64, 66, 66,254, 0,
238, 84, 84, 84, 68, 68,238, 0,
238,100, 84, 84, 76, 76,228, 0,
56, 68,130,130,130, 68, 56, 0,
252, 66, 66, 66,124, 64,224, 0,
56, 68,130,130,146, 76, 58, 0,
252, 66, 66, 66,124, 72,238, 0,
124,130,128,124, 2,130,124, 0,
254,146, 16, 16, 16, 16, 56, 0,
238, 68, 68, 68, 68, 68, 56, 0,
238, 68, 68, 40, 40, 40, 16, 0,
238, 68, 68, 84, 84,108, 68, 0,
238, 68, 40, 16, 40, 68,238, 0,
238, 68, 40, 40, 16, 16, 56, 0,
254,132, 8, 16, 32, 66,254, 0,
60, 48, 48, 48, 48, 48, 60, 0,
12, 18, 48,124, 48, 98,252, 0,
60, 12, 12, 12, 12, 12, 60, 0,
0, 2, 4, 8, 80, 32, 80,128,
0, 64, 32, 16, 10, 4, 10, 1,
0, 0, 0, 0, 0, 0, 0, 0,
24, 24, 24, 24, 0, 0, 24, 0,
102,102,102, 0, 0, 0, 0, 0,
254,212,170,212,170,212,170, 0,
24, 62, 96, 60, 6,124, 24, 0,
0, 32, 80,143, 85, 37, 0, 0,
8,148, 72, 46, 26, 36,108, 0,
6, 12, 24, 0, 0, 0, 0, 0,
12, 24, 48, 48, 48, 24, 12, 0,
48, 24, 12, 12, 12, 24, 48, 0,
129,102, 44,195, 52,102,129, 0,
0, 24, 24,126, 24, 24, 0, 0,
0, 0, 0, 0, 0, 24, 24, 48,
0, 0, 0,126, 0, 0, 0, 0,
0, 0, 0, 0, 0, 24, 24, 0,
0, 3, 6, 12, 24, 48, 96, 0,
56, 68,130,130,130, 68, 56, 0,
48, 80,144, 16, 16, 16,254, 0,
124,130, 2,124,128,130,254, 0,
254,132, 8, 28,130,130,124, 0,
12, 24, 40, 74,254, 10, 28, 0,
254,130,252, 2,130,130,124, 0,
124,130,128,252,130,130,124, 0,
254,132, 8, 8, 16, 16, 56, 0,
124,130,130,124,130,130,124, 0,
124,130,130,130,124, 4,120, 0,
0, 0, 24, 0, 0, 24, 0, 0,
0, 0, 24, 0, 0, 24, 24, 48,
0,126, 0, 60, 0, 24, 0, 0,
239,138, 12, 0,254,170,128, 0,
0, 0, 24, 0, 60, 0,126, 0,
60, 66, 66, 28, 16, 0, 16, 0,
0, 60, 66, 66, 70, 66,126, 0,
8, 28, 62,127,127, 28, 62, 0,
0, 60, 66, 66, 70, 66,126, 0,
0, 0, 0,255, 0, 0, 0, 0,
0, 0,255,255, 0, 0, 0, 0,
0,255,255, 0, 0, 0, 0, 0,
0, 0, 0, 0,255,255, 0, 0,
48, 48, 48, 48, 48, 48, 48, 48,
12, 12, 12, 12, 12, 12, 12, 12,
0, 0, 0,224,240, 56, 24, 24,
24, 24, 28, 15, 7, 0, 0, 0,
24, 24, 56,240,224, 0, 0, 0,
192,192,192,192,192,192,255,255,
192,224,112, 56, 28, 14, 7, 3,
3, 7, 14, 28, 56,112,224,192,
255,255,192,192,192,192,192,192,
255,255, 3, 3, 3, 3, 3, 3,
8, 24,153,126, 60, 60,102,129,
0, 0, 0, 0, 0,255,255, 0,
54,127,107, 99, 42, 28, 8, 0,
96, 96, 96, 96, 96, 96, 96, 96,
0, 0, 0, 7, 15, 28, 24, 24,
195,231,126, 60, 60,126,231,195,
0, 60,126,102,102,126, 60, 0,
24, 60,114, 98, 36, 24, 60, 0,
6, 6, 6, 6, 6, 6, 6, 6,
16, 56,124,226,100, 40, 16, 0,
24, 24, 24,255,255, 24, 24, 24,
96, 8, 72, 48, 0, 96,144,144,
24, 24, 24, 24, 24, 24, 24, 24,
0, 12, 2, 2, 44,124,236, 0,
255,127, 63, 31, 15, 7, 3, 1,
0, 0, 0, 0, 0, 0, 0, 0,
240,240,240,240,240,240,240,240,
0, 0, 0, 0,255,255,255,255,
255, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,255,
192,192,192,192,192,192,192,192,
204,135, 48,102, 8,147,199, 70,
3, 3, 3, 3, 3, 3, 3, 3,
0, 0, 0, 0,131, 92,100,171,
255,254,252,248,240,224,192,128,
3, 3, 3, 3, 3, 3, 3, 3,
24, 24, 24, 31, 31, 24, 24, 24,
0, 0, 0, 0, 15, 15, 15, 15,
24, 24, 24, 31, 31, 0, 0, 0,
0, 0, 0,248,248, 24, 24, 24,
0, 0, 0, 0, 0, 0,255,255,
0, 0, 0, 31, 31, 24, 24, 24,
24, 24, 24,255,255, 0, 0, 0,
0, 0, 0,255,255, 24, 24, 24,
24, 24, 24,248,248, 24, 24, 24,
192,192,192,192,192,192,192,192,
224,224,224,224,224,224,224,224,
7, 7, 7, 7, 7, 7, 7, 7,
255,255, 0, 0, 0, 0, 0, 0,
255,255,255, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0,255,255,255,
3, 3, 3, 3, 3, 3,255,255,
0, 0, 0, 0,240,240,240,240,
15, 15, 15, 15, 0, 0, 0, 0,
24, 24, 24,248,248, 0, 0, 0,
240,240,240,240, 0, 0, 0, 0,
240,240,240,240, 15, 15, 15, 15,
195,153,145,145,159,153,195,255,
239,215,215,187,131,187, 17,255,
3,189,189,131,189,189, 3,255,
199,187,125,127,125,187,199,255,
3,189,189,189,189,189, 3,255,
1,189,183,135,183,189, 1,255,
1,189,183,135,183,191, 31,255,
195,189,127,113,125,189,195,255,
17,187,131,187,187,187, 17,255,
1,239,239,239,239,239, 1,255,
131,239,239,239,111,111,159,255,
17,187,183,143,183,187, 17,255,
31,191,191,191,189,189, 1,255,
17,171,171,171,187,187, 17,255,
17,155,171,171,179,179, 27,255,
199,187,125,125,125,187,199,255,
3,189,189,189,131,191, 31,255,
199,187,125,125,109,179,197,255,
3,189,189,189,131,183, 17,255,
131,125,127,131,253,125,131,255,
1,109,239,239,239,239,199,255,
17,187,187,187,187,187,199,255,
17,187,187,215,215,215,239,255,
17,187,187,171,171,147,187,255,
17,187,215,239,215,187, 17,255,
17,187,215,215,239,239,199,255,
1,123,247,239,223,189, 1,255,
195,207,207,207,207,207,195,255,
243,237,207,131,207,157, 3,255,
195,243,243,243,243,243,195,255,
255,231,195,129,231,231,231,231,
255,239,207,128,128,207,239,255,
255,255,255,255,255,255,255,255,
231,231,231,231,255,255,231,255,
153,153,153,255,255,255,255,255,
153,153, 0,153, 0,153,153,255,
231,193,159,195,249,131,231,255,
157,153,243,231,207,153,185,255,
195,153,195,199,152,153,192,255,
249,243,231,255,255,255,255,255,
243,231,207,207,207,231,243,255,
207,231,243,243,243,231,207,255,
255,153,195, 0,195,153,255,255,
255,231,231,129,231,231,255,255,
255,255,255,255,255,231,231,207,
255,255,255,129,255,255,255,255,
255,255,255,255,255,231,231,255,
255,252,249,243,231,207,159,255,
195,153,145,137,153,153,195,255,
231,231,199,231,231,231,129,255,
195,153,249,243,207,159,129,255,
195,153,249,227,249,153,195,255,
249,241,225,153,128,249,249,255,
129,159,131,249,249,153,195,255,
195,153,159,131,153,153,195,255,
129,153,243,231,231,231,231,255,
195,153,153,195,153,153,195,255,
195,153,153,193,249,153,195,255,
255,255,231,255,255,231,255,255,
255,255,231,255,255,231,231,207,
241,231,207,159,207,231,241,255,
255,255,129,255,129,255,255,255,
143,231,243,249,243,231,143,255,
195,153,249,243,231,255,231,255,
255,255,255, 0, 0,255,255,255,
247,227,193,128,128,227,193,255,
231,231,231,231,231,231,231,231,
255,255,255, 0, 0,255,255,255,
255,255, 0, 0,255,255,255,255,
255, 0, 0,255,255,255,255,255,
255,255,255,255, 0, 0,255,255,
207,207,207,207,207,207,207,207,
243,243,243,243,243,243,243,243,
255,255,255, 31, 15,199,231,231,
231,231,227,240,248,255,255,255,
231,231,199, 15, 31,255,255,255,
63, 63, 63, 63, 63, 63, 0, 0,
63, 31,143,199,227,241,248,252,
252,248,241,227,199,143, 31, 63,
0, 0, 63, 63, 63, 63, 63, 63,
0, 0,252,252,252,252,252,252,
255,195,129,129,129,129,195,255,
255,255,255,255,255, 0, 0,255,
201,128,128,128,193,227,247,255,
159,159,159,159,159,159,159,159,
255,255,255,248,240,227,231,231,
60, 24,129,195,195,129, 24, 60,
255,195,129,153,153,129,195,255,
231,231,153,153,231,231,195,255,
249,249,249,249,249,249,249,249,
247,227,193,128,193,227,247,255,
231,231,231, 0, 0,231,231,231,
63, 63,207,207, 63, 63,207,207,
231,231,231,231,231,231,231,231,
255,255,252,193,137,201,201,255,
0,128,192,224,240,248,252,254,
255,255,255,255,255,255,255,255,
15, 15, 15, 15, 15, 15, 15, 15,
255,255,255,255, 0, 0, 0, 0,
0,255,255,255,255,255,255,255,
255,255,255,255,255,255,255, 0,
63, 63, 63, 63, 63, 63, 63, 63,
51, 51,204,204, 51, 51,204,204,
252,252,252,252,252,252,252,252,
255,255,255,255, 51, 51,204,204,
0, 1, 3, 7, 15, 31, 63,127,
252,252,252,252,252,252,252,252,
231,231,231,224,224,231,231,231,
255,255,255,255,240,240,240,240,
231,231,231,224,224,255,255,255,
255,255,255, 7, 7,231,231,231,
255,255,255,255,255,255, 0, 0,
255,255,255,224,224,231,231,231,
231,231,231, 0, 0,255,255,255,
255,255,255, 0, 0,231,231,231,
231,231,231, 7, 7,231,231,231,
63, 63, 63, 63, 63, 63, 63, 63,
31, 31, 31, 31, 31, 31, 31, 31,
248,248,248,248,248,248,248,248,
0, 0,255,255,255,255,255,255,
0, 0, 0,255,255,255,255,255,
255,255,255,255,255, 0, 0, 0,
252,252,252,252,252,252, 0, 0,
255,255,255,255, 15, 15, 15, 15,
240,240,240,240,255,255,255,255,
231,231,231, 7, 7,255,255,255,
15, 15, 15, 15,255,255,255,255,
15, 15, 15, 15,240,240,240,240
};
unsigned char title_screen_data[] = {
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32,236,251, 32,236,226, 32, 97,123, 32,102,102, 92, 92, 92, 92, 32, 92,102, 92,102, 92,102, 92, 92, 32, 92, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 97, 32, 32, 97, 32, 32, 97, 97, 32,102, 32, 92, 92, 92,102, 32, 92, 92, 32, 92, 32, 92, 92,102, 32, 92, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 97, 32, 32,236,251, 32,252,252,123,102, 32, 92, 92, 92, 92, 92, 92, 92, 92,102, 32, 92, 92, 92, 92, 92, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 97, 32, 32, 97,225, 32, 32, 97, 32,102, 32, 92, 92, 92, 92,102, 92, 92, 92, 92, 32, 92, 92, 92,102, 92, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32,252,254, 32,252,254, 32, 32, 97, 32,102,102, 92,102, 92, 92, 32, 92,102, 92,102, 92,102, 92, 92, 32, 92, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 23, 5, 12, 3, 15, 13, 5, 32, 1, 4, 22, 5, 14, 20, 21, 18, 5, 18, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 25, 15, 21, 18, 32, 13, 9, 19, 19, 9, 15, 14, 32, 9, 19, 58, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 90, 32, 18, 5, 3, 15, 22, 5, 18, 32, 20, 8, 5, 32, 9, 4, 15, 12, 19, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 90, 32, 7, 5, 20, 32, 15, 21, 20, 32, 1, 12, 9, 22, 5, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 90, 32, 1, 14, 25, 32, 12, 15, 15, 20, 32, 25, 15, 21, 32, 6, 9, 14, 4, 32, 9, 19, 32, 25, 15, 21, 18, 19, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 2, 25, 32, 3, 8, 18, 9, 19, 32, 7, 1, 18, 18, 5, 20, 20, 32, 50, 48, 50, 51, 32, 21, 19, 9, 14, 7, 32, 3, 3, 54, 53, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
};
unsigned char title_screen_cdata[] = {
5, 5, 5, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 5, 13, 13, 13, 13, 5, 13, 13, 5, 13, 5, 13, 13, 13, 5, 13, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 5, 13, 13, 13, 13, 13, 13, 13, 13, 13, 5, 13, 13, 13, 13, 13, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 5, 5, 5, 5, 5, 13, 5, 13, 13, 5, 5, 5, 5, 13, 13, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 5, 5, 5, 5, 13, 13, 5, 13, 5, 5, 5, 5, 13, 13, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 10, 10, 10, 10, 10, 10, 10, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2, 2, 5, 2, 2, 2, 2, 2, 2, 2, 5, 2, 2, 11, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 3, 5, 15, 15, 15, 15, 15, 15, 15, 5, 15, 15, 15, 5, 15, 15, 15, 15, 15, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 14, 5, 12, 12, 12, 5, 12, 12, 12, 5, 12, 12, 12, 12, 12, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 6, 5, 11, 11, 11, 5, 11, 11, 11, 11, 5, 11, 11, 11, 5, 11, 11, 11, 11, 5, 11, 11, 5, 11, 11, 11, 11, 11, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 12, 12, 5, 15, 15, 15, 15, 15, 5, 15, 15, 15, 15, 15, 15, 15, 5, 12, 12, 12, 12, 5, 11, 11, 11, 11, 11, 5, 15, 15, 15, 15, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
};
#endif
unsigned char rooms[] = {
// Room 1
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 0, 32, 32, 32, 32, 32, 11, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 94, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 81, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 38, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 88, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 83, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32,102,102,102,102,102, 45,102,102,102,102,102,102,102,102,102, 32, 32, 32, 32, 32, 83, 32,102, 32, 32, 32, 32, 32, 32,
32,102,102,102,102,102,102,102,102,102,102,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 36, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 11, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 83, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 11, 32, 32, 32, 32, 32, 9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 30, 32, 88, 32, 32, 32, 32, 9, 32, 32, 32, 32, 38, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 94, 32, 32, 32, 32,102, 32, 32, 94, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 36, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32,102,102,102,102,102,102,102,102,102,102,102, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32, 32,102, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
,// room 2
105,120,120,120,120,120,120,120, 97, 61, 61, 97,120,120,120,120,120,120,120, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
97, 32, 32, 32, 32, 32, 32, 32, 97, 61, 61, 97, 32, 32, 32, 32, 32, 32, 32, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
97, 32, 32, 32, 32, 32, 32, 32, 97, 61, 61, 97, 32, 32, 32, 32, 32, 32, 32, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
117, 32, 32, 32, 32, 32, 32, 32, 97, 61, 61, 97, 32, 32, 32, 32, 32, 32, 32, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
97, 32, 32, 32, 32, 32, 32, 32, 32, 0, 32, 32, 32, 32, 32, 32, 32, 32, 32,116, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,121, 98, 98, 98, 98, 98, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
97, 32, 32, 90, 32, 94, 94, 94, 94, 94, 94, 94, 94, 94, 32, 32, 32, 32, 32, 97, 97, 32, 32, 32, 32, 32,127, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,117,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,117,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,
117, 32, 32, 32, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 88, 32, 32, 32, 32, 32, 32, 32, 97,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 38, 32, 32, 90, 32, 32, 32, 32, 97, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 83, 32, 32, 32, 32, 32, 32, 32, 32, 97,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 83, 32, 32, 32, 32, 32, 32, 32, 32, 97, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 38, 32, 32, 90, 32, 32, 32, 32, 97,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 88, 32, 32, 32, 32, 32, 32, 97,117, 32, 32, 32, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,
97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,117, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,
97, 32, 32, 32, 32, 32, 32, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,117, 97, 32, 32, 90, 32, 94, 94, 94, 94, 94, 94, 94, 94, 94, 32, 32, 32, 32, 32, 97,
127, 98, 98, 98, 98, 98, 98,117, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,117, 32, 32, 32, 32, 32, 32, 32, 97, 61, 61, 97, 32, 32, 32, 32, 32, 32, 32, 97,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 32, 32, 32, 32, 32, 32, 32, 97, 61, 61, 97, 32, 32, 32, 32, 32, 32, 32, 97,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 97, 32, 32, 32, 32, 32, 32, 32, 97, 61, 61, 97, 32, 32, 32, 32, 32, 32, 32, 97,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,105,120,120,120,120,120,120,120, 97, 61, 61, 97,120,120,120,120,120,120,120, 97,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
// room 3
,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 87, 87, 87, 87, 32, 87, 87, 87, 87, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 87, 87, 32, 32, 87, 87, 87, 87, 32, 32, 32, 32, 87, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 87, 32, 32, 32, 32, 32, 32,
32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32, 32, 32, 32, 32, 88, 83, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32, 32,
32, 87, 32, 32, 32, 88, 32, 32, 32, 32, 32, 32, 32, 32, 32, 9, 32, 32, 32, 32, 32, 32, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 87, 32, 87, 32, 32, 32, 32, 32,
32, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 38, 32, 87, 87, 32, 32, 38, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 87, 87, 32, 32, 32, 32,
32, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 32, 32, 32, 87, 32, 32, 32, 32,
32, 87, 32, 32, 32, 32, 32, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32,
32, 87, 87, 32, 32, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32, 32, 32, 32, 32, 87, 45, 87, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32, 32,
32, 32, 87, 32, 32, 32, 38, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32,
32, 32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 87, 87, 32, 32, 32, 94, 94, 94, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32,
32, 32, 32, 87, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 32, 32, 94, 94, 94, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32,
32, 32, 32, 32, 32, 87, 87, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 9, 32, 32, 32, 94, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 87, 87, 87, 87, 87, 32, 32, 32, 32, 32, 87, 32, 32, 94, 32, 32, 32, 32, 32, 32, 0, 32, 32, 32, 32, 32, 87, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 87, 87, 87, 87, 87, 32, 94, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 87, 32, 32, 32, 32, 32, 87, 87, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 87, 87, 87, 87, 87, 87, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32
};
#if defined (__CC65__)
void output_message() {
printf(output);
sprintf(output,"");
}
#else
void output_message() {
printw(output);
sprintf(output,"");
}
#endif
unsigned char game_map[1000];
unsigned int map(char x, char y) {
unsigned char c;
c = game_map[40*y+x];
#ifdef __C64__
if(c==11) c=37;
if(c==45) c=66;
if(c==9) c=66;
#endif
if(c>64) c+=64;
return c;
// For testing you could use the following to output the charset
// return 40*y+x;
}
void load_room() {
int pos;
clrscr();
gotoxy(0,0);
sprintf(output, "loading room %d",room+1);
output_message();
for (pos = 0; pos < 1000; pos++) {
c=rooms[pos+(1000*room)];
// Player x and y
if(c==0) {
y=pos/40;
x=pos % 40;
}
// Goblin
if(c==38) {
// Increment for next enemy (Enemy 0 is counted as no enemy)
enemy_count+=1;
// Create the enemy in the list
enemies[enemy_count].tile = c;
enemies[enemy_count].room = room;
enemies[enemy_count].x = pos % 40;
enemies[enemy_count].y = pos/40;
enemies[enemy_count].old_x = enemies[enemy_count].x;
enemies[enemy_count].old_y = enemies[enemy_count].y;
enemies[enemy_count].health = 30;
enemies[enemy_count].strength = 5;
enemies[enemy_count].speed = 1;
enemies[enemy_count].armour = 10;
}
// Rat
else if (c==94) {
// Increment for next enemy (Enemy 0 is counted as no enemy)
enemy_count+=1;
// Create the enemy in the list
enemies[enemy_count].tile = 158;
enemies[enemy_count].room = room;
enemies[enemy_count].x = pos % 40;
enemies[enemy_count].y = pos/40;
enemies[enemy_count].old_x = enemies[enemy_count].x;
enemies[enemy_count].old_y = enemies[enemy_count].y;
enemies[enemy_count].health = 15;
enemies[enemy_count].strength = 5;
enemies[enemy_count].speed = 2;
enemies[enemy_count].armour = 0;
}
game_map[pos] = c;
}
/*
sprintf(output, "\n\nenemies %3d\n", enemy_count);
for(i=1; i<enemy_count+1;i++)
{
sprintf(output, "%s %3d\n",enemies[i].tile,i);
}
key = cgetc();
*/
}
void set_map(char x, char y, int tile) {
// Set the part of the array to the given tile
game_map[40*y+x]=tile;
}
unsigned int dumb_wait(unsigned int delay) {
for(timer=0; timer<delay; timer++) {}
return timer;
}
// Returns the enemy for a given x,y coord
unsigned int which_enemy(unsigned int ex,unsigned int ey) {
if(map(ex,ey)==32) return 0;
// Enemies starts at 1, 0 = no enemy
for(i=1;i<enemy_count+1;i++)
{
if(enemies[i].x == ex && enemies[i].y == ey && enemies[i].health >= 1) return i;
}
// No enemies
return 0;
}
void attack(unsigned int weapon, unsigned int ax, unsigned int ay)
{
int rnum = 0;
this_enemy = 0;
this_enemy = which_enemy(ax,ay);
if(this_enemy == 0) {
return;
}
rnum = (rand() % (20 - 1 + 1)) + 1;
if(rnum > enemies[this_enemy].armour+enemies[this_enemy].speed) {
// Damage!
enemies[this_enemy].health-=weapon;
if(enemies[this_enemy].health>0)
{
gotoxy(0,0);
sprintf(output, "hit!! enemy health: %3d ", enemies[this_enemy].health);
output_message();
timer=dumb_wait(1000);
}
} else {
gotoxy(0,0);
sprintf(output, "miss! enemy health: %3d ", enemies[this_enemy].health);
output_message();
if((x == ax && y == ay)||(x == ax && (y == ay + 1 || y == ay - 1)) || (y == ay && (x == ax + 1 || x == ax - 1)))
{
health -= enemies[this_enemy].strength;
}
timer=dumb_wait(1000);
}
if(enemies[this_enemy].health < 1 ) {
// Success!
gotoxy(0,0);
sprintf(output, "enemy defeated! ");
output_message();
// Draw tile in new location
cputcxy(ax,ay,32);
set_map(ax,ay,32);
enemies[this_enemy].tile = 32;
// Up the score
score+=10;
timer=dumb_wait(1000);
}
}
void enemy_attack(unsigned int this_enemy)
{
int rnum = 0;
rnum = (rand() % (20 - 1 + 1)) + 1;
if(rnum > 10) {
// Damage!
if(health < 1 || (health-enemies[this_enemy].strength) < 1)
{
health = 0;
} else {
health-=enemies[this_enemy].strength;
}
gotoxy(0,0);
sprintf(output, "ouch! health: %3d ", health);
output_message();
timer=dumb_wait(1000);
} else {
enemies[this_enemy].health -= 5;
if(enemies[this_enemy].health<1) {
enemies[this_enemy].health=0;
// Draw tile in new location
cputcxy(enemies[this_enemy].x,enemies[this_enemy].y,32);
set_map(enemies[this_enemy].x,enemies[this_enemy].y,32);
enemies[this_enemy].tile = 32;
gotoxy(0,0);
sprintf(output, "enemy defeated! ");
output_message();
}else {
gotoxy(0,0);
sprintf(output, "block health: %3d ", health);}
output_message();
}
timer=dumb_wait(1000);
if(health < 1) {
// Fail!
gotoxy(0,0);
sprintf(output, "enemy defeated you! ");
output_message();
health = 0;
timer=dumb_wait(1000);
}
}
// Move the enemies for a given room
void move_enemies() {
unsigned char rnd;
// Enemies starts at 1, 0 = no enemy
for(i=1;i<enemy_count+1;i++)
{
if(enemies[i].room == room && enemies[i].health>0){
enemies[i].old_x = enemies[i].x;
enemies[i].old_y = enemies[i].y;
// Rat is random
if(enemies[i].tile == 158) {
rnd = (rand() % (4)) + 1;
if(rnd == 4) enemies[i].x-=1;
if(rnd == 2) enemies[i].x+=1;
if(rnd == 1) enemies[i].y-=1;
if(rnd == 3) enemies[i].y+=1;
}
// Gobbo goes for player
if(enemies[i].tile == 38) {
if(enemies[i].x > x) enemies[i].x-=1;
if(enemies[i].x < x) enemies[i].x+=1;
if(enemies[i].y > y) enemies[i].y-=1;
if(enemies[i].y < y) enemies[i].y+=1;
}
// Redraw
c=map(enemies[i].x,enemies[i].y);
if(c!=32) {
enemies[i].x = enemies[i].old_x;
enemies[i].y = enemies[i].old_y;
if(c==64) enemy_attack(i);
}else{
set_map(enemies[i].old_x, enemies[i].old_y, 32);
cputcxy(enemies[i].old_x, enemies[i].old_y, 32);
}
set_map(enemies[i].x, enemies[i].y, enemies[i].tile);
cputcxy(enemies[i].x, enemies[i].y,enemies[i].tile);
}
}
}
void draw_screen() {
int row,col;
for(row=0; row<25; row++)
{
for(col=0; col < 40; col++){
cputcxy(col,row,map(col,row));
}
};
}
void draw_momentary_object(unsigned int obj_old_x, unsigned int obj_old_y,unsigned int obj_x, unsigned int obj_y, unsigned int obj_tile, unsigned int delay) {
// Replace tile
cputcxy(obj_old_x,obj_old_y,map(obj_old_x,obj_old_y));
// Draw tile in new location
cputcxy(obj_x,obj_y,obj_tile);
// Delay
timer=dumb_wait(delay);
// Replace tile again
cputcxy(obj_x,obj_y,map(obj_x,obj_y));
}
void draw_move(bool replace) {
// Delete the player character
if(!replace) {
set_map(old_x, old_y, 32);
}
// Draw new location
cputcxy(old_x,old_y,map(old_x,old_y));
cputcxy(x,y,64);
set_map(x, y, 64);
}
#ifdef __PET__
void title_screen() {
clrscr();
for(i=0; i<1000; i++) {
POKE(32768+i,title_screen_data[i]);
}
gotoxy(0,9);
sprintf(output, " a game by retrogamecoders.com\n press a key");
output_message();
while(kbhit()==false){
timer=dumb_wait(1500);
gotoxy(13,10);
sprintf(output, "%cpress a key",18);
output_message();
timer=dumb_wait(1500);
gotoxy(13,10);
sprintf(output, "%cpress a key",146);
output_message();
};
in_play=true;
}
#elif defined __C64__
void title_screen() {
memcpy(49152,&chars,sizeof(chars)); // load character data
POKE(56576,PEEK(57576)&252);
POKE(53272,32); // 0x3000 would be POKE(53272,(PEEK(53272)&240)+12);
POKE(648,200);
// load character data into 0x3000
// memcpy(0x3000,&chars,sizeof(chars));
// POKE(53272,(PEEK(53272)&240)+12);
clrscr();
for(i=0; i<1000; i++) {
POKE(51200+i,title_screen_data[i]);
POKE(55296+i,title_screen_cdata[i]);
}
while(!kbhit()) {
gotoxy(0,9);
sprintf(output, " a game by retrogamecoders.com\n press a key");
output_message();
delay = dumb_wait(2000);
gotoxy(0,9);
sprintf(output, " a game by retrogamecoders.com\n %cpress a key%c",18,146);
output_message();
delay = dumb_wait(2000);
}
in_play=true;
}
#else
// This is the default title screen
void title_screen() {
clrscr();
mvprintw(9,0,"ASCII Dungeon\na game by retrogamecoders.com\n");
mvprintw(11,0,"\nPRESS A KEY\n");
refresh();
key=cgetc();
in_play=true;
}
#endif
bool game_over() {
clrscr();
sprintf(output, "game over\n\n");
output_message();
timer=dumb_wait(1000);
sprintf(output, "ah, such a shame,\nyou were doing so well!\n\n");
output_message();
timer=dumb_wait(1000);
sprintf(output, "score:%03d\n\nplay again (y/n)?",score);
output_message();
key=cgetc();
in_play=false;
if(key=='n') {
return false;
} else {
return true;
}
}
void game_loop() {
gotoxy(0,24);
sprintf(output, " k: %02d S: %03d *: %03d score: %04d", keys, health, magic, score);
output_message();
// Change direction
if(x != old_x || y != old_y) {
direction_x = x-old_x;
direction_y = y-old_y;
}
move_enemies();
// Backup the location
old_x = x;
old_y = y;
//if(kbhit()) { Remove comment to make more action than turn-based
// Check keys;
switch (key=cgetc())
{
case 'w':
if(y>0) y--;
break;
case 'a':
if(x>0) x--;
break;
case 'A':
case 'o':
if(sword==true) {
draw_momentary_object(x-1,y,x-1,y,131,2000);
attack(10,x-1,y);
}
break;
case 's':