home · contact · privacy
Fix face pop-ups on non-faces.
[plomrogue2] / rogue_chat.html
index 5e663981d13ba7292b0f8b98ca006fde9b8b4a7c..ba49e868e16dcf77f7856e757d100e0338af2157 100644 (file)
@@ -778,6 +778,7 @@ let tui = {
     if (this.mode && this.mode.name == 'control_tile_draw') {
         tui.log_msg('@ finished tile protection drawing.')
     }
+    this.draw_face = false;
     this.tile_draw = false;
       if (mode_name == 'command_thing' && (!game.player.carrying
                                            || !game.player.carrying.commandable)) {
@@ -1133,24 +1134,25 @@ let tui = {
   },
   draw_face_popup: function() {
       const t = game.things[this.draw_face];
-      if (!t) {
+      if (!t || !t.face) {
           this.draw_face = false;
           return;
       }
+      const start_x = tui.window_width - 10;
       function draw_body_part(body_part, end_y) {
-          const start_x = tui.window_width - 10;
-          terminal.write(end_y - 4, start_x, '+--------+');
+          terminal.write(end_y - 4, start_x, ' ________ ');
           terminal.write(end_y - 3, start_x, '|        |');
           terminal.write(end_y - 2, start_x, '| ' + body_part.slice(0, 6) + ' |');
           terminal.write(end_y - 1, start_x, '| ' + body_part.slice(6, 12) + ' |');
           terminal.write(end_y, start_x, '| ' + body_part.slice(12, 18) + ' |');
       }
       if (t.face) {
-          draw_body_part(t.face, terminal.rows - 1);
+          draw_body_part(t.face, terminal.rows - 2);
       }
       if (t.hat) {
-          draw_body_part(t.hat, terminal.rows - 4);
+          draw_body_part(t.hat, terminal.rows - 5);
       }
+      terminal.write(terminal.rows - 1, start_x, '|        |');
   },
   draw_mode_line: function() {
       let help = 'hit [' + this.keys.help + '] for help';
@@ -1503,7 +1505,6 @@ document.onclick = function() {
 };
 tui.inputEl.addEventListener('keydown', (event) => {
     tui.show_help = false;
-    tui.draw_face = false;
     if (event.key == 'Enter') {
         event.preventDefault();
     }