SDL Frotz at least compiles now. Fix the complaints and maybe it'll run.
authorDavid Griffith <dave@661.org>
Tue, 17 Jan 2012 00:47:03 +0000 (16:47 -0800)
committerDavid Griffith <dave@661.org>
Tue, 17 Jan 2012 00:47:03 +0000 (16:47 -0800)
src/common/err.c
src/common/frotz.h
src/common/screen.c
src/sdl/sf_frotz.h
src/sdl/sf_resource.c

index 6978044a01597187a8e701e29091f56b0df46aa0..49cb13bd10352f28a3449ed35e90db9855e78f84 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "frotz.h"
+f_setup_t f_setup;
 
 /* Define stuff for stricter Z-code error checking, for the generic
    Unix/DOS/etc terminal-window interface. Feel free to change the way
index 1d078b4a188bfa61d45cfa580708222adb9b20f6..7c7f45e3185c85f449b029563f9f09ff541797e9 100644 (file)
@@ -45,6 +45,30 @@ enum story {
     UNKNOWN
 };
 
+/*** screen window ***/
+
+typedef struct {
+    zword y_pos;
+    zword x_pos;
+    zword y_size;
+    zword x_size;
+    zword y_cursor;
+    zword x_cursor;
+    zword left;
+    zword right;
+    zword nl_routine;
+    zword nl_countdown;
+    zword style;
+    zword colour;
+    zword font;
+    zword font_size;
+    zword attribute;
+    zword line_count;
+    zword true_fore;
+    zword true_back;
+} Zwindow;
+
+
 #include "setup.h"
 
 typedef unsigned char zchar;
@@ -674,6 +698,11 @@ void       branch (bool);
 void   storeb (zword, zbyte);
 void   storew (zword, zword);
 
+
+       /*** returns the current window ***/
+Zwindow * curwinrec( void);
+
+
 /*** Interface functions ***/
 
 void   os_beep (int);
index d12ab3aaf3cb6dae16a4202cd84bca229798e9e6..0de4de9c6981a5bdeb3857d1a763064df076cec8 100644 (file)
@@ -49,24 +49,9 @@ static bool cursor = TRUE;
 
 static int input_window = 0;
 
-static struct {
-    zword y_pos;
-    zword x_pos;
-    zword y_size;
-    zword x_size;
-    zword y_cursor;
-    zword x_cursor;
-    zword left;
-    zword right;
-    zword nl_routine;
-    zword nl_countdown;
-    zword style;
-    zword colour;
-    zword font;
-    zword font_size;
-    zword attribute;
-    zword line_count;
-} wp[8], *cwp;
+static Zwindow wp[8], *cwp = wp;
+
+Zwindow * curwinrec() { return cwp;}
 
 
 /*
@@ -1742,3 +1727,91 @@ void z_window_style (void)
        update_attributes ();
 
 }/* z_window_style */
+
+/*
+ * get_window_colours
+ *
+ * Get the colours for a given window.
+ *
+ */
+
+void get_window_colours (zword win, zbyte* fore, zbyte* back)
+{
+
+    *fore = lo (wp[win].colour);
+    *back = hi (wp[win].colour);
+
+}/* get_window_colours */
+
+/*
+ * get_window_font
+ *
+ * Get the font for a given window.
+ *
+ */
+
+zword get_window_font (zword win)
+{
+    zword font = wp[win].font;
+
+    if (font == TEXT_FONT)
+
+        if (h_version != V6) {
+
+            if (win != 0 || h_flags & FIXED_FONT_FLAG)
+
+                font = FIXED_WIDTH_FONT;
+
+        } else {
+
+            if (wp[win].style & FIXED_WIDTH_STYLE)
+
+                font = FIXED_WIDTH_FONT;
+
+        }
+
+    return font;
+
+}/* get_window_font */
+
+/*
+ * colour_in_use
+ *
+ * Check if a colour is set in any window.
+ *
+ */
+
+int colour_in_use (zword colour)
+{
+    int max = (h_version == V6) ? 8 : 2;
+    int i;
+
+    for (i = 0; i < max; i++) {
+
+        zword bg = hi (wp[i].colour);
+        zword fg = lo (wp[i].colour);
+
+        if (colour == fg || colour == bg)
+            return 1;
+
+
+    }
+
+    return 0;
+
+}/* colour_in_use */
+
+/*
+ * get_current_window
+ *
+ * Get the currently active window.
+ *
+ */
+
+zword get_current_window (void)
+{
+
+    return cwp - wp;
+
+}/* get_current_window */
+
index d0dbc77ccf4dc5d4ed77188821d9aa4172ecabdc..3d356b355d80998f3032c209d6895d85a6cdee62 100644 (file)
@@ -249,7 +249,7 @@ struct CONVstruct {
 
 
 /*** screen window ***/
-
+/*
 typedef struct {
     zword y_pos;
     zword x_pos;
@@ -270,4 +270,4 @@ typedef struct {
     zword true_fore;
     zword true_back;
 } Zwindow;
-
+*/
index 46debc27a225dc6360ec679d783d37daac83429d..d723c27400bdd2bb2014228dad1f8ac401c18e13 100644 (file)
@@ -8,10 +8,13 @@
 #include <stdarg.h>
 
 #include "sf_frotz.h"
-
 #include "../blorb/blorb.h"
 #include "../blorb/blorblow.h"
 
+zword hx_flags;
+zword hx_fore_colour;
+zword hx_back_colour;
+
 // various data
 
 bool   m_tandy = 0;
@@ -1013,3 +1016,22 @@ static FILE * findfromlist( int ispic, int num, int *size)
   return f;
   }
 
+void os_init_setup(void)
+{
+       f_setup.attribute_assignment = 0;
+       f_setup.attribute_testing = 0;
+       f_setup.context_lines = 0;
+       f_setup.object_locating = 0;
+       f_setup.object_movement = 0;
+       f_setup.left_margin = 0;
+       f_setup.right_margin = 0;
+       f_setup.ignore_errors = 0;
+       f_setup.piracy = 0;             /* enable the piracy opcode */
+       f_setup.undo_slots = MAX_UNDO_SLOTS;
+       f_setup.expand_abbreviations = 0;
+       f_setup.script_cols = 80;
+       f_setup.save_quetzal = 1;
+       f_setup.sound = 1;
+       f_setup.err_report_mode = ERR_DEFAULT_REPORT_MODE;
+
+}