home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #2 / amigaacscoverdisc1998-021998.iso / games / doom / adoom / src / amiga_main.c < prev    next >
C/C++ Source or Header  |  1998-01-08  |  4KB  |  173 lines

  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.
  11. //
  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.
  16. //
  17. // $Log:$
  18. //
  19. // DESCRIPTION:
  20. //    Main program, simply calls D_DoomMain high level loop.
  21. //
  22. //-----------------------------------------------------------------------------
  23.  
  24. const char amigaversion[] = "$VER: ADoom 0.5 " __AMIGADATE__ ;
  25.  
  26. long __oslibversion = 39;    /* we require at least OS3.0 for LoadRGB32() */
  27. char __stdiowin[] = "CON:20/50/500/130/ADoom";
  28. char __stdiov37[] = "/AUTO";
  29.  
  30. #include <stdio.h>
  31. #include <stdlib.h>
  32.  
  33. #include <exec/exec.h>
  34. #include <workbench/startup.h>
  35. #include <workbench/workbench.h>
  36. #include <workbench/icon.h>
  37.  
  38. #include <proto/exec.h>
  39. #include <proto/icon.h>
  40.  
  41. #include "doomdef.h"
  42.  
  43. #include "m_argv.h"
  44. #include "d_main.h"
  45. #include "i_system.h"
  46. #include "m_fixed.h"
  47.  
  48. /**********************************************************************/
  49. extern struct ExecBase *SysBase;
  50.  
  51. int cpu_type;
  52.  
  53. /**********************************************************************/
  54. int main (int argc, char* argv[])
  55.   struct WBStartup *argmsg;
  56.   struct WBArg *wb_arg;
  57.   struct DiskObject *obj;
  58.   char **toolarray, *s;
  59.   int i;
  60.  
  61.   /* these command line arguments are flags */
  62.   static char *flags[] = {
  63.     "-forcedemo",
  64.     "-changepitch",
  65.     "-mouse",
  66.     "-joypad",
  67.     "-music",
  68.     "-maxdemo",
  69.     "-nodraw",
  70.     "-noblit",
  71.     "-debugfile",
  72.     "-shdev",
  73.     "-regdev",
  74.     "-comdev",
  75.     "-nomonsters",
  76.     "-respawn",
  77.     "-fast",
  78.     "-devparm",
  79.     "-altdeath",
  80.     "-deathmatch",
  81.     "-cdrom",
  82.     "-turbo",
  83.     "-playdemo",
  84.     "-avg"
  85.   };
  86.   /* these command line arguments each take a value */
  87.   static char *settings[] = {
  88.     "-screenmode",
  89.     "-taskpriority",
  90.     "-file",
  91.     "-timedemo",
  92.     "-skill",
  93.     "-episode",
  94.     "-timer",
  95.     "-statcopy",
  96.     "-record",
  97.     "-playdemo",
  98.     "-timedemo",
  99.     "-loadgame",
  100.     "-config"
  101.   };
  102.  
  103.   printf ("%s\n", &amigaversion[6]);
  104.  
  105.   myargc = argc;
  106.   if ((myargv = malloc(sizeof(char *)*MAXARGVS)) == NULL)
  107.     I_Error ("malloc(%d) failed", sizeof(char *)*MAXARGVS);
  108.   memset (myargv, 0, sizeof(char *)*MAXARGVS);
  109.   memcpy (myargv, argv, sizeof(char *)*myargc);
  110.  
  111.   /* parse icon tooltypes and convert them to argc/argv format */
  112.   if (argc == 0) {
  113.     argmsg = (struct WBStartup *)argv;
  114.     wb_arg = argmsg->sm_ArgList;
  115.     if ((myargv[myargc] = malloc(strlen(wb_arg->wa_Name)+1)) == NULL)
  116.       I_Error ("malloc(%d) failed", strlen(wb_arg->wa_Name)+1);
  117.     strcpy (myargv[myargc++], wb_arg->wa_Name);
  118.   }
  119.   if ((obj = GetDiskObject (myargv[0])) != NULL) {
  120.     toolarray = obj->do_ToolTypes;
  121.     for (i = 0; i < sizeof(flags)/sizeof(flags[0]); i++) {
  122.       if (FindToolType (toolarray, &flags[i][1]) != NULL) {
  123.         myargv[myargc++] = flags[i];
  124.       }
  125.     }
  126.     for (i = 0; i < sizeof(settings)/sizeof(settings[0]); i++) {
  127.       if ((s = FindToolType (toolarray, &settings[i][1])) != NULL) {
  128.         myargv[myargc++] = settings[i];
  129.         if ((myargv[myargc] = malloc(strlen(s)+1)) == NULL)
  130.           I_Error ("malloc(%d) failed", strlen(s)+1);
  131.         strcpy(myargv[myargc++], s);
  132.       }
  133.     }
  134.     FreeDiskObject (obj);
  135.   }
  136.  
  137.   if (argc != myargc) {
  138.     printf ("\nIcon tooltypes translated command line to:\n\n    ");
  139.     for (i = 0; i < myargc; i++)
  140.       printf (" %s", myargv[i]);
  141.     printf ("\n\n");
  142.   }
  143.  
  144.   if ((SysBase->AttnFlags & AFF_68060) != 0)
  145.     cpu_type = 68060;
  146.   else if ((SysBase->AttnFlags & AFF_68040) != 0)
  147.     cpu_type = 68040;
  148.   else if ((SysBase->AttnFlags & AFF_68030) != 0)
  149.     cpu_type = 68030;
  150.   else if ((SysBase->AttnFlags & AFF_68020) != 0)
  151.     cpu_type = 68020;
  152.   else if ((SysBase->AttnFlags & AFF_68010) != 0)
  153.     cpu_type = 68010;
  154.   else
  155.     cpu_type = 68000;
  156.  
  157.   if (cpu_type >= 68060) {
  158.     FixedMul = FixedMul_060;
  159.     if ((SysBase->AttnFlags & AFB_68881) != 0)
  160.       FixedDiv = FixedDiv_060fpu;
  161.     else
  162.       FixedDiv = FixedDiv_040;
  163.   } else {
  164.     FixedMul = FixedMul_040;
  165.     FixedDiv = FixedDiv_040;
  166.   }
  167.  
  168.   D_DoomMain ();
  169.  
  170.   return 0;
  171. }
  172.