From 756a24e132e64d1514e85b8fa09f123e75417fd0 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 28 Feb 2003 22:05:51 +0100 Subject: [PATCH] rnd-20030228-1-src --- src/conf_gfx.c | 148 +++++++++++++++++++++---------------------- src/conftime.h | 2 +- src/init.c | 25 ++------ src/libgame/misc.c | 76 ++++++++++++++++++++-- src/libgame/misc.h | 2 +- src/libgame/system.h | 9 +++ src/libgame/toons.h | 25 -------- src/main.h | 33 +++++----- 8 files changed, 175 insertions(+), 145 deletions(-) diff --git a/src/conf_gfx.c b/src/conf_gfx.c index d73f922a..0a6e17e7 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -32,14 +32,10 @@ struct ConfigInfo image_config_suffix[] = { ".xoffset", ARG_UNDEFINED, TYPE_INTEGER }, { ".yoffset", ARG_UNDEFINED, TYPE_INTEGER }, { ".frames", ARG_UNDEFINED, TYPE_INTEGER }, + { ".frames_per_line", ARG_UNDEFINED, TYPE_INTEGER }, { ".start_frame", ARG_UNDEFINED, TYPE_INTEGER }, { ".delay", "1", TYPE_INTEGER }, - { ".mode_loop", "false", TYPE_BOOLEAN }, - { ".mode_linear", "false", TYPE_BOOLEAN }, - { ".mode_pingpong", "false", TYPE_BOOLEAN }, - { ".mode_pingpong2", "false", TYPE_BOOLEAN }, - { ".mode_random", "false", TYPE_BOOLEAN }, - { ".mode_reverse", "false", TYPE_BOOLEAN }, + { ".anim_mode", ARG_UNDEFINED, TYPE_STRING }, { ".global_sync", "false", TYPE_BOOLEAN }, { ".step_offset", "4", TYPE_INTEGER }, { ".step_delay", "1", TYPE_INTEGER }, @@ -47,6 +43,7 @@ struct ConfigInfo image_config_suffix[] = { ".position", ARG_UNDEFINED, TYPE_STRING }, { ".draw_xoffset", "0", TYPE_INTEGER }, { ".draw_yoffset", "0", TYPE_INTEGER }, + { ".format", ARG_UNDEFINED, TYPE_STRING }, { ".name", ARG_UNDEFINED, TYPE_STRING }, { NULL, NULL, 0 } @@ -80,7 +77,7 @@ struct ConfigInfo image_config[] = { "bd_rock.moving.left.ypos", "10" }, { "bd_rock.moving.left.frames", "4" }, { "bd_rock.moving.left.delay", "2" }, - { "bd_rock.moving.left.mode_reverse", "true" }, + { "bd_rock.moving.left.anim_mode", "reverse" }, { "bd_rock.moving.right", "RocksDC.pcx" }, { "bd_rock.moving.right.xpos", "12" }, { "bd_rock.moving.right.ypos", "10" }, @@ -93,7 +90,7 @@ struct ConfigInfo image_config[] = { "bd_diamond.ypos", "10" }, { "bd_diamond.frames", "4" }, { "bd_diamond.delay", "4" }, - { "bd_diamond.mode_reverse", "true" }, + { "bd_diamond.anim_mode", "reverse" }, { "bd_diamond.moving", "RocksElements.pcx" }, { "bd_diamond.moving.xpos", "3" }, { "bd_diamond.moving.ypos", "10" }, @@ -113,28 +110,28 @@ struct ConfigInfo image_config[] = { "bd_magic_wall.active.xpos", "12" }, { "bd_magic_wall.active.ypos", "10" }, { "bd_magic_wall.active.frames", "4" }, - { "bd_magic_wall.active.mode_reverse", "true" }, + { "bd_magic_wall.active.anim_mode", "reverse" }, { "bd_magic_wall.active.delay", "4" }, { "bd_magic_wall.active.global_sync", "true" }, { "bd_magic_wall_filling", "RocksElements.pcx" }, { "bd_magic_wall_filling.xpos", "12" }, { "bd_magic_wall_filling.ypos", "10" }, { "bd_magic_wall_filling.frames", "4" }, - { "bd_magic_wall_filling.mode_reverse", "true" }, + { "bd_magic_wall_filling.anim_mode", "reverse" }, { "bd_magic_wall_filling.delay", "4" }, { "bd_magic_wall_filling.global_sync", "true" }, { "bd_magic_wall_full", "RocksElements.pcx" }, { "bd_magic_wall_full.xpos", "12" }, { "bd_magic_wall_full.ypos", "10" }, { "bd_magic_wall_full.frames", "4" }, - { "bd_magic_wall_full.mode_reverse", "true" }, + { "bd_magic_wall_full.anim_mode", "reverse" }, { "bd_magic_wall_full.delay", "4" }, { "bd_magic_wall_full.global_sync", "true" }, { "bd_magic_wall_emptying", "RocksElements.pcx" }, { "bd_magic_wall_emptying.xpos", "12" }, { "bd_magic_wall_emptying.ypos", "10" }, { "bd_magic_wall_emptying.frames", "4" }, - { "bd_magic_wall_emptying.mode_reverse", "true" }, + { "bd_magic_wall_emptying.anim_mode", "reverse" }, { "bd_magic_wall_emptying.delay", "4" }, { "bd_magic_wall_emptying.global_sync", "true" }, { "bd_magic_wall_dead", "RocksElements.pcx" }, @@ -147,7 +144,7 @@ struct ConfigInfo image_config[] = { "bd_amoeba.ypos", "6" }, { "bd_amoeba.frames", "4" }, { "bd_amoeba.delay", "1000000" }, - { "bd_amoeba.mode_random", "true" }, + { "bd_amoeba.anim_mode", "random" }, { "bd_amoeba.EDITOR", "RocksElements.pcx" }, { "bd_amoeba.EDITOR.xpos", "8" }, { "bd_amoeba.EDITOR.ypos", "7" }, @@ -156,7 +153,7 @@ struct ConfigInfo image_config[] = { "bd_butterfly.xpos", "4" }, { "bd_butterfly.ypos", "12" }, { "bd_butterfly.frames", "2" }, - { "bd_butterfly.mode_pingpong", "true" }, + { "bd_butterfly.anim_mode", "pingpong" }, { "bd_butterfly.delay", "4" }, { "bd_butterfly.right", "RocksElements.pcx" }, { "bd_butterfly.right.xpos", "8" }, @@ -178,14 +175,14 @@ struct ConfigInfo image_config[] = { "bd_butterfly.moving.xpos", "4" }, { "bd_butterfly.moving.ypos", "12" }, { "bd_butterfly.moving.frames", "2" }, - { "bd_butterfly.moving.mode_pingpong", "true" }, + { "bd_butterfly.moving.anim_mode", "pingpong" }, { "bd_butterfly.moving.delay", "4" }, { "bd_firefly", "RocksElements.pcx" }, { "bd_firefly.xpos", "6" }, { "bd_firefly.ypos", "12" }, { "bd_firefly.frames", "2" }, - { "bd_firefly.mode_pingpong", "true" }, + { "bd_firefly.anim_mode", "pingpong" }, { "bd_firefly.delay", "4" }, { "bd_firefly.right", "RocksElements.pcx" }, { "bd_firefly.right.xpos", "12" }, @@ -207,7 +204,7 @@ struct ConfigInfo image_config[] = { "bd_firefly.moving.xpos", "6" }, { "bd_firefly.moving.ypos", "12" }, { "bd_firefly.moving.frames", "2" }, - { "bd_firefly.moving.mode_pingpong", "true" }, + { "bd_firefly.moving.anim_mode", "pingpong" }, { "bd_firefly.moving.delay", "4" }, /* images for Supaplex style elements and actions */ @@ -230,7 +227,7 @@ struct ConfigInfo image_config[] = { "sp_zonk.moving.left.ypos", "6" }, { "sp_zonk.moving.left.frames", "4" }, { "sp_zonk.moving.left.delay", "2" }, - { "sp_zonk.moving.left.mode_reverse", "true" }, + { "sp_zonk.moving.left.anim_mode", "reverse" }, { "sp_zonk.moving.right", "RocksSP.pcx" }, { "sp_zonk.moving.right.xpos", "0" }, { "sp_zonk.moving.right.ypos", "6" }, @@ -251,25 +248,25 @@ struct ConfigInfo image_config[] = { "sp_murphy.moving.left.xpos", "8" }, { "sp_murphy.moving.left.ypos", "0" }, { "sp_murphy.moving.left.frames", "3" }, - { "sp_murphy.moving.left.mode_pingpong", "true" }, + { "sp_murphy.moving.left.anim_mode", "pingpong" }, { "sp_murphy.moving.left.delay", "2" }, { "sp_murphy.moving.right", "RocksSP.pcx" }, { "sp_murphy.moving.right.xpos", "11" }, { "sp_murphy.moving.right.ypos", "0" }, { "sp_murphy.moving.right.frames", "3" }, - { "sp_murphy.moving.right.mode_pingpong", "true" }, + { "sp_murphy.moving.right.anim_mode", "pingpong" }, { "sp_murphy.moving.right.delay", "2" }, { "sp_murphy.digging.left", "RocksSP.pcx" }, { "sp_murphy.digging.left.xpos", "8" }, { "sp_murphy.digging.left.ypos", "0" }, { "sp_murphy.digging.left.frames", "3" }, - { "sp_murphy.digging.left.mode_pingpong", "true" }, + { "sp_murphy.digging.left.anim_mode", "pingpong" }, { "sp_murphy.digging.left.delay", "2" }, { "sp_murphy.digging.right", "RocksSP.pcx" }, { "sp_murphy.digging.right.xpos", "11" }, { "sp_murphy.digging.right.ypos", "0" }, { "sp_murphy.digging.right.frames", "3" }, - { "sp_murphy.digging.right.mode_pingpong", "true" }, + { "sp_murphy.digging.right.anim_mode", "pingpong" }, { "sp_murphy.digging.right.delay", "2" }, { "sp_murphy.pushing.left", "RocksSP.pcx" }, { "sp_murphy.pushing.left.xpos", "11" }, @@ -448,22 +445,22 @@ struct ConfigInfo image_config[] = { "sp_sniksnak.left.xpos", "8" }, { "sp_sniksnak.left.ypos", "8" }, { "sp_sniksnak.left.frames", "4" }, - { "sp_sniksnak.left.mode_pingpong2", "true" }, + { "sp_sniksnak.left.anim_mode", "pingpong2" }, { "sp_sniksnak.right", "RocksSP.pcx" }, { "sp_sniksnak.right.xpos", "12" }, { "sp_sniksnak.right.ypos", "8" }, { "sp_sniksnak.right.frames", "4" }, - { "sp_sniksnak.right.mode_pingpong2", "true" }, + { "sp_sniksnak.right.anim_mode", "pingpong2" }, { "sp_sniksnak.up", "RocksSP.pcx" }, { "sp_sniksnak.up.xpos", "8" }, { "sp_sniksnak.up.ypos", "9" }, { "sp_sniksnak.up.frames", "4" }, - { "sp_sniksnak.up.mode_pingpong2", "true" }, + { "sp_sniksnak.up.anim_mode", "pingpong2" }, { "sp_sniksnak.down", "RocksSP.pcx" }, { "sp_sniksnak.down.xpos", "12" }, { "sp_sniksnak.down.ypos", "9" }, { "sp_sniksnak.down.frames", "4" }, - { "sp_sniksnak.down.mode_pingpong2", "true" }, + { "sp_sniksnak.down.anim_mode", "pingpong2" }, { "sp_electron", "RocksSP.pcx" }, { "sp_electron.xpos", "8" }, @@ -500,7 +497,7 @@ struct ConfigInfo image_config[] = { "sp_buggy_base.active.xpos", "8" }, { "sp_buggy_base.active.ypos", "6" }, { "sp_buggy_base.active.frames", "4" }, - { "sp_buggy_base.active.mode_random", "true" }, + { "sp_buggy_base.active.anim_mode", "random" }, { "sp_hard_base1", "RocksSP.pcx" }, { "sp_hard_base1.xpos", "4" }, @@ -532,13 +529,13 @@ struct ConfigInfo image_config[] = { "sp_explosion.ypos", "3" }, { "sp_explosion.frames", "8" }, { "sp_explosion.delay", "3" }, - { "sp_explosion.mode_linear", "true" }, + { "sp_explosion.anim_mode", "linear" }, { "sp_explosion_infotron", "RocksSP.pcx" }, { "sp_explosion_infotron.xpos", "8" }, { "sp_explosion_infotron.ypos", "4" }, { "sp_explosion_infotron.frames", "8" }, { "sp_explosion.delay", "3" }, - { "sp_explosion.mode_linear", "true" }, + { "sp_explosion.anim_mode", "linear" }, /* images for Sokoban style elements and actions */ @@ -603,7 +600,7 @@ struct ConfigInfo image_config[] = { "rock.moving.left.ypos", "0" }, { "rock.moving.left.frames", "4" }, { "rock.moving.left.delay", "2" }, - { "rock.moving.left.mode_reverse", "true" }, + { "rock.moving.left.anim_mode", "reverse" }, { "rock.moving.right", "RocksElements.pcx" }, { "rock.moving.right.xpos", "12" }, { "rock.moving.right.ypos", "0" }, @@ -667,7 +664,7 @@ struct ConfigInfo image_config[] = { "nut.cracking.ypos", "1" }, { "nut.cracking.frames", "3" }, { "nut.cracking.delay", "2" }, - { "nut.cracking.mode_linear", "true" }, + { "nut.cracking.anim_mode", "linear" }, { "dynamite", "RocksElements.pcx" }, { "dynamite.xpos", "0" }, @@ -681,7 +678,7 @@ struct ConfigInfo image_config[] = { "dynamite.active.ypos", "3" }, { "dynamite.active.frames", "7" }, { "dynamite.active.delay", "12" }, - { "dynamite.active.mode_linear", "true" }, + { "dynamite.active.anim_mode", "linear" }, { "dynamite.active.EDITOR", "RocksElements.pcx" }, { "dynamite.active.EDITOR.xpos", "1" }, { "dynamite.active.EDITOR.ypos", "14" }, @@ -750,7 +747,7 @@ struct ConfigInfo image_config[] = { "yamyam.xpos", "0" }, { "yamyam.ypos", "5" }, { "yamyam.frames", "4" }, - { "yamyam.mode_pingpong2", "true" }, + { "yamyam.anim_mode", "pingpong2" }, { "yamyam.moving", "RocksElements.pcx" }, { "yamyam.moving.xpos", "0" }, { "yamyam.moving.ypos", "5" }, @@ -760,7 +757,7 @@ struct ConfigInfo image_config[] = { "robot.xpos", "4" }, { "robot.ypos", "5" }, { "robot.frames", "4" }, - { "robot.mode_pingpong2", "true" }, + { "robot.anim_mode", "pingpong2" }, { "robot.moving", "RocksElements.pcx" }, { "robot.moving.xpos", "4" }, { "robot.moving.ypos", "5" }, @@ -783,28 +780,28 @@ struct ConfigInfo image_config[] = { "magic_wall.active.xpos", "0" }, { "magic_wall.active.ypos", "8" }, { "magic_wall.active.frames", "4" }, - { "magic_wall.active.mode_reverse", "true" }, + { "magic_wall.active.anim_mode", "reverse" }, { "magic_wall.active.delay", "4" }, { "magic_wall.active.global_sync", "true" }, { "magic_wall_filling", "RocksElements.pcx" }, { "magic_wall_filling.xpos", "0" }, { "magic_wall_filling.ypos", "8" }, { "magic_wall_filling.frames", "4" }, - { "magic_wall_filling.mode_reverse", "true" }, + { "magic_wall_filling.anim_mode", "reverse" }, { "magic_wall_filling.delay", "4" }, { "magic_wall_filling.global_sync", "true" }, { "magic_wall_full", "RocksElements.pcx" }, { "magic_wall_full.xpos", "0" }, { "magic_wall_full.ypos", "8" }, { "magic_wall_full.frames", "4" }, - { "magic_wall_full.mode_reverse", "true" }, + { "magic_wall_full.anim_mode", "reverse" }, { "magic_wall_full.delay", "4" }, { "magic_wall_full.global_sync", "true" }, { "magic_wall_emptying", "RocksElements.pcx" }, { "magic_wall_emptying.xpos", "0" }, { "magic_wall_emptying.ypos", "8" }, { "magic_wall_emptying.frames", "4" }, - { "magic_wall_emptying.mode_reverse", "true" }, + { "magic_wall_emptying.anim_mode", "reverse" }, { "magic_wall_emptying.delay", "4" }, { "magic_wall_emptying.global_sync", "true" }, { "magic_wall_dead", "RocksElements.pcx" }, @@ -864,13 +861,13 @@ struct ConfigInfo image_config[] = { "acid_splash.left.ypos", "10" }, { "acid_splash.left.frames", "4" }, { "acid_splash.left.delay", "2" }, - { "acid_splash.left.mode_linear", "true" }, + { "acid_splash.left.anim_mode", "linear" }, { "acid_splash.right", "RocksHeroes.pcx" }, { "acid_splash.right.xpos", "12" }, { "acid_splash.right.ypos", "10" }, { "acid_splash.right.frames", "4" }, { "acid_splash.right.delay", "2" }, - { "acid_splash.right.mode_linear", "true" }, + { "acid_splash.right.anim_mode", "linear" }, { "amoeba_drop", "RocksElements.pcx" }, { "amoeba_drop.xpos", "5" }, @@ -881,20 +878,19 @@ struct ConfigInfo image_config[] = { "amoeba_creating.ypos", "6" }, { "amoeba_creating.frames", "3" }, { "amoeba_creating.delay", "2" }, - { "amoeba_creating.mode_linear", "true" }, + { "amoeba_creating.anim_mode", "linear" }, { "amoeba.shrinking", "RocksElements.pcx" }, { "amoeba.shrinking.xpos", "5" }, { "amoeba.shrinking.ypos", "6" }, { "amoeba.shrinking.frames", "3" }, { "amoeba.shrinking.delay", "2" }, - { "amoeba.shrinking.mode_linear", "true" }, - { "amoeba.shrinking.mode_reverse", "true" }, + { "amoeba.shrinking.anim_mode", "loop,linear,reverse" }, { "amoeba_wet", "RocksElements.pcx" }, { "amoeba_wet.xpos", "8" }, { "amoeba_wet.ypos", "6" }, { "amoeba_wet.frames", "4" }, { "amoeba_wet.delay", "1000000" }, - { "amoeba_wet.mode_random", "true" }, + { "amoeba_wet.anim_mode", "random" }, { "amoeba_wet.EDITOR", "RocksElements.pcx" }, { "amoeba_wet.EDITOR.xpos", "4" }, { "amoeba_wet.EDITOR.ypos", "6" }, @@ -903,19 +899,19 @@ struct ConfigInfo image_config[] = { "amoeba_dripping.ypos", "6" }, { "amoeba_dripping.frames", "4" }, { "amoeba_dripping.delay", "1000000" }, - { "amoeba_dripping.mode_random", "true" }, + { "amoeba_dripping.anim_mode", "random" }, { "amoeba_dry", "RocksElements.pcx" }, { "amoeba_dry.xpos", "8" }, { "amoeba_dry.ypos", "6" }, { "amoeba_dry.frames", "4" }, { "amoeba_dry.delay", "1000000" }, - { "amoeba_dry.mode_random", "true" }, + { "amoeba_dry.anim_mode", "random" }, { "amoeba_full", "RocksElements.pcx" }, { "amoeba_full.xpos", "8" }, { "amoeba_full.ypos", "6" }, { "amoeba_full.frames", "4" }, { "amoeba_full.delay", "1000000" }, - { "amoeba_full.mode_random", "true" }, + { "amoeba_full.anim_mode", "random" }, { "amoeba_full.EDITOR", "RocksElements.pcx" }, { "amoeba_full.EDITOR.xpos", "8" }, { "amoeba_full.EDITOR.ypos", "7" }, @@ -924,7 +920,7 @@ struct ConfigInfo image_config[] = { "amoeba_dead.ypos", "6" }, { "amoeba_dead.frames", "4" }, { "amoeba_dead.delay", "1000000" }, - { "amoeba_dead.mode_random", "true" }, + { "amoeba_dead.anim_mode", "random" }, { "amoeba_dead.EDITOR", "RocksElements.pcx" }, { "amoeba_dead.EDITOR.xpos", "12" }, { "amoeba_dead.EDITOR.ypos", "6" }, @@ -1000,13 +996,13 @@ struct ConfigInfo image_config[] = { "exit.opening.ypos", "11" }, { "exit.opening.frames", "5" }, { "exit.opening.delay", "6" }, - { "exit.opening.mode_linear", "true" }, + { "exit.opening.anim_mode", "linear" }, { "exit_open", "RocksElements.pcx" }, { "exit_open.xpos", "4" }, { "exit_open.ypos", "11" }, { "exit_open.frames", "4" }, { "exit_open.delay", "4" }, - { "exit_open.mode_pingpong", "true" }, + { "exit_open.anim_mode", "pingpong" }, /* images for Emerald Mine Club style elements and actions */ @@ -1018,7 +1014,7 @@ struct ConfigInfo image_config[] = { "balloon.moving.xpos", "12" }, { "balloon.moving.ypos", "7" }, { "balloon.moving.frames", "4" }, - { "balloon.moving.mode_pingpong", "true" }, + { "balloon.moving.anim_mode", "pingpong" }, { "balloon.moving.delay", "2" }, { "balloon_send.left", "RocksDC.pcx" }, @@ -1368,7 +1364,7 @@ struct ConfigInfo image_config[] = { "shield_normal.active.ypos", "13" }, { "shield_normal.active.frames", "3" }, { "shield_normal.active.delay", "8" }, - { "shield_normal.active.mode_pingpong", "true" }, + { "shield_normal.active.anim_mode", "pingpong" }, { "shield_deadly", "RocksDC.pcx" }, { "shield_deadly.xpos", "8" }, @@ -1380,7 +1376,7 @@ struct ConfigInfo image_config[] = { "shield_deadly.active.ypos", "13" }, { "shield_deadly.active.frames", "3" }, { "shield_deadly.active.delay", "8" }, - { "shield_deadly.active.mode_pingpong", "true" }, + { "shield_deadly.active.anim_mode", "pingpong" }, { "switchgate_closed", "RocksDC.pcx" }, { "switchgate_closed.xpos", "8" }, @@ -1400,7 +1396,7 @@ struct ConfigInfo image_config[] = { "switchgate.closing.ypos", "5" }, { "switchgate.closing.frames", "5" }, { "switchgate.closing.delay", "6" }, - { "switchgate.closing.mode_reverse", "true" }, + { "switchgate.closing.anim_mode", "reverse" }, { "timegate_closed", "RocksDC.pcx" }, { "timegate_closed.xpos", "8" }, @@ -1420,7 +1416,7 @@ struct ConfigInfo image_config[] = { "timegate.closing.ypos", "6" }, { "timegate.closing.frames", "5" }, { "timegate.closing.delay", "6" }, - { "timegate.closing.mode_reverse", "true" }, + { "timegate.closing.anim_mode", "reverse" }, { "pearl", "RocksDC.pcx" }, { "pearl.xpos", "8" }, @@ -1431,7 +1427,7 @@ struct ConfigInfo image_config[] = { "pearl.breaking.ypos", "12" }, { "pearl.breaking.frames", "4" }, { "pearl.breaking.delay", "2" }, - { "pearl.breaking.mode_linear", "4" }, + { "pearl.breaking.anim_mode", "linear" }, { "crystal", "RocksDC.pcx" }, { "crystal.xpos", "9" }, @@ -1514,7 +1510,7 @@ struct ConfigInfo image_config[] = { "trap.active.ypos", "8" }, { "trap.active.frames", "4" }, { "trap.active.delay", "4" }, - { "trap.active.mode_pingpong2", "true" }, + { "trap.active.anim_mode", "pingpong2" }, { "dx_supabomb", "RocksDC.pcx" }, { "dx_supabomb.xpos", "15" }, @@ -1611,28 +1607,28 @@ struct ConfigInfo image_config[] = { "pacman.right.xpos", "8" }, { "pacman.right.ypos", "5" }, { "pacman.right.frames", "2" }, - { "pacman.right.mode_reverse", "true" }, + { "pacman.right.anim_mode", "reverse" }, { "pacman.right.delay", "4" }, { "pacman.right.offset", "128" }, { "pacman.up", "RocksElements.pcx" }, { "pacman.up.xpos", "9" }, { "pacman.up.ypos", "5" }, { "pacman.up.frames", "2" }, - { "pacman.up.mode_reverse", "true" }, + { "pacman.up.anim_mode", "reverse" }, { "pacman.up.delay", "4" }, { "pacman.up.offset", "128" }, { "pacman.left", "RocksElements.pcx" }, { "pacman.left.xpos", "10" }, { "pacman.left.ypos", "5" }, { "pacman.left.frames", "2" }, - { "pacman.left.mode_reverse", "true" }, + { "pacman.left.anim_mode", "reverse" }, { "pacman.left.delay", "4" }, { "pacman.left.offset", "128" }, { "pacman.down", "RocksElements.pcx" }, { "pacman.down.xpos", "11" }, { "pacman.down.ypos", "5" }, { "pacman.down.frames", "2" }, - { "pacman.down.mode_reverse", "true" }, + { "pacman.down.anim_mode", "reverse" }, { "pacman.down.delay", "4" }, { "pacman.down.offset", "128" }, @@ -1748,25 +1744,25 @@ struct ConfigInfo image_config[] = { "wall_growing.active.left.ypos", "10" }, { "wall_growing.active.left.frames", "3" }, { "wall_growing.active.left.delay", "6" }, - { "wall_growing.active.left.mode_linear", "true" }, + { "wall_growing.active.left.anim_mode", "linear" }, { "wall_growing.active.right", "RocksElements.pcx" }, { "wall_growing.active.right.xpos", "5" }, { "wall_growing.active.right.ypos", "10" }, { "wall_growing.active.right.frames", "3" }, { "wall_growing.active.right.delay", "6" }, - { "wall_growing.active.right.mode_linear", "true" }, + { "wall_growing.active.right.anim_mode", "linear" }, { "wall_growing.active.up", "RocksHeroes.pcx" }, { "wall_growing.active.up.xpos", "3" }, { "wall_growing.active.up.ypos", "12" }, { "wall_growing.active.up.frames", "3" }, { "wall_growing.active.up.delay", "6" }, - { "wall_growing.active.up.mode_linear", "true" }, + { "wall_growing.active.up.anim_mode", "linear" }, { "wall_growing.active.down", "RocksHeroes.pcx" }, { "wall_growing.active.down.xpos", "0" }, { "wall_growing.active.down.ypos", "12" }, { "wall_growing.active.down.frames", "3" }, { "wall_growing.active.down.delay", "6" }, - { "wall_growing.active.down.mode_linear", "true" }, + { "wall_growing.active.down.anim_mode", "linear" }, { "black_orb", "RocksElements.pcx" }, { "black_orb.xpos", "13" }, @@ -1782,38 +1778,38 @@ struct ConfigInfo image_config[] = { "dark_yamyam.xpos", "8" }, { "dark_yamyam.ypos", "11" }, { "dark_yamyam.frames", "4" }, - { "dark_yamyam.mode_pingpong2", "true" }, + { "dark_yamyam.anim_mode", "pingpong2" }, { "dynabomb.active", "RocksElements.pcx" }, { "dynabomb.active.xpos", "12" }, { "dynabomb.active.ypos", "11" }, { "dynabomb.active.frames", "4" }, { "dynabomb.active.delay", "6" }, - { "dynabomb.active.mode_pingpong", "true" }, + { "dynabomb.active.anim_mode", "pingpong" }, { "dynabomb_player1.active", "RocksElements.pcx" }, { "dynabomb_player1.active.xpos", "12" }, { "dynabomb_player1.active.ypos", "11" }, { "dynabomb_player1.active.frames", "4" }, { "dynabomb_player1.active.delay", "6" }, - { "dynabomb_player1.active.mode_pingpong", "true" }, + { "dynabomb_player1.active.anim_mode", "pingpong" }, { "dynabomb_player2.active", "RocksElements.pcx" }, { "dynabomb_player2.active.xpos", "12" }, { "dynabomb_player2.active.ypos", "11" }, { "dynabomb_player2.active.frames", "4" }, { "dynabomb_player2.active.delay", "6" }, - { "dynabomb_player2.active.mode_pingpong", "true" }, + { "dynabomb_player2.active.anim_mode", "pingpong" }, { "dynabomb_player3.active", "RocksElements.pcx" }, { "dynabomb_player3.active.xpos", "12" }, { "dynabomb_player3.active.ypos", "11" }, { "dynabomb_player3.active.frames", "4" }, { "dynabomb_player3.active.delay", "6" }, - { "dynabomb_player3.active.mode_pingpong", "true" }, + { "dynabomb_player3.active.anim_mode", "pingpong" }, { "dynabomb_player4.active", "RocksElements.pcx" }, { "dynabomb_player4.active.xpos", "12" }, { "dynabomb_player4.active.ypos", "11" }, { "dynabomb_player4.active.frames", "4" }, { "dynabomb_player4.active.delay", "6" }, - { "dynabomb_player4.active.mode_pingpong", "true" }, + { "dynabomb_player4.active.anim_mode", "pingpong" }, { "dynabomb_nr", "RocksElements.pcx" }, { "dynabomb_nr.xpos", "12" }, { "dynabomb_nr.ypos", "11" }, @@ -2522,21 +2518,21 @@ struct ConfigInfo image_config[] = { "explosion.ypos", "4" }, { "explosion.frames", "8" }, { "explosion.delay", "2" }, - { "explosion.mode_linear", "true" }, + { "explosion.anim_mode", "linear" }, { "twinkle_blue", "RocksHeroes.pcx" }, { "twinkle_blue.xpos", "9" }, { "twinkle_blue.ypos", "11" }, { "twinkle_blue.frames", "3" }, { "twinkle_blue.delay", "2" }, - { "twinkle_blue.mode_pingpong", "true" }, + { "twinkle_blue.anim_mode", "pingpong" }, { "twinkle_blue.global_sync", "false" }, { "twinkle_white", "RocksHeroes.pcx" }, { "twinkle_white.xpos", "13" }, { "twinkle_white.ypos", "11" }, { "twinkle_white.frames", "3" }, { "twinkle_white.delay", "2" }, - { "twinkle_white.mode_pingpong", "true" }, + { "twinkle_white.anim_mode", "pingpong" }, { "twinkle_white.global_sync", "false" }, { "steelwall_topleft", "RocksElements.pcx" }, @@ -2705,7 +2701,7 @@ struct ConfigInfo image_config[] = { "toon_5.height", "30" }, { "toon_5.frames", "8" }, { "toon_5.delay", "2" }, - { "toon_5.mode_pingpong2", "true" }, + { "toon_5.anim_mode", "pingpong2" }, { "toon_5.step_offset", "2" }, { "toon_5.step_delay", "1" }, { "toon_5.direction", "right" }, @@ -2718,7 +2714,7 @@ struct ConfigInfo image_config[] = { "toon_6.height", "30" }, { "toon_6.frames", "8" }, { "toon_6.delay", "2" }, - { "toon_6.mode_pingpong2", "true" }, + { "toon_6.anim_mode", "pingpong2" }, { "toon_6.step_offset", "2" }, { "toon_6.step_delay", "1" }, { "toon_6.direction", "left" }, diff --git a/src/conftime.h b/src/conftime.h index 200c6135..5e7a5d96 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-02-23 21:04]" +#define COMPILE_DATE_STRING "[2003-02-28 22:00]" diff --git a/src/init.c b/src/init.c index 8026ab9d..e3f9b98f 100644 --- a/src/init.c +++ b/src/init.c @@ -1019,7 +1019,8 @@ static void set_graphic_parameters(int graphic, char **parameter_raw) /* get integer values from string parameters */ for (i=0; i < NUM_GFX_ARGS; i++) parameter[i] = - get_parameter_value(image_config_suffix[i].type, parameter_raw[i]); + get_parameter_value(image_config_suffix[i].token, parameter_raw[i], + image_config_suffix[i].type); graphic_info[graphic].bitmap = src_bitmap; @@ -1085,25 +1086,10 @@ static void set_graphic_parameters(int graphic, char **parameter_raw) if (graphic_info[graphic].anim_delay == 0) /* delay must be at least 1 */ graphic_info[graphic].anim_delay = 1; - /* set mode for animation frame order */ - if (parameter[GFX_ARG_MODE_LOOP]) - graphic_info[graphic].anim_mode = ANIM_LOOP; - else if (parameter[GFX_ARG_MODE_LINEAR]) - graphic_info[graphic].anim_mode = ANIM_LINEAR; - else if (parameter[GFX_ARG_MODE_PINGPONG]) - graphic_info[graphic].anim_mode = ANIM_PINGPONG; - else if (parameter[GFX_ARG_MODE_PINGPONG2]) - graphic_info[graphic].anim_mode = ANIM_PINGPONG2; - else if (parameter[GFX_ARG_MODE_RANDOM]) - graphic_info[graphic].anim_mode = ANIM_RANDOM; + if (parameter[GFX_ARG_ANIM_MODE] != ANIM_NONE) + graphic_info[graphic].anim_mode = parameter[GFX_ARG_ANIM_MODE]; else if (graphic_info[graphic].anim_frames > 1) graphic_info[graphic].anim_mode = ANIM_LOOP; - else - graphic_info[graphic].anim_mode = ANIM_NONE; - - /* set additional flag to play animation frames in reverse order */ - if (parameter[GFX_ARG_MODE_REVERSE]) - graphic_info[graphic].anim_mode |= ANIM_REVERSE; /* automatically determine correct start frame, if not defined */ if (parameter[GFX_ARG_START_FRAME] == ARG_UNDEFINED_VALUE) @@ -1284,7 +1270,8 @@ static void set_sound_parameters(int sound, char **parameter_raw) /* get integer values from string parameters */ for (i=0; i < NUM_SND_ARGS; i++) parameter[i] = - get_parameter_value(sound_config_suffix[i].type, parameter_raw[i]); + get_parameter_value(sound_config_suffix[i].token, parameter_raw[i], + sound_config_suffix[i].type); /* explicit loop mode setting in configuration overrides default value */ if (parameter[SND_ARG_MODE_LOOP] != ARG_UNDEFINED_VALUE) diff --git a/src/libgame/misc.c b/src/libgame/misc.c index d68316d8..0b1382fa 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -1512,12 +1512,78 @@ boolean FileIsArtworkType(char *basename, int type) /* functions for loading artwork configuration information */ /* ------------------------------------------------------------------------- */ -int get_parameter_value(int type, char *value) +/* This function checks if a string of the format "string1, string2, ..." + exactly contains a string . */ + +static boolean string_has_parameter(char *s, char *s_contained) { - return (strcmp(value, ARG_UNDEFINED) == 0 ? ARG_UNDEFINED_VALUE : - type == TYPE_INTEGER ? get_integer_from_string(value) : - type == TYPE_BOOLEAN ? get_boolean_from_string(value) : - ARG_UNDEFINED_VALUE); + char *substring; + + if (s == NULL || s_contained == NULL) + return FALSE; + + if (strlen(s_contained) > strlen(s)) + return FALSE; + + if (strncmp(s, s_contained, strlen(s_contained)) == 0) + { + char next_char = s[strlen(s_contained)]; + + /* check if next character is delimiter or whitespace */ + return (next_char == ',' || next_char == '\0' || + next_char == ' ' || next_char == '\t' ? TRUE : FALSE); + } + + /* check if string contains another parameter string after a comma */ + substring = strchr(s, ','); + if (substring == NULL) /* string does not contain a comma */ + return FALSE; + + /* advance string pointer to next character after the comma */ + substring++; + + /* skip potential whitespaces after the comma */ + while (*substring == ' ' || *substring == '\t') + substring++; + + return string_has_parameter(substring, s_contained); +} + +int get_parameter_value(char *token, char *value_raw, int type) +{ + char *value = getStringToLower(value_raw); + int result = 0; /* probably a save default value */ + + if (strcmp(token, ".direction") == 0) + { + result = (strcmp(value, "left") == 0 ? MV_LEFT : + strcmp(value, "right") == 0 ? MV_RIGHT : + strcmp(value, "up") == 0 ? MV_UP : + strcmp(value, "down") == 0 ? MV_DOWN : MV_NO_MOVING); + } + else if (strcmp(token, ".anim_mode") == 0) + { + result = (string_has_parameter(value, "loop") ? ANIM_LOOP : + string_has_parameter(value, "linear") ? ANIM_LINEAR : + string_has_parameter(value, "pingpong") ? ANIM_PINGPONG : + string_has_parameter(value, "pingpong2") ? ANIM_PINGPONG2 : + string_has_parameter(value, "random") ? ANIM_RANDOM : + ANIM_NONE); + + if (string_has_parameter(value, "reverse")) + result |= ANIM_REVERSE; + } + else /* generic parameter of type integer or boolean */ + { + result = (strcmp(value, ARG_UNDEFINED) == 0 ? ARG_UNDEFINED_VALUE : + type == TYPE_INTEGER ? get_integer_from_string(value) : + type == TYPE_BOOLEAN ? get_boolean_from_string(value) : + ARG_UNDEFINED_VALUE); + } + + free(value); + + return result; } static void FreeCustomArtworkList(struct ArtworkListInfo *, diff --git a/src/libgame/misc.h b/src/libgame/misc.h index caf1bb64..a93b2baa 100644 --- a/src/libgame/misc.h +++ b/src/libgame/misc.h @@ -137,7 +137,7 @@ boolean FileIsSound(char *); boolean FileIsMusic(char *); boolean FileIsArtworkType(char *, int); -int get_parameter_value(int, char *); +int get_parameter_value(char *, char *, int); struct FileInfo *getFileListFromConfigList(struct ConfigInfo *, struct ConfigInfo *, int); diff --git a/src/libgame/system.h b/src/libgame/system.h index d9cd579a..672a9d1d 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -101,6 +101,15 @@ #define MB_MIDDLEBUTTON 2 #define MB_RIGHTBUTTON 3 +/* values for animation mode (frame order and direction) */ +#define ANIM_NONE 0 +#define ANIM_LOOP (1 << 0) +#define ANIM_LINEAR (1 << 1) +#define ANIM_PINGPONG (1 << 2) +#define ANIM_PINGPONG2 (1 << 3) +#define ANIM_RANDOM (1 << 4) +#define ANIM_REVERSE (1 << 5) + /* values for redraw_mask */ #define REDRAW_NONE (0) #define REDRAW_ALL (1 << 0) diff --git a/src/libgame/toons.h b/src/libgame/toons.h index a30cbe63..31345837 100644 --- a/src/libgame/toons.h +++ b/src/libgame/toons.h @@ -17,31 +17,6 @@ #include "system.h" -/* values for animation mode (frame order and direction) */ -#define ANIM_NONE 0 -#define ANIM_LOOP (1 << 0) -#define ANIM_LINEAR (1 << 1) -#define ANIM_PINGPONG (1 << 2) -#define ANIM_PINGPONG2 (1 << 3) -#define ANIM_REVERSE (1 << 4) -#define ANIM_RANDOM (1 << 5) - -#if 0 -/* values for toon animation direction */ -#define ANIMDIR_LEFT 1 -#define ANIMDIR_RIGHT 2 -#define ANIMDIR_UP 4 -#define ANIMDIR_DOWN 8 - -#define ANIMPOS_ANY 0 -#define ANIMPOS_LEFT 1 -#define ANIMPOS_RIGHT 2 -#define ANIMPOS_UP 4 -#define ANIMPOS_DOWN 8 -#define ANIMPOS_UPPER 16 -#endif - - struct ToonScreenInfo { Bitmap *save_buffer; diff --git a/src/main.h b/src/main.h index b4589dcc..9b372069 100644 --- a/src/main.h +++ b/src/main.h @@ -769,24 +769,21 @@ #define GFX_ARG_XOFFSET 8 #define GFX_ARG_YOFFSET 9 #define GFX_ARG_FRAMES 10 -#define GFX_ARG_START_FRAME 11 -#define GFX_ARG_DELAY 12 -#define GFX_ARG_MODE_LOOP 13 -#define GFX_ARG_MODE_LINEAR 14 -#define GFX_ARG_MODE_PINGPONG 15 -#define GFX_ARG_MODE_PINGPONG2 16 -#define GFX_ARG_MODE_RANDOM 17 -#define GFX_ARG_MODE_REVERSE 18 -#define GFX_ARG_GLOBAL_SYNC 19 -#define GFX_ARG_STEP_OFFSET 20 -#define GFX_ARG_STEP_DELAY 21 -#define GFX_ARG_DIRECTION 22 -#define GFX_ARG_POSITION 23 -#define GFX_ARG_DRAW_XOFFSET 24 -#define GFX_ARG_DRAW_YOFFSET 25 -#define GFX_ARG_NAME 26 - -#define NUM_GFX_ARGS 27 +#define GFX_ARG_FRAMES_PER_LINE 11 +#define GFX_ARG_START_FRAME 12 +#define GFX_ARG_DELAY 13 +#define GFX_ARG_ANIM_MODE 14 +#define GFX_ARG_GLOBAL_SYNC 15 +#define GFX_ARG_STEP_OFFSET 16 +#define GFX_ARG_STEP_DELAY 17 +#define GFX_ARG_DIRECTION 18 +#define GFX_ARG_POSITION 19 +#define GFX_ARG_DRAW_XOFFSET 20 +#define GFX_ARG_DRAW_YOFFSET 21 +#define GFX_ARG_FORMAT 22 +#define GFX_ARG_NAME 23 + +#define NUM_GFX_ARGS 24 /* values for sound configuration suffixes */ -- 2.34.1