X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ffiles.c;h=e6baec2532cc26d4636cb68c21a7e129e3f62798;hb=6d7ebf6db8a9a57f2e3e398da1d2f7d8d084523f;hp=6b395bf0cd7e8c1eed3b49a382ef5c1ab8e88d11;hpb=c5d03f36989babf47697957101ecebe9b7b9cbe8;p=rocksndiamonds.git diff --git a/src/files.c b/src/files.c index 6b395bf0..e6baec25 100644 --- a/src/files.c +++ b/src/files.c @@ -119,6 +119,10 @@ #define CONF_CONTENTS_ELEMENT(b,c,x,y) ((b[CONF_CONTENT_BYTE_POS(c,x,y)]<< 8)|\ (b[CONF_CONTENT_BYTE_POS(c,x,y) + 1])) +#if 0 +static void LoadLevel_InitPlayfield(struct LevelInfo *, char *); +#endif + static struct LevelInfo li; static struct @@ -286,6 +290,10 @@ static struct EL_PLAYER_4, CONF_VALUE_BOOLEAN_4, &li.use_explosion_element[3], FALSE }, + { + EL_PLAYER_1, CONF_VALUE_BOOLEAN_5, + &li.continuous_snapping, TRUE + }, { EL_PLAYER_1, CONF_VALUE_INTEGER_1, &li.initial_player_stepsize, STEPSIZE_NORMAL @@ -568,7 +576,9 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) level->can_pass_to_walkable = FALSE; level->grow_into_diggable = TRUE; +#if 0 level->block_snap_field = TRUE; +#endif level->block_last_field = FALSE; /* EM does not block by default */ level->sp_block_last_field = TRUE; /* SP blocks the last field */ @@ -718,8 +728,13 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) /* !!! now done in InitElementPropertiesStatic() (see above) !!! */ /* !!! (else properties set there will be overwritten here) !!! */ /* start with no properties at all */ +#if 1 + for (j = 0; j < NUM_EP_BITFIELDS; j++) + ei->properties[j] = EP_BITMASK_DEFAULT; +#else for (j = 0; j < NUM_EP_BITFIELDS; j++) Properties[element][j] = EP_BITMASK_DEFAULT; +#endif #endif /* now set default properties */ @@ -759,7 +774,7 @@ static void setLevelInfoToDefaults(struct LevelInfo *level) return; /* try to determine better author name than 'anonymous' */ - if (strcmp(leveldir_current->author, ANONYMOUS_NAME) != 0) + if (!strEqual(leveldir_current->author, ANONYMOUS_NAME)) { strncpy(level->author, leveldir_current->author, MAX_LEVEL_AUTHOR_LEN); level->author[MAX_LEVEL_AUTHOR_LEN] = '\0'; @@ -800,9 +815,15 @@ static void setFileInfoToDefaults(struct LevelFileInfo *level_file_info) static void ActivateLevelTemplate() { +#if 1 + /* Currently there is no special action needed to activate the template + data, because 'element_info' property settings overwrite the original + level data, while all other variables do not change. */ +#else /* Currently there is no special action needed to activate the template data, because 'element_info' and 'Properties' overwrite the original level data, while all other variables do not change. */ +#endif } static char *getLevelFilenameFromBasename(char *basename) @@ -961,7 +982,7 @@ static int getFiletypeFromID(char *filetype_id) { char *id_lower = getStringToLower(filetype_id_list[i].id); - if (strcmp(filetype_id_lower, id_lower) == 0) + if (strEqual(filetype_id_lower, id_lower)) filetype = filetype_id_list[i].filetype; free(id_lower); @@ -1381,10 +1402,17 @@ static int LoadLevel_CUS1(FILE *file, int chunk_size, struct LevelInfo *level) int element = getFile16BitBE(file); int properties = getFile32BitBE(file); +#if 1 + if (IS_CUSTOM_ELEMENT(element)) + element_info[element].properties[EP_BITFIELD_BASE] = properties; + else + Error(ERR_WARN, "invalid custom element number %d", element); +#else if (IS_CUSTOM_ELEMENT(element)) Properties[element][EP_BITFIELD_BASE] = properties; else Error(ERR_WARN, "invalid custom element number %d", element); +#endif } return chunk_size; @@ -1445,7 +1473,11 @@ static int LoadLevel_CUS3(FILE *file, int chunk_size, struct LevelInfo *level) ei->description[j] = getFile8Bit(file); ei->description[MAX_ELEMENT_NAME_LEN] = 0; +#if 1 + ei->properties[EP_BITFIELD_BASE] = getFile32BitBE(file); +#else Properties[element][EP_BITFIELD_BASE] = getFile32BitBE(file); +#endif /* some free bytes for future properties and padding */ ReadUnusedBytesFromFile(file, 7); @@ -1532,7 +1564,11 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level) ei->description[i] = getFile8Bit(file); ei->description[MAX_ELEMENT_NAME_LEN] = 0; +#if 1 + ei->properties[EP_BITFIELD_BASE] = getFile32BitBE(file); +#else Properties[element][EP_BITFIELD_BASE] = getFile32BitBE(file); +#endif ReadUnusedBytesFromFile(file, 4); /* reserved for more base properties */ ei->num_change_pages = getFile8Bit(file); @@ -1830,12 +1866,12 @@ static void LoadLevelFromFileInfo_RND(struct LevelInfo *level, } getFileChunkBE(file, chunk_name, NULL); - if (strcmp(chunk_name, "RND1") == 0) + if (strEqual(chunk_name, "RND1")) { getFile32BitBE(file); /* not used */ getFileChunkBE(file, chunk_name, NULL); - if (strcmp(chunk_name, "CAVE") != 0) + if (!strEqual(chunk_name, "CAVE")) { level->no_valid_file = TRUE; @@ -1911,7 +1947,7 @@ static void LoadLevelFromFileInfo_RND(struct LevelInfo *level, int i = 0; while (chunk_info[i].name != NULL && - strcmp(chunk_name, chunk_info[i].name) != 0) + !strEqual(chunk_name, chunk_info[i].name)) i++; if (chunk_info[i].name == NULL) @@ -2389,10 +2425,17 @@ void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) }; struct LevelInfo_EM *level_em = level->native_em_level; struct LEVEL *lev = level_em->lev; - struct PLAYER *ply1 = level_em->ply1; - struct PLAYER *ply2 = level_em->ply2; + struct PLAYER **ply = level_em->ply; int i, j, x, y; +#if 0 + printf("::: A\n"); + for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) + for (j = 0; j < 8; j++) + printf("::: ball %d, %d: %d\n", i, j, + level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]); +#endif + lev->width = MIN(level->fieldx, EM_MAX_CAVE_WIDTH); lev->height = MIN(level->fieldy, EM_MAX_CAVE_HEIGHT); @@ -2445,6 +2488,13 @@ void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) map_element_RND_to_EM(level-> ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]); +#if 0 + for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) + for (j = 0; j < 8; j++) + printf("::: ball %d, %d: %d\n", i, j, + level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]); +#endif + map_android_clone_elements_RND_to_EM(level); #if 0 @@ -2457,6 +2507,45 @@ void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) for (x = 0; x < EM_MAX_CAVE_WIDTH; x++) level_em->cave[x][y] = ZBORDER; +#if 1 + +#if 0 +#if 1 + LoadLevel_InitPlayfield(); +#else + lev_fieldx = lev->width; /* !!! also in LoadLevel_InitPlayfield() !!! */ + lev_fieldy = lev->height; /* !!! also in LoadLevel_InitPlayfield() !!! */ + SetBorderElement(); /* !!! also in LoadLevel_InitPlayfield() !!! */ +#endif +#endif + +#if 0 + printf("::: BorderElement == %d\n", BorderElement); +#endif + + if (BorderElement == EL_STEELWALL) + { + for (y = 0; y < lev->height + 2; y++) + for (x = 0; x < lev->width + 2; x++) + level_em->cave[x + 1][y + 1] = map_element_RND_to_EM(EL_STEELWALL); + } + + /* then copy the real level contents from level file into the playfield */ + for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++) + { + int new_element = map_element_RND_to_EM(level->field[x][y]); + int offset = (BorderElement == EL_STEELWALL ? 1 : 0); + int xx = x + 1 + offset; + int yy = y + 1 + offset; + + if (level->field[x][y] == EL_AMOEBA_DEAD) + new_element = map_element_RND_to_EM(EL_AMOEBA_WET); + + level_em->cave[xx][yy] = new_element; + } + +#else + /* then copy the real level contents from level file into the playfield */ for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++) { @@ -2468,15 +2557,46 @@ void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) level_em->cave[x + 1][y + 1] = new_element; } +#endif + +#if 1 + + for (i = 0; i < MAX_PLAYERS; i++) + { + ply[i]->x_initial = 0; + ply[i]->y_initial = 0; + } + +#else + ply1->x_initial = 0; ply1->y_initial = 0; ply2->x_initial = 0; ply2->y_initial = 0; +#endif + /* initialize player positions and delete players from the playfield */ for (y = 0; y < lev->height; y++) for (x = 0; x < lev->width; x++) { + +#if 1 + if (ELEM_IS_PLAYER(level->field[x][y])) + { + int player_nr = GET_PLAYER_NR(level->field[x][y]); + int offset = (BorderElement == EL_STEELWALL ? 1 : 0); + int xx = x + 1 + offset; + int yy = y + 1 + offset; + + ply[player_nr]->x_initial = xx; + ply[player_nr]->y_initial = yy; + + level_em->cave[xx][yy] = map_element_RND_to_EM(EL_EMPTY); + } + +#else + #if 1 /* !!! CURRENTLY ONLY SUPPORT FOR ONE PLAYER !!! */ if (ELEM_IS_PLAYER(level->field[x][y])) @@ -2500,6 +2620,17 @@ void CopyNativeLevel_RND_to_EM(struct LevelInfo *level) level_em->cave[x + 1][y + 1] = map_element_RND_to_EM(EL_EMPTY); } #endif + +#endif + + } + + if (BorderElement == EL_STEELWALL) + { +#if 1 + lev->width += 2; + lev->height += 2; +#endif } } @@ -2518,8 +2649,7 @@ void CopyNativeLevel_EM_to_RND(struct LevelInfo *level) }; struct LevelInfo_EM *level_em = level->native_em_level; struct LEVEL *lev = level_em->lev; - struct PLAYER *ply1 = level_em->ply1; - struct PLAYER *ply2 = level_em->ply2; + struct PLAYER **ply = level_em->ply; int i, j, x, y; level->fieldx = MIN(lev->width, MAX_LEV_FIELDX); @@ -2570,11 +2700,27 @@ void CopyNativeLevel_EM_to_RND(struct LevelInfo *level) level->wind_direction_initial = map_direction_EM_to_RND(lev->wind_direction_initial); +#if 0 + printf("::: foo\n"); + for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) + for (j = 0; j < 8; j++) + printf("::: ball %d, %d: %d\n", i, j, + level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]); +#endif + for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) for (j = 0; j < 8; j++) level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]] = map_element_EM_to_RND(lev->ball_array[i][j]); +#if 0 + printf("::: bar\n"); + for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) + for (j = 0; j < 8; j++) + printf("::: ball %d, %d: %d\n", i, j, + level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]); +#endif + map_android_clone_elements_EM_to_RND(level); #if 0 @@ -2593,13 +2739,50 @@ void CopyNativeLevel_EM_to_RND(struct LevelInfo *level) level->field[x][y] = new_element; } +#if 0 + printf("::: bar 0\n"); + for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) + for (j = 0; j < 8; j++) + printf("::: ball %d, %d: %d\n", i, j, + level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]); +#endif + +#if 1 + + for (i = 0; i < MAX_PLAYERS; i++) + { + /* in case of all players set to the same field, use the first player */ + int nr = MAX_PLAYERS - i - 1; + int jx = ply[nr]->x_initial - 1; + int jy = ply[nr]->y_initial - 1; + +#if 0 + printf("::: player %d: %d, %d\n", nr, jx, jy); +#endif + + if (jx != -1 && jy != -1) + level->field[jx][jy] = EL_PLAYER_1 + nr; + } + +#else + /* in case of both players set to the same field, use the first player */ level->field[ply2->x_initial - 1][ply2->y_initial - 1] = EL_PLAYER_2; level->field[ply1->x_initial - 1][ply1->y_initial - 1] = EL_PLAYER_1; +#endif + #if 0 printf("::: native Emerald Mine file version: %d\n", level_em->file_version); #endif + +#if 0 + printf("::: bar 2\n"); + for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) + for (j = 0; j < 8; j++) + printf("::: ball %d, %d: %d\n", i, j, + level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]); +#endif } static void LoadLevelFromFileInfo_EM(struct LevelInfo *level, @@ -2617,6 +2800,30 @@ void CopyNativeLevel_RND_to_Native(struct LevelInfo *level) void CopyNativeLevel_Native_to_RND(struct LevelInfo *level) { + +#if 0 + { + static int ball_xy[8][2] = + { + { 0, 0 }, + { 1, 0 }, + { 2, 0 }, + { 0, 1 }, + { 2, 1 }, + { 0, 2 }, + { 1, 2 }, + { 2, 2 }, + }; + int i, j; + + printf("::: A6\n"); + for (i = 0; i < MAX_ELEMENT_CONTENTS; i++) + for (j = 0; j < 8; j++) + printf("::: ball %d, %d: %d\n", i, j, + level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]]); + } +#endif + if (level->game_engine_type == GAME_ENGINE_TYPE_EM) CopyNativeLevel_EM_to_RND(level); } @@ -2773,8 +2980,12 @@ static void LoadLevelFromFileStream_SP(FILE *file, struct LevelInfo *level, level->time_wheel = 0; level->amoeba_content = EL_EMPTY; +#if 1 + /* original Supaplex does not use score values -- use default values */ +#else for (i = 0; i < LEVEL_SCORE_ELEMENTS; i++) level->score[i] = 0; /* !!! CORRECT THIS !!! */ +#endif /* there are no yamyams in supaplex levels */ for (i = 0; i < level->num_yamyam_contents; i++) @@ -2877,7 +3088,7 @@ static void LoadLevelFromFileInfo_SP(struct LevelInfo *level, if (reading_multipart_level && (!is_multipart_level || - strcmp(level->name, multipart_level.name) != 0)) + !strEqual(level->name, multipart_level.name))) { /* we are already reading parts of a multi-part level, but this level is either not a multi-part level, or a part of a different multi-part @@ -2999,10 +3210,15 @@ void LoadLevelFromFileInfo(struct LevelInfo *level, if (level->game_engine_type == GAME_ENGINE_TYPE_UNKNOWN) level->game_engine_type = GAME_ENGINE_TYPE_RND; +#if 1 + if (level_file_info->type != LEVEL_FILE_TYPE_RND) + CopyNativeLevel_Native_to_RND(level); +#else if (level_file_info->type == LEVEL_FILE_TYPE_RND) CopyNativeLevel_RND_to_Native(level); else CopyNativeLevel_Native_to_RND(level); +#endif } void LoadLevelFromFilename(struct LevelInfo *level, char *filename) @@ -3024,6 +3240,19 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) if (leveldir_current == NULL) /* only when dumping level */ return; + /* all engine modifications also valid for levels which use latest engine */ +#if 1 + if (level->game_version < VERSION_IDENT(3,2,0,5)) + { + /* time bonus score was given for 10 s instead of 1 s before 3.2.0-5 */ + level->score[SC_TIME_BONUS] /= 10; + } +#endif + +#if 0 + leveldir_current->latest_engine = TRUE; /* !!! TEST ONLY !!! */ +#endif + if (leveldir_current->latest_engine) { /* ---------- use latest game engine ----------------------------------- */ @@ -3086,8 +3315,16 @@ static void LoadLevel_InitVersion(struct LevelInfo *level, char *filename) /* extra time score was same value as time left score before 3.2.0-5 */ level->extra_time_score = level->score[SC_TIME_BONUS]; +#if 0 /* time bonus score was given for 10 s instead of 1 s before 3.2.0-5 */ level->score[SC_TIME_BONUS] /= 10; +#endif + } + + if (level->game_version < VERSION_IDENT(3,2,0,7)) + { + /* default behaviour for snapping was "not continuous" before 3.2.0-7 */ + level->continuous_snapping = FALSE; } /* only few elements were able to actively move into acid before 3.1.0 */ @@ -3141,6 +3378,7 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) int element = EL_CUSTOM_START + i; /* order of checking and copying events to be mapped is important */ + /* (do not change the start and end value -- they are constant) */ for (j = CE_BY_OTHER_ACTION; j >= CE_VALUE_GETS_ZERO; j--) { if (HAS_CHANGE_EVENT(element, j - 2)) @@ -3151,6 +3389,7 @@ static void LoadLevel_InitElements(struct LevelInfo *level, char *filename) } /* order of checking and copying events to be mapped is important */ + /* (do not change the start and end value -- they are constant) */ for (j = CE_PLAYER_COLLECTS_X; j >= CE_HITTING_SOMETHING; j--) { if (HAS_CHANGE_EVENT(element, j - 1)) @@ -3290,6 +3529,21 @@ static void LoadLevel_InitPlayfield(struct LevelInfo *level, char *filename) SetBorderElement(); } +static void LoadLevel_InitNativeEngines(struct LevelInfo *level,char *filename) +{ + struct LevelFileInfo *level_file_info = &level->file_info; + +#if 1 + if (level_file_info->type == LEVEL_FILE_TYPE_RND) + CopyNativeLevel_RND_to_Native(level); +#else + if (level_file_info->type == LEVEL_FILE_TYPE_RND) + CopyNativeLevel_RND_to_Native(level); + else + CopyNativeLevel_Native_to_RND(level); +#endif +} + void LoadLevelTemplate(int nr) { char *filename; @@ -3320,6 +3574,8 @@ void LoadLevel(int nr) LoadLevel_InitVersion(&level, filename); LoadLevel_InitElements(&level, filename); LoadLevel_InitPlayfield(&level, filename); + + LoadLevel_InitNativeEngines(&level, filename); } static void SaveLevel_VERS(FILE *file, struct LevelInfo *level) @@ -3498,6 +3754,20 @@ static void SaveLevel_CUS1(FILE *file, struct LevelInfo *level, { int element = EL_CUSTOM_START + i; +#if 1 + struct ElementInfo *ei = &element_info[element]; + + if (ei->properties[EP_BITFIELD_BASE] != EP_BITMASK_DEFAULT) + { + if (check < num_changed_custom_elements) + { + putFile16BitBE(file, element); + putFile32BitBE(file, ei->properties[EP_BITFIELD_BASE]); + } + + check++; + } +#else if (Properties[element][EP_BITFIELD_BASE] != EP_BITMASK_DEFAULT) { if (check < num_changed_custom_elements) @@ -3508,6 +3778,7 @@ static void SaveLevel_CUS1(FILE *file, struct LevelInfo *level, check++; } +#endif } if (check != num_changed_custom_elements) /* should not happen */ @@ -3566,7 +3837,11 @@ static void SaveLevel_CUS3(FILE *file, struct LevelInfo *level, for (j = 0; j < MAX_ELEMENT_NAME_LEN; j++) putFile8Bit(file, ei->description[j]); +#if 1 + putFile32BitBE(file, ei->properties[EP_BITFIELD_BASE]); +#else putFile32BitBE(file, Properties[element][EP_BITFIELD_BASE]); +#endif /* some free bytes for future properties and padding */ WriteUnusedBytesToFile(file, 7); @@ -3639,7 +3914,11 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element) for (i = 0; i < MAX_ELEMENT_NAME_LEN; i++) putFile8Bit(file, ei->description[i]); +#if 1 + putFile32BitBE(file, ei->properties[EP_BITFIELD_BASE]); +#else putFile32BitBE(file, Properties[element][EP_BITFIELD_BASE]); +#endif WriteUnusedBytesToFile(file, 4); /* reserved for more base properties */ putFile8Bit(file, ei->num_change_pages); @@ -4264,12 +4543,12 @@ void LoadTapeFromFilename(char *filename) } getFileChunkBE(file, chunk_name, NULL); - if (strcmp(chunk_name, "RND1") == 0) + if (strEqual(chunk_name, "RND1")) { getFile32BitBE(file); /* not used */ getFileChunkBE(file, chunk_name, NULL); - if (strcmp(chunk_name, "TAPE") != 0) + if (!strEqual(chunk_name, "TAPE")) { tape.no_valid_file = TRUE; @@ -4335,7 +4614,7 @@ void LoadTapeFromFilename(char *filename) int i = 0; while (chunk_info[i].name != NULL && - strcmp(chunk_name, chunk_info[i].name) != 0) + !strEqual(chunk_name, chunk_info[i].name)) i++; if (chunk_info[i].name == NULL) @@ -4512,6 +4791,7 @@ void SaveTape(int nr) void DumpTape(struct TapeInfo *tape) { + int tape_frame_counter; int i, j; if (tape->no_valid_file) @@ -4529,12 +4809,14 @@ void DumpTape(struct TapeInfo *tape) printf("Level series identifier: '%s'\n", tape->level_identifier); printf_line("-", 79); + tape_frame_counter = 0; + for (i = 0; i < tape->length; i++) { if (i >= MAX_TAPE_LEN) break; - printf("%03d: ", i); + printf("%04d: ", i); for (j = 0; j < MAX_PLAYERS; j++) { @@ -4553,7 +4835,10 @@ void DumpTape(struct TapeInfo *tape) } } - printf("(%03d)\n", tape->pos[i].delay); + printf("(%03d) ", tape->pos[i].delay); + printf("[%05d]\n", tape_frame_counter); + + tape_frame_counter += tape->pos[i].delay; } printf_line("-", 79); @@ -4666,14 +4951,18 @@ void SaveScore(int nr) #define SETUP_TOKEN_TIME_LIMIT 14 #define SETUP_TOKEN_FULLSCREEN 15 #define SETUP_TOKEN_ASK_ON_ESCAPE 16 -#define SETUP_TOKEN_GRAPHICS_SET 17 -#define SETUP_TOKEN_SOUNDS_SET 18 -#define SETUP_TOKEN_MUSIC_SET 19 -#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 20 -#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 21 -#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 22 - -#define NUM_GLOBAL_SETUP_TOKENS 23 +#define SETUP_TOKEN_ASK_ON_ESCAPE_EDITOR 17 +#define SETUP_TOKEN_QUICK_SWITCH 18 +#define SETUP_TOKEN_INPUT_ON_FOCUS 19 +#define SETUP_TOKEN_PREFER_AGA_GRAPHICS 20 +#define SETUP_TOKEN_GRAPHICS_SET 21 +#define SETUP_TOKEN_SOUNDS_SET 22 +#define SETUP_TOKEN_MUSIC_SET 23 +#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 24 +#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 25 +#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 26 + +#define NUM_GLOBAL_SETUP_TOKENS 27 /* editor setup */ #define SETUP_TOKEN_EDITOR_EL_BOULDERDASH 0 @@ -4689,8 +4978,9 @@ void SaveScore(int nr) #define SETUP_TOKEN_EDITOR_EL_HEADLINES 10 #define SETUP_TOKEN_EDITOR_EL_USER_DEFINED 11 #define SETUP_TOKEN_EDITOR_EL_DYNAMIC 12 +#define SETUP_TOKEN_EDITOR_SHOW_ELEMENT_TOKEN 13 -#define NUM_EDITOR_SETUP_TOKENS 13 +#define NUM_EDITOR_SETUP_TOKENS 14 /* editor cascade setup */ #define SETUP_TOKEN_EDITOR_CASCADE_BD 0 @@ -4714,8 +5004,13 @@ void SaveScore(int nr) #define SETUP_TOKEN_SHORTCUT_SAVE_GAME 0 #define SETUP_TOKEN_SHORTCUT_LOAD_GAME 1 #define SETUP_TOKEN_SHORTCUT_TOGGLE_PAUSE 2 +#define SETUP_TOKEN_SHORTCUT_FOCUS_PLAYER_1 3 +#define SETUP_TOKEN_SHORTCUT_FOCUS_PLAYER_2 4 +#define SETUP_TOKEN_SHORTCUT_FOCUS_PLAYER_3 5 +#define SETUP_TOKEN_SHORTCUT_FOCUS_PLAYER_4 6 +#define SETUP_TOKEN_SHORTCUT_FOCUS_PLAYER_ALL 7 -#define NUM_SHORTCUT_SETUP_TOKENS 3 +#define NUM_SHORTCUT_SETUP_TOKENS 8 /* player setup */ #define SETUP_TOKEN_PLAYER_USE_JOYSTICK 0 @@ -4776,6 +5071,10 @@ static struct TokenInfo global_setup_tokens[] = { TYPE_SWITCH, &si.time_limit, "time_limit" }, { TYPE_SWITCH, &si.fullscreen, "fullscreen" }, { TYPE_SWITCH, &si.ask_on_escape, "ask_on_escape" }, + { TYPE_SWITCH, &si.ask_on_escape_editor, "ask_on_escape_editor" }, + { TYPE_SWITCH, &si.quick_switch, "quick_player_switch" }, + { TYPE_SWITCH, &si.input_on_focus, "input_on_focus" }, + { TYPE_SWITCH, &si.prefer_aga_graphics, "prefer_aga_graphics" }, { TYPE_STRING, &si.graphics_set, "graphics_set" }, { TYPE_STRING, &si.sounds_set, "sounds_set" }, { TYPE_STRING, &si.music_set, "music_set" }, @@ -4799,6 +5098,7 @@ static struct TokenInfo editor_setup_tokens[] = { TYPE_SWITCH, &sei.el_headlines, "editor.el_headlines" }, { TYPE_SWITCH, &sei.el_user_defined, "editor.el_user_defined" }, { TYPE_SWITCH, &sei.el_dynamic, "editor.el_dynamic" }, + { TYPE_SWITCH, &sei.show_element_token,"editor.show_element_token" }, }; static struct TokenInfo editor_cascade_setup_tokens[] = @@ -4815,7 +5115,6 @@ static struct TokenInfo editor_cascade_setup_tokens[] = { TYPE_SWITCH, &seci.el_ce, "editor.cascade.el_ce" }, { TYPE_SWITCH, &seci.el_ge, "editor.cascade.el_ge" }, { TYPE_SWITCH, &seci.el_user, "editor.cascade.el_user" }, - { TYPE_SWITCH, &seci.el_generic, "editor.cascade.el_generic" }, { TYPE_SWITCH, &seci.el_dynamic, "editor.cascade.el_dynamic" }, }; @@ -4823,7 +5122,12 @@ static struct TokenInfo shortcut_setup_tokens[] = { { TYPE_KEY_X11, &ssi.save_game, "shortcut.save_game" }, { TYPE_KEY_X11, &ssi.load_game, "shortcut.load_game" }, - { TYPE_KEY_X11, &ssi.toggle_pause, "shortcut.toggle_pause" } + { TYPE_KEY_X11, &ssi.toggle_pause, "shortcut.toggle_pause" }, + { TYPE_KEY_X11, &ssi.focus_player[0], "shortcut.focus_player_1" }, + { TYPE_KEY_X11, &ssi.focus_player[1], "shortcut.focus_player_2" }, + { TYPE_KEY_X11, &ssi.focus_player[2], "shortcut.focus_player_3" }, + { TYPE_KEY_X11, &ssi.focus_player[3], "shortcut.focus_player_4" }, + { TYPE_KEY_X11, &ssi.focus_player_all,"shortcut.focus_player_all" }, }; static struct TokenInfo player_setup_tokens[] = @@ -4843,18 +5147,18 @@ static struct TokenInfo player_setup_tokens[] = { TYPE_KEY_X11, &sii.key.up, ".key.move_up" }, { TYPE_KEY_X11, &sii.key.down, ".key.move_down" }, { TYPE_KEY_X11, &sii.key.snap, ".key.snap_field" }, - { TYPE_KEY_X11, &sii.key.drop, ".key.place_bomb" } + { TYPE_KEY_X11, &sii.key.drop, ".key.place_bomb" }, }; static struct TokenInfo system_setup_tokens[] = { { TYPE_STRING, &syi.sdl_audiodriver, "system.sdl_audiodriver" }, - { TYPE_INTEGER, &syi.audio_fragment_size,"system.audio_fragment_size" } + { TYPE_INTEGER, &syi.audio_fragment_size,"system.audio_fragment_size" }, }; static struct TokenInfo options_setup_tokens[] = { - { TYPE_BOOLEAN, &soi.verbose, "options.verbose" } + { TYPE_BOOLEAN, &soi.verbose, "options.verbose" }, }; static char *get_corrected_login_name(char *login_name) @@ -4896,6 +5200,10 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->time_limit = TRUE; si->fullscreen = FALSE; si->ask_on_escape = TRUE; + si->ask_on_escape_editor = TRUE; + si->quick_switch = FALSE; + si->input_on_focus = FALSE; + si->prefer_aga_graphics = TRUE; si->graphics_set = getStringCopy(GFX_CLASSIC_SUBDIR); si->sounds_set = getStringCopy(SND_CLASSIC_SUBDIR); @@ -4919,10 +5227,18 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->editor.el_user_defined = FALSE; si->editor.el_dynamic = TRUE; + si->editor.show_element_token = FALSE; + si->shortcut.save_game = DEFAULT_KEY_SAVE_GAME; si->shortcut.load_game = DEFAULT_KEY_LOAD_GAME; si->shortcut.toggle_pause = DEFAULT_KEY_TOGGLE_PAUSE; + si->shortcut.focus_player[0] = DEFAULT_KEY_FOCUS_PLAYER_1; + si->shortcut.focus_player[1] = DEFAULT_KEY_FOCUS_PLAYER_2; + si->shortcut.focus_player[2] = DEFAULT_KEY_FOCUS_PLAYER_3; + si->shortcut.focus_player[3] = DEFAULT_KEY_FOCUS_PLAYER_4; + si->shortcut.focus_player_all = DEFAULT_KEY_FOCUS_PLAYER_ALL; + for (i = 0; i < MAX_PLAYERS; i++) { si->input[i].use_joystick = FALSE; @@ -4964,7 +5280,6 @@ static void setSetupInfoToDefaults_EditorCascade(struct SetupInfo *si) si->editor_cascade.el_ce = FALSE; si->editor_cascade.el_ge = FALSE; si->editor_cascade.el_user = FALSE; - si->editor_cascade.el_generic = FALSE; si->editor_cascade.el_dynamic = FALSE; } @@ -5060,7 +5375,7 @@ void LoadSetup() { char *player_name_new; - checkSetupFileHashIdentifier(setup_file_hash, getCookie("SETUP")); + checkSetupFileHashIdentifier(setup_file_hash, filename,getCookie("SETUP")); decodeSetupFileHash(setup_file_hash); setup.direct_draw = !setup.double_buffering; @@ -5088,7 +5403,7 @@ void LoadSetup_EditorCascade() if (setup_file_hash) { - checkSetupFileHashIdentifier(setup_file_hash, getCookie("SETUP")); + checkSetupFileHashIdentifier(setup_file_hash, filename,getCookie("SETUP")); decodeSetupFileHash_EditorCascade(setup_file_hash); freeSetupFileHash(setup_file_hash); @@ -5241,7 +5556,7 @@ void LoadSpecialMenuDesignSettings() /* always start with reliable default values from default config */ for (i = 0; image_config_vars[i].token != NULL; i++) for (j = 0; image_config[j].token != NULL; j++) - if (strcmp(image_config_vars[i].token, image_config[j].token) == 0) + if (strEqual(image_config_vars[i].token, image_config[j].token)) *image_config_vars[i].value = get_auto_parameter_value(image_config_vars[i].token, image_config[j].value); @@ -5466,7 +5781,7 @@ static boolean music_info_listed_ext(struct MusicFileInfo *list, char *basename, boolean is_sound) { for (; list != NULL; list = list->next) - if (list->is_sound == is_sound && strcmp(list->basename, basename) == 0) + if (list->is_sound == is_sound && strEqual(list->basename, basename)) return TRUE; return FALSE; @@ -5524,7 +5839,7 @@ void LoadMusicInfo() if (music->filename == NULL) continue; - if (strcmp(music->filename, UNDEFINED_FILENAME) == 0) + if (strEqual(music->filename, UNDEFINED_FILENAME)) continue; /* a configured file may be not recognized as music */ @@ -5563,7 +5878,7 @@ void LoadMusicInfo() if (music->filename == NULL) continue; - if (strcmp(basename, music->filename) == 0) + if (strEqual(basename, music->filename)) { music_already_used = TRUE; break; @@ -5599,7 +5914,7 @@ void LoadMusicInfo() if (sound->filename == NULL) continue; - if (strcmp(sound->filename, UNDEFINED_FILENAME) == 0) + if (strEqual(sound->filename, UNDEFINED_FILENAME)) continue; /* a configured file may be not recognized as sound */ @@ -5708,7 +6023,7 @@ void LoadHelpAnimInfo() char *element_value, *action_value, *direction_value; int delay = atoi(list->value); - if (strcmp(list->token, "end") == 0) + if (strEqual(list->token, "end")) { add_helpanim_entry(HELPANIM_LIST_NEXT, -1, -1, -1, &num_list_entries); @@ -5860,7 +6175,8 @@ void LoadHelpAnimInfo() #if 0 for (i = 0; i < num_list_entries; i++) - printf("::: %d, %d, %d => %d\n", + printf("::: '%s': %d, %d, %d => %d\n", + EL_NAME(helpanim_info[i].element), helpanim_info[i].element, helpanim_info[i].action, helpanim_info[i].direction,