From 872cf2d86e73d185fcad1fac7b389e7d1dfcb839 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 7 Apr 2007 17:24:57 +0200 Subject: [PATCH] rnd-20070407-2-src --- src/conf_gfx.c | 89 ++++++++ src/conf_var.c | 496 ++++++++++++++++++++++++++++++++++++------- src/conftime.h | 2 +- src/files.c | 48 +++++ src/game.c | 293 +++++++++++++++++-------- src/game.h | 36 ++-- src/libgame/misc.c | 50 ++--- src/libgame/misc.h | 3 +- src/libgame/system.h | 1 + src/main.h | 2 - 10 files changed, 804 insertions(+), 216 deletions(-) diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 1da4c96d..c5d055c9 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5787,6 +5787,95 @@ struct ConfigInfo image_config[] = { "game.panel.gravity_state.font", "font.text_1" }, { "game.panel.gravity_state.font_active", "font.text_2" }, + { "game.panel.ce_score_1.x", "-1" }, + { "game.panel.ce_score_1.y", "-1" }, + { "game.panel.ce_score_1.align", "left" }, + { "game.panel.ce_score_1.valign", "top" }, + { "game.panel.ce_score_1.digits", "-1" }, + { "game.panel.ce_score_1.font", "font.text_2" }, + { "game.panel.ce_score_1.element", "custom_1" }, + { "game.panel.ce_score_1_element.x", "-1" }, + { "game.panel.ce_score_1_element.y", "-1" }, + { "game.panel.ce_score_1_element.tile_size", "16" }, + { "game.panel.ce_score_1_element.element", "custom_1" }, + { "game.panel.ce_score_2.x", "-1" }, + { "game.panel.ce_score_2.y", "-1" }, + { "game.panel.ce_score_2.align", "left" }, + { "game.panel.ce_score_2.valign", "top" }, + { "game.panel.ce_score_2.digits", "-1" }, + { "game.panel.ce_score_2.font", "font.text_2" }, + { "game.panel.ce_score_2.element", "custom_1" }, + { "game.panel.ce_score_2_element.x", "-1" }, + { "game.panel.ce_score_2_element.y", "-1" }, + { "game.panel.ce_score_2_element.tile_size", "16" }, + { "game.panel.ce_score_2_element.element", "custom_1" }, + { "game.panel.ce_score_3.x", "-1" }, + { "game.panel.ce_score_3.y", "-1" }, + { "game.panel.ce_score_3.align", "left" }, + { "game.panel.ce_score_3.valign", "top" }, + { "game.panel.ce_score_3.digits", "-1" }, + { "game.panel.ce_score_3.font", "font.text_2" }, + { "game.panel.ce_score_3.element", "custom_1" }, + { "game.panel.ce_score_3_element.x", "-1" }, + { "game.panel.ce_score_3_element.y", "-1" }, + { "game.panel.ce_score_3_element.tile_size", "16" }, + { "game.panel.ce_score_3_element.element", "custom_1" }, + { "game.panel.ce_score_4.x", "-1" }, + { "game.panel.ce_score_4.y", "-1" }, + { "game.panel.ce_score_4.align", "left" }, + { "game.panel.ce_score_4.valign", "top" }, + { "game.panel.ce_score_4.digits", "-1" }, + { "game.panel.ce_score_4.font", "font.text_2" }, + { "game.panel.ce_score_4.element", "custom_1" }, + { "game.panel.ce_score_4_element.x", "-1" }, + { "game.panel.ce_score_4_element.y", "-1" }, + { "game.panel.ce_score_4_element.tile_size", "16" }, + { "game.panel.ce_score_4_element.element", "custom_1" }, + { "game.panel.ce_score_5.x", "-1" }, + { "game.panel.ce_score_5.y", "-1" }, + { "game.panel.ce_score_5.align", "left" }, + { "game.panel.ce_score_5.valign", "top" }, + { "game.panel.ce_score_5.digits", "-1" }, + { "game.panel.ce_score_5.font", "font.text_2" }, + { "game.panel.ce_score_5.element", "custom_1" }, + { "game.panel.ce_score_5_element.x", "-1" }, + { "game.panel.ce_score_5_element.y", "-1" }, + { "game.panel.ce_score_5_element.tile_size", "16" }, + { "game.panel.ce_score_5_element.element", "custom_1" }, + { "game.panel.ce_score_6.x", "-1" }, + { "game.panel.ce_score_6.y", "-1" }, + { "game.panel.ce_score_6.align", "left" }, + { "game.panel.ce_score_6.valign", "top" }, + { "game.panel.ce_score_6.digits", "-1" }, + { "game.panel.ce_score_6.font", "font.text_2" }, + { "game.panel.ce_score_6.element", "custom_1" }, + { "game.panel.ce_score_6_element.x", "-1" }, + { "game.panel.ce_score_6_element.y", "-1" }, + { "game.panel.ce_score_6_element.tile_size", "16" }, + { "game.panel.ce_score_6_element.element", "custom_1" }, + { "game.panel.ce_score_7.x", "-1" }, + { "game.panel.ce_score_7.y", "-1" }, + { "game.panel.ce_score_7.align", "left" }, + { "game.panel.ce_score_7.valign", "top" }, + { "game.panel.ce_score_7.digits", "-1" }, + { "game.panel.ce_score_7.font", "font.text_2" }, + { "game.panel.ce_score_7.element", "custom_1" }, + { "game.panel.ce_score_7_element.x", "-1" }, + { "game.panel.ce_score_7_element.y", "-1" }, + { "game.panel.ce_score_7_element.tile_size", "16" }, + { "game.panel.ce_score_7_element.element", "custom_1" }, + { "game.panel.ce_score_8.x", "-1" }, + { "game.panel.ce_score_8.y", "-1" }, + { "game.panel.ce_score_8.align", "left" }, + { "game.panel.ce_score_8.valign", "top" }, + { "game.panel.ce_score_8.digits", "-1" }, + { "game.panel.ce_score_8.font", "font.text_2" }, + { "game.panel.ce_score_8.element", "custom_1" }, + { "game.panel.ce_score_8_element.x", "-1" }, + { "game.panel.ce_score_8_element.y", "-1" }, + { "game.panel.ce_score_8_element.tile_size", "16" }, + { "game.panel.ce_score_8_element.element", "custom_1" }, + { "game.panel.player_name.x", "-1" }, { "game.panel.player_name.y", "-1" }, { "game.panel.player_name.align", "left" }, diff --git a/src/conf_var.c b/src/conf_var.c index bf4e4a10..c8cd2f66 100644 --- a/src/conf_var.c +++ b/src/conf_var.c @@ -2046,195 +2046,195 @@ struct TokenIntPtrInfo image_config_vars[] = }, { "game.panel.inventory_first_1.x", - &game.panel.inventory_first_1.x + &game.panel.inventory_first[0].x }, { "game.panel.inventory_first_1.y", - &game.panel.inventory_first_1.y + &game.panel.inventory_first[0].y }, { "game.panel.inventory_first_1.tile_size", - &game.panel.inventory_first_1.size + &game.panel.inventory_first[0].size }, { "game.panel.inventory_first_2.x", - &game.panel.inventory_first_2.x + &game.panel.inventory_first[1].x }, { "game.panel.inventory_first_2.y", - &game.panel.inventory_first_2.y + &game.panel.inventory_first[1].y }, { "game.panel.inventory_first_2.tile_size", - &game.panel.inventory_first_2.size + &game.panel.inventory_first[1].size }, { "game.panel.inventory_first_3.x", - &game.panel.inventory_first_3.x + &game.panel.inventory_first[2].x }, { "game.panel.inventory_first_3.y", - &game.panel.inventory_first_3.y + &game.panel.inventory_first[2].y }, { "game.panel.inventory_first_3.tile_size", - &game.panel.inventory_first_3.size + &game.panel.inventory_first[2].size }, { "game.panel.inventory_first_4.x", - &game.panel.inventory_first_4.x + &game.panel.inventory_first[3].x }, { "game.panel.inventory_first_4.y", - &game.panel.inventory_first_4.y + &game.panel.inventory_first[3].y }, { "game.panel.inventory_first_4.tile_size", - &game.panel.inventory_first_4.size + &game.panel.inventory_first[3].size }, { "game.panel.inventory_first_5.x", - &game.panel.inventory_first_5.x + &game.panel.inventory_first[4].x }, { "game.panel.inventory_first_5.y", - &game.panel.inventory_first_5.y + &game.panel.inventory_first[4].y }, { "game.panel.inventory_first_5.tile_size", - &game.panel.inventory_first_5.size + &game.panel.inventory_first[4].size }, { "game.panel.inventory_first_6.x", - &game.panel.inventory_first_6.x + &game.panel.inventory_first[5].x }, { "game.panel.inventory_first_6.y", - &game.panel.inventory_first_6.y + &game.panel.inventory_first[5].y }, { "game.panel.inventory_first_6.tile_size", - &game.panel.inventory_first_6.size + &game.panel.inventory_first[5].size }, { "game.panel.inventory_first_7.x", - &game.panel.inventory_first_7.x + &game.panel.inventory_first[6].x }, { "game.panel.inventory_first_7.y", - &game.panel.inventory_first_7.y + &game.panel.inventory_first[6].y }, { "game.panel.inventory_first_7.tile_size", - &game.panel.inventory_first_7.size + &game.panel.inventory_first[6].size }, { "game.panel.inventory_first_8.x", - &game.panel.inventory_first_8.x + &game.panel.inventory_first[7].x }, { "game.panel.inventory_first_8.y", - &game.panel.inventory_first_8.y + &game.panel.inventory_first[7].y }, { "game.panel.inventory_first_8.tile_size", - &game.panel.inventory_first_8.size + &game.panel.inventory_first[7].size }, { "game.panel.inventory_last_1.x", - &game.panel.inventory_last_1.x + &game.panel.inventory_last[0].x }, { "game.panel.inventory_last_1.y", - &game.panel.inventory_last_1.y + &game.panel.inventory_last[0].y }, { "game.panel.inventory_last_1.tile_size", - &game.panel.inventory_last_1.size + &game.panel.inventory_last[0].size }, { "game.panel.inventory_last_2.x", - &game.panel.inventory_last_2.x + &game.panel.inventory_last[1].x }, { "game.panel.inventory_last_2.y", - &game.panel.inventory_last_2.y + &game.panel.inventory_last[1].y }, { "game.panel.inventory_last_2.tile_size", - &game.panel.inventory_last_2.size + &game.panel.inventory_last[1].size }, { "game.panel.inventory_last_3.x", - &game.panel.inventory_last_3.x + &game.panel.inventory_last[2].x }, { "game.panel.inventory_last_3.y", - &game.panel.inventory_last_3.y + &game.panel.inventory_last[2].y }, { "game.panel.inventory_last_3.tile_size", - &game.panel.inventory_last_3.size + &game.panel.inventory_last[2].size }, { "game.panel.inventory_last_4.x", - &game.panel.inventory_last_4.x + &game.panel.inventory_last[3].x }, { "game.panel.inventory_last_4.y", - &game.panel.inventory_last_4.y + &game.panel.inventory_last[3].y }, { "game.panel.inventory_last_4.tile_size", - &game.panel.inventory_last_4.size + &game.panel.inventory_last[3].size }, { "game.panel.inventory_last_5.x", - &game.panel.inventory_last_5.x + &game.panel.inventory_last[4].x }, { "game.panel.inventory_last_5.y", - &game.panel.inventory_last_5.y + &game.panel.inventory_last[4].y }, { "game.panel.inventory_last_5.tile_size", - &game.panel.inventory_last_5.size + &game.panel.inventory_last[4].size }, { "game.panel.inventory_last_6.x", - &game.panel.inventory_last_6.x + &game.panel.inventory_last[5].x }, { "game.panel.inventory_last_6.y", - &game.panel.inventory_last_6.y + &game.panel.inventory_last[5].y }, { "game.panel.inventory_last_6.tile_size", - &game.panel.inventory_last_6.size + &game.panel.inventory_last[5].size }, { "game.panel.inventory_last_7.x", - &game.panel.inventory_last_7.x + &game.panel.inventory_last[6].x }, { "game.panel.inventory_last_7.y", - &game.panel.inventory_last_7.y + &game.panel.inventory_last[6].y }, { "game.panel.inventory_last_7.tile_size", - &game.panel.inventory_last_7.size + &game.panel.inventory_last[6].size }, { "game.panel.inventory_last_8.x", - &game.panel.inventory_last_8.x + &game.panel.inventory_last[7].x }, { "game.panel.inventory_last_8.y", - &game.panel.inventory_last_8.y + &game.panel.inventory_last[7].y }, { "game.panel.inventory_last_8.tile_size", - &game.panel.inventory_last_8.size + &game.panel.inventory_last[7].size }, { "game.panel.key_1.x", @@ -2914,99 +2914,99 @@ struct TokenIntPtrInfo image_config_vars[] = }, { "game.panel.conveyor_belt_1.x", - &game.panel.conveyor_belt_1.x + &game.panel.conveyor_belt[0].x }, { "game.panel.conveyor_belt_1.y", - &game.panel.conveyor_belt_1.y + &game.panel.conveyor_belt[0].y }, { "game.panel.conveyor_belt_1.tile_size", - &game.panel.conveyor_belt_1.size + &game.panel.conveyor_belt[0].size }, { "game.panel.conveyor_belt_1_switch.x", - &game.panel.conveyor_belt_1_switch.x + &game.panel.conveyor_belt_switch[0].x }, { "game.panel.conveyor_belt_1_switch.y", - &game.panel.conveyor_belt_1_switch.y + &game.panel.conveyor_belt_switch[0].y }, { "game.panel.conveyor_belt_1_switch.tile_size", - &game.panel.conveyor_belt_1_switch.size + &game.panel.conveyor_belt_switch[0].size }, { "game.panel.conveyor_belt_2.x", - &game.panel.conveyor_belt_2.x + &game.panel.conveyor_belt[1].x }, { "game.panel.conveyor_belt_2.y", - &game.panel.conveyor_belt_2.y + &game.panel.conveyor_belt[1].y }, { "game.panel.conveyor_belt_2.tile_size", - &game.panel.conveyor_belt_2.size + &game.panel.conveyor_belt[1].size }, { "game.panel.conveyor_belt_2_switch.x", - &game.panel.conveyor_belt_2_switch.x + &game.panel.conveyor_belt_switch[1].x }, { "game.panel.conveyor_belt_2_switch.y", - &game.panel.conveyor_belt_2_switch.y + &game.panel.conveyor_belt_switch[1].y }, { "game.panel.conveyor_belt_2_switch.tile_size", - &game.panel.conveyor_belt_2_switch.size + &game.panel.conveyor_belt_switch[1].size }, { "game.panel.conveyor_belt_3.x", - &game.panel.conveyor_belt_3.x + &game.panel.conveyor_belt[2].x }, { "game.panel.conveyor_belt_3.y", - &game.panel.conveyor_belt_3.y + &game.panel.conveyor_belt[2].y }, { "game.panel.conveyor_belt_3.tile_size", - &game.panel.conveyor_belt_3.size + &game.panel.conveyor_belt[2].size }, { "game.panel.conveyor_belt_3_switch.x", - &game.panel.conveyor_belt_3_switch.x + &game.panel.conveyor_belt_switch[2].x }, { "game.panel.conveyor_belt_3_switch.y", - &game.panel.conveyor_belt_3_switch.y + &game.panel.conveyor_belt_switch[2].y }, { "game.panel.conveyor_belt_3_switch.tile_size", - &game.panel.conveyor_belt_3_switch.size + &game.panel.conveyor_belt_switch[2].size }, { "game.panel.conveyor_belt_4.x", - &game.panel.conveyor_belt_4.x + &game.panel.conveyor_belt[3].x }, { "game.panel.conveyor_belt_4.y", - &game.panel.conveyor_belt_4.y + &game.panel.conveyor_belt[3].y }, { "game.panel.conveyor_belt_4.tile_size", - &game.panel.conveyor_belt_4.size + &game.panel.conveyor_belt[3].size }, { "game.panel.conveyor_belt_4_switch.x", - &game.panel.conveyor_belt_4_switch.x + &game.panel.conveyor_belt_switch[3].x }, { "game.panel.conveyor_belt_4_switch.y", - &game.panel.conveyor_belt_4_switch.y + &game.panel.conveyor_belt_switch[3].y }, { "game.panel.conveyor_belt_4_switch.tile_size", - &game.panel.conveyor_belt_4_switch.size + &game.panel.conveyor_belt_switch[3].size }, { "game.panel.magic_wall.x", @@ -3072,6 +3072,358 @@ struct TokenIntPtrInfo image_config_vars[] = "game.panel.gravity_state.font_active", &game.panel.gravity_state.font_alt }, + { + "game.panel.ce_score_1.x", + &game.panel.ce_score[0].x + }, + { + "game.panel.ce_score_1.y", + &game.panel.ce_score[0].y + }, + { + "game.panel.ce_score_1.align", + &game.panel.ce_score[0].align + }, + { + "game.panel.ce_score_1.valign", + &game.panel.ce_score[0].valign + }, + { + "game.panel.ce_score_1.digits", + &game.panel.ce_score[0].size + }, + { + "game.panel.ce_score_1.font", + &game.panel.ce_score[0].font + }, + { + "game.panel.ce_score_1.element", + &game.panel.ce_score[0].id + }, + { + "game.panel.ce_score_1_element.x", + &game.panel.ce_score_element[0].x + }, + { + "game.panel.ce_score_1_element.y", + &game.panel.ce_score_element[0].y + }, + { + "game.panel.ce_score_1_element.tile_size", + &game.panel.ce_score_element[0].size + }, + { + "game.panel.ce_score_1_element.element", + &game.panel.ce_score_element[0].id + }, + { + "game.panel.ce_score_2.x", + &game.panel.ce_score[1].x + }, + { + "game.panel.ce_score_2.y", + &game.panel.ce_score[1].y + }, + { + "game.panel.ce_score_2.align", + &game.panel.ce_score[1].align + }, + { + "game.panel.ce_score_2.valign", + &game.panel.ce_score[1].valign + }, + { + "game.panel.ce_score_2.digits", + &game.panel.ce_score[1].size + }, + { + "game.panel.ce_score_2.font", + &game.panel.ce_score[1].font + }, + { + "game.panel.ce_score_2.element", + &game.panel.ce_score[1].id + }, + { + "game.panel.ce_score_2_element.x", + &game.panel.ce_score_element[1].x + }, + { + "game.panel.ce_score_2_element.y", + &game.panel.ce_score_element[1].y + }, + { + "game.panel.ce_score_2_element.tile_size", + &game.panel.ce_score_element[1].size + }, + { + "game.panel.ce_score_2_element.element", + &game.panel.ce_score_element[1].id + }, + { + "game.panel.ce_score_3.x", + &game.panel.ce_score[2].x + }, + { + "game.panel.ce_score_3.y", + &game.panel.ce_score[2].y + }, + { + "game.panel.ce_score_3.align", + &game.panel.ce_score[2].align + }, + { + "game.panel.ce_score_3.valign", + &game.panel.ce_score[2].valign + }, + { + "game.panel.ce_score_3.digits", + &game.panel.ce_score[2].size + }, + { + "game.panel.ce_score_3.font", + &game.panel.ce_score[2].font + }, + { + "game.panel.ce_score_3.element", + &game.panel.ce_score[2].id + }, + { + "game.panel.ce_score_3_element.x", + &game.panel.ce_score_element[2].x + }, + { + "game.panel.ce_score_3_element.y", + &game.panel.ce_score_element[2].y + }, + { + "game.panel.ce_score_3_element.tile_size", + &game.panel.ce_score_element[2].size + }, + { + "game.panel.ce_score_3_element.element", + &game.panel.ce_score_element[2].id + }, + { + "game.panel.ce_score_4.x", + &game.panel.ce_score[3].x + }, + { + "game.panel.ce_score_4.y", + &game.panel.ce_score[3].y + }, + { + "game.panel.ce_score_4.align", + &game.panel.ce_score[3].align + }, + { + "game.panel.ce_score_4.valign", + &game.panel.ce_score[3].valign + }, + { + "game.panel.ce_score_4.digits", + &game.panel.ce_score[3].size + }, + { + "game.panel.ce_score_4.font", + &game.panel.ce_score[3].font + }, + { + "game.panel.ce_score_4.element", + &game.panel.ce_score[3].id + }, + { + "game.panel.ce_score_4_element.x", + &game.panel.ce_score_element[3].x + }, + { + "game.panel.ce_score_4_element.y", + &game.panel.ce_score_element[3].y + }, + { + "game.panel.ce_score_4_element.tile_size", + &game.panel.ce_score_element[3].size + }, + { + "game.panel.ce_score_4_element.element", + &game.panel.ce_score_element[3].id + }, + { + "game.panel.ce_score_5.x", + &game.panel.ce_score[4].x + }, + { + "game.panel.ce_score_5.y", + &game.panel.ce_score[4].y + }, + { + "game.panel.ce_score_5.align", + &game.panel.ce_score[4].align + }, + { + "game.panel.ce_score_5.valign", + &game.panel.ce_score[4].valign + }, + { + "game.panel.ce_score_5.digits", + &game.panel.ce_score[4].size + }, + { + "game.panel.ce_score_5.font", + &game.panel.ce_score[4].font + }, + { + "game.panel.ce_score_5.element", + &game.panel.ce_score[4].id + }, + { + "game.panel.ce_score_5_element.x", + &game.panel.ce_score_element[4].x + }, + { + "game.panel.ce_score_5_element.y", + &game.panel.ce_score_element[4].y + }, + { + "game.panel.ce_score_5_element.tile_size", + &game.panel.ce_score_element[4].size + }, + { + "game.panel.ce_score_5_element.element", + &game.panel.ce_score_element[4].id + }, + { + "game.panel.ce_score_6.x", + &game.panel.ce_score[5].x + }, + { + "game.panel.ce_score_6.y", + &game.panel.ce_score[5].y + }, + { + "game.panel.ce_score_6.align", + &game.panel.ce_score[5].align + }, + { + "game.panel.ce_score_6.valign", + &game.panel.ce_score[5].valign + }, + { + "game.panel.ce_score_6.digits", + &game.panel.ce_score[5].size + }, + { + "game.panel.ce_score_6.font", + &game.panel.ce_score[5].font + }, + { + "game.panel.ce_score_6.element", + &game.panel.ce_score[5].id + }, + { + "game.panel.ce_score_6_element.x", + &game.panel.ce_score_element[5].x + }, + { + "game.panel.ce_score_6_element.y", + &game.panel.ce_score_element[5].y + }, + { + "game.panel.ce_score_6_element.tile_size", + &game.panel.ce_score_element[5].size + }, + { + "game.panel.ce_score_6_element.element", + &game.panel.ce_score_element[5].id + }, + { + "game.panel.ce_score_7.x", + &game.panel.ce_score[6].x + }, + { + "game.panel.ce_score_7.y", + &game.panel.ce_score[6].y + }, + { + "game.panel.ce_score_7.align", + &game.panel.ce_score[6].align + }, + { + "game.panel.ce_score_7.valign", + &game.panel.ce_score[6].valign + }, + { + "game.panel.ce_score_7.digits", + &game.panel.ce_score[6].size + }, + { + "game.panel.ce_score_7.font", + &game.panel.ce_score[6].font + }, + { + "game.panel.ce_score_7.element", + &game.panel.ce_score[6].id + }, + { + "game.panel.ce_score_7_element.x", + &game.panel.ce_score_element[6].x + }, + { + "game.panel.ce_score_7_element.y", + &game.panel.ce_score_element[6].y + }, + { + "game.panel.ce_score_7_element.tile_size", + &game.panel.ce_score_element[6].size + }, + { + "game.panel.ce_score_7_element.element", + &game.panel.ce_score_element[6].id + }, + { + "game.panel.ce_score_8.x", + &game.panel.ce_score[7].x + }, + { + "game.panel.ce_score_8.y", + &game.panel.ce_score[7].y + }, + { + "game.panel.ce_score_8.align", + &game.panel.ce_score[7].align + }, + { + "game.panel.ce_score_8.valign", + &game.panel.ce_score[7].valign + }, + { + "game.panel.ce_score_8.digits", + &game.panel.ce_score[7].size + }, + { + "game.panel.ce_score_8.font", + &game.panel.ce_score[7].font + }, + { + "game.panel.ce_score_8.element", + &game.panel.ce_score[7].id + }, + { + "game.panel.ce_score_8_element.x", + &game.panel.ce_score_element[7].x + }, + { + "game.panel.ce_score_8_element.y", + &game.panel.ce_score_element[7].y + }, + { + "game.panel.ce_score_8_element.tile_size", + &game.panel.ce_score_element[7].size + }, + { + "game.panel.ce_score_8_element.element", + &game.panel.ce_score_element[7].id + }, { "game.panel.player_name.x", &game.panel.player_name.x diff --git a/src/conftime.h b/src/conftime.h index 685202d1..44d63dee 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-04-07 03:38" +#define COMPILE_DATE_STRING "2007-04-07 17:24" diff --git a/src/files.c b/src/files.c index cb57311a..7d32cda8 100644 --- a/src/files.c +++ b/src/files.c @@ -8344,6 +8344,54 @@ void LoadCustomElementDescriptions() freeSetupFileHash(setup_file_hash); } +static int getElementFromToken(char *token) +{ + int i; + + /* !!! OPTIMIZE THIS BY USING HASH !!! */ + for (i = 0; i < MAX_NUM_ELEMENTS; i++) + if (strEqual(token, element_info[i].token_name)) + return i; + + Error(ERR_WARN, "unknown element token '%s'", token); + + return EL_UNDEFINED; +} + +static int get_token_parameter_value(char *token, char *value_raw) +{ + char *suffix; + + if (token == NULL || value_raw == NULL) + return ARG_UNDEFINED_VALUE; + + suffix = strrchr(token, '.'); + if (suffix == NULL) + suffix = token; + +#if 1 + if (strEqual(suffix, ".element")) + return getElementFromToken(value_raw); +#endif + +#if 0 + if (strncmp(suffix, ".font", 5) == 0) + { + int i; + + /* !!! OPTIMIZE THIS BY USING HASH !!! */ + for (i = 0; i < NUM_FONTS; i++) + if (strEqual(value_raw, font_info[i].token_name)) + return i; + + /* if font not found, use reliable default value */ + return FONT_INITIAL_1; + } +#endif + + return get_parameter_value(value_raw, suffix, TYPE_INTEGER); +} + static void LoadSpecialMenuDesignSettingsFromFilename(char *filename) { static struct TitleMessageInfo tmi; diff --git a/src/game.c b/src/game.c index 2a9eabb0..f7cb0fe1 100644 --- a/src/game.c +++ b/src/game.c @@ -131,8 +131,8 @@ #if 1 /* game panel display and control definitions */ -#define GAME_PANEL_LEVEL_NUMBER 0 -#define GAME_PANEL_GEMS 1 +#define GAME_PANEL_LEVEL_NUMBER 0 +#define GAME_PANEL_GEMS 1 #define GAME_PANEL_INVENTORY_COUNT 2 #define GAME_PANEL_INVENTORY_FIRST_1 3 #define GAME_PANEL_INVENTORY_FIRST_2 4 @@ -161,7 +161,7 @@ #define GAME_PANEL_KEY_WHITE 27 #define GAME_PANEL_KEY_WHITE_COUNT 28 #define GAME_PANEL_SCORE 29 -#define GAME_PANEL_TIME 30 +#define GAME_PANEL_TIME 30 #define GAME_PANEL_TIME_HH 31 #define GAME_PANEL_TIME_MM 32 #define GAME_PANEL_TIME_SS 33 @@ -169,13 +169,13 @@ #define GAME_PANEL_SHIELD_NORMAL_TIME 35 #define GAME_PANEL_SHIELD_DEADLY 36 #define GAME_PANEL_SHIELD_DEADLY_TIME 37 -#define GAME_PANEL_EXIT 38 +#define GAME_PANEL_EXIT 38 #define GAME_PANEL_EMC_MAGIC_BALL 39 #define GAME_PANEL_EMC_MAGIC_BALL_SWITCH 40 -#define GAME_PANEL_LIGHT_SWITCH 41 +#define GAME_PANEL_LIGHT_SWITCH 41 #define GAME_PANEL_LIGHT_SWITCH_TIME 42 #define GAME_PANEL_TIMEGATE_SWITCH 43 -#define GAME_PANEL_TIMEGATE_SWITCH_TIME 44 +#define GAME_PANEL_TIMEGATE_SWITCH_TIME 44 #define GAME_PANEL_SWITCHGATE_SWITCH 45 #define GAME_PANEL_EMC_LENSES 46 #define GAME_PANEL_EMC_LENSES_TIME 47 @@ -188,23 +188,39 @@ #define GAME_PANEL_PENGUINS 54 #define GAME_PANEL_SOKOBAN_OBJECTS 55 #define GAME_PANEL_SOKOBAN_FIELDS 56 -#define GAME_PANEL_ROBOT_WHEEL 57 +#define GAME_PANEL_ROBOT_WHEEL 57 #define GAME_PANEL_CONVEYOR_BELT_1 58 -#define GAME_PANEL_CONVEYOR_BELT_1_SWITCH 59 -#define GAME_PANEL_CONVEYOR_BELT_2 60 -#define GAME_PANEL_CONVEYOR_BELT_2_SWITCH 61 -#define GAME_PANEL_CONVEYOR_BELT_3 62 -#define GAME_PANEL_CONVEYOR_BELT_3_SWITCH 63 -#define GAME_PANEL_CONVEYOR_BELT_4 64 +#define GAME_PANEL_CONVEYOR_BELT_2 59 +#define GAME_PANEL_CONVEYOR_BELT_3 60 +#define GAME_PANEL_CONVEYOR_BELT_4 61 +#define GAME_PANEL_CONVEYOR_BELT_1_SWITCH 62 +#define GAME_PANEL_CONVEYOR_BELT_2_SWITCH 63 +#define GAME_PANEL_CONVEYOR_BELT_3_SWITCH 64 #define GAME_PANEL_CONVEYOR_BELT_4_SWITCH 65 #define GAME_PANEL_MAGIC_WALL 66 #define GAME_PANEL_MAGIC_WALL_TIME 67 #define GAME_PANEL_GRAVITY_STATE 68 -#define GAME_PANEL_PLAYER_NAME 69 -#define GAME_PANEL_LEVEL_NAME 70 -#define GAME_PANEL_LEVEL_AUTHOR 71 - -#define NUM_GAME_PANEL_CONTROLS 72 +#define GAME_PANEL_CE_SCORE_1 69 +#define GAME_PANEL_CE_SCORE_2 70 +#define GAME_PANEL_CE_SCORE_3 71 +#define GAME_PANEL_CE_SCORE_4 72 +#define GAME_PANEL_CE_SCORE_5 73 +#define GAME_PANEL_CE_SCORE_6 74 +#define GAME_PANEL_CE_SCORE_7 75 +#define GAME_PANEL_CE_SCORE_8 76 +#define GAME_PANEL_CE_SCORE_1_ELEMENT 77 +#define GAME_PANEL_CE_SCORE_2_ELEMENT 78 +#define GAME_PANEL_CE_SCORE_3_ELEMENT 79 +#define GAME_PANEL_CE_SCORE_4_ELEMENT 80 +#define GAME_PANEL_CE_SCORE_5_ELEMENT 81 +#define GAME_PANEL_CE_SCORE_6_ELEMENT 82 +#define GAME_PANEL_CE_SCORE_7_ELEMENT 83 +#define GAME_PANEL_CE_SCORE_8_ELEMENT 84 +#define GAME_PANEL_PLAYER_NAME 85 +#define GAME_PANEL_LEVEL_NAME 86 +#define GAME_PANEL_LEVEL_AUTHOR 87 + +#define NUM_GAME_PANEL_CONTROLS 88 struct GamePanelControlInfo { @@ -237,82 +253,82 @@ static struct GamePanelControlInfo game_panel_controls[] = }, { GAME_PANEL_INVENTORY_FIRST_1, - &game.panel.inventory_first_1, + &game.panel.inventory_first[0], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_FIRST_2, - &game.panel.inventory_first_2, + &game.panel.inventory_first[1], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_FIRST_3, - &game.panel.inventory_first_3, + &game.panel.inventory_first[2], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_FIRST_4, - &game.panel.inventory_first_4, + &game.panel.inventory_first[3], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_FIRST_5, - &game.panel.inventory_first_5, + &game.panel.inventory_first[4], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_FIRST_6, - &game.panel.inventory_first_6, + &game.panel.inventory_first[5], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_FIRST_7, - &game.panel.inventory_first_7, + &game.panel.inventory_first[6], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_FIRST_8, - &game.panel.inventory_first_8, + &game.panel.inventory_first[7], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_LAST_1, - &game.panel.inventory_last_1, + &game.panel.inventory_last[0], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_LAST_2, - &game.panel.inventory_last_2, + &game.panel.inventory_last[1], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_LAST_3, - &game.panel.inventory_last_3, + &game.panel.inventory_last[2], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_LAST_4, - &game.panel.inventory_last_4, + &game.panel.inventory_last[3], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_LAST_5, - &game.panel.inventory_last_5, + &game.panel.inventory_last[4], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_LAST_6, - &game.panel.inventory_last_6, + &game.panel.inventory_last[5], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_LAST_7, - &game.panel.inventory_last_7, + &game.panel.inventory_last[6], TYPE_ELEMENT, }, { GAME_PANEL_INVENTORY_LAST_8, - &game.panel.inventory_last_8, + &game.panel.inventory_last[7], TYPE_ELEMENT, }, { @@ -512,42 +528,42 @@ static struct GamePanelControlInfo game_panel_controls[] = }, { GAME_PANEL_CONVEYOR_BELT_1, - &game.panel.conveyor_belt_1, + &game.panel.conveyor_belt[0], TYPE_ELEMENT, }, { - GAME_PANEL_CONVEYOR_BELT_1_SWITCH, - &game.panel.conveyor_belt_1_switch, + GAME_PANEL_CONVEYOR_BELT_2, + &game.panel.conveyor_belt[1], TYPE_ELEMENT, }, { - GAME_PANEL_CONVEYOR_BELT_2, - &game.panel.conveyor_belt_2, + GAME_PANEL_CONVEYOR_BELT_3, + &game.panel.conveyor_belt[2], TYPE_ELEMENT, }, { - GAME_PANEL_CONVEYOR_BELT_2_SWITCH, - &game.panel.conveyor_belt_2_switch, + GAME_PANEL_CONVEYOR_BELT_4, + &game.panel.conveyor_belt[3], TYPE_ELEMENT, }, { - GAME_PANEL_CONVEYOR_BELT_3, - &game.panel.conveyor_belt_3, + GAME_PANEL_CONVEYOR_BELT_1_SWITCH, + &game.panel.conveyor_belt_switch[0], TYPE_ELEMENT, }, { - GAME_PANEL_CONVEYOR_BELT_3_SWITCH, - &game.panel.conveyor_belt_3_switch, + GAME_PANEL_CONVEYOR_BELT_2_SWITCH, + &game.panel.conveyor_belt_switch[1], TYPE_ELEMENT, }, { - GAME_PANEL_CONVEYOR_BELT_4, - &game.panel.conveyor_belt_4, + GAME_PANEL_CONVEYOR_BELT_3_SWITCH, + &game.panel.conveyor_belt_switch[2], TYPE_ELEMENT, }, { GAME_PANEL_CONVEYOR_BELT_4_SWITCH, - &game.panel.conveyor_belt_4_switch, + &game.panel.conveyor_belt_switch[3], TYPE_ELEMENT, }, { @@ -565,6 +581,86 @@ static struct GamePanelControlInfo game_panel_controls[] = &game.panel.gravity_state, TYPE_STRING, }, + { + GAME_PANEL_CE_SCORE_1, + &game.panel.ce_score[0], + TYPE_INTEGER, + }, + { + GAME_PANEL_CE_SCORE_2, + &game.panel.ce_score[1], + TYPE_INTEGER, + }, + { + GAME_PANEL_CE_SCORE_3, + &game.panel.ce_score[2], + TYPE_INTEGER, + }, + { + GAME_PANEL_CE_SCORE_4, + &game.panel.ce_score[3], + TYPE_INTEGER, + }, + { + GAME_PANEL_CE_SCORE_5, + &game.panel.ce_score[4], + TYPE_INTEGER, + }, + { + GAME_PANEL_CE_SCORE_6, + &game.panel.ce_score[5], + TYPE_INTEGER, + }, + { + GAME_PANEL_CE_SCORE_7, + &game.panel.ce_score[6], + TYPE_INTEGER, + }, + { + GAME_PANEL_CE_SCORE_8, + &game.panel.ce_score[7], + TYPE_INTEGER, + }, + { + GAME_PANEL_CE_SCORE_1_ELEMENT, + &game.panel.ce_score_element[0], + TYPE_ELEMENT, + }, + { + GAME_PANEL_CE_SCORE_2_ELEMENT, + &game.panel.ce_score_element[1], + TYPE_ELEMENT, + }, + { + GAME_PANEL_CE_SCORE_3_ELEMENT, + &game.panel.ce_score_element[2], + TYPE_ELEMENT, + }, + { + GAME_PANEL_CE_SCORE_4_ELEMENT, + &game.panel.ce_score_element[3], + TYPE_ELEMENT, + }, + { + GAME_PANEL_CE_SCORE_5_ELEMENT, + &game.panel.ce_score_element[4], + TYPE_ELEMENT, + }, + { + GAME_PANEL_CE_SCORE_6_ELEMENT, + &game.panel.ce_score_element[5], + TYPE_ELEMENT, + }, + { + GAME_PANEL_CE_SCORE_7_ELEMENT, + &game.panel.ce_score_element[6], + TYPE_ELEMENT, + }, + { + GAME_PANEL_CE_SCORE_8_ELEMENT, + &game.panel.ce_score_element[7], + TYPE_ELEMENT, + }, { GAME_PANEL_PLAYER_NAME, &game.panel.player_name, @@ -1891,7 +1987,7 @@ void UpdateGameControlValues() stored_player[player_nr].num_white_keys; } - for (i = 0; i < 8; i++) + for (i = 0; i < NUM_PANEL_INVENTORY; i++) { game_panel_controls[GAME_PANEL_INVENTORY_FIRST_1 + i].value = get_inventory_element_from_pos(local_player, i); @@ -1975,26 +2071,14 @@ void UpdateGameControlValues() game_panel_controls[GAME_PANEL_ROBOT_WHEEL].value = (game.robot_wheel_active ? EL_ROBOT_WHEEL_ACTIVE : EL_ROBOT_WHEEL); - game_panel_controls[GAME_PANEL_CONVEYOR_BELT_1].value = - (game.belt_dir[0] != MV_NONE ? EL_CONVEYOR_BELT_1_MIDDLE_ACTIVE : - EL_CONVEYOR_BELT_1_MIDDLE); - game_panel_controls[GAME_PANEL_CONVEYOR_BELT_1_SWITCH].value = - getBeltSwitchElementFromBeltNrAndBeltDir(0, game.belt_dir[0]); - game_panel_controls[GAME_PANEL_CONVEYOR_BELT_2].value = - (game.belt_dir[1] != MV_NONE ? EL_CONVEYOR_BELT_2_MIDDLE_ACTIVE : - EL_CONVEYOR_BELT_2_MIDDLE); - game_panel_controls[GAME_PANEL_CONVEYOR_BELT_2_SWITCH].value = - getBeltSwitchElementFromBeltNrAndBeltDir(1, game.belt_dir[1]); - game_panel_controls[GAME_PANEL_CONVEYOR_BELT_3].value = - (game.belt_dir[2] != MV_NONE ? EL_CONVEYOR_BELT_3_MIDDLE_ACTIVE : - EL_CONVEYOR_BELT_3_MIDDLE); - game_panel_controls[GAME_PANEL_CONVEYOR_BELT_3_SWITCH].value = - getBeltSwitchElementFromBeltNrAndBeltDir(2, game.belt_dir[2]); - game_panel_controls[GAME_PANEL_CONVEYOR_BELT_4].value = - (game.belt_dir[3] != MV_NONE ? EL_CONVEYOR_BELT_4_MIDDLE_ACTIVE : - EL_CONVEYOR_BELT_4_MIDDLE); - game_panel_controls[GAME_PANEL_CONVEYOR_BELT_4_SWITCH].value = - getBeltSwitchElementFromBeltNrAndBeltDir(3, game.belt_dir[3]); + for (i = 0; i < NUM_BELTS; i++) + { + game_panel_controls[GAME_PANEL_CONVEYOR_BELT_1 + i].value = + (game.belt_dir[i] != MV_NONE ? EL_CONVEYOR_BELT_1_MIDDLE_ACTIVE : + EL_CONVEYOR_BELT_1_MIDDLE) + i; + game_panel_controls[GAME_PANEL_CONVEYOR_BELT_1_SWITCH + i].value = + getBeltSwitchElementFromBeltNrAndBeltDir(i, game.belt_dir[i]); + } game_panel_controls[GAME_PANEL_MAGIC_WALL].value = (game.magic_wall_active ? EL_MAGIC_WALL_ACTIVE : EL_MAGIC_WALL); @@ -2008,6 +2092,22 @@ void UpdateGameControlValues() game_panel_controls[GAME_PANEL_GRAVITY_STATE].value = game.gravity; #endif + for (i = 0; i < NUM_PANEL_CE_SCORE; i++) + { + if (game.panel.ce_score[i].id != EL_UNDEFINED) + { + int ce_score = element_info[game.panel.ce_score[i].id].collect_score; + + game_panel_controls[GAME_PANEL_CE_SCORE_1 + i].value = ce_score; + game_panel_controls[GAME_PANEL_CE_SCORE_1_ELEMENT + i].value = ce_score; + } + else + { + game_panel_controls[GAME_PANEL_CE_SCORE_1 + i].value = 0; + game_panel_controls[GAME_PANEL_CE_SCORE_1_ELEMENT + i].value = 0; + } + } + game_panel_controls[GAME_PANEL_PLAYER_NAME].value = 0; game_panel_controls[GAME_PANEL_LEVEL_NAME].value = 0; game_panel_controls[GAME_PANEL_LEVEL_AUTHOR].value = 0; @@ -2093,31 +2193,49 @@ void DisplayGameControlValues() max_width, max_height); } } - - pos->width = size * getFontWidth(font); } +#if 1 + /* correct text size if "digits" is zero or less */ + if (size <= 0) + size = strlen(int2str(value, size)); + + /* dynamically correct text alignment */ + pos->width = size * getFontWidth(font); +#endif + DrawText(PANEL_XPOS(pos), PANEL_YPOS(pos), int2str(value, size), font); } else if (type == TYPE_ELEMENT) { + int element, graphic; + Bitmap *src_bitmap; + int src_x, src_y; + int width, height; int dst_x = PANEL_XPOS(pos); int dst_y = PANEL_YPOS(pos); if (value == EL_UNDEFINED || value == EL_EMPTY) { - int src_x = DOOR_GFX_PAGEX5 + ALIGNED_TEXT_XPOS(pos); - int src_y = DOOR_GFX_PAGEY1 + ALIGNED_TEXT_YPOS(pos); + element = (last_value == EL_UNDEFINED ? EL_EMPTY : last_value); + graphic = el2panelimg(element); - BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto, src_x, src_y, - size, size, dst_x, dst_y); + src_bitmap = graphic_info[IMG_GLOBAL_DOOR].bitmap; + src_x = DOOR_GFX_PAGEX5 + ALIGNED_TEXT_XPOS(pos); + src_y = DOOR_GFX_PAGEY1 + ALIGNED_TEXT_YPOS(pos); } else { - int graphic = el2panelimg(value); + element = value; + graphic = el2panelimg(value); - DrawSizedGraphicExt(drawto, dst_x, dst_y, graphic, frame, size); + getSizedGraphicSource(graphic, frame, size, &src_bitmap, &src_x,&src_y); } + + width = graphic_info[graphic].width * size / TILESIZE; + height = graphic_info[graphic].height * size / TILESIZE; + + BlitBitmap(src_bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y); } else if (type == TYPE_STRING) { @@ -2150,21 +2268,22 @@ void DisplayGameControlValues() font = (active ? font2 : font1); } -#if 1 - /* as with numbers, don't truncate output if "chars" is zero or less */ - size = (size > 0 ? size : strlen(s)); -#endif - if (s != NULL) { - char *s_cut = getStringCopyN(s, size); + char *s_cut; -#if 0 - /* (not needed anymore with above correction of "size" value) */ - size = strlen(s_cut); /* string size may be smaller than "chars" */ +#if 1 + if (size <= 0) + { + /* don't truncate output if "chars" is zero or less */ + size = strlen(s); + + /* dynamically correct text alignment */ + pos->width = size * getFontWidth(font); + } #endif - pos->width = size * getFontWidth(font); + s_cut = getStringCopyN(s, size); DrawText(PANEL_XPOS(pos), PANEL_YPOS(pos), s_cut, font); diff --git a/src/game.h b/src/game.h index 55a0b5e8..ace61a5b 100644 --- a/src/game.h +++ b/src/game.h @@ -18,9 +18,15 @@ /* #include "main.h" */ #define MAX_INVENTORY_SIZE 1000 + #define STD_NUM_KEYS 4 #define MAX_NUM_KEYS 8 +#define NUM_BELTS 4 +#define NUM_BELT_PARTS 3 + +#define NUM_PANEL_INVENTORY 8 +#define NUM_PANEL_CE_SCORE 8 #if 1 struct GamePanelInfo @@ -28,22 +34,8 @@ struct GamePanelInfo struct TextPosInfo level_number; struct TextPosInfo gems; struct TextPosInfo inventory_count; - struct TextPosInfo inventory_first_1; - struct TextPosInfo inventory_first_2; - struct TextPosInfo inventory_first_3; - struct TextPosInfo inventory_first_4; - struct TextPosInfo inventory_first_5; - struct TextPosInfo inventory_first_6; - struct TextPosInfo inventory_first_7; - struct TextPosInfo inventory_first_8; - struct TextPosInfo inventory_last_1; - struct TextPosInfo inventory_last_2; - struct TextPosInfo inventory_last_3; - struct TextPosInfo inventory_last_4; - struct TextPosInfo inventory_last_5; - struct TextPosInfo inventory_last_6; - struct TextPosInfo inventory_last_7; - struct TextPosInfo inventory_last_8; + struct TextPosInfo inventory_first[NUM_PANEL_INVENTORY]; + struct TextPosInfo inventory_last[NUM_PANEL_INVENTORY]; struct TextPosInfo key[MAX_NUM_KEYS]; struct TextPosInfo key_white; struct TextPosInfo key_white_count; @@ -76,17 +68,13 @@ struct GamePanelInfo struct TextPosInfo sokoban_objects; struct TextPosInfo sokoban_fields; struct TextPosInfo robot_wheel; - struct TextPosInfo conveyor_belt_1; - struct TextPosInfo conveyor_belt_1_switch; - struct TextPosInfo conveyor_belt_2; - struct TextPosInfo conveyor_belt_2_switch; - struct TextPosInfo conveyor_belt_3; - struct TextPosInfo conveyor_belt_3_switch; - struct TextPosInfo conveyor_belt_4; - struct TextPosInfo conveyor_belt_4_switch; + struct TextPosInfo conveyor_belt[NUM_BELTS]; + struct TextPosInfo conveyor_belt_switch[NUM_BELTS]; struct TextPosInfo magic_wall; struct TextPosInfo magic_wall_time; struct TextPosInfo gravity_state; + struct TextPosInfo ce_score[NUM_PANEL_CE_SCORE]; + struct TextPosInfo ce_score_element[NUM_PANEL_CE_SCORE]; struct TextPosInfo player_name; struct TextPosInfo level_name; struct TextPosInfo level_author; diff --git a/src/libgame/misc.c b/src/libgame/misc.c index e300b9bb..b93c9bde 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -607,6 +607,23 @@ boolean strEqualN(char *s1, char *s2, int n) strncmp(s1, s2, n) == 0); } +boolean strEqualPrefix(char *s, char *prefix) +{ + return (s == NULL && prefix == NULL ? TRUE : + s == NULL && prefix != NULL ? FALSE : + s != NULL && prefix == NULL ? FALSE : + strncmp(s, prefix, strlen(prefix)) == 0); +} + +boolean strEqualSuffix(char *s, char *suffix) +{ + return (s == NULL && suffix == NULL ? TRUE : + s == NULL && suffix != NULL ? FALSE : + s != NULL && suffix == NULL ? FALSE : + strlen(s) < strlen(suffix) ? FALSE : + strncmp(&s[strlen(s) - strlen(suffix)], suffix, strlen(suffix)) == 0); +} + /* ------------------------------------------------------------------------- */ /* command line option handling functions */ @@ -1853,7 +1870,11 @@ int get_parameter_value(char *value_raw, char *suffix, int type) string_has_parameter(value, "melt") ? FADE_MODE_MELT : FADE_MODE_DEFAULT); } +#if 1 + else if (strEqualPrefix(suffix, ".font")) /* (may also be ".font_xyz") */ +#else else if (strEqualN(suffix, ".font", 5)) /* (may also be ".font_xyz") */ +#endif { result = gfx.get_font_from_token_function(value); } @@ -1870,35 +1891,6 @@ int get_parameter_value(char *value_raw, char *suffix, int type) return result; } -int get_token_parameter_value(char *token, char *value_raw) -{ - char *suffix; - - if (token == NULL || value_raw == NULL) - return ARG_UNDEFINED_VALUE; - - suffix = strrchr(token, '.'); - if (suffix == NULL) - suffix = token; - -#if 0 - if (strncmp(suffix, ".font", 5) == 0) - { - int i; - - /* !!! OPTIMIZE THIS BY USING HASH !!! */ - for (i = 0; i < NUM_FONTS; i++) - if (strEqual(value_raw, font_info[i].token_name)) - return i; - - /* if font not found, use reliable default value */ - return FONT_INITIAL_1; - } -#endif - - return get_parameter_value(value_raw, suffix, TYPE_INTEGER); -} - struct ScreenModeInfo *get_screen_mode_from_string(char *screen_mode_string) { static struct ScreenModeInfo screen_mode; diff --git a/src/libgame/misc.h b/src/libgame/misc.h index cd4b2dd0..3d011184 100644 --- a/src/libgame/misc.h +++ b/src/libgame/misc.h @@ -108,6 +108,8 @@ char *getStringToLower(char *); void setString(char **, char *); boolean strEqual(char *, char *); boolean strEqualN(char *, char *, int); +boolean strEqualPrefix(char *, char *); +boolean strEqualSuffix(char *, char *); void GetOptions(char **, void (*print_usage_function)(void)); @@ -182,7 +184,6 @@ boolean FileIsArtworkType(char *, int); char *get_mapped_token(char *); int get_parameter_value(char *, char *, int); -int get_token_parameter_value(char *, char *); struct ScreenModeInfo *get_screen_mode_from_string(char *); void get_aspect_ratio_from_screen_mode(struct ScreenModeInfo *, int *x, int *y); diff --git a/src/libgame/system.h b/src/libgame/system.h index c0e5d776..0a306068 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1052,6 +1052,7 @@ struct TextPosInfo int align, valign; int size; int font, font_alt; + int id; }; diff --git a/src/main.h b/src/main.h index eb6b4386..1e62cc61 100644 --- a/src/main.h +++ b/src/main.h @@ -858,8 +858,6 @@ #define MAX_NUM_AMOEBA 100 -#define NUM_BELTS 4 -#define NUM_BELT_PARTS 3 #define NUM_ENVELOPES 4 #define MIN_ENVELOPE_XSIZE 1 #define MIN_ENVELOPE_YSIZE 1 -- 2.34.1