]> 4ch.mooo.com Git - 16.git/commitdiff
16_in improvements and added debugging stuff
authorsparky4 <sparky4@cock.li>
Sat, 12 Mar 2016 23:38:43 +0000 (17:38 -0600)
committersparky4 <sparky4@cock.li>
Sat, 12 Mar 2016 23:38:43 +0000 (17:38 -0600)
dld.bat [new file with mode: 0755]
src/inputest.c
src/lib/16_in.c
src/lib/16_in.h
src/lib/modex16.h
src/scroll.c

diff --git a/dld.bat b/dld.bat
new file mode 100755 (executable)
index 0000000..25d94e8
--- /dev/null
+++ b/dld.bat
@@ -0,0 +1 @@
+cd src\lib\doslib
index 32947c5c7d74f987b4c43cd551049cbb08eec17c..c0c3792e6922fca61e49aed35e9c145a3569d45a 100755 (executable)
@@ -29,8 +29,9 @@ main(int argc, char *argv[])
 {\r
        player_t player[MaxPlayers];\r
        //extern struct inconfig inpu;\r
-       testkeyin=1;\r
-       testcontrolnoisy=0;\r
+       testkeyin=0;\r
+       testcontrolnoisy=1;\r
+       gfxtest=0;\r
        IN_Startup();\r
        IN_Default(0,&player,ctrl_Joystick);\r
        //while(!IN_KeyDown(sc_Escape))\r
@@ -46,4 +47,5 @@ main(int argc, char *argv[])
        printf("inputest.exe ");\r
        printf("version %s\n", VERSION);\r
        printf("testkeyin=%u\n", testkeyin);\r
+       printf("testcontrolnoisy=%u\n", testcontrolnoisy);\r
 }\r
index 7519a6c2312ed20428f4c85a1e41a2cc87c6613d..062e3beef1dba3a4f18bd09bec4f8f5161de9da6 100755 (executable)
@@ -38,7 +38,7 @@
 \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
@@ -669,6 +669,7 @@ IN_Startup()
 void\r
 IN_Default(boolean gotit,player_t *player,ControlType nt)\r
 {\r
+       int i;\r
        if\r
        (\r
                (!gotit)\r
@@ -690,6 +691,8 @@ IN_Default(boolean gotit,player_t *player,ControlType nt)
        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
@@ -800,7 +803,7 @@ IN_ReadCursor(CursorInfo *info)
 //\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
@@ -837,7 +840,7 @@ register    KeyboardDef     *def;
        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
@@ -851,16 +854,21 @@ register  KeyboardDef     *def;
                                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
@@ -900,22 +908,27 @@ register  KeyboardDef     *def;
                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
@@ -944,11 +957,13 @@ register  KeyboardDef     *def;
 #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
@@ -960,10 +975,10 @@ if((inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->lef
 //\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
index 44daca6d19583efdcde9f07881bae4765d887126..e39c400e29554414cb80e87465160af6670c6a1e 100755 (executable)
 //#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
@@ -220,8 +224,9 @@ typedef     struct
        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
@@ -285,8 +290,8 @@ extern void IN_SetKeyHook(void (*hook)());
 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
index 5a2655d69446258d01719a1694a4decdd981bec5..c45aafbc8532ac489d9547b9e4872061b5d1422d 100755 (executable)
@@ -36,6 +36,7 @@
 #include "src/lib/modex16/256x192.h"
 #include "src/lib/modex16/192x144_.h"
 #include "src/lib/modex16/160x120.h"
+extern byte gfxtest;
 
 static struct pcxHeader {
        byte id;
index b89d1291b45e5065797457dfac96500056cf4cd2..99910f26e134c1129df7ee5c6d5e105112c6822d 100755 (executable)
@@ -1,5 +1,5 @@
 /* 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.
  *
@@ -64,6 +64,9 @@ void main(int argc, char *argv[])
        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;
@@ -422,6 +425,7 @@ void main(int argc, char *argv[])
        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());