]> 4ch.mooo.com Git - 16.git/blobdiff - src/scroll.c
wtf!?
[16.git] / src / scroll.c
index 03411b3c0788fb3dbfe20e5b251f75e30b34cde9..6e6dc03231738c132dc66a1b7c2900793e4c8760 100644 (file)
 #include "src/lib/scroll16.h"
 #include "src/lib/mapread.h"
 #include "src/lib/wcpu/wcpu.h"
-//====#include "src\lib\ems.c"
 
 //word far *clock= (word far*) 0x046C; /* 18.2hz clock */
 
 void main()
 {
+       dword tiku = 0;
 //     word panswitch=0, panq=1, pand=0;
+       global_game_variables_t gvar;
        word panpagenum=0; //for panning!
        int i;
        static word paloffset=0;
@@ -37,52 +38,36 @@ void main()
        const char *cpus;
        //static int persist_aniframe = 0;    /* gonna be increased to 1 before being used, so 0 is ok for default */
        page_t screen, screen2, screen3;
-       map_t map;
+       static map_t map;
        map_view_t mv[3];
        map_view_t *bg, *spri, *mask;//, *tmp;
        //map_view_db_t pgid[4];
        byte *dpal, *gpal;
        byte *ptr;
        byte *mappalptr;
+       byte *mesg=malloc(sizeof(dword));
        player_t player[MaxPlayers];
 
        player[0].persist_aniframe=0;
        player[0].speed=4;
+
+       start_timer(&gvar);
+       gvar.frames_per_second = 60;
        //extern struct inconfig inpu;
-\r
-       //player_t npc0;
 
 //     atexit(qclean());
-       /*if(!emmtest())
-       {
-               printf("Expanded memory is not present\n");
-               exit(0);
-       }
-
-       if(!emmok())
-       {
-               printf("Expanded memory manager is not present\n");
-               exit(0);
-       }
-
-       emsavail = emmavail();
-       if(emsavail == -1)
-       {
-               printf("Expanded memory manager error\n");
-               exit(0);
-       }
-       printf("There are %ld pages available\n",emsavail);
-
-       if((emmhandle = emmalloc(emsavail)) < 0)
-       {
-               printf("Insufficient pages available\n");
-               exit(0);
-       }*/
 
        /* create the map */
-//0000 printf("Total used @ before map load:                   %zu\n", oldfreemem-GetFreeSize());
+       //printf("Total used @ before map load:                 %zu\n", oldfreemem-GetFreeSize());
+       printf("Total free @ before map load:                   %zu\n", GetFreeSize());
+       printf("Total near free @ before map load:                      %zu\n", GetNearFreeSize());
+       printf("Total far free @ before map load:                       %zu\n", GetFarFreeSize());
+//     getch();
 //0000 fprintf(stderr, "testing~\n");
-       loadmap("data/test.map", &map);
+//     loadmap("data/test.map", &map);
+       map.width=0;
+       map.height=0;
+       chkmap(&map, 1);
 //0000 fprintf(stderr, "yay map loaded~~\n");
 //---- map = allocMap(map.width,map.height); //20x15 is the resolution of the screen you can make maps smaller than 20x15 but the null space needs to be drawn properly
        //if(isEMS()) printf("%d tesuto\n", coretotalEMS());
@@ -104,37 +89,6 @@ void main()
        p = planar_buf_from_bitmap(&player[0].data);
 //0000 printf("Total used @ after planar buffer creation:      %zu\n", oldfreemem-GetFreeSize());
 
-       /*if(isEMS())
-       {
-               XMOVE mm;
-               mm.length=sizeof(map);
-               mm.sourceH=0;
-               mm.sourceOff=(long)&map;
-               mm.destH=emmhandle;
-               mm.destOff=1;
-               //halp!
-               ist = move_emem(&mm);
-               printf("%d\n", coretotalEMS());
-               if(!ist){ dealloc_emem(emmhandle); exit(5); }
-               //printf("%d\n", emmhandle);
-       }
-
-       if(isEMS())
-       {
-               XMOVE mm;
-               mm.length=emmhandle;
-               mm.sourceH=0;
-               mm.sourceOff=(long)&ptmp;
-               mm.destH=emmhandle;
-               mm.destOff=0;
-               //halp!
-               ist = move_emem(&mm);
-               printf("%d\n", coretotalEMS());
-               if(!ist){ dealloc_emem(emmhandle); exit(5); }
-               //printf("%d\n", emmhandle);
-       }
-*/
-
        /*      input!  */
        IN_Startup();
        IN_Default(0,&player,ctrl_Joystick);
@@ -144,18 +98,19 @@ void main()
        modexPalSave(dpal);
        modexFadeOff(4, dpal);
 
+       textInit();
        VGAmodeX(1);
        modexPalBlack();        //reset the palette~
 //     printf("Total used @ before palette initiation:         %zu\n", oldfreemem-GetFreeSize());
-       player[0].data.offset=(paloffset/3);
-       modexPalUpdate(&player[0].data, &paloffset, 0, 0);
+//++++ player[0].data.offset=(paloffset/3);
+//++++ modexPalUpdate(&player[0].data, &paloffset, 0, 0);
        //printf("      %d\n", sizeof(ptmp->data));
        //printf("1:    %d\n", paloffset);
-       map.tiles->data->offset=(paloffset/3);
+//++++ map.tiles->data->offset=(paloffset/3);
        //XTmodexPalUpdate(map.tiles->data, &paloffset, 0, 0);
-       printf("\n====\n");
-       printf("0       paloffset=      %d\n", paloffset/3);
-       printf("====\n\n");
+//     printf("\n====\n");
+//     printf("0       paloffset=      %d\n", paloffset/3);
+//     printf("====\n\n");
        gpal = modexNewPal();
        modexPalSave(gpal);
        modexSavePalFile("data/g.pal", gpal);
@@ -208,9 +163,13 @@ void main()
        modexShowPage(spri->page);
 //     printf("Total used @ before loop:                       %zu\n", oldfreemem-GetFreeSize());
        modexClearRegion(mv[2].page, 0, 0, mv[2].page->width, mv[2].page->height, 1);
-       modexFadeOn(4, gpal);
-       while(!IN_KeyDown(sc_Escape) && player[0].hp>0)\r
+//++++ modexFadeOn(4, gpal);
+       modexFadeOn(4, dpal);
+       while(!IN_KeyDown(sc_Escape) && player[0].hp>0)
        {
+               sprintf(mesg, "%lu", tiku);
+               modexprint(mv[1].page, 0, 0, 1, 15, 0, mesg);
+               shinku(mv[1].page, &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
@@ -374,6 +333,7 @@ void main()
 
        if((player[0].q==1) && !(player[0].x%TILEWH==0 && player[0].y%TILEWH==0)) break;        //incase things go out of sync!
 
+       tiku++;
        }
 
        /* fade back to text mode */
@@ -391,7 +351,7 @@ void main()
        //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\n", player[0].info.dir);
+       printf("player[0].hp: %d", (player[0].hp));     printf("        player[0].q: %d", player[0].q); printf("        player[0].info.dir: %d\n", player[0].info.dir);
        printf("tile data value at player trigger position: %d\n", bg->map->data[(player[0].triggerx-1)+(map.width*(player[0].triggery-1))]);
        printf("palette offset: %d\n", paloffset/3);
 //++++ printf("Total used: %zu\n", oldfreemem-GetFreeSize());
@@ -400,6 +360,8 @@ void main()
        printf("temporary player sprite 1: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=44606385\n");
        printf("Screen: %dx", screen.width);    printf("%d\n", screen.height);
        printf("Screen2: %dx", screen2.width);  printf("%d\n", screen2.height);
+       printf("map: %dx%d\n", map.width, map.height);
+       printf("player[0].info.dir: %u\n", player[0].info.dir);
        //printf("map.width=%d  map.height=%d   map.data[0]=%d\n", bg->map->width, bg->map->height, bg->map->data[0]);
        //xmsfree(&map);
        //xmsfree(bg);