wwww
Révision | bfd75c3c48e3c4bc6e2f151e1ff69cfe74d3d651 (tree) |
---|---|
l'heure | 2016-06-24 02:59:00 |
Auteur | ![]() |
Commiter | sparky4 |
tesuto0 made for understanding doslib fast rendering~
@@ -30,8 +30,6 @@ int main(int argc,char **argv) { | ||
30 | 30 | if(argv[1]) bakapee1 = argv[1]; |
31 | 31 | if(argv[2]) bakapee2 = argv[2]; |
32 | 32 | } |
33 | - printf("1=%s 2=%s\n", bakapee1, bakapee2); | |
34 | - while (getch() != 13); | |
35 | 33 | |
36 | 34 | fd = open(bakapee1,O_RDONLY|O_BINARY); |
37 | 35 | if (fd < 0) { |
@@ -113,79 +111,8 @@ int main(int argc,char **argv) { | ||
113 | 111 | vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15! |
114 | 112 | } |
115 | 113 | } |
116 | - //while (getch() != 13); | |
117 | 114 | |
118 | - /* make distinctive pattern offscreen, render sprite, copy onscreen */ | |
119 | - { | |
120 | - const unsigned int offscreen_ofs = (vga_state.vga_stride * vga_state.vga_height); | |
121 | - unsigned int i,j,o,o2,x,y,rx,ry,w,h; | |
122 | - unsigned int overdraw = 1; // how many pixels to "overdraw" so that moving sprites with edge pixels don't leave streaks. | |
123 | - // if the sprite's edge pixels are clear anyway, you can set this to 0. | |
124 | - VGA_RAM_PTR omemptr; | |
125 | - int xdir=1,ydir=1; | |
126 | - | |
127 | - /* starting coords. note: this technique is limited to x coordinates of multiple of 4 */ | |
128 | - x = 0; | |
129 | - y = 0; | |
130 | - | |
131 | - /* do it */ | |
132 | - omemptr = vga_state.vga_graphics_ram; // save original mem ptr | |
133 | - //while (1) { | |
134 | - /* stop animating if the user hits ENTER */ | |
135 | - // if (kbhit()) { | |
136 | - // if (getch() == 13) break; | |
137 | - // } | |
138 | - | |
139 | - /* render box bounds. y does not need modification, but x and width must be multiple of 4 */ | |
140 | - if (x >= overdraw) rx = (x - overdraw) & (~3); | |
141 | - else rx = 0; | |
142 | - if (y >= overdraw) ry = (y - overdraw); | |
143 | - else ry = 0; | |
144 | - h = vrl_header->height + overdraw + y - ry; | |
145 | - w = (x + vrl_header->width + (overdraw*2) + 3/*round up*/ - rx) & (~3); | |
146 | - if ((rx+w) > vga_state.vga_width) w = vga_state.vga_width-rx; | |
147 | - if ((ry+h) > vga_state.vga_height) h = vga_state.vga_height-ry; | |
148 | - | |
149 | - /* replace VGA stride with our own and mem ptr. then sprite rendering at this stage is just (0,0) */ | |
150 | - vga_state.vga_draw_stride_limit = (vga_state.vga_width + 3/*round up*/ - x) >> 2; | |
151 | - vga_state.vga_draw_stride = w >> 2; | |
152 | - vga_state.vga_graphics_ram = omemptr + offscreen_ofs; | |
153 | - | |
154 | - /* first draw pattern corresponding to that part of the screen. this COULD be optimized, obviously, but it's designed for study. | |
155 | - * also note we don't have to use the same stride as the display! */ | |
156 | - for (i=rx;i < (rx+w);i++) { | |
157 | - o = (i-rx) >> 2; | |
158 | - vga_write_sequencer(0x02/*map mask*/,1 << (i&3)); | |
159 | - for (j=ry;j < (ry+h);j++,o += vga_state.vga_draw_stride) | |
160 | - vga_state.vga_graphics_ram[o] = (i^j)&15; // VRL samples put all colors in first 15! | |
161 | - } | |
162 | - | |
163 | - /* then the sprite. note modding ram ptr means we just draw to (x&3,0) */ | |
164 | - draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); | |
165 | - | |
166 | - /* restore ptr */ | |
167 | - vga_state.vga_graphics_ram = omemptr; | |
168 | - | |
169 | - /* block copy to visible RAM from offscreen */ | |
170 | - vga_setup_wm1_block_copy(); | |
171 | - o = offscreen_ofs; // source offscreen | |
172 | - o2 = (ry * vga_state.vga_stride) + (rx >> 2); // dest visible (original stride) | |
173 | - for (i=0;i < h;i++,o += vga_state.vga_draw_stride,o2 += vga_state.vga_stride) vga_wm1_mem_block_copy(o2,o,w >> 2); | |
174 | - /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */ | |
175 | - vga_restore_rm0wm0(); | |
176 | - | |
177 | - /* restore stride */ | |
178 | - vga_state.vga_draw_stride_limit = vga_state.vga_draw_stride = vga_state.vga_stride; | |
179 | - | |
180 | - /* step */ | |
181 | - x += xdir; | |
182 | - y += ydir; | |
183 | - if (x >= (vga_state.vga_width - 1) || x == 0) | |
184 | - xdir = -xdir; | |
185 | - if (y >= (vga_state.vga_height - 1) || y == 0) | |
186 | - ydir = -ydir; | |
187 | - //} | |
188 | - } | |
115 | + //draw_vrl1_vgax_modex(0/*x-rx*/,0/*y-ry*/,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); | |
189 | 116 | |
190 | 117 | /* make distinctive pattern offscreen, render sprite, copy onscreen. |
191 | 118 | * this time, we render the distinctive pattern to another offscreen location and just copy. |