]> 4ch.mooo.com Git - 16.git/blob - src/test.c
test updated a bit
[16.git] / src / test.c
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
3  *\r
4  * This file is part of Project 16.\r
5  *\r
6  * Project 16 is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 3 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Project 16 is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
19  * Fifth Floor, Boston, MA 02110-1301 USA.\r
20  *\r
21  */\r
22 \r
23 #include <stdio.h>\r
24 #include "src/lib/modex16.h"\r
25 #include "src/lib/16_in.h"\r
26 \r
27 global_game_variables_t gvar;\r
28 player_t player[MaxPlayers];\r
29 \r
30 void main(int argc, char *argv[])\r
31 {\r
32         int i, j, k;\r
33         word start, end;\r
34         byte *pal, *pal2;\r
35         sword bakapee;\r
36 \r
37         //argument\r
38         if(argv[1]) bakapee = atoi(argv[1]);\r
39         else bakapee = 1;\r
40 \r
41         /* load our palette */\r
42         modexLoadPalFile("data/default.pal", &pal2);\r
43 \r
44         /* save the palette */\r
45         pal  = modexNewPal();\r
46         modexPalSave(pal);\r
47         modexFadeOff(1, pal);\r
48         modexPalBlack();\r
49 \r
50         VGAmodeX(bakapee, &gvar);\r
51         modexPalBlack();\r
52 \r
53         IN_Startup();\r
54         IN_Default(0,&player,ctrl_Joystick);\r
55 \r
56         /* set up the page, but with 16 pixels on all borders in offscreen mem */\r
57         gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);\r
58         gvar.video.page[1] = modexNextPage(&gvar.video.page[0]);\r
59         gvar.video.page[0].width += 32;\r
60         gvar.video.page[0].height += 32;\r
61 \r
62 \r
63         /* fill the page with one color, but with a black border */\r
64         modexShowPage(&gvar.video.page[1]);\r
65         modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 128);\r
66         modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 42);\r
67         modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 128);\r
68         modexShowPage(&gvar.video.page[0]);\r
69 \r
70         /* fade in */\r
71         modexFadeOn(1, pal2);\r
72 \r
73         i=0,k=0,j=0;\r
74         start = *clockw;\r
75         while(!IN_KeyDown(sc_Escape) || i<5)\r
76         {\r
77                 IN_ReadControl(0,&player);\r
78         /* go right */\r
79         for(j=0; j<32; j++) {\r
80                 gvar.video.page[0].dx++;\r
81                 modexShowPage(&gvar.video.page[0]);\r
82         }\r
83         /* go left */\r
84         for(j=0; j<32; j++) {\r
85                 gvar.video.page[0].dx--;\r
86                 modexShowPage(&gvar.video.page[0]);\r
87         }\r
88         /* go up */\r
89         for(j=0; j<32; j++) {\r
90                 gvar.video.page[0].dy++;\r
91                 modexShowPage(&gvar.video.page[0]);\r
92         }\r
93 \r
94         /* go down */\r
95         for(j=0; j<32; j++) {\r
96                 gvar.video.page[0].dy--;\r
97                 modexShowPage(&gvar.video.page[0]);\r
98         }\r
99 //      switch (j)\r
100 //      {\r
101 //              case 31:\r
102 //              case 32:\r
103 //                      j=0;\r
104 //              break;\r
105 //      }\r
106         i++;\r
107         }\r
108 \r
109         end = *clockw;\r
110 \r
111         /* fade back to text mode */\r
112         modexFadeOff(1, pal2);\r
113         modexPalBlack();\r
114         VGAmodeX(0, &gvar);\r
115         modexPalBlack();\r
116         modexFadeOn(1, pal);\r
117 }\r