diff --git a/src/cache.cpp b/src/cache.cpp index ff3f6f764b..d9f29dd32b 100644 --- a/src/cache.cpp +++ b/src/cache.cpp @@ -182,52 +182,39 @@ namespace { }; // struct Material + using DummyRenderer = BitmapRef(*)(void); + template BitmapRef DrawCheckerboard(); BitmapRef DummySystem() { return Bitmap::Create(system_h, sizeof(system_h), true, Bitmap::Flag_System | Bitmap::Flag_ReadOnly); } - std::function backdrop_dummy_func = DrawCheckerboard; - std::function battle_dummy_func = DrawCheckerboard; - std::function charset_dummy_func = DrawCheckerboard; - std::function chipset_dummy_func = DrawCheckerboard; - std::function faceset_dummy_func = DrawCheckerboard; - std::function gameover_dummy_func = DrawCheckerboard; - std::function monster_dummy_func = DrawCheckerboard; - std::function panorama_dummy_func = DrawCheckerboard; - std::function picture_dummy_func = DrawCheckerboard; - std::function title_dummy_func = DrawCheckerboard; - std::function system2_dummy_func = DrawCheckerboard; - std::function battle2_dummy_func = DrawCheckerboard; - std::function battlecharset_dummy_func = DrawCheckerboard; - std::function battleweapon_dummy_func = DrawCheckerboard; - std::function frame_dummy_func = DrawCheckerboard; - struct Spec { char const* directory; bool transparent; int min_width , max_width; int min_height, max_height; - std::function dummy_renderer; + DummyRenderer dummy_renderer; bool oob_check; - } const spec[] = { - { "Backdrop", false, 320, 320, 160, 240, backdrop_dummy_func, true }, - { "Battle", true, 480, 480, 96, 480, battle_dummy_func, true }, - { "CharSet", true, 288, 288, 256, 256, charset_dummy_func, true }, - { "ChipSet", true, 480, 480, 256, 256, chipset_dummy_func, true }, - { "FaceSet", true, 192, 192, 192, 192, faceset_dummy_func, true}, - { "GameOver", false, 320, 320, 240, 240, gameover_dummy_func, true }, - { "Monster", true, 16, 320, 16, 160, monster_dummy_func, false }, - { "Panorama", false, 80, 640, 80, 480, panorama_dummy_func, false }, - { "Picture", true, 1, 640, 1, 480, picture_dummy_func, false }, - { "System", true, 160, 160, 80, 80, &DummySystem, true }, - { "Title", false, 320, 320, 240, 240, title_dummy_func, true }, - { "System2", true, 80, 80, 96, 96, system2_dummy_func, true }, - { "Battle2", true, 640, 640, 640, 640, battle2_dummy_func, true }, - { "BattleCharSet", true, 144, 144, 384, 384, battlecharset_dummy_func, true}, - { "BattleWeapon", true, 192, 192, 512, 512, battleweapon_dummy_func, true }, - { "Frame", true, 320, 320, 240, 240, frame_dummy_func, true }, + }; + constexpr Spec spec[] = { + { "Backdrop", false, 320, 320, 160, 240, DrawCheckerboard, true }, + { "Battle", true, 480, 480, 96, 480, DrawCheckerboard, true }, + { "CharSet", true, 288, 288, 256, 256, DrawCheckerboard, true }, + { "ChipSet", true, 480, 480, 256, 256, DrawCheckerboard, true }, + { "FaceSet", true, 192, 192, 192, 192, DrawCheckerboard, true}, + { "GameOver", false, 320, 320, 240, 240, DrawCheckerboard, true }, + { "Monster", true, 16, 320, 16, 160, DrawCheckerboard, false }, + { "Panorama", false, 80, 640, 80, 480, DrawCheckerboard, false }, + { "Picture", true, 1, 640, 1, 480, DrawCheckerboard, false }, + { "System", true, 160, 160, 80, 80, DummySystem, true }, + { "Title", false, 320, 320, 240, 240, DrawCheckerboard, true }, + { "System2", true, 80, 80, 96, 96, DrawCheckerboard, true }, + { "Battle2", true, 640, 640, 640, 640, DrawCheckerboard, true }, + { "BattleCharSet", true, 144, 144, 384, 384, DrawCheckerboard, true}, + { "BattleWeapon", true, 192, 192, 512, 512, DrawCheckerboard, true }, + { "Frame", true, 320, 320, 240, 240, DrawCheckerboard, true }, }; template