]> 4ch.mooo.com Git - 16.git/commitdiff
panning needs to be finished i am about to CRASH wwwwwwwwwwwwwwwwwww
authorsparky4 <sparky4@cock.li>
Sat, 30 Apr 2016 01:07:28 +0000 (20:07 -0500)
committersparky4 <sparky4@cock.li>
Sat, 30 Apr 2016 01:07:28 +0000 (20:07 -0500)
src/lib/16_in.c
src/lib/16_in.h
src/lib/scroll16.c
src/lib/typdefst.h
src/scroll.c

index f4a66213f0dfa7ec47eb9242dc38573ebfbb9585..3c16d32a24f8f4db202d9f884631c9be56155250 100755 (executable)
@@ -1299,4 +1299,5 @@ void IN_initplayer(player_t *player, word pn)
        player[pn].hp=4;\r
        player[pn].speed=4;\r
        player[pn].persist_aniframe=0;\r
+       player[pn].spt=(TILEWH/(player[pn].speed));     //speed per tile wwww\r
 }\r
index 78ebd8053db4bec143f7dc2995773c0712fd92db..9ac30e81504be1640a845aa48668105bf218da4c 100755 (executable)
@@ -225,6 +225,7 @@ typedef     struct
        byte near pdir; //previous direction~\r
        //byte near kd[2];      //array of arrow key pressed\r
        word speed;             //player speed!\r
+       word spt;               //speed per tile\r
 //0000 planar_buf_t huge *data; //supposively the sprite sheet data\r
 //     planar_buf_t data; //supposively the sprite sheet data\r
 ////0000----\r
index a56de644c1e4cc9f8553cc25fc278314bb8509a0..6282480a254261494c1793fb182112bdfcffd8ea 100755 (executable)
@@ -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;
        }
index bd6dfd6fa0b556995422e56838aef850ffac91f8..732053c139af36acafbff2089e6b6a6da6957b61 100755 (executable)
@@ -104,7 +104,7 @@ typedef struct
 \r
 typedef struct\r
 {\r
-       word    pagenum;\r
+       word    pn;\r
 } pan_t;\r
 \r
 typedef struct\r
@@ -113,7 +113,7 @@ typedef struct
        page_t page[MAXPAGE];           //pointer to root page[0]\r
        sdiword vmem_remain;    //remaining video memory\r
        byte num_of_pages;      //number of actual pages\r
-       boolean p;                      //render page number\r
+       boolean __near p;                       //render page number\r
        word pr[MAXPAGE][4];    //render sections of pages\r
 } video_t;\r
 \r
index 982f4b5133ae93ae884bebc5acaa947d7db75e1a..407a05ee503446efcc785efaf198a38c4a4d53dc 100755 (executable)
@@ -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);