]> 4ch.mooo.com Git - 16.git/blobdiff - src/test.c
wwww updated sheet ww
[16.git] / src / test.c
old mode 100644 (file)
new mode 100755 (executable)
index 99a2f9f..b80291f
-/* 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 <http://www.gnu.org/licenses/>, or
- * write to the Free Software Foundation, Inc., 51 Franklin Street,
- * Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
+\r
 #include <stdio.h>\r
-#include "src/lib/modex16.h"
+#include "src/lib/modex16.h"\r
+#include "src/lib/16_in.h"\r
 \r
-word far* clockw= (word far*) 0x046C; /* 18.2hz clock */\r
+global_game_variables_t gvar;\r
+player_t player[MaxPlayers];\r
 \r
-void main() {\r
-    int i, j;\r
-    word start, end;\r
-    page_t page, page2;\r
-    byte *pal, *pal2=NULL;\r
+void main(int argc, char *argv[])\r
+{\r
+       int i, j;\r
+       word start, end;\r
+       word p, k;\r
+       byte *pal, *pal2;\r
+       sword bakapee;\r
 \r
-    /* load our palette */\r
-    modexLoadPalFile("gfx.pal", &pal2);\r
+       //argument\r
+       if(argv[1]) bakapee = atoi(argv[1]);\r
+       else bakapee = 1;\r
 \r
-    /* save the palette */\r
-    pal  = modexNewPal();\r
-    modexPalSave(pal);\r
-    modexFadeOff(1, pal);\r
-    modexPalBlack();\r
+       /* load our palette */\r
+       modexLoadPalFile("data/default.pal", &pal2);\r
 \r
-    modexEnter();\r
-    modexPalBlack();\r
+       /* save the palette */\r
+       pal  = modexNewPal();\r
+       modexPalSave(pal);\r
+       modexFadeOff(1, pal);\r
+       modexPalBlack();\r
 \r
-    /* set up the page, but with 16 pixels on all borders in offscreen mem */\r
-    page=modexDefaultPage();\r
-    page2 = modexNextPage(&page);\r
-    page.width += 32;\r
-    page.height += 32;\r
+       VGAmodeX(bakapee, 1, &gvar);\r
+       modexPalBlack();\r
 \r
+       IN_Startup();\r
+       IN_Default(0,&player,ctrl_Joystick);\r
 \r
-    /* fill the page with one color, but with a black border */\r
-    modexShowPage(&page2);\r
-    modexClearRegion(&page, 16, 16, SCREEN_WIDTH, SCREEN_HEIGHT, 128);\r
-    modexClearRegion(&page, 32, 32, SCREEN_WIDTH-32, SCREEN_HEIGHT-32, 42);\r
-    modexClearRegion(&page, 48, 48, SCREEN_WIDTH-64, SCREEN_HEIGHT-64, 128);\r
-    modexShowPage(&page);\r
+       /* set up the page, but with 16 pixels on all borders in offscreen mem */\r
+       gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);\r
+       gvar.video.page[1] = modexNextPage(&gvar.video.page[0]);\r
+       gvar.video.page[0].width += 32;\r
+       gvar.video.page[0].height += 32;\r
 \r
-    /* fade in */\r
-    modexFadeOn(1, pal2);\r
 \r
+       /* fill the page with one color, but with a black border */\r
+       modexShowPage(&gvar.video.page[1]);\r
+       modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 128);\r
+       modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 42);\r
+       modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 128);\r
+       modexShowPage(&gvar.video.page[0]);\r
 \r
-    start = *clockw;\r
-    for(i=0; i<5; i++) {\r
-       /* go right */\r
-       for(j=0; j<32; j++) {\r
-           page.dx++;\r
-           modexShowPage(&page);\r
-       }\r
-       /* go left */\r
-       for(j=0; j<32; j++) {\r
-           page.dx--;\r
-           modexShowPage(&page);\r
-       }\r
-       /* go up */\r
-       for(j=0; j<32; j++) {\r
-           page.dy++;\r
-           modexShowPage(&page);\r
-       }\r
+       /* fade in */\r
+       modexFadeOn(1, pal2);\r
+\r
+       i=0,k=0,j=0,p=0;\r
+       start = *clockw;\r
+       while(!IN_KeyDown(sc_Escape) && i<5)\r
+       {\r
+               IN_ReadControl(0,&player);\r
+               switch (k)\r
+               {\r
+                       case 0:\r
+                               /* go right */\r
+                               gvar.video.page[p].dx++;\r
+                               if(j>=32){ k++; j=0; }else j++;\r
+                       break;\r
+                       case 1:\r
+                               /* go left */\r
+                               gvar.video.page[p].dx--;\r
+                               if(j>=32){ k++; j=0; }else j++;\r
+                       break;\r
+                       case 2:\r
+                               /* go up */\r
+                               gvar.video.page[p].dy++;\r
+                               if(j>=32){ k++; j=0; }else j++;\r
+                       break;\r
+                       case 3:\r
+                               /* go down */\r
+                               gvar.video.page[p].dy--;\r
+                               if(j>=32){ k=0; j=0; i++; }else j++;\r
+                       break;\r
+                       default:\r
 \r
-       /* go down */\r
-       for(j=0; j<32; j++) {\r
-           page.dy--;\r
-           modexShowPage(&page);\r
+                       break;\r
+               }\r
+               if(IN_KeyDown(2)) p=0;\r
+               if(IN_KeyDown(3)) p=1;\r
+               modexShowPage(&gvar.video.page[p]);\r
        }\r
-    }\r
 \r
-    end = *clockw;\r
+       end = *clockw;\r
 \r
-    /* fade back to text mode */\r
-    modexFadeOff(1, pal2);\r
-    modexPalBlack();\r
-    modexLeave();\r
-    modexPalBlack();\r
-    modexFadeOn(1, pal);\r
+       /* fade back to text mode */\r
+       modexFadeOff(1, pal2);\r
+       modexPalBlack();\r
+       VGAmodeX(0, 1, &gvar);\r
+       IN_Shutdown();\r
+       printf("Project 16 test.exe. This is just a test file!\n");\r
+       printf("version %s\n", VERSION);\r
+       modexPalBlack();\r
+       modexFadeOn(1, pal);\r
 }\r