+++ /dev/null
-include "src\lib\scroll.h"
-void main() {
- bitmap_t ptmp; // player sprite
- word q=1;
- const char *cpus;
- static int persist_aniframe = 0; /* gonna be increased to 1 before being used, so 0 is ok for default */
- page_t screen, screen2, screen3;
- map_t map;
- map_view_t mv, mv2, mv3;
- map_view_t *bg, *spri, *mask;//, *tmp;
- byte *ptr;
-
- /* create the map */
- map = allocMap(MAPX,MAPY); //20x15 is the resolution of the screen you can make maps smaller than 20x15 but the null space needs to be drawn properly
- initMap(&map);
- mv.map = ↦
- mv2.map = ↦
- mv3.map = ↦
-
- /* draw the tiles */
- ptr = map.data;
- /*data\\*/
- ptmp = bitmapLoadPcx("ptmp.pcx"); // load sprite
- setkb(1);
- modexEnter();
- modexPalUpdate(ptmp.palette);
- screen = modexDefaultPage();
- screen.width += (TILEWH*2);
- screen.height += (TILEWH*2)+QUADWH;
- mv.page = &screen;
- screen2 = modexNextPage(mv.page);
- mv2.page = &screen2;
- screen3 = screen2;
- mv3.page = &screen3;
-
- /* set up paging */
- bg = &mv;
- spri = &mv2;
- mask = &mv3;
-
-//TODO: LOAD map data and position the map in the middle of the screen if smaller then screen
- mapGoTo(bg, 0, 0);
- mapGoTo(spri, 0, 0);
- //mapGoTo(mask, 0, 0);
-
- //TODO: put player in starting position of spot
- //default player position on the viewable map
- player.tx = bg->tx + 10;
- player.ty = bg->ty + 8;
- player.x = player.tx*TILEWH;
- player.y = player.ty*TILEWH;
- player.triggerx = player.tx;
- player.triggery = player.ty+1;
- //TODO: erase player initial draw
- modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp);
- //temp draw trigger box
- modexClearRegion(spri->page, player.triggerx*16, player.triggery*16, 16, 16, 1);
- modexClearRegion(bg->page, player.triggerx*16, player.triggery*16, 16, 16, 1);
- modexShowPage(spri->page);
- while(!keyp(1))//!keyp(1))
- {
- //top left corner & bottem right corner of map veiw be set as map edge trigger since maps are actually square
- //to stop scrolling and have the player position data move to the edge of the screen with respect to the direction
- //when player.tx or player.ty == 0 or player.tx == 20 or player.ty == 15 then stop because that is edge of map and you do not want to walk of the map
-
- #define INC_PER_FRAME if(q&1) persist_aniframe++; if(persist_aniframe>4) persist_aniframe = 1;
-
- if(keyp(77) && !keyp(75))
- {
- if(bg->tx >= 0 && bg->tx+20 < MAPX && player.tx == bg->tx + 10 && !(player.tx+1 == TRIGGX && player.ty == TRIGGY))
- {
- for(q=1; q<=(TILEWH/SPEED); q++)
- {
- INC_PER_FRAME;
- //animatePlayer(bg, spri, mask, 1, 1, player.x, player.y, persist_aniframe, q, &ptmp);
- animatePlayer(bg, spri, 1, 1, player.x, player.y, persist_aniframe, q, &ptmp);
- mapScrollRight(bg, SPEED, q);
- mapScrollRight(spri, SPEED, q);
- //mapScrollRight(mask, SPEED);
- modexShowPage(spri->page);
- }
- player.tx++;
- }
- else if(player.tx < MAPX && !(player.tx+1 == TRIGGX && player.ty == TRIGGY))
- {
- for(q=1; q<=(TILEWH/SPEED); q++)
- {
- INC_PER_FRAME;
- player.x+=SPEED;
- //animatePlayer(bg, spri, mask, 1, 0, player.x, player.y, persist_aniframe, q, &ptmp);
- animatePlayer(bg, spri, 1, 0, player.x, player.y, persist_aniframe, q, &ptmp);
- modexShowPage(spri->page);
- }
- player.tx++;
- }
- else
- {
- modexCopyPageRegion(spri->page, bg->page, player.x-4, player.y-TILEWH, player.x-4, player.y-TILEWH, 24, 32);
- modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 32, 24, 32, &ptmp);
- modexShowPage(spri->page);
- }
- player.triggerx = player.tx+1;
- player.triggery = player.ty;
- }
-
- if(keyp(75) && !keyp(77))
- {
- if(bg->tx > 0 && bg->tx+20 <= MAPX && player.tx == bg->tx + 10 && !(player.tx-1 == TRIGGX && player.ty == TRIGGY))
- {
- for(q=1; q<=(TILEWH/SPEED); q++)
- {
- INC_PER_FRAME;
- //animatePlayer(bg, spri, mask, 3, 1, player.x, player.y, persist_aniframe, q, &ptmp);
- animatePlayer(bg, spri, 3, 1, player.x, player.y, persist_aniframe, q, &ptmp);
- mapScrollLeft(bg, SPEED, q);
- mapScrollLeft(spri, SPEED, q);
- //mapScrollLeft(mask, SPEED);
- modexShowPage(spri->page);
- }
- player.tx--;
- }
- else if(player.tx > 1 && !(player.tx-1 == TRIGGX && player.ty == TRIGGY))
- {
- for(q=1; q<=(TILEWH/SPEED); q++)
- {
- INC_PER_FRAME;
- player.x-=SPEED;
- //animatePlayer(bg, spri, mask, 3, 0, player.x, player.y, persist_aniframe, q, &ptmp);
- animatePlayer(bg, spri, 3, 0, player.x, player.y, persist_aniframe, q, &ptmp);
- modexShowPage(spri->page);
- }
- player.tx--;
- }
- else
- {
- modexCopyPageRegion(spri->page, bg->page, player.x-4, player.y-TILEWH, player.x-4, player.y-TILEWH, 24, 32);
- modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 96, 24, 32, &ptmp);
- modexShowPage(spri->page);
- }
- player.triggerx = player.tx-1;
- player.triggery = player.ty;
- }
-
- if(keyp(80) && !keyp(72))
- {
- if(bg->ty >= 0 && bg->ty+15 < MAPY && player.ty == bg->ty + 8 && !(player.tx == TRIGGX && player.ty+1 == TRIGGY))
- {
- for(q=1; q<=(TILEWH/SPEED); q++)
- {
- INC_PER_FRAME;
- //animatePlayer(bg, spri, mask, 2, 1, player.x, player.y, persist_aniframe, q, &ptmp);
- animatePlayer(bg, spri, 2, 1, player.x, player.y, persist_aniframe, q, &ptmp);
- mapScrollDown(bg, SPEED, q);
- mapScrollDown(spri, SPEED, q);
- //mapScrollDown(mask, SPEED);
- modexShowPage(spri->page);
- }
- player.ty++;
- }
- else if(player.ty < MAPY && !(player.tx == TRIGGX && player.ty+1 == TRIGGY))
- {
- for(q=1; q<=(TILEWH/SPEED); q++)
- {
- INC_PER_FRAME;
- player.y+=SPEED;
- //animatePlayer(bg, spri, mask, 2, 0, player.x, player.y, persist_aniframe, q, &ptmp);
- animatePlayer(bg, spri, 2, 0, player.x, player.y, persist_aniframe, q, &ptmp);
- modexShowPage(spri->page);
- }
- player.ty++;
- }
- else
- {
- modexCopyPageRegion(spri->page, bg->page, player.x-4, player.y-TILEWH, player.x-4, player.y-TILEWH, 24, 32);
- modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 64, 24, 32, &ptmp);
- modexShowPage(spri->page);
- }
- player.triggerx = player.tx;
- player.triggery = player.ty+1;
- }
-
- if(keyp(72) && !keyp(80))
- {
- if(bg->ty > 0 && bg->ty+15 <= MAPY && player.ty == bg->ty + 8 && !(player.tx == TRIGGX && player.ty-1 == TRIGGY))
- {
- for(q=1; q<=(TILEWH/SPEED); q++)
- {
- INC_PER_FRAME;
- //animatePlayer(bg, spri, mask, 0, 1, player.x, player.y, persist_aniframe, q, &ptmp);
- animatePlayer(bg, spri, 0, 1, player.x, player.y, persist_aniframe, q, &ptmp);
- mapScrollUp(bg, SPEED, q);
- mapScrollUp(spri, SPEED, q);
- //mapScrollUp(mask, SPEED);
- modexShowPage(spri->page);
- }
- player.ty--;
- }
- else if(player.ty > 1 && !(player.tx == TRIGGX && player.ty-1 == TRIGGY))
- {
- for(q=1; q<=(TILEWH/SPEED); q++)
- {
- INC_PER_FRAME;
- player.y-=SPEED;
- //animatePlayer(bg, spri, mask, 0, 0, player.x, player.y, persist_aniframe, q, &ptmp);
- modexShowPage(spri->page);
- animatePlayer(bg, spri, 0, 0, player.x, player.y, persist_aniframe, q, &ptmp);
- }
- player.ty--;
- }
- else
- {
- modexCopyPageRegion(spri->page, bg->page, player.x-4, player.y-TILEWH, player.x-4, player.y-TILEWH, 24, 32);
- modexDrawSpriteRegion(spri->page, player.x-4, player.y-TILEWH, 24, 0, 24, 32, &ptmp);
- modexShowPage(spri->page);
- }
- player.triggerx = player.tx;
- player.triggery = player.ty-1;
- }
- //modexClearRegion(mask->page, 66, 66, 2, 40, 0);
-
- if((player.triggerx == TRIGGX && player.triggery == TRIGGY) && keyp(KEY_ENTER))
- {
- short i;
- for(i=600; i>=400; i--)
- {
- sound(i);
- }
- nosound();
- }
- }
-
- modexLeave();
- setkb(0);
- printf("Project 16 scroll.exe\n");
- printf("tx: %d\n", bg->tx);
- printf("ty: %d\n", bg->ty);
- printf("player.x: %d\n", player.x);
- printf("player.y: %d\n", player.y);
- printf("player.tx: %d\n", player.tx);
- printf("player.ty: %d\n", player.ty);
- printf("player.triggx: %d\n", player.triggerx);
- printf("player.triggy: %d\n", player.triggery);
- printf("temporary player sprite 0: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45556867\n");
- printf("temporary player sprite 1: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44606385\n");
- printf("\n");
- switch(detectcpu())
- {
- case 0: cpus = "8086/8088 or 186/88"; break;
- case 1: cpus = "286"; break;
- case 2: cpus = "386 or newer"; break;
- default: cpus = "internal error"; break;
- }
- printf("detected CPU type: %s\n", cpus);
-}
openfiles: /dos/z/16/doc/project.txt:138:0:0:
openfiles: /dos/z/16/src/palettec.c:179:0:0:
openfiles: /dos/z/16/src/pcxtest.c:141:0:0:
-openfiles: /dos/z/16/src/scroll.c:6670:5844:0:
+openfiles: /dos/z/16/src/scroll.c:2181:1209:0:
openfiles: /dos/z/16/src/fmemtest.c:116:0:0:
openfiles: /dos/z/16/src/emmtest.c:439:0:0:
openfiles: /dos/z/16/src/emsdump.c:59:0:0:
-openfiles: /dos/z/16/src/maptest.c:62:0:0:
+openfiles: /dos/z/16/src/maptest.c:64:0:0:
openfiles: /dos/z/16/src/maptest0.c:366:0:0:
openfiles: /dos/z/16/src/test.c:0:0:0:
openfiles: /dos/z/16/src/test2.c:0:0:0:
-openfiles: /dos/z/16/src/lib/modex16.c:2760:2448:0:
+openfiles: /dos/z/16/src/lib/modex16.c:2759:2367:0:
openfiles: /dos/z/16/src/lib/modex16.h:1279:866:0:
openfiles: /dos/z/16/src/lib/planar.h:131:0:0:
openfiles: /dos/z/16/src/lib/PLANAR.C:0:0:0:
openfiles: /dos/z/16/src/lib/bitmap.c:1152:604:0:
openfiles: /dos/z/16/src/lib/bitmap.h:257:0:0:
-openfiles: /dos/z/16/src/lib/dos_kb.c:3264:2407:1:
+openfiles: /dos/z/16/src/lib/dos_kb.c:2857:2407:0:
openfiles: /dos/z/16/src/lib/dos_kb.h:0:0:0:
openfiles: /dos/z/16/src/lib/mapread.c:2265:1988:0:
openfiles: /dos/z/16/src/lib/mapread.h:585:0:0:
openfiles: /dos/z/16/src/lib/fmapread.c:5968:4541:0:
-openfiles: /dos/z/16/src/lib/fmapread.h:437:0:0:
+openfiles: /dos/z/16/src/lib/fmapread.h:240:0:0:
openfiles: /dos/z/16/src/lib/exmm/memory.c:308:99:0:
openfiles: /dos/z/16/src/lib/exmm/memory.h:0:0:0:
openfiles: /dos/z/16/src/lib/exmm/emmsize.h:0:0:0:
openfiles: /dos/z/16/src/lib/jsmn/farjsmn.c:7182:6673:0:
openfiles: /dos/z/16/src/lib/jsmn/farjsmn.h:861:381:0:
openfiles: /dos/z/16/src/lib/lib_head.c:0:0:0:
-openfiles: /dos/z/16/src/lib/lib_head.h:2786:1937:0:
-openfiles: /dos/z/16/makefile:2533:2399:0:
-openfiles: /dos/z/16/src/lib/types.h:274:0:0:
+openfiles: /dos/z/16/src/lib/lib_head.h:2786:1673:0:
+openfiles: /dos/z/16/makefile:2533:2173:0:
+openfiles: /dos/z/16/src/lib/types.h:528:0:0:
+openfiles: /dos/z/16/src/16.h:850:0:0:
+openfiles: /dos/z/16/src/16.c:854:0:1:
snr_recursion_level: 0
convertcolumn_horizontally: 0
adv_open_matchname: 0
default_mime_type: text/plain
e2c.convert_xml: 1
c2e.convert_iso: 0
-opendir: file:///dos/z/16/src
+opendir: file:///dos/z/16
wrap_text_default: 0
bookmarks_filename_mode: 1
ssearch_text: mapscrollr
recent_files: file:///dos/z/16/src/lib/exmm/x.bat
recent_files: file:///dos/z/16/src/lib/jsmn/jsmn.c
recent_files: file:///dos/z/16/src/lib/jsmn/jsmn.h
-recent_files: file:///dos/z/16/src/lib/modex16.c
recent_files: file:///dos/z/16/doc/project.txt
recent_files: file:///dos/z/16/src/palettec.c
recent_files: file:///dos/z/16/src/pcxtest.c
recent_files: file:///dos/z/16/src/lib/exmm/emmsize.h
recent_files: file:///dos/z/16/src/lib/lib_head.c
recent_files: file:///dos/z/16/src/scroll.c
+recent_files: file:///dos/z/16/src/lib/modex16.c
+recent_files: file:///dos/z/16/16.c
snr_replacetype: 0
savedir: file:///dos/z/16/src
spell_check_default: 1