OSDN Git Service

no idea how to get joy buttons 2 and 3 to function.
[proj16/16.git] / src / pcxtest2.c
index 3b83c53..9052546 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
+ * Copyright (C) 2012-2021 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
+static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */\r
 \r
 /*\r
 void\r
@@ -55,25 +55,47 @@ DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite)
 */\r
 \r
 void main() {\r
+       static global_game_variables_t gvar;\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", &gvar);\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
        gvar.video.page[0].sw+=32;\r
        gvar.video.page[0].sh+=32;\r
 \r
        /* fix up the palette and everything */\r
-       modexPalUpdate1(bmp.palette);\r
+       modexPalUpdate(bmp.palette);\r
 \r
        /* clear and draw one sprite and one bitmap */\r
        modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 1);\r
@@ -121,7 +143,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