From b6c73f8bef1fac7abc8d1040b5e2628d186d96ad Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Tue, 15 Nov 2016 20:35:45 +0000 Subject: [PATCH 01/62] Refactor place scenery --- src/world/map.c | 377 +++++++++++++++++++++++++++--------------------- 1 file changed, 213 insertions(+), 164 deletions(-) diff --git a/src/world/map.c b/src/world/map.c index edaf1c2266..108f7d4652 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -3014,191 +3014,240 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi int y = (uint16)*ecx; uint8 colour2 = *edi >> 16; uint8 rotation = *edi; - int z = *ebp; uint8 scenery_type = *ebx >> 8; uint8 flags = *ebx & 0xFF; uint8 quadrant = *edx; uint8 colour1 = *edx >> 8; money32 clearCost = 0; - int F64F1D = 0; - int F64EC8 = z; + bool isOnWater = false; + int targetHeight = *ebp; + bool supportsRequired = false; + if (targetHeight != 0) { + supportsRequired = true; + } int base_height = map_element_height(x, y); + // If on water if(base_height & 0xFFFF0000){ base_height >>= 16; } gCommandPosition.x = x; gCommandPosition.y = y; gCommandPosition.z = base_height; - if(F64EC8){ - base_height = F64EC8; + if(targetHeight != 0){ + base_height = targetHeight; gCommandPosition.z = base_height; } gCommandPosition.x += 16; gCommandPosition.y += 16; - if(game_is_not_paused() || gCheatsBuildInPauseMode){ - if (map_check_free_elements_and_reorganise(1)) { - if ((byte_9D8150 & 1) || (x <= gMapSizeMaxXY && y <= gMapSizeMaxXY)) { - rct_scenery_entry* scenery_entry = (rct_scenery_entry*)object_entry_groups[OBJECT_TYPE_SMALL_SCENERY].chunks[scenery_type]; - if(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE || !(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG9)){ - if(scenery_entry->small_scenery.flags & (SMALL_SCENERY_FLAG9 | SMALL_SCENERY_FLAG24 | SMALL_SCENERY_FLAG25)){ - quadrant = 0; - } - } - int x2 = x; - int y2 = y; - if(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE){ - x2 += 16; - y2 += 16; - }else{ - x2 += ScenerySubTileOffsets[quadrant & 3].x - 1; - y2 += ScenerySubTileOffsets[quadrant & 3].y - 1; - } - int base_height2 = map_element_height(x2, y2); - if(base_height2 & 0xFFFF0000){ - base_height2 >>= 16; - if(F64EC8 == 0){ - F64F1D = 1; - } - } - if(F64EC8 == 0){ - F64EC8 = base_height2; - } - if(!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode && !map_is_location_owned(x, y, F64EC8)){ - *ebx = MONEY32_UNDEFINED; - return; - } - if(flags & GAME_COMMAND_FLAG_APPLY && !(flags & 0x40)){ - footpath_remove_litter(x, y, F64EC8); - if(!gCheatsDisableClearanceChecks && (scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_ALLOW_WALLS)) { - map_remove_walls_at(x, y, F64EC8, F64EC8 + scenery_entry->small_scenery.height); - } - } - rct_map_element* map_element = map_get_first_element_at(x / 32, y / 32); - while(map_element_get_type(map_element) != MAP_ELEMENT_TYPE_SURFACE){ - map_element++; - } - if(!gCheatsDisableClearanceChecks && (map_element->properties.surface.terrain & 0x1F)){ - int water_height = ((map_element->properties.surface.terrain & 0x1F) * 16) - 1; - if(water_height > F64EC8){ - gGameCommandErrorText = STR_CANT_BUILD_THIS_UNDERWATER; - *ebx = MONEY32_UNDEFINED; - return; - } - } - if(!gCheatsDisableClearanceChecks && !(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG18)){ - if(F64F1D != 0){ - gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ON_LAND; - *ebx = MONEY32_UNDEFINED; - return; - } - if(map_element->properties.surface.terrain & 0x1F){ - if(((map_element->properties.surface.terrain & 0x1F) * 16) > F64EC8){ - gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ON_LAND; - *ebx = MONEY32_UNDEFINED; - return; - } - } - } - if(gCheatsDisableClearanceChecks || !(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE) || z != 0 || F64F1D != 0 || !(map_element->properties.surface.slope & 0x1F)){ - if(gCheatsDisableSupportLimits || scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG18 || z == 0){ - l_6E0B78: ; - int bp = quadrant; - int zLow = F64EC8 / 8; - int zHigh = zLow + ((scenery_entry->small_scenery.height + 7) / 8); - int bl = 0xF; - if(!(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE)){ - bp ^= 2; - bl = 1; - bl <<= bp; - } - if(!(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG24)){ - if(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG9 && scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE){ - if(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG25){ - bp ^= 2; - bp += rotation; - bp &= 3; - bl = 0xBB; - bl = rol8(bl, bp); - bl &= 0xF; - }else{ - bp += rotation; - bp &= 1; - bl = 0xA; - bl >>= bp; - } - } - }else{ - bp ^= 2; - bp += rotation; - bp &= 3; - bl = 0x33; - bl = rol8(bl, bp); - bl &= 0xF; - } - if(z == 0){ - bl |= 0xF0; - } - if(gCheatsDisableClearanceChecks || map_can_construct_with_clear_at(x, y, zLow, zHigh, &map_place_scenery_clear_func, bl, flags, &clearCost)){ - gSceneryGroundFlags = gMapGroundFlags & (ELEMENT_IS_1 | ELEMENT_IS_UNDERGROUND); - if(flags & GAME_COMMAND_FLAG_APPLY){ - if (gGameCommandNestLevel == 1 && !(flags & GAME_COMMAND_FLAG_GHOST)) { - rct_xyz16 coord; - coord.x = x + 16; - coord.y = y + 16; - coord.z = map_element_height(coord.x, coord.y); - network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord); - } - int collisionQuadrants = (bl & 0xf); - rct_map_element* new_map_element = map_element_insert(x / 32, y / 32, zLow, collisionQuadrants); - assert(new_map_element != NULL); - gSceneryMapElement = new_map_element; - uint8 type = quadrant << 6; - type |= MAP_ELEMENT_TYPE_SCENERY; - type |= rotation; - new_map_element->type = type; - new_map_element->properties.scenery.type = scenery_type; - new_map_element->properties.scenery.age = 0; - new_map_element->properties.scenery.colour_1 = colour1; - new_map_element->properties.scenery.colour_2 = colour2; - new_map_element->clearance_height = new_map_element->base_height + ((scenery_entry->small_scenery.height + 7) / 8); - if(z != 0){ - new_map_element->properties.scenery.colour_1 |= 0x20; - } - if(flags & 0x40){ - new_map_element->flags |= 0x10; - } - map_invalidate_tile_full(x, y); - if(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_ANIMATED){ - map_animation_create(2, x, y, new_map_element->base_height); - } - } - *ebx = (scenery_entry->small_scenery.price * 10) + clearCost; - if(gParkFlags & PARK_FLAGS_NO_MONEY){ - *ebx = 0; - } - return; - } - }else{ - if(F64F1D == 0){ - if((map_element->properties.surface.terrain & 0x1F) || (map_element->base_height * 8) != F64EC8){ - gGameCommandErrorText = STR_LEVEL_LAND_REQUIRED; - }else{ - goto l_6E0B78; - } - }else{ - gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ON_LAND; - } - } - }else{ - gGameCommandErrorText = STR_LEVEL_LAND_REQUIRED; - } + if (game_is_paused() && !gCheatsBuildInPauseMode) { + gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + *ebx = MONEY32_UNDEFINED; + return; + } + + if (!map_check_free_elements_and_reorganise(1)) { + *ebx = MONEY32_UNDEFINED; + return; + } + + if (!(byte_9D8150 & 1) && (x > gMapSizeMaxXY || y > gMapSizeMaxXY)) { + *ebx = MONEY32_UNDEFINED; + return; + } + + rct_scenery_entry* scenery_entry = (rct_scenery_entry*)object_entry_groups[OBJECT_TYPE_SMALL_SCENERY].chunks[scenery_type]; + + if(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE || !(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG9)){ + if(scenery_entry->small_scenery.flags & (SMALL_SCENERY_FLAG9 | SMALL_SCENERY_FLAG24 | SMALL_SCENERY_FLAG25)){ + quadrant = 0; + } + } + + // Check if sub tile height is any different compared to actual surface tile height + int x2 = x; + int y2 = y; + if(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE){ + x2 += 16; + y2 += 16; + }else{ + x2 += ScenerySubTileOffsets[quadrant & 3].x - 1; + y2 += ScenerySubTileOffsets[quadrant & 3].y - 1; + } + base_height = map_element_height(x2, y2); + // If on water + if(base_height & 0xFFFF0000){ + // base_height2 is now the water height + base_height >>= 16; + if(targetHeight == 0){ + isOnWater = true; + } + } + if(targetHeight == 0){ + targetHeight = base_height; + } + + if(!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && + !gCheatsSandboxMode && + !map_is_location_owned(x, y, targetHeight)){ + + *ebx = MONEY32_UNDEFINED; + return; + } + + if(flags & GAME_COMMAND_FLAG_APPLY && !(flags & 0x40)){ + footpath_remove_litter(x, y, targetHeight); + if(!gCheatsDisableClearanceChecks && (scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_ALLOW_WALLS)) { + map_remove_walls_at(x, y, targetHeight, targetHeight + scenery_entry->small_scenery.height); + } + } + + rct_map_element* surface_element = map_get_surface_element_at(x / 32, y / 32); + + if(!gCheatsDisableClearanceChecks && (surface_element->properties.surface.terrain & 0x1F)){ + int water_height = ((surface_element->properties.surface.terrain & 0x1F) * 16) - 1; + if(water_height > targetHeight){ + gGameCommandErrorText = STR_CANT_BUILD_THIS_UNDERWATER; + *ebx = MONEY32_UNDEFINED; + return; + } + } + + if(!gCheatsDisableClearanceChecks && !(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG18)){ + if(isOnWater){ + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ON_LAND; + *ebx = MONEY32_UNDEFINED; + return; + } + + if(surface_element->properties.surface.terrain & 0x1F){ + if(((surface_element->properties.surface.terrain & 0x1F) * 16) > targetHeight){ + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ON_LAND; + *ebx = MONEY32_UNDEFINED; + return; + } + } + } + + if (!gCheatsDisableClearanceChecks && + (scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_REQUIRE_FLAT_SURFACE) && + !supportsRequired && + !isOnWater && + (surface_element->properties.surface.slope & 0x1F)) { + + gGameCommandErrorText = STR_LEVEL_LAND_REQUIRED; + *ebx = MONEY32_UNDEFINED; + return; + } + + if (!gCheatsDisableSupportLimits && + !(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG18) && + supportsRequired) { + + if(!isOnWater){ + if((surface_element->properties.surface.terrain & 0x1F) || + (surface_element->base_height * 8) != targetHeight){ + + gGameCommandErrorText = STR_LEVEL_LAND_REQUIRED; + *ebx = MONEY32_UNDEFINED; + return; + } + + }else{ + gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ON_LAND; + *ebx = MONEY32_UNDEFINED; + return; + } + } + + int bp = quadrant; + int zLow = targetHeight / 8; + int zHigh = zLow + ((scenery_entry->small_scenery.height + 7) / 8); + int bl = 0xF; + if(!(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE)){ + bp ^= 2; + bl = 1; + bl <<= bp; + } + if(!(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG24)){ + if(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG9 && scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE){ + if(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG25){ + bp ^= 2; + bp += rotation; + bp &= 3; + bl = 0xBB; + bl = rol8(bl, bp); + bl &= 0xF; + }else{ + bp += rotation; + bp &= 1; + bl = 0xA; + bl >>= bp; } } }else{ - gGameCommandErrorText = STR_CONSTRUCTION_NOT_POSSIBLE_WHILE_GAME_IS_PAUSED; + bp ^= 2; + bp += rotation; + bp &= 3; + bl = 0x33; + bl = rol8(bl, bp); + bl &= 0xF; + } + if(!supportsRequired){ + bl |= 0xF0; + } + + if (!gCheatsDisableClearanceChecks && + !map_can_construct_with_clear_at(x, y, zLow, zHigh, &map_place_scenery_clear_func, bl, flags, &clearCost)) { + *ebx = MONEY32_UNDEFINED; + return; + } + + gSceneryGroundFlags = gMapGroundFlags & (ELEMENT_IS_1 | ELEMENT_IS_UNDERGROUND); + + *ebx = (scenery_entry->small_scenery.price * 10) + clearCost; + if(gParkFlags & PARK_FLAGS_NO_MONEY){ + *ebx = 0; + } + + if (!flags & GAME_COMMAND_FLAG_APPLY) { + return; + } + + if (gGameCommandNestLevel == 1 && !(flags & GAME_COMMAND_FLAG_GHOST)) { + rct_xyz16 coord; + coord.x = x + 16; + coord.y = y + 16; + coord.z = map_element_height(coord.x, coord.y); + network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord); + } + + int collisionQuadrants = (bl & 0xf); + rct_map_element* new_map_element = map_element_insert(x / 32, y / 32, zLow, collisionQuadrants); + assert(new_map_element != NULL); + gSceneryMapElement = new_map_element; + uint8 type = quadrant << 6; + type |= MAP_ELEMENT_TYPE_SCENERY; + type |= rotation; + new_map_element->type = type; + new_map_element->properties.scenery.type = scenery_type; + new_map_element->properties.scenery.age = 0; + new_map_element->properties.scenery.colour_1 = colour1; + new_map_element->properties.scenery.colour_2 = colour2; + new_map_element->clearance_height = new_map_element->base_height + ((scenery_entry->small_scenery.height + 7) / 8); + + if(supportsRequired){ + new_map_element->properties.scenery.colour_1 |= 0x20; + } + + if(flags & GAME_COMMAND_FLAG_GHOST){ + new_map_element->flags |= MAP_ELEMENT_FLAG_GHOST; + } + + map_invalidate_tile_full(x, y); + if(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_ANIMATED){ + map_animation_create(2, x, y, new_map_element->base_height); } - *ebx = MONEY32_UNDEFINED; } static bool map_is_location_at_edge(int x, int y) From d09238ac0cf809dcced16d5a5df3fb683d0f4102 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Tue, 22 Nov 2016 18:48:32 +0000 Subject: [PATCH 02/62] Label known register uses --- src/ride/track.c | 4 ++-- src/ride/track_design.c | 8 +++---- src/ride/track_design.h | 2 +- src/world/map.c | 53 +++++++++++++++-------------------------- 4 files changed, 26 insertions(+), 41 deletions(-) diff --git a/src/ride/track.c b/src/ride/track.c index 8edf5ccc04..99565e7fab 100644 --- a/src/ride/track.c +++ b/src/ride/track.c @@ -1177,7 +1177,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in return MONEY32_UNDEFINED; } - if ((rideTypeFlags & RIDE_TYPE_FLAG_6) && !(byte_9D8150 & 1)) { + if ((rideTypeFlags & RIDE_TYPE_FLAG_6) && !byte_9D8150) { mapElement = map_get_surface_element_at(x / 32, y / 32); uint8 water_height = 2 * (mapElement->properties.surface.terrain & MAP_ELEMENT_WATER_HEIGHT_MASK); @@ -1240,7 +1240,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in maxHeight = RideData5[ride->type].max_height; } ride_height /= 2; - if (ride_height > maxHeight && !(byte_9D8150 & 1)) { + if (ride_height > maxHeight && !byte_9D8150) { gGameCommandErrorText = STR_TOO_HIGH_FOR_SUPPORTS; return MONEY32_UNDEFINED; } diff --git a/src/ride/track_design.c b/src/ride/track_design.c index 09fa74336f..edf0464aae 100644 --- a/src/ride/track_design.c +++ b/src/ride/track_design.c @@ -53,7 +53,7 @@ rct_xyz16 gTrackPreviewMax; rct_xyz16 gTrackPreviewOrigin; uint8 byte_F4414E; -uint8 byte_9D8150; +bool byte_9D8150; static uint8 _trackDesignPlaceOperation; static uint8 byte_F44150; static money32 _trackDesignPlaceCost; @@ -1396,7 +1396,7 @@ static bool sub_6D2189(rct_track_td6 *td6, money32 *cost, uint8 *rideId, uint8 * ride->track_colour_supports[i] = td6->track_support_colour[i]; } - byte_9D8150 |= 1; + byte_9D8150 = true; uint8 backup_rotation = _currentTrackPieceDirection; uint32 backup_park_flags = gParkFlags; gParkFlags &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION; @@ -1426,7 +1426,7 @@ static bool sub_6D2189(rct_track_td6 *td6, money32 *cost, uint8 *rideId, uint8 * } _currentTrackPieceDirection = backup_rotation; - byte_9D8150 &= ~1; + byte_9D8150 = false; *cost = resultCost; *rideId = rideIndex; return true; @@ -1434,7 +1434,7 @@ static bool sub_6D2189(rct_track_td6 *td6, money32 *cost, uint8 *rideId, uint8 * _currentTrackPieceDirection = backup_rotation; user_string_free(ride->name); ride->type = RIDE_TYPE_NULL; - byte_9D8150 &= ~1; + byte_9D8150 = false; return false; } } diff --git a/src/ride/track_design.h b/src/ride/track_design.h index bb81486c83..53776fe804 100644 --- a/src/ride/track_design.h +++ b/src/ride/track_design.h @@ -188,7 +188,7 @@ extern rct_xyz16 gTrackPreviewMax; extern rct_xyz16 gTrackPreviewOrigin; extern uint8 byte_F4414E; -extern uint8 byte_9D8150; +extern bool byte_9D8150; extern bool gTrackDesignSaveMode; extern uint8 gTrackDesignSaveRideIndex; diff --git a/src/world/map.c b/src/world/map.c index 108f7d4652..462a802018 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -3051,12 +3051,12 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi return; } - if (!(byte_9D8150 & 1) && (x > gMapSizeMaxXY || y > gMapSizeMaxXY)) { + if (!byte_9D8150 && (x > gMapSizeMaxXY || y > gMapSizeMaxXY)) { *ebx = MONEY32_UNDEFINED; return; } - rct_scenery_entry* scenery_entry = (rct_scenery_entry*)object_entry_groups[OBJECT_TYPE_SMALL_SCENERY].chunks[scenery_type]; + rct_scenery_entry* scenery_entry = get_small_scenery_entry(scenery_type); if(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE || !(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG9)){ if(scenery_entry->small_scenery.flags & (SMALL_SCENERY_FLAG9 | SMALL_SCENERY_FLAG24 | SMALL_SCENERY_FLAG25)){ @@ -3095,7 +3095,7 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi return; } - if(flags & GAME_COMMAND_FLAG_APPLY && !(flags & 0x40)){ + if(flags & GAME_COMMAND_FLAG_APPLY && !(flags & GAME_COMMAND_FLAG_GHOST)){ footpath_remove_litter(x, y, targetHeight); if(!gCheatsDisableClearanceChecks && (scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_ALLOW_WALLS)) { map_remove_walls_at(x, y, targetHeight, targetHeight + scenery_entry->small_scenery.height); @@ -3104,8 +3104,8 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi rct_map_element* surface_element = map_get_surface_element_at(x / 32, y / 32); - if(!gCheatsDisableClearanceChecks && (surface_element->properties.surface.terrain & 0x1F)){ - int water_height = ((surface_element->properties.surface.terrain & 0x1F) * 16) - 1; + if(!gCheatsDisableClearanceChecks && (surface_element->properties.surface.terrain & MAP_ELEMENT_WATER_HEIGHT_MASK)){ + int water_height = ((surface_element->properties.surface.terrain & MAP_ELEMENT_WATER_HEIGHT_MASK) * 16) - 1; if(water_height > targetHeight){ gGameCommandErrorText = STR_CANT_BUILD_THIS_UNDERWATER; *ebx = MONEY32_UNDEFINED; @@ -3120,8 +3120,8 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi return; } - if(surface_element->properties.surface.terrain & 0x1F){ - if(((surface_element->properties.surface.terrain & 0x1F) * 16) > targetHeight){ + if(surface_element->properties.surface.terrain & MAP_ELEMENT_WATER_HEIGHT_MASK){ + if(((surface_element->properties.surface.terrain & MAP_ELEMENT_WATER_HEIGHT_MASK) * 16) > targetHeight){ gGameCommandErrorText = STR_CAN_ONLY_BUILD_THIS_ON_LAND; *ebx = MONEY32_UNDEFINED; return; @@ -3145,7 +3145,7 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi supportsRequired) { if(!isOnWater){ - if((surface_element->properties.surface.terrain & 0x1F) || + if((surface_element->properties.surface.terrain & MAP_ELEMENT_WATER_HEIGHT_MASK) || (surface_element->base_height * 8) != targetHeight){ gGameCommandErrorText = STR_LEVEL_LAND_REQUIRED; @@ -3162,43 +3162,29 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi int bp = quadrant; int zLow = targetHeight / 8; - int zHigh = zLow + ((scenery_entry->small_scenery.height + 7) / 8); - int bl = 0xF; + int zHigh = zLow + ceil2(scenery_entry->small_scenery.height, 8) / 8; + uint8 collisionQuadrants = 0xF; + uint8 unk_bl = 0; if(!(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE)){ - bp ^= 2; - bl = 1; - bl <<= bp; + collisionQuadrants = 1 << (quadrant ^ 2); } if(!(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG24)){ if(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG9 && scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE){ if(scenery_entry->small_scenery.flags & SMALL_SCENERY_FLAG25){ - bp ^= 2; - bp += rotation; - bp &= 3; - bl = 0xBB; - bl = rol8(bl, bp); - bl &= 0xF; + collisionQuadrants = 0xF & rol8(0xBB, ((quadrant ^ 2) + rotation) & 3); }else{ - bp += rotation; - bp &= 1; - bl = 0xA; - bl >>= bp; + collisionQuadrants = 0xA >> ((quadrant + rotation) & 1); } } }else{ - bp ^= 2; - bp += rotation; - bp &= 3; - bl = 0x33; - bl = rol8(bl, bp); - bl &= 0xF; + collisionQuadrants = 0xF & rol8(0x33, ((quadrant ^ 2) + rotation) & 3); } if(!supportsRequired){ - bl |= 0xF0; + unk_bl |= 0xF0; } if (!gCheatsDisableClearanceChecks && - !map_can_construct_with_clear_at(x, y, zLow, zHigh, &map_place_scenery_clear_func, bl, flags, &clearCost)) { + !map_can_construct_with_clear_at(x, y, zLow, zHigh, &map_place_scenery_clear_func, unk_bl | collisionQuadrants, flags, &clearCost)) { *ebx = MONEY32_UNDEFINED; return; } @@ -3222,7 +3208,6 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord); } - int collisionQuadrants = (bl & 0xf); rct_map_element* new_map_element = map_element_insert(x / 32, y / 32, zLow, collisionQuadrants); assert(new_map_element != NULL); gSceneryMapElement = new_map_element; @@ -3504,7 +3489,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, } if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && - !(flags & (1 << 7)) && !gCheatsSandboxMode){ + !(flags & GAME_COMMAND_FLAG_7) && !gCheatsSandboxMode){ if (position.z == 0){ if (!map_is_location_in_park(position.x, position.y)){ @@ -3654,7 +3639,7 @@ void game_command_place_fence(int* eax, int* ebx, int* ecx, int* edx, int* esi, } clearanceHeight += fence->wall.height; - if (!(flags & (1 << 7)) && !gCheatsDisableClearanceChecks){ + if (!(flags & GAME_COMMAND_FLAG_7) && !gCheatsDisableClearanceChecks){ if (!map_place_fence_check_obstruction(fence, position.x, position.y, position.z / 8, clearanceHeight, edge)) { *ebx = MONEY32_UNDEFINED; return; From 329c8b1f76bfc01cd8c0a29292771ef9c8e9d2f8 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Mon, 28 Nov 2016 17:51:37 +0000 Subject: [PATCH 03/62] Fix motion simulator vehicle colours. Due to a mistake during implementation the vehicle colour of the motion simulator was the wrong way around. The trim colour was applied to the body and vice versa. Issue noticed by reddit user. --- src/ride/thrill/motion_simulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ride/thrill/motion_simulator.c b/src/ride/thrill/motion_simulator.c index e43f562aca..bd42e40d38 100644 --- a/src/ride/thrill/motion_simulator.c +++ b/src/ride/thrill/motion_simulator.c @@ -64,8 +64,8 @@ static void paint_motionsimulator_vehicle(sint8 offsetX, sint8 offsetY, uint8 di uint32 imageColourFlags = gTrackColours[SCHEME_MISC]; if (imageColourFlags == 0x20000000) { imageColourFlags = IMAGE_TYPE_REMAP_2_PLUS | IMAGE_TYPE_REMAP; - imageColourFlags |= ride->vehicle_colours[0].trim_colour << 19; - imageColourFlags |= ride->vehicle_colours[0].body_colour << 24; + imageColourFlags |= ride->vehicle_colours[0].body_colour << 19; + imageColourFlags |= ride->vehicle_colours[0].trim_colour << 24; } simulatorImageId |= imageColourFlags; From 3f194991a14ab9b81788b29334b64c05fe1a0eb7 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Tue, 29 Nov 2016 19:01:46 +0000 Subject: [PATCH 04/62] Remove redundant variable --- src/world/map.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/world/map.c b/src/world/map.c index 462a802018..970bc31b01 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -3160,7 +3160,6 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi } } - int bp = quadrant; int zLow = targetHeight / 8; int zHigh = zLow + ceil2(scenery_entry->small_scenery.height, 8) / 8; uint8 collisionQuadrants = 0xF; From 46fbac9564b4471ce9ec8fdb188ebafc39984f4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Wed, 30 Nov 2016 19:01:02 +0100 Subject: [PATCH 05/62] Add .clang-format style file (#4836) [ci skip] --- .clang-format | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .clang-format diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000000..10190ab957 --- /dev/null +++ b/.clang-format @@ -0,0 +1,16 @@ +--- +BasedOnStyle: LLVM +AccessModifierOffset: '-4' +AlignConsecutiveAssignments: 'true' +AlignConsecutiveDeclarations: 'true' +AllowShortFunctionsOnASingleLine: Empty +BreakBeforeBraces: Allman +ColumnLimit: '128' +Cpp11BracedListStyle: 'false' +IndentWidth: '4' +PointerAlignment: Middle +SortIncludes: 'true' +Standard: Cpp11 +TabWidth: '4' + +... From 6c8e0cc5360ec24ad4d75babac8207d6cfa1208e Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Wed, 30 Nov 2016 19:09:45 +0000 Subject: [PATCH 06/62] Fix #4838. Prevent leaving ghosts with small scenery Issue was caused by placing two ghost scenery items when using the scenery placement tool. The ghost clean up code would only remove the first ghost and leave the second ghost. Mistake caused when refactoring. Incorrect use of NOT and AND. --- src/world/map.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/world/map.c b/src/world/map.c index 970bc31b01..35b40a2442 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -3195,7 +3195,7 @@ void game_command_place_scenery(int* eax, int* ebx, int* ecx, int* edx, int* esi *ebx = 0; } - if (!flags & GAME_COMMAND_FLAG_APPLY) { + if (!(flags & GAME_COMMAND_FLAG_APPLY)) { return; } From 7eb008b546f6f5ff5b8cc74087496fa976fdae60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 1 Dec 2016 09:09:15 +0100 Subject: [PATCH 07/62] Ensure includes are used when needed --- src/drawing/IDrawingEngine.h | 2 +- src/drawing/NewDrawing.h | 5 +++++ src/drawing/engines/opengl/DrawCommands.h | 3 ++- src/interface/keyboard_shortcut.h | 2 ++ src/network/NetworkGroup.h | 1 + src/ride/vehicle.h | 1 + src/title.h | 1 + src/world/climate.h | 1 + 8 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/drawing/IDrawingEngine.h b/src/drawing/IDrawingEngine.h index 90bee4d6a1..a4ded3b623 100644 --- a/src/drawing/IDrawingEngine.h +++ b/src/drawing/IDrawingEngine.h @@ -61,7 +61,7 @@ namespace DrawingEngineFactory IDrawingEngine * CreateSoftware(); IDrawingEngine * CreateSoftwareWithHardwareDisplay(); IDrawingEngine * CreateOpenGL(); -}; +} interface IRainDrawer { diff --git a/src/drawing/NewDrawing.h b/src/drawing/NewDrawing.h index 370ad89d0e..e4edc6cd17 100644 --- a/src/drawing/NewDrawing.h +++ b/src/drawing/NewDrawing.h @@ -16,11 +16,16 @@ #pragma once +#include + #ifdef __cplusplus extern "C" { #endif +#include "../rct2.h" +#include "drawing.h" + extern rct_string_id DrawingEngineStringIds[3]; sint32 drawing_engine_get_type(); diff --git a/src/drawing/engines/opengl/DrawCommands.h b/src/drawing/engines/opengl/DrawCommands.h index 194f3f9eb2..952d5118d6 100644 --- a/src/drawing/engines/opengl/DrawCommands.h +++ b/src/drawing/engines/opengl/DrawCommands.h @@ -19,6 +19,7 @@ #include "../../../common.h" #include "OpenGLAPI.h" #include "GLSLTypes.h" +#include "TextureCache.h" struct DrawRectCommand { uint32 flags; @@ -43,4 +44,4 @@ struct DrawImageCommand { CachedTextureInfo texPalette; sint32 bounds[4]; bool mask; -}; \ No newline at end of file +}; diff --git a/src/interface/keyboard_shortcut.h b/src/interface/keyboard_shortcut.h index a956c00da2..c0da2707d3 100644 --- a/src/interface/keyboard_shortcut.h +++ b/src/interface/keyboard_shortcut.h @@ -17,6 +17,8 @@ #ifndef _INTERFACE_KEYBOARD_SHORTCUT_H_ #define _INTERFACE_KEYBOARD_SHORTCUT_H_ +#include "../common.h" + #define SHORTCUT_UNDEFINED 0xFFFF /** The current shortcut being changed. */ diff --git a/src/network/NetworkGroup.h b/src/network/NetworkGroup.h index aec1795bd8..58f2b1bf40 100644 --- a/src/network/NetworkGroup.h +++ b/src/network/NetworkGroup.h @@ -18,6 +18,7 @@ #include #include +#include #include "NetworkPacket.h" #include "../common.h" diff --git a/src/ride/vehicle.h b/src/ride/vehicle.h index 1e1d325b9d..fd33c7cccf 100644 --- a/src/ride/vehicle.h +++ b/src/ride/vehicle.h @@ -18,6 +18,7 @@ #define _VEHICLE_H_ #include "../common.h" +#include "../world/map.h" #pragma pack(push, 1) /* size: 0x2 */ diff --git a/src/title.h b/src/title.h index 151b58dbc3..244f1b994b 100644 --- a/src/title.h +++ b/src/title.h @@ -18,6 +18,7 @@ #define _TITLE_H_ #include +#include "drawing/drawing.h" enum { TITLE_SCRIPT_WAIT, diff --git a/src/world/climate.h b/src/world/climate.h index 38322c4384..0e6d5a1531 100644 --- a/src/world/climate.h +++ b/src/world/climate.h @@ -18,6 +18,7 @@ #define _CLIMATE_H_ #include "../common.h" +#include "../drawing/drawing.h" enum { CLIMATE_COOL_AND_WET, From ecec752dec6295f729e1ab0278e7989e6cd5aa53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 1 Dec 2016 09:20:56 +0100 Subject: [PATCH 08/62] Remove some unused headers --- src/audio/audio.c | 5 ----- src/cmdline/ConvertCommand.cpp | 1 - src/core/FileScanner.cpp | 1 - src/core/FileScanner.h | 5 ----- src/intro.c | 2 -- src/paint/map_element/surface.c | 3 --- src/windows/footpath.c | 3 --- src/world/footpath.c | 6 ------ 8 files changed, 26 deletions(-) diff --git a/src/audio/audio.c b/src/audio/audio.c index 300ea16e0c..6d69d80285 100644 --- a/src/audio/audio.c +++ b/src/audio/audio.c @@ -16,12 +16,7 @@ #include "../config.h" #include "../interface/viewport.h" -#include "../interface/window.h" #include "../localisation/language.h" -#include "../platform/platform.h" -#include "../ride/ride.h" -#include "../world/map.h" -#include "../world/sprite.h" #include "audio.h" #include "mixer.h" #include "../openrct2.h" diff --git a/src/cmdline/ConvertCommand.cpp b/src/cmdline/ConvertCommand.cpp index ff2027d4e0..a6ae65d4d4 100644 --- a/src/cmdline/ConvertCommand.cpp +++ b/src/cmdline/ConvertCommand.cpp @@ -25,7 +25,6 @@ extern "C" { #include "../game.h" - #include "../scenario.h" #include "../openrct2.h" #include "../interface/window.h" } diff --git a/src/core/FileScanner.cpp b/src/core/FileScanner.cpp index 1e03ea3e5b..eb45257c25 100644 --- a/src/core/FileScanner.cpp +++ b/src/core/FileScanner.cpp @@ -37,7 +37,6 @@ extern "C" { - #include "../localisation/localisation.h" #include "../platform/platform.h" } diff --git a/src/core/FileScanner.h b/src/core/FileScanner.h index 032419524e..c7fd41cad9 100644 --- a/src/core/FileScanner.h +++ b/src/core/FileScanner.h @@ -18,11 +18,6 @@ #include "../common.h" -struct DirectoryInfo -{ - const utf8 * Name; -}; - struct FileInfo { const utf8 * Name; diff --git a/src/intro.c b/src/intro.c index a2185dc0b1..58c21b9d7a 100644 --- a/src/intro.c +++ b/src/intro.c @@ -18,8 +18,6 @@ #include "audio/mixer.h" #include "drawing/drawing.h" #include "intro.h" -#include "localisation/localisation.h" -#include "platform/platform.h" #include "sprites.h" #define BACKROUND_COLOUR_DARK 10 diff --git a/src/paint/map_element/surface.c b/src/paint/map_element/surface.c index bce51b239b..0d5ca840fa 100644 --- a/src/paint/map_element/surface.c +++ b/src/paint/map_element/surface.c @@ -15,12 +15,9 @@ #pragma endregion #include "../../cheats.h" -#include "../../common.h" #include "../../config.h" #include "../../interface/viewport.h" #include "../../peep/staff.h" -#include "../../world/map.h" -#include "../paint.h" #include "map_element.h" #include "surface.h" diff --git a/src/windows/footpath.c b/src/windows/footpath.c index 673c50957b..7c8d9f2287 100644 --- a/src/windows/footpath.c +++ b/src/windows/footpath.c @@ -20,13 +20,10 @@ #include "../input.h" #include "../sprites.h" #include "../interface/widget.h" -#include "../interface/window.h" #include "../interface/viewport.h" #include "../world/footpath.h" -#include "../world/map.h" #include "dropdown.h" #include "../interface/themes.h" -#include "../cheats.h" enum { PATH_CONSTRUCTION_MODE_LAND, diff --git a/src/world/footpath.c b/src/world/footpath.c index 594d94501d..c30166656f 100644 --- a/src/world/footpath.c +++ b/src/world/footpath.c @@ -15,17 +15,11 @@ #pragma endregion #include "../cheats.h" -#include "../config.h" #include "../game.h" #include "../localisation/localisation.h" -#include "../management/finance.h" #include "../network/network.h" #include "../util/util.h" #include "../object_list.h" -#include "footpath.h" -#include "map.h" -#include "map_animation.h" -#include "scenery.h" #include "../ride/track.h" #include "../ride/track_data.h" From b95fd84ecc31efcbf8a8adab36237215b8b12cd2 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Thu, 1 Dec 2016 09:42:29 +0100 Subject: [PATCH 09/62] Add note about full implementation --- distribution/changelog.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index f84d2ffba0..af9d94547a 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,5 +1,7 @@ 0.0.5 (in development) ------------------------------------------------------------------------ +This is the first fully implemented version of OpenRCT2. RCT2.EXE is no longer required. + - Feature: Ability to disable rendering of weather effects and gloom - Feature: New view option: "See-Through Paths" - Feature: Add cheat to reset date. @@ -31,7 +33,7 @@ - Improved: In-game file dialog now shows more formats (sv6, sc6, sv4, etc.) - Removed: BMP screenshots. - Removed: Intamin and Phoenix easter eggs. -- Fix: [#933] On-ride photo price sometimes gets reset to £2 when using 'same price in whole park' +- Fix: [#933] On-ride photo price sometimes gets reset to £2 when using 'same price in whole park' (original bug). - Fix: [#1038] Guest List is out of order. - Fix: [#1238] Track place window does not fully adjust to custom colour scheme. - Fix: [#2042] Guests entering queues are immediately annoyed when many entertainers are around (original bug). From 070e41e65626bd78d8a28037041253596f23a3bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 1 Dec 2016 10:12:52 +0100 Subject: [PATCH 10/62] Fix Windows builds due to missing header --- src/core/FileScanner.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/FileScanner.cpp b/src/core/FileScanner.cpp index eb45257c25..1f6b6d8ecb 100644 --- a/src/core/FileScanner.cpp +++ b/src/core/FileScanner.cpp @@ -26,6 +26,11 @@ #include #include #include +#elif defined(__WINDOWS__) + extern "C" { + // Windows needs this for widechar <-> utf8 conversion utils + #include "../localisation/language.h" + } #endif #include From f486a1d302a84cd60d10d75beb096322a032febf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 1 Dec 2016 10:57:16 +0100 Subject: [PATCH 11/62] Return valid value from `strlogicalcmp` even if `assert` is hit --- src/util/util.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/util.c b/src/util/util.c index 98f9c760af..53da8c12a6 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -310,6 +310,7 @@ int strlogicalcmp(char const *a, char const *b) { } assert(false); + return 0; } utf8 * safe_strtrunc(utf8 * text, size_t size) From 15a6575346d06e5c2c2237aeabafefcdbd1edbf1 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 13 Nov 2016 18:32:32 +0100 Subject: [PATCH 12/62] Update hooks to return CPU flags --- src/hook.c | 255 ++++++++++++------------------ src/hook.h | 21 +-- test/testpaint/PaintIntercept.cpp | 171 ++++++++++++-------- 3 files changed, 219 insertions(+), 228 deletions(-) diff --git a/src/hook.c b/src/hook.c index b1bb8d0581..8c1f664c4a 100644 --- a/src/hook.c +++ b/src/hook.c @@ -27,9 +27,12 @@ #include "hook.h" #include "platform/platform.h" -void* g_hooktableaddress = 0; -int g_hooktableoffset = 0; -int g_maxhooks = 1000; +void* _hookTableAddress = 0; +int _hookTableOffset = 0; +int _maxHooks = 1000; +#define HOOK_BYTE_COUNT (140) + +registers gHookRegisters = {0}; // This macro writes a little-endian 4-byte long value into *data // It is used to avoid type punning. @@ -39,165 +42,115 @@ int g_maxhooks = 1000; *(data + 2) = ((addr) & 0x00ff0000) >> 16; \ *(data + 3) = ((addr) & 0xff000000) >> 24; -static void hookfunc(int address, int newaddress, int stacksize, int registerargs[], int registersreturned, int eaxDestinationRegister) +static void hookfunc(uintptr_t address, uintptr_t hookAddress, int stacksize) { int i = 0; - char data[100]; + uint8 data[HOOK_BYTE_COUNT] = {0}; - registersreturned |= eaxDestinationRegister; + uintptr_t registerAddress = (uintptr_t) &gHookRegisters; - int registerssaved = 7; - int n = registersreturned; - for (; n; registerssaved--) { - n &= n - 1; - } - int numrargs = 0; - for (int j = 0; ; j++) { - if (registerargs[j] != END) { - numrargs++; - } else { - break; - } - } + data[i++] = 0x89; // mov [gHookRegisters], eax + data[i++] = (0b000 << 3) | 0b101; + write_address_strictalias(&data[i], registerAddress); + i += 4; - int rargssize = numrargs * 4; + data[i++] = 0x89; // mov [gHookRegisters + 4], ebx + data[i++] = (0b011 << 3) | 0b101; + write_address_strictalias(&data[i], registerAddress + 4); + i += 4; - if (!(registersreturned & EAX)) { - data[i++] = 0x50; // push eax - } - if (!(registersreturned & EBX)) { - data[i++] = 0x53; // push ebx - } - if (!(registersreturned & ECX)) { - data[i++] = 0x51; // push ecx - } - if (!(registersreturned & EDX)) { - data[i++] = 0x52; // push edx - } - if (!(registersreturned & EBP)) { - data[i++] = 0x55; // push ebp - } - if (!(registersreturned & ESI)) { - data[i++] = 0x56; // push esi - } - if (!(registersreturned & EDI)) { - data[i++] = 0x57; // push edi - } + data[i++] = 0x89; // mov [gHookRegisters + 8], ecx + data[i++] = (0b001 << 3) | 0b101; + write_address_strictalias(&data[i], registerAddress + 8); + i += 4; - data[i++] = 0x50; //push eax - data[i++] = 0x89; //mov eax, esp - data[i++] = 0xE0; - data[i++] = 0x83; //sub eax, (0xC + numargs*4) & 0xF - data[i++] = 0xE8; - data[i++] = (0xC + numrargs * 4) & 0xF; - data[i++] = 0x83; //and eax, 0xC - data[i++] = 0xE0; - data[i++] = 0x0C; - data[i++] = 0xA3; //mov [0x9ABDA8], eax - data[i++] = 0xA8; - data[i++] = 0xBD; - data[i++] = 0x9A; - data[i++] = 0x00; - data[i++] = 0x58; //pop eax - data[i++] = 0x2B; //sub esp, [0x9ABDA8] - data[i++] = 0x25; - data[i++] = 0xA8; - data[i++] = 0xBD; - data[i++] = 0x9A; - data[i++] = 0x00; + data[i++] = 0x89; // mov [gHookRegisters + 12], edx + data[i++] = (0b010 << 3) | 0b101; + write_address_strictalias(&data[i], registerAddress + 12); + i += 4; + + data[i++] = 0x89; // mov [gHookRegisters + 16], esi + data[i++] = (0b110 << 3) | 0b101; + write_address_strictalias(&data[i], registerAddress + 16); + i += 4; + + data[i++] = 0x89; // mov [gHookRegisters + 20], edi + data[i++] = (0b111 << 3) | 0b101; + write_address_strictalias(&data[i], registerAddress + 20); + i += 4; + + data[i++] = 0x89; // mov [gHookRegisters + 24], ebp + data[i++] = (0b101 << 3) | 0b101; + write_address_strictalias(&data[i], registerAddress + 24); + i += 4; // work out distance to nearest 0xC // (esp - numargs * 4) & 0xC // move to align - 4 // save that amount - if (numrargs > 0) { - // push the registers to be on the stack to access as arguments - for (signed int j = numrargs - 1; j >= 0; j--) { - switch (registerargs[j]) { - case EAX: data[i++] = 0x50; break; - case EBX: data[i++] = 0x53; break; - case ECX: data[i++] = 0x51; break; - case EDX: data[i++] = 0x52; break; - case ESI: data[i++] = 0x56; break; - case EDI: data[i++] = 0x57; break; - case EBP: data[i++] = 0x55; break; - } - } - } + // push the registers to be on the stack to access as arguments + data[i++] = 0x68; // push gHookRegisters + write_address_strictalias(&data[i], registerAddress); + i += 4; data[i++] = 0xE8; // call - write_address_strictalias(&data[i], newaddress - address - i - 4); + write_address_strictalias(&data[i], hookAddress - address - i - 4); i += 4; - // returnlocation: - switch (eaxDestinationRegister) { - case EBX: - // mov ebx, eax - data[i++] = 0x8B; - data[i++] = 0xD8; - break; - case ECX: - // mov ecx, eax - data[i++] = 0x8B; - data[i++] = 0xC8; - break; - case EDX: - // mov ecx, eax - data[i++] = 0x8B; - data[i++] = 0xD0; - break; - case ESI: - // mov ecx, eax - data[i++] = 0x8B; - data[i++] = 0xF0; - break; - case EDI: - // mov ecx, eax - data[i++] = 0x8B; - data[i++] = 0xF8; - break; - case EBP: - // mov ecx, eax - data[i++] = 0x8B; - data[i++] = 0xE8; - break; - } + data[i++] = 0x83; // add esp, 4 + data[i++] = 0xC4; + data[i++] = 0x04; - data[i++] = 0x83; // sub esp, x - data[i++] = 0xEC; - data[i++] = (signed char)(stacksize * -4) - rargssize; - - data[i++] = 0x03; //add esp, [0x9ABDA8] - data[i++] = 0x25; - data[i++] = 0xA8; - data[i++] = 0xBD; - data[i++] = 0x9A; + data[i++] = 0x25; // and eax,0xff + data[i++] = 0xff; data[i++] = 0x00; + data[i++] = 0x00; + data[i++] = 0x00; + data[i++] = 0xc1; // shl eax, 8 + data[i++] = 0xe0; + data[i++] = 0x08; + data[i++] = 0x9e; // sahf + data[i++] = 0x9c; // pushf - if (!(registersreturned & EDI)) { - data[i++] = 0x5F; // pop edi - } - if (!(registersreturned & ESI)) { - data[i++] = 0x5E; // pop esi - } - if (!(registersreturned & EBP)) { - data[i++] = 0x5D; // pop ebp - } - if (!(registersreturned & EDX)) { - data[i++] = 0x5A; // pop edx - } - if (!(registersreturned & ECX)) { - data[i++] = 0x59; // pop ecx - } - if (!(registersreturned & EBX)) { - data[i++] = 0x5B; // pop ebx - } - if (!(registersreturned & EAX)) { - data[i++] = 0x58; // pop eax - } + data[i++] = 0x8B; // mov eax, [gHookRegisters] + data[i++] = (0b000 << 3) | 0b101; + write_address_strictalias(&data[i], registerAddress); + i += 4; + + data[i++] = 0x8B; // mov ebx, [gHookRegisters + 4] + data[i++] = (0b011 << 3) | 0b101; + write_address_strictalias(&data[i], registerAddress + 4); + i += 4; + + data[i++] = 0x8B; // mov ecx, [gHookRegisters + 8] + data[i++] = (0b001 << 3) | 0b101; + write_address_strictalias(&data[i], registerAddress + 8); + i += 4; + + data[i++] = 0x8B; // mov edx, [gHookRegisters + 12] + data[i++] = (0b010 << 3) | 0b101; + write_address_strictalias(&data[i], registerAddress + 12); + i += 4; + + data[i++] = 0x8B; // mov esi, [gHookRegisters + 16] + data[i++] = (0b110 << 3) | 0b101; + write_address_strictalias(&data[i], registerAddress + 16); + i += 4; + + data[i++] = 0x8B; // mov edi, [gHookRegisters + 20] + data[i++] = (0b111 << 3) | 0b101; + write_address_strictalias(&data[i], registerAddress + 20); + i += 4; + + data[i++] = 0x8B; // mov ebp, [gHookRegisters + 24] + data[i++] = (0b101 << 3) | 0b101; + write_address_strictalias(&data[i], registerAddress + 24); + i += 4; + + data[i++] = 0x9d; // popf data[i++] = 0xC3; // retn @@ -209,26 +162,26 @@ static void hookfunc(int address, int newaddress, int stacksize, int registerarg #endif // __WINDOWS__ } -void addhook(int address, int newaddress, int stacksize, int registerargs[], int registersreturned, int eaxDestinationRegister) +void addhook(uintptr_t address, hook_function *function) { - if (!g_hooktableaddress) { - size_t size = g_maxhooks * 100; + if (!_hookTableAddress) { + size_t size = _maxHooks * HOOK_BYTE_COUNT; #ifdef __WINDOWS__ - g_hooktableaddress = VirtualAllocEx(GetCurrentProcess(), NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); + _hookTableAddress = VirtualAllocEx(GetCurrentProcess(), NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE); #else - g_hooktableaddress = mmap(NULL, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (g_hooktableaddress == MAP_FAILED) + _hookTableAddress = mmap(NULL, size, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (_hookTableAddress == MAP_FAILED) { perror("mmap"); exit(1); } #endif // __WINDOWS__ } - if (g_hooktableoffset > g_maxhooks) { + if (_hookTableOffset > _maxHooks) { return; } - unsigned int hookaddress = (unsigned int)g_hooktableaddress + (g_hooktableoffset * 100); - char data[9]; + unsigned int hookaddress = (unsigned int)_hookTableAddress + (_hookTableOffset * HOOK_BYTE_COUNT); + uint8 data[9]; int i = 0; data[i++] = 0xE9; // jmp @@ -254,8 +207,8 @@ void addhook(int address, int newaddress, int stacksize, int registerargs[], int perror("mprotect"); } #endif // __WINDOWS__ - hookfunc(hookaddress, newaddress, stacksize, registerargs, registersreturned, eaxDestinationRegister); - g_hooktableoffset++; + hookfunc(hookaddress, (uintptr_t)function, 0); + _hookTableOffset++; } #endif diff --git a/src/hook.h b/src/hook.h index 3ca02fef69..c4dbdf5758 100644 --- a/src/hook.h +++ b/src/hook.h @@ -19,18 +19,19 @@ #ifndef NO_RCT2 -enum REGISTER_ARGS { - EAX = 1 << 0, - EBX = 1 << 1, - ECX = 1 << 2, - EDX = 1 << 3, - ESI = 1 << 4, - EDI = 1 << 5, - EBP = 1 << 6, - END = 0 +enum { + X86_FLAG_CARRY = 1 << 0, + X86_FLAG_PARITY = 1 << 2, + + X86_FLAG_ADJUST = 1 << 4, + + X86_FLAG_ZERO = 1 << 6, + X86_FLAG_SIGN = 1 << 7, }; -void addhook(int address, int newaddress, int stacksize, int registerargs[], int registersreturned, int eaxDestinationRegister); +typedef uint8 (hook_function)(registers *regs); + +void addhook(uintptr_t address, hook_function *function); #endif diff --git a/test/testpaint/PaintIntercept.cpp b/test/testpaint/PaintIntercept.cpp index 10d3c03280..1f0aebbb18 100644 --- a/test/testpaint/PaintIntercept.cpp +++ b/test/testpaint/PaintIntercept.cpp @@ -29,47 +29,46 @@ static uint8 _callCount = 0; static function_call _calls[256] = {0}; namespace PaintIntercept { - static uint32 InterceptWoodenASupports(uint32 eax, uint32 ebx, uint32 edx, uint32 edi, uint32 ebp); - static uint32 InterceptWoodenBSupports(uint32 eax, uint32 ebx, uint32 edx, uint32 edi, uint32 ebp); - static uint32 InterceptMetalASupports(uint32 eax, uint32 ebx, uint32 edx, uint32 edi, uint32 ebp); - static uint32 InterceptMetalBSupports(uint32 eax, uint32 ebx, uint32 edx, uint32 edi, uint32 ebp); - static uint32 InterceptPaint6C(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp); - static uint32 InterceptPaint7C(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp); - static uint32 InterceptPaint8C(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp); - static uint32 InterceptPaint9C(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp); - static uint32 InterceptPaintFull(uint8 function, uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp); + static uint8 InterceptWoodenASupports(registers *regs); + static uint8 InterceptWoodenBSupports(registers *regs); + static uint8 InterceptMetalASupports(registers *regs); + static uint8 InterceptMetalBSupports(registers *regs); + static uint8 InterceptPaint6C(registers *regs); + static uint8 InterceptPaint7C(registers *regs); + static uint8 InterceptPaint8C(registers *regs); + static uint8 InterceptPaint9C(registers *regs); + static uint8 InterceptPaintFull(uint8 function, registers *regs); + bool PaintMetalSupports(uint8 function, int supportType, uint8 segment, int special, int height, uint32 imageColourFlags); bool PaintWoodenSupports(uint8 function, int supportType, int special, int height, uint32 imageColourFlags, bool *underground); static void CheckSegmentSupportHeight(); void InitHooks() { - int supportsRegisterArgs[] = {EAX, EBX, EDX, EDI, EBP, END}; - addhook(0x006629BC, (int) InterceptWoodenASupports, 0, supportsRegisterArgs, 0, EAX); - addhook(0x00662D5C, (int) InterceptWoodenBSupports, 0, supportsRegisterArgs, 0, EAX); + addhook(0x006629BC, InterceptWoodenASupports); + addhook(0x00662D5C, InterceptWoodenBSupports); - addhook(0x00663105, (int) InterceptMetalASupports, 0, supportsRegisterArgs, 0, EAX); - addhook(0x00663584, (int) InterceptMetalBSupports, 0, supportsRegisterArgs, 0, EAX); + addhook(0x00663105, InterceptMetalASupports); + addhook(0x00663584, InterceptMetalBSupports); - int paintRegisterArgs[] = {EAX, EBX, ECX, EDX, ESI, EDI, EBP, END}; - addhook(0x006861AC, (int) InterceptPaint6C, 0, paintRegisterArgs, 0, EBP); - addhook(0x00686337, (int) InterceptPaint6C, 0, paintRegisterArgs, 0, EBP); - addhook(0x006864D0, (int) InterceptPaint6C, 0, paintRegisterArgs, 0, EBP); - addhook(0x0068666B, (int) InterceptPaint6C, 0, paintRegisterArgs, 0, EBP); + addhook(0x006861AC, InterceptPaint6C); + addhook(0x00686337, InterceptPaint6C); + addhook(0x006864D0, InterceptPaint6C); + addhook(0x0068666B, InterceptPaint6C); - addhook(0x00686806, (int) InterceptPaint7C, 0, paintRegisterArgs, 0, EBP); - addhook(0x006869B2, (int) InterceptPaint7C, 0, paintRegisterArgs, 0, EBP); - addhook(0x00686B6F, (int) InterceptPaint7C, 0, paintRegisterArgs, 0, EBP); - addhook(0x00686D31, (int) InterceptPaint7C, 0, paintRegisterArgs, 0, EBP); + addhook(0x00686806, InterceptPaint7C); + addhook(0x006869B2, InterceptPaint7C); + addhook(0x00686B6F, InterceptPaint7C); + addhook(0x00686D31, InterceptPaint7C); - addhook(0x00686EF0, (int) InterceptPaint8C, 0, paintRegisterArgs, 0, EBP); - addhook(0x00687056, (int) InterceptPaint8C, 0, paintRegisterArgs, 0, EBP); - addhook(0x006871C8, (int) InterceptPaint8C, 0, paintRegisterArgs, 0, EBP); - addhook(0x0068733C, (int) InterceptPaint8C, 0, paintRegisterArgs, 0, EBP); + addhook(0x00686EF0, InterceptPaint8C); + addhook(0x00687056, InterceptPaint8C); + addhook(0x006871C8, InterceptPaint8C); + addhook(0x0068733C, InterceptPaint8C); - addhook(0x006874B0, (int) InterceptPaint9C, 0, paintRegisterArgs, 0, EBP); - addhook(0x00687618, (int) InterceptPaint9C, 0, paintRegisterArgs, 0, EBP); - addhook(0x0068778C, (int) InterceptPaint9C, 0, paintRegisterArgs, 0, EBP); - addhook(0x00687902, (int) InterceptPaint9C, 0, paintRegisterArgs, 0, EBP); + addhook(0x006874B0, InterceptPaint9C); + addhook(0x00687618, InterceptPaint9C); + addhook(0x0068778C, InterceptPaint9C); + addhook(0x00687902, InterceptPaint9C); } bool PaintWoodenSupports(uint8 function, int supportType, int special, int height, uint32 imageColourFlags, bool *underground) { @@ -110,7 +109,7 @@ namespace PaintIntercept { sint16 zOffset, uint32 rotation ) { - function_call call = {0}; + function_call call = _calls[_callCount]; call.function = PAINT_98196C; call.paint.image_id = imageID; call.paint.offset = {xOffset, yOffset}; @@ -133,7 +132,7 @@ namespace PaintIntercept { sint16 boundBoxOffsetX, sint16 boundBoxOffsetY, sint16 boundBoxOffsetZ, uint32 rotation ) { - function_call call = {0}; + function_call call = _calls[_callCount]; call.function = function; call.paint.image_id = imageID; call.paint.offset = {xOffset, yOffset}; @@ -162,16 +161,18 @@ namespace PaintIntercept { _woodenSupports = enabled; } - static uint32 InterceptMetalASupports(uint32 eax, uint32 ebx, uint32 edx, uint32 edi, uint32 ebp) { - bool output = PaintMetalSupports(SUPPORTS_METAL_A, edi, ebx, (sint16) (eax & 0xFFFF), (edx & 0xFFFF), ebp); + static uint8 InterceptMetalASupports(registers *regs) + { + bool output = PaintMetalSupports(SUPPORTS_METAL_A, regs->edi, regs->ebx, (sint16) regs->ax, regs->dx, regs->ebp); - return output ? 1 : 0; + return output ? X86_FLAG_CARRY : 0; } - static uint32 InterceptMetalBSupports(uint32 eax, uint32 ebx, uint32 edx, uint32 edi, uint32 ebp) { - bool output = PaintMetalSupports(SUPPORTS_METAL_B, edi, ebx, (sint16) (eax & 0xFFFF), (edx & 0xFFFF), ebp); + static uint8 InterceptMetalBSupports(registers *regs) + { + bool output = PaintMetalSupports(SUPPORTS_METAL_B, regs->edi, regs->ebx, (sint16) regs->ax, regs->dx, regs->ebp); - return output ? 1 : 0; + return output ? X86_FLAG_CARRY : 0; } static void CheckSegmentSupportHeight() { @@ -192,47 +193,75 @@ namespace PaintIntercept { _callCount++; } - static uint32 InterceptWoodenASupports(uint32 eax, uint32 ebx, uint32 edx, uint32 edi, uint32 ebp) { - bool output = PaintWoodenSupports(SUPPORTS_WOOD_A, edi, eax & 0xFFFF, edx & 0xFFFF, ebp, nullptr); + static uint8 InterceptWoodenASupports(registers *regs) + { + bool cf = false; + regs->al = PaintWoodenSupports(SUPPORTS_WOOD_A, regs->edi, regs->ax, regs->dx, regs->ebp, &cf); - return output ? 1 : 0; + if (cf) + { + return X86_FLAG_CARRY; + } + + return 0; } - static uint32 InterceptWoodenBSupports(uint32 eax, uint32 ebx, uint32 edx, uint32 edi, uint32 ebp) { - bool output = PaintWoodenSupports(SUPPORTS_WOOD_B, edi, eax & 0xFFFF, edx & 0xFFFF, ebp, nullptr); + static uint8 InterceptWoodenBSupports(registers *regs) + { + bool cf = false; + regs->al = PaintWoodenSupports(SUPPORTS_WOOD_B, regs->edi, regs->ax, regs->dx, regs->ebp, &cf); - return output ? 1 : 0; + if (cf) + { + return X86_FLAG_CARRY; + } + + return 0; } - static uint32 InterceptPaint6C(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp) { - if ((ebp & 0x03) != get_current_rotation()) { + static uint8 InterceptPaint6C(registers *regs) + { + if ((regs->ebp & 0x03) != get_current_rotation()) + { // Log error log_error("Ebp is different from current rotation"); } - return (uintptr_t) Paint6C( - ebx, - (sint8) (eax & 0xFF), (sint8) (ecx & 0xFF), - (sint16) (edi & 0xFFFF), (sint16) (esi & 0xFFFF), (sint8) ((eax >> 8) & 0xFF), - edx & 0xFFFF, - ebp & 0x03 + paint_struct *out = Paint6C( + regs->ebx, + (sint8) regs->al, (sint8) regs->cl, + (sint16) regs->di, (sint16) regs->si, (sint8) regs->ah, + regs->dx, + regs->ebp & 0x03 ); + + if (out == nullptr) + { + return X86_FLAG_CARRY; + } + + regs->ebp = (int) out; + regs->al = 1; + return 0; } - static uint32 InterceptPaint7C(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp) { - return InterceptPaintFull(PAINT_98197C, eax, ebx, ecx, edx, esi, edi, ebp); + static uint8 InterceptPaint7C(registers *regs) + { + return InterceptPaintFull(PAINT_98197C, regs); } - static uint32 InterceptPaint8C(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp) { - return InterceptPaintFull(PAINT_98198C, eax, ebx, ecx, edx, esi, edi, ebp); + static uint8 InterceptPaint8C(registers *regs) + { + return InterceptPaintFull(PAINT_98198C, regs); } - static uint32 InterceptPaint9C(uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp) { - return InterceptPaintFull(PAINT_98199C, eax, ebx, ecx, edx, esi, edi, ebp); + static uint8 InterceptPaint9C(registers *regs) + { + return InterceptPaintFull(PAINT_98199C, regs); } - static uint32 InterceptPaintFull(uint8 function, uint32 eax, uint32 ebx, uint32 ecx, uint32 edx, uint32 esi, uint32 edi, uint32 ebp) { - if ((ebp & 0x03) != get_current_rotation()) { + static uint8 InterceptPaintFull(uint8 function, registers *regs) { + if ((regs->ebp & 0x03) != get_current_rotation()) { // Log error log_error("Ebp is different from current rotation"); } @@ -243,15 +272,23 @@ namespace PaintIntercept { RCT2_GLOBAL(RCT2_ADDRESS_PAINT_BOUNDBOX_OFFSET_Z, sint16) }; - return (uintptr_t) PaintFull( + paint_struct *out = PaintFull( function, - ebx, - (sint8) (eax & 0xFF), (sint8) (ecx & 0xFF), - (sint16) (edi & 0xFFFF), (sint16) (esi & 0xFFFF), (sint8) ((eax >> 8) & 0xFF), - edx & 0xFFFF, + regs->ebx, + (sint8) regs->al, (sint8) regs->cl, + (sint16) regs->di, (sint16) regs->si, (sint8) regs->ah, + regs->dx, boundOffset.x, boundOffset.y, boundOffset.z, - ebp & 0x03 + regs->ebp & 0x03 ); + + if (out == nullptr) + { + return X86_FLAG_CARRY; + } + + regs->ebp = (int) out; + return 0; } }; From e7254ca708f97708916b9f702f435ad6b0e68a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 1 Dec 2016 14:33:23 +0100 Subject: [PATCH 13/62] Fix call to `realpath` in `posix.c` --- src/platform/posix.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/platform/posix.c b/src/platform/posix.c index ae976c4a4a..1e0e2912e8 100644 --- a/src/platform/posix.c +++ b/src/platform/posix.c @@ -699,9 +699,16 @@ void platform_get_openrct_data_path(utf8 *outPath, size_t outSize) void platform_resolve_openrct_data_path() { if (gCustomOpenrctDataPath[0] != 0) { - if (realpath(gCustomOpenrctDataPath, _openrctDataDirectoryPath) == NULL) { + // NOTE: second argument to `realpath` is meant to either be NULL or `PATH_MAX`-sized buffer, + // since our `MAX_PATH` macro is set to some other value, pass NULL to have `realpath` return + // a `malloc`ed buffer. + char *resolved_path = realpath(gCustomOpenrctDataPath, NULL); + if (resolved_path == NULL) { log_error("Could not resolve path \"%s\", errno = %d", gCustomOpenrctDataPath, errno); return; + } else { + safe_strcpy(_openrctDataDirectoryPath, resolved_path, MAX_PATH); + free(resolved_path); } path_end_with_separator(_openrctDataDirectoryPath, MAX_PATH); From 54e622659d2f14ad0cc975dd88cd11b8990ba8ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Wed, 30 Nov 2016 12:07:10 +0100 Subject: [PATCH 14/62] Extract common parts from rct2.h to common.h --- src/ScenarioRepository.cpp | 1 + src/audio/audio.c | 1 + src/audio/mixer.cpp | 1 + src/cmdline/ConvertCommand.cpp | 1 + src/common.h | 160 +++++++++++++++++- src/core/Console.hpp | 2 + src/core/Memory.hpp | 1 + src/drawing/NewDrawing.cpp | 1 + src/drawing/drawing.c | 1 + src/drawing/engines/SoftwareDrawingEngine.cpp | 1 + src/drawing/sprite.c | 1 + src/drawing/string.c | 1 + src/input.c | 1 + src/interface/chat.c | 1 + src/interface/console.c | 1 + src/interface/screenshot.c | 1 + src/interface/title_sequences.c | 1 + src/interface/viewport.c | 1 + src/intro.c | 1 + src/management/news_item.c | 1 + src/network/twitch.cpp | 1 + src/object/ObjectRepository.cpp | 1 + src/paint/map_element/surface.c | 1 + src/peep/peep.c | 1 + src/platform/platform.h | 1 + src/platform/shared.c | 1 + src/rct2.h | 160 +----------------- src/rct2/S6Exporter.cpp | 1 + src/rct2/S6Importer.cpp | 1 + src/ride/TrackDesignRepository.cpp | 1 + src/ride/ride_ratings.c | 1 + src/windows/changelog.c | 1 + src/windows/clear_scenery.c | 1 + src/windows/debug_paint.c | 1 + src/windows/dropdown.c | 1 + src/windows/editor_main.c | 1 + src/windows/editor_objective_options.c | 1 + src/windows/editor_scenario_options.c | 1 + src/windows/error.c | 1 + src/windows/footpath.c | 2 + src/windows/game_bottom_toolbar.c | 1 + src/windows/land.c | 1 + src/windows/land_rights.c | 1 + src/windows/main.c | 1 + src/windows/map.c | 1 + src/windows/options.c | 1 + src/windows/park.c | 1 + src/windows/ride.c | 1 + src/windows/save_prompt.c | 1 + src/windows/scenery.c | 1 + src/windows/staff_list.c | 1 + src/windows/title_command_editor.c | 1 + src/windows/title_editor.c | 1 + src/windows/title_exit.c | 1 + src/windows/title_options.c | 1 + src/windows/tooltip.c | 1 + src/windows/track_manage.c | 1 + src/windows/water.c | 1 + src/world/climate.c | 1 + src/world/footpath.c | 5 + src/world/map.c | 1 + src/world/park.c | 1 + 62 files changed, 226 insertions(+), 160 deletions(-) diff --git a/src/ScenarioRepository.cpp b/src/ScenarioRepository.cpp index 4a4d5b0b7b..39de3c989d 100644 --- a/src/ScenarioRepository.cpp +++ b/src/ScenarioRepository.cpp @@ -31,6 +31,7 @@ extern "C" #include "config.h" #include "localisation/localisation.h" #include "scenario.h" + #include "rct2.h" } static int ScenarioCategoryCompare(int categoryA, int categoryB) diff --git a/src/audio/audio.c b/src/audio/audio.c index 6d69d80285..b255e6532e 100644 --- a/src/audio/audio.c +++ b/src/audio/audio.c @@ -23,6 +23,7 @@ #include "../util/util.h" #include "../localisation/string_ids.h" #include "../intro.h" +#include "../rct2.h" typedef struct rct_audio_params { bool in_range; diff --git a/src/audio/mixer.cpp b/src/audio/mixer.cpp index 2b03f1b9f4..859ae66a77 100644 --- a/src/audio/mixer.cpp +++ b/src/audio/mixer.cpp @@ -20,6 +20,7 @@ extern "C" { #include "../platform/platform.h" #include "../localisation/localisation.h" #include "../openrct2.h" + #include "../rct2.h" #include "audio.h" } #include "mixer.h" diff --git a/src/cmdline/ConvertCommand.cpp b/src/cmdline/ConvertCommand.cpp index a6ae65d4d4..b0a4bfde41 100644 --- a/src/cmdline/ConvertCommand.cpp +++ b/src/cmdline/ConvertCommand.cpp @@ -26,6 +26,7 @@ extern "C" { #include "../game.h" #include "../openrct2.h" + #include "../rct2.h" #include "../interface/window.h" } diff --git a/src/common.h b/src/common.h index 7de291a628..4172604263 100644 --- a/src/common.h +++ b/src/common.h @@ -17,8 +17,166 @@ #ifndef _COMMON_H_ #define _COMMON_H_ +#include + +#ifndef _USE_MATH_DEFINES +#define _USE_MATH_DEFINES +#endif +#undef M_PI + +#ifdef _MSC_VER +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + #include "diagnostic.h" -#include "rct2.h" + +typedef int8_t sint8; +typedef int16_t sint16; +typedef int32_t sint32; +typedef int64_t sint64; +typedef uint8_t uint8; +typedef uint16_t uint16; +typedef uint32_t uint32; +typedef uint64_t uint64; + +typedef char utf8; +typedef utf8* utf8string; +typedef const utf8* const_utf8string; +#ifdef __WINDOWS__ +typedef wchar_t utf16; +typedef utf16* utf16string; +#endif + +typedef uint32 codepoint_t; +typedef uint8 colour_t; + +#define rol8(x, shift) (((uint8)(x) << (shift)) | ((uint8)(x) >> (8 - (shift)))) +#define ror8(x, shift) (((uint8)(x) >> (shift)) | ((uint8)(x) << (8 - (shift)))) +#define rol16(x, shift) (((uint16)(x) << (shift)) | ((uint16)(x) >> (16 - (shift)))) +#define ror16(x, shift) (((uint16)(x) >> (shift)) | ((uint16)(x) << (16 - (shift)))) +#define rol32(x, shift) (((uint32)(x) << (shift)) | ((uint32)(x) >> (32 - (shift)))) +#define ror32(x, shift) (((uint32)(x) >> (shift)) | ((uint32)(x) << (32 - (shift)))) +#define rol64(x, shift) (((uint64)(x) << (shift)) | ((uint32)(x) >> (64 - (shift)))) +#define ror64(x, shift) (((uint64)(x) >> (shift)) | ((uint32)(x) << (64 - (shift)))) + +#ifndef __cplusplus +// in C++ you should be using Math::Min and Math::Max +#ifndef min +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#endif +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#endif // __cplusplus + +#define sgn(x) ((x > 0) ? 1 : ((x < 0) ? -1 : 0)) +#define clamp(l, x, h) (min(h, max(l, x))) + +// Rounds an integer down to the given power of 2. y must be a power of 2. +#define floor2(x, y) ((x) & (~((y) - 1))) + +// Rounds an integer up to the given power of 2. y must be a power of 2. +#define ceil2(x, y) (((x) + (y) - 1) & (~((y) - 1))) + + +#ifndef __cplusplus +// in C++ you should be using Util::CountOf +#ifdef __GNUC__ +/** + * Force a compilation error if condition is true, but also produce a + * result (of value 0 and type size_t), so the expression can be used + * e.g. in a structure initializer (or where-ever else comma expressions + * aren't permitted). + */ +#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) + +/* &a[0] degrades to a pointer: a different type from an array */ +#define __must_be_array(a) \ + BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) + +// based on http://lxr.free-electrons.com/source/include/linux/kernel.h#L54 +#define countof(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) +#elif defined (_MSC_VER) +#define countof(arr) _countof(arr) +#else +#define countof(arr) (sizeof(arr) / sizeof((arr)[0])) +#endif // __GNUC__ +#endif // __cplusplus + +#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) +#include +#define STUB() log_warning("Function %s at %s:%d is a stub.\n", __PRETTY_FUNCTION__, __FILE__, __LINE__) +#define _strcmpi _stricmp +#define _stricmp(x, y) strcasecmp((x), (y)) +#define _strnicmp(x, y, n) strncasecmp((x), (y), (n)) +#define _strdup(x) strdup((x)) + +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define RCT2_ENDIANESS __ORDER_LITTLE_ENDIAN__ +#define LOBYTE(w) ((uint8)(w)) +#define HIBYTE(w) ((uint8)(((uint16)(w)>>8)&0xFF)) +#endif // __BYTE_ORDER__ + +#ifndef RCT2_ENDIANESS +#error Unknown endianess! +#endif // RCT2_ENDIANESS + +#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) + +#if !((defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700)) +char *strndup(const char *src, size_t size); +#endif // !(POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700) + +// BSD and macOS have MAP_ANON instead of MAP_ANONYMOUS +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif + +#include "version.h" + +#define OPENRCT2_MASTER_SERVER_URL "https://servers.openrct2.website" + +// Time (represented as number of 100-nanosecond intervals since 0001-01-01T00:00:00Z) +typedef uint64 datetime64; + +#define DATETIME64_MIN ((datetime64)0) + +// Represent fixed point numbers. dp = decimal point +typedef uint8 fixed8_1dp; +typedef uint8 fixed8_2dp; +typedef sint16 fixed16_1dp; +typedef sint16 fixed16_2dp; +typedef sint32 fixed32_1dp; +typedef sint32 fixed32_2dp; + +// Money is stored as a multiple of 0.10. +typedef fixed8_1dp money8; +typedef fixed16_1dp money16; +typedef fixed32_1dp money32; + +// Construct a fixed point number. For example, to create the value 3.65 you +// would write FIXED_2DP(3,65) +#define FIXED_XDP(x, whole, fraction) ((whole) * (10 * x) + (fraction)) +#define FIXED_1DP(whole, fraction) FIXED_XDP(1, whole, fraction) +#define FIXED_2DP(whole, fraction) FIXED_XDP(10, whole, fraction) + +// Construct a money value in the format MONEY(10,70) to represent 10.70. Fractional part must be two digits. +#define MONEY(whole, fraction) ((whole) * 10 + ((fraction) / 10)) + +#define MONEY_FREE MONEY(0,00) +#define MONEY32_UNDEFINED ((money32)0x80000000) + +typedef void (EMPTY_ARGS_VOID_POINTER)(); +typedef unsigned short rct_string_id; #define SafeFree(x) do { free(x); (x) = NULL; } while (0) diff --git a/src/core/Console.hpp b/src/core/Console.hpp index 9b1d82f310..a763e6a056 100644 --- a/src/core/Console.hpp +++ b/src/core/Console.hpp @@ -21,6 +21,8 @@ extern "C" #include "../common.h" } +#include + namespace Console { void Write(char c); diff --git a/src/core/Memory.hpp b/src/core/Memory.hpp index 2a1c79f6b6..62b1e523ae 100644 --- a/src/core/Memory.hpp +++ b/src/core/Memory.hpp @@ -19,6 +19,7 @@ #include "../common.h" #include "Guard.hpp" #include +#include /** * Utility methods for memory management. Typically helpers and wrappers around the C standard library. diff --git a/src/drawing/NewDrawing.cpp b/src/drawing/NewDrawing.cpp index 4db7ea31fe..8046a3dc00 100644 --- a/src/drawing/NewDrawing.cpp +++ b/src/drawing/NewDrawing.cpp @@ -26,6 +26,7 @@ extern "C" #include "../interface/screenshot.h" #include "../localisation/string_ids.h" #include "../platform/platform.h" + #include "../rct2.h" } static sint32 _drawingEngineType = DRAWING_ENGINE_SOFTWARE; diff --git a/src/drawing/drawing.c b/src/drawing/drawing.c index 0d45490eaf..0e09782456 100644 --- a/src/drawing/drawing.c +++ b/src/drawing/drawing.c @@ -21,6 +21,7 @@ #include "../object.h" #include "../world/water.h" #include "drawing.h" +#include "../rct2.h" // HACK These were originally passed back through registers int gLastDrawStringX; diff --git a/src/drawing/engines/SoftwareDrawingEngine.cpp b/src/drawing/engines/SoftwareDrawingEngine.cpp index 433bf138ad..22d0cdd85a 100644 --- a/src/drawing/engines/SoftwareDrawingEngine.cpp +++ b/src/drawing/engines/SoftwareDrawingEngine.cpp @@ -31,6 +31,7 @@ extern "C" #include "../../intro.h" #include "../drawing.h" #include "../lightfx.h" + #include "../../rct2.h" } class SoftwareDrawingEngine; diff --git a/src/drawing/sprite.c b/src/drawing/sprite.c index 2298b1a875..a8a4593192 100644 --- a/src/drawing/sprite.c +++ b/src/drawing/sprite.c @@ -21,6 +21,7 @@ #include "../sprites.h" #include "../util/util.h" #include "drawing.h" +#include "../rct2.h" void *_g1Buffer = NULL; diff --git a/src/drawing/string.c b/src/drawing/string.c index ee029338f6..2ae44790de 100644 --- a/src/drawing/string.c +++ b/src/drawing/string.c @@ -23,6 +23,7 @@ #include "../util/util.h" #include "../world/map.h" #include "drawing.h" +#include "../rct2.h" enum { TEXT_DRAW_FLAG_INSET = 1 << 0, diff --git a/src/input.c b/src/input.c index a0f8ee802c..8409c7fac4 100644 --- a/src/input.c +++ b/src/input.c @@ -37,6 +37,7 @@ #include "world/sprite.h" #include "world/scenery.h" #include "openrct2.h" +#include "rct2.h" typedef struct rct_mouse_data { uint32 x; diff --git a/src/interface/chat.c b/src/interface/chat.c index aeebf1c37d..79c98f9e7b 100644 --- a/src/interface/chat.c +++ b/src/interface/chat.c @@ -22,6 +22,7 @@ #include "../network/network.h" #include "../platform/platform.h" #include "../util/util.h" +#include "../rct2.h" bool gChatOpen = false; char _chatCurrentLine[CHAT_MAX_MESSAGE_LENGTH]; diff --git a/src/interface/console.c b/src/interface/console.c index cfc2493072..54b4891bcf 100644 --- a/src/interface/console.c +++ b/src/interface/console.c @@ -31,6 +31,7 @@ #include "../object.h" #include "../object/ObjectManager.h" #include "../object/ObjectRepository.h" +#include "../rct2.h" #include "../world/banner.h" #include "../world/climate.h" #include "../world/scenery.h" diff --git a/src/interface/screenshot.c b/src/interface/screenshot.c index 7520da4404..bb26c32bc8 100644 --- a/src/interface/screenshot.c +++ b/src/interface/screenshot.c @@ -23,6 +23,7 @@ #include "../localisation/localisation.h" #include "../openrct2.h" #include "../platform/platform.h" +#include "../rct2.h" #include "../util/util.h" #include "../windows/error.h" #include "screenshot.h" diff --git a/src/interface/title_sequences.c b/src/interface/title_sequences.c index 622eebe698..a7d5978baa 100644 --- a/src/interface/title_sequences.c +++ b/src/interface/title_sequences.c @@ -19,6 +19,7 @@ #include "title_sequences.h" #include "../title.h" #include "../util/util.h" +#include "../rct2.h" uint16 gCurrentTitleSequence; diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 850c8c3aa1..8a715a3b82 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -21,6 +21,7 @@ #include "../input.h" #include "../localisation/localisation.h" #include "../peep/staff.h" +#include "../rct2.h" #include "../ride/ride_data.h" #include "../ride/track_data.h" #include "../sprites.h" diff --git a/src/intro.c b/src/intro.c index 58c21b9d7a..0c0b2007ae 100644 --- a/src/intro.c +++ b/src/intro.c @@ -19,6 +19,7 @@ #include "drawing/drawing.h" #include "intro.h" #include "sprites.h" +#include "rct2.h" #define BACKROUND_COLOUR_DARK 10 #define BACKROUND_COLOUR_LOGO 245 diff --git a/src/management/news_item.c b/src/management/news_item.c index de55f9a4e4..c723719ee9 100644 --- a/src/management/news_item.c +++ b/src/management/news_item.c @@ -19,6 +19,7 @@ #include "../interface/window.h" #include "../localisation/date.h" #include "../localisation/localisation.h" +#include "../rct2.h" #include "../ride/ride.h" #include "../world/sprite.h" #include "../util/util.h" diff --git a/src/network/twitch.cpp b/src/network/twitch.cpp index db2e45f0bb..22b5ccc848 100644 --- a/src/network/twitch.cpp +++ b/src/network/twitch.cpp @@ -42,6 +42,7 @@ extern "C" #include "../localisation/localisation.h" #include "../management/news_item.h" #include "../peep/peep.h" + #include "../rct2.h" #include "../world/sprite.h" #include "../util/util.h" #include "http.h" diff --git a/src/object/ObjectRepository.cpp b/src/object/ObjectRepository.cpp index eaca2cd2a6..9033a9c700 100644 --- a/src/object/ObjectRepository.cpp +++ b/src/object/ObjectRepository.cpp @@ -45,6 +45,7 @@ extern "C" #include "../object.h" #include "../object_list.h" #include "../platform/platform.h" + #include "../rct2.h" #include "../util/sawyercoding.h" #include "../util/util.h" } diff --git a/src/paint/map_element/surface.c b/src/paint/map_element/surface.c index 0d5ca840fa..0b11c1742a 100644 --- a/src/paint/map_element/surface.c +++ b/src/paint/map_element/surface.c @@ -20,6 +20,7 @@ #include "../../peep/staff.h" #include "map_element.h" #include "surface.h" +#include "../../rct2.h" const uint8 byte_97B444[] = { 0, 2, 1, 3, 8, 10, 9, 11, 4, 6, diff --git a/src/peep/peep.c b/src/peep/peep.c index 4f42005c54..a8c3ef515f 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -26,6 +26,7 @@ #include "../management/news_item.h" #include "../openrct2.h" #include "../network/network.h" +#include "../rct2.h" #include "../ride/ride.h" #include "../ride/ride_data.h" #include "../ride/track.h" diff --git a/src/platform/platform.h b/src/platform/platform.h index 82cb99d65c..6d636bda19 100644 --- a/src/platform/platform.h +++ b/src/platform/platform.h @@ -20,6 +20,7 @@ #include "../common.h" #ifdef __WINDOWS__ +#include "../rct2.h" #ifndef HAVE_MATH_H #define HAVE_MATH_H #endif diff --git a/src/platform/shared.c b/src/platform/shared.c index ff75fbb520..ed1bf5b4db 100644 --- a/src/platform/shared.c +++ b/src/platform/shared.c @@ -28,6 +28,7 @@ #include "../localisation/currency.h" #include "../localisation/localisation.h" #include "../openrct2.h" +#include "../rct2.h" #include "../title.h" #include "../util/util.h" #include "../world/climate.h" diff --git a/src/rct2.h b/src/rct2.h index f9597746ba..3f450067e3 100644 --- a/src/rct2.h +++ b/src/rct2.h @@ -17,165 +17,7 @@ #ifndef _RCT2_H_ #define _RCT2_H_ -#include -#include - -#ifndef _USE_MATH_DEFINES - #define _USE_MATH_DEFINES -#endif -#undef M_PI - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef _MSC_VER - #include -#endif - -typedef int8_t sint8; -typedef int16_t sint16; -typedef int32_t sint32; -typedef int64_t sint64; -typedef uint8_t uint8; -typedef uint16_t uint16; -typedef uint32_t uint32; -typedef uint64_t uint64; - -typedef char utf8; -typedef utf8* utf8string; -typedef const utf8* const_utf8string; -typedef wchar_t utf16; -typedef utf16* utf16string; - -typedef uint32 codepoint_t; -typedef uint8 colour_t; - -#define rol8(x, shift) (((uint8)(x) << (shift)) | ((uint8)(x) >> (8 - (shift)))) -#define ror8(x, shift) (((uint8)(x) >> (shift)) | ((uint8)(x) << (8 - (shift)))) -#define rol16(x, shift) (((uint16)(x) << (shift)) | ((uint16)(x) >> (16 - (shift)))) -#define ror16(x, shift) (((uint16)(x) >> (shift)) | ((uint16)(x) << (16 - (shift)))) -#define rol32(x, shift) (((uint32)(x) << (shift)) | ((uint32)(x) >> (32 - (shift)))) -#define ror32(x, shift) (((uint32)(x) >> (shift)) | ((uint32)(x) << (32 - (shift)))) -#define rol64(x, shift) (((uint64)(x) << (shift)) | ((uint32)(x) >> (64 - (shift)))) -#define ror64(x, shift) (((uint64)(x) >> (shift)) | ((uint32)(x) << (64 - (shift)))) - -#ifndef __cplusplus -// in C++ you should be using Math::Min and Math::Max -#ifndef min - #define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif -#ifndef max - #define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif -#endif // __cplusplus - -#define sgn(x) ((x > 0) ? 1 : ((x < 0) ? -1 : 0)) -#define clamp(l, x, h) (min(h, max(l, x))) - -// Rounds an integer down to the given power of 2. y must be a power of 2. -#define floor2(x, y) ((x) & (~((y) - 1))) - -// Rounds an integer up to the given power of 2. y must be a power of 2. -#define ceil2(x, y) (((x) + (y) - 1) & (~((y) - 1))) - - -#ifndef __cplusplus -// in C++ you should be using Util::CountOf -#ifdef __GNUC__ -/** - * Force a compilation error if condition is true, but also produce a - * result (of value 0 and type size_t), so the expression can be used - * e.g. in a structure initializer (or where-ever else comma expressions - * aren't permitted). - */ -#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) - -/* &a[0] degrades to a pointer: a different type from an array */ -#define __must_be_array(a) \ - BUILD_BUG_ON_ZERO(__builtin_types_compatible_p(typeof(a), typeof(&a[0]))) - -// based on http://lxr.free-electrons.com/source/include/linux/kernel.h#L54 -#define countof(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) -#elif defined (_MSC_VER) - #define countof(arr) _countof(arr) -#else - #define countof(arr) (sizeof(arr) / sizeof((arr)[0])) -#endif // __GNUC__ -#endif // __cplusplus - -#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) -#include -#define STUB() log_warning("Function %s at %s:%d is a stub.\n", __PRETTY_FUNCTION__, __FILE__, __LINE__) -#define _strcmpi _stricmp -#define _stricmp(x, y) strcasecmp((x), (y)) -#define _strnicmp(x, y, n) strncasecmp((x), (y), (n)) -#define _strdup(x) strdup((x)) - -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -#define RCT2_ENDIANESS __ORDER_LITTLE_ENDIAN__ -#define LOBYTE(w) ((uint8)(w)) -#define HIBYTE(w) ((uint8)(((uint16)(w)>>8)&0xFF)) -#endif // __BYTE_ORDER__ - -#ifndef RCT2_ENDIANESS -#error Unknown endianess! -#endif // RCT2_ENDIANESS - -#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) - -#if !((defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200809L) || (defined(_XOPEN_SOURCE) && _XOPEN_SOURCE >= 700)) - char *strndup(const char *src, size_t size); -#endif // !(POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700) - -// BSD and macOS have MAP_ANON instead of MAP_ANONYMOUS -#ifndef MAP_ANONYMOUS - #define MAP_ANONYMOUS MAP_ANON -#endif - -#include "version.h" - -#define OPENRCT2_MASTER_SERVER_URL "https://servers.openrct2.website" - -// Time (represented as number of 100-nanosecond intervals since 0001-01-01T00:00:00Z) -typedef uint64 datetime64; - -#define DATETIME64_MIN ((datetime64)0) - -// Represent fixed point numbers. dp = decimal point -typedef uint8 fixed8_1dp; -typedef uint8 fixed8_2dp; -typedef sint16 fixed16_1dp; -typedef sint16 fixed16_2dp; -typedef sint32 fixed32_1dp; -typedef sint32 fixed32_2dp; - -// Money is stored as a multiple of 0.10. -typedef fixed8_1dp money8; -typedef fixed16_1dp money16; -typedef fixed32_1dp money32; - -// Construct a fixed point number. For example, to create the value 3.65 you -// would write FIXED_2DP(3,65) -#define FIXED_XDP(x, whole, fraction) ((whole) * (10 * x) + (fraction)) -#define FIXED_1DP(whole, fraction) FIXED_XDP(1, whole, fraction) -#define FIXED_2DP(whole, fraction) FIXED_XDP(10, whole, fraction) - -// Construct a money value in the format MONEY(10,70) to represent 10.70. Fractional part must be two digits. -#define MONEY(whole, fraction) ((whole) * 10 + ((fraction) / 10)) - -#define MONEY_FREE MONEY(0,00) -#define MONEY32_UNDEFINED ((money32)0x80000000) - -typedef void (EMPTY_ARGS_VOID_POINTER)(); -typedef unsigned short rct_string_id; +#include "common.h" typedef struct rct2_install_info { uint32 installLevel; diff --git a/src/rct2/S6Exporter.cpp b/src/rct2/S6Exporter.cpp index 7c8aa2d050..90100b16cb 100644 --- a/src/rct2/S6Exporter.cpp +++ b/src/rct2/S6Exporter.cpp @@ -36,6 +36,7 @@ extern "C" #include "../object.h" #include "../openrct2.h" #include "../peep/staff.h" + #include "../rct2.h" #include "../ride/ride.h" #include "../ride/ride_ratings.h" #include "../scenario.h" diff --git a/src/rct2/S6Importer.cpp b/src/rct2/S6Importer.cpp index 1e79e75873..5a555d6fac 100644 --- a/src/rct2/S6Importer.cpp +++ b/src/rct2/S6Importer.cpp @@ -32,6 +32,7 @@ extern "C" #include "../management/research.h" #include "../openrct2.h" #include "../peep/staff.h" + #include "../rct2.h" #include "../ride/ride.h" #include "../ride/ride_ratings.h" #include "../scenario.h" diff --git a/src/ride/TrackDesignRepository.cpp b/src/ride/TrackDesignRepository.cpp index 28238be952..a288154204 100644 --- a/src/ride/TrackDesignRepository.cpp +++ b/src/ride/TrackDesignRepository.cpp @@ -27,6 +27,7 @@ extern "C" { #include "../platform/platform.h" + #include "../rct2.h" #include "track_design.h" } diff --git a/src/ride/ride_ratings.c b/src/ride/ride_ratings.c index 766c988cba..99750fb01e 100644 --- a/src/ride/ride_ratings.c +++ b/src/ride/ride_ratings.c @@ -17,6 +17,7 @@ #include "../interface/window.h" #include "../localisation/date.h" #include "../world/map.h" +#include "../rct2.h" #include "ride.h" #include "ride_data.h" #include "ride_ratings.h" diff --git a/src/windows/changelog.c b/src/windows/changelog.c index 7d392f3e22..f16e376611 100644 --- a/src/windows/changelog.c +++ b/src/windows/changelog.c @@ -21,6 +21,7 @@ #include "../localisation/localisation.h" #include "../openrct2.h" #include "../platform/platform.h" +#include "../rct2.h" #include "../util/util.h" #include "../world/footpath.h" #include "../world/map.h" diff --git a/src/windows/clear_scenery.c b/src/windows/clear_scenery.c index 0c6322a3ce..04fa0899dc 100644 --- a/src/windows/clear_scenery.c +++ b/src/windows/clear_scenery.c @@ -16,6 +16,7 @@ #include "../input.h" #include "../localisation/localisation.h" +#include "../rct2.h" #include "../sprites.h" #include "../interface/themes.h" #include "../interface/widget.h" diff --git a/src/windows/debug_paint.c b/src/windows/debug_paint.c index e894e3e5fe..8caab9b573 100644 --- a/src/windows/debug_paint.c +++ b/src/windows/debug_paint.c @@ -19,6 +19,7 @@ #include "../interface/window.h" #include "../localisation/localisation.h" #include "../sprites.h" +#include "../rct2.h" #include "../world/map.h" #include "../interface/themes.h" #include "../paint/map_element/map_element.h" diff --git a/src/windows/dropdown.c b/src/windows/dropdown.c index a1c742e62f..3c71fb35cb 100644 --- a/src/windows/dropdown.c +++ b/src/windows/dropdown.c @@ -20,6 +20,7 @@ #include "../localisation/localisation.h" #include "../scenario.h" #include "../sprites.h" +#include "../rct2.h" #include "dropdown.h" int gAppropriateImageDropdownItemsPerRow[] = { diff --git a/src/windows/editor_main.c b/src/windows/editor_main.c index e7d4a2a85e..3912b55237 100644 --- a/src/windows/editor_main.c +++ b/src/windows/editor_main.c @@ -17,6 +17,7 @@ #include "../interface/viewport.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../rct2.h" #include "../world/footpath.h" static void window_editor_main_paint(rct_window *w, rct_drawpixelinfo *dpi); diff --git a/src/windows/editor_objective_options.c b/src/windows/editor_objective_options.c index aacca5151b..4a753f966d 100644 --- a/src/windows/editor_objective_options.c +++ b/src/windows/editor_objective_options.c @@ -21,6 +21,7 @@ #include "../localisation/date.h" #include "../localisation/localisation.h" #include "../scenario.h" +#include "../rct2.h" #include "../util/util.h" #include "../world/climate.h" #include "../world/park.h" diff --git a/src/windows/editor_scenario_options.c b/src/windows/editor_scenario_options.c index 8885707f99..3280610b60 100644 --- a/src/windows/editor_scenario_options.c +++ b/src/windows/editor_scenario_options.c @@ -19,6 +19,7 @@ #include "../interface/window.h" #include "../management/finance.h" #include "../sprites.h" +#include "../rct2.h" #include "error.h" #include "dropdown.h" #include "../interface/themes.h" diff --git a/src/windows/error.c b/src/windows/error.c index 8a2101203b..cc606344af 100644 --- a/src/windows/error.c +++ b/src/windows/error.c @@ -18,6 +18,7 @@ #include "../localisation/localisation.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../rct2.h" #include "error.h" bool gDisableErrorWindowSound = false; diff --git a/src/windows/footpath.c b/src/windows/footpath.c index 7c8d9f2287..7c5ac0809f 100644 --- a/src/windows/footpath.c +++ b/src/windows/footpath.c @@ -24,6 +24,8 @@ #include "../world/footpath.h" #include "dropdown.h" #include "../interface/themes.h" +#include "../cheats.h" +#include "../rct2.h" enum { PATH_CONSTRUCTION_MODE_LAND, diff --git a/src/windows/game_bottom_toolbar.c b/src/windows/game_bottom_toolbar.c index be3e784fb3..38aa089a50 100644 --- a/src/windows/game_bottom_toolbar.c +++ b/src/windows/game_bottom_toolbar.c @@ -27,6 +27,7 @@ #include "../peep/peep.h" #include "../peep/staff.h" #include "../sprites.h" +#include "../rct2.h" #include "../world/climate.h" #include "../world/park.h" #include "../world/sprite.h" diff --git a/src/windows/land.c b/src/windows/land.c index 16fb3a0dcb..447b9eb7ef 100644 --- a/src/windows/land.c +++ b/src/windows/land.c @@ -19,6 +19,7 @@ #include "../interface/window.h" #include "../localisation/localisation.h" #include "../sprites.h" +#include "../rct2.h" #include "../world/map.h" #include "dropdown.h" #include "../interface/themes.h" diff --git a/src/windows/land_rights.c b/src/windows/land_rights.c index 1e08ce48a7..1fb8d451e7 100644 --- a/src/windows/land_rights.c +++ b/src/windows/land_rights.c @@ -20,6 +20,7 @@ #include "../interface/viewport.h" #include "../localisation/localisation.h" #include "../sprites.h" +#include "../rct2.h" #include "../world/map.h" #include "../game.h" #include "../interface/themes.h" diff --git a/src/windows/main.c b/src/windows/main.c index 5f1a6209b7..908fd5b4c0 100644 --- a/src/windows/main.c +++ b/src/windows/main.c @@ -17,6 +17,7 @@ #include "../interface/viewport.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../rct2.h" #include "../world/footpath.h" rct_widget window_main_widgets[] = { diff --git a/src/windows/map.c b/src/windows/map.c index 807e98bde4..7fb7b827c6 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -24,6 +24,7 @@ #include "../interface/viewport.h" #include "../interface/window.h" #include "../sprites.h" +#include "../rct2.h" #include "../world/footpath.h" #include "../world/scenery.h" #include "error.h" diff --git a/src/windows/options.c b/src/windows/options.c index 242cf81a1a..9f17664749 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -35,6 +35,7 @@ #include "../localisation/date.h" #include "../localisation/localisation.h" #include "../platform/platform.h" +#include "../rct2.h" #include "../sprites.h" #include "../title.h" #include "dropdown.h" diff --git a/src/windows/park.c b/src/windows/park.c index 1ecaac51fa..6c1552f924 100644 --- a/src/windows/park.c +++ b/src/windows/park.c @@ -25,6 +25,7 @@ #include "../interface/window.h" #include "../management/award.h" #include "../peep/peep.h" +#include "../rct2.h" #include "../ride/ride.h" #include "../scenario.h" #include "../sprites.h" diff --git a/src/windows/ride.c b/src/windows/ride.c index 7b4e3ed284..4e0778a10f 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -28,6 +28,7 @@ #include "../object/ObjectManager.h" #include "../object/ObjectRepository.h" #include "../peep/staff.h" +#include "../rct2.h" #include "../ride/ride.h" #include "../ride/ride_data.h" #include "../ride/track.h" diff --git a/src/windows/save_prompt.c b/src/windows/save_prompt.c index 8935708b62..ab90d39346 100644 --- a/src/windows/save_prompt.c +++ b/src/windows/save_prompt.c @@ -22,6 +22,7 @@ #include "../interface/widget.h" #include "../interface/window.h" #include "../openrct2.h" +#include "../rct2.h" #include "../sprites.h" enum WINDOW_SAVE_PROMPT_WIDGET_IDX { diff --git a/src/windows/scenery.c b/src/windows/scenery.c index d8afcd98e6..583c3b8a82 100644 --- a/src/windows/scenery.c +++ b/src/windows/scenery.c @@ -23,6 +23,7 @@ #include "../interface/window.h" #include "../localisation/localisation.h" #include "../peep/peep.h" +#include "../rct2.h" #include "../world/map.h" #include "../world/scenery.h" #include "../world/sprite.h" diff --git a/src/windows/staff_list.c b/src/windows/staff_list.c index 7c6ae12ac2..b64db4772b 100644 --- a/src/windows/staff_list.c +++ b/src/windows/staff_list.c @@ -25,6 +25,7 @@ #include "../localisation/localisation.h" #include "../peep/peep.h" #include "../peep/staff.h" +#include "../rct2.h" #include "../sprites.h" #include "../world/footpath.h" #include "../world/sprite.h" diff --git a/src/windows/title_command_editor.c b/src/windows/title_command_editor.c index 4c0ad9a6de..50cd0e8460 100644 --- a/src/windows/title_command_editor.c +++ b/src/windows/title_command_editor.c @@ -19,6 +19,7 @@ #include "../interface/window.h" #include "../interface/viewport.h" #include "../localisation/localisation.h" +#include "../rct2.h" #include "../sprites.h" #include "../world/map.h" #include "../game.h" diff --git a/src/windows/title_editor.c b/src/windows/title_editor.c index c1b0db1e1e..003d846652 100644 --- a/src/windows/title_editor.c +++ b/src/windows/title_editor.c @@ -24,6 +24,7 @@ #include "../localisation/localisation.h" #include "../peep/peep.h" #include "../peep/staff.h" +#include "../rct2.h" #include "../world/sprite.h" #include "dropdown.h" #include "../interface/themes.h" diff --git a/src/windows/title_exit.c b/src/windows/title_exit.c index ed09619fa1..66360bd3ee 100644 --- a/src/windows/title_exit.c +++ b/src/windows/title_exit.c @@ -22,6 +22,7 @@ #include "../interface/window.h" #include "../interface/themes.h" #include "../intro.h" +#include "../rct2.h" static rct_widget window_title_exit_widgets[] = { { WWT_IMGBTN, 2, 0, 39, 0, 63, SPR_MENU_EXIT, STR_EXIT }, diff --git a/src/windows/title_options.c b/src/windows/title_options.c index 7b42f89125..a6992a7d39 100644 --- a/src/windows/title_options.c +++ b/src/windows/title_options.c @@ -21,6 +21,7 @@ #include "../interface/widget.h" #include "../interface/window.h" #include "../interface/themes.h" +#include "../rct2.h" static rct_widget window_title_options_widgets[] = { { WWT_DROPDOWN_BUTTON, 2, 0, 79, 0, 11, STR_OPTIONS, STR_OPTIONS_TIP }, diff --git a/src/windows/tooltip.c b/src/windows/tooltip.c index 90621ce4cf..b9f1d8d821 100644 --- a/src/windows/tooltip.c +++ b/src/windows/tooltip.c @@ -19,6 +19,7 @@ #include "../input.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../rct2.h" #include "tooltip.h" enum { diff --git a/src/windows/track_manage.c b/src/windows/track_manage.c index 6de27798e5..5862da15d6 100644 --- a/src/windows/track_manage.c +++ b/src/windows/track_manage.c @@ -19,6 +19,7 @@ #include "../interface/widget.h" #include "../interface/window.h" #include "../localisation/localisation.h" +#include "../rct2.h" #include "../ride/track.h" #include "../ride/track_design.h" #include "../ride/TrackDesignRepository.h" diff --git a/src/windows/water.c b/src/windows/water.c index dda15563b1..a20edcfb54 100644 --- a/src/windows/water.c +++ b/src/windows/water.c @@ -18,6 +18,7 @@ #include "../interface/widget.h" #include "../interface/window.h" #include "../localisation/localisation.h" +#include "../rct2.h" #include "../sprites.h" #include "../world/map.h" #include "../interface/themes.h" diff --git a/src/world/climate.c b/src/world/climate.c index 550f5c9a91..47266902f7 100644 --- a/src/world/climate.c +++ b/src/world/climate.c @@ -25,6 +25,7 @@ #include "../scenario.h" #include "../util/util.h" #include "climate.h" +#include "../rct2.h" #include "../sprites.h" enum { diff --git a/src/world/footpath.c b/src/world/footpath.c index c30166656f..a037d823b8 100644 --- a/src/world/footpath.c +++ b/src/world/footpath.c @@ -16,12 +16,17 @@ #include "../cheats.h" #include "../game.h" +#include "footpath.h" #include "../localisation/localisation.h" +#include "map.h" +#include "map_animation.h" #include "../network/network.h" #include "../util/util.h" #include "../object_list.h" +#include "../rct2.h" #include "../ride/track.h" #include "../ride/track_data.h" +#include "scenery.h" void footpath_interrupt_peeps(int x, int y, int z); void sub_6A7642(int x, int y, rct_map_element *mapElement); diff --git a/src/world/map.c b/src/world/map.c index 35b40a2442..ba7ecae200 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -26,6 +26,7 @@ #include "../management/finance.h" #include "../network/network.h" #include "../openrct2.h" +#include "../rct2.h" #include "../ride/ride_data.h" #include "../ride/track.h" #include "../ride/track_data.h" diff --git a/src/world/park.c b/src/world/park.c index a33d644e55..8e2fd71933 100644 --- a/src/world/park.c +++ b/src/world/park.c @@ -27,6 +27,7 @@ #include "../management/research.h" #include "../peep/peep.h" #include "../peep/staff.h" +#include "../rct2.h" #include "../ride/ride.h" #include "../ride/ride_data.h" #include "../scenario.h" From afdc1457d511d0a2fb3f1cd5d3ccf01caaf20d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Wed, 30 Nov 2016 11:50:43 +0100 Subject: [PATCH 15/62] Move font-related code out from language.cpp --- openrct2.vcxproj | 2 + src/config.c | 1 - src/interface/Fonts.cpp | 157 ++++++++++++++++++++++++++++++++++ src/interface/Fonts.h | 32 +++++++ src/localisation/language.cpp | 133 +--------------------------- 5 files changed, 192 insertions(+), 133 deletions(-) create mode 100644 src/interface/Fonts.cpp create mode 100644 src/interface/Fonts.h diff --git a/openrct2.vcxproj b/openrct2.vcxproj index d2f142d7bc..99c831daf7 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -89,6 +89,7 @@ + @@ -417,6 +418,7 @@ + diff --git a/src/config.c b/src/config.c index 5bc9656b75..241910f853 100644 --- a/src/config.c +++ b/src/config.c @@ -334,7 +334,6 @@ sound_configuration gConfigSound; twitch_configuration gConfigTwitch; network_configuration gConfigNetwork; notification_configuration gConfigNotifications; -font_configuration gConfigFonts; title_sequences_configuration gConfigTitleSequences; static bool config_open(const utf8string path); diff --git a/src/interface/Fonts.cpp b/src/interface/Fonts.cpp new file mode 100644 index 0000000000..407f7ffc6a --- /dev/null +++ b/src/interface/Fonts.cpp @@ -0,0 +1,157 @@ +#pragma region Copyright(c) 2014 - 2016 OpenRCT2 Developers +/***************************************************************************** + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * OpenRCT2 is the work of many authors, a full list can be found in contributors.md + * For more information, visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * A full copy of the GNU General Public License can be found in licence.txt + *****************************************************************************/ +#pragma endregion + +#include "../common.h" +#include "Fonts.h" +#include "../core/Console.hpp" +#include "../core/String.hpp" +#include "../localisation/LanguagePack.h" + +extern "C" { +#include "../config.h" +#include "../drawing/drawing.h" +#include "../localisation/language.h" +font_configuration gConfigFonts; +} + +static TTFFontSetDescriptor TTFFontMSGothic = { { + { "msgothic.ttc", "MS PGothic", 9, 1, 0, 15, nullptr }, + { "msgothic.ttc", "MS PGothic", 12, 1, 0, 17, nullptr }, + { "msgothic.ttc", "MS PGothic", 12, 1, 0, 17, nullptr }, + { "msgothic.ttc", "MS PGothic", 13, 1, 0, 20, nullptr }, +} }; + +static TTFFontSetDescriptor TTFFontMingLiu = { { + { "msjh.ttc", "JhengHei", 9, -1, -3, 6, nullptr }, + { "mingliu.ttc", "MingLiU", 11, 1, 1, 12, nullptr }, + { "mingliu.ttc", "MingLiU", 12, 1, 0, 12, nullptr }, + { "mingliu.ttc", "MingLiU", 13, 1, 0, 20, nullptr }, +} }; + +static TTFFontSetDescriptor TTFFontSimSun = { { + { "msyh.ttc", "YaHei", 9, -1, -3, 6, nullptr }, + { "simsun.ttc", "SimSun", 11, 1, -1, 14, nullptr }, + { "simsun.ttc", "SimSun", 12, 1, -2, 14, nullptr }, + { "simsun.ttc", "SimSun", 13, 1, 0, 20, nullptr }, +} }; + +static TTFFontSetDescriptor TTFFontGulim = { { + { "gulim.ttc", "Gulim", 11, 1, 0, 15, nullptr }, + { "gulim.ttc", "Gulim", 12, 1, 0, 17, nullptr }, + { "gulim.ttc", "Gulim", 12, 1, 0, 17, nullptr }, + { "gulim.ttc", "Gulim", 13, 1, 0, 20, nullptr }, +} }; + +static TTFFontSetDescriptor TTFFontArial = { { + { "arial.ttf", "Arial", 8, 0, -1, 6, nullptr }, + { "arial.ttf", "Arial", 10, 0, -1, 12, nullptr }, + { "arial.ttf", "Arial", 11, 0, -1, 12, nullptr }, + { "arial.ttf", "Arial", 12, 0, -1, 20, nullptr }, +} }; + +const language_descriptor LanguagesDescriptors[LANGUAGE_COUNT] = { + { "", "", "", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_UNDEFINED + { "en-GB", "English (UK)", "English (UK)", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_ENGLISH_UK + { "en-US", "English (US)", "English (US)", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_ENGLISH_US }, // LANGUAGE_ENGLISH_US + { "de-DE", "German", "Deutsch", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_GERMAN }, // LANGUAGE_GERMAN + { "nl-NL", "Dutch", "Nederlands", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_DUTCH }, // LANGUAGE_DUTCH + { "fr-FR", "French", u8"Français", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_FRENCH }, // LANGUAGE_FRENCH + { "hu-HU", "Hungarian", "Magyar", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_HUNGARIAN + { "pl-PL", "Polish", "Polski", &TTFFontArial, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_POLISH + { "es-ES", "Spanish", u8"Español", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_SPANISH }, // LANGUAGE_SPANISH + { "sv-SE", "Swedish", "Svenska", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_SWEDISH }, // LANGUAGE_SWEDISH + { "it-IT", "Italian", "Italiano", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_ITALIAN }, // LANGUAGE_ITALIAN + { "pt-BR", "Portuguese (BR)", u8"Português (BR)", FONT_OPENRCT2_SPRITE, + RCT2_LANGUAGE_ID_PORTUGUESE }, // LANGUAGE_PORTUGUESE_BR + { "zh-TW", "Chinese (Traditional)", "Chinese (Traditional)", &TTFFontMingLiu, + RCT2_LANGUAGE_ID_CHINESE_TRADITIONAL }, // LANGUAGE_CHINESE_TRADITIONAL + { "zh-CN", "Chinese (Simplified)", "Chinese (Simplified)", &TTFFontSimSun, + RCT2_LANGUAGE_ID_CHINESE_SIMPLIFIED }, // LANGUAGE_CHINESE_SIMPLIFIED + { "fi-FI", "Finnish", "Suomi", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_FINNISH + { "ko-KR", "Korean", "Korean", &TTFFontGulim, RCT2_LANGUAGE_ID_KOREAN }, // LANGUAGE_KOREAN + { "ru-RU", "Russian", "Russian", &TTFFontArial, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_RUSSIAN + { "cs-CZ", "Czech", "Czech", &TTFFontArial, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_CZECH + { "ja-JP", "Japanese", "Japanese", &TTFFontMSGothic, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_JAPANESE + { + "nb-NO", "Norwegian", "Norsk", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_ENGLISH_UK, + }, // LANGUAGE_NORWEGIAN +}; + +static void LoadSpriteFont() +{ + ttf_dispose(); + gUseTrueTypeFont = false; + gCurrentTTFFontSet = nullptr; +} + +static bool LoadFont(TTFFontSetDescriptor * font) +{ + gUseTrueTypeFont = true; + gCurrentTTFFontSet = font; + + bool fontInitialised = ttf_initialise(); + return fontInitialised; +} + +static bool LoadCustomConfigFont() +{ + static TTFFontSetDescriptor TTFFontCustom = { { + { gConfigFonts.file_name, gConfigFonts.font_name, gConfigFonts.size_tiny, gConfigFonts.x_offset, gConfigFonts.y_offset, + gConfigFonts.height_tiny, nullptr }, + { gConfigFonts.file_name, gConfigFonts.font_name, gConfigFonts.size_small, gConfigFonts.x_offset, gConfigFonts.y_offset, + gConfigFonts.height_small, nullptr }, + { gConfigFonts.file_name, gConfigFonts.font_name, gConfigFonts.size_medium, gConfigFonts.x_offset, + gConfigFonts.y_offset, gConfigFonts.height_medium, nullptr }, + { gConfigFonts.file_name, gConfigFonts.font_name, gConfigFonts.size_big, gConfigFonts.x_offset, gConfigFonts.y_offset, + gConfigFonts.height_big, nullptr }, + } }; + + ttf_dispose(); + gUseTrueTypeFont = true; + gCurrentTTFFontSet = &TTFFontCustom; + + bool fontInitialised = ttf_initialise(); + return fontInitialised; +} + +void TryLoadFonts() +{ + TTFFontSetDescriptor * font = LanguagesDescriptors[gCurrentLanguage].font; + if (font != FONT_OPENRCT2_SPRITE) + { + if (!String::IsNullOrEmpty(gConfigFonts.file_name)) + { + if (LoadCustomConfigFont()) + { + return; + } + Console::Error::WriteLine("Unable to initialise configured TrueType font -- falling back to Language default."); + } + + if (LoadFont(font)) + { + return; + } + Console::Error::WriteLine("Unable to initialise prefered TrueType font -- falling back to Arial."); + + if (LoadFont(&TTFFontArial)) + { + return; + } + Console::Error::WriteLine("Unable to initialise prefered TrueType font -- Falling back to sprite font."); + } + LoadSpriteFont(); +} diff --git a/src/interface/Fonts.h b/src/interface/Fonts.h new file mode 100644 index 0000000000..7ae6308317 --- /dev/null +++ b/src/interface/Fonts.h @@ -0,0 +1,32 @@ +#pragma region Copyright(c) 2014 - 2016 OpenRCT2 Developers +/***************************************************************************** + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * OpenRCT2 is the work of many authors, a full list can be found in contributors.md + * For more information, visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * A full copy of the GNU General Public License can be found in licence.txt + *****************************************************************************/ +#pragma endregion + +#ifndef OPENRCT2_FONTS_H +#define OPENRCT2_FONTS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "../drawing/font.h" + +#ifdef __cplusplus +} +#endif + +void TryLoadFonts(); + +#endif // OPENRCT2_FONTS_H diff --git a/src/localisation/language.cpp b/src/localisation/language.cpp index b6b5952e7e..935c12c804 100644 --- a/src/localisation/language.cpp +++ b/src/localisation/language.cpp @@ -21,81 +21,13 @@ #include "../core/String.hpp" #include "../core/StringBuilder.hpp" #include "../object/ObjectManager.h" +#include "../interface/Fonts.h" #include "LanguagePack.h" extern "C" { -#include "../config.h" -#include "../drawing/drawing.h" -#include "../object.h" -#include "../openrct2.h" -#include "../util/util.h" #include "localisation.h" -static TTFFontSetDescriptor TTFFontMSGothic = -{{ - { "msgothic.ttc", "MS PGothic", 9, 1, 0, 15, nullptr }, - { "msgothic.ttc", "MS PGothic", 12, 1, 0, 17, nullptr }, - { "msgothic.ttc", "MS PGothic", 12, 1, 0, 17, nullptr }, - { "msgothic.ttc", "MS PGothic", 13, 1, 0, 20, nullptr }, -}}; - -static TTFFontSetDescriptor TTFFontMingLiu = -{{ - { "msjh.ttc", "JhengHei", 9, -1, -3, 6, nullptr }, - { "mingliu.ttc", "MingLiU", 11, 1, 1, 12, nullptr }, - { "mingliu.ttc", "MingLiU", 12, 1, 0, 12, nullptr }, - { "mingliu.ttc", "MingLiU", 13, 1, 0, 20, nullptr }, -}}; - -static TTFFontSetDescriptor TTFFontSimSun = -{{ - { "msyh.ttc", "YaHei", 9, -1, -3, 6, nullptr }, - { "simsun.ttc", "SimSun", 11, 1, -1, 14, nullptr }, - { "simsun.ttc", "SimSun", 12, 1, -2, 14, nullptr }, - { "simsun.ttc", "SimSun", 13, 1, 0, 20, nullptr }, -}}; - -static TTFFontSetDescriptor TTFFontGulim = -{{ - { "gulim.ttc", "Gulim", 11, 1, 0, 15, nullptr }, - { "gulim.ttc", "Gulim", 12, 1, 0, 17, nullptr }, - { "gulim.ttc", "Gulim", 12, 1, 0, 17, nullptr }, - { "gulim.ttc", "Gulim", 13, 1, 0, 20, nullptr }, -}}; - -static TTFFontSetDescriptor TTFFontArial = -{{ - { "arial.ttf", "Arial", 8, 0, -1, 6, nullptr }, - { "arial.ttf", "Arial", 10, 0, -1, 12, nullptr }, - { "arial.ttf", "Arial", 11, 0, -1, 12, nullptr }, - { "arial.ttf", "Arial", 12, 0, -1, 20, nullptr }, -}}; - -const language_descriptor LanguagesDescriptors[LANGUAGE_COUNT] = -{ - { "", "", "", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_UNDEFINED - { "en-GB", "English (UK)", "English (UK)", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_ENGLISH_UK - { "en-US", "English (US)", "English (US)", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_ENGLISH_US }, // LANGUAGE_ENGLISH_US - { "de-DE", "German", "Deutsch", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_GERMAN }, // LANGUAGE_GERMAN - { "nl-NL", "Dutch", "Nederlands", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_DUTCH }, // LANGUAGE_DUTCH - { "fr-FR", "French", u8"Français", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_FRENCH }, // LANGUAGE_FRENCH - { "hu-HU", "Hungarian", "Magyar", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_HUNGARIAN - { "pl-PL", "Polish", "Polski", &TTFFontArial, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_POLISH - { "es-ES", "Spanish", u8"Español", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_SPANISH }, // LANGUAGE_SPANISH - { "sv-SE", "Swedish", "Svenska", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_SWEDISH }, // LANGUAGE_SWEDISH - { "it-IT", "Italian", "Italiano", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_ITALIAN }, // LANGUAGE_ITALIAN - { "pt-BR", "Portuguese (BR)", u8"Português (BR)", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_PORTUGUESE }, // LANGUAGE_PORTUGUESE_BR - { "zh-TW", "Chinese (Traditional)", "Chinese (Traditional)", &TTFFontMingLiu, RCT2_LANGUAGE_ID_CHINESE_TRADITIONAL }, // LANGUAGE_CHINESE_TRADITIONAL - { "zh-CN", "Chinese (Simplified)", "Chinese (Simplified)", &TTFFontSimSun, RCT2_LANGUAGE_ID_CHINESE_SIMPLIFIED }, // LANGUAGE_CHINESE_SIMPLIFIED - { "fi-FI", "Finnish", "Suomi", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_FINNISH - { "ko-KR", "Korean", "Korean", &TTFFontGulim, RCT2_LANGUAGE_ID_KOREAN }, // LANGUAGE_KOREAN - { "ru-RU", "Russian", "Russian", &TTFFontArial, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_RUSSIAN - { "cs-CZ", "Czech", "Czech", &TTFFontArial, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_CZECH - { "ja-JP", "Japanese", "Japanese", &TTFFontMSGothic, RCT2_LANGUAGE_ID_ENGLISH_UK }, // LANGUAGE_JAPANESE - { "nb-NO", "Norwegian", "Norsk", FONT_OPENRCT2_SPRITE, RCT2_LANGUAGE_ID_ENGLISH_UK, }, // LANGUAGE_NORWEGIAN -}; - int gCurrentLanguage = LANGUAGE_UNDEFINED; bool gUseTrueTypeFont = false; @@ -155,69 +87,6 @@ static utf8 * GetLanguagePath(utf8 * buffer, size_t bufferSize, uint32 languageI return buffer; } -static void LoadSpriteFont() -{ - ttf_dispose(); - gUseTrueTypeFont = false; - gCurrentTTFFontSet = nullptr; -} - -static bool LoadFont(TTFFontSetDescriptor * font) -{ - gUseTrueTypeFont = true; - gCurrentTTFFontSet = font; - - bool fontInitialised = ttf_initialise(); - return fontInitialised; -} - -static bool LoadCustomConfigFont() -{ - static TTFFontSetDescriptor TTFFontCustom = - {{ - { gConfigFonts.file_name, gConfigFonts.font_name, gConfigFonts.size_tiny, gConfigFonts.x_offset, gConfigFonts.y_offset, gConfigFonts.height_tiny, nullptr }, - { gConfigFonts.file_name, gConfigFonts.font_name, gConfigFonts.size_small, gConfigFonts.x_offset, gConfigFonts.y_offset, gConfigFonts.height_small, nullptr }, - { gConfigFonts.file_name, gConfigFonts.font_name, gConfigFonts.size_medium, gConfigFonts.x_offset, gConfigFonts.y_offset, gConfigFonts.height_medium, nullptr }, - { gConfigFonts.file_name, gConfigFonts.font_name, gConfigFonts.size_big, gConfigFonts.x_offset, gConfigFonts.y_offset, gConfigFonts.height_big, nullptr }, - }}; - - ttf_dispose(); - gUseTrueTypeFont = true; - gCurrentTTFFontSet = &TTFFontCustom; - - bool fontInitialised = ttf_initialise(); - return fontInitialised; -} - -static void TryLoadFonts() -{ - TTFFontSetDescriptor * font = LanguagesDescriptors[gCurrentLanguage].font; - if (font != FONT_OPENRCT2_SPRITE) - { - if (!String::IsNullOrEmpty(gConfigFonts.file_name)) - { - if (LoadCustomConfigFont()) - { - return; - } - Console::Error::WriteLine("Unable to initialise configured TrueType font -- falling back to Language default."); - } - - if (LoadFont(font)) - { - return; - } - Console::Error::WriteLine("Unable to initialise prefered TrueType font -- falling back to Arial."); - - if (LoadFont(&TTFFontArial)) - { - return; - } - Console::Error::WriteLine("Unable to initialise prefered TrueType font -- Falling back to sprite font."); - } - LoadSpriteFont(); -} - bool language_open(int id) { char filename[MAX_PATH]; From 5c6e0b550bc4dd80aa04ca5916a2a669016dd082 Mon Sep 17 00:00:00 2001 From: LRFLEW Date: Wed, 30 Nov 2016 16:05:23 -0600 Subject: [PATCH 16/62] Update Xcode Project --- OpenRCT2.xcodeproj/project.pbxproj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenRCT2.xcodeproj/project.pbxproj b/OpenRCT2.xcodeproj/project.pbxproj index a4901ac4f6..ec24f53466 100644 --- a/OpenRCT2.xcodeproj/project.pbxproj +++ b/OpenRCT2.xcodeproj/project.pbxproj @@ -403,6 +403,7 @@ D44272A51CC81B3200D84D28 /* particle.c in Sources */ = {isa = PBXBuildFile; fileRef = D44271EF1CC81B3200D84D28 /* particle.c */; }; D44272A61CC81B3200D84D28 /* scenery.c in Sources */ = {isa = PBXBuildFile; fileRef = D44271F01CC81B3200D84D28 /* scenery.c */; }; D44272A71CC81B3200D84D28 /* sprite.c in Sources */ = {isa = PBXBuildFile; fileRef = D44271F21CC81B3200D84D28 /* sprite.c */; }; + D4469DAD1DEF84480039A779 /* Fonts.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D4469DAB1DEF84480039A779 /* Fonts.cpp */; }; D45A38BC1CF3006400659A24 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D45A38B31CF3006400659A24 /* libcrypto.dylib */; }; D45A38BE1CF3006400659A24 /* libjansson.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D45A38B51CF3006400659A24 /* libjansson.dylib */; }; D45A38C01CF3006400659A24 /* libSDL2_ttf.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D45A38B71CF3006400659A24 /* libSDL2_ttf.dylib */; }; @@ -941,6 +942,8 @@ D44271F21CC81B3200D84D28 /* sprite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sprite.c; sourceTree = ""; }; D44271F31CC81B3200D84D28 /* sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sprite.h; sourceTree = ""; }; D44271F41CC81B3200D84D28 /* water.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = water.h; sourceTree = ""; }; + D4469DAB1DEF84480039A779 /* Fonts.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Fonts.cpp; sourceTree = ""; }; + D4469DAC1DEF84480039A779 /* Fonts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Fonts.h; sourceTree = ""; }; D45A38B31CF3006400659A24 /* libcrypto.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libcrypto.dylib; sourceTree = ""; }; D45A38B41CF3006400659A24 /* libfreetype.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libfreetype.dylib; sourceTree = ""; }; D45A38B51CF3006400659A24 /* libjansson.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libjansson.dylib; sourceTree = ""; }; @@ -1616,6 +1619,8 @@ D4F5B5EC1DAD8A4300AB6075 /* CursorData.cpp */, D4F5B5ED1DAD8A4300AB6075 /* Cursors.cpp */, D4F5B5EE1DAD8A4300AB6075 /* Cursors.h */, + D4469DAB1DEF84480039A779 /* Fonts.cpp */, + D4469DAC1DEF84480039A779 /* Fonts.h */, D442711F1CC81B3200D84D28 /* graph.c */, D44271201CC81B3200D84D28 /* graph.h */, D44271211CC81B3200D84D28 /* keyboard_shortcut.c */, @@ -2702,6 +2707,7 @@ C686F91A1CDBC3B7009F9BFC /* mine_train_coaster.c in Sources */, D44272A11CC81B3200D84D28 /* map_helpers.c in Sources */, C686F9431CDBC3B7009F9BFC /* motion_simulator.c in Sources */, + D4469DAD1DEF84480039A779 /* Fonts.cpp in Sources */, D44272281CC81B3200D84D28 /* language.cpp in Sources */, D442729B1CC81B3200D84D28 /* climate.c in Sources */, D464FEC01D31A68800CBABAC /* Image.cpp in Sources */, From 37c9bbd51384e8d9c9e982e0d257a2e6c0f22403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 1 Dec 2016 11:19:42 +0100 Subject: [PATCH 17/62] Extract format_codes to its own file --- openrct2.vcxproj | 1 + src/localisation/format_codes.c | 142 ++++++++++++++++++++++++++++++++ src/localisation/localisation.c | 123 --------------------------- 3 files changed, 143 insertions(+), 123 deletions(-) create mode 100644 src/localisation/format_codes.c diff --git a/openrct2.vcxproj b/openrct2.vcxproj index 99c831daf7..2e3bfde9eb 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -102,6 +102,7 @@ + diff --git a/src/localisation/format_codes.c b/src/localisation/format_codes.c new file mode 100644 index 0000000000..640bdf6890 --- /dev/null +++ b/src/localisation/format_codes.c @@ -0,0 +1,142 @@ +#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers +/***************************************************************************** + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * OpenRCT2 is the work of many authors, a full list can be found in contributors.md + * For more information, visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * A full copy of the GNU General Public License can be found in licence.txt + *****************************************************************************/ +#pragma endregion + +#include "../common.h" +#include "format_codes.h" +#include "localisation.h" + +#pragma region Format codes + +typedef struct format_code_token { + uint32 code; + const char *token; +} format_code_token; + +format_code_token format_code_tokens[] = { + { FORMAT_MOVE_X, "MOVE_X" }, + { FORMAT_ADJUST_PALETTE, "ADJUST_PALETTE" }, + { FORMAT_NEWLINE, "NEWLINE" }, + { FORMAT_NEWLINE_SMALLER, "NEWLINE_SMALLER" }, + { FORMAT_TINYFONT, "TINYFONT" }, + { FORMAT_BIGFONT, "BIGFONT" }, + { FORMAT_MEDIUMFONT, "MEDIUMFONT" }, + { FORMAT_SMALLFONT, "SMALLFONT" }, + { FORMAT_OUTLINE, "OUTLINE" }, + { FORMAT_OUTLINE_OFF, "OUTLINE_OFF" }, + { FORMAT_WINDOW_COLOUR_1, "WINDOW_COLOUR_1" }, + { FORMAT_WINDOW_COLOUR_2, "WINDOW_COLOUR_2" }, + { FORMAT_WINDOW_COLOUR_3, "WINDOW_COLOUR_3" }, + { FORMAT_NEWLINE_X_Y, "NEWLINE_X_Y" }, + { FORMAT_INLINE_SPRITE, "INLINE_SPRITE" }, + { FORMAT_ENDQUOTES, "ENDQUOTES" }, + { FORMAT_COMMA32, "COMMA32" }, + { FORMAT_INT32, "INT32" }, + { FORMAT_COMMA2DP32, "COMMA2DP32" }, + { FORMAT_COMMA16, "COMMA16" }, + { FORMAT_UINT16, "UINT16" }, + { FORMAT_CURRENCY2DP, "CURRENCY2DP" }, + { FORMAT_CURRENCY, "CURRENCY" }, + { FORMAT_STRINGID, "STRINGID" }, + { FORMAT_STRINGID2, "STRINGID2" }, + { FORMAT_STRING, "STRING" }, + { FORMAT_MONTHYEAR, "MONTHYEAR" }, + { FORMAT_MONTH, "MONTH" }, + { FORMAT_VELOCITY, "VELOCITY" }, + { FORMAT_POP16, "POP16" }, + { FORMAT_PUSH16, "PUSH16" }, + { FORMAT_DURATION, "DURATION" }, + { FORMAT_REALTIME, "REALTIME" }, + { FORMAT_LENGTH, "LENGTH" }, + { FORMAT_SPRITE, "SPRITE" }, + { FORMAT_BLACK, "BLACK" }, + { FORMAT_GREY, "GREY" }, + { FORMAT_WHITE, "WHITE" }, + { FORMAT_RED, "RED" }, + { FORMAT_GREEN, "GREEN" }, + { FORMAT_YELLOW, "YELLOW" }, + { FORMAT_TOPAZ, "TOPAZ" }, + { FORMAT_CELADON, "CELADON" }, + { FORMAT_BABYBLUE, "BABYBLUE" }, + { FORMAT_PALELAVENDER, "PALELAVENDER" }, + { FORMAT_PALEGOLD, "PALEGOLD" }, + { FORMAT_LIGHTPINK, "LIGHTPINK" }, + { FORMAT_PEARLAQUA, "PEARLAQUA" }, + { FORMAT_PALESILVER, "PALESILVER" }, + { FORMAT_AMINUSCULE, "AMINUSCULE" }, + { FORMAT_UP, "UP" }, + { FORMAT_POUND, "POUND" }, + { FORMAT_YEN, "YEN" }, + { FORMAT_COPYRIGHT, "COPYRIGHT" }, + { FORMAT_DOWN, "DOWN" }, + { FORMAT_LEFTGUILLEMET, "LEFTGUILLEMET" }, + { FORMAT_TICK, "TICK" }, + { FORMAT_CROSS, "CROSS" }, + { FORMAT_RIGHT, "RIGHT" }, + { FORMAT_DEGREE, "DEGREE" }, + { FORMAT_SQUARED, "SQUARED" }, + { FORMAT_OPENQUOTES, "OPENQUOTES" }, + { FORMAT_EURO, "EURO" }, + { FORMAT_APPROX, "APPROX" }, + { FORMAT_POWERNEGATIVEONE, "POWERNEGATIVEONE" }, + { FORMAT_BULLET, "BULLET" }, + { FORMAT_RIGHTGUILLEMET, "RIGHTGUILLEMET" }, + { FORMAT_SMALLUP, "SMALLUP" }, + { FORMAT_SMALLDOWN, "SMALLDOWN" }, + { FORMAT_LEFT, "LEFT" }, + { FORMAT_INVERTEDQUESTION, "INVERTEDQUESTION" }, + { FORMAT_COMMA1DP16, "COMMA1DP16" } +}; + +uint32 format_get_code(const char *token) +{ + int i; + for (i = 0; i < countof(format_code_tokens); i++) + if (_strcmpi(token, format_code_tokens[i].token) == 0) + return format_code_tokens[i].code; + return 0; +} + +const char *format_get_token(uint32 code) +{ + int i; + for (i = 0; i < countof(format_code_tokens); i++) + if (code == format_code_tokens[i].code) + return format_code_tokens[i].token; + return 0; +} + +bool utf8_should_use_sprite_for_codepoint(int codepoint) +{ + switch (codepoint) { + case FORMAT_UP: + case FORMAT_DOWN: + case FORMAT_LEFTGUILLEMET: + case FORMAT_TICK: + case FORMAT_CROSS: + case FORMAT_RIGHT: + case FORMAT_RIGHTGUILLEMET: + case FORMAT_SMALLUP: + case FORMAT_SMALLDOWN: + case FORMAT_LEFT: + case FORMAT_OPENQUOTES: + case FORMAT_ENDQUOTES: + return true; + default: + return false; + } +} + +#pragma endregion diff --git a/src/localisation/localisation.c b/src/localisation/localisation.c index d6bf46fb2f..e5c53a912a 100644 --- a/src/localisation/localisation.c +++ b/src/localisation/localisation.c @@ -323,129 +323,6 @@ const rct_string_id DateGameShortMonthNames[MONTH_COUNT] = { STR_MONTH_SHORT_OCT, }; -#pragma region Format codes - -typedef struct format_code_token { - uint32 code; - const char *token; -} format_code_token; - -format_code_token format_code_tokens[] = { - { FORMAT_MOVE_X, "MOVE_X" }, - { FORMAT_ADJUST_PALETTE, "ADJUST_PALETTE" }, - { FORMAT_NEWLINE, "NEWLINE" }, - { FORMAT_NEWLINE_SMALLER, "NEWLINE_SMALLER" }, - { FORMAT_TINYFONT, "TINYFONT" }, - { FORMAT_BIGFONT, "BIGFONT" }, - { FORMAT_MEDIUMFONT, "MEDIUMFONT" }, - { FORMAT_SMALLFONT, "SMALLFONT" }, - { FORMAT_OUTLINE, "OUTLINE" }, - { FORMAT_OUTLINE_OFF, "OUTLINE_OFF" }, - { FORMAT_WINDOW_COLOUR_1, "WINDOW_COLOUR_1" }, - { FORMAT_WINDOW_COLOUR_2, "WINDOW_COLOUR_2" }, - { FORMAT_WINDOW_COLOUR_3, "WINDOW_COLOUR_3" }, - { FORMAT_NEWLINE_X_Y, "NEWLINE_X_Y" }, - { FORMAT_INLINE_SPRITE, "INLINE_SPRITE" }, - { FORMAT_ENDQUOTES, "ENDQUOTES" }, - { FORMAT_COMMA32, "COMMA32" }, - { FORMAT_INT32, "INT32" }, - { FORMAT_COMMA2DP32, "COMMA2DP32" }, - { FORMAT_COMMA16, "COMMA16" }, - { FORMAT_UINT16, "UINT16" }, - { FORMAT_CURRENCY2DP, "CURRENCY2DP" }, - { FORMAT_CURRENCY, "CURRENCY" }, - { FORMAT_STRINGID, "STRINGID" }, - { FORMAT_STRINGID2, "STRINGID2" }, - { FORMAT_STRING, "STRING" }, - { FORMAT_MONTHYEAR, "MONTHYEAR" }, - { FORMAT_MONTH, "MONTH" }, - { FORMAT_VELOCITY, "VELOCITY" }, - { FORMAT_POP16, "POP16" }, - { FORMAT_PUSH16, "PUSH16" }, - { FORMAT_DURATION, "DURATION" }, - { FORMAT_REALTIME, "REALTIME" }, - { FORMAT_LENGTH, "LENGTH" }, - { FORMAT_SPRITE, "SPRITE" }, - { FORMAT_BLACK, "BLACK" }, - { FORMAT_GREY, "GREY" }, - { FORMAT_WHITE, "WHITE" }, - { FORMAT_RED, "RED" }, - { FORMAT_GREEN, "GREEN" }, - { FORMAT_YELLOW, "YELLOW" }, - { FORMAT_TOPAZ, "TOPAZ" }, - { FORMAT_CELADON, "CELADON" }, - { FORMAT_BABYBLUE, "BABYBLUE" }, - { FORMAT_PALELAVENDER, "PALELAVENDER" }, - { FORMAT_PALEGOLD, "PALEGOLD" }, - { FORMAT_LIGHTPINK, "LIGHTPINK" }, - { FORMAT_PEARLAQUA, "PEARLAQUA" }, - { FORMAT_PALESILVER, "PALESILVER" }, - { FORMAT_AMINUSCULE, "AMINUSCULE" }, - { FORMAT_UP, "UP" }, - { FORMAT_POUND, "POUND" }, - { FORMAT_YEN, "YEN" }, - { FORMAT_COPYRIGHT, "COPYRIGHT" }, - { FORMAT_DOWN, "DOWN" }, - { FORMAT_LEFTGUILLEMET, "LEFTGUILLEMET" }, - { FORMAT_TICK, "TICK" }, - { FORMAT_CROSS, "CROSS" }, - { FORMAT_RIGHT, "RIGHT" }, - { FORMAT_DEGREE, "DEGREE" }, - { FORMAT_SQUARED, "SQUARED" }, - { FORMAT_OPENQUOTES, "OPENQUOTES" }, - { FORMAT_EURO, "EURO" }, - { FORMAT_APPROX, "APPROX" }, - { FORMAT_POWERNEGATIVEONE, "POWERNEGATIVEONE" }, - { FORMAT_BULLET, "BULLET" }, - { FORMAT_RIGHTGUILLEMET, "RIGHTGUILLEMET" }, - { FORMAT_SMALLUP, "SMALLUP" }, - { FORMAT_SMALLDOWN, "SMALLDOWN" }, - { FORMAT_LEFT, "LEFT" }, - { FORMAT_INVERTEDQUESTION, "INVERTEDQUESTION" }, - { FORMAT_COMMA1DP16, "COMMA1DP16" } -}; - -uint32 format_get_code(const char *token) -{ - int i; - for (i = 0; i < countof(format_code_tokens); i++) - if (_strcmpi(token, format_code_tokens[i].token) == 0) - return format_code_tokens[i].code; - return 0; -} - -const char *format_get_token(uint32 code) -{ - int i; - for (i = 0; i < countof(format_code_tokens); i++) - if (code == format_code_tokens[i].code) - return format_code_tokens[i].token; - return 0; -} - -bool utf8_should_use_sprite_for_codepoint(int codepoint) -{ - switch (codepoint) { - case FORMAT_UP: - case FORMAT_DOWN: - case FORMAT_LEFTGUILLEMET: - case FORMAT_TICK: - case FORMAT_CROSS: - case FORMAT_RIGHT: - case FORMAT_RIGHTGUILLEMET: - case FORMAT_SMALLUP: - case FORMAT_SMALLDOWN: - case FORMAT_LEFT: - case FORMAT_OPENQUOTES: - case FORMAT_ENDQUOTES: - return true; - default: - return false; - } -} - -#pragma endregion - #define format_push_char_safe(C) { *(*dest)++ = (C); --(*size); } #define format_handle_overflow(X) if ((*size) <= (X)) { *(*dest) = '\0'; (*size) = 0; return; } #define format_push_char(C) { format_handle_overflow(1); format_push_char_safe(C); } From 4bc346df2f3e7429caafefca7b7e02caf2ae0f40 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Thu, 1 Dec 2016 13:28:26 +0100 Subject: [PATCH 18/62] Update Xcode project --- OpenRCT2.xcodeproj/project.pbxproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OpenRCT2.xcodeproj/project.pbxproj b/OpenRCT2.xcodeproj/project.pbxproj index ec24f53466..e093ee144f 100644 --- a/OpenRCT2.xcodeproj/project.pbxproj +++ b/OpenRCT2.xcodeproj/project.pbxproj @@ -37,6 +37,7 @@ C606CD261DB5120C00FE4015 /* TestPaint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C606CD231DB5120900FE4015 /* TestPaint.cpp */; }; C612A8991D64825300B634CA /* vehicle_data.c in Sources */ = {isa = PBXBuildFile; fileRef = C612A8971D64825300B634CA /* vehicle_data.c */; }; C61FB7241CF86356004CE991 /* NetworkUser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C61FB7221CF86356004CE991 /* NetworkUser.cpp */; }; + C649B3D41DF04ED2008AC826 /* format_codes.c in Sources */ = {isa = PBXBuildFile; fileRef = C649B3D31DF04ED2008AC826 /* format_codes.c */; }; C64FDA641D6D9A2100F259B9 /* air_powered_vertical_coaster.c in Sources */ = {isa = PBXBuildFile; fileRef = C686F8BB1CDBC3B7009F9BFC /* air_powered_vertical_coaster.c */; }; C64FDA651D6D9A2100F259B9 /* bobsleigh_coaster.c in Sources */ = {isa = PBXBuildFile; fileRef = C686F8BC1CDBC3B7009F9BFC /* bobsleigh_coaster.c */; }; C64FDA661D6D9A2100F259B9 /* compact_inverted_coaster.c in Sources */ = {isa = PBXBuildFile; fileRef = C686F8BD1CDBC3B7009F9BFC /* compact_inverted_coaster.c */; }; @@ -535,6 +536,7 @@ C612A8981D64825300B634CA /* vehicle_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vehicle_data.h; sourceTree = ""; }; C61FB7221CF86356004CE991 /* NetworkUser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkUser.cpp; sourceTree = ""; usesTabs = 0; }; C61FB7231CF86356004CE991 /* NetworkUser.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = NetworkUser.h; sourceTree = ""; usesTabs = 0; }; + C649B3D31DF04ED2008AC826 /* format_codes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = format_codes.c; sourceTree = ""; }; C64FDA5D1D6D99F400F259B9 /* PaintTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = PaintTest; sourceTree = BUILT_PRODUCTS_DIR; }; C650B2151CCABBDD00B4D91C /* S4Importer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = S4Importer.cpp; sourceTree = ""; usesTabs = 0; }; C650B2161CCABBDD00B4D91C /* S4Importer.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = S4Importer.h; sourceTree = ""; usesTabs = 0; }; @@ -1650,6 +1652,7 @@ D44271351CC81B3200D84D28 /* currency.h */, D44271361CC81B3200D84D28 /* date.c */, D44271371CC81B3200D84D28 /* date.h */, + C649B3D31DF04ED2008AC826 /* format_codes.c */, D44271381CC81B3200D84D28 /* format_codes.h */, D44271391CC81B3200D84D28 /* language.cpp */, D442713A1CC81B3200D84D28 /* language.h */, @@ -2577,6 +2580,7 @@ C686F93A1CDBC3B7009F9BFC /* spiral_slide.c in Sources */, C686F9421CDBC3B7009F9BFC /* magic_carpet.c in Sources */, D44272021CC81B3200D84D28 /* Json.cpp in Sources */, + C649B3D41DF04ED2008AC826 /* format_codes.c in Sources */, D44272591CC81B3200D84D28 /* dropdown.c in Sources */, D43407DF1D0E14BE00C2B3D4 /* SwapFramebuffer.cpp in Sources */, C686F8AF1CDBC37E009F9BFC /* map_element.c in Sources */, From 1ae2ca54f72a48b1f56aac9ac7fab9c5f3dea43e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 1 Dec 2016 15:05:00 +0100 Subject: [PATCH 19/62] Sort includes --- src/audio/audio.c | 9 ++++---- src/audio/mixer.cpp | 2 +- src/cmdline/ConvertCommand.cpp | 2 +- src/core/Memory.hpp | 4 ++-- src/drawing/drawing.c | 6 ++--- src/drawing/engines/SoftwareDrawingEngine.cpp | 2 +- src/drawing/sprite.c | 3 --- src/drawing/string.c | 5 ----- src/input.c | 2 +- src/interface/Fonts.cpp | 2 +- src/interface/chat.c | 4 ++-- src/interface/console.c | 22 +++++++++---------- src/interface/title_sequences.c | 6 ++--- src/interface/viewport.c | 10 ++++----- src/intro.c | 2 +- src/localisation/language.cpp | 2 +- src/management/news_item.c | 2 +- src/network/twitch.cpp | 2 +- src/paint/map_element/surface.c | 2 +- src/peep/peep.c | 2 +- src/platform/shared.c | 2 +- src/ride/ride_ratings.c | 2 +- src/windows/clear_scenery.c | 6 ++--- src/windows/debug_paint.c | 10 ++++----- src/windows/dropdown.c | 2 +- src/windows/editor_objective_options.c | 4 ++-- src/windows/editor_scenario_options.c | 8 +++---- src/windows/footpath.c | 12 +++++----- src/windows/game_bottom_toolbar.c | 2 +- src/windows/land.c | 4 ++-- src/windows/land_rights.c | 8 +++---- src/windows/map.c | 6 ++--- src/world/climate.c | 4 ++-- src/world/footpath.c | 6 +---- 34 files changed, 77 insertions(+), 90 deletions(-) diff --git a/src/audio/audio.c b/src/audio/audio.c index b255e6532e..feb247257e 100644 --- a/src/audio/audio.c +++ b/src/audio/audio.c @@ -16,14 +16,13 @@ #include "../config.h" #include "../interface/viewport.h" +#include "../intro.h" #include "../localisation/language.h" -#include "audio.h" -#include "mixer.h" +#include "../localisation/string_ids.h" #include "../openrct2.h" #include "../util/util.h" -#include "../localisation/string_ids.h" -#include "../intro.h" -#include "../rct2.h" +#include "audio.h" +#include "mixer.h" typedef struct rct_audio_params { bool in_range; diff --git a/src/audio/mixer.cpp b/src/audio/mixer.cpp index 859ae66a77..3a54f51cc4 100644 --- a/src/audio/mixer.cpp +++ b/src/audio/mixer.cpp @@ -17,9 +17,9 @@ #include "../core/Guard.hpp" extern "C" { #include "../config.h" - #include "../platform/platform.h" #include "../localisation/localisation.h" #include "../openrct2.h" + #include "../platform/platform.h" #include "../rct2.h" #include "audio.h" } diff --git a/src/cmdline/ConvertCommand.cpp b/src/cmdline/ConvertCommand.cpp index b0a4bfde41..526d3e8a85 100644 --- a/src/cmdline/ConvertCommand.cpp +++ b/src/cmdline/ConvertCommand.cpp @@ -25,9 +25,9 @@ extern "C" { #include "../game.h" + #include "../interface/window.h" #include "../openrct2.h" #include "../rct2.h" - #include "../interface/window.h" } static void WriteConvertFromAndToMessage(uint32 sourceFileType, uint32 destinationFileType); diff --git a/src/core/Memory.hpp b/src/core/Memory.hpp index 62b1e523ae..168851ff44 100644 --- a/src/core/Memory.hpp +++ b/src/core/Memory.hpp @@ -16,10 +16,10 @@ #pragma once +#include +#include #include "../common.h" #include "Guard.hpp" -#include -#include /** * Utility methods for memory management. Typically helpers and wrappers around the C standard library. diff --git a/src/drawing/drawing.c b/src/drawing/drawing.c index 0e09782456..290ac27b99 100644 --- a/src/drawing/drawing.c +++ b/src/drawing/drawing.c @@ -15,13 +15,13 @@ #pragma endregion #include "../common.h" -#include "../localisation/localisation.h" #include "../interface/window.h" -#include "../platform/platform.h" +#include "../localisation/localisation.h" #include "../object.h" +#include "../platform/platform.h" +#include "../rct2.h" #include "../world/water.h" #include "drawing.h" -#include "../rct2.h" // HACK These were originally passed back through registers int gLastDrawStringX; diff --git a/src/drawing/engines/SoftwareDrawingEngine.cpp b/src/drawing/engines/SoftwareDrawingEngine.cpp index 22d0cdd85a..03c131b132 100644 --- a/src/drawing/engines/SoftwareDrawingEngine.cpp +++ b/src/drawing/engines/SoftwareDrawingEngine.cpp @@ -29,9 +29,9 @@ extern "C" #include "../../interface/viewport.h" #include "../../interface/window.h" #include "../../intro.h" + #include "../../rct2.h" #include "../drawing.h" #include "../lightfx.h" - #include "../../rct2.h" } class SoftwareDrawingEngine; diff --git a/src/drawing/sprite.c b/src/drawing/sprite.c index a8a4593192..4106e506bd 100644 --- a/src/drawing/sprite.c +++ b/src/drawing/sprite.c @@ -14,14 +14,11 @@ *****************************************************************************/ #pragma endregion -#include "../addresses.h" #include "../common.h" #include "../openrct2.h" -#include "../platform/platform.h" #include "../sprites.h" #include "../util/util.h" #include "drawing.h" -#include "../rct2.h" void *_g1Buffer = NULL; diff --git a/src/drawing/string.c b/src/drawing/string.c index 2ae44790de..fada3cd3cf 100644 --- a/src/drawing/string.c +++ b/src/drawing/string.c @@ -16,14 +16,9 @@ #include "../interface/colour.h" #include "../interface/viewport.h" -#include "../interface/window.h" #include "../localisation/localisation.h" -#include "../platform/platform.h" #include "../sprites.h" #include "../util/util.h" -#include "../world/map.h" -#include "drawing.h" -#include "../rct2.h" enum { TEXT_DRAW_FLAG_INSET = 1 << 0, diff --git a/src/input.c b/src/input.c index 8409c7fac4..d1912acc4c 100644 --- a/src/input.c +++ b/src/input.c @@ -104,7 +104,7 @@ static void input_window_resize_end(); static void input_viewport_drag_begin(rct_window *w, int x, int y); static void input_viewport_drag_continue(); static void input_viewport_drag_end(); -static void input_scroll_begin(); +static void input_scroll_begin(rct_window *w, int widgetIndex, int x, int y); static void input_scroll_continue(rct_window *w, int widgetIndex, int state, int x, int y); static void input_scroll_end(); static void input_scroll_part_update_hthumb(rct_window *w, int widgetIndex, int x, int scroll_id); diff --git a/src/interface/Fonts.cpp b/src/interface/Fonts.cpp index 407f7ffc6a..2e35928b6a 100644 --- a/src/interface/Fonts.cpp +++ b/src/interface/Fonts.cpp @@ -15,10 +15,10 @@ #pragma endregion #include "../common.h" -#include "Fonts.h" #include "../core/Console.hpp" #include "../core/String.hpp" #include "../localisation/LanguagePack.h" +#include "Fonts.h" extern "C" { #include "../config.h" diff --git a/src/interface/chat.c b/src/interface/chat.c index 79c98f9e7b..638384b1fa 100644 --- a/src/interface/chat.c +++ b/src/interface/chat.c @@ -14,15 +14,15 @@ *****************************************************************************/ #pragma endregion -#include "chat.h" #include "../audio/audio.h" #include "../audio/mixer.h" #include "../interface/themes.h" #include "../localisation/localisation.h" #include "../network/network.h" #include "../platform/platform.h" -#include "../util/util.h" #include "../rct2.h" +#include "../util/util.h" +#include "chat.h" bool gChatOpen = false; char _chatCurrentLine[CHAT_MAX_MESSAGE_LENGTH]; diff --git a/src/interface/console.c b/src/interface/console.c index 54b4891bcf..168c876ad0 100644 --- a/src/interface/console.c +++ b/src/interface/console.c @@ -17,30 +17,30 @@ #include #include -#include "../drawing/drawing.h" -#include "../localisation/localisation.h" -#include "../localisation/user.h" -#include "../platform/platform.h" -#include "../world/park.h" -#include "../util/sawyercoding.h" #include "../config.h" +#include "../drawing/drawing.h" #include "../game.h" #include "../input.h" -#include "../network/twitch.h" +#include "../localisation/localisation.h" +#include "../localisation/user.h" +#include "../management/finance.h" +#include "../management/research.h" #include "../network/network.h" +#include "../network/twitch.h" #include "../object.h" #include "../object/ObjectManager.h" #include "../object/ObjectRepository.h" +#include "../platform/platform.h" #include "../rct2.h" +#include "../util/sawyercoding.h" +#include "../util/util.h" #include "../world/banner.h" #include "../world/climate.h" +#include "../world/park.h" #include "../world/scenery.h" -#include "../management/finance.h" -#include "../management/research.h" -#include "../util/util.h" #include "console.h" -#include "window.h" #include "viewport.h" +#include "window.h" #define CONSOLE_BUFFER_SIZE 8192 #define CONSOLE_BUFFER_2_SIZE 256 diff --git a/src/interface/title_sequences.c b/src/interface/title_sequences.c index a7d5978baa..f94fd0daf7 100644 --- a/src/interface/title_sequences.c +++ b/src/interface/title_sequences.c @@ -15,11 +15,11 @@ #pragma endregion #include "../localisation/string_ids.h" -#include "window.h" -#include "title_sequences.h" +#include "../rct2.h" #include "../title.h" #include "../util/util.h" -#include "../rct2.h" +#include "title_sequences.h" +#include "window.h" uint16 gCurrentTitleSequence; diff --git a/src/interface/viewport.c b/src/interface/viewport.c index 8a715a3b82..5d16eb9af2 100644 --- a/src/interface/viewport.c +++ b/src/interface/viewport.c @@ -16,24 +16,24 @@ #include "../config.h" #include "../drawing/drawing.h" -#include "../paint/supports.h" #include "../game.h" #include "../input.h" #include "../localisation/localisation.h" +#include "../paint/paint.h" +#include "../paint/supports.h" #include "../peep/staff.h" #include "../rct2.h" #include "../ride/ride_data.h" #include "../ride/track_data.h" #include "../sprites.h" -#include "../world/climate.h" -#include "../world/map.h" -#include "../world/sprite.h" #include "../world/banner.h" +#include "../world/climate.h" #include "../world/entrance.h" #include "../world/footpath.h" +#include "../world/map.h" #include "../world/scenery.h" +#include "../world/sprite.h" #include "colour.h" -#include "../paint/paint.h" #include "viewport.h" #include "window.h" diff --git a/src/intro.c b/src/intro.c index 0c0b2007ae..ab044bffa4 100644 --- a/src/intro.c +++ b/src/intro.c @@ -18,8 +18,8 @@ #include "audio/mixer.h" #include "drawing/drawing.h" #include "intro.h" -#include "sprites.h" #include "rct2.h" +#include "sprites.h" #define BACKROUND_COLOUR_DARK 10 #define BACKROUND_COLOUR_LOGO 245 diff --git a/src/localisation/language.cpp b/src/localisation/language.cpp index 935c12c804..87fabc2fc3 100644 --- a/src/localisation/language.cpp +++ b/src/localisation/language.cpp @@ -20,8 +20,8 @@ #include "../core/Path.hpp" #include "../core/String.hpp" #include "../core/StringBuilder.hpp" -#include "../object/ObjectManager.h" #include "../interface/Fonts.h" +#include "../object/ObjectManager.h" #include "LanguagePack.h" extern "C" { diff --git a/src/management/news_item.c b/src/management/news_item.c index c723719ee9..f2eaef7985 100644 --- a/src/management/news_item.c +++ b/src/management/news_item.c @@ -21,8 +21,8 @@ #include "../localisation/localisation.h" #include "../rct2.h" #include "../ride/ride.h" -#include "../world/sprite.h" #include "../util/util.h" +#include "../world/sprite.h" #include "news_item.h" rct_news_item gNewsItems[MAX_NEWS_ITEMS]; diff --git a/src/network/twitch.cpp b/src/network/twitch.cpp index 22b5ccc848..910f153e39 100644 --- a/src/network/twitch.cpp +++ b/src/network/twitch.cpp @@ -43,8 +43,8 @@ extern "C" #include "../management/news_item.h" #include "../peep/peep.h" #include "../rct2.h" - #include "../world/sprite.h" #include "../util/util.h" + #include "../world/sprite.h" #include "http.h" #include "twitch.h" } diff --git a/src/paint/map_element/surface.c b/src/paint/map_element/surface.c index 0b11c1742a..c56005a6de 100644 --- a/src/paint/map_element/surface.c +++ b/src/paint/map_element/surface.c @@ -18,9 +18,9 @@ #include "../../config.h" #include "../../interface/viewport.h" #include "../../peep/staff.h" +#include "../../rct2.h" #include "map_element.h" #include "surface.h" -#include "../../rct2.h" const uint8 byte_97B444[] = { 0, 2, 1, 3, 8, 10, 9, 11, 4, 6, diff --git a/src/peep/peep.c b/src/peep/peep.c index a8c3ef515f..aba1b46efd 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -24,8 +24,8 @@ #include "../management/finance.h" #include "../management/marketing.h" #include "../management/news_item.h" -#include "../openrct2.h" #include "../network/network.h" +#include "../openrct2.h" #include "../rct2.h" #include "../ride/ride.h" #include "../ride/ride_data.h" diff --git a/src/platform/shared.c b/src/platform/shared.c index ed1bf5b4db..c434531dbc 100644 --- a/src/platform/shared.c +++ b/src/platform/shared.c @@ -21,8 +21,8 @@ #include "../drawing/lightfx.h" #include "../game.h" #include "../input.h" -#include "../interface/console.h" #include "../interface/Cursors.h" +#include "../interface/console.h" #include "../interface/keyboard_shortcut.h" #include "../interface/window.h" #include "../localisation/currency.h" diff --git a/src/ride/ride_ratings.c b/src/ride/ride_ratings.c index 99750fb01e..01e250e19a 100644 --- a/src/ride/ride_ratings.c +++ b/src/ride/ride_ratings.c @@ -16,8 +16,8 @@ #include "../interface/window.h" #include "../localisation/date.h" -#include "../world/map.h" #include "../rct2.h" +#include "../world/map.h" #include "ride.h" #include "ride_data.h" #include "ride_ratings.h" diff --git a/src/windows/clear_scenery.c b/src/windows/clear_scenery.c index 04fa0899dc..f7453743e9 100644 --- a/src/windows/clear_scenery.c +++ b/src/windows/clear_scenery.c @@ -15,12 +15,12 @@ #pragma endregion #include "../input.h" -#include "../localisation/localisation.h" -#include "../rct2.h" -#include "../sprites.h" #include "../interface/themes.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../localisation/localisation.h" +#include "../rct2.h" +#include "../sprites.h" #include "../world/map.h" #include "../world/scenery.h" diff --git a/src/windows/debug_paint.c b/src/windows/debug_paint.c index 8caab9b573..007c893371 100644 --- a/src/windows/debug_paint.c +++ b/src/windows/debug_paint.c @@ -15,16 +15,16 @@ #pragma endregion #include "../input.h" +#include "../interface/themes.h" #include "../interface/widget.h" #include "../interface/window.h" #include "../localisation/localisation.h" -#include "../sprites.h" -#include "../rct2.h" -#include "../world/map.h" -#include "../interface/themes.h" #include "../paint/map_element/map_element.h" -#include "../ride/track_paint.h" #include "../paint/paint.h" +#include "../rct2.h" +#include "../ride/track_paint.h" +#include "../sprites.h" +#include "../world/map.h" enum WINDOW_DEBUG_PAINT_WIDGET_IDX { diff --git a/src/windows/dropdown.c b/src/windows/dropdown.c index 3c71fb35cb..ab5ff0ea05 100644 --- a/src/windows/dropdown.c +++ b/src/windows/dropdown.c @@ -18,9 +18,9 @@ #include "../interface/widget.h" #include "../interface/window.h" #include "../localisation/localisation.h" +#include "../rct2.h" #include "../scenario.h" #include "../sprites.h" -#include "../rct2.h" #include "dropdown.h" int gAppropriateImageDropdownItemsPerRow[] = { diff --git a/src/windows/editor_objective_options.c b/src/windows/editor_objective_options.c index 4a753f966d..84151bebb1 100644 --- a/src/windows/editor_objective_options.c +++ b/src/windows/editor_objective_options.c @@ -20,14 +20,14 @@ #include "../interface/window.h" #include "../localisation/date.h" #include "../localisation/localisation.h" -#include "../scenario.h" #include "../rct2.h" +#include "../scenario.h" +#include "../sprites.h" #include "../util/util.h" #include "../world/climate.h" #include "../world/park.h" #include "dropdown.h" #include "error.h" -#include "../sprites.h" #pragma region Widgets diff --git a/src/windows/editor_scenario_options.c b/src/windows/editor_scenario_options.c index 3280610b60..7854f1bb1b 100644 --- a/src/windows/editor_scenario_options.c +++ b/src/windows/editor_scenario_options.c @@ -14,15 +14,15 @@ *****************************************************************************/ #pragma endregion -#include "../localisation/localisation.h" +#include "../interface/themes.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../localisation/localisation.h" #include "../management/finance.h" -#include "../sprites.h" #include "../rct2.h" -#include "error.h" +#include "../sprites.h" #include "dropdown.h" -#include "../interface/themes.h" +#include "error.h" #pragma region Widgets diff --git a/src/windows/footpath.c b/src/windows/footpath.c index 7c5ac0809f..8c23db9973 100644 --- a/src/windows/footpath.c +++ b/src/windows/footpath.c @@ -15,17 +15,17 @@ #pragma endregion #include "../audio/audio.h" +#include "../cheats.h" #include "../game.h" -#include "../localisation/localisation.h" #include "../input.h" -#include "../sprites.h" -#include "../interface/widget.h" +#include "../interface/themes.h" #include "../interface/viewport.h" +#include "../interface/widget.h" +#include "../localisation/localisation.h" +#include "../rct2.h" +#include "../sprites.h" #include "../world/footpath.h" #include "dropdown.h" -#include "../interface/themes.h" -#include "../cheats.h" -#include "../rct2.h" enum { PATH_CONSTRUCTION_MODE_LAND, diff --git a/src/windows/game_bottom_toolbar.c b/src/windows/game_bottom_toolbar.c index 38aa089a50..aa39e295c6 100644 --- a/src/windows/game_bottom_toolbar.c +++ b/src/windows/game_bottom_toolbar.c @@ -26,8 +26,8 @@ #include "../management/news_item.h" #include "../peep/peep.h" #include "../peep/staff.h" -#include "../sprites.h" #include "../rct2.h" +#include "../sprites.h" #include "../world/climate.h" #include "../world/park.h" #include "../world/sprite.h" diff --git a/src/windows/land.c b/src/windows/land.c index 447b9eb7ef..33068e7157 100644 --- a/src/windows/land.c +++ b/src/windows/land.c @@ -15,14 +15,14 @@ #pragma endregion #include "../input.h" +#include "../interface/themes.h" #include "../interface/widget.h" #include "../interface/window.h" #include "../localisation/localisation.h" -#include "../sprites.h" #include "../rct2.h" +#include "../sprites.h" #include "../world/map.h" #include "dropdown.h" -#include "../interface/themes.h" #define MINIMUM_TOOL_SIZE 1 #define MAXIMUM_TOOL_SIZE 64 diff --git a/src/windows/land_rights.c b/src/windows/land_rights.c index 1fb8d451e7..5adda40342 100644 --- a/src/windows/land_rights.c +++ b/src/windows/land_rights.c @@ -14,16 +14,16 @@ *****************************************************************************/ #pragma endregion +#include "../game.h" #include "../input.h" +#include "../interface/themes.h" +#include "../interface/viewport.h" #include "../interface/widget.h" #include "../interface/window.h" -#include "../interface/viewport.h" #include "../localisation/localisation.h" -#include "../sprites.h" #include "../rct2.h" +#include "../sprites.h" #include "../world/map.h" -#include "../game.h" -#include "../interface/themes.h" #define MINIMUM_TOOL_SIZE 1 #define MAXIMUM_TOOL_SIZE 64 diff --git a/src/windows/map.c b/src/windows/map.c index 7fb7b827c6..42543f6458 100644 --- a/src/windows/map.c +++ b/src/windows/map.c @@ -17,14 +17,14 @@ #include "../audio/audio.h" #include "../cheats.h" #include "../game.h" -#include "../localisation/localisation.h" #include "../input.h" #include "../interface/themes.h" -#include "../interface/widget.h" #include "../interface/viewport.h" +#include "../interface/widget.h" #include "../interface/window.h" -#include "../sprites.h" +#include "../localisation/localisation.h" #include "../rct2.h" +#include "../sprites.h" #include "../world/footpath.h" #include "../world/scenery.h" #include "error.h" diff --git a/src/world/climate.c b/src/world/climate.c index 47266902f7..3c904da65a 100644 --- a/src/world/climate.c +++ b/src/world/climate.c @@ -22,11 +22,11 @@ #include "../game.h" #include "../interface/window.h" #include "../localisation/date.h" +#include "../rct2.h" #include "../scenario.h" +#include "../sprites.h" #include "../util/util.h" #include "climate.h" -#include "../rct2.h" -#include "../sprites.h" enum { THUNDER_STATUS_NULL = 0, diff --git a/src/world/footpath.c b/src/world/footpath.c index a037d823b8..ed168d31b4 100644 --- a/src/world/footpath.c +++ b/src/world/footpath.c @@ -16,17 +16,13 @@ #include "../cheats.h" #include "../game.h" -#include "footpath.h" #include "../localisation/localisation.h" -#include "map.h" -#include "map_animation.h" #include "../network/network.h" -#include "../util/util.h" #include "../object_list.h" #include "../rct2.h" #include "../ride/track.h" #include "../ride/track_data.h" -#include "scenery.h" +#include "../util/util.h" void footpath_interrupt_peeps(int x, int y, int z); void sub_6A7642(int x, int y, rct_map_element *mapElement); From fdcbd583e396c36f438a8b731ce0324bd8081493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sun, 27 Nov 2016 23:22:13 +0100 Subject: [PATCH 20/62] Add first test for sawyercoding --- test/tests/sawyercoding_test.cpp | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 test/tests/sawyercoding_test.cpp diff --git a/test/tests/sawyercoding_test.cpp b/test/tests/sawyercoding_test.cpp new file mode 100644 index 0000000000..3e8c163eda --- /dev/null +++ b/test/tests/sawyercoding_test.cpp @@ -0,0 +1,44 @@ +extern "C" { + #include "util/sawyercoding.h" +} + +#include + +// TODO: Seed with some proper randomness +char randomdata[] = { 0x01, 0x02, 0x03, 0x04 }; + +#define BUFFER_SIZE 0x600000 + +static void test_encode_decode(uint8_t encoding_type) { + sawyercoding_chunk_header chdr_in, chdr_out; + chdr_in.encoding = encoding_type; + chdr_in.length = sizeof(randomdata); + uint8_t * encodedDataBuffer = new uint8_t[BUFFER_SIZE]; + size_t encodedDataSize = sawyercoding_write_chunk_buffer(encodedDataBuffer, (const uint8 *)randomdata, chdr_in); + ASSERT_GT(encodedDataSize, sizeof(sawyercoding_chunk_header)); + memcpy(&chdr_out, encodedDataBuffer, sizeof(sawyercoding_chunk_header)); + ASSERT_EQ(chdr_out.encoding, encoding_type); + uint8_t * decodeBuffer = new uint8_t[BUFFER_SIZE]; + size_t decodedDataSize = sawyercoding_read_chunk_buffer(decodeBuffer, encodedDataBuffer + sizeof(sawyercoding_chunk_header), chdr_out, BUFFER_SIZE); + ASSERT_EQ(decodedDataSize, sizeof(randomdata)); + int result = memcmp(decodeBuffer, randomdata, sizeof(randomdata)); + ASSERT_EQ(result, 0); + delete [] decodeBuffer; + delete [] encodedDataBuffer; +} + +TEST(sawyercoding, write_read_chunk_none) { + test_encode_decode(CHUNK_ENCODING_NONE); +} + +TEST(sawyercoding, write_read_chunk_rle) { + test_encode_decode(CHUNK_ENCODING_RLE); +} + +TEST(sawyercoding, write_read_chunk_rle_compressed) { + test_encode_decode(CHUNK_ENCODING_RLECOMPRESSED); +} + +TEST(sawyercoding, write_read_chunk_rotate) { + test_encode_decode(CHUNK_ENCODING_ROTATE); +} From be1028b20e5637160ef462cfff509ac1ee20f694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Mon, 28 Nov 2016 14:33:50 +0100 Subject: [PATCH 21/62] Add CMakeLists.txt file for tests --- test/tests/CMakeLists.txt | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/tests/CMakeLists.txt diff --git a/test/tests/CMakeLists.txt b/test/tests/CMakeLists.txt new file mode 100644 index 0000000000..6bb47463b9 --- /dev/null +++ b/test/tests/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 2.6) +include(FindGTest) +set(SAWYERCODING_TEST_SOURCES "sawyercoding_test.cpp" "../../src/diagnostic.c" "../../src/util/sawyercoding.c" "../../src/localisation/utf8.c") +set (CMAKE_CXX_STANDARD 11) +find_package(GTest REQUIRED) +add_executable(test_sawyercoding ${SAWYERCODING_TEST_SOURCES}) +target_link_libraries(test_sawyercoding gtest gtest_main pthread) +target_include_directories(test_sawyercoding PUBLIC "../../src") +target_include_directories(test_sawyercoding PUBLIC "/usr/include/SDL2") From f496fceb00d4fe14b0393d3107b8361872a172cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Mon, 28 Nov 2016 23:27:21 +0100 Subject: [PATCH 22/62] Download and compile our own gtest --- test/tests/CMakeLists.txt | 52 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/test/tests/CMakeLists.txt b/test/tests/CMakeLists.txt index 6bb47463b9..a9b327886d 100644 --- a/test/tests/CMakeLists.txt +++ b/test/tests/CMakeLists.txt @@ -1,8 +1,56 @@ cmake_minimum_required(VERSION 2.6) -include(FindGTest) + + +INCLUDE(ExternalProject) + +ExternalProject_Add( + googletest-distribution + URL https://github.com/google/googletest/archive/release-1.8.0.tar.gz + URL_HASH SHA1=e7e646a6204638fe8e87e165292b8dd9cd4c36ed + TIMEOUT 10 + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" +) + +# Specify include dir +ExternalProject_Get_Property(googletest-distribution SOURCE_DIR) +set(GOOGLETEST_DISTRIB_SOURCE_DIR "${SOURCE_DIR}") + +ExternalProject_Add( + googletest + DEPENDS googletest-distribution + DOWNLOAD_COMMAND "" + SOURCE_DIR "${GOOGLETEST_DISTRIB_SOURCE_DIR}/googletest" + # Disable install step + INSTALL_COMMAND "" + # Wrap download, configure and build steps in a script to log output + LOG_DOWNLOAD ON + LOG_CONFIGURE ON + LOG_BUILD ON) + + +# Specify include dir +set(GTEST_INCLUDE_DIR ${GOOGLETEST_DISTRIB_SOURCE_DIR}/googletest/include) + +# Library +ExternalProject_Get_Property(googletest BINARY_DIR) +set(GOOGLETEST_BINARY_DIR "${BINARY_DIR}") +set(GTEST_LIBRARY_PATH ${GOOGLETEST_BINARY_DIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest.a) +set(GTEST_MAIN_LIBRARY_PATH ${GOOGLETEST_BINARY_DIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main.a) +set(GTEST_LIBRARY gtest) +set(GTEST_MAIN_LIBRARY gtest_main) +add_library(${GTEST_LIBRARY} UNKNOWN IMPORTED) +add_library(${GTEST_MAIN_LIBRARY} UNKNOWN IMPORTED) +set_property(TARGET ${GTEST_LIBRARY} PROPERTY IMPORTED_LOCATION ${GTEST_LIBRARY_PATH}) +set_property(TARGET ${GTEST_MAIN_LIBRARY} PROPERTY IMPORTED_LOCATION ${GTEST_MAIN_LIBRARY_PATH}) +add_dependencies(${GTEST_LIBRARY} googletest) +add_dependencies(${GTEST_MAIN_LIBRARY} ${GTEST_LIBRARY}) + +include_directories(${GTEST_INCLUDE_DIR}) + set(SAWYERCODING_TEST_SOURCES "sawyercoding_test.cpp" "../../src/diagnostic.c" "../../src/util/sawyercoding.c" "../../src/localisation/utf8.c") set (CMAKE_CXX_STANDARD 11) -find_package(GTest REQUIRED) add_executable(test_sawyercoding ${SAWYERCODING_TEST_SOURCES}) target_link_libraries(test_sawyercoding gtest gtest_main pthread) target_include_directories(test_sawyercoding PUBLIC "../../src") From cae3f776f357a2b8ff9f496c496dc0cb03cb163a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Mon, 28 Nov 2016 14:37:27 +0100 Subject: [PATCH 23/62] Run tests on travis --- CMakeLists.txt | 6 ++++++ scripts/linux/build.sh | 2 +- test/tests/CMakeLists.txt | 9 ++++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd75803adc..c3d5c02679 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -115,6 +115,7 @@ option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags") option(DISABLE_OPENGL "Disable OpenGL support.") option(DISABLE_RCT2 "Build a standalone version, without using code and data segments from vanilla. On by default." ON) option(USE_MMAP "Use mmap to try loading rct2's data segment into memory.") +option(WITH_TESTS "Build tests") set(COMMON_COMPILE_OPTIONS "${COMMON_COMPILE_OPTIONS} -fstrict-aliasing -Werror -Wundef -Wmissing-declarations -Winit-self -Wall -Wno-unknown-pragmas -Wno-unused-function -Wno-missing-braces -Wno-comment") @@ -407,6 +408,11 @@ install(FILES resources/logo/icon_x256.png DESTINATION share/icons/hicolor/256x2 install(FILES resources/logo/icon_flag.svg DESTINATION share/icons/hicolor/scalable/apps RENAME openrct2.svg) install(FILES distribution/linux/openrct2.desktop DESTINATION share/applications) +if (WITH_TESTS) + enable_testing() + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test/tests/) +endif () + if (UNIX AND (NOT USE_MMAP) AND (NOT DISABLE_RCT2) AND (FORCE32)) file(GLOB_RECURSE ORCT2_RIDE_SOURCES "src/ride/*/*.c") file(GLOB_RECURSE ORCT2_RIDE_DEP_SOURCES "src/ride/ride_data.c" "src/ride/track_data.c" "src/ride/track_data_old.c" "src/ride/track_paint.c" "src/addresses.c" "src/diagnostic.c" "src/hook.c" "src/paint/map_element/map_element.c" "src/paint/paint_helpers.c") diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh index 1370a63132..af7e33201e 100755 --- a/scripts/linux/build.sh +++ b/scripts/linux/build.sh @@ -75,7 +75,7 @@ pushd build chmod a+rwx $(pwd) chmod g+s $(pwd) # CMAKE and MAKE opts from environment - docker run -v $PARENT:/work/openrct2 -w /work/openrct2/build -i -t openrct2/openrct2:64bit-only bash -c "cmake ../ $OPENRCT2_CMAKE_OPTS && make $OPENRCT_MAKE_OPTS" + docker run -v $PARENT:/work/openrct2 -w /work/openrct2/build -i -t openrct2/openrct2:64bit-only bash -c "cmake ../ -DWITH_TESTS=on $OPENRCT2_CMAKE_OPTS && make $OPENRCT_MAKE_OPTS && make test ARGS=\"-V\"" elif [[ $TARGET == "linux" ]] then cmake $OPENRCT2_CMAKE_OPTS .. -DCMAKE_BUILD_TYPE=debug diff --git a/test/tests/CMakeLists.txt b/test/tests/CMakeLists.txt index a9b327886d..977522fef2 100644 --- a/test/tests/CMakeLists.txt +++ b/test/tests/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.6) - +# Bootstrap GoogleTest INCLUDE(ExternalProject) ExternalProject_Add( @@ -47,11 +47,14 @@ set_property(TARGET ${GTEST_MAIN_LIBRARY} PROPERTY IMPORTED_LOCATION ${GTEST_MAI add_dependencies(${GTEST_LIBRARY} googletest) add_dependencies(${GTEST_MAIN_LIBRARY} ${GTEST_LIBRARY}) -include_directories(${GTEST_INCLUDE_DIR}) +include_directories(SYSTEM ${GTEST_INCLUDE_DIR}) + +# Start of our tests set(SAWYERCODING_TEST_SOURCES "sawyercoding_test.cpp" "../../src/diagnostic.c" "../../src/util/sawyercoding.c" "../../src/localisation/utf8.c") set (CMAKE_CXX_STANDARD 11) add_executable(test_sawyercoding ${SAWYERCODING_TEST_SOURCES}) target_link_libraries(test_sawyercoding gtest gtest_main pthread) target_include_directories(test_sawyercoding PUBLIC "../../src") -target_include_directories(test_sawyercoding PUBLIC "/usr/include/SDL2") +add_test(NAME sawyercoding + COMMAND test_sawyercoding) From b0e5333ce6984e45f5d02bf61d627d3ad6c5bf5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Tue, 29 Nov 2016 11:56:21 +0100 Subject: [PATCH 24/62] Improve sawyercoding_test.cpp --- test/tests/sawyercoding_test.cpp | 426 +++++++++++++++++++++++++++++-- 1 file changed, 399 insertions(+), 27 deletions(-) diff --git a/test/tests/sawyercoding_test.cpp b/test/tests/sawyercoding_test.cpp index 3e8c163eda..2dce17f261 100644 --- a/test/tests/sawyercoding_test.cpp +++ b/test/tests/sawyercoding_test.cpp @@ -1,44 +1,416 @@ extern "C" { - #include "util/sawyercoding.h" +#include "util/sawyercoding.h" } #include -// TODO: Seed with some proper randomness -char randomdata[] = { 0x01, 0x02, 0x03, 0x04 }; +// These are populated further down in this file, but to do so, they need to be marked `extern`. +extern const uint8 randomdata[1024]; +extern const uint8 nonedata[1029]; +extern const uint8 rledata[1038]; +extern const uint8 rlecompresseddata[1949]; +extern const uint8 rotatedata[1038]; #define BUFFER_SIZE 0x600000 -static void test_encode_decode(uint8_t encoding_type) { - sawyercoding_chunk_header chdr_in, chdr_out; - chdr_in.encoding = encoding_type; - chdr_in.length = sizeof(randomdata); - uint8_t * encodedDataBuffer = new uint8_t[BUFFER_SIZE]; - size_t encodedDataSize = sawyercoding_write_chunk_buffer(encodedDataBuffer, (const uint8 *)randomdata, chdr_in); - ASSERT_GT(encodedDataSize, sizeof(sawyercoding_chunk_header)); - memcpy(&chdr_out, encodedDataBuffer, sizeof(sawyercoding_chunk_header)); - ASSERT_EQ(chdr_out.encoding, encoding_type); - uint8_t * decodeBuffer = new uint8_t[BUFFER_SIZE]; - size_t decodedDataSize = sawyercoding_read_chunk_buffer(decodeBuffer, encodedDataBuffer + sizeof(sawyercoding_chunk_header), chdr_out, BUFFER_SIZE); - ASSERT_EQ(decodedDataSize, sizeof(randomdata)); - int result = memcmp(decodeBuffer, randomdata, sizeof(randomdata)); - ASSERT_EQ(result, 0); - delete [] decodeBuffer; - delete [] encodedDataBuffer; +static void test_encode_decode(uint8 encoding_type) +{ + sawyercoding_chunk_header chdr_in, chdr_out; + chdr_in.encoding = encoding_type; + chdr_in.length = sizeof(randomdata); + uint8 * encodedDataBuffer = new uint8[BUFFER_SIZE]; + size_t encodedDataSize = sawyercoding_write_chunk_buffer(encodedDataBuffer, (const uint8 *)randomdata, chdr_in); + ASSERT_GT(encodedDataSize, sizeof(sawyercoding_chunk_header)); + memcpy(&chdr_out, encodedDataBuffer, sizeof(sawyercoding_chunk_header)); + ASSERT_EQ(chdr_out.encoding, encoding_type); + uint8 * decodeBuffer = new uint8[BUFFER_SIZE]; + size_t decodedDataSize = sawyercoding_read_chunk_buffer(decodeBuffer, encodedDataBuffer + sizeof(sawyercoding_chunk_header), + chdr_out, BUFFER_SIZE); + ASSERT_EQ(decodedDataSize, sizeof(randomdata)); + int result = memcmp(decodeBuffer, randomdata, sizeof(randomdata)); + ASSERT_EQ(result, 0); + delete[] decodeBuffer; + delete[] encodedDataBuffer; } -TEST(sawyercoding, write_read_chunk_none) { - test_encode_decode(CHUNK_ENCODING_NONE); +static void test_decode(const uint8 * data) +{ + sawyercoding_chunk_header chdr_in; + memcpy(&chdr_in, data, sizeof(sawyercoding_chunk_header)); + uint8 * decodeBuffer = new uint8[BUFFER_SIZE]; + size_t decodedDataSize = + sawyercoding_read_chunk_buffer(decodeBuffer, data + sizeof(sawyercoding_chunk_header), chdr_in, BUFFER_SIZE); + ASSERT_EQ(decodedDataSize, sizeof(randomdata)); + int result = memcmp(decodeBuffer, randomdata, sizeof(randomdata)); + ASSERT_EQ(result, 0); + delete[] decodeBuffer; } -TEST(sawyercoding, write_read_chunk_rle) { - test_encode_decode(CHUNK_ENCODING_RLE); +TEST(sawyercoding, write_read_chunk_none) +{ + test_encode_decode(CHUNK_ENCODING_NONE); } -TEST(sawyercoding, write_read_chunk_rle_compressed) { - test_encode_decode(CHUNK_ENCODING_RLECOMPRESSED); +TEST(sawyercoding, write_read_chunk_rle) +{ + test_encode_decode(CHUNK_ENCODING_RLE); } -TEST(sawyercoding, write_read_chunk_rotate) { - test_encode_decode(CHUNK_ENCODING_ROTATE); +TEST(sawyercoding, write_read_chunk_rle_compressed) +{ + test_encode_decode(CHUNK_ENCODING_RLECOMPRESSED); } + +TEST(sawyercoding, write_read_chunk_rotate) +{ + test_encode_decode(CHUNK_ENCODING_ROTATE); +} + +// Note we only check if provided data decompresses to the same data, not if it compresses the same. +// The reason for that is we may improve encoding at some point, but the test won't be affected, +// as we already do a decode test and rountrip (encode + decode), which validates all uses. + +TEST(sawyercoding, decode_chunk_none) +{ + test_decode(nonedata); +} + +TEST(sawyercoding, decode_chunk_rle) +{ + test_decode(rledata); +} + +TEST(sawyercoding, decode_chunk_rlecompressed) +{ + test_decode(rlecompresseddata); +} + +TEST(sawyercoding, decode_chunk_rotate) +{ + test_decode(rotatedata); +} + +// 1024 bytes of random data +// use `dd if=/dev/urandom bs=1024 count=1 | xxd -i` to get your own +extern const uint8 randomdata[] = { + 0x3a, 0x97, 0x63, 0x8b, 0xbf, 0xe5, 0x6e, 0x0e, 0xc4, 0xac, 0xdc, 0x84, 0xd7, 0x68, 0xf1, 0x4d, 0xcb, 0xaf, 0x1e, 0x5a, + 0x29, 0x40, 0x87, 0x80, 0x3f, 0xf9, 0xb8, 0xad, 0x01, 0xd3, 0x79, 0x3d, 0xe9, 0x87, 0xa8, 0x95, 0x68, 0xc0, 0xc2, 0x3d, + 0x15, 0x87, 0xdb, 0xa6, 0x90, 0x8c, 0x26, 0x98, 0x2a, 0x3f, 0x2e, 0x0c, 0x82, 0x43, 0x00, 0x10, 0x6d, 0x60, 0xb9, 0xd4, + 0xed, 0xf1, 0x49, 0xbb, 0xf6, 0x7f, 0x21, 0x24, 0xc3, 0xfb, 0x42, 0xe1, 0xfc, 0xb8, 0x82, 0x5e, 0x01, 0x5d, 0x96, 0x2d, + 0x0f, 0x48, 0x12, 0xdf, 0x4b, 0x6c, 0x7e, 0x99, 0x01, 0xfa, 0x46, 0x7d, 0x2c, 0xeb, 0xd6, 0xf3, 0x77, 0xa3, 0x85, 0x8e, + 0x00, 0x34, 0xee, 0x73, 0x31, 0x76, 0x53, 0x17, 0x5a, 0x2b, 0x19, 0x65, 0x2f, 0x32, 0x99, 0x57, 0xc4, 0xf8, 0x05, 0x0d, + 0xc3, 0x59, 0x29, 0x9a, 0x19, 0x3c, 0x33, 0x58, 0x8c, 0xd1, 0x1f, 0x3b, 0xa5, 0x66, 0xa7, 0xfc, 0x7c, 0x99, 0xa9, 0x1a, + 0x5e, 0x65, 0x92, 0x9e, 0x71, 0x27, 0x07, 0xbc, 0x71, 0xed, 0xe5, 0xc6, 0x0e, 0x74, 0xdb, 0x15, 0x91, 0xd7, 0xff, 0xf7, + 0x30, 0x6e, 0x6a, 0x00, 0x40, 0x0e, 0x76, 0x8a, 0xb2, 0x31, 0xa3, 0x81, 0x83, 0xc8, 0xed, 0x08, 0x1f, 0xe5, 0x8d, 0x13, + 0x3e, 0x9a, 0xca, 0x9c, 0xd4, 0x01, 0x28, 0xe6, 0xaf, 0xd6, 0x2f, 0xbc, 0xe1, 0xb7, 0xbb, 0x48, 0x88, 0x86, 0x19, 0xbb, + 0x52, 0xfc, 0x18, 0xc9, 0xe3, 0x90, 0x88, 0x6c, 0x54, 0x53, 0x08, 0x26, 0xff, 0x38, 0xe3, 0x5e, 0x06, 0xa1, 0xac, 0xc2, + 0x83, 0x23, 0x0d, 0x42, 0xe6, 0xa9, 0x81, 0x38, 0x0b, 0x4f, 0x16, 0x2a, 0x77, 0x3b, 0x24, 0xfb, 0x94, 0x53, 0x78, 0x6a, + 0xf3, 0x17, 0x6a, 0x60, 0x44, 0x58, 0x5c, 0x50, 0x80, 0xc8, 0x0f, 0x87, 0x7b, 0x95, 0x0a, 0xdc, 0xf1, 0x1a, 0x6a, 0xa3, + 0xff, 0x79, 0xda, 0x14, 0xd4, 0x6c, 0x7a, 0xfd, 0x7e, 0x1e, 0xfe, 0xd2, 0x28, 0xd0, 0x06, 0x95, 0x40, 0x80, 0xa1, 0x84, + 0xc9, 0xc0, 0x4b, 0xa5, 0x97, 0xb2, 0xb9, 0x20, 0x27, 0x94, 0x87, 0x91, 0xba, 0xb2, 0xc6, 0xdb, 0x78, 0x19, 0x40, 0x35, + 0x9f, 0xbd, 0xfb, 0xc1, 0x45, 0xbe, 0xdc, 0x30, 0xad, 0x38, 0xd4, 0x14, 0x46, 0x98, 0x2a, 0x90, 0xc8, 0x85, 0x5e, 0x7e, + 0x76, 0x0f, 0xc4, 0x20, 0x07, 0x54, 0x1a, 0x60, 0x3a, 0x8c, 0x75, 0xb0, 0x43, 0xab, 0xbb, 0x05, 0xca, 0x93, 0xeb, 0x18, + 0x94, 0xf1, 0x64, 0x8a, 0x01, 0xe0, 0xe6, 0x24, 0x78, 0x50, 0x93, 0xd3, 0xb9, 0xe1, 0xbf, 0x1c, 0xb0, 0x5c, 0xad, 0x94, + 0x17, 0x8a, 0xd1, 0xef, 0x66, 0x08, 0xa7, 0x08, 0x6d, 0x6a, 0xb7, 0x06, 0x31, 0xa6, 0x9d, 0xe5, 0xb2, 0xd8, 0xf9, 0xa6, + 0xf2, 0xe1, 0x63, 0xba, 0x36, 0x7a, 0x53, 0xc0, 0x22, 0x40, 0x3e, 0xa1, 0x95, 0xe5, 0xae, 0x8c, 0x35, 0x7d, 0x34, 0xae, + 0x0c, 0x69, 0x8a, 0x0e, 0xd4, 0x53, 0x19, 0xc9, 0x90, 0x78, 0x36, 0x38, 0xc8, 0xa0, 0xc6, 0x49, 0xef, 0xe3, 0xb2, 0x1d, + 0x7c, 0xd3, 0x38, 0x33, 0x51, 0x69, 0x2b, 0xd2, 0x8e, 0xa8, 0x6d, 0x9c, 0x01, 0x06, 0x9f, 0x93, 0xa5, 0x13, 0x86, 0x67, + 0x72, 0x3e, 0xc7, 0x38, 0x97, 0xe6, 0x1d, 0xce, 0x61, 0x5a, 0x57, 0x10, 0xf7, 0x49, 0x32, 0xea, 0x8f, 0xce, 0x37, 0xea, + 0x38, 0x65, 0x76, 0x86, 0xf4, 0x63, 0x9c, 0x44, 0xe6, 0x4c, 0x7b, 0x3f, 0x9b, 0x61, 0xf7, 0xb4, 0x2a, 0x7a, 0x9c, 0x03, + 0x29, 0xf3, 0x6f, 0xff, 0x76, 0x1a, 0xb8, 0x21, 0xd7, 0xd0, 0xbf, 0x10, 0x1e, 0x82, 0x96, 0x9f, 0xe3, 0xc4, 0xcf, 0x19, + 0x39, 0xd0, 0x4b, 0x4b, 0xa4, 0x7e, 0xd7, 0x4e, 0x3b, 0x2c, 0x0c, 0x35, 0xe1, 0xd4, 0x45, 0x10, 0x28, 0x67, 0x18, 0xdc, + 0x2d, 0x77, 0x68, 0xf2, 0x39, 0x87, 0x52, 0xd7, 0xd1, 0x50, 0x04, 0x45, 0xf6, 0x1d, 0xb8, 0x9d, 0xfa, 0xe8, 0xd8, 0x94, + 0xe0, 0xae, 0x31, 0x66, 0xc7, 0xee, 0xa9, 0xa8, 0x51, 0xe9, 0x14, 0x67, 0x53, 0x4c, 0x40, 0xf6, 0xee, 0x50, 0x67, 0x57, + 0xf4, 0xd8, 0xd1, 0x95, 0x17, 0x2c, 0x5a, 0x72, 0x8f, 0xdc, 0xeb, 0x6c, 0x9b, 0x24, 0xfc, 0x67, 0x11, 0x07, 0x82, 0x2a, + 0xae, 0xfb, 0xd9, 0xfd, 0x89, 0x75, 0x71, 0x75, 0x74, 0x08, 0x0d, 0xf7, 0xba, 0x5d, 0x56, 0xdf, 0x7e, 0x52, 0x5b, 0xce, + 0xef, 0xeb, 0xf6, 0x32, 0x11, 0x93, 0x5f, 0xab, 0xfe, 0x08, 0xec, 0x20, 0x18, 0x0a, 0x4e, 0xc5, 0xb6, 0x42, 0xe4, 0x70, + 0xbb, 0xba, 0x1b, 0xec, 0x01, 0x9c, 0xe5, 0x1c, 0xf4, 0xd2, 0x68, 0x0b, 0x30, 0x2d, 0xec, 0xda, 0x23, 0xff, 0xbd, 0x95, + 0x46, 0x55, 0x59, 0xab, 0x03, 0x0f, 0xe4, 0xeb, 0x8c, 0xca, 0xc1, 0x13, 0x28, 0x49, 0x12, 0x66, 0xd7, 0x85, 0xcb, 0x21, + 0x8d, 0x8a, 0x34, 0x4c, 0x2e, 0x28, 0x25, 0x79, 0xbf, 0x98, 0x04, 0xcd, 0x8a, 0x3e, 0xad, 0x08, 0xd3, 0x21, 0x32, 0xed, + 0x54, 0x7e, 0x17, 0xfe, 0x89, 0xe9, 0x09, 0x18, 0xac, 0x96, 0xda, 0x51, 0x61, 0x85, 0x44, 0xd2, 0xdf, 0xd9, 0x61, 0xa2, + 0x44, 0x07, 0x29, 0xa5, 0xdc, 0x16, 0xac, 0x3d, 0x6e, 0x27, 0xb6, 0x5a, 0x15, 0x87, 0x6c, 0x48, 0x3e, 0x34, 0xdd, 0xec, + 0xf2, 0x7c, 0xc6, 0x87, 0x0f, 0xcf, 0xac, 0xde, 0x42, 0x02, 0x93, 0xff, 0x4f, 0x10, 0x0f, 0x03, 0xf3, 0x1b, 0x1e, 0xaf, + 0x94, 0x8e, 0x77, 0x7c, 0x66, 0x65, 0xfb, 0xd9, 0x0d, 0xf8, 0x36, 0x0c, 0xac, 0xdc, 0x8e, 0xd1, 0x1e, 0x19, 0xa8, 0x87, + 0x97, 0x39, 0x77, 0x98, 0x6c, 0xfb, 0x5d, 0xc1, 0x09, 0x7e, 0x5d, 0xab, 0xde, 0xdc, 0x1f, 0x21, 0xd0, 0x7a, 0xaa, 0xeb, + 0x96, 0x60, 0xf9, 0x95, 0xed, 0x13, 0xf4, 0x82, 0xa9, 0x94, 0x7e, 0xa8, 0x5e, 0xe2, 0xca, 0x08, 0xed, 0xfe, 0x9d, 0x94, + 0x3f, 0x08, 0xd8, 0xd8, 0x9d, 0xb0, 0x84, 0xd6, 0x6a, 0xcb, 0xc1, 0xd4, 0xd0, 0xe8, 0xe7, 0xae, 0x44, 0x28, 0x47, 0x75, + 0xa6, 0x2a, 0x40, 0x0b, 0x82, 0x57, 0xd5, 0x49, 0x40, 0x85, 0x5c, 0x92, 0x95, 0x6b, 0x7d, 0xbe, 0xcc, 0xb6, 0x2d, 0x2b, + 0x71, 0x85, 0x63, 0x39, 0xfa, 0xbc, 0x19, 0x7c, 0xe2, 0x3a, 0x81, 0xf1, 0x86, 0x9e, 0x46, 0x3d, 0x5f, 0x71, 0xa4, 0xb7, + 0xd4, 0x2c, 0x98, 0xfa, 0xb5, 0x95, 0xac, 0x33, 0x1a, 0x53, 0x9d, 0xe3, 0x4e, 0x5d, 0x4f, 0x54, 0x0d, 0xe8, 0xa4, 0x32, + 0x25, 0x4d, 0x5e, 0x4c, 0xe1, 0xae, 0x46, 0x85, 0x1e, 0xc4, 0x20, 0xdf, 0x73, 0x1e, 0x81, 0x40, 0xa2, 0x33, 0x75, 0x1e, + 0x1d, 0x1d, 0x7c, 0x1f, 0x07, 0xe5, 0x9e, 0x76, 0x9f, 0x42, 0xeb, 0xc4, 0xb4, 0xd3, 0xcb, 0x55, 0xe8, 0xbf, 0xf7, 0xeb, + 0x7c, 0x2d, 0xa5, 0xfd, 0xda, 0xb4, 0x5b, 0x1f, 0xa8, 0xd2, 0xeb, 0xdf, 0xd9, 0xf2, 0x35, 0xc6, 0x0c, 0x36, 0x66, 0x28, + 0x95, 0xe2, 0x34, 0x64, 0xea, 0xaf, 0x3a, 0x36, 0x3c, 0x38, 0x31, 0x99, 0x8d, 0x80, 0x78, 0x18, 0x48, 0x2c, 0xe9, 0xe5, + 0xb7, 0xe6, 0x2e, 0x73, 0xf1, 0x7c, 0x84, 0x21, 0x04, 0x00, 0x8e, 0x12, 0x66, 0x6c, 0x9b, 0x09, 0x88, 0xe2, 0xd5, 0xec, + 0xb4, 0xdd, 0x2b, 0xda, 0x29, 0x6f, 0x1b, 0x81, 0x21, 0xe4, 0x5c, 0x36, 0x73, 0x2d, 0x9d, 0xdd, 0xb6, 0x69, 0x21, 0x40, + 0x4e, 0x70, 0xde, 0x9d, 0x0c, 0x17, 0x1d, 0x15, 0x29, 0x5b, 0xd0, 0x66, 0x72, 0xb8, 0x38, 0x80, 0xbe, 0x9e, 0xd7, 0x5e, + 0xb5, 0x72, 0x22, 0xbc +}; + +// Following are compressed versions of the data above. + +extern const uint8 nonedata[] = { + 0x00, 0x00, 0x04, 0x00, 0x00, 0x3a, 0x97, 0x63, 0x8b, 0xbf, 0xe5, 0x6e, 0x0e, 0xc4, 0xac, 0xdc, 0x84, 0xd7, 0x68, 0xf1, + 0x4d, 0xcb, 0xaf, 0x1e, 0x5a, 0x29, 0x40, 0x87, 0x80, 0x3f, 0xf9, 0xb8, 0xad, 0x01, 0xd3, 0x79, 0x3d, 0xe9, 0x87, 0xa8, + 0x95, 0x68, 0xc0, 0xc2, 0x3d, 0x15, 0x87, 0xdb, 0xa6, 0x90, 0x8c, 0x26, 0x98, 0x2a, 0x3f, 0x2e, 0x0c, 0x82, 0x43, 0x00, + 0x10, 0x6d, 0x60, 0xb9, 0xd4, 0xed, 0xf1, 0x49, 0xbb, 0xf6, 0x7f, 0x21, 0x24, 0xc3, 0xfb, 0x42, 0xe1, 0xfc, 0xb8, 0x82, + 0x5e, 0x01, 0x5d, 0x96, 0x2d, 0x0f, 0x48, 0x12, 0xdf, 0x4b, 0x6c, 0x7e, 0x99, 0x01, 0xfa, 0x46, 0x7d, 0x2c, 0xeb, 0xd6, + 0xf3, 0x77, 0xa3, 0x85, 0x8e, 0x00, 0x34, 0xee, 0x73, 0x31, 0x76, 0x53, 0x17, 0x5a, 0x2b, 0x19, 0x65, 0x2f, 0x32, 0x99, + 0x57, 0xc4, 0xf8, 0x05, 0x0d, 0xc3, 0x59, 0x29, 0x9a, 0x19, 0x3c, 0x33, 0x58, 0x8c, 0xd1, 0x1f, 0x3b, 0xa5, 0x66, 0xa7, + 0xfc, 0x7c, 0x99, 0xa9, 0x1a, 0x5e, 0x65, 0x92, 0x9e, 0x71, 0x27, 0x07, 0xbc, 0x71, 0xed, 0xe5, 0xc6, 0x0e, 0x74, 0xdb, + 0x15, 0x91, 0xd7, 0xff, 0xf7, 0x30, 0x6e, 0x6a, 0x00, 0x40, 0x0e, 0x76, 0x8a, 0xb2, 0x31, 0xa3, 0x81, 0x83, 0xc8, 0xed, + 0x08, 0x1f, 0xe5, 0x8d, 0x13, 0x3e, 0x9a, 0xca, 0x9c, 0xd4, 0x01, 0x28, 0xe6, 0xaf, 0xd6, 0x2f, 0xbc, 0xe1, 0xb7, 0xbb, + 0x48, 0x88, 0x86, 0x19, 0xbb, 0x52, 0xfc, 0x18, 0xc9, 0xe3, 0x90, 0x88, 0x6c, 0x54, 0x53, 0x08, 0x26, 0xff, 0x38, 0xe3, + 0x5e, 0x06, 0xa1, 0xac, 0xc2, 0x83, 0x23, 0x0d, 0x42, 0xe6, 0xa9, 0x81, 0x38, 0x0b, 0x4f, 0x16, 0x2a, 0x77, 0x3b, 0x24, + 0xfb, 0x94, 0x53, 0x78, 0x6a, 0xf3, 0x17, 0x6a, 0x60, 0x44, 0x58, 0x5c, 0x50, 0x80, 0xc8, 0x0f, 0x87, 0x7b, 0x95, 0x0a, + 0xdc, 0xf1, 0x1a, 0x6a, 0xa3, 0xff, 0x79, 0xda, 0x14, 0xd4, 0x6c, 0x7a, 0xfd, 0x7e, 0x1e, 0xfe, 0xd2, 0x28, 0xd0, 0x06, + 0x95, 0x40, 0x80, 0xa1, 0x84, 0xc9, 0xc0, 0x4b, 0xa5, 0x97, 0xb2, 0xb9, 0x20, 0x27, 0x94, 0x87, 0x91, 0xba, 0xb2, 0xc6, + 0xdb, 0x78, 0x19, 0x40, 0x35, 0x9f, 0xbd, 0xfb, 0xc1, 0x45, 0xbe, 0xdc, 0x30, 0xad, 0x38, 0xd4, 0x14, 0x46, 0x98, 0x2a, + 0x90, 0xc8, 0x85, 0x5e, 0x7e, 0x76, 0x0f, 0xc4, 0x20, 0x07, 0x54, 0x1a, 0x60, 0x3a, 0x8c, 0x75, 0xb0, 0x43, 0xab, 0xbb, + 0x05, 0xca, 0x93, 0xeb, 0x18, 0x94, 0xf1, 0x64, 0x8a, 0x01, 0xe0, 0xe6, 0x24, 0x78, 0x50, 0x93, 0xd3, 0xb9, 0xe1, 0xbf, + 0x1c, 0xb0, 0x5c, 0xad, 0x94, 0x17, 0x8a, 0xd1, 0xef, 0x66, 0x08, 0xa7, 0x08, 0x6d, 0x6a, 0xb7, 0x06, 0x31, 0xa6, 0x9d, + 0xe5, 0xb2, 0xd8, 0xf9, 0xa6, 0xf2, 0xe1, 0x63, 0xba, 0x36, 0x7a, 0x53, 0xc0, 0x22, 0x40, 0x3e, 0xa1, 0x95, 0xe5, 0xae, + 0x8c, 0x35, 0x7d, 0x34, 0xae, 0x0c, 0x69, 0x8a, 0x0e, 0xd4, 0x53, 0x19, 0xc9, 0x90, 0x78, 0x36, 0x38, 0xc8, 0xa0, 0xc6, + 0x49, 0xef, 0xe3, 0xb2, 0x1d, 0x7c, 0xd3, 0x38, 0x33, 0x51, 0x69, 0x2b, 0xd2, 0x8e, 0xa8, 0x6d, 0x9c, 0x01, 0x06, 0x9f, + 0x93, 0xa5, 0x13, 0x86, 0x67, 0x72, 0x3e, 0xc7, 0x38, 0x97, 0xe6, 0x1d, 0xce, 0x61, 0x5a, 0x57, 0x10, 0xf7, 0x49, 0x32, + 0xea, 0x8f, 0xce, 0x37, 0xea, 0x38, 0x65, 0x76, 0x86, 0xf4, 0x63, 0x9c, 0x44, 0xe6, 0x4c, 0x7b, 0x3f, 0x9b, 0x61, 0xf7, + 0xb4, 0x2a, 0x7a, 0x9c, 0x03, 0x29, 0xf3, 0x6f, 0xff, 0x76, 0x1a, 0xb8, 0x21, 0xd7, 0xd0, 0xbf, 0x10, 0x1e, 0x82, 0x96, + 0x9f, 0xe3, 0xc4, 0xcf, 0x19, 0x39, 0xd0, 0x4b, 0x4b, 0xa4, 0x7e, 0xd7, 0x4e, 0x3b, 0x2c, 0x0c, 0x35, 0xe1, 0xd4, 0x45, + 0x10, 0x28, 0x67, 0x18, 0xdc, 0x2d, 0x77, 0x68, 0xf2, 0x39, 0x87, 0x52, 0xd7, 0xd1, 0x50, 0x04, 0x45, 0xf6, 0x1d, 0xb8, + 0x9d, 0xfa, 0xe8, 0xd8, 0x94, 0xe0, 0xae, 0x31, 0x66, 0xc7, 0xee, 0xa9, 0xa8, 0x51, 0xe9, 0x14, 0x67, 0x53, 0x4c, 0x40, + 0xf6, 0xee, 0x50, 0x67, 0x57, 0xf4, 0xd8, 0xd1, 0x95, 0x17, 0x2c, 0x5a, 0x72, 0x8f, 0xdc, 0xeb, 0x6c, 0x9b, 0x24, 0xfc, + 0x67, 0x11, 0x07, 0x82, 0x2a, 0xae, 0xfb, 0xd9, 0xfd, 0x89, 0x75, 0x71, 0x75, 0x74, 0x08, 0x0d, 0xf7, 0xba, 0x5d, 0x56, + 0xdf, 0x7e, 0x52, 0x5b, 0xce, 0xef, 0xeb, 0xf6, 0x32, 0x11, 0x93, 0x5f, 0xab, 0xfe, 0x08, 0xec, 0x20, 0x18, 0x0a, 0x4e, + 0xc5, 0xb6, 0x42, 0xe4, 0x70, 0xbb, 0xba, 0x1b, 0xec, 0x01, 0x9c, 0xe5, 0x1c, 0xf4, 0xd2, 0x68, 0x0b, 0x30, 0x2d, 0xec, + 0xda, 0x23, 0xff, 0xbd, 0x95, 0x46, 0x55, 0x59, 0xab, 0x03, 0x0f, 0xe4, 0xeb, 0x8c, 0xca, 0xc1, 0x13, 0x28, 0x49, 0x12, + 0x66, 0xd7, 0x85, 0xcb, 0x21, 0x8d, 0x8a, 0x34, 0x4c, 0x2e, 0x28, 0x25, 0x79, 0xbf, 0x98, 0x04, 0xcd, 0x8a, 0x3e, 0xad, + 0x08, 0xd3, 0x21, 0x32, 0xed, 0x54, 0x7e, 0x17, 0xfe, 0x89, 0xe9, 0x09, 0x18, 0xac, 0x96, 0xda, 0x51, 0x61, 0x85, 0x44, + 0xd2, 0xdf, 0xd9, 0x61, 0xa2, 0x44, 0x07, 0x29, 0xa5, 0xdc, 0x16, 0xac, 0x3d, 0x6e, 0x27, 0xb6, 0x5a, 0x15, 0x87, 0x6c, + 0x48, 0x3e, 0x34, 0xdd, 0xec, 0xf2, 0x7c, 0xc6, 0x87, 0x0f, 0xcf, 0xac, 0xde, 0x42, 0x02, 0x93, 0xff, 0x4f, 0x10, 0x0f, + 0x03, 0xf3, 0x1b, 0x1e, 0xaf, 0x94, 0x8e, 0x77, 0x7c, 0x66, 0x65, 0xfb, 0xd9, 0x0d, 0xf8, 0x36, 0x0c, 0xac, 0xdc, 0x8e, + 0xd1, 0x1e, 0x19, 0xa8, 0x87, 0x97, 0x39, 0x77, 0x98, 0x6c, 0xfb, 0x5d, 0xc1, 0x09, 0x7e, 0x5d, 0xab, 0xde, 0xdc, 0x1f, + 0x21, 0xd0, 0x7a, 0xaa, 0xeb, 0x96, 0x60, 0xf9, 0x95, 0xed, 0x13, 0xf4, 0x82, 0xa9, 0x94, 0x7e, 0xa8, 0x5e, 0xe2, 0xca, + 0x08, 0xed, 0xfe, 0x9d, 0x94, 0x3f, 0x08, 0xd8, 0xd8, 0x9d, 0xb0, 0x84, 0xd6, 0x6a, 0xcb, 0xc1, 0xd4, 0xd0, 0xe8, 0xe7, + 0xae, 0x44, 0x28, 0x47, 0x75, 0xa6, 0x2a, 0x40, 0x0b, 0x82, 0x57, 0xd5, 0x49, 0x40, 0x85, 0x5c, 0x92, 0x95, 0x6b, 0x7d, + 0xbe, 0xcc, 0xb6, 0x2d, 0x2b, 0x71, 0x85, 0x63, 0x39, 0xfa, 0xbc, 0x19, 0x7c, 0xe2, 0x3a, 0x81, 0xf1, 0x86, 0x9e, 0x46, + 0x3d, 0x5f, 0x71, 0xa4, 0xb7, 0xd4, 0x2c, 0x98, 0xfa, 0xb5, 0x95, 0xac, 0x33, 0x1a, 0x53, 0x9d, 0xe3, 0x4e, 0x5d, 0x4f, + 0x54, 0x0d, 0xe8, 0xa4, 0x32, 0x25, 0x4d, 0x5e, 0x4c, 0xe1, 0xae, 0x46, 0x85, 0x1e, 0xc4, 0x20, 0xdf, 0x73, 0x1e, 0x81, + 0x40, 0xa2, 0x33, 0x75, 0x1e, 0x1d, 0x1d, 0x7c, 0x1f, 0x07, 0xe5, 0x9e, 0x76, 0x9f, 0x42, 0xeb, 0xc4, 0xb4, 0xd3, 0xcb, + 0x55, 0xe8, 0xbf, 0xf7, 0xeb, 0x7c, 0x2d, 0xa5, 0xfd, 0xda, 0xb4, 0x5b, 0x1f, 0xa8, 0xd2, 0xeb, 0xdf, 0xd9, 0xf2, 0x35, + 0xc6, 0x0c, 0x36, 0x66, 0x28, 0x95, 0xe2, 0x34, 0x64, 0xea, 0xaf, 0x3a, 0x36, 0x3c, 0x38, 0x31, 0x99, 0x8d, 0x80, 0x78, + 0x18, 0x48, 0x2c, 0xe9, 0xe5, 0xb7, 0xe6, 0x2e, 0x73, 0xf1, 0x7c, 0x84, 0x21, 0x04, 0x00, 0x8e, 0x12, 0x66, 0x6c, 0x9b, + 0x09, 0x88, 0xe2, 0xd5, 0xec, 0xb4, 0xdd, 0x2b, 0xda, 0x29, 0x6f, 0x1b, 0x81, 0x21, 0xe4, 0x5c, 0x36, 0x73, 0x2d, 0x9d, + 0xdd, 0xb6, 0x69, 0x21, 0x40, 0x4e, 0x70, 0xde, 0x9d, 0x0c, 0x17, 0x1d, 0x15, 0x29, 0x5b, 0xd0, 0x66, 0x72, 0xb8, 0x38, + 0x80, 0xbe, 0x9e, 0xd7, 0x5e, 0xb5, 0x72, 0x22, 0xbc +}; + +extern const uint8 rledata[] = { + 0x01, 0x09, 0x04, 0x00, 0x00, 0x7d, 0x3a, 0x97, 0x63, 0x8b, 0xbf, 0xe5, 0x6e, 0x0e, 0xc4, 0xac, 0xdc, 0x84, 0xd7, 0x68, + 0xf1, 0x4d, 0xcb, 0xaf, 0x1e, 0x5a, 0x29, 0x40, 0x87, 0x80, 0x3f, 0xf9, 0xb8, 0xad, 0x01, 0xd3, 0x79, 0x3d, 0xe9, 0x87, + 0xa8, 0x95, 0x68, 0xc0, 0xc2, 0x3d, 0x15, 0x87, 0xdb, 0xa6, 0x90, 0x8c, 0x26, 0x98, 0x2a, 0x3f, 0x2e, 0x0c, 0x82, 0x43, + 0x00, 0x10, 0x6d, 0x60, 0xb9, 0xd4, 0xed, 0xf1, 0x49, 0xbb, 0xf6, 0x7f, 0x21, 0x24, 0xc3, 0xfb, 0x42, 0xe1, 0xfc, 0xb8, + 0x82, 0x5e, 0x01, 0x5d, 0x96, 0x2d, 0x0f, 0x48, 0x12, 0xdf, 0x4b, 0x6c, 0x7e, 0x99, 0x01, 0xfa, 0x46, 0x7d, 0x2c, 0xeb, + 0xd6, 0xf3, 0x77, 0xa3, 0x85, 0x8e, 0x00, 0x34, 0xee, 0x73, 0x31, 0x76, 0x53, 0x17, 0x5a, 0x2b, 0x19, 0x65, 0x2f, 0x32, + 0x99, 0x57, 0xc4, 0xf8, 0x05, 0x0d, 0xc3, 0x59, 0x29, 0x9a, 0x19, 0x3c, 0x7d, 0x33, 0x58, 0x8c, 0xd1, 0x1f, 0x3b, 0xa5, + 0x66, 0xa7, 0xfc, 0x7c, 0x99, 0xa9, 0x1a, 0x5e, 0x65, 0x92, 0x9e, 0x71, 0x27, 0x07, 0xbc, 0x71, 0xed, 0xe5, 0xc6, 0x0e, + 0x74, 0xdb, 0x15, 0x91, 0xd7, 0xff, 0xf7, 0x30, 0x6e, 0x6a, 0x00, 0x40, 0x0e, 0x76, 0x8a, 0xb2, 0x31, 0xa3, 0x81, 0x83, + 0xc8, 0xed, 0x08, 0x1f, 0xe5, 0x8d, 0x13, 0x3e, 0x9a, 0xca, 0x9c, 0xd4, 0x01, 0x28, 0xe6, 0xaf, 0xd6, 0x2f, 0xbc, 0xe1, + 0xb7, 0xbb, 0x48, 0x88, 0x86, 0x19, 0xbb, 0x52, 0xfc, 0x18, 0xc9, 0xe3, 0x90, 0x88, 0x6c, 0x54, 0x53, 0x08, 0x26, 0xff, + 0x38, 0xe3, 0x5e, 0x06, 0xa1, 0xac, 0xc2, 0x83, 0x23, 0x0d, 0x42, 0xe6, 0xa9, 0x81, 0x38, 0x0b, 0x4f, 0x16, 0x2a, 0x77, + 0x3b, 0x24, 0xfb, 0x94, 0x53, 0x78, 0x6a, 0xf3, 0x17, 0x6a, 0x60, 0x44, 0x58, 0x5c, 0x50, 0x80, 0xc8, 0x0f, 0x87, 0x7d, + 0x7b, 0x95, 0x0a, 0xdc, 0xf1, 0x1a, 0x6a, 0xa3, 0xff, 0x79, 0xda, 0x14, 0xd4, 0x6c, 0x7a, 0xfd, 0x7e, 0x1e, 0xfe, 0xd2, + 0x28, 0xd0, 0x06, 0x95, 0x40, 0x80, 0xa1, 0x84, 0xc9, 0xc0, 0x4b, 0xa5, 0x97, 0xb2, 0xb9, 0x20, 0x27, 0x94, 0x87, 0x91, + 0xba, 0xb2, 0xc6, 0xdb, 0x78, 0x19, 0x40, 0x35, 0x9f, 0xbd, 0xfb, 0xc1, 0x45, 0xbe, 0xdc, 0x30, 0xad, 0x38, 0xd4, 0x14, + 0x46, 0x98, 0x2a, 0x90, 0xc8, 0x85, 0x5e, 0x7e, 0x76, 0x0f, 0xc4, 0x20, 0x07, 0x54, 0x1a, 0x60, 0x3a, 0x8c, 0x75, 0xb0, + 0x43, 0xab, 0xbb, 0x05, 0xca, 0x93, 0xeb, 0x18, 0x94, 0xf1, 0x64, 0x8a, 0x01, 0xe0, 0xe6, 0x24, 0x78, 0x50, 0x93, 0xd3, + 0xb9, 0xe1, 0xbf, 0x1c, 0xb0, 0x5c, 0xad, 0x94, 0x17, 0x8a, 0xd1, 0xef, 0x66, 0x08, 0xa7, 0x08, 0x6d, 0x6a, 0xb7, 0x06, + 0x31, 0xa6, 0x9d, 0xe5, 0xb2, 0xd8, 0x7b, 0xf9, 0xa6, 0xf2, 0xe1, 0x63, 0xba, 0x36, 0x7a, 0x53, 0xc0, 0x22, 0x40, 0x3e, + 0xa1, 0x95, 0xe5, 0xae, 0x8c, 0x35, 0x7d, 0x34, 0xae, 0x0c, 0x69, 0x8a, 0x0e, 0xd4, 0x53, 0x19, 0xc9, 0x90, 0x78, 0x36, + 0x38, 0xc8, 0xa0, 0xc6, 0x49, 0xef, 0xe3, 0xb2, 0x1d, 0x7c, 0xd3, 0x38, 0x33, 0x51, 0x69, 0x2b, 0xd2, 0x8e, 0xa8, 0x6d, + 0x9c, 0x01, 0x06, 0x9f, 0x93, 0xa5, 0x13, 0x86, 0x67, 0x72, 0x3e, 0xc7, 0x38, 0x97, 0xe6, 0x1d, 0xce, 0x61, 0x5a, 0x57, + 0x10, 0xf7, 0x49, 0x32, 0xea, 0x8f, 0xce, 0x37, 0xea, 0x38, 0x65, 0x76, 0x86, 0xf4, 0x63, 0x9c, 0x44, 0xe6, 0x4c, 0x7b, + 0x3f, 0x9b, 0x61, 0xf7, 0xb4, 0x2a, 0x7a, 0x9c, 0x03, 0x29, 0xf3, 0x6f, 0xff, 0x76, 0x1a, 0xb8, 0x21, 0xd7, 0xd0, 0xbf, + 0x10, 0x1e, 0x82, 0x96, 0x9f, 0xe3, 0xc4, 0xcf, 0x19, 0x39, 0xd0, 0xff, 0x4b, 0x7d, 0xa4, 0x7e, 0xd7, 0x4e, 0x3b, 0x2c, + 0x0c, 0x35, 0xe1, 0xd4, 0x45, 0x10, 0x28, 0x67, 0x18, 0xdc, 0x2d, 0x77, 0x68, 0xf2, 0x39, 0x87, 0x52, 0xd7, 0xd1, 0x50, + 0x04, 0x45, 0xf6, 0x1d, 0xb8, 0x9d, 0xfa, 0xe8, 0xd8, 0x94, 0xe0, 0xae, 0x31, 0x66, 0xc7, 0xee, 0xa9, 0xa8, 0x51, 0xe9, + 0x14, 0x67, 0x53, 0x4c, 0x40, 0xf6, 0xee, 0x50, 0x67, 0x57, 0xf4, 0xd8, 0xd1, 0x95, 0x17, 0x2c, 0x5a, 0x72, 0x8f, 0xdc, + 0xeb, 0x6c, 0x9b, 0x24, 0xfc, 0x67, 0x11, 0x07, 0x82, 0x2a, 0xae, 0xfb, 0xd9, 0xfd, 0x89, 0x75, 0x71, 0x75, 0x74, 0x08, + 0x0d, 0xf7, 0xba, 0x5d, 0x56, 0xdf, 0x7e, 0x52, 0x5b, 0xce, 0xef, 0xeb, 0xf6, 0x32, 0x11, 0x93, 0x5f, 0xab, 0xfe, 0x08, + 0xec, 0x20, 0x18, 0x0a, 0x4e, 0xc5, 0xb6, 0x42, 0xe4, 0x70, 0xbb, 0xba, 0x1b, 0xec, 0x01, 0x9c, 0xe5, 0x1c, 0xf4, 0xd2, + 0x7d, 0x68, 0x0b, 0x30, 0x2d, 0xec, 0xda, 0x23, 0xff, 0xbd, 0x95, 0x46, 0x55, 0x59, 0xab, 0x03, 0x0f, 0xe4, 0xeb, 0x8c, + 0xca, 0xc1, 0x13, 0x28, 0x49, 0x12, 0x66, 0xd7, 0x85, 0xcb, 0x21, 0x8d, 0x8a, 0x34, 0x4c, 0x2e, 0x28, 0x25, 0x79, 0xbf, + 0x98, 0x04, 0xcd, 0x8a, 0x3e, 0xad, 0x08, 0xd3, 0x21, 0x32, 0xed, 0x54, 0x7e, 0x17, 0xfe, 0x89, 0xe9, 0x09, 0x18, 0xac, + 0x96, 0xda, 0x51, 0x61, 0x85, 0x44, 0xd2, 0xdf, 0xd9, 0x61, 0xa2, 0x44, 0x07, 0x29, 0xa5, 0xdc, 0x16, 0xac, 0x3d, 0x6e, + 0x27, 0xb6, 0x5a, 0x15, 0x87, 0x6c, 0x48, 0x3e, 0x34, 0xdd, 0xec, 0xf2, 0x7c, 0xc6, 0x87, 0x0f, 0xcf, 0xac, 0xde, 0x42, + 0x02, 0x93, 0xff, 0x4f, 0x10, 0x0f, 0x03, 0xf3, 0x1b, 0x1e, 0xaf, 0x94, 0x8e, 0x77, 0x7c, 0x66, 0x65, 0xfb, 0xd9, 0x0d, + 0xf8, 0x36, 0x0c, 0xac, 0xdc, 0x8e, 0xd1, 0x2d, 0x1e, 0x19, 0xa8, 0x87, 0x97, 0x39, 0x77, 0x98, 0x6c, 0xfb, 0x5d, 0xc1, + 0x09, 0x7e, 0x5d, 0xab, 0xde, 0xdc, 0x1f, 0x21, 0xd0, 0x7a, 0xaa, 0xeb, 0x96, 0x60, 0xf9, 0x95, 0xed, 0x13, 0xf4, 0x82, + 0xa9, 0x94, 0x7e, 0xa8, 0x5e, 0xe2, 0xca, 0x08, 0xed, 0xfe, 0x9d, 0x94, 0x3f, 0x08, 0xff, 0xd8, 0x5f, 0x9d, 0xb0, 0x84, + 0xd6, 0x6a, 0xcb, 0xc1, 0xd4, 0xd0, 0xe8, 0xe7, 0xae, 0x44, 0x28, 0x47, 0x75, 0xa6, 0x2a, 0x40, 0x0b, 0x82, 0x57, 0xd5, + 0x49, 0x40, 0x85, 0x5c, 0x92, 0x95, 0x6b, 0x7d, 0xbe, 0xcc, 0xb6, 0x2d, 0x2b, 0x71, 0x85, 0x63, 0x39, 0xfa, 0xbc, 0x19, + 0x7c, 0xe2, 0x3a, 0x81, 0xf1, 0x86, 0x9e, 0x46, 0x3d, 0x5f, 0x71, 0xa4, 0xb7, 0xd4, 0x2c, 0x98, 0xfa, 0xb5, 0x95, 0xac, + 0x33, 0x1a, 0x53, 0x9d, 0xe3, 0x4e, 0x5d, 0x4f, 0x54, 0x0d, 0xe8, 0xa4, 0x32, 0x25, 0x4d, 0x5e, 0x4c, 0xe1, 0xae, 0x46, + 0x85, 0x1e, 0xc4, 0x20, 0xdf, 0x73, 0x1e, 0x81, 0x40, 0xa2, 0x33, 0x75, 0x1e, 0xff, 0x1d, 0x79, 0x7c, 0x1f, 0x07, 0xe5, + 0x9e, 0x76, 0x9f, 0x42, 0xeb, 0xc4, 0xb4, 0xd3, 0xcb, 0x55, 0xe8, 0xbf, 0xf7, 0xeb, 0x7c, 0x2d, 0xa5, 0xfd, 0xda, 0xb4, + 0x5b, 0x1f, 0xa8, 0xd2, 0xeb, 0xdf, 0xd9, 0xf2, 0x35, 0xc6, 0x0c, 0x36, 0x66, 0x28, 0x95, 0xe2, 0x34, 0x64, 0xea, 0xaf, + 0x3a, 0x36, 0x3c, 0x38, 0x31, 0x99, 0x8d, 0x80, 0x78, 0x18, 0x48, 0x2c, 0xe9, 0xe5, 0xb7, 0xe6, 0x2e, 0x73, 0xf1, 0x7c, + 0x84, 0x21, 0x04, 0x00, 0x8e, 0x12, 0x66, 0x6c, 0x9b, 0x09, 0x88, 0xe2, 0xd5, 0xec, 0xb4, 0xdd, 0x2b, 0xda, 0x29, 0x6f, + 0x1b, 0x81, 0x21, 0xe4, 0x5c, 0x36, 0x73, 0x2d, 0x9d, 0xdd, 0xb6, 0x69, 0x21, 0x40, 0x4e, 0x70, 0xde, 0x9d, 0x0c, 0x17, + 0x1d, 0x15, 0x29, 0x5b, 0xd0, 0x66, 0x72, 0xb8, 0x38, 0x80, 0xbe, 0x9e, 0xd7, 0x5e, 0xb5, 0x72, 0x22, 0xbc +}; + +extern const uint8 rlecompresseddata[] = { + 0x02, 0x98, 0x07, 0x00, 0x00, 0x7d, 0xff, 0x3a, 0xff, 0x97, 0xff, 0x63, 0xff, 0x8b, 0xff, 0xbf, 0xff, 0xe5, 0xff, 0x6e, + 0xff, 0x0e, 0xff, 0xc4, 0xff, 0xac, 0xff, 0xdc, 0xff, 0x84, 0xff, 0xd7, 0xff, 0x68, 0xff, 0xf1, 0xff, 0x4d, 0xff, 0xcb, + 0xff, 0xaf, 0xff, 0x1e, 0xff, 0x5a, 0xff, 0x29, 0xff, 0x40, 0xff, 0x87, 0xff, 0x80, 0xff, 0x3f, 0xff, 0xf9, 0xff, 0xb8, + 0xff, 0xad, 0xff, 0x01, 0xff, 0xd3, 0xff, 0x79, 0xff, 0x3d, 0xff, 0xe9, 0xa8, 0xff, 0xa8, 0xff, 0x95, 0x48, 0xff, 0xc0, + 0xff, 0xc2, 0xc0, 0xff, 0x15, 0x68, 0xff, 0xdb, 0xff, 0xa6, 0xff, 0x90, 0xff, 0x8c, 0xff, 0x26, 0xff, 0x98, 0xff, 0x2a, + 0x38, 0xff, 0x2e, 0xff, 0x0c, 0xff, 0x82, 0xff, 0x43, 0xff, 0x00, 0xff, 0x10, 0xff, 0x6d, 0xff, 0x60, 0xff, 0xb9, 0xff, + 0xd4, 0xff, 0xed, 0xff, 0xf1, 0xff, 0x49, 0xff, 0xbb, 0xff, 0xf6, 0xff, 0x7d, 0x7f, 0xff, 0x21, 0xff, 0x24, 0xff, 0xc3, + 0xff, 0xfb, 0xff, 0x42, 0xff, 0xe1, 0xff, 0xfc, 0xff, 0xb8, 0x50, 0xff, 0x5e, 0xff, 0x01, 0xff, 0x5d, 0xff, 0x96, 0xff, + 0x2d, 0xff, 0x0f, 0xff, 0x48, 0xff, 0x12, 0xff, 0xdf, 0xff, 0x4b, 0xff, 0x6c, 0xff, 0x7e, 0xff, 0x99, 0xa0, 0xff, 0xfa, + 0xff, 0x46, 0xff, 0x7d, 0xff, 0x2c, 0xff, 0xeb, 0xff, 0xd6, 0xff, 0xf3, 0xff, 0x77, 0xff, 0xa3, 0xff, 0x85, 0xff, 0x8e, + 0xff, 0x00, 0xff, 0x34, 0xff, 0xee, 0xff, 0x73, 0xff, 0x31, 0xff, 0x76, 0xff, 0x53, 0xff, 0x17, 0xff, 0x5a, 0xff, 0x2b, + 0xff, 0x19, 0xff, 0x65, 0xff, 0x2f, 0xff, 0x32, 0x28, 0xff, 0x57, 0xff, 0xc4, 0xff, 0xf8, 0xff, 0x05, 0xff, 0x0d, 0xff, + 0xc3, 0xff, 0x59, 0xff, 0x29, 0xff, 0x9a, 0x90, 0xff, 0x3c, 0xff, 0x33, 0xff, 0x58, 0xff, 0x8c, 0xff, 0xd1, 0xff, 0x33, + 0x1f, 0xff, 0x3b, 0xff, 0xa5, 0xff, 0x66, 0xff, 0xa7, 0xff, 0xfc, 0xff, 0x7c, 0x48, 0xff, 0xa9, 0xff, 0x1a, 0xff, 0x5e, + 0x10, 0xff, 0x92, 0xff, 0x9e, 0xff, 0x71, 0xff, 0x27, 0xff, 0x07, 0xff, 0xbc, 0xe0, 0xff, 0xed, 0xff, 0xe5, 0xff, 0xc6, + 0xff, 0x0e, 0xff, 0x74, 0xff, 0xdb, 0xff, 0x15, 0xff, 0x91, 0xff, 0xd7, 0xfe, 0xff, 0x63, 0xf7, 0xff, 0x30, 0xff, 0x6e, + 0xff, 0x6a, 0xff, 0x00, 0xff, 0x40, 0x98, 0xff, 0x76, 0xff, 0x8a, 0xff, 0xb2, 0xff, 0x31, 0xff, 0xa3, 0xff, 0x81, 0xff, + 0x83, 0xff, 0xc8, 0x38, 0xff, 0x08, 0xff, 0x1f, 0x28, 0xff, 0x8d, 0xff, 0x13, 0xff, 0x3e, 0xff, 0x9a, 0xff, 0xca, 0xff, + 0x9c, 0xff, 0xd4, 0xff, 0x01, 0xff, 0x28, 0xff, 0xe6, 0xff, 0xaf, 0xff, 0xd6, 0xff, 0x2f, 0xff, 0xbc, 0xff, 0xe1, 0xff, + 0xb7, 0xff, 0xbb, 0xff, 0x48, 0xff, 0x88, 0xff, 0x86, 0xff, 0x19, 0xd8, 0xff, 0x52, 0xff, 0xfc, 0xff, 0x18, 0xff, 0xc9, + 0xff, 0xe3, 0xff, 0x90, 0xb0, 0xff, 0x6c, 0xff, 0x54, 0xff, 0x53, 0xff, 0x08, 0xff, 0x26, 0xfe, 0xff, 0x57, 0x38, 0xb0, + 0xff, 0x5e, 0xff, 0x06, 0xff, 0xa1, 0xff, 0xac, 0xff, 0xc2, 0xff, 0x83, 0xff, 0x23, 0xff, 0x0d, 0xff, 0x42, 0xff, 0xe6, + 0xff, 0xa9, 0xff, 0x81, 0x90, 0xff, 0x0b, 0xff, 0x4f, 0xff, 0x16, 0xff, 0x2a, 0xff, 0x77, 0xff, 0x3b, 0xff, 0x24, 0xff, + 0xfb, 0xff, 0x94, 0x20, 0xff, 0x78, 0xff, 0x6a, 0xff, 0xf3, 0xff, 0x17, 0xe8, 0xff, 0x60, 0xff, 0x44, 0xff, 0x58, 0xff, + 0x5c, 0xff, 0x50, 0xff, 0x80, 0xff, 0xc8, 0xff, 0x0f, 0xff, 0x87, 0xff, 0x7b, 0xff, 0x95, 0xff, 0x0a, 0xff, 0xdc, 0xff, + 0xf1, 0xff, 0x1a, 0x68, 0xff, 0xa3, 0xfe, 0xff, 0x7d, 0x79, 0xff, 0xda, 0xff, 0x14, 0xff, 0xd4, 0xff, 0x6c, 0xff, 0x7a, + 0xff, 0xfd, 0xff, 0x7e, 0xff, 0x1e, 0xff, 0xfe, 0xff, 0xd2, 0xff, 0x28, 0xff, 0xd0, 0xff, 0x06, 0x50, 0xff, 0x40, 0x18, + 0xff, 0xa1, 0xff, 0x84, 0xff, 0xc9, 0xff, 0xc0, 0xff, 0x4b, 0xff, 0xa5, 0xff, 0x97, 0xff, 0xb2, 0xff, 0xb9, 0xff, 0x20, + 0xff, 0x27, 0xff, 0x94, 0xff, 0x87, 0xff, 0x91, 0xff, 0xba, 0xc0, 0xff, 0xc6, 0xff, 0xdb, 0xff, 0x78, 0xff, 0x19, 0x50, + 0xff, 0x35, 0xff, 0x9f, 0xff, 0xbd, 0xff, 0xfb, 0xff, 0xc1, 0xff, 0x45, 0xff, 0xbe, 0xff, 0xdc, 0xff, 0x30, 0xff, 0xad, + 0xff, 0x38, 0xff, 0xd4, 0xff, 0x14, 0xff, 0x46, 0xff, 0x98, 0xff, 0x2a, 0xff, 0x90, 0xff, 0xc8, 0xff, 0x85, 0xff, 0x5e, + 0xff, 0x7e, 0xff, 0x76, 0xff, 0x0f, 0xff, 0xc4, 0xff, 0x20, 0xff, 0x07, 0xff, 0x54, 0xff, 0x7d, 0x1a, 0xff, 0x60, 0xff, + 0x3a, 0xff, 0x8c, 0xff, 0x75, 0xff, 0xb0, 0xff, 0x43, 0xff, 0xab, 0xff, 0xbb, 0xff, 0x05, 0xff, 0xca, 0xff, 0x93, 0xff, + 0xeb, 0xff, 0x18, 0xff, 0x94, 0xff, 0xf1, 0xff, 0x64, 0xff, 0x8a, 0xff, 0x01, 0xff, 0xe0, 0xff, 0xe6, 0xff, 0x24, 0xff, + 0x78, 0xff, 0x50, 0x98, 0xff, 0xd3, 0xff, 0xb9, 0xff, 0xe1, 0xff, 0xbf, 0xff, 0x1c, 0x38, 0xff, 0x5c, 0xff, 0xad, 0x68, + 0xff, 0x17, 0x70, 0xff, 0xd1, 0xff, 0xef, 0xff, 0x66, 0xff, 0x08, 0xff, 0xa7, 0xf0, 0xff, 0x6d, 0xff, 0x6a, 0xff, 0xb7, + 0xff, 0x06, 0xff, 0x31, 0xff, 0xa6, 0xff, 0x9d, 0xff, 0xe5, 0xff, 0xb2, 0xff, 0xd8, 0xff, 0xf9, 0xd0, 0xff, 0xf2, 0x20, + 0xff, 0x63, 0xff, 0xba, 0xff, 0x36, 0xff, 0x7a, 0xff, 0x53, 0xff, 0xc0, 0xff, 0x22, 0xff, 0x40, 0xff, 0x3e, 0xff, 0xa1, + 0xff, 0x95, 0x7d, 0x70, 0xff, 0xae, 0xff, 0x8c, 0xff, 0x35, 0xff, 0x7d, 0xff, 0x34, 0xd8, 0xff, 0x0c, 0xff, 0x69, 0xff, + 0x8a, 0xff, 0x0e, 0xff, 0xd4, 0x68, 0xff, 0x19, 0xff, 0xc9, 0xff, 0x90, 0xff, 0x78, 0x30, 0xff, 0x38, 0xff, 0xc8, 0xff, + 0xa0, 0xff, 0xc6, 0xff, 0x49, 0xff, 0xef, 0xff, 0xe3, 0xff, 0xb2, 0xff, 0x1d, 0xff, 0x7c, 0xff, 0xd3, 0xa8, 0xff, 0x33, + 0xff, 0x51, 0x40, 0xff, 0x2b, 0xff, 0xd2, 0xff, 0x8e, 0xff, 0xa8, 0xff, 0x6d, 0xff, 0x9c, 0xff, 0x01, 0xff, 0x06, 0xff, + 0x9f, 0xff, 0x93, 0xff, 0xa5, 0xff, 0x13, 0xff, 0x86, 0xff, 0x67, 0xff, 0x72, 0xff, 0x3e, 0xff, 0xc7, 0x00, 0xff, 0x97, + 0xff, 0xe6, 0x28, 0xff, 0xce, 0xff, 0x61, 0xff, 0x5a, 0xff, 0x57, 0xff, 0x10, 0xff, 0xf7, 0xff, 0x49, 0xff, 0x32, 0xff, + 0xea, 0xff, 0x8f, 0xb0, 0xff, 0x37, 0xe0, 0x78, 0xff, 0x25, 0x65, 0xff, 0x76, 0x38, 0xff, 0xf4, 0xff, 0x63, 0xff, 0x9c, + 0xff, 0x44, 0x48, 0xff, 0x4c, 0xff, 0x7b, 0xff, 0x3f, 0xff, 0x9b, 0x38, 0x50, 0xff, 0xb4, 0xff, 0x2a, 0xff, 0x7a, 0xa0, + 0xff, 0x03, 0xff, 0x29, 0xff, 0xf3, 0xff, 0x6f, 0xff, 0xff, 0x7d, 0x50, 0xff, 0x1a, 0xff, 0xb8, 0xff, 0x21, 0xff, 0xd7, + 0xff, 0xd0, 0xff, 0xbf, 0xff, 0x10, 0xff, 0x1e, 0xff, 0x82, 0xff, 0x96, 0xff, 0x9f, 0xff, 0xe3, 0xff, 0xc4, 0xff, 0xcf, + 0xff, 0x19, 0xff, 0x39, 0xa0, 0xff, 0x4b, 0xf8, 0xff, 0xa4, 0xff, 0x7e, 0x70, 0xff, 0x4e, 0xff, 0x3b, 0xff, 0x2c, 0xff, + 0x0c, 0xff, 0x35, 0xff, 0xe1, 0xff, 0xd4, 0xff, 0x45, 0x40, 0xff, 0x28, 0xff, 0x67, 0xff, 0x18, 0xff, 0xdc, 0xff, 0x2d, + 0xff, 0x77, 0xff, 0x68, 0xff, 0xf2, 0x40, 0xff, 0x87, 0xff, 0x52, 0x58, 0xff, 0xd1, 0xff, 0x50, 0xff, 0x04, 0x78, 0xff, + 0xf6, 0xff, 0x1d, 0xff, 0xb8, 0xff, 0x9d, 0xff, 0xfa, 0xff, 0xe8, 0xff, 0xd8, 0xff, 0x94, 0xff, 0xe0, 0xff, 0xae, 0xff, + 0x31, 0xff, 0x66, 0xff, 0xc7, 0xff, 0xee, 0xff, 0xa9, 0xff, 0xa8, 0xff, 0x51, 0xff, 0xe9, 0xff, 0x14, 0x7d, 0xff, 0x67, + 0xff, 0x53, 0xff, 0x4c, 0xff, 0x40, 0x48, 0xa8, 0x20, 0xc8, 0xff, 0x57, 0xff, 0xf4, 0x48, 0xff, 0xd1, 0xff, 0x95, 0xff, + 0x17, 0xff, 0x2c, 0xff, 0x5a, 0xff, 0x72, 0xff, 0x8f, 0xff, 0xdc, 0xff, 0xeb, 0xff, 0x6c, 0xff, 0x9b, 0xff, 0x24, 0xff, + 0xfc, 0x40, 0xff, 0x11, 0xff, 0x07, 0xff, 0x82, 0xff, 0x2a, 0xff, 0xae, 0xff, 0xfb, 0xff, 0xd9, 0xff, 0xfd, 0xff, 0x89, + 0xff, 0x75, 0xff, 0x71, 0xf0, 0xff, 0x74, 0xff, 0x08, 0xff, 0x0d, 0xff, 0xf7, 0xff, 0xba, 0xff, 0x5d, 0xff, 0x56, 0xff, + 0xdf, 0xff, 0x7e, 0xff, 0x52, 0xff, 0x5b, 0xff, 0xce, 0xff, 0xef, 0x08, 0xff, 0xf6, 0xff, 0x32, 0x20, 0xff, 0x93, 0xff, + 0x5f, 0xff, 0xab, 0xff, 0xfe, 0x60, 0xff, 0xec, 0xff, 0x20, 0xff, 0x18, 0xff, 0x0a, 0xff, 0x4e, 0xff, 0xc5, 0xff, 0xb6, + 0xff, 0x42, 0xff, 0xe4, 0x20, 0xff, 0x70, 0xff, 0xbb, 0x18, 0xff, 0x1b, 0x98, 0xff, 0x01, 0xff, 0x9c, 0xff, 0xe5, 0xff, + 0x1c, 0xff, 0xf4, 0xff, 0xd2, 0xff, 0x68, 0xff, 0x0b, 0xff, 0x30, 0xff, 0x2d, 0x40, 0xff, 0xda, 0xff, 0x23, 0xfe, 0xff, + 0x7d, 0xbd, 0xff, 0x95, 0xff, 0x46, 0xff, 0x55, 0xff, 0x59, 0xff, 0xab, 0xff, 0x03, 0xff, 0x0f, 0x20, 0xff, 0xeb, 0xff, + 0x8c, 0xff, 0xca, 0xff, 0xc1, 0xff, 0x13, 0xff, 0x28, 0xff, 0x49, 0xff, 0x12, 0xff, 0x66, 0xff, 0xd7, 0xff, 0x85, 0xff, + 0xcb, 0xff, 0x21, 0xff, 0x8d, 0xff, 0x8a, 0xff, 0x34, 0xff, 0x4c, 0xff, 0x2e, 0x98, 0xff, 0x25, 0xff, 0x79, 0xff, 0xbf, + 0xff, 0x98, 0xff, 0x04, 0xff, 0xcd, 0xa8, 0xff, 0x3e, 0xff, 0xad, 0xff, 0x08, 0xff, 0xd3, 0x70, 0xff, 0x32, 0xff, 0xed, + 0xff, 0x54, 0xff, 0x7e, 0xff, 0x17, 0xff, 0xfe, 0xff, 0x89, 0xff, 0xe9, 0xff, 0x09, 0xff, 0x18, 0xff, 0xac, 0xff, 0x96, + 0xff, 0xda, 0xff, 0x51, 0xff, 0x61, 0xff, 0x85, 0xff, 0x44, 0xff, 0xd2, 0xff, 0xdf, 0xff, 0xd9, 0xd0, 0xff, 0xa2, 0xd0, + 0xff, 0x07, 0xff, 0x29, 0xff, 0xa5, 0xff, 0x31, 0xdc, 0xff, 0x16, 0x70, 0xff, 0x3d, 0xff, 0x6e, 0xff, 0x27, 0xff, 0xb6, + 0xff, 0x5a, 0xff, 0x15, 0xff, 0x87, 0xff, 0x6c, 0xff, 0x48, 0xff, 0x3e, 0xff, 0x34, 0xff, 0xdd, 0xff, 0xec, 0xff, 0xf2, + 0xff, 0x7c, 0xff, 0xc6, 0xb0, 0xff, 0x0f, 0xff, 0xcf, 0x60, 0xff, 0xde, 0xff, 0x42, 0xff, 0x02, 0xff, 0x93, 0xfe, 0xff, + 0x7d, 0x4f, 0xff, 0x10, 0xb0, 0xff, 0x03, 0xff, 0xf3, 0xff, 0x1b, 0xff, 0x1e, 0xff, 0xaf, 0xff, 0x94, 0xff, 0x8e, 0xff, + 0x77, 0x50, 0xff, 0x66, 0xff, 0x65, 0xff, 0xfb, 0xff, 0xd9, 0xff, 0x0d, 0xff, 0xf8, 0xff, 0x36, 0xff, 0x0c, 0x30, 0xff, + 0xdc, 0x98, 0xff, 0xd1, 0x70, 0xff, 0x19, 0xff, 0xa8, 0xff, 0x87, 0xff, 0x97, 0xff, 0x39, 0x60, 0xff, 0x98, 0xff, 0x6c, + 0x68, 0xff, 0x5d, 0xff, 0xc1, 0xff, 0x09, 0xff, 0x7e, 0xe0, 0xff, 0xab, 0xff, 0xde, 0x60, 0xff, 0x1f, 0xff, 0x21, 0xff, + 0xd0, 0xff, 0x7a, 0xff, 0xaa, 0xff, 0xeb, 0xff, 0x96, 0xff, 0x60, 0xff, 0xf9, 0xff, 0x95, 0xff, 0xed, 0xff, 0x13, 0xff, + 0xf4, 0xff, 0x82, 0xff, 0xa9, 0xff, 0x94, 0x58, 0xff, 0xa8, 0xff, 0x5e, 0xff, 0xe2, 0xff, 0xca, 0xff, 0x08, 0xa0, 0xff, + 0xfe, 0xff, 0x9d, 0xb0, 0xff, 0x3f, 0xd0, 0x7d, 0xff, 0xd8, 0xf8, 0xd0, 0xff, 0xb0, 0xff, 0x84, 0xff, 0xd6, 0xff, 0x6a, + 0xff, 0xcb, 0xff, 0xc1, 0xff, 0xd4, 0xff, 0xd0, 0xff, 0xe8, 0xff, 0xe7, 0xff, 0xae, 0xff, 0x44, 0xff, 0x28, 0xff, 0x47, + 0xff, 0x75, 0xff, 0xa6, 0xff, 0x2a, 0xff, 0x40, 0xff, 0x0b, 0xff, 0x82, 0xff, 0x57, 0xff, 0xd5, 0xff, 0x49, 0xd0, 0xff, + 0x85, 0xff, 0x5c, 0xff, 0x92, 0xff, 0x95, 0xff, 0x6b, 0xff, 0x7d, 0xff, 0xbe, 0xff, 0xcc, 0xff, 0xb6, 0xff, 0x2d, 0xff, + 0x2b, 0xff, 0x71, 0xa0, 0xff, 0x63, 0xff, 0x39, 0xff, 0xfa, 0xff, 0xbc, 0xff, 0x19, 0xff, 0x7c, 0xff, 0xe2, 0xff, 0x3a, + 0xff, 0x81, 0xff, 0xf1, 0xff, 0x86, 0xff, 0x9e, 0xff, 0x46, 0xff, 0x3d, 0xff, 0x5f, 0x78, 0xff, 0xa4, 0xff, 0xb7, 0xff, + 0xd4, 0xff, 0x2c, 0xff, 0x98, 0x68, 0xff, 0xb5, 0xff, 0x95, 0xff, 0xac, 0xff, 0x33, 0x7d, 0xff, 0x1a, 0xff, 0x53, 0xff, + 0x9d, 0xff, 0xe3, 0xff, 0x4e, 0xff, 0x5d, 0xff, 0x4f, 0xff, 0x54, 0xff, 0x0d, 0xff, 0xe8, 0x60, 0xff, 0x32, 0xff, 0x25, + 0xff, 0x4d, 0xff, 0x5e, 0xff, 0x4c, 0xff, 0xe1, 0xff, 0xae, 0x00, 0xff, 0x85, 0xff, 0x1e, 0xff, 0xc4, 0xff, 0x20, 0xff, + 0xdf, 0xff, 0x73, 0xd8, 0xff, 0x81, 0xff, 0x40, 0xff, 0xa2, 0x10, 0xff, 0x75, 0xa8, 0xff, 0x1d, 0xf8, 0xff, 0x7c, 0xff, + 0x1f, 0xff, 0x07, 0xff, 0xe5, 0xff, 0x9e, 0xff, 0x76, 0xff, 0x9f, 0xff, 0x42, 0xff, 0xeb, 0x50, 0xff, 0xb4, 0xff, 0xd3, + 0xff, 0xcb, 0xff, 0x55, 0xff, 0xe8, 0xff, 0xbf, 0xff, 0xf7, 0xb8, 0x70, 0xff, 0x2d, 0xff, 0xa5, 0xff, 0xfd, 0xff, 0xda, + 0x98, 0xff, 0x5b, 0x40, 0xff, 0xa8, 0xff, 0xd2, 0x60, 0xff, 0xdf, 0xff, 0xd9, 0xff, 0xf2, 0xff, 0x35, 0xff, 0xc6, 0xff, + 0x0c, 0x7d, 0xff, 0x36, 0xff, 0x66, 0xff, 0x28, 0xff, 0x95, 0xff, 0xe2, 0xff, 0x34, 0xff, 0x64, 0xff, 0xea, 0xff, 0xaf, + 0xff, 0x3a, 0xb0, 0xff, 0x3c, 0xff, 0x38, 0xff, 0x31, 0xff, 0x99, 0xff, 0x8d, 0xff, 0x80, 0xff, 0x78, 0xff, 0x18, 0xff, + 0x48, 0xff, 0x2c, 0xff, 0xe9, 0xff, 0xe5, 0xff, 0xb7, 0xff, 0xe6, 0xff, 0x2e, 0xff, 0x73, 0xff, 0xf1, 0xff, 0x7c, 0xff, + 0x84, 0xff, 0x21, 0xff, 0x04, 0xff, 0x00, 0xff, 0x8e, 0xff, 0x12, 0xff, 0x66, 0xff, 0x6c, 0xff, 0x9b, 0xff, 0x09, 0xff, + 0x88, 0xff, 0xe2, 0xff, 0xd5, 0xff, 0xec, 0xff, 0xb4, 0xff, 0xdd, 0xff, 0x2b, 0xff, 0xda, 0xff, 0x29, 0xff, 0x6f, 0xff, + 0x1b, 0xff, 0x81, 0x58, 0xff, 0xe4, 0xff, 0x5c, 0xff, 0x36, 0x18, 0xff, 0x2d, 0xff, 0x9d, 0x90, 0xff, 0xb6, 0xff, 0x69, + 0x08, 0xff, 0x40, 0xff, 0x4e, 0xff, 0x70, 0xff, 0x27, 0xde, 0xb8, 0xff, 0x0c, 0xff, 0x17, 0xff, 0x1d, 0xff, 0x15, 0x40, + 0xff, 0x5b, 0xff, 0xd0, 0xff, 0x66, 0xff, 0x72, 0xff, 0xb8, 0xff, 0x38, 0xff, 0x80, 0xff, 0xbe, 0xff, 0x9e, 0xff, 0xd7, + 0xff, 0x5e, 0xff, 0xb5, 0xb8, 0xff, 0x22, 0xff, 0xbc +}; + +extern const uint8 rotatedata[] = { + 0x03, 0x00, 0x04, 0x00, 0x00, 0x74, 0xbc, 0x6c, 0xc5, 0x7f, 0x2f, 0xcd, 0x07, 0x89, 0x65, 0x9b, 0x42, 0xaf, 0x43, 0x3e, + 0xa6, 0x97, 0x7d, 0xc3, 0x2d, 0x52, 0x02, 0xf0, 0x40, 0x7e, 0xcf, 0x17, 0xd6, 0x02, 0x9e, 0x2f, 0x9e, 0xd3, 0x3c, 0x15, + 0xca, 0xd0, 0x06, 0x58, 0x9e, 0x2a, 0x3c, 0x7b, 0x53, 0x21, 0x64, 0xc4, 0x4c, 0x54, 0xf9, 0xc5, 0x06, 0x05, 0x1a, 0x00, + 0x08, 0xda, 0x03, 0x37, 0x6a, 0xdb, 0x8f, 0x29, 0xdd, 0xed, 0xfb, 0x24, 0x12, 0x87, 0xdf, 0x48, 0xf0, 0xf9, 0xc5, 0x50, + 0x2f, 0x02, 0xea, 0xd2, 0x96, 0x1e, 0x42, 0x42, 0xef, 0x96, 0x63, 0xcf, 0xcc, 0x02, 0xd7, 0xc8, 0xbe, 0x58, 0x5f, 0xda, + 0xf9, 0xee, 0x1d, 0xb0, 0x47, 0x00, 0xa1, 0xdd, 0xb9, 0x62, 0xb3, 0x6a, 0x8b, 0xb4, 0x59, 0x23, 0xb2, 0x5e, 0x91, 0x33, + 0xab, 0x89, 0xc7, 0xa0, 0x86, 0x87, 0xca, 0x25, 0x4d, 0x32, 0xe1, 0x66, 0x2c, 0x19, 0x8e, 0xe3, 0x9d, 0x4b, 0x33, 0xf4, + 0x7e, 0xf8, 0xcc, 0x35, 0x0d, 0xbc, 0x2b, 0x52, 0x4f, 0xe2, 0x39, 0xe0, 0x5e, 0xe2, 0x6f, 0xbc, 0x63, 0x1c, 0xa3, 0x7b, + 0x8a, 0x23, 0xbe, 0xff, 0xfb, 0x60, 0x73, 0x4d, 0x00, 0x80, 0x70, 0xce, 0x45, 0x65, 0x89, 0x74, 0xc0, 0x07, 0x46, 0xbd, + 0x04, 0x3e, 0x2f, 0xb1, 0x89, 0x7c, 0xd4, 0x59, 0x4e, 0xa9, 0x08, 0x05, 0x73, 0x5f, 0xb6, 0xe5, 0x5e, 0xc3, 0xbd, 0x77, + 0x24, 0x11, 0x34, 0x23, 0xdd, 0xa4, 0xe7, 0x03, 0xe4, 0xc7, 0x84, 0x11, 0x36, 0xa8, 0x9a, 0x01, 0x13, 0xff, 0xc1, 0x7c, + 0x2f, 0x0c, 0x0d, 0x95, 0x61, 0x07, 0x19, 0xa1, 0x21, 0xcd, 0x4d, 0x30, 0x1c, 0x16, 0x7a, 0xc2, 0x15, 0xee, 0xd9, 0x84, + 0xfd, 0x29, 0x9a, 0x0f, 0x35, 0xe7, 0xb8, 0x4d, 0x30, 0x88, 0xc2, 0x8b, 0x28, 0x01, 0x46, 0xe1, 0xc3, 0xf6, 0xac, 0x41, + 0x6e, 0xe3, 0xd0, 0x4d, 0xd1, 0xff, 0xcb, 0x5b, 0x0a, 0xa9, 0x63, 0x4f, 0xfe, 0xfc, 0xf0, 0xdf, 0x69, 0x50, 0x86, 0xc0, + 0xca, 0x80, 0x04, 0x34, 0x42, 0x93, 0x06, 0x69, 0xd2, 0x2f, 0x95, 0x37, 0x10, 0x4e, 0xa4, 0xf0, 0xc8, 0x75, 0x95, 0xd8, + 0xed, 0xf0, 0xc8, 0x08, 0x9a, 0x3f, 0xed, 0x7f, 0xe0, 0x8a, 0xf5, 0x9b, 0x18, 0x5b, 0xc1, 0x9a, 0x0a, 0x8c, 0xc4, 0x45, + 0x48, 0x91, 0x2c, 0xcb, 0x3f, 0xec, 0x78, 0x98, 0x10, 0x0e, 0xa2, 0x43, 0x30, 0x74, 0x64, 0xae, 0x58, 0x86, 0x5d, 0x77, + 0x82, 0x95, 0x9c, 0x7d, 0x0c, 0x29, 0x8f, 0x8c, 0x45, 0x02, 0x07, 0xdc, 0x12, 0xf0, 0x82, 0x72, 0xe9, 0x73, 0x0f, 0xf7, + 0x0e, 0x61, 0xe2, 0xb5, 0x4a, 0x2e, 0x54, 0x3a, 0xf7, 0xcc, 0x40, 0xf4, 0x04, 0xda, 0x53, 0xf6, 0x03, 0x62, 0x35, 0xb3, + 0xf2, 0x65, 0xc6, 0x3f, 0x53, 0xe5, 0x0f, 0x6c, 0x5d, 0x6c, 0xd3, 0x6a, 0x60, 0x44, 0x02, 0xc7, 0xd0, 0x2b, 0x2f, 0xd5, + 0x46, 0x6a, 0xeb, 0x86, 0x57, 0x18, 0x4b, 0x51, 0x07, 0xa9, 0x9a, 0x23, 0xe4, 0x21, 0xc3, 0xc6, 0x1c, 0x91, 0x05, 0xd8, + 0xa4, 0xdf, 0x1f, 0x56, 0x8e, 0xf8, 0x9e, 0x07, 0x99, 0xa2, 0x4b, 0x65, 0x69, 0x1d, 0x45, 0xad, 0x4e, 0x02, 0x30, 0xf3, + 0xc9, 0x4b, 0x98, 0xd0, 0xb3, 0xe4, 0xf1, 0xf8, 0x1c, 0x2f, 0x37, 0xa3, 0x67, 0xc2, 0xd2, 0xea, 0x08, 0xef, 0x4a, 0x46, + 0x75, 0x1f, 0x76, 0xe6, 0x75, 0x70, 0x2b, 0xce, 0x43, 0xe9, 0x1b, 0x93, 0x22, 0xcd, 0x62, 0x6f, 0x9f, 0x37, 0x0b, 0xfe, + 0x5a, 0x54, 0xd3, 0x93, 0x81, 0x52, 0x9f, 0xed, 0xff, 0xec, 0xd0, 0x17, 0x90, 0xaf, 0x86, 0xf7, 0x08, 0x3c, 0x14, 0xd2, + 0xcf, 0xc7, 0x26, 0xf9, 0x8c, 0x72, 0x86, 0x69, 0xa5, 0x49, 0xf3, 0xfa, 0x27, 0x76, 0x61, 0x81, 0x9a, 0xc3, 0xa6, 0xa8, + 0x08, 0x50, 0x3b, 0x03, 0x6e, 0x5a, 0xbb, 0x0d, 0x79, 0x72, 0x3c, 0x4a, 0xeb, 0xa3, 0x82, 0x80, 0xa2, 0xed, 0xe8, 0x17, + 0xce, 0xf5, 0x47, 0x1b, 0x4a, 0xc1, 0x75, 0x26, 0x33, 0x8f, 0x77, 0x35, 0x54, 0xa2, 0x4f, 0x82, 0xb3, 0xa6, 0x62, 0x08, + 0x7b, 0xdd, 0x82, 0xec, 0xab, 0xe9, 0xc6, 0x3a, 0xca, 0x2e, 0x61, 0x4b, 0x39, 0x1f, 0xe6, 0x7d, 0x36, 0x37, 0x21, 0x9f, + 0xb3, 0x22, 0x38, 0x50, 0x15, 0x5d, 0xdf, 0x3b, 0xfe, 0x13, 0xab, 0x2e, 0xba, 0xe8, 0x40, 0xa1, 0xfb, 0x75, 0xea, 0xca, + 0xef, 0xfc, 0x92, 0x6b, 0x67, 0xdf, 0x5f, 0xde, 0x19, 0x22, 0x9c, 0xeb, 0xd5, 0xfd, 0x40, 0x9d, 0x10, 0x30, 0x50, 0xc9, + 0xe2, 0x6d, 0x12, 0x9c, 0x38, 0x77, 0xd5, 0x63, 0x76, 0x02, 0xe4, 0xbc, 0x0e, 0xe9, 0x96, 0x0d, 0x85, 0x60, 0x69, 0x9d, + 0x6d, 0x46, 0xff, 0xb7, 0xca, 0x8c, 0xaa, 0x2b, 0xd5, 0x06, 0x78, 0x9c, 0xf5, 0x19, 0x56, 0x38, 0x89, 0x50, 0x4a, 0x42, + 0x33, 0xaf, 0x2c, 0x79, 0x90, 0x1b, 0x54, 0x86, 0x26, 0x5c, 0x41, 0xa4, 0xbc, 0x7f, 0xc4, 0x80, 0xe6, 0x15, 0xf1, 0xb5, + 0x04, 0xa7, 0x09, 0x46, 0xf6, 0xa8, 0xf3, 0xe2, 0x7f, 0x13, 0x4f, 0x21, 0x0c, 0x59, 0xb4, 0x5b, 0xa8, 0xc2, 0x2c, 0x88, + 0x69, 0xbf, 0xce, 0x2c, 0x51, 0x88, 0x38, 0x25, 0xd2, 0xb9, 0xb0, 0x95, 0x9e, 0xdc, 0x39, 0xd6, 0x2d, 0x2a, 0x3c, 0x8d, + 0x24, 0x7c, 0xa1, 0xbb, 0x76, 0xe5, 0xe3, 0xd8, 0xc3, 0x1e, 0x7e, 0x95, 0x6f, 0x84, 0x10, 0x72, 0xff, 0x9e, 0x80, 0xe1, + 0x81, 0xe7, 0xd8, 0xc3, 0xd7, 0x29, 0x74, 0xee, 0x3e, 0xcc, 0x2b, 0x7f, 0xec, 0x1a, 0xc7, 0xc6, 0x06, 0x59, 0xe6, 0xd1, + 0xe8, 0x3c, 0xc8, 0x15, 0xc3, 0x2f, 0xc9, 0xee, 0x4c, 0xd8, 0xdf, 0xab, 0xe0, 0x12, 0xf3, 0xab, 0xd5, 0xbd, 0xe6, 0xe3, + 0x90, 0xa1, 0xd3, 0x55, 0xf5, 0x2d, 0x03, 0x3f, 0xca, 0xdb, 0x98, 0x9e, 0x41, 0x53, 0xa4, 0xcf, 0x54, 0xbc, 0x17, 0x59, + 0x04, 0xdb, 0xf7, 0xb3, 0x4a, 0x7e, 0x40, 0x1b, 0x6c, 0x3b, 0x85, 0x90, 0x6b, 0xd4, 0x5e, 0x38, 0x6a, 0xa1, 0x47, 0xfc, + 0x57, 0x88, 0x41, 0xe8, 0xba, 0x4d, 0x51, 0x08, 0x85, 0x05, 0xba, 0xba, 0xa4, 0x80, 0x2c, 0x8b, 0x49, 0x2b, 0x5b, 0xaf, + 0x5f, 0x99, 0xb5, 0xa5, 0x95, 0xe2, 0x2c, 0x6c, 0x9c, 0xf5, 0xe5, 0x23, 0x3e, 0xc5, 0xd1, 0x30, 0xf8, 0x0d, 0xf4, 0xc8, + 0x9e, 0xbe, 0x8b, 0x94, 0xdb, 0xa9, 0x61, 0x13, 0x7d, 0x6b, 0xac, 0x95, 0x99, 0x34, 0x9a, 0xb3, 0xf1, 0x9c, 0xea, 0xe9, + 0x2a, 0x1a, 0x47, 0x94, 0x19, 0x4a, 0x6a, 0xcb, 0x26, 0xc3, 0x75, 0xc8, 0xc2, 0x3c, 0x26, 0x04, 0xef, 0xe6, 0xf0, 0x30, + 0x20, 0x45, 0x99, 0xae, 0x0f, 0x3a, 0xe8, 0x8f, 0x8f, 0x0e, 0x2f, 0xd3, 0x3b, 0x3f, 0x12, 0x7d, 0x62, 0x69, 0x9e, 0x79, + 0xaa, 0xd1, 0xfd, 0xfe, 0xf5, 0xf8, 0x69, 0xb4, 0xfe, 0xb5, 0xa5, 0x6b, 0x8f, 0x51, 0x96, 0x7d, 0xef, 0xb3, 0x97, 0xa6, + 0x63, 0x18, 0xb1, 0xcc, 0x14, 0x2b, 0x17, 0x86, 0x32, 0xd5, 0x7d, 0x47, 0x1b, 0x78, 0xc1, 0x26, 0xcc, 0x1b, 0x04, 0x0f, + 0x0c, 0x90, 0x61, 0x3d, 0xf2, 0x6f, 0x37, 0xc5, 0xb9, 0xe3, 0xe3, 0x90, 0x90, 0x08, 0x00, 0xd1, 0x09, 0xcc, 0x63, 0x73, + 0x84, 0x11, 0x17, 0xba, 0x76, 0x69, 0xee, 0x65, 0x6d, 0x52, 0x7b, 0x63, 0xc0, 0x42, 0x27, 0x8b, 0x1b, 0xe6, 0x69, 0xb3, + 0xee, 0x6d, 0x4b, 0x24, 0x20, 0x9c, 0x83, 0xdb, 0xce, 0x18, 0xb8, 0xa3, 0x8a, 0x52, 0xda, 0x1a, 0x33, 0xe4, 0xc5, 0x07, + 0x40, 0x7d, 0xf4, 0xfa, 0x2f, 0x6b, 0x93, 0x44, 0x5e +}; From 729934193c389869a776c31ea4f461c9dc9efcfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Tue, 29 Nov 2016 23:57:30 +0100 Subject: [PATCH 25/62] Improve tests' CMakeLists.txt --- test/tests/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/tests/CMakeLists.txt b/test/tests/CMakeLists.txt index 977522fef2..a16f70fc9d 100644 --- a/test/tests/CMakeLists.txt +++ b/test/tests/CMakeLists.txt @@ -36,12 +36,12 @@ set(GTEST_INCLUDE_DIR ${GOOGLETEST_DISTRIB_SOURCE_DIR}/googletest/include) # Library ExternalProject_Get_Property(googletest BINARY_DIR) set(GOOGLETEST_BINARY_DIR "${BINARY_DIR}") -set(GTEST_LIBRARY_PATH ${GOOGLETEST_BINARY_DIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest.a) -set(GTEST_MAIN_LIBRARY_PATH ${GOOGLETEST_BINARY_DIR}/${CMAKE_FIND_LIBRARY_PREFIXES}gtest_main.a) +set(GTEST_LIBRARY_PATH ${GOOGLETEST_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}) +set(GTEST_MAIN_LIBRARY_PATH ${GOOGLETEST_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest_main${CMAKE_STATIC_LIBRARY_SUFFIX}) set(GTEST_LIBRARY gtest) set(GTEST_MAIN_LIBRARY gtest_main) -add_library(${GTEST_LIBRARY} UNKNOWN IMPORTED) -add_library(${GTEST_MAIN_LIBRARY} UNKNOWN IMPORTED) +add_library(${GTEST_LIBRARY} STATIC IMPORTED) +add_library(${GTEST_MAIN_LIBRARY} STATIC IMPORTED) set_property(TARGET ${GTEST_LIBRARY} PROPERTY IMPORTED_LOCATION ${GTEST_LIBRARY_PATH}) set_property(TARGET ${GTEST_MAIN_LIBRARY} PROPERTY IMPORTED_LOCATION ${GTEST_MAIN_LIBRARY_PATH}) add_dependencies(${GTEST_LIBRARY} googletest) From e3a3cf375d39297b4c729078fd8bd1314a30e0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Wed, 30 Nov 2016 11:51:55 +0100 Subject: [PATCH 26/62] Add LanguagePackTest --- test/tests/CMakeLists.txt | 29 ++++++++++++++--- test/tests/LanguagePackTest.cpp | 55 +++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 test/tests/LanguagePackTest.cpp diff --git a/test/tests/CMakeLists.txt b/test/tests/CMakeLists.txt index a16f70fc9d..8d2c6650ff 100644 --- a/test/tests/CMakeLists.txt +++ b/test/tests/CMakeLists.txt @@ -48,13 +48,32 @@ add_dependencies(${GTEST_LIBRARY} googletest) add_dependencies(${GTEST_MAIN_LIBRARY} ${GTEST_LIBRARY}) include_directories(SYSTEM ${GTEST_INCLUDE_DIR}) +include_directories("../../src") + +set(GTEST_LIBRARIES gtest gtest_main pthread) # Start of our tests +# sawyercoding test + set(SAWYERCODING_TEST_SOURCES "sawyercoding_test.cpp" "../../src/diagnostic.c" "../../src/util/sawyercoding.c" "../../src/localisation/utf8.c") -set (CMAKE_CXX_STANDARD 11) add_executable(test_sawyercoding ${SAWYERCODING_TEST_SOURCES}) -target_link_libraries(test_sawyercoding gtest gtest_main pthread) -target_include_directories(test_sawyercoding PUBLIC "../../src") -add_test(NAME sawyercoding - COMMAND test_sawyercoding) +target_link_libraries(test_sawyercoding ${GTEST_LIBRARIES}) +add_test(NAME sawyercoding COMMAND test_sawyercoding) + +# LanguagePack test +set(LANGUAGEPACK_TEST_SOURCES + "LanguagePackTest.cpp" + "../../src/localisation/LanguagePack.cpp" + "../../src/core/Console.cpp" + "../../src/core/Diagnostics.cpp" + "../../src/core/Guard.cpp" + "../../src/core/String.cpp" + "../../src/diagnostic.c" + "../../src/localisation/format_codes.c" + "../../src/localisation/utf8.c" + "../../src/util/util.c" + ) +add_executable(test_languagepack ${LANGUAGEPACK_TEST_SOURCES}) +target_link_libraries(test_languagepack ${GTEST_LIBRARIES} dl z SDL2 SDL2_ttf ssl crypto) +add_test(NAME languagepack COMMAND test_languagepack) \ No newline at end of file diff --git a/test/tests/LanguagePackTest.cpp b/test/tests/LanguagePackTest.cpp new file mode 100644 index 0000000000..598a7e3558 --- /dev/null +++ b/test/tests/LanguagePackTest.cpp @@ -0,0 +1,55 @@ +#include "localisation/LanguagePack.h" +#include + +TEST(LanguagePackTest, create_empty) +{ + ILanguagePack * empty = LanguagePackFactory::FromText(0, ""); + ASSERT_EQ(empty->GetId(), 0); + ASSERT_EQ(empty->GetCount(), 0); + delete empty; +} + +TEST(LanguagePackTest, create_mutable_id_1) +{ + ILanguagePack * lang = LanguagePackFactory::FromText(1, "STR_0000:\n"); + ASSERT_EQ(lang->GetId(), 1); + ASSERT_EQ(lang->GetCount(), 1); + ASSERT_STREQ(lang->GetString(0), ""); + lang->SetString(0, "xx"); + ASSERT_EQ(lang->GetCount(), 1); + ASSERT_STREQ(lang->GetString(0), "xx"); + delete lang; +} + +extern const utf8 * LanguageEnGB; + +TEST(LanguagePackTest, language_pack_simple) +{ + ILanguagePack * lang = LanguagePackFactory::FromText(0, LanguageEnGB); + ASSERT_EQ(lang->GetId(), 0); + ASSERT_EQ(lang->GetCount(), 4); + ASSERT_STREQ(lang->GetString(2), "Spiral Roller Coaster"); + ASSERT_EQ(lang->GetScenarioOverrideStringId("Arid Heights", 0), 0x7000); + ASSERT_STREQ(lang->GetString(0x7000), "Arid Heights scenario string"); + ASSERT_EQ(lang->GetObjectOverrideStringId("CONDORRD", 0), 0x6000); + ASSERT_STREQ(lang->GetString(0x6000), "my test ride"); + delete lang; +} + +const utf8 * LanguageEnGB = "# STR_XXXX part is read and XXXX becomes the string id number.\n" + "# Everything after the colon and before the new line will be saved as the " + "string.\n" + "# Use # at the beginning of a line to leave a comment.\n" + "STR_0000 :\n" + "STR_0001 :{STRINGID} {COMMA16}\n" + "STR_0002 :Spiral Roller Coaster\n" + "STR_0003 :Stand-up Roller Coaster\n" + "\n" + "STR_SCNR :Arid Heights scenario string\n" + "STR_PARK :Arid Heights park string\n" + "STR_DTLS :Free of any financial limits, your challenge is to develop " + "this desert park while keeping the guests happy\n" + "[CONDORRD]\n" + "STR_NAME :my test ride\n" + "STR_DESC :ride description\n" + "STR_CPTY :ride capacity\n"; From a2d30ac40517008c07cf884bfe0b4885efc365a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 1 Dec 2016 23:21:35 +0100 Subject: [PATCH 27/62] Add multibyte LanguagePack test --- test/tests/LanguagePackTest.cpp | 48 ++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/test/tests/LanguagePackTest.cpp b/test/tests/LanguagePackTest.cpp index 598a7e3558..6d6e0263c2 100644 --- a/test/tests/LanguagePackTest.cpp +++ b/test/tests/LanguagePackTest.cpp @@ -21,7 +21,8 @@ TEST(LanguagePackTest, create_mutable_id_1) delete lang; } -extern const utf8 * LanguageEnGB; +extern const utf8 * LanguageEnGB; +extern const unsigned char LanguageZhTW[]; TEST(LanguagePackTest, language_pack_simple) { @@ -36,6 +37,21 @@ TEST(LanguagePackTest, language_pack_simple) delete lang; } +TEST(LanguagePackTest, language_pack_multibyte) +{ + ILanguagePack * lang = LanguagePackFactory::FromText(0, (const utf8 *)LanguageZhTW); + ASSERT_EQ(lang->GetId(), 0); + ASSERT_EQ(lang->GetCount(), 4); + ASSERT_STREQ(lang->GetString(2), u8"懸吊式雲霄飛車"); + ASSERT_EQ(lang->GetScenarioOverrideStringId("Forest Frontiers", 0), 0x7000); + ASSERT_EQ(lang->GetScenarioOverrideStringId("Forest Frontiers", 2), 0x7002); + ASSERT_STREQ(lang->GetString(0x7000), "Forest Frontiers"); + ASSERT_STREQ(lang->GetString(0x7002), u8"在隱藏於森林深處的清空範圍中, 建造一個很受歡迎的樂園"); + ASSERT_EQ(lang->GetObjectOverrideStringId("CONDORRD", 0), 0x6000); + ASSERT_STREQ(lang->GetString(0x6000), u8"神鷹暢遊"); + delete lang; +} + const utf8 * LanguageEnGB = "# STR_XXXX part is read and XXXX becomes the string id number.\n" "# Everything after the colon and before the new line will be saved as the " "string.\n" @@ -53,3 +69,33 @@ const utf8 * LanguageEnGB = "# STR_XXXX part is read and XXXX becomes the string "STR_NAME :my test ride\n" "STR_DESC :ride description\n" "STR_CPTY :ride capacity\n"; + +// This includes a few entries extracted from zh-TW localisation. +// It has to be declared as `unsigned char`, or else the values overflow signed byte. +const unsigned char LanguageZhTW[] = { + 0x53, 0x54, 0x52, 0x5f, 0x30, 0x30, 0x30, 0x30, 0x20, 0x20, 0x20, 0x20, 0x3a, 0xe8, 0x9e, 0xba, 0xe6, 0x97, 0x8b, 0xe5, + 0xbc, 0x8f, 0xe9, 0x9b, 0xb2, 0xe9, 0x9c, 0x84, 0xe9, 0xa3, 0x9b, 0xe8, 0xbb, 0x8a, 0x0a, 0x53, 0x54, 0x52, 0x5f, 0x30, + 0x30, 0x30, 0x31, 0x20, 0x20, 0x20, 0x20, 0x3a, 0xe7, 0xab, 0x99, 0xe7, 0xab, 0x8b, 0xe5, 0xbc, 0x8f, 0xe9, 0x9b, 0xb2, + 0xe9, 0x9c, 0x84, 0xe9, 0xa3, 0x9b, 0xe8, 0xbb, 0x8a, 0x0a, 0x53, 0x54, 0x52, 0x5f, 0x30, 0x30, 0x30, 0x32, 0x20, 0x20, + 0x20, 0x20, 0x3a, 0xe6, 0x87, 0xb8, 0xe5, 0x90, 0x8a, 0xe5, 0xbc, 0x8f, 0xe9, 0x9b, 0xb2, 0xe9, 0x9c, 0x84, 0xe9, 0xa3, + 0x9b, 0xe8, 0xbb, 0x8a, 0x0a, 0x53, 0x54, 0x52, 0x5f, 0x30, 0x30, 0x30, 0x33, 0x20, 0x20, 0x20, 0x20, 0x3a, 0xe5, 0x8f, + 0x8d, 0xe8, 0xbd, 0x89, 0xe5, 0xbc, 0x8f, 0xe9, 0x9b, 0xb2, 0xe9, 0x9c, 0x84, 0xe9, 0xa3, 0x9b, 0xe8, 0xbb, 0x8a, 0x0a, + 0x3c, 0x46, 0x6f, 0x72, 0x65, 0x73, 0x74, 0x20, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x69, 0x65, 0x72, 0x73, 0x3e, 0x0a, 0x53, + 0x54, 0x52, 0x5f, 0x53, 0x43, 0x4e, 0x52, 0x20, 0x20, 0x20, 0x20, 0x3a, 0x46, 0x6f, 0x72, 0x65, 0x73, 0x74, 0x20, 0x46, + 0x72, 0x6f, 0x6e, 0x74, 0x69, 0x65, 0x72, 0x73, 0x0a, 0x53, 0x54, 0x52, 0x5f, 0x50, 0x41, 0x52, 0x4b, 0x20, 0x20, 0x20, + 0x20, 0x3a, 0x46, 0x6f, 0x72, 0x65, 0x73, 0x74, 0x20, 0x46, 0x72, 0x6f, 0x6e, 0x74, 0x69, 0x65, 0x72, 0x73, 0x0a, 0x53, + 0x54, 0x52, 0x5f, 0x44, 0x54, 0x4c, 0x53, 0x20, 0x20, 0x20, 0x20, 0x3a, 0xe5, 0x9c, 0xa8, 0xe9, 0x9a, 0xb1, 0xe8, 0x97, + 0x8f, 0xe6, 0x96, 0xbc, 0xe6, 0xa3, 0xae, 0xe6, 0x9e, 0x97, 0xe6, 0xb7, 0xb1, 0xe8, 0x99, 0x95, 0xe7, 0x9a, 0x84, 0xe6, + 0xb8, 0x85, 0xe7, 0xa9, 0xba, 0xe7, 0xaf, 0x84, 0xe5, 0x9c, 0x8d, 0xe4, 0xb8, 0xad, 0x2c, 0x20, 0xe5, 0xbb, 0xba, 0xe9, + 0x80, 0xa0, 0xe4, 0xb8, 0x80, 0xe5, 0x80, 0x8b, 0xe5, 0xbe, 0x88, 0xe5, 0x8f, 0x97, 0xe6, 0xad, 0xa1, 0xe8, 0xbf, 0x8e, + 0xe7, 0x9a, 0x84, 0xe6, 0xa8, 0x82, 0xe5, 0x9c, 0x92, 0x0a, 0x5b, 0x43, 0x4f, 0x4e, 0x44, 0x4f, 0x52, 0x52, 0x44, 0x5d, + 0x0a, 0x53, 0x54, 0x52, 0x5f, 0x4e, 0x41, 0x4d, 0x45, 0x20, 0x20, 0x20, 0x20, 0x3a, 0xe7, 0xa5, 0x9e, 0xe9, 0xb7, 0xb9, + 0xe6, 0x9a, 0xa2, 0xe9, 0x81, 0x8a, 0x0a, 0x53, 0x54, 0x52, 0x5f, 0x44, 0x45, 0x53, 0x43, 0x20, 0x20, 0x20, 0x20, 0x3a, + 0xe4, 0xb9, 0x98, 0xe5, 0xae, 0xa2, 0xe4, 0xb9, 0x98, 0xe5, 0x9d, 0x90, 0xe6, 0x96, 0xbc, 0xe8, 0xbb, 0x8c, 0xe9, 0x81, + 0x93, 0xe4, 0xb8, 0x8b, 0xe7, 0x9a, 0x84, 0xe7, 0xa5, 0x9e, 0xe9, 0xb7, 0xb9, 0xe9, 0x80, 0xa0, 0xe5, 0x9e, 0x8b, 0xe5, + 0x88, 0x97, 0xe8, 0xbb, 0x8a, 0xe4, 0xb8, 0x8a, 0x2c, 0x20, 0xe5, 0xb0, 0x87, 0xe6, 0x9c, 0x83, 0xe6, 0x96, 0xbc, 0xe9, + 0xa3, 0x9b, 0xe9, 0xa6, 0xb3, 0xe4, 0xb8, 0xad, 0xe9, 0xab, 0x94, 0xe9, 0xa9, 0x97, 0xe9, 0xa3, 0x9b, 0xe4, 0xb8, 0x80, + 0xe8, 0x88, 0xac, 0xe7, 0x9a, 0x84, 0xe5, 0xbf, 0xab, 0xe6, 0x84, 0x9f, 0x0a, 0x53, 0x54, 0x52, 0x5f, 0x43, 0x50, 0x54, + 0x59, 0x20, 0x20, 0x20, 0x20, 0x3a, 0xe6, 0xaf, 0x8f, 0xe8, 0xbb, 0x8a, 0xe5, 0x8d, 0xa1, 0x34, 0xe4, 0xbd, 0x8d, 0xe4, + 0xb9, 0x98, 0xe5, 0xae, 0xa2, 0x0a, 0x00 +}; \ No newline at end of file From 86a336dd3d71947fe2e3fb544a28dd89f4e0714b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Thu, 1 Dec 2016 23:28:01 +0100 Subject: [PATCH 28/62] Extend LanguagePack test with negative tests --- test/tests/LanguagePackTest.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/tests/LanguagePackTest.cpp b/test/tests/LanguagePackTest.cpp index 6d6e0263c2..355f881746 100644 --- a/test/tests/LanguagePackTest.cpp +++ b/test/tests/LanguagePackTest.cpp @@ -1,4 +1,5 @@ #include "localisation/LanguagePack.h" +#include "localisation/string_ids.h" #include TEST(LanguagePackTest, create_empty) @@ -34,6 +35,10 @@ TEST(LanguagePackTest, language_pack_simple) ASSERT_STREQ(lang->GetString(0x7000), "Arid Heights scenario string"); ASSERT_EQ(lang->GetObjectOverrideStringId("CONDORRD", 0), 0x6000); ASSERT_STREQ(lang->GetString(0x6000), "my test ride"); + // Test some negatives too + ASSERT_EQ(lang->GetString(1000), nullptr); + ASSERT_EQ(lang->GetScenarioOverrideStringId("No such park", 0), STR_NONE); + ASSERT_EQ(lang->GetObjectOverrideStringId(" ", 0), STR_NONE); delete lang; } @@ -98,4 +103,4 @@ const unsigned char LanguageZhTW[] = { 0xe8, 0x88, 0xac, 0xe7, 0x9a, 0x84, 0xe5, 0xbf, 0xab, 0xe6, 0x84, 0x9f, 0x0a, 0x53, 0x54, 0x52, 0x5f, 0x43, 0x50, 0x54, 0x59, 0x20, 0x20, 0x20, 0x20, 0x3a, 0xe6, 0xaf, 0x8f, 0xe8, 0xbb, 0x8a, 0xe5, 0x8d, 0xa1, 0x34, 0xe4, 0xbd, 0x8d, 0xe4, 0xb9, 0x98, 0xe5, 0xae, 0xa2, 0x0a, 0x00 -}; \ No newline at end of file +}; From a08af1a2537a2b1df386cd138c4a424c50fbc6cc Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 00:34:14 +0000 Subject: [PATCH 29/62] Get tests to build for Windows and VS --- openrct2.sln | 14 +++++ openrct2.vcxproj | 8 ++- src/platform/windows.c | 2 +- test/tests/sawyercoding_test.cpp | 3 + test/tests/tests.cpp | 13 ++++ test/tests/tests.vcxproj | 101 +++++++++++++++++++++++++++++++ 6 files changed, 138 insertions(+), 3 deletions(-) create mode 100644 test/tests/tests.cpp create mode 100644 test/tests/tests.vcxproj diff --git a/openrct2.sln b/openrct2.sln index a9f6803221..37c5ec1170 100644 --- a/openrct2.sln +++ b/openrct2.sln @@ -7,6 +7,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openrct2", "openrct2.vcxpro EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testpaint", "test\testpaint\testpaint.vcxproj", "{57E60BA1-FB76-4316-909E-C1449C142327}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "test\tests\tests.vcxproj", "{62B020FA-E4FB-4C6E-B32A-DC999470F155}" + ProjectSection(ProjectDependencies) = postProject + {D24D94F6-2A74-480C-B512-629C306CE92F} = {D24D94F6-2A74-480C-B512-629C306CE92F} + EndProjectSection +EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2202A816-377D-4FA0-A7AF-7D4105F8A4FB}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{480B577D-4E4A-4757-9A42-28A9AD33E6B0}" @@ -33,6 +38,14 @@ Global {57E60BA1-FB76-4316-909E-C1449C142327}.Release|Win32.ActiveCfg = Release|Win32 {57E60BA1-FB76-4316-909E-C1449C142327}.Release|Win32.Build.0 = Release|Win32 {57E60BA1-FB76-4316-909E-C1449C142327}.Release|x64.ActiveCfg = Release|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|Win32.ActiveCfg = Debug|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|Win32.Build.0 = Debug|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|x64.ActiveCfg = Debug|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|x64.Build.0 = Debug|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|Win32.ActiveCfg = Release|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|Win32.Build.0 = Release|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|x64.ActiveCfg = Release|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -40,5 +53,6 @@ Global GlobalSection(NestedProjects) = preSolution {D24D94F6-2A74-480C-B512-629C306CE92F} = {2202A816-377D-4FA0-A7AF-7D4105F8A4FB} {57E60BA1-FB76-4316-909E-C1449C142327} = {480B577D-4E4A-4757-9A42-28A9AD33E6B0} + {62B020FA-E4FB-4C6E-B32A-DC999470F155} = {480B577D-4E4A-4757-9A42-28A9AD33E6B0} EndGlobalSection EndGlobal diff --git a/openrct2.vcxproj b/openrct2.vcxproj index 2e3bfde9eb..202974fbd1 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -563,6 +563,9 @@ true MultiByte + + StaticLibrary + @@ -600,9 +603,10 @@ $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ $(ProjectName) - + - USE_BREAKPAD;%(PreprocessorDefinitions) + USE_BREAKPAD;%(PreprocessorDefinitions) + __NOENTRYPOINT__;%(PreprocessorDefinitions) diff --git a/src/platform/windows.c b/src/platform/windows.c index bdeb7abd57..8fda6936cd 100644 --- a/src/platform/windows.c +++ b/src/platform/windows.c @@ -52,7 +52,7 @@ utf8 **windows_get_command_line_args(int *outNumArgs); static HMODULE _dllModule = NULL; -#ifdef NO_RCT2 +#if defined(NO_RCT2) && !defined(__NOENTRYPOINT__) /** * Windows entry point to OpenRCT2 without a console window. diff --git a/test/tests/sawyercoding_test.cpp b/test/tests/sawyercoding_test.cpp index 2dce17f261..c7105416c5 100644 --- a/test/tests/sawyercoding_test.cpp +++ b/test/tests/sawyercoding_test.cpp @@ -1,3 +1,6 @@ +// Make MSVC shut up about M_PI +#include + extern "C" { #include "util/sawyercoding.h" } diff --git a/test/tests/tests.cpp b/test/tests/tests.cpp new file mode 100644 index 0000000000..bba7cb7be3 --- /dev/null +++ b/test/tests/tests.cpp @@ -0,0 +1,13 @@ +// This serves as the entry point when building for MSVC which compiles gtest +// directly into the test binary. +#ifdef _MSC_VER + +#include + +int main(int argc, char * * argv) +{ + testing::InitGoogleTest(&argc, argv); + RUN_ALL_TESTS(); +} + +#endif diff --git a/test/tests/tests.vcxproj b/test/tests/tests.vcxproj new file mode 100644 index 0000000000..01c1504b55 --- /dev/null +++ b/test/tests/tests.vcxproj @@ -0,0 +1,101 @@ + + + + ..\..\ + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + {62B020FA-E4FB-4C6E-B32A-DC999470F155} + tests + + + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + $(SolutionDir)bin\tests\ + $(SolutionDir)obj\$(ProjectName)\$(Configuration)\ + tests + $(GTestDir)\googletest;$(GTestDir)\googletest\include;$(SolutionDir)src;$(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) + $(SolutionDir)bin;$(SolutionDir)lib;$(LibraryPath) + + + + Level3 + Disabled + true + DEBUG;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + true + true + 4200 + true + false + + + openrct2.lib;openrct2-libs-vs2015-x64.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) + /OPT:NOLBR /ignore:4099 %(AdditionalOptions) + + + + + Level3 + MaxSpeed + true + true + true + DEBUG;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + true + 4200 + true + + + true + true + openrct2.lib;%(AdditionalDependencies) + + + + + + + + + + + + \ No newline at end of file From 91e19c7d48cc1e2596e43f217a1a62a634fd43a7 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 00:59:52 +0000 Subject: [PATCH 30/62] Move a lot of the common properties to a shared props file --- openrct2.common.props | 87 ++++++++++++++++++++ openrct2.vcxproj | 171 +++------------------------------------ test/tests/tests.vcxproj | 66 +++------------ 3 files changed, 106 insertions(+), 218 deletions(-) diff --git a/openrct2.common.props b/openrct2.common.props index 10103679d6..eaa0b37966 100644 --- a/openrct2.common.props +++ b/openrct2.common.props @@ -1,8 +1,95 @@ + + ..\..\ + + + + $(DefaultPlatformToolset) $(UCRTVersion) + + MultiByte + + $(SolutionDir)bin\ + $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ + $(ProjectName) + + + true + + + + false + true + + + + $(SolutionDir)bin\ + $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ + + $(ProjectName) + + + $(SolutionDir)bin\ + $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ + $(ProjectName) + + + + + 4091;%(DisableSpecificWarnings) + Level3 + OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) + MultiThreaded + true + 4013 + true + + + openrct2-libs-vs2015-x64.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) + /OPT:NOLBR /ignore:4099 %(AdditionalOptions) + + + PerMonitorHighDPIAware + + + + + Disabled + true + DEBUG;%(PreprocessorDefinitions) + false + + + true + UseFastLinkTimeCodeGeneration + + + + + Full + true + true + + + false + %(PreprocessorDefinitions) + Speed + + + true + true + true + + + + + + + $(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) + $(SolutionDir)lib;$(LibraryPath) diff --git a/openrct2.vcxproj b/openrct2.vcxproj index 202974fbd1..c1bf2508e9 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -18,6 +18,7 @@ x64 + @@ -540,185 +541,31 @@ openrct2 openrct2 - - - + + Application + + + DynamicLibrary - true - MultiByte - - - Application - false - true - MultiByte - - - Application - true - MultiByte - - - false - true - MultiByte StaticLibrary - - - - - - - - - - - $(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) - $(SolutionDir)lib;$(LibraryPath) - $(SolutionDir)bin\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ - - - - $(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) - $(SolutionDir)lib;$(LibraryPath) - $(SolutionDir)bin\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ - - - $(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) - $(SolutionDir)lib;$(LibraryPath) - $(SolutionDir)bin\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ - - $(ProjectName) - - - $(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) - $(SolutionDir)lib;$(LibraryPath) - $(SolutionDir)bin\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ - $(ProjectName) - + USE_BREAKPAD;%(PreprocessorDefinitions) __NOENTRYPOINT__;%(PreprocessorDefinitions) - + - 4091;%(DisableSpecificWarnings) - Level3 - Disabled - true - DEBUG;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreaded - true $(IntDir)\%(RelativeDir) - 4013 - false - true $(OPENRCT2_CL_ADDITIONALOPTIONS) - true - openrct2-libs-vs2015-x86.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) - UseFastLinkTimeCodeGeneration - /OPT:NOLBR /ignore:4099 %(AdditionalOptions) + Console - - - 4091;%(DisableSpecificWarnings) - Level3 - Full - true - true - - MultiThreaded - 4013 - - false - NO_RCT2;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;%(PreprocessorDefinitions) - $(IntDir)\%(RelativeDir) - true - Speed - true - $(OPENRCT2_CL_ADDITIONALOPTIONS) - - - true - true - true - openrct2-libs-vs2015-x86.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) - /ignore:4099 %(AdditionalOptions) - Windows - - - PerMonitorHighDPIAware - - - - - 4091;%(DisableSpecificWarnings) - Level3 - Disabled - true - DEBUG;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreaded - true - $(IntDir)\%(RelativeDir) - 4013 - false - true - $(OPENRCT2_CL_ADDITIONALOPTIONS) - - - true - openrct2-libs-vs2015-x64.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) - UseFastLinkTimeCodeGeneration - /OPT:NOLBR /ignore:4099 %(AdditionalOptions) - Console - - - PerMonitorHighDPIAware - - - - - 4091;%(DisableSpecificWarnings) - Level3 - Full - true - true - - MultiThreaded - 4013 - - false - OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;%(PreprocessorDefinitions) - $(IntDir)\%(RelativeDir) - true - Speed - true - $(OPENRCT2_CL_ADDITIONALOPTIONS) - - - true - true - true - openrct2-libs-vs2015-x64.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) - /ignore:4099 %(AdditionalOptions) - Windows - - - PerMonitorHighDPIAware - - - \ No newline at end of file diff --git a/test/tests/tests.vcxproj b/test/tests/tests.vcxproj index 01c1504b55..bfc423ffc0 100644 --- a/test/tests/tests.vcxproj +++ b/test/tests/tests.vcxproj @@ -24,71 +24,24 @@ {62B020FA-E4FB-4C6E-B32A-DC999470F155} tests + tests + + + Application - - - Application - true - MultiByte - - - Application - false - true - MultiByte - - - - - - - - - $(SolutionDir)bin\tests\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)\ - tests - $(GTestDir)\googletest;$(GTestDir)\googletest\include;$(SolutionDir)src;$(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) - $(SolutionDir)bin;$(SolutionDir)lib;$(LibraryPath) + $(GTestDir)\googletest;$(GTestDir)\googletest\include;$(SolutionDir)src;$(IncludePath) + $(SolutionDir)bin;$(LibraryPath) - - - Level3 - Disabled - true - DEBUG;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) - MultiThreaded - true - true - 4200 - true - false - + - openrct2.lib;openrct2-libs-vs2015-x64.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) - /OPT:NOLBR /ignore:4099 %(AdditionalOptions) - - - - - Level3 - MaxSpeed - true - true - true - DEBUG;OPENGL_NO_LINK;_CRT_SECURE_NO_WARNINGS;_USE_MATH_DEFINES;CURL_STATICLIB;SDL_MAIN_HANDLED;_WINSOCK_DEPRECATED_NO_WARNINGS;%(PreprocessorDefinitions) - true - 4200 - true - - - true - true openrct2.lib;%(AdditionalDependencies) + + @@ -97,5 +50,6 @@ + \ No newline at end of file From fab8dce9ccaf0c136137f62e7949dfc84d93e344 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 01:00:57 +0000 Subject: [PATCH 31/62] Move file listing to the bottom of openrct2.vcxproj --- openrct2.vcxproj | 64 +++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/openrct2.vcxproj b/openrct2.vcxproj index c1bf2508e9..dcd7a97007 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -18,6 +18,38 @@ x64 + + {D24D94F6-2A74-480C-B512-629C306CE92F} + openrct2 + openrct2 + + + Application + + + + DynamicLibrary + + + StaticLibrary + + + + + USE_BREAKPAD;%(PreprocessorDefinitions) + __NOENTRYPOINT__;%(PreprocessorDefinitions) + + + + + $(IntDir)\%(RelativeDir) + $(OPENRCT2_CL_ADDITIONALOPTIONS) + + + Console + + + @@ -536,36 +568,6 @@ - - {D24D94F6-2A74-480C-B512-629C306CE92F} - openrct2 - openrct2 - - - Application - - - - DynamicLibrary - - - StaticLibrary - - - - - USE_BREAKPAD;%(PreprocessorDefinitions) - __NOENTRYPOINT__;%(PreprocessorDefinitions) - - - - - $(IntDir)\%(RelativeDir) - $(OPENRCT2_CL_ADDITIONALOPTIONS) - - - Console - - + \ No newline at end of file From 4ccb50409b37a56cfd0c04dfaa74bba1676c957f Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 02:49:50 +0000 Subject: [PATCH 32/62] Add test configurations --- openrct2.common.props | 37 ++++++++++++++++++------------------- openrct2.sln | 37 ++++++++++++++++++++++++++++--------- openrct2.vcxproj | 25 ++++++++++++++++++++++--- test/tests/tests.vcxproj | 19 ++++++++++--------- 4 files changed, 78 insertions(+), 40 deletions(-) diff --git a/openrct2.common.props b/openrct2.common.props index eaa0b37966..9f6b6b38de 100644 --- a/openrct2.common.props +++ b/openrct2.common.props @@ -2,6 +2,8 @@ ..\..\ + Debug + Release @@ -14,30 +16,17 @@ MultiByte $(SolutionDir)bin\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ + $(SolutionDir)obj\$(ProjectName)\$(Config)_$(Platform)\ $(ProjectName) - + true - - + false true - - $(SolutionDir)bin\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ - - $(ProjectName) - - - $(SolutionDir)bin\ - $(SolutionDir)obj\$(ProjectName)\$(Configuration)_$(Platform)\ - $(ProjectName) - - 4091;%(DisableSpecificWarnings) @@ -49,14 +38,16 @@ true - openrct2-libs-vs2015-x64.lib;imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) + imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) + openrct2-libs-vs2015-x86.lib;%(AdditionalDependencies) + openrct2-libs-vs2015-x64.lib;%(AdditionalDependencies) /OPT:NOLBR /ignore:4099 %(AdditionalOptions) PerMonitorHighDPIAware - + Disabled true @@ -68,7 +59,7 @@ UseFastLinkTimeCodeGeneration - + Full true @@ -86,10 +77,18 @@ + + + + NO_RCT2;%(PreprocessorDefinitions) + + + $(SolutionDir)lib\include;$(SolutionDir)lib\include\breakpad;$(SolutionDir)lib\include\libspeex;$(SolutionDir)lib\include\sdl;$(SolutionDir)lib\include\jansson;$(SolutionDir)lib\include\sdl_ttf;$(SolutionDir)lib\include\libpng;$(SolutionDir)lib\include\zlib;$(IncludePath) $(SolutionDir)lib;$(LibraryPath) + diff --git a/openrct2.sln b/openrct2.sln index 37c5ec1170..df162fe6a2 100644 --- a/openrct2.sln +++ b/openrct2.sln @@ -20,32 +20,51 @@ Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 Debug|x64 = Debug|x64 + DebugTests|Win32 = DebugTests|Win32 + DebugTests|x64 = DebugTests|x64 Release|Win32 = Release|Win32 Release|x64 = Release|x64 + ReleaseTests|Win32 = ReleaseTests|Win32 + ReleaseTests|x64 = ReleaseTests|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {D24D94F6-2A74-480C-B512-629C306CE92F}.Debug|Win32.ActiveCfg = Debug|Win32 {D24D94F6-2A74-480C-B512-629C306CE92F}.Debug|Win32.Build.0 = Debug|Win32 {D24D94F6-2A74-480C-B512-629C306CE92F}.Debug|x64.ActiveCfg = Debug|x64 {D24D94F6-2A74-480C-B512-629C306CE92F}.Debug|x64.Build.0 = Debug|x64 + {D24D94F6-2A74-480C-B512-629C306CE92F}.DebugTests|Win32.ActiveCfg = DebugTests|Win32 + {D24D94F6-2A74-480C-B512-629C306CE92F}.DebugTests|Win32.Build.0 = DebugTests|Win32 + {D24D94F6-2A74-480C-B512-629C306CE92F}.DebugTests|x64.ActiveCfg = DebugTests|x64 + {D24D94F6-2A74-480C-B512-629C306CE92F}.DebugTests|x64.Build.0 = DebugTests|x64 {D24D94F6-2A74-480C-B512-629C306CE92F}.Release|Win32.ActiveCfg = Release|Win32 {D24D94F6-2A74-480C-B512-629C306CE92F}.Release|Win32.Build.0 = Release|Win32 {D24D94F6-2A74-480C-B512-629C306CE92F}.Release|x64.ActiveCfg = Release|x64 {D24D94F6-2A74-480C-B512-629C306CE92F}.Release|x64.Build.0 = Release|x64 + {D24D94F6-2A74-480C-B512-629C306CE92F}.ReleaseTests|Win32.ActiveCfg = ReleaseTests|Win32 + {D24D94F6-2A74-480C-B512-629C306CE92F}.ReleaseTests|Win32.Build.0 = ReleaseTests|Win32 + {D24D94F6-2A74-480C-B512-629C306CE92F}.ReleaseTests|x64.ActiveCfg = ReleaseTests|x64 + {D24D94F6-2A74-480C-B512-629C306CE92F}.ReleaseTests|x64.Build.0 = ReleaseTests|x64 {57E60BA1-FB76-4316-909E-C1449C142327}.Debug|Win32.ActiveCfg = Debug|Win32 {57E60BA1-FB76-4316-909E-C1449C142327}.Debug|Win32.Build.0 = Debug|Win32 {57E60BA1-FB76-4316-909E-C1449C142327}.Debug|x64.ActiveCfg = Debug|Win32 + {57E60BA1-FB76-4316-909E-C1449C142327}.DebugTests|Win32.ActiveCfg = Debug|Win32 + {57E60BA1-FB76-4316-909E-C1449C142327}.DebugTests|x64.ActiveCfg = Debug|Win32 {57E60BA1-FB76-4316-909E-C1449C142327}.Release|Win32.ActiveCfg = Release|Win32 - {57E60BA1-FB76-4316-909E-C1449C142327}.Release|Win32.Build.0 = Release|Win32 {57E60BA1-FB76-4316-909E-C1449C142327}.Release|x64.ActiveCfg = Release|Win32 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|Win32.ActiveCfg = Debug|Win32 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|Win32.Build.0 = Debug|Win32 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|x64.ActiveCfg = Debug|x64 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|x64.Build.0 = Debug|x64 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|Win32.ActiveCfg = Release|Win32 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|Win32.Build.0 = Release|Win32 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|x64.ActiveCfg = Release|x64 - {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|x64.Build.0 = Release|x64 + {57E60BA1-FB76-4316-909E-C1449C142327}.ReleaseTests|Win32.ActiveCfg = Release|Win32 + {57E60BA1-FB76-4316-909E-C1449C142327}.ReleaseTests|x64.ActiveCfg = Release|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|Win32.ActiveCfg = DebugTests|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Debug|x64.ActiveCfg = DebugTests|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.DebugTests|Win32.ActiveCfg = DebugTests|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.DebugTests|Win32.Build.0 = DebugTests|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.DebugTests|x64.ActiveCfg = DebugTests|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.DebugTests|x64.Build.0 = DebugTests|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|Win32.ActiveCfg = ReleaseTests|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.Release|x64.ActiveCfg = ReleaseTests|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.ReleaseTests|Win32.ActiveCfg = ReleaseTests|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.ReleaseTests|Win32.Build.0 = ReleaseTests|Win32 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.ReleaseTests|x64.ActiveCfg = ReleaseTests|x64 + {62B020FA-E4FB-4C6E-B32A-DC999470F155}.ReleaseTests|x64.Build.0 = ReleaseTests|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/openrct2.vcxproj b/openrct2.vcxproj index dcd7a97007..9384c8ff90 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -1,5 +1,8 @@  + + .\ + Debug @@ -9,6 +12,14 @@ Debug x64 + + DebugTests + Win32 + + + DebugTests + x64 + Release Win32 @@ -17,6 +28,14 @@ Release x64 + + ReleaseTests + Win32 + + + ReleaseTests + x64 + {D24D94F6-2A74-480C-B512-629C306CE92F} @@ -30,14 +49,14 @@ DynamicLibrary - + StaticLibrary - + USE_BREAKPAD;%(PreprocessorDefinitions) - __NOENTRYPOINT__;%(PreprocessorDefinitions) + __NOENTRYPOINT__;%(PreprocessorDefinitions) diff --git a/test/tests/tests.vcxproj b/test/tests/tests.vcxproj index bfc423ffc0..683615e359 100644 --- a/test/tests/tests.vcxproj +++ b/test/tests/tests.vcxproj @@ -4,20 +4,20 @@ ..\..\ - - Debug + + DebugTests Win32 - - Release + + ReleaseTests Win32 - - Debug + + DebugTests x64 - - Release + + ReleaseTests x64 @@ -29,7 +29,7 @@ Application - + $(SolutionDir)bin\tests\ $(GTestDir)\googletest;$(GTestDir)\googletest\include;$(SolutionDir)src;$(IncludePath) @@ -38,6 +38,7 @@ openrct2.lib;%(AdditionalDependencies) + Console From 872976bff4e5851e816f222c217b34a950993da2 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 10:49:58 +0000 Subject: [PATCH 33/62] Force UTF-8 compile and fix manifest DPI --- openrct2.common.props | 10 +++++++--- openrct2.vcxproj | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/openrct2.common.props b/openrct2.common.props index 9f6b6b38de..72eb374c7c 100644 --- a/openrct2.common.props +++ b/openrct2.common.props @@ -36,6 +36,7 @@ true 4013 true + /utf-8 imm32.lib;version.lib;winmm.lib;crypt32.lib;%(AdditionalDependencies) @@ -43,9 +44,6 @@ openrct2-libs-vs2015-x64.lib;%(AdditionalDependencies) /OPT:NOLBR /ignore:4099 %(AdditionalOptions) - - PerMonitorHighDPIAware - @@ -91,4 +89,10 @@ $(SolutionDir)lib;$(LibraryPath) + + + + PerMonitorHighDPIAware + + diff --git a/openrct2.vcxproj b/openrct2.vcxproj index 9384c8ff90..098d5abc10 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -62,7 +62,7 @@ $(IntDir)\%(RelativeDir) - $(OPENRCT2_CL_ADDITIONALOPTIONS) + $(OPENRCT2_CL_ADDITIONALOPTIONS) %(AdditionalOptions) Console From d26e1df21e75becdd7a3d9c51bfd7f563c154512 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 13:36:03 +0000 Subject: [PATCH 34/62] Automatically download googletest --- openrct2.proj | 11 +++++++++++ test/tests/tests.vcxproj | 5 +++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index 8917009a18..a10de00194 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -65,6 +65,8 @@ https://github.com/OpenRCT2/Dependencies/releases/download/v$(TargetLibsVersion)/openrct2-libs-vs2015.zip $(RootDir)lib\ $(LibsPath)libversion + 1.8.0 + https://github.com/google/googletest/archive/release-$(GtestVersion).zip @@ -122,6 +124,7 @@ $(LibsPath)openrct2-libs-vs2015.zip + $(LibsPath)gtest.zip @@ -129,10 +132,18 @@ + + + + + + + + diff --git a/test/tests/tests.vcxproj b/test/tests/tests.vcxproj index 683615e359..3e42ab8e4a 100644 --- a/test/tests/tests.vcxproj +++ b/test/tests/tests.vcxproj @@ -2,6 +2,7 @@ ..\..\ + $(SolutionDir)lib\googletest\googletest @@ -32,7 +33,7 @@ $(SolutionDir)bin\tests\ - $(GTestDir)\googletest;$(GTestDir)\googletest\include;$(SolutionDir)src;$(IncludePath) + $(GtestDir);$(GtestDir)\include;$(SolutionDir)src;$(IncludePath) $(SolutionDir)bin;$(LibraryPath) @@ -48,7 +49,7 @@ - + From 05737fdd74aea2a397288675e93c80ed76e9aa03 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 14:42:40 +0000 Subject: [PATCH 35/62] Add test target --- openrct2.proj | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/openrct2.proj b/openrct2.proj index a10de00194..ee68eea4b4 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -55,7 +55,6 @@ OpenRCT2-$(Version)$(VersionExtra)-windows-$(Platform.ToLower()) - Configuration=$(Configuration) $(SlnProperties);Platform=$(Platform) $(SlnProperties);OPENRCT2_CL_ADDITIONALOPTIONS=$(OPENRCT2_CL_ADDITIONALOPTIONS) @@ -149,6 +148,9 @@ + + $(SlnProperties);Configuration=$(Configuration) + @@ -180,15 +182,33 @@ + + $(SlnProperties);Configuration=$(Configuration) + + + $(SlnProperties);Configuration=$(Configuration) + + + + DebugTests + ReleaseTests + $(SlnProperties);Configuration=$(Configuration) + + + + - + + + + From 9c973e20cdf45747d53e82981deee70ce7f0dba8 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 14:54:07 +0000 Subject: [PATCH 36/62] Run tests on AppVeyor --- appveyor.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 5e8110ac26..b8ebe79a07 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,9 +19,16 @@ install: platform: - Win32 - x64 -configuration: Release +configuration: + - Release + - ReleaseTests build: project: openrct2.proj +test_script: +- ps: >- + if ($env:configuration -eq "ReleaseTests") { + msbuild openrct2.proj /t:test /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + } artifacts: - path: .\artifacts\openrct2-portable*.zip name: OpenRCT2-portable From 756e26ad452479f9740f1112891cbbba23476c13 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 17:16:12 +0000 Subject: [PATCH 37/62] Fix main function --- test/tests/sawyercoding_test.cpp | 2 +- test/tests/tests.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/tests/sawyercoding_test.cpp b/test/tests/sawyercoding_test.cpp index c7105416c5..5e9120a29a 100644 --- a/test/tests/sawyercoding_test.cpp +++ b/test/tests/sawyercoding_test.cpp @@ -1,5 +1,5 @@ // Make MSVC shut up about M_PI -#include +#include extern "C" { #include "util/sawyercoding.h" diff --git a/test/tests/tests.cpp b/test/tests/tests.cpp index bba7cb7be3..4190c4fa39 100644 --- a/test/tests/tests.cpp +++ b/test/tests/tests.cpp @@ -6,8 +6,8 @@ int main(int argc, char * * argv) { - testing::InitGoogleTest(&argc, argv); - RUN_ALL_TESTS(); + testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); } #endif From 433207dc81cd5738d41673b1c3384c1c409276ed Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 17:16:26 +0000 Subject: [PATCH 38/62] Do not assert when testing --- openrct2.common.props | 10 ++++++++++ src/core/Guard.cpp | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/openrct2.common.props b/openrct2.common.props index 72eb374c7c..64d144e987 100644 --- a/openrct2.common.props +++ b/openrct2.common.props @@ -74,6 +74,16 @@ true + + + __TEST__;%(PreprocessorDefinitions) + + + + + NDEBUG;__TEST__;%(PreprocessorDefinitions) + + diff --git a/src/core/Guard.cpp b/src/core/Guard.cpp index 2b6518aa39..479f976104 100644 --- a/src/core/Guard.cpp +++ b/src/core/Guard.cpp @@ -78,7 +78,9 @@ namespace Guard char *bufend = (char *)strchr(buffer, 0); vsnprintf(bufend, sizeof(buffer) - (bufend - buffer), message, args); } - int result = MessageBox(nullptr, buffer, OPENRCT2_NAME, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION); + // Only show message box if we are not building for testing +#ifndef __TEST__ + int result = MessageBoxA(nullptr, buffer, OPENRCT2_NAME, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION); if (result == IDABORT) { #ifdef USE_BREAKPAD @@ -88,6 +90,7 @@ namespace Guard assert(false); #endif } +#endif #else assert(false); #endif From 28098776b2b90e91629a89879314c3246bdd9f63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Fri, 2 Dec 2016 21:58:46 +0100 Subject: [PATCH 39/62] Convert tests to class + fixtures This makes test data not require `extern` --- test/tests/LanguagePackTest.cpp | 54 ++++++++-------- test/tests/sawyercoding_test.cpp | 103 ++++++++++++++++--------------- 2 files changed, 82 insertions(+), 75 deletions(-) diff --git a/test/tests/LanguagePackTest.cpp b/test/tests/LanguagePackTest.cpp index 355f881746..80bce82760 100644 --- a/test/tests/LanguagePackTest.cpp +++ b/test/tests/LanguagePackTest.cpp @@ -2,7 +2,14 @@ #include "localisation/string_ids.h" #include -TEST(LanguagePackTest, create_empty) +class LanguagePackTest : public testing::Test +{ +protected: + static const utf8 * LanguageEnGB; + static const unsigned char LanguageZhTW[]; +}; + +TEST_F(LanguagePackTest, create_empty) { ILanguagePack * empty = LanguagePackFactory::FromText(0, ""); ASSERT_EQ(empty->GetId(), 0); @@ -10,7 +17,7 @@ TEST(LanguagePackTest, create_empty) delete empty; } -TEST(LanguagePackTest, create_mutable_id_1) +TEST_F(LanguagePackTest, create_mutable_id_1) { ILanguagePack * lang = LanguagePackFactory::FromText(1, "STR_0000:\n"); ASSERT_EQ(lang->GetId(), 1); @@ -22,10 +29,7 @@ TEST(LanguagePackTest, create_mutable_id_1) delete lang; } -extern const utf8 * LanguageEnGB; -extern const unsigned char LanguageZhTW[]; - -TEST(LanguagePackTest, language_pack_simple) +TEST_F(LanguagePackTest, language_pack_simple) { ILanguagePack * lang = LanguagePackFactory::FromText(0, LanguageEnGB); ASSERT_EQ(lang->GetId(), 0); @@ -42,7 +46,7 @@ TEST(LanguagePackTest, language_pack_simple) delete lang; } -TEST(LanguagePackTest, language_pack_multibyte) +TEST_F(LanguagePackTest, language_pack_multibyte) { ILanguagePack * lang = LanguagePackFactory::FromText(0, (const utf8 *)LanguageZhTW); ASSERT_EQ(lang->GetId(), 0); @@ -57,27 +61,27 @@ TEST(LanguagePackTest, language_pack_multibyte) delete lang; } -const utf8 * LanguageEnGB = "# STR_XXXX part is read and XXXX becomes the string id number.\n" - "# Everything after the colon and before the new line will be saved as the " - "string.\n" - "# Use # at the beginning of a line to leave a comment.\n" - "STR_0000 :\n" - "STR_0001 :{STRINGID} {COMMA16}\n" - "STR_0002 :Spiral Roller Coaster\n" - "STR_0003 :Stand-up Roller Coaster\n" - "\n" - "STR_SCNR :Arid Heights scenario string\n" - "STR_PARK :Arid Heights park string\n" - "STR_DTLS :Free of any financial limits, your challenge is to develop " - "this desert park while keeping the guests happy\n" - "[CONDORRD]\n" - "STR_NAME :my test ride\n" - "STR_DESC :ride description\n" - "STR_CPTY :ride capacity\n"; +const utf8 * LanguagePackTest::LanguageEnGB = "# STR_XXXX part is read and XXXX becomes the string id number.\n" + "# Everything after the colon and before the new line will be saved as the " + "string.\n" + "# Use # at the beginning of a line to leave a comment.\n" + "STR_0000 :\n" + "STR_0001 :{STRINGID} {COMMA16}\n" + "STR_0002 :Spiral Roller Coaster\n" + "STR_0003 :Stand-up Roller Coaster\n" + "\n" + "STR_SCNR :Arid Heights scenario string\n" + "STR_PARK :Arid Heights park string\n" + "STR_DTLS :Free of any financial limits, your challenge is to develop " + "this desert park while keeping the guests happy\n" + "[CONDORRD]\n" + "STR_NAME :my test ride\n" + "STR_DESC :ride description\n" + "STR_CPTY :ride capacity\n"; // This includes a few entries extracted from zh-TW localisation. // It has to be declared as `unsigned char`, or else the values overflow signed byte. -const unsigned char LanguageZhTW[] = { +const unsigned char LanguagePackTest::LanguageZhTW[] = { 0x53, 0x54, 0x52, 0x5f, 0x30, 0x30, 0x30, 0x30, 0x20, 0x20, 0x20, 0x20, 0x3a, 0xe8, 0x9e, 0xba, 0xe6, 0x97, 0x8b, 0xe5, 0xbc, 0x8f, 0xe9, 0x9b, 0xb2, 0xe9, 0x9c, 0x84, 0xe9, 0xa3, 0x9b, 0xe8, 0xbb, 0x8a, 0x0a, 0x53, 0x54, 0x52, 0x5f, 0x30, 0x30, 0x30, 0x31, 0x20, 0x20, 0x20, 0x20, 0x3a, 0xe7, 0xab, 0x99, 0xe7, 0xab, 0x8b, 0xe5, 0xbc, 0x8f, 0xe9, 0x9b, 0xb2, diff --git a/test/tests/sawyercoding_test.cpp b/test/tests/sawyercoding_test.cpp index 2dce17f261..ab9deb18ee 100644 --- a/test/tests/sawyercoding_test.cpp +++ b/test/tests/sawyercoding_test.cpp @@ -4,64 +4,67 @@ extern "C" { #include -// These are populated further down in this file, but to do so, they need to be marked `extern`. -extern const uint8 randomdata[1024]; -extern const uint8 nonedata[1029]; -extern const uint8 rledata[1038]; -extern const uint8 rlecompresseddata[1949]; -extern const uint8 rotatedata[1038]; - #define BUFFER_SIZE 0x600000 -static void test_encode_decode(uint8 encoding_type) +class SawyerCodingTest : public testing::Test { - sawyercoding_chunk_header chdr_in, chdr_out; - chdr_in.encoding = encoding_type; - chdr_in.length = sizeof(randomdata); - uint8 * encodedDataBuffer = new uint8[BUFFER_SIZE]; - size_t encodedDataSize = sawyercoding_write_chunk_buffer(encodedDataBuffer, (const uint8 *)randomdata, chdr_in); - ASSERT_GT(encodedDataSize, sizeof(sawyercoding_chunk_header)); - memcpy(&chdr_out, encodedDataBuffer, sizeof(sawyercoding_chunk_header)); - ASSERT_EQ(chdr_out.encoding, encoding_type); - uint8 * decodeBuffer = new uint8[BUFFER_SIZE]; - size_t decodedDataSize = sawyercoding_read_chunk_buffer(decodeBuffer, encodedDataBuffer + sizeof(sawyercoding_chunk_header), - chdr_out, BUFFER_SIZE); - ASSERT_EQ(decodedDataSize, sizeof(randomdata)); - int result = memcmp(decodeBuffer, randomdata, sizeof(randomdata)); - ASSERT_EQ(result, 0); - delete[] decodeBuffer; - delete[] encodedDataBuffer; -} +protected: + static const uint8 randomdata[1024]; + static const uint8 nonedata[1029]; + static const uint8 rledata[1038]; + static const uint8 rlecompresseddata[1949]; + static const uint8 rotatedata[1038]; -static void test_decode(const uint8 * data) -{ - sawyercoding_chunk_header chdr_in; - memcpy(&chdr_in, data, sizeof(sawyercoding_chunk_header)); - uint8 * decodeBuffer = new uint8[BUFFER_SIZE]; - size_t decodedDataSize = - sawyercoding_read_chunk_buffer(decodeBuffer, data + sizeof(sawyercoding_chunk_header), chdr_in, BUFFER_SIZE); - ASSERT_EQ(decodedDataSize, sizeof(randomdata)); - int result = memcmp(decodeBuffer, randomdata, sizeof(randomdata)); - ASSERT_EQ(result, 0); - delete[] decodeBuffer; -} + void test_encode_decode(uint8 encoding_type) + { + sawyercoding_chunk_header chdr_in, chdr_out; + chdr_in.encoding = encoding_type; + chdr_in.length = sizeof(randomdata); + uint8 * encodedDataBuffer = new uint8[BUFFER_SIZE]; + size_t encodedDataSize = sawyercoding_write_chunk_buffer(encodedDataBuffer, (const uint8 *)randomdata, chdr_in); + ASSERT_GT(encodedDataSize, sizeof(sawyercoding_chunk_header)); + memcpy(&chdr_out, encodedDataBuffer, sizeof(sawyercoding_chunk_header)); + ASSERT_EQ(chdr_out.encoding, encoding_type); + uint8 * decodeBuffer = new uint8[BUFFER_SIZE]; + size_t decodedDataSize = sawyercoding_read_chunk_buffer( + decodeBuffer, encodedDataBuffer + sizeof(sawyercoding_chunk_header), chdr_out, BUFFER_SIZE); + ASSERT_EQ(decodedDataSize, sizeof(randomdata)); + int result = memcmp(decodeBuffer, randomdata, sizeof(randomdata)); + ASSERT_EQ(result, 0); + delete[] decodeBuffer; + delete[] encodedDataBuffer; + } -TEST(sawyercoding, write_read_chunk_none) + void test_decode(const uint8 * data) + { + sawyercoding_chunk_header chdr_in; + memcpy(&chdr_in, data, sizeof(sawyercoding_chunk_header)); + uint8 * decodeBuffer = new uint8[BUFFER_SIZE]; + size_t decodedDataSize = + sawyercoding_read_chunk_buffer(decodeBuffer, data + sizeof(sawyercoding_chunk_header), chdr_in, BUFFER_SIZE); + ASSERT_EQ(decodedDataSize, sizeof(randomdata)); + int result = memcmp(decodeBuffer, randomdata, sizeof(randomdata)); + ASSERT_EQ(result, 0); + delete[] decodeBuffer; + } +}; + +TEST_F(SawyerCodingTest, write_read_chunk_none) { test_encode_decode(CHUNK_ENCODING_NONE); } -TEST(sawyercoding, write_read_chunk_rle) +TEST_F(SawyerCodingTest, write_read_chunk_rle) { test_encode_decode(CHUNK_ENCODING_RLE); } -TEST(sawyercoding, write_read_chunk_rle_compressed) +TEST_F(SawyerCodingTest, write_read_chunk_rle_compressed) { test_encode_decode(CHUNK_ENCODING_RLECOMPRESSED); } -TEST(sawyercoding, write_read_chunk_rotate) +TEST_F(SawyerCodingTest, write_read_chunk_rotate) { test_encode_decode(CHUNK_ENCODING_ROTATE); } @@ -70,29 +73,29 @@ TEST(sawyercoding, write_read_chunk_rotate) // The reason for that is we may improve encoding at some point, but the test won't be affected, // as we already do a decode test and rountrip (encode + decode), which validates all uses. -TEST(sawyercoding, decode_chunk_none) +TEST_F(SawyerCodingTest, decode_chunk_none) { test_decode(nonedata); } -TEST(sawyercoding, decode_chunk_rle) +TEST_F(SawyerCodingTest, decode_chunk_rle) { test_decode(rledata); } -TEST(sawyercoding, decode_chunk_rlecompressed) +TEST_F(SawyerCodingTest, decode_chunk_rlecompressed) { test_decode(rlecompresseddata); } -TEST(sawyercoding, decode_chunk_rotate) +TEST_F(SawyerCodingTest, decode_chunk_rotate) { test_decode(rotatedata); } // 1024 bytes of random data // use `dd if=/dev/urandom bs=1024 count=1 | xxd -i` to get your own -extern const uint8 randomdata[] = { +const uint8 SawyerCodingTest::randomdata[] = { 0x3a, 0x97, 0x63, 0x8b, 0xbf, 0xe5, 0x6e, 0x0e, 0xc4, 0xac, 0xdc, 0x84, 0xd7, 0x68, 0xf1, 0x4d, 0xcb, 0xaf, 0x1e, 0x5a, 0x29, 0x40, 0x87, 0x80, 0x3f, 0xf9, 0xb8, 0xad, 0x01, 0xd3, 0x79, 0x3d, 0xe9, 0x87, 0xa8, 0x95, 0x68, 0xc0, 0xc2, 0x3d, 0x15, 0x87, 0xdb, 0xa6, 0x90, 0x8c, 0x26, 0x98, 0x2a, 0x3f, 0x2e, 0x0c, 0x82, 0x43, 0x00, 0x10, 0x6d, 0x60, 0xb9, 0xd4, @@ -149,7 +152,7 @@ extern const uint8 randomdata[] = { // Following are compressed versions of the data above. -extern const uint8 nonedata[] = { +const uint8 SawyerCodingTest::nonedata[] = { 0x00, 0x00, 0x04, 0x00, 0x00, 0x3a, 0x97, 0x63, 0x8b, 0xbf, 0xe5, 0x6e, 0x0e, 0xc4, 0xac, 0xdc, 0x84, 0xd7, 0x68, 0xf1, 0x4d, 0xcb, 0xaf, 0x1e, 0x5a, 0x29, 0x40, 0x87, 0x80, 0x3f, 0xf9, 0xb8, 0xad, 0x01, 0xd3, 0x79, 0x3d, 0xe9, 0x87, 0xa8, 0x95, 0x68, 0xc0, 0xc2, 0x3d, 0x15, 0x87, 0xdb, 0xa6, 0x90, 0x8c, 0x26, 0x98, 0x2a, 0x3f, 0x2e, 0x0c, 0x82, 0x43, 0x00, @@ -204,7 +207,7 @@ extern const uint8 nonedata[] = { 0x80, 0xbe, 0x9e, 0xd7, 0x5e, 0xb5, 0x72, 0x22, 0xbc }; -extern const uint8 rledata[] = { +const uint8 SawyerCodingTest::rledata[] = { 0x01, 0x09, 0x04, 0x00, 0x00, 0x7d, 0x3a, 0x97, 0x63, 0x8b, 0xbf, 0xe5, 0x6e, 0x0e, 0xc4, 0xac, 0xdc, 0x84, 0xd7, 0x68, 0xf1, 0x4d, 0xcb, 0xaf, 0x1e, 0x5a, 0x29, 0x40, 0x87, 0x80, 0x3f, 0xf9, 0xb8, 0xad, 0x01, 0xd3, 0x79, 0x3d, 0xe9, 0x87, 0xa8, 0x95, 0x68, 0xc0, 0xc2, 0x3d, 0x15, 0x87, 0xdb, 0xa6, 0x90, 0x8c, 0x26, 0x98, 0x2a, 0x3f, 0x2e, 0x0c, 0x82, 0x43, @@ -259,7 +262,7 @@ extern const uint8 rledata[] = { 0x1d, 0x15, 0x29, 0x5b, 0xd0, 0x66, 0x72, 0xb8, 0x38, 0x80, 0xbe, 0x9e, 0xd7, 0x5e, 0xb5, 0x72, 0x22, 0xbc }; -extern const uint8 rlecompresseddata[] = { +const uint8 SawyerCodingTest::rlecompresseddata[] = { 0x02, 0x98, 0x07, 0x00, 0x00, 0x7d, 0xff, 0x3a, 0xff, 0x97, 0xff, 0x63, 0xff, 0x8b, 0xff, 0xbf, 0xff, 0xe5, 0xff, 0x6e, 0xff, 0x0e, 0xff, 0xc4, 0xff, 0xac, 0xff, 0xdc, 0xff, 0x84, 0xff, 0xd7, 0xff, 0x68, 0xff, 0xf1, 0xff, 0x4d, 0xff, 0xcb, 0xff, 0xaf, 0xff, 0x1e, 0xff, 0x5a, 0xff, 0x29, 0xff, 0x40, 0xff, 0x87, 0xff, 0x80, 0xff, 0x3f, 0xff, 0xf9, 0xff, 0xb8, @@ -360,7 +363,7 @@ extern const uint8 rlecompresseddata[] = { 0xff, 0x5e, 0xff, 0xb5, 0xb8, 0xff, 0x22, 0xff, 0xbc }; -extern const uint8 rotatedata[] = { +const uint8 SawyerCodingTest::rotatedata[] = { 0x03, 0x00, 0x04, 0x00, 0x00, 0x74, 0xbc, 0x6c, 0xc5, 0x7f, 0x2f, 0xcd, 0x07, 0x89, 0x65, 0x9b, 0x42, 0xaf, 0x43, 0x3e, 0xa6, 0x97, 0x7d, 0xc3, 0x2d, 0x52, 0x02, 0xf0, 0x40, 0x7e, 0xcf, 0x17, 0xd6, 0x02, 0x9e, 0x2f, 0x9e, 0xd3, 0x3c, 0x15, 0xca, 0xd0, 0x06, 0x58, 0x9e, 0x2a, 0x3c, 0x7b, 0x53, 0x21, 0x64, 0xc4, 0x4c, 0x54, 0xf9, 0xc5, 0x06, 0x05, 0x1a, 0x00, From 3253ef7cae3b37cdc931089bee78bac298b33645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Fri, 2 Dec 2016 22:12:55 +0100 Subject: [PATCH 40/62] Verify decoded chunk length --- test/tests/sawyercoding_test.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/tests/sawyercoding_test.cpp b/test/tests/sawyercoding_test.cpp index ab9deb18ee..107e2dca4c 100644 --- a/test/tests/sawyercoding_test.cpp +++ b/test/tests/sawyercoding_test.cpp @@ -13,7 +13,7 @@ protected: static const uint8 nonedata[1029]; static const uint8 rledata[1038]; static const uint8 rlecompresseddata[1949]; - static const uint8 rotatedata[1038]; + static const uint8 rotatedata[1029]; void test_encode_decode(uint8 encoding_type) { @@ -35,10 +35,11 @@ protected: delete[] encodedDataBuffer; } - void test_decode(const uint8 * data) + void test_decode(const uint8 * data, size_t size) { sawyercoding_chunk_header chdr_in; memcpy(&chdr_in, data, sizeof(sawyercoding_chunk_header)); + ASSERT_EQ(chdr_in.length, size - sizeof(sawyercoding_chunk_header)); uint8 * decodeBuffer = new uint8[BUFFER_SIZE]; size_t decodedDataSize = sawyercoding_read_chunk_buffer(decodeBuffer, data + sizeof(sawyercoding_chunk_header), chdr_in, BUFFER_SIZE); @@ -75,22 +76,23 @@ TEST_F(SawyerCodingTest, write_read_chunk_rotate) TEST_F(SawyerCodingTest, decode_chunk_none) { - test_decode(nonedata); + test_decode(nonedata, sizeof(nonedata)); } TEST_F(SawyerCodingTest, decode_chunk_rle) { - test_decode(rledata); + test_decode(rledata, sizeof(rledata)); } TEST_F(SawyerCodingTest, decode_chunk_rlecompressed) { - test_decode(rlecompresseddata); + test_decode(rlecompresseddata, sizeof(rlecompresseddata)); } TEST_F(SawyerCodingTest, decode_chunk_rotate) { - test_decode(rotatedata); + // Rotate + test_decode(rotatedata, sizeof(rotatedata)); } // 1024 bytes of random data From 7557d9ca0743627415a8880a0d2a6be93c6db0c6 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 21:49:44 +0000 Subject: [PATCH 41/62] Abort if assert is hit in tests --- src/core/Guard.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/Guard.cpp b/src/core/Guard.cpp index 479f976104..031e8841d5 100644 --- a/src/core/Guard.cpp +++ b/src/core/Guard.cpp @@ -78,8 +78,11 @@ namespace Guard char *bufend = (char *)strchr(buffer, 0); vsnprintf(bufend, sizeof(buffer) - (bufend - buffer), message, args); } - // Only show message box if we are not building for testing -#ifndef __TEST__ +#ifdef __TEST__ + // Abort if we are building for testing + abort(); +#else + // Show message box if we are not building for testing int result = MessageBoxA(nullptr, buffer, OPENRCT2_NAME, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION); if (result == IDABORT) { From 3a3e3c76d15d1c03ce818b3988b8aef400e21539 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 22:09:52 +0000 Subject: [PATCH 42/62] Rollback AppVeyor platform update --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index b8ebe79a07..ffc1f5e0cc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ version: 0.0.5.{build} -os: Visual Studio 2015 +os: Previous Visual Studio 2015 cache: - C:\ProgramData\chocolatey\bin -> scripts\ps\appveyor_install.ps1 - C:\ProgramData\chocolatey\lib -> scripts\ps\appveyor_install.ps1 From 7917d189cbd01e3e222ba5f7e535a4eaf702715f Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Sat, 3 Dec 2016 07:19:43 +0000 Subject: [PATCH 43/62] Readd addresses header to allow RCT2 builds --- src/drawing/sprite.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/drawing/sprite.c b/src/drawing/sprite.c index 4106e506bd..499eb4d2a6 100644 --- a/src/drawing/sprite.c +++ b/src/drawing/sprite.c @@ -14,6 +14,7 @@ *****************************************************************************/ #pragma endregion +#include "../addresses.h" #include "../common.h" #include "../openrct2.h" #include "../sprites.h" From 8892a5e17cf559063c38b09134a1fd92f226f907 Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 23:07:07 +0000 Subject: [PATCH 44/62] Fix AppVeyor for testing --- appveyor.yml | 9 ++------- openrct2.proj | 18 ++++++++++++------ scripts/ps/appveyor_deploy.ps1 | 24 ++++++++++++++---------- scripts/ps/appveyor_install.ps1 | 6 ++++-- 4 files changed, 32 insertions(+), 25 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ffc1f5e0cc..7ff10f3cdc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,16 +19,11 @@ install: platform: - Win32 - x64 -configuration: - - Release - - ReleaseTests +configuration: Release build: project: openrct2.proj test_script: -- ps: >- - if ($env:configuration -eq "ReleaseTests") { - msbuild openrct2.proj /t:test /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" - } +- ps: msbuild openrct2.proj /t:test /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" artifacts: - path: .\artifacts\openrct2-portable*.zip name: OpenRCT2-portable diff --git a/openrct2.proj b/openrct2.proj index ee68eea4b4..7c9c7259b3 100644 --- a/openrct2.proj +++ b/openrct2.proj @@ -16,6 +16,7 @@ Debug x64 + true $(GIT_COMMIT_SHA1.Substring(0, 7)) 0.0.5.0 @@ -213,7 +214,8 @@ - + @@ -221,7 +223,8 @@ - + @@ -234,14 +237,16 @@ - + <_7z Output="$(PublishZip)" Inputs="@(PublishItems)" /> - + <_7z Output="$(PublishSymbolsZip)" Inputs="@(SymbolItems)" /> @@ -252,7 +257,7 @@ DependsOnTargets="Build;g2" Inputs="@(PublishItems);$(NsisScript)" Outputs="$(PublishInstallerExe)" - Condition="'$(NO_NSIS)'!='true'"> + Condition="'$(NO_NSIS)'!='true' AND '$(TestConfig)'!='true'"> $([System.IO.Path]::GetFilename($(PublishInstallerExe))) @@ -280,7 +285,8 @@ DependsOnTargets="PublishSymbols;PublishPortable;PublishInstaller" /> - + https://openrct2.org/altapi/?command=push-build %(UploadArtifacts.Filename)%(UploadArtifacts.Extension) diff --git a/scripts/ps/appveyor_deploy.ps1 b/scripts/ps/appveyor_deploy.ps1 index bf63ce8592..55a5363f9f 100644 --- a/scripts/ps/appveyor_deploy.ps1 +++ b/scripts/ps/appveyor_deploy.ps1 @@ -2,20 +2,24 @@ # Script to deploy OpenRCT2 from AppVeyor # ########################################### -# Check if OpenRCT2.org API security token is available -if (${env:OPENRCT2_ORG_TOKEN}) +$testing = (${env:Configuration} -like "*tests") +if (-not $testing) { - # Only upload tagged builds, develop branch or push/ branches - if (${env:APPVEYOR_REPO_TAG} -eq "true" -or ${env:APPVEYOR_REPO_BRANCH} -match "^develop$|^push/") + # Check if OpenRCT2.org API security token is available + if (${env:OPENRCT2_ORG_TOKEN}) { - msbuild openrct2.proj /t:UploadArtifacts /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + # Only upload tagged builds, develop branch or push/ branches + if (${env:APPVEYOR_REPO_TAG} -eq "true" -or ${env:APPVEYOR_REPO_BRANCH} -match "^develop$|^push/") + { + msbuild openrct2.proj /t:UploadArtifacts /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" + } + else + { + Write-Host "No deployment: Non-tagged or push branch." -ForegroundColor Yellow + } } else { - Write-Host "No deployment: Non-tagged or push branch." -ForegroundColor Yellow + Write-Host "No deployment: %OPENRCT2_ORG_TOKEN% not available." -ForegroundColor Yellow } } -else -{ - Write-Host "No deployment: %OPENRCT2_ORG_TOKEN% not available." -ForegroundColor Yellow -} diff --git a/scripts/ps/appveyor_install.ps1 b/scripts/ps/appveyor_install.ps1 index 5dccee05bf..dadc11a679 100644 --- a/scripts/ps/appveyor_install.ps1 +++ b/scripts/ps/appveyor_install.ps1 @@ -2,6 +2,8 @@ # Script to setup OpenRCT2 for building on AppVeyor ######################################################### +$testing = (${env:Configuration} -like "*tests") + function Check-ExitCode { if ($LASTEXITCODE -ne 0) @@ -10,7 +12,7 @@ function Check-ExitCode } } -if ($env:ENCKEY) +if ($env:ENCKEY -and -not $testing) { if (-not (Test-Path "secure-file")) { @@ -24,7 +26,7 @@ if ($env:ENCKEY) } # Check if OpenRCT2.org API security token is available -if (${env:OPENRCT2_ORG_TOKEN}) +if (${env:OPENRCT2_ORG_TOKEN} -and -not $testing) { if (-not (Test-Path "C:\ProgramData\chocolatey\lib\nsis.portable")) { From a5de8934393c45158145e3538113f436087fcf29 Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Sun, 4 Dec 2016 04:00:22 +0000 Subject: [PATCH 45/62] Merge Localisation/master into OpenRCT2/develop. --- data/language/pt-BR.txt | 77 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 3 deletions(-) diff --git a/data/language/pt-BR.txt b/data/language/pt-BR.txt index 5667aa3d3c..d164c50fb1 100644 --- a/data/language/pt-BR.txt +++ b/data/language/pt-BR.txt @@ -3679,8 +3679,8 @@ STR_5337 :Entrada do parque STR_5338 :Tipo de elemento STR_5339 :{SMALLFONT}{BLACK}Altura da base STR_5340 :{SMALLFONT}{BLACK}Altura de segurança -STR_5341 :Bandeiras -STR_5342 :Escolha o azulejo do mapa +STR_5341 : +STR_5342 : STR_5343 :Colocar automaticamente funcionários STR_5344 :Log de mudanças STR_5345 :Trapaça financeira @@ -4187,7 +4187,7 @@ STR_5875 :Engine de desenho: STR_5876 :{SMALLFONT}{BLACK}Engine que será usada para desenhar o jogo. STR_5877 :Software STR_5878 :Software (exibição por hardware) -STR_5879 :OpenGL +STR_5879 :OpenGL (experimental) STR_5880 :Somente selecionados STR_5881 :Somente não selecionados STR_5882 :Moeda Personalizada @@ -4232,6 +4232,77 @@ STR_5920 :Renderizar efeitos climáticos STR_5921 :{SMALLFONT}{BLACK}Se habilitado, chuva e cores escuras serão renderizadas durante tempestades. STR_5922 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{SMALLFONT}{BLACK}Máx {STRINGID} STR_5923 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{SMALLFONT}{BLACK}Máx {COMMA16} {STRINGID} por trem +STR_5924 :Detalhes de superfície +STR_5925 :Detalhes de caminho +STR_5926 :Detalhes de pista +STR_5927 :Detalhes de cenário +STR_5928 :Detalhes de entrada +STR_5929 :Detalhes de cerca +STR_5930 :Detalhes de cenário grande +STR_5931 :Detalhes de banner +STR_5932 :Detalhes de elemento corrompido +STR_5933 :Propriedades +STR_5934 :{WINDOW_COLOUR_2}Textura do terreno: {BLACK}{STRINGID} +STR_5935 :{WINDOW_COLOUR_2}Borda do terreno: {BLACK}{STRINGID} +STR_5936 :{WINDOW_COLOUR_2}Posse de terra: {BLACK}{STRINGID} +STR_5937 :Não comprado e não está à venda +STR_5938 :{WINDOW_COLOUR_2}Nível da água: {BLACK}{COMMA16} +STR_5939 :Remover cercas do parque +STR_5940 :Restaurar cercas do parque +STR_5941 :{WINDOW_COLOUR_2}Altura da base: +STR_5942 :{WINDOW_COLOUR_2}Nome do caminho: {BLACK}{STRINGID} +STR_5943 :{WINDOW_COLOUR_2}Adições: {BLACK}{STRINGID} +STR_5944 :{WINDOW_COLOUR_2}Adições: {BLACK}Nenhuma +STR_5945 :{WINDOW_COLOUR_2}Bordas conectadas: +STR_5946 :{WINDOW_COLOUR_2}Tipo de atração: {BLACK}{STRINGID} +STR_5947 :{WINDOW_COLOUR_2}ID da atração: {BLACK}{COMMA16} +STR_5948 :{WINDOW_COLOUR_2}Nome da atração: {BLACK}{STRINGID} +STR_5949 :{WINDOW_COLOUR_2}Corrente de elevação +STR_5950 :{WINDOW_COLOUR_2}Aplicar mudanças para a pista toda +STR_5951 :{WINDOW_COLOUR_2}ID do pedaço de pista: {BLACK}{COMMA16} +STR_5952 :{WINDOW_COLOUR_2}Número sequencial: {BLACK}{COMMA16} +STR_5953 :{SMALLFONT}{BLACK}Sortear os elementos do mapa no azulejo atual baseado em sua altura base. +STR_5954 :{WINDOW_COLOUR_2}Idade do cenário: {BLACK}{COMMA16} +STR_5955 :{WINDOW_COLOUR_2}Posicionamento em quadrante: {BLACK}{STRINGID} +STR_5956 :Sudoeste +STR_5957 :Noroeste +STR_5958 :Nordeste +STR_5959 :Sudeste +STR_5960 :{WINDOW_COLOUR_2}Posicionamento em quadrante: +STR_5961 :{WINDOW_COLOUR_2}Índice de entrada: {BLACK}{COMMA16} +STR_5962 :{WINDOW_COLOUR_2}Detecção de colisão: +STR_5963 :{WINDOW_COLOUR_2}Cantos elevados: +STR_5964 :{WINDOW_COLOUR_2}Diagonal +STR_5965 :{WINDOW_COLOUR_2}Tipo de entrada: {BLACK}{STRINGID} +STR_5966 :{WINDOW_COLOUR_2}Parte de entrada do parque: {BLACK}{STRINGID} +STR_5967 :Meio +STR_5968 :Esquerda +STR_5969 :Direita +STR_5970 :{WINDOW_COLOUR_2}ID da entrada: {BLACK}{COMMA16} +STR_5971 :{WINDOW_COLOUR_2}ID da saída: {BLACK}{COMMA16} +STR_5972 :{WINDOW_COLOUR_2}ID da atração: {BLACK}{COMMA16} +STR_5973 :Prender ao próximo +STR_5974 :{SMALLFONT}{BLACK}Muda a base e a altura de segurançapara que sejam as mesmas que o próximo elemento no azulejo atual. Fazendo isto fica mais fácil de construir neste azulejo. +STR_5975 :Inclinação: +STR_5976 :Reto +STR_5977 :Direita para cima +STR_5978 :Esquerda para cima +STR_5979 :{WINDOW_COLOUR_2}Tipo de cerca: {BLACK}{COMMA16} +STR_5980 :{WINDOW_COLOUR_2}Texto do banner: {BLACK}{STRINGID} +STR_5981 :{WINDOW_COLOUR_2}Não é um banner +STR_5982 :{WINDOW_COLOUR_2}Tipo de cenário grande: {BLACK}{COMMA16} +STR_5983 :{WINDOW_COLOUR_2}ID da peça de cenário grande: {BLACK}{COMMA16} +STR_5984 :Caminhos bloqueados: +STR_5985 :Nova pasta +STR_5986 :Insira o nome da nova pasta. +STR_5987 :Impossível criar pasta +STR_5988 :{SMALLFONT}{BLACK}Não há posse de terra à venda +STR_5989 :{SMALLFONT}{BLACK}Não há direitos de construção à venda +STR_5990 :{SMALLFONT}{BLACK}Não há posse de terra ou direitos de construção à venda +STR_5991 :Impossível colar elemento... +STR_5992 :O limite de elementos no mapa foi atingido +STR_5993 :{SMALLFONT}{BLACK}Copiar elemento selecionado +STR_5994 :{SMALLFONT}{BLACK}Colar elemento selecionado ############# # Scenarios # From d2e1857733f800980ce90bc66262c04816d8b7f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sun, 4 Dec 2016 12:03:32 +0100 Subject: [PATCH 46/62] Fix #4793: Inventions list broken This reverts commit 3f767ed8ff2 and replaces it with exact check that doesn't trigger array-bounds GCC warning with `-O3` --- src/windows/editor_inventions_list.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/windows/editor_inventions_list.c b/src/windows/editor_inventions_list.c index ea26f61e36..bcc95604fd 100644 --- a/src/windows/editor_inventions_list.c +++ b/src/windows/editor_inventions_list.c @@ -419,9 +419,7 @@ static void move_research_item(rct_research_item *beforeItem) rct_window *w; rct_research_item *researchItem, draggedItem; - // We only really care about `_editorInventionsListDraggedItem == beforeItem - 1`, - // but this would cause a GCC warning due to -Warray-bounds - if (_editorInventionsListDraggedItem < beforeItem) + if (_editorInventionsListDraggedItem + 1 == beforeItem) return; // Back up the dragged item From f13056755405a1f618bc896bbf80112508df88e5 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sun, 4 Dec 2016 14:32:05 +0000 Subject: [PATCH 47/62] Define subsystem for release configuration --- openrct2.vcxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openrct2.vcxproj b/openrct2.vcxproj index 098d5abc10..b0ba61022c 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -65,7 +65,8 @@ $(OPENRCT2_CL_ADDITIONALOPTIONS) %(AdditionalOptions) - Console + Console + Windows @@ -587,6 +588,5 @@ - \ No newline at end of file From db39e66c5b3e1a1c9cf0e8e0896c2f9de685e168 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sun, 4 Dec 2016 15:24:48 +0000 Subject: [PATCH 48/62] Fix machine not specified warning --- openrct2.vcxproj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openrct2.vcxproj b/openrct2.vcxproj index b0ba61022c..0f0b64b570 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -68,8 +68,11 @@ Console Windows + + MachineX86 + MachineX64 + - From c462a6dd2356a3c1183017cd0224762c5ecd884d Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Tue, 6 Dec 2016 04:00:17 +0000 Subject: [PATCH 49/62] Merge Localisation/master into OpenRCT2/develop. --- data/language/fr-FR.txt | 14 +- data/language/zh-CN.txt | 1795 +++++++++++++++++++++++---------------- 2 files changed, 1050 insertions(+), 759 deletions(-) diff --git a/data/language/fr-FR.txt b/data/language/fr-FR.txt index 694320fc21..18a006df44 100644 --- a/data/language/fr-FR.txt +++ b/data/language/fr-FR.txt @@ -556,7 +556,7 @@ STR_0551 : STR_0552 : STR_0553 : STR_0554 :La voiture est propulsée hors de la station à l'aide de moteurs à induction linéaire puis, après avoir atteint une pointe verticale, revient à la station en chute libre -STR_0555 :Les passagers passent aux différents niveaux d'une tour verticale à bord d'un ascenceur +STR_0555 :Les passagers passent aux différents niveaux d'une tour verticale à bord d'un ascenseur STR_0556 :Des voitures très larges descendent des voies en pente verticale. pour amateurs de chute libre STR_0557 : STR_0558 : @@ -3185,7 +3185,7 @@ STR_3173 :Cet objet est déjà utilisé STR_3174 :Cet objet est requis par un autre objet STR_3175 :Cet objet est toujours requis STR_3176 :Impossible de sélectionner cet objet -STR_3177 :Impossible de déselectionner cet objet +STR_3177 :Impossible de désélectionner cet objet STR_3178 :Au moins un objet d'allée doit être sélectionné STR_3179 :Au moins un objet de véhicule ou d'attraction doit être sélectionné STR_3180 :Sélection d'objets non valide @@ -3262,8 +3262,8 @@ STR_3250 :Impossible d'augmenter davantage l'emprunt initial ! STR_3251 :Impossible de diminuer davantage l'emprunt initial ! STR_3252 :Impossible d'augmenter davantage l'emprunt maximum ! STR_3253 :Impossible de diminuer davantage l'emprunt maximum ! -STR_3254 :Impossible d'augmenter davantage le taux d'intérêts ! -STR_3255 :Impossible de diminuer davantage le taux d'intérêts ! +STR_3254 :Impossible d'augmenter davantage le taux d'intérêt ! +STR_3255 :Impossible de diminuer davantage le taux d'intérêt ! STR_3256 :Attr. moins dures pour visiteurs STR_3257 :{SMALLFONT}{BLACK}Choisir si vous souhaitez que les visiteurs préfèrent des attractions moins intenses STR_3258 :Attr. plus dures pour visiteurs @@ -3392,7 +3392,7 @@ STR_3380 :Impossible d'installer ce modèle de circuit... STR_3381 :Le fichier n'est pas compatible ou contient des données invalides STR_3382 :Copie du fichier échouée STR_3383 :Sélectionnez le nouveau nom pour le modèle de circuit -STR_3384 :Un modèle de circuit possède déjà ce nom - Veuillez en choisir un autre pour celui ci : +STR_3384 :Un modèle de circuit possède déjà ce nom - Veuillez en choisir un autre pour celui-ci : STR_3385 :Didacticiel pour débutants STR_3386 :Didacticiel attractions personnalisées STR_3387 :Didacticiel construction des montagnes russes @@ -3431,7 +3431,7 @@ STR_3419 :{SMALLFONT}{BLACK}Pour construire du décor l'un au-dessus de l'aut STR_3420 :{SMALLFONT}{BLACK}Certains éléments du décor peuvent être repeints après leur construction... STR_3421 :{SMALLFONT}{BLACK}Ajoutons un peu de musique à notre attraction... STR_3422 :{SMALLFONT}{BLACK}Construisons un montagne russe ! -STR_3423 :{SMALLFONT}{BLACK}Il y a plein de modèles pré-définis, mais nous allons construire notre propre circuit... +STR_3423 :{SMALLFONT}{BLACK}Il y a plein de modèles prédéfinis, mais nous allons construire notre propre circuit... STR_3424 :{SMALLFONT}{BLACK}Voilà la station construite. Maintenant la montée... STR_3425 :{SMALLFONT}{BLACK}Les trains des montagnes russes ne sont pas propulsés, une 'échelle' est nécessaire pour tirer le train lors de la première montée... STR_3426 :{SMALLFONT}{BLACK}La montée est terminée - Maintenant la descente... @@ -3523,7 +3523,7 @@ STR_5180 :{SMALLFONT}{BLACK}Afficher les options de triche du parc STR_5181 :{SMALLFONT}{BLACK}Afficher les options de triche des attractions STR_5182 :{INT32} STR_5183 :Hauteur de base -STR_5184 :Entrez une hauter de base entre {COMMA16} et {COMMA16} +STR_5184 :Entrez une hauteur de base entre {COMMA16} et {COMMA16} STR_5185 :Niveau de l'eau STR_5186 :Entrez un niveau d'eau entre {COMMA16} et {COMMA16} STR_5187 :Finances diff --git a/data/language/zh-CN.txt b/data/language/zh-CN.txt index f2f22683d7..c001fc8352 100644 --- a/data/language/zh-CN.txt +++ b/data/language/zh-CN.txt @@ -1661,36 +1661,36 @@ STR_1650 :{SMALLFONT}{OPENQUOTES}喔!一个新的设施正在建造{ENDQUOTES # Two removed inside jokes about Intamin and Phoenix STR_1651 : STR_1652 : -STR_1653 :{SMALLFONT}{OPENQUOTES}...and here we are on {STRINGID}!{ENDQUOTES} -STR_1654 :{WINDOW_COLOUR_2}Recent thoughts: -STR_1655 :{SMALLFONT}{BLACK}Construct footpath on land -STR_1656 :{SMALLFONT}{BLACK}Construct bridge or tunnel footpath -STR_1657 :{WINDOW_COLOUR_2}Preferred ride -STR_1658 :{WINDOW_COLOUR_2}intensity: {BLACK}less than {COMMA16} -STR_1659 :{WINDOW_COLOUR_2}intensity: {BLACK}between {COMMA16} and {COMMA16} -STR_1660 :{WINDOW_COLOUR_2}intensity: {BLACK}more than {COMMA16} -STR_1661 :{WINDOW_COLOUR_2}Nausea tolerance: {BLACK}{STRINGID} -STR_1662 :{WINDOW_COLOUR_2}Happiness: -STR_1663 :{WINDOW_COLOUR_2}Nausea: -STR_1664 :{WINDOW_COLOUR_2}Energy: -STR_1665 :{WINDOW_COLOUR_2}Hunger: -STR_1666 :{WINDOW_COLOUR_2}Thirst: -STR_1667 :{WINDOW_COLOUR_2}Bathroom: -STR_1668 :{WINDOW_COLOUR_2}Satisfaction: {BLACK}Unknown -STR_1669 :{WINDOW_COLOUR_2}Satisfaction: {BLACK}{COMMA16}% -STR_1670 :{WINDOW_COLOUR_2}Total customers: {BLACK}{COMMA32} -STR_1671 :{WINDOW_COLOUR_2}Total profit: {BLACK}{CURRENCY2DP} -STR_1672 :Brakes -STR_1673 :Spinning Control Toggle Track -STR_1674 :Brake speed +STR_1653 :{SMALLFONT}{OPENQUOTES}...现在我们已经在{STRINGID}上!{ENDQUOTES} +STR_1654 :{WINDOW_COLOUR_2}最近的想法: +STR_1655 :{SMALLFONT}{BLACK}在地上建造道路 +STR_1656 :{SMALLFONT}{BLACK}建造桥梁或隧道 +STR_1657 :{WINDOW_COLOUR_2}游乐设施选项 +STR_1658 :{WINDOW_COLOUR_2}刺激度: {BLACK}少于{COMMA16} +STR_1659 :{WINDOW_COLOUR_2}刺激度: {BLACK}介于{COMMA16}和{COMMA16}之间 +STR_1660 :{WINDOW_COLOUR_2}刺激度: {BLACK}大于{COMMA16} +STR_1661 :{WINDOW_COLOUR_2}恶心忍受度: {BLACK}{STRINGID} +STR_1662 :{WINDOW_COLOUR_2}快乐度: +STR_1663 :{WINDOW_COLOUR_2}恶心度: +STR_1664 :{WINDOW_COLOUR_2}体力: +STR_1665 :{WINDOW_COLOUR_2}饥饿度: +STR_1666 :{WINDOW_COLOUR_2}口渴度: +STR_1667 :{WINDOW_COLOUR_2}如厕度: +STR_1668 :{WINDOW_COLOUR_2}满意度: {BLACK}未知 +STR_1669 :{WINDOW_COLOUR_2}满意度: {BLACK}{COMMA16}% +STR_1670 :{WINDOW_COLOUR_2}总乘客数: {BLACK}{COMMA32} +STR_1671 :{WINDOW_COLOUR_2}总利润: {BLACK}{CURRENCY2DP} +STR_1672 :刹车 +STR_1673 :控制旋转开/关轨道 +STR_1674 :刹车速度 STR_1675 :{POP16}{VELOCITY} -STR_1676 :{SMALLFONT}{BLACK}Set speed limit for brakes -STR_1677 :{WINDOW_COLOUR_2}Popularity: {BLACK}Unknown -STR_1678 :{WINDOW_COLOUR_2}Popularity: {BLACK}{COMMA16}% -STR_1679 :Helix up (left) -STR_1680 :Helix up (right) -STR_1681 :Helix down (left) -STR_1682 :Helix down (right) +STR_1676 :{SMALLFONT}{BLACK}设置刹车速度限制 +STR_1677 :{WINDOW_COLOUR_2}受欢迎度: {BLACK}未知 +STR_1678 :{WINDOW_COLOUR_2}受欢迎度: {BLACK}{COMMA16}% +STR_1679 :向上盘旋 (向左) +STR_1680 :向上盘旋 (向右) +STR_1681 :向下盘旋 (向左) +STR_1682 :向下盘旋 (向右) STR_1683 :Base size 2 x 2 STR_1684 :Base size 4 x 4 STR_1685 :Base size 2 x 4 @@ -1705,9 +1705,9 @@ STR_1693 :{SMALLFONT}{BLACK}游客 STR_1694 :{SMALLFONT}{BLACK}职员 STR_1695 :{SMALLFONT}{BLACK}收入和支出 STR_1696 :{SMALLFONT}{BLACK}顾客信息 -STR_1697 :Cannot place these on queue line area -STR_1698 :Can only place these on queue area -STR_1699 :Too many people in game +STR_1697 :不能在等候区放置此物品 +STR_1698 :只能在等候区放置此物品 +STR_1699 :游戏中已有太多人 STR_1700 :雇佣新的清洁工 STR_1701 :雇佣新的机械工 STR_1702 :雇佣新的安保人员 @@ -1781,10 +1781,10 @@ STR_1769 :{WINDOW_COLOUR_2}Number of swings: STR_1770 :{SMALLFONT}{BLACK}Number of complete swings STR_1771 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{COMMA16} STR_1772 :{COMMA16} -STR_1773 :Only one on-ride photo section allowed per ride -STR_1774 :Only one cable lift hill allowed per ride -STR_1775 :Off -STR_1776 :On +STR_1773 :每个游乐设施只能建造一个照相区域 +STR_1774 :每个游乐设施只能建造一个牵引轨道 +STR_1775 :关闭 +STR_1776 :开启 STR_1777 :{WINDOW_COLOUR_2}设施音乐 STR_1778 :{STRINGID} - - STR_1779 :{INLINE_SPRITE}{254}{19}{00}{00} 熊猫服装 @@ -1798,33 +1798,33 @@ STR_1786 :{INLINE_SPRITE}{05}{20}{00}{00} 宇航员服装 STR_1787 :{INLINE_SPRITE}{06}{20}{00}{00} 土匪服装 STR_1788 :{INLINE_SPRITE}{07}{20}{00}{00} 警长服装 STR_1789 :{INLINE_SPRITE}{08}{20}{00}{00} 海盗服装 -STR_1790 :{SMALLFONT}{BLACK}Select uniform colour for this type of staff -STR_1791 :{WINDOW_COLOUR_2}Uniform colour: -STR_1792 :Responding to {STRINGID} breakdown call -STR_1793 :Heading to {STRINGID} for an inspection -STR_1794 :Fixing {STRINGID} -STR_1795 :Answering radio call -STR_1796 :Has broken down and requires fixing -STR_1797 :This option cannot be changed for this ride -STR_1798 :Whirlpool +STR_1790 :{SMALLFONT}{BLACK}选择这种员工的制服颜色 +STR_1791 :{WINDOW_COLOUR_2}制服的颜色: +STR_1792 :回应{STRINGID}的故障呼叫中 +STR_1793 :前往{STRINGID}检查中 +STR_1794 :修理{STRINGID}中 +STR_1795 :回应电台呼叫中 +STR_1796 :已经故障并需要修复 +STR_1797 :不能在这个游乐设施中更改这个选项 +STR_1798 :漩涡 STR_1799 :{POP16}{POP16}{POP16}{POP16}{POP16}{CURRENCY2DP} -STR_1800 :Safety cut-out -STR_1801 :Restraints stuck closed -STR_1802 :Restraints stuck open -STR_1803 :Doors stuck closed -STR_1804 :Doors stuck open -STR_1805 :Vehicle malfunction -STR_1806 :Brakes failure -STR_1807 :Control failure -STR_1808 :{WINDOW_COLOUR_2}Last breakdown: {BLACK}{STRINGID} -STR_1809 :{WINDOW_COLOUR_2}Current breakdown: {OUTLINE}{RED}{STRINGID} -STR_1810 :{WINDOW_COLOUR_2}Carrying: +STR_1800 :保险设备跳闸 +STR_1801 :保护设备卡住不能开启 +STR_1802 :保护设备卡住不能关闭 +STR_1803 :车门卡住不能开启 +STR_1804 :车门卡住不能关闭 +STR_1805 :车辆失灵 +STR_1806 :刹车设备故障 +STR_1807 :控制设备故障 +STR_1808 :{WINDOW_COLOUR_2}上次故障原因: {BLACK}{STRINGID} +STR_1809 :{WINDOW_COLOUR_2}本次故障原因: {OUTLINE}{RED}{STRINGID} +STR_1810 :{WINDOW_COLOUR_2}搬运中: STR_1811 :Can't build this here... STR_1812 :{SMALLFONT}{BLACK}{STRINGID} -STR_1813 :Miscellaneous Objects -STR_1814 :Actions -STR_1815 :Thoughts -STR_1816 :{SMALLFONT}{BLACK}Select information type to show in guest list +STR_1813 :其他物体 +STR_1814 :动作 +STR_1815 :想法 +STR_1816 :{SMALLFONT}{BLACK}选择游客列表中要显示的信息类别 STR_1817 :({COMMA16}) STR_1818 :{WINDOW_COLOUR_2}所有游客 STR_1819 :{WINDOW_COLOUR_2}所有游客(汇总) @@ -1834,51 +1834,51 @@ STR_1822 :{WINDOW_COLOUR_2}在想{POP16}{STRINGID}的游客 STR_1823 :{SMALLFONT}{BLACK}显示游客对此游乐设施/店铺的想法 STR_1824 :{SMALLFONT}{BLACK}显示在此游乐设施/店铺的游客 STR_1825 :{SMALLFONT}{BLACK}显示在此游乐设施/店铺排队等候的游客 -STR_1826 :Status -STR_1827 :Popularity -STR_1828 :Satisfaction -STR_1829 :Profit -STR_1830 :Queue length -STR_1831 :Queue time -STR_1832 :Reliability -STR_1833 :Down-time -STR_1834 :Guests favourite -STR_1835 :Popularity: Unknown -STR_1836 :Popularity: {COMMA16}% -STR_1837 :Satisfaction: Unknown -STR_1838 :Satisfaction: {COMMA16}% -STR_1839 :Reliability: {COMMA16}% -STR_1840 :Down-time: {COMMA16}% -STR_1841 :Profit: {CURRENCY2DP} per hour -STR_1842 :Favourite of: {COMMA16} guest -STR_1843 :Favourite of: {COMMA16} guests -STR_1844 :{SMALLFONT}{BLACK}Select information type to show in ride/attraction list +STR_1826 :状态 +STR_1827 :人气 +STR_1828 :满意度 +STR_1829 :利润 +STR_1830 :等候队列长度 +STR_1831 :等候时间 +STR_1832 :可靠度 +STR_1833 :故障度 +STR_1834 :游客最爱的游乐设施 +STR_1835 :人气度: 未知 +STR_1836 :人气度: {COMMA16}% +STR_1837 :满意度: 未知 +STR_1838 :满意度: {COMMA16}% +STR_1839 :可靠度: {COMMA16}% +STR_1840 :故障度: {COMMA16}% +STR_1841 :利润: 每小时{CURRENCY2DP} +STR_1842 :{COMMA16}游客最喜爱的游乐设施 +STR_1843 :{COMMA16}游客最喜爱的游乐设施 +STR_1844 :{SMALLFONT}{BLACK}选择要在游乐设施/店面列表中显示的信息类别 STR_1845 :{MONTHYEAR} -STR_1846 :{COMMA16} guests +STR_1846 :{COMMA16}游客 STR_1847 :{INLINE_SPRITE}{11}{20}{00}{00}{COMMA16} guests STR_1848 :{INLINE_SPRITE}{10}{20}{00}{00}{COMMA16} guests -STR_1849 :{WINDOW_COLOUR_2}Play music -STR_1850 :{SMALLFONT}{BLACK}Select whether music should be played for this ride -STR_1851 :{WINDOW_COLOUR_2}Running cost: {BLACK}{CURRENCY2DP} per hour -STR_1852 :{WINDOW_COLOUR_2}Running cost: {BLACK}Unknown -STR_1853 :{WINDOW_COLOUR_2}Built: {BLACK}This Year -STR_1854 :{WINDOW_COLOUR_2}Built: {BLACK}Last Year -STR_1855 :{WINDOW_COLOUR_2}Built: {BLACK}{COMMA16} Years Ago -STR_1856 :{WINDOW_COLOUR_2}Profit per item sold: {BLACK}{CURRENCY2DP} -STR_1857 :{WINDOW_COLOUR_2}Loss per item sold: {BLACK}{CURRENCY2DP} -STR_1858 :{WINDOW_COLOUR_2}Cost: {BLACK}{CURRENCY2DP} per month -STR_1859 :Handymen -STR_1860 :Mechanics -STR_1861 :Security Guards -STR_1862 :Entertainers -STR_1863 :Handyman -STR_1864 :Mechanic -STR_1865 :Security Guard -STR_1866 :Entertainer +STR_1849 :{WINDOW_COLOUR_2}播放音乐 +STR_1850 :{SMALLFONT}{BLACK}选择此游乐设施是否播放音乐 +STR_1851 :{WINDOW_COLOUR_2}运行成本: {BLACK}每小时{CURRENCY2DP} +STR_1852 :{WINDOW_COLOUR_2}运行成本: {BLACK}未知 +STR_1853 :{WINDOW_COLOUR_2}建造年份: {BLACK}今年 +STR_1854 :{WINDOW_COLOUR_2}建造年份: {BLACK}去年 +STR_1855 :{WINDOW_COLOUR_2}建造年份: {BLACK}{COMMA16}年前 +STR_1856 :{WINDOW_COLOUR_2}每件产品售出的利润: {BLACK}{CURRENCY2DP} +STR_1857 :{WINDOW_COLOUR_2}每件产品售出的亏损: {BLACK}{CURRENCY2DP} +STR_1858 :{WINDOW_COLOUR_2}成本: {BLACK}每个月{CURRENCY2DP} +STR_1859 :位清洁工 +STR_1860 :位维修工 +STR_1861 :位警卫 +STR_1862 :位演员 +STR_1863 :位清洁工 +STR_1864 :位维修工 +STR_1865 :位警卫 +STR_1866 :位演员 STR_1867 :{BLACK}{COMMA16} {STRINGID} -STR_1868 :Can't change number of rotations... -STR_1869 :{WINDOW_COLOUR_2}Number of rotations: -STR_1870 :{SMALLFONT}{BLACK}Number of complete rotations +STR_1868 :不能改变旋转次数... +STR_1869 :{WINDOW_COLOUR_2}旋转次数: +STR_1870 :{SMALLFONT}{BLACK}完整旋转次数 STR_1871 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{COMMA16} STR_1872 :{COMMA16} STR_1873 :{WINDOW_COLOUR_2}Income: {BLACK}{CURRENCY2DP} per hour @@ -1886,7 +1886,7 @@ STR_1874 :{WINDOW_COLOUR_2}Profit: {BLACK}{CURRENCY2DP} per hour STR_1875 :{BLACK} {SPRITE}{BLACK} {STRINGID} STR_1876 :{WINDOW_COLOUR_2}{INLINE_SPRITE}{251}{19}{00}{00}Inspect Rides STR_1877 :{WINDOW_COLOUR_2}{INLINE_SPRITE}{252}{19}{00}{00}Fix Rides -STR_1878 :{WINDOW_COLOUR_2}Inspection: +STR_1878 :{WINDOW_COLOUR_2}检查时间间隔: STR_1879 :每10分钟 STR_1880 :每20分钟 STR_1881 :每30分钟 @@ -1895,32 +1895,32 @@ STR_1883 :每小时 STR_1884 :每2小时 STR_1885 :从不 STR_1886 :Inspecting {STRINGID} -STR_1887 :{WINDOW_COLOUR_2}Time since last inspection: {BLACK}{COMMA16} minutes -STR_1888 :{WINDOW_COLOUR_2}Time since last inspection: {BLACK}more than 4 hours -STR_1889 :{WINDOW_COLOUR_2}Down-Time: {MOVE_X}{255}{BLACK}{COMMA16}% -STR_1890 :{SMALLFONT}{BLACK}Select how often a mechanic should check this ride -STR_1891 :No {STRINGID} in park yet! +STR_1887 :{WINDOW_COLOUR_2}上次检查时间: {BLACK}{COMMA16}分钟前 +STR_1888 :{WINDOW_COLOUR_2}上次检查时间: {BLACK}大于4小时 +STR_1889 :{WINDOW_COLOUR_2}故障度: {MOVE_X}{255}{BLACK}{COMMA16}% +STR_1890 :{SMALLFONT}{BLACK}选择维修工检查此游乐设施的时间间隔 +STR_1891 :在乐园里暂未有{STRINGID}! # The following two strings were used to display an error when the disc was missing. # This has been replaced in OpenRCT2. STR_1892 : STR_1893 : -STR_1894 :{WINDOW_COLOUR_2}{STRINGID} sold: {BLACK}{COMMA32} -STR_1895 :{SMALLFONT}{BLACK}Build new ride/attraction -STR_1896 :{WINDOW_COLOUR_2}Expenditure/Income -STR_1897 :{WINDOW_COLOUR_2}Ride construction -STR_1898 :{WINDOW_COLOUR_2}Ride running costs -STR_1899 :{WINDOW_COLOUR_2}Land purchase -STR_1900 :{WINDOW_COLOUR_2}Landscaping -STR_1901 :{WINDOW_COLOUR_2}Park entrance tickets -STR_1902 :{WINDOW_COLOUR_2}Ride tickets -STR_1903 :{WINDOW_COLOUR_2}Shop sales -STR_1904 :{WINDOW_COLOUR_2}Shop stock -STR_1905 :{WINDOW_COLOUR_2}Food/drink sales -STR_1906 :{WINDOW_COLOUR_2}Food/drink stock -STR_1907 :{WINDOW_COLOUR_2}Staff wages -STR_1908 :{WINDOW_COLOUR_2}Marketing +STR_1894 :{WINDOW_COLOUR_2}售出{STRINGID}: {BLACK}{COMMA32} +STR_1895 :{SMALLFONT}{BLACK}建造新的游乐设施/店铺 +STR_1896 :{WINDOW_COLOUR_2}支出/收入 +STR_1897 :{WINDOW_COLOUR_2}建造游乐设施 +STR_1898 :{WINDOW_COLOUR_2}运行游乐设施费用 +STR_1899 :{WINDOW_COLOUR_2}购买土地 +STR_1900 :{WINDOW_COLOUR_2}调整地形 +STR_1901 :{WINDOW_COLOUR_2}乐园入场门票 +STR_1902 :{WINDOW_COLOUR_2}游乐设施门票 +STR_1903 :{WINDOW_COLOUR_2}其他商品销售额 +STR_1904 :{WINDOW_COLOUR_2}其他商品进货 +STR_1905 :{WINDOW_COLOUR_2}食物/饮料销售额 +STR_1906 :{WINDOW_COLOUR_2}食物/饮料进货 +STR_1907 :{WINDOW_COLOUR_2}员工薪金 +STR_1908 :{WINDOW_COLOUR_2}营销费用 STR_1909 :{WINDOW_COLOUR_2}研发费用 -STR_1910 :{WINDOW_COLOUR_2}Loan interest +STR_1910 :{WINDOW_COLOUR_2}贷款利息 STR_1911 :{BLACK} at {COMMA16}% per year STR_1912 :{MONTH} STR_1913 :{BLACK}+{CURRENCY2DP} @@ -1928,48 +1928,48 @@ STR_1914 :{BLACK}{CURRENCY2DP} STR_1915 :{RED}{CURRENCY2DP} STR_1916 :{WINDOW_COLOUR_2}Loan: STR_1917 :{POP16}{POP16}{POP16}{CURRENCY} -STR_1918 :Can't borrow any more money! -STR_1919 :Not enough cash available! -STR_1920 :Can't pay back loan! +STR_1918 :不能再借贷更多钱! +STR_1919 :没有足够的现金! +STR_1920 :不能偿还贷款! STR_1921 :{SMALLFONT}{BLACK}开始新游戏 STR_1922 :{SMALLFONT}{BLACK}从存档继续玩 STR_1923 :{SMALLFONT}{BLACK}打开教学任务 STR_1924 :{SMALLFONT}{BLACK}退出游戏 -STR_1925 :Can't place person here... +STR_1925 :不能放置人物于此... STR_1926 :{SMALLFONT} -STR_1927 :{YELLOW}{STRINGID} has broken down -STR_1928 :{RED}{STRINGID} has crashed! -STR_1929 :{RED}{STRINGID} still hasn't been fixed{NEWLINE}Check where your mechanics are and consider organizing them better -STR_1930 :{SMALLFONT}{BLACK}Turn on/off tracking information for this guest - (If tracking is on, guest's movements will be reported in the message area) -STR_1931 :{STRINGID} has joined the queue line for {STRINGID} -STR_1932 :{STRINGID} is on {STRINGID} -STR_1933 :{STRINGID} is in {STRINGID} -STR_1934 :{STRINGID} has left {STRINGID} -STR_1935 :{STRINGID} has left the park -STR_1936 :{STRINGID} has bought {STRINGID} -STR_1937 :{SMALLFONT}{BLACK}Show information about the subject of this message -STR_1938 :{SMALLFONT}{BLACK}Show view of guest -STR_1939 :{SMALLFONT}{BLACK}Show view of staff member -STR_1940 :{SMALLFONT}{BLACK}Show happiness, energy, hunger etc. for this guest -STR_1941 :{SMALLFONT}{BLACK}Show which rides this guest has been on -STR_1942 :{SMALLFONT}{BLACK}Show financial information about this guest -STR_1943 :{SMALLFONT}{BLACK}Show guest's recent thoughts -STR_1944 :{SMALLFONT}{BLACK}Show items guest is carrying -STR_1945 :{SMALLFONT}{BLACK}Show orders and options for this staff member -STR_1946 :{SMALLFONT}{BLACK}Select costume for this entertainer -STR_1947 :{SMALLFONT}{BLACK}Show areas patrolled by selected staff type, and locate the nearest staff member -STR_1948 :{SMALLFONT}{BLACK}Hire a new staff member of the selected type -STR_1949 :Financial Summary -STR_1950 :Financial Graph -STR_1951 :Park Value Graph -STR_1952 :Profit Graph -STR_1953 :Marketing -STR_1954 :Research Funding -STR_1955 :{WINDOW_COLOUR_2}Number of circuits: -STR_1956 :{SMALLFONT}{BLACK}Number of circuits of track per ride +STR_1927 :{YELLOW}{STRINGID}发生故障了 +STR_1928 :{RED}{STRINGID}毁坏了! +STR_1929 :{RED}{STRINGID}依然未修复好{NEWLINE}请检查维修人员位置所在, 或考虑以更好的方法管理他们 +STR_1930 :{SMALLFONT}{BLACK}开启/关闭这位游客的追踪信息 - (假若开启追踪, 这位游客的行动将会报告于最近消息里) +STR_1931 :{STRINGID}已在轮候{STRINGID} +STR_1932 :{STRINGID}已在{STRINGID}上 +STR_1933 :{STRINGID}已在{STRINGID}中 +STR_1934 :{STRINGID}已离开{STRINGID} +STR_1935 :{STRINGID}已离开乐园 +STR_1936 :{STRINGID}已购买{STRINGID} +STR_1937 :{SMALLFONT}{BLACK}显示关于这个消息标题的信息 +STR_1938 :{SMALLFONT}{BLACK}显示游客所视 +STR_1939 :{SMALLFONT}{BLACK}显示员工所视 +STR_1940 :{SMALLFONT}{BLACK}显示这位游客的快乐度, 体力, 饥饿度等指标 +STR_1941 :{SMALLFONT}{BLACK}显示这位游客乘坐了甚么游乐设施 +STR_1942 :{SMALLFONT}{BLACK}显示这位游客的财政状况 +STR_1943 :{SMALLFONT}{BLACK}显示这位游客的最近想法 +STR_1944 :{SMALLFONT}{BLACK}显示这位游客携带中的对象 +STR_1945 :{SMALLFONT}{BLACK}显示有关这位员工的排序及选项 +STR_1946 :{SMALLFONT}{BLACK}选择这位表演人员的服装 +STR_1947 :{SMALLFONT}{BLACK}显示已分配被巡逻的区域, 以及将最近的员工定位 +STR_1948 :{SMALLFONT}{BLACK}雇用这个类别的新员工 +STR_1949 :财政概要 +STR_1950 :财政图表 +STR_1951 :乐园价值图表 +STR_1952 :营利图表 +STR_1953 :营销计划 +STR_1954 :研发资金 +STR_1955 :{WINDOW_COLOUR_2}圈数: +STR_1956 :{SMALLFONT}{BLACK}每次运转游乐设施的圈数 STR_1957 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{COMMA16} STR_1958 :{COMMA16} -STR_1959 :Can't change number of circuits... +STR_1959 :不能改变圈数... STR_1960 :{WINDOW_COLOUR_2}气球价格: STR_1961 :{WINDOW_COLOUR_2}毛绒公仔价格: STR_1962 :{WINDOW_COLOUR_2}游乐园地图价格: @@ -2096,7 +2096,7 @@ STR_2082 :空罐子 STR_2083 :垃圾 STR_2084 :空汉堡包装盒 STR_2085 :披萨 -STR_2086 :Voucher for {STRINGID} +STR_2086 :{STRINGID}的优惠券 STR_2087 :爆米花 STR_2088 :热狗 STR_2089 :触手 @@ -2220,31 +2220,31 @@ STR_2206 :空饮料包装 STR_2207 :空果汁杯 STR_2208 :烤香肠 STR_2209 :空碗 -STR_2210 :{SMALLFONT}{BLACK}Show list of handymen in park -STR_2211 :{SMALLFONT}{BLACK}Show list of mechanics in park -STR_2212 :{SMALLFONT}{BLACK}Show list of security guards in park -STR_2213 :{SMALLFONT}{BLACK}Show list of entertainers in park -STR_2214 :Construction not possible while game is paused! +STR_2210 :{SMALLFONT}{BLACK}列出乐园内的清洁工人 +STR_2211 :{SMALLFONT}{BLACK}列出乐园内的维修人员 +STR_2212 :{SMALLFONT}{BLACK}列出乐园内的安全警卫 +STR_2213 :{SMALLFONT}{BLACK}列出乐园内的表演人员 +STR_2214 :游戏暂停时无法建造任何物体! STR_2215 :{STRINGID}{NEWLINE}({STRINGID}) STR_2216 :{WINDOW_COLOUR_2}{COMMA16}{DEGREE}C STR_2217 :{WINDOW_COLOUR_2}{COMMA16}{DEGREE}F -STR_2218 :{RED}{STRINGID} on {STRINGID} hasn't returned to the {STRINGID} yet!{NEWLINE}Check whether it is stuck or has stalled -STR_2219 :{RED}{COMMA16} people have died in an accident on {STRINGID} -STR_2220 :{WINDOW_COLOUR_2}Park Rating: {BLACK}{COMMA16} -STR_2221 :{SMALLFONT}{BLACK}Park Rating: {COMMA16} +STR_2218 :{RED}{STRINGID}, {STRINGID}的一部份, 尚未返回到{STRINGID}!{NEWLINE}检查是否被卡住或被停止了 +STR_2219 :{RED}{COMMA16}人已丧生于{STRINGID}的意外中 +STR_2220 :{WINDOW_COLOUR_2}乐园评价: {BLACK}{COMMA16} +STR_2221 :{SMALLFONT}{BLACK}乐园评价: {COMMA16} STR_2222 :{SMALLFONT}{BLACK}{STRINGID} -STR_2223 :{WINDOW_COLOUR_2}Guests in park: {BLACK}{COMMA16} -STR_2224 :{WINDOW_COLOUR_2}Cash: {BLACK}{CURRENCY2DP} -STR_2225 :{WINDOW_COLOUR_2}Cash: {RED}{CURRENCY2DP} -STR_2226 :{WINDOW_COLOUR_2}Park value: {BLACK}{CURRENCY} -STR_2227 :{WINDOW_COLOUR_2}Company value: {BLACK}{CURRENCY} -STR_2228 :{WINDOW_COLOUR_2}Last month's profit from food/drink and{NEWLINE}merchandise sales: {BLACK}{CURRENCY} -STR_2229 :Slope up to vertical -STR_2230 :Vertical track -STR_2231 :Holding brake for drop -STR_2232 :Cable lift hill +STR_2223 :{WINDOW_COLOUR_2}园内游客: {BLACK}{COMMA16} +STR_2224 :{WINDOW_COLOUR_2}现金: {BLACK}{CURRENCY2DP} +STR_2225 :{WINDOW_COLOUR_2}现金: {RED}{CURRENCY2DP} +STR_2226 :{WINDOW_COLOUR_2}乐园价值: {BLACK}{CURRENCY} +STR_2227 :{WINDOW_COLOUR_2}公司价值: {BLACK}{CURRENCY} +STR_2228 :{WINDOW_COLOUR_2}上个月来自食物/饮料以及{NEWLINE}其他商品的销售额: {BLACK}{CURRENCY} +STR_2229 :上坡到垂直的过渡轨道 +STR_2230 :垂直轨道 +STR_2231 :下落刹车设备 +STR_2232 :缆索坡道 STR_2233 :{SMALLFONT}{BLACK}游乐园信息 -STR_2234 :Recent Messages +STR_2234 :最近消息 STR_2235 :{SMALLFONT}{STRINGID} {STRINGID} STR_2236 :1月 STR_2237 :2月 @@ -2258,85 +2258,85 @@ STR_2244 :9月 STR_2245 :10月 STR_2246 :11月 STR_2247 :12月 -STR_2248 :Can't demolish ride/attraction... -STR_2249 :{BABYBLUE}New ride/attraction now available:{NEWLINE}{STRINGID} -STR_2250 :{BABYBLUE}New scenery/themeing now available:{NEWLINE}{STRINGID} -STR_2251 :Can only be built on paths! -STR_2252 :Can only be built across paths! -STR_2253 :Transport Rides -STR_2254 :Gentle Rides -STR_2255 :Roller Coasters -STR_2256 :Thrill Rides -STR_2257 :Water Rides -STR_2258 :Shops & Stalls -STR_2259 :Scenery & Themeing -STR_2260 :No funding -STR_2261 :Minimum funding -STR_2262 :Normal funding -STR_2263 :Maximum funding -STR_2264 :Research funding -STR_2265 :{WINDOW_COLOUR_2}Cost: {BLACK}{CURRENCY} per month -STR_2266 :Research priorities -STR_2267 :Currently in development -STR_2268 :Last development -STR_2269 :{WINDOW_COLOUR_2}Type: {BLACK}{STRINGID} -STR_2270 :{WINDOW_COLOUR_2}Progress: {BLACK}{STRINGID} -STR_2271 :{WINDOW_COLOUR_2}Expected: {BLACK}{STRINGID} -STR_2272 :{WINDOW_COLOUR_2}Ride/attraction:{NEWLINE}{BLACK}{STRINGID} -STR_2273 :{WINDOW_COLOUR_2}Scenery/themeing:{NEWLINE}{BLACK}{STRINGID} -STR_2274 :{SMALLFONT}{BLACK}Show details of this invention or development -STR_2275 :{SMALLFONT}{BLACK}Show funding and options for research & development -STR_2276 :{SMALLFONT}{BLACK}Show research & development status -STR_2277 :Unknown -STR_2278 :Transport Ride -STR_2279 :Gentle Ride -STR_2280 :Roller Coaster -STR_2281 :Thrill Ride -STR_2282 :Water Ride -STR_2283 :Shop/Stall -STR_2284 :Scenery/Themeing -STR_2285 :Initial research -STR_2286 :Designing -STR_2287 :Completing design -STR_2288 :Unknown +STR_2248 :不能移除游乐设施/店铺... +STR_2249 :{BABYBLUE}全新游乐设施/店铺可供使用:{NEWLINE}{STRINGID} +STR_2250 :{BABYBLUE}全新景物/主题景物可供使用:{NEWLINE}{STRINGID} +STR_2251 :只可以在道路上建造! +STR_2252 :只可以横过道路建造! +STR_2253 :运输类游乐设施 +STR_2254 :温和类游乐设施 +STR_2255 :云霄飞车 +STR_2256 :剌激类游乐设施 +STR_2257 :水文类游乐设施 +STR_2258 :商店及摊贩 +STR_2259 :景物及主题景物 +STR_2260 :无资金 +STR_2261 :最少资金 +STR_2262 :普通资金 +STR_2263 :最多资金 +STR_2264 :研发资金分配 +STR_2265 :{WINDOW_COLOUR_2}费用: {BLACK}每个月{CURRENCY} +STR_2266 :研发优先项目 +STR_2267 :目前研发项目 +STR_2268 :上次研发项目 +STR_2269 :{WINDOW_COLOUR_2}类别: {BLACK}{STRINGID} +STR_2270 :{WINDOW_COLOUR_2}进度: {BLACK}{STRINGID} +STR_2271 :{WINDOW_COLOUR_2}预计完工日期: {BLACK}{STRINGID} +STR_2272 :{WINDOW_COLOUR_2}游乐设施/店铺:{NEWLINE}{BLACK}{STRINGID} +STR_2273 :{WINDOW_COLOUR_2}景物/主题景物:{NEWLINE}{BLACK}{STRINGID} +STR_2274 :{SMALLFONT}{BLACK}显示此研发项目的详细数据 +STR_2275 :{SMALLFONT}{BLACK}显示研发的资金分配及选项 +STR_2276 :{SMALLFONT}{BLACK}显示研发项目进度 +STR_2277 :未知 +STR_2278 :运输类游乐设施 +STR_2279 :温和类游乐设施 +STR_2280 :云霄飞车 +STR_2281 :剌激类游乐设施 +STR_2282 :水文类游乐设施 +STR_2283 :商店及摊贩 +STR_2284 :景物及主题景物 +STR_2285 :初始研发 +STR_2286 :设计中 +STR_2287 :完成设计中 +STR_2288 :未知 STR_2289 :{STRINGID} {STRINGID} STR_2290 : -STR_2291 :Select scenario for new game -STR_2292 :{WINDOW_COLOUR_2}Rides been on: -STR_2293 :{BLACK} Nothing -STR_2294 :{SMALLFONT}{BLACK}Change base land style -STR_2295 :{SMALLFONT}{BLACK}Change vertical edges of land -STR_2296 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} paid to enter park -STR_2297 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} spent on {BLACK}{COMMA16} ride -STR_2298 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} spent on {BLACK}{COMMA16} rides -STR_2299 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} spent on {BLACK}{COMMA16} item of food -STR_2300 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} spent on {BLACK}{COMMA16} items of food -STR_2301 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} spent on {BLACK}{COMMA16} drink -STR_2302 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} spent on {BLACK}{COMMA16} drinks -STR_2303 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} spent on {BLACK}{COMMA16} souvenir -STR_2304 :{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2} spent on {BLACK}{COMMA16} souvenirs -STR_2305 :Track design files -STR_2306 :Save track design -STR_2307 :Select {STRINGID} design -STR_2308 :{STRINGID} Track Designs -STR_2309 :Install New Track Design -STR_2310 :Build custom design -STR_2311 :{WINDOW_COLOUR_2}Excitement rating: {BLACK}{COMMA2DP32} (approx.) -STR_2312 :{WINDOW_COLOUR_2}Intensity rating: {BLACK}{COMMA2DP32} (approx.) -STR_2313 :{WINDOW_COLOUR_2}Nausea rating: {BLACK}{COMMA2DP32} (approx.) -STR_2314 :{WINDOW_COLOUR_2}Ride length: {BLACK}{STRINGID} -STR_2315 :{WINDOW_COLOUR_2}Cost: {BLACK}around {CURRENCY} -STR_2316 :{WINDOW_COLOUR_2}Space required: {BLACK}{COMMA16} x {COMMA16} blocks +STR_2291 :选择新游戏的剧情 +STR_2292 :{WINDOW_COLOUR_2}乘坐过的游乐设施: +STR_2293 :{BLACK}无 +STR_2294 :{SMALLFONT}{BLACK}更改基础土地样式 +STR_2295 :{SMALLFONT}{BLACK}更改土地的垂直边界 +STR_2296 :{WINDOW_COLOUR_2}付了{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2}进入乐园 +STR_2297 :{WINDOW_COLOUR_2}付了{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2}乘坐{BLACK}{COMMA16}个游乐设施 +STR_2298 :{WINDOW_COLOUR_2}付了{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2}乘坐{BLACK}{COMMA16}个游乐设施 +STR_2299 :{WINDOW_COLOUR_2}付了{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2}享用{BLACK}{COMMA16}款食物 +STR_2300 :{WINDOW_COLOUR_2}付了{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2}享用{BLACK}{COMMA16}款食物 +STR_2301 :{WINDOW_COLOUR_2}付了{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2}享用{BLACK}{COMMA16}款饮料 +STR_2302 :{WINDOW_COLOUR_2}付了{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2}享用{BLACK}{COMMA16}款饮料 +STR_2303 :{WINDOW_COLOUR_2}付了{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2}购买{BLACK}{COMMA16}个记念品 +STR_2304 :{WINDOW_COLOUR_2}付了{BLACK}{CURRENCY2DP}{WINDOW_COLOUR_2}购买{BLACK}{COMMA16}个记念品 +STR_2305 :轨道设计文件 +STR_2306 :存储轨道设计 +STR_2307 :选择{STRINGID}的设计 +STR_2308 :{STRINGID}的设计文件 +STR_2309 :安装新的轨道设计 +STR_2310 :建造自订设计 +STR_2311 :{WINDOW_COLOUR_2}兴奋度: {BLACK}{COMMA2DP32} (大约) +STR_2312 :{WINDOW_COLOUR_2}刺激度: {BLACK}{COMMA2DP32} (大约) +STR_2313 :{WINDOW_COLOUR_2}恶心度: {BLACK}{COMMA2DP32} (大约) +STR_2314 :{WINDOW_COLOUR_2}轨道长度: {BLACK}{STRINGID} +STR_2315 :{WINDOW_COLOUR_2}建造费用: {BLACK}约{CURRENCY} +STR_2316 :{WINDOW_COLOUR_2}需要空间: {BLACK}{COMMA16} x {COMMA16}格 STR_2317 : STR_2318 : STR_2319 : STR_2320 : -STR_2321 :{WINDOW_COLOUR_2}Number of rides/attractions: {BLACK}{COMMA16} -STR_2322 :{WINDOW_COLOUR_2}Staff: {BLACK}{COMMA16} -STR_2323 :{WINDOW_COLOUR_2}Park size: {BLACK}{COMMA32}m{SQUARED} -STR_2324 :{WINDOW_COLOUR_2}Park size: {BLACK}{COMMA32}sq.ft. -STR_2325 :{SMALLFONT}{BLACK}Buy land to extend park -STR_2326 :{SMALLFONT}{BLACK}Buy construction rights to allow construction above or below land outside the park +STR_2321 :{WINDOW_COLOUR_2}游乐设施/店铺数目: {BLACK}{COMMA16} +STR_2322 :{WINDOW_COLOUR_2}员工数目: {BLACK}{COMMA16} +STR_2323 :{WINDOW_COLOUR_2}乐园大小: {BLACK}{COMMA32}m{SQUARED} +STR_2324 :{WINDOW_COLOUR_2}乐园大小: {BLACK}{COMMA32}平方英尺 +STR_2325 :{SMALLFONT}{BLACK}购买土地来扩展乐园 +STR_2326 :{SMALLFONT}{BLACK}购买建造权来准许在乐园范围外的空中或地底建造对象 STR_2327 :选项 STR_2328 :{WINDOW_COLOUR_2}货币单位: STR_2329 :{WINDOW_COLOUR_2}距离和速度单位: @@ -2357,17 +2357,17 @@ STR_2343 :欧元 ({EURO}) STR_2344 :英制 STR_2345 :公制 STR_2346 :显示 -STR_2347 :{RED}{STRINGID} has drowned! -STR_2348 :{SMALLFONT}{BLACK}Show statistics for this staff member -STR_2349 :{WINDOW_COLOUR_2}Wages: {BLACK}{CURRENCY} per month -STR_2350 :{WINDOW_COLOUR_2}Employed: {BLACK}{MONTHYEAR} -STR_2351 :{WINDOW_COLOUR_2}Lawns mown: {BLACK}{COMMA16} -STR_2352 :{WINDOW_COLOUR_2}Gardens watered: {BLACK}{COMMA16} -STR_2353 :{WINDOW_COLOUR_2}Litter swept: {BLACK}{COMMA16} -STR_2354 :{WINDOW_COLOUR_2}Bins emptied: {BLACK}{COMMA16} -STR_2355 :{WINDOW_COLOUR_2}Rides fixed: {BLACK}{COMMA16} -STR_2356 :{WINDOW_COLOUR_2}Rides inspected: {BLACK}{COMMA16} -STR_2357 :House +STR_2347 :{RED}{STRINGID}已被溺死! +STR_2348 :{SMALLFONT}{BLACK}显示这位员工的统计数据 +STR_2349 :{WINDOW_COLOUR_2}工资: {BLACK}每个月{CURRENCY} +STR_2350 :{WINDOW_COLOUR_2}雇用日期: {BLACK}{MONTHYEAR} +STR_2351 :{WINDOW_COLOUR_2}除草次数: {BLACK}{COMMA16} +STR_2352 :{WINDOW_COLOUR_2}灌溉次数: {BLACK}{COMMA16} +STR_2353 :{WINDOW_COLOUR_2}扫地次数: {BLACK}{COMMA16} +STR_2354 :{WINDOW_COLOUR_2}清空拉坡筒次数: {BLACK}{COMMA16} +STR_2355 :{WINDOW_COLOUR_2}修理游乐设施次数: {BLACK}{COMMA16} +STR_2356 :{WINDOW_COLOUR_2}检验游乐设施次数: {BLACK}{COMMA16} +STR_2357 :房屋 STR_2358 :单位 STR_2359 :真实数值 STR_2360 :屏幕分辨率: @@ -2375,77 +2375,77 @@ STR_2361 :地表边缘平滑 STR_2362 :{SMALLFONT}{BLACK}开启/关闭地表边缘平滑 STR_2363 :地表网格 STR_2364 :{SMALLFONT}{BLACK}开启/关闭地表网格显示 -STR_2365 :The bank refuses to increase your loan! +STR_2365 :银行拒绝增加你的贷款额! STR_2366 :摄氏 ({DEGREE}C) STR_2367 :华氏 ({DEGREE}F) -STR_2368 :None -STR_2369 :Low -STR_2370 :Average -STR_2371 :High -STR_2372 :Low -STR_2373 :Medium -STR_2374 :High -STR_2375 :Very high -STR_2376 :Extreme -STR_2377 :Ultra-Extreme -STR_2378 :{SMALLFONT}{BLACK}Adjust smaller area of land -STR_2379 :{SMALLFONT}{BLACK}Adjust larger area of land -STR_2380 :{SMALLFONT}{BLACK}Adjust smaller area of water -STR_2381 :{SMALLFONT}{BLACK}Adjust larger area of water -STR_2382 :Land -STR_2383 :Water +STR_2368 :无 +STR_2369 :低 +STR_2370 :普通 +STR_2371 :高 +STR_2372 :低 +STR_2373 :中 +STR_2374 :高 +STR_2375 :很高 +STR_2376 :极端 +STR_2377 :超极端 +STR_2378 :{SMALLFONT}{BLACK}调整较小的土地区域 +STR_2379 :{SMALLFONT}{BLACK}调整较大的土地区域 +STR_2380 :{SMALLFONT}{BLACK}调整较小的水塘区域 +STR_2381 :{SMALLFONT}{BLACK}调整较大的水塘区域 +STR_2382 :土地 +STR_2383 :水面 STR_2384 :{WINDOW_COLOUR_2}你的目标 -STR_2385 :{BLACK}None +STR_2385 :{BLACK}无 STR_2386 :{BLACK}在 {MONTHYEAR} 之前乐园内至少有 {COMMA16} 游客, 并且乐园评分不低于 600 STR_2387 :{BLACK}在 {PUSH16}{PUSH16}{PUSH16}{MONTHYEAR} 之前乐园价值不低于 {POP16}{POP16}{CURRENCY} -STR_2388 :{BLACK}Have Fun! -STR_2389 :{BLACK}Build the best {STRINGID} you can! +STR_2388 :{BLACK}尽情玩吧! +STR_2389 :{BLACK}建造你的最佳{STRINGID}吧! STR_2390 :{BLACK}在你的乐园中运营10种类型的过山车, 并且每一个的兴奋度不低于 6.00 STR_2391 :{BLACK}乐园内至少有 {COMMA16} 游客,并且在任何时候你都不能让公园评分低于700 ! STR_2392 :{BLACK}每个月的门票收入至少 {POP16}{POP16}{CURRENCY} STR_2393 :{BLACK}在你的乐园中运营10种类型的过山车, 每一个的长度至少 {LENGTH}, 并且每一个的兴奋度不低于 7.00 -STR_2394 :{BLACK}To finish building all 5 of the partially built roller coasters in this park, designing them to achieve excitement ratings of at least {POP16}{POP16}{COMMA2DP32} each -STR_2395 :{BLACK}To repay your loan and achieve a park value of at least {POP16}{POP16}{CURRENCY} -STR_2396 :{BLACK}To achieve a monthly profit from food, drink and merchandise sales of at least {POP16}{POP16}{CURRENCY} -STR_2397 :None -STR_2398 :Number of guests at a given date -STR_2399 :Park value at a given date -STR_2400 :Have fun -STR_2401 :Build the best ride you can -STR_2402 :Build 10 roller coasters -STR_2403 :Number of guests in park -STR_2404 :Monthly income from ride tickets -STR_2405 :Build 10 roller coasters of a given length -STR_2406 :Finish building 5 roller coasters -STR_2407 :Repay loan and achieve a given park value -STR_2408 :Monthly profit from food/merchandise -STR_2409 :{WINDOW_COLOUR_2}Marketing campaigns in operation -STR_2410 :{BLACK}None -STR_2411 :{WINDOW_COLOUR_2}Marketing campaigns available -STR_2412 :{SMALLFONT}{BLACK}Start this marketing campaign -STR_2413 :{BLACK}({CURRENCY2DP} per week) -STR_2414 :(Not Selected) -STR_2415 :{WINDOW_COLOUR_2}Ride: -STR_2416 :{WINDOW_COLOUR_2}Item: -STR_2417 :{WINDOW_COLOUR_2}Length of time: -STR_2418 :Free entry to {STRINGID} -STR_2419 :Free ride on {STRINGID} -STR_2420 :Half-price entry to {STRINGID} -STR_2421 :Free {STRINGID} -STR_2422 :Advertising campaign for {STRINGID} -STR_2423 :Advertising campaign for {STRINGID} -STR_2424 :{WINDOW_COLOUR_2}Vouchers for free entry to the park -STR_2425 :{WINDOW_COLOUR_2}Vouchers for free rides on a particular ride -STR_2426 :{WINDOW_COLOUR_2}Vouchers for half-price entry to the park -STR_2427 :{WINDOW_COLOUR_2}Vouchers for free food or drink -STR_2428 :{WINDOW_COLOUR_2}Advertising campaign for the park -STR_2429 :{WINDOW_COLOUR_2}Advertising campaign for a particular ride -STR_2430 :{BLACK}Vouchers for free entry to {STRINGID} -STR_2431 :{BLACK}Vouchers for free ride on {STRINGID} -STR_2432 :{BLACK}Vouchers for half-price entry to {STRINGID} -STR_2433 :{BLACK}Vouchers for free {STRINGID} -STR_2434 :{BLACK}Advertising campaign for {STRINGID} -STR_2435 :{BLACK}Advertising campaign for {STRINGID} +STR_2394 :{BLACK}建造好五座未完成的云霄飞车, 将他们每座设计成兴奋度至少达到{POP16}{POP16}{COMMA2DP32} +STR_2395 :{BLACK}还清乐园的贷款, 并令其价值至少达到{POP16}{POP16}{CURRENCY} +STR_2396 :{BLACK}食物, 饮料及纪念品的销售收入至少要达到每月{POP16}{POP16}{CURRENCY} +STR_2397 :无 +STR_2398 :指定日期要达到的游客数量 +STR_2399 :指定日期要达到的乐园评价 +STR_2400 :尽情玩吧 +STR_2401 :建造你的最佳游乐设施 +STR_2402 :建造十座云霄飞车 +STR_2403 :乐园内游客数量 +STR_2404 :游乐设施门票的每月收入 +STR_2405 :建造十座指定长度的云霄飞车 +STR_2406 :完成建造五座云霄飞车 +STR_2407 :付清贷款及达到指定乐园评价 +STR_2408 :食物/饮料或其他商品的每月收入 +STR_2409 :{WINDOW_COLOUR_2}实行中的营销计划 +STR_2410 :{BLACK}无 +STR_2411 :{WINDOW_COLOUR_2}可以实行的营销计划 +STR_2412 :{SMALLFONT}{BLACK}开始实行这个营销计划 +STR_2413 :{BLACK}(每周{CURRENCY2DP}) +STR_2414 :(尚未选择) +STR_2415 :{WINDOW_COLOUR_2}游乐设施: +STR_2416 :{WINDOW_COLOUR_2}物品: +STR_2417 :{WINDOW_COLOUR_2}时长: +STR_2418 :免费进入{STRINGID} +STR_2419 :免费乘坐{STRINGID} +STR_2420 :半价进入{STRINGID} +STR_2421 :免费{STRINGID} +STR_2422 :{STRINGID}的推广计划 +STR_2423 :{STRINGID}的推广计划 +STR_2424 :{WINDOW_COLOUR_2}发放免费进入乐园卷 +STR_2425 :{WINDOW_COLOUR_2}发放免费乘坐个别游乐设施卷 +STR_2426 :{WINDOW_COLOUR_2}发放半价进入乐园卷 +STR_2427 :{WINDOW_COLOUR_2}发放免费进入食物或饮料乐园卷 +STR_2428 :{WINDOW_COLOUR_2}开始针对乐园的推广计划 +STR_2429 :{WINDOW_COLOUR_2}开始针对个别游乐设施的推广计划 +STR_2430 :{BLACK}免费进入{STRINGID}的优惠卷 +STR_2431 :{BLACK}免费乘坐{STRINGID}的优惠卷 +STR_2432 :{BLACK}半价进入{STRINGID}的优惠卷 +STR_2433 :{BLACK}免费{STRINGID}的优惠卷 +STR_2434 :{BLACK}{STRINGID}的推广计划 +STR_2435 :{BLACK}{STRINGID}的推广计划 STR_2436 :1 week STR_2437 : STR_2438 : @@ -2453,76 +2453,76 @@ STR_2439 : STR_2440 : STR_2441 : STR_2442 : -STR_2443 :{WINDOW_COLOUR_2}Cost per week: {BLACK}{CURRENCY2DP} -STR_2444 :{WINDOW_COLOUR_2}Total cost: {BLACK}{CURRENCY2DP} -STR_2445 :Start this marketing campaign -STR_2446 :{YELLOW}Your marketing campaign for free entry to the park has finished -STR_2447 :{YELLOW}Your marketing campaign for free rides on {STRINGID} has finished -STR_2448 :{YELLOW}Your marketing campaign for half-price entry to the park has finished -STR_2449 :{YELLOW}Your marketing campaign for free {STRINGID} has finished -STR_2450 :{YELLOW}Your advertising campaign for the park has finished -STR_2451 :{YELLOW}Your advertising campaign for {STRINGID} has finished -STR_2452 :{WINDOW_COLOUR_2}Cash (less loan): {BLACK}{CURRENCY2DP} -STR_2453 :{WINDOW_COLOUR_2}Cash (less loan): {RED}{CURRENCY2DP} -STR_2454 :{SMALLFONT}{BLACK}{CURRENCY2DP} - -STR_2455 :{SMALLFONT}{BLACK}+{CURRENCY2DP} - -STR_2456 :{SMALLFONT}{BLACK}{CURRENCY2DP} - -STR_2457 :{SMALLFONT}{BLACK}Show financial accounts -STR_2458 :{SMALLFONT}{BLACK}Show graph of cash (less loan) over time -STR_2459 :{SMALLFONT}{BLACK}Show graph of park value over time -STR_2460 :{SMALLFONT}{BLACK}Show graph of weekly profit -STR_2461 :{SMALLFONT}{BLACK}Show marketing campaigns -STR_2462 :{SMALLFONT}{BLACK}Show view of park entrance -STR_2463 :{SMALLFONT}{BLACK}Show graph of park ratings over time -STR_2464 :{SMALLFONT}{BLACK}Show graph of guest numbers over time -STR_2465 :{SMALLFONT}{BLACK}Show park entrance price and information -STR_2466 :{SMALLFONT}{BLACK}Show park statistics -STR_2467 :{SMALLFONT}{BLACK}Show objectives for this game -STR_2468 :{SMALLFONT}{BLACK}Show recent awards this park has received -STR_2469 :{SMALLFONT}{BLACK}Select level of research & development -STR_2470 :{SMALLFONT}{BLACK}Research new transport rides -STR_2471 :{SMALLFONT}{BLACK}Research new gentle rides -STR_2472 :{SMALLFONT}{BLACK}Research new roller coasters -STR_2473 :{SMALLFONT}{BLACK}Research new thrill rides -STR_2474 :{SMALLFONT}{BLACK}Research new water rides -STR_2475 :{SMALLFONT}{BLACK}Research new shops and stalls -STR_2476 :{SMALLFONT}{BLACK}Research new scenery and themeing -STR_2477 :{SMALLFONT}{BLACK}Select operating mode for this ride/attraction -STR_2478 :{SMALLFONT}{BLACK}Show graph of velocity against time -STR_2479 :{SMALLFONT}{BLACK}Show graph of altitude against time -STR_2480 :{SMALLFONT}{BLACK}Show graph of vertical acceleration against time -STR_2481 :{SMALLFONT}{BLACK}Show graph of lateral acceleration against time -STR_2482 :{SMALLFONT}{BLACK}Profit: {CURRENCY} per week, Park Value: {CURRENCY} -STR_2483 :{WINDOW_COLOUR_2}Weekly profit: {BLACK}+{CURRENCY2DP} -STR_2484 :{WINDOW_COLOUR_2}Weekly profit: {RED}{CURRENCY2DP} -STR_2485 :Controls -STR_2486 :General +STR_2443 :{WINDOW_COLOUR_2}每周费用:{BLACK} {CURRENCY2DP} +STR_2444 :{WINDOW_COLOUR_2}总费用:{BLACK} {CURRENCY2DP} +STR_2445 :开始实行此营销计划 +STR_2446 :{YELLOW}你举行的行销计划 - 免费进入乐园营销计划现已结束 +STR_2447 :{YELLOW}你举行的行销计划 - 免费乘坐游乐设施{STRINGID}现已结束 +STR_2448 :{YELLOW}你举行的行销计划 - 半价进入乐园现已结束 +STR_2449 :{YELLOW}你举行的行销计划 - 免费{STRINGID}现已结束 +STR_2450 :{YELLOW}你针对乐园的推广计划现已结束 +STR_2451 :{YELLOW}你针对{STRINGID}的推广计划现已结束 +STR_2452 :{WINDOW_COLOUR_2}现金(减去贷款):{BLACK} {CURRENCY2DP} +STR_2453 :{WINDOW_COLOUR_2}现金(减去贷款):{RED} {CURRENCY2DP} +STR_2454 :{SMALLFONT} {BLACK} {CURRENCY2DP} - +STR_2455 :{SMALLFONT} {BLACK} + {CURRENCY2DP} - +STR_2456 :{SMALLFONT} {BLACK} {CURRENCY2DP} - +STR_2457 :{SMALLFONT} {BLACK}显示财政报表 +STR_2458 :{SMALLFONT} {BLACK}以图表显示过往到现在的净现金 +STR_2459 :{SMALLFONT} {BLACK}以图表显示过往到现在的乐园价格 +STR_2460 :{SMALLFONT} {BLACK}以图表显示过往到现在的每周营利 +STR_2461 :{SMALLFONT} {BLACK}显示营销计划详情 +STR_2462 :{SMALLFONT} {BLACK}显示乐园入口的视点 +STR_2463 :{SMALLFONT} {BLACK}以图表显示过往到现在的乐园评价 +STR_2464 :{SMALLFONT} {BLACK}以图表显示过往到现在的游客人员 +STR_2465 :{SMALLFONT} {BLACK}显示乐园门票价格以及其资讯 +STR_2466 :{SMALLFONT} {BLACK}显示乐园的统计资料 +STR_2467 :{SMALLFONT} {BLACK}显示是次游戏的目标 +STR_2468 :{SMALLFONT} {BLACK}显示这个乐园最近获得的奖项 +STR_2469 :{SMALLFONT} {BLACK}选择投放多少资金到研发当中 +STR_2470 :{SMALLFONT} {BLACK}研发新的运输类游游设施 +STR_2471 :{SMALLFONT} {BLACK}研发新的温和类游乐设施 +STR_2472 :{SMALLFONT} {BLACK}研发新的云霄飞车 +STR_2473 :{SMALLFONT} {BLACK}研发新的刺激类游乐设施 +STR_2474 :{SMALLFONT} {BLACK}研发新的水文类游乐设施 +STR_2475 :{SMALLFONT} {BLACK}研发新的商店及摊贩 +STR_2476 :{SMALLFONT} {BLACK}研发新的景物及主题景物 +STR_2477 :{SMALLFONT} {BLACK}选择这个游乐设施的运作模式 +STR_2478 :{SMALLFONT} {BLACK}以图表显示速度与运作时间的关系 +STR_2479 :{SMALLFONT} {BLACK}以图表显示高度与运作时间的关系 +STR_2480 :{SMALLFONT} {BLACK}以图表显示垂直加速与运作时间的关系 +STR_2481 :{SMALLFONT}{BLACK}以图表显示横向加速与运作时间的关系 +STR_2482 :{SMALLFONT}{BLACK}营利: 每周{CURRENCY}, 乐园价值: {CURRENCY} +STR_2483 :{WINDOW_COLOUR_2}每周营利: {BLACK}+{CURRENCY2DP} +STR_2484 :{WINDOW_COLOUR_2}每周营利: {RED}{CURRENCY2DP} +STR_2485 :控制 +STR_2486 :基本 STR_2487 :显示游客的'真实'姓名 STR_2488 :{SMALLFONT}{BLACK}在游客'真实'姓名和游客编号之间切换 STR_2489 :快捷键... STR_2490 :键盘快捷键 STR_2491 :重置快捷键 -STR_2492 :{SMALLFONT}{BLACK}Set all keyboard shortcuts back to default settings -STR_2493 :Close top-most window -STR_2494 :Close all floating windows -STR_2495 :Cancel construction mode +STR_2492 :{SMALLFONT}{BLACK}初始化所有快捷键设置 +STR_2493 :关闭最顶层的窗口 +STR_2494 :关闭所有窗口 +STR_2495 :退出建造模式 STR_2496 :暂停游戏 -STR_2497 :Zoom view out -STR_2498 :Zoom view in -STR_2499 :Rotate view clockwise -STR_2500 :Rotate construction object -STR_2501 :Underground view toggle +STR_2497 :缩小视图范围 +STR_2498 :放大视图范围 +STR_2499 :顺时针旋转视图范围 +STR_2500 :旋转要建造的对象 +STR_2501 :开启/关闭地底视图模式 STR_2502 :开启/关闭'隐藏地表'选项 STR_2503 :开启/关闭'隐藏垂直地面'选项 STR_2504 :开启/关闭'半透明游乐设施'选项 STR_2505 :开启/关闭'半透明景观'选项 -STR_2506 :Invisible supports toggle -STR_2507 :Invisible people toggle -STR_2508 :Height marks on land toggle -STR_2509 :Height marks on ride tracks toggle -STR_2510 :Height marks on paths toggle -STR_2511 :Adjust land -STR_2512 :Adjust water +STR_2506 :开启/关闭'透明化支撑'选项 +STR_2507 :开启/关闭'透明化游客'选项 +STR_2508 :开启/关闭'在土地上标记高度'选项 +STR_2509 :开启/关闭'在设施轨道上标记高度'选项 +STR_2510 :开启/关闭'在道路上标记高度'选项 +STR_2511 :调整土地 +STR_2512 :调整水面 STR_2513 :建造景观 STR_2514 :建造道路 STR_2515 :建造新的游乐设施 @@ -2747,8 +2747,8 @@ STR_2732 :{COMMA16}ft STR_2733 :{COMMA16}m STR_2734 :{COMMA16}mph STR_2735 :{COMMA16}km/h -STR_2736 :{MONTH}, Year {COMMA16} -STR_2737 :{STRINGID} {MONTH}, Year {COMMA16} +STR_2736 :{COMMA16}年, {MONTH} +STR_2737 :{STRINGID}{COMMA16}年, {MONTH} STR_2738 :主菜单音乐: STR_2739 :无 STR_2740 :过山车大亨1(RCT1) @@ -2761,7 +2761,6 @@ STR_2746 :] STR_2747 :{ENDQUOTES} STR_2748 :Bar STR_2749 :My new scenario - # New strings used in the cheats window previously these were ??? STR_2750 :Move all items to top STR_2751 :Move all items to bottom @@ -2795,22 +2794,20 @@ STR_2778 :{RIGHTGUILLEMET}{MOVE_X}{SMALLFONT}{STRING} STR_2779 :查看窗口 #{COMMA16} STR_2780 :额外的查看窗口 # End of new strings - - STR_2781 :{STRINGID}:{MOVE_X}{195}{STRINGID} STR_2782 :SHIFT + STR_2783 :CTRL + STR_2784 :变更快捷键 STR_2785 :{WINDOW_COLOUR_2}Press new shortcut key for:{NEWLINE}{OPENQUOTES}{STRINGID}{ENDQUOTES} STR_2786 :{SMALLFONT}{BLACK}Click on shortcut description to select new key -STR_2787 :{WINDOW_COLOUR_2}Park value: {BLACK}{CURRENCY} -STR_2788 :{WINDOW_COLOUR_2}Congratulations !{NEWLINE}{BLACK}You achieved your objective with a company value of {CURRENCY} ! -STR_2789 :{WINDOW_COLOUR_2}You have failed your objective ! -STR_2790 :Enter name into scenario chart +STR_2787 :{WINDOW_COLOUR_2}乐园价值: {BLACK}{CURRENCY} +STR_2788 :{WINDOW_COLOUR_2}恭喜您!{NEWLINE}{BLACK}你已经达到你的目标, 并令公司价值增至 {CURRENCY} ! +STR_2789 :{WINDOW_COLOUR_2}你未达成目标 ! +STR_2790 :请输入你要在剧情列表显示的名字 STR_2791 :输入名字 -STR_2792 :Please enter your name for the scenario chart: -STR_2793 :{SMALLFONT}(Completed by {STRINGID}) -STR_2794 :{WINDOW_COLOUR_2}Completed by: {BLACK}{STRINGID}{NEWLINE}{WINDOW_COLOUR_2} with a company value of: {BLACK}{CURRENCY} +STR_2792 :请输入你要在剧情列表显示的名字: +STR_2793 :{SMALLFONT}(由{STRINGID}达成) +STR_2794 :{WINDOW_COLOUR_2}完成者: {BLACK}{STRINGID}{NEWLINE}{WINDOW_COLOUR_2} 公司价值: {BLACK}{CURRENCY} STR_2795 :排序 STR_2796 :{SMALLFONT}{BLACK}Sort the ride list into order using the information type displayed STR_2797 :当鼠标位于屏幕边缘时滚动视图 @@ -2822,14 +2819,14 @@ STR_2802 :地图 STR_2803 :{SMALLFONT}{BLACK}高亮显示游客 STR_2804 :{SMALLFONT}{BLACK}高亮显示雇员 STR_2805 :{SMALLFONT}{BLACK}显示游乐园地图 -STR_2806 :{RED}Guests are complaining about the disgusting state of the paths in your park{NEWLINE}Check where your handymen are and consider organising them better -STR_2807 :{RED}Guests are complaining about the amount of litter in your park{NEWLINE}Check where your handymen are and consider organising them better -STR_2808 :{RED}Guests are complaining about the vandalism in your park{NEWLINE}Check where your security guards are and consider organising them better -STR_2809 :{RED}Guests are hungry and can't find anywhere to buy food -STR_2810 :{RED}Guests are thirsty and can't find anywhere to buy drinks -STR_2811 :{RED}Guests are complaining because they can't find the toilets in your park -STR_2812 :{RED}Guests are getting lost or stuck{NEWLINE}Check whether the layout of your footpaths needs improving to help the guests find their way around -STR_2813 :{RED}Your park entrance fee is too high!{NEWLINE}Reduce your entrance fee or improve the value of the park to attract more guests +STR_2806 :{RED}游客都在投诉乐园里的道路十分肮脏及恶心{NEWLINE}请检查你的清洁工人位置, 并考虑以更好的方法管理他们 +STR_2807 :{RED}游客都在投诉乐园里十分多随地抛弃的垃圾{NEWLINE}请检查你的清洁工人位置, 并考虑以更好的方法管理他们 +STR_2808 :{RED}游客都在投诉乐园里的公物被毁坏{NEWLINE}请检查你的安全警卫位置, 并考虑以更好的方法管理他们 +STR_2809 :{RED}游客都饿了, 但他们找不到卖食物的店舖 +STR_2810 :{RED}游客都渴了, 但他们找不到卖饮料的店舖 +STR_2811 :{RED}游客都在抱怨于乐园里找不到厕所 +STR_2812 :{RED}游客都被卡住或迷失了{NEWLINE}请检查乐园的道路设计是否需要改善, 以便游客找到出路 +STR_2813 :{RED}你的乐园入场费太贵了!{NEWLINE}减低入场费或增加乐团价值来吸引更多游客来访 STR_2814 :{WINDOW_COLOUR_2}最杂乱无章乐园奖 STR_2815 :{WINDOW_COLOUR_2}最整洁乐园奖 STR_2816 :{WINDOW_COLOUR_2}拥有最棒过山车乐园奖 @@ -2864,22 +2861,22 @@ STR_2844 :{TOPAZ}你的游乐园获得了'拥有最佳自行设计的游乐 STR_2845 :{TOPAZ}你的游乐园获得了'拥有最大胆色彩搭配乐园奖'! STR_2846 :{TOPAZ}你的游乐园获得了'拥有最令人迷失布局乐园奖'! STR_2847 :{TOPAZ}你的游乐园获得了'拥有最温和游乐设施乐园奖'! -STR_2848 :{WINDOW_COLOUR_2}No recent awards +STR_2848 :{WINDOW_COLOUR_2}暂无获得任何奖项 STR_2849 :新的剧情副本安装完毕 STR_2850 :新的轨道设计安装完毕 STR_2851 :剧情副本已经安装过了 STR_2852 :轨道设计已经安装过了 -STR_2853 :Forbidden by the local authority! -STR_2854 :{RED}Guests can't get to the entrance of {STRINGID} !{NEWLINE}Construct a path to the entrance -STR_2855 :{RED}{STRINGID} has no path leading from its exit !{NEWLINE}Construct a path from the ride exit -STR_2856 :{WINDOW_COLOUR_2}Tutorial -STR_2857 :{WINDOW_COLOUR_2}(Press a key or mouse button to take control) -STR_2858 :Can't start marketing campaign... -STR_2859 :Another instance of OpenRCT2 is already running +STR_2853 :被当地政府禁止! +STR_2854 :{RED}游客都不能走到去{STRINGID}的入口!{NEWLINE}请建造道路连接入口 +STR_2855 :{RED}{STRINGID}的出口并没有道路连接!{NEWLINE}请建造道路连接出口 +STR_2856 :{WINDOW_COLOUR_2}教学 +STR_2857 :{WINDOW_COLOUR_2}(按下任意键来获取控制) +STR_2858 :不能开始实行营销计划... +STR_2859 :另外一个OpenRCT2进程已在运行中 STR_2860 :Infogrames Interactive credits... STR_2861 :{WINDOW_COLOUR_2}Licensed to Infogrames Interactive Inc. -STR_2862 :Music acknowledgements... -STR_2863 :Music acknowledgements +STR_2862 :音乐鸣谢列表... +STR_2863 :音乐鸣谢列表 STR_2864 :{WINDOW_COLOUR_2}March - Children of the Regiment: (Fucik) non copyright STR_2865 :{WINDOW_COLOUR_2}Heyken's Serenade: (J.Heyken) British Standard Music Coy; GEMA, BRITICO STR_2866 :{WINDOW_COLOUR_2}In Continental Mood: (Composer unknown) Copyright Control @@ -3026,16 +3023,16 @@ STR_3006 :{PALEGOLD}ABC STR_3007 :{LIGHTPINK}ABC STR_3008 :{PEARLAQUA}ABC STR_3009 :{PALESILVER}ABC -STR_3010 :Unable to load file... -STR_3011 :File contains invalid data -STR_3012 :Dodgems beat style -STR_3013 :Fairground organ style -STR_3014 :Roman fanfare style -STR_3015 :Oriental style -STR_3016 :Martian style -STR_3017 :Jungle drums style -STR_3018 :Egyptian style -STR_3019 :Toyland style +STR_3010 :无法加载文件... +STR_3011 :文件中含有非法数据 +STR_3012 :碰碰车节奏风格 +STR_3013 :游乐场风琴风格 +STR_3014 :罗马号角风格 +STR_3015 :东方风格 +STR_3016 :火星风格 +STR_3017 :丛林敲击风格 +STR_3018 :埃及风格 +STR_3019 :童真风格 STR_3020 : STR_3021 :太空风格 STR_3022 :恐怖风格 @@ -3054,17 +3051,17 @@ STR_3034 :雪地风格 STR_3035 :自定义音乐1 STR_3036 :自定义音乐2 STR_3037 :中世纪风格 -STR_3038 :Urban style -STR_3039 :Organ style -STR_3040 :Mechanical style -STR_3041 :Modern style -STR_3042 :Pirates style -STR_3043 :Rock style 3 -STR_3044 :Candy style -STR_3045 :{SMALLFONT}{BLACK}Select style of music to play -STR_3046 :This ride cannot be modified -STR_3047 :Local authority forbids demolition or modifications to this ride -STR_3048 :Marketing campaigns forbidden by local authority +STR_3038 :都市风格 +STR_3039 :风琴风格 +STR_3040 :机械风格 +STR_3041 :摩登风格 +STR_3042 :海盗风格 +STR_3043 :摇滚风格3 +STR_3044 :糖果风格 +STR_3045 :{SMALLFONT}{BLACK}选择要播放的音乐风格: +STR_3046 :此游乐设施不能被修改 +STR_3047 :当地政府禁止拆除或修改此游乐设施 +STR_3048 :当地政府禁止所有推广计划进行 STR_3049 :高尔夫球洞A STR_3050 :高尔夫球洞B STR_3051 :高尔夫球洞C @@ -3072,105 +3069,105 @@ STR_3052 :高尔夫球洞D STR_3053 :高尔夫球洞E STR_3054 :加载中... STR_3055 :白色 -STR_3056 :半透明 +STR_3056 :半透明 STR_3057 :{WINDOW_COLOUR_2}建造标记: -STR_3058 :Brick walls -STR_3059 :Hedges -STR_3060 :Ice blocks -STR_3061 :Wooden fences -STR_3062 :{SMALLFONT}{BLACK}Standard roller coaster track -STR_3063 :{SMALLFONT}{BLACK}Water channel (track submerged) -STR_3064 :Beginner Parks -STR_3065 :Challenging Parks -STR_3066 :Expert Parks -STR_3067 :{OPENQUOTES}Real{ENDQUOTES} Parks -STR_3068 :Other Parks -STR_3069 :Top Section -STR_3070 :Slope to Level -STR_3071 :{WINDOW_COLOUR_2}Same price throughout park -STR_3072 :{SMALLFONT}{BLACK}Select whether this price is used throughout the entire park -STR_3073 :{RED}WARNING: Your park rating has dropped below 700 !{NEWLINE}If you haven't raised the park rating in 4 weeks, your park will be closed down -STR_3074 :{RED}WARNING: Your park rating is still below 700 !{NEWLINE}You have 3 weeks to raise the park rating -STR_3075 :{RED}WARNING: Your park rating is still below 700 !{NEWLINE}You have only 2 weeks to raise the park rating, or your park will be closed down -STR_3076 :{RED}FINAL WARNING: Your park rating is still below 700 !{NEWLINE}In just 7 days your park will be closed down unless you can raise the rating -STR_3077 :{RED}CLOSURE NOTICE: Your park has been closed down ! -STR_3078 :Plain entrance -STR_3079 :Wooden entrance -STR_3080 :Canvas tent entrance -STR_3081 :Castle entrance (grey) -STR_3082 :Castle entrance (brown) -STR_3083 :Jungle entrance -STR_3084 :Log cabin entrance -STR_3085 :Classical/Roman entrance -STR_3086 :Abstract entrance -STR_3087 :Snow/Ice entrance -STR_3088 :Pagoda entrance -STR_3089 :Space entrance -STR_3090 :{SMALLFONT}{BLACK}Select style of entrance, exit, and station -STR_3091 :You are not allowed to remove this section! -STR_3092 :You are not allowed to move or modify the station for this ride! -STR_3093 :{WINDOW_COLOUR_2}Favourite: {BLACK}{STRINGID} +STR_3058 :砖墙 +STR_3059 :树篱 +STR_3060 :冰砖墙 +STR_3061 :木栅栏 +STR_3062 :{SMALLFONT}{BLACK}标准云霄飞车轨道 +STR_3063 :{SMALLFONT}{BLACK}水溅轨道 (轨道半浸于水中) +STR_3064 :新手级乐园 +STR_3065 :挑战级乐园 +STR_3066 :专家级乐园 +STR_3067 :{OPENQUOTES}真实{ENDQUOTES}乐园 +STR_3068 :其他乐园 +STR_3069 :最上的区域 +STR_3070 :斜坡至平面 +STR_3071 :{WINDOW_COLOUR_2}划一乐园内的价格 +STR_3072 :{SMALLFONT}{BLACK}选择是否以此价格为划一价格 +STR_3073 :{RED}警告: 你的乐园评价已跌至低于700!{NEWLINE}如果你在4周内尚未改善乐园评价, 你的乐园将会被强制关闭 +STR_3074 :{RED}警告: 你的乐园评价仍然低于700!{NEWLINE}你还有3周去改善评价 +STR_3075 :{RED}警告: 你的乐园评价仍然低于700!{NEWLINE}你还有2周去改善评价, 否则你的乐园将会被强制关闭 +STR_3076 :{RED}最后通谍: 你的乐园评价仍然低于700!{NEWLINE}7日之内你的乐园将会被强制关闭, 除非你能改善乐园评价 +STR_3077 :{RED}关闭告示: 你的乐园已被强制关闭! +STR_3078 :普通入口 +STR_3079 :木制入口 +STR_3080 :帆布帐幕式入口 +STR_3081 :城堡主题入口 (灰) +STR_3082 :城堡主题入口 (啡) +STR_3083 :丛林主题入口 +STR_3084 :木屋式入口 +STR_3085 :古罗马主题入口 +STR_3086 :抽象主题入口 +STR_3087 :冰雪主题入口 +STR_3088 :宝塔式入口 +STR_3089 :太空主题入口 +STR_3090 :{SMALLFONT}{BLACK}选择入口, 出口以及车站的风格 +STR_3091 :你无法删除此轨道! +STR_3092 :你无法移动或修改这个游乐设施的车站! +STR_3093 :{WINDOW_COLOUR_2}最爱: {BLACK}{STRINGID} STR_3094 :N/A -STR_3095 :{WINDOW_COLOUR_2}Lift hill chain speed: +STR_3095 :{WINDOW_COLOUR_2}链条坡道的链条速度: STR_3096 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{VELOCITY} -STR_3097 :{SMALLFONT}{BLACK}Select lift hill chain speed -STR_3098 :Can't change lift hill speed... -STR_3099 :{SMALLFONT}{BLACK}Select colour -STR_3100 :{SMALLFONT}{BLACK}Select second colour -STR_3101 :{SMALLFONT}{BLACK}Select third colour -STR_3102 :{SMALLFONT}{BLACK}Re-paint coloured scenery on landscape -STR_3103 :Can't re-paint this... -STR_3104 :{SMALLFONT}{BLACK}List rides -STR_3105 :{SMALLFONT}{BLACK}List shops and stalls -STR_3106 :{SMALLFONT}{BLACK}List information kiosks and other guest facilities +STR_3097 :{SMALLFONT}{BLACK}选择链条坡道的链条上拉速度 +STR_3098 :不能更改链条坡道的链条速度... +STR_3099 :{SMALLFONT}{BLACK}选择颜色 +STR_3100 :{SMALLFONT}{BLACK}选择第二颜色 +STR_3101 :{SMALLFONT}{BLACK}选择第三颜色 +STR_3102 :{SMALLFONT}{BLACK}将地形的景物重新上色 +STR_3103 :不能重新上色这个对象... +STR_3104 :{SMALLFONT}{BLACK}列出游乐设施 +STR_3105 :{SMALLFONT}{BLACK}列出商店及摊贩 +STR_3106 :{SMALLFONT}{BLACK}列出访客信息中心或其他游客设施 STR_3107 :关闭 STR_3108 :测试 -STR_3109 :开放 -STR_3110 :{WINDOW_COLOUR_2}Block Sections: {BLACK}{COMMA16} -STR_3111 :{SMALLFONT}{BLACK}Click on design to build it -STR_3112 :{SMALLFONT}{BLACK}Click on design to rename or delete it -STR_3113 :Select a different design -STR_3114 :{SMALLFONT}{BLACK}Go back to design selection window -STR_3115 :{SMALLFONT}{BLACK}保存轨道设计 -STR_3116 :{SMALLFONT}{BLACK}保存轨道设计(在测试完成及统计结果生成前不可用) -STR_3117 :{BLACK}Calling mechanic... -STR_3118 :{BLACK}{STRINGID} is heading for the ride -STR_3119 :{BLACK}{STRINGID} is fixing the ride -STR_3120 :{SMALLFONT}{BLACK}Locate nearest available mechanic, or mechanic fixing ride -STR_3121 :Unable to locate mechanic, or all nearby mechanics are busy -STR_3122 :{WINDOW_COLOUR_2}Favourite ride of: {BLACK}{COMMA16} guest -STR_3123 :{WINDOW_COLOUR_2}Favourite ride of: {BLACK}{COMMA16} guests -STR_3124 :Broken {STRINGID} -STR_3125 :{WINDOW_COLOUR_2}Excitement Factor: {BLACK}+{COMMA16}% -STR_3126 :{WINDOW_COLOUR_2}Intensity Factor: {BLACK}+{COMMA16}% -STR_3127 :{WINDOW_COLOUR_2}Nausea Factor: {BLACK}+{COMMA16}% -STR_3128 :保存轨道设计 -STR_3129 :保存轨道设计及周边景观 -STR_3130 :保存 +STR_3109 :开启 +STR_3110 :{WINDOW_COLOUR_2}刹车区间: {BLACK}{COMMA16} +STR_3111 :{SMALLFONT}{BLACK}点击建造设计 +STR_3112 :{SMALLFONT}{BLACK}点击删除或重命名设计 +STR_3113 :选择另一个设计 +STR_3114 :{SMALLFONT}{BLACK}返回选择设计窗口 +STR_3115 :{SMALLFONT}{BLACK}存储轨道设计 +STR_3116 :{SMALLFONT}{BLACK}存储轨道设计 (在测试完结及测试数据生成完毕前不可用) +STR_3117 :{BLACK}调用维修人员中... +STR_3118 :{BLACK}{STRINGID}正在前往到这个游乐设施 +STR_3119 :{BLACK}{STRINGID}正在修复这个游乐设施 +STR_3120 :{SMALLFONT}{BLACK}将最邻近, 或在维修此游乐设施的维修人员定位 +STR_3121 :无法将维修人员定位, 或者附近的维修人员都在工作中 +STR_3122 :{WINDOW_COLOUR_2}游客的最爱: {BLACK}{COMMA16}位游客 +STR_3123 :{WINDOW_COLOUR_2}游客的最爱: {BLACK}{COMMA16}位游客 +STR_3124 :故障的{STRINGID} +STR_3125 :{WINDOW_COLOUR_2}兴奋度加成: {BLACK}+{COMMA16}% +STR_3126 :{WINDOW_COLOUR_2}刺激度加成: {BLACK}+{COMMA16}% +STR_3127 :{WINDOW_COLOUR_2}恶心度加成: {BLACK}+{COMMA16}% +STR_3128 :存储轨道设计 +STR_3129 :存储轨道设计及周边景物 +STR_3130 :存储 STR_3131 :取消 -STR_3132 :{BLACK}Click items of scenery to select them to be saved with track design... -STR_3133 :Unable to build this on a slope -STR_3134 :{RED}(Design includes scenery which is unavailable) -STR_3135 :{RED}(Vehicle design unavailable - Ride performance may be affected) -STR_3136 :Warning: This design will be built with an alternative vehicle type and may not perform as expected -STR_3137 :Select Nearby Scenery -STR_3138 :Reset Selection -STR_3139 :Cable lift unable to work in this operating mode -STR_3140 :Cable lift hill must start immediately after station -STR_3141 :Multi-circuit per ride not possible with cable lift hill -STR_3142 :{WINDOW_COLOUR_2}Capacity: {BLACK}{STRINGID} -STR_3143 :{SMALLFONT}{BLACK}显示地图上所有人物 -STR_3144 :{SMALLFONT}{BLACK}显示地图上所有游乐设施和店铺 -STR_3145 :{SMALLFONT}{BLACK}Scroll {STRINGID} left -STR_3146 :{SMALLFONT}{BLACK}Scroll {STRINGID} right -STR_3147 :{SMALLFONT}{BLACK}Scroll {STRINGID} left fast -STR_3148 :{SMALLFONT}{BLACK}Scroll {STRINGID} right fast -STR_3149 :{SMALLFONT}{BLACK}Scroll {STRINGID} left/right -STR_3150 :{SMALLFONT}{BLACK}Scroll {STRINGID} up -STR_3151 :{SMALLFONT}{BLACK}Scroll {STRINGID} down -STR_3152 :{SMALLFONT}{BLACK}Scroll {STRINGID} up fast -STR_3153 :{SMALLFONT}{BLACK}Scroll {STRINGID} down fast -STR_3154 :{SMALLFONT}{BLACK}Scroll {STRINGID} up/down +STR_3132 :{BLACK}点击选择景物, 以便存储于轨道设计内... +STR_3133 :无法于斜坡上建造此对象 +STR_3134 :{RED}(设计中含有不可用的景物) +STR_3135 :{RED}(车辆款式不可用 - 游乐设施的性能可能会有影响) +STR_3136 :警告: 此设计会使用另一款车辆, 它的运作可能会跟预期有落差 +STR_3137 :选择邻近景物 +STR_3138 :重新选择 +STR_3139 :缆道坡道不能在这个运作模式运作 +STR_3140 :缆道坡道需要连接至车站 +STR_3141 :缆道坡道并不适合於单次多圈数的游乐设施 +STR_3142 :{WINDOW_COLOUR_2}载客量: {BLACK}{STRINGID} +STR_3143 :{SMALLFONT}{BLACK}在地图上显示所有人物 +STR_3144 :{SMALLFONT}{BLACK}在地图上显示所有游乐设施及店铺 +STR_3145 :{SMALLFONT}{BLACK}向左卷动{STRINGID} +STR_3146 :{SMALLFONT}{BLACK}向右卷动{STRINGID} +STR_3147 :{SMALLFONT}{BLACK}快速向左卷动{STRINGID} +STR_3148 :{SMALLFONT}{BLACK}快速向右卷动{STRINGID} +STR_3149 :{SMALLFONT}{BLACK}向左/向右卷动{STRINGID} +STR_3150 :{SMALLFONT}{BLACK}向上卷动{STRINGID} +STR_3151 :{SMALLFONT}{BLACK}向下卷动{STRINGID} +STR_3152 :{SMALLFONT}{BLACK}快速向上卷动{STRINGID} +STR_3153 :{SMALLFONT}{BLACK}快速向下卷动{STRINGID} +STR_3154 :{SMALLFONT}{BLACK}向上/向下卷动{STRINGID} STR_3155 : STR_3156 : STR_3157 :地图 @@ -3178,177 +3175,177 @@ STR_3158 :graph STR_3159 :list STR_3160 :{SMALLFONT}{BLACK}选择每次乘坐循环的次数 STR_3161 : -STR_3162 :Unable to allocate enough memory -STR_3163 :Installing new data: -STR_3164 :{BLACK}{COMMA16} selected (maximum {COMMA16}) +STR_3162 :无法分配足够的内存 +STR_3163 :安装新数据档中: +STR_3164 :{BLACK}已选择{COMMA16}项 (最多{COMMA16}项) STR_3165 : STR_3166 :{BLACK}(ID: -STR_3167 :{WINDOW_COLOUR_2}Includes: {BLACK}{COMMA16} objects -STR_3168 :{WINDOW_COLOUR_2}Text: {BLACK}{STRINGID} -STR_3169 :Data for the following object not found: -STR_3170 :Not enough space for graphics -STR_3171 :Too many objects of this type selected -STR_3172 :The following object must be selected first: {STRING} -STR_3173 :This object is currently in use -STR_3174 :This object is required by another object -STR_3175 :This object is always required -STR_3176 :Unable to select this object -STR_3177 :Unable to de-select this object -STR_3178 :At least one path object must be selected -STR_3179 :At least one ride vehicle/attraction object must be selected -STR_3180 :Invalid selection of objects -STR_3181 :Object Selection - {STRINGID} -STR_3182 :Park entrance type must be selected -STR_3183 :Water type must be selected -STR_3184 :Ride Vehicles/Attractions -STR_3185 :Small Scenery -STR_3186 :Large Scenery -STR_3187 :Walls/Fences -STR_3188 :Path Signs -STR_3189 :Footpaths -STR_3190 :Path Extras -STR_3191 :Scenery Groups -STR_3192 :Park Entrance -STR_3193 :Water -STR_3194 :Scenario Description -STR_3195 :Invention List -STR_3196 :{WINDOW_COLOUR_2}Research Group: {BLACK}{STRINGID} -STR_3197 :{WINDOW_COLOUR_2}Items pre-invented at start of game: -STR_3198 :{WINDOW_COLOUR_2}Items to invent during game: -STR_3199 :Random Shuffle -STR_3200 :{SMALLFONT}{BLACK}Randomly shuffle the list of items to invent during the game -STR_3201 :Object Selection -STR_3202 :Landscape Editor -STR_3203 :Invention List Set Up -STR_3204 :Options Selection -STR_3205 :Objective Selection -STR_3206 :Save Scenario +STR_3167 :{WINDOW_COLOUR_2}包含: {BLACK}{COMMA16}项对象 +STR_3168 :{WINDOW_COLOUR_2}文本: {BLACK}{STRINGID} +STR_3169 :找不到以下对象的数据: +STR_3170 :没有空间绘制图像 +STR_3171 :选择了太多此类型的对象 +STR_3172 :必需要先选择以下的对象: {STRING} +STR_3173 :这个对象目前被使用中 +STR_3174 :其他对象需要这个对象 +STR_3175 :这个对象是必需的 +STR_3176 :无法选择这个对象 +STR_3177 :无法取消选择这个对象 +STR_3178 :至少需要选择一项道路款式 +STR_3179 :至少需要选择一项游乐设施/店铺 +STR_3180 :不合适的对象选择 +STR_3181 :对象选择 - {STRINGID} +STR_3182 :必须选择乐园入口类别 +STR_3183 :必须选择水塘类别 +STR_3184 :游乐设施/其车辆 +STR_3185 :小型景物 +STR_3186 :大型景物 +STR_3187 :墙壁/栅栏 +STR_3188 :道路指示牌 +STR_3189 :道路 +STR_3190 :额外的道路对象 +STR_3191 :景物组别 +STR_3192 :乐园入口 +STR_3193 :水塘 +STR_3194 :剧情简介 +STR_3195 :研发列表 +STR_3196 :{WINDOW_COLOUR_2}研发组别: {BLACK}{STRINGID} +STR_3197 :{WINDOW_COLOUR_2}游戏开始时已研发好的项目: +STR_3198 :{WINDOW_COLOUR_2}需要在游戏中研发的项目: +STR_3199 :随机分配 +STR_3200 :{SMALLFONT}{BLACK}将需要在游戏中研发的项目随机分配 +STR_3201 :选取对象 +STR_3202 :编辑地势 +STR_3203 :设置研发清单 +STR_3204 :选取选项 +STR_3205 :选取目标 +STR_3206 :存储剧情 STR_3207 :过山车设计工具 STR_3208 :轨道设计管理工具 -STR_3209 :Back to Previous Step: -STR_3210 :Forward to Next Step: -STR_3211 :{WINDOW_COLOUR_2}Map size: +STR_3209 :上一步: +STR_3210 :下一步: +STR_3211 :{WINDOW_COLOUR_2}地图大小: STR_3212 :{POP16}{COMMA16} x {PUSH16}{COMMA16} -STR_3213 :Can't decrease map size any further -STR_3214 :Can't increase map size any further -STR_3215 :Too close to edge of map -STR_3216 :{SMALLFONT}{BLACK}Select park-owned land etc. -STR_3217 :Land Owned -STR_3218 :Construction Rights Owned -STR_3219 :Land For Sale -STR_3220 :Construction Rights For Sale -STR_3221 :{SMALLFONT}{BLACK}Set land to be owned by the park -STR_3222 :{SMALLFONT}{BLACK}Set construction rights only to be owned by the park -STR_3223 :{SMALLFONT}{BLACK}Set land to be available to purchase by the park -STR_3224 :{SMALLFONT}{BLACK}Set construction rights to be available to purchase by the park -STR_3225 :{SMALLFONT}{BLACK}Toggle on/off building a random cluster of objects around the selected position -STR_3226 :{SMALLFONT}{BLACK}Build park entrance -STR_3227 :Too many park entrances! -STR_3228 :{SMALLFONT}{BLACK}Set starting positions for people -STR_3229 :Block Brakes cannot be used directly after station -STR_3230 :Block Brakes cannot be used directly after each other -STR_3231 :Block Brakes cannot be used directly after the top of this lift hill -STR_3232 :Options - Financial -STR_3233 :Options - Guests -STR_3234 :Options - Park -STR_3235 :{SMALLFONT}{BLACK}Show financial options -STR_3236 :{SMALLFONT}{BLACK}Show guest options -STR_3237 :{SMALLFONT}{BLACK}Show park options -STR_3238 :No Money -STR_3239 :{SMALLFONT}{BLACK}Make this park a 'no money' park with no financial restrictions -STR_3240 :{WINDOW_COLOUR_2}Initial cash: -STR_3241 :{WINDOW_COLOUR_2}Initial loan: -STR_3242 :{WINDOW_COLOUR_2}Maximum loan size: -STR_3243 :{WINDOW_COLOUR_2}Annual interest rate: -STR_3244 :Forbid marketing campaigns -STR_3245 :{SMALLFONT}{BLACK}Forbid advertising, promotional schemes, and other marketing campaigns +STR_3213 :不能再缩小地图 +STR_3214 :不能再扩大地图 +STR_3215 :太接近地图的边缘 +STR_3216 :{SMALLFONT}{BLACK}选择乐园拥有的土地及其他选项 +STR_3217 :已拥有的土地 +STR_3218 :已拥有建造权的土地 +STR_3219 :可供购买的土地 +STR_3220 :可供购买建造权的土地 +STR_3221 :{SMALLFONT}{BLACK}令乐园成为土地的拥有者 +STR_3222 :{SMALLFONT}{BLACK}令乐园拥有土地的建造权 +STR_3223 :{SMALLFONT}{BLACK}将土地设置成为可供乐园购买 +STR_3224 :{SMALLFONT}{BLACK}将土地的建造权设置成为可供乐园购买 +STR_3225 :{SMALLFONT}{BLACK}设置是否在选中的位置中随机建造一些对象 +STR_3226 :{SMALLFONT}{BLACK}建造乐园入口 +STR_3227 :太多乐园入口! +STR_3228 :{SMALLFONT}{BLACK}设置游客的开始步行位置 +STR_3229 :区域煞车不能建造在车站之后 +STR_3230 :区域煞车不能建造在另一个区域煞车之后 +STR_3231 :区域煞车不能建造在这个链条坡道的顶部之后 +STR_3232 :选项 - 财政 +STR_3233 :选项 - 游客 +STR_3234 :选项 - 乐园 +STR_3235 :{SMALLFONT}{BLACK}显示财政选项 +STR_3236 :{SMALLFONT}{BLACK}显示游客选项 +STR_3237 :{SMALLFONT}{BLACK}显示乐园选项 +STR_3238 :无金钱限制 +STR_3239 :{SMALLFONT}{BLACK}将这个乐园设置为无金钱限制的乐园 +STR_3240 :{WINDOW_COLOUR_2}初始现金: +STR_3241 :{WINDOW_COLOUR_2}初始贷款额: +STR_3242 :{WINDOW_COLOUR_2}最高贷款额: +STR_3243 :{WINDOW_COLOUR_2}贷款年利率: +STR_3244 :禁止营销计划 +STR_3245 :{SMALLFONT}{BLACK}禁止推销, 推广计划以及其他营销计划 STR_3246 :{WINDOW_COLOUR_2}{CURRENCY} STR_3247 :{WINDOW_COLOUR_2}{COMMA16}% -STR_3248 :Can't increase initial cash any further! -STR_3249 :Can't reduce initial cash any further! -STR_3250 :Can't increase initial loan any further! -STR_3251 :Can't reduce initial loan any further! -STR_3252 :Can't increase maximum loan size any further! -STR_3253 :Can't reduce maximum loan size any further! -STR_3254 :Can't increase interest rate any further! -STR_3255 :Can't reduce interest rate any further! -STR_3256 :Guests prefer less intense rides -STR_3257 :{SMALLFONT}{BLACK}Select whether guests should generally prefer less intense rides only -STR_3258 :Guests prefer more intense rides -STR_3259 :{SMALLFONT}{BLACK}Select whether guests should generally prefer more intense rides only -STR_3260 :{WINDOW_COLOUR_2}Cash per guest (average): -STR_3261 :{WINDOW_COLOUR_2}Guests initial happiness: -STR_3262 :{WINDOW_COLOUR_2}Guests initial hunger: -STR_3263 :{WINDOW_COLOUR_2}Guests initial thirst: -STR_3264 :Can't increase this any further! -STR_3265 :Can't reduce this any further! -STR_3266 :{SMALLFONT}{BLACK}Select how this park charges for entrance and rides -STR_3267 :Forbid tree removal -STR_3268 :{SMALLFONT}{BLACK}Forbid tall trees being removed -STR_3269 :Forbid landscape changes -STR_3270 :{SMALLFONT}{BLACK}Forbid any changes to the landscape -STR_3271 :Forbid high construction -STR_3272 :{SMALLFONT}{BLACK}Forbid any tall construction -STR_3273 :Park rating higher difficult level -STR_3274 :{SMALLFONT}{BLACK}Make the park rating value more challenging -STR_3275 :Guest generation higher difficult level -STR_3276 :{SMALLFONT}{BLACK}Make it more difficult to attract guests to the park -STR_3277 :{WINDOW_COLOUR_2}Cost to buy land: -STR_3278 :{WINDOW_COLOUR_2}Cost to buy construction rights: -STR_3279 :Free park entry / Pay per ride -STR_3280 :Pay to enter park / Free rides -STR_3281 :{WINDOW_COLOUR_2}Entry price: -STR_3282 :{SMALLFONT}{BLACK}Select objective and park name +STR_3248 :不能再增加初始现金! +STR_3249 :不能再减少初始现金! +STR_3250 :不能再增加初始贷款额! +STR_3251 :不能再减少初始贷款额! +STR_3252 :不能再增加最高贷款额! +STR_3253 :不能再减少最高贷款额! +STR_3254 :不能再增加贷款利率! +STR_3255 :不能再减少贷款利率! +STR_3256 :游客喜欢较温和的游乐设施 +STR_3257 :{SMALLFONT}{BLACK}选择普遍游客是否只喜欢较温和的游乐设施 +STR_3258 :游客喜欢较刺激的游乐设施 +STR_3259 :{SMALLFONT}{BLACK}选择普遍游客是否只喜欢较刺激的游乐设施 +STR_3260 :{WINDOW_COLOUR_2}游客身上现金 (平均值): +STR_3261 :{WINDOW_COLOUR_2}游客初始快乐度: +STR_3262 :{WINDOW_COLOUR_2}游客初始饥饿度: +STR_3263 :{WINDOW_COLOUR_2}游客初始口渴度: +STR_3264 :不能再增加这个选项! +STR_3265 :不能再减少这个选项! +STR_3266 :{SMALLFONT}{BLACK}选择这个乐园的收费策略 +STR_3267 :禁止移除树木 +STR_3268 :{SMALLFONT}{BLACK}禁止移除高壮的树木 +STR_3269 :禁止调整地形 +STR_3270 :{SMALLFONT}{BLACK}禁止对地形作任何调整 +STR_3271 :禁止高空建造 +STR_3272 :{SMALLFONT}{BLACK}禁止任何高空发展 +STR_3273 :较高难度的乐园评价公式 +STR_3274 :{SMALLFONT}{BLACK}使增加乐园评价更具挑战性 +STR_3275 :较难生成游客 +STR_3276 :{SMALLFONT}{BLACK}使吸引游客更具挑战性 +STR_3277 :{WINDOW_COLOUR_2}购买土地的费用: +STR_3278 :{WINDOW_COLOUR_2}购买建造权利的费用: +STR_3279 :免费进入乐园 / 需费乘搭游乐设施 +STR_3280 :需费进入乐园 / 免费乘搭游乐设施 +STR_3281 :{WINDOW_COLOUR_2}乐园门票价格: +STR_3282 :{SMALLFONT}{BLACK}选择目标及乐园名称 STR_3283 :{SMALLFONT}{BLACK}选择要保留的游乐设施/店铺 -STR_3284 :Objective Selection -STR_3285 :Preserved Rides -STR_3286 :{SMALLFONT}{BLACK}Select objective for this scenario -STR_3287 :{WINDOW_COLOUR_2}Objective: -STR_3288 :{SMALLFONT}{BLACK}Select climate -STR_3289 :{WINDOW_COLOUR_2}Climate: -STR_3290 :Cool and wet -STR_3291 :Warm -STR_3292 :Hot and dry -STR_3293 :Cold -STR_3294 :Change... -STR_3295 :{SMALLFONT}{BLACK}Change name of park -STR_3296 :{SMALLFONT}{BLACK}Change name of scenario -STR_3297 :{SMALLFONT}{BLACK}Change detail notes about park / scenario -STR_3298 :{WINDOW_COLOUR_2}Park Name: {BLACK}{STRINGID} -STR_3299 :{WINDOW_COLOUR_2}Park/Scenario Details: -STR_3300 :{WINDOW_COLOUR_2}Scenario Name: {BLACK}{STRINGID} -STR_3301 :{WINDOW_COLOUR_2}Objective Date: +STR_3284 :选取目标 +STR_3285 :保留游乐设施/店铺 +STR_3286 :{SMALLFONT}{BLACK}选择此剧情的目标 +STR_3287 :{WINDOW_COLOUR_2}目标: +STR_3288 :{SMALLFONT}{BLACK}选择气候 +STR_3289 :{WINDOW_COLOUR_2}气候: +STR_3290 :又冷又潮湿 +STR_3291 :温暖 +STR_3292 :又热又干燥 +STR_3293 :寒冷 +STR_3294 :更改... +STR_3295 :{SMALLFONT}{BLACK}更改乐园名称 +STR_3296 :{SMALLFONT}{BLACK}更改剧情名称 +STR_3297 :{SMALLFONT}{BLACK}更改乐园/剧情的简介 +STR_3298 :{WINDOW_COLOUR_2}乐园名称: {BLACK}{STRINGID} +STR_3299 :{WINDOW_COLOUR_2}乐园/剧情的简介: +STR_3300 :{WINDOW_COLOUR_2}剧情名称: {BLACK}{STRINGID} +STR_3301 :{WINDOW_COLOUR_2}达成目标的日期: STR_3302 :{WINDOW_COLOUR_2}{MONTHYEAR} -STR_3303 :{WINDOW_COLOUR_2}Number of guests: -STR_3304 :{WINDOW_COLOUR_2}Park value: -STR_3305 :{WINDOW_COLOUR_2}Monthly income: -STR_3306 :{WINDOW_COLOUR_2}Monthly profit: -STR_3307 :{WINDOW_COLOUR_2}Minimum length: -STR_3308 :{WINDOW_COLOUR_2}Excitement rating: +STR_3303 :{WINDOW_COLOUR_2}游客数量: +STR_3304 :{WINDOW_COLOUR_2}乐园评价: +STR_3305 :{WINDOW_COLOUR_2}每月收入: +STR_3306 :{WINDOW_COLOUR_2}每月利润: +STR_3307 :{WINDOW_COLOUR_2}最少长度: +STR_3308 :{WINDOW_COLOUR_2}兴奋度: STR_3309 :{WINDOW_COLOUR_2}{COMMA16} STR_3310 :{WINDOW_COLOUR_2}{LENGTH} STR_3311 :{WINDOW_COLOUR_2}{COMMA2DP32} -STR_3312 :{WINDOW_COLOUR_2}Rides/attractions under a preservation order: -STR_3313 :Scenario Name -STR_3314 :Enter name for scenario: -STR_3315 :Park/Scenario Details -STR_3316 :Enter description of this scenario: -STR_3317 :No details yet -STR_3318 :{SMALLFONT}{BLACK}Select which group this scenario appears in -STR_3319 :{WINDOW_COLOUR_2}Scenario Group: -STR_3320 :Unable to save scenario file... -STR_3321 :New objects installed successfully -STR_3322 :{WINDOW_COLOUR_2}Objective: {BLACK}{STRINGID} -STR_3323 :Missing object data, ID: -STR_3324 :Requires Add-On Pack: {STRINGID} -STR_3325 :Requires an Add-On Pack -STR_3326 :{WINDOW_COLOUR_2}(no image) -STR_3327 :Starting positions for people not set -STR_3328 :Can't advance to next editor stage... -STR_3329 :Park entrance not yet built -STR_3330 :Park must own some land -STR_3331 :Path from park entrance to map edge either not complete or too complex - Path must be single-width with as few junctions and corners as possible -STR_3332 :Park entrance is the wrong way round or has no path leading to the map edge +STR_3312 :{WINDOW_COLOUR_2}请选取要保留的游乐设施/店铺: +STR_3313 :剧情名称 +STR_3314 :请输入这个剧情的名称: +STR_3315 :乐园/剧情的简介 +STR_3316 :请输入这个乐园/剧情的简介: +STR_3317 :暂无简介 +STR_3318 :{SMALLFONT}{BLACK}选择这个剧情要在哪个组别中显示 +STR_3319 :{WINDOW_COLOUR_2}剧情组别: +STR_3320 :无法存储剧情文件... +STR_3321 :成功安装新对象 +STR_3322 :{WINDOW_COLOUR_2}目标: {BLACK}{STRINGID} +STR_3323 :缺少对象数据, ID为: +STR_3324 :需要数据片: {STRINGID} +STR_3325 :需要一只数据片 +STR_3326 :{WINDOW_COLOUR_2}(暂无图片) +STR_3327 :尚未设置游客的开始步行位置 +STR_3328 :不能进行下一步编辑... +STR_3329 :尚未建造乐园入口 +STR_3330 :乐园必需有一些己拥有的土地 +STR_3331 :由地图边缘到乐园入口的道路尚未连接好, 或者太复杂 - 这些道路必需是一格宽度, 并以越少交界及弯位越好 +STR_3332 :乐园入口倒转了, 或没有道路连接至地图边缘 STR_3333 :在存档中导出附加物 STR_3334 :{SMALLFONT}{BLACK}Select whether to save any additional plug-in object data required (add-in data not supplied with the main product) in saved game or scenario files, allowing them to be loaded by someone who doesn't have the additional object data STR_3335 :过山车设计工具 - 选择游乐设施的类型及车辆种类 @@ -3390,23 +3387,23 @@ STR_3370 :{BLACK}= 信息亭 STR_3371 :{BLACK}= 急救室 STR_3372 :{BLACK}= 取款机 STR_3373 :{BLACK}= 厕所 -STR_3374 :Warning: Too many objects selected! -STR_3375 :Not all objects in this scenery group could be selected -STR_3376 :Install new track design... -STR_3377 :{SMALLFONT}{BLACK}Install a new track design file -STR_3378 :Install -STR_3379 :Cancel -STR_3380 :Unable to install this track design... -STR_3381 :File is not compatible or contains invalid data -STR_3382 :File copy failed -STR_3383 :Select new name for track design -STR_3384 :An existing track design already has this name - Please select a new name for this design: -STR_3385 :Beginners Tutorial -STR_3386 :Custom Rides Tutorial -STR_3387 :Roller Coaster Building Tutorial -STR_3388 :Unable to switch to selected mode -STR_3389 :Unable to select additional item of scenery... -STR_3390 :Too many items selected +STR_3374 :警告: 选取了太多对象! +STR_3375 :不是在此景观组别中的所有对象都能够选取 +STR_3376 :安装新的轨道设计... +STR_3377 :{SMALLFONT}{BLACK}安装新的轨道设计文件 +STR_3378 :安装 +STR_3379 :取消 +STR_3380 :无法安装这个轨道设计 +STR_3381 :不兼容的文件或含有非法数据 +STR_3382 :复制文件失败 +STR_3383 :输入这个轨道设计的新名称 +STR_3384 :已有相同名称的轨道设计 - 请输入这个轨道设计的新名称: +STR_3385 :新手入门教学 +STR_3386 :自订游乐设施教学 +STR_3387 :云霄飞车建造教学 +STR_3388 :无法切换至已选择的模式 +STR_3389 :无法选择额外的景观对象... +STR_3390 :选取了太多对象 # Start of tutorial strings. Not used at the moment, so not necessary to translate. STR_3391 :{SMALLFONT}{BLACK}Here is our park - Let's have a quick look around... STR_3392 :{SMALLFONT}{BLACK}Holding down the RIGHT mouse button and moving the mouse is the quickest way to move the view... @@ -3507,7 +3504,7 @@ STR_5156 :{SMALLFONT}{BLACK}允许测试大多数轨道设计, 即使那些 STR_5157 :Unlock all prices STR_5158 :回到主菜单 STR_5159 :退出OpenRCT2 -STR_5160 :{POP16}{MONTH} {PUSH16}{PUSH16}{STRINGID}, Year {POP16}{COMMA16} +STR_5160 :{POP16}{MONTH} {PUSH16}{PUSH16}{STRINGID}, {POP16}第{COMMA16}年 STR_5161 :日期格式: STR_5162 :日/月/年 STR_5163 :月/日/年 @@ -3530,51 +3527,51 @@ STR_5179 :{SMALLFONT}{BLACK}Show guest cheats STR_5180 :{SMALLFONT}{BLACK}Show park cheats STR_5181 :{SMALLFONT}{BLACK}Show ride cheats STR_5182 :{INT32} -STR_5183 :Base height -STR_5184 :Enter base height between {COMMA16} and {COMMA16} -STR_5185 :Water level -STR_5186 :Enter water level between {COMMA16} and {COMMA16} +STR_5183 :地面高度 +STR_5184 :请输入介乎{COMMA16}及{COMMA16}的地面高度 +STR_5185 :水面高度 +STR_5186 :请输入介乎{COMMA16}及{COMMA16}的水面高度 STR_5187 :财务 -STR_5188 :New Campaign +STR_5188 :新的营销计划 STR_5189 :研发 STR_5190 :地图 -STR_5191 :Viewport -STR_5192 :Recent News -STR_5193 :Land -STR_5194 :Water -STR_5195 :Clear Scenery -STR_5196 :Land Rights -STR_5197 :Scenery -STR_5198 :Footpath -STR_5199 :Ride Construction -STR_5200 :Track Design Place -STR_5201 :New Ride -STR_5202 :Track Design Selection -STR_5203 :Ride -STR_5204 :Ride List -STR_5205 :Guest -STR_5206 :Guest List -STR_5207 :Staff -STR_5208 :Staff List -STR_5209 :Banner -STR_5210 :Object Selection -STR_5211 :Invention List -STR_5212 :Scenario Options -STR_5213 :Objective Options -STR_5214 :Map Generation -STR_5215 :Track Design Manager -STR_5216 :Track Design Manager List -STR_5217 :作弊 +STR_5191 :额外视图窗口 +STR_5192 :最近消息 +STR_5193 :土地 +STR_5194 :水塘 +STR_5195 :清除景物 +STR_5196 :土地拥有权 +STR_5197 :景物 +STR_5198 :道路 +STR_5199 :建造游乐设施 +STR_5200 :放置轨道设计 +STR_5201 :新的游乐设施 +STR_5202 :选择轨道设计 +STR_5203 :游乐设施 +STR_5204 :游乐设施列表 +STR_5205 :游客 +STR_5206 :游客列表 +STR_5207 :员工 +STR_5208 :员工列表 +STR_5209 :横额 +STR_5210 :选取对象 +STR_5211 :研发列表 +STR_5212 :剧情选项 +STR_5213 :目标选项 +STR_5214 :生成地图 +STR_5215 :轨道设计管理工具 +STR_5216 :轨道设计管理工具列表 +STR_5217 :密技 STR_5218 :主题 STR_5219 :选项 -STR_5220 :Keyboard Shortcuts -STR_5221 :Change Keyboard Shortcut -STR_5222 :Load/Save -STR_5223 :Save Prompt -STR_5224 :Demolish Ride Prompt -STR_5225 :Fire Staff Prompt -STR_5226 :Track Delete Prompt -STR_5227 :Save Overwrite Prompt +STR_5220 :键盘快捷键 +STR_5221 :更改键盘快捷键 +STR_5222 :加载/存储 +STR_5223 :存储对话框 +STR_5224 :拆除游乐设施对话框 +STR_5225 :解雇员工对话框 +STR_5226 :删除轨道设计对话框 +STR_5227 :覆盖存盘对话框 STR_5228 :{SMALLFONT}{BLACK}主界面 STR_5229 :{SMALLFONT}{BLACK}公园 STR_5230 :{SMALLFONT}{BLACK}工具 @@ -3896,17 +3893,17 @@ STR_5546 :{SMALLFONT}{BLACK}亮粉色 STR_5547 :{SMALLFONT}{BLACK}浅粉色 STR_5548 :Show all operating modes STR_5549 :年/月/日 -STR_5550 :{POP16}{POP16}Year {COMMA16}, {PUSH16}{PUSH16}{MONTH} {PUSH16}{PUSH16}{STRINGID} +STR_5550 :{POP16}{POP16}{COMMA16}年, {PUSH16}{PUSH16}{MONTH} {PUSH16}{PUSH16}{STRINGID} STR_5551 :年/日/月 -STR_5552 :{POP16}{POP16}Year {COMMA16}, {PUSH16}{PUSH16}{PUSH16}{STRINGID} {MONTH} +STR_5552 :{POP16}{POP16}{COMMA16}年, {PUSH16}{PUSH16}{PUSH16}{STRINGID} {MONTH} STR_5553 :当Steam overlay打开时暂停游戏 STR_5554 :{SMALLFONT}{BLACK}启用山丘工具 STR_5555 :显示来自其他类型轨道的车辆种类 STR_5556 :{SMALLFONT}{BLACK}踢除玩家 STR_5557 :多人游戏不同步时依然保持联机 STR_5558 :此设定会于重启游戏后生效 -STR_5559 :检查时距为10分钟 -STR_5560 :将所有游乐设施的检查时距设定为'每10分钟' +STR_5559 :检查时间间隔为10分钟 +STR_5560 :将所有游乐设施的检查时间间隔设定为'每10分钟' STR_5561 :加载语言失败 STR_5562 :警告! STR_5563 :此功能暂未稳定地使用,请多加留意. @@ -4201,7 +4198,7 @@ STR_5882 :自定义货币 STR_5883 :自定义货币选项 STR_5884 :{WINDOW_COLOUR_2}汇率: STR_5885 :{WINDOW_COLOUR_2}等价于英镑(£){COMMA32} -STR_5886 :{WINDOW_COLOUR_2}货币符号: +STR_5886 :{WINDOW_COLOUR_2}货币符号: STR_5887 :前缀 STR_5888 :后缀 STR_5889 :自定义货币符号 @@ -4236,7 +4233,7 @@ STR_5917 :{COMMA16}位玩家 STR_5918 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{COMMA16} STR_5919 :{COMMA16} STR_5920 :渲染天气效果 -STR_5921 :{SMALLFONT}{BLACK}启用后,于雷暴天气中的雨和灰蒙蒙的滤镜会被渲染在画面中. +STR_5921 :{SMALLFONT}{BLACK}启用后,雷暴中的雨和灰雾的滤镜会被渲染在画面中. STR_5922 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{SMALLFONT}{BLACK}最多{STRINGID} STR_5923 :{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{POP16}{SMALLFONT}{BLACK}每列车最多为{COMMA16} {STRINGID} STR_5924 :地面详情 @@ -4763,3 +4760,297 @@ STR_DTLS : STR_NAME :Condor Ride STR_DESC :Riding in special harnesses below the track, riders experience the feeling of flight as they swoop through the air in Condor-shaped trains STR_CPTY :4 passengers per car + +################# +## RCT2 Scenarios +################# + +STR_SCNR :Alpine Adventures +STR_PARK :Alpine Adventures +STR_DTLS :将一个小滑雪胜地转型为一个以冰雪为主题的游乐园 + + +STR_SCNR :Amity Airfield +STR_PARK :Amity Airfield +STR_DTLS :在这个被遗弃的飞机场建立一个以飞行为主题的游乐园 + + +STR_SCNR :Botany Breakers +STR_PARK :Botany Breakers +STR_DTLS :你的挑战是在这个天堂岛上建立一个高利润的游乐园 + + +STR_SCNR :Build your own Six Flags Belgium +STR_PARK :Six Flags Belgium +STR_DTLS :建立自己的这个欧洲六旗游乐园的版本 + + +STR_SCNR :Build your own Six Flags Great Adventure +STR_PARK :Six Flags Great Adventure +STR_DTLS :使用您的设计技能来重建这个六旗游乐园 + + +STR_SCNR :Build your own Six Flags Holland +STR_PARK :Six Flags Holland +STR_DTLS :以你想要的方式建造这个欧洲六旗游乐园 + + +STR_SCNR :Build your own Six Flags Magic Mountain +STR_PARK :Six Flags Magic Mountain +STR_DTLS :创建你自己的大型六旗游乐园的版本 + + +STR_SCNR :Build your own Six Flags over Texas +STR_PARK :Six Flags over Texas +STR_DTLS :从零开始,建造这个六旗游乐园的游乐设施 + + +STR_SCNR :Build your own Six Flags Park +STR_PARK :Six Flags +STR_DTLS :建造你自己设计的六旗游乐园-你可以从其他六旗游乐园借鉴或者设计建造你自己的游乐设施 + + +STR_SCNR :Bumbly Bazaar +STR_PARK :Bumbly Bazaar +STR_DTLS :从一个小集市,你的挑战是增加商店利润,建设商店及游乐设施和过山车来吸引更多的顾客 + + +STR_SCNR :Crazy Castle +STR_PARK :Crazy Castle +STR_DTLS :你继承了一个大的城堡-你的工作是把它转型成一个小型主题公园。 + + +STR_SCNR :Dusty Greens +STR_PARK :Dusty Greens +STR_DTLS :位于沙漠附近的一个公路交界处,是时候把 Dusty Greens 这个小高尔夫度假村发展成为一个繁荣的主题公园了 + + +STR_SCNR :Electric Fields +STR_PARK :Electric Fields +STR_DTLS :你继承了一个小农场,你的挑战是在农田和农场建筑之间建立一个小型主题乐园 + + +STR_SCNR :Extreme Heights +STR_PARK :Extreme Heights +STR_DTLS :自由的金融限制,你的挑战是如何扩大这个沙漠游乐园吸引人们寻求终极的刺激 + + +STR_SCNR :Factory Capers +STR_PARK :Factory Capers +STR_DTLS :一个废弃的工厂是你的机遇,把它建造成一个机械为主题的游乐园 + + +STR_SCNR :Fungus Woods +STR_PARK :Fungus Woods +STR_DTLS :仅限于老式的木制游乐设施,你的挑战是在 Fungus Woods 建造一个蓬勃发展的主题乐园 + + +STR_SCNR :Ghost Town +STR_PARK :Ghost Town +STR_DTLS :由一个大型的娱乐公园开始,你的任务是在一个废弃的采矿镇周围建造一个巨大的过山车游乐园 + + +STR_SCNR :Gravity Gardens +STR_PARK :Gravity Gardens +STR_DTLS :你的挑战是在 Gravity Gardens 没有其他设施可用的条件下打造过山车游乐园,只能建造过山车! + + +STR_SCNR :Infernal Views +STR_PARK :Infernal Views +STR_DTLS :公园坐落在炙热的熔岩流和不稳定的岩浆中 + + +STR_SCNR :Lucky Lake +STR_PARK :Lucky Lake +STR_DTLS :你有了无限的资金,但湖泊是一个具有挑战性的位置,这个公园将是一个挑战,扩大它并运营它 + + +STR_SCNR :Rainbow Summit +STR_PARK :Rainbow Summit +STR_DTLS :这个游乐园建在一个山坡上,禁止建造任何高的东西。你能扩大游乐园,使它成功吗? + + +STR_SCNR :Six Flags Belgium +STR_PARK :Six Flags Belgium +STR_DTLS :尝试用你的手运营并改进这座六旗游乐园 + + +STR_SCNR :Six Flags Great Adventure +STR_PARK :Six Flags Great Adventure +STR_DTLS :建造遗失的六旗乐园游乐设施,或用自己的设计善公园!但别忘了你的最终目标--吸引更多的客人到公园去! + + +STR_SCNR :Six Flags Holland +STR_PARK :Six Flags Holland +STR_DTLS :尝试用你的手运营并改进这座六旗游乐园 + + +STR_SCNR :Six Flags Magic Mountain +STR_PARK :Six Flags Magic Mountain +STR_DTLS :建造遗失的六旗乐园游乐设施,或用自己的设计善公园!但别忘了你的最终目标--偿还贷款,同时保持公园价值! + + +STR_SCNR :Six Flags over Texas +STR_PARK :Six Flags over Texas +STR_DTLS :建造遗失的六旗乐园游乐设施,或用自己的设计善公园!但别忘了你的最终目标--吸引更多的客人到公园去! + +############################################################################### +## Wacky Worlds Scenarios +############################################################################### + +STR_SCNR :Africa - African Diamond Mine +STR_PARK :Mines of Africa +STR_DTLS :你继承了一个废弃的钻石矿,并找到一个珍贵的钻石。你决定用那笔钱去建造一个世界闻名的主题乐园。 + + +STR_SCNR :Africa - Oasis +STR_PARK :Mirage Madness +STR_DTLS :一个沙漠绿洲被发现了,它为游乐园提供了一个美丽的环境。游乐园已有绿洲运输。 + + +STR_SCNR :Africa - Victoria Falls +STR_PARK :Over The Edge +STR_DTLS :当地建成了一个大坝,提供了丰富的,廉价的水电,用来运行一个公园。你需要用公园来获得很多的钱,用来偿还建造大坝的贷款。 + + +STR_SCNR :Antarctic - Ecological Salvage +STR_PARK :Icy Adventures +STR_DTLS :环境署已经把你碍眼的旧炼油厂改造成顶级生态的旅游胜地。土地便宜但贷款利息高。你可以卖掉旧建筑来赚钱。 + + +STR_SCNR :Asia - Great Wall of China Tourism Enhancement +STR_PARK :Great Wall of China +STR_DTLS :当局已决定在附近的土地上建造主题公园,以加强在长城周边的旅游业发展。 + + +STR_SCNR :Asia - Japanese Coastal Reclaim +STR_PARK :Okinawa Coast +STR_DTLS :一个现有的公园已经用完了空间。你唯一的选择是建立在海上,所以你采取了贷款。你的建筑的高度被地基和地震风险限制。 + + +STR_SCNR :Asia - Maharaja Palace +STR_PARK :Park Maharaja +STR_DTLS :你被委托为当地人建造大型的娱乐设施。由王公的宫殿改建成一个游乐园。 + + +STR_SCNR :Australasia - Ayers Rock +STR_PARK :Ayers Adventure +STR_DTLS :作为文化意识计划的一部分,你要帮助土著人建立一个游乐园。你需要让大量的客人知道土著们具有独特的文化遗产。 + + +STR_SCNR :Australasia - Fun at the Beach +STR_PARK :Beach Barbecue Blast +STR_DTLS :一个本地企业家的海滨游乐园已经破产。你已经经营了一个小游乐园,你要从建筑公司购买另一个游乐园。开发一个大联合游乐园。 + + +STR_SCNR :Europe - European Cultural Festival +STR_PARK :European Extravaganza +STR_DTLS :你被安排接管一个欧洲文化游的景点,必须增加客人的数量,在目前的欧洲议会任期结束前支付加入欧盟的税款。 + + +STR_SCNR :Europe - Renovation +STR_PARK :From The Ashes +STR_DTLS :一个老公园年久失修。你获得一个欧盟的补助金,将这个被剥夺的地区归还给它昔日的荣耀!你需要整修公园并偿还补助金。 + + +STR_SCNR :N. America - Extreme Hawaiian Island +STR_PARK :Wacky Waikiki +STR_DTLS :夏威夷的人们厌倦了冲浪,寻找更刺激的东西。你需要建立一个游乐园,以保持该地区的旅游评级。 + + +STR_SCNR :North America - Grand Canyon +STR_PARK :Canyon Calamities +STR_DTLS :你必须在有限的土地上建立一个游乐园,这里有自然财富--从美洲印第安人那里有机会购买邻近的土地。维持当地城镇的人口是你需要完成的目标。 + + +STR_SCNR :North America - Rollercoaster Heaven +STR_PARK :Rollercoaster Heaven +STR_DTLS :你是在休假想要利用这段时间改造城市公园的过山车的天堂一个成功的商业大亨。金钱是没有目标的! + + +STR_SCNR :South America - Inca Lost City +STR_PARK :Lost City Founder +STR_DTLS :为了进一步促进当地的旅游业,你必须建设一个公园,它与周围的环境,并有高度的限制。 + + +STR_SCNR :South America - Rain Forest Plateau +STR_PARK :Rainforest Romp +STR_DTLS :空间是有限的宝贵的热带雨林-你必须尽可能多地塞进现有的结算,以提供一个可行的替代当地木材业。 + + +STR_SCNR :South America - Rio Carnival +STR_PARK :Sugarloaf Shores +STR_DTLS :你在里约附近的一个小公园,但银行已在你的贷款。你需要快速提高你的盈利能力来偿还这意想不到的债务。 + +############################################################################### +## Time Twister Scenarios +############################################################################### + +STR_SCNR :Dark Age - Castle +STR_PARK :Cliffside Castle +STR_DTLS :战斗的地方成员重新制定的社会是相当严重的他们的爱好。他们委托你在悬崖边的城堡的场地建设一个黑暗时代的主题公园的工作。 + + +STR_SCNR :Dark Age - Robin Hood +STR_PARK :Sherwood Forest +STR_DTLS :为了把财富从富人中解放出来并分发给有需要的人,你和你的快乐的人决定在舍伍德森林里建立一个主题公园。 + + +STR_SCNR :Future - First Encounters +STR_PARK :Extraterrestrial Extravaganza +STR_DTLS :生命在一个遥远的星球上被发现,建造一个外星人主题公园,以现金在前所未有的兴趣浪潮。 + + +STR_SCNR :Future - Future World +STR_PARK :Gemini City +STR_DTLS :炫耀你的创造性的,乌托邦式的未来愿景-想出一个未来的公园设计,结合国家的最先进的景点。 + + +STR_SCNR :Mythological - Animatronic Film Set +STR_PARK :Animatronic Antics +STR_DTLS :你已经被赋予了运行和改进现有的主题公园的任务,它是建立在一个旧的电影集上的。建立一个向创业的定格动画人第一次带来了神秘的生物生活在银幕上。 + + +STR_SCNR :Mythological - Cradle of Civilisation +STR_PARK :Mythological Madness +STR_DTLS :你拥有一个特定的考古价值的岛屿。你已经决定采用基于地区丰富的神话遗产建设主题公园的保护基金。 + + +STR_SCNR :Prehistoric - After the Asteroid +STR_PARK :Crater Carnage +STR_DTLS :你拥有一个布满灰尘的老流星陨石坑。在真正的创业精神,你已经决定建造一个小行星主题公园,并转换你的看似毫无价值的土地变成一个相当大的财富. + + +STR_SCNR :Prehistoric - Jurassic Safari +STR_PARK :Coastersaurus +STR_DTLS :你被赋予了建设一个侏罗纪时代主题公园的任务。为了优化您的游客访问异国情调的植物和动物的展品,你将需要建立乘坐去到山谷。 + + +STR_SCNR :Prehistoric - Stone Age +STR_PARK :Rocky Rambles +STR_DTLS :为了阻止公路的开发和维护神秘的古老的石头圈,你将需要建造一个石器时代主题公园,并把利润。然而,吸引游客可能会构成挑战,因为地形有点荒凉。 + + +STR_SCNR :Roaring Twenties - Prison Island +STR_PARK :Alcatraz +STR_DTLS :臭名昭著的监狱岛的人口曾经充满了走私犯和诈骗犯-现在出售。你已经决定把它变成一个顶级的旅游景点,钱是没有对象 + + +STR_SCNR :Roaring Twenties - Schneider Cup +STR_PARK :Schneider Shores +STR_DTLS :你的祖父的施耐德杯胜利第七十五周年是几年来。你要尊重自己的成就,通过构建一个基于著名的水上飞机比赛主题公园。 + + +STR_SCNR :Roaring Twenties - Skyscrapers +STR_PARK :Metropolis +STR_DTLS :你拥有一个空的地段,靠近城镇的低矮的部分。把最贵的城市属性,建立一个主题公园的启发,摩天大楼高耸的建筑装饰艺术的年代。 + + +STR_SCNR :Rock 'n' Roll - Flower Power +STR_PARK :Woodstock +STR_DTLS :一个大型的年度音乐节在你的土地上。打造一个主题公园,保持自由奔放的观众的娱乐。 + + +STR_SCNR :Rock 'n' Roll - Rock 'n' Roll +STR_PARK :Rock 'n' Roll Revival +STR_DTLS :这个老龄化的主题公园已经看到了更好的日子。帮助主人给它一个复古摇滚的改造,把这个地方变成一个成功的地点。 From 1dd2751f4a91a33d417970c7d962e6d0a0a5b617 Mon Sep 17 00:00:00 2001 From: OpenRCT2 git bot Date: Wed, 7 Dec 2016 04:00:19 +0000 Subject: [PATCH 50/62] Merge Localisation/master into OpenRCT2/develop. --- data/language/zh-TW.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/data/language/zh-TW.txt b/data/language/zh-TW.txt index bdba67be1f..865c8bfc37 100644 --- a/data/language/zh-TW.txt +++ b/data/language/zh-TW.txt @@ -4188,7 +4188,7 @@ STR_5875 :渲染引擎: STR_5876 :{SMALLFONT}{BLACK}選擇使用於渲染遊戲的引擎. STR_5877 :軟件渲染 STR_5878 :軟件渲染 (使用硬件渲染) -STR_5879   :OpenGL (實驗性質) +STR_5879 :OpenGL (實驗性質) STR_5880 :只顯示已選擇的物件 STR_5881 :只顯示未選擇的物件 STR_5882 :自訂貨幣 @@ -4242,7 +4242,7 @@ STR_5929 :圍欄詳情 STR_5930 :巨型景物詳情 STR_5931 :橫額詳情 STR_5932 :已毀壞元素詳情 -STR_5933   :屬性 +STR_5933 :屬性 STR_5934 :{WINDOW_COLOUR_2}地型素材: {BLACK}{STRINGID} STR_5935 :{WINDOW_COLOUR_2}地型邊緣: {BLACK}{STRINGID} STR_5936 :{WINDOW_COLOUR_2}土地擁有權: {BLACK}{STRINGID} @@ -4252,9 +4252,9 @@ STR_5939 :移除樂園邊界 STR_5940 :還原樂園邊界 STR_5941 :{WINDOW_COLOUR_2}地面高度: STR_5942 :{WINDOW_COLOUR_2}道路名稱: {BLACK}{STRINGID} -STR_5943   :{WINDOW_COLOUR_2}附加物品: {BLACK}{STRINGID} +STR_5943 :{WINDOW_COLOUR_2}附加物品: {BLACK}{STRINGID} STR_5944 :{WINDOW_COLOUR_2}附加物品: {BLACK}暫無 -STR_5945   :{WINDOW_COLOUR_2}已連接的邊緣: +STR_5945 :{WINDOW_COLOUR_2}已連接的邊緣: STR_5946 :{WINDOW_COLOUR_2}遊樂設施種類: {BLACK}{STRINGID} STR_5947 :{WINDOW_COLOUR_2}遊樂設施編號: {BLACK}{COMMA16} STR_5948 :{WINDOW_COLOUR_2}遊樂設施名稱: {BLACK}{STRINGID} @@ -4262,7 +4262,7 @@ STR_5949 :{WINDOW_COLOUR_2}鏈條坡道 STR_5950 :{WINDOW_COLOUR_2}將改變應用於整個軌道組件中 STR_5951 :{WINDOW_COLOUR_2}軌道組件編號: {BLACK}{COMMA16} STR_5952 :{WINDOW_COLOUR_2}次序數目: {BLACK}{COMMA16} -STR_5953   :{SMALLFONT}{BLACK}以底部高度排序目前網格上的地圖元素 +STR_5953 :{SMALLFONT}{BLACK}以底部高度排序目前網格上的地圖元素 STR_5954 :{WINDOW_COLOUR_2}景物年齡: {BLACK}{COMMA16} STR_5955 :{WINDOW_COLOUR_2}Quadrant放置: {BLACK}{STRINGID} STR_5956 :西南 @@ -4271,8 +4271,8 @@ STR_5958 :東北 STR_5959 :東南 STR_5960 :{WINDOW_COLOUR_2}Quadrant放置: STR_5961 :{WINDOW_COLOUR_2}入口編號: {BLACK}{COMMA16} -STR_5962   :{WINDOW_COLOUR_2}衝突檢測: -STR_5963   :{WINDOW_COLOUR_2}已升起的角落: +STR_5962 :{WINDOW_COLOUR_2}衝突檢測: +STR_5963 :{WINDOW_COLOUR_2}已升起的角落: STR_5964 :{WINDOW_COLOUR_2}斜角 STR_5965 :{WINDOW_COLOUR_2}入口類型: {BLACK}{STRINGID} STR_5966 :{WINDOW_COLOUR_2}樂園入口部份: {BLACK}{STRINGID} @@ -4281,25 +4281,25 @@ STR_5968 :左 STR_5969 :右 STR_5970 :{WINDOW_COLOUR_2}入口編號: {BLACK}{COMMA16} STR_5971 :{WINDOW_COLOUR_2}出口編號: {BLACK}{COMMA16} -STR_5972   :{WINDOW_COLOUR_2}遊樂設施編號: {BLACK}{COMMA16} +STR_5972 :{WINDOW_COLOUR_2}遊樂設施編號: {BLACK}{COMMA16} STR_5973 :與下一地圖元素並列 -STR_5974   :{SMALLFONT}{BLACK}將此元素的底部及清空高度與下一元素調整成一致. 此舉會讓於此網格上建造得更加容易. +STR_5974 :{SMALLFONT}{BLACK}將此元素的底部及清空高度與下一元素調整成一致. 此舉會讓於此網格上建造得更加容易. STR_5975 :坡道: STR_5976 :平坦 -STR_5977   :右邊向上 +STR_5977 :右邊向上 STR_5978 :左邊向上 STR_5979 :{WINDOW_COLOUR_2}圍欄類型: {BLACK}{COMMA16} STR_5980 :{WINDOW_COLOUR_2}橫額文字: {BLACK}{STRINGID} STR_5981 :{WINDOW_COLOUR_2}不是橫額 STR_5982 :{WINDOW_COLOUR_2}巨型景物類型: {BLACK}{COMMA16} STR_5983 :{WINDOW_COLOUR_2}巨型景物組件編號: {BLACK}{COMMA16} -STR_5984   :被擋住的道路: +STR_5984 :被擋住的道路: STR_5985 :建立新文件夾 STR_5986 :請輸入新文件夾的名字 STR_5987 :無法建立新文件夾 STR_5988 :{SMALLFONT}{BLACK}已經沒有可供購買的土地使用權 STR_5989 :{SMALLFONT}{BLACK}已經沒有可供購買的建造權 -STR_5990   :{SMALLFONT}{BLACK}已經沒有可供購買的土地使用或建造權 +STR_5990 :{SMALLFONT}{BLACK}已經沒有可供購買的土地使用或建造權 STR_5991 :無法貼上元素... STR_5992 :此地圖元素的數量已達上限 STR_5993 :{SMALLFONT}{BLACK}複製所選元素 From 51fcfe3379127d43d1b3a412f80ad64a50ca94f2 Mon Sep 17 00:00:00 2001 From: Yaroslav Tretyakov Date: Wed, 7 Dec 2016 14:28:55 -0700 Subject: [PATCH 51/62] Fix #4852: Clicking on the hook icon for a person does not return it to the original location (#4854) --- src/network/network.h | 2 +- src/peep/peep.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/network/network.h b/src/network/network.h index 1e5bcfcbae..eec83f4f08 100644 --- a/src/network/network.h +++ b/src/network/network.h @@ -55,7 +55,7 @@ extern "C" { // This define specifies which version of network stream current build uses. // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "19" +#define NETWORK_STREAM_VERSION "20" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION #ifdef __cplusplus diff --git a/src/peep/peep.c b/src/peep/peep.c index aba1b46efd..d43b495af7 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -19,6 +19,7 @@ #include "../cheats.h" #include "../config.h" #include "../game.h" +#include "../input.h" #include "../interface/window.h" #include "../localisation/localisation.h" #include "../management/finance.h" @@ -2006,9 +2007,17 @@ bool peep_pickup_command(unsigned int peepnum, int x, int y, int z, int action, if (!peep_can_be_picked_up(peep)) { return false; } - if (network_get_pickup_peep(game_command_playerid)) { + rct_peep* existing = network_get_pickup_peep(game_command_playerid); + if (existing) { // already picking up a peep - return false; + bool result = peep_pickup_command(existing->sprite_index, network_get_pickup_peep_old_x(game_command_playerid), 0, 0, 1, apply); + if (existing == peep) { + return result; + } + if (game_command_playerid == network_get_current_player_id()) { + // prevent tool_cancel() + gInputFlags &= ~INPUT_FLAG_TOOL_ACTIVE; + } } if (apply) { network_set_pickup_peep(game_command_playerid, peep); From 1513b88af7b5d01a2538f932f3fc34f696da2ca2 Mon Sep 17 00:00:00 2001 From: Ted John Date: Thu, 8 Dec 2016 11:31:21 +0000 Subject: [PATCH 52/62] Resolve #4856: Mention Dump File Location in Readme --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e58c2296e3..80cf211f68 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -8,6 +8,8 @@ To report a bug, ensure you have a GitHub account. Search the issues page to see If not, create a new issue and write the steps to reproduce. Upload a saved game if possible and this is very helpful for users to replicate the bug. Please state which version of the game you are running and where you downloaded it from, e.g. *openrct2.com develop 0.0.3 build 1255 (ec25b2f)*. +For Windows builds, OpenRCT2 will generate a memory dump and saved game when the game crashes unexpectedly. The game will open explorer to these files automatically for you. They are placed inside your configured user directory which by default is `%HOMEPATH%\Documents\OpenRCT2`. + # Translation Translation is managed in a separate repository, [OpenRCT2/Localisation](https://github.com/OpenRCT2/Localisation). You will find more information there. From bd02f14699eee4a20821083c645b56347fce83b0 Mon Sep 17 00:00:00 2001 From: n42k Date: Thu, 8 Dec 2016 12:09:21 +0000 Subject: [PATCH 53/62] Fix platform_get_locale_temperature_format() in windows.c --- src/platform/windows.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/platform/windows.c b/src/platform/windows.c index 8fda6936cd..e591a113e4 100644 --- a/src/platform/windows.c +++ b/src/platform/windows.c @@ -966,23 +966,23 @@ uint8 platform_get_locale_measurement_format() uint8 platform_get_locale_temperature_format() { - // There does not seem to be a function to obtain this, just check the countries - UINT country; + UINT fahrenheit; + + // GetLocaleInfo will set fahrenheit to 1 if the locale on this computer + // uses the United States measurement system or 0 otherwise. if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IMEASURE | LOCALE_RETURN_NUMBER, - (LPSTR)&country, - sizeof(country)) == 0 + (LPSTR)&fahrenheit, + sizeof(fahrenheit)) == 0 ) { + // Assume celsius by default if function call fails return TEMPERATURE_FORMAT_C; } - switch (country) { - case CTRY_UNITED_STATES: - case CTRY_BELIZE: + if(fahrenheit) return TEMPERATURE_FORMAT_F; - default: + else return TEMPERATURE_FORMAT_C; - } } bool platform_check_steam_overlay_attached() From d1d6be0b9316fd8a0322024b55ef5fbb0f3f7d7f Mon Sep 17 00:00:00 2001 From: wolfreak99 Date: Thu, 8 Dec 2016 14:10:16 -0500 Subject: [PATCH 54/62] Clip all scenery images in scenery window to prevent overflow/overlap --- src/windows/scenery.c | 73 +++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 38 deletions(-) diff --git a/src/windows/scenery.c b/src/windows/scenery.c index 583c3b8a82..1f0d843699 100644 --- a/src/windows/scenery.c +++ b/src/windows/scenery.c @@ -1100,13 +1100,13 @@ void window_scenery_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrol while ((currentSceneryGlobalId = window_scenery_tab_entries[tabIndex][sceneryTabItemIndex]) != -1) { uint16 tabSelectedSceneryId = gWindowSceneryTabSelections[tabIndex]; - if (gWindowSceneryPaintEnabled == 1) - { + if (gWindowSceneryPaintEnabled == 1) { if (w->scenery.selected_scenery_id == currentSceneryGlobalId) { gfx_fill_rect_inset(dpi, left, top, left + SCENERY_BUTTON_WIDTH - 1, top + SCENERY_BUTTON_HEIGHT - 1, w->colours[1], INSET_RECT_FLAG_FILL_MID_LIGHT); } - } else { + } + else { if (tabSelectedSceneryId == currentSceneryGlobalId) { gfx_fill_rect_inset(dpi, left, top, left + SCENERY_BUTTON_WIDTH - 1, top + SCENERY_BUTTON_HEIGHT - 1, w->colours[1], (INSET_RECT_FLAG_BORDER_INSET | INSET_RECT_FLAG_FILL_MID_LIGHT)); @@ -1118,26 +1118,29 @@ void window_scenery_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrol } rct_scenery_entry* sceneryEntry; - if (currentSceneryGlobalId >= 0x400) { - sceneryEntry = get_banner_entry(currentSceneryGlobalId - 0x400); - uint32 imageId = sceneryEntry->image + gWindowSceneryRotation * 2; - imageId |= (gWindowSceneryPrimaryColour << 19) | 0x20000000; + rct_drawpixelinfo clipdpi; + if (clip_drawpixelinfo(&clipdpi, dpi, left + 1, top + 1, SCENERY_BUTTON_WIDTH - 2, SCENERY_BUTTON_HEIGHT - 2)) { + if (currentSceneryGlobalId >= 0x400) { + sceneryEntry = get_banner_entry(currentSceneryGlobalId - 0x400); + uint32 imageId = sceneryEntry->image + gWindowSceneryRotation * 2; + imageId |= (gWindowSceneryPrimaryColour << 19) | 0x20000000; - gfx_draw_sprite(dpi, imageId, left + 0x21, top + 0x28, w->colours[1]); - gfx_draw_sprite(dpi, imageId + 1, left + 0x21, top + 0x28, w->colours[1]); - } else if (currentSceneryGlobalId >= 0x300) { - sceneryEntry = get_large_scenery_entry(currentSceneryGlobalId - 0x300); - uint32 imageId = sceneryEntry->image + gWindowSceneryRotation; - imageId |= (gWindowSceneryPrimaryColour << 19) | 0x20000000; - imageId |= (gWindowScenerySecondaryColour << 24) | 0x80000000; + gfx_draw_sprite(&clipdpi, imageId, 0x21, 0x28, w->colours[1]); + gfx_draw_sprite(&clipdpi, imageId + 1, 0x21, 0x28, w->colours[1]); + } + else if (currentSceneryGlobalId >= 0x300) { + sceneryEntry = get_large_scenery_entry(currentSceneryGlobalId - 0x300); + uint32 imageId = sceneryEntry->image + gWindowSceneryRotation; + imageId |= (gWindowSceneryPrimaryColour << 19) | 0x20000000; + imageId |= (gWindowScenerySecondaryColour << 24) | 0x80000000; - gfx_draw_sprite(dpi, imageId, left + 0x21, top, w->colours[1]); - } else if (currentSceneryGlobalId >= 0x200) { - sceneryEntry = get_wall_entry(currentSceneryGlobalId - 0x200); - rct_drawpixelinfo clipdpi; - if (clip_drawpixelinfo(&clipdpi, dpi, left + 1, top + 1, 64, 78)) { + gfx_draw_sprite(&clipdpi, imageId, 0x21, 0, w->colours[1]); + } + else if (currentSceneryGlobalId >= 0x200) { + sceneryEntry = get_wall_entry(currentSceneryGlobalId - 0x200); uint32 imageId = sceneryEntry->image; uint8 tertiaryColour = w->colours[1]; + uint16 spriteTop = (sceneryEntry->wall.height * 2) + 0x32; if (sceneryEntry->wall.flags & WALL_SCENERY_FLAG2) { imageId |= (gWindowSceneryPrimaryColour << 19) | 0x20000000; @@ -1145,12 +1148,10 @@ void window_scenery_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrol if (sceneryEntry->wall.flags & WALL_SCENERY_HAS_SECONDARY_COLOUR) { imageId |= (gWindowScenerySecondaryColour << 24) | 0x80000000; } - gfx_draw_sprite(&clipdpi, imageId, 0x2F, (sceneryEntry->wall.height * 2) + 0x32, - tertiaryColour); + gfx_draw_sprite(&clipdpi, imageId, 0x2F, spriteTop, tertiaryColour); imageId = (sceneryEntry->image + 0x40000006) | (GlassPaletteIds[gWindowSceneryPrimaryColour] << 19); - gfx_draw_sprite(&clipdpi, imageId, 0x2F, (sceneryEntry->wall.height * 2) + 0x32, - tertiaryColour); + gfx_draw_sprite(&clipdpi, imageId, 0x2F, spriteTop, tertiaryColour); } else { imageId |= (gWindowSceneryPrimaryColour << 19) | 0x20000000; @@ -1162,26 +1163,22 @@ void window_scenery_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrol imageId &= 0xDFFFFFFF; tertiaryColour = gWindowSceneryTertiaryColour; } - } - gfx_draw_sprite(&clipdpi, imageId, 0x2F, (sceneryEntry->wall.height * 2) + 0x32, - tertiaryColour); + gfx_draw_sprite(&clipdpi, imageId, 0x2F, spriteTop, tertiaryColour); - if (sceneryEntry->wall.flags & WALL_SCENERY_IS_DOOR){ - gfx_draw_sprite(&clipdpi, imageId + 1, 0x2F, (sceneryEntry->wall.height * 2) + 0x32, - tertiaryColour); + if (sceneryEntry->wall.flags & WALL_SCENERY_IS_DOOR) { + gfx_draw_sprite(&clipdpi, imageId + 1, 0x2F, spriteTop, tertiaryColour); } } } - } else if (currentSceneryGlobalId >= 0x100) { - sceneryEntry = get_footpath_item_entry(currentSceneryGlobalId - 0x100); - uint32 imageId = sceneryEntry->image; + else if (currentSceneryGlobalId >= 0x100) { + sceneryEntry = get_footpath_item_entry(currentSceneryGlobalId - 0x100); + uint32 imageId = sceneryEntry->image; - gfx_draw_sprite(dpi, imageId, left + 0x0B, top + 0x10, w->colours[1]); - } else { - sceneryEntry = get_small_scenery_entry(currentSceneryGlobalId); - rct_drawpixelinfo clipdpi; - if (clip_drawpixelinfo(&clipdpi, dpi, left + 1, top + 1, SCENERY_BUTTON_WIDTH - 2, SCENERY_BUTTON_HEIGHT - 2)) { + gfx_draw_sprite(&clipdpi, imageId, 0x0B, 0x10, w->colours[1]); + } + else { + sceneryEntry = get_small_scenery_entry(currentSceneryGlobalId); uint32 imageId = sceneryEntry->image + gWindowSceneryRotation; if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR) { @@ -1195,7 +1192,7 @@ void window_scenery_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrol uint16 spriteTop = (sceneryEntry->small_scenery.height / 4) + 0x2B; if (sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_FULL_TILE && - sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE) { + sceneryEntry->small_scenery.flags & SMALL_SCENERY_FLAG_VOFFSET_CENTRE) { spriteTop -= 0x0C; } From c6dda4e614bf4bbc5dfabcd7f5442eda5824a9de Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 10 Dec 2016 00:36:59 +0000 Subject: [PATCH 55/62] Fix #4863: Build fails when using VS 2017 RC --- src/drawing/engines/opengl/OpenGLFramebuffer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/drawing/engines/opengl/OpenGLFramebuffer.cpp b/src/drawing/engines/opengl/OpenGLFramebuffer.cpp index c75e4f995c..d8bc8502cd 100644 --- a/src/drawing/engines/opengl/OpenGLFramebuffer.cpp +++ b/src/drawing/engines/opengl/OpenGLFramebuffer.cpp @@ -16,6 +16,7 @@ #ifndef DISABLE_OPENGL +#include "../../../common.h" #include #include "../../../core/Memory.hpp" #include "OpenGLFramebuffer.h" From e9bafc29737b74e9aa1162a5833909f7a32935ed Mon Sep 17 00:00:00 2001 From: Ted John Date: Sat, 10 Dec 2016 19:34:33 +0000 Subject: [PATCH 56/62] Refactor RCT2 interop code to new source --- openrct2.vcxproj | 2 + src/hook.h | 2 + src/openrct2.c | 199 +-------------------------- src/openrct2.h | 1 - src/rct2/interop.c | 223 +++++++++++++++++++++++++++++++ src/rct2/interop.h | 24 ++++ test/testpaint/testpaint.vcxproj | 13 -- 7 files changed, 255 insertions(+), 209 deletions(-) create mode 100644 src/rct2/interop.c create mode 100644 src/rct2/interop.h diff --git a/openrct2.vcxproj b/openrct2.vcxproj index 0f0b64b570..bd40bc245e 100644 --- a/openrct2.vcxproj +++ b/openrct2.vcxproj @@ -228,6 +228,7 @@ + @@ -544,6 +545,7 @@ + diff --git a/src/hook.h b/src/hook.h index c4dbdf5758..d4cee25f61 100644 --- a/src/hook.h +++ b/src/hook.h @@ -19,6 +19,8 @@ #ifndef NO_RCT2 +#include "common.h" + enum { X86_FLAG_CARRY = 1 << 0, X86_FLAG_PARITY = 1 << 2, diff --git a/src/openrct2.c b/src/openrct2.c index 9af19a5ffb..f18253ae99 100644 --- a/src/openrct2.c +++ b/src/openrct2.c @@ -19,7 +19,6 @@ #include "config.h" #include "editor.h" #include "game.h" -#include "hook.h" #include "interface/chat.h" #include "interface/themes.h" #include "interface/window.h" @@ -32,31 +31,15 @@ #include "openrct2.h" #include "platform/crash.h" #include "platform/platform.h" +#include "rct2/interop.h" #include "ride/ride.h" #include "title.h" -#include "util/sawyercoding.h" #include "util/util.h" #include "version.h" #include "world/mapgen.h" -#if defined(__unix__) || defined(__MACOSX__) -#include -#include -#include -#include -#include -#include -#endif // defined(__unix__) || defined(__MACOSX__) - int gExitCode; -#if defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) && !defined(NO_RCT2) - static int fdData = -1; -#endif -#if defined(__unix__) && !defined(NO_RCT2) - static char * segments = (char *)(GOOD_PLACE_FOR_DATA_SEGMENT); -#endif - int gOpenRCT2StartupAction = STARTUP_ACTION_TITLE; utf8 gOpenRCT2StartupActionPath[512] = { 0 }; utf8 gExePath[MAX_PATH]; @@ -83,7 +66,6 @@ int _finished; static rct_xyz16 _spritelocations1[MAX_SPRITES], _spritelocations2[MAX_SPRITES]; static void openrct2_loop(); -static void openrct2_setup_rct2_hooks(); void openrct2_write_full_version_info(utf8 *buffer, size_t bufferSize) { @@ -206,7 +188,7 @@ bool openrct2_initialise() crash_init(); - if (!openrct2_setup_rct2_segment()) { + if (!rct2_interop_setup_segment()) { log_fatal("Unable to load RCT2 data sector"); return false; } @@ -263,7 +245,7 @@ bool openrct2_initialise() title_sequences_set_default(); title_sequences_load_presets(); - openrct2_setup_rct2_hooks(); + rct2_interop_setup_hooks(); if (!rct2_init()) return false; @@ -357,10 +339,7 @@ void openrct2_dispose() #ifndef DISABLE_NETWORK EVP_MD_CTX_destroy(gHashCTX); #endif // DISABLE_NETWORK -#if defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) && !defined(NO_RCT2) - munmap(segments, 12079104); - close(fdData); -#endif + rct2_interop_dispose(); platform_free(); } @@ -491,173 +470,3 @@ void openrct2_reset_object_tween_locations() _spritelocations1[i].z = _spritelocations2[i].z = get_sprite(i)->unknown.z; } } - -static void openrct2_get_segment_data_path(char * buffer, size_t bufferSize) -{ - platform_get_exe_path(buffer, bufferSize); - safe_strcat_path(buffer, "openrct2_data", bufferSize); -} - -/** - * Loads RCT2's data model and remaps the addresses. - * @returns true if the data integrity check succeeded, otherwise false. - */ -bool openrct2_setup_rct2_segment() -{ - // OpenRCT2 on Linux and macOS is wired to have the original Windows PE sections loaded - // necessary. Windows does not need to do this as OpenRCT2 runs as a DLL loaded from the Windows PE. - int len = 0x01429000 - 0x8a4000; // 0xB85000, 12079104 bytes or around 11.5MB - int err = 0; - // in some configurations err and len may be unused - UNUSED(err); - UNUSED(len); -#if defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) && !defined(NO_RCT2) - #define RDATA_OFFSET 0x004A4000 - #define DATASEG_OFFSET 0x005E2000 - - // Using PE-bear I was able to figure out all the needed addresses to be filled. - // There are three sections to be loaded: .rdata, .data and .text, plus another - // one to be mapped: DATASEG. - // Out of the three, two can simply be mmapped into memory, while the third one, - // .data has a virtual size which is much completely different to its file size - // (even when taking page-alignment into consideration) - // - // The sections are as follows (dump from gdb) - // [0] 0x401000->0x6f7000 at 0x00001000: .text ALLOC LOAD READONLY CODE HAS_CONTENTS - // [1] 0x6f7000->0x8a325d at 0x002f7000: CODESEG ALLOC LOAD READONLY CODE HAS_CONTENTS - // [2] 0x8a4000->0x9a5894 at 0x004a4000: .rdata ALLOC LOAD DATA HAS_CONTENTS - // [3] 0x9a6000->0x9e2000 at 0x005a6000: .data ALLOC LOAD DATA HAS_CONTENTS - // [4] 0x1428000->0x14282bc at 0x005e2000: DATASEG ALLOC LOAD DATA HAS_CONTENTS - // [5] 0x1429000->0x1452000 at 0x005e3000: .cms_t ALLOC LOAD READONLY CODE HAS_CONTENTS - // [6] 0x1452000->0x14aaf3e at 0x0060c000: .cms_d ALLOC LOAD DATA HAS_CONTENTS - // [7] 0x14ab000->0x14ac58a at 0x00665000: .idata ALLOC LOAD READONLY DATA HAS_CONTENTS - // [8] 0x14ad000->0x14b512f at 0x00667000: .rsrc ALLOC LOAD DATA HAS_CONTENTS - // - // .data section, however, has virtual size of 0xA81C3C, and so - // 0x9a6000 + 0xA81C3C = 0x1427C3C, which after alignment to page size becomes - // 0x1428000, which can be seen as next section, DATASEG - // - // The data is now loaded into memory with a linker script, which proves to - // be more reliable, as mallocs that happen before we reach segment setup - // could have already taken the space we need. - - // TODO: UGLY, UGLY HACK! - //off_t file_size = 6750208; - - utf8 segmentDataPath[MAX_PATH]; - openrct2_get_segment_data_path(segmentDataPath, sizeof(segmentDataPath)); - fdData = open(segmentDataPath, O_RDONLY); - if (fdData < 0) - { - log_fatal("failed to load openrct2_data"); - exit(1); - } - log_warning("%p", GOOD_PLACE_FOR_DATA_SEGMENT); - segments = mmap((void *)(GOOD_PLACE_FOR_DATA_SEGMENT), len, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE, fdData, 0); - log_warning("%p", segments); - if ((uintptr_t)segments != GOOD_PLACE_FOR_DATA_SEGMENT) { - perror("mmap"); - return false; - } -#endif // defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) - -#if defined(__unix__) && !defined(NO_RCT2) - int pageSize = getpagesize(); - int numPages = (len + pageSize - 1) / pageSize; - unsigned char *dummy = malloc(numPages); - - err = mincore((void *)segments, len, dummy); - bool pagesMissing = false; - if (err != 0) - { - err = errno; -#ifdef __LINUX__ - // On Linux ENOMEM means all requested range is unmapped - if (err != ENOMEM) - { - pagesMissing = true; - perror("mincore"); - } -#else - pagesMissing = true; - perror("mincore"); -#endif // __LINUX__ - } else { - for (int i = 0; i < numPages; i++) - { - if (dummy[i] != 1) - { - pagesMissing = true; - void *start = (void *)segments + i * pageSize; - void *end = (void *)segments + (i + 1) * pageSize - 1; - log_warning("required page %p - %p is not in memory!", start, end); - } - } - } - free(dummy); - if (pagesMissing) - { - log_error("At least one of required pages was not found in memory. This can cause segfaults later on."); - } -#if !defined(USE_MMAP) - // section: text - err = mprotect((void *)0x401000, 0x8a4000 - 0x401000, PROT_READ | PROT_EXEC | PROT_WRITE); - if (err != 0) - { - perror("mprotect"); - } -#endif // !defined(USE_MMAP) - // section: rw data - err = mprotect((void *)segments, 0x01429000 - 0x8a4000, PROT_READ | PROT_WRITE); - if (err != 0) - { - perror("mprotect"); - } -#endif // defined(__unix__) - -#if defined(USE_MMAP) && defined(__WINDOWS__) - segments = VirtualAlloc((void *)(GOOD_PLACE_FOR_DATA_SEGMENT), len, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); - if ((uintptr_t)segments != GOOD_PLACE_FOR_DATA_SEGMENT) { - log_error("VirtualAlloc, segments = %p, GetLastError = 0x%x", segments, GetLastError()); - return false; - } - - utf8 segmentDataPath[MAX_PATH]; - openrct2_get_segment_data_path(segmentDataPath, sizeof(segmentDataPath)); - SDL_RWops * rw = SDL_RWFromFile(segmentDataPath, "rb"); - if (rw == NULL) - { - log_error("failed to load file"); - return false; - } - if (SDL_RWread(rw, segments, len, 1) != 1) { - log_error("Unable to read chunk header!"); - return false; - } - SDL_RWclose(rw); -#endif // defined(USE_MMAP) && defined(__WINDOWS__) - -#if !defined(NO_RCT2) && defined(USE_MMAP) - // Check that the expected data is at various addresses. - // Start at 0x9a6000, which is start of .data, to skip the region containing addresses to DLL - // calls, which can be changed by windows/wine loader. - const uint32 c1 = sawyercoding_calculate_checksum((const uint8*)(segments + (uintptr_t)(0x009A6000 - 0x8a4000)), 0x009E0000 - 0x009A6000); - const uint32 c2 = sawyercoding_calculate_checksum((const uint8*)(segments + (uintptr_t)(0x01428000 - 0x8a4000)), 0x014282BC - 0x01428000); - const uint32 exp_c1 = 10114815; - const uint32 exp_c2 = 23564; - if (c1 != exp_c1 || c2 != exp_c2) { - log_warning("c1 = %u, expected %u, match %d", c1, exp_c1, c1 == exp_c1); - log_warning("c2 = %u, expected %u, match %d", c2, exp_c2, c2 == exp_c2); - return false; - } -#endif - return true; -} - -/** - * Setup hooks to allow RCT2 to call OpenRCT2 functions instead. - */ -static void openrct2_setup_rct2_hooks() -{ - // None for now -} diff --git a/src/openrct2.h b/src/openrct2.h index 67eb264628..8da27fe06a 100644 --- a/src/openrct2.h +++ b/src/openrct2.h @@ -61,7 +61,6 @@ void openrct2_launch(); void openrct2_dispose(); void openrct2_finish(); void openrct2_reset_object_tween_locations(); -bool openrct2_setup_rct2_segment(); int cmdline_run(const char **argv, int argc); diff --git a/src/rct2/interop.c b/src/rct2/interop.c new file mode 100644 index 0000000000..d8b952a3fb --- /dev/null +++ b/src/rct2/interop.c @@ -0,0 +1,223 @@ +#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers +/***************************************************************************** + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * OpenRCT2 is the work of many authors, a full list can be found in contributors.md + * For more information, visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * A full copy of the GNU General Public License can be found in licence.txt + *****************************************************************************/ +#pragma endregion + +#include "../common.h" + +#if defined(__WINDOWS__) + #define WIN32_LEAN_AND_MEAN + #include +#endif + +#if defined(__unix__) || defined(__MACOSX__) + #include + #include + #include + #include + #include + #include +#endif // defined(__unix__) || defined(__MACOSX__) + +#include "../addresses.h" +#include "../hook.h" +#include "../openrct2.h" +#include "../util/sawyercoding.h" +#include "../util/util.h" +#include "interop.h" + +#if defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) && !defined(NO_RCT2) + static int fdData = -1; +#endif +#if !defined(NO_RCT2) + static char * segments = (char *)(GOOD_PLACE_FOR_DATA_SEGMENT); +#endif + +static void rct2_interop_get_segment_data_path(char * buffer, size_t bufferSize) +{ + platform_get_exe_path(buffer, bufferSize); + safe_strcat_path(buffer, "openrct2_data", bufferSize); +} + +/** + * Loads RCT2's data model and remaps the addresses. + * @returns true if the data integrity check succeeded, otherwise false. + */ +bool rct2_interop_setup_segment() +{ + // OpenRCT2 on Linux and macOS is wired to have the original Windows PE sections loaded + // necessary. Windows does not need to do this as OpenRCT2 runs as a DLL loaded from the Windows PE. + int len = 0x01429000 - 0x8a4000; // 0xB85000, 12079104 bytes or around 11.5MB + int err = 0; + // in some configurations err and len may be unused + UNUSED(err); + UNUSED(len); +#if defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) && !defined(NO_RCT2) + #define RDATA_OFFSET 0x004A4000 + #define DATASEG_OFFSET 0x005E2000 + + // Using PE-bear I was able to figure out all the needed addresses to be filled. + // There are three sections to be loaded: .rdata, .data and .text, plus another + // one to be mapped: DATASEG. + // Out of the three, two can simply be mmapped into memory, while the third one, + // .data has a virtual size which is much completely different to its file size + // (even when taking page-alignment into consideration) + // + // The sections are as follows (dump from gdb) + // [0] 0x401000->0x6f7000 at 0x00001000: .text ALLOC LOAD READONLY CODE HAS_CONTENTS + // [1] 0x6f7000->0x8a325d at 0x002f7000: CODESEG ALLOC LOAD READONLY CODE HAS_CONTENTS + // [2] 0x8a4000->0x9a5894 at 0x004a4000: .rdata ALLOC LOAD DATA HAS_CONTENTS + // [3] 0x9a6000->0x9e2000 at 0x005a6000: .data ALLOC LOAD DATA HAS_CONTENTS + // [4] 0x1428000->0x14282bc at 0x005e2000: DATASEG ALLOC LOAD DATA HAS_CONTENTS + // [5] 0x1429000->0x1452000 at 0x005e3000: .cms_t ALLOC LOAD READONLY CODE HAS_CONTENTS + // [6] 0x1452000->0x14aaf3e at 0x0060c000: .cms_d ALLOC LOAD DATA HAS_CONTENTS + // [7] 0x14ab000->0x14ac58a at 0x00665000: .idata ALLOC LOAD READONLY DATA HAS_CONTENTS + // [8] 0x14ad000->0x14b512f at 0x00667000: .rsrc ALLOC LOAD DATA HAS_CONTENTS + // + // .data section, however, has virtual size of 0xA81C3C, and so + // 0x9a6000 + 0xA81C3C = 0x1427C3C, which after alignment to page size becomes + // 0x1428000, which can be seen as next section, DATASEG + // + // The data is now loaded into memory with a linker script, which proves to + // be more reliable, as mallocs that happen before we reach segment setup + // could have already taken the space we need. + + // TODO: UGLY, UGLY HACK! + //off_t file_size = 6750208; + + utf8 segmentDataPath[MAX_PATH]; + rct2_interop_get_segment_data_path(segmentDataPath, sizeof(segmentDataPath)); + fdData = open(segmentDataPath, O_RDONLY); + if (fdData < 0) + { + log_fatal("failed to load openrct2_data"); + exit(1); + } + log_warning("%p", GOOD_PLACE_FOR_DATA_SEGMENT); + segments = mmap((void *)(GOOD_PLACE_FOR_DATA_SEGMENT), len, PROT_EXEC | PROT_READ | PROT_WRITE, MAP_PRIVATE, fdData, 0); + log_warning("%p", segments); + if ((uintptr_t)segments != GOOD_PLACE_FOR_DATA_SEGMENT) { + perror("mmap"); + return false; + } +#endif // defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) + +#if defined(__unix__) && !defined(NO_RCT2) + int pageSize = getpagesize(); + int numPages = (len + pageSize - 1) / pageSize; + unsigned char *dummy = malloc(numPages); + + err = mincore((void *)segments, len, dummy); + bool pagesMissing = false; + if (err != 0) + { + err = errno; +#ifdef __LINUX__ + // On Linux ENOMEM means all requested range is unmapped + if (err != ENOMEM) + { + pagesMissing = true; + perror("mincore"); + } +#else + pagesMissing = true; + perror("mincore"); +#endif // __LINUX__ + } else { + for (int i = 0; i < numPages; i++) + { + if (dummy[i] != 1) + { + pagesMissing = true; + void *start = (void *)segments + i * pageSize; + void *end = (void *)segments + (i + 1) * pageSize - 1; + log_warning("required page %p - %p is not in memory!", start, end); + } + } + } + free(dummy); + if (pagesMissing) + { + log_error("At least one of required pages was not found in memory. This can cause segfaults later on."); + } +#if !defined(USE_MMAP) + // section: text + err = mprotect((void *)0x401000, 0x8a4000 - 0x401000, PROT_READ | PROT_EXEC | PROT_WRITE); + if (err != 0) + { + perror("mprotect"); + } +#endif // !defined(USE_MMAP) + // section: rw data + err = mprotect((void *)segments, 0x01429000 - 0x8a4000, PROT_READ | PROT_WRITE); + if (err != 0) + { + perror("mprotect"); + } +#endif // defined(__unix__) + +#if defined(USE_MMAP) && defined(__WINDOWS__) + segments = VirtualAlloc((void *)(GOOD_PLACE_FOR_DATA_SEGMENT), len, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); + if ((uintptr_t)segments != GOOD_PLACE_FOR_DATA_SEGMENT) { + log_error("VirtualAlloc, segments = %p, GetLastError = 0x%x", segments, GetLastError()); + return false; + } + + utf8 segmentDataPath[MAX_PATH]; + rct2_interop_get_segment_data_path(segmentDataPath, sizeof(segmentDataPath)); + SDL_RWops * rw = SDL_RWFromFile(segmentDataPath, "rb"); + if (rw == NULL) + { + log_error("failed to load file"); + return false; + } + if (SDL_RWread(rw, segments, len, 1) != 1) { + log_error("Unable to read chunk header!"); + return false; + } + SDL_RWclose(rw); +#endif // defined(USE_MMAP) && defined(__WINDOWS__) + +#if !defined(NO_RCT2) && defined(USE_MMAP) + // Check that the expected data is at various addresses. + // Start at 0x9a6000, which is start of .data, to skip the region containing addresses to DLL + // calls, which can be changed by windows/wine loader. + const uint32 c1 = sawyercoding_calculate_checksum((const uint8*)(segments + (uintptr_t)(0x009A6000 - 0x8a4000)), 0x009E0000 - 0x009A6000); + const uint32 c2 = sawyercoding_calculate_checksum((const uint8*)(segments + (uintptr_t)(0x01428000 - 0x8a4000)), 0x014282BC - 0x01428000); + const uint32 exp_c1 = 10114815; + const uint32 exp_c2 = 23564; + if (c1 != exp_c1 || c2 != exp_c2) { + log_warning("c1 = %u, expected %u, match %d", c1, exp_c1, c1 == exp_c1); + log_warning("c2 = %u, expected %u, match %d", c2, exp_c2, c2 == exp_c2); + return false; + } +#endif + return true; +} + +/** + * Setup hooks to allow RCT2 to call OpenRCT2 functions instead. + */ +void rct2_interop_setup_hooks() +{ + // None for now +} + +void rct2_interop_dispose() +{ +#if defined(USE_MMAP) && (defined(__unix__) || defined(__MACOSX__)) && !defined(NO_RCT2) + munmap(segments, 12079104); + close(fdData); +#endif +} diff --git a/src/rct2/interop.h b/src/rct2/interop.h new file mode 100644 index 0000000000..5f7c598cd7 --- /dev/null +++ b/src/rct2/interop.h @@ -0,0 +1,24 @@ +#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers +/***************************************************************************** + * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. + * + * OpenRCT2 is the work of many authors, a full list can be found in contributors.md + * For more information, visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * A full copy of the GNU General Public License can be found in licence.txt + *****************************************************************************/ +#pragma endregion + +#ifndef _RCT2_INTEROP_H_ +#define _RCT2_INTEROP_H_ + +bool rct2_interop_setup_segment(); +void rct2_interop_setup_hooks(); +void rct2_interop_dispose(); + +#endif diff --git a/test/testpaint/testpaint.vcxproj b/test/testpaint/testpaint.vcxproj index 047bd39467..c0191e40cf 100644 --- a/test/testpaint/testpaint.vcxproj +++ b/test/testpaint/testpaint.vcxproj @@ -17,7 +17,6 @@ {57E60BA1-FB76-4316-909E-C1449C142327} testpaint - DynamicLibrary @@ -30,18 +29,6 @@ true MultiByte - - - - - - - - - - - - $(SolutionDir)bin\testpaint\ $(SolutionDir)obj\$(ProjectName)\$(Configuration)\ From 0019827d6c281af43f3ac58e73843831171d7704 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sun, 11 Dec 2016 00:08:37 +0000 Subject: [PATCH 57/62] Refactor sprite tween logic out openrct2.c --- src/openrct2.c | 72 +++++++----------------------- src/openrct2.h | 1 - src/peep/peep.c | 4 +- src/rct2/S6Importer.cpp | 8 ++-- src/world/sprite.c | 99 ++++++++++++++++++++++++++++++++++++----- src/world/sprite.h | 6 ++- 6 files changed, 113 insertions(+), 77 deletions(-) diff --git a/src/openrct2.c b/src/openrct2.c index f18253ae99..baac5b623c 100644 --- a/src/openrct2.c +++ b/src/openrct2.c @@ -38,6 +38,8 @@ #include "version.h" #include "world/mapgen.h" +#define UPDATE_TIME_MS 25 // (1000 / 40fps) = 25ms + int gExitCode; int gOpenRCT2StartupAction = STARTUP_ACTION_TITLE; @@ -62,9 +64,6 @@ EVP_MD_CTX *gHashCTX = NULL; /** If set, will end the OpenRCT2 game loop. Intentially private to this module so that the flag can not be set back to 0. */ int _finished; -// Used for object movement tweening -static rct_xyz16 _spritelocations1[MAX_SPRITES], _spritelocations2[MAX_SPRITES]; - static void openrct2_loop(); void openrct2_write_full_version_info(utf8 *buffer, size_t bufferSize) @@ -343,20 +342,6 @@ void openrct2_dispose() platform_free(); } -/** - * Determines whether its worth tweening a sprite or not when frame smoothing is on. - */ -static bool sprite_should_tween(rct_sprite *sprite) -{ - switch (sprite->unknown.linked_list_type_offset >> 1) { - case SPRITE_LIST_VEHICLE: - case SPRITE_LIST_PEEP: - case SPRITE_LIST_UNKNOWN: - return true; - } - return false; -} - /** * Run the main game loop until the finished flag is set at 40fps (25ms interval). */ @@ -377,44 +362,33 @@ static void openrct2_loop() if (uncapTick == 0) { // Reset sprite locations uncapTick = SDL_GetTicks(); - openrct2_reset_object_tween_locations(); + sprite_position_tween_reset(); } // Limit number of updates per loop (any long pauses or debugging can make this update for a very long time) - if (currentTick - uncapTick > 25 * 60) { - uncapTick = currentTick - 25 - 1; + if (currentTick - uncapTick > UPDATE_TIME_MS * 60) { + uncapTick = currentTick - UPDATE_TIME_MS - 1; } platform_process_messages(); - while (uncapTick <= currentTick && currentTick - uncapTick > 25) { + while (uncapTick <= currentTick && currentTick - uncapTick > UPDATE_TIME_MS) { // Get the original position of each sprite - store_sprite_locations(_spritelocations1); + sprite_position_tween_store_a(); // Update the game so the sprite positions update rct2_update(); // Get the next position of each sprite - store_sprite_locations(_spritelocations2); + sprite_position_tween_store_b(); - uncapTick += 25; + uncapTick += UPDATE_TIME_MS; } // Tween the position of each sprite from the last position to the new position based on the time between the last // tick and the next tick. - float nudge = 1 - ((float)(currentTick - uncapTick) / 25); - for (uint16 i = 0; i < MAX_SPRITES; i++) { - if (!sprite_should_tween(get_sprite(i))) - continue; - - sprite_set_coordinates( - _spritelocations2[i].x + (sint16)((_spritelocations1[i].x - _spritelocations2[i].x) * nudge), - _spritelocations2[i].y + (sint16)((_spritelocations1[i].y - _spritelocations2[i].y) * nudge), - _spritelocations2[i].z + (sint16)((_spritelocations1[i].z - _spritelocations2[i].z) * nudge), - get_sprite(i) - ); - invalidate_sprite_2(get_sprite(i)); - } + float nudge = 1 - ((float)(currentTick - uncapTick) / UPDATE_TIME_MS); + sprite_position_tween_all(nudge); platform_draw(); @@ -424,21 +398,14 @@ static void openrct2_loop() secondTick = SDL_GetTicks(); } - // Restore the real positions of the sprites so they aren't left at the mid-tween positions - for (uint16 i = 0; i < MAX_SPRITES; i++) { - if (!sprite_should_tween(get_sprite(i))) - continue; - - invalidate_sprite_2(get_sprite(i)); - sprite_set_coordinates(_spritelocations2[i].x, _spritelocations2[i].y, _spritelocations2[i].z, get_sprite(i)); - } + sprite_position_tween_restore(); } else { uncapTick = 0; currentTick = SDL_GetTicks(); ticksElapsed = currentTick - lastTick; - if (ticksElapsed < 25) { - SDL_Delay(25 - ticksElapsed); - lastTick += 25; + if (ticksElapsed < UPDATE_TIME_MS) { + SDL_Delay(UPDATE_TIME_MS - ticksElapsed); + lastTick += UPDATE_TIME_MS; } else { lastTick = currentTick; } @@ -461,12 +428,3 @@ void openrct2_finish() { _finished = 1; } - -void openrct2_reset_object_tween_locations() -{ - for (uint16 i = 0; i < MAX_SPRITES; i++) { - _spritelocations1[i].x = _spritelocations2[i].x = get_sprite(i)->unknown.x; - _spritelocations1[i].y = _spritelocations2[i].y = get_sprite(i)->unknown.y; - _spritelocations1[i].z = _spritelocations2[i].z = get_sprite(i)->unknown.z; - } -} diff --git a/src/openrct2.h b/src/openrct2.h index 8da27fe06a..28d40ab2b1 100644 --- a/src/openrct2.h +++ b/src/openrct2.h @@ -60,7 +60,6 @@ bool openrct2_initialise(); void openrct2_launch(); void openrct2_dispose(); void openrct2_finish(); -void openrct2_reset_object_tween_locations(); int cmdline_run(const char **argv, int argc); diff --git a/src/peep/peep.c b/src/peep/peep.c index d43b495af7..93a7f12887 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -1978,7 +1978,7 @@ bool peep_pickup_place(rct_peep* peep, int x, int y, int z, bool apply) peep->action_sprite_image_offset = 0; peep->action_sprite_type = 0; peep->var_C4 = 0; - openrct2_reset_object_tween_locations(); + sprite_position_tween_reset(); if (peep->type == PEEP_TYPE_GUEST) { peep->action_sprite_type = 0xFF; @@ -12245,7 +12245,7 @@ void peep_update_name_sort(rct_peep *peep) finish_peep_sort: // This is required at the moment because this function reorders peeps in the sprite list - openrct2_reset_object_tween_locations(); + sprite_position_tween_reset(); } void peep_sort() diff --git a/src/rct2/S6Importer.cpp b/src/rct2/S6Importer.cpp index 5a555d6fac..58af4d7250 100644 --- a/src/rct2/S6Importer.cpp +++ b/src/rct2/S6Importer.cpp @@ -385,7 +385,7 @@ extern "C" s6Importer->LoadSavedGame(rw); s6Importer->Import(); - openrct2_reset_object_tween_locations(); + sprite_position_tween_reset(); result = true; } catch (ObjectLoadException) @@ -412,7 +412,7 @@ extern "C" s6Importer->LoadSavedGame(path); s6Importer->Import(); - openrct2_reset_object_tween_locations(); + sprite_position_tween_reset(); result = true; } catch (ObjectLoadException) @@ -452,7 +452,7 @@ extern "C" s6Importer->LoadScenario(path); s6Importer->Import(); - openrct2_reset_object_tween_locations(); + sprite_position_tween_reset(); result = true; } catch (ObjectLoadException) @@ -486,7 +486,7 @@ extern "C" s6Importer->LoadSavedGame(rw); s6Importer->Import(); - openrct2_reset_object_tween_locations(); + sprite_position_tween_reset(); result = true; } catch (ObjectLoadException) diff --git a/src/world/sprite.c b/src/world/sprite.c index ab596eaa9e..f40e65caf3 100644 --- a/src/world/sprite.c +++ b/src/world/sprite.c @@ -38,24 +38,15 @@ static rct_sprite *_spriteList = RCT2_ADDRESS(RCT2_ADDRESS_SPRITE_LIST, rct_spri uint16 gSpriteSpatialIndex[0x10001]; +static rct_xyz16 _spritelocations1[MAX_SPRITES]; +static rct_xyz16 _spritelocations2[MAX_SPRITES]; + rct_sprite *get_sprite(size_t sprite_idx) { openrct2_assert(sprite_idx < MAX_SPRITES, "Tried getting sprite %u", sprite_idx); return &_spriteList[sprite_idx]; } -void store_sprite_locations(rct_xyz16 * sprite_locations) -{ - for (uint16 i = 0; i < MAX_SPRITES; i++) { - // skip going through `get_sprite` to not get stalled on assert, - // this can get very expensive for busy parks with uncap FPS option on - const rct_sprite *sprite = &_spriteList[i]; - sprite_locations[i].x = sprite->unknown.x; - sprite_locations[i].y = sprite->unknown.y; - sprite_locations[i].z = sprite->unknown.z; - } -} - uint16 sprite_get_first_in_quadrant(int x, int y) { int offset = ((x & 0x1FE0) << 3) | (y >> 5); @@ -701,3 +692,87 @@ void litter_remove_at(int x, int y, int z) spriteIndex = nextSpriteIndex; } } + +/** + * Determines whether its worth tweening a sprite or not when frame smoothing is on. + */ +static bool sprite_should_tween(rct_sprite *sprite) +{ + switch (sprite->unknown.linked_list_type_offset >> 1) { + case SPRITE_LIST_VEHICLE: + case SPRITE_LIST_PEEP: + case SPRITE_LIST_UNKNOWN: + return true; + } + return false; +} + +static void store_sprite_locations(rct_xyz16 * sprite_locations) +{ + for (uint16 i = 0; i < MAX_SPRITES; i++) { + // skip going through `get_sprite` to not get stalled on assert, + // this can get very expensive for busy parks with uncap FPS option on + const rct_sprite *sprite = &_spriteList[i]; + sprite_locations[i].x = sprite->unknown.x; + sprite_locations[i].y = sprite->unknown.y; + sprite_locations[i].z = sprite->unknown.z; + } +} + +void sprite_position_tween_store_a() +{ + store_sprite_locations(_spritelocations1); +} + +void sprite_position_tween_store_b() +{ + store_sprite_locations(_spritelocations2); +} + +void sprite_position_tween_all(float nudge) +{ + for (uint16 i = 0; i < MAX_SPRITES; i++) { + rct_sprite * sprite = get_sprite(i); + if (sprite_should_tween(sprite)) { + rct_xyz16 posA = _spritelocations1[i]; + rct_xyz16 posB = _spritelocations2[i]; + + sprite_set_coordinates( + posB.x + (sint16)((posA.x - posB.x) * nudge), + posB.y + (sint16)((posA.y - posB.y) * nudge), + posB.z + (sint16)((posA.z - posB.z) * nudge), + sprite + ); + invalidate_sprite_2(sprite); + } + } +} + +/** + * Restore the real positions of the sprites so they aren't left at the mid-tween positions + */ +void sprite_position_tween_restore() +{ + for (uint16 i = 0; i < MAX_SPRITES; i++) { + rct_sprite * sprite = get_sprite(i); + if (sprite_should_tween(sprite)) { + invalidate_sprite_2(sprite); + + rct_xyz16 pos = _spritelocations2[i]; + sprite_set_coordinates(pos.x, pos.y, pos.z, sprite); + } + } +} + +void sprite_position_tween_reset() +{ + for (uint16 i = 0; i < MAX_SPRITES; i++) { + rct_sprite * sprite = get_sprite(i); + _spritelocations1[i].x = + _spritelocations2[i].x = sprite->unknown.x; + _spritelocations1[i].y = + _spritelocations2[i].y = sprite->unknown.y; + _spritelocations1[i].z = + _spritelocations2[i].z = sprite->unknown.z; + } +} diff --git a/src/world/sprite.h b/src/world/sprite.h index cf411c2bdb..16f8f27520 100644 --- a/src/world/sprite.h +++ b/src/world/sprite.h @@ -400,7 +400,6 @@ enum { }; rct_sprite *get_sprite(size_t sprite_idx); -void store_sprite_locations(rct_xyz16 *sprite_locations); // rct2: 0x00982708 extern rct_sprite_entry g_sprite_entries[48]; @@ -432,6 +431,11 @@ void litter_remove_at(int x, int y, int z); void sprite_misc_explosion_cloud_create(int x, int y, int z); void sprite_misc_explosion_flare_create(int x, int y, int z); uint16 sprite_get_first_in_quadrant(int x, int y); +void sprite_position_tween_store_a(); +void sprite_position_tween_store_b(); +void sprite_position_tween_all(float nudge); +void sprite_position_tween_restore(); +void sprite_position_tween_reset(); /////////////////////////////////////////////////////////////// // Balloon From cef258711939b36e4f0cbaabb3c3ed91786035b1 Mon Sep 17 00:00:00 2001 From: Ted John Date: Sun, 11 Dec 2016 12:10:35 +0000 Subject: [PATCH 58/62] Move RCT2 file copy into rct2.c --- src/openrct2.c | 71 +------------------------------------------------- src/rct2.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ src/rct2.h | 1 + 3 files changed, 71 insertions(+), 70 deletions(-) diff --git a/src/openrct2.c b/src/openrct2.c index baac5b623c..5a8cf1ac93 100644 --- a/src/openrct2.c +++ b/src/openrct2.c @@ -93,81 +93,12 @@ void openrct2_write_full_version_info(utf8 *buffer, size_t bufferSize) #endif } -static void openrct2_copy_files_over(const utf8 *originalDirectory, const utf8 *newDirectory, const utf8 *extension) -{ - utf8 *ch, filter[MAX_PATH], oldPath[MAX_PATH], newPath[MAX_PATH]; - int fileEnumHandle; - file_info fileInfo; - - if (!platform_ensure_directory_exists(newDirectory)) { - log_error("Could not create directory %s.", newDirectory); - return; - } - - // Create filter path - safe_strcpy(filter, originalDirectory, sizeof(filter)); - ch = strchr(filter, '*'); - if (ch != NULL) - *ch = 0; - safe_strcat_path(filter, "*", sizeof(filter)); - path_append_extension(filter, extension, sizeof(filter)); - - fileEnumHandle = platform_enumerate_files_begin(filter); - while (platform_enumerate_files_next(fileEnumHandle, &fileInfo)) { - safe_strcpy(newPath, newDirectory, sizeof(newPath)); - safe_strcat_path(newPath, fileInfo.path, sizeof(newPath)); - - safe_strcpy(oldPath, originalDirectory, sizeof(oldPath)); - ch = strchr(oldPath, '*'); - if (ch != NULL) - *ch = 0; - safe_strcat_path(oldPath, fileInfo.path, sizeof(oldPath)); - - if (!platform_file_exists(newPath)) - platform_file_copy(oldPath, newPath, false); - } - platform_enumerate_files_end(fileEnumHandle); - - fileEnumHandle = platform_enumerate_directories_begin(originalDirectory); - while (platform_enumerate_directories_next(fileEnumHandle, filter)) { - safe_strcpy(newPath, newDirectory, sizeof(newPath)); - safe_strcat_path(newPath, filter, sizeof(newPath)); - - safe_strcpy(oldPath, originalDirectory, MAX_PATH); - ch = strchr(oldPath, '*'); - if (ch != NULL) - *ch = 0; - safe_strcat_path(oldPath, filter, sizeof(oldPath)); - - if (!platform_ensure_directory_exists(newPath)) { - log_error("Could not create directory %s.", newPath); - return; - } - openrct2_copy_files_over(oldPath, newPath, extension); - } - platform_enumerate_directories_end(fileEnumHandle); -} - static void openrct2_set_exe_path() { platform_get_exe_path(gExePath, sizeof(gExePath)); log_verbose("Setting exe path to %s", gExePath); } -/** - * Copy saved games and landscapes to user directory - */ -static void openrct2_copy_original_user_files_over() -{ - utf8 path[MAX_PATH]; - - platform_get_user_directory(path, "save", sizeof(path)); - openrct2_copy_files_over((utf8*)gRCT2AddressSavedGamesPath, path, ".sv6"); - - platform_get_user_directory(path, "landscape", sizeof(path)); - openrct2_copy_files_over((utf8*)gRCT2AddressLandscapesPath, path, ".sc6"); -} - bool openrct2_initialise() { utf8 userPath[MAX_PATH]; @@ -251,7 +182,7 @@ bool openrct2_initialise() chat_init(); - openrct2_copy_original_user_files_over(); + rct2_copy_original_user_files_over(); return true; } diff --git a/src/rct2.c b/src/rct2.c index ea8bbb4119..afb697f26c 100644 --- a/src/rct2.c +++ b/src/rct2.c @@ -499,3 +499,72 @@ uint32 get_file_extension_type(const utf8 *path) if (strcicmp(extension, ".td6") == 0) return FILE_EXTENSION_TD6; return FILE_EXTENSION_UNKNOWN; } + +static void rct2_copy_files_over(const utf8 *originalDirectory, const utf8 *newDirectory, const utf8 *extension) +{ + utf8 *ch, filter[MAX_PATH], oldPath[MAX_PATH], newPath[MAX_PATH]; + int fileEnumHandle; + file_info fileInfo; + + if (!platform_ensure_directory_exists(newDirectory)) { + log_error("Could not create directory %s.", newDirectory); + return; + } + + // Create filter path + safe_strcpy(filter, originalDirectory, sizeof(filter)); + ch = strchr(filter, '*'); + if (ch != NULL) + *ch = 0; + safe_strcat_path(filter, "*", sizeof(filter)); + path_append_extension(filter, extension, sizeof(filter)); + + fileEnumHandle = platform_enumerate_files_begin(filter); + while (platform_enumerate_files_next(fileEnumHandle, &fileInfo)) { + safe_strcpy(newPath, newDirectory, sizeof(newPath)); + safe_strcat_path(newPath, fileInfo.path, sizeof(newPath)); + + safe_strcpy(oldPath, originalDirectory, sizeof(oldPath)); + ch = strchr(oldPath, '*'); + if (ch != NULL) + *ch = 0; + safe_strcat_path(oldPath, fileInfo.path, sizeof(oldPath)); + + if (!platform_file_exists(newPath)) + platform_file_copy(oldPath, newPath, false); + } + platform_enumerate_files_end(fileEnumHandle); + + fileEnumHandle = platform_enumerate_directories_begin(originalDirectory); + while (platform_enumerate_directories_next(fileEnumHandle, filter)) { + safe_strcpy(newPath, newDirectory, sizeof(newPath)); + safe_strcat_path(newPath, filter, sizeof(newPath)); + + safe_strcpy(oldPath, originalDirectory, MAX_PATH); + ch = strchr(oldPath, '*'); + if (ch != NULL) + *ch = 0; + safe_strcat_path(oldPath, filter, sizeof(oldPath)); + + if (!platform_ensure_directory_exists(newPath)) { + log_error("Could not create directory %s.", newPath); + return; + } + rct2_copy_files_over(oldPath, newPath, extension); + } + platform_enumerate_directories_end(fileEnumHandle); +} + +/** + * Copy saved games and landscapes to user directory + */ +void rct2_copy_original_user_files_over() +{ + utf8 path[MAX_PATH]; + + platform_get_user_directory(path, "save", sizeof(path)); + rct2_copy_files_over((utf8*)gRCT2AddressSavedGamesPath, path, ".sv6"); + + platform_get_user_directory(path, "landscape", sizeof(path)); + rct2_copy_files_over((utf8*)gRCT2AddressLandscapesPath, path, ".sc6"); +} diff --git a/src/rct2.h b/src/rct2.h index 3f450067e3..71435ff079 100644 --- a/src/rct2.h +++ b/src/rct2.h @@ -145,6 +145,7 @@ void rct2_quit(); bool rct2_open_file(const char *path); uint32 get_file_extension_type(const utf8 *path); +void rct2_copy_original_user_files_over(); #ifdef __cplusplus } From c3b054e795bc2771b543dc7748dd911a0b197d22 Mon Sep 17 00:00:00 2001 From: Hielke Morsink Date: Sun, 11 Dec 2016 14:44:09 +0100 Subject: [PATCH 59/62] Fix typo in msbuild command --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index bdb3a7595a..2f59bf040f 100644 --- a/readme.md +++ b/readme.md @@ -79,7 +79,7 @@ All libs listed here (bar cmake) required in 32 bit variants. ### Windows: 1. Check out the repository. This can be done using [GitHub Desktop](https://desktop.github.com) or [other tools](https://help.github.com/articles/which-remote-url-should-i-use). 2. Open a new Developer Command Prompt for VS2015, then navigate to the repository (e.g. `cd C:\GitHub\OpenRCT2`). -3. Run `msbuild openrct2.proj /t:build /t:platform=x64`. +3. Run `msbuild openrct2.proj /t:build /p:platform=x64`. 4. Run the game, `bin\openrct2` Once you have ran msbuild once, further development can be done within Visual Studio by opening `openrct2.sln`. From fe2085e0ed420f12d13a70d26f78982e98dc3624 Mon Sep 17 00:00:00 2001 From: Giles Wells Date: Sun, 11 Dec 2016 14:24:40 -0500 Subject: [PATCH 60/62] Fix spelling error [ci skip] --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 80cf211f68..543d092841 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,6 +39,6 @@ When coding, please also add a string constant for your strings to ```./src/loca ### Coding style / language OpenRCT2 currently does not have a strict coding style. This will be implemented after the entire game is implemented and -undergoes heavy refactoring. For now, it is recommended that you only write C files as the majority of the game is currenlty in +undergoes heavy refactoring. For now, it is recommended that you only write C files as the majority of the game is currently in C. Exceptions are to modules that have no direct relationship to original code such as the new software audio mixer, the HTTP integration and the Twitch integration. From eb87baa5d86d1340e64474bf3a591a8180763322 Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Sun, 11 Dec 2016 21:05:52 +0100 Subject: [PATCH 61/62] Update Xcode project --- OpenRCT2.xcodeproj/project.pbxproj | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenRCT2.xcodeproj/project.pbxproj b/OpenRCT2.xcodeproj/project.pbxproj index e093ee144f..d9147e6075 100644 --- a/OpenRCT2.xcodeproj/project.pbxproj +++ b/OpenRCT2.xcodeproj/project.pbxproj @@ -124,6 +124,7 @@ C650B21A1CCABBDD00B4D91C /* tables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C650B2171CCABBDD00B4D91C /* tables.cpp */; }; C650B21C1CCABC4400B4D91C /* ConvertCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C650B21B1CCABC4400B4D91C /* ConvertCommand.cpp */; }; C6575A371D46AFBA00C3E79F /* debug_paint.c in Sources */ = {isa = PBXBuildFile; fileRef = C6575A361D46AFBA00C3E79F /* debug_paint.c */; }; + C6834A111DFDE8E300CE933A /* interop.c in Sources */ = {isa = PBXBuildFile; fileRef = C6834A0F1DFDE8E300CE933A /* interop.c */; }; C686F8AC1CDBC37E009F9BFC /* banner.c in Sources */ = {isa = PBXBuildFile; fileRef = C686F8981CDBC37E009F9BFC /* banner.c */; }; C686F8AD1CDBC37E009F9BFC /* entrance.c in Sources */ = {isa = PBXBuildFile; fileRef = C686F8991CDBC37E009F9BFC /* entrance.c */; }; C686F8AE1CDBC37E009F9BFC /* fence.c in Sources */ = {isa = PBXBuildFile; fileRef = C686F89A1CDBC37E009F9BFC /* fence.c */; }; @@ -544,6 +545,8 @@ C650B2181CCABBDD00B4D91C /* Tables.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; fileEncoding = 4; path = Tables.h; sourceTree = ""; usesTabs = 0; }; C650B21B1CCABC4400B4D91C /* ConvertCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConvertCommand.cpp; sourceTree = ""; usesTabs = 0; }; C6575A361D46AFBA00C3E79F /* debug_paint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = debug_paint.c; sourceTree = ""; }; + C6834A0F1DFDE8E300CE933A /* interop.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = interop.c; sourceTree = ""; usesTabs = 1; }; + C6834A101DFDE8E300CE933A /* interop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = interop.h; sourceTree = ""; }; C686F8981CDBC37E009F9BFC /* banner.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = banner.c; sourceTree = ""; }; C686F8991CDBC37E009F9BFC /* entrance.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = entrance.c; sourceTree = ""; }; C686F89A1CDBC37E009F9BFC /* fence.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fence.c; sourceTree = ""; }; @@ -1409,6 +1412,8 @@ C6B5A7CF1CDFE4CB00C9C006 /* rct2 */ = { isa = PBXGroup; children = ( + C6834A0F1DFDE8E300CE933A /* interop.c */, + C6834A101DFDE8E300CE933A /* interop.h */, C6B5A7D01CDFE4CB00C9C006 /* S6Exporter.cpp */, C6B5A7D11CDFE4CB00C9C006 /* S6Exporter.h */, C6B5A7D21CDFE4CB00C9C006 /* S6Importer.cpp */, @@ -2842,6 +2847,7 @@ C686F90E1CDBC3B7009F9BFC /* corkscrew_roller_coaster.c in Sources */, D44272A61CC81B3200D84D28 /* scenery.c in Sources */, C686F9111CDBC3B7009F9BFC /* heartline_twister_coaster.c in Sources */, + C6834A111DFDE8E300CE933A /* interop.c in Sources */, C686F9231CDBC3B7009F9BFC /* steeplechase.c in Sources */, D44271FE1CC81B3200D84D28 /* config.c in Sources */, D44272871CC81B3200D84D28 /* staff_list.c in Sources */, From 35472fe6e28e04ff8d618ef699a90d59b2499f86 Mon Sep 17 00:00:00 2001 From: Duncan Date: Mon, 12 Dec 2016 08:33:55 +0000 Subject: [PATCH 62/62] Fix #4819. Prevent peep queue loops when next_in_queue broken. --- src/network/network.h | 2 +- src/peep/peep.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/network/network.h b/src/network/network.h index eec83f4f08..73377e6dbf 100644 --- a/src/network/network.h +++ b/src/network/network.h @@ -55,7 +55,7 @@ extern "C" { // This define specifies which version of network stream current build uses. // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "20" +#define NETWORK_STREAM_VERSION "21" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION #ifdef __cplusplus diff --git a/src/peep/peep.c b/src/peep/peep.c index 93a7f12887..d831593a13 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -4889,7 +4889,20 @@ static void peep_update_queuing(rct_peep* peep){ } if (peep->sub_state != 10){ - if (peep->next_in_queue == 0xFFFF){ + bool is_front = true; + if (peep->next_in_queue != 0xFFFF) { + // Fix #4819: Occasionally the peep->next_in_queue is incorrectly set + // to prevent this from causing the peeps to enter a loop + // first check if the next in queue is actually nearby + // if they are not then its safe to assume that this is + // the front of the queue. + rct_peep* next_peep = GET_PEEP(peep->next_in_queue); + if (abs(next_peep->x - peep->x) < 32 && + abs(next_peep->y - peep->y) < 32) { + is_front = false; + } + } + if (is_front){ //Happens every time peep goes onto ride. peep->destination_tolerence = 0; peep_decrement_num_riders(peep);