OSDN Git Service

wwww
[proj16/16.git] / src / lib / 16_head.h
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\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 #if !defined(__LARGE__) && !defined(__COMPACT__) && !defined(__HUGE__)\r
24 #error Invalid memory model for compiling project 16\r
25 #endif\r
26 \r
27 #if !defined(__i86__) && defined(__i386__)\r
28 #error i8088 only\r
29 #endif\r
30 \r
31 #ifndef _LIBHEAD_H_\r
32 #define _LIBHEAD_H_\r
33 #include <dos.h>\r
34 #include <stdio.h>\r
35 #include <stdlib.h>\r
36 #include <conio.h> // just for wait\r
37 #include <time.h> // just for wait\r
38 #include <malloc.h>\r
39 #include <ctype.h>\r
40 #include <fcntl.h>\r
41 #include <io.h>\r
42 #include <sys/stat.h>\r
43 #include <mem.h>\r
44 #include <string.h>\r
45 #ifdef __WATCOMC__\r
46 #include <i86.h>\r
47 #include <unistd.h>\r
48 #include <alloca.h>\r
49 #endif\r
50 #include "src/lib/nyan/kitten.h"\r
51 #include "src/lib/types.h"\r
52 \r
53 //0000 test type def wwww\r
54 /*struct list {\r
55         struct list __based(__self) *next;\r
56         int         value;\r
57 };*/\r
58 \r
59 /* Control codes for all keys on the keyboard */\r
60 //here temperarly\r
61 /*\r
62 #define KEY_A           (0x1E)\r
63 #define KEY_B           (0x30)\r
64 #define KEY_C           (0x2E)\r
65 #define KEY_D           (0x20)\r
66 #define KEY_E           (0x12)\r
67 #define KEY_F           (0x21)\r
68 #define KEY_G           (0x22)\r
69 #define KEY_H           (0x23)\r
70 #define KEY_I           (0x17)\r
71 #define KEY_J           (0x24)\r
72 #define KEY_K           (0x25)\r
73 #define KEY_L           (0x26)\r
74 #define KEY_M           (0x32)\r
75 #define KEY_N           (0x31)\r
76 #define KEY_O           (0x18)\r
77 #define KEY_P           (0x19)\r
78 #define KEY_Q           (0x10)\r
79 #define KEY_R           (0x13)\r
80 #define KEY_S           (0x1F)\r
81 #define KEY_T           (0x14)\r
82 #define KEY_U           (0x16)\r
83 #define KEY_V           (0x2F)\r
84 #define KEY_W           (0x11)\r
85 #define KEY_X           (0x2D)\r
86 #define KEY_Y           (0x15)\r
87 #define KEY_Z           (0x2C)\r
88 #define KEY_1           (0x02)\r
89 #define KEY_2           (0x03)\r
90 #define KEY_3           (0x04)\r
91 #define KEY_4           (0x05)\r
92 #define KEY_5           (0x06)\r
93 #define KEY_6           (0x07)\r
94 #define KEY_7           (0x08)\r
95 #define KEY_8           (0x09)\r
96 #define KEY_9           (0x0A)\r
97 #define KEY_0           (0x0B)\r
98 #define KEY_DASH                (0x0C)  // -_\r
99 #define KEY_EQUAL               (0x0D)  // =+\r
100 #define KEY_LBRACKET    (0x1A)  // [{\r
101 #define KEY_RBRACKET    (0x1B)  // ]}\r
102 #define KEY_SEMICOLON   (0x27)  // ;:\r
103 #define KEY_RQUOTE      (0x28)  // '"\r
104 #define KEY_LQUOTE      (0x29)  // `~\r
105 #define KEY_PERIOD      (0x33)  // .>\r
106 #define KEY_COMMA               (0x34)  // ,<\r
107 #define KEY_SLASH               (0x35)  // /?\r
108 #define KEY_BACKSLASH   (0x2B)  // \|\r
109 #define KEY_F1          (0x3B)\r
110 #define KEY_F2          (0x3C)\r
111 #define KEY_F3          (0x3D)\r
112 #define KEY_F4          (0x3E)\r
113 #define KEY_F5          (0x3F)\r
114 #define KEY_F6          (0x40)\r
115 #define KEY_F7          (0x41)\r
116 #define KEY_F8          (0x42)\r
117 #define KEY_F9          (0x43)\r
118 #define KEY_F10         (0x44)\r
119 #define KEY_ESC         (0x01)\r
120 #define KEY_BACKSPACE   (0x0E)\r
121 #define KEY_TAB         (0x0F)\r
122 #define KEY_ENTER               (0x1C)\r
123 #define KEY_CONTROL     (0x1D)\r
124 #define KEY_LSHIFT      (0x2A)\r
125 #define KEY_RSHIFT      (0x36)\r
126 #define KEY_PRTSC               (0x37)\r
127 #define KEY_ALT         (0x38)\r
128 #define KEY_SPACE               (0x39)\r
129 #define KEY_CAPSLOCK    (0x3A)\r
130 #define KEY_NUMLOCK     (0x45)\r
131 #define KEY_SCROLLLOCK  (0x46)\r
132 #define KEY_HOME                (0x47)\r
133 #define KEY_UP          (0x48)\r
134 #define KEY_PGUP                (0x49)\r
135 #define KEY_MINUS               (0x4A)\r
136 #define KEY_LEFT                (0x4B)\r
137 #define KEY_CENTER      (0x4C)\r
138 #define KEY_RIGHT               (0x4D)\r
139 #define KEY_PLUS                (0x4E)\r
140 #define KEY_END         (0x4F)\r
141 #define KEY_DOWN                (0x50)\r
142 #define KEY_PGDOWN      (0x51)\r
143 #define KEY_INS         (0x52)\r
144 #define KEY_DEL         (0x53)\r
145 \r
146 #define KEY_LWIN                (0x73)\r
147 #define KEY_RWIN                (0x74)\r
148 #define KEY_MENU                (0x75)\r
149 */\r
150 \r
151 static dword far* clockdw= (dword far*) 0x046C; /* 18.2hz clock */\r
152 extern  int                     profilehandle,debughandle;      //make it into game global\r
153 \r
154 #define __DEBUG__\r
155 \r
156 #define nil     ((void *)0)\r
157 #ifdef __BORLANDC__\r
158 #define _FCORELEFT 0x90000UL-16UL\r
159 #endif\r
160 #ifdef __WATCOMC__\r
161 #define _FCORELEFT 0x90000UL+16UL\r
162 \r
163 #define peekb(segm,ofs) (*(byte far*)MK_FP((segm),(ofs)))\r
164 #define peekw(segm,ofs) (*(word far*)MK_FP((segm),(ofs)))\r
165 #define pokeb(segm,ofs,value) (peekb((segm),(ofs)) = (byte)(value))\r
166 #define pokew(segm,ofs,value) (peekw((segm),(ofs)) = (word)(value))\r
167 \r
168 typedef union REGPACK   regs_t;\r
169 #endif\r
170 \r
171 typedef enum    {false,true}    boolean;\r
172 \r
173 #ifdef __WATCOMC__\r
174 typedef void __based(__self) * memptr;\r
175 #endif\r
176 #ifdef __BORLANDC__\r
177 typedef void _seg * memptr;\r
178 #endif\r
179 \r
180 typedef struct\r
181 {\r
182 //      int showmemhandle;\r
183         int                     profilehandle,debughandle;\r
184         int heaphandle;\r
185 } handle_t;\r
186 \r
187 typedef struct\r
188 {\r
189         int old_mode;   //old video mode before game!\r
190         word frames_per_second;\r
191         clock_t t;\r
192         dword tiku;\r
193         word far* clock;\r
194         handle_t handle;        //handles for file logging\r
195 } global_game_variables_t;\r
196 \r
197 /* local function */\r
198 void wait(clock_t wait);\r
199 \r
200 long int filesize(FILE *fp);\r
201 void printmeminfoline(byte *strc, const byte *pee, size_t h_total, size_t h_used, size_t h_free);\r
202 int US_CheckParm(char *parm,char **strings);\r
203 \r
204 #endif/*_LIBHEAD_H_*/\r