1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
\r
4 * This file is part of Project 16.
\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
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
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
26 #include "src/lib/16_vl.h"
\r
27 #include "src/lib/modex16/16planar.h"
\r
29 global_game_variables_t gvar;
\r
30 planar_buf_t p, ptmp;
\r
34 float t1, t2, t3, t4, tpee;
\r
41 void main(int argc, char *argv[])
\r
48 //printf("%u ", w++);
\r
49 bakapeee = malloc(64);
\r
51 if(argv[1]) bakapeee = argv[1];
\r
52 else bakapeee = "data/koishi~.pcx";
\r
54 // if(argv[2]) baka = atoi(argv[2]);
\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
66 VGAmodeX(baka, 1, &gvar);
\r
67 gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);
\r
69 //fix up the palette and everything
\r
70 modexPalUpdate1(p.palette);
\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
76 gvar.video.page[0].dx+=32;
\r
77 gvar.video.page[0].dy+=32;
\r
78 modexShowPage(&gvar.video.page[0]);
\r
80 //non sprite comparison
\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
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
90 t2 = (*clockw-start) /18.2;
\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
96 for(i=0; i<100 ;i++) {
\r
97 modexDrawPBuf (&gvar.video.page[0], 0, 0, &p, 0);
\r
99 t3 = (*clockw-start) /18.2;
\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
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
112 VGAmodeX(0, 1, &gvar);
\r
114 //print out the contents of each plane
\r
115 for(plane=0; plane < 4; plane++) {
\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
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
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