Browse Source

ansi-to-src takes wildcards.

This improves the speed and ease of adding images
(because we now just process everything in ansi/*.ans)

We've made all the ansi/*.ans depends.

specter is just too long.  :(
Steve Thielemann 4 years ago
parent
commit
7cd51522e4
21 changed files with 120 additions and 21 deletions
  1. 6 1
      CMakeLists.txt
  2. 10 2
      ansi-to-src.cpp
  3. 0 0
      ansi/bat.ans
  4. 3 0
      ansi/eyes.ans
  5. 0 0
      ansi/ghead.ans
  6. 0 0
      ansi/ghost.ans
  7. 0 0
      ansi/icu.ans
  8. 20 0
      ansi/owl.ans
  9. 0 0
      ansi/panther.ans
  10. 0 0
      ansi/skull-blink.ans
  11. 0 0
      ansi/skull.ans
  12. 51 0
      ansi/specter.ans
  13. 0 0
      ansi/wolf.ans
  14. 1 8
      build_images.sh
  15. 2 2
      images.cpp
  16. 6 1
      render.cpp
  17. 1 1
      show_bat_issue.sh
  18. 1 1
      show_icu_issue.sh
  19. 5 0
      show_owl_issue.sh
  20. 2 2
      show_skull_issue.sh
  21. 12 3
      wordplay.cpp

+ 6 - 1
CMakeLists.txt

@@ -145,10 +145,15 @@ if(DISABLE_BUFFER_DEBUG)
 target_compile_definitions(ansi-to-src PUBLIC NO_BUFFER_DEBUG=1)
 endif()
 
+# Everything in the ansi directory is a dependency for images.h
+file(GLOB IMAGES
+    ansi/*.ans
+)
+
 add_custom_command(
     OUTPUT images.h
     COMMAND ./build_images.sh
-    DEPENDS ansi-to-src ghost.ans ghead.ans wolf.ans panther.ans bat.ans skull.ans skull-blink.ans icu.ans
+    DEPENDS ansi-to-src ${IMAGES}
     COMMENT "Generating images.h"
     WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
 )

+ 10 - 2
ansi-to-src.cpp

@@ -17,7 +17,13 @@ int read_file(const char *filename) {
     return 0;
   }
 
-  strcpy(buffer, filename);
+  {
+    const char *ccp = filename;
+    while (strchr(ccp, '/') != NULL)
+      ccp = strchr(ccp, '/') + 1;
+
+    strcpy(buffer, ccp);
+  }
   char *cp;
 
   if ((cp = strchr(buffer, '.')) != NULL) {
@@ -57,6 +63,8 @@ int read_file(const char *filename) {
 }
 
 int main(int argc, char *argv[]) {
-  read_file(argv[1]);
+  for (int pos = 1; pos < argc; ++pos) {
+    read_file(argv[pos]);
+  }
   return 0;
 }

+ 0 - 0
bat.ans → ansi/bat.ans


+ 3 - 0
ansi/eyes.ans

@@ -0,0 +1,3 @@
+ßßßßßßßßßßßß               ß                        ÛÜ       ÜÛ        ÜÛÛÛÛÜ   ÜÛÛÛÛÜ    ß    ßÛÛ ÛÛß    ß     ÛÛÛ
+     ÛÛÛ        ßßß     ßßß                              ( å å )                        ,          ÛÛÛÛÛÛÛÜ    
+Ü    ÛÛÛÛÛßßßß  ÜÜ           Ü

+ 0 - 0
ghead.ans → ansi/ghead.ans


+ 0 - 0
ghost.ans → ansi/ghost.ans


+ 0 - 0
icu.ans → ansi/icu.ans


+ 20 - 0
ansi/owl.ans

@@ -0,0 +1,20 @@
+°
+°
+  °°± ²ÛÛÛÛÜܱ         °        °           ÜÛÛÛÛÛ² ±°°  
+    °°    ²ÛÛÛÛܱ   °                   ±ÜÛÛÛÛ²    °°    
+    ° ° °±±         ²ÛÛÛܱ   °  °     °  °   ±ÜÛÛÛ²         ±±° ° °
+       Ü    ÜÜÜ ²ÛÛÛÜ  °  ° ° °  °  ÜÛÛÛ² ÜÜÜ    Ü       
+ °   ° °±  °±ÞÝ  ÜÛ²±°ÛÜ ²ÛÛÛ±  °  ±  °  ±ÛÛÛ² ÜÛ°±²ÛÜ  Þݱ°  ±° °   °
+   °±²Û  Þ²²±°ÛÛ    ²ÛÛ    ßÞ ß   ÛÛ²    ÛÛ°±²²Ý  Û²±°   
+  °±²ÛÛÝ  Û²²±°ÛÛÜÜÛݲÛÛ± ÞÜßÜÝ ±ÛÛ² ÛÜÜÛÛ°±²²Û  ÞÛÛ²±°  
+   °    ± °±²ÛÛ   ß²²±°°ÜÜß   ÛÛÛß   ßÛÛÛ   ßÜÜ°°±²²ß   ÛÛ²±° ± 
+ÜÜß   °±²ÛÛÜ   ßßßß    °  Ü       Ü  °    ßßßß   ÜÛÛ²±°   ßÜ
+   °  °±²ÛÛÜÜ       ° °Þ²  Ü     Ý° °       ÜÜÛÛ²±°  °   °
+    °   ±ß     °±²ÛÛÛß °  °±± °Ý Þ°     Þ ±±°    ßÛÛÛ²±°  °     
+ß         °±²ß    ±²   Þ  ²Ý     Ý   ²±    ß²±   °     ° 
+°         °       ²  ±  ±Ý  ²        ±  ²      °   ßÜ     
+°      ú      °     ²Ý Þ    Þ    °              °
+þ              ±Ý     Ý               Ü
+Ü°°Ý
+
+  Darkman of <ACiD> Productions o6/o2/199ý  

+ 0 - 0
panther.ans → ansi/panther.ans


+ 0 - 0
skull-blink.ans → ansi/skull-blink.ans


+ 0 - 0
skull.ans → ansi/skull.ans


+ 51 - 0
ansi/specter.ans

@@ -0,0 +1,51 @@
+[?7hワ
+゙゙
+゙゙
+ーーワ ンン゙
+ーーーアワ゚ンンンンンン
+ーアーーーーンン ゙ ゙ ン
+ーーアーアーアン゙
+ーアーーアイイアア゙ン
+ーーーーーイロロイアアン
+ーアーアイロ゚ ローーー゙  ゙
+ーアーーイロ   ゙イーアアワワ
+ーーアイロ゚ロイーア゙    ー  ン
+アーロ゚゙イーアンン  ーー ゙゙
+ーーインロアー゙ ゙ ーー  ン゙
+アイロ゙イー゙  ンーー  ン゙
+ーイロ゚゙イー゙  ゙ー  ゙ ゙
+ーアロ    ーロイン  ゙ー  ゙ ン
+ー  ーーアア    ーヷ    ン  ン ン
+ーーアー゚゚ワ  ゙    ン ゙  ン
+ー  ーアア ーー    ゚ワン    ンワ゚  ン
+ー アアアアア ーーーンン  ゙
+ー   アアイイイアー ーーーーー   ゙   ゙
+    ー  アイ ワ  ワ イー  ー    ワワ゚ローーーー    ゙   ン
+    ー アイ ロン゙ロン ーー    ワ゚    イー ーーーン
+   ー ーア ゙ン ゙゙  イーー    ゚ンーーン
+アイ  ロ゙ ロ゙ ゙ イーー    ゙ーワ゚
+   ー アイ  ゙ロロワーーーン イイ   ゙ンーン
+アイ   ロロンー゚ ワ  ワンー゙
+アイ  ゙゙ーーワ゚ ゙ ンー゙
+    ー ーアイ  ローー゚゚ ゙ ゙ー゙
+ー ーアイ  ゚ワワワ ンーー゙
+ア  ン ア   ン゚゚ーーン
+ーイ ンーーア ゙ーンン
+ーイ ン ーーア゙   ロ ーー゙゙ン
+ー ーア ゙  ーーンーー゙゙ン
+アイ゙   ゙ー゙ ゚ワ   ワ゚
+アア゙   ンー  ワ゚ンン ゙ワ ゙
+ア゙  ゙ー ゙ ゙   ーン   ンン
+ー ン ン   ー   ワン ン   ーン   ゙
+ーーン゙    ワワワ゚   ンア   ン
+ー ー ンン  ワ゚゙ア   ン
+ー ー ンン ワンーー゙ー   ン
+ー ー゙ワ゚ ーー   ーー ンアン
+ー    ーー    ー  ン    アアン
+ー ーン    アアー    ゙
+ーン   アーーー    ゙
+゙    ーー゙
+゙    ーーー゙
+゙    アアアン
+゙    ア
+

+ 0 - 0
wolf.ans → ansi/wolf.ans


+ 1 - 8
build_images.sh

@@ -7,14 +7,7 @@ export PATH=$PATH:build:.
 
 # echo $PATH
 
-ansi-to-src skull.ans > $BASE
-ansi-to-src skull-blink.ans >> $BASE
-ansi-to-src ghead.ans >> $BASE
-ansi-to-src ghost.ans >> $BASE
-ansi-to-src wolf.ans >> $BASE
-ansi-to-src panther.ans >> $BASE
-ansi-to-src bat.ans >> $BASE
-ansi-to-src icu.ans >> $BASE
+ansi-to-src ansi/*.ans > $BASE
 
 # workaround
 if [ -f "$FINAL" ]; then

+ 2 - 2
images.cpp

@@ -34,12 +34,12 @@ int main() {
   SHOW_IMAGE(skull);
   SHOW_IMAGE(skullblink);
   SHOW_IMAGE(icu);
-
+  SHOW_IMAGE(owl);
   SHOW_IMAGE(ghead);
   SHOW_IMAGE(ghost);
   SHOW_IMAGE(wolf);
   SHOW_IMAGE(panther);
   SHOW_IMAGE(bat);
-
+  SHOW_IMAGE(specter);
   return 0;
 }

+ 6 - 1
render.cpp

@@ -212,8 +212,13 @@ int send_image(int fd) {
   }
 
   for (i = 0; i < image_size; i++) {
+    std::string line(lines[i]);
+    line.append("\r\n");
+    render(fd, line);
+    /*
     write(fd, lines[i], strlen(lines[i]));
     write(fd, "\r\n", 2);
+    */
   }
 
   // success
