X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Ftest.c;h=2c698a63327d5217413cfd335b6911a3ca88a045;hb=9fae6d1ef0ebd44690958e072f400edde9262208;hp=1f9a4322bbb5c305bfac4954b8bd8843dc73b134;hpb=c3104b1494bd0f31ce49e3365d36e4ace02e69c7;p=16.git diff --git a/src/test.c b/src/test.c index 1f9a4322..2c698a63 100755 --- a/src/test.c +++ b/src/test.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * @@ -22,14 +22,54 @@ #include #include "src/lib/modex16.h" +#include "src/lib/16_in.h" +#include "src/lib/scroll16.h" global_game_variables_t gvar; +player_t player[MaxPlayers]; +map_view_t mv[4]; +pan_t pan; -void main() { +void main(int argc, char *argv[]) +{ int i, j; - word start, end; - page_t page, page2; - byte *pal, *pal2=NULL; + word startclk, endclk; + word k; + byte *pal, *pal2; + sword bakapee; + + //argument + if(argv[1]) bakapee = atoi(argv[1]); + else bakapee = 1; + + + // 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; + } + + if (_DEBUG_INIT() == 0) { +#ifdef DEBUGSERIAL + printf("WARNING: Failed to initialize DEBUG output\n"); +#endif + } + _DEBUG("Serial debug output started\n"); // NTS: All serial output must end messages with newline, or DOSBox-X will not emit text to log /* load our palette */ modexLoadPalFile("data/default.pal", &pal2); @@ -40,58 +80,117 @@ void main() { modexFadeOff(1, pal); modexPalBlack(); - VGAmodeX(1, &gvar); + IN_Startup(); + IN_Default(0,&player,ctrl_Keyboard1); + IN_initplayer(&player, 0); + + textInit(); + VGAmodeX(bakapee, 1, &gvar); modexPalBlack(); /* set up the page, but with 16 pixels on all borders in offscreen mem */ - page=modexDefaultPage(); - page2 = modexNextPage(&page); - page.width += 32; - page.height += 32; + modexHiganbanaPageSetup(&gvar.video); + for(i=0;i=31){ i++; j=0; goto baka; }else j++; }else + if(j>=32){ k++; j=0; }else j++; + break; + case 1: + // go left + gvar.video.page[pan.pn].dx--; + if(j>=32){ k++; j=0; }else j++; + break; + case 2: + // go up + gvar.video.page[pan.pn].dy++; + if(j>=32){ k++; j=0; }else j++; + break; + case 3: + // go down + gvar.video.page[pan.pn].dy--; + if(j>=32){ k=0; j=0; i++; }else j++; + break; + default: - /* go down */ - for(j=0; j<32; j++) { - page.dy--; - modexShowPage(&page); - } + break; + }}else{ + if(i==5) goto pee; + baka: + i++; + modexClearRegion(&gvar.video.page[1], 0, gvar.video.page[0].height/2, gvar.video.page[0].width-32, 16, 45);*/ +// if(IN_KeyDown(6)) +// { +// modexClearRegion(&gvar.video.page[1], gvar.video.page[1].sw, 16, 8, 4, 45); +// } +// if(IN_KeyDown(4+1)){ +// modexClearRegion(&gvar.video.page[1], 16, 16, gvar.video.page[1].sw, gvar.video.page[1].sh, 128); +// modexClearRegion(&gvar.video.page[1], 32, 32, gvar.video.page[1].sw-32, gvar.video.page[1].sh-32, 42); +// modexClearRegion(&gvar.video.page[1], 48, 48, gvar.video.page[1].sw-64, gvar.video.page[1].sh-64, 128); +// } + //} + if(IN_KeyDown(1+1)) pan.pn=0; + if(IN_KeyDown(2+1)) pan.pn=1; + if(IN_KeyDown(3+1)) pan.pn=2; + if(IN_KeyDown(4+1)) pan.pn=3; + if(IN_KeyDown(25)){ + modexpdump(&gvar.video.page[pan.pn]); + }//p + modexShowPage(&gvar.video.page[pan.pn]); } - end = *clockw; + endclk = *clockw; /* fade back to text mode */ modexFadeOff(1, pal2); modexPalBlack(); - VGAmodeX(0, &gvar); + VGAmodeX(0, 1, &gvar); + printf("Project 16 test.exe. This is just a test file!\n"); + printf("version %s\n", VERSION); + modexprintmeminfo(&gvar.video); + printf("tx=%d ", mv[pan.pn].tx); printf("ty=%d ", mv[pan.pn].ty); printf("player.d=%d\n", player[0].d); + IN_Shutdown(); modexPalBlack(); modexFadeOn(1, pal); }