]> 4ch.mooo.com Git - 16.git/commitdiff
panning updated and stuff wwww
authorsparky4 <sparky4@cock.li>
Mon, 2 May 2016 20:42:13 +0000 (15:42 -0500)
committersparky4 <sparky4@cock.li>
Mon, 2 May 2016 20:42:13 +0000 (15:42 -0500)
SCROLL.16L
src/lib/modex16.c
src/lib/scroll16.c
src/scroll.c

index 671f9c4b4af5bd83c852f66dfb9f9605cf0fa86a..1860846115726ac639c2e3ac591ddf21f7e97d76 100755 (executable)
@@ -12,14 +12,14 @@ chkmap ok
                [3], video->page[i].pagesize=256\r
                [3], vmem_remain=0\r
 Project 16 scroll.exe. This is just a test file!\r
-version Apr 29 2016 15:57:39\r
-tx: -1\r
-ty: 14\r
-player[0].x: 160               player[0].y: 128\r
-player[0].tx: 10               player[0].ty: 8\r
-player[0].triggx: 10   player[0].triggy: 9\r
-player[0].hp: 4        player[0].q: 1  player[0].info.dir: 0   player[0].d: 2 pdir=0\r
-tile data value at player trigger position: 0\r
+version May  2 2016 15:12:18\r
+tx: -16\r
+ty: -1\r
+player.x: 144          player.y: 112\r
+player.tx: 9           player.ty: 7\r
+player.triggx: 9       player.triggy: 8\r
+player.hp: 4   player.q: 1     player.info.dir: 2      player.d: 1 pdir=1\r
+tile data value at player trigger position: 1\r
 Virtual Screen: 352x272\r
 Screen: 320x240\r
 tile resolution: 15x15 middle tile position: 10x8\r
@@ -28,8 +28,7 @@ page  [0]=(a000:0000)
        [1]=(a000:5d80)\r
        [2]=(a000:bb00)\r
        [3]=(a000:ffc0)\r
-mv[0].tx: -1   mv[0].ty: 14\r
-player[1].q: 1 player[1].d: 2\r
+mv[0].tx: -16  mv[0].ty: -1\r
 \r
 \r
 detected CPU type: 386 or newer\r
index c6bb04fdac450d71ae7a28c6bbfb52c0cd8d3db1..97870192fb8962f794f4bfdec984afb9ab86da50 100755 (executable)
@@ -148,11 +148,13 @@ void modexEnter(sword vq, boolean cmem, global_game_variables_t *gv)
                }\r
                break;\r
        }\r
-       gv->video.page[0].tilesw = gv->video.page[0].sw/TILEWH;\r
-       gv->video.page[0].tilesh = gv->video.page[0].sh/TILEWH;\r
+\r
+//     gv->video.page[0].tw = gv->video.page[0].sw/TILEWH;\r
+//     gv->video.page[0].th = gv->video.page[0].sh/TILEWH;\r
+\r
        //TODO MAKE FLEXIBLE~\r
-       gv->video.page[0].tilemidposscreenx = gv->video.page[0].tilesw;\r
-       gv->video.page[0].tilemidposscreeny = (gv->video.page[0].tilesh/2)+1;\r
+//     gv->video.page[0].tilemidposscreenx = gv->video.page[0].tilesw;\r
+//     gv->video.page[0].tilemidposscreeny = (gv->video.page[0].tilesh/2)+1;\r
 }\r
 \r
 void\r
@@ -176,10 +178,10 @@ modexDefaultPage(page_t *p)
        page.height = p->sh+TILEWHD;\r
        page.tw = page.sw/TILEWH;\r
        page.th = page.sh/TILEWH;\r
+       page.tilesw=page.width/TILEWH;\r
+       page.tilesh=page.height/TILEWH;\r
        page.tilemidposscreenx = page.tw/2;\r
        page.tilemidposscreeny = (page.th/2)+1;\r
-       page.tilesw=p->tilesw;\r
-       page.tilesh=p->tilesh;\r
        page.pagesize = (sdiword)page.width*page.height;\r
        page.id = 0;\r
 \r
@@ -198,8 +200,10 @@ modexNextPage(page_t *p) {
     result.dy = 0;\r
     result.width = p->width;\r
     result.height = p->height;\r
-       result.tw = p->width/TILEWH;\r
-       result.th = p->height/TILEWH;\r
+       result.tw = p->tw;\r
+       result.th = p->th;\r
+       result.tilesw = p->tilesw;\r
+       result.tilesh = p->tilesh;\r
        result.id = p->id+1;\r
        result.pagesize = p->pagesize;\r
 \r
@@ -217,8 +221,10 @@ modexNextPageFlexibleSize(page_t *p, word x, word y)
        result.dy = 0;\r
        result.width = x;\r
        result.height = y;\r
-       result.tw = p->width/TILEWH;\r
-       result.th = p->height/TILEWH;\r
+       result.tw = result.sw/TILEWH;\r
+       result.th = result.sh/TILEWH;\r
+       result.tilesw=result.width/TILEWH;\r
+       result.tilesh=result.height/TILEWH;\r
        result.id = p->id+1;\r
        result.pagesize = (sdiword)result.width*result.height;\r
 \r
index 6282480a254261494c1793fb182112bdfcffd8ea..6aec082756a5120bb9bdc83ccb2aade0250d24ab 100755 (executable)
@@ -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
index 407a05ee503446efcc785efaf198a38c4a4d53dc..79c3732d20f01d757130b44a6cc99222b6725ea5 100755 (executable)
@@ -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);