}
}
+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;
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 */
return;
}
- player[0].persist_aniframe=0;
- player[0].speed=4;
+ pan.pagenum=0;
//player[0].data = &pp;
printf("starting timer ");
/* input! */
IN_Startup();
IN_Default(0,&player,ctrl_Joystick);
+ IN_Default(1,&player,ctrl_Joystick);
/* save the palette */
#ifdef MODEX
mv[i].page = &gvar.video.page[i];
mv[i].map = ↦
mv[i].video = &gvar.video;
+ mv[i].pan = &pan;
}
/* set up paging */
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
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))
{
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
#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
{
// 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); }
//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);
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);