wwww
Revisão | e35dbd4c98f6b142b171d57297ca998957482fcf (tree) |
---|---|
Hora | 2016-08-22 02:52:56 |
Autor | sparky4 <sparky4@cock...> |
Commiter | sparky4 |
boink ok done~
@@ -91,9 +91,8 @@ FLAGS=$(CFLAGS) $(OFLAGS) $(DFLAGS) $(ZFLAGS) | ||
91 | 91 | # |
92 | 92 | VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ) |
93 | 93 | DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ) |
94 | -16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) 16_ca.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_timer.$(OBJ) | |
95 | -GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) $(DOSLIBLIBS) | |
96 | -#16_vrs.$(OBJ) | |
94 | +16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) 16_ca.$(OBJ) 16_dbg.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_timer.$(OBJ) | |
95 | +GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) $(DOSLIBLIBS) 16_vrs.$(OBJ) 16_sprite.$(OBJ) | |
97 | 96 | #planar.$(OBJ) 16planar.$(OBJ) |
98 | 97 | DOSLIBLIBS=$(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)cpu$(DIRSEP)dos86h$(DIRSEP)cpu.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)dos$(DIRSEP)dos86h$(DIRSEP)dos.lib $(DOSLIBDIR)$(DIRSEP)hw$(DIRSEP)vga$(DIRSEP)dos86h$(DIRSEP)vga.lib |
99 | 98 |
@@ -337,8 +336,11 @@ bakapee.$(OBJ): $(SRCLIB)bakapee.h $(SRCLIB)bakapee.c | ||
337 | 336 | ##16planar.$(OBJ): $(MODEXLIB)16planar.h $(MODEXLIB)16planar.c |
338 | 337 | ## wcl $(FLAGS) -c $(MODEXLIB)16planar.c |
339 | 338 | |
340 | -16_vrs.$(OBJ): $(SRCLIB)16_vrs.h $(SRCLIB)16_vrs.c | |
341 | - wcl $(FLAGS) -c $(SRCLIB)16_vrs.c | |
339 | +16_vrs.$(OBJ): $(SRCLIB)16_vrs.h $(SRCLIB)16_vrs.c $(DOSLIBLIBS) | |
340 | + wcl $(FLAGS) -c $(SRCLIB)16_vrs.c $(DOSLIBLIBS) | |
341 | +16_sprite.$(OBJ): $(SRCLIB)16_sprite.h $(SRCLIB)16_sprite.c | |
342 | + wcl $(FLAGS) -c $(SRCLIB)16_sprite.c | |
343 | + | |
342 | 344 | |
343 | 345 | bitmap.$(OBJ): $(SRCLIB)bitmap.h $(SRCLIB)bitmap.c |
344 | 346 | wcl $(FLAGS) -c $(SRCLIB)bitmap.c |
@@ -0,0 +1,401 @@ | ||
1 | +/* Project 16 Source Code~ | |
2 | + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover | |
3 | + * | |
4 | + * This file is part of Project 16. | |
5 | + * | |
6 | + * Project 16 is free software; you can redistribute it and/or modify | |
7 | + * it under the terms of the GNU General Public License as published by | |
8 | + * the Free Software Foundation; either version 3 of the License, or | |
9 | + * (at your option) any later version. | |
10 | + * | |
11 | + * Project 16 is distributed in the hope that it will be useful, | |
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | + * GNU General Public License for more details. | |
15 | + * | |
16 | + * You should have received a copy of the GNU General Public License | |
17 | + * along with this program. If not, see <http://www.gnu.org/licenses/>, or | |
18 | + * write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | + * Fifth Floor, Boston, MA 02110-1301 USA. | |
20 | + * | |
21 | + */ | |
22 | + | |
23 | +#include "src/lib/scroll16.h" | |
24 | +#include "src/lib/16_timer.h" | |
25 | +#include "src/lib/wcpu/wcpu.h" | |
26 | +#include "src/lib/16_sprite.h" | |
27 | +#include "src/lib/16_head.h" | |
28 | + | |
29 | +//#define FADE | |
30 | +#define MODEX //this is for mode x initiating | |
31 | + | |
32 | +//word far *clock= (word far*) 0x046C; /* 18.2hz clock */ | |
33 | +//bitmap_t *p; | |
34 | +global_game_variables_t gvar; | |
35 | +static map_t map; | |
36 | +player_t player[MaxPlayers]; | |
37 | +map_view_t mv[4]; | |
38 | +static unsigned char palette[768]; | |
39 | +int fd; | |
40 | +//word pn=0; //i forgot ww | |
41 | +//static planar_buf_t huge *pp; | |
42 | +float t; | |
43 | +sword bakapee; | |
44 | +pan_t pan; | |
45 | +//debugswitches | |
46 | +boolean panswitch=0; | |
47 | +//extern boolean pageflipflop=1; | |
48 | + unsigned int i; | |
49 | + const char *cpus; | |
50 | + //static int persist_aniframe = 0; /* gonna be increased to 1 before being used, so 0 is ok for default */ | |
51 | + | |
52 | + //map_view_db_t pgid[4]; | |
53 | + word pg; | |
54 | +//#ifdef FADE | |
55 | + static word paloffset=0; | |
56 | + byte *dpal, *default_pal; | |
57 | +//#endif | |
58 | + byte *gpal; | |
59 | + byte *ptr; | |
60 | + byte *mappalptr; | |
61 | + | |
62 | +void main(int argc, char *argv[]) | |
63 | +{ | |
64 | + mminfo_t mm; mminfotype mmi; | |
65 | + struct sprite sp; | |
66 | + | |
67 | + byte *mesg=malloc(sizeof(dword)); | |
68 | + int i; | |
69 | + | |
70 | + if(argv[1]) bakapee = atoi(argv[1]); | |
71 | + else bakapee = 1; | |
72 | + | |
73 | +/* mm.mmstarted = 0; | |
74 | + | |
75 | + MM_Startup(&mm, &mmi); | |
76 | + CA_Startup(&gvar);*/ | |
77 | + // DOSLIB: check our environment | |
78 | + probe_dos(); | |
79 | + | |
80 | + // DOSLIB: what CPU are we using? | |
81 | + // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS. | |
82 | + // So this code by itself shouldn't care too much what CPU it's running on. Except that other | |
83 | + // parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for | |
84 | + // the CPU to carry out tasks. --J.C. | |
85 | + cpu_probe(); | |
86 | + | |
87 | + // DOSLIB: check for VGA | |
88 | + if (!probe_vga()) { | |
89 | + printf("VGA probe failed\n"); | |
90 | + return; | |
91 | + } | |
92 | + // hardware must be VGA or higher! | |
93 | + if (!(vga_state.vga_flags & VGA_IS_VGA)) { | |
94 | + printf("This program requires VGA or higher graphics hardware\n"); | |
95 | + return; | |
96 | + } | |
97 | + | |
98 | + if (_DEBUG_INIT() == 0) { | |
99 | +#ifdef DEBUGSERIAL | |
100 | + printf("WARNING: Failed to initialize DEBUG output\n"); | |
101 | +#endif | |
102 | + } | |
103 | + _DEBUG("Serial debug output started\n"); // NTS: All serial output must end messages with newline, or DOSBox-X will not emit text to log | |
104 | + _DEBUGF("Serial debug output printf test %u %u %u\n",1U,2U,3U); | |
105 | + | |
106 | + pan.pn=1; | |
107 | + | |
108 | + start_timer(&gvar); | |
109 | + | |
110 | + /* create the map */ | |
111 | + fprintf(stderr, "testing map load~ "); | |
112 | + loadmap("data/test.map", &map); | |
113 | + chkmap(&map, 0); | |
114 | + printf("chkmap ok "); | |
115 | + fprintf(stderr, "yay map loaded~~\n"); | |
116 | + | |
117 | + /* draw the tiles */ | |
118 | +#ifdef MODEX | |
119 | + ptr = map.data; | |
120 | + | |
121 | + /* data */ | |
122 | + i = read_vrs(&gvar, "data/spri/chikyuu.vrs", sp.spritesheet); | |
123 | + if (i) | |
124 | + { | |
125 | + puts("Error! Did not load sprite!"); | |
126 | + return; | |
127 | + } | |
128 | + puts("Sprite should be loaded now"); | |
129 | + putch('q'); | |
130 | + print_anim_ids(&sp); | |
131 | + putch('r'); | |
132 | + i = set_anim_by_id(&sp, 10); | |
133 | + if (i == -1) | |
134 | + { | |
135 | + printf("Anim id not found!"); | |
136 | + return; | |
137 | + } | |
138 | +/* player[0].spri = malloc(...) | |
139 | + * read_vrs(&gvar, "data/spri/chikyuu.vrs", player[0].spri->spritesheet); // load sprite | |
140 | + putch('s'); | |
141 | + print_anim_ids(player[0].spri); | |
142 | + putch('t'); | |
143 | + i = set_anim_by_id(player[0].spri, 10); | |
144 | + if (i == -1) | |
145 | + { | |
146 | + printf("Anim id not found!"); | |
147 | + return; | |
148 | + }*/ | |
149 | + player[0].spri = &sp; | |
150 | + | |
151 | + fd = open("data/spri/chikyuu.pal",O_RDONLY|O_BINARY); | |
152 | + if (fd >= 0) { | |
153 | + unsigned int i; | |
154 | + | |
155 | + read(fd,palette,768); | |
156 | + close(fd); | |
157 | + | |
158 | + vga_palette_lseek(0); | |
159 | + for (i=0;i < 256;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2); | |
160 | + } | |
161 | + | |
162 | +#endif | |
163 | + /* input! */ | |
164 | + IN_Startup(); | |
165 | + IN_Default(0,&player,ctrl_Joystick); | |
166 | + | |
167 | + /* save the palette */ | |
168 | +#ifdef MODEX | |
169 | +#ifdef FADE | |
170 | + dpal = modexNewPal(); | |
171 | + default_pal = modexNewPal(); | |
172 | + *default_pal = *dpal; | |
173 | + modexPalSave(dpal); | |
174 | + modexFadeOff(4, dpal); | |
175 | +#endif | |
176 | + | |
177 | + textInit(); | |
178 | + VGAmodeX(bakapee, 1, &gvar); | |
179 | +#ifdef FADE | |
180 | + modexPalBlack(); //reset the palette~ | |
181 | +#endif | |
182 | +#endif | |
183 | + modexPalUpdate1(palette); | |
184 | +#ifdef MODEX | |
185 | +#ifdef FADE | |
186 | + gpal = modexNewPal(); | |
187 | + modexPalSave(gpal); | |
188 | + modexSavePalFile("data/g.pal", gpal); | |
189 | + modexPalBlack(); //so player will not see loadings~ | |
190 | +#endif | |
191 | +#endif | |
192 | + | |
193 | + /* setup camera and screen~ */ | |
194 | + modexHiganbanaPageSetup(&gvar.video); | |
195 | + for(i=0;i<gvar.video.num_of_pages;i++) | |
196 | + { | |
197 | + mv[i].page = &gvar.video.page[i]; | |
198 | + mv[i].map = ↦ | |
199 | + mv[i].video = &gvar.video; | |
200 | + mv[i].pan = &pan; | |
201 | + } | |
202 | + | |
203 | + /* set up paging */ | |
204 | + //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen | |
205 | + mapGoTo(mv, 0, 0); | |
206 | + //_fmemcpy(mv[1].page->data, mv[0].page->data, mv[0].page->pagesize); | |
207 | + | |
208 | + //TODO: put player in starting position of spot | |
209 | + //default player position on the viewable map | |
210 | + player[0].tx = mv[0].tx + mv[0].page->tilemidposscreenx; | |
211 | + player[0].ty = mv[0].ty + mv[0].page->tilemidposscreeny; | |
212 | + IN_initplayer(&player, 0); | |
213 | + //IN_initplayer(&player, 1); | |
214 | + | |
215 | +#ifndef SPRITE | |
216 | + modexClearRegion(mv[0].page, player[0].x, player[0].y-TILEWH, 16, 32, 15); | |
217 | + //modexClearRegion(mv[1].page, player[0].x, player[0].y-TILEWH, 16, 32, 15); | |
218 | +#else | |
219 | + //PBUFSFUN(mv[1].page, player[0].x, player[0].y-TILEWH, 16, 64, 24, 32, PLAYERBMPDATA); | |
220 | + //PBUFSFUN(mv[0].page, player[0].x, player[0].y-TILEWH, 16, 64, 16, 32, player[0].data); | |
221 | + animate_spri(player[0].spri); | |
222 | +#endif | |
223 | + | |
224 | + if(!pageflipflop) modexShowPage(mv[1].page); | |
225 | + else modexShowPage(mv[0].page);//!(gvar.video.p) | |
226 | + shinku_fps_indicator_page = 0; // we're on page 1 now, shinku(). follow along please or it will not be visible. | |
227 | + | |
228 | + /* buffer pages */ | |
229 | +// modexClearRegion(mv[2].page, 0, 0, mv[2].page->width, mv[2].page->height, 47); | |
230 | +// modexClearRegion(mv[3].page, 0, 0, mv[3].page->width, mv[3].page->height, 45); | |
231 | +// { | |
232 | +// unsigned int k,j,o; | |
233 | +// /* fill screen with a distinctive pattern */ | |
234 | +// for (k=0;k < vga_state.vga_width;k++) { | |
235 | +// o = k >> 2; | |
236 | +// vga_write_sequencer(0x02/*map mask*/,1 << (k&3)); | |
237 | +// for (j=0;j < vga_state.vga_height;j++,o += vga_state.vga_stride) | |
238 | +// vga_state.vga_graphics_ram[o] = (k^j)&15; // VRL samples put all colors in first 15! | |
239 | +// } | |
240 | +// } | |
241 | + modexClearRegion(mv[3].page, 0, 128, 24, 36, 15); | |
242 | + | |
243 | +#ifdef MODEX | |
244 | +#ifdef FADE | |
245 | + modexFadeOn(4, gpal); | |
246 | +#endif | |
247 | +#endif | |
248 | + while(!IN_KeyDown(sc_Escape) && player[0].hp>0) | |
249 | + { | |
250 | + shinku(&gvar); | |
251 | + //top left corner & bottem right corner of map veiw be set as map edge trigger since maps are actually square | |
252 | + //to stop scrolling and have the player position data move to the edge of the screen with respect to the direction | |
253 | + //when player[0].tx or player[0].ty == 0 or player[0].tx == 20 or player[0].ty == 15 then stop because that is edge of map and you do not want to walk of the map | |
254 | + | |
255 | + //player movement | |
256 | + IN_ReadControl(0,&player); | |
257 | + if(!panswitch){ | |
258 | + walk(mv, player, 0); | |
259 | + }else{ | |
260 | + panpagemanual(mv, player, 0); | |
261 | + //printf(" player[0].q: %d", player[0].q); printf(" player[0].d: %d\n", player[0].d); | |
262 | + } | |
263 | + | |
264 | + //the scripting stuff.... | |
265 | + //if(((player[0].triggerx == TRIGGX && player[0].triggery == TRIGGY) && IN_KeyDown(0x1C))||(player[0].tx == 5 && player[0].ty == 5)) | |
266 | + if(((mv[0].map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))] == 0) && IN_KeyDown(0x1C))||(player[0].tx == 5 && player[0].ty == 5)) | |
267 | + { | |
268 | + short i; | |
269 | + for(i=800; i>=400; i--) | |
270 | + { | |
271 | + sound(i); | |
272 | + } | |
273 | + nosound(); | |
274 | + } | |
275 | + if(player[0].q == (TILEWH/(player[0].speed))+1 && player[0].info.dir != 2 && (player[0].triggerx == 5 && player[0].triggery == 5)){ player[0].hp--; } | |
276 | + //debugging binds! | |
277 | + if(IN_KeyDown(2)){ modexShowPage(mv[0].page); pan.pn=0; } | |
278 | + if(IN_KeyDown(3)){ modexShowPage(mv[1].page); pan.pn=1; } | |
279 | + if(IN_KeyDown(4)){ modexShowPage(mv[2].page); pan.pn=2; } | |
280 | + if(IN_KeyDown(4+1)){ modexShowPage(mv[3].page); pan.pn=3; } | |
281 | + if(IN_KeyDown(25)){ modexpdump(mv[0].page); modexpdump(mv[1].page); | |
282 | + IN_UserInput(1,1); | |
283 | + } //p | |
284 | +#ifdef MODEX | |
285 | +#ifdef FADE | |
286 | + if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; modexpdump(mv[0].page); modexpdump(mv[1].page); IN_UserInput(1,1); } | |
287 | + if(IN_KeyDown(22)){ | |
288 | + paloffset=0; modexPalBlack(); modexPalUpdate(player[0].data, &paloffset, 0, 0); | |
289 | + printf("1paloffset = %d\n", paloffset/3); | |
290 | + modexPalUpdate(map.tiles->data, &paloffset, 0, 0); | |
291 | + printf("2paloffset = %d\n", paloffset/3); | |
292 | + modexpdump(mv[0].page); modexpdump(mv[1].page); | |
293 | + IN_UserInput(1,1); | |
294 | + } | |
295 | +#endif | |
296 | +#endif | |
297 | + //pan switch | |
298 | + if(IN_KeyDown(88)){panswitch=!panswitch; IN_UserInput(1,1);} //f12 | |
299 | + if(IN_KeyDown(87)) //f11 | |
300 | + { | |
301 | + pageflipflop=!pageflipflop; | |
302 | + IN_UserInput(1,1); | |
303 | +// VGAmodeX(0, 0, &gvar); | |
304 | +// IN_Shutdown(); | |
305 | +// __asm | |
306 | +// { | |
307 | +// mov ah,31h | |
308 | +// int 21h | |
309 | +// } | |
310 | + } | |
311 | + if(IN_KeyDown(68)) //f10 | |
312 | + { | |
313 | + gvar.kurokku.fpscap=!gvar.kurokku.fpscap; | |
314 | + IN_UserInput(1,1); | |
315 | + } | |
316 | + if(IN_KeyDown(67)) //f9 | |
317 | + { | |
318 | + modexClearRegion(mv[1].page, 0, 0, mv[1].page->width, mv[1].page->height, 2); | |
319 | + modexClearRegion(mv[2].page, 0, 0, mv[2].page->width, mv[2].page->height, 3); | |
320 | + modexClearRegion(mv[3].page, 0, 0, mv[3].page->width, mv[3].page->height, 4); | |
321 | + modexClearRegion(mv[3].page, 0, 0, 20, 36, 15); | |
322 | + //IN_UserInput(1,1); | |
323 | + } | |
324 | + if(IN_KeyDown(66)) //f8 | |
325 | + { | |
326 | +// modexDrawSprite(mv[0].page, 16, 16, p); | |
327 | +// modexDrawSprite(mv[0].page, 32+48, 16, (player[0].data)); | |
328 | + } | |
329 | + //TODO fmemtest into page | |
330 | + /*if(IN_KeyDown(4+1)) //4 | |
331 | + { | |
332 | + pg=1; | |
333 | + SELECT_ALL_PLANES(); | |
334 | + _fmemset(((mv[pg].page->data+4)+(16*(mv[pg].page->width/4))), 15, 4); | |
335 | + }*/ | |
336 | + | |
337 | + //9 | |
338 | + if(IN_KeyDown(10)){ modexPalOverscan(rand()%56); modexPalUpdate1(default_pal); IN_UserInput(1,1); } | |
339 | + //if(IN_KeyDown(11)){ modexPalOverscan(15); } | |
340 | + if((player[0].q==1) && !(player[0].x%TILEWH==0 && player[0].y%TILEWH==0)) break; //incase things go out of sync! | |
341 | + } | |
342 | + | |
343 | + /* fade back to text mode */ | |
344 | + /* but 1st lets save the game palette~ */ | |
345 | +#ifdef MODEX | |
346 | +#ifdef FADE | |
347 | + modexPalSave(gpal); | |
348 | + modexSavePalFile("data/g.pal", gpal); | |
349 | + modexFadeOff(4, gpal); | |
350 | +#endif | |
351 | + VGAmodeX(0, 1, &gvar); | |
352 | +#endif | |
353 | + IN_Shutdown(); | |
354 | + printf("\nProject 16 scroll.exe. This is just a test file!\n"); | |
355 | + printf("version %s\n", VERSION); | |
356 | + printf("tx: %d ", mv[0].tx); | |
357 | + printf("ty: %d\n", mv[0].ty); | |
358 | + printf("\n"); | |
359 | + printf("player vars:\n"); | |
360 | + printf(" x: %d", player[0].x); printf(" y: %d\n", player[0].y); | |
361 | + //if(player[0].hp==0) printf("%d wwww\n", player[0].y+8); | |
362 | + //else printf("\nplayer[0].y: %d\n", player[0].y); | |
363 | + printf(" tx: %d", player[0].tx); printf(" ty: %d\n", player[0].ty); | |
364 | + printf(" triggx: %d", player[0].triggerx); printf(" triggy: %d\n", player[0].triggery); | |
365 | + printf(" hp: %d", (player[0].hp)); printf(" q: %d", player[0].q); printf(" player.info.dir: %d", player[0].info.dir); printf(" player.d: %d ", player[0].d); | |
366 | + printf(" pdir=%d\n", player[0].pdir); | |
367 | + printf(" tile data value at player trigger position: %d\n\n", mv[0].map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))]); | |
368 | +// printf("palette offset: %d\n", paloffset/3); | |
369 | +//++++ printf("Total used: %zu\n", oldfreemem-GetFreeSize()); | |
370 | +//++++ printf("Total free: %zu\n", GetFreeSize()); | |
371 | +//not used now printf("temporary player sprite 0: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45556867\n"); | |
372 | +//not used now printf("temporary player sprite 1: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44606385\n"); | |
373 | + printf("Virtual Screen: %dx", gvar.video.page[0].width); printf("%d ", gvar.video.page[0].height); | |
374 | + printf("Screen: %dx", gvar.video.page[0].sw); printf("%d\n", gvar.video.page[0].sh); | |
375 | + printf("virtual tile resolution: %dx", gvar.video.page[0].tilesw); printf("%d ", gvar.video.page[0].tilesh); | |
376 | + printf("tile resolution: %dx", gvar.video.page[0].tw); printf("%d\n", gvar.video.page[0].th); | |
377 | + printf("middle tile position: %dx", gvar.video.page[0].tilemidposscreenx); printf("%d\n", gvar.video.page[0].tilemidposscreeny); | |
378 | + modexprintmeminfo(&gvar.video); | |
379 | + //printf("mv[%u].tx: %d", pan.pn, mv[pan.pn].tx); printf(" mv[%u].ty: %d ", pan.pn, mv[pan.pn].ty); | |
380 | + printf("gvar.video.p=%u ", gvar.video.p); printf("gvar.video.r=%u ", gvar.video.r); | |
381 | + printf("pageflipflop=%u\n", pageflipflop); | |
382 | + //0000printf("\ngvar.video.tickclk=%f\n", gvar.video.tickclk); | |
383 | + //0000printf("gvar.video.clk=%f", gvar.video.clk); | |
384 | + printf("\n"); | |
385 | + //printf("map.width=%d map.height=%d map.data[0]=%d\n", mv[0].map->width, mv[0].map->height, mv[0].map->data[0]); | |
386 | + | |
387 | + printf("\n"); | |
388 | + switch(detectcpu()) | |
389 | + { | |
390 | + case 0: cpus = "8086/8088 or 186/88"; break; | |
391 | + case 1: cpus = "286"; break; | |
392 | + case 2: cpus = "386 or newer"; break; | |
393 | + default: cpus = "internal error"; break; | |
394 | + } | |
395 | + printf("detected CPU type: %s\n", cpus); | |
396 | +#ifdef MODEX | |
397 | +#ifdef FADE | |
398 | + modexFadeOn(4, dpal); | |
399 | +#endif | |
400 | +#endif | |
401 | +} |
@@ -0,0 +1,310 @@ | ||
1 | +/* Catacomb Apocalypse Source Code | |
2 | + * Copyright (C) 1993-2014 Flat Rock Software | |
3 | + * | |
4 | + * This program is free software; you can redistribute it and/or modify | |
5 | + * it under the terms of the GNU General Public License as published by | |
6 | + * the Free Software Foundation; either version 2 of the License, or | |
7 | + * (at your option) any later version. | |
8 | + * | |
9 | + * This program is distributed in the hope that it will be useful, | |
10 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | + * GNU General Public License for more details. | |
13 | + * | |
14 | + * You should have received a copy of the GNU General Public License along | |
15 | + * with this program; if not, write to the Free Software Foundation, Inc., | |
16 | + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
17 | + */ | |
18 | + | |
19 | +// | |
20 | +// ID Engine | |
21 | +// ID_IN.h - Header file for Input Manager | |
22 | +// v1.0d1w | |
23 | +// By Jason Blochowiak | |
24 | +// Open Watcom port by sparky4 | |
25 | +// | |
26 | + | |
27 | +#ifndef __16_IN__ | |
28 | +#define __16_IN__ | |
29 | + | |
30 | +#include <string.h> | |
31 | +#include "src/lib/16_head.h" | |
32 | +#include "src/lib/16_timer.h" | |
33 | +#include "src/lib/16_sprite.h" | |
34 | +#ifdef __WATCOMC__ | |
35 | +#include "src/lib/16_dbg.h" | |
36 | +#endif | |
37 | +#ifdef __DEBUG__ | |
38 | +//#define __DEBUG_InputMgr__ | |
39 | +#endif | |
40 | + | |
41 | +#ifdef __DEBUG_InputMgr__ | |
42 | +//#define TESTKEYIN | |
43 | +//#define TESTCONTROLNOISY | |
44 | +#endif | |
45 | + | |
46 | +extern boolean testkeyin,testcontrolnoisy; | |
47 | + | |
48 | +//if else for gfxtesting and direction | |
49 | +//player[pn].d == 2 || | |
50 | +//player[pn].d != 2 || | |
51 | +#define DIRECTIONIFELSE (player[pn].info.dir == 2) | |
52 | +//#define NDIRECTIONIFELSE (player[pn].info.dir != 2) | |
53 | + | |
54 | +#define KeyInt 9 // The keyboard ISR number | |
55 | + | |
56 | +// Stuff for the joystick | |
57 | +#define JoyScaleMax 32768 | |
58 | +#define JoyScaleShift 8 | |
59 | +#define MaxJoyValue 5000 | |
60 | + | |
61 | +#define MaxPlayers 4 | |
62 | +#define MaxKbds 2 | |
63 | +#define MaxJoys 2 | |
64 | +#define MaxPads 2 | |
65 | +#define NumCodes 128 | |
66 | + | |
67 | +typedef byte ScanCode; | |
68 | +#define sc_None 0 | |
69 | +#define sc_Bad 0xff | |
70 | +#define sc_Return 0x1c | |
71 | +#define sc_Enter sc_Return | |
72 | +#define sc_Escape 0x01 | |
73 | +#define sc_Space 0x39 | |
74 | +#define sc_BackSpace 0x0e | |
75 | +#define sc_Tab 0x0f | |
76 | +#define sc_Alt 0x38 | |
77 | +#define sc_Control 0x1d | |
78 | +#define sc_CapsLock 0x3a | |
79 | +#define sc_LShift 0x2a | |
80 | +#define sc_RShift 0x36 | |
81 | +#define sc_UpArrow 0x48 | |
82 | +#define sc_DownArrow 0x50 | |
83 | +#define sc_LeftArrow 0x4b | |
84 | +#define sc_RightArrow 0x4d | |
85 | +#define sc_Insert 0x52 | |
86 | +#define sc_Delete 0x53 | |
87 | +#define sc_Home 0x47 | |
88 | +#define sc_End 0x4f | |
89 | +#define sc_PgUp 0x49 | |
90 | +#define sc_PgDn 0x51 | |
91 | +#define sc_F1 0x3b | |
92 | +#define sc_F2 0x3c | |
93 | +#define sc_F3 0x3d | |
94 | +#define sc_F4 0x3e | |
95 | +#define sc_F5 0x3f | |
96 | +#define sc_F6 0x40 | |
97 | +#define sc_F7 0x41 | |
98 | +#define sc_F8 0x42 | |
99 | +#define sc_F9 0x43 | |
100 | +#define sc_F10 0x44 | |
101 | +#define sc_F11 0x57 | |
102 | +#define sc_F12 0x59 | |
103 | + | |
104 | +#define sc_1 0x02 | |
105 | +#define sc_2 0x03 | |
106 | +#define sc_3 0x04 | |
107 | +#define sc_4 0x05 | |
108 | +#define sc_5 0x06 | |
109 | +#define sc_6 0x07 | |
110 | +#define sc_7 0x08 | |
111 | +#define sc_8 0x09 | |
112 | +#define sc_9 0x0a | |
113 | +#define sc_0 0x0b | |
114 | + | |
115 | +#define sc_A 0x1e | |
116 | +#define sc_B 0x30 | |
117 | +#define sc_C 0x2e | |
118 | +#define sc_D 0x20 | |
119 | +#define sc_E 0x12 | |
120 | +#define sc_F 0x21 | |
121 | +#define sc_G 0x22 | |
122 | +#define sc_H 0x23 | |
123 | +#define sc_I 0x17 | |
124 | +#define sc_J 0x24 | |
125 | +#define sc_K 0x25 | |
126 | +#define sc_L 0x26 | |
127 | +#define sc_M 0x32 | |
128 | +#define sc_N 0x31 | |
129 | +#define sc_O 0x18 | |
130 | +#define sc_P 0x19 | |
131 | +#define sc_Q 0x10 | |
132 | +#define sc_R 0x13 | |
133 | +#define sc_S 0x1f | |
134 | +#define sc_T 0x14 | |
135 | +#define sc_U 0x16 | |
136 | +#define sc_V 0x2f | |
137 | +#define sc_W 0x11 | |
138 | +#define sc_X 0x2d | |
139 | +#define sc_Y 0x15 | |
140 | +#define sc_Z 0x2c | |
141 | + | |
142 | +#define key_None 0 | |
143 | +#define key_Return 0x0d | |
144 | +#define key_Enter key_Return | |
145 | +#define key_Escape 0x1b | |
146 | +#define key_Space 0x20 | |
147 | +#define key_BackSpace 0x08 | |
148 | +#define key_Tab 0x09 | |
149 | +#define key_Delete 0x7f | |
150 | + | |
151 | +#define key_LSuper 0x5b | |
152 | +#define key_RSuper 0x5c | |
153 | +#define key_Menu 0x5d | |
154 | + | |
155 | +// Stuff for the mouse | |
156 | +#define MReset 0 | |
157 | +#define MButtons 3 | |
158 | +#define MDelta 11 | |
159 | + | |
160 | +#define MouseInt 0x33 | |
161 | +#ifdef DEMO0 | |
162 | +typedef enum { | |
163 | + demo_Off,demo_Record,demo_Playback,demo_PlayDone | |
164 | + } Demo; | |
165 | +#endif | |
166 | +typedef enum { | |
167 | + //ctrl_None, // MDM (GAMERS EDGE) - added | |
168 | + ctrl_Keyboard, | |
169 | + ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2, | |
170 | + ctrl_Joystick, | |
171 | + ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2, | |
172 | + ctrl_Mouse, | |
173 | + } ControlType; | |
174 | +typedef enum { | |
175 | + motion_Left = -1,motion_Up = -1, | |
176 | + motion_None = 0, | |
177 | + motion_Right = 1,motion_Down = 1 | |
178 | + } Motion; | |
179 | +typedef enum { | |
180 | + dir_North,//dir_NorthEast, | |
181 | + dir_West,//dir_Nortinest, | |
182 | + dir_None, | |
183 | + dir_East,//,dir_SouthEast, | |
184 | + dir_South,//dir_Soutinest, | |
185 | + } Direction; | |
186 | +typedef struct { | |
187 | + boolean near button0,button1,button2,button3; | |
188 | + int near x,y; | |
189 | + Motion near xaxis,yaxis; | |
190 | + Direction near dir; | |
191 | + } CursorInfo; | |
192 | + | |
193 | +typedef struct { | |
194 | + ScanCode near button0,button1, | |
195 | + //upleft, | |
196 | + up, | |
197 | + down, | |
198 | + left, | |
199 | + right | |
200 | + //upright, | |
201 | + //downleft, | |
202 | + //,downright | |
203 | + ; | |
204 | + } KeyboardDef; | |
205 | +typedef struct { | |
206 | + word near joyMinX,joyMinY, | |
207 | + threshMinX,threshMinY, | |
208 | + threshMaxX,threshMaxY, | |
209 | + joyMaxX,joyMaxY, | |
210 | + joyMultXL,joyMultYL, | |
211 | + joyMultXH,joyMultYH; | |
212 | + } JoystickDef; | |
213 | + | |
214 | +typedef struct | |
215 | +{ | |
216 | + int x; //player exact position on the viewable map | |
217 | + int y; //player exact position on the viewable map | |
218 | + int tx; //player tile position on the viewable map | |
219 | + int ty; //player tile position on the viewable map | |
220 | + int triggerx; //player's trigger box tile position on the viewable map | |
221 | + int triggery; //player's trigger box tile position on the viewable map | |
222 | + int sheetsetx; //NOT USED YET! player sprite sheet set on the image x | |
223 | + int sheetsety; //NOT USED YET! player sprite sheet set on the image y | |
224 | + byte d; //direction to render sprite!! wwww | |
225 | + byte q; //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www | |
226 | + byte near pdir; //previous direction~ | |
227 | + //byte near kd[2]; //array of arrow key pressed | |
228 | + word speed; //player speed! | |
229 | + word spt; //speed per tile | |
230 | +//0000 planar_buf_t huge *data; //supposively the sprite sheet data | |
231 | +// planar_buf_t data; //supposively the sprite sheet data | |
232 | +////0000---- | |
233 | + struct sprite *spri; //supposively the sprite sheet data | |
234 | + sword hp; //hitpoints of the player | |
235 | + int persist_aniframe; /* gonna be increased to 1 before being used, so 0 is ok for default */ | |
236 | + CursorInfo info; | |
237 | + ControlType Controls; | |
238 | +} player_t; | |
239 | + | |
240 | +/* | |
241 | +============================================================================= | |
242 | + | |
243 | + GLOBAL VARIABLES | |
244 | + | |
245 | +============================================================================= | |
246 | +*/ | |
247 | +/*extern struct inconfig | |
248 | +{ | |
249 | + boolean MousePresent; | |
250 | + boolean JoysPresent[MaxJoys]; | |
251 | + boolean Keyboard[NumCodes]; | |
252 | + boolean Paused; | |
253 | + char LastASCII; | |
254 | + ScanCode LastScan; | |
255 | + | |
256 | + KeyboardDef KbdDefs[MaxKbds]; | |
257 | + JoystickDef JoyDefs[MaxJoys]; | |
258 | +} inpu;*/ | |
259 | + | |
260 | +#ifdef DEMO0 | |
261 | + static Demo DemoMode = demo_Off; | |
262 | + static byte /*_seg*/ *DemoBuffer; | |
263 | + static word DemoOffset,DemoSize; | |
264 | +#endif | |
265 | + | |
266 | +// Internal routines | |
267 | +extern void interrupt INL_KeyService(); | |
268 | +extern void Mouse(int x); | |
269 | +//static void INL_GetMouseDelta(int *x,int *y); | |
270 | +//static word INL_GetMouseButtons(void); | |
271 | +extern void IN_GetJoyAbs(word joy,word *xp,word *yp); | |
272 | +//static void INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive); | |
273 | +//static word INL_GetJoyButtons(word joy); | |
274 | +extern word IN_GetJoyButtonsDB(word joy); | |
275 | +//static void INL_StartKbd(void); | |
276 | +//static void INL_ShutKbd(void); | |
277 | +//static boolean INL_StartMouse(void); | |
278 | +//static void INL_ShutMouse(void); | |
279 | +//static void INL_SetJoyScale(word joy); | |
280 | +extern void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy); | |
281 | +//static boolean INL_StartJoy(word joy); | |
282 | +//static void INL_ShutJoy(word joy); | |
283 | +extern void IN_Startup(); | |
284 | +extern void IN_Default(boolean gotit,player_t *player,ControlType nt); | |
285 | +extern void IN_Shutdown(); | |
286 | +extern void IN_SetKeyHook(void (*hook)()); | |
287 | +extern void IN_ClearKeysDown(); | |
288 | +//static void INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy); | |
289 | +extern void IN_ReadCursor(CursorInfo *info); | |
290 | +extern void near IN_ReadControl(int pn,player_t *player); | |
291 | +extern void IN_SetControlType(word pn,player_t *player,ControlType type); | |
292 | +#if DEMO0 | |
293 | +extern boolean IN_StartDemoRecord(word bufsize); | |
294 | +extern void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize); | |
295 | +extern void IN_StopDemo(void); | |
296 | +extern void IN_FreeDemoBuffer(void); | |
297 | +#endif | |
298 | +extern byte *IN_GetScanName(ScanCode scan); | |
299 | +extern ScanCode IN_WaitForKey(); | |
300 | +extern char IN_WaitForASCII(); | |
301 | +extern void IN_AckBack(); | |
302 | +extern void IN_Ack(); | |
303 | +extern boolean IN_IsUserInput(); | |
304 | +extern boolean IN_UserInput(dword delay,boolean clear); | |
305 | +extern boolean IN_KeyDown(byte code); | |
306 | +extern void IN_ClearKey(byte code); | |
307 | +extern boolean IN_qb(byte kee); | |
308 | +void IN_initplayer(player_t *player, word pn); | |
309 | + | |
310 | +#endif |
@@ -0,0 +1,925 @@ | ||
1 | +/* Project 16 Source Code~ | |
2 | + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover | |
3 | + * | |
4 | + * This file is part of Project 16. | |
5 | + * | |
6 | + * Project 16 is free software; you can redistribute it and/or modify | |
7 | + * it under the terms of the GNU General Public License as published by | |
8 | + * the Free Software Foundation; either version 3 of the License, or | |
9 | + * (at your option) any later version. | |
10 | + * | |
11 | + * Project 16 is distributed in the hope that it will be useful, | |
12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | + * GNU General Public License for more details. | |
15 | + * | |
16 | + * You should have received a copy of the GNU General Public License | |
17 | + * along with this program. If not, see <http://www.gnu.org/licenses/>, or | |
18 | + * write to the Free Software Foundation, Inc., 51 Franklin Street, | |
19 | + * Fifth Floor, Boston, MA 02110-1301 USA. | |
20 | + * | |
21 | + */ | |
22 | +/* | |
23 | + scroll16 library~ | |
24 | +*/ | |
25 | +#include "src/lib/scroll16.h" | |
26 | +#include "src/lib/16_sprite.h" | |
27 | + | |
28 | +void walk(map_view_t *pip, player_t *player, word pn) | |
29 | +{ | |
30 | + #define INC_PER_FRAME if(player[pn].q&1) player[pn].persist_aniframe++; if(player[pn].persist_aniframe>4) player[pn].persist_aniframe = 1; | |
31 | + //printf("player[%d].d=%d\n", pn, player[pn].d); | |
32 | + switch(player[pn].d) | |
33 | + { | |
34 | + //no direction | |
35 | + case 2: | |
36 | + //0000pip[0].video->startclk = (*clockw); | |
37 | + break; | |
38 | + //right movement | |
39 | + case 3: | |
40 | + //printf("pip[0].page->tilesw=%d ", pip[0].page->tilesw); printf("pip[0].page->tw=%d\n", pip[0].page->tw); | |
41 | + if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tw < pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && | |
42 | + !(pip[0].map->data[(player[pn].tx)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx+1 == TRIGGX && player[pn].ty == TRIGGY)) //collision detection! | |
43 | + { | |
44 | + if(player[pn].q<=player[pn].spt) | |
45 | + { | |
46 | + INC_PER_FRAME; | |
47 | + animatePlayer(pip, player, pn, 1); | |
48 | + ScrollRight(pip, player, 3, pn); | |
49 | + ScrollRight(pip, player, 2, pn); | |
50 | + mapScrollRight(pip, player, !(pip[0].video->p), pn); | |
51 | + mapScrollRight(pip, player, (pip[0].video->p), pn); | |
52 | + if(!pageflipflop) modexShowPage(pip[1].page); | |
53 | + player[pn].q++; | |
54 | + //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; | |
55 | + } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; } | |
56 | + } | |
57 | + else if(player[pn].tx < pip[0].map->width && !(pip[0].map->data[(player[pn].tx)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx+1 == TRIGGX && player[pn].ty == TRIGGY)) | |
58 | + { | |
59 | + if(player[pn].q<=player[pn].spt) | |
60 | + { | |
61 | + INC_PER_FRAME; | |
62 | + player[pn].x+=(player[pn].speed); | |
63 | + animatePlayer(pip, player, pn, 0); | |
64 | + if(!pageflipflop) modexShowPage(pip[1].page); | |
65 | + player[pn].q++; | |
66 | + } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; } | |
67 | + } | |
68 | + else | |
69 | + { | |
70 | + if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 16, 32); | |
71 | +#ifdef SPRITE | |
72 | + //PBUFSFUN(pip[0].page, player[pn].x, player[pn].y-TILEWH, 16, 32, 16, 32, PLAYERBMPDATA); | |
73 | + animate_spri(player[pn].spri); | |
74 | +#else | |
75 | + modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 16, 32, 14); | |
76 | +#endif | |
77 | + if(!pageflipflop) modexShowPage(pip[1].page); | |
78 | + player[pn].d = 2; | |
79 | + } | |
80 | + player[pn].triggerx = player[pn].tx+1; | |
81 | + player[pn].triggery = player[pn].ty; | |
82 | + break; | |
83 | + | |
84 | + //left movement | |
85 | + case 1: | |
86 | + if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tw <= pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && | |
87 | + !(pip[0].map->data[(player[pn].tx-2)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx-1 == TRIGGX && player[pn].ty == TRIGGY)) //collision detection! | |
88 | + { | |
89 | + if(player[pn].q<=player[pn].spt) | |
90 | + { | |
91 | + INC_PER_FRAME; | |
92 | + animatePlayer(pip, player, pn, 1); | |
93 | + ScrollLeft(pip, player, 3, pn); | |
94 | + ScrollLeft(pip, player, 2, pn); | |
95 | + mapScrollLeft(pip, player, !(pip[0].video->p), pn); | |
96 | + mapScrollLeft(pip, player, (pip[0].video->p), pn); | |
97 | + if(!pageflipflop) modexShowPage(pip[1].page); | |
98 | + player[pn].q++; | |
99 | + //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; | |
100 | + } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; } | |
101 | + } | |
102 | + else if(player[pn].tx > 1 && !(pip[0].map->data[(player[pn].tx-2)+(pip[0].map->width*(player[pn].ty-1))] == 0))//!(player[pn].tx-1 == TRIGGX && player[pn].ty == TRIGGY)) | |
103 | + { | |
104 | + if(player[pn].q<=player[pn].spt) | |
105 | + { | |
106 | + INC_PER_FRAME; | |
107 | + player[pn].x-=(player[pn].speed); | |
108 | + animatePlayer(pip, player, pn, 0); | |
109 | + if(!pageflipflop) modexShowPage(pip[1].page); | |
110 | + player[pn].q++; | |
111 | + } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; } | |
112 | + } | |
113 | + else | |
114 | + { | |
115 | + if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 16, 32); | |
116 | +#ifdef SPRITE | |
117 | + //PBUFSFUN(pip[0].page, player[pn].x, player[pn].y-TILEWH, 16, 96, 16, 32, PLAYERBMPDATA); | |
118 | + animate_spri(player[pn].spri); | |
119 | +#else | |
120 | + modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 16, 32, 10); | |
121 | +#endif | |
122 | + if(!pageflipflop) modexShowPage(pip[1].page); | |
123 | + player[pn].d = 2; | |
124 | + } | |
125 | + player[pn].triggerx = player[pn].tx-1; | |
126 | + player[pn].triggery = player[pn].ty; | |
127 | + break; | |
128 | + | |
129 | + //down movement | |
130 | + case 4: | |
131 | + if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->th < pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && | |
132 | + !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty+1 == TRIGGY)) //collision detection! | |
133 | + { | |
134 | + if(player[pn].q<=player[pn].spt) | |
135 | + { | |
136 | + INC_PER_FRAME; | |
137 | + animatePlayer(pip, player, pn, 1); | |
138 | + ScrollDown(pip, player, 3, pn); | |
139 | + ScrollDown(pip, player, 2, pn); | |
140 | + mapScrollDown(pip, player, !(pip[0].video->p), pn); | |
141 | + mapScrollDown(pip, player, (pip[0].video->p), pn); | |
142 | + if(!pageflipflop) modexShowPage(pip[1].page); | |
143 | + player[pn].q++; | |
144 | + //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; | |
145 | + } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; } | |
146 | + } | |
147 | + else if(player[pn].ty < pip[0].map->height && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty+1 == TRIGGY)) | |
148 | + { | |
149 | + if(player[pn].q<=player[pn].spt) | |
150 | + { | |
151 | + INC_PER_FRAME; | |
152 | + player[pn].y+=(player[pn].speed); | |
153 | + animatePlayer(pip, player, pn, 0); | |
154 | + if(!pageflipflop) modexShowPage(pip[1].page); | |
155 | + player[pn].q++; | |
156 | + } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; } | |
157 | + } | |
158 | + else | |
159 | + { | |
160 | + if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 16, 32); | |
161 | +#ifdef SPRITE | |
162 | + //PBUFSFUN(pip[0].page, player[pn].x, player[pn].y-TILEWH, 16, 64, 16, 32, PLAYERBMPDATA); | |
163 | + animate_spri(player[pn].spri); | |
164 | +#else | |
165 | + modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 16, 32, 9); | |
166 | +#endif | |
167 | + if(!pageflipflop) modexShowPage(pip[1].page); | |
168 | + player[pn].d = 2; | |
169 | + } | |
170 | + player[pn].triggerx = player[pn].tx; | |
171 | + player[pn].triggery = player[pn].ty+1; | |
172 | + break; | |
173 | + | |
174 | + //up movement | |
175 | + case 0: | |
176 | + if(pip[0].ty > 0 && pip[0].ty+pip[0].page->th <= pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && | |
177 | + !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty-2))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty-1 == TRIGGY)) //collision detection! | |
178 | + { | |
179 | + if(player[pn].q<=player[pn].spt) | |
180 | + { | |
181 | + INC_PER_FRAME; | |
182 | + animatePlayer(pip, player, pn, 1); | |
183 | + ScrollUp(pip, player, 3, pn); | |
184 | + ScrollUp(pip, player, 2, pn); | |
185 | + mapScrollUp(pip, player, !(pip[0].video->p), pn); | |
186 | + mapScrollUp(pip, player, (pip[0].video->p), pn); | |
187 | + if(!pageflipflop) modexShowPage(pip[1].page); | |
188 | + player[pn].q++; | |
189 | + //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2; | |
190 | + } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; } | |
191 | + } | |
192 | + else if(player[pn].ty > 1 && !(pip[0].map->data[(player[pn].tx-1)+(pip[0].map->width*(player[pn].ty-2))] == 0))//!(player[pn].tx == TRIGGX && player[pn].ty-1 == TRIGGY)) | |
193 | + { | |
194 | + if(player[pn].q<=player[pn].spt) | |
195 | + { | |
196 | + INC_PER_FRAME; | |
197 | + player[pn].y-=(player[pn].speed); | |
198 | + animatePlayer(pip, player, 0, pn); | |
199 | + if(!pageflipflop) modexShowPage(pip[1].page); | |
200 | + player[pn].q++; | |
201 | + } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; } | |
202 | + } | |
203 | + else | |
204 | + { | |
205 | + if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 16, 32); | |
206 | +#ifdef SPRITE | |
207 | + //PBUFSFUN(pip[0].page, player[pn].x, player[pn].y-TILEWH, 16, 0, 16, 32, PLAYERBMPDATA); | |
208 | + animate_spri(player[pn].spri); | |
209 | +#else | |
210 | + modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 16, 32, 12); | |
211 | +#endif | |
212 | + if(!pageflipflop) modexShowPage(pip[1].page); | |
213 | + player[pn].d = 2; | |
214 | + } | |
215 | + player[pn].triggerx = player[pn].tx; | |
216 | + player[pn].triggery = player[pn].ty-1; | |
217 | + break; | |
218 | + } | |
219 | +} | |
220 | + | |
221 | +//panning page | |
222 | +void panpagemanual(map_view_t *pip, player_t *player, word pn) | |
223 | +{ | |
224 | + switch(player[pn].d) | |
225 | + { | |
226 | + //right movement | |
227 | + case 3: | |
228 | + if(pip[pip[0].pan->pn].tx >= 0 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tw < pip[pip[0].pan->pn].page->tilesw) | |
229 | + { | |
230 | + if(player[pn].q<=player[pn].spt) | |
231 | + { | |
232 | + pip[pip[0].pan->pn].page->dx+=4; | |
233 | + modexShowPage(pip[pip[0].pan->pn].page); | |
234 | + player[pn].q++; | |
235 | + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; } | |
236 | + } | |
237 | + break; | |
238 | + | |
239 | + //left movement | |
240 | + case 1: | |
241 | + if(pip[pip[0].pan->pn].tx > 0 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tw <= pip[pip[0].pan->pn].page->tilesw) | |
242 | + { | |
243 | + if(player[pn].q<=player[pn].spt) | |
244 | + { | |
245 | + pip[pip[0].pan->pn].page->dx-=4; | |
246 | + modexShowPage(pip[pip[0].pan->pn].page); | |
247 | + player[pn].q++; | |
248 | + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; } | |
249 | + } | |
250 | + break; | |
251 | + | |
252 | + //down movement | |
253 | + case 4: | |
254 | + if(pip[pip[0].pan->pn].ty >= 0 && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->th < pip[pip[0].pan->pn].page->tilesh) | |
255 | + { | |
256 | + if(player[pn].q<=player[pn].spt) | |
257 | + { | |
258 | + pip[pip[0].pan->pn].page->dy+=4; | |
259 | + modexShowPage(pip[pip[0].pan->pn].page); | |
260 | + player[pn].q++; | |
261 | + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; } | |
262 | + } | |
263 | + break; | |
264 | + | |
265 | + //up movement | |
266 | + case 0: | |
267 | + if(pip[pip[0].pan->pn].ty > 0 && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->th <= pip[pip[0].pan->pn].page->tilesh) | |
268 | + { | |
269 | + if(player[pn].q<=player[pn].spt) | |
270 | + { | |
271 | + pip[pip[0].pan->pn].page->dy-=4; | |
272 | + modexShowPage(pip[pip[0].pan->pn].page); | |
273 | + player[pn].q++; | |
274 | + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; } | |
275 | + } | |
276 | + break; | |
277 | + } | |
278 | + //if (player[pn].d!=2) printf("player[%u].d=%u player[%u].q=%u\n", pn, player[pn].d, pn, player[pn].q); | |
279 | +} | |
280 | + | |
281 | +/*map_t | |
282 | +allocMap(int w, int h) { | |
283 | + map_t result; | |
284 | + | |
285 | + result.width =w; | |
286 | + result.height=h; | |
287 | + result.data = malloc(sizeof(byte) * w * h); | |
288 | + //result.data = (byte *)alloc_emem(((int)sizeof(byte) * w * h)/1024); | |
289 | + if(isEMS() || checkEMS()) | |
290 | + { | |
291 | + XMOVE mm; | |
292 | + //emmhandle = mallocEMS(coretotalEMS());//alloc_emem((int)sizeof(map)) | |
293 | + mm.length=sizeof(result); | |
294 | + mm.sourceH=0; | |
295 | + mm.sourceOff=ptr2long(&result); | |
296 | + mm.destH=emmhandle; | |
297 | + mm.destOff=0; | |
298 | + ist = move_emem(&mm); | |
299 | + if(!ist){ dealloc_emem(emmhandle); exit(5); } | |
300 | + printf("%d\n", coretotalEMS()); | |
301 | + } | |
302 | + | |
303 | + return result; | |
304 | +}*/ | |
305 | + | |
306 | +/*void | |
307 | +initMap(map_t *map) { | |
308 | + // just a place holder to fill out an alternating pattern | |
309 | + int x, y, xx, yy; | |
310 | + int i, q; | |
311 | +// int tile = 1; | |
312 | + //if(!isEMS() || !checkEMS()) | |
313 | +// map->tiles = malloc(sizeof(tiles_t)); | |
314 | + //else | |
315 | + // map->tiles = (tiles_t *)alloc_emem(sizeof(tiles_t)); | |
316 | + | |
317 | + //create the tile set | |
318 | + //if(!isEMS() || !checkEMS()) | |
319 | +// map->tiles->data = malloc(sizeof(bitmap_t)); | |
320 | + //else | |
321 | + // map->tiles->data = (bitmap_t *)alloc_emem(sizeof(bitmap_t)); | |
322 | +// map->tiles->data->width = (TILEWH); | |
323 | +// map->tiles->data->height= TILEWH; | |
324 | + //if(!isEMS() || !checkEMS()) | |
325 | +// map->tiles->data->data = malloc((TILEWH*2)*TILEWH); | |
326 | + //else | |
327 | + // map->tiles->data->data = (byte *)alloc_emem((TILEWH*2)*TILEWH); | |
328 | +// map->tiles->tileHeight = TILEWH; | |
329 | +// map->tiles->tileWidth =TILEWH; | |
330 | +// map->tiles->rows = 1; | |
331 | +// map->tiles->cols = 1;//2; | |
332 | + | |
333 | + q=0; | |
334 | + //for(y=0; y<map->height; y++) { | |
335 | + //for(x=0; x<map->width; x++) { | |
336 | + i=0; | |
337 | + for(yy=0; yy<TILEWH; yy++) { | |
338 | + for(xx=0; xx<(TILEWH); xx++) { | |
339 | + //if(x<TILEWH){ | |
340 | + map->tiles->data->data[i+1] = map->data[q];//28;//0x24; | |
341 | +// printf("[%d]", map->tiles->data->data[i]); | |
342 | + //}else{ | |
343 | + //map->tiles->data->data[i] = map->data[q];//0;//0x34; | |
344 | + //printf("]%d[==[%d]", i, map->tiles->data->data[i]); | |
345 | + //} | |
346 | + i++; | |
347 | + } | |
348 | +// printf("\n"); | |
349 | + } | |
350 | +// printf("[%d]", map->data[q]); | |
351 | + q++; | |
352 | +// } | |
353 | + //printf("\n\n"); | |
354 | +// } | |
355 | + | |
356 | + i=0; | |
357 | + for(y=0; y<map->height; y++) { | |
358 | + for(x=0; x<map->width; x++) { | |
359 | +// map->data[i]=255; | |
360 | + printf("[%d]", map->data[i]); | |
361 | + //tile = tile ? 0 : 1; | |
362 | + i++; | |
363 | + } | |
364 | + //tile = tile ? 0 : 1; | |
365 | + } | |
366 | +}*/ | |
367 | + | |
368 | +void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid) | |
369 | +{ | |
370 | + word x, y; /* coordinate for drawing */ | |
371 | + | |
372 | + /* increment the pixel position and update the page */ | |
373 | + mv[id].page->dx += player[plid].speed; | |
374 | + | |
375 | + /* check to see if this changes the tile */ | |
376 | + if(mv[id].page->dx >= mv[id].dxThresh ) | |
377 | + { | |
378 | + /* go forward one tile */ | |
379 | + mv[id].tx++; | |
380 | + /* Snap the origin forward */ | |
381 | + mv[id].page->data += 4; | |
382 | + | |
383 | + mv[id].page->dx = mv[id].map->tiles->tileWidth; | |
384 | + } | |
385 | + | |
386 | + /* draw the next column */ | |
387 | + x= mv[0].page->sw + mv[id].map->tiles->tileWidth; | |
388 | + if(player[plid].q%4) | |
389 | + if(id==0) | |
390 | + mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tw, mv[0].ty-1, x, player, mv->page->dx); | |
391 | + else | |
392 | + if(!pageflipflop && !pageploop) | |
393 | + modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->th+2)); | |
394 | + mv[0].video->r=1; | |
395 | +} | |
396 | + | |
397 | + | |
398 | +void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid) | |
399 | +{ | |
400 | + word x, y; /* coordinate for drawing */ | |
401 | + | |
402 | + /* decrement the pixel position and update the page */ | |
403 | + mv[id].page->dx -= player[plid].speed; | |
404 | + | |
405 | + /* check to see if this changes the tile */ | |
406 | + if(mv[id].page->dx == 0) | |
407 | + { | |
408 | + /* go backward one tile */ | |
409 | + mv[id].tx--; | |
410 | + /* Snap the origin backward */ | |
411 | + mv[id].page->data -= 4; | |
412 | + | |
413 | + mv[id].page->dx = mv[id].map->tiles->tileWidth; | |
414 | + } | |
415 | + | |
416 | + /* draw the next column */ | |
417 | + x= 0; | |
418 | + if(player[plid].q%4) | |
419 | + if(id==0) | |
420 | + mapDrawCol(&mv[0], mv[0].tx - 1, mv[0].ty-1, x, player, mv->page->dx); | |
421 | + else | |
422 | + if(!pageflipflop && !pageploop) | |
423 | + modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->th+2)); | |
424 | + mv[0].video->r=1; | |
425 | +} | |
426 | + | |
427 | + | |
428 | +void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid) | |
429 | +{ | |
430 | + word x, y; /* coordinate for drawing */ | |
431 | + | |
432 | + /* decrement the pixel position and update the page */ | |
433 | + mv[id].page->dy -= player[plid].speed; | |
434 | + | |
435 | + /* check to see if this changes the tile */ | |
436 | + if(mv[id].page->dy == 0 ) | |
437 | + { | |
438 | + /* go down one tile */ | |
439 | + mv[id].ty--; | |
440 | + /* Snap the origin downward */ | |
441 | + mv[id].page->data -= mv[id].page->pi; | |
442 | + | |
443 | + mv[id].page->dy = mv[id].map->tiles->tileHeight; | |
444 | + } | |
445 | + | |
446 | + /* draw the next row */ | |
447 | + y= 0; | |
448 | + if(player[plid].q%3) | |
449 | + if(id==0) | |
450 | + mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty-1, y, player, mv->page->dy); | |
451 | + else | |
452 | + if(!pageflipflop && !pageploop) | |
453 | + modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tw+2), mv[id].map->tiles->tileHeight); | |
454 | + mv[0].video->r=1; | |
455 | +} | |
456 | + | |
457 | +void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) | |
458 | +{ | |
459 | + word x, y; /* coordinate for drawing */ | |
460 | + | |
461 | + /* increment the pixel position and update the page */ | |
462 | + mv[id].page->dy += player[plid].speed; | |
463 | + | |
464 | + /* check to see if this changes the tile */ | |
465 | + if(mv[id].page->dy >= mv[id].dyThresh ) | |
466 | + { | |
467 | + /* go down one tile */ | |
468 | + mv[id].ty++; | |
469 | + /* Snap the origin downward */ | |
470 | + mv[id].page->data += mv[id].page->pi; | |
471 | + | |
472 | + mv[id].page->dy = mv[id].map->tiles->tileHeight; | |
473 | + } | |
474 | + | |
475 | + /* draw the next row */ | |
476 | + y= mv[0].page->sh + mv[id].map->tiles->tileHeight; | |
477 | + if(player[plid].q%3) | |
478 | + if(id==0) | |
479 | + mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->th, y, player, mv->page->dy); | |
480 | + else | |
481 | + if(!pageflipflop && !pageploop) | |
482 | + modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tw+2), mv[id].map->tiles->tileHeight); | |
483 | + mv[0].video->r=1; | |
484 | +} | |
485 | + | |
486 | + | |
487 | +//TODO finish this wwww | |
488 | +void near ScrollRight(map_view_t *mv, player_t *player, word id, word plid) | |
489 | +{ | |
490 | + /* increment the pixel position and update the page */ | |
491 | + mv[id].page->dx += player[plid].speed; | |
492 | + | |
493 | + /* check to see if this changes the tile */ | |
494 | + if(mv[id].page->dx >= mv[0].dxThresh ) | |
495 | + { | |
496 | +// vga_setup_wm1_block_copy(); | |
497 | +// _fmemmove(mv[id].page->data+4, mv[id].page->data, mv[id].page->pagesize); | |
498 | +// vga_restore_rm0wm0(); | |
499 | + /* Snap the origin forward */ | |
500 | + mv[id].page->data += 4; | |
501 | + mv[id].page->dx = mv[0].map->tiles->tileWidth; | |
502 | + } | |
503 | +} | |
504 | + | |
505 | +void near ScrollLeft(map_view_t *mv, player_t *player, word id, word plid) | |
506 | +{ | |
507 | + /* decrement the pixel position and update the page */ | |
508 | + mv[id].page->dx -= player[plid].speed; | |
509 | + | |
510 | + /* check to see if this changes the tile */ | |
511 | + if(mv[id].page->dx == 0) | |
512 | + { | |
513 | +// vga_setup_wm1_block_copy(); | |
514 | +// _fmemmove(mv[id].page->data-4, mv[id].page->data, mv[id].page->pagesize); | |
515 | +// vga_restore_rm0wm0(); | |
516 | + /* Snap the origin backward */ | |
517 | + mv[id].page->data -= 4; | |
518 | + mv[id].page->dx = mv[0].map->tiles->tileWidth; | |
519 | + } | |
520 | +} | |
521 | + | |
522 | +void near ScrollUp(map_view_t *mv, player_t *player, word id, word plid) | |
523 | +{ | |
524 | + /* decrement the pixel position and update the page */ | |
525 | + mv[id].page->dy -= player[plid].speed; | |
526 | + | |
527 | + /* check to see if this changes the tile */ | |
528 | + if(mv[id].page->dy == 0) | |
529 | + { | |
530 | +// vga_setup_wm1_block_copy(); | |
531 | +// _fmemmove(mv[id].page->data-mv[id].page->pi, mv[id].page->data, mv[id].page->pagesize); | |
532 | +// vga_restore_rm0wm0(); | |
533 | + /* Snap the origin backward */ | |
534 | + mv[id].page->data -= mv[id].page->pi; | |
535 | + mv[id].page->dy = mv[0].map->tiles->tileWidth; | |
536 | + } | |
537 | +} | |
538 | + | |
539 | +void near ScrollDown(map_view_t *mv, player_t *player, word id, word plid) | |
540 | +{ | |
541 | + /* increment the pixel position and update the page */ | |
542 | + mv[id].page->dy += player[plid].speed; | |
543 | + | |
544 | + /* check to see if this changes the tile */ | |
545 | + if(mv[id].page->dy >= mv[0].dxThresh ) | |
546 | + { | |
547 | +// vga_setup_wm1_block_copy(); | |
548 | +// _fmemmove(mv[id].page->data+mv[id].page->pi, mv[id].page->data, mv[id].page->pagesize); | |
549 | +// vga_restore_rm0wm0(); | |
550 | + /* Snap the origin forward */ | |
551 | + mv[id].page->data += mv[id].page->pi; | |
552 | + mv[id].page->dy = mv[0].map->tiles->tileWidth; | |
553 | + } | |
554 | +} | |
555 | + | |
556 | +sword chkmap(map_t *map, word q) | |
557 | +{ | |
558 | +// bitmap_t bp; | |
559 | + static byte x[(MAPW*MAPH)+1] = | |
560 | +{ 1, 2, 3, 4, 0, 3, 3, 3, 3, 3, 3, 3, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 6, 7, 8, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 10, 11, 12, 4, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 13, 14, 15, 16, 0, 1, 1, 1, 5, 8, 1, 11, 11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 4, 0, 0, 0, 0, 0, 8, 8, 1, 11, 11, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 1, 2, 3, 4, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 5, 6, 7, 8, 6, 6, 6, 6, 6, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1, 9, 10, 11, 12, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 13, 14, 15, 16, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 10 }; | |
561 | +/*1, 2, 3, 4, 0, 3, 3, 3, 3, 3, 3, 3, 3, 4, 1, 1, 1, 1, 1, 1, \ | |
562 | +5, 6, 7, 8, 0, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
563 | +9, 10, 11, 12, 4, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
564 | +13, 14, 15, 16, 0, 1, 1, 1, 5, 8, 1, 11, 11, 1, 1, 1, 1, 1, 1, 1, \ | |
565 | +0, 0, 4, 0, 0, 0, 0, 0, 8, 8, 1, 11, 11, 3, 1, 1, 1, 1, 1, 1, \ | |
566 | +1, 1, 1, 1, 0, 0, 0, 0, 8, 8, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
567 | +1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
568 | +1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, \ | |
569 | +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
570 | +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
571 | +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, \ | |
572 | +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
573 | +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, \ | |
574 | +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \ | |
575 | +1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, 1, 2, 3, 4 };*/ | |
576 | + //check for failed to load map | |
577 | + if((map->width == map->height == 0) && (q>0)) | |
578 | + { | |
579 | + //initiate a null map! | |
580 | + map->width=MAPW;///2; | |
581 | + map->height=MAPH;///2; | |
582 | +// map->data = malloc(((map->width*map->height)+1)*sizeof(byte)); | |
583 | + map->data = &x; | |
584 | + map->tiles = malloc(sizeof(tiles_t)); | |
585 | + //fix this to be far~ | |
586 | +// bp = bitmapLoadPcx("data/ed.pcx"); | |
587 | +// map->tiles->data = &bp; | |
588 | + map->tiles->debug_data = map->data; | |
589 | + map->tiles->tileHeight = 16; | |
590 | + map->tiles->tileWidth = 16; | |
591 | + map->tiles->rows = 1; | |
592 | + map->tiles->cols = 1; | |
593 | + map->tiles->debug_text = true; | |
594 | + } | |
595 | + else map->tiles->debug_text = false; | |
596 | + return 0; | |
597 | +} | |
598 | + | |
599 | +//TODO: player position here | |
600 | +void mapGoTo(map_view_t *mv, int tx, int ty) | |
601 | +{ | |
602 | + int px, py; | |
603 | + unsigned int i; | |
604 | + | |
605 | + /* set up the coordinates */ | |
606 | + mv[0].tx = mv[1].tx = tx; | |
607 | + mv[0].ty = mv[1].ty = ty; | |
608 | + mv[0].page->dx = mv[1].page->dx = mv[2].page->dx = mv[3].page->dx = mv->map->tiles->tileWidth; | |
609 | + mv[0].page->dy = mv[1].page->dy = mv[2].page->dy = mv[3].page->dy = mv->map->tiles->tileHeight; | |
610 | + | |
611 | + /* set up the thresholds */ | |
612 | + mv[0].dxThresh = mv[1].dxThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileWidth * 2; | |
613 | + mv[0].dyThresh = mv[1].dyThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileHeight * 2; | |
614 | + | |
615 | + /* draw the tiles */ | |
616 | + modexClearRegion(mv[0].page, 0, 0, mv[0].page->width, mv[0].page->height, 0); | |
617 | + py=0; | |
618 | + i=mv[0].ty * mv[0].map->width + mv[0].tx; | |
619 | + for(ty=mv[0].ty-1; py < mv[0].page->sh+mv->dyThresh && ty < mv[0].map->height; ty++, py+=mv[0].map->tiles->tileHeight) { | |
620 | + mapDrawWRow(&mv[0], tx-1, ty, py); | |
621 | + i+=mv->map->width - tx; | |
622 | + } | |
623 | + if(!pageploop) modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height); | |
624 | +// { | |
625 | +// unsigned int k,j,o; | |
626 | +// /* fill screen with a distinctive pattern */ | |
627 | +// for (k=0;k < vga_state.vga_width;k++) { | |
628 | +// o = k >> 2; | |
629 | +// vga_write_sequencer(0x02/*map mask*/,1 << (k&3)); | |
630 | +// for (j=0;j < (mv[0].page->height)+(mv[1].page->height)+(mv[2].page->height)+(mv[3].page->height);j++,o += vga_state.vga_stride) | |
631 | +// vga_state.vga_graphics_ram[o] = (k^j)&15; // VRL samples put all colors in first 15! | |
632 | +// } | |
633 | +// } | |
634 | + modexCopyPageRegion(mv[3].page, mv[0].page, 0/**/, 0/**/, 0, 0, 16, 32); | |
635 | +} | |
636 | + | |
637 | +void near | |
638 | +mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y) | |
639 | +{ | |
640 | + word rx; | |
641 | + word ry; | |
642 | + word textx=0; | |
643 | + word texty=0; | |
644 | + //if(i==0) i=2; | |
645 | + if(i==0) | |
646 | + { | |
647 | + //wwww | |
648 | + modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, 0); //currently the over scan color! | |
649 | + } | |
650 | + else | |
651 | + { | |
652 | + rx = (((i-1) % ((t->data->width)/t->tileWidth)) * t->tileWidth); | |
653 | + ry = (((i-1) / ((t->data->height)/t->tileHeight)) * t->tileHeight); | |
654 | +////0000printf("i=%d\n", i); | |
655 | + switch(t->debug_text) | |
656 | + { | |
657 | + case 0: | |
658 | +#ifndef TILERENDER | |
659 | + modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, ((t->debug_data[i])+1)); | |
660 | + //modexprint(page, x, y, 1, 15, 0, (char const *)(t->debug_data[i])); | |
661 | +#else | |
662 | + PBUFBFUN (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data)); | |
663 | + /* then the sprite. note modding ram ptr means we just draw to (x&3,0) */ | |
664 | + //draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); | |
665 | + //modexDrawBmpRegion (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data)); | |
666 | +#endif | |
667 | + break; | |
668 | + case 1: | |
669 | + modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, (t->debug_data[i])+1); | |
670 | + //modexprintbig(page, x, y, 1, 15, 0, (t->debug_data)); | |
671 | + /*for(texty=0; texty<2; texty++) | |
672 | + { | |
673 | + for(textx=0; textx<2; textx++) | |
674 | + {*/ | |
675 | +// modexprint(page, x+(textx*8), y+(texty*8), 1, (word)(t->debug_data), 0, (t->debug_data)); | |
676 | +/* } | |
677 | + }*/ | |
678 | + break; | |
679 | + } | |
680 | + } | |
681 | +} | |
682 | + | |
683 | +void near mapDrawRow(map_view_t *mv, int tx, int ty, word y, player_t *p, word poopoffset) | |
684 | +{ | |
685 | + word x; | |
686 | + int i; | |
687 | + poopoffset%=p[0].speed; | |
688 | +//printf("y: %d\n", poopoffset); | |
689 | + /* the position within the map array */ | |
690 | + i=ty * mv->map->width + tx; | |
691 | + for(x=poopoffset; x<(mv->page->sw+mv->dxThresh)/(poopoffset+1) && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) { | |
692 | + if(i>=0) { | |
693 | + /* we are in the map, so copy! */ | |
694 | + mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y); | |
695 | + } | |
696 | + i++; /* next! */ | |
697 | + } | |
698 | +} | |
699 | + | |
700 | +void near mapDrawCol(map_view_t *mv, int tx, int ty, word x, player_t *p, word poopoffset) | |
701 | +{ | |
702 | + int y; | |
703 | + int i; | |
704 | + poopoffset%=p[0].speed; | |
705 | +//printf("x: %d\n", poopoffset); | |
706 | + /* location in the map array */ | |
707 | + i=ty * mv->map->width + tx; | |
708 | + | |
709 | + /* We'll copy all of the columns in the screen, | |
710 | + i + 1 row above and one below */ | |
711 | + for(y=poopoffset; y<(mv->page->sh+mv->dyThresh)/(poopoffset+1) && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) { | |
712 | + if(i>=0) { | |
713 | + /* we are in the map, so copy away! */ | |
714 | + mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y); | |
715 | + } | |
716 | + i += mv->map->width; | |
717 | + } | |
718 | +} | |
719 | + | |
720 | +void mapDrawWRow(map_view_t *mv, int tx, int ty, word y) | |
721 | +{ | |
722 | + word x; | |
723 | + int i; | |
724 | + | |
725 | + /* the position within the map array */ | |
726 | + i=ty * mv->map->width + tx; | |
727 | + for(x=0; x<mv->page->sw+mv->dxThresh && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) { | |
728 | + if(i>=0) { | |
729 | + /* we are in the map, so copy! */ | |
730 | + mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y); | |
731 | + } | |
732 | + i++; /* next! */ | |
733 | + } | |
734 | +} | |
735 | + | |
736 | +void mapDrawWCol(map_view_t *mv, int tx, int ty, word x) | |
737 | +{ | |
738 | + int y; | |
739 | + int i; | |
740 | + | |
741 | + /* location in the map array */ | |
742 | + i=ty * mv->map->width + tx; | |
743 | + | |
744 | + /* We'll copy all of the columns in the screen, | |
745 | + i + 1 row above and one below */ | |
746 | + for(y=0; y<mv->page->sh+mv->dyThresh && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) { | |
747 | + if(i>=0) { | |
748 | + /* we are in the map, so copy away! */ | |
749 | + mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y); | |
750 | + } | |
751 | + i += mv->map->width; | |
752 | + } | |
753 | +} | |
754 | + | |
755 | +/*void qclean() | |
756 | +{ | |
757 | + //setkb(0); | |
758 | +}*/ | |
759 | + | |
760 | +unsigned char shinku_fps_indicator_page = 2; | |
761 | +boolean pageflipflop = 1; | |
762 | +boolean pageploop = 1; | |
763 | + | |
764 | +/* sync */ | |
765 | +void shinku(global_game_variables_t *gv) | |
766 | +{ | |
767 | + word x = (0) + gv->video.page[/*!*/(gv->video.p)].dx; // follow the screen | |
768 | + word y = (0) + gv->video.page[/*!*/(gv->video.p)].dy; // follow the screen | |
769 | + word w = 64, h = 8, col = 7, bgcol = 0, type = 1; | |
770 | + byte o,o2,i; | |
771 | + //modexCopyPageRegion(pip[1].page, pip[2].page, 16, 16, 16, 16, (14*8)+4, 8+4); | |
772 | + /* block copy to visible RAM from offscreen */ | |
773 | +// vga_setup_wm1_block_copy(); | |
774 | +// modexCopyPageRegion(&(gv->video.page[shinku_fps_indicator_page]), &(gv->video.page[!shinku_fps_indicator_page]), x, y, x+w, 0, w, h); | |
775 | +// o = *(gv->video.page[2].data); // source offscreen | |
776 | +// o2 = *(gv->video.page[shinku_fps_indicator_page].data)+(y * vga_state.vga_stride) + (x >> 2); // dest visible (original stride) | |
777 | +// 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); | |
778 | + /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */ | |
779 | +// vga_restore_rm0wm0(); | |
780 | + if(elapsed_timer(gv) >= (1.0 / gv->kurokku.frames_per_second)) | |
781 | + { | |
782 | + sprintf(gv->pee, "%.0f fps", (double)gv->kurokku.tiku/ticktock(gv)); | |
783 | + //modexClearRegion(&(gv->video.page[shinku_fps_indicator_page]), x, y, w, h, 45); | |
784 | + modexprint(&(gv->video.page[/*!*/(gv->video.p)]), x, y, type, col, bgcol, gv->pee); | |
785 | + gv->kurokku.tiku=0; | |
786 | + /* block copy to visible RAM from offscreen */ | |
787 | +// vga_setup_wm1_block_copy(); | |
788 | +// o = *(gv->video.page[shinku_fps_indicator_page].data); // source offscreen | |
789 | +// o2 = *(gv->video.page[2].data)+(y * vga_state.vga_stride) + (x >> 2); // dest visible (original stride) | |
790 | +// 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); | |
791 | +// modexCopyPageRegion(&(gv->video.page[shinku_fps_indicator_page]), &(gv->video.page[!shinku_fps_indicator_page]), x, y, x, 0, w, h); | |
792 | + /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */ | |
793 | +// vga_restore_rm0wm0(); | |
794 | + }else //copy dat sheet | |
795 | + gv->kurokku.tiku++; | |
796 | + | |
797 | + switch(gv->kurokku.fpscap) | |
798 | + { | |
799 | + case 0: | |
800 | + //modexprint(&(gv->video.page[shinku_fps_indicator_page]), x, y+8, type, col, bgcol, "sanic!"); | |
801 | + gv->kurokku.frames_per_second=1; | |
802 | + break; | |
803 | + case 1: | |
804 | + //turn this off if XT | |
805 | + //modexWaitBorder(); | |
806 | + vga_wait_for_vsync(); | |
807 | + gv->kurokku.frames_per_second=60; | |
808 | + break; | |
809 | + } | |
810 | + if(pageflipflop){ | |
811 | + if(gv->video.r){ | |
812 | + //vga_setup_wm1_block_copy(); | |
813 | + //_fmemcpy((gv->video.page[(gv->video.p)]).data, (gv->video.page[(!gv->video.p)]).data, gv->video.page[(!gv->video.p)].pagesize); | |
814 | + //vga_restore_rm0wm0(); | |
815 | + if(!pageploop) modexCopyPageRegion(&(gv->video.page[(gv->video.p)]), &(gv->video.page[(!gv->video.p)]), 0, 0, 0, 0, gv->video.page[gv->video.p].width, gv->video.page[!gv->video.p].height); | |
816 | + modexShowPage(&(gv->video.page[gv->video.p])); | |
817 | + if(!pageploop) gv->video.p=!gv->video.p; | |
818 | + gv->video.r=!gv->video.r; | |
819 | + //0000gv->video.tickclk = ((*clockw)-gv->video.startclk)/18.2; | |
820 | + } | |
821 | + } | |
822 | +} | |
823 | + | |
824 | +void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch) | |
825 | +{ | |
826 | + sword x = player[pn].x; | |
827 | + sword y = player[pn].y; | |
828 | + sword bx = x+16; //buffer's x | |
829 | + sword by = y+16; //buffer's y | |
830 | + word dire=32; //direction | |
831 | + sword qq; //scroll offset | |
832 | + word ls = player[pn].persist_aniframe; | |
833 | + | |
834 | + switch(scrollswitch) | |
835 | + { | |
836 | + case 0: | |
837 | + qq = 0; | |
838 | + break; | |
839 | + default: | |
840 | + qq = ((player[pn].q)*(player[pn].speed)); | |
841 | + break; | |
842 | + } | |
843 | + //x-=4; | |
844 | + y-=pip[0].map->tiles->tileHeight; | |
845 | + switch (player[pn].d) | |
846 | + { | |
847 | + case 0: | |
848 | + //up | |
849 | + dire*=player[pn].d; | |
850 | + y-=qq; | |
851 | + by-=4; | |
852 | + break; | |
853 | + case 3: | |
854 | + // right | |
855 | + dire*=(player[pn].d-2); | |
856 | + x+=qq; | |
857 | + bx+=4; | |
858 | + break; | |
859 | + case 2: | |
860 | + break; | |
861 | + case 4: | |
862 | + //down | |
863 | + dire*=(player[pn].d-2); | |
864 | + y+=qq; | |
865 | + by+=4; | |
866 | + break; | |
867 | + case 1: | |
868 | + //left | |
869 | + dire*=(player[pn].d+2); | |
870 | + x-=qq; | |
871 | + bx-=4; | |
872 | + break; | |
873 | + } | |
874 | + | |
875 | +#ifdef SPRITE | |
876 | +//#define FRAME1 PBUFSFUN(pip[/*!*/(pip->video->p)].page, x, y, 32, dire, 16, 32, PLAYERBMPDATA); | |
877 | +//#define FRAME2 PBUFSFUN(pip[/*!*/(pip->video->p)].page, x, y, 16, dire, 16, 32, PLAYERBMPDATA); | |
878 | +//#define FRAME3 PBUFSFUN(pip[/*!*/(pip->video->p)].page, x, y, 0, dire, 16, 32, PLAYERBMPDATA); | |
879 | +//#define FRAME4 PBUFSFUN(pip[/*!*/(pip->video->p)].page, x, y, 16, dire, 16, 32, PLAYERBMPDATA); | |
880 | +#define FRAME1 animate_spri(player[pn].spri); | |
881 | +#define FRAME2 animate_spri(player[pn].spri); | |
882 | +#define FRAME3 animate_spri(player[pn].spri); | |
883 | +#define FRAME4 animate_spri(player[pn].spri); | |
884 | +#else | |
885 | +#define FRAME1 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 2+dire); | |
886 | +#define FRAME2 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 1+dire); | |
887 | +#define FRAME3 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, dire); | |
888 | +#define FRAME4 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 16, 32, 1+dire); | |
889 | +#endif | |
890 | + if(!pageflipflop) | |
891 | + modexCopyPageRegion(pip[1].page, pip[0].page, x-4, y-4, x-4, y-4, 28, 36); | |
892 | + else{ | |
893 | + //copy old bg to page0 | |
894 | + //modexCopyPageRegion(pip[3].page, pip[0].page, bx, by, 0, 0, 20, 36); | |
895 | + //update buffer | |
896 | + //modexCopyPageRegion(pip[0].page, pip[3].page, 0, 0, x, y, 20, 36); | |
897 | + } | |
898 | +//modexCopyPageRegion(page_t *dest, page_t *src, word sx, word sy, word dx, word dy, word width, word height); | |
899 | + //modexCopyPageRegion(pip[3].page, pip[!(pip->video->p)].page, x-4, y-4, 0, 128, 28, 36); | |
900 | + /*modexCopyPageRegion(pip[pip->video->p].page, | |
901 | + pip[!(pip->video->p)].page, x-4, y-4, x-4, y-4, 28, 36);*/ | |
902 | +// else modexCopyPageRegion(pip[1].page, pip[0].page, x-4, y-4, x-4, y-4, 28, 40); | |
903 | + switch(ls) | |
904 | + { | |
905 | + case 1: | |
906 | + FRAME1 | |
907 | + break; | |
908 | + case 2: | |
909 | + FRAME2 | |
910 | + break; | |
911 | + case 3: | |
912 | + FRAME3 | |
913 | + break; | |
914 | + case 4: | |
915 | + FRAME4 | |
916 | + break; | |
917 | + } | |
918 | +// if(2>ls && ls>=1) { FRAME1 }else | |
919 | +// if(3>ls && ls>=2) { FRAME2 }else | |
920 | +// if(4>ls && ls>=3) { FRAME3 }else | |
921 | +// if(5>ls && ls>=4) { FRAME4 } | |
922 | + //modexCopyPageRegion(pip[0].page, pip[3].page, 0, 0, x, y, 16, 32); | |
923 | + //printf("x=%d y=%d bx=%d by=%d\n", x, y, bx, by); | |
924 | + pip->video->r=1; | |
925 | +} |
@@ -0,0 +1,12 @@ | ||
1 | +#!/bin/bash | |
2 | +mv src/scroll.c src/scroll_.c | |
3 | +mv src/_scroll.c src/scroll.c | |
4 | +mv src/scroll_.c src/_scroll.c | |
5 | + | |
6 | +mv src/lib/16_in.h src/lib/16_in_.h | |
7 | +mv src/lib/_16_in.h src/lib/16_in.h | |
8 | +mv src/lib/16_in_.h src/lib/_16_in.h | |
9 | + | |
10 | +mv src/lib/scroll16.c src/lib/scroll1_.c | |
11 | +mv src/lib/_croll16.c src/lib/scroll16.c | |
12 | +mv src/lib/scroll1_.c src/lib/_croll16.c |