added additional empty space elements (not used yet)
authorHolger Schemel <info@artsoft.org>
Fri, 26 Nov 2021 12:06:07 +0000 (13:06 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 22 Jan 2022 16:58:28 +0000 (17:58 +0100)
build-scripts/create_element_defs.pl
graphics/gfx_classic/RocksCE.png
src/Makefile
src/conf_gfx.c
src/main.c
src/main.h

index 0966816ae3e717a7ba273942a36899ea2aaaf82c..3f5693fe4de0ab304a9b38181bd8d4adae64ae78 100755 (executable)
@@ -42,6 +42,8 @@ my $filename_conf_cus_c = 'conf_cus.c';
 my $filename_conf_cus_h = 'conf_cus.h';
 my $filename_conf_grp_c = 'conf_grp.c';
 my $filename_conf_grp_h = 'conf_grp.h';
 my $filename_conf_cus_h = 'conf_cus.h';
 my $filename_conf_grp_c = 'conf_grp.c';
 my $filename_conf_grp_h = 'conf_grp.h';
+my $filename_conf_emp_c = 'conf_emp.c';
+my $filename_conf_emp_h = 'conf_emp.h';
 my $filename_conf_e2g_c = 'conf_e2g.c';
 my $filename_conf_esg_c = 'conf_esg.c';
 my $filename_conf_e2s_c = 'conf_e2s.c';
 my $filename_conf_e2g_c = 'conf_e2g.c';
 my $filename_conf_esg_c = 'conf_esg.c';
 my $filename_conf_e2s_c = 'conf_e2s.c';
@@ -61,6 +63,8 @@ my $text_cus_c = 'values for graphics configuration (custom elements)';
 my $text_cus_h = 'values for elements configuration (custom elements)';
 my $text_grp_c = 'values for graphics configuration (group elements)';
 my $text_grp_h = 'values for elements configuration (group elements)';
 my $text_cus_h = 'values for elements configuration (custom elements)';
 my $text_grp_c = 'values for graphics configuration (group elements)';
 my $text_grp_h = 'values for elements configuration (group elements)';
+my $text_emp_c = 'values for graphics configuration (empty elements)';
+my $text_emp_h = 'values for elements configuration (empty elements)';
 my $text_e2g_c = 'values for element/graphics mapping configuration (normal)';
 my $text_esg_c = 'values for element/graphics mapping configuration (special)';
 my $text_e2s_c = 'values for element/sounds mapping configuration';
 my $text_e2g_c = 'values for element/graphics mapping configuration (normal)';
 my $text_esg_c = 'values for element/graphics mapping configuration (special)';
 my $text_e2s_c = 'values for element/sounds mapping configuration';
@@ -72,6 +76,7 @@ my $text_act_c = 'values for active states of elements and fonts';
 
 my $num_custom_elements = 256;
 my $num_group_elements = 32;
 
 my $num_custom_elements = 256;
 my $num_group_elements = 32;
+my $num_empty_elements = 16;
 
 my $char_skip = '---[SKIP]---';
 
 
 my $char_skip = '---[SKIP]---';
 
@@ -393,6 +398,28 @@ sub print_graphics_list
            }
        }
 
            }
        }
 
