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
25 #include "src/lib/16_scr.h"
\r
27 void walk(map_view_t *pip, player_t *player, word pn)
\r
33 #define INC_PER_FRAME if(player[pn].q&1) player[pn].persist_aniframe++; if(player[pn].persist_aniframe>4) player[pn].persist_aniframe = 1;
\r
34 //printf("player[%d].d=%d\n", pn, player[pn].d);
\r
35 switch(player[pn].d)
\r
39 //0000pip[0].video->startclk = (*clockw);
\r
43 //printf("pip[0].page->tilesw=%d ", pip[0].page->tilesw); printf("pip[0].page->tw=%d\n", pip[0].page->tw);
\r
44 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 &&
\r
45 !(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!
\r
47 if(player[pn].q<=player[pn].spt)
\r
50 animatePlayer(pip, player, pn, 1);
\r
51 ScrollRight(pip, player, 3, pn);
\r
52 ScrollRight(pip, player, 2, pn);
\r
53 mapScrollRight(pip, player, !(pip[0].video->p), pn);
\r
54 mapScrollRight(pip, player, (pip[0].video->p), pn);
\r
55 if(!pageflipflop) modexShowPage(pip[1].page);
\r
57 //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;
\r
58 } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; }
\r
60 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))
\r
62 if(player[pn].q<=player[pn].spt)
\r
65 player[pn].x+=(player[pn].speed);
\r
66 animatePlayer(pip, player, pn, 0);
\r
67 if(!pageflipflop) modexShowPage(pip[1].page);
\r
69 } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; }
\r
73 if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 24, 32);
\r
75 PBUFSFUN(pip[0].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 24, 32, PLAYERBMPDATA);
\r
77 modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 14);
\r
79 if(!pageflipflop) modexShowPage(pip[1].page);
\r
82 player[pn].triggerx = player[pn].tx+1;
\r
83 player[pn].triggery = player[pn].ty;
\r
88 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 &&
\r
89 !(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!
\r
91 if(player[pn].q<=player[pn].spt)
\r
94 animatePlayer(pip, player, pn, 1);
\r
95 ScrollLeft(pip, player, 3, pn);
\r
96 ScrollLeft(pip, player, 2, pn);
\r
97 mapScrollLeft(pip, player, !(pip[0].video->p), pn);
\r
98 mapScrollLeft(pip, player, (pip[0].video->p), pn);
\r
99 if(!pageflipflop) modexShowPage(pip[1].page);
\r
101 //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;
\r
102 } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; }
\r
104 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))
\r
106 if(player[pn].q<=player[pn].spt)
\r
109 player[pn].x-=(player[pn].speed);
\r
110 animatePlayer(pip, player, pn, 0);
\r
111 if(!pageflipflop) modexShowPage(pip[1].page);
\r
113 } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; }
\r
117 if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 24, 32);
\r
119 PBUFSFUN(pip[0].page, player[pn].x, player[pn].y-TILEWH, 24, 96, 24, 32, PLAYERBMPDATA);
\r
121 modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 10);
\r
123 if(!pageflipflop) modexShowPage(pip[1].page);
\r
126 player[pn].triggerx = player[pn].tx-1;
\r
127 player[pn].triggery = player[pn].ty;
\r
132 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 &&
\r
133 !(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!
\r
135 if(player[pn].q<=player[pn].spt)
\r
138 animatePlayer(pip, player, pn, 1);
\r
139 ScrollDown(pip, player, 3, pn);
\r
140 ScrollDown(pip, player, 2, pn);
\r
141 mapScrollDown(pip, player, !(pip[0].video->p), pn);
\r
142 mapScrollDown(pip, player, (pip[0].video->p), pn);
\r
143 if(!pageflipflop) modexShowPage(pip[1].page);
\r
145 //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;
\r
146 } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; }
\r
148 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))
\r
150 if(player[pn].q<=player[pn].spt)
\r
153 player[pn].y+=(player[pn].speed);
\r
154 animatePlayer(pip, player, pn, 0);
\r
155 if(!pageflipflop) modexShowPage(pip[1].page);
\r
157 } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; }
\r
161 if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 24, 32);
\r
163 PBUFSFUN(pip[0].page, player[pn].x, player[pn].y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATA);
\r
165 modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 9);
\r
167 if(!pageflipflop) modexShowPage(pip[1].page);
\r
170 player[pn].triggerx = player[pn].tx;
\r
171 player[pn].triggery = player[pn].ty+1;
\r
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 &&
\r
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!
\r
179 if(player[pn].q<=player[pn].spt)
\r
182 animatePlayer(pip, player, pn, 1);
\r
183 ScrollUp(pip, player, 3, pn);
\r
184 ScrollUp(pip, player, 2, pn);
\r
185 mapScrollUp(pip, player, !(pip[0].video->p), pn);
\r
186 mapScrollUp(pip, player, (pip[0].video->p), pn);
\r
187 if(!pageflipflop) modexShowPage(pip[1].page);
\r
189 //0000pip[0].video->clk = ((*clockw)-pip[0].video->startclk)/18.2;
\r
190 } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; }
\r
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))
\r
194 if(player[pn].q<=player[pn].spt)
\r
197 player[pn].y-=(player[pn].speed);
\r
198 animatePlayer(pip, player, 0, pn);
\r
199 if(!pageflipflop) modexShowPage(pip[1].page);
\r
201 } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; }
\r
205 if(!pageflipflop) modexCopyPageRegion(pip[1].page, pip[0].page, player[pn].x, player[pn].y-TILEWH, player[pn].x, player[pn].y-TILEWH, 24, 32);
\r
207 PBUFSFUN(pip[0].page, player[pn].x, player[pn].y-TILEWH, 24, 0, 24, 32, PLAYERBMPDATA);
\r
209 modexClearRegion(pip[1].page, player[pn].x, player[pn].y-TILEWH, 24, 32, 12);
\r
211 if(!pageflipflop) modexShowPage(pip[1].page);
\r
214 player[pn].triggerx = player[pn].tx;
\r
215 player[pn].triggery = player[pn].ty-1;
\r
221 void panpagemanual(map_view_t *pip, player_t *player, word pn)
\r
223 switch(player[pn].d)
\r
227 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)
\r
229 if(player[pn].q<=player[pn].spt)
\r
231 pip[pip[0].pan->pn].page->dx+=4;
\r
232 modexShowPage(pip[pip[0].pan->pn].page);
\r
234 } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; }
\r
240 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)
\r
242 if(player[pn].q<=player[pn].spt)
\r
244 pip[pip[0].pan->pn].page->dx-=4;
\r
245 modexShowPage(pip[pip[0].pan->pn].page);
\r
247 } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; }
\r
253 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)
\r
255 if(player[pn].q<=player[pn].spt)
\r
257 pip[pip[0].pan->pn].page->dy+=4;
\r
258 modexShowPage(pip[pip[0].pan->pn].page);
\r
260 } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; }
\r
266 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)
\r
268 if(player[pn].q<=player[pn].spt)
\r
270 pip[pip[0].pan->pn].page->dy-=4;
\r
271 modexShowPage(pip[pip[0].pan->pn].page);
\r
273 } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; }
\r
277 //if (player[pn].d!=2) printf("player[%u].d=%u player[%u].q=%u\n", pn, player[pn].d, pn, player[pn].q);
\r
281 allocMap(int w, int h) {
\r
286 result.data = malloc(sizeof(byte) * w * h);
\r
287 //result.data = (byte *)alloc_emem(((int)sizeof(byte) * w * h)/1024);
\r
288 if(isEMS() || checkEMS())
\r
291 //emmhandle = mallocEMS(coretotalEMS());//alloc_emem((int)sizeof(map))
\r
292 mm.length=sizeof(result);
\r
294 mm.sourceOff=ptr2long(&result);
\r
295 mm.destH=emmhandle;
\r
297 ist = move_emem(&mm);
\r
298 if(!ist){ dealloc_emem(emmhandle); exit(5); }
\r
299 printf("%d\n", coretotalEMS());
\r
306 initMap(map_t *map) {
\r
307 // just a place holder to fill out an alternating pattern
\r
311 //if(!isEMS() || !checkEMS())
\r
312 // map->tiles = malloc(sizeof(tiles_t));
\r
314 // map->tiles = (tiles_t *)alloc_emem(sizeof(tiles_t));
\r
316 //create the tile set
\r
317 //if(!isEMS() || !checkEMS())
\r
318 // map->tiles->data = malloc(sizeof(bitmap_t));
\r
320 // map->tiles->data = (bitmap_t *)alloc_emem(sizeof(bitmap_t));
\r
321 // map->tiles->data->width = (TILEWH);
\r
322 // map->tiles->data->height= TILEWH;
\r
323 //if(!isEMS() || !checkEMS())
\r
324 // map->tiles->data->data = malloc((TILEWH*2)*TILEWH);
\r
326 // map->tiles->data->data = (byte *)alloc_emem((TILEWH*2)*TILEWH);
\r
327 // map->tiles->tileHeight = TILEWH;
\r
328 // map->tiles->tileWidth =TILEWH;
\r
329 // map->tiles->rows = 1;
\r
330 // map->tiles->cols = 1;//2;
\r
333 //for(y=0; y<map->height; y++) {
\r
334 //for(x=0; x<map->width; x++) {
\r
336 for(yy=0; yy<TILEWH; yy++) {
\r
337 for(xx=0; xx<(TILEWH); xx++) {
\r
339 map->tiles->data->data[i+1] = map->data[q];//28;//0x24;
\r
340 // printf("[%d]", map->tiles->data->data[i]);
\r
342 //map->tiles->data->data[i] = map->data[q];//0;//0x34;
\r
343 //printf("]%d[==[%d]", i, map->tiles->data->data[i]);
\r
349 // printf("[%d]", map->data[q]);
\r
356 for(y=0; y<map->height; y++) {
\r
357 for(x=0; x<map->width; x++) {
\r
358 // map->data[i]=255;
\r
359 printf("[%d]", map->data[i]);
\r
360 //tile = tile ? 0 : 1;
\r
363 //tile = tile ? 0 : 1;
\r
367 void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid)
\r
369 word x;//, y; /* coordinate for drawing */
\r
371 /* increment the pixel position and update the page */
\r
372 mv[id].page->dx += player[plid].speed;
\r
374 /* check to see if this changes the tile */
\r
375 if(mv[id].page->dx >= mv[id].dxThresh )
\r
377 /* go forward one tile */
\r
379 /* Snap the origin forward */
\r
380 mv[id].page->data += 4;
\r
382 mv[id].page->dx = mv[id].map->tiles->tileWidth;
\r
385 /* draw the next column */
\r
386 x= mv[0].page->sw + mv[id].map->tiles->tileWidth;
\r
387 if(player[plid].q%4)
\r
389 mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tw, mv[0].ty-1, x, player, mv->page->dx);
\r
391 if(!pageflipflop && !pageploop)
\r
392 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));
\r
397 void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid)
\r
399 word x;//,y; /* coordinate for drawing */
\r
401 /* decrement the pixel position and update the page */
\r
402 mv[id].page->dx -= player[plid].speed;
\r
404 /* check to see if this changes the tile */
\r
405 if(mv[id].page->dx == 0)
\r
407 /* go backward one tile */
\r
409 /* Snap the origin backward */
\r
410 mv[id].page->data -= 4;
\r
412 mv[id].page->dx = mv[id].map->tiles->tileWidth;
\r
415 /* draw the next column */
\r
417 if(player[plid].q%4)
\r
419 mapDrawCol(&mv[0], mv[0].tx - 1, mv[0].ty-1, x, player, mv->page->dx);
\r
421 if(!pageflipflop && !pageploop)
\r
422 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));
\r
427 void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid)
\r
429 word y;//x, /* coordinate for drawing */
\r
431 /* decrement the pixel position and update the page */
\r
432 mv[id].page->dy -= player[plid].speed;
\r
434 /* check to see if this changes the tile */
\r
435 if(mv[id].page->dy == 0 )
\r
437 /* go down one tile */
\r
439 /* Snap the origin downward */
\r
440 mv[id].page->data -= mv[id].page->pi;
\r
442 mv[id].page->dy = mv[id].map->tiles->tileHeight;
\r
445 /* draw the next row */
\r
447 if(player[plid].q%3)
\r
449 mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty-1, y, player, mv->page->dy);
\r
451 if(!pageflipflop && !pageploop)
\r
452 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);
\r
456 void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid)
\r
458 word y;//x, /* coordinate for drawing */
\r
460 /* increment the pixel position and update the page */
\r
461 mv[id].page->dy += player[plid].speed;
\r
463 /* check to see if this changes the tile */
\r
464 if(mv[id].page->dy >= mv[id].dyThresh )
\r
466 /* go down one tile */
\r
468 /* Snap the origin downward */
\r
469 mv[id].page->data += mv[id].page->pi;
\r
471 mv[id].page->dy = mv[id].map->tiles->tileHeight;
\r
474 /* draw the next row */
\r
475 y= mv[0].page->sh + mv[id].map->tiles->tileHeight;
\r
476 if(player[plid].q%3)
\r
478 mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->th, y, player, mv->page->dy);
\r
480 if(!pageflipflop && !pageploop)
\r
481 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);
\r
486 //TODO finish this wwww
\r
487 void near ScrollRight(map_view_t *mv, player_t *player, word id, word plid)
\r
489 /* increment the pixel position and update the page */
\r
490 mv[id].page->dx += player[plid].speed;
\r
492 /* check to see if this changes the tile */
\r
493 if(mv[id].page->dx >= mv[0].dxThresh )
\r
495 // vga_setup_wm1_block_copy();
\r
496 // _fmemmove(mv[id].page->data+4, mv[id].page->data, mv[id].page->pagesize);
\r
497 // vga_restore_rm0wm0();
\r
498 /* Snap the origin forward */
\r
499 mv[id].page->data += 4;
\r
500 mv[id].page->dx = mv[0].map->tiles->tileWidth;
\r
504 void near ScrollLeft(map_view_t *mv, player_t *player, word id, word plid)
\r
506 /* decrement the pixel position and update the page */
\r
507 mv[id].page->dx -= player[plid].speed;
\r
509 /* check to see if this changes the tile */
\r
510 if(mv[id].page->dx == 0)
\r
512 // vga_setup_wm1_block_copy();
\r
513 // _fmemmove(mv[id].page->data-4, mv[id].page->data, mv[id].page->pagesize);
\r
514 // vga_restore_rm0wm0();
\r
515 /* Snap the origin backward */
\r
516 mv[id].page->data -= 4;
\r
517 mv[id].page->dx = mv[0].map->tiles->tileWidth;
\r
521 void near ScrollUp(map_view_t *mv, player_t *player, word id, word plid)
\r
523 /* decrement the pixel position and update the page */
\r
524 mv[id].page->dy -= player[plid].speed;
\r
526 /* check to see if this changes the tile */
\r
527 if(mv[id].page->dy == 0)
\r
529 // vga_setup_wm1_block_copy();
\r
530 // _fmemmove(mv[id].page->data-mv[id].page->pi, mv[id].page->data, mv[id].page->pagesize);
\r
531 // vga_restore_rm0wm0();
\r
532 /* Snap the origin backward */
\r
533 mv[id].page->data -= mv[id].page->pi;
\r
534 mv[id].page->dy = mv[0].map->tiles->tileWidth;
\r
538 void near ScrollDown(map_view_t *mv, player_t *player, word id, word plid)
\r
540 /* increment the pixel position and update the page */
\r
541 mv[id].page->dy += player[plid].speed;
\r
543 /* check to see if this changes the tile */
\r
544 if(mv[id].page->dy >= mv[0].dxThresh )
\r
546 // vga_setup_wm1_block_copy();
\r
547 // _fmemmove(mv[id].page->data+mv[id].page->pi, mv[id].page->data, mv[id].page->pagesize);
\r
548 // vga_restore_rm0wm0();
\r
549 /* Snap the origin forward */
\r
550 mv[id].page->data += mv[id].page->pi;
\r
551 mv[id].page->dy = mv[0].map->tiles->tileWidth;
\r
555 sword chkmap(map_t *map, word q)
\r
558 static byte x[(MAPW*MAPH)+1] =
\r
559 { 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, 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 1, 1, 1, 3, 3, 3, 3, 1, 2, 3, 4 };*/
\r
575 //check for failed to load map
\r
576 if((map->width == map->height == 0) && (q>0))
\r
578 //initiate a null map!
\r
579 map->width=MAPW;///2;
\r
580 map->height=MAPH;///2;
\r
581 // map->data = malloc(((map->width*map->height)+1)*sizeof(byte));
\r
583 map->tiles = malloc(sizeof(tiles_t));
\r
584 //fix this to be far~
\r
585 // bp = bitmapLoadPcx("data/ed.pcx");
\r
586 // map->tiles->data = &bp;
\r
587 map->tiles->debug_data = map->data;
\r
588 map->tiles->tileHeight = 16;
\r
589 map->tiles->tileWidth = 16;
\r
590 map->tiles->rows = 1;
\r
591 map->tiles->cols = 1;
\r
592 map->tiles->debug_text = true;
\r
594 else map->tiles->debug_text = false;
\r
598 //TODO: player position here
\r
599 void mapGoTo(map_view_t *mv, int tx, int ty)
\r
604 /* set up the coordinates */
\r
605 mv[0].tx = mv[1].tx = tx;
\r
606 mv[0].ty = mv[1].ty = ty;
\r
607 mv[0].page->dx = mv[1].page->dx = mv[2].page->dx = mv[3].page->dx = mv->map->tiles->tileWidth;
\r
608 mv[0].page->dy = mv[1].page->dy = mv[2].page->dy = mv[3].page->dy = mv->map->tiles->tileHeight;
\r
610 /* set up the thresholds */
\r
611 mv[0].dxThresh = mv[1].dxThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileWidth * 2;
\r
612 mv[0].dyThresh = mv[1].dyThresh = mv[2].dxThresh = mv[3].dxThresh = mv->map->tiles->tileHeight * 2;
\r
614 /* draw the tiles */
\r
615 modexClearRegion(mv[0].page, 0, 0, mv[0].page->width, mv[0].page->height, 0);
\r
617 i=mv[0].ty * mv[0].map->width + mv[0].tx;
\r
618 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) {
\r
619 mapDrawWRow(&mv[0], tx-1, ty, py);
\r
620 i+=mv->map->width - tx;
\r
622 if(!pageploop) modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height);
\r
624 // unsigned int k,j,o;
\r
625 // /* fill screen with a distinctive pattern */
\r
626 // for (k=0;k < vga_state.vga_width;k++) {
\r
628 // vga_write_sequencer(0x02/*map mask*/,1 << (k&3));
\r
629 // 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)
\r
630 // vga_state.vga_graphics_ram[o] = (k^j)&15; // VRL samples put all colors in first 15!
\r
633 modexCopyPageRegion(mv[3].page, mv[0].page, 0/**/, 0/**/, 0, 0, 24, 32);
\r
637 mapDrawTile(tiles_t *t, word i, page_t *page, word x, word y)
\r
641 //word textx=0, texty=0;
\r
646 modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, 0); //currently the over scan color!
\r
650 rx = (((i-1) % ((t->data->width)/t->tileWidth)) * t->tileWidth);
\r
651 ry = (((i-1) / ((t->data->height)/t->tileHeight)) * t->tileHeight);
\r
652 ////0000printf("i=%d\n", i);
\r
653 switch(t->debug_text)
\r
657 modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, ((t->debug_data[i])+1));
\r
658 //modexprint(page, x, y, 1, 15, 0, (char const *)(t->debug_data[i]));
\r
660 PBUFBFUN (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data));
\r
661 /* then the sprite. note modding ram ptr means we just draw to (x&3,0) */
\r
662 //draw_vrl1_vgax_modex(x-rx,y-ry,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));
\r
663 //modexDrawBmpRegion (page, x, y, rx, ry, t->tileWidth, t->tileHeight, (t->data));
\r
667 modexClearRegion(page, x, y, t->tileWidth, t->tileHeight, (t->debug_data[i])+1);
\r
668 //modexprintbig(page, x, y, 1, 15, 0, (t->debug_data));
\r
669 /*for(texty=0; texty<2; texty++)
\r
671 for(textx=0; textx<2; textx++)
\r
673 // modexprint(page, x+(textx*8), y+(texty*8), 1, (word)(t->debug_data), 0, (t->debug_data));
\r
681 void near mapDrawRow(map_view_t *mv, int tx, int ty, word y, player_t *p, word poopoffset)
\r
685 poopoffset%=p[0].speed;
\r
686 //printf("y: %d\n", poopoffset);
\r
687 /* the position within the map array */
\r
688 i=ty * mv->map->width + tx;
\r
689 for(x=poopoffset; x<(mv->page->sw+mv->dxThresh)/(poopoffset+1) && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) {
\r
691 /* we are in the map, so copy! */
\r
692 mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y);
\r
698 void near mapDrawCol(map_view_t *mv, int tx, int ty, word x, player_t *p, word poopoffset)
\r
702 poopoffset%=p[0].speed;
\r
703 //printf("x: %d\n", poopoffset);
\r
704 /* location in the map array */
\r
705 i=ty * mv->map->width + tx;
\r
707 /* We'll copy all of the columns in the screen,
\r
708 i + 1 row above and one below */
\r
709 for(y=poopoffset; y<(mv->page->sh+mv->dyThresh)/(poopoffset+1) && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) {
\r
711 /* we are in the map, so copy away! */
\r
712 mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y);
\r
714 i += mv->map->width;
\r
718 void mapDrawWRow(map_view_t *mv, int tx, int ty, word y)
\r
723 /* the position within the map array */
\r
724 i=ty * mv->map->width + tx;
\r
725 for(x=0; x<mv->page->sw+mv->dxThresh && tx < mv->map->width; x+=mv->map->tiles->tileWidth, tx++) {
\r
727 /* we are in the map, so copy! */
\r
728 mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y);
\r
734 void mapDrawWCol(map_view_t *mv, int tx, int ty, word x)
\r
739 /* location in the map array */
\r
740 i=ty * mv->map->width + tx;
\r
742 /* We'll copy all of the columns in the screen,
\r
743 i + 1 row above and one below */
\r
744 for(y=0; y<mv->page->sh+mv->dyThresh && ty < mv->map->height; y+=mv->map->tiles->tileHeight, ty++) {
\r
746 /* we are in the map, so copy away! */
\r
747 mapDrawTile(mv->map->tiles, mv->map->data[i], mv->page, x, y);
\r
749 i += mv->map->width;
\r
758 unsigned char shinku_fps_indicator_page = 2;
\r
759 boolean pageflipflop = 1;
\r
760 boolean pageploop = 1;
\r
763 void shinku(global_game_variables_t *gv)
\r
765 word x = (0) + gv->video.page[/*!*/(gv->video.p)].dx; // follow the screen
\r
766 word y = (0) + gv->video.page[/*!*/(gv->video.p)].dy; // follow the screen
\r
767 word col = 7, bgcol = 0, type = 1;//w = 64, h = 8,
\r
769 //modexCopyPageRegion(pip[1].page, pip[2].page, 16, 16, 16, 16, (14*8)+4, 8+4);
\r
770 /* block copy to visible RAM from offscreen */
\r
771 // vga_setup_wm1_block_copy();
\r
772 // modexCopyPageRegion(&(gv->video.page[shinku_fps_indicator_page]), &(gv->video.page[!shinku_fps_indicator_page]), x, y, x+w, 0, w, h);
\r
773 // o = *(gv->video.page[2].data); // source offscreen
\r
774 // o2 = *(gv->video.page[shinku_fps_indicator_page].data)+(y * vga_state.vga_stride) + (x >> 2); // dest visible (original stride)
\r
775 // 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);
\r
776 /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */
\r
777 // vga_restore_rm0wm0();
\r
778 if(elapsed_timer(gv) >= (1.0 / gv->kurokku.frames_per_second))
\r
780 // NTS: For some bizarre reason, gv->pee is not initialized, but the pointer is not NULL even
\r
781 // though it should be. Instead it's NULL as a near pointer but contains a non-null
\r
782 // segment value, so testing against NULL doesn't work. It is initialized properly if
\r
783 // you call start_timer() though which uses near malloc. Rather than fight with that,
\r
784 // I decided it would be better to declare a temp buffer statically and sprintf to that.
\r
786 // This fixes *** Null pointer assignment detected error message in ZCROLL.EXE on exit.
\r
787 sprintf(global_temp_status_text, "%.0f fps", (double)gv->kurokku.tiku/ticktock(gv));
\r
788 //modexClearRegion(&(gv->video.page[shinku_fps_indicator_page]), x, y, w, h, 45);
\r
789 modexprint(&(gv->video.page[/*!*/(gv->video.p)]), x, y, type, col, bgcol, global_temp_status_text);
\r
790 gv->kurokku.tiku=0;
\r
791 /* block copy to visible RAM from offscreen */
\r
792 // vga_setup_wm1_block_copy();
\r
793 // o = *(gv->video.page[shinku_fps_indicator_page].data); // source offscreen
\r
794 // o2 = *(gv->video.page[2].data)+(y * vga_state.vga_stride) + (x >> 2); // dest visible (original stride)
\r
795 // 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);
\r
796 // modexCopyPageRegion(&(gv->video.page[shinku_fps_indicator_page]), &(gv->video.page[!shinku_fps_indicator_page]), x, y, x, 0, w, h);
\r
797 /* must restore Write Mode 0/Read Mode 0 for this code to continue drawing normally */
\r
798 // vga_restore_rm0wm0();
\r
799 }else //copy dat sheet
\r
800 gv->kurokku.tiku++;
\r
802 switch(gv->kurokku.fpscap)
\r
805 //modexprint(&(gv->video.page[shinku_fps_indicator_page]), x, y+8, type, col, bgcol, "sanic!");
\r
806 gv->kurokku.frames_per_second=1;
\r
809 //turn this off if XT
\r
810 //modexWaitBorder();
\r
811 vga_wait_for_vsync();
\r
812 gv->kurokku.frames_per_second=60;
\r
817 //vga_setup_wm1_block_copy();
\r
818 //_fmemcpy((gv->video.page[(gv->video.p)]).data, (gv->video.page[(!gv->video.p)]).data, gv->video.page[(!gv->video.p)].pagesize);
\r
819 //vga_restore_rm0wm0();
\r
820 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);
\r
821 modexShowPage(&(gv->video.page[gv->video.p]));
\r
822 if(!pageploop) gv->video.p=!gv->video.p;
\r
823 gv->video.r=!gv->video.r;
\r
824 //0000gv->video.tickclk = ((*clockw)-gv->video.startclk)/18.2;
\r
829 void near animatePlayer(map_view_t *pip, player_t *player, word pn, sword scrollswitch)
\r
831 sword x = player[pn].x;
\r
832 sword y = player[pn].y;
\r
833 sword bx = x+16; //buffer's x
\r
834 sword by = y+16; //buffer's y
\r
835 word dire=32; //direction
\r
836 sword qq; //scroll offset
\r
837 word ls = player[pn].persist_aniframe;
\r
839 switch(scrollswitch)
\r
845 qq = ((player[pn].q)*(player[pn].speed));
\r
849 y-=pip[0].map->tiles->tileHeight;
\r
850 switch (player[pn].d)
\r
854 dire*=player[pn].d;
\r
860 dire*=(player[pn].d-2);
\r
868 dire*=(player[pn].d-2);
\r
874 dire*=(player[pn].d+2);
\r
881 #define FRAME1 PBUFSFUN(pip[/*!*/(pip->video->p)].page, x, y, 48, dire, 24, 32, PLAYERBMPDATA);
\r
882 #define FRAME2 PBUFSFUN(pip[/*!*/(pip->video->p)].page, x, y, 24, dire, 24, 32, PLAYERBMPDATA);
\r
883 #define FRAME3 PBUFSFUN(pip[/*!*/(pip->video->p)].page, x, y, 0, dire, 24, 32, PLAYERBMPDATA);
\r
884 #define FRAME4 PBUFSFUN(pip[/*!*/(pip->video->p)].page, x, y, 24, dire, 24, 32, PLAYERBMPDATA);
\r
886 #define FRAME1 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 2+dire);
\r
887 #define FRAME2 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 1+dire);
\r
888 #define FRAME3 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, dire);
\r
889 #define FRAME4 modexClearRegion(pip[/*!*/(pip->video->p)].page, x, y, 24, 32, 1+dire);
\r
892 modexCopyPageRegion(pip[1].page, pip[0].page, x-4, y-4, x-4, y-4, 28, 36);
\r
894 //copy old bg to page0
\r
895 //modexCopyPageRegion(pip[3].page, pip[0].page, bx, by, 0, 0, 20, 36);
\r
897 //modexCopyPageRegion(pip[0].page, pip[3].page, 0, 0, x, y, 20, 36);
\r
899 //modexCopyPageRegion(page_t *dest, page_t *src, word sx, word sy, word dx, word dy, word width, word height);
\r
900 //modexCopyPageRegion(pip[3].page, pip[!(pip->video->p)].page, x-4, y-4, 0, 128, 28, 36);
\r
901 /*modexCopyPageRegion(pip[pip->video->p].page,
\r
902 pip[!(pip->video->p)].page, x-4, y-4, x-4, y-4, 28, 36);*/
\r
903 // else modexCopyPageRegion(pip[1].page, pip[0].page, x-4, y-4, x-4, y-4, 28, 40);
\r
919 // if(2>ls && ls>=1) { FRAME1 }else
\r
920 // if(3>ls && ls>=2) { FRAME2 }else
\r
921 // if(4>ls && ls>=3) { FRAME3 }else
\r
922 // if(5>ls && ls>=4) { FRAME4 }
\r
923 //modexCopyPageRegion(pip[0].page, pip[3].page, 0, 0, x, y, 24, 32);
\r
924 //printf("x=%d y=%d bx=%d by=%d\n", x, y, bx, by);
\r
932 boolean boundary_check(int x, int y, int dx, int dy, int h, int w)
\r
934 return (dx > 0 && (x + dx) < w) || (dx < 0 && (x + dx) >= 0) || (dy > 0 && (y + dy) < h) || (dy < 0 && (y + dy) >= 0) || (dx == dy && dx == 0);
\r
937 boolean coll_check(int x, int y, int dx, int dy, map_view_t *map_v)
\r
939 // Assume everything crosses at most 1 tile at once
\r
940 return dx && 1;//crossable_tile(x + dx, map_v) || dy && crossable_tile(y + dy, map_v);
\r
943 boolean ZC_walk(entity_t *ent, map_view_t *map_v)
\r
963 if(coll_check(ent->x, ent->y, dx, dy, map_v))
\r
968 // Mark next tile as occupied
\r
969 // Mark this tile as vacant
\r
975 void player_walk(player_t *player, map_view_t *map_v){
\r
977 if(ZC_walk(player->ent, map_v) && boundary_check(map_v->tx, map_v->ty, dx, dy, map_v->map->width - 2*map_v->page->tilesw, map_v->map->height - 2*map_v->page->tilesh))
\r
979 mapScroll(map_v, player);
\r
984 void near mapScroll(map_view_t *mv, player_t *player)
\r
986 //word x, y; /* coordinate for drawing */
\r
989 mv->delta += player->dx | player->dy;
\r
991 mv->d = (player->dx) ? (player->dx > 0) ? 3 : 1 : (player->dy) ? (player->dy > 0) ? 4 : 0 : 2;
\r
997 if(!(delta + mv->dxThresh))
\r
1007 if(!(delta + mv->dyThresh))
\r