@@ -712,7 +717,7 @@ void render(int fd, const char *string_out, int len) {
  * Renders with effects.
  */
 void render(int fd, std::string &string_out) {
-  reset_render();
+  // reset_render();
   time_t start = time(NULL);
   size_t pos = 0;
   int elapsed;

+ 1 - 1
show_bat_issue.sh

@@ -1,5 +1,5 @@
 #!/bin/bash
 
-echo ""; ./show bat.ans
+echo ""; ./show ansi/bat.ans
 
 

+ 1 - 1
show_icu_issue.sh

@@ -1,5 +1,5 @@
 #!/bin/bash
 
-echo ""; ./show icu.ans
+echo ""; ./show ansi/icu.ans
 
 

+ 5 - 0
show_owl_issue.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+echo ""; ./show ansi/owl.ans
+
+

+ 2 - 2
show_skull_issue.sh

@@ -1,8 +1,8 @@
 #!/bin/bash
 
-echo ""; ./show skull.ans
+echo ""; ./show ansi/skull.ans
 
 read -p "Press [ENTER] to view skull-blink"
 
-echo ""; ./show skull-blink.ans
+echo ""; ./show ansi/skull-blink.ans
 

+ 12 - 3
wordplay.cpp

@@ -127,6 +127,7 @@ void init_harry() {
   // ZF_LOGD("init => %d %d", last_seen_harry_event[0],
   // last_seen_harry_event[1]);
   console_init(&console);
+  reset_render();
 }
 
 // char words[] = "[a-zA-Z]+( [a-zA-Z]+)+";
@@ -159,7 +160,11 @@ int mangle_clrscr(std::string &buffer, std::string &work, size_t pos) {
                     {bat, sizeof(bat) / sizeof(char *), 1, 0},
                     {icu, sizeof(icu) / sizeof(char *), 0, 20},
                     {skull, sizeof(skull) / sizeof(char *), 0, 19},
-                    {skullblink, sizeof(skullblink) / sizeof(char *), 0, 19}};
+                    {skullblink, sizeof(skullblink) / sizeof(char *), 0, 19},
+                    {specter, sizeof(specter) / sizeof(char *), 1, 0},
+                    {owl, sizeof(owl) / sizeof(char *), 0, 70}
+
+      };
 
       static LastSeen last_files(2);
       int r;
@@ -183,7 +188,11 @@ int mangle_clrscr(std::string &buffer, std::string &work, size_t pos) {
         display.str(std::string());
         display.clear();
       } else {
-        fgoto.assign("^CS^F");
+        if (images[r].lines == specter) {
+          // specter!
+          fgoto.assign("^S1^CS^F");
+        } else
+          fgoto.assign("^CS^F");
       }
 
       needs_cls = images[r].cls;
@@ -199,7 +208,7 @@ int mangle_clrscr(std::string &buffer, std::string &work, size_t pos) {
       // Ok, yes, there's no filename being sent.  :P
       render_image(images[r].lines, images[r].size);
 
-      display << (needs_cls ? "\x1b[2J" : "") << fgoto << "^CR^P3";
+      display << (needs_cls ? "\x1b[2J" : "") << fgoto << "^S0^CR^P3";
 
       std::string display_output = display.str();