gv->pee status text buffer with a global char[] buffer everyone can use for status messages.
that way Watcom C can resolve the far pointer properly to sprintf(). This fixes ZCROLL.EXE
printing *** Null pointer assignment detected on shutdown.
gv->kurokku.clock_start = *clockw;\r
gv->kurokku.clock = clockw;\r
//gv->kurokku.frames_per_second = 60;\r
- gv->pee = _nmalloc(sizeof(byte)*16);\r
- //turn this off if XT\r
+\r
+ //turn this off if XT\r
switch(detectcpu())\r
{\r
case 0:\r
return (gv->kurokku.t) / CLOCKS_PER_SEC;\r
}\r
\r
+// big global status text buffer\r
+char global_temp_status_text[512];\r
+\r
/*double time_in_seconds(time_t in_t)\r
{\r
return (in_t) / CLOCKS_PER_SEC;\r
if(elapsed_timer(gv) >= (1.0 / gv->kurokku.frames_per_second))\r
{\r
//t=(((*(gv->clock))-gv->clock_start) /18.2);\r
- sprintf(gv->pee, "%.0f fps", (double)gv->kurokku.tiku/ticktock(gv));\r
- fprintf(stderr, "%s\n", gv->pee);\r
+ sprintf(global_temp_status_text, "%.0f fps", (double)gv->kurokku.tiku/ticktock(gv));\r
+ fprintf(stderr, "%s\n", global_temp_status_text);\r
//(gv->clock_start)=*(gv->clock);\r
gv->kurokku.tiku=0;\r
}\r
// 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
extern boolean pageflipflop, pageploop;\r
extern unsigned char shinku_fps_indicator_page;\r
\r
+extern char global_temp_status_text[512];\r
+\r
//map_t allocMap(int w, int h);\r
//void initMap(map_t *map);\r
void walk(map_view_t *pip, player_t *player, word pn);\r
video_t video; // video settings variable\r
ca_t ca; // ca stuff\r
pm_t pm; // pm stuff\r
- byte *pee; // message for fps\r
loghandle_t handle; //handles for file logging\r
kurokku_t kurokku; //clock struct\r
mminfo_t mm; mminfotype mmi;\r
} global_game_variables_t;\r
\r
+extern char global_temp_status_text[512];\r
+\r
#endif /* _TYPEDEFSTRUCT_H_ */\r