X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Ftest.c;h=23b99826e1138697f27c0ad7ea3a191e65dc65c8;hb=29050ce6a22ce3d6c47183d6946e81ea25b6b5c7;hp=a34ed407862a65798f77177bd8c112e2ad6fe706;hpb=a4facf06a902997ce6d588e8518822cc407b62d8;p=16.git
diff --git a/src/test.c b/src/test.c
old mode 100644
new mode 100755
index a34ed407..23b99826
--- a/src/test.c
+++ b/src/test.c
@@ -1,97 +1,121 @@
-/* Project 16 Source Code~
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669
- *
- * 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.
- *
- */
-
+/* Project 16 Source Code~
+ * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669
+ *
+ * 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/modex16.h"
+#include "src/lib/16_in.h"
-word far* clockw= (word far*) 0x046C; /* 18.2hz clock */
+global_game_variables_t gvar;
+player_t player[MaxPlayers];
-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 start, end;
+ word p, k;
+ byte *pal, *pal2;
+ sword bakapee;
- /* load our palette */
- modexLoadPalFile("data/default.pal", &pal2);
+ //argument
+ if(argv[1]) bakapee = atoi(argv[1]);
+ else bakapee = 1;
- /* save the palette */
- pal = modexNewPal();
- modexPalSave(pal);
- modexFadeOff(1, pal);
- modexPalBlack();
+ /* load our palette */
+ modexLoadPalFile("data/default.pal", &pal2);
- modexEnter();
- modexPalBlack();
+ /* save the palette */
+ pal = modexNewPal();
+ modexPalSave(pal);
+ modexFadeOff(1, pal);
+ 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;
+ VGAmodeX(bakapee, &gvar);
+ modexPalBlack();
+ IN_Startup();
+ IN_Default(0,&player,ctrl_Joystick);
- /* 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);
+ /* set up the page, but with 16 pixels on all borders in offscreen mem */
+ gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);
+ gvar.video.page[1] = modexNextPage(&gvar.video.page[0]);
+ gvar.video.page[0].width += 32;
+ gvar.video.page[0].height += 32;
- /* fade in */
- modexFadeOn(1, pal2);
+ /* fill the page with one color, but with a black border */
+ modexShowPage(&gvar.video.page[1]);
+ modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 128);
+ modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 42);
+ modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 128);
+ modexShowPage(&gvar.video.page[0]);
- start = *clockw;
- 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);
- }
+ /* fade in */
+ modexFadeOn(1, pal2);
+
+ i=0,k=0,j=0,p=0;
+ start = *clockw;
+ while(!IN_KeyDown(sc_Escape) && i<5)
+ {
+ IN_ReadControl(0,&player);
+ switch (k)
+ {
+ case 0:
+ /* go right */
+ gvar.video.page[p].dx++;
+ if(j>=32){ k++; j=0; }else j++;
+ break;
+ case 1:
+ /* go left */
+ gvar.video.page[p].dx--;
+ if(j>=32){ k++; j=0; }else j++;
+ break;
+ case 2:
+ /* go up */
+ gvar.video.page[p].dy++;
+ if(j>=32){ k++; j=0; }else j++;
+ break;
+ case 3:
+ /* go down */
+ gvar.video.page[p].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;
+ }
+ if(IN_KeyDown(2)) p=0;
+ if(IN_KeyDown(3)) p=1;
+ modexShowPage(&gvar.video.page[p]);
}
- }
- end = *clockw;
+ end = *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, &gvar);
+ IN_Shutdown();
+ printf("Project 16 test.exe. This is just a test file!\n");
+ printf("version %s\n", VERSION);
+ modexPalBlack();
+ modexFadeOn(1, pal);
}