From: sparky4 Date: Sat, 30 Apr 2016 01:07:28 +0000 (-0500) Subject: panning needs to be finished i am about to CRASH wwwwwwwwwwwwwwwwwww X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=80b3d6cc928bc94a01aa357bca85d077ec5fba2f;p=16.git panning needs to be finished i am about to CRASH wwwwwwwwwwwwwwwwwww --- diff --git a/src/lib/16_in.c b/src/lib/16_in.c index f4a66213..3c16d32a 100755 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -1299,4 +1299,5 @@ void IN_initplayer(player_t *player, word pn) player[pn].hp=4; player[pn].speed=4; player[pn].persist_aniframe=0; + player[pn].spt=(TILEWH/(player[pn].speed)); //speed per tile wwww } diff --git a/src/lib/16_in.h b/src/lib/16_in.h index 78ebd805..9ac30e81 100755 --- a/src/lib/16_in.h +++ b/src/lib/16_in.h @@ -225,6 +225,7 @@ typedef struct byte near pdir; //previous direction~ //byte near kd[2]; //array of arrow key pressed word speed; //player speed! + word spt; //speed per tile //0000 planar_buf_t huge *data; //supposively the sprite sheet data // planar_buf_t data; //supposively the sprite sheet data ////0000---- diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index a56de644..6282480a 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -35,7 +35,7 @@ void walk(map_view_t *pip, player_t *player, word pn) if(pip[0].tx >= 0 && pip[0].tx+pip[0].page->tilesw < pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && !(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! { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); @@ -49,7 +49,7 @@ void walk(map_view_t *pip, player_t *player, word pn) } 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)) { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; player[pn].x+=(player[pn].speed); @@ -78,7 +78,7 @@ void walk(map_view_t *pip, player_t *player, word pn) if(pip[0].tx > 0 && pip[0].tx+pip[0].page->tilesw <= pip[0].map->width && player[pn].tx == pip[0].tx+pip[0].page->tilemidposscreenx && !(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! { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); @@ -92,7 +92,7 @@ void walk(map_view_t *pip, player_t *player, word pn) } 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)) { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; player[pn].x-=(player[pn].speed); @@ -121,7 +121,7 @@ void walk(map_view_t *pip, player_t *player, word pn) if(pip[0].ty >= 0 && pip[0].ty+pip[0].page->tilesh < pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && !(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! { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); @@ -135,7 +135,7 @@ void walk(map_view_t *pip, player_t *player, word pn) } 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)) { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; player[pn].y+=(player[pn].speed); @@ -164,7 +164,7 @@ void walk(map_view_t *pip, player_t *player, word pn) if(pip[0].ty > 0 && pip[0].ty+pip[0].page->tilesh <= pip[0].map->height && player[pn].ty == pip[0].ty+pip[0].page->tilemidposscreeny && !(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! { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; animatePlayer(pip, player, pn, 1); @@ -178,7 +178,7 @@ void walk(map_view_t *pip, player_t *player, word pn) } 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)) { - if(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { INC_PER_FRAME; player[pn].y-=(player[pn].speed); @@ -206,66 +206,58 @@ void walk(map_view_t *pip, player_t *player, word pn) void panpagemanual(map_view_t *pip, player_t *player, word pn) { - #define INC_PER_FRAME if(player[pn].q&1) player[pn].persist_aniframe++; if(player[pn].persist_aniframe>4) player[pn].persist_aniframe = 1; switch(player[pn].d) { //right movement case 3: - if(pip[pip[0].pan->pagenum].tx >= -1 && pip[pip[0].pan->pagenum].tx+pip[pip[0].pan->pagenum].page->tilesw < pip[pip[0].pan->pagenum].map->width+1) - //!(pip[0].map->data[(pip[0].pan->tx)+(pip[0].map->width*(pip[0].pan->ty-1))] == 0)) + 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(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { - INC_PER_FRAME; - pip[pip[0].pan->pagenum].page->dx++; - modexShowPage(pip[pip[0].pan->pagenum].page); + pip[pip[0].pan->pn].page->dx++; + modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pagenum].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->pagenum].tx > -1 && pip[pip[0].pan->pagenum].tx+pip[pip[0].pan->pagenum].page->tilesw <= pip[pip[0].pan->pagenum].map->width+1) - //!(pip[0].map->data[(pip[0].pan->tx-2)+(pip[0].map->width*(pip[0].pan->ty-1))] == 0)) + 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(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { - INC_PER_FRAME; - pip[pip[0].pan->pagenum].page->dx--; - modexShowPage(pip[pip[0].pan->pagenum].page); + pip[pip[0].pan->pn].page->dx--; + modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pagenum].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->pagenum].ty >= -1 && pip[pip[0].pan->pagenum].ty+pip[pip[0].pan->pagenum].page->tilesh < pip[pip[0].pan->pagenum].map->height+1) - //!(pip[0].map->data[(pip[0].pan->tx-1)+(pip[0].map->width*(pip[0].pan->ty))] == 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(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { - INC_PER_FRAME; - pip[pip[0].pan->pagenum].page->dy++; - modexShowPage(pip[pip[0].pan->pagenum].page); + pip[pip[0].pan->pn].page->dy++; + modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pagenum].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->pagenum].ty > -1 && pip[pip[0].pan->pagenum].ty+pip[pip[0].pan->pagenum].page->tilesh <= pip[pip[0].pan->pagenum].map->height+1) - //!(pip[0].map->data[(pip[0].pan->tx-1)+(pip[0].map->width*(pip[0].pan->ty-2))] == 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(player[pn].q<=(TILEWH/(player[pn].speed))) + if(player[pn].q<=player[pn].spt) { - INC_PER_FRAME; - pip[pip[0].pan->pagenum].page->dy--; - modexShowPage(pip[pip[0].pan->pagenum].page); + pip[pip[0].pan->pn].page->dy--; + modexShowPage(pip[pip[0].pan->pn].page); player[pn].q++; - } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pagenum].ty--; } + } else { player[pn].q = 1; player[pn].d = 2; }//pip[pip[0].pan->pn].ty--; } } break; } diff --git a/src/lib/typdefst.h b/src/lib/typdefst.h index bd6dfd6f..732053c1 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -104,7 +104,7 @@ typedef struct typedef struct { - word pagenum; + word pn; } pan_t; typedef struct @@ -113,7 +113,7 @@ typedef struct page_t page[MAXPAGE]; //pointer to root page[0] sdiword vmem_remain; //remaining video memory byte num_of_pages; //number of actual pages - boolean p; //render page number + boolean __near p; //render page number word pr[MAXPAGE][4]; //render sections of pages } video_t; diff --git a/src/scroll.c b/src/scroll.c index 982f4b51..407a05ee 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -83,7 +83,7 @@ void main(int argc, char *argv[]) return; } - pan.pagenum=0; + pan.pn=0; //player[0].data = &pp; printf("starting timer "); @@ -227,10 +227,10 @@ void main(int argc, char *argv[]) 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--; } //debugging binds! //if(IN_KeyDown(0x0E)) while(1){ if(xmsmalloc(24)) break; } - if(IN_KeyDown(2)){ modexShowPage(mv[0].page); pan.pagenum=0; } - if(IN_KeyDown(3)){ modexShowPage(mv[1].page); pan.pagenum=1; } - //if(IN_KeyDown(4)){ modexShowPage(mv[2].page); pan.pagenum=2; } - //if(IN_KeyDown(4+1)){ modexShowPage(mv[3].page); pan.pagenum=3; } + if(IN_KeyDown(2)){ modexShowPage(mv[0].page); pan.pn=0; } + if(IN_KeyDown(3)){ modexShowPage(mv[1].page); pan.pn=1; } + //if(IN_KeyDown(4)){ modexShowPage(mv[2].page); pan.pn=2; } + //if(IN_KeyDown(4+1)){ modexShowPage(mv[3].page); pan.pn=3; } if(IN_KeyDown(25)){ modexpdump(mv[0].page); modexpdump(mv[1].page); //IN_Ack(); } //p @@ -318,7 +318,7 @@ void main(int argc, char *argv[]) printf(" [%u]=", i); printf("(%Fp)\n", (gvar.video.page[i].data)); } - printf("mv[%u].tx: %d", pan.pagenum, mv[pan.pagenum].tx); printf(" mv[%u].ty: %d\n", pan.pagenum, mv[pan.pagenum].ty); + 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("\n"); // printf("Screen2: %dx", gvar.video.page[1].width); printf("%d\n", gvar.video.page[1].height);