\r
#include "src/lib/16_in.h"\r
\r
-word testkeyin=1,testcontrolnoisy=0;\r
+byte testkeyin=0,testcontrolnoisy=0,gfxtest=0;\r
\r
/*\r
=============================================================================\r
void\r
IN_Default(boolean gotit,player_t *player,ControlType nt)\r
{\r
+ int i;\r
if\r
(\r
(!gotit)\r
inpu.KbdDefs[0].down = 0x50;\r
//in.KbdDefs[0].downright = 0x51;\r
IN_SetControlType(0,player,nt);\r
+ for(i=0; i>MaxPlayers;i++)\r
+ player[i].d=2;\r
}\r
\r
///////////////////////////////////////////////////////////////////////////\r
//\r
///////////////////////////////////////////////////////////////////////////\r
void near\r
-IN_ReadControl(int playnum,player_t *player)\r
+IN_ReadControl(int pn,player_t *player)\r
{\r
boolean realdelta;\r
byte dbyte;\r
else\r
{\r
#endif\r
- switch (type = player[playnum].Controls)\r
+ switch (type = player[pn].Controls)\r
{\r
case ctrl_Keyboard1:\r
case ctrl_Keyboard2:\r
mx = motion_Left,my = motion_Down;\r
else if (Keyboard[def->downright])\r
mx = motion_Right,my = motion_Down;*/\r
- if(!inpu.Keyboard[def->left] && !inpu.Keyboard[def->right]){\r
- if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down] && player[playnum].d == 2))// || player[playnum].info.dir == 0)\r
- my = motion_Up;\r
- if((inpu.Keyboard[def->down] && !inpu.Keyboard[def->up] && player[playnum].d == 2))// || player[playnum].info.dir == 4)\r
- my = motion_Down;\r
- }else if(!inpu.Keyboard[def->up] && !inpu.Keyboard[def->down]){\r
- if((inpu.Keyboard[def->left] && !inpu.Keyboard[def->right] && player[playnum].d == 2))// || player[playnum].info.dir == 1)\r
- mx = motion_Left;\r
- if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left] && player[playnum].d == 2))// || player[playnum].info.dir == 3)\r
- mx = motion_Right;\r
+ if(DIRECTIONIFELSEGFXTEST)\r
+ {\r
+ if(!inpu.Keyboard[def->left] && !inpu.Keyboard[def->right]){// && (inpu.Keyboard[def->up] || inpu.Keyboard[def->down])){\r
+// if(testcontrolnoisy > 0){ printf("ud "); printf("%u ", inpu.Keyboard[def->up]); printf("%u ", inpu.Keyboard[def->down]);}\r
+ if(inpu.Keyboard[def->up] && !inpu.Keyboard[def->down])// || player[pn].info.pdir == 0)\r
+ my = motion_Up;\r
+ if(inpu.Keyboard[def->down] && !inpu.Keyboard[def->up])// || player[pn].info.pdir == 4)\r
+ my = motion_Down;\r
+ }else if(!inpu.Keyboard[def->up] && !inpu.Keyboard[def->down]){// && (inpu.Keyboard[def->left] || inpu.Keyboard[def->right])){\r
+// if(testcontrolnoisy > 0){ printf("lr "); printf("%u ", inpu.Keyboard[def->left]); printf("%u ", inpu.Keyboard[def->right]); }\r
+ if(inpu.Keyboard[def->left] && !inpu.Keyboard[def->right])// || player[pn].info.pdir == 1)\r
+ mx = motion_Left;\r
+ if(inpu.Keyboard[def->right] && !inpu.Keyboard[def->left])// || player[pn].info.pdir == 3)\r
+ mx = motion_Right;\r
+ }\r
}\r
//input from player\r
if (inpu.Keyboard[def->button0])\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.yaxis = my;\r
- player[playnum].info.button0 = buttons & (1 << 0);\r
- player[playnum].info.button1 = buttons & (1 << 1);\r
- player[playnum].info.button2 = buttons & (1 << 2);\r
- player[playnum].info.button3 = buttons & (1 << 3);\r
-// player[playnum].info.dir = DirTable[((my + 1) * 3) + (mx + 1)];\r
- conpee=(((my + 1) * 2) + (mx + 1));\r
- if(conpee) conpee--;\r
- player[playnum].info.dir = DirTable[conpee];\r
- if(player[playnum].q==1 && (mx!=motion_None || my!=motion_None))\r
+ player[pn].info.x = dx;\r
+ player[pn].info.xaxis = mx;\r
+ player[pn].info.y = dy;\r
+ player[pn].info.yaxis = my;\r
+ player[pn].info.button0 = buttons & (1 << 0);\r
+ player[pn].info.button1 = buttons & (1 << 1);\r
+ player[pn].info.button2 = buttons & (1 << 2);\r
+ player[pn].info.button3 = buttons & (1 << 3);\r
+// player[pn].info.dir = DirTable[((my + 1) * 3) + (mx + 1)];\r
+ conpee=(((my + 1) * 2) + (mx + 1))-1; //if(conpee) conpee--;\r
+ player[pn].info.dir = DirTable[conpee];\r
+ if(DIRECTIONIFELSEGFXTEST && player[pn].d != player[pn].info.dir) player[pn].pdir=DirTable[conpee];\r
+ if(player[pn].q==1 && (mx!=motion_None || my!=motion_None))\r
{\r
- player[playnum].d = player[playnum].info.dir;\r
+ player[pn].d = player[pn].info.dir;\r
+ //printf("q =%d ", player[pn].q);\r
+ //if(testcontrolnoisy > 0)\r
+ //if(testcontrolnoisy > 0)\r
+ //printf("cpee=%d ", conpee);\r
}\r
+ if(testcontrolnoisy > 0)\r
\r
#if DEMO0\r
if (DemoMode == demo_Record)\r
#endif\r
//#ifdef TESTCONTROLNOISY\r
if(testcontrolnoisy > 0)\r
-if((inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->left] || inpu.Keyboard[def->right])&& player[playnum].info.dir!=2)\r
+if((inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->left] || inpu.Keyboard[def->right]) && NDIRECTIONIFELSEGFXTEST)\r
{\r
+ printf("q=%d ", player[pn].q);\r
+ printf("cpee=%d ", conpee);\r
printf("(mx)=%d ", mx);\r
printf("(my)=%d ", my);\r
- printf("dir=%d\n", player[playnum].info.dir);\r
+ printf("pdir=%d d=%d dir=%d\n", player[pn].pdir, player[pn].d, player[pn].info.dir);\r
}\r
//#endif\r
}\r
//\r
///////////////////////////////////////////////////////////////////////////\r
void\r
-IN_SetControlType(word playnum,player_t *player,ControlType type)\r
+IN_SetControlType(word pn,player_t *player,ControlType type)\r
{\r
// DEBUG - check that requested type is present?\r
- player[playnum].Controls = type;\r
+ player[pn].Controls = type;\r
}\r
\r
#if DEMO0\r
//#define TESTCONTROLNOISY\r
#endif\r
\r
-extern word testkeyin,testcontrolnoisy;\r
+extern byte testkeyin,testcontrolnoisy,gfxtest;\r
+\r
+//if else for gfxtesting and direction\r
+#define DIRECTIONIFELSEGFXTEST (player[pn].d == 2 && gfxtest) || (player[pn].info.dir == 2 && !gfxtest)\r
+#define NDIRECTIONIFELSEGFXTEST (player[pn].d != 2 && gfxtest) || (player[pn].info.dir != 2 && !gfxtest)\r
\r
#define KeyInt 9 // The keyboard ISR number\r
\r
int triggery; //player's trigger box tile position on the viewable map\r
int sheetsetx; //NOT USED YET! player sprite sheet set on the image x\r
int sheetsety; //NOT USED YET! player sprite sheet set on the image y\r
- byte d; //direction!! wwww\r
- byte q; //loop variable\r
+ byte d; //direction to render sprite!! wwww\r
+ byte q; //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www\r
+ byte near pdir; //previous direction~\r
word speed; //player speed!\r
//0000 planar_buf_t huge *data; //supposively the sprite sheet data\r
// planar_buf_t data; //supposively the sprite sheet data\r
extern void IN_ClearKeysDown();\r
//static void INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy);\r
extern void IN_ReadCursor(CursorInfo *info);\r
-extern void near IN_ReadControl(int playnum,player_t *player);\r
-extern void IN_SetControlType(word playnum,player_t *player,ControlType type);\r
+extern void near IN_ReadControl(int pn,player_t *player);\r
+extern void IN_SetControlType(word pn,player_t *player,ControlType type);\r
#if DEMO0\r
extern boolean IN_StartDemoRecord(word bufsize);\r
extern void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize);\r
/* Project 16 Source Code~
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669
*
* This file is part of Project 16.
*
if(argv[1]) bakapee = atoi(argv[1]);
else bakapee = 1;
+ testcontrolnoisy=0;
+ gfxtest=1;
+
player[0].persist_aniframe=0;
player[0].speed=4;
//player[0].data = &pp;
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("pdir=%d\n", player[0].pdir);
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());