fix remapping behavior. Remapping is only necessary if we are rendering on the workbe...
[AROS-Contrib.git] / Games / Doom / amiga_main.c
blob819a7d11f82fee0a22574ab56eee08aa09e892f0
1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // $Id$
5 //
6 // Copyright (C) 1993-1996 by id Software, Inc.
7 //
8 // This source is available for distribution and/or modification
9 // only under the terms of the DOOM Source Code License as
10 // published by id Software. All rights reserved.
12 // The source is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
15 // for more details.
17 // $Log$
18 // Revision 1.1 2000/02/29 18:21:03 stegerg
19 // Doom port based on ADoomPPC. Read README.AROS!
22 // DESCRIPTION:
23 // Main program, simply calls D_DoomMain high level loop.
25 //-----------------------------------------------------------------------------
27 const char amigaversion[] = "$VER: ADoomPPC 1.3 " __AMIGADATE__ ;
29 long __oslibversion = 38; /* we require at least OS3.0 for LoadRGB32() */
30 char __stdiowin[] = "CON:0/20/640/140/ADoomPPC";
31 char __stdiov37[] = "/AUTO/CLOSE/WAIT";
33 #include <stdio.h>
34 #include <stdlib.h>
36 #include <exec/exec.h>
37 #include <workbench/startup.h>
38 #include <workbench/workbench.h>
39 #include <workbench/icon.h>
40 #include <PowerUP/ppclib/ppc.h>
42 #include <proto/exec.h>
43 #include <proto/icon.h>
45 #include "doomdef.h"
47 #include "m_argv.h"
48 #include "d_main.h"
49 #include "i_system.h"
50 #include "m_fixed.h"
52 /**********************************************************************/
54 int VERSION = 110;
56 int cpu_type;
57 int bus_clock;
58 int bus_MHz;
59 double tb_scale_lo;
60 double tb_scale_hi;
62 /**********************************************************************/
63 extern int _WBArgc;
64 extern char **_WBArgv;
66 int main (int argc, char* argv[])
68 int i, p;
69 double pll;
71 /* these command line arguments are flags */
72 static char *flags[] = {
73 "-forcedemo",
74 "-changepitch",
75 "-mouse",
76 "-joypad",
77 "-music",
78 "-nosfx",
79 "-mmu",
80 "-fps",
81 "-rotatemap",
82 "-maponhu",
83 // "-rtg",
84 // "-native",
85 // "-ehb",
86 "-mousepointer",
87 "-sega3",
88 "-sega6",
89 "-pcchecksum",
90 "-revrseipx",
91 "-directcgx",
92 // "-graffitilo",
93 // "-graffitihi",
94 "-rawkey",
95 "-maxdemo",
96 "-nodraw",
97 "-noblit",
98 "-debugfile",
99 "-shdev",
100 "-regdev",
101 "-comdev",
102 "-nomonsters",
103 "-respawn",
104 "-fast",
105 "-devparm",
106 "-altdeath",
107 "-deathmatch",
108 "-cdrom",
109 "-playdemo",
110 "-avg"
112 /* these command line arguments each take a value */
113 static char *settings[] = {
114 "-screenmode",
115 // "-taskpriority",
116 "-heapsize",
117 "-cpu",
118 "-bus",
119 "-forceversion",
120 "-width",
121 "-height",
122 "-waddir",
123 "-file",
124 "-deh",
125 "-timedemo",
126 "-skill",
127 "-episode",
128 "-timer",
129 "-statcopy",
130 "-record",
131 "-playdemo",
132 "-timedemo",
133 "-loadgame",
134 "-config",
135 "-turbo"
138 printf ("%s\n", &amigaversion[6]);
140 if (argc == 0)
142 /* run from WB, _WBArgv is name and TOOLTYPEs */
143 argc = _WBArgc;
144 argv = _WBArgv;
146 myargc = argc;
147 if ((myargv = malloc(sizeof(char *)*MAXARGVS)) == NULL)
148 I_Error ("malloc(%d) failed", sizeof(char *)*MAXARGVS);
149 memset (myargv, 0, sizeof(char *)*MAXARGVS);
150 memcpy (myargv, argv, sizeof(char *)*myargc);
152 printf ("\nADoomPPC parameters are:\n\n ");
153 for (i = 1; i < myargc; i++)
154 printf (" %s", myargv[i]);
155 printf ("\n\n");
157 cpu_type = PPCGetAttr(PPCINFOTAG_CPU);
158 p = M_CheckParm ("-cpu");
159 if (p && p < myargc - 1) {
160 cpu_type = atoi (myargv[p+1]);
162 switch (cpu_type) {
163 case 3:
164 printf ("\nCPU is PPC603 ");
165 break;
166 case 4:
167 printf ("\nCPU is PPC604 ");
168 break;
169 case 5:
170 printf ("\nCPU is PPC602 ");
171 break;
172 case 6:
173 printf ("\nCPU is PPC603e ");
174 break;
175 case 7:
176 printf ("\nCPU is PPC603e+ ");
177 break;
178 case 8:
179 printf ("\nCPU is PPC604e ");
180 break;
181 default:
182 printf ("\nCPU is PPC ");
183 break;
186 bus_clock = PPCGetAttr(PPCINFOTAG_CPUCLOCK);
187 printf ("running at %d MHz ", bus_clock);
188 if (!bus_clock)
189 bus_clock = 50000000;
190 else
191 bus_clock = bus_clock * 1000000;
192 i = PPCGetAttr(PPCINFOTAG_CPUPLL);
193 switch (i) {
194 case 0:
195 case 1:
196 case 2:
197 case 3:
198 pll = 1.0; // PLL is 1:1 (or bypassed)
199 break;
200 case 4:
201 case 5:
202 pll = 2.0; // PLL is 2:1
203 break;
204 case 8:
205 case 9:
206 pll = 3.0; // PLL is 3:1
207 break;
208 case 12:
209 if ((cpu_type == 4) || (cpu_type == 8))
210 pll = 1.5; // PLL is 1.5:1
211 else
212 pll = 4.0; // PLL is 4:1
213 break;
214 case 13:
215 pll = 4.0; // PLL is 4:1
216 break;
217 default:
218 pll = 3.0;
219 break;
221 printf ("using a PLL divisor of %3.1f.\n", pll);
223 bus_clock = (int)((double)bus_clock / pll);
224 p = M_CheckParm ("-bus");
225 if (p && p < myargc - 1) {
226 bus_clock = atoi (myargv[p+1]);
228 bus_MHz = bus_clock / 1000000;
229 printf("Bus clock is %d MHz.\n\n", bus_MHz);
231 tb_scale_lo = ((double)(bus_clock >> 2)) / 35.0;
232 tb_scale_hi = (4.294967296E9 / (double)(bus_clock >> 2)) * 35.0;
234 SetFPMode (); /* set FPU rounding mode to "trunc towards -infinity" */
236 p = M_CheckParm ("-forceversion");
237 if (p && p < myargc - 1)
238 VERSION = atoi (myargv[p+1]);
240 D_DoomMain ();
242 return 0;