]> 4ch.mooo.com Git - 16.git/commitdiff
panning needs to be finished i am about to CRASH wwwwwwwwwwwwwwwwwww
authorsparky4 <sparky4@cock.li>
Fri, 29 Apr 2016 20:58:56 +0000 (15:58 -0500)
committersparky4 <sparky4@cock.li>
Fri, 29 Apr 2016 20:58:56 +0000 (15:58 -0500)
SCROLL.16L
src/lib/16_in.c
src/lib/modex16.c
src/lib/scroll16.c
src/lib/scroll16.h
src/lib/typdefst.h
src/scroll.c

index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..671f9c4b4af5bd83c852f66dfb9f9605cf0fa86a 100755 (executable)
@@ -0,0 +1,35 @@
+starting timer ok\r
+index=4096\r
+chkmap ok      \r
+\r
+       1st vmem_remain=262144\r
+               [0], video->page[i].pagesize=95744\r
+               [0], vmem_remain=166400\r
+               [1], video->page[i].pagesize=95744\r
+               [1], vmem_remain=70656\r
+               [2], video->page[i].pagesize=70400\r
+               [2], vmem_remain=256\r
+               [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
+Virtual Screen: 352x272\r
+Screen: 320x240\r
+tile resolution: 15x15 middle tile position: 10x8\r
+video memory remaining: 0\r
+page   [0]=(a000:0000)\r
+       [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
+\r
+\r
+detected CPU type: 386 or newer\r
index 5bccecafde8529eb59983c6a1674d35a2a92f877..f4a66213f0dfa7ec47eb9242dc38573ebfbb9585 100755 (executable)
@@ -1297,4 +1297,6 @@ void IN_initplayer(player_t *player, word pn)
        player[pn].q=1;\r
        player[pn].d=2;\r
        player[pn].hp=4;\r
+       player[pn].speed=4;\r
+       player[pn].persist_aniframe=0;\r
 }\r
index 8b7bf8c487ff283239e251a77f868eeb01281e9c..c6bb04fdac450d71ae7a28c6bbfb52c0cd8d3db1 100755 (executable)
@@ -193,7 +193,7 @@ page_t
 modexNextPage(page_t *p) {\r
     page_t result;\r
 \r
-    result.data = p->data + (p->width/4)*p->height;\r
+    result.data = p->data + (byte)(p->width/4)*p->height;\r
     result.dx = 0;\r
     result.dy = 0;\r
     result.width = p->width;\r
@@ -212,7 +212,7 @@ modexNextPageFlexibleSize(page_t *p, word x, word y)
 {\r
        page_t result;\r
 \r
-       result.data = p->data + (p->width/4)*p->height;  /* compute the offset */\r
+       result.data = p->data + (byte)(p->width/4)*p->height;  /* compute the offset */\r
        result.dx = 0;\r
        result.dy = 0;\r
        result.width = x;\r
index 509f97430c1b16d00783eb43e918a4fb6f8c00f4..a56de644c1e4cc9f8553cc25fc278314bb8509a0 100755 (executable)
@@ -204,6 +204,73 @@ 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(player[pn].q<=(TILEWH/(player[pn].speed)))
+                               {
+                                       INC_PER_FRAME;
+                                       pip[pip[0].pan->pagenum].page->dx++;
+                                       modexShowPage(pip[pip[0].pan->pagenum].page);
+                                       player[pn].q++;
+                               } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pagenum].tx++; }
+                       }
+               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(player[pn].q<=(TILEWH/(player[pn].speed)))
+                               {
+                                       INC_PER_FRAME;
+                                       pip[pip[0].pan->pagenum].page->dx--;
+                                       modexShowPage(pip[pip[0].pan->pagenum].page);
+                                       player[pn].q++;
+                               } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pagenum].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(player[pn].q<=(TILEWH/(player[pn].speed)))
+                               {
+                                       INC_PER_FRAME;
+                                       pip[pip[0].pan->pagenum].page->dy++;
+                                       modexShowPage(pip[pip[0].pan->pagenum].page);
+                                       player[pn].q++;
+                               } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pagenum].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(player[pn].q<=(TILEWH/(player[pn].speed)))
+                               {
+                                       INC_PER_FRAME;
+                                       pip[pip[0].pan->pagenum].page->dy--;
+                                       modexShowPage(pip[pip[0].pan->pagenum].page);
+                                       player[pn].q++;
+                               } else { player[pn].q = 1; player[pn].d = 2; pip[pip[0].pan->pagenum].ty--; }
+                       }
+                       break;
+       }
+}
+
 /*map_t
 allocMap(int w, int h) {
        map_t result;
index 67e094554719e54f60dff10c4139ed0ea1c5efb1..669237b47e92803a1c07910639a3bab2b4ced065 100755 (executable)
@@ -52,7 +52,8 @@ typedef struct {
        int ty; //appears to be the top left tile position on the viewable screen map
        word dxThresh; //????
        word dyThresh; //????
-       video_t *video;
+       video_t *video; //pointer to game variables of the video
+       pan_t *pan;             //pointer the the page panning debug system
 } map_view_t;
 
 typedef struct
@@ -69,6 +70,7 @@ extern boolean pageflipflop;
 //map_t allocMap(int w, int h);
 //void initMap(map_t *map);
 void walk(map_view_t *pip, player_t *player, word pn);
+void panpagemanual(map_view_t *pip,  player_t *player, word pn);
 void near mapScrollRight(map_view_t *mv, player_t *player, word id, word plid);
 void near mapScrollLeft(map_view_t *mv, player_t *player, word id, word plid);
 void near mapScrollUp(map_view_t *mv, player_t *player, word id, word plid);
index 8eff787f4a318dab454bb087864ec21b80a250cc..bd6dfd6fa0b556995422e56838aef850ffac91f8 100755 (executable)
@@ -36,6 +36,8 @@
 #define AAMAGENTA      "\x1b[45;35m"\r
 #define AARESET        "\x1b[0m"\r
 \r
+#define MAXPAGE 4\r
+\r
 /*\r
  * typedefs of the game variables!\r
  */\r
