1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669
\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/modex16.h"
\r
28 global_game_variables_t gvar;
\r
29 planar_buf_t p, ptmp;
\r
33 float t1, t2, t3, t4, tpee;
\r
40 void main(int argc, char *argv[])
\r
45 static word chx, chy, colpee;
\r
49 //printf("%u ", w++);
\r
50 bakapeee = malloc(64);
\r
52 if(argv[1]) bakapeee = argv[1];
\r
53 else bakapeee = "data/koishi~.pcx";
\r
55 // if(argv[2]) baka = atoi(argv[2]);
\r
58 //fprintf(stderr, "%u ", w++);
\r
59 p = planarLoadPcx(bakapeee);
\r
60 //fprintf(stderr, "%u ", w++);
\r
61 // ptmp = planarLoadPcx("data/ptmp.pcx");
\r
62 //fprintf(stderr, "%u ", w++);
\r
63 //fprintf(stderr, "^^;", w++);
\r
67 VGAmodeX(baka, &gvar);
\r
68 gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);
\r
70 //fix up the palette and everything
\r
71 modexPalUpdate1(p.palette);
\r
73 //clear and draw one sprite and one bitmap
\r
74 modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 0);
\r
77 gvar.video.page[0].dx+=32;
\r
78 gvar.video.page[0].dy+=32;
\r
79 modexShowPage(&gvar.video.page[0]);
\r
81 //non sprite comparison
\r
83 // oldDrawBmp(VGA, 20, 20, &bmp, 0);
\r
84 for(i=0; i<100 ;i++) {
\r
85 //modexDrawBmpPBuf (&gvar.video.page[0], 32, 32, &p);
\r
87 t1 = (*clockw-start) /18.2;
\r
88 for(i=0; i<100 ;i++) {
\r
89 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
91 t2 = (*clockw-start) /18.2;
\r
94 // modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240);
\r
95 // t2 = (*clockw-start)/18.2;
\r
97 for(i=0; i<100 ;i++) {
\r
98 modexDrawPBuf (&gvar.video.page[0], 0, 0, &p, 0);
\r
100 t3 = (*clockw-start) /18.2;
\r
102 for(i=0; i<100 ;i++) {
\r
103 //(page_t *page, int x, int y, int rx, int ry, int rw, int rh, planar_buf_t *p, boolean sprite);
\r
104 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
106 t4 = (*clockw-start) /18.2;
\r
107 //++++ modexPalUpdate1(ptmp.palette);
\r
108 //modexDrawBmpPBufRegion(&gvar.video.page[0], 64, 64, 48, 32, 24, 32, ptmp);
\r
109 //modexDrawPBuf(&gvar.video.page[0], 64, 64, &ptmp, 0);
\r
113 VGAmodeX(0, &gvar);
\r
115 //print out the contents of each plane
\r
116 for(plane=0; plane < 4; plane++) {
\r
118 printf("Plane %d\n", plane);
\r
119 for(py=0; py < p.height; py++) {
\r
120 for(px=0; px < p.pwidth; px++) {
\r
121 printf("%02X ", (int) p.plane[plane][i++]);
\r
130 for(e=0x00; e<=0xFE; e++)
\r
132 if(chx+8>(gvar.video.page[0].width/2))
\r
136 sprintf(pee,"%u", colpee);
\r
137 modexprint(&gvar.video.page[0], 200, 200, 1, 47, 0, &pee, 0);
\r
140 modexprint(&gvar.video.page[0], chx, chy, 1, 0, colpee, &e, 0);
\r
143 if(colpee>=32+24) colpee=32;
\r
146 fprintf(stderr,"Project 16 planrpcx.exe. This is just a test file!\n");
\r
147 fprintf(stderr,"version %s\n", VERSION);
\r
148 fprintf(stderr,"%d\n", sizeof(p.plane));
\r
149 fprintf(stderr,"pw=%d\n", p.width);
\r
150 fprintf(stderr,"ph=%d\n", p.height);
\r
151 fprintf(stderr,"ppw=%d\n", p.pwidth);
\r
152 fprintf(stderr,"%d\n", sizeof(p));
\r
153 fprintf(stderr,"%dx%d\n", gvar.video.page[0].sw-(p.width), gvar.video.page[0].sh-(p.height));
\r
155 fprintf(stderr, "modexDrawBmpPBufRegion: %f\n", t2);
\r
156 fprintf(stderr, "modexDrawPBufRegion: %f\n", t4);
\r
157 fprintf(stderr, "speed difference %f\n", t2/t4);
\r
158 //fprintf(stderr, "gvar.video.page[0].width: %u\n", gvar.video.page[0].width);
\r
159 //fprintf(stderr, "gvar.video.page[0].height: %u\n", gvar.video.page[0].height);
\r