OSDN Git Service

- Added PlayActorSound identifiers to zdefs.acs.
[zandronum/zandronum-acc.git] / acc.c
diff --git a/acc.c b/acc.c
index cbe9d21..41f891e 100644 (file)
--- a/acc.c
+++ b/acc.c
@@ -22,7 +22,7 @@
 \r
 // MACROS ------------------------------------------------------------------\r
 \r
-#define VERSION_TEXT "1.37"\r
+#define VERSION_TEXT "1.53"\r
 #define COPYRIGHT_YEARS_TEXT "1995"\r
 \r
 // TYPES -------------------------------------------------------------------\r
@@ -125,7 +125,9 @@ static void DisplayBanner(void)
        fprintf(stderr, "ZDoom changes and language extensions by Randy Heit\n");\r
        fprintf(stderr, "Further changes by Brad Carney\n");\r
        fprintf(stderr, "Even more changes by James Bentler\n");\r
+       fprintf(stderr, "Some additions by Michael \"Necromage\" Weber\n");\r
        fprintf(stderr, "Error reporting improvements and limit expansion by Ty Halderman\n");\r
+       fprintf(stderr, "Include paths added by Pascal vd Heiden\n");\r
 }\r
 \r
 //==========================================================================\r
@@ -157,21 +159,25 @@ static void Init(void)
 //\r
 // ProcessArgs\r
 //\r
+// Pascal 12/11/08\r
+// Allowing space after options (option parameter as the next argument)\r
+//\r
 //==========================================================================\r
 \r
 static void ProcessArgs(void)\r
 {\r
-       int i;\r
-       int count;\r
+       int i = 1;\r
+       int count = 0;\r
        char *text;\r
        char option;\r
-\r
-       count = 0;\r
-       for(i = 1; i < ArgCount; i++)\r
+       \r
+       while(i < ArgCount)\r
        {\r
                text = ArgVector[i];\r
+               \r
                if(*text == '-')\r
                {\r
+                       // Option\r
                        text++;\r
                        if(*text == 0)\r
                        {\r
@@ -180,6 +186,13 @@ static void ProcessArgs(void)
                        option = toupper(*text++);\r
                        switch(option)\r
                        {\r
+                               case 'I':\r
+                                       if((i + 1) < ArgCount)\r
+                                       {\r
+                                               TK_AddIncludePath(ArgVector[++i]);\r
+                                       }\r
+                                       break;\r
+                                       \r
                                case 'D':\r
                                        acs_DebugMode = YES;\r
                                        acs_VerboseMode = YES;\r
@@ -188,36 +201,56 @@ static void ProcessArgs(void)
                                                OpenDebugFile(text);\r
                                        }\r
                                        break;\r
+                                       \r
                                case 'H':\r
                                        pc_NoShrink = TRUE;\r
                                        pc_HexenCase = TRUE;\r
+                                       pc_EnforceHexen = toupper(*text) != 'H';\r
+                                       pc_WarnNotHexen = toupper(*text) == 'H';\r
                                        break;\r
+                                       \r
                                default:\r
                                        DisplayUsage();\r
                                        break;\r
                        }\r
-                       continue;\r
                }\r
-               count++;\r
-               switch(count)\r
+               else\r
                {\r
-                       case 1:\r
-                               strcpy(acs_SourceFileName, text);\r
-                               MS_SuggestFileExt(acs_SourceFileName, ".acs");\r
-                               break;\r
-                       case 2:\r
-                               strcpy(ObjectFileName, text);\r
-                               MS_SuggestFileExt(ObjectFileName, ".o");\r
-                               break;\r
-                       default:\r
-                               DisplayUsage();\r
-                               break;\r
+                       // Input/output file\r
+                       count++;\r
+                       switch(count)\r
+                       {\r
+                               case 1:\r
+                                       strcpy(acs_SourceFileName, text);\r
+                                       MS_SuggestFileExt(acs_SourceFileName, ".acs");\r
+                                       break;\r
+                                       \r
+                               case 2:\r
+                                       strcpy(ObjectFileName, text);\r
+                                       MS_SuggestFileExt(ObjectFileName, ".o");\r
+                                       break;\r
+                                       \r
+                               default:\r
+                                       DisplayUsage();\r
+                                       break;\r
+                       }\r
                }\r
+               \r
+               // Next arg\r
+               i++;\r
        }\r
+       \r
        if(count == 0)\r
        {\r
                DisplayUsage();\r
        }\r
+\r
+       TK_AddIncludePath(".");\r
+#ifdef unix\r
+       TK_AddIncludePath("/usr/local/share/acc/");\r
+#endif\r
+       TK_AddProgramIncludePath(ArgVector[0]);\r
+       \r
        if(count == 1)\r
        {\r
                strcpy(ObjectFileName, acs_SourceFileName);\r
@@ -235,8 +268,10 @@ static void ProcessArgs(void)
 static void DisplayUsage(void)\r
 {\r
        puts("\nUsage: ACC [options] source[.acs] [object[.o]]\n");\r
-       puts("-d[file]  Output debugging information");\r
-       puts("-h        Create pcode compatible with Hexen and old ZDooms");\r
+       puts("-i [path]  Add include path to find include files");\r
+       puts("-d[file]   Output debugging information");\r
+       puts("-h         Create pcode compatible with Hexen and old ZDooms");\r
+       puts("-hh        Like -h, but use of new features is only a warning");\r
        exit(1);\r
 }\r
 \r