@@ -100,7 +102,10 @@ typedef struct
        boolean fpscap; //cap the fps var\r
 } kurokku_t;\r
 \r
-#define MAXPAGE 4\r
+typedef struct\r
+{\r
+       word    pagenum;\r
+} pan_t;\r
 \r
 typedef struct\r
 {\r
index 30433ef77041cd2e6d48bb6ec66a65f9871f7265..982f4b5133ae93ae884bebc5acaa947d7db75e1a 100755 (executable)
@@ -39,9 +39,8 @@ word pn=0;
 static planar_buf_t huge *pp;
 float t;
 sword bakapee;
-
-//     word panswitch=0, panq=1, pand=0;
-       word panpagenum=0; //for panning!
+pan_t pan;
+boolean panswitch=1;
        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 */
@@ -84,8 +83,7 @@ void main(int argc, char *argv[])
                return;
        }
 
-       player[0].persist_aniframe=0;
-       player[0].speed=4;
+       pan.pagenum=0;
        //player[0].data = &pp;
 
        printf("starting timer  ");
@@ -120,6 +118,7 @@ void main(int argc, char *argv[])
        /*      input!  */
        IN_Startup();
        IN_Default(0,&player,ctrl_Joystick);
+       IN_Default(1,&player,ctrl_Joystick);
 
        /* save the palette */
 #ifdef MODEX
@@ -166,6 +165,7 @@ void main(int argc, char *argv[])
                mv[i].page = &gvar.video.page[i];
                mv[i].map = &map;
                mv[i].video = &gvar.video;
+               mv[i].pan       = &pan;
        }
 
        /* set up paging */
@@ -177,6 +177,7 @@ void main(int argc, char *argv[])
        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);
 #ifndef        SPRITE
