rnd-20030505-1-src
[rocksndiamonds.git] / src / main.c
1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
3 *----------------------------------------------------------*
4 * (c) 1995-2002 Artsoft Entertainment                      *
5 *               Holger Schemel                             *
6 *               Detmolder Strasse 189                      *
7 *               33604 Bielefeld                            *
8 *               Germany                                    *
9 *               e-mail: info@artsoft.org                   *
10 *----------------------------------------------------------*
11 * main.c                                                   *
12 ***********************************************************/
13
14 #include "libgame/libgame.h"
15
16 #include "main.h"
17 #include "init.h"
18 #include "game.h"
19 #include "events.h"
20 #include "config.h"
21
22 #if 0
23 GC                      tile_clip_gc;
24 Bitmap                 *pix[NUM_BITMAPS];
25 #endif
26 Bitmap                 *bitmap_db_field, *bitmap_db_door;
27 #if 0
28 Pixmap                  tile_clipmask[NUM_TILES];
29 #endif
30 DrawBuffer             *fieldbuffer;
31 DrawBuffer             *drawto_field;
32
33 int                     game_status = -1;
34 boolean                 level_editor_test_game = FALSE;
35 boolean                 network_playing = FALSE;
36
37 int                     key_joystick_mapping = 0;
38
39 boolean                 redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
40 int                     redraw_x1 = 0, redraw_y1 = 0;
41
42 short                   Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
43 short                   Ur[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
44 short                   MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
45 short                   MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
46 short                   MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
47 short                   Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
48 short                   Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
49 short                   StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
50 short                   Back[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
51 boolean                 Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
52 short                   JustStopped[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
53 short                   AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
54 short                   AmoebaCnt[MAX_NUM_AMOEBA];
55 short                   AmoebaCnt2[MAX_NUM_AMOEBA];
56 short                   ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
57 short                   ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
58
59 unsigned long           Properties[MAX_NUM_ELEMENTS][NUM_EP_BITFIELDS];
60
61 int                     GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
62 int                     GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
63 int                     GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
64 int                     GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
65
66 int                     lev_fieldx, lev_fieldy;
67 int                     scroll_x, scroll_y;
68
69 int                     FX = SX, FY = SY;
70 int                     ScrollStepSize;
71 int                     ScreenMovDir = MV_NO_MOVING, ScreenMovPos = 0;
72 int                     ScreenGfxPos = 0;
73 int                     BorderElement = EL_STEELWALL;
74 int                     GameFrameDelay = GAME_FRAME_DELAY;
75 int                     FfwdFrameDelay = FFWD_FRAME_DELAY;
76 int                     BX1 = 0, BY1 = 0;
77 int                     BX2 = SCR_FIELDX - 1, BY2 = SCR_FIELDY - 1;
78 int                     SBX_Left, SBX_Right;
79 int                     SBY_Upper, SBY_Lower;
80 int                     ZX, ZY;
81 int                     ExitX, ExitY;
82 int                     AllPlayersGone;
83
84 int                     TimeFrames, TimePlayed, TimeLeft;
85
86 boolean                 network_player_action_received = FALSE;
87
88 struct LevelInfo        level;
89 struct PlayerInfo       stored_player[MAX_PLAYERS], *local_player = NULL;
90 struct HiScore          highscore[MAX_SCORE_ENTRIES];
91 struct TapeInfo         tape;
92 struct SetupInfo        setup;
93 struct GameInfo         game;
94 struct GlobalInfo       global;
95 struct MenuInfo         menu;
96 struct DoorInfo         door;
97 struct GraphicInfo     *graphic_info = NULL;
98 struct SoundInfo       *sound_info = NULL;
99
100
101 /* ------------------------------------------------------------------------- */
102 /* element definitions                                                       */
103 /* ------------------------------------------------------------------------- */
104
105 struct ElementInfo element_info[MAX_NUM_ELEMENTS + 1] =
106 {
107   /* keyword to start parser: "ELEMENT_INFO_START" <-- do not change! */
108
109   /* ----------------------------------------------------------------------- */
110   /* "real" level file elements                                              */
111   /* ----------------------------------------------------------------------- */
112
113   {
114     "empty_space",
115     "empty_space",
116     "empty space"
117   },
118   {
119     "sand",
120     "sand",
121     "sand"
122   },
123   {
124     "wall",
125     "wall",
126     "normal wall"
127   },
128   {
129     "wall_crumbled",
130     "wall",
131     "round wall"
132   },
133   {
134     "rock",
135     "rock",
136     "rock"
137   },
138   {
139     "key_obsolete",
140     "key",
141     "key"
142   },
143   {
144     "emerald",
145     "emerald",
146     "emerald"
147   },
148   {
149     "exit_closed",
150     "exit",
151     "closed exit"
152   },
153   {
154     "player_obsolete",
155     "player",
156     "player"
157   },
158   {
159     "bug",
160     "bug",
161     "bug"
162   },
163   {
164     "spaceship",
165     "spaceship",
166     "spaceship"
167   },
168   {
169     "yamyam",
170     "yamyam",
171     "yam yam"
172   },
173   {
174     "robot",
175     "robot",
176     "robot"
177   },
178   {
179     "steelwall",
180     "wall",
181     "steel wall"
182   },
183   {
184     "diamond",
185     "diamond",
186     "diamond"
187   },
188   {
189     "amoeba_dead",
190     "amoeba",
191     "dead amoeba"
192   },
193   {
194     "quicksand_empty",
195     "quicksand",
196     "empty quicksand"
197   },
198   {
199     "quicksand_full",
200     "quicksand",
201     "quicksand with rock"
202   },
203   {
204     "amoeba_drop",
205     "amoeba",
206     "amoeba drop"
207   },
208   {
209     "bomb",
210     "bomb",
211     "bomb"
212   },
213   {
214     "magic_wall",
215     "magic_wall",
216     "magic wall"
217   },
218   {
219     "speed_pill",
220     "speed_pill",
221     "speed pill"
222   },
223   {
224     "acid",
225     "acid",
226     "acid"
227   },
228   {
229     "amoeba_wet",
230     "amoeba",
231     "dropping amoeba"
232   },
233   {
234     "amoeba_dry",
235     "amoeba",
236     "normal amoeba"
237   },
238   {
239     "nut",
240     "nut",
241     "nut with emerald"
242   },
243   {
244     "game_of_life",
245     "game_of_life",
246     "Conway's wall of life"
247   },
248   {
249     "biomaze",
250     "biomaze",
251     "biomaze"
252   },
253   {
254     "dynamite_active",
255     "dynamite",
256     "burning dynamite"
257   },
258   {
259     "stoneblock",
260     "wall",
261     "wall"
262   },
263   {
264     "robot_wheel",
265     "robot_wheel",
266     "magic wheel"
267   },
268   {
269     "robot_wheel_active",
270     "robot_wheel",
271     "magic wheel (running)"
272   },
273   {
274     "key_1",
275     "key",
276     "red key"
277   },
278   {
279     "key_2",
280     "key",
281     "yellow key"
282   },
283   {
284     "key_3",
285     "key",
286     "green key"
287   },
288   {
289     "key_4",
290     "key",
291     "blue key"
292   },
293   {
294     "gate_1",
295     "gate",
296     "red door"
297   },
298   {
299     "gate_2",
300     "gate",
301     "yellow door"
302   },
303   {
304     "gate_3",
305     "gate",
306     "green door"
307   },
308   {
309     "gate_4",
310     "gate",
311     "blue door"
312   },
313   {
314     "gate_1_gray",
315     "gate",
316     "gray door (opened by red key)"
317   },
318   {
319     "gate_2_gray",
320     "gate",
321     "gray door (opened by yellow key)"},
322   {
323     "gate_3_gray",
324     "gate",
325     "gray door (opened by green key)"},
326   {
327     "gate_4_gray",
328     "gate",
329     "gray door (opened by blue key)"},
330   {
331     "dynamite",
332     "dynamite",
333     "dynamite"
334   },
335   {
336     "pacman",
337     "pacman",
338     "pac man"
339   },
340   {
341     "invisible_wall",
342     "wall",
343     "invisible normal wall"
344   },
345   {
346     "lamp",
347     "lamp",
348     "lamp (off)"
349   },
350   {
351     "lamp_active",
352     "lamp",
353     "lamp (on)"
354   },
355   {
356     "wall_emerald",
357     "wall",
358     "wall with emerald"
359   },
360   {
361     "wall_diamond",
362     "wall",
363     "wall with diamond"
364   },
365   {
366     "amoeba_full",
367     "amoeba",
368     "amoeba with content"
369   },
370   {
371     "bd_amoeba",
372     "bd_amoeba",
373     "amoeba (BD style)"
374   },
375   {
376     "time_orb_full",
377     "time_orb_full",
378     "time orb (full)"
379   },
380   {
381     "time_orb_empty",
382     "time_orb_empty",
383     "time orb (empty)"
384   },
385   {
386     "expandable_wall",
387     "wall",
388     "growing wall"
389   },
390   {
391     "bd_diamond",
392     "bd_diamond",
393     "diamond (BD style)"
394   },
395   {
396     "emerald_yellow",
397     "emerald",
398     "yellow emerald"
399   },
400   {
401     "wall_bd_diamond",
402     "wall",
403     "wall with BD style diamond"
404   },
405   {
406     "wall_emerald_yellow",
407     "wall",
408     "wall with yellow emerald"
409   },
410   {
411     "dark_yamyam",
412     "dark_yamyam",
413     "dark yam yam"
414   },
415   {
416     "bd_magic_wall",
417     "bd_magic_wall",
418     "magic wall (BD style)"
419   },
420   {
421     "invisible_steelwall",
422     "wall",
423     "invisible steel wall"
424   },
425   {
426     "unused_63",
427     "unused",
428     "(not used)"
429   },
430   {
431     "dynabomb_increase_number",
432     "dynabomb",
433     "increases number of bombs"
434   },
435   {
436     "dynabomb_increase_size",
437     "dynabomb",
438     "increases explosion size"
439   },
440   {
441     "dynabomb_increase_power",
442     "dynabomb",
443     "increases power of explosion"
444   },
445   {
446     "sokoban_object",
447     "sokoban",
448     "sokoban object"
449   },
450   {
451     "sokoban_field_empty",
452     "sokoban",
453     "sokoban empty field"
454   },
455   {
456     "sokoban_field_full",
457     "sokoban",
458     "sokoban field with object"
459   },
460   {
461     "bd_butterfly_right",
462     "bd_butterfly",
463     "butterfly (starts moving right)"},
464   {
465     "bd_butterfly_up",
466     "bd_butterfly",
467     "butterfly (starts moving up)"
468   },
469   {
470     "bd_butterfly_left",
471     "bd_butterfly",
472     "butterfly (starts moving left)"},
473   {
474     "bd_butterfly_down",
475     "bd_butterfly",
476     "butterfly (starts moving down)"},
477   {
478     "bd_firefly_right",
479     "bd_firefly",
480     "firefly (starts moving right)"
481   },
482   {
483     "bd_firefly_up",
484     "bd_firefly",
485     "firefly (starts moving up)"
486   },
487   {
488     "bd_firefly_left",
489     "bd_firefly",
490     "firefly (starts moving left)"
491   },
492   {
493     "bd_firefly_down",
494     "bd_firefly",
495     "firefly (starts moving down)"
496   },
497   {
498     "bd_butterfly",
499     "bd_butterfly",
500     "butterfly"
501   },
502   {
503     "bd_firefly",
504     "bd_firefly",
505     "firefly"
506   },
507   {
508     "player_1",
509     "player",
510     "yellow player"
511   },
512   {
513     "player_2",
514     "player",
515     "red player"
516   },
517   {
518     "player_3",
519     "player",
520     "green player"
521   },
522   {
523     "player_4",
524     "player",
525     "blue player"
526   },
527   {
528     "bug_right",
529     "bug",
530     "bug (starts moving right)"
531   },
532   {
533     "bug_up",
534     "bug",
535     "bug (starts moving up)"
536   },
537   {
538     "bug_left",
539     "bug",
540     "bug (starts moving left)"
541   },
542   {
543     "bug_down",
544     "bug",
545     "bug (starts moving down)"
546   },
547   {
548     "spaceship_right",
549     "spaceship",
550     "spaceship (starts moving right)"},
551   {
552     "spaceship_up",
553     "spaceship",
554     "spaceship (starts moving up)"
555   },
556   {
557     "spaceship_left",
558     "spaceship",
559     "spaceship (starts moving left)"},
560   {
561     "spaceship_down",
562     "spaceship",
563     "spaceship (starts moving down)"},
564   {
565     "pacman_right",
566     "pacman",
567     "pac man (starts moving right)"
568   },
569   {
570     "pacman_up",
571     "pacman",
572     "pac man (starts moving up)"
573   },
574   {
575     "pacman_left",
576     "pacman",
577     "pac man (starts moving left)"
578   },
579   {
580     "pacman_down",
581     "pacman",
582     "pac man (starts moving down)"
583   },
584   {
585     "emerald_red",
586     "emerald",
587     "red emerald"
588   },
589   {
590     "emerald_purple",
591     "emerald",
592     "purple emerald"
593   },
594   {
595     "wall_emerald_red",
596     "wall",
597     "wall with red emerald"
598   },
599   {
600     "wall_emerald_purple",
601     "wall",
602     "wall with purple emerald"
603   },
604   {
605     "acid_pool_topleft",
606     "wall",
607     "acid pool (top left)"
608   },
609   {
610     "acid_pool_topright",
611     "wall",
612     "acid pool (top right)"
613   },
614   {
615     "acid_pool_bottomleft",
616     "wall",
617     "acid pool (bottom left)"
618   },
619   {
620     "acid_pool_bottom",
621     "wall",
622     "acid pool (bottom)"
623   },
624   {
625     "acid_pool_bottomright",
626     "wall",
627     "acid pool (bottom right)"
628   },
629   {
630     "bd_wall",
631     "wall",
632     "normal wall (BD style)"
633   },
634   {
635     "bd_rock",
636     "bd_rock",
637     "rock (BD style)"
638   },
639   {
640     "exit_open",
641     "exit",
642     "open exit"
643   },
644   {
645     "black_orb",
646     "black_orb",
647     "bomb"
648   },
649   {
650     "amoeba_to_diamond",
651     "amoeba",
652     "amoeba"
653   },
654   {
655     "mole",
656     "mole",
657     "mole"
658   },
659   {
660     "penguin",
661     "penguin",
662     "penguin"
663   },
664   {
665     "satellite",
666     "satellite",
667     "satellite"
668   },
669   {
670     "arrow_left",
671     "arrow",
672     "arrow left"
673   },
674   {
675     "arrow_right",
676     "arrow",
677     "arrow right"
678   },
679   {
680     "arrow_up",
681     "arrow",
682     "arrow up"
683   },
684   {
685     "arrow_down",
686     "arrow",
687     "arrow down"
688   },
689   {
690     "pig",
691     "pig",
692     "pig"
693   },
694   {
695     "dragon",
696     "dragon",
697     "fire breathing dragon"
698   },
699   {
700     "em_key_1_file",
701     "key",
702     "red key (EM style)"
703   },
704   {
705     "char_space",
706     "char",
707     "letter ' '"
708   },
709   {
710     "char_exclam",
711     "char",
712     "letter '!'"
713   },
714   {
715     "char_quotedbl",
716     "char",
717     "letter '\"'"
718   },
719   {
720     "char_numbersign",
721     "char",
722     "letter '#'"
723   },
724   {
725     "char_dollar",
726     "char",
727     "letter '$'"
728   },
729   {
730     "char_procent",
731     "char",
732     "letter '%'"
733   },
734   {
735     "char_ampersand",
736     "char",
737     "letter '&'"
738   },
739   {
740     "char_apostrophe",
741     "char",
742     "letter '''"
743   },
744   {
745     "char_parenleft",
746     "char",
747     "letter '('"
748   },
749   {
750     "char_parenright",
751     "char",
752     "letter ')'"
753   },
754   {
755     "char_asterisk",
756     "char",
757     "letter '*'"
758   },
759   {
760     "char_plus",
761     "char",
762     "letter '+'"
763   },
764   {
765     "char_comma",
766     "char",
767     "letter ','"
768   },
769   {
770     "char_minus",
771     "char",
772     "letter '-'"
773   },
774   {
775     "char_period",
776     "char",
777     "letter '.'"
778   },
779   {
780     "char_slash",
781     "char",
782     "letter '/'"
783   },
784   {
785     "char_0",
786     "char",
787     "letter '0'"
788   },
789   {
790     "char_1",
791     "char",
792     "letter '1'"
793   },
794   {
795     "char_2",
796     "char",
797     "letter '2'"
798   },
799   {
800     "char_3",
801     "char",
802     "letter '3'"
803   },
804   {
805     "char_4",
806     "char",
807     "letter '4'"
808   },
809   {
810     "char_5",
811     "char",
812     "letter '5'"
813   },
814   {
815     "char_6",
816     "char",
817     "letter '6'"
818   },
819   {
820     "char_7",
821     "char",
822     "letter '7'"
823   },
824   {
825     "char_8",
826     "char",
827     "letter '8'"
828   },
829   {
830     "char_9",
831     "char",
832     "letter '9'"
833   },
834   {
835     "char_colon",
836     "char",
837     "letter ':'"
838   },
839   {
840     "char_semicolon",
841     "char",
842     "letter ';'"
843   },
844   {
845     "char_less",
846     "char",
847     "letter '<'"
848   },
849   {
850     "char_equal",
851     "char",
852     "letter '='"
853   },
854   {
855     "char_greater",
856     "char",
857     "letter '>'"
858   },
859   {
860     "char_question",
861     "char",
862     "letter '?'"
863   },
864   {
865     "char_at",
866     "char",
867     "letter '@'"
868   },
869   {
870     "char_a",
871     "char",
872     "letter 'A'"
873   },
874   {
875     "char_b",
876     "char",
877     "letter 'B'"
878   },
879   {
880     "char_c",
881     "char",
882     "letter 'C'"
883   },
884   {
885     "char_d",
886     "char",
887     "letter 'D'"
888   },
889   {
890     "char_e",
891     "char",
892     "letter 'E'"
893   },
894   {
895     "char_f",
896     "char",
897     "letter 'F'"
898   },
899   {
900     "char_g",
901     "char",
902     "letter 'G'"
903   },
904   {
905     "char_h",
906     "char",
907     "letter 'H'"
908   },
909   {
910     "char_i",
911     "char",
912     "letter 'I'"
913   },
914   {
915     "char_j",
916     "char",
917     "letter 'J'"
918   },
919   {
920     "char_k",
921     "char",
922     "letter 'K'"
923   },
924   {
925     "char_l",
926     "char",
927     "letter 'L'"
928   },
929   {
930     "char_m",
931     "char",
932     "letter 'M'"
933   },
934   {
935     "char_n",
936     "char",
937     "letter 'N'"
938   },
939   {
940     "char_o",
941     "char",
942     "letter 'O'"
943   },
944   {
945     "char_p",
946     "char",
947     "letter 'P'"
948   },
949   {
950     "char_q",
951     "char",
952     "letter 'Q'"
953   },
954   {
955     "char_r",
956     "char",
957     "letter 'R'"
958   },
959   {
960     "char_s",
961     "char",
962     "letter 'S'"
963   },
964   {
965     "char_t",
966     "char",
967     "letter 'T'"
968   },
969   {
970     "char_u",
971     "char",
972     "letter 'U'"
973   },
974   {
975     "char_v",
976     "char",
977     "letter 'V'"
978   },
979   {
980     "char_w",
981     "char",
982     "letter 'W'"
983   },
984   {
985     "char_x",
986     "char",
987     "letter 'X'"
988   },
989   {
990     "char_y",
991     "char",
992     "letter 'Y'"
993   },
994   {
995     "char_z",
996     "char",
997     "letter 'Z'"
998   },
999   {
1000     "char_bracketleft",
1001     "char",
1002     "letter '['"
1003   },
1004   {
1005     "char_backslash",
1006     "char",
1007     "letter '\\'"
1008   },
1009   {
1010     "char_bracketright",
1011     "char",
1012     "letter ']'"
1013   },
1014   {
1015     "char_asciicircum",
1016     "char",
1017     "letter '^'"
1018   },
1019   {
1020     "char_underscore",
1021     "char",
1022     "letter '_'"
1023   },
1024   {
1025     "char_copyright",
1026     "char",
1027     "letter '©'"
1028   },
1029   {
1030     "char_aumlaut",
1031     "char",
1032     "letter 'Ä'"
1033   },
1034   {
1035     "char_oumlaut",
1036     "char",
1037     "letter 'Ö'"
1038   },
1039   {
1040     "char_uumlaut",
1041     "char",
1042     "letter 'Ãœ'"
1043   },
1044   {
1045     "char_degree",
1046     "char",
1047     "letter '°'"
1048   },
1049   {
1050     "char_trademark",
1051     "char",
1052     "letter '®'"
1053   },
1054   {
1055     "char_cursor",
1056     "char",
1057     "letter ' '"
1058   },
1059   {
1060     "char_unused",
1061     "char",
1062     "letter ''"
1063   },
1064   {
1065     "char_unused",
1066     "char",
1067     "letter ''"
1068   },
1069   {
1070     "char_unused",
1071     "char",
1072     "letter ''"
1073   },
1074   {
1075     "char_unused",
1076     "char",
1077     "letter ''"
1078   },
1079   {
1080     "char_unused",
1081     "char",
1082     "letter ''"
1083   },
1084   {
1085     "char_unused",
1086     "char",
1087     "letter ''"
1088   },
1089   {
1090     "char_unused",
1091     "char",
1092     "letter ''"
1093   },
1094   {
1095     "char_unused",
1096     "char",
1097     "letter ''"
1098   },
1099   {
1100     "char_unused",
1101     "char",
1102     "letter ''"
1103   },
1104   {
1105     "expandable_wall_horizontal",
1106     "wall",
1107     "growing wall (horizontal)"
1108   },
1109   {
1110     "expandable_wall_vertical",
1111     "wall",
1112     "growing wall (vertical)"
1113   },
1114   {
1115     "expandable_wall_any",
1116     "wall",
1117     "growing wall (any direction)"
1118   },
1119   {
1120     "em_gate_1",
1121     "gate",
1122     "red door (EM style)"
1123   },
1124   {
1125     "em_gate_2",
1126     "gate",
1127     "yellow door (EM style)"
1128   },
1129   {
1130     "em_gate_3",
1131     "gate",
1132     "green door (EM style)"
1133   },
1134   {
1135     "em_gate_4",
1136     "gate",
1137     "blue door (EM style)"
1138   },
1139   {
1140     "em_key_2_file",
1141     "key",
1142     "yellow key (EM style)"
1143   },
1144   {
1145     "em_key_3_file",
1146     "key",
1147     "green key (EM style)"
1148   },
1149   {
1150     "em_key_4_file",
1151     "key",
1152     "blue key (EM style)"
1153   },
1154   {
1155     "sp_empty_space",
1156     "empty_space",
1157     "empty space"
1158   },
1159   {
1160     "sp_zonk",
1161     "sp_zonk",
1162     "zonk"
1163   },
1164   {
1165     "sp_base",
1166     "sp_base",
1167     "base"
1168   },
1169   {
1170     "sp_murphy",
1171     "player",
1172     "murphy"
1173   },
1174   {
1175     "sp_infotron",
1176     "sp_infotron",
1177     "infotron"
1178   },
1179   {
1180     "sp_chip_single",
1181     "wall",
1182     "chip (single)"
1183   },
1184   {
1185     "sp_hardware_gray",
1186     "wall",
1187     "hardware"
1188   },
1189   {
1190     "sp_exit_closed",
1191     "sp_exit",
1192     "exit"
1193   },
1194   {
1195     "sp_disk_orange",
1196     "sp_disk_orange",
1197     "orange disk"
1198   },
1199   {
1200     "sp_port_right",
1201     "sp_port",
1202     "port (leading right)"
1203   },
1204   {
1205     "sp_port_down",
1206     "sp_port",
1207     "port (leading down)"
1208   },
1209   {
1210     "sp_port_left",
1211     "sp_port",
1212     "port (leading left)"
1213   },
1214   {
1215     "sp_port_up",
1216     "sp_port",
1217     "port (leading up)"
1218   },
1219   {
1220     "sp_gravity_port_right",
1221     "sp_port",
1222     "port (leading right)"
1223   },
1224   {
1225     "sp_gravity_port_down",
1226     "sp_port",
1227     "port (leading down)"
1228   },
1229   {
1230     "sp_gravity_port_left",
1231     "sp_port",
1232     "port (leading left)"
1233   },
1234   {
1235     "sp_gravity_port_up",
1236     "sp_port",
1237     "port (leading up)"
1238   },
1239   {
1240     "sp_sniksnak",
1241     "sp_sniksnak",
1242     "snik snak"
1243   },
1244   {
1245     "sp_disk_yellow",
1246     "sp_disk_yellow",
1247     "yellow disk"
1248   },
1249   {
1250     "sp_terminal",
1251     "sp_terminal",
1252     "terminal"
1253   },
1254   {
1255     "sp_disk_red",
1256     "dynamite",
1257     "red disk"
1258   },
1259   {
1260     "sp_port_vertical",
1261     "sp_port",
1262     "port (vertical)"
1263   },
1264   {
1265     "sp_port_horizontal",
1266     "sp_port",
1267     "port (horizontal)"
1268   },
1269   {
1270     "sp_port_any",
1271     "sp_port",
1272     "port (any direction)"
1273   },
1274   {
1275     "sp_electron",
1276     "sp_electron",
1277     "electron"
1278   },
1279   {
1280     "sp_buggy_base",
1281     "sp_buggy_base",
1282     "buggy base"
1283   },
1284   {
1285     "sp_chip_left",
1286     "wall",
1287     "chip (left half)"
1288   },
1289   {
1290     "sp_chip_right",
1291     "wall",
1292     "chip (right half)"
1293   },
1294   {
1295     "sp_hardware_base_1",
1296     "wall",
1297     "hardware"
1298   },
1299   {
1300     "sp_hardware_green",
1301     "wall",
1302     "hardware"
1303   },
1304   {
1305     "sp_hardware_blue",
1306     "wall",
1307     "hardware"
1308   },
1309   {
1310     "sp_hardware_red",
1311     "wall",
1312     "hardware"
1313   },
1314   {
1315     "sp_hardware_yellow",
1316     "wall",
1317     "hardware"
1318   },
1319   {
1320     "sp_hardware_base_2",
1321     "wall",
1322     "hardware"
1323   },
1324   {
1325     "sp_hardware_base_3",
1326     "wall",
1327     "hardware"
1328   },
1329   {
1330     "sp_hardware_base_4",
1331     "wall",
1332     "hardware"
1333   },
1334   {
1335     "sp_hardware_base_5",
1336     "wall",
1337     "hardware"
1338   },
1339   {
1340     "sp_hardware_base_6",
1341     "wall",
1342     "hardware"
1343   },
1344   {
1345     "sp_chip_top",
1346     "wall",
1347     "chip (upper half)"
1348   },
1349   {
1350     "sp_chip_bottom",
1351     "wall",
1352     "chip (lower half)"
1353   },
1354   {
1355     "em_gate_1_gray",
1356     "gate",
1357     "gray door (EM style, red key)"
1358   },
1359   {
1360     "em_gate_2_gray",
1361     "gate",
1362     "gray door (EM style, yellow key)"
1363   },
1364   {
1365     "em_gate_3_gray",
1366     "gate",
1367     "gray door (EM style, green key)"
1368   },
1369   {
1370     "em_gate_4_gray",
1371     "gate",
1372     "gray door (EM style, blue key)"
1373   },
1374   {
1375     "unused_254",
1376     "unused",
1377     "(not used)"
1378   },
1379   {
1380     "unused_255",
1381     "unused",
1382     "(not used)"
1383   },
1384   {
1385     "pearl",
1386     "pearl",
1387     "pearl"
1388   },
1389   {
1390     "crystal",
1391     "crystal",
1392     "crystal"
1393   },
1394   {
1395     "wall_pearl",
1396     "wall",
1397     "wall with pearl"
1398   },
1399   {
1400     "wall_crystal",
1401     "wall",
1402     "wall with crystal"
1403   },
1404   {
1405     "door_white",
1406     "gate",
1407     "white door"
1408   },
1409   {
1410     "door_white_gray",
1411     "gate",
1412     "gray door (opened by white key)"
1413   },
1414   {
1415     "key_white",
1416     "key",
1417     "white key"
1418   },
1419   {
1420     "shield_normal",
1421     "shield_normal",
1422     "shield (normal)"
1423   },
1424   {
1425     "extra_time",
1426     "extra_time",
1427     "extra time"
1428   },
1429   {
1430     "switchgate_open",
1431     "switchgate",
1432     "switch gate (open)"
1433   },
1434   {
1435     "switchgate_closed",
1436     "switchgate",
1437     "switch gate (closed)"
1438   },
1439   {
1440     "switchgate_switch_up",
1441     "switchgate_switch",
1442     "switch for switch gate"
1443   },
1444   {
1445     "switchgate_switch_down",
1446     "switchgate_switch",
1447     "switch for switch gate"
1448   },
1449   {
1450     "unused_269",
1451     "unused",
1452     "-"
1453   },
1454   {
1455     "unused_270",
1456     "unused",
1457     "-"
1458   },
1459   {
1460     "conveyor_belt_1_left",
1461     "conveyor_belt",
1462     "red conveyor belt (left)"
1463   },
1464   {
1465     "conveyor_belt_1_middle",
1466     "conveyor_belt",
1467     "red conveyor belt (middle)"
1468   },
1469   {
1470     "conveyor_belt_1_right",
1471     "conveyor_belt",
1472     "red conveyor belt (right)"
1473   },
1474   {
1475     "conveyor_belt_1_switch_left",
1476     "conveyor_belt_switch",
1477     "switch for red conveyor belt (left)"
1478   },
1479   {
1480     "conveyor_belt_1_switch_middle",
1481     "conveyor_belt_switch",
1482     "switch for red conveyor belt (middle)"
1483   },
1484   {
1485     "conveyor_belt_1_switch_right",
1486     "conveyor_belt_switch",
1487     "switch for red conveyor belt (right)"
1488   },
1489   {
1490     "conveyor_belt_2_left",
1491     "conveyor_belt",
1492     "yellow conveyor belt (left)"
1493   },
1494   {
1495     "conveyor_belt_2_middle",
1496     "conveyor_belt",
1497     "yellow conveyor belt (middle)"
1498   },
1499   {
1500     "conveyor_belt_2_right",
1501     "conveyor_belt",
1502     "yellow conveyor belt (right)"
1503   },
1504   {
1505     "conveyor_belt_2_switch_left",
1506     "conveyor_belt_switch",
1507     "switch for yellow conveyor belt (left)"
1508   },
1509   {
1510     "conveyor_belt_2_switch_middle",
1511     "conveyor_belt_switch",
1512     "switch for yellow conveyor belt (middle)"
1513   },
1514   {
1515     "conveyor_belt_2_switch_right",
1516     "conveyor_belt_switch",
1517     "switch for yellow conveyor belt (right)"
1518   },
1519   {
1520     "conveyor_belt_3_left",
1521     "conveyor_belt",
1522     "green conveyor belt (left)"
1523   },
1524   {
1525     "conveyor_belt_3_middle",
1526     "conveyor_belt",
1527     "green conveyor belt (middle)"
1528   },
1529   {
1530     "conveyor_belt_3_right",
1531     "conveyor_belt",
1532     "green conveyor belt (right)"
1533   },
1534   {
1535     "conveyor_belt_3_switch_left",
1536     "conveyor_belt_switch",
1537     "switch for green conveyor belt (left)"
1538   },
1539   {
1540     "conveyor_belt_3_switch_middle",
1541     "conveyor_belt_switch",
1542     "switch for green conveyor belt (middle)"
1543   },
1544   {
1545     "conveyor_belt_3_switch_right",
1546     "conveyor_belt_switch",
1547     "switch for green conveyor belt (right)"
1548   },
1549   {
1550     "conveyor_belt_4_left",
1551     "conveyor_belt",
1552     "blue conveyor belt (left)"
1553   },
1554   {
1555     "conveyor_belt_4_middle",
1556     "conveyor_belt",
1557     "blue conveyor belt (middle)"
1558   },
1559   {
1560     "conveyor_belt_4_right",
1561     "conveyor_belt",
1562     "blue conveyor belt (right)"
1563   },
1564   {
1565     "conveyor_belt_4_switch_left",
1566     "conveyor_belt_switch",
1567     "switch for blue conveyor belt (left)"
1568   },
1569   {
1570     "conveyor_belt_4_switch_middle",
1571     "conveyor_belt_switch",
1572     "switch for blue conveyor belt (middle)"
1573   },
1574   {
1575     "conveyor_belt_4_switch_right",
1576     "conveyor_belt_switch",
1577     "switch for blue conveyor belt (right)"
1578   },
1579   {
1580     "landmine",
1581     "sand",
1582     "land mine"
1583   },
1584   {
1585     "envelope",
1586     "envelope",
1587     "mail envelope"
1588   },
1589   {
1590     "light_switch",
1591     "light_switch",
1592     "light switch (off)"
1593   },
1594   {
1595     "light_switch_active",
1596     "light_switch",
1597     "light switch (on)"
1598   },
1599   {
1600     "sign_exclamation",
1601     "wall",
1602     "sign (exclamation)"
1603   },
1604   {
1605     "sign_radioactivity",
1606     "wall",
1607     "sign (radio activity)"
1608   },
1609   {
1610     "sign_stop",
1611     "wall",
1612     "sign (stop)"
1613   },
1614   {
1615     "sign_wheelchair",
1616     "wall",
1617     "sign (wheel chair)"
1618   },
1619   {
1620     "sign_parking",
1621     "wall",
1622     "sign (parking)"
1623   },
1624   {
1625     "sign_oneway",
1626     "wall",
1627     "sign (one way)"
1628   },
1629   {
1630     "sign_heart",
1631     "wall",
1632     "sign (heart)"
1633   },
1634   {
1635     "sign_triangle",
1636     "wall",
1637     "sign (triangle)"
1638   },
1639   {
1640     "sign_round",
1641     "wall",
1642     "sign (round)"
1643   },
1644   {
1645     "sign_exit",
1646     "wall",
1647     "sign (exit)"
1648   },
1649   {
1650     "sign_yinyang",
1651     "wall",
1652     "sign (yin yang)"
1653   },
1654   {
1655     "sign_other",
1656     "wall",
1657     "sign (other)"
1658   },
1659   {
1660     "mole_left",
1661     "mole",
1662     "mole (starts moving left)"
1663   },
1664   {
1665     "mole_right",
1666     "mole",
1667     "mole (starts moving right)"
1668   },
1669   {
1670     "mole_up",
1671     "mole",
1672     "mole (starts moving up)"
1673   },
1674   {
1675     "mole_down",
1676     "mole",
1677     "mole (starts moving down)"
1678   },
1679   {
1680     "steelwall_slanted",
1681     "wall",
1682     "steel wall (slanted)"
1683   },
1684   {
1685     "invisible_sand",
1686     "sand",
1687     "invisible sand"
1688   },
1689   {
1690     "dx_unknown_15",
1691     "unknown",
1692     "dx unknown element 15"
1693   },
1694   {
1695     "dx_unknown_42",
1696     "unknown",
1697     "dx unknown element 42"
1698   },
1699   {
1700     "unused_319",
1701     "unused",
1702     "(not used)"
1703   },
1704   {
1705     "unused_320",
1706     "unused",
1707     "(not used)"
1708   },
1709   {
1710     "shield_deadly",
1711     "shield_deadly",
1712     "shield (deadly, kills enemies)"
1713   },
1714   {
1715     "timegate_open",
1716     "timegate",
1717     "time gate (open)"
1718   },
1719   {
1720     "timegate_closed",
1721     "timegate",
1722     "time gate (closed)"
1723   },
1724   {
1725     "timegate_switch_active",
1726     "timegate_switch",
1727     "switch for time gate"
1728   },
1729   {
1730     "timegate_switch",
1731     "timegate_switch",
1732     "switch for time gate"
1733   },
1734   {
1735     "balloon",
1736     "balloon",
1737     "balloon"
1738   },
1739   {
1740     "balloon_switch_left",
1741     "balloon_switch",
1742     "send balloon to the left"
1743   },
1744   {
1745     "balloon_switch_right",
1746     "balloon_switch",
1747     "send balloon to the right"
1748   },
1749   {
1750     "balloon_switch_up",
1751     "balloon_switch",
1752     "send balloon up"
1753   },
1754   {
1755     "balloon_switch_down",
1756     "balloon_switch",
1757     "send balloon down"
1758   },
1759   {
1760     "balloon_switch_any",
1761     "balloon_switch",
1762     "send balloon in any direction"
1763   },
1764   {
1765     "emc_steelwall_1",
1766     "wall",
1767     "steel wall"
1768   },
1769   {
1770     "emc_steelwall_2",
1771     "wall",
1772     "steel wall"
1773   },
1774   {
1775     "emc_steelwall_3",
1776     "wall",
1777     "steel wall"
1778   },
1779   {
1780     "emc_steelwall_4",
1781     "wall",
1782     "steel wall"
1783   },
1784   {
1785     "emc_wall_1",
1786     "wall",
1787     "normal wall"
1788   },
1789   {
1790     "emc_wall_2",
1791     "wall",
1792     "normal wall"
1793   },
1794   {
1795     "emc_wall_3",
1796     "wall",
1797     "normal wall"
1798   },
1799   {
1800     "emc_wall_4",
1801     "wall",
1802     "normal wall"
1803   },
1804   {
1805     "emc_wall_5",
1806     "wall",
1807     "normal wall"
1808   },
1809   {
1810     "emc_wall_6",
1811     "wall",
1812     "normal wall"
1813   },
1814   {
1815     "emc_wall_7",
1816     "wall",
1817     "normal wall"
1818   },
1819   {
1820     "emc_wall_8",
1821     "wall",
1822     "normal wall"
1823   },
1824   {
1825     "tube_any",
1826     "tube",
1827     "tube (any direction)"
1828   },
1829   {
1830     "tube_vertical",
1831     "tube",
1832     "tube (vertical)"
1833   },
1834   {
1835     "tube_horizontal",
1836     "tube",
1837     "tube (horizontal)"
1838   },
1839   {
1840     "tube_vertical_left",
1841     "tube",
1842     "tube (vertical & left)"
1843   },
1844   {
1845     "tube_vertical_right",
1846     "tube",
1847     "tube (vertical & right)"
1848   },
1849   {
1850     "tube_horizontal_up",
1851     "tube",
1852     "tube (horizontal & up)"
1853   },
1854   {
1855     "tube_horizontal_down",
1856     "tube",
1857     "tube (horizontal & down)"
1858   },
1859   {
1860     "tube_left_up",
1861     "tube",
1862     "tube (left & up)"
1863   },
1864   {
1865     "tube_left_down",
1866     "tube",
1867     "tube (left & down)"
1868   },
1869   {
1870     "tube_right_up",
1871     "tube",
1872     "tube (right & up)"
1873   },
1874   {
1875     "tube_right_down",
1876     "tube",
1877     "tube (right & down)"
1878   },
1879   {
1880     "spring",
1881     "spring",
1882     "spring"
1883   },
1884   {
1885     "trap",
1886     "trap",
1887     "trap"
1888   },
1889   {
1890     "dx_supabomb",
1891     "bomb",
1892     "stable bomb (DX style)"
1893   },
1894   {
1895     "unused_358",
1896     "unused",
1897     "-"
1898   },
1899   {
1900     "unused_359",
1901     "unused",
1902     "-"
1903   },
1904   {
1905     "custom_1",
1906     "custom",
1907     "custom element 1"
1908   },
1909   {
1910     "custom_2",
1911     "custom",
1912     "custom element 2"
1913   },
1914   {
1915     "custom_3",
1916     "custom",
1917     "custom element 3"
1918   },
1919   {
1920     "custom_4",
1921     "custom",
1922     "custom element 4"
1923   },
1924   {
1925     "custom_5",
1926     "custom",
1927     "custom element 5"
1928   },
1929   {
1930     "custom_6",
1931     "custom",
1932     "custom element 6"
1933   },
1934   {
1935     "custom_7",
1936     "custom",
1937     "custom element 7"
1938   },
1939   {
1940     "custom_8",
1941     "custom",
1942     "custom element 8"
1943   },
1944   {
1945     "custom_9",
1946     "custom",
1947     "custom element 9"
1948   },
1949   {
1950     "custom_10",
1951     "custom",
1952     "custom element 10"
1953   },
1954   {
1955     "custom_11",
1956     "custom",
1957     "custom element 11"
1958   },
1959   {
1960     "custom_12",
1961     "custom",
1962     "custom element 12"
1963   },
1964   {
1965     "custom_13",
1966     "custom",
1967     "custom element 13"
1968   },
1969   {
1970     "custom_14",
1971     "custom",
1972     "custom element 14"
1973   },
1974   {
1975     "custom_15",
1976     "custom",
1977     "custom element 15"
1978   },
1979   {
1980     "custom_16",
1981     "custom",
1982     "custom element 16"
1983   },
1984   {
1985     "custom_17",
1986     "custom",
1987     "custom element 17"
1988   },
1989   {
1990     "custom_18",
1991     "custom",
1992     "custom element 18"
1993   },
1994   {
1995     "custom_19",
1996     "custom",
1997     "custom element 19"
1998   },
1999   {
2000     "custom_20",
2001     "custom",
2002     "custom element 20"
2003   },
2004   {
2005     "custom_21",
2006     "custom",
2007     "custom element 21"
2008   },
2009   {
2010     "custom_22",
2011     "custom",
2012     "custom element 22"
2013   },
2014   {
2015     "custom_23",
2016     "custom",
2017     "custom element 23"
2018   },
2019   {
2020     "custom_24",
2021     "custom",
2022     "custom element 24"
2023   },
2024   {
2025     "custom_25",
2026     "custom",
2027     "custom element 25"
2028   },
2029   {
2030     "custom_26",
2031     "custom",
2032     "custom element 26"
2033   },
2034   {
2035     "custom_27",
2036     "custom",
2037     "custom element 27"
2038   },
2039   {
2040     "custom_28",
2041     "custom",
2042     "custom element 28"
2043   },
2044   {
2045     "custom_29",
2046     "custom",
2047     "custom element 29"
2048   },
2049   {
2050     "custom_30",
2051     "custom",
2052     "custom element 30"
2053   },
2054   {
2055     "custom_31",
2056     "custom",
2057     "custom element 31"
2058   },
2059   {
2060     "custom_32",
2061     "custom",
2062     "custom element 32"
2063   },
2064   {
2065     "custom_33",
2066     "custom",
2067     "custom element 33"
2068   },
2069   {
2070     "custom_34",
2071     "custom",
2072     "custom element 34"
2073   },
2074   {
2075     "custom_35",
2076     "custom",
2077     "custom element 35"
2078   },
2079   {
2080     "custom_36",
2081     "custom",
2082     "custom element 36"
2083   },
2084   {
2085     "custom_37",
2086     "custom",
2087     "custom element 37"
2088   },
2089   {
2090     "custom_38",
2091     "custom",
2092     "custom element 38"
2093   },
2094   {
2095     "custom_39",
2096     "custom",
2097     "custom element 39"
2098   },
2099   {
2100     "custom_40",
2101     "custom",
2102     "custom element 40"
2103   },
2104   {
2105     "custom_41",
2106     "custom",
2107     "custom element 41"
2108   },
2109   {
2110     "custom_42",
2111     "custom",
2112     "custom element 42"
2113   },
2114   {
2115     "custom_43",
2116     "custom",
2117     "custom element 43"
2118   },
2119   {
2120     "custom_44",
2121     "custom",
2122     "custom element 44"
2123   },
2124   {
2125     "custom_45",
2126     "custom",
2127     "custom element 45"
2128   },
2129   {
2130     "custom_46",
2131     "custom",
2132     "custom element 46"
2133   },
2134   {
2135     "custom_47",
2136     "custom",
2137     "custom element 47"
2138   },
2139   {
2140     "custom_48",
2141     "custom",
2142     "custom element 48"
2143   },
2144   {
2145     "custom_49",
2146     "custom",
2147     "custom element 49"
2148   },
2149   {
2150     "custom_50",
2151     "custom",
2152     "custom element 50"
2153   },
2154   {
2155     "custom_51",
2156     "custom",
2157     "custom element 51"
2158   },
2159   {
2160     "custom_52",
2161     "custom",
2162     "custom element 52"
2163   },
2164   {
2165     "custom_53",
2166     "custom",
2167     "custom element 53"
2168   },
2169   {
2170     "custom_54",
2171     "custom",
2172     "custom element 54"
2173   },
2174   {
2175     "custom_55",
2176     "custom",
2177     "custom element 55"
2178   },
2179   {
2180     "custom_56",
2181     "custom",
2182     "custom element 56"
2183   },
2184   {
2185     "custom_57",
2186     "custom",
2187     "custom element 57"
2188   },
2189   {
2190     "custom_58",
2191     "custom",
2192     "custom element 58"
2193   },
2194   {
2195     "custom_59",
2196     "custom",
2197     "custom element 59"
2198   },
2199   {
2200     "custom_60",
2201     "custom",
2202     "custom element 60"
2203   },
2204   {
2205     "custom_61",
2206     "custom",
2207     "custom element 61"
2208   },
2209   {
2210     "custom_62",
2211     "custom",
2212     "custom element 62"
2213   },
2214   {
2215     "custom_63",
2216     "custom",
2217     "custom element 63"
2218   },
2219   {
2220     "custom_64",
2221     "custom",
2222     "custom element 64"
2223   },
2224   {
2225     "custom_65",
2226     "custom",
2227     "custom element 65"
2228   },
2229   {
2230     "custom_66",
2231     "custom",
2232     "custom element 66"
2233   },
2234   {
2235     "custom_67",
2236     "custom",
2237     "custom element 67"
2238   },
2239   {
2240     "custom_68",
2241     "custom",
2242     "custom element 68"
2243   },
2244   {
2245     "custom_69",
2246     "custom",
2247     "custom element 69"
2248   },
2249   {
2250     "custom_70",
2251     "custom",
2252     "custom element 70"
2253   },
2254   {
2255     "custom_71",
2256     "custom",
2257     "custom element 71"
2258   },
2259   {
2260     "custom_72",
2261     "custom",
2262     "custom element 72"
2263   },
2264   {
2265     "custom_73",
2266     "custom",
2267     "custom element 73"
2268   },
2269   {
2270     "custom_74",
2271     "custom",
2272     "custom element 74"
2273   },
2274   {
2275     "custom_75",
2276     "custom",
2277     "custom element 75"
2278   },
2279   {
2280     "custom_76",
2281     "custom",
2282     "custom element 76"
2283   },
2284   {
2285     "custom_77",
2286     "custom",
2287     "custom element 77"
2288   },
2289   {
2290     "custom_78",
2291     "custom",
2292     "custom element 78"
2293   },
2294   {
2295     "custom_79",
2296     "custom",
2297     "custom element 79"
2298   },
2299   {
2300     "custom_80",
2301     "custom",
2302     "custom element 80"
2303   },
2304   {
2305     "custom_81",
2306     "custom",
2307     "custom element 81"
2308   },
2309   {
2310     "custom_82",
2311     "custom",
2312     "custom element 82"
2313   },
2314   {
2315     "custom_83",
2316     "custom",
2317     "custom element 83"
2318   },
2319   {
2320     "custom_84",
2321     "custom",
2322     "custom element 84"
2323   },
2324   {
2325     "custom_85",
2326     "custom",
2327     "custom element 85"
2328   },
2329   {
2330     "custom_86",
2331     "custom",
2332     "custom element 86"
2333   },
2334   {
2335     "custom_87",
2336     "custom",
2337     "custom element 87"
2338   },
2339   {
2340     "custom_88",
2341     "custom",
2342     "custom element 88"
2343   },
2344   {
2345     "custom_89",
2346     "custom",
2347     "custom element 89"
2348   },
2349   {
2350     "custom_90",
2351     "custom",
2352     "custom element 90"
2353   },
2354   {
2355     "custom_91",
2356     "custom",
2357     "custom element 91"
2358   },
2359   {
2360     "custom_92",
2361     "custom",
2362     "custom element 92"
2363   },
2364   {
2365     "custom_93",
2366     "custom",
2367     "custom element 93"
2368   },
2369   {
2370     "custom_94",
2371     "custom",
2372     "custom element 94"
2373   },
2374   {
2375     "custom_95",
2376     "custom",
2377     "custom element 95"
2378   },
2379   {
2380     "custom_96",
2381     "custom",
2382     "custom element 96"
2383   },
2384   {
2385     "custom_97",
2386     "custom",
2387     "custom element 97"
2388   },
2389   {
2390     "custom_98",
2391     "custom",
2392     "custom element 98"
2393   },
2394   {
2395     "custom_99",
2396     "custom",
2397     "custom element 99"
2398   },
2399   {
2400     "custom_100",
2401     "custom",
2402     "custom element 100"
2403   },
2404   {
2405     "custom_101",
2406     "custom",
2407     "custom element 101"
2408   },
2409   {
2410     "custom_102",
2411     "custom",
2412     "custom element 102"
2413   },
2414   {
2415     "custom_103",
2416     "custom",
2417     "custom element 103"
2418   },
2419   {
2420     "custom_104",
2421     "custom",
2422     "custom element 104"
2423   },
2424   {
2425     "custom_105",
2426     "custom",
2427     "custom element 105"
2428   },
2429   {
2430     "custom_106",
2431     "custom",
2432     "custom element 106"
2433   },
2434   {
2435     "custom_107",
2436     "custom",
2437     "custom element 107"
2438   },
2439   {
2440     "custom_108",
2441     "custom",
2442     "custom element 108"
2443   },
2444   {
2445     "custom_109",
2446     "custom",
2447     "custom element 109"
2448   },
2449   {
2450     "custom_110",
2451     "custom",
2452     "custom element 110"
2453   },
2454   {
2455     "custom_111",
2456     "custom",
2457     "custom element 111"
2458   },
2459   {
2460     "custom_112",
2461     "custom",
2462     "custom element 112"
2463   },
2464   {
2465     "custom_113",
2466     "custom",
2467     "custom element 113"
2468   },
2469   {
2470     "custom_114",
2471     "custom",
2472     "custom element 114"
2473   },
2474   {
2475     "custom_115",
2476     "custom",
2477     "custom element 115"
2478   },
2479   {
2480     "custom_116",
2481     "custom",
2482     "custom element 116"
2483   },
2484   {
2485     "custom_117",
2486     "custom",
2487     "custom element 117"
2488   },
2489   {
2490     "custom_118",
2491     "custom",
2492     "custom element 118"
2493   },
2494   {
2495     "custom_119",
2496     "custom",
2497     "custom element 119"
2498   },
2499   {
2500     "custom_120",
2501     "custom",
2502     "custom element 120"
2503   },
2504   {
2505     "custom_121",
2506     "custom",
2507     "custom element 121"
2508   },
2509   {
2510     "custom_122",
2511     "custom",
2512     "custom element 122"
2513   },
2514   {
2515     "custom_123",
2516     "custom",
2517     "custom element 123"
2518   },
2519   {
2520     "custom_124",
2521     "custom",
2522     "custom element 124"
2523   },
2524   {
2525     "custom_125",
2526     "custom",
2527     "custom element 125"
2528   },
2529   {
2530     "custom_126",
2531     "custom",
2532     "custom element 126"
2533   },
2534   {
2535     "custom_127",
2536     "custom",
2537     "custom element 127"
2538   },
2539   {
2540     "custom_128",
2541     "custom",
2542     "custom element 128"
2543   },
2544
2545   /* ----------------------------------------------------------------------- */
2546   /* "real" (and therefore drawable) runtime elements                        */
2547   /* ----------------------------------------------------------------------- */
2548
2549   {
2550     "em_key_1",
2551     "key",
2552     "-"
2553     },
2554   {
2555     "em_key_2",
2556     "key",
2557     "-"
2558     },
2559   {
2560     "em_key_3",
2561     "key",
2562     "-"
2563   },
2564   {
2565     "em_key_4",
2566     "key",
2567     "-"
2568   },
2569   {
2570     "dynabomb_player_1_active",
2571     "dynabomb",
2572     "-"
2573   },
2574   {
2575     "dynabomb_player_2_active",
2576     "dynabomb",
2577     "-"
2578   },
2579   {
2580     "dynabomb_player_3_active",
2581     "dynabomb",
2582     "-"
2583   },
2584   {
2585     "dynabomb_player_4_active",
2586     "dynabomb",
2587     "-"
2588   },
2589   {
2590     "sp_disk_red_active",
2591     "dynamite",
2592     "-"
2593   },
2594   {
2595     "switchgate_opening",
2596     "switchgate",
2597     "-"
2598   },
2599   {
2600     "switchgate_closing",
2601     "switchgate",
2602     "-"
2603   },
2604   {
2605     "timegate_opening",
2606     "timegate",
2607     "-"
2608   },
2609   {
2610     "timegate_closing",
2611     "timegate",
2612     "-"
2613   },
2614   {
2615     "pearl_breaking",
2616     "pearl",
2617     "-"
2618   },
2619   {
2620     "trap_active",
2621     "trap",
2622     "-"
2623   },
2624   {
2625     "invisible_steelwall_active",
2626     "wall",
2627     "-"
2628   },
2629   {
2630     "invisible_wall_active",
2631     "wall",
2632     "-"
2633   },
2634   {
2635     "invisible_sand_active",
2636     "sand",
2637     "-"
2638   },
2639   {
2640     "conveyor_belt_1_left_active",
2641     "conveyor_belt",
2642     "-"
2643   },
2644   {
2645     "conveyor_belt_1_middle_active",
2646     "conveyor_belt",
2647     "-"
2648   },
2649   {
2650     "conveyor_belt_1_right_active",
2651     "conveyor_belt",
2652     "-"
2653   },
2654   {
2655     "conveyor_belt_2_left_active",
2656     "conveyor_belt",
2657     "-"
2658   },
2659   {
2660     "conveyor_belt_2_middle_active",
2661     "conveyor_belt",
2662     "-"
2663   },
2664   {
2665     "conveyor_belt_2_right_active",
2666     "conveyor_belt",
2667     "-"
2668   },
2669   {
2670     "conveyor_belt_3_left_active",
2671     "conveyor_belt",
2672     "-"
2673   },
2674   {
2675     "conveyor_belt_3_middle_active",
2676     "conveyor_belt",
2677     "-"
2678   },
2679   {
2680     "conveyor_belt_3_right_active",
2681     "conveyor_belt",
2682     "-"
2683   },
2684   {
2685     "conveyor_belt_4_left_active",
2686     "conveyor_belt",
2687     "-"
2688   },
2689   {
2690     "conveyor_belt_4_middle_active",
2691     "conveyor_belt",
2692     "-"
2693   },
2694   {
2695     "conveyor_belt_4_right_active",
2696     "conveyor_belt",
2697     "-"
2698   },
2699   {
2700     "exit_opening",
2701     "exit",
2702     "-"
2703   },
2704   {
2705     "sp_exit_open",
2706     "sp_exit",
2707     "-"
2708   },
2709   {
2710     "sp_terminal_active",
2711     "sp_terminal",
2712     "-"
2713   },
2714   {
2715     "sp_buggy_base_activating",
2716     "sp_buggy_base",
2717     "-"
2718   },
2719   {
2720     "sp_buggy_base_active",
2721     "sp_buggy_base",
2722     "-"
2723   },
2724   {
2725     "sp_murphy_clone",
2726     "murphy_clone",
2727     "-"
2728   },
2729   {
2730     "amoeba_dropping",
2731     "amoeba",
2732     "-"
2733   },
2734   {
2735     "quicksand_emptying",
2736     "quicksand",
2737     "-"
2738   },
2739   {
2740     "magic_wall_active",
2741     "magic_wall",
2742     "-"
2743   },
2744   {
2745     "bd_magic_wall_active",
2746     "magic_wall",
2747     "-"
2748   },
2749   {
2750     "magic_wall_full",
2751     "magic_wall",
2752     "-"
2753   },
2754   {
2755     "bd_magic_wall_full",
2756     "magic_wall",
2757     "-"
2758   },
2759   {
2760     "magic_wall_emptying",
2761     "magic_wall",
2762     "-"
2763   },
2764   {
2765     "bd_magic_wall_emptying",
2766     "magic_wall",
2767     "-"
2768   },
2769   {
2770     "magic_wall_dead",
2771     "magic_wall",
2772     "-"
2773   },
2774   {
2775     "bd_magic_wall_dead",
2776     "magic_wall",
2777     "-"
2778   },
2779
2780   /* ----------------------------------------------------------------------- */
2781   /* "unreal" (and therefore not drawable) runtime elements                  */
2782   /* ----------------------------------------------------------------------- */
2783
2784   {
2785     "blocked",
2786     "-",
2787     "-"
2788   },
2789   {
2790     "explosion",
2791     "-",
2792     "-"
2793   },
2794   {
2795     "nut_breaking",
2796     "-",
2797     "-"
2798   },
2799   {
2800     "acid_splash_left",
2801     "-",
2802     "-"
2803   },
2804   {
2805     "acid_splash_right",
2806     "-",
2807     "-"
2808   },
2809   {
2810     "amoeba_growing",
2811     "-",
2812     "-"
2813   },
2814   {
2815     "amoeba_shrinking",
2816     "-",
2817     "-"
2818   },
2819   {
2820     "expandable_wall_growing",
2821     "-",
2822     "-"
2823   },
2824   {
2825     "flames",
2826     "-",
2827     "-"
2828   },
2829   {
2830     "player_is_leaving",
2831     "-",
2832     "-"
2833   },
2834   {
2835     "quicksand_filling",
2836     "quicksand",
2837     "-"
2838   },
2839   {
2840     "magic_wall_filling",
2841     "-",
2842     "-"
2843   },
2844   {
2845     "bd_magic_wall_filling",
2846     "-",
2847     "-"
2848   },
2849
2850   /* ----------------------------------------------------------------------- */
2851   /* dummy elements (never used as game elements, only used as graphics)     */
2852   /* ----------------------------------------------------------------------- */
2853
2854   {
2855     "steelwall_topleft",
2856     "-",
2857     "-"
2858   },
2859   {
2860     "steelwall_topright",
2861     "-",
2862     "-"
2863   },
2864   {
2865     "steelwall_bottomleft",
2866     "-",
2867     "-"
2868   },
2869   {
2870     "steelwall_bottomright",
2871     "-",
2872     "-"
2873   },
2874   {
2875     "steelwall_horizontal",
2876     "-",
2877     "-"
2878   },
2879   {
2880     "steelwall_vertical",
2881     "-",
2882     "-"
2883   },
2884   {
2885     "invisible_steelwall_topleft",
2886     "-",
2887     "-"
2888   },
2889   {
2890     "invisible_steelwall_topright",
2891     "-",
2892     "-"
2893   },
2894   {
2895     "invisible_steelwall_bottomleft",
2896     "-",
2897     "-"
2898   },
2899   {
2900     "invisible_steelwall_bottomright",
2901     "-",
2902     "-"
2903   },
2904   {
2905     "invisible_steelwall_horizontal",
2906     "-",
2907     "-"
2908   },
2909   {
2910     "invisible_steelwall_vertical",
2911     "-",
2912     "-"
2913   },
2914   {
2915     "sand_crumbled",
2916     "-",
2917     "-"
2918   },
2919   {
2920     "dynabomb_active",
2921     "-",
2922     "-"
2923   },
2924   {
2925     "shield_normal_active",
2926     "-",
2927     "-"
2928   },
2929   {
2930     "shield_deadly_active",
2931     "-",
2932     "-"
2933   },
2934
2935   /* keyword to stop parser: "ELEMENT_INFO_END" <-- do not change! */
2936
2937   {
2938     NULL,
2939     NULL,
2940     NULL
2941   }
2942 };
2943
2944
2945 /* ------------------------------------------------------------------------- */
2946 /* element action and direction definitions                                  */
2947 /* ------------------------------------------------------------------------- */
2948
2949 struct ElementActionInfo element_action_info[NUM_ACTIONS + 1] =
2950 {
2951   { ".[DEFAULT]",       ACTION_DEFAULT,         TRUE    },
2952   { ".waiting",         ACTION_WAITING,         TRUE    },
2953   { ".falling",         ACTION_FALLING,         TRUE    },
2954   { ".moving",          ACTION_MOVING,          TRUE    },
2955   { ".digging",         ACTION_DIGGING,         FALSE   },
2956   { ".snapping",        ACTION_SNAPPING,        FALSE   },
2957   { ".collecting",      ACTION_COLLECTING,      FALSE   },
2958   { ".dropping",        ACTION_DROPPING,        FALSE   },
2959   { ".pushing",         ACTION_PUSHING,         FALSE   },
2960   { ".passing",         ACTION_PASSING,         FALSE   },
2961   { ".impact",          ACTION_IMPACT,          FALSE   },
2962   { ".breaking",        ACTION_BREAKING,        FALSE   },
2963   { ".activating",      ACTION_ACTIVATING,      FALSE   },
2964   { ".deactivating",    ACTION_DEACTIVATING,    FALSE   },
2965   { ".opening",         ACTION_OPENING,         FALSE   },
2966   { ".closing",         ACTION_CLOSING,         FALSE   },
2967   { ".attacking",       ACTION_ATTACKING,       TRUE    },
2968   { ".growing",         ACTION_GROWING,         TRUE    },
2969   { ".shrinking",       ACTION_SHRINKING,       FALSE   },
2970   { ".active",          ACTION_ACTIVE,          TRUE    },
2971   { ".filling",         ACTION_FILLING,         FALSE   },
2972   { ".emptying",        ACTION_EMPTYING,        FALSE   },
2973   { ".changing",        ACTION_CHANGING,        FALSE   },
2974   { ".exploding",       ACTION_EXPLODING,       FALSE   },
2975   { ".dying",           ACTION_DYING,           FALSE   },
2976   { ".other",           ACTION_OTHER,           FALSE   },
2977
2978   { NULL,               0,                      0       }
2979 };
2980
2981 struct ElementDirectionInfo element_direction_info[NUM_DIRECTIONS + 1] =
2982 {
2983   { ".left",            MV_BIT_LEFT                     },
2984   { ".right",           MV_BIT_RIGHT                    },
2985   { ".up",              MV_BIT_UP                       },
2986   { ".down",            MV_BIT_DOWN                     },
2987
2988   { NULL,               0                               }
2989 };
2990
2991 struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1] =
2992 {
2993   { ".MAIN",            GAME_MODE_MAIN,                 },
2994   { ".LEVELS",          GAME_MODE_LEVELS                },
2995   { ".SCORES",          GAME_MODE_SCORES,               },
2996   { ".EDITOR",          GAME_MODE_EDITOR,               },
2997   { ".INFO",            GAME_MODE_INFO,                 },
2998   { ".SETUP",           GAME_MODE_SETUP,                },
2999   { ".DOOR",            GAME_MODE_PSEUDO_DOOR,          },
3000   { ".PREVIEW",         GAME_MODE_PSEUDO_PREVIEW,       },
3001
3002   { NULL,               0,                              }
3003 };
3004
3005 struct TokenIntPtrInfo image_config_vars[] =
3006 {
3007   { "global.num_toons",         &global.num_toons                          },
3008   { "menu.draw_xoffset",        &menu.draw_xoffset_default                 },
3009   { "menu.draw_yoffset",        &menu.draw_yoffset_default                 },
3010   { "menu.draw_xoffset.MAIN",   &menu.draw_xoffset[GFX_SPECIAL_ARG_MAIN]   },
3011   { "menu.draw_yoffset.MAIN",   &menu.draw_yoffset[GFX_SPECIAL_ARG_MAIN]   },
3012   { "menu.draw_xoffset.LEVELS", &menu.draw_xoffset[GFX_SPECIAL_ARG_LEVELS] },
3013   { "menu.draw_yoffset.LEVELS", &menu.draw_yoffset[GFX_SPECIAL_ARG_LEVELS] },
3014   { "menu.draw_xoffset.SCORES", &menu.draw_xoffset[GFX_SPECIAL_ARG_SCORES] },
3015   { "menu.draw_yoffset.SCORES", &menu.draw_yoffset[GFX_SPECIAL_ARG_SCORES] },
3016   { "menu.draw_xoffset.EDITOR", &menu.draw_xoffset[GFX_SPECIAL_ARG_EDITOR] },
3017   { "menu.draw_yoffset.EDITOR", &menu.draw_yoffset[GFX_SPECIAL_ARG_EDITOR] },
3018   { "menu.draw_xoffset.INFO",   &menu.draw_xoffset[GFX_SPECIAL_ARG_INFO]   },
3019   { "menu.draw_yoffset.INFO",   &menu.draw_yoffset[GFX_SPECIAL_ARG_INFO]   },
3020   { "menu.draw_xoffset.SETUP",  &menu.draw_xoffset[GFX_SPECIAL_ARG_SETUP]  },
3021   { "menu.draw_yoffset.SETUP",  &menu.draw_yoffset[GFX_SPECIAL_ARG_SETUP]  },
3022   { "door.step_offset",         &door.step_offset                          },
3023   { "door.step_delay",          &door.step_delay                           },
3024
3025   { NULL,                       NULL,                                      }
3026 };
3027
3028
3029 /* ------------------------------------------------------------------------- */
3030 /* font definitions                                                          */
3031 /* ------------------------------------------------------------------------- */
3032
3033 /* Important: When one entry is a prefix of another entry, the longer entry
3034    must come first, because the dynamic configuration does prefix matching! */
3035
3036 struct FontInfo font_info[NUM_FONTS + 1] =
3037 {
3038   { "font.initial_1"            },
3039   { "font.initial_2"            },
3040   { "font.initial_3"            },
3041   { "font.initial_4"            },
3042   { "font.title_1"              },
3043   { "font.title_2"              },
3044   { "font.menu_1"               },
3045   { "font.menu_2"               },
3046   { "font.text_1.active"        },
3047   { "font.text_2.active"        },
3048   { "font.text_3.active"        },
3049   { "font.text_4.active"        },
3050   { "font.text_1"               },
3051   { "font.text_2"               },
3052   { "font.text_3"               },
3053   { "font.text_4"               },
3054   { "font.input_1.active"       },
3055   { "font.input_2.active"       },
3056   { "font.input_1"              },
3057   { "font.input_2"              },
3058   { "font.option_off"           },
3059   { "font.option_on"            },
3060   { "font.value_1"              },
3061   { "font.value_2"              },
3062   { "font.value_old"            },
3063   { "font.level_number"         },
3064   { "font.tape_recorder"        },
3065   { "font.game_info"            },
3066 };
3067
3068
3069 /* ========================================================================= */
3070 /* main()                                                                    */
3071 /* ========================================================================= */
3072
3073 int main(int argc, char *argv[])
3074 {
3075   InitProgramInfo(argv[0], USERDATA_DIRECTORY,
3076                   PROGRAM_TITLE_STRING, getWindowTitleString(),
3077                   ICON_TITLE_STRING, X11_ICON_FILENAME, X11_ICONMASK_FILENAME,
3078                   MSDOS_POINTER_FILENAME,
3079                   COOKIE_PREFIX, FILENAME_PREFIX, GAME_VERSION_ACTUAL);
3080
3081   InitExitFunction(CloseAllAndExit);
3082   InitPlatformDependantStuff();
3083
3084   GetOptions(argv);
3085   OpenAll();
3086
3087   EventLoop();
3088   CloseAllAndExit(0);
3089
3090   return 0;     /* to keep compilers happy */
3091 }