X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fpcxtest2.c;h=0b026b9270c01cd31cd1a5ff00ac12f204e9186a;hb=6021fc3f27b895d382fbd30488ead35657e39196;hp=2fc4a4b0cfccd627de944b024d85885a8f93cbf9;hpb=c3104b1494bd0f31ce49e3365d36e4ace02e69c7;p=16.git diff --git a/src/pcxtest2.c b/src/pcxtest2.c index 2fc4a4b0..0b026b92 100755 --- a/src/pcxtest2.c +++ b/src/pcxtest2.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2018 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover * * This file is part of Project 16. * @@ -23,11 +23,11 @@ #include #include #include -#include "src/lib/modex16.h" +#include "src/lib/16_vl.h" #include "src/lib/bitmap.h" -#include "src/lib/planar.h" +//----#include "src/lib/planar.h" -global_game_variables_t gvar; +static word far* clockw= (word far*) 0x046C; /* 18.2hz clock */ /* void @@ -55,34 +55,55 @@ DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite) */ void main() { + static global_game_variables_t gvar; bitmap_t bmp; - planar_buf_t *p; +//---- planar_buf_t *p; int i; - page_t page; word start; int plane; float t1, t2; - page=modexDefaultPage(); - page.width+=32; - page.height+=32; + // DOSLIB: check our environment + probe_dos(); + + // DOSLIB: what CPU are we using? + // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS. + // So this code by itself shouldn't care too much what CPU it's running on. Except that other + // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for + // the CPU to carry out tasks. --J.C. + cpu_probe(); + + // DOSLIB: check for VGA + if (!probe_vga()) { + printf("VGA probe failed\n"); + return; + } + // hardware must be VGA or higher! + if (!(vga_state.vga_flags & VGA_IS_VGA)) { + printf("This program requires VGA or higher graphics hardware\n"); + return; + } + //0000 bmp = bitmapLoadPcx("data/koishi~~.pcx"); -// bmp = bitmapLoadPcx("data/chikyuu.pcx"); - bmp = bitmapLoadPcx("data/koishi^^.pcx"); + bmp = bitmapLoadPcx("data/chikyuu.pcx", &gvar); +// bmp = bitmapLoadPcx("data/koishi^^.pcx"); // bmp = bitmapLoadPcx("16/PCX_LIB/chikyuu.pcx"); - p = planar_buf_from_bitmap(&bmp); - VGAmodeX(1, &gvar); +//---- p = planar_buf_from_bitmap(&bmp); + VGAmodeX(1, 1, &gvar); + gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]); + gvar.video.page[0].sw+=32; + gvar.video.page[0].sh+=32; /* fix up the palette and everything */ - modexPalUpdate1(bmp.palette); + modexPalUpdate(bmp.palette); /* clear and draw one sprite and one bitmap */ - modexClearRegion(&page, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 1); + modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 1); /* update display~*/ - page.dx+=16; - page.dy+=16; - modexShowPage(&page); + gvar.video.page[0].dx+=16; + gvar.video.page[0].dy+=16; + modexShowPage(&gvar.video.page[0]); /* non sprite comparison */ start = *clockw; @@ -92,15 +113,15 @@ void main() { start = *clockw; //for(i=0; i<100 ;i++) { -//0000 modexDrawBmp(&page, 20, 20, &bmp); - modexDrawBmp(&page, 160, 120, &bmp); +//0000 modexDrawBmp(&gvar.video.page[0], 20, 20, &bmp); + modexDrawBmp(&gvar.video.page[0], 160, 120, &bmp); //} t1 = (*clockw-start) /18.2; start = *clockw; //for(i=0; i<100; i++) { -//0000 modexCopyPageRegion(&page, &page, 20, 20, 128, 20, 64, 64); - modexCopyPageRegion(&page, &page, 0, 0, 0, 0, 320, 240); +//0000 modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 20, 20, 128, 20, 64, 64); + modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240); //} t2 = (*clockw-start)/18.2; @@ -113,16 +134,16 @@ void main() { start = *clockw; //for(i=0; i<100 ;i++) { -//0000 modexDrawSprite(&page, 20, 20, &bmp); - modexDrawSprite(&page, 160, 120, &bmp); +//0000 modexDrawSprite(&gvar.video.page[0], 20, 20, &bmp); + modexDrawSprite(&gvar.video.page[0], 160, 120, &bmp); //} - //_fmemset(MK_FP(0xA000, 0), (int)p->plane, SCREEN_WIDTH*(SCREEN_HEIGHT*2)); - //modexDrawBmp(&page, 0, 0, &bmp); + //_fmemset(MK_FP(0xA000, 0), (int)p->plane, gvar.video.page[0].sw*(gvar.video.page[0].sh*2)); + //modexDrawBmp(&gvar.video.page[0], 0, 0, &bmp); while(!kbhit()) { - //DrawPBuf(&page, 0, 0, p, 0); + //DrawPBuf(&gvar.video.page[0], 0, 0, p, 0); } - VGAmodeX(0, &gvar); + VGAmodeX(0, 1, &gvar); /*printf("\nmain=%Fp\n\n", &i); printf("bmp.data=%Fp\n", bmp.data); printf("*bmp.data=%Fp\n", *(bmp.data)); @@ -138,7 +159,7 @@ void main() { }*/ printf("CPU to VGA: %f\n", t1); printf("VGA to VGA: %f\n", t2); - printf("page.width: %u\n", page.width); - printf("page.height: %u\n", page.height); + printf("gvar.video.page[0].width: %u\n", gvar.video.page[0].width); + printf("gvar.video.page[0].height: %u\n", gvar.video.page[0].height); return; }