]> 4ch.mooo.com Git - 16.git/blobdiff - src/scroll.c
scroll.exe works again but the fps thingy dose not work because of MM zcroll breaks...
[16.git] / src / scroll.c
index e638df1b06c0677b09dce6d45fe3b32e956024a8..bb0863045ea27ad95b12a4409cca71506017c570 100755 (executable)
 #include "src/lib/scroll16.h"\r
 #include "src/lib/16_timer.h"\r
 #include "src/lib/wcpu/wcpu.h"\r
+#include "src/lib/mapread.h"\r
+#include "src/lib/16_dbg.h"\r
 \r
 //#define FADE\r
 #define MODEX  //this is for mode x initiating\r
 \r
+boolean dbg_nommpmca=1;\r
+\r
 //word far *clock= (word far*) 0x046C; /* 18.2hz clock */\r
 //bitmap_t *p;\r
 global_game_variables_t gvar;\r
@@ -38,7 +42,7 @@ float t;
 sword bakapee;\r
 pan_t pan;\r
 //debugswitches\r
-boolean panswitch=0;\r
+boolean panswitch=0;//1\r
 //extern boolean pageflipflop=1;\r
        unsigned int i;\r
        const char *cpus;\r
@@ -47,7 +51,7 @@ boolean panswitch=0;
        //map_view_db_t pgid[4];\r
        word pg;\r
 //#ifdef FADE\r
-       static word paloffset=0;\r
+       //static word paloffset=0;\r
        byte *dpal;\r
 //#endif\r
        byte *gpal;\r
@@ -56,44 +60,15 @@ boolean panswitch=0;
 \r
 void main(int argc, char *argv[])\r
 {\r
-       byte *mesg=malloc(sizeof(dword));\r
+       //byte *mesg=malloc(sizeof(dword));\r
 \r
        if(argv[1]) bakapee = atoi(argv[1]);\r
        else bakapee = 1;\r
 \r
-       // DOSLIB: check our environment\r
-       probe_dos();\r
-\r
-       // DOSLIB: what CPU are we using?\r
-       // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.\r
-       //      So this code by itself shouldn't care too much what CPU it's running on. Except that other\r
-       //      parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for\r
-       //      the CPU to carry out tasks. --J.C.\r
-       cpu_probe();\r
-\r
-       // DOSLIB: check for VGA\r
-       if (!probe_vga()) {\r
-               printf("VGA probe failed\n");\r
-               return;\r
-       }\r
-       // hardware must be VGA or higher!\r
-       if (!(vga_state.vga_flags & VGA_IS_VGA)) {\r
-               printf("This program requires VGA or higher graphics hardware\n");\r
-               return;\r
-       }\r
-\r
-       if (_DEBUG_INIT() == 0) {\r
-#ifdef DEBUGSERIAL\r
-               printf("WARNING: Failed to initialize DEBUG output\n");\r
-#endif\r
-       }\r
-       _DEBUG("Serial debug output started\n"); // NTS: All serial output must end messages with newline, or DOSBox-X will not emit text to log\r
-       _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U);\r
+       Startup16(&gvar);\r
 \r
        pan.pn=1;\r
 \r
-       start_timer(&gvar);\r
-\r
        /* create the map */\r
        fprintf(stderr, "testing map load~      ");\r
        loadmap("data/test.map", &map);\r
@@ -118,9 +93,8 @@ void main(int argc, char *argv[])
 \r
 #endif\r
        /*      input!  */\r
-       IN_Startup();\r
-       IN_Default(0,&player,ctrl_Joystick);\r
-       //IN_Default(1,&player,ctrl_Joystick);\r
+       if(!dbg_noplayerinpu)\r
+       IN_Default(0,&player,ctrl_Keyboard1);\r
 \r
        /* save the palette */\r
 #ifdef MODEX\r
@@ -212,6 +186,7 @@ void main(int argc, char *argv[])
        modexFadeOn(4, gpal);\r
 #endif\r
 #endif\r
+       if(!dbg_noplayerinpu)\r
        while(!IN_KeyDown(sc_Escape) && player[0].hp>0)\r
        {\r
                shinku(&gvar);\r
@@ -220,11 +195,11 @@ void main(int argc, char *argv[])
        //when player[0].tx or player[0].ty == 0 or player[0].tx == 20 or player[0].ty == 15 then stop because that is edge of map and you do not want to walk of the map\r
 \r
        //player movement\r
-               IN_ReadControl(0,&player);\r
+               IN_ReadControl(0, &player);\r
        if(!panswitch){\r
-               walk(mv, player, 0);\r
+               walk(mv, &player, 0);\r
        }else{\r
-               panpagemanual(mv, player, 0);\r
+               panpagemanual(mv, &player, 0);\r
                //printf("      player[0].q: %d", player[0].q); printf("        player[0].d: %d\n", player[0].d);\r
        }\r
 \r
@@ -306,6 +281,11 @@ void main(int argc, char *argv[])
        //if(IN_KeyDown(11)){ modexPalOverscan(15); }\r
        if((player[0].q==1) && !(player[0].x%TILEWH==0 && player[0].y%TILEWH==0)) break;        //incase things go out of sync!\r
        }\r
+       else\r
+               while(!kbhit())\r
+               {\r
+                       shinku(&gvar);\r
+               }\r
 \r
        /* fade back to text mode */\r
        /* but 1st lets save the game palette~ */\r
@@ -317,7 +297,7 @@ void main(int argc, char *argv[])
 #endif\r
        VGAmodeX(0, 1, &gvar);\r
 #endif\r
-       IN_Shutdown();\r
+       Shutdown16(&gvar);\r
        printf("\nProject 16 scroll.exe. This is just a test file!\n");\r
        printf("version %s\n", VERSION);\r
        printf("tx: %d  ", mv[0].tx);\r
@@ -346,8 +326,7 @@ void main(int argc, char *argv[])
        //printf("mv[%u].tx: %d", pan.pn, mv[pan.pn].tx); printf("      mv[%u].ty: %d   ", pan.pn, mv[pan.pn].ty);\r
        printf("gvar.video.p=%u ", gvar.video.p); printf("gvar.video.r=%u ", gvar.video.r);\r
        printf("pageflipflop=%u\n", pageflipflop);\r
-       //0000printf("\ngvar.video.tickclk=%f\n", gvar.video.tickclk);\r
-       //0000printf("gvar.video.clk=%f", gvar.video.clk);\r
+       //printf("gvar.kurokku: "); printf("%.0f ", clock());   printf("tiku=%lu ", gvar.kurokku.tiku); printf("t=%.0f ", gvar.kurokku.t);      printf("ticktock()=%f ", ticktock(&gvar));      printf("%.0f fps", (double)gvar.kurokku.tiku/ticktock(&gvar));\r
        printf("\n");\r
        //printf("map.width=%d  map.height=%d   map.data[0]=%d\n", mv[0].map->width, mv[0].map->height, mv[0].map->data[0]);\r
 \r