X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Fscroll.c;h=ac0b8fe821b00de824f09f9bcda1c48dbd8f65b4;hb=05b59a2be57557408dada7c2134c406c073e424c;hp=c6316e5628cea25a85c2b2d86aaa3f95fdc55ea5;hpb=bd1fcae44f46be994efadf246b1cfc05da14a1c7;p=16.git diff --git a/src/scroll.c b/src/scroll.c old mode 100644 new mode 100755 index c6316e56..ac0b8fe8 --- a/src/scroll.c +++ b/src/scroll.c @@ -21,15 +21,18 @@ */ #include "src/lib/scroll16.h" -#include "src/lib/mapread.h" +//#include "src/lib/mapread.h" #include "src/lib/wcpu/wcpu.h" -//====#include "src\lib\ems.c" + +//#define FADE +//#define SPRITE //word far *clock= (word far*) 0x046C; /* 18.2hz clock */ void main() { // word panswitch=0, panq=1, pand=0; + global_game_variables_t gvar; word panpagenum=0; //for panning! int i; static word paloffset=0; @@ -41,55 +44,38 @@ void main() map_view_t mv[3]; map_view_t *bg, *spri, *mask;//, *tmp; //map_view_db_t pgid[4]; +#ifdef FADE byte *dpal, *gpal; +#endif byte *ptr; byte *mappalptr; + byte *mesg=malloc(sizeof(dword)); player_t player[MaxPlayers]; player[0].persist_aniframe=0; player[0].speed=4; + //0000printf("starting timer\n"); +//++++ + start_timer(&gvar); +//++++ gvar.frames_per_second = 60; +//0000 printf("ok\n"); //extern struct inconfig inpu; - - //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 */ - //printf("Total used @ before map load: %zu\n", oldfreemem-GetFreeSize()); - printf("Total free @ before map load: %zu\n", GetFreeSize()); - printf("Total far free @ before map load: %zu\n", GetFarFreeSize()); - getch(); + //0000printf("Total used @ before map load: %zu\n", oldfreemem-GetFreeSize()); +//0000 printf("Total free @ before map load: %zu\n", GetFreeSize()); +//0000 printf("Total near free @ before map load: %zu\n", GetNearFreeSize()); +//0000 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); +// printf("chkmap ok\n"); //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()); -//---- initMap(&map); mv[0].map = ↦ mv[1].map = ↦ mv[2].map = ↦ @@ -105,64 +91,42 @@ void main() /* create the planar buffer */ //0000 printf("Total used @ before planar buffer creation: %zu\n", oldfreemem-GetFreeSize()); p = planar_buf_from_bitmap(&player[0].data); +//0000 printf("planar buffer ok\n"); //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)↦ - 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! */ +//0000 getch(); IN_Startup(); IN_Default(0,&player,ctrl_Joystick); /* save the palette */ +#ifdef FADE dpal = modexNewPal(); modexPalSave(dpal); modexFadeOff(4, dpal); +#endif - VGAmodeX(1); + textInit(); + VGAmodeX(1, &gvar); +#ifdef FADE modexPalBlack(); //reset the palette~ +#endif // 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"); +#ifdef FADE gpal = modexNewPal(); modexPalSave(gpal); modexSavePalFile("data/g.pal", gpal); modexPalBlack(); //so player will not see loadings~ +#endif /* setup camera and screen~ */ screen = modexDefaultPage(); @@ -193,9 +157,14 @@ void main() player[0].y = player[0].ty*TILEWH; player[0].triggerx = player[0].tx; player[0].triggery = player[0].ty+1; +/* player[0].info.x = player[0].tx; + player[0].info.xaxis = player[0].tx*TILEWH; + player[0].info.y = player[0].ty; + player[0].info.yaxis = player[0].ty*TILEWH;*/ player[0].q=1; - player[0].info.dir=2; + player[0].d=2; player[0].hp=4; +// player[0].persist_aniframe=0; //npc /*npc0.tx = bg->tx + 1; npc0.ty = bg->ty + 1; @@ -206,14 +175,23 @@ void main() npc0.q=1; npc0.d=0; modexDrawSpriteRegion(spri->page, npc0.x-4, npc0.y-TILEWH, 24, 64, 24, 32, &npctmp);*/ +#ifdef SPRITE modexDrawSpriteRegion(spri->page, player[0].x-4, player[0].y-TILEWH, 24, 64, 24, 32, &player[0].data); +#else + modexClearRegion(mv[1].page, player[0].x-4, player[0].y-TILEWH, 24, 32, 15); +#endif 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); +#ifdef FADE modexFadeOn(4, gpal); - while(!IN_KeyDown(sc_Escape) && player[0].hp>0) +#endif + while(!IN_KeyDown(sc_Escape) && player[0].hp>0) { + sprintf(mesg, "%lu", gvar.tiku); +//++++ modexprint(mv[1].page, 16, 16, 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 @@ -354,6 +332,7 @@ void main() if(IN_KeyDown(3)){ modexShowPage(spri->page); panpagenum=1; } if(IN_KeyDown(4)){ modexShowPage(mask->page); panpagenum=2; } if(IN_KeyDown(25)){ pdump(bg->page); pdump(spri->page); } //p +#ifdef FADE if(IN_KeyDown(24)){ modexPalUpdate0(gpal); paloffset=0; pdump(bg->page); pdump(spri->page); } if(IN_KeyDown(22)){ paloffset=0; modexPalBlack(); modexPalUpdate(&player[0].data, &paloffset, 0, 0); @@ -361,12 +340,13 @@ void main() modexPalUpdate(map.tiles->data, &paloffset, 0, 0); printf("2paloffset = %d\n", paloffset/3); pdump(bg->page); pdump(spri->page); } +#endif //pan switch //if(IN_KeyDown(88)){if(!panswitch) panswitch++; else panswitch--; } //f12 //TSR if(IN_KeyDown(87)) //f11 { - VGAmodeX(0); + VGAmodeX(0, &gvar); IN_Shutdown(); __asm { @@ -377,16 +357,20 @@ void main() if((player[0].q==1) && !(player[0].x%TILEWH==0 && player[0].y%TILEWH==0)) break; //incase things go out of sync! + gvar.tiku++; } /* fade back to text mode */ /* but 1st lets save the game palette~ */ +#ifdef FADE modexPalSave(gpal); modexSavePalFile("data/g.pal", gpal); modexFadeOff(4, gpal); - VGAmodeX(0); +#endif + VGAmodeX(0, &gvar); IN_Shutdown(); - printf("Project 16 scroll.exe\n"); + printf("Project 16 scroll.exe. This is just a test file!\n"); + printf("version %s %s\n", __DATE__, __TIME__); printf("tx: %d\n", bg->tx); printf("ty: %d\n", bg->ty); printf("player[0].x: %d", player[0].x); printf(" player[0].y: %d\n", player[0].y); @@ -394,23 +378,21 @@ 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", player[0].info.dir); printf(" player[0].d: %d\n", player[0].d); 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("palette offset: %d\n", paloffset/3); //++++ printf("Total used: %zu\n", oldfreemem-GetFreeSize()); //++++ printf("Total free: %zu\n", GetFreeSize()); - printf("temporary player sprite 0: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45556867\n"); - 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); +//not used now printf("temporary player sprite 0: http://www.pixiv.net/member_illust.php?mode=medium&illust_id=45556867\n"); +//not used now 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("\n"); +// printf("player[0].info.x: %d", player[0].info.xaxis); printf(" player[0].info.y: %d\n", player[0].info.yaxis); +// printf("player[0].info.tx: %d", player[0].info.x); printf(" player[0].info.ty: %d\n", player[0].info.y); //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); - //xmsfree(spri); - //xmsfree(mask); - //xmsreport(); - //emmclose(emmhandle); + switch(detectcpu()) { case 0: cpus = "8086/8088 or 186/88"; break; @@ -419,5 +401,7 @@ void main() default: cpus = "internal error"; break; } printf("detected CPU type: %s\n", cpus); +#ifdef FADE modexFadeOn(4, dpal); +#endif }