OSDN Git Service

updated copyleft and need to test and fix newer version of open watcom
[proj16/16.git] / src / inputest.c
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2022 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
3  *\r
4  * This file is part of Project 16.\r
5  *\r
6  * Project 16 is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 3 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Project 16 is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
19  * Fifth Floor, Boston, MA 02110-1301 USA.\r
20  *\r
21  */\r
22 /*\r
23         input test\r
24 */\r
25 #include "src/lib/16_in.h"\r
26 #include "src/lib/16_tail.h"\r
27 \r
28 #define INPUTEST_JOYSTICKPADTEST\r
29 //#define INPUTEST_MOUSETEST\r
30 \r
31 void\r
32 main(int argc, char *argv[])\r
33 {\r
34         static global_game_variables_t gvar;\r
35 #ifdef __DEBUG_InputMgr__\r
36         dbg_testkeyin=1;\r
37         dbg_testcontrolnoisy=1;\r
38         dbg_joymousedelta=1;\r
39 #endif\r
40         start_timer(&gvar);\r
41         //Startup16(&gvar);\r
42         IN_Startup(&gvar);\r
43         IN_Default(0,&gvar.player[0],\r
44                                 #if !defined(INPUTEST_JOYSTICKPADTEST) && !defined(INPUTEST_MOUSETEST)\r
45                                                                 ctrl_Keyboard1\r
46                                 #endif\r
47                                 #if defined(INPUTEST_JOYSTICKPADTEST) && !defined(INPUTEST_MOUSETEST)\r
48                                                                 ctrl_Joystick1\r
49                                 #endif\r
50                                 #if !defined(INPUTEST_JOYSTICKPADTEST) && defined(INPUTEST_MOUSETEST)\r
51                                                                 ctrl_Mouse\r
52                                 #endif\r
53                                                                                                 , &gvar);\r
54         IN_SetControlType(&gvar.player[0],\r
55                                 #if !defined(INPUTEST_JOYSTICKPADTEST) && !defined(INPUTEST_MOUSETEST)\r
56                                                                 ctrl_Keyboard1\r
57                                 #endif\r
58                                 #if defined(INPUTEST_JOYSTICKPADTEST) && !defined(INPUTEST_MOUSETEST)\r
59                                                                 ctrl_Joystick1\r
60                                 #endif\r
61                                 #if !defined(INPUTEST_JOYSTICKPADTEST) && defined(INPUTEST_MOUSETEST)\r
62                                                                 ctrl_Mouse\r
63                                 #endif\r
64                                                                                                 );\r
65 \r
66         gvar.player[0].enti.q=1;\r
67         gvar.player[0].enti.d=2;\r
68         gvar.player[0].enti.spt=4;\r
69 \r
70         printf("dbg_testkeyin=%u        dbg_testcontrolnoisy=%u\nloop if this is not responsive then please KILL or reset machine sorry!!\n", dbg_testkeyin, dbg_testcontrolnoisy);\r
71         while(!gvar.in.inst->Keyboard[sc_Escape])\r
72         {\r
73 //0000          shinkutxt(&gvar);\r
74                 IN_ReadControl(&gvar.player[0], &gvar);\r
75                 switch(gvar.player[0].enti.d)\r
76                 {\r
77                 //right movement\r
78                 case 3:\r
79                         if(gvar.player[0].enti.q<=(TILEWH/(gvar.player[0].enti.spt)))\r
80                         {\r
81                                 gvar.player[0].enti.q++;\r
82                         } else { gvar.player[0].enti.q = 1; gvar.player[0].enti.d = 2; }\r
83                 break;\r
84 \r
85                 //left movement\r
86                 case 1:\r
87                         if(gvar.player[0].enti.q<=(TILEWH/(gvar.player[0].enti.spt)))\r
88                         {\r
89                                 gvar.player[0].enti.q++;\r
90                         } else { gvar.player[0].enti.q = 1; gvar.player[0].enti.d = 2; }\r
91                 break;\r
92 \r
93                 //down movement\r
94                 case 4:\r
95                         if(gvar.player[0].enti.q<=(TILEWH/(gvar.player[0].enti.spt)))\r
96                         {\r
97                                 gvar.player[0].enti.q++;\r
98                         } else { gvar.player[0].enti.q = 1; gvar.player[0].enti.d = 2; }\r
99                 break;\r
100 \r
101                 //up movement\r
102                 case 0:\r
103                         if(gvar.player[0].enti.q<=(TILEWH/(gvar.player[0].enti.spt)))\r
104                         {\r
105                                 gvar.player[0].enti.q++;\r
106                         } else { gvar.player[0].enti.q = 1; gvar.player[0].enti.d = 2; }\r
107                 break;\r
108         }\r
109                 //printf("%u\n", gvar.in.inst->Keyboard[sc_Escape]);\r
110                 //if(\r
111                 if(gvar.in.inst->Keyboard[88])  //speed\r
112                 {\r
113                         switch(gvar.kurokku.fpscap)\r
114                         {\r
115                                 case 0:\r
116                                         gvar.kurokku.fpscap=1;\r
117                                 break;\r
118                                 case 1:\r
119                                         gvar.kurokku.fpscap=0;\r
120                                 break;\r
121                         }\r
122                         //IN_Ack();\r
123                 }\r
124         }\r
125         IN_Shutdown(&gvar);\r
126                 //Shutdown16(&gvar);\r
127         //printf("%u\n", in.Keyboard[sc_Escape]);\r
128         printf("inputest.exe ");\r
129         printf("version %s\n", VERSION);\r
130 #ifdef __DEBUG_InputMgr__\r
131         printf("testkeyin=%u\n", dbg_testkeyin);\r
132         printf("testcontrolnoisy=%u\n", dbg_testcontrolnoisy);\r
133         printf("dbg_joymousedelta=%u\n", dbg_joymousedelta);\r
134 #endif\r
135         printf("JoysPresent={%d,%d}\n", gvar.in.JoysPresent[0], gvar.in.JoysPresent[1]);\r
136         printf("MousePresent=%d\n", gvar.in.MousePresent);\r
137 }\r