]> 4ch.mooo.com Git - 16.git/blobdiff - src/pcxtest.c
wwww ok wwwww zscroll and scroll compile disabled due to me being too tired to whack...
[16.git] / src / pcxtest.c
index 7a8c3389c21e4caf37cb6e0d44a1f5dcc7c01442..84a8323699855b657c370a37a64cbd96939d91a3 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
  *\r
  * This file is part of Project 16.\r
  *\r
 #include <stdio.h>\r
 #include <dos.h>\r
 #include <string.h>\r
-#include "src/lib/modex16.h"\r
+#include "src/lib/16_vl.h"\r
 #include "src/lib/bitmap.h"\r
-#include "src/lib/planar.h"\r
+//----#include "src/lib/planar.h"\r
 \r
 global_game_variables_t gvar;\r
-\r
-/*\r
-void\r
-DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite)\r
-{\r
-       byte plane;\r
-       word px, py;\r
-       word offset;\r
-\r
-       // TODO Make this fast.  It's SLOOOOOOW\r
-       for(plane=0; plane < 4; plane++) {\r
-       modexSelectPlane(PLANE(plane+x));\r
-       for(px = plane; px < p->width; px+=4) {\r
-               offset=px;\r
-               for(py=0; py<p->height/2; py++) {\r
-               SELECT_ALL_PLANES();\r
-               if(!sprite || p->plane[offset])\r
-                       page->data = p->plane;\r
-               //offset+=p->width;\r
-               //offset++;\r
-               }\r
-       }\r
-       }\r
-}\r
-*/\r
+static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */\r
 \r
 void main() {\r
        bitmap_t bmp;\r
-       planar_buf_t *p;\r
+//---- planar_buf_t *p;\r
        int i;\r
        word start;\r
        int plane;\r
        float t1, t2;\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
 //0000 bmp = bitmapLoadPcx("data/koishi~~.pcx");\r
-//     bmp = bitmapLoadPcx("data/chikyuu.pcx");\r
-       bmp = bitmapLoadPcx("data/koishi^^.pcx");\r
+       bmp = bitmapLoadPcx("data/chikyuu.pcx");\r
+//     bmp = bitmapLoadPcx("data/koishi^^.pcx");\r
 //     bmp = bitmapLoadPcx("16/PCX_LIB/chikyuu.pcx");\r
-       p = planar_buf_from_bitmap(&bmp);\r
-       VGAmodeX(1, &gvar);\r
+//---- p = planar_buf_from_bitmap(&bmp);\r
+       VGAmodeX(1, 1, &gvar);\r
        gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);\r
 \r
        /* fix up the palette and everything */\r
@@ -114,7 +111,7 @@ void main() {
        {\r
                //DrawPBuf(&gvar.video.page[0], 0, 0, p, 0);\r
        }\r
-       VGAmodeX(0, &gvar);\r
+       VGAmodeX(0, 1, &gvar);\r
        /*printf("\nmain=%Fp\n\n", &i);\r
        printf("bmp.data=%Fp\n", bmp.data);\r
        printf("*bmp.data=%Fp\n", *(bmp.data));\r