diff options
-rw-r--r-- | cmake/scripts/Baseset.cmake | 53 | ||||
-rw-r--r-- | cmake/scripts/CreateGRF.cmake | 44 | ||||
-rw-r--r-- | media/baseset/CMakeLists.txt | 87 | ||||
-rw-r--r-- | media/baseset/no_music.obm | 2 | ||||
-rw-r--r-- | media/baseset/no_sound.obs | 2 | ||||
-rw-r--r-- | media/baseset/openttd.grf (renamed from bin/baseset/openttd.grf) | bin | 510264 -> 510264 bytes | |||
-rw-r--r-- | media/baseset/openttd/2ccmap.nfo (renamed from media/extra_grf/2ccmap.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/CMakeLists.txt | 9 | ||||
-rw-r--r-- | media/baseset/openttd/airport_preview.nfo (renamed from media/extra_grf/airport_preview.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/airport_preview.png (renamed from media/extra_grf/airport_preview.png) | bin | 29520 -> 29520 bytes | |||
-rw-r--r-- | media/baseset/openttd/airports.nfo (renamed from media/extra_grf/airports.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/airports.png (renamed from media/extra_grf/airports.png) | bin | 9491 -> 9491 bytes | |||
-rw-r--r-- | media/baseset/openttd/aqueduct.nfo (renamed from media/extra_grf/aqueduct.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/aqueduct.png (renamed from media/extra_grf/aqueduct.png) | bin | 3609 -> 3609 bytes | |||
-rw-r--r-- | media/baseset/openttd/autorail.nfo (renamed from media/extra_grf/autorail.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/autorail.png (renamed from media/extra_grf/autorail.png) | bin | 5503 -> 5503 bytes | |||
-rw-r--r-- | media/baseset/openttd/canal_locks.png (renamed from media/extra_grf/canal_locks.png) | bin | 16361 -> 16361 bytes | |||
-rw-r--r-- | media/baseset/openttd/canals.nfo (renamed from media/extra_grf/canals.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/canals.png (renamed from media/extra_grf/canals.png) | bin | 6236 -> 6236 bytes | |||
-rw-r--r-- | media/baseset/openttd/chars.nfo (renamed from media/extra_grf/chars.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/chars.png (renamed from media/extra_grf/chars.png) | bin | 16993 -> 16993 bytes | |||
-rw-r--r-- | media/baseset/openttd/elrails.nfo (renamed from media/extra_grf/elrails.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/elrails.png (renamed from media/extra_grf/elrails.png) | bin | 6033 -> 6033 bytes | |||
-rw-r--r-- | media/baseset/openttd/flags.nfo (renamed from media/extra_grf/flags.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/flags.png (renamed from media/extra_grf/flags.png) | bin | 1763 -> 1763 bytes | |||
-rw-r--r-- | media/baseset/openttd/foundations.nfo (renamed from media/extra_grf/foundations.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/foundations.png (renamed from media/extra_grf/foundations.png) | bin | 54976 -> 54976 bytes | |||
-rw-r--r-- | media/baseset/openttd/mono.nfo (renamed from media/extra_grf/mono.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/mono.png (renamed from media/extra_grf/mono.png) | bin | 4856 -> 4856 bytes | |||
-rw-r--r-- | media/baseset/openttd/oneway.nfo (renamed from media/extra_grf/oneway.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/oneway.png (renamed from media/extra_grf/oneway.png) | bin | 1222 -> 1222 bytes | |||
-rw-r--r-- | media/baseset/openttd/openttd.nfo (renamed from media/extra_grf/openttd.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/openttdgui.nfo (renamed from media/extra_grf/openttdgui.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/openttdgui.png (renamed from media/extra_grf/openttdgui.png) | bin | 26393 -> 26393 bytes | |||
-rw-r--r-- | media/baseset/openttd/openttdgui_build_tram.png (renamed from media/extra_grf/openttdgui_build_tram.png) | bin | 2287 -> 2287 bytes | |||
-rw-r--r-- | media/baseset/openttd/openttdgui_convert_road.png (renamed from media/extra_grf/openttdgui_convert_road.png) | bin | 1274 -> 1274 bytes | |||
-rw-r--r-- | media/baseset/openttd/openttdgui_convert_tram.png (renamed from media/extra_grf/openttdgui_convert_tram.png) | bin | 1289 -> 1289 bytes | |||
-rw-r--r-- | media/baseset/openttd/openttdgui_group_livery.png (renamed from media/extra_grf/openttdgui_group_livery.png) | bin | 1426 -> 1426 bytes | |||
-rw-r--r-- | media/baseset/openttd/palette.nfo (renamed from media/extra_grf/palette.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/roadstops.nfo (renamed from media/extra_grf/roadstops.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/roadstops.png (renamed from media/extra_grf/roadstops.png) | bin | 2621 -> 2621 bytes | |||
-rw-r--r-- | media/baseset/openttd/signals.nfo (renamed from media/extra_grf/signals.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/signals.png (renamed from media/extra_grf/signals.png) | bin | 23747 -> 23747 bytes | |||
-rw-r--r-- | media/baseset/openttd/sloped_tracks.nfo (renamed from media/extra_grf/sloped_tracks.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/sloped_tracks.png (renamed from media/extra_grf/sloped_tracks.png) | bin | 2495 -> 2495 bytes | |||
-rw-r--r-- | media/baseset/openttd/tramtracks.nfo (renamed from media/extra_grf/tramtracks.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/tramtracks.png (renamed from media/extra_grf/tramtracks.png) | bin | 25946 -> 25946 bytes | |||
-rw-r--r-- | media/baseset/openttd/tramtracks_bare_depot.png (renamed from media/extra_grf/tramtracks_bare_depot.png) | bin | 3661 -> 3661 bytes | |||
-rw-r--r-- | media/baseset/openttd/tunnel_portals.nfo (renamed from media/extra_grf/tunnel_portals.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/openttd/tunnel_portals.png (renamed from media/extra_grf/tunnel_portals.png) | bin | 18680 -> 18680 bytes | |||
-rw-r--r-- | media/baseset/opntitle.dat (renamed from bin/baseset/opntitle.dat) | bin | 138710 -> 138710 bytes | |||
-rw-r--r-- | media/baseset/orig_dos.obg | 4 | ||||
-rw-r--r-- | media/baseset/orig_dos.obm | 2 | ||||
-rw-r--r-- | media/baseset/orig_dos.obs | 2 | ||||
-rw-r--r-- | media/baseset/orig_dos_de.obg | 4 | ||||
-rw-r--r-- | media/baseset/orig_extra.grf (renamed from bin/baseset/orig_extra.grf) | bin | 328676 -> 328676 bytes | |||
-rw-r--r-- | media/baseset/orig_extra/CMakeLists.txt | 14 | ||||
-rw-r--r-- | media/baseset/orig_extra/airports_orig_extra.nfo (renamed from media/extra_grf/airports_orig_extra.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/orig_extra/canals_extra.nfo (renamed from media/extra_grf/canals_extra.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/orig_extra/chars_orig_extra.nfo (renamed from media/extra_grf/chars_orig_extra.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/orig_extra/fix_graphics.nfo (renamed from media/extra_grf/fix_graphics.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/orig_extra/fix_graphics.png (renamed from media/extra_grf/fix_graphics.png) | bin | 78210 -> 78210 bytes | |||
-rw-r--r-- | media/baseset/orig_extra/orig_extra.nfo (renamed from media/extra_grf/orig_extra.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/orig_extra/rivers/arctic.nfo (renamed from media/extra_grf/rivers/arctic.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/orig_extra/rivers/arctic_brown.png (renamed from media/extra_grf/rivers/arctic_brown.png) | bin | 15024 -> 15024 bytes | |||
-rw-r--r-- | media/baseset/orig_extra/rivers/arctic_snowy.png (renamed from media/extra_grf/rivers/arctic_snowy.png) | bin | 13796 -> 13796 bytes | |||
-rw-r--r-- | media/baseset/orig_extra/rivers/rapids.nfo (renamed from media/extra_grf/rivers/rapids.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/orig_extra/rivers/rapids.png (renamed from media/extra_grf/rivers/rapids.png) | bin | 17651 -> 17651 bytes | |||
-rw-r--r-- | media/baseset/orig_extra/rivers/temperate.nfo (renamed from media/extra_grf/rivers/temperate.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/orig_extra/rivers/temperate.png (renamed from media/extra_grf/rivers/temperate.png) | bin | 16127 -> 16127 bytes | |||
-rw-r--r-- | media/baseset/orig_extra/rivers/toyland.nfo (renamed from media/extra_grf/rivers/toyland.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/orig_extra/rivers/toyland.png (renamed from media/extra_grf/rivers/toyland.png) | bin | 16127 -> 16127 bytes | |||
-rw-r--r-- | media/baseset/orig_extra/rivers/tropic.nfo (renamed from media/extra_grf/rivers/tropic.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/orig_extra/rivers/tropic_desert.png (renamed from media/extra_grf/rivers/tropic_desert.png) | bin | 15582 -> 15582 bytes | |||
-rw-r--r-- | media/baseset/orig_extra/rivers/tropic_forest.png (renamed from media/extra_grf/rivers/tropic_forest.png) | bin | 15157 -> 15157 bytes | |||
-rw-r--r-- | media/baseset/orig_extra/shore.nfo (renamed from media/extra_grf/shore.nfo) | 0 | ||||
-rw-r--r-- | media/baseset/orig_extra/shore.png (renamed from media/extra_grf/shore.png) | bin | 21568 -> 21568 bytes | |||
-rw-r--r-- | media/baseset/orig_tto.obm | 2 | ||||
-rw-r--r-- | media/baseset/orig_win.obg | 4 | ||||
-rw-r--r-- | media/baseset/orig_win.obm | 2 | ||||
-rw-r--r-- | media/baseset/orig_win.obs | 2 | ||||
-rw-r--r-- | media/baseset/translations.awk | 67 | ||||
-rw-r--r-- | media/baseset/translations.vbs | 145 | ||||
-rw-r--r-- | media/extra_grf/assemble_nfo.awk | 30 |
84 files changed, 220 insertions, 255 deletions
diff --git a/cmake/scripts/Baseset.cmake b/cmake/scripts/Baseset.cmake new file mode 100644 index 000000000..4329dbdf8 --- /dev/null +++ b/cmake/scripts/Baseset.cmake @@ -0,0 +1,53 @@ +cmake_minimum_required(VERSION 3.5) + +# +# Create a single baseset meta file with the correct translations. +# + +set(ARGC 1) +set(ARG_READ NO) + +# Read all the arguments given to CMake; we are looking for -- and everything +# that follows. Those are our language files. +while(ARGC LESS CMAKE_ARGC) + set(ARG ${CMAKE_ARGV${ARGC}}) + + if (ARG_READ) + list(APPEND LANG_SOURCE_FILES "${ARG}") + endif (ARG_READ) + + if (ARG STREQUAL "--") + set(ARG_READ YES) + endif (ARG STREQUAL "--") + + math(EXPR ARGC "${ARGC} + 1") +endwhile() + +# Place holder format is @<ini_key>_<str_id>@ +file(STRINGS "${BASESET_SOURCE_FILE}" PLACE_HOLDER REGEX "^@") +string(REGEX REPLACE "@([^_]+).*@" "\\1" INI_KEY "${PLACE_HOLDER}") +string(REGEX REPLACE "@[^_]+_(.*)@" "\\1" STR_ID "${PLACE_HOLDER}") +string(REGEX REPLACE "@(.*)@" "\\1" PLACE_HOLDER "${PLACE_HOLDER}") + +# Get the translations +foreach(LANGFILE IN LISTS LANG_SOURCE_FILES) + file(STRINGS "${LANGFILE}" LANGLINES REGEX "^(##isocode|${STR_ID})" ENCODING UTF-8) + string(FIND "${LANGLINES}" "${STR_ID}" HAS_STR_ID) + if (HAS_STR_ID LESS 0) + continue() + endif (HAS_STR_ID LESS 0) + string(REGEX REPLACE "##isocode ([^;]+).*" "\\1" ISOCODE "${LANGLINES}") + if ("${ISOCODE}" STREQUAL "en_GB") + string(REGEX REPLACE "[^:]*:(.*)" "${INI_KEY} = \\1" LANGLINES "${LANGLINES}") + else() + string(REGEX REPLACE "[^:]*:(.*)" "${INI_KEY}.${ISOCODE} = \\1" LANGLINES "${LANGLINES}") + endif() + list(APPEND ${PLACE_HOLDER} ${LANGLINES}) +endforeach(LANGFILE) +list(SORT ${PLACE_HOLDER}) +string(REPLACE ";" "\n" ${PLACE_HOLDER} "${${PLACE_HOLDER}}") + +# Get the grf md5 +file(MD5 ${BASESET_EXTRAGRF_FILE} ORIG_EXTRA_GRF_MD5) + +configure_file(${BASESET_SOURCE_FILE} ${BASESET_BINARY_FILE}) diff --git a/cmake/scripts/CreateGRF.cmake b/cmake/scripts/CreateGRF.cmake new file mode 100644 index 000000000..f5811daf9 --- /dev/null +++ b/cmake/scripts/CreateGRF.cmake @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.5) + +# +# Create a single GRF file based on sprites/<grfname>.nfo and sprites/*.png +# files. +# + +if (NOT NFORENUM_EXECUTABLE) + message(FATAL_ERROR "Script needs NFORENUM_EXECUTABLE defined") +endif (NOT NFORENUM_EXECUTABLE) +if (NOT GRFCODEC_EXECUTABLE) + message(FATAL_ERROR "Script needs GRFCODEC_EXECUTABLE defined") +endif (NOT GRFCODEC_EXECUTABLE) +if (NOT GRF_SOURCE_FOLDER) + message(FATAL_ERROR "Script needs GRF_SOURCE_FOLDER defined") +endif (NOT GRF_SOURCE_FOLDER) +if (NOT GRF_BINARY_FILE) + message(FATAL_ERROR "Script needs GRF_BINARY_FILE defined") +endif (NOT GRF_BINARY_FILE) + +get_filename_component(GRF_SOURCE_FOLDER_NAME "${GRF_SOURCE_FOLDER}" NAME) + +file(WRITE sprites/${GRF_SOURCE_FOLDER_NAME}.nfo "") +file(READ ${GRF_SOURCE_FOLDER}/${GRF_SOURCE_FOLDER_NAME}.nfo NFO_LINES) +# Replace ; with \;, and make a list out of this based on \n +string(REPLACE ";" "\\;" NFO_LINES "${NFO_LINES}") +string(REPLACE "\n" ";" NFO_LINES "${NFO_LINES}") + +foreach(NFO_LINE IN LISTS NFO_LINES) + # Recover the ; that was really in the text (and not a newline) + string(REPLACE "\\;" ";" NFO_LINE "${NFO_LINE}") + + if (NFO_LINE MATCHES "^#include") + string(REGEX REPLACE "^#include \"(.*)\"$" "\\1" INCLUDE_FILE ${NFO_LINE}) + file(READ ${GRF_SOURCE_FOLDER}/${INCLUDE_FILE} INCLUDE_LINES) + file(APPEND sprites/${GRF_SOURCE_FOLDER_NAME}.nfo "${INCLUDE_LINES}") + else (NFO_LINE MATCHES "^#include") + file(APPEND sprites/${GRF_SOURCE_FOLDER_NAME}.nfo "${NFO_LINE}\n") + endif (NFO_LINE MATCHES "^#include") +endforeach(NFO_LINE) + +execute_process(COMMAND ${NFORENUM_EXECUTABLE} -s sprites/${GRF_SOURCE_FOLDER_NAME}.nfo) +execute_process(COMMAND ${GRFCODEC_EXECUTABLE} -n -s -e -p1 ${GRF_SOURCE_FOLDER_NAME}.grf) +execute_process(COMMAND ${CMAKE_COMMAND} -E copy ${GRF_SOURCE_FOLDER_NAME}.grf ${GRF_BINARY_FILE}) diff --git a/media/baseset/CMakeLists.txt b/media/baseset/CMakeLists.txt new file mode 100644 index 000000000..309ac7a49 --- /dev/null +++ b/media/baseset/CMakeLists.txt @@ -0,0 +1,87 @@ +add_subdirectory(openttd) +add_subdirectory(orig_extra) + +set(BASESET_SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/orig_dos.obg + ${CMAKE_CURRENT_SOURCE_DIR}/orig_dos_de.obg + ${CMAKE_CURRENT_SOURCE_DIR}/orig_win.obg + ${CMAKE_CURRENT_SOURCE_DIR}/no_music.obm + ${CMAKE_CURRENT_SOURCE_DIR}/orig_dos.obm + ${CMAKE_CURRENT_SOURCE_DIR}/orig_tto.obm + ${CMAKE_CURRENT_SOURCE_DIR}/orig_win.obm + ${CMAKE_CURRENT_SOURCE_DIR}/no_sound.obs + ${CMAKE_CURRENT_SOURCE_DIR}/orig_dos.obs + ${CMAKE_CURRENT_SOURCE_DIR}/orig_win.obs +) +set(BASESET_OTHER_SOURCE_FILES + ${CMAKE_CURRENT_SOURCE_DIR}/openttd.grf + ${CMAKE_CURRENT_SOURCE_DIR}/opntitle.dat + ${CMAKE_CURRENT_SOURCE_DIR}/orig_extra.grf +) + +# Done by the subdirectories, if nforenum / grfcodec is installed +if (NFORENUM_FOUND AND GRFCODEC_FOUND) + set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/openttd.grf PROPERTIES GENERATED TRUE) + set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/orig_extra.grf PROPERTIES GENERATED TRUE) + + list(APPEND BASESET_BINARY_FILES openttd.grf) + list(APPEND BASESET_BINARY_FILES orig_extra.grf) +endif (NFORENUM_FOUND AND GRFCODEC_FOUND) + +set(BASESET_EXTRAGRF_FILE ${CMAKE_CURRENT_SOURCE_DIR}/orig_extra.grf) + +# Walk over all the baseset files, and generate a command to configure them +foreach(BASESET_SOURCE_FILE IN LISTS BASESET_SOURCE_FILES) + get_filename_component(BASESET_SOURCE_FILE_NAME "${BASESET_SOURCE_FILE}" NAME) + set(BASESET_BINARY_FILE "${CMAKE_BINARY_DIR}/baseset/${BASESET_SOURCE_FILE_NAME}") + + get_target_property(LANG_SOURCE_FILES language_files LANG_SOURCE_FILES) + + add_custom_command_timestamp(OUTPUT ${BASESET_BINARY_FILE} + COMMAND ${CMAKE_COMMAND} + -DBASESET_SOURCE_FILE=${BASESET_SOURCE_FILE} + -DBASESET_BINARY_FILE=${BASESET_BINARY_FILE} + -DBASESET_EXTRAGRF_FILE=${BASESET_EXTRAGRF_FILE} + -P ${CMAKE_SOURCE_DIR}/cmake/scripts/Baseset.cmake + -- + ${LANG_SOURCE_FILES} + MAIN_DEPENDENCY ${BASESET_SOURCE_FILE} + DEPENDS ${LANG_SOURCE_FILES} + ${BASESET_EXTRAGRF_FILE} + ${CMAKE_SOURCE_DIR}/cmake/scripts/Baseset.cmake + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating ${BASESET_SOURCE_FILE_NAME} baseset metadata file" + ) + + list(APPEND BASESET_BINARY_FILES ${BASESET_BINARY_FILE}) +endforeach(BASESET_SOURCE_FILE) + +# Walk over all the other baseset files, and generate a command to copy them +foreach(BASESET_OTHER_SOURCE_FILE IN LISTS BASESET_OTHER_SOURCE_FILES) + get_filename_component(BASESET_OTHER_SOURCE_FILE_NAME "${BASESET_OTHER_SOURCE_FILE}" NAME) + set(BASESET_OTHER_BINARY_FILE "${CMAKE_BINARY_DIR}/baseset/${BASESET_OTHER_SOURCE_FILE_NAME}") + + add_custom_command(OUTPUT ${BASESET_OTHER_BINARY_FILE} + COMMAND ${CMAKE_COMMAND} -E copy + ${BASESET_OTHER_SOURCE_FILE} + ${BASESET_OTHER_BINARY_FILE} + MAIN_DEPENDENCY ${BASESET_OTHER_SOURCE_FILE} + COMMENT "Copying ${BASESET_OTHER_SOURCE_FILE_NAME} baseset file" + ) + + list(APPEND BASESET_BINARY_FILES ${BASESET_OTHER_BINARY_FILE}) +endforeach(BASESET_OTHER_SOURCE_FILE) + +# Create a new target which generates all baseset metadata files +add_custom_target_timestamp(baseset_files + DEPENDS + ${BASESET_BINARY_FILES} +) + +add_library(basesets + INTERFACE +) +add_dependencies(basesets + baseset_files +) +add_library(openttd::basesets ALIAS basesets) diff --git a/media/baseset/no_music.obm b/media/baseset/no_music.obm index e395ba0b0..3b8b9657a 100644 --- a/media/baseset/no_music.obm +++ b/media/baseset/no_music.obm @@ -5,7 +5,7 @@ name = NoMusic shortname = NULL version = 0 fallback = true -!! description STR_BASEMUSIC_NONE_DESCRIPTION +@description_STR_BASEMUSIC_NONE_DESCRIPTION@ [files] theme = diff --git a/media/baseset/no_sound.obs b/media/baseset/no_sound.obs index fd2430de5..3b546d5bb 100644 --- a/media/baseset/no_sound.obs +++ b/media/baseset/no_sound.obs @@ -5,7 +5,7 @@ name = NoSound shortname = NULL version = 2 fallback = true -!! description STR_BASESOUNDS_NONE_DESCRIPTION +@description_STR_BASESOUNDS_NONE_DESCRIPTION@ [files] samples = diff --git a/bin/baseset/openttd.grf b/media/baseset/openttd.grf Binary files differindex 550863ff9..550863ff9 100644 --- a/bin/baseset/openttd.grf +++ b/media/baseset/openttd.grf diff --git a/media/extra_grf/2ccmap.nfo b/media/baseset/openttd/2ccmap.nfo index 39f3fe494..39f3fe494 100644 --- a/media/extra_grf/2ccmap.nfo +++ b/media/baseset/openttd/2ccmap.nfo diff --git a/media/baseset/openttd/CMakeLists.txt b/media/baseset/openttd/CMakeLists.txt new file mode 100644 index 000000000..42d62dd7c --- /dev/null +++ b/media/baseset/openttd/CMakeLists.txt @@ -0,0 +1,9 @@ +# In case both NFORenum and GRFCodec are found, generate the GRF. +# Otherwise, just use them from the cache (read: git). +# This is mainly because not many people have both of these tools installed, +# so it is cheaper to cache them in git, and only regenerate when you are +# working on it / have the tools installed. +if (NFORENUM_FOUND AND GRFCODEC_FOUND) + include(CreateGrfCommand REQUIRED) + create_grf_command() +endif (NFORENUM_FOUND AND GRFCODEC_FOUND) diff --git a/media/extra_grf/airport_preview.nfo b/media/baseset/openttd/airport_preview.nfo index 6efac6e91..6efac6e91 100644 --- a/media/extra_grf/airport_preview.nfo +++ b/media/baseset/openttd/airport_preview.nfo diff --git a/media/extra_grf/airport_preview.png b/media/baseset/openttd/airport_preview.png Binary files differindex cfa41f2c7..cfa41f2c7 100644 --- a/media/extra_grf/airport_preview.png +++ b/media/baseset/openttd/airport_preview.png diff --git a/media/extra_grf/airports.nfo b/media/baseset/openttd/airports.nfo index fc03f1d7f..fc03f1d7f 100644 --- a/media/extra_grf/airports.nfo +++ b/media/baseset/openttd/airports.nfo diff --git a/media/extra_grf/airports.png b/media/baseset/openttd/airports.png Binary files differindex 5fb9618bc..5fb9618bc 100644 --- a/media/extra_grf/airports.png +++ b/media/baseset/openttd/airports.png diff --git a/media/extra_grf/aqueduct.nfo b/media/baseset/openttd/aqueduct.nfo index 3f9bb97f3..3f9bb97f3 100644 --- a/media/extra_grf/aqueduct.nfo +++ b/media/baseset/openttd/aqueduct.nfo diff --git a/media/extra_grf/aqueduct.png b/media/baseset/openttd/aqueduct.png Binary files differindex 6d55f0aa4..6d55f0aa4 100644 --- a/media/extra_grf/aqueduct.png +++ b/media/baseset/openttd/aqueduct.png diff --git a/media/extra_grf/autorail.nfo b/media/baseset/openttd/autorail.nfo index 9633064c8..9633064c8 100644 --- a/media/extra_grf/autorail.nfo +++ b/media/baseset/openttd/autorail.nfo diff --git a/media/extra_grf/autorail.png b/media/baseset/openttd/autorail.png Binary files differindex 5c21d3602..5c21d3602 100644 --- a/media/extra_grf/autorail.png +++ b/media/baseset/openttd/autorail.png diff --git a/media/extra_grf/canal_locks.png b/media/baseset/openttd/canal_locks.png Binary files differindex f156402eb..f156402eb 100644 --- a/media/extra_grf/canal_locks.png +++ b/media/baseset/openttd/canal_locks.png diff --git a/media/extra_grf/canals.nfo b/media/baseset/openttd/canals.nfo index 7bf8e5ae4..7bf8e5ae4 100644 --- a/media/extra_grf/canals.nfo +++ b/media/baseset/openttd/canals.nfo diff --git a/media/extra_grf/canals.png b/media/baseset/openttd/canals.png Binary files differindex f9f6da6f9..f9f6da6f9 100644 --- a/media/extra_grf/canals.png +++ b/media/baseset/openttd/canals.png diff --git a/media/extra_grf/chars.nfo b/media/baseset/openttd/chars.nfo index 8d1acb814..8d1acb814 100644 --- a/media/extra_grf/chars.nfo +++ b/media/baseset/openttd/chars.nfo diff --git a/media/extra_grf/chars.png b/media/baseset/openttd/chars.png Binary files differindex 34a4a67c5..34a4a67c5 100644 --- a/media/extra_grf/chars.png +++ b/media/baseset/openttd/chars.png diff --git a/media/extra_grf/elrails.nfo b/media/baseset/openttd/elrails.nfo index 93456ecb3..93456ecb3 100644 --- a/media/extra_grf/elrails.nfo +++ b/media/baseset/openttd/elrails.nfo diff --git a/media/extra_grf/elrails.png b/media/baseset/openttd/elrails.png Binary files differindex a5166da2c..a5166da2c 100644 --- a/media/extra_grf/elrails.png +++ b/media/baseset/openttd/elrails.png diff --git a/media/extra_grf/flags.nfo b/media/baseset/openttd/flags.nfo index 3c125ec79..3c125ec79 100644 --- a/media/extra_grf/flags.nfo +++ b/media/baseset/openttd/flags.nfo diff --git a/media/extra_grf/flags.png b/media/baseset/openttd/flags.png Binary files differindex 2e0401ffc..2e0401ffc 100644 --- a/media/extra_grf/flags.png +++ b/media/baseset/openttd/flags.png diff --git a/media/extra_grf/foundations.nfo b/media/baseset/openttd/foundations.nfo index 7cb4e5e40..7cb4e5e40 100644 --- a/media/extra_grf/foundations.nfo +++ b/media/baseset/openttd/foundations.nfo diff --git a/media/extra_grf/foundations.png b/media/baseset/openttd/foundations.png Binary files differindex c05b80e91..c05b80e91 100644 --- a/media/extra_grf/foundations.png +++ b/media/baseset/openttd/foundations.png diff --git a/media/extra_grf/mono.nfo b/media/baseset/openttd/mono.nfo index f855e8f0e..f855e8f0e 100644 --- a/media/extra_grf/mono.nfo +++ b/media/baseset/openttd/mono.nfo diff --git a/media/extra_grf/mono.png b/media/baseset/openttd/mono.png Binary files differindex fb52e1e75..fb52e1e75 100644 --- a/media/extra_grf/mono.png +++ b/media/baseset/openttd/mono.png diff --git a/media/extra_grf/oneway.nfo b/media/baseset/openttd/oneway.nfo index 46f3b8f94..46f3b8f94 100644 --- a/media/extra_grf/oneway.nfo +++ b/media/baseset/openttd/oneway.nfo diff --git a/media/extra_grf/oneway.png b/media/baseset/openttd/oneway.png Binary files differindex 15542af85..15542af85 100644 --- a/media/extra_grf/oneway.png +++ b/media/baseset/openttd/oneway.png diff --git a/media/extra_grf/openttd.nfo b/media/baseset/openttd/openttd.nfo index b0d80824e..b0d80824e 100644 --- a/media/extra_grf/openttd.nfo +++ b/media/baseset/openttd/openttd.nfo diff --git a/media/extra_grf/openttdgui.nfo b/media/baseset/openttd/openttdgui.nfo index b458073be..b458073be 100644 --- a/media/extra_grf/openttdgui.nfo +++ b/media/baseset/openttd/openttdgui.nfo diff --git a/media/extra_grf/openttdgui.png b/media/baseset/openttd/openttdgui.png Binary files differindex 900a612a8..900a612a8 100644 --- a/media/extra_grf/openttdgui.png +++ b/media/baseset/openttd/openttdgui.png diff --git a/media/extra_grf/openttdgui_build_tram.png b/media/baseset/openttd/openttdgui_build_tram.png Binary files differindex bc1133ac2..bc1133ac2 100644 --- a/media/extra_grf/openttdgui_build_tram.png +++ b/media/baseset/openttd/openttdgui_build_tram.png diff --git a/media/extra_grf/openttdgui_convert_road.png b/media/baseset/openttd/openttdgui_convert_road.png Binary files differindex 9218e7705..9218e7705 100644 --- a/media/extra_grf/openttdgui_convert_road.png +++ b/media/baseset/openttd/openttdgui_convert_road.png diff --git a/media/extra_grf/openttdgui_convert_tram.png b/media/baseset/openttd/openttdgui_convert_tram.png Binary files differindex d4a43e7cb..d4a43e7cb 100644 --- a/media/extra_grf/openttdgui_convert_tram.png +++ b/media/baseset/openttd/openttdgui_convert_tram.png diff --git a/media/extra_grf/openttdgui_group_livery.png b/media/baseset/openttd/openttdgui_group_livery.png Binary files differindex f45be670c..f45be670c 100644 --- a/media/extra_grf/openttdgui_group_livery.png +++ b/media/baseset/openttd/openttdgui_group_livery.png diff --git a/media/extra_grf/palette.nfo b/media/baseset/openttd/palette.nfo index 2a5b8400f..2a5b8400f 100644 --- a/media/extra_grf/palette.nfo +++ b/media/baseset/openttd/palette.nfo diff --git a/media/extra_grf/roadstops.nfo b/media/baseset/openttd/roadstops.nfo index 15ede7027..15ede7027 100644 --- a/media/extra_grf/roadstops.nfo +++ b/media/baseset/openttd/roadstops.nfo diff --git a/media/extra_grf/roadstops.png b/media/baseset/openttd/roadstops.png Binary files differindex 598792417..598792417 100644 --- a/media/extra_grf/roadstops.png +++ b/media/baseset/openttd/roadstops.png diff --git a/media/extra_grf/signals.nfo b/media/baseset/openttd/signals.nfo index 8e612ae66..8e612ae66 100644 --- a/media/extra_grf/signals.nfo +++ b/media/baseset/openttd/signals.nfo diff --git a/media/extra_grf/signals.png b/media/baseset/openttd/signals.png Binary files differindex 6e0562a39..6e0562a39 100644 --- a/media/extra_grf/signals.png +++ b/media/baseset/openttd/signals.png diff --git a/media/extra_grf/sloped_tracks.nfo b/media/baseset/openttd/sloped_tracks.nfo index 42c257d31..42c257d31 100644 --- a/media/extra_grf/sloped_tracks.nfo +++ b/media/baseset/openttd/sloped_tracks.nfo diff --git a/media/extra_grf/sloped_tracks.png b/media/baseset/openttd/sloped_tracks.png Binary files differindex 16ace38c5..16ace38c5 100644 --- a/media/extra_grf/sloped_tracks.png +++ b/media/baseset/openttd/sloped_tracks.png diff --git a/media/extra_grf/tramtracks.nfo b/media/baseset/openttd/tramtracks.nfo index f9a190bd7..f9a190bd7 100644 --- a/media/extra_grf/tramtracks.nfo +++ b/media/baseset/openttd/tramtracks.nfo diff --git a/media/extra_grf/tramtracks.png b/media/baseset/openttd/tramtracks.png Binary files differindex 5e21455bc..5e21455bc 100644 --- a/media/extra_grf/tramtracks.png +++ b/media/baseset/openttd/tramtracks.png diff --git a/media/extra_grf/tramtracks_bare_depot.png b/media/baseset/openttd/tramtracks_bare_depot.png Binary files differindex d45bcff41..d45bcff41 100644 --- a/media/extra_grf/tramtracks_bare_depot.png +++ b/media/baseset/openttd/tramtracks_bare_depot.png diff --git a/media/extra_grf/tunnel_portals.nfo b/media/baseset/openttd/tunnel_portals.nfo index ce09308ef..ce09308ef 100644 --- a/media/extra_grf/tunnel_portals.nfo +++ b/media/baseset/openttd/tunnel_portals.nfo diff --git a/media/extra_grf/tunnel_portals.png b/media/baseset/openttd/tunnel_portals.png Binary files differindex 00abd9c7f..00abd9c7f 100644 --- a/media/extra_grf/tunnel_portals.png +++ b/media/baseset/openttd/tunnel_portals.png diff --git a/bin/baseset/opntitle.dat b/media/baseset/opntitle.dat Binary files differindex 264aaff60..264aaff60 100644 --- a/bin/baseset/opntitle.dat +++ b/media/baseset/opntitle.dat diff --git a/media/baseset/orig_dos.obg b/media/baseset/orig_dos.obg index d56a63712..ebb27ee7b 100644 --- a/media/baseset/orig_dos.obg +++ b/media/baseset/orig_dos.obg @@ -6,7 +6,7 @@ name = original_dos shortname = TTDD version = 1 palette = DOS -!! description STR_BASEGRAPHICS_DOS_DESCRIPTION +@description_STR_BASEGRAPHICS_DOS_DESCRIPTION@ [files] base = TRG1.GRF @@ -22,7 +22,7 @@ TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8 TRGC.GRF = ed446637e034104c5559b32c18afe78d TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9 TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6 -ORIG_EXTRA.GRF = +ORIG_EXTRA.GRF = ${ORIG_EXTRA_GRF_MD5} [origin] default = You can find it on your Transport Tycoon Deluxe CD-ROM. diff --git a/media/baseset/orig_dos.obm b/media/baseset/orig_dos.obm index 0b51c2db8..49c0f6770 100644 --- a/media/baseset/orig_dos.obm +++ b/media/baseset/orig_dos.obm @@ -5,7 +5,7 @@ name = original_dos shortname = TTDD version = 1 -!! description STR_BASEMUSIC_DOS_DESCRIPTION +@description_STR_BASEMUSIC_DOS_DESCRIPTION@ [files] theme = gm.cat diff --git a/media/baseset/orig_dos.obs b/media/baseset/orig_dos.obs index 60afc854f..c500fe0e4 100644 --- a/media/baseset/orig_dos.obs +++ b/media/baseset/orig_dos.obs @@ -5,7 +5,7 @@ name = original_dos shortname = TTDO version = 0 -!! description STR_BASESOUNDS_DOS_DESCRIPTION +@description_STR_BASESOUNDS_DOS_DESCRIPTION@ [files] samples = SAMPLE.CAT diff --git a/media/baseset/orig_dos_de.obg b/media/baseset/orig_dos_de.obg index 388d68502..b8251ab7b 100644 --- a/media/baseset/orig_dos_de.obg +++ b/media/baseset/orig_dos_de.obg @@ -6,7 +6,7 @@ name = original_dos_de shortname = TTDD version = 0 palette = DOS -!! description STR_BASEGRAPHICS_DOS_DE_DESCRIPTION +@description_STR_BASEGRAPHICS_DOS_DE_DESCRIPTION@ [files] base = TRG1.GRF @@ -22,7 +22,7 @@ TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8 TRGC.GRF = ed446637e034104c5559b32c18afe78d TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9 TRGT.GRF = fcde1d7e8a74197d72a62695884b909e -ORIG_EXTRA.GRF = +ORIG_EXTRA.GRF = ${ORIG_EXTRA_GRF_MD5} [origin] default = You can find it on your Transport Tycoon Deluxe CD-ROM. diff --git a/bin/baseset/orig_extra.grf b/media/baseset/orig_extra.grf Binary files differindex 728a8b255..728a8b255 100644 --- a/bin/baseset/orig_extra.grf +++ b/media/baseset/orig_extra.grf diff --git a/media/baseset/orig_extra/CMakeLists.txt b/media/baseset/orig_extra/CMakeLists.txt new file mode 100644 index 000000000..f865a8dd0 --- /dev/null +++ b/media/baseset/orig_extra/CMakeLists.txt @@ -0,0 +1,14 @@ +# In case both NFORenum and GRFCodec are found, generate the GRF. +# Otherwise, just use them from the cache (read: git). +# This is mainly because not many people have both of these tools installed, +# so it is cheaper to cache them in git, and only regenerate when you are +# working on it / have the tools installed. +if (NFORENUM_FOUND AND GRFCODEC_FOUND) + include(CreateGrfCommand REQUIRED) + create_grf_command( + # We share some files with 'openttd' grf + ${CMAKE_CURRENT_SOURCE_DIR}/../openttd/airports.png + ${CMAKE_CURRENT_SOURCE_DIR}/../openttd/canals.png + ${CMAKE_CURRENT_SOURCE_DIR}/../openttd/chars.png + ) +endif (NFORENUM_FOUND AND GRFCODEC_FOUND) diff --git a/media/extra_grf/airports_orig_extra.nfo b/media/baseset/orig_extra/airports_orig_extra.nfo index 2d649fbd1..2d649fbd1 100644 --- a/media/extra_grf/airports_orig_extra.nfo +++ b/media/baseset/orig_extra/airports_orig_extra.nfo diff --git a/media/extra_grf/canals_extra.nfo b/media/baseset/orig_extra/canals_extra.nfo index e412e2da4..e412e2da4 100644 --- a/media/extra_grf/canals_extra.nfo +++ b/media/baseset/orig_extra/canals_extra.nfo diff --git a/media/extra_grf/chars_orig_extra.nfo b/media/baseset/orig_extra/chars_orig_extra.nfo index c5e3efe26..c5e3efe26 100644 --- a/media/extra_grf/chars_orig_extra.nfo +++ b/media/baseset/orig_extra/chars_orig_extra.nfo diff --git a/media/extra_grf/fix_graphics.nfo b/media/baseset/orig_extra/fix_graphics.nfo index aaad79c0a..aaad79c0a 100644 --- a/media/extra_grf/fix_graphics.nfo +++ b/media/baseset/orig_extra/fix_graphics.nfo diff --git a/media/extra_grf/fix_graphics.png b/media/baseset/orig_extra/fix_graphics.png Binary files differindex 1dc7bad82..1dc7bad82 100644 --- a/media/extra_grf/fix_graphics.png +++ b/media/baseset/orig_extra/fix_graphics.png diff --git a/media/extra_grf/orig_extra.nfo b/media/baseset/orig_extra/orig_extra.nfo index 903d96a57..903d96a57 100644 --- a/media/extra_grf/orig_extra.nfo +++ b/media/baseset/orig_extra/orig_extra.nfo diff --git a/media/extra_grf/rivers/arctic.nfo b/media/baseset/orig_extra/rivers/arctic.nfo index 375946fa5..375946fa5 100644 --- a/media/extra_grf/rivers/arctic.nfo +++ b/media/baseset/orig_extra/rivers/arctic.nfo diff --git a/media/extra_grf/rivers/arctic_brown.png b/media/baseset/orig_extra/rivers/arctic_brown.png Binary files differindex c2a6c94b4..c2a6c94b4 100644 --- a/media/extra_grf/rivers/arctic_brown.png +++ b/media/baseset/orig_extra/rivers/arctic_brown.png diff --git a/media/extra_grf/rivers/arctic_snowy.png b/media/baseset/orig_extra/rivers/arctic_snowy.png Binary files differindex 5e44e7688..5e44e7688 100644 --- a/media/extra_grf/rivers/arctic_snowy.png +++ b/media/baseset/orig_extra/rivers/arctic_snowy.png diff --git a/media/extra_grf/rivers/rapids.nfo b/media/baseset/orig_extra/rivers/rapids.nfo index e03d96ca1..e03d96ca1 100644 --- a/media/extra_grf/rivers/rapids.nfo +++ b/media/baseset/orig_extra/rivers/rapids.nfo diff --git a/media/extra_grf/rivers/rapids.png b/media/baseset/orig_extra/rivers/rapids.png Binary files differindex db25ae0e3..db25ae0e3 100644 --- a/media/extra_grf/rivers/rapids.png +++ b/media/baseset/orig_extra/rivers/rapids.png diff --git a/media/extra_grf/rivers/temperate.nfo b/media/baseset/orig_extra/rivers/temperate.nfo index 261f727be..261f727be 100644 --- a/media/extra_grf/rivers/temperate.nfo +++ b/media/baseset/orig_extra/rivers/temperate.nfo diff --git a/media/extra_grf/rivers/temperate.png b/media/baseset/orig_extra/rivers/temperate.png Binary files differindex 61ff22430..61ff22430 100644 --- a/media/extra_grf/rivers/temperate.png +++ b/media/baseset/orig_extra/rivers/temperate.png diff --git a/media/extra_grf/rivers/toyland.nfo b/media/baseset/orig_extra/rivers/toyland.nfo index 8b6dedd38..8b6dedd38 100644 --- a/media/extra_grf/rivers/toyland.nfo +++ b/media/baseset/orig_extra/rivers/toyland.nfo diff --git a/media/extra_grf/rivers/toyland.png b/media/baseset/orig_extra/rivers/toyland.png Binary files differindex 61ff22430..61ff22430 100644 --- a/media/extra_grf/rivers/toyland.png +++ b/media/baseset/orig_extra/rivers/toyland.png diff --git a/media/extra_grf/rivers/tropic.nfo b/media/baseset/orig_extra/rivers/tropic.nfo index 1041bff54..1041bff54 100644 --- a/media/extra_grf/rivers/tropic.nfo +++ b/media/baseset/orig_extra/rivers/tropic.nfo diff --git a/media/extra_grf/rivers/tropic_desert.png b/media/baseset/orig_extra/rivers/tropic_desert.png Binary files differindex 868468637..868468637 100644 --- a/media/extra_grf/rivers/tropic_desert.png +++ b/media/baseset/orig_extra/rivers/tropic_desert.png diff --git a/media/extra_grf/rivers/tropic_forest.png b/media/baseset/orig_extra/rivers/tropic_forest.png Binary files differindex 1aa21e479..1aa21e479 100644 --- a/media/extra_grf/rivers/tropic_forest.png +++ b/media/baseset/orig_extra/rivers/tropic_forest.png diff --git a/media/extra_grf/shore.nfo b/media/baseset/orig_extra/shore.nfo index 6dccb8487..6dccb8487 100644 --- a/media/extra_grf/shore.nfo +++ b/media/baseset/orig_extra/shore.nfo diff --git a/media/extra_grf/shore.png b/media/baseset/orig_extra/shore.png Binary files differindex f98333ebc..f98333ebc 100644 --- a/media/extra_grf/shore.png +++ b/media/baseset/orig_extra/shore.png diff --git a/media/baseset/orig_tto.obm b/media/baseset/orig_tto.obm index c572bcf34..ced9cf580 100644 --- a/media/baseset/orig_tto.obm +++ b/media/baseset/orig_tto.obm @@ -5,7 +5,7 @@ name = original_tto shortname = TTOD version = 1 -!! description STR_BASEMUSIC_TTO_DESCRIPTION +@description_STR_BASEMUSIC_TTO_DESCRIPTION@ [files] theme = gm-tto.cat diff --git a/media/baseset/orig_win.obg b/media/baseset/orig_win.obg index f01624a25..b1cc8437e 100644 --- a/media/baseset/orig_win.obg +++ b/media/baseset/orig_win.obg @@ -6,7 +6,7 @@ name = original_windows shortname = TTDW version = 0 palette = Windows -!! description STR_BASEGRAPHICS_WIN_DESCRIPTION +@description_STR_BASEGRAPHICS_WIN_DESCRIPTION@ [files] base = TRG1R.GRF @@ -22,7 +22,7 @@ TRGIR.GRF = 0c2484ff6be49fc63a83be6ab5c38f32 TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1 TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8 -ORIG_EXTRA.GRF = +ORIG_EXTRA.GRF = ${ORIG_EXTRA_GRF_MD5} [origin] default = You can find it on your Transport Tycoon Deluxe CD-ROM. diff --git a/media/baseset/orig_win.obm b/media/baseset/orig_win.obm index 11e363fab..de269d65c 100644 --- a/media/baseset/orig_win.obm +++ b/media/baseset/orig_win.obm @@ -5,7 +5,7 @@ name = original_windows shortname = TTDW version = 1 -!! description STR_BASEMUSIC_WIN_DESCRIPTION +@description_STR_BASEMUSIC_WIN_DESCRIPTION@ [files] theme = GM_TT00.GM diff --git a/media/baseset/orig_win.obs b/media/baseset/orig_win.obs index 7b0237220..66dd619a8 100644 --- a/media/baseset/orig_win.obs +++ b/media/baseset/orig_win.obs @@ -5,7 +5,7 @@ name = original_windows shortname = TTDO version = 0 -!! description STR_BASESOUNDS_WIN_DESCRIPTION +@description_STR_BASESOUNDS_WIN_DESCRIPTION@ [files] samples = SAMPLE.CAT diff --git a/media/baseset/translations.awk b/media/baseset/translations.awk deleted file mode 100644 index af5f2b4a8..000000000 --- a/media/baseset/translations.awk +++ /dev/null @@ -1,67 +0,0 @@ -# This file is part of OpenTTD. -# OpenTTD 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, version 2. -# OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. - -# -# Awk script to extract translations for baseset descriptions -# from lang files for insertion into .obg/obs/obm files. -# If there is no translation, there is no output. -# -# The input file is scanned for the pattern -# !! <ini-key> <STR_id> -# -# The lang files (passed as variable 'langfiles') are scanned for <STR_id> and -# the translations are added to the output file: -# <ini-key>.<iso-code> = <translation> -# - -# Simple insertion sort since not all AWKs have a sort implementation -function isort(A) { - n = 0 - for (val in A) { - n++; - } - - for (i = 2; i <= n; i++) { - j = i; - hold = A[j] - while (A[j - 1] > hold) { - j--; - A[j + 1] = A[j] - } - A[j] = hold - } - - return n -} - -/^!!/ { - ini_key = $2; - str_id = $3; - - file = langfiles - while ((getline < file) > 0) { - if (match($0, "##isocode") > 0) { - lang = $2; - } else if (match($0, "^" str_id " *:") > 0) { - sub("^[^:]*:", "", $0) - i++; - if (lang == "en_GB") { - texts[i] = ini_key " = "$0; - } else { - texts[i] = ini_key "." lang " = "$0; - } - } - } - close(file); - - count = isort(texts); - for (i = 1; i <= count; i++) { - print texts[i] - } - - next -} - -{ print } diff --git a/media/baseset/translations.vbs b/media/baseset/translations.vbs deleted file mode 100644 index c16788693..000000000 --- a/media/baseset/translations.vbs +++ /dev/null @@ -1,145 +0,0 @@ -Option Explicit - -' This file is part of OpenTTD. -' OpenTTD 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, version 2. -' OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -' See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. - -Dim FSO -Set FSO = CreateObject("Scripting.FileSystemObject") - -Dim inputfile, outputfile, langpath, extra_grf -inputfile = WScript.Arguments(0) -outputfile = WScript.Arguments(1) -langpath = WScript.Arguments(2) - -If WScript.Arguments.Length > 3 Then - extra_grf = WScript.Arguments(3) -End If - -Function GetExtraGrfHash - Dim WSO, exe, line - - Set WSO = WScript.CreateObject("WScript.Shell") - Set exe = WSO.Exec("certutil -hashfile " & extra_grf & " MD5") - - Do Until exe.StdOut.AtEndOfStream - line = exe.StdOut.ReadLine - If Len(line) = 32 Then GetExtraGrfHash = line - Loop - - Set WSO = Nothing -End Function - -' Simple insertion sort, copied from translations.awk -Sub ISort(a) - Dim i, j, n, hold - n = UBound(a) - - For i = 1 To n - j = i - hold = a(j) - Do While a(j - 1) > hold - j = j - 1 - a(j + 1) = a(j) - - If j = 0 Then Exit Do - Loop - a(j) = hold - Next -End Sub - -Sub Lookup(ini_key, str_id, outfile) - Dim folder, file, line, p, lang, i - - ' Ensure only complete string matches - str_id = str_id & " " - - Set folder = FSO.GetFolder(langpath) - - Dim output() - ReDim output(folder.Files.Count) - - For Each file In folder.Files - If UCase(FSO.GetExtensionName(file.Name)) = "TXT" Then - Dim f - Set f = CreateObject("ADODB.Stream") - f.Charset = "utf-8" - f.LineSeparator = 10 ' Assume lines end with \n even for \r\n files - f.Open - f.LoadFromFile(file.Path) - - Do Until f.EOS - line = Replace(f.ReadText(-2), Chr(13), "") ' Read a line and remove any \r - - If InStr(1, line, "##isocode ") = 1 Then - p = Split(line) - lang = p(1) - ElseIf InStr(1, line, str_id) = 1 Then - p = Split(line, ":", 2) - If lang = "en_GB" Then - output(i) = ini_key & " = " & p(1) - Else - output(i) = ini_key & "." & lang & " = " & p(1) - End If - i = i + 1 - End If - Loop - - f.Close - End If - Next - - ReDim Preserve output(i - 1) - ISort output - - For Each line In output - outfile.WriteText line, 1 - Next - -End Sub - -Dim line, p - -Dim infile -Set infile = FSO.OpenTextFile(inputfile) - -Dim outfile -Set outfile = CreateObject("ADODB.Stream") -outfile.Charset = "utf-8" -outfile.Open - -Do Until infile.atEndOfStream - - line = infile.ReadLine() - - If InStr(1, line, "ORIG_EXTRA.GRF ") = 1 Then - p = Split(line, "=") - If Trim(p(1)) = "" Then - outfile.WriteText "ORIG_EXTRA.GRF = " & GetExtraGrfHash(), 1 - Else - outfile.WriteText line, 1 - End If - ElseIf InStr(1, line, "!! ") = 1 Then - p = Split(line) - Lookup p(1), p(2), outfile - Else - outfile.WriteText line, 1 - End If - -Loop - -' UTF-8 Text ADO Stream includes BOM, so we need to remove it -Dim outfile_noBOM -Set outfile_noBOM = CreateObject("ADODB.Stream") -outfile_noBOM.Type = 1 -outfile_noBOM.Open - -' Copy Text stream to Binary stream, skiping the BOM -outfile.Position = 3 -outfile.CopyTo outfile_noBOM -outfile.Close - -' Write the Binary stream -outfile_noBOM.SaveToFile outputfile, 2 -outfile_noBOM.Close diff --git a/media/extra_grf/assemble_nfo.awk b/media/extra_grf/assemble_nfo.awk deleted file mode 100644 index f39e6b6b4..000000000 --- a/media/extra_grf/assemble_nfo.awk +++ /dev/null @@ -1,30 +0,0 @@ -# This file is part of OpenTTD. -# OpenTTD 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, version 2. -# OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. - -BEGIN { - # Very basic variant function; barely any error checking. - # Just use the first argument as the file to start from when assembling everything - path = ARGV[1]; - gsub("[^/\\\\]*$", "", path); - assemble(ARGV[1]); -} - -# Recursive function for assembling by means of resolving the #includes. -function assemble(filename) { - while ((getline < filename) > 0) { - if (NF == 2 && $1 == "#include" ) { - # Remove the quotes. - gsub("[\"'<>]", "", $2); - assemble(path $2); - } else { - print $0; - } - } - - if (close(filename) < 0) { - print "Could not open " filename > "/dev/stderr"; - exit -1; - } -} |