]> 4ch.mooo.com Git - 16.git/blob - src/test.c
ww
[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 \r
26 global_game_variables_t gvar;\r
27 \r
28 void main(int argc, char *argv[])\r
29 {\r
30         int i, j;\r
31         word start, end;\r
32         byte *pal, *pal2;\r
33         sword bakapee;\r
34 \r
35         //argument\r
36         if(argv[1]) bakapee = atoi(argv[1]);\r
37         else bakapee = 1;\r
38 \r
39         /* load our palette */\r
40         modexLoadPalFile("data/default.pal", &pal2);\r
41 \r
42         /* save the palette */\r
43         pal  = modexNewPal();\r
44         modexPalSave(pal);\r
45         modexFadeOff(1, pal);\r
46         modexPalBlack();\r
47 \r
48         VGAmodeX(bakapee, &gvar);\r
49         modexPalBlack();\r
50 \r
51         /* set up the page, but with 16 pixels on all borders in offscreen mem */\r
52         gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);\r
53         gvar.video.page[1] = modexNextPage(&gvar.video.page[0]);\r
54         gvar.video.page[0].width += 32;\r
55         gvar.video.page[0].height += 32;\r
56 \r
57 \r
58         /* fill the page with one color, but with a black border */\r
59         modexShowPage(&gvar.video.page[1]);\r
60         modexClearRegion(&gvar.video.page[0], 16, 16, gvar.video.page[0].sw, gvar.video.page[0].sh, 128);\r
61         modexClearRegion(&gvar.video.page[0], 32, 32, gvar.video.page[0].sw-32, gvar.video.page[0].sh-32, 42);\r
62         modexClearRegion(&gvar.video.page[0], 48, 48, gvar.video.page[0].sw-64, gvar.video.page[0].sh-64, 128);\r
63         modexShowPage(&gvar.video.page[0]);\r
64 \r
65         /* fade in */\r
66         modexFadeOn(1, pal2);\r
67 \r
68         start = *clockw;\r
69         for(i=0; i<5; i++) {\r
70         /* go right */\r
71         for(j=0; j<32; j++) {\r
72                 gvar.video.page[0].dx++;\r
73                 modexShowPage(&gvar.video.page[0]);\r
74         }\r
75         /* go left */\r
76         for(j=0; j<32; j++) {\r
77                 gvar.video.page[0].dx--;\r
78                 modexShowPage(&gvar.video.page[0]);\r
79         }\r
80         /* go up */\r
81         for(j=0; j<32; j++) {\r
82                 gvar.video.page[0].dy++;\r
83                 modexShowPage(&gvar.video.page[0]);\r
84         }\r
85 \r
86         /* go down */\r
87         for(j=0; j<32; j++) {\r
88                 gvar.video.page[0].dy--;\r
89                 modexShowPage(&gvar.video.page[0]);\r
90         }\r
91         }\r
92 \r
93         end = *clockw;\r
94 \r
95         /* fade back to text mode */\r
96         modexFadeOff(1, pal2);\r
97         modexPalBlack();\r
98         VGAmodeX(0, &gvar);\r
99         modexPalBlack();\r
100         modexFadeOn(1, pal);\r
101 }\r