]> 4ch.mooo.com Git - 16.git/blob - 16/src/planrpcx.c
it is semi working the bg preservation wwww
[16.git] / 16 / src / planrpcx.c
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\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 <dos.h>\r
25 #include <string.h>\r
26 #include "src/lib/16_vl.h"\r
27 #include "src/lib/modex16/16planar.h"\r
28 \r
29 global_game_variables_t gvar;\r
30 planar_buf_t p, ptmp;\r
31 int i;\r
32 word start;//,  w;\r
33 int plane;\r
34 float t1, t2, t3, t4, tpee;\r
35 int x,y;\r
36 word px,py;\r
37 sword baka;\r
38 char *bakapeee;\r
39 \r
40 \r
41 void main(int argc, char *argv[])\r
42 {\r
43 \r
44         byte l[1024];\r
45         byte pee[2];\r
46 \r
47 //w=0;\r
48 //printf("%u ", w++);\r
49         bakapeee = malloc(64);\r
50 \r
51         if(argv[1]) bakapeee = argv[1];\r
52         else bakapeee = "data/koishi~.pcx";\r
53 \r
54 //      if(argv[2]) baka = atoi(argv[2]);\r
55 //      else\r
56 baka = 1;\r
57 //fprintf(stderr, "%u ", w++);\r
58         p = planarLoadPcx(bakapeee);\r
59 //fprintf(stderr, "%u ", w++);\r
60 //      ptmp = planarLoadPcx("data/ptmp.pcx");\r
61 //fprintf(stderr, "%u ", w++);\r
62 //fprintf(stderr, "^^;", w++);\r
63 //getch();\r
64 \r
65         textInit();\r
66         VGAmodeX(baka, 1, &gvar);\r
67         gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);\r
68 \r
69         //fix up the palette and everything\r
70         modexPalUpdate1(p.palette);\r
71 \r
72         //clear and draw one sprite and one bitmap\r
73         modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 0);\r
74 \r
75         //update display~\r
76         gvar.video.page[0].dx+=32;\r
77         gvar.video.page[0].dy+=32;\r
78         modexShowPage(&gvar.video.page[0]);\r
79 \r
80         //non sprite comparison\r
81         start = *clockw;\r
82 //              oldDrawBmp(VGA, 20, 20, &bmp, 0);\r
83         for(i=0; i<100 ;i++) {\r
84                 //modexDrawBmpPBuf              (&gvar.video.page[0], 32, 32, &p);\r
85         }\r
86         t1 = (*clockw-start) /18.2;\r
87         for(i=0; i<100 ;i++) {\r
88                 modexDrawBmpPBufRegion  (&gvar.video.page[0], p.width+32, 32, p.width-(p.width/4), p.height-(p.height/4), p.width/4, p.height/4, &p);\r
89         }\r
90         t2 = (*clockw-start) /18.2;\r
91         getch();\r
92 //      start = *clockw;\r
93 //              modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240);\r
94 //      t2 = (*clockw-start)/18.2;\r
95         start = *clockw;\r
96         for(i=0; i<100 ;i++) {\r
97                 modexDrawPBuf           (&gvar.video.page[0], 0, 0, &p, 0);\r
98         }\r
99         t3 = (*clockw-start) /18.2;\r
100 getch();\r
101         for(i=0; i<100 ;i++) {\r
102                                                 //(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *p, boolean sprite);\r
103                 modexDrawPBufRegion     (&gvar.video.page[0], p.width, 0, p.width-(p.width/4), p.height-(p.height/4), p.width/4, p.height/4, &p, 0);//(&gvar.video.page[0], 0, 0, 0+p.width, 0, p.width, p.height, &p, 0);\r
104         }\r
105         t4 = (*clockw-start) /18.2;\r
106         //++++  modexPalUpdate1(ptmp.palette);\r
107         //modexDrawBmpPBufRegion(&gvar.video.page[0], 64, 64, 48, 32, 24, 32, ptmp);\r
108         //modexDrawPBuf(&gvar.video.page[0], 64, 64, &ptmp, 0);\r
109         while(!kbhit())\r
110         {\r
111         }\r
112         VGAmodeX(0, 1, &gvar);\r
113 \r
114         //print out the contents of each plane\r
115         for(plane=0; plane < 4; plane++) {\r
116                 i=0;\r
117                 printf("Plane %d\n", plane);\r
118                 for(py=0; py < p.height; py++) {\r
119                         for(px=0; px < p.pwidth; px++) {\r
120                                 printf("%02X ", (int) p.plane[plane][i++]);\r
121                         }\r
122                         printf("\n");\r
123                 }\r
124         }\r
125 \r
126         fprintf(stderr,"Project 16 planrpcx.exe. This is just a test file!\n");\r
127         fprintf(stderr,"version %s\n", VERSION);\r
128         fprintf(stderr,"%d\n", sizeof(p.plane));\r
129         fprintf(stderr,"pw=%d\n", p.width);\r
130         fprintf(stderr,"ph=%d\n", p.height);\r
131         fprintf(stderr,"ppw=%d\n", p.pwidth);\r
132         fprintf(stderr,"%d\n", sizeof(p));\r
133         fprintf(stderr,"%dx%d\n", gvar.video.page[0].sw-(p.width), gvar.video.page[0].sh-(p.height));\r
134         free(bakapeee);\r
135         fprintf(stderr, "modexDrawBmpPBufRegion:        %f\n", t2);\r
136         fprintf(stderr, "modexDrawPBufRegion:   %f\n", t4);\r
137         fprintf(stderr, "speed difference       %f\n", t2/t4);\r
138         //fprintf(stderr, "gvar.video.page[0].width: %u\n", gvar.video.page[0].width);\r
139         //fprintf(stderr, "gvar.video.page[0].height: %u\n", gvar.video.page[0].height);\r
140 }\r