X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Ftest.c;h=ce05994363d82a2424234fd9edc4b9539d14b856;hb=17059078badc368466bae1e8dae877c9a9876506;hp=24520a53b41addd3c26bf02ac35b884abc8e0e82;hpb=1073f7dbfa5b78819af46c64f3ffd0301e9d8cc6;p=16.git diff --git a/src/test.c b/src/test.c old mode 100644 new mode 100755 index 24520a53..ce059943 --- a/src/test.c +++ b/src/test.c @@ -1,75 +1,192 @@ -#include "src/lib/modex16.h" +/* Project 16 Source Code~ + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + #include +#include "src/lib/modex16.h" +#include "src/lib/16_in.h" +#include "src/lib/scroll16.h" -word far* clock= (word far*) 0x046C; /* 18.2hz clock */ +global_game_variables_t gvar; +player_t player[MaxPlayers]; +map_view_t mv[2]; +pan_t pan; -void main() { - int i, j; - word start, end; - page_t page, page2; - byte *pal, *pal2=NULL; +void main(int argc, char *argv[]) +{ + int i, j; + word startclk, endclk; + word k; + byte *pal, *pal2; + sword bakapee; - /* load our palette */ - modexLoadPalFile("gfx.pal", &pal2); + //argument + if(argv[1]) bakapee = atoi(argv[1]); + else bakapee = 1; - /* save the palette */ - pal = modexNewPal(); - modexPalSave(pal); - modexFadeOff(1, pal); - modexPalBlack(); - modexEnter(); - modexPalBlack(); + // DOSLIB: check our environment + probe_dos(); - /* 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; + // 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; + } - /* fill the page with one color, but with a black border */ - modexShowPage(&page2); - modexClearRegion(&page, 16, 16, SCREEN_WIDTH, SCREEN_HEIGHT, 128); - modexClearRegion(&page, 32, 32, SCREEN_WIDTH-32, SCREEN_HEIGHT-32, 42); - modexClearRegion(&page, 48, 48, SCREEN_WIDTH-64, SCREEN_HEIGHT-64, 128); - modexShowPage(&page); + /* load our palette */ + modexLoadPalFile("data/default.pal", &pal2); - /* fade in */ - modexFadeOn(1, pal2); + /* save the palette */ + pal = modexNewPal(); + modexPalSave(pal); + modexFadeOff(1, pal); + modexPalBlack(); + IN_Startup(); + IN_Default(0,&player,ctrl_Keyboard1); + IN_initplayer(&player, 0); - start = *clock; - for(i=0; i<5; i++) { - /* go right */ - for(j=0; j<32; j++) { - page.dx++; - modexShowPage(&page); - } - /* go left */ - for(j=0; j<32; j++) { - page.dx--; - modexShowPage(&page); - } - /* go up */ - for(j=0; j<32; j++) { - page.dy++; - modexShowPage(&page); + textInit(); + VGAmodeX(bakapee, 1, &gvar); + modexPalBlack(); + + /* set up the page, but with 16 pixels on all borders in offscreen mem */ + 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: + + 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(2)) pan.pn=0; + if(IN_KeyDown(3)) pan.pn=1; + if(IN_KeyDown(25)){ + modexpdump(&gvar.video.page[pan.pn]); + }//p + modexShowPage(&gvar.video.page[pan.pn]); } - } - end = *clock; + endclk = *clockw; - /* fade back to text mode */ - modexFadeOff(1, pal2); - modexPalBlack(); - modexLeave(); - modexPalBlack(); - modexFadeOn(1, pal); + /* fade back to text mode */ + modexFadeOff(1, pal2); + modexPalBlack(); + VGAmodeX(0, 1, &gvar); + printf("Project 16 test.exe. This is just a test file!\n"); + printf("version %s\n", VERSION); + printf("video memory remaining: %ld\n", gvar.video.vmem_remain); + printf("page "); + for(i=0; i