int i, j, x, y;
+ level->native_em_level = &native_em_level;
+
level->game_engine_type = GAME_ENGINE_TYPE_RND;
level->file_version = FILE_VERSION_ACTUAL;
#else
+static int map_element_RND_to_EM(int element_rnd)
+{
+ static unsigned short mapping_RND_to_EM[NUM_FILE_ELEMENTS];
+ static boolean mapping_initialized = FALSE;
+
+ struct
+ {
+ int element_em;
+ int element_rnd;
+ }
+ mapping_RND_to_EM_list[] =
+ {
+ { Xblank, EL_EMPTY },
+ { Xstone, EL_ROCK },
+ { Xnut, EL_NUT },
+ { Xbug_n, EL_BUG_UP },
+ { Xbug_e, EL_BUG_RIGHT },
+ { Xbug_s, EL_BUG_DOWN },
+ { Xbug_w, EL_BUG_LEFT },
+ { Xtank_n, EL_SPACESHIP_UP },
+ { Xtank_e, EL_SPACESHIP_RIGHT },
+ { Xtank_s, EL_SPACESHIP_DOWN },
+ { Xtank_w, EL_SPACESHIP_LEFT },
+ { Xandroid, EL_EMC_ANDROID },
+ { Xandroid_1_n, EL_EMC_ANDROID_UP },
+ { Xandroid_1_e, EL_EMC_ANDROID_RIGHT },
+ { Xandroid_1_w, EL_EMC_ANDROID_LEFT },
+ { Xandroid_1_s, EL_EMC_ANDROID_DOWN },
+ { Xspring, EL_SPRING },
+ { Xeater_n, EL_YAMYAM },
+ { Xalien, EL_ROBOT },
+ { Xemerald, EL_EMERALD },
+ { Xdiamond, EL_DIAMOND },
+ { Xdrip_fall, EL_AMOEBA_DROP },
+ { Xbomb, EL_BOMB },
+ { Xballoon, EL_BALLOON },
+ { Xgrass, EL_EMC_GRASS },
+ { Xdirt, EL_SAND },
+ { Xacid_ne, EL_ACID_POOL_TOPRIGHT },
+ { Xacid_se, EL_ACID_POOL_BOTTOMRIGHT },
+ { Xacid_s, EL_ACID_POOL_BOTTOM },
+ { Xacid_sw, EL_ACID_POOL_BOTTOMLEFT },
+ { Xacid_nw, EL_ACID_POOL_TOPLEFT },
+ { Xacid_1, EL_ACID },
+ { Xball_1, EL_EMC_GENERATOR_BALL },
+ { Xgrow_ns, EL_EMC_GROW },
+ { Xwonderwall, EL_MAGIC_WALL },
+ { Xameuba_1, EL_AMOEBA_WET },
+ { Xdoor_1, EL_EM_GATE_1 },
+ { Xdoor_2, EL_EM_GATE_2 },
+ { Xdoor_3, EL_EM_GATE_3 },
+ { Xdoor_4, EL_EM_GATE_4 },
+ { Xdoor_5, EL_EMC_GATE_5 },
+ { Xdoor_6, EL_EMC_GATE_6 },
+ { Xdoor_7, EL_EMC_GATE_7 },
+ { Xdoor_8, EL_EMC_GATE_8 },
+ { Xkey_1, EL_EM_KEY_1 },
+ { Xkey_2, EL_EM_KEY_2 },
+ { Xkey_3, EL_EM_KEY_3 },
+ { Xkey_4, EL_EM_KEY_4 },
+ { Xkey_5, EL_EMC_KEY_5 },
+ { Xkey_6, EL_EMC_KEY_6 },
+ { Xkey_7, EL_EMC_KEY_7 },
+ { Xkey_8, EL_EMC_KEY_8 },
+ { Xwind_n, EL_BALLOON_SWITCH_UP },
+ { Xwind_e, EL_BALLOON_SWITCH_RIGHT },
+ { Xwind_s, EL_BALLOON_SWITCH_DOWN },
+ { Xwind_w, EL_BALLOON_SWITCH_LEFT },
+ { Xwind_nesw, EL_BALLOON_SWITCH_ANY },
+ { Xwind_stop, EL_BALLOON_SWITCH_NONE },
+ { Xexit, EL_EXIT_CLOSED },
+ { Xexit_1, EL_EXIT_OPEN },
+ { Xdynamite, EL_DYNAMITE },
+ { Xdynamite_1, EL_DYNAMITE_ACTIVE },
+ { Xbumper, EL_EMC_BUMPER },
+ { Xwheel, EL_ROBOT_WHEEL },
+ { Xswitch, EL_UNKNOWN },
+ { Xsand, EL_QUICKSAND_EMPTY },
+ { Xsand_stone, EL_QUICKSAND_FULL },
+ { Xplant, EL_EMC_PLANT },
+ { Xlenses, EL_EMC_LENSES },
+ { Xmagnify, EL_EMC_MAGNIFY },
+ { Xdripper, EL_UNKNOWN },
+ { Xfake_blank, EL_INVISIBLE_WALL },
+ { Xfake_grass, EL_INVISIBLE_SAND },
+ { Xfake_door_1, EL_EM_GATE_1_GRAY },
+ { Xfake_door_2, EL_EM_GATE_2_GRAY },
+ { Xfake_door_3, EL_EM_GATE_3_GRAY },
+ { Xfake_door_4, EL_EM_GATE_4_GRAY },
+ { Xfake_door_5, EL_EMC_GATE_5_GRAY },
+ { Xfake_door_6, EL_EMC_GATE_6_GRAY },
+ { Xfake_door_7, EL_EMC_GATE_7_GRAY },
+ { Xfake_door_8, EL_EMC_GATE_8_GRAY },
+ { Xsteel_1, EL_UNKNOWN },
+ { Xsteel_2, EL_UNKNOWN },
+ { Xsteel_3, EL_UNKNOWN },
+ { Xsteel_4, EL_UNKNOWN },
+ { Xwall_1, EL_UNKNOWN },
+ { Xwall_2, EL_UNKNOWN },
+ { Xwall_3, EL_UNKNOWN },
+ { Xwall_4, EL_UNKNOWN },
+ { Xround_wall_1, EL_UNKNOWN },
+ { Xround_wall_2, EL_UNKNOWN },
+ { Xround_wall_3, EL_UNKNOWN },
+ { Xround_wall_4, EL_UNKNOWN },
+ { Xdecor_1, EL_UNKNOWN },
+ { Xdecor_2, EL_UNKNOWN },
+ { Xdecor_3, EL_UNKNOWN },
+ { Xdecor_4, EL_UNKNOWN },
+ { Xdecor_5, EL_UNKNOWN },
+ { Xdecor_6, EL_UNKNOWN },
+ { Xdecor_7, EL_UNKNOWN },
+ { Xdecor_8, EL_UNKNOWN },
+ { Xdecor_9, EL_UNKNOWN },
+ { Xdecor_10, EL_UNKNOWN },
+ { Xdecor_11, EL_UNKNOWN },
+ { Xdecor_12, EL_UNKNOWN },
+ { Xalpha_0, EL_CHAR('0') },
+ { Xalpha_1, EL_CHAR('1') },
+ { Xalpha_2, EL_CHAR('2') },
+ { Xalpha_3, EL_CHAR('3') },
+ { Xalpha_4, EL_CHAR('4') },
+ { Xalpha_5, EL_CHAR('5') },
+ { Xalpha_6, EL_CHAR('6') },
+ { Xalpha_7, EL_CHAR('7') },
+ { Xalpha_8, EL_CHAR('8') },
+ { Xalpha_9, EL_CHAR('9') },
+ { Xalpha_excla, EL_CHAR('!') },
+ { Xalpha_quote, EL_CHAR('"') },
+ { Xalpha_comma, EL_CHAR(',') },
+ { Xalpha_minus, EL_CHAR('-') },
+ { Xalpha_perio, EL_CHAR('.') },
+ { Xalpha_colon, EL_CHAR(':') },
+ { Xalpha_quest, EL_CHAR('?') },
+ { Xalpha_a, EL_CHAR('A') },
+ { Xalpha_b, EL_CHAR('B') },
+ { Xalpha_c, EL_CHAR('C') },
+ { Xalpha_d, EL_CHAR('D') },
+ { Xalpha_e, EL_CHAR('E') },
+ { Xalpha_f, EL_CHAR('F') },
+ { Xalpha_g, EL_CHAR('G') },
+ { Xalpha_h, EL_CHAR('H') },
+ { Xalpha_i, EL_CHAR('I') },
+ { Xalpha_j, EL_CHAR('J') },
+ { Xalpha_k, EL_CHAR('K') },
+ { Xalpha_l, EL_CHAR('L') },
+ { Xalpha_m, EL_CHAR('M') },
+ { Xalpha_n, EL_CHAR('N') },
+ { Xalpha_o, EL_CHAR('O') },
+ { Xalpha_p, EL_CHAR('P') },
+ { Xalpha_q, EL_CHAR('Q') },
+ { Xalpha_r, EL_CHAR('R') },
+ { Xalpha_s, EL_CHAR('S') },
+ { Xalpha_t, EL_CHAR('T') },
+ { Xalpha_u, EL_CHAR('U') },
+ { Xalpha_v, EL_CHAR('V') },
+ { Xalpha_w, EL_CHAR('W') },
+ { Xalpha_x, EL_CHAR('X') },
+ { Xalpha_y, EL_CHAR('Y') },
+ { Xalpha_z, EL_CHAR('Z') },
+ { Xalpha_arrow_e, EL_CHAR('>') },
+ { Xalpha_arrow_w, EL_CHAR('<') },
+ { Xalpha_copyr, EL_CHAR('©') },
+
+ { Zplayer, EL_PLAYER_1 },
+ { Zplayer, EL_PLAYER_2 },
+ { Zplayer, EL_PLAYER_3 },
+ { Zplayer, EL_PLAYER_4 },
+
+ { ZBORDER, EL_EMC_LEVEL_BORDER },
+
+ { -1, -1 }
+ };
+
+ if (!mapping_initialized)
+ {
+ int i;
+
+ /* return "Xalpha_quest" for all undefined elements in mapping array */
+ for (i = 0; i < NUM_FILE_ELEMENTS; i++)
+ mapping_RND_to_EM[i] = Xalpha_quest;
+
+ for (i = 0; mapping_RND_to_EM_list[i].element_rnd != -1; i++)
+ mapping_RND_to_EM[mapping_RND_to_EM_list[i].element_rnd] =
+ mapping_RND_to_EM_list[i].element_em;
+
+ mapping_initialized = TRUE;
+ }
+
+ if (element_rnd >= 0 && element_rnd < NUM_FILE_ELEMENTS)
+ return mapping_RND_to_EM[element_rnd];
+
+ Error(ERR_WARN, "invalid RND level element %d", element_rnd);
+
+ return EL_UNKNOWN;
+}
+
+static int map_element_EM_to_RND(int element_em)
+{
+ static unsigned short mapping_EM_to_RND[TILE_MAX];
+ static boolean mapping_initialized = FALSE;
+
+ struct
+ {
+ int element_em;
+ int element_rnd;
+ }
+ mapping_EM_to_RND_list[] =
+ {
+ { Xblank, EL_EMPTY },
+ { Yacid_splash_eB, EL_EMPTY },
+ { Yacid_splash_wB, EL_EMPTY },
+
+#ifdef EM_ENGINE_BAD_ROLL
+ { Xstone_force_e, EL_ROCK },
+ { Xstone_force_w, EL_ROCK },
+ { Xnut_force_e, EL_NUT },
+ { Xnut_force_w, EL_NUT },
+ { Xspring_force_e, EL_SPRING },
+ { Xspring_force_w, EL_SPRING },
+ { Xemerald_force_e, EL_EMERALD },
+ { Xemerald_force_w, EL_EMERALD },
+ { Xdiamond_force_e, EL_DIAMOND },
+ { Xdiamond_force_w, EL_DIAMOND },
+ { Xbomb_force_e, EL_BOMB },
+ { Xbomb_force_w, EL_BOMB },
+#endif
+
+ { Xstone, EL_ROCK },
+ { Xstone_pause, EL_ROCK },
+ { Xstone_fall, EL_ROCK },
+ { Ystone_s, EL_ROCK },
+ { Ystone_sB, EL_ROCK },
+ { Ystone_e, EL_ROCK },
+ { Ystone_eB, EL_ROCK },
+ { Ystone_w, EL_ROCK },
+ { Ystone_wB, EL_ROCK },
+ { Xnut, EL_NUT },
+ { Xnut_pause, EL_NUT },
+ { Xnut_fall, EL_NUT },
+ { Ynut_s, EL_NUT },
+ { Ynut_sB, EL_NUT },
+ { Ynut_e, EL_NUT },
+ { Ynut_eB, EL_NUT },
+ { Ynut_w, EL_NUT },
+ { Ynut_wB, EL_NUT },
+ { Xbug_n, EL_BUG_UP },
+ { Xbug_e, EL_BUG_RIGHT },
+ { Xbug_s, EL_BUG_DOWN },
+ { Xbug_w, EL_BUG_LEFT },
+ { Xbug_gon, EL_BUG_UP },
+ { Xbug_goe, EL_BUG_RIGHT },
+ { Xbug_gos, EL_BUG_DOWN },
+ { Xbug_gow, EL_BUG_LEFT },
+ { Ybug_n, EL_BUG_UP },
+ { Ybug_nB, EL_BUG_UP },
+ { Ybug_e, EL_BUG_RIGHT },
+ { Ybug_eB, EL_BUG_RIGHT },
+ { Ybug_s, EL_BUG_DOWN },
+ { Ybug_sB, EL_BUG_DOWN },
+ { Ybug_w, EL_BUG_LEFT },
+ { Ybug_wB, EL_BUG_LEFT },
+ { Ybug_w_n, EL_BUG_UP },
+ { Ybug_n_e, EL_BUG_RIGHT },
+ { Ybug_e_s, EL_BUG_DOWN },
+ { Ybug_s_w, EL_BUG_LEFT },
+ { Ybug_e_n, EL_BUG_UP },
+ { Ybug_s_e, EL_BUG_RIGHT },
+ { Ybug_w_s, EL_BUG_DOWN },
+ { Ybug_n_w, EL_BUG_LEFT },
+ { Ybug_stone, EL_ROCK },
+ { Ybug_spring, EL_SPRING },
+ { Xtank_n, EL_SPACESHIP_UP },
+ { Xtank_e, EL_SPACESHIP_RIGHT },
+ { Xtank_s, EL_SPACESHIP_DOWN },
+ { Xtank_w, EL_SPACESHIP_LEFT },
+ { Xtank_gon, EL_SPACESHIP_UP },
+ { Xtank_goe, EL_SPACESHIP_RIGHT },
+ { Xtank_gos, EL_SPACESHIP_DOWN },
+ { Xtank_gow, EL_SPACESHIP_LEFT },
+ { Ytank_n, EL_SPACESHIP_UP },
+ { Ytank_nB, EL_SPACESHIP_UP },
+ { Ytank_e, EL_SPACESHIP_RIGHT },
+ { Ytank_eB, EL_SPACESHIP_RIGHT },
+ { Ytank_s, EL_SPACESHIP_DOWN },
+ { Ytank_sB, EL_SPACESHIP_DOWN },
+ { Ytank_w, EL_SPACESHIP_LEFT },
+ { Ytank_wB, EL_SPACESHIP_LEFT },
+ { Ytank_w_n, EL_SPACESHIP_UP },
+ { Ytank_n_e, EL_SPACESHIP_RIGHT },
+ { Ytank_e_s, EL_SPACESHIP_DOWN },
+ { Ytank_s_w, EL_SPACESHIP_LEFT },
+ { Ytank_e_n, EL_SPACESHIP_UP },
+ { Ytank_s_e, EL_SPACESHIP_RIGHT },
+ { Ytank_w_s, EL_SPACESHIP_DOWN },
+ { Ytank_n_w, EL_SPACESHIP_LEFT },
+ { Ytank_stone, EL_ROCK },
+ { Ytank_spring, EL_SPRING },
+ { Xandroid, EL_EMC_ANDROID },
+ { Xandroid_1_n, EL_EMC_ANDROID_UP },
+ { Xandroid_2_n, EL_EMC_ANDROID_UP },
+ { Xandroid_1_e, EL_EMC_ANDROID_RIGHT },
+ { Xandroid_2_e, EL_EMC_ANDROID_RIGHT },
+ { Xandroid_1_w, EL_EMC_ANDROID_LEFT },
+ { Xandroid_2_w, EL_EMC_ANDROID_LEFT },
+ { Xandroid_1_s, EL_EMC_ANDROID_DOWN },
+ { Xandroid_2_s, EL_EMC_ANDROID_DOWN },
+ { Yandroid_n, EL_EMC_ANDROID_UP },
+ { Yandroid_nB, EL_EMC_ANDROID_UP },
+ { Yandroid_ne, EL_EMC_ANDROID_RIGHT_UP },
+ { Yandroid_neB, EL_EMC_ANDROID_RIGHT_UP },
+ { Yandroid_e, EL_EMC_ANDROID_RIGHT },
+ { Yandroid_eB, EL_EMC_ANDROID_RIGHT },
+ { Yandroid_se, EL_EMC_ANDROID_RIGHT_DOWN },
+ { Yandroid_seB, EL_EMC_ANDROID_RIGHT_DOWN },
+ { Yandroid_s, EL_EMC_ANDROID_DOWN },
+ { Yandroid_sB, EL_EMC_ANDROID_DOWN },
+ { Yandroid_sw, EL_EMC_ANDROID_LEFT_DOWN },
+ { Yandroid_swB, EL_EMC_ANDROID_LEFT_DOWN },
+ { Yandroid_w, EL_EMC_ANDROID_LEFT },
+ { Yandroid_wB, EL_EMC_ANDROID_LEFT },
+ { Yandroid_nw, EL_EMC_ANDROID_LEFT_UP },
+ { Yandroid_nwB, EL_EMC_ANDROID_LEFT_UP },
+ { Xspring, EL_SPRING },
+ { Xspring_pause, EL_SPRING },
+ { Xspring_e, EL_SPRING },
+ { Xspring_w, EL_SPRING },
+ { Xspring_fall, EL_SPRING },
+ { Yspring_s, EL_SPRING },
+ { Yspring_sB, EL_SPRING },
+ { Yspring_e, EL_SPRING },
+ { Yspring_eB, EL_SPRING },
+ { Yspring_w, EL_SPRING },
+ { Yspring_wB, EL_SPRING },
+ { Yspring_kill_e, EL_SPRING },
+ { Yspring_kill_eB, EL_SPRING },
+ { Yspring_kill_w, EL_SPRING },
+ { Yspring_kill_wB, EL_SPRING },
+ { Xeater_n, EL_YAMYAM },
+ { Xeater_e, EL_YAMYAM },
+ { Xeater_w, EL_YAMYAM },
+ { Xeater_s, EL_YAMYAM },
+ { Yeater_n, EL_YAMYAM },
+ { Yeater_nB, EL_YAMYAM },
+ { Yeater_e, EL_YAMYAM },
+ { Yeater_eB, EL_YAMYAM },
+ { Yeater_s, EL_YAMYAM },
+ { Yeater_sB, EL_YAMYAM },
+ { Yeater_w, EL_YAMYAM },
+ { Yeater_wB, EL_YAMYAM },
+ { Yeater_stone, EL_ROCK },
+ { Yeater_spring, EL_SPRING },
+ { Xalien, EL_ROBOT },
+ { Xalien_pause, EL_ROBOT },
+ { Yalien_n, EL_ROBOT },
+ { Yalien_nB, EL_ROBOT },
+ { Yalien_e, EL_ROBOT },
+ { Yalien_eB, EL_ROBOT },
+ { Yalien_s, EL_ROBOT },
+ { Yalien_sB, EL_ROBOT },
+ { Yalien_w, EL_ROBOT },
+ { Yalien_wB, EL_ROBOT },
+ { Yalien_stone, EL_ROCK },
+ { Yalien_spring, EL_SPRING },
+ { Xemerald, EL_EMERALD },
+ { Xemerald_pause, EL_EMERALD },
+ { Xemerald_fall, EL_EMERALD },
+ { Xemerald_shine, EL_EMERALD },
+ { Yemerald_s, EL_EMERALD },
+ { Yemerald_sB, EL_EMERALD },
+ { Yemerald_e, EL_EMERALD },
+ { Yemerald_eB, EL_EMERALD },
+ { Yemerald_w, EL_EMERALD },
+ { Yemerald_wB, EL_EMERALD },
+ { Yemerald_eat, EL_EMERALD },
+ { Yemerald_stone, EL_ROCK },
+ { Xdiamond, EL_DIAMOND },
+ { Xdiamond_pause, EL_DIAMOND },
+ { Xdiamond_fall, EL_DIAMOND },
+ { Xdiamond_shine, EL_DIAMOND },
+ { Ydiamond_s, EL_DIAMOND },
+ { Ydiamond_sB, EL_DIAMOND },
+ { Ydiamond_e, EL_DIAMOND },
+ { Ydiamond_eB, EL_DIAMOND },
+ { Ydiamond_w, EL_DIAMOND },
+ { Ydiamond_wB, EL_DIAMOND },
+ { Ydiamond_eat, EL_DIAMOND },
+ { Ydiamond_stone, EL_ROCK },
+ { Xdrip_fall, EL_AMOEBA_DROP },
+ { Xdrip_stretch, EL_AMOEBA_DROP },
+ { Xdrip_stretchB, EL_AMOEBA_DROP },
+ { Xdrip_eat, EL_AMOEBA_DROP },
+ { Ydrip_s1, EL_AMOEBA_DROP },
+ { Ydrip_s1B, EL_AMOEBA_DROP },
+ { Ydrip_s2, EL_AMOEBA_DROP },
+ { Ydrip_s2B, EL_AMOEBA_DROP },
+ { Xbomb, EL_BOMB },
+ { Xbomb_pause, EL_BOMB },
+ { Xbomb_fall, EL_BOMB },
+ { Ybomb_s, EL_BOMB },
+ { Ybomb_sB, EL_BOMB },
+ { Ybomb_e, EL_BOMB },
+ { Ybomb_eB, EL_BOMB },
+ { Ybomb_w, EL_BOMB },
+ { Ybomb_wB, EL_BOMB },
+ { Ybomb_eat, EL_BOMB },
+ { Xballoon, EL_BALLOON },
+ { Yballoon_n, EL_BALLOON },
+ { Yballoon_nB, EL_BALLOON },
+ { Yballoon_e, EL_BALLOON },
+ { Yballoon_eB, EL_BALLOON },
+ { Yballoon_s, EL_BALLOON },
+ { Yballoon_sB, EL_BALLOON },
+ { Yballoon_w, EL_BALLOON },
+ { Yballoon_wB, EL_BALLOON },
+ { Xgrass, EL_SAND },
+ { Ygrass_nB, EL_SAND },
+ { Ygrass_eB, EL_SAND },
+ { Ygrass_sB, EL_SAND },
+ { Ygrass_wB, EL_SAND },
+ { Xdirt, EL_SAND },
+ { Ydirt_nB, EL_SAND },
+ { Ydirt_eB, EL_SAND },
+ { Ydirt_sB, EL_SAND },
+ { Ydirt_wB, EL_SAND },
+ { Xacid_ne, EL_ACID_POOL_TOPRIGHT },
+ { Xacid_se, EL_ACID_POOL_BOTTOMRIGHT },
+ { Xacid_s, EL_ACID_POOL_BOTTOM },
+ { Xacid_sw, EL_ACID_POOL_BOTTOMLEFT },
+ { Xacid_nw, EL_ACID_POOL_TOPLEFT },
+ { Xacid_1, EL_ACID },
+ { Xacid_2, EL_ACID },
+ { Xacid_3, EL_ACID },
+ { Xacid_4, EL_ACID },
+ { Xacid_5, EL_ACID },
+ { Xacid_6, EL_ACID },
+ { Xacid_7, EL_ACID },
+ { Xacid_8, EL_ACID },
+ { Xball_1, EL_EMC_GENERATOR_BALL },
+ { Xball_1B, EL_EMC_GENERATOR_BALL },
+ { Xball_2, EL_EMC_GENERATOR_BALL },
+ { Xball_2B, EL_EMC_GENERATOR_BALL },
+ { Yball_eat, EL_EMC_GENERATOR_BALL },
+ { Xgrow_ns, EL_EMC_GROW },
+ { Ygrow_ns_eat, EL_EMC_GROW },
+ { Xgrow_ew, EL_EMC_GROW },
+ { Ygrow_ew_eat, EL_EMC_GROW },
+ { Xwonderwall, EL_MAGIC_WALL },
+ { XwonderwallB, EL_MAGIC_WALL },
+ { Xameuba_1, EL_AMOEBA_WET },
+ { Xameuba_2, EL_AMOEBA_WET },
+ { Xameuba_3, EL_AMOEBA_WET },
+ { Xameuba_4, EL_AMOEBA_WET },
+ { Xameuba_5, EL_AMOEBA_WET },
+ { Xameuba_6, EL_AMOEBA_WET },
+ { Xameuba_7, EL_AMOEBA_WET },
+ { Xameuba_8, EL_AMOEBA_WET },
+ { Xdoor_1, EL_EM_GATE_1 },
+ { Xdoor_2, EL_EM_GATE_2 },
+ { Xdoor_3, EL_EM_GATE_3 },
+ { Xdoor_4, EL_EM_GATE_4 },
+ { Xdoor_5, EL_EMC_GATE_5 },
+ { Xdoor_6, EL_EMC_GATE_6 },
+ { Xdoor_7, EL_EMC_GATE_7 },
+ { Xdoor_8, EL_EMC_GATE_8 },
+ { Xkey_1, EL_EM_KEY_1 },
+ { Xkey_2, EL_EM_KEY_2 },
+ { Xkey_3, EL_EM_KEY_3 },
+ { Xkey_4, EL_EM_KEY_4 },
+ { Xkey_5, EL_EMC_KEY_5 },
+ { Xkey_6, EL_EMC_KEY_6 },
+ { Xkey_7, EL_EMC_KEY_7 },
+ { Xkey_8, EL_EMC_KEY_8 },
+ { Xwind_n, EL_BALLOON_SWITCH_UP },
+ { Xwind_e, EL_BALLOON_SWITCH_RIGHT },
+ { Xwind_s, EL_BALLOON_SWITCH_DOWN },
+ { Xwind_w, EL_BALLOON_SWITCH_LEFT },
+ { Xwind_nesw, EL_BALLOON_SWITCH_ANY },
+ { Xwind_stop, EL_BALLOON_SWITCH_NONE },
+ { Xexit, EL_EXIT_CLOSED },
+ { Xexit_1, EL_EXIT_OPEN },
+ { Xexit_2, EL_EXIT_OPEN },
+ { Xexit_3, EL_EXIT_OPEN },
+ { Xdynamite, EL_DYNAMITE },
+ { Ydynamite_eat, EL_DYNAMITE },
+ { Xdynamite_1, EL_DYNAMITE_ACTIVE },
+ { Xdynamite_2, EL_DYNAMITE_ACTIVE },
+ { Xdynamite_3, EL_DYNAMITE_ACTIVE },
+ { Xdynamite_4, EL_DYNAMITE_ACTIVE },
+ { Xbumper, EL_EMC_BUMPER },
+ { XbumperB, EL_EMC_BUMPER },
+ { Xwheel, EL_ROBOT_WHEEL },
+ { XwheelB, EL_ROBOT_WHEEL },
+ { Xswitch, EL_UNKNOWN },
+ { XswitchB, EL_UNKNOWN },
+ { Xsand, EL_QUICKSAND_EMPTY },
+ { Xsand_stone, EL_QUICKSAND_FULL },
+ { Xsand_stonein_1, EL_QUICKSAND_FULL },
+ { Xsand_stonein_2, EL_QUICKSAND_FULL },
+ { Xsand_stonein_3, EL_QUICKSAND_FULL },
+ { Xsand_stonein_4, EL_QUICKSAND_FULL },
+ { Xsand_stonesand_1, EL_QUICKSAND_FULL },
+ { Xsand_stonesand_2, EL_QUICKSAND_FULL },
+ { Xsand_stonesand_3, EL_QUICKSAND_FULL },
+ { Xsand_stonesand_4, EL_QUICKSAND_FULL },
+ { Xsand_stoneout_1, EL_QUICKSAND_FULL },
+ { Xsand_stoneout_2, EL_QUICKSAND_FULL },
+ { Xsand_sandstone_1, EL_QUICKSAND_FULL },
+ { Xsand_sandstone_2, EL_QUICKSAND_FULL },
+ { Xsand_sandstone_3, EL_QUICKSAND_FULL },
+ { Xsand_sandstone_4, EL_QUICKSAND_FULL },
+ { Xplant, EL_EMC_PLANT },
+ { Yplant, EL_EMC_PLANT },
+ { Xlenses, EL_EMC_LENSES },
+ { Xmagnify, EL_EMC_MAGNIFY },
+ { Xdripper, EL_UNKNOWN },
+ { XdripperB, EL_UNKNOWN },
+ { Xfake_blank, EL_INVISIBLE_WALL },
+ { Xfake_blankB, EL_INVISIBLE_WALL },
+ { Xfake_grass, EL_INVISIBLE_SAND },
+ { Xfake_grassB, EL_INVISIBLE_SAND },
+ { Xfake_door_1, EL_EM_GATE_1_GRAY },
+ { Xfake_door_2, EL_EM_GATE_2_GRAY },
+ { Xfake_door_3, EL_EM_GATE_3_GRAY },
+ { Xfake_door_4, EL_EM_GATE_4_GRAY },
+ { Xfake_door_5, EL_EMC_GATE_5_GRAY },
+ { Xfake_door_6, EL_EMC_GATE_6_GRAY },
+ { Xfake_door_7, EL_EMC_GATE_7_GRAY },
+ { Xfake_door_8, EL_EMC_GATE_8_GRAY },
+ { Xsteel_1, EL_STEELWALL },
+ { Xsteel_2, EL_UNKNOWN },
+ { Xsteel_3, EL_EMC_STEELWALL_1 },
+ { Xsteel_4, EL_UNKNOWN },
+ { Xwall_1, EL_WALL },
+ { Xwall_2, EL_UNKNOWN },
+ { Xwall_3, EL_UNKNOWN },
+ { Xwall_4, EL_UNKNOWN },
+ { Xround_wall_1, EL_WALL_SLIPPERY },
+ { Xround_wall_2, EL_UNKNOWN },
+ { Xround_wall_3, EL_UNKNOWN },
+ { Xround_wall_4, EL_UNKNOWN },
+ { Xdecor_1, EL_UNKNOWN },
+ { Xdecor_2, EL_EMC_WALL_6 },
+ { Xdecor_3, EL_EMC_WALL_4 },
+ { Xdecor_4, EL_EMC_WALL_5 },
+ { Xdecor_5, EL_EMC_WALL_7 },
+ { Xdecor_6, EL_EMC_WALL_8 },
+ { Xdecor_7, EL_UNKNOWN },
+ { Xdecor_8, EL_EMC_WALL_1 },
+ { Xdecor_9, EL_EMC_WALL_2 },
+ { Xdecor_10, EL_EMC_WALL_3 },
+ { Xdecor_11, EL_UNKNOWN },
+ { Xdecor_12, EL_UNKNOWN },
+ { Xalpha_0, EL_CHAR('0') },
+ { Xalpha_1, EL_CHAR('1') },
+ { Xalpha_2, EL_CHAR('2') },
+ { Xalpha_3, EL_CHAR('3') },
+ { Xalpha_4, EL_CHAR('4') },
+ { Xalpha_5, EL_CHAR('5') },
+ { Xalpha_6, EL_CHAR('6') },
+ { Xalpha_7, EL_CHAR('7') },
+ { Xalpha_8, EL_CHAR('8') },
+ { Xalpha_9, EL_CHAR('9') },
+ { Xalpha_excla, EL_CHAR('!') },
+ { Xalpha_quote, EL_CHAR('"') },
+ { Xalpha_comma, EL_CHAR(',') },
+ { Xalpha_minus, EL_CHAR('-') },
+ { Xalpha_perio, EL_CHAR('.') },
+ { Xalpha_colon, EL_CHAR(':') },
+ { Xalpha_quest, EL_CHAR('?') },
+ { Xalpha_a, EL_CHAR('A') },
+ { Xalpha_b, EL_CHAR('B') },
+ { Xalpha_c, EL_CHAR('C') },
+ { Xalpha_d, EL_CHAR('D') },
+ { Xalpha_e, EL_CHAR('E') },
+ { Xalpha_f, EL_CHAR('F') },
+ { Xalpha_g, EL_CHAR('G') },
+ { Xalpha_h, EL_CHAR('H') },
+ { Xalpha_i, EL_CHAR('I') },
+ { Xalpha_j, EL_CHAR('J') },
+ { Xalpha_k, EL_CHAR('K') },
+ { Xalpha_l, EL_CHAR('L') },
+ { Xalpha_m, EL_CHAR('M') },
+ { Xalpha_n, EL_CHAR('N') },
+ { Xalpha_o, EL_CHAR('O') },
+ { Xalpha_p, EL_CHAR('P') },
+ { Xalpha_q, EL_CHAR('Q') },
+ { Xalpha_r, EL_CHAR('R') },
+ { Xalpha_s, EL_CHAR('S') },
+ { Xalpha_t, EL_CHAR('T') },
+ { Xalpha_u, EL_CHAR('U') },
+ { Xalpha_v, EL_CHAR('V') },
+ { Xalpha_w, EL_CHAR('W') },
+ { Xalpha_x, EL_CHAR('X') },
+ { Xalpha_y, EL_CHAR('Y') },
+ { Xalpha_z, EL_CHAR('Z') },
+ { Xalpha_arrow_e, EL_CHAR('>') },
+ { Xalpha_arrow_w, EL_CHAR('<') },
+ { Xalpha_copyr, EL_CHAR('©') },
+
+ { Zplayer, EL_PLAYER_1 },
+
+ { ZBORDER, EL_EMC_LEVEL_BORDER },
+
+ { -1, -1 }
+ };
+
+ if (!mapping_initialized)
+ {
+ int i;
+
+ /* return "EL_UNKNOWN" for all undefined elements in mapping array */
+ for (i = 0; i < TILE_MAX; i++)
+ mapping_EM_to_RND[i] = EL_UNKNOWN;
+
+ for (i = 0; mapping_EM_to_RND_list[i].element_em != -1; i++)
+ mapping_EM_to_RND[mapping_EM_to_RND_list[i].element_em] =
+ mapping_EM_to_RND_list[i].element_rnd;
+
+ mapping_initialized = TRUE;
+ }
+
+ if (element_em >= 0 && element_em < TILE_MAX)
+ return mapping_EM_to_RND[element_em];
+
+ Error(ERR_WARN, "invalid EM level element %d", element_em);
+
+ return EL_UNKNOWN;
+}
+
+void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
+{
+ struct LevelInfo_EM *level_em = level->native_em_level;
+ struct LEVEL *lev = level_em->lev;
+ struct PLAYER *ply1 = level_em->ply1;
+ struct PLAYER *ply2 = level_em->ply2;
+ int i, x, y;
+
+ lev->width = MIN(level->fieldx, EM_MAX_CAVE_WIDTH);
+ lev->height = MIN(level->fieldy, EM_MAX_CAVE_HEIGHT);
+
+ lev->time_initial = level->time;
+ lev->required_initial = level->gems_needed;
+
+ lev->emerald_score = level->score[SC_EMERALD];
+ lev->diamond_score = level->score[SC_DIAMOND];
+ lev->alien_score = level->score[SC_ROBOT];
+ lev->tank_score = level->score[SC_SPACESHIP];
+ lev->bug_score = level->score[SC_BUG];
+ lev->eater_score = level->score[SC_YAMYAM];
+ lev->nut_score = level->score[SC_NUT];
+ lev->dynamite_score = level->score[SC_DYNAMITE];
+ lev->key_score = level->score[SC_TIME_BONUS]; /* ??? CHECK THIS */
+
+ for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
+ lev->eater_array[i][y * 3 + x] =
+ map_element_RND_to_EM(level->yamyam_content[i][x][y]);
+
+ lev->ameuba_time = level->amoeba_speed;
+ lev->wonderwall_time_initial = level->time_magic_wall;
+ lev->wheel_time = level->time_wheel;
+
+ /* first fill the complete playfield with the default border element */
+ for (y = 0; y < EM_MAX_CAVE_HEIGHT; y++)
+ for (x = 0; x < EM_MAX_CAVE_WIDTH; x++)
+ level_em->cave[x][y] = ZBORDER;
+
+ /* then copy the real level contents from level file into the playfield */
+ for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++)
+ {
+ int new_element = map_element_RND_to_EM(level->field[x][y]);
+
+ level_em->cave[x + 1][y + 1] = new_element;
+ }
+
+ ply1->x_initial = 0;
+ ply1->y_initial = 0;
+
+ ply2->x_initial = 0;
+ ply2->y_initial = 0;
+
+ /* at last, set the two players at their positions in the playfield */
+ for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++)
+ {
+ if (level->field[x][y] == EL_PLAYER_1)
+ {
+ ply1->x_initial = x + 1;
+ ply1->y_initial = y + 1;
+ }
+ else if (level->field[x][y] == EL_PLAYER_2)
+ {
+ ply2->x_initial = x + 1;
+ ply2->y_initial = y + 1;
+ }
+ }
+}
+
+void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
+{
+ struct LevelInfo_EM *level_em = level->native_em_level;
+ struct LEVEL *lev = level_em->lev;
+ struct PLAYER *ply1 = level_em->ply1;
+ struct PLAYER *ply2 = level_em->ply2;
+ int i, x, y;
+
+ level->fieldx = MIN(lev->width, MAX_LEV_FIELDX);
+ level->fieldy = MIN(lev->height, MAX_LEV_FIELDY);
+
+ level->time = lev->time_initial;
+ level->gems_needed = lev->required_initial;
+
+ sprintf(level->name, "Level %d", level->file_info.nr);
+
+ level->score[SC_EMERALD] = lev->emerald_score;
+ level->score[SC_DIAMOND] = lev->diamond_score;
+ level->score[SC_ROBOT] = lev->alien_score;
+ level->score[SC_SPACESHIP] = lev->tank_score;
+ level->score[SC_BUG] = lev->bug_score;
+ level->score[SC_YAMYAM] = lev->eater_score;
+ level->score[SC_NUT] = lev->nut_score;
+ level->score[SC_DYNAMITE] = lev->dynamite_score;
+ level->score[SC_TIME_BONUS] = lev->key_score; /* ??? CHECK THIS */
+
+ level->num_yamyam_contents = MAX_ELEMENT_CONTENTS;
+
+ for (i = 0; i < level->num_yamyam_contents; i++)
+ for (y = 0; y < 3; y++)
+ for (x = 0; x < 3; x++)
+ level->yamyam_content[i][x][y] =
+ map_element_EM_to_RND(lev->eater_array[i][y * 3 + x]);
+
+ level->amoeba_speed = lev->ameuba_time;
+ level->time_magic_wall = lev->wonderwall_time_initial;
+ level->time_wheel = lev->wheel_time;
+
+ for (y = 0; y < level->fieldy; y++) for (x = 0; x < level->fieldx; x++)
+ {
+ int new_element = map_element_EM_to_RND(level_em->cave[x + 1][y + 1]);
+
+ if (new_element == EL_AMOEBA_WET && level->amoeba_speed == 0)
+ new_element = EL_AMOEBA_DEAD;
+
+ level->field[x][y] = new_element;
+ }
+
+ level->field[ply1->x_initial - 1][ply1->y_initial - 1] = EL_PLAYER_1;
+ level->field[ply2->x_initial - 1][ply2->y_initial - 1] = EL_PLAYER_2;
+}
+
static void LoadLevelFromFileInfo_EM(struct LevelInfo *level,
struct LevelFileInfo *level_file_info)
{
if (!LoadNativeLevel_EM(level_file_info->filename))
level->no_valid_file = TRUE;
+
+ CopyNativeLevel_EM_to_RND(level);
}
#endif
#include "display.h"
#include "level.h"
-#include <stdio.h>
-
#if defined(TARGET_X11)
-unsigned int frame; /* current frame */
-unsigned int screen_x; /* current scroll position */
+unsigned int frame; /* current screen frame */
+unsigned int screen_x; /* current scroll position */
unsigned int screen_y;
/* tiles currently on screen */
static unsigned short screentiles[MAX_BUF_YSIZE][MAX_BUF_XSIZE];
-static unsigned int colours[8];
-static unsigned int colour_anim;
-
-static void xdebug(char *msg)
-{
-#if 0
- XSync(display, False);
- printf("EM DEBUG: %s\n", msg);
-#endif
-}
-
-static void colour_shuffle(void)
-{
- unsigned int i, j, k;
-
- for (i = 0; i < 8; i++)
- colours[i] = i;
-
- for (i = 0; i < 8; i++)
- {
- Random = Random * 129 + 1;
- j = (Random >> 10) & 7;
- k = colours[i];
- colours[i] = colours[j];
- colours[j] = k;
- }
-}
-
/* copy the entire screen to the window at the scroll position
*
unsigned int x = screen_x % (MAX_BUF_XSIZE * TILEX);
unsigned int y = screen_y % (MAX_BUF_YSIZE * TILEY);
- xdebug("blitscreen");
-
- if (em_game_status == EM_GAME_STATUS_MENU)
- {
- ClearRectangle(screenBitmap, 0, SCR_MENUY * TILEY,
- SCR_FIELDX * TILEX, (17 - SCR_MENUY) * TILEY);
- BlitBitmap(scoreBitmap, screenBitmap, 0, 0, SCR_MENUX * TILEX, SCOREY,
- 0, SCR_MENUY * TILEY);
- }
-
if (x < 2 * TILEX && y < 2 * TILEY)
{
BlitBitmap(screenBitmap, window, x, y,
SX + MAX_BUF_XSIZE * TILEX - x, SY + MAX_BUF_YSIZE * TILEY - y);
}
- if (em_game_status == EM_GAME_STATUS_PLAY && SCR_FIELDY < 17)
- {
- BlitBitmap(scoreBitmap, window, 0, 0, SCR_FIELDX * TILEX, SCOREY,
- SX, SY + SCR_FIELDY * TILEY);
- ClearRectangle(window, SX, SY + SCR_FIELDY * TILEY + SCOREY,
- SCR_FIELDX * TILEX, (17 - SCR_FIELDY) * TILEY - SCOREY);
- }
-
XFlush(display);
-
- xdebug("blitscreen - done");
}
unsigned int left = screen_x / TILEX;
unsigned int top = screen_y / TILEY;
- xdebug("animscreen");
-
for (y = top; y < top + MAX_BUF_YSIZE; y++)
{
dy = y % MAX_BUF_YSIZE;
unsigned int x, y, dx, dy;
unsigned short obj, spr;
- xdebug("blitplayer");
-
if (ply->alive)
{
x = (frame * ply->oldx + (8 - frame) * ply->x) * TILEX / 8;
}
}
-
-/* draw static text for time, gems and score counter */
-
void game_initscreen(void)
{
unsigned int x,y;
- xdebug("game_initscreen");
-
frame = 6;
screen_x = 0;
screen_y = 0;
for (x = 0; x < MAX_BUF_XSIZE; x++)
screentiles[y][x] = -1;
- colour_shuffle();
- colours[0] += 16;
- colours[1] += 16;
- colours[2] += 16;
- colour_anim = 0;
-
- ClearRectangle(scoreBitmap, 0, 0, SCR_FIELDX * TILEX, SCOREY);
- BlitBitmap(botBitmap, scoreBitmap,
- 11 * SCOREX, colours[0] * SCOREY, 3 * SCOREX, SCOREY,
- 1 * SCOREX, 0); /* 0-63 time */
- BlitBitmap(botBitmap, scoreBitmap,
- 18 * SCOREX, colours[0] * SCOREY, 6 * SCOREX, SCOREY,
- 11 * SCOREX, 0); /* 112-207 diamonds */
- BlitBitmap(botBitmap, scoreBitmap,
- 14 * SCOREX, colours[0] * SCOREY, 4 * SCOREX, SCOREY,
- 24 * SCOREX, 0); /* 256-319 score */
-}
-
-
-/* draw current values for time, gems and score counter */
-
-void game_blitscore(void)
-{
- unsigned int i;
-
- xdebug("game_blitscore");
-
DrawGameDoorValues_EM(lev.required, ply1.dynamite, lev.score,
(lev.time + 4) / 5);
-
- i = (lev.time + 4) / 5;
- BlitBitmap(botBitmap, scoreBitmap,
- (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
- 7 * SCOREX, 0);
- i /= 10;
- BlitBitmap(botBitmap, scoreBitmap,
- (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
- 6 * SCOREX, 0);
- i /= 10;
- BlitBitmap(botBitmap, scoreBitmap,
- (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
- 5 * SCOREX, 0);
- i /= 10;
- BlitBitmap(botBitmap, scoreBitmap,
- (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
- 4 * SCOREX, 0);
-
- i = lev.score;
- BlitBitmap(botBitmap, scoreBitmap,
- (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
- 31 * SCOREX, 0);
- i /= 10;
- BlitBitmap(botBitmap, scoreBitmap,
- (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
- 30 * SCOREX, 0);
- i /= 10;
- BlitBitmap(botBitmap, scoreBitmap,
- (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
- 29 * SCOREX, 0);
- i /= 10;
- BlitBitmap(botBitmap, scoreBitmap,
- (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
- 28 * SCOREX, 0);
-
- if (lev.home == 0)
- {
- BlitBitmap(botBitmap, scoreBitmap,
- 12 * SCOREX, 24 * SCOREY, 12 * SCOREX, SCOREY,
- 14 * SCOREX, 0); /* relax */
-
- goto done;
- }
-
- if (ply1.alive + ply2.alive >= lev.home && lev.required == 0)
- {
- BlitBitmap(botBitmap, scoreBitmap,
- 24 * SCOREX, colours[2] * SCOREY, 12 * SCOREX, SCOREY,
- 14 * SCOREX, 0); /* find the exit */
-
- goto done;
- }
-
- if (ply1.alive + ply2.alive < lev.home)
- {
- if (++colour_anim > 11)
- colour_anim = 0;
-
- if (colour_anim < 6)
- {
- BlitBitmap(botBitmap, scoreBitmap,
- 0, 24 * SCOREY, 12 * SCOREX, SCOREY,
- 14 * SCOREX, 0); /* forget it */
-
- goto done;
- }
-
- BlitBitmap(botBitmap, scoreBitmap,
- 18 * SCOREX, colours[0] * SCOREY, 6 * SCOREX, SCOREY,
- 15 * SCOREX, 0); /* diamonds */
- }
-
- i = lev.required;
- BlitBitmap(botBitmap, scoreBitmap,
- (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
- 20 * SCOREX, 0);
- i /= 10;
- BlitBitmap(botBitmap, scoreBitmap,
- (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
- 19 * SCOREX, 0);
- i /= 10;
- BlitBitmap(botBitmap, scoreBitmap,
- (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
- 18 * SCOREX, 0);
- i /= 10;
- BlitBitmap(botBitmap, scoreBitmap,
- (i % 10) * SCOREX, colours[1] * SCOREY, SCOREX, SCOREY,
- 17 * SCOREX, 0);
-
- done:
}
void game_animscreen(void)
{
unsigned int x,y;
- xdebug("game_animscreen");
-
x = (frame * ply1.oldx + (8 - frame) * ply1.x) * TILEX / 8
+ ((SCR_FIELDX - 1) * TILEX) / 2;
y = (frame * ply1.oldy + (8 - frame) * ply1.y) * TILEY / 8
blitscreen();
XFlush(display);
-
- Random = Random * 129 + 1;
-}
-
-
-/* draw main menu background and copyright note */
-
-void title_initscreen(void)
-{
- xdebug("title_initscreen");
-
- screen_x = 0;
- screen_y = 0;
-
- colour_shuffle();
- colours[1] += 8;
- colour_anim = 0;
-
-#if 1
-
- /* draw title screen on menu background */
-
- BlitBitmap(ttlBitmap, screenBitmap, ORIG_MENU_SX, ORIG_MENU_SY,
- SCR_MENUX * TILEX, SCR_MENUY * TILEY, 0, 0);
-
- /* draw copyright note at footer */
-
- if (botmaskBitmap)
- {
- BlitBitmap(botBitmap, scoreBitmap, 0, colours[1] * SCOREY,
- SCR_MENUX * TILEX, SCOREY, 0, 0);
-
- SetClipOrigin(botBitmap, botBitmap->stored_clip_gc,
- 0, 0 - colours[0] * SCOREY);
- }
-
- BlitBitmapMasked(botBitmap, scoreBitmap, 0, colours[0] * SCOREY,
- SCR_MENUX * TILEX, SCOREY, 0, 0);
-
-#else
-
- XCopyArea(display, ttlPixmap, screenPixmap, screenGC,
- 0, 0, SCR_MENUX * TILEX, SCR_MENUY * TILEY, 0, 0);
-
- if (botmaskBitmap)
- {
- XCopyArea(display, botPixmap, scorePixmap, scoreGC,
- 0, colours[1] * SCOREY, SCR_MENUX * TILEX, SCOREY, 0, 0);
- XSetClipMask(display, scoreGC, botmaskBitmap);
- XSetClipOrigin(display, scoreGC, 0, 0 - colours[0] * SCOREY);
- }
-
- XCopyArea(display, botPixmap, scorePixmap, scoreGC,
- 0, colours[0] * SCOREY, SCR_MENUX * TILEX, SCOREY, 0, 0);
-
- if (botmaskBitmap)
- XSetClipMask(display, scoreGC, None);
-
-#endif
-}
-
-
-/* draw bouncing ball on main menu footer */
-
-void title_blitscore(void)
-{
- unsigned int x, y, i;
-
- xdebug("title_blitscore");
-
- if (++colour_anim > 30)
- colour_anim = 0;
-
- i = colour_anim >= 16 ? 31 - colour_anim : colour_anim;
- x = (i / 8 + 18) * 2 * SCOREX;
- y = (i % 8 + 16) * SCOREY;
-
-#if 1
- if (botmaskBitmap)
- {
- BlitBitmap(botBitmap, scoreBitmap,
- 32 * SCOREX, colours[1] * SCOREY, 2 * SCOREX, SCOREY,
- 32 * SCOREX, 0);
-
- SetClipOrigin(botBitmap, botBitmap->stored_clip_gc,
- 32 * SCOREX - x, 0 - y);
- }
-
- BlitBitmapMasked(botBitmap, scoreBitmap,
- x, y, 2 * SCOREX, SCOREY, 32 * SCOREX, 0);
-
-#else
-
- if (botmaskBitmap)
- {
- XCopyArea(display, botPixmap, scorePixmap, scoreGC,
- 32 * SCOREX, colours[1] * SCOREY, 2 * SCOREX, SCOREY,
- 32 * SCOREX, 0);
- XSetClipMask(display, scoreGC, botmaskBitmap);
- XSetClipOrigin(display, scoreGC, 32 * SCOREX - x, 0 - y);
- }
-
- XCopyArea(display, botPixmap, scorePixmap, scoreGC,
- x, y, 2 * SCOREX, SCOREY, 32 * SCOREX, 0);
-
- if (botmaskBitmap)
- XSetClipMask(display, scoreGC, None);
-#endif
-}
-
-void title_animscreen(void)
-{
- blitscreen();
- XFlush(display);
-
- Random = Random * 129 + 1;
-}
-
-static int ttl_map[] =
-{
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
- -1,0,-1,-1,-1,-1,-1,1,-1,-1,-1,-1,2,3,4,-1, /* !',-. */
- 5,6,7,8,9,10,11,12,13,14,15,-1,-1,-1,-1,16, /* 0123456789:? */
- -1,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, /* ABCDEFGHIJKLMNO */
- 32,33,34,35,36,37,38,39,40,41,42,-1,-1,-1,-1,-1, /* PQRSTUVWXYZ */
- -1,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31, /* abcdefghijklmno */
- 32,33,34,35,36,37,38,39,40,41,42,-1,-1,-1,-1,-1 /* pqrstuvwxyz */
-};
-
-void title_string(unsigned int y, unsigned int left, unsigned int right,
- char *string)
-{
- int i;
- unsigned int x;
-
- xdebug("title_string");
-
- y *= TILEY;
- left *= SCOREX;
- right *= SCOREX;
-
- x = (left + right - strlen(string) * MENUFONTX) / 2;
- if (x < left || x >= right)
- x = left;
-
- /* restore background graphic where text will be drawn */
- BlitBitmap(ttlBitmap, screenBitmap, ORIG_MENU_SX + left, ORIG_MENU_SY + y,
- right - left, MENUFONTY, left, y);
-
-#if 1
-#else
- if (ttlmaskBitmap)
- XSetClipMask(display, screenGC, ttlmaskBitmap);
-#endif
-
- for (i = 0; string[i] && x < right; i++)
- {
- int ch_pos, ch_x, ch_y;
-
- ch_pos = ttl_map[string[i] & 127];
-
- if (ch_pos == -1 || ch_pos > 22 * 2)
- continue; /* no graphic for this character */
-
- ch_x = (ch_pos % 22) * GFXMENUFONTX;
- ch_y = (ch_pos / 22 + 12) * TILEY;
-
-#if 1
- SetClipOrigin(ttlBitmap, ttlBitmap->stored_clip_gc,
- x - ORIG_MENU_SX - ch_x, y - ORIG_MENU_SY - ch_y);
-
- BlitBitmapMasked(ttlBitmap, screenBitmap, ch_x, ch_y, MENUFONTX, MENUFONTY,
- x - ORIG_MENU_SX, y - ORIG_MENU_SY);
-#else
- if (ttlmaskBitmap)
- XSetClipOrigin(display, screenGC, x - ch_x, y - ch_y);
-
- XCopyArea(display, ttlPixmap, screenPixmap, screenGC,
- ch_x, ch_y, MENUFONTX, MENUFONTY, x, y);
-#endif
-
- x += MENUFONTX;
- }
-
-#if 1
-#else
- XSetClipMask(display, screenGC, None);
-#endif
}
#endif