| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
#include "heheader.h" |
| 17 |
|
| 18 |
|
| 19 |
const int object = 0; |
| 20 |
const int xobject = 1; |
| 21 |
const int self = 2; |
| 22 |
const int wordcount = 3; |
| 23 |
const int player = 4; |
| 24 |
const int actor = 5; |
| 25 |
const int location = 6; |
| 26 |
const int verbroutine = 7; |
| 27 |
const int endflag = 8; |
| 28 |
const int prompt = 9; |
| 29 |
const int objectcount = 10; |
| 30 |
const int system_status = 11; |
| 31 |
|
| 32 |
|
| 33 |
const int before = 1; |
| 34 |
const int after = 2; |
| 35 |
const int noun = 3; |
| 36 |
const int adjective = 4; |
| 37 |
const int article = 5; |
| 38 |
|
| 39 |
|
| 40 |
const int screenwidth = 1; |
| 41 |
const int screenheight = 2; |
| 42 |
const int linelength = 3; |
| 43 |
const int windowlines = 4; |
| 44 |
const int cursor_column = 5; |
| 45 |
const int cursor_row = 6; |
| 46 |
const int hasgraphics = 7; |
| 47 |
const int title_caption = 8; |
| 48 |
const int hasvideo = 9; |
| 49 |
const int needs_repaint = 10; |
| 50 |
const int pointer_x = 11; |
| 51 |
const int pointer_y = 12; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
int address_scale = 16; |
| 58 |
|
| 59 |
static char **my_argv = NULL; |
| 60 |
char program_path[MAXPATH] = ""; |
| 61 |
|
| 62 |
void MakeProgramPath(char *path); |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
#if !defined (FRONT_END) |
| 72 |
int main(int argc, char *argv[]) |
| 73 |
#else |
| 74 |
int he_main(int argc, char *argv[]) |
| 75 |
#endif |
| 76 |
{ |
| 77 |
time_t seed; |
| 78 |
|
| 79 |
my_argv = argv; |
| 80 |
|
| 81 |
if (!strcmp(program_path, "") && argv) MakeProgramPath(argv[0]); |
| 82 |
|
| 83 |
|
| 84 |
#if !defined (RANDOM) |
| 85 |
srand((unsigned int)time((time_t *)&seed)); |
| 86 |
#else |
| 87 |
SRANDOM((unsigned int)time((time_t *)&seed)); |
| 88 |
#endif |
| 89 |
|
| 90 |
#if !defined (GLK) |
| 91 |
ParseCommandLine(argc, argv); |
| 92 |
#endif |
| 93 |
|
| 94 |
hugo_init_screen(); |
| 95 |
|
| 96 |
#if defined (DEBUGGER) |
| 97 |
debug_getinvocationpath(argv[0]); |
| 98 |
SwitchtoGame(); |
| 99 |
#endif |
| 100 |
SetupDisplay(); |
| 101 |
|
| 102 |
strcpy(pbuffer, ""); |
| 103 |
|
| 104 |
gameseg = 0; |
| 105 |
|
| 106 |
LoadGame(); |
| 107 |
|
| 108 |
#if defined (DEBUGGER) |
| 109 |
LoadDebuggableFile(); |
| 110 |
StartDebugger(); |
| 111 |
#endif |
| 112 |
|
| 113 |
RunGame(); |
| 114 |
|
| 115 |
hugo_cleanup_screen(); |
| 116 |
|
| 117 |
hugo_blockfree(mem); |
| 118 |
mem = NULL; |
| 119 |
hugo_closefiles(); |
| 120 |
|
| 121 |
return 0; |
| 122 |
} |
| 123 |
|
| 124 |
|
| 125 |
void Banner(void) |
| 126 |
{ |
| 127 |
printf("HUGO %s v%d.%d%s by Kent Tessman (c) 1995-2009\n", |
| 128 |
#if defined (DEBUGGER) |
| 129 |
"DEBUGGER", |
| 130 |
#else |
| 131 |
"ENGINE", |
| 132 |
#endif |
| 133 |
HEVERSION, HEREVISION, HEINTERIM); |
| 134 |
|
| 135 |
printf("The General Coffee Company Film Productions\n"); |
| 136 |
#if defined (PORT_NAME) |
| 137 |
printf("%s port by %s\n", PORT_NAME, PORTER_NAME); |
| 138 |
#endif |
| 139 |
#if defined(GCC_UNIX) && defined(DO_COLOR) |
| 140 |
printf("SYNTAX: %s [switches] filename[%s]\n", my_argv?my_argv[0]:PROGRAM_NAME, |
| 141 |
#else |
| 142 |
printf("SYNTAX: %s filename[%s]\n", my_argv?my_argv[0]:PROGRAM_NAME, |
| 143 |
#endif |
| 144 |
#if defined (DEBUGGER) |
| 145 |
".HDX"); |
| 146 |
#else |
| 147 |
".HEX"); |
| 148 |
#if defined(GCC_UNIX) && defined(DO_COLOR) |
| 149 |
printf("SWITCHES:\n"); |
| 150 |
printf(" Hugo colour values [0-15]:\n"); |
| 151 |
printf("\t-f n foreground colour\n"); |
| 152 |
printf("\t-b n background colour\n"); |
| 153 |
printf("\t-F n status foreground colour\n"); |
| 154 |
printf("\t-B n status background colour\n"); |
| 155 |
#endif |
| 156 |
#endif |
| 157 |
} |
| 158 |
|
| 159 |
void MakeProgramPath(char *path) |
| 160 |
{ |
| 161 |
#ifndef GLK |
| 162 |
char drive[MAXDRIVE], dir[MAXDIR], fname[MAXFILENAME], ext[MAXEXT]; |
| 163 |
|
| 164 |
hugo_splitpath(path, drive, dir, fname, ext); |
| 165 |
hugo_makepath(program_path, drive, dir, "", ""); |
| 166 |
#endif |
| 167 |
} |