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
27 #include "src/lib/bitmap.h"
\r
28 #include "src/lib/planar.h"
\r
30 global_game_variables_t gvar;
\r
34 DrawPBuf(page_t *page, int x, int y, planar_buf_t *p, byte sprite)
\r
40 // TODO Make this fast. It's SLOOOOOOW
\r
41 for(plane=0; plane < 4; plane++) {
\r
42 modexSelectPlane(PLANE(plane+x));
\r
43 for(px = plane; px < p->width; px+=4) {
\r
45 for(py=0; py<p->height/2; py++) {
\r
46 SELECT_ALL_PLANES();
\r
47 if(!sprite || p->plane[offset])
\r
48 page->data = p->plane;
\r
65 //0000 bmp = bitmapLoadPcx("data/koishi~~.pcx");
\r
66 // bmp = bitmapLoadPcx("data/chikyuu.pcx");
\r
67 bmp = bitmapLoadPcx("data/koishi^^.pcx");
\r
68 // bmp = bitmapLoadPcx("16/PCX_LIB/chikyuu.pcx");
\r
69 p = planar_buf_from_bitmap(&bmp);
\r
71 gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);
\r
72 gvar.video.page[0].sw+=32;
\r
73 gvar.video.page[0].sh+=32;
\r
75 /* fix up the palette and everything */
\r
76 modexPalUpdate1(bmp.palette);
\r
78 /* clear and draw one sprite and one bitmap */
\r
79 modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 1);
\r
81 /* update display~*/
\r
82 gvar.video.page[0].dx+=16;
\r
83 gvar.video.page[0].dy+=16;
\r
84 modexShowPage(&gvar.video.page[0]);
\r
86 /* non sprite comparison */
\r
88 //for(i=0; i<100 ;i++) {
\r
89 oldDrawBmp(VGA, 20, 20, &bmp, 0);
\r
93 //for(i=0; i<100 ;i++) {
\r
94 //0000 modexDrawBmp(&gvar.video.page[0], 20, 20, &bmp);
\r
95 modexDrawBmp(&gvar.video.page[0], 160, 120, &bmp);
\r
97 t1 = (*clockw-start) /18.2;
\r
100 //for(i=0; i<100; i++) {
\r
101 //0000 modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 20, 20, 128, 20, 64, 64);
\r
102 modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240);
\r
104 t2 = (*clockw-start)/18.2;
\r
108 //for(i=0; i<100 ;i++) {
\r
109 oldDrawBmp(VGA, 20, 20, &bmp, 1);
\r
114 //for(i=0; i<100 ;i++) {
\r
115 //0000 modexDrawSprite(&gvar.video.page[0], 20, 20, &bmp);
\r
116 modexDrawSprite(&gvar.video.page[0], 160, 120, &bmp);
\r
118 //_fmemset(MK_FP(0xA000, 0), (int)p->plane, gvar.video.page[0].sw*(gvar.video.page[0].sh*2));
\r
119 //modexDrawBmp(&gvar.video.page[0], 0, 0, &bmp);
\r
122 //DrawPBuf(&gvar.video.page[0], 0, 0, p, 0);
\r
124 VGAmodeX(0, &gvar);
\r
125 /*printf("\nmain=%Fp\n\n", &i);
\r
126 printf("bmp.data=%Fp\n", bmp.data);
\r
127 printf("*bmp.data=%Fp\n", *(bmp.data));
\r
128 printf("&bmp.data=%Fp\n", &(bmp.data));
\r
130 printf("\n%d\n", sizeof(p->plane));
\r
131 printf("%d\n", sizeof(bmp));*/
\r
133 /*for(i=0; i<(320*240); i++)
\r
135 fprintf(stdout, "%d", bmp.data[i]);
\r
136 if(i%bmp.width==0) fprintf(stdout, "\n");
\r
138 printf("CPU to VGA: %f\n", t1);
\r
139 printf("VGA to VGA: %f\n", t2);
\r
140 printf("gvar.video.page[0].width: %u\n", gvar.video.page[0].width);
\r
141 printf("gvar.video.page[0].height: %u\n", gvar.video.page[0].height);
\r