+       if (/^\#include "conf_emp.c"/)  # dump list of empty elements
+       {
+           for (my $nr = 0; $nr < $num_empty_elements; $nr++)
+           {
+               my $line = sprintf("#define IMG_EMPTY_SPACE_%d", $nr + 1);
+
+               my $tabs = get_tabs($line, $max_num_tabs);
+
+               print "$line$tabs$i\n";
+
+               $i++;
+
+               $line = sprintf("#define IMG_EMPTY_SPACE_%d_EDITOR", $nr + 1);
+
+               $tabs = get_tabs($line, $max_num_tabs);
+
+               print "$line$tabs$i\n";
+
+               $i++;
+           }
+       }
+
        if (!contains_image_file($_))   # skip all lines without image file
        {
            next;
        if (!contains_image_file($_))   # skip all lines without image file
        {
            next;
@@ -727,6 +754,24 @@ sub print_group_elements_list
     print_file_footer($filename_conf_grp_c);
 }
 
     print_file_footer($filename_conf_grp_c);
 }
 
+sub print_empty_elements_list
+{
+    print_file_header($filename_conf_emp_h, $text_emp_h);
+
+    for (my $i = 0; $i < $num_empty_elements; $i++)
+    {
+       my $left = sprintf("#define EL_EMPTY_SPACE_%d", $i + 1);
+
+       my $tabs_left = get_tabs($left, 5);
+
+       my $right = "(EL_EMPTY_SPACE_START + $i)";
+
+       print "$left$tabs_left$right\n";
+    }
+
+    print_file_footer($filename_conf_emp_c);
+}
+
 sub print_custom_graphics_list
 {
     my @extensions1 =
 sub print_custom_graphics_list
 {
     my @extensions1 =
@@ -889,6 +934,89 @@ sub print_group_graphics_list
     print_file_footer($filename_conf_grp_c);
 }
 
     print_file_footer($filename_conf_grp_c);
 }
 
+sub print_empty_graphics_list
+{
+    my @extensions1 =
+       (
+        '',
+        '.xpos',
+        '.ypos',
+        '.frames',
+        );
+    my @extensions2 =
+       (
+        '',
+        '.xpos',
+        '.ypos',
+        );
+
+    my $num_non_empty_elements = $num_custom_elements + $num_group_elements;
+
+    print_file_header($filename_conf_emp_c, $text_emp_c);
+
+    for (my $i = 0; $i < $num_empty_elements; $i++)
+    {
+       foreach my $ext (@extensions1)
+       {
+           my $left = sprintf("  \{ \"empty_space_%d$ext\",", $i + 1);
+
+           my $tabs_left = get_tabs($left, 6);
+
+           # my $right = ($ext eq '' ? 'RocksDC.png' :
+           my $right = ($ext eq '' ? 'RocksCE.png' :
+                        $ext eq '.frames' ? '1' : '0');
+
+           if ($ext eq '.xpos')
+           {
+               # $right = 4;
+               $right = int($i % 16);
+           }
+           elsif ($ext eq '.ypos')
+           {
+               # $right = 15;
+               $right = int($i / 16) + int($num_non_empty_elements / 16);
+           }
+
+           $right = "\"$right\"";
+
+           my $tabs_right = get_tabs($right, 3);
+
+           print "$left$tabs_left$right$tabs_right},\n";
+       }
+
+       foreach my $ext (@extensions2)
+       {
+           my $left = sprintf("  \{ \"empty_space_%d.EDITOR$ext\",", $i + 1);
+
+           my $tabs_left = get_tabs($left, 6);
+
+           # my $right = ($ext eq '' ? 'RocksDC.png' : '0');
+           my $right = ($ext eq '' ? 'RocksCE.png' : '0');
+
+           if ($ext eq '.xpos')
+           {
+               # $right = 14;
+               $right = int($i % 16) + 16;
+           }
+           elsif ($ext eq '.ypos')
+           {
+               # $right = 15;
+               $right = int($i / 16) + int($num_non_empty_elements / 16);
+           }
+
+           $right = "\"$right\"";
+
+           my $tabs_right = get_tabs($right, 3);
+
+           print "$left$tabs_left$right$tabs_right},\n";
+       }
+
+       print "\n";
+    }
+
+    print_file_footer($filename_conf_emp_c);
+}
+
 sub get_known_element_definitions_ALTERNATIVE
 {
     my %known_element = ();
 sub get_known_element_definitions_ALTERNATIVE
 {
     my %known_element = ();
@@ -1644,6 +1772,15 @@ sub print_element_to_graphic_list
        print_element_to_graphic_entry($element, '-1', '-1', '-1', $graphic);
     }
 
        print_element_to_graphic_entry($element, '-1', '-1', '-1', $graphic);
     }
 
+    # dump list of empty elements
+    for (my $i = 0; $i < $num_empty_elements; $i++)
+    {
+       my $element = sprintf("EL_EMPTY_SPACE_%d", $i + 1);
+       my $graphic = sprintf("IMG_EMPTY_SPACE_%d", $i + 1);
+
+       print_element_to_graphic_entry($element, '-1', '-1', '-1', $graphic);
+    }
+
     print_element_to_graphic_entry('-1', '-1', '-1', '-1', '-1');
 
     print "};\n";
     print_element_to_graphic_entry('-1', '-1', '-1', '-1', '-1');
 
     print "};\n";
@@ -1815,6 +1952,17 @@ sub print_element_to_special_graphic_list
                                               $graphic);
     }
 
                                               $graphic);
     }
 
