]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/scroll16.c
fix bizarre near/far sprintf problem when gv->pee not initialized by just replacing the
[16.git] / src / lib / scroll16.c
index b94e768a77c1a8d4813111caa3e2bdae39c36cf3..6f1c450ed0e1d2fd89473cd755ddaca0cdd06d7b 100755 (executable)
@@ -774,9 +774,16 @@ void shinku(global_game_variables_t *gv)
 //     vga_restore_rm0wm0();\r
        if(elapsed_timer(gv) >= (1.0 / gv->kurokku.frames_per_second))\r
        {\r
-               sprintf(gv->pee, "%.0f fps", (double)gv->kurokku.tiku/ticktock(gv));\r
+        // NTS: For some bizarre reason, gv->pee is not initialized, but the pointer is not NULL even\r
+        //      though it should be. Instead it's NULL as a near pointer but contains a non-null\r
+        //      segment value, so testing against NULL doesn't work. It is initialized properly if\r
+        //      you call start_timer() though which uses near malloc. Rather than fight with that,\r
+        //      I decided it would be better to declare a temp buffer statically and sprintf to that.\r
+        //\r
+        //      This fixes *** Null pointer assignment detected error message in ZCROLL.EXE on exit.\r
+               sprintf(global_temp_status_text, "%.0f fps", (double)gv->kurokku.tiku/ticktock(gv));\r
                //modexClearRegion(&(gv->video.page[shinku_fps_indicator_page]), x, y, w, h, 45);\r
-               modexprint(&(gv->video.page[/*!*/(gv->video.p)]), x, y, type, col, bgcol, gv->pee);\r
+               modexprint(&(gv->video.page[/*!*/(gv->video.p)]), x, y, type, col, bgcol, global_temp_status_text);\r
                gv->kurokku.tiku=0;\r
                /* block copy to visible RAM from offscreen */\r
 //             vga_setup_wm1_block_copy();\r