shithub: m8c

Download patch

ref: 63e5f559fdfebab92f1941bf25443b47b8d53ed2
parent: b3d50b1f554e973f1eff1de684abbb857a245247
parent: 1c37f8bd507c3e05b025f3be5632633756fe3b4a
author: Jonne Kokkonen <jonne.kokkonen@gmail.com>
date: Thu Apr 18 02:56:29 EDT 2024

Merge pull request #144 from Dirtywave/model2_support

Fixing fonts / rendering with version 3.3.0

--- a/src/font1.h
+++ b/src/font1.h
@@ -3,8 +3,8 @@
 struct inline_font font_v1_small = {
     470,
     7,
-    8,
-    10,
+    5,
+    7,
     0,
     0,
     3,
--- a/src/font2.h
+++ b/src/font2.h
@@ -3,8 +3,8 @@
 struct inline_font font_v1_large = {
     752,
     9,
-    10,
-    12,
+    8,
+    9,
     0,
     -40,
     4,
--- a/src/font3.h
+++ b/src/font3.h
@@ -3,11 +3,11 @@
 struct inline_font font_v2_small = {
     846,
     9,
-    12,
-    14,
+    9,
+    9,
     0,
     -2,
-    3,
+    5,
     22914,
     {66,77,130,89,0,0,0,0,0,0,54,0,0,0,40,0,0,0,78,3,0,0,9,0,0,0,1,0,24,0,0,0,0,0,76,89,0,0,196,14,0,0,196,14,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
\ No newline at end of file
 };
--- a/src/font4.h
+++ b/src/font4.h
@@ -3,8 +3,8 @@
 struct inline_font font_v2_large = {
 940,
 10,
-12,
-14,
+10,
+10,
 0,
 -2,
 4,
--- a/src/font5.h
+++ b/src/font5.h
@@ -3,8 +3,8 @@
 struct inline_font font_v2_huge = {
 1128,
 12,
-15,
-16,
+12,
+12,
 0,
 -54,
 4,
--- a/src/inprint2.c
+++ b/src/inprint2.c
@@ -123,10 +123,8 @@
                              (Uint8)((bgcolor & 0x0000FF00) >> 8),
                              (Uint8)((bgcolor & 0x000000FF)), 0xFF);
       bg_rect = d_rect;
-      bg_rect.w = selected_inline_font->glyph_x - 1;
+      bg_rect.w = selected_inline_font->glyph_x;
       bg_rect.h = selected_inline_font->glyph_y;
-      bg_rect.x--;
-      bg_rect.y--;
 
       SDL_RenderFillRect(dst, &bg_rect);
     }
--- a/src/render.c
+++ b/src/render.c
@@ -121,12 +121,10 @@
   switch (model) {
   case 1:
     m8_hardware_model = 1;
-    waveform_max_height = 38;
     check_and_adjust_window_and_texture_size(480, 320);
     break;
   default:
     m8_hardware_model = 0;
-    waveform_max_height = 20;
     check_and_adjust_window_and_texture_size(320, 240);
     break;
   }
@@ -133,16 +131,29 @@
 }
 
 void set_font_mode(unsigned int mode) {
+  if (mode < 0 || mode > 2) {
+    //bad font mode
+    return;
+  }
+  if (m8_hardware_model == 1) {
+    mode += 2;
+  }
   if (font_mode == mode) return;
-  if (mode >= 0 && mode <= 2) {
-    if (m8_hardware_model == 1) {
-      mode += 2;
+
+  font_mode = mode;
+  screen_offset_y = fonts[mode]->screen_offset_y;
+  text_offset_y = fonts[mode]->text_offset_y;
+
+  if (m8_hardware_model == 0) {
+    waveform_max_height = 20;
+  } else {
+    waveform_max_height = 38;
+    if(font_mode == 4) {
+      waveform_max_height = 20;
     }
-    font_mode = mode;
-    screen_offset_y = fonts[mode]->screen_offset_y;
-    text_offset_y = fonts[mode]->text_offset_y;
-    change_font(fonts[mode]);
   }
+
+  change_font(fonts[mode]);
   SDL_LogDebug(SDL_LOG_CATEGORY_RENDER,"Font mode %i, Screen offset %i", mode, screen_offset_y);
 }
 
--