///////////////////////////////////////////////////////////////////////////\r
void\r
IN_ReadControl(int playnum,player_t *player)\r
-{\r
+{
boolean realdelta;\r
byte dbyte;\r
word buttons;\r
\r
dx = dy = 0;\r
mx = my = motion_None;\r
- buttons = 0;\r
+ buttons = 0;
\r
#if DEMO0\r
if (DemoMode == demo_Playback)\r
mx = motion_Left,my = motion_Down;\r
else if (Keyboard[def->downright])\r
mx = motion_Right,my = motion_Down;*/\r
-\r
if(!inpu.Keyboard[def->left] && !inpu.Keyboard[def->right]){
- if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down] && player[playnum].info.dir == 2) || player[playnum].info.dir == 0)\r
- my = motion_Up;\r
- if((inpu.Keyboard[def->down] && !inpu.Keyboard[def->up] && player[playnum].info.dir == 2) || player[playnum].info.dir == 4)\r
- my = motion_Down;\r
-\r
+ if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down] && player[playnum].d == 2))// || player[playnum].info.dir == 0)\r
+ my = motion_Up;
+ if((inpu.Keyboard[def->down] && !inpu.Keyboard[def->up] && player[playnum].d == 2))// || player[playnum].info.dir == 4)\r
+ my = motion_Down;
}else if(!inpu.Keyboard[def->up] && !inpu.Keyboard[def->down]){\r
- if((inpu.Keyboard[def->left] && !inpu.Keyboard[def->right] && player[playnum].info.dir == 2) || player[playnum].info.dir == 1)\r
- mx = motion_Left;\r
- if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left] && player[playnum].info.dir == 2) || player[playnum].info.dir == 3)\r
- mx = motion_Right;\r
+ if((inpu.Keyboard[def->left] && !inpu.Keyboard[def->right] && player[playnum].d == 2))// || player[playnum].info.dir == 1)\r
+ mx = motion_Left;
+ if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left] && player[playnum].d == 2))// || player[playnum].info.dir == 3)\r
+ mx = motion_Right;
}\r
if (inpu.Keyboard[def->button0])\r
buttons += 1 << 0;\r
}\r
else\r
{\r
- dx = mx * 127;\r
- dy = my * 127;\r
+ dx = mx;// * 127;\r
+ dy = my;// * 127;\r
}\r
-\r
+
player[playnum].info.x = dx;\r
player[playnum].info.xaxis = mx;\r
player[playnum].info.y = dy;\r
// player[playnum].info.dir = DirTable[((my + 1) * 3) + (mx + 1)];
conpee=(((my + 1) * 2) + (mx + 1));
if(conpee) conpee--;
- player[playnum].info.dir = DirTable[conpee];\r
+ player[playnum].info.dir = DirTable[conpee];
+ if(player[playnum].q==1 && (mx!=motion_None || my!=motion_None))
+ {
+ player[playnum].d = player[playnum].info.dir;
+ }
\r
#if DEMO0\r
if (DemoMode == demo_Record)\r
void walk(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].info.dir)
+ switch(player[pn].d)
{
//right movement
case 3:
mapScrollRight(pip, player, 1, pn);
modexShowPage(pip[1].page);
player[pn].q++;
- } else { player[pn].q = 1; player[pn].info.dir = 2; player[pn].tx++; }
+ } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; }
}
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))
{
animatePlayer(pip, player, pn, 0);
modexShowPage(pip[1].page);
player[pn].q++;
- } else { player[pn].q = 1; player[pn].info.dir = 2; player[pn].tx++; }
+ } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx++; }
}
else
{
modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 14);
#endif
modexShowPage(pip[1].page);
- player[pn].info.dir = 2;
+ player[pn].d = 2;
}
player[pn].triggerx = player[pn].tx+1;
player[pn].triggery = player[pn].ty;
mapScrollLeft(pip, player, 1, pn);
modexShowPage(pip[1].page);
player[pn].q++;
- } else { player[pn].q = 1; player[pn].info.dir = 2; player[pn].tx--; }
+ } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; }
}
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))
{
animatePlayer(pip, player, pn, 0);
modexShowPage(pip[1].page);
player[pn].q++;
- } else { player[pn].q = 1; player[pn].info.dir = 2; player[pn].tx--; }
+ } else { player[pn].q = 1; player[pn].d = 2; player[pn].tx--; }
}
else
{
modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 10);
#endif
modexShowPage(pip[1].page);
- player[pn].info.dir = 2;
+ player[pn].d = 2;
}
player[pn].triggerx = player[pn].tx-1;
player[pn].triggery = player[pn].ty;
mapScrollDown(pip, player, 1, pn);
modexShowPage(pip[1].page);
player[pn].q++;
- } else { player[pn].q = 1; player[pn].info.dir = 2; player[pn].ty++; }
+ } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; }
}
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))
{
animatePlayer(pip, player, pn, 0);
modexShowPage(pip[1].page);
player[pn].q++;
- } else { player[pn].q = 1; player[pn].info.dir = 2; player[pn].ty++; }
+ } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty++; }
}
else
{
modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 9);
#endif
modexShowPage(pip[1].page);
- player[pn].info.dir = 2;
+ player[pn].d = 2;
}
player[pn].triggerx = player[pn].tx;
player[pn].triggery = player[pn].ty+1;
mapScrollUp(pip, player, 1, pn);
modexShowPage(pip[1].page);
player[pn].q++;
- } else { player[pn].q = 1; player[pn].info.dir = 2; player[pn].ty--; }
+ } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; }
}
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))
{
animatePlayer(pip, player, 0, pn);
modexShowPage(pip[1].page);
player[pn].q++;
- } else { player[pn].q = 1; player[pn].info.dir = 2; player[pn].ty--; }
+ } else { player[pn].q = 1; player[pn].d = 2; player[pn].ty--; }
}
else
{
modexClearRegion(pip[1].page, player[pn].x-4, player[pn].y-TILEWH, 24, 32, 12);
#endif
modexShowPage(pip[1].page);
- player[pn].info.dir = 2;
+ player[pn].d = 2;
}
player[pn].triggerx = player[pn].tx;
player[pn].triggery = player[pn].ty-1;
if(!scrollswitch) qq = 0;
else qq = ((ls)*player[playnum].speed);
- switch (player[playnum].info.dir)
+ switch (player[playnum].d)
{
case 0:
//up
- dire*=player[playnum].info.dir;
+ dire*=player[playnum].d;
x-=4;
y-=(qq-TILEWH);
break;
case 3:
// right
- dire*=(player[playnum].info.dir-2);
+ dire*=(player[playnum].d-2);
x+=(qq-4);
y-=TILEWH;
break;
break;
case 4:
//down
- dire*=(player[playnum].info.dir-2);
+ dire*=(player[playnum].d-2);
x-=4;
y+=(qq-TILEWH);
break;
case 1:
//left
- dire*=(player[playnum].info.dir+2);
+ dire*=(player[playnum].d+2);
x-=(qq-4);
y-=TILEWH;
break;
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].speed=4;
- player[0].persist_aniframe=0;
+// player[0].persist_aniframe=0;
//npc
/*npc0.tx = bg->tx + 1;
npc0.ty = bg->ty + 1;
//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("Total used: %zu\n", oldfreemem-GetFreeSize());
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);