static void check_infocom(void) { /* All V1234 games from the Infocom fact sheet for which both a * release and serial number are available. */ const char *v1234[] = { "1-841226", "47-850313", "64-850404", "84-850516", "105-850605", "131-850628", "132-850702", "143-850711", "77-850814", "79-851122", "97-851218", "99-861014", "86-870212", "116-870602", "160-880521", "23-840809", "25-840917", "18-820311", "19-820427", "21-820512", "22-820809", "26-821108", "27-831005", "28-850129", "10-830810", "15-831107", "16-831118", "16-840518", "24-851118", "29-860820", "62-840706", "108-840809", "119-840822", "47-840914", "56-841221", "58-851002", "59-851108", "60-861002", "235-861118", "37-861215", "22-830916", "22-840522", "48-860103", "57-860121", "118-860325", "160-860521", "50-860711", "59-860730", "203-870506", "219-870912", "221-870918", "4-860918", "9-861022", "13-880501", "70-870423", "77-870428", "117-870512", "19-870722", "20-870722", "1-830306", "1-830517", "1-830614", "6-830619", "20-830708", "26-831014", "29-840118", "37-851003", "39-880501", "26-870730", "86-840320", "15-840501", "15-840522", "15-840612", "15-840716", "17-850208", "16-850515", "16-850603", "18-850919", "17-831001", "67-831208", "85-840106", "4-840131", "6-840508", "13-851021", "15-851108", "18-860904", "63-850916", "87-860904", "15-820901", "17-821021", "18-830114", "28-861221", "36-870106", "63-870218", "87-870326", "107-870430", "14-841005", "14-841005", "18-850222", "5-830222", "7-830419", "8-830521", "8-840521", "1-851202", "1-860221", "14-860313", "11-860509", "12-860926", "15-870628", "68-850501", "69-850920", "13-830524", "18-830910", "20-831119", "21-831208", "22-840924", "23-840925", "2-AS000C", "15-UG3AU5", "23-820428", "25-820515", "26-820803", "28-821013", "30-830330", "75-830929", "76-840509", "88-840726", "119-880429", "7-UG3AU5", "15-820308", "17-820427", "18-820512", "19-820721", "22-830331", "23-830411", "22-840518", "48-840904", "63-860811", "10-820818", "12-821025", "15-830331", "16-830410", "15-840518", "17-840727", "25-860811", }; for(size_t i = 0; i < sizeof v1234 / sizeof *v1234; i++) { if(is_story(v1234[i])) { is_infocom_v1234 = 1; return; } } }
static void read_config(void) { FILE *fp; char file[MAX_PATH + 1]; char line[MAX_LINE]; char *key, *val, *p; long n; int story_matches = 1; zterp_os_rcfile(file, sizeof file); fp = fopen(file, "r"); if(fp == NULL) return; while(fgets(line, sizeof line, fp) != NULL) { line[strcspn(line, "#\n")] = 0; if(line[0] == 0) continue; if(line[0] == '[') { p = strrchr(line, ']'); if(p != NULL && p[1] == 0) { *p = 0; story_matches = 0; for(p = strtok(line + 1, " ,"); p != NULL; p = strtok(NULL, " ,")) { if(is_story(p)) story_matches = 1; } } continue; } if(!story_matches) continue; key = strtok(line, " \t="); if(key == NULL) continue; val = strtok(NULL, "="); if(val == NULL) continue; /* Trim whitespace. */ while(isspace((unsigned char)*val)) val++; if(*val == 0) continue; p = val + strlen(val) - 1; while(isspace((unsigned char)*p)) *p-- = 0; n = strtol(val, NULL, 10); #define BOOL(name) else if(strcmp(key, #name) == 0) options.name = (n != 0) #define NUMBER(name) else if(strcmp(key, #name) == 0) options.name = n #define STRING(name) else if(strcmp(key, #name) == 0) do { free(options.name); options.name = xstrdup(val); } while(0) #define CHAR(name) else if(strcmp(key, #name) == 0) options.name = val[0] #ifdef GARGLK #define COLOR(name, num)else if(strcmp(key, "color_" #name) == 0) update_color(num, strtol(val, NULL, 16)) #else #define COLOR(name, num)else if(0) #endif if(0); NUMBER(eval_stack_size); NUMBER(call_stack_size); BOOL (disable_color); BOOL (disable_timed); BOOL (disable_sound); BOOL (enable_escape); STRING(escape_string); BOOL (disable_fixed); BOOL (assume_fixed); BOOL (disable_graphics_font); BOOL (enable_alt_graphics); BOOL (disable_term_keys); BOOL (disable_utf8); BOOL (force_utf8); BOOL (disable_meta_commands); NUMBER(max_saves); BOOL (disable_undo_compression); NUMBER(int_number); CHAR (int_version); BOOL (replay_on); STRING(replay_name); BOOL (record_on); STRING(record_name); BOOL (transcript_on); STRING(transcript_name); BOOL (disable_abbreviations); BOOL (enable_censorship); BOOL (overwrite_transcript); NUMBER(random_seed); STRING(random_device); COLOR(black, 2); COLOR(red, 3); COLOR(green, 4); COLOR(yellow, 5); COLOR(blue, 6); COLOR(magenta, 7); COLOR(cyan, 8); COLOR(white, 9); #ifndef ZTERP_NO_CHEAT else if(strcmp(key, "cheat") == 0) cheat(val); #endif #undef BOOL #undef NUMBER #undef STRING #undef CHAR #undef COLOR }
int is_journey(void) { return is_story("83-890706"); }
int is_sherlock(void) { return is_story("97-871026") || is_story("21-871214") || is_story("22-880112") || is_story("26-880127"); }
int is_beyond_zork(void) { return is_story("47-870915") || is_story("49-870917") || is_story("51-870923") || is_story("57-871221"); }