From: sparky4 Date: Mon, 2 May 2016 20:42:13 +0000 (-0500) Subject: panning updated and stuff wwww X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=51714bd13b5cec5a5eb3ac5aa6091162924cacb0;p=16.git panning updated and stuff wwww --- diff --git a/SCROLL.16L b/SCROLL.16L index 671f9c4b..18608461 100755 --- a/SCROLL.16L +++ b/SCROLL.16L @@ -12,14 +12,14 @@ chkmap ok [3], video->page[i].pagesize=256 [3], vmem_remain=0 Project 16 scroll.exe. This is just a test file! -version Apr 29 2016 15:57:39 -tx: -1 -ty: 14 -player[0].x: 160 player[0].y: 128 -player[0].tx: 10 player[0].ty: 8 -player[0].triggx: 10 player[0].triggy: 9 -player[0].hp: 4 player[0].q: 1 player[0].info.dir: 0 player[0].d: 2 pdir=0 -tile data value at player trigger position: 0 +version May 2 2016 15:12:18 +tx: -16 +ty: -1 +player.x: 144 player.y: 112 +player.tx: 9 player.ty: 7 +player.triggx: 9 player.triggy: 8 +player.hp: 4 player.q: 1 player.info.dir: 2 player.d: 1 pdir=1 +tile data value at player trigger position: 1 Virtual Screen: 352x272 Screen: 320x240 tile resolution: 15x15 middle tile position: 10x8 @@ -28,8 +28,7 @@ page [0]=(a000:0000) [1]=(a000:5d80) [2]=(a000:bb00) [3]=(a000:ffc0) -mv[0].tx: -1 mv[0].ty: 14 -player[1].q: 1 player[1].d: 2 +mv[0].tx: -16 mv[0].ty: -1 detected CPU type: 386 or newer diff --git a/src/lib/modex16.c b/src/lib/modex16.c index c6bb04fd..97870192 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -148,11 +148,13 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv) } break; } - gv->video.page[0].tilesw = gv->video.page[0].sw/TILEWH; - gv->video.page[0].tilesh = gv->video.page[0].sh/TILEWH; + +// gv->video.page[0].tw = gv->video.page[0].sw/TILEWH; +// gv->video.page[0].th = gv->video.page[0].sh/TILEWH; + //TODO MAKE FLEXIBLE~ - gv->video.page[0].tilemidposscreenx = gv->video.page[0].tilesw; - gv->video.page[0].tilemidposscreeny = (gv->video.page[0].tilesh/2)+1; +// gv->video.page[0].tilemidposscreenx = gv->video.page[0].tilesw; +// gv->video.page[0].tilemidposscreeny = (gv->video.page[0].tilesh/2)+1; } void @@ -176,10 +178,10 @@ modexDefaultPage(page_t *p) page.height = p->sh+TILEWHD; page.tw = page.sw/TILEWH; page.th = page.sh/TILEWH; + page.tilesw=page.width/TILEWH; + page.tilesh=page.height/TILEWH; page.tilemidposscreenx = page.tw/2; page.tilemidposscreeny = (page.th/2)+1; - page.tilesw=p->tilesw; - page.tilesh=p->tilesh; page.pagesize = (sdiword)page.width*page.height; page.id = 0; @@ -198,8 +200,10 @@ modexNextPage(page_t *p) { result.dy = 0; result.width = p->width; result.height = p->height; - result.tw = p->width/TILEWH; - result.th = p->height/TILEWH; + result.tw = p->tw; + result.th = p->th; + result.tilesw = p->tilesw; + result.tilesh = p->tilesh; result.id = p->id+1; result.pagesize = p->pagesize; @@ -217,8 +221,10 @@ modexNextPageFlexibleSize(page_t *p, word x, word y) result.dy = 0; result.width = x; result.height = y; - result.tw = p->width/TILEWH; - result.th = p->height/TILEWH; + result.tw = result.sw/TILEWH; + result.th = result.sh/TILEWH; + result.tilesw=result.width/TILEWH; + result.tilesh=result.height/TILEWH; result.id = p->id+1; result.pagesize = (sdiword)result.width*result.height; diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 6282480a..6aec0827 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -204,63 +204,64 @@ void walk(map_view_t *pip, player_t *player, word pn) } } +//panning page void panpagemanual(map_view_t *pip, player_t *player, word pn) { switch(player[pn].d) { //right movement case 3: - if(pip[pip[0].pan->pn].tx >= -TILEWH && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tilesw < pip[pip[0].pan->pn].map->width+TILEWH) + if(pip[pip[0].pan->pn].tx >= -1 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tilesw < pip[pip[0].pan->pn].page->tilesw+1) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page->dx++; + pip[pip[0].pan->pn].page->dx+=4; modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; }//pip[pip[0].pan->pn].tx++; } + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx++; } } - printf("player[pn].d=%u player[pn].q=%u\n", player[pn].d, player[pn].q); break; //left movement case 1: - if(pip[pip[0].pan->pn].tx > -TILEWH && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tilesw <= pip[pip[0].pan->pn].map->width+TILEWH) + if(pip[pip[0].pan->pn].tx > -1 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tilesw <= pip[pip[0].pan->pn].page->tilesw+1) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page->dx--; + pip[pip[0].pan->pn].page->dx-=4; modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; }//pip[pip[0].pan->pn].tx--; } + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].tx--; } } break; //down movement case 4: - if(pip[pip[0].pan->pn].ty >= -TILEWH && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->tilesh < pip[pip[0].pan->pn].map->height+TILEWH) + if(pip[pip[0].pan->pn].ty >= -1 && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->tilesh < pip[pip[0].pan->pn].page->tilesh+1) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page->dy++; + pip[pip[0].pan->pn].page->dy+=4; modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; }//pip[pip[0].pan->pn].ty++; } + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty++; } } break; //up movement case 0: - if(pip[pip[0].pan->pn].ty > -TILEWH && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->tilesh <= pip[pip[0].pan->pn].map->height+TILEWH) + if(pip[pip[0].pan->pn].ty > -1 && pip[pip[0].pan->pn].ty+pip[pip[0].pan->pn].page->tilesh <= pip[pip[0].pan->pn].page->tilesh+1) { if(player[pn].q<=player[pn].spt) { - pip[pip[0].pan->pn].page->dy--; + pip[pip[0].pan->pn].page->dy-=4; modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; }//pip[pip[0].pan->pn].ty--; } + } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pn].ty--; } } break; } + //if (player[pn].d!=2) printf("player[%u].d=%u player[%u].q=%u\n", pn, player[pn].d, pn, player[pn].q); } /*map_t diff --git a/src/scroll.c b/src/scroll.c index 407a05ee..79c3732d 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -170,21 +170,21 @@ void main(int argc, char *argv[]) /* set up paging */ //TODO: LOAD map data and position the map in the middle of the screen if smaller then screen - mapGoTo(&mv[0], 0, 0); - mapGoTo(&mv[1], 0, 0); + mapGoTo(&mv[0], -1, -1); + mapGoTo(&mv[1], -1, -1); //TODO: put player in starting position of spot //default player position on the viewable map - player[0].tx = mv[0].tx + mv[0].page->tilemidposscreenx; - player[0].ty = mv[0].ty + mv[0].page->tilemidposscreeny; + player[panswitch].tx = mv[0].tx + mv[0].page->tilemidposscreenx; + player[panswitch].ty = mv[0].ty + mv[0].page->tilemidposscreeny; IN_initplayer(&player, 0); IN_initplayer(&player, 1); modexCopyPageRegion(mv[1].page, mv[0].page, 0, 0, 0, 0, mv[0].page->width, mv[0].page->height); #ifndef SPRITE - modexClearRegion(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 32, 15); + modexClearRegion(mv[1].page, player[panswitch].x-4, player[panswitch].y-TILEWH, 24, 32, 15); #else - //PBUFSFUN(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATA); - PBUFSFUN(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, &pp); + //PBUFSFUN(mv[1].page, player[panswitch].x-4, player[panswitch].y-TILEWH, 24, 64, 24, 32, PLAYERBMPDATA); + PBUFSFUN(mv[1].page, player[panswitch].x-4, player[panswitch].y-TILEWH, 24, 64, 24, 32, &pp); #endif modexShowPage(mv[1].page); @@ -195,27 +195,26 @@ void main(int argc, char *argv[]) modexFadeOn(4, gpal); #endif #endif - while(!IN_KeyDown(sc_Escape) && player[0].hp>0) + while(!IN_KeyDown(sc_Escape) && player[panswitch].hp>0) { shinku(&gvar); //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[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 + //when player[panswitch].tx or player[panswitch].ty == 0 or player[panswitch].tx == 20 or player[panswitch].ty == 15 then stop because that is edge of map and you do not want to walk of the map //player movement + IN_ReadControl(panswitch,&player); if(!panswitch){ - IN_ReadControl(0,&player); - walk(mv, player, 0); + walk(mv, player, panswitch); }else{ - IN_ReadControl(1,&player); - panpagemanual(mv, player, 1); - //printf(" player[1].q: %d", player[1].q); printf(" player[1].d: %d\n", player[1].d); + panpagemanual(mv, player, panswitch); + //printf(" player[panswitch].q: %d", player[panswitch].q); printf(" player[panswitch].d: %d\n", player[panswitch].d); } //the scripting stuff.... - //if(((player[0].triggerx == TRIGGX && player[0].triggery == TRIGGY) && IN_KeyDown(0x1C))||(player[0].tx == 5 && player[0].ty == 5)) - 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)) + //if(((player[panswitch].triggerx == TRIGGX && player[panswitch].triggery == TRIGGY) && IN_KeyDown(0x1C))||(player[panswitch].tx == 5 && player[panswitch].ty == 5)) + if(((mv[panswitch].map->data[(player[panswitch].triggerx-1)+(map.width*(player[panswitch].triggery-1))] == 0) && IN_KeyDown(0x1C))||(player[panswitch].tx == 5 && player[panswitch].ty == 5)) { short i; for(i=800; i>=400; i--) @@ -224,7 +223,7 @@ void main(int argc, char *argv[]) } nosound(); } - 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--; } + if(player[panswitch].q == (TILEWH/(player[panswitch].speed))+1 && player[panswitch].info.dir != 2 && (player[panswitch].triggerx == 5 && player[panswitch].triggery == 5)){ player[panswitch].hp--; } //debugging binds! //if(IN_KeyDown(0x0E)) while(1){ if(xmsmalloc(24)) break; } if(IN_KeyDown(2)){ modexShowPage(mv[0].page); pan.pn=0; } @@ -238,7 +237,7 @@ void main(int argc, char *argv[]) #ifdef FADE if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; modexpdump(mv[0].page); modexpdump(mv[1].page); } if(IN_KeyDown(22)){ - paloffset=0; modexPalBlack(); modexPalUpdate(&player[0].data, &paloffset, 0, 0); + paloffset=0; modexPalBlack(); modexPalUpdate(&player[panswitch].data, &paloffset, 0, 0); printf("1paloffset = %d\n", paloffset/3); modexPalUpdate(map.tiles->data, &paloffset, 0, 0); printf("2paloffset = %d\n", paloffset/3); @@ -276,7 +275,7 @@ void main(int argc, char *argv[]) //9 if(IN_KeyDown(10)){ modexPalOverscan(default_pal, rand()%56); modexPalUpdate1(default_pal); } //if(IN_KeyDown(11)){ modexPalOverscan(default_pal, 15); } - if((player[0].q==1) && !(player[0].x%TILEWH==0 && player[0].y%TILEWH==0)) break; //incase things go out of sync! + if((player[panswitch].q==1) && !(player[panswitch].x%TILEWH==0 && player[panswitch].y%TILEWH==0)) break; //incase things go out of sync! } /* fade back to text mode */ @@ -294,14 +293,14 @@ void main(int argc, char *argv[]) printf("version %s\n", VERSION); printf("tx: %d\n", mv[0].tx); printf("ty: %d\n", mv[0].ty); - printf("player[0].x: %d", player[0].x); printf(" player[0].y: %d\n", player[0].y); + printf("player.x: %d", player[panswitch].x); printf(" player.y: %d\n", player[panswitch].y); //if(player[0].hp==0) printf("%d wwww\n", player[0].y+8); //else printf("\nplayer[0].y: %d\n", player[0].y); - printf("player[0].tx: %d", player[0].tx); printf(" player[0].ty: %d\n", player[0].ty); - printf("player[0].triggx: %d", player[0].triggerx); printf(" player[0].triggy: %d\n", player[0].triggery); - printf("player[0].hp: %d", (player[0].hp)); printf(" player[0].q: %d", player[0].q); printf(" player[0].info.dir: %d", player[0].info.dir); printf(" player[0].d: %d ", player[0].d); - printf("pdir=%d\n", player[0].pdir); - printf("tile data value at player trigger position: %d\n", mv[0].map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))]); + printf("player.tx: %d", player[panswitch].tx); printf(" player.ty: %d\n", player[panswitch].ty); + printf("player.triggx: %d", player[panswitch].triggerx); printf(" player.triggy: %d\n", player[panswitch].triggery); + printf("player.hp: %d", (player[panswitch].hp)); printf(" player.q: %d", player[panswitch].q); printf(" player.info.dir: %d", player[panswitch].info.dir); printf(" player.d: %d ", player[panswitch].d); + printf("pdir=%d\n", player[panswitch].pdir); + printf("tile data value at player trigger position: %d\n", mv[0].map->data[(player[panswitch].triggerx-1)+(map.width*(player[panswitch].triggery-1))]); // printf("palette offset: %d\n", paloffset/3); //++++ printf("Total used: %zu\n", oldfreemem-GetFreeSize()); //++++ printf("Total free: %zu\n", GetFreeSize()); @@ -309,7 +308,8 @@ void main(int argc, char *argv[]) //not used now printf("temporary player sprite 1: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44606385\n"); printf("Virtual Screen: %dx", gvar.video.page[0].width); printf("%d\n", gvar.video.page[0].height); printf("Screen: %dx", gvar.video.page[0].sw); printf("%d\n", gvar.video.page[0].sh); - printf("tile resolution: %dx", gvar.video.page[0].tilesh); printf("%d ", gvar.video.page[0].tilesh); + printf("virtual tile resolution: %dx", gvar.video.page[0].tilesw); printf("%d\n", gvar.video.page[0].tilesh); + printf("tile resolution: %dx", gvar.video.page[0].tw); printf("%d \n", gvar.video.page[0].th); printf("middle tile position: %dx", gvar.video.page[0].tilemidposscreenx); printf("%d\n", gvar.video.page[0].tilemidposscreeny); printf("video memory remaining: %ld\n", gvar.video.vmem_remain); printf("page "); @@ -319,7 +319,7 @@ void main(int argc, char *argv[]) printf("(%Fp)\n", (gvar.video.page[i].data)); } printf("mv[%u].tx: %d", pan.pn, mv[pan.pn].tx); printf(" mv[%u].ty: %d\n", pan.pn, mv[pan.pn].ty); - printf("player[1].q: %d", player[1].q); printf(" player[1].d: %d\n", player[1].d); + //printf("player[1].q: %d", player[1].q); printf(" player[1].d: %d\n", player[1].d); printf("\n"); // printf("Screen2: %dx", gvar.video.page[1].width); printf("%d\n", gvar.video.page[1].height); // printf("map: %dx%d\n", map.width, map.height);