@@ -197,129 +198,22 @@ void main(int argc, char *argv[])
        while(!IN_KeyDown(sc_Escape) && player[0].hp>0)
        {
                shinku(&gvar);
-               IN_ReadControl(0,&player);
        //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
 
        //player movement
-       //if(!panswitch){
+       if(!panswitch){
+               IN_ReadControl(0,&player);
                walk(mv, player, 0);
-       /*}else{
-//88 switch!
-       //right movement
-       if((IN_KeyDown(77) && !IN_KeyDown(75) && pand == 0) || pand == 2)
-       {
-               if(pand == 0){ pand = 2; }
-                       if(panq<=(TILEWH/(player[0].speed)))
-                       {
-                               switch(panpagenum)
-                               {
-                                       case 0:
-                                               //bg
-                                               mv[0].page->dx++;
-                                               modexShowPage(mv[0].page);
-                                       break;
-                                       case 1:
-                                               //spri
-                                               mv[1].page->dx++;
-                                               modexShowPage(mv[1].page);
-                                       break;
-                                       case 2:
-                                               //fg
-                                               mv[2].page->dx++;
-                                               modexShowPage(mv[2].page);
-                                       break;
-                               }
-                               panq++;
-                       } else { panq = 1; pand = 0; }
-       }
-       //left movement
-       if((IN_KeyDown(75) && !IN_KeyDown(77) && pand == 0) || pand == 4)
-       {
-               if(pand == 0){ pand = 4; }
-                       if(panq<=(TILEWH/(player[0].speed)))
-                       {
-                               switch(panpagenum)
-                               {
-                                       case 0:
-                                               //bg
-                                               mv[0].page->dx--;
-                                               modexShowPage(mv[0].page);
-                                       break;
-                                       case 1:
-                                               //spri
-                                               mv[1].page->dx--;
-                                               modexShowPage(mv[1].page);
-                                       break;
-                                       case 2:
-                                               //fg
-                                               mv[2].page->dx--;
-                                               modexShowPage(mv[2].page);
-                                       break;
-                               }
-                               panq++;
-                       } else { panq = 1; pand = 0; }
+       }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);
        }
-       //down movement
-       if((IN_KeyDown(72) && !IN_KeyDown(80) && pand == 0) || pand == 3)
-       {
-               if(pand == 0){ pand = 3; }
-                       if(panq<=(TILEWH/(player[0].speed)))
-                       {
-                               switch(panpagenum)
-                               {
-                                       case 0:
-                                               //bg
-                                               mv[0].page->dy--;
-                                               modexShowPage(mv[0].page);
-                                       break;
-                                       case 1:
-                                               //spri
-                                               mv[1].page->dy--;
-                                               modexShowPage(mv[1].page);
-                                       break;
-                                       case 2:
-                                               //fg
-                                               mv[2].page->dy--;
-                                               modexShowPage(mv[2].page);
-                                       break;
-                               }
-                               panq++;
-                       } else { panq = 1; pand = 0; }
-       }
-       //up movement
-       if((IN_KeyDown(80) && !IN_KeyDown(72) && pand == 0) || pand == 1)
-       {
-               if(pand == 0){ pand = 1; }
-                       if(panq<=(TILEWH/(player[0].speed)))
-                       {
-                               switch(panpagenum)
-                               {
-                                       case 0:
-                                               //bg
-                                               mv[0].page->dy++;
-                                               modexShowPage(mv[0].page);
-                                       break;
-                                       case 1:
-                                               //spri
-                                               mv[1].page->dy++;
-                                               modexShowPage(mv[1].page);
-                                       break;
-                                       case 2:
-                                               //fg
-                                               mv[2].page->dy++;
-                                               modexShowPage(mv[2].page);
-                                       break;
-                               }
-                               panq++;
-                       } else { panq = 1; pand = 0; }
-       }
-}*/
-
 
-       //the scripting stuf....
 
+       //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))
        {
@@ -333,9 +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); panpagenum=0; }
-       if(IN_KeyDown(3)){ modexShowPage(mv[1].page); panpagenum=1; }
-       if(IN_KeyDown(4)){ modexShowPage(mv[2].page); panpagenum=2; }
+       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(25)){ modexpdump(mv[0].page); modexpdump(mv[1].page);
                //IN_Ack();
        }       //p
@@ -351,7 +246,7 @@ void main(int argc, char *argv[])
 #endif
 #endif
        //pan switch
-       //if(IN_KeyDown(88)){if(!panswitch) panswitch++; else panswitch--; }    //f12
+       if(IN_KeyDown(88)){panswitch=!panswitch;}       //f12
        //TSR
        if(IN_KeyDown(87))      //f11
        {
@@ -365,18 +260,18 @@ void main(int argc, char *argv[])
 //                     int 21h
 //             }
        }
-       if(IN_KeyDown(88))      //s
+       if(IN_KeyDown(68))      //s
        {
                gvar.kurokku.fpscap=!gvar.kurokku.fpscap;
                //IN_Ack();
        }
        //TODO fmemtest into page
-       if(IN_KeyDown(4+1))     //4
+       /*if(IN_KeyDown(4+1))   //4
        {
                pg=1;
                SELECT_ALL_PLANES();
                _fmemset(((mv[pg].page->data+4)+(16*(mv[pg].page->width/4))), 15, 4);
-       }
+       }*/
 
        //9
        if(IN_KeyDown(10)){ modexPalOverscan(default_pal, rand()%56); modexPalUpdate1(default_pal); }
@@ -404,7 +299,7 @@ void main(int argc, char *argv[])
        //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\n", player[0].d);
+       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("palette offset: %d\n", paloffset/3);
@@ -417,14 +312,14 @@ void main(int argc, char *argv[])
        printf("tile resolution: %dx", gvar.video.page[0].tilesh);      printf("%d ", gvar.video.page[0].tilesh);
        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("\npage ");
+       printf("page ");
        for(i=0; i<gvar.video.num_of_pages;i++)
        {
-               printf("[%u]=", i);
+               printf("        [%u]=", i);
                printf("(%Fp)\n", (gvar.video.page[i].data));
-               //printf("(%Fp)=", *(gvar.video.page[i].data));
-               //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("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);