+    # dump list of empty element editor graphics
+    for (my $i = 0; $i < $num_empty_elements; $i++)
+    {
+       my $element = sprintf("EL_EMPTY_SPACE_%d", $i + 1);
+       my $graphic = sprintf("IMG_EMPTY_SPACE_%d_EDITOR", $i + 1);
+
+       print_element_to_special_graphic_entry($element,
+                                              'GFX_SPECIAL_ARG_EDITOR',
+                                              $graphic);
+    }
+
     # dump other special editor graphics
     foreach my $token (@elements_with_editor_graphic)
     {
     # dump other special editor graphics
     foreach my $token (@elements_with_editor_graphic)
     {
@@ -2557,6 +2705,8 @@ sub main
        print "- '$filename_conf_cus_h'\n";
        print "- '$filename_conf_grp_c'\n";
        print "- '$filename_conf_grp_h'\n";
        print "- '$filename_conf_cus_h'\n";
        print "- '$filename_conf_grp_c'\n";
        print "- '$filename_conf_grp_h'\n";
+       print "- '$filename_conf_emp_c'\n";
+       print "- '$filename_conf_emp_h'\n";
        print "- '$filename_conf_e2g_c'\n";
        print "- '$filename_conf_esg_c'\n";
        print "- '$filename_conf_fnt_c'\n";
        print "- '$filename_conf_e2g_c'\n";
        print "- '$filename_conf_esg_c'\n";
        print "- '$filename_conf_fnt_c'\n";
@@ -2604,6 +2754,14 @@ sub main
     {
        print_group_elements_list();
     }
     {
        print_group_elements_list();
     }
+    elsif ($ARGV[0] eq $filename_conf_emp_c)
+    {
+       print_empty_graphics_list();
+    }
+    elsif ($ARGV[0] eq $filename_conf_emp_h)
+    {
+       print_empty_elements_list();
+    }
     elsif ($ARGV[0] eq $filename_conf_e2g_c)
     {
        print_element_to_graphic_list();
     elsif ($ARGV[0] eq $filename_conf_e2g_c)
     {
        print_element_to_graphic_list();
index 72bbb0a45da3616cdb90d1528d17e04838a46f21..5a5f1812253305a6b395ae5b1cf0eb3287c3be8e 100644 (file)
Binary files a/graphics/gfx_classic/RocksCE.png and b/graphics/gfx_classic/RocksCE.png differ
index 0456b906a58798e4a7c5728b791ce757abe66e54..f9fb4581ca5b7947ab0f1b588b1df918e3338286 100644 (file)
@@ -192,6 +192,8 @@ CNFS =      conf_gfx.h      \
        conf_cus.h      \
        conf_grp.c      \
        conf_grp.h      \
        conf_cus.h      \
        conf_grp.c      \
        conf_grp.h      \
+       conf_emp.c      \
+       conf_emp.h      \
        conf_e2g.c      \
        conf_esg.c      \
        conf_e2s.c      \
        conf_e2g.c      \
        conf_esg.c      \
        conf_e2s.c      \
index a5b8aa86d8f8dda4cea4076c62a2eda5c3fa97cb..62326d7a972d5924b5db09f9ceed03bd6ba3c52b 100644 (file)
@@ -5788,6 +5788,7 @@ struct ConfigInfo image_config[] =
 #include "conf_chr.c"  // include auto-generated data structure definitions
 #include "conf_cus.c"  // include auto-generated data structure definitions
 #include "conf_grp.c"  // include auto-generated data structure definitions
 #include "conf_chr.c"  // include auto-generated data structure definitions
 #include "conf_cus.c"  // include auto-generated data structure definitions
 #include "conf_grp.c"  // include auto-generated data structure definitions
+#include "conf_emp.c"  // include auto-generated data structure definitions
 
 
   // ==========================================================================
 
 
   // ==========================================================================
index 27d40168ef6e5f5f2016aa74c8c311362bb8b142..496a86c9e8d2ed1ad97377e731724982bb5b09be 100644 (file)
@@ -6278,6 +6278,86 @@ struct ElementNameInfo element_name_info[MAX_NUM_ELEMENTS + 1] =
     "spring",
     "spring (starts moving right)"
   },
     "spring",
     "spring (starts moving right)"
   },
+  {
+    "empty_space_1",
+    "empty_space",
+    "empty space 1"
+  },
+  {
+    "empty_space_2",
+    "empty_space",
+    "empty space 2"
+  },
+  {
+    "empty_space_3",
+    "empty_space",
+    "empty space 3"
+  },
+  {
+    "empty_space_4",
+    "empty_space",
+    "empty space 4"
+  },
+  {
+    "empty_space_5",
+    "empty_space",
+    "empty space 5"
+  },
+  {
+    "empty_space_6",
+    "empty_space",
+    "empty space 6"
+  },
+  {
+    "empty_space_7",
+    "empty_space",
+    "empty space 7"
+  },
+  {
+    "empty_space_8",
+    "empty_space",
+    "empty space 8"
+  },
+  {
+    "empty_space_9",
+    "empty_space",
+    "empty space 9"
+  },
+  {
+    "empty_space_10",
+    "empty_space",
+    "empty space 10"
+  },
+  {
+    "empty_space_11",
+    "empty_space",
+    "empty space 11"
+  },
+  {
+    "empty_space_12",
+    "empty_space",
+    "empty space 12"
+  },
+  {
+    "empty_space_13",
+    "empty_space",
+    "empty space 13"
+  },
+  {
+    "empty_space_14",
+    "empty_space",
+    "empty space 14"
+  },
+  {
+    "empty_space_15",
+    "empty_space",
+    "empty space 15"
+  },
+  {
+    "empty_space_16",
+    "empty_space",
+    "empty space 16"
+  },
 
   // --------------------------------------------------------------------------
   // "real" (and therefore drawable) runtime elements
 
   // --------------------------------------------------------------------------
   // "real" (and therefore drawable) runtime elements
index 14c2e885424fac83e3b2b718245ebe9ea73c2188..3f2389cc2c38cfa287ca50e2c9d0727dd884c72b 100644 (file)
 #define EL_SPRING_LEFT                 1215
 #define EL_SPRING_RIGHT                        1216
 
 #define EL_SPRING_LEFT                 1215
 #define EL_SPRING_RIGHT                        1216
 
-#define NUM_FILE_ELEMENTS              1217
+// ---------- begin of empty space elements section ---------------------------
+#define EL_EMPTY_SPACE_START           1217
+
+#include "conf_emp.h"  // include auto-generated data structure definitions
+
+#define NUM_EMPTY_SPACE_ELEMENTS       16
+#define EL_EMPTY_SPACE_END             1232
+// ---------- end of empty space elements section -----------------------------
+
+#define NUM_FILE_ELEMENTS              1233
 
 
 // "real" (and therefore drawable) runtime elements
 
 
 // "real" (and therefore drawable) runtime elements