OSDN Git Service

wwww
[proj16/16.git] / 16 / v2 / source / ENGINE / STARTUP.C
1 /*\r
2 Copyright (C) 1998 BJ Eirich (aka vecna)\r
3 This program is free software; you can redistribute it and/or\r
4 modify it under the terms of the GNU General Public License\r
5 as published by the Free Software Foundation; either version 2\r
6 of the License, or (at your option) any later version.\r
7 This program is distributed in the hope that it will be useful,\r
8 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\r
10 See the GNU General Public Lic\r
11 See the GNU General Public License for more details.\r
12 You should have received a copy of the GNU General Public License\r
13 along with this program; if not, write to the Free Software\r
14 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
15 */\r
16 \r
17 #include <stdarg.h> // va_*()\r
18 #include <time.h>\r
19 \r
20 #define MAIN_H\r
21 #include "verge.h"\r
22 extern void vmain(int argc, char *argv[]);\r
23 extern void Log(char *message, ...);\r
24 \r
25 int mx, my, mb;\r
26 \r
27 // ================================= Code ====================================\r
28 \r
29 void err(char *message, ...)\r
30 {\r
31   char tempbuf[256];\r
32   va_list lst;\r
33 \r
34   ShutdownVideo(1);\r
35   ShutdownTimer();\r
36   ShutdownKeyboard();\r
37 //  CD_Deinit();\r
38   MD_PlayStop();\r
39   MD_Exit();\r
40 \r
41   va_start(lst, message);\r
42   vsprintf(tempbuf, message, lst);\r
43   va_end(lst);\r
44 \r
45   printf(tempbuf);\r
46   fflush(stdout);\r
47 \r
48   Log("Sys: Exiting with message: %s", tempbuf);\r
49 \r
50   exit(-1);\r
51 }\r
52 \r
53 int sgn(int x)\r
54 {\r
55   if (x>=0) return 1;\r
56   return 0;\r
57 }\r
58 \r
59 void ver()\r
60 { char temp[256];\r
61 \r
62   Con_NextLine();\r
63   Con_Printf("{|||||||||||||||||}");\r
64   sprintf(temp,"VERGE v.%s Copyright (C)1998 vecna",VERSION);\r
65   Con_Printf(temp);\r
66   Con_Printf("All rights reserved. DJGPP/DOS build.");\r
67   sprintf(strbuf,"Timestamp %s at %s.",__DATE__, __TIME__);\r
68   Con_Printf(strbuf);\r
69   Con_Printf("Options: -Wall -m486 -O1 -ffast-math");\r
70   Con_Printf("{|||||||||||||||||}");\r
71 }\r
72 \r
73 void CheckMessages()\r
74 {\r
75   // Win95 can bite me.\r
76 }\r
77 \r
78 void InitMouse(int x, int y)\r
79 { REGISTERS r;\r
80 \r
81   SET_AX(r,7);\r
82   SET_CX(r,0);\r
83   SET_DX(r,x);\r
84   INTERRUPT(0x33, r);\r
85 \r
86   SET_AX(r,8);\r
87   SET_CX(r,0);\r
88   SET_DX(r,y);\r
89   INTERRUPT(0x33, r);\r
90 }\r
91 \r
92 void ReadMouse()\r
93 { REGISTERS r;\r
94 \r
95   SET_AX(r,3);\r
96   INTERRUPT(0x33, r);\r
97 \r
98   mx=r.x.cx;\r
99   my=r.x.dx;\r
100   mb=r.x.bx;\r
101 }\r
102 \r
103 void SetMouse(int x, int y)\r
104 { REGISTERS r;\r
105 \r
106   SET_AX(r, 4);\r
107   SET_CX(r, x);\r
108   SET_DX(r, y);\r
109   INTERRUPT(0x33, r);\r
110 }\r
111 \r
112 int main(int argc, char *argv[])\r
113 {\r
114   if (argc==1)\r
115   {\r
116     printf("VERGE v.%s build %s at %s. \n",VERSION,__DATE__,__TIME__);\r
117     printf("Copyright (C)1998 vecna \n");\r
118     delay(500);\r
119   }\r
120   srand(time(NULL));\r
121   vmain(argc, argv);\r
122   return 0;\r
123 }\r