]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_timer.c
updating copy left. i am super fuckin busy with school, and trying to get life back...
[16.git] / src / lib / 16_timer.c
index c8416c79f822c08735e52cd15ade0026e4b7677e..c4a80522f032500514909a5d45decb9addd40d37 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2019 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
  *\r
  * This file is part of Project 16.\r
  *\r
 \r
 #include "src/lib/16_timer.h"\r
 \r
+static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */\r
+\r
 clock_t start_timer(global_game_variables_t *gv)\r
 {\r
        gv->kurokku.t = clock();\r
-       gv->kurokku.tiku = 0;\r
+       gv->kurokku.tiku = 0; gv->video.sfip = 0;\r
        gv->kurokku.clock_start = *clockw;\r
-       gv->kurokku.clock = clockw;\r
-       gv->kurokku.frames_per_second = 60;\r
-       gv->pee = _nmalloc(sizeof(byte)*2);\r
+       gv->kurokku.clock = (word *)clockw;\r
+       gv->kurokku.wcpu = WCPU_detectcpu();\r
+\r
        //turn this off if XT\r
-       switch(detectcpu())\r
+       switch(gv->kurokku.wcpu)\r
        {\r
                case 0:\r
                        gv->kurokku.fpscap=0;\r
+                       gv->kurokku.frames_per_second=1;\r
                break;\r
                default:\r
                        gv->kurokku.fpscap=1;\r
+                       gv->kurokku.frames_per_second=FPSVALUE;\r
                break;\r
        }\r
        return gv->kurokku.t;\r
@@ -66,6 +70,7 @@ double time_in_seconds(global_game_variables_t *gv)
        return (in_t) / CLOCKS_PER_SEC;\r
 }*/\r
 \r
+#if 0\r
 /*     sync    */\r
 void shinkutxt(global_game_variables_t *gv)\r
 {\r
@@ -73,25 +78,26 @@ void shinkutxt(global_game_variables_t *gv)
        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, "%f 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
        gv->kurokku.tiku++;\r
-       switch(gv->kurokku.fpscap)\r
-       {\r
-               case 0:\r
-                       gv->kurokku.frames_per_second=1;\r
-               break;\r
-               case 1:\r
-                       //turn this off if XT\r
-                       WaitPee();\r
-                       gv->kurokku.frames_per_second=60;\r
-               break;\r
-       }\r
+//     switch(gv->kurokku.fpscap)\r
+//     {\r
+//             case 0:\r
+//                     gv->kurokku.frames_per_second=1;\r
+//             break;\r
+//             case 1:\r
+//                     //turn this off if XT\r
+//                     WaitPee();\r
+//                     gv->kurokku.frames_per_second=60;\r
+//             break;\r
+//     }\r
 }\r
 \r
+//#if 0\r
 void WaitPee()\r
 {\r
     while(inp(INPUT_STATUS_1)  & 8)  {\r
@@ -102,3 +108,4 @@ void WaitPee()
        /* spin */\r
     }\r
 }\r
+#endif\r