From 7477a345cbe3f5ee467e18f1a1020eff67e43ded Mon Sep 17 00:00:00 2001 From: sparky4 Date: Mon, 2 May 2016 16:27:24 -0500 Subject: [PATCH] panning updated and stuff wwww --- src/lib/scroll16.c | 24 ++++++++++++------------ src/scroll.c | 30 +++++++++++++++--------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index 9d372375..f9a23fc4 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -32,7 +32,7 @@ void walk(map_view_t *pip, player_t *player, word pn) //right movement case 3: //printf("pip[0].page->tilesw=%d\n", pip[0].page->tilesw); - 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 && + 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 && !(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<=player[pn].spt) @@ -75,7 +75,7 @@ void walk(map_view_t *pip, player_t *player, word pn) //left movement case 1: - 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 && + 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 && !(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<=player[pn].spt) @@ -118,7 +118,7 @@ void walk(map_view_t *pip, player_t *player, word pn) //down movement case 4: - 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 && + 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 && !(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<=player[pn].spt) @@ -161,7 +161,7 @@ void walk(map_view_t *pip, player_t *player, word pn) //up movement case 0: - 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 && + 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 && !(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<=player[pn].spt) @@ -211,7 +211,7 @@ void panpagemanual(map_view_t *pip, player_t *player, word pn) { //right movement case 3: - 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(pip[pip[0].pan->pn].tx >= -1 && pip[pip[0].pan->pn].tx+pip[pip[0].pan->pn].page->tw < pip[pip[0].pan->pn].page->tilesw+1) { if(player[pn].q<=player[pn].spt) { @@ -372,9 +372,9 @@ void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid) x= mv[0].page->sw + mv[id].map->tiles->tileWidth; if(player[plid].q%4) if(id==0) - mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tilesw, mv[0].ty-1, x, player, mv->page->dx); + mapDrawCol(&mv[0], mv[0].tx + mv[0].page->tw, mv[0].ty-1, x, player, mv->page->dx); else - modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->tilesh+2)); + 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)); //} } @@ -403,7 +403,7 @@ void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid) if(id==0) mapDrawCol(&mv[0], mv[0].tx - 1, mv[0].ty-1, x, player, mv->page->dx); else - modexCopyPageRegion(mv[id].page, mv[0].page, x, 0, x, 0, mv[id].map->tiles->tileWidth, mv[id].map->tiles->tileHeight*(mv[0].page->tilesh+2)); + 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)); //} } @@ -431,7 +431,7 @@ void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid) if(id==0) mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty-1, y, player, mv->page->dy); else - modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tilesw+2), mv[id].map->tiles->tileHeight); + 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); //} } @@ -456,9 +456,9 @@ void near mapScrollDown(map_view_t *mv, player_t *player, word id, word plid) y= mv[0].page->sh + mv[id].map->tiles->tileHeight; if(player[plid].q%3) if(id==0) - mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->tilesh, y, player, mv->page->dy); + mapDrawRow(&mv[0], mv[0].tx - 1, mv[0].ty+mv[0].page->th, y, player, mv->page->dy); else - modexCopyPageRegion(mv[id].page, mv[0].page, 0, y, 0, y, mv[id].map->tiles->tileWidth*(mv[0].page->tilesw+2), mv[id].map->tiles->tileHeight); + 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); //} } @@ -583,7 +583,7 @@ void mapGoTo(map_view_t *mv, int tx, int ty) mv->dyThresh = mv->map->tiles->tileHeight * 2; /* draw the tiles */ - modexClearRegion(mv->page, 0, 0, mv->page->width+mv->map->tiles->tileWidth, mv->page->height+mv->map->tiles->tileHeight, 0); + modexClearRegion(mv->page, 0, 0, mv->page->width, mv->page->height, 0); py=0; i=mv->ty * mv->map->width + mv->tx; for(ty=mv->ty-1; py < mv->page->sh+mv->dyThresh && ty < mv->map->height; ty++, py+=mv->map->tiles->tileHeight) { diff --git a/src/scroll.c b/src/scroll.c index e6eda6fa..40dc8fc2 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -40,7 +40,7 @@ static planar_buf_t huge *pp; float t; sword bakapee; pan_t pan; -boolean panswitch=1; +boolean panswitch=0; unsigned int i; const char *cpus; //static int persist_aniframe = 0; /* gonna be increased to 1 before being used, so 0 is ok for default */ @@ -175,38 +175,38 @@ void main(int argc, char *argv[]) //TODO: put player in starting position of spot //default player position on the viewable map - player[panswitch].tx = mv[0].tx + mv[0].page->tilemidposscreenx; - player[panswitch].ty = mv[0].ty + mv[0].page->tilemidposscreeny; + player[0].tx = mv[0].tx + mv[0].page->tilemidposscreenx; + player[0].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); + 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[panswitch].x-4, player[panswitch].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[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); + PBUFSFUN(mv[1].page, player[panswitch].x-4, player[panswitch].y-TILEWH, 24, 64, 24, 32, &pp); #endif - modexShowPage(mv[pan.pn].page); - shinku_fps_indicator_page = 0; // we're on page 1 now, shinku(). follow along please or it will not be visible. + modexShowPage(mv[1].page); + shinku_fps_indicator_page = 1; // we're on page 1 now, shinku(). follow along please or it will not be visible. //modexClearRegion(mv[2].page, 0, 0, mv[2].page->width, mv[2].page->height, 1); #ifdef MODEX #ifdef FADE modexFadeOn(4, gpal); #endif #endif - while(!IN_KeyDown(sc_Escape) && player[panswitch].hp>0) + while(!IN_KeyDown(sc_Escape) && player[0].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[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 + //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 //player movement IN_ReadControl(panswitch,&player); if(!panswitch){ - walk(mv, player, panswitch); + walk(mv, player, 0); }else{ panpagemanual(mv, player, pan.pn); //printf(" player[panswitch].q: %d", player[panswitch].q); printf(" player[panswitch].d: %d\n", player[panswitch].d); @@ -215,7 +215,7 @@ void main(int argc, char *argv[]) //the scripting stuff.... //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)) + 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)) { short i; for(i=800; i>=400; i--) @@ -224,7 +224,7 @@ void main(int argc, char *argv[]) } nosound(); } - 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--; } + 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.pn=0; } @@ -238,7 +238,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[panswitch].data, &paloffset, 0, 0); + paloffset=0; modexPalBlack(); modexPalUpdate(&player[0].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 +276,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[panswitch].q==1) && !(player[panswitch].x%TILEWH==0 && player[panswitch].y%TILEWH==0)) break; //incase things go out of sync! + if((player[0].q==1) && !(player[0].x%TILEWH==0 && player[0].y%TILEWH==0)) break; //incase things go out of sync! } /* fade back to text mode */ -- 2.39.5