diff --git a/.gitignore b/.gitignore index cb1e9d1599..2b298a14a9 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ bin/ai/* bin/baseset/* !bin/baseset/openttd.grf !bin/baseset/opntitle.dat +!bin/baseset/orig_extra.grf !bin/baseset/orig_*.obg !bin/baseset/orig_*.obs !bin/baseset/no_sound.obs diff --git a/Makefile.grf.in b/Makefile.grf.in index 1cc2642320..1625b9e4c0 100644 --- a/Makefile.grf.in +++ b/Makefile.grf.in @@ -44,22 +44,18 @@ PNG_FILES := $(GRF_DIR)/*.png $(GRF_DIR)/rivers/*.png # Build the GRF. ifdef GRFCODEC -all: $(BIN_DIR)/openttd.grf $(BIN_DIR)/orig_dos.obg $(BIN_DIR)/orig_dos_de.obg $(BIN_DIR)/orig_win.obg $(BIN_DIR)/orig_dos.obs $(BIN_DIR)/orig_win.obs $(BIN_DIR)/no_sound.obs $(BIN_DIR)/orig_win.obm $(BIN_DIR)/no_music.obm +all: $(BIN_DIR)/openttd.grf $(BIN_DIR)/orig_extra.grf $(BIN_DIR)/orig_dos.obg $(BIN_DIR)/orig_dos_de.obg $(BIN_DIR)/orig_win.obg $(BIN_DIR)/orig_dos.obs $(BIN_DIR)/orig_win.obs $(BIN_DIR)/no_sound.obs $(BIN_DIR)/orig_win.obm $(BIN_DIR)/no_music.obm else all: endif -# Make sure the sprites directory exists. -$(OBJS_DIR)/sprites: - $(Q)-mkdir "$@" - $(OBJS_DIR)/langfiles.tmp: $(LANG_DIR)/*.txt $(E) '$(STAGE) Collecting baseset translations' $(Q) cat $^ > $@ -$(BIN_DIR)/%.obg: $(BASESET_DIR)/%.obg $(BIN_DIR)/openttd.grf $(OBJS_DIR)/langfiles.tmp $(BASESET_DIR)/translations.awk +$(BIN_DIR)/%.obg: $(BASESET_DIR)/%.obg $(BIN_DIR)/orig_extra.grf $(OBJS_DIR)/langfiles.tmp $(BASESET_DIR)/translations.awk $(E) '$(STAGE) Updating $(notdir $@)' - $(Q) sed 's/^OPENTTD.GRF = *[0-9a-f]*$$/OPENTTD.GRF = '`$(MD5SUM) $(BIN_DIR)/openttd.grf | sed 's@ .*@@'`'/' $< > $@.tmp + $(Q) sed 's/^ORIG_EXTRA.GRF = *[0-9a-f]*$$/ORIG_EXTRA.GRF = '`$(MD5SUM) $(BIN_DIR)/orig_extra.grf | sed 's@ .*@@'`'/' $< > $@.tmp $(Q) awk -v langfiles='$(OBJS_DIR)/langfiles.tmp' -f $(BASESET_DIR)/translations.awk $@.tmp >$@ $(Q) rm $@.tmp @@ -72,8 +68,9 @@ $(BIN_DIR)/%.obm: $(BASESET_DIR)/%.obm $(OBJS_DIR)/langfiles.tmp $(BASESET_DIR)/ $(Q) awk -v langfiles='$(OBJS_DIR)/langfiles.tmp' -f $(BASESET_DIR)/translations.awk $< >$@ # Compile extra grf -$(BIN_DIR)/openttd.grf: $(PNG_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites $(GRF_DIR)/assemble_nfo.awk +$(BIN_DIR)/openttd.grf: $(PNG_FILES) $(NFO_FILES) $(GRF_DIR)/assemble_nfo.awk $(E) '$(STAGE) Assembling openttd.nfo' + $(Q)-mkdir -p $(OBJS_DIR)/sprites $(Q)-cp $(PNG_FILES) $(OBJS_DIR)/sprites 2> /dev/null $(Q) awk -f $(GRF_DIR)/assemble_nfo.awk $(GRF_DIR)/openttd.nfo > $(OBJS_DIR)/sprites/openttd.nfo $(Q) $(NFORENUM) -s $(OBJS_DIR)/sprites/openttd.nfo @@ -81,6 +78,17 @@ $(BIN_DIR)/openttd.grf: $(PNG_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites $(GRF_DIR) $(Q) $(GRFCODEC) -n -s -e -p1 $(OBJS_DIR)/openttd.grf $(Q)cp $(OBJS_DIR)/openttd.grf $(BIN_DIR)/openttd.grf +# The copy operation of PNG_FILES is duplicated from the target 'openttd.grf', thus those targets may not run in parallel. +$(BIN_DIR)/orig_extra.grf: $(PNG_FILES) $(NFO_FILES) $(GRF_DIR)/assemble_nfo.awk | $(BIN_DIR)/openttd.grf + $(E) '$(STAGE) Assembling orig_extra.nfo' + $(Q)-mkdir -p $(OBJS_DIR)/sprites + $(Q)-cp $(PNG_FILES) $(OBJS_DIR)/sprites 2> /dev/null + $(Q) awk -f $(GRF_DIR)/assemble_nfo.awk $(GRF_DIR)/orig_extra.nfo > $(OBJS_DIR)/sprites/orig_extra.nfo + $(Q) $(NFORENUM) -s $(OBJS_DIR)/sprites/orig_extra.nfo + $(E) '$(STAGE) Compiling orig_extra.grf' + $(Q) $(GRFCODEC) -n -s -e -p1 $(OBJS_DIR)/orig_extra.grf + $(Q)cp $(OBJS_DIR)/orig_extra.grf $(BIN_DIR)/orig_extra.grf + # Clean up temporary files. clean: $(Q)rm -f *.bak *.grf diff --git a/Makefile.in b/Makefile.in index 0d50fc1b1e..d33d8a0d2a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -152,7 +152,7 @@ mrproper: distclean: mrproper maintainer-clean: distclean - $(Q)rm -f $(BIN_DIR)/baseset/openttd.grf $(BIN_DIR)/baseset/*.obg $(BIN_DIR)/baseset/*.obs $(BIN_DIR)/baseset/*.obm + $(Q)rm -f $(BIN_DIR)/baseset/openttd.grf $(BIN_DIR)/baseset/orig_extra.grf $(BIN_DIR)/baseset/*.obg $(BIN_DIR)/baseset/*.obs $(BIN_DIR)/baseset/*.obm depend: @for dir in $(SRC_DIRS); do \ diff --git a/bin/baseset/openttd.grf b/bin/baseset/openttd.grf index efe35ffd38..6f2921f272 100644 Binary files a/bin/baseset/openttd.grf and b/bin/baseset/openttd.grf differ diff --git a/bin/baseset/orig_dos.obg b/bin/baseset/orig_dos.obg index 3eb8c0ff97..6d721825a8 100644 --- a/bin/baseset/orig_dos.obg +++ b/bin/baseset/orig_dos.obg @@ -63,21 +63,21 @@ description.zh_CN = 运输大亨DOS豪华版原版图形包. description.zh_TW = 原版 Transport Tycoon Deluxe DOS 版的圖形。 [files] -base = TRG1.GRF -logos = TRGI.GRF -arctic = TRGC.GRF -tropical = TRGH.GRF -toyland = TRGT.GRF -extra = OPENTTD.GRF +base = TRG1.GRF +logos = TRGI.GRF +arctic = TRGC.GRF +tropical = TRGH.GRF +toyland = TRGT.GRF +extra = ORIG_EXTRA.GRF [md5s] -TRG1.GRF = 9311676280e5b14077a8ee41c1b42192 -TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8 -TRGC.GRF = ed446637e034104c5559b32c18afe78d -TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9 -TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6 -OPENTTD.GRF = 505d96061556d3bb5cec6234096ec5bc +TRG1.GRF = 9311676280e5b14077a8ee41c1b42192 +TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8 +TRGC.GRF = ed446637e034104c5559b32c18afe78d +TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9 +TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6 +ORIG_EXTRA.GRF = 2f214be226d04af78c3afb961ccdd08d [origin] -default = You can find it on your Transport Tycoon Deluxe CD-ROM. -OPENTTD.GRF = This file was part of your OpenTTD installation. +default = You can find it on your Transport Tycoon Deluxe CD-ROM. +ORIG_EXTRA.GRF = This file was part of your OpenTTD installation. diff --git a/bin/baseset/orig_dos_de.obg b/bin/baseset/orig_dos_de.obg index b081e4bc2f..51b5353952 100644 --- a/bin/baseset/orig_dos_de.obg +++ b/bin/baseset/orig_dos_de.obg @@ -62,21 +62,21 @@ description.zh_CN = 运输大亨DOS豪华德语版原版图形包. description.zh_TW = 原版 Transport Tycoon Deluxe DOS 版 (德國版) 的圖形。 [files] -base = TRG1.GRF -logos = TRGI.GRF -arctic = TRGC.GRF -tropical = TRGH.GRF -toyland = TRGT.GRF -extra = OPENTTD.GRF +base = TRG1.GRF +logos = TRGI.GRF +arctic = TRGC.GRF +tropical = TRGH.GRF +toyland = TRGT.GRF +extra = ORIG_EXTRA.GRF [md5s] -TRG1.GRF = 9311676280e5b14077a8ee41c1b42192 -TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8 -TRGC.GRF = ed446637e034104c5559b32c18afe78d -TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9 -TRGT.GRF = fcde1d7e8a74197d72a62695884b909e -OPENTTD.GRF = 505d96061556d3bb5cec6234096ec5bc +TRG1.GRF = 9311676280e5b14077a8ee41c1b42192 +TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8 +TRGC.GRF = ed446637e034104c5559b32c18afe78d +TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9 +TRGT.GRF = fcde1d7e8a74197d72a62695884b909e +ORIG_EXTRA.GRF = 2f214be226d04af78c3afb961ccdd08d [origin] -default = You can find it on your Transport Tycoon Deluxe CD-ROM. -OPENTTD.GRF = This file was part of your OpenTTD installation. +default = You can find it on your Transport Tycoon Deluxe CD-ROM. +ORIG_EXTRA.GRF = This file was part of your OpenTTD installation. diff --git a/bin/baseset/orig_extra.grf b/bin/baseset/orig_extra.grf new file mode 100644 index 0000000000..32d2cf627d Binary files /dev/null and b/bin/baseset/orig_extra.grf differ diff --git a/bin/baseset/orig_win.obg b/bin/baseset/orig_win.obg index 65a97c4770..fc4740fbac 100644 --- a/bin/baseset/orig_win.obg +++ b/bin/baseset/orig_win.obg @@ -63,21 +63,21 @@ description.zh_CN = 运输大亨Windows豪华版原版图形包. description.zh_TW = 原版 Transport Tycoon Deluxe Windows 版的圖形。 [files] -base = TRG1R.GRF -logos = TRGIR.GRF -arctic = TRGCR.GRF -tropical = TRGHR.GRF -toyland = TRGTR.GRF -extra = OPENTTD.GRF +base = TRG1R.GRF +logos = TRGIR.GRF +arctic = TRGCR.GRF +tropical = TRGHR.GRF +toyland = TRGTR.GRF +extra = ORIG_EXTRA.GRF [md5s] -TRG1R.GRF = b04ce593d8c5016e07473a743d7d3358 -TRGIR.GRF = 0c2484ff6be49fc63a83be6ab5c38f32 -TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b -TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1 -TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8 -OPENTTD.GRF = 505d96061556d3bb5cec6234096ec5bc +TRG1R.GRF = b04ce593d8c5016e07473a743d7d3358 +TRGIR.GRF = 0c2484ff6be49fc63a83be6ab5c38f32 +TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b +TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1 +TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8 +ORIG_EXTRA.GRF = 2f214be226d04af78c3afb961ccdd08d [origin] -default = You can find it on your Transport Tycoon Deluxe CD-ROM. -OPENTTD.GRF = This file was part of your OpenTTD installation. +default = You can find it on your Transport Tycoon Deluxe CD-ROM. +ORIG_EXTRA.GRF = This file was part of your OpenTTD installation. diff --git a/media/baseset/orig_dos.obg b/media/baseset/orig_dos.obg index b4cde64007..f9db843af1 100644 --- a/media/baseset/orig_dos.obg +++ b/media/baseset/orig_dos.obg @@ -11,21 +11,21 @@ palette = DOS !! description STR_BASEGRAPHICS_DOS_DESCRIPTION [files] -base = TRG1.GRF -logos = TRGI.GRF -arctic = TRGC.GRF -tropical = TRGH.GRF -toyland = TRGT.GRF -extra = OPENTTD.GRF +base = TRG1.GRF +logos = TRGI.GRF +arctic = TRGC.GRF +tropical = TRGH.GRF +toyland = TRGT.GRF +extra = ORIG_EXTRA.GRF [md5s] -TRG1.GRF = 9311676280e5b14077a8ee41c1b42192 -TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8 -TRGC.GRF = ed446637e034104c5559b32c18afe78d -TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9 -TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6 -OPENTTD.GRF = +TRG1.GRF = 9311676280e5b14077a8ee41c1b42192 +TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8 +TRGC.GRF = ed446637e034104c5559b32c18afe78d +TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9 +TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6 +ORIG_EXTRA.GRF = [origin] -default = You can find it on your Transport Tycoon Deluxe CD-ROM. -OPENTTD.GRF = This file was part of your OpenTTD installation. +default = You can find it on your Transport Tycoon Deluxe CD-ROM. +ORIG_EXTRA.GRF = This file was part of your OpenTTD installation. diff --git a/media/baseset/orig_dos_de.obg b/media/baseset/orig_dos_de.obg index 8cfcc27074..4e12582727 100644 --- a/media/baseset/orig_dos_de.obg +++ b/media/baseset/orig_dos_de.obg @@ -11,21 +11,21 @@ palette = DOS !! description STR_BASEGRAPHICS_DOS_DE_DESCRIPTION [files] -base = TRG1.GRF -logos = TRGI.GRF -arctic = TRGC.GRF -tropical = TRGH.GRF -toyland = TRGT.GRF -extra = OPENTTD.GRF +base = TRG1.GRF +logos = TRGI.GRF +arctic = TRGC.GRF +tropical = TRGH.GRF +toyland = TRGT.GRF +extra = ORIG_EXTRA.GRF [md5s] -TRG1.GRF = 9311676280e5b14077a8ee41c1b42192 -TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8 -TRGC.GRF = ed446637e034104c5559b32c18afe78d -TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9 -TRGT.GRF = fcde1d7e8a74197d72a62695884b909e -OPENTTD.GRF = +TRG1.GRF = 9311676280e5b14077a8ee41c1b42192 +TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8 +TRGC.GRF = ed446637e034104c5559b32c18afe78d +TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9 +TRGT.GRF = fcde1d7e8a74197d72a62695884b909e +ORIG_EXTRA.GRF = [origin] -default = You can find it on your Transport Tycoon Deluxe CD-ROM. -OPENTTD.GRF = This file was part of your OpenTTD installation. +default = You can find it on your Transport Tycoon Deluxe CD-ROM. +ORIG_EXTRA.GRF = This file was part of your OpenTTD installation. diff --git a/media/baseset/orig_win.obg b/media/baseset/orig_win.obg index 82a5c2a616..393b5d3013 100644 --- a/media/baseset/orig_win.obg +++ b/media/baseset/orig_win.obg @@ -11,21 +11,21 @@ palette = Windows !! description STR_BASEGRAPHICS_WIN_DESCRIPTION [files] -base = TRG1R.GRF -logos = TRGIR.GRF -arctic = TRGCR.GRF -tropical = TRGHR.GRF -toyland = TRGTR.GRF -extra = OPENTTD.GRF +base = TRG1R.GRF +logos = TRGIR.GRF +arctic = TRGCR.GRF +tropical = TRGHR.GRF +toyland = TRGTR.GRF +extra = ORIG_EXTRA.GRF [md5s] -TRG1R.GRF = b04ce593d8c5016e07473a743d7d3358 -TRGIR.GRF = 0c2484ff6be49fc63a83be6ab5c38f32 -TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b -TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1 -TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8 -OPENTTD.GRF = +TRG1R.GRF = b04ce593d8c5016e07473a743d7d3358 +TRGIR.GRF = 0c2484ff6be49fc63a83be6ab5c38f32 +TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b +TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1 +TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8 +ORIG_EXTRA.GRF = [origin] -default = You can find it on your Transport Tycoon Deluxe CD-ROM. -OPENTTD.GRF = This file was part of your OpenTTD installation. +default = You can find it on your Transport Tycoon Deluxe CD-ROM. +ORIG_EXTRA.GRF = This file was part of your OpenTTD installation. diff --git a/media/extra_grf/openttd.nfo b/media/extra_grf/openttd.nfo index 66149a37e5..7ece5c7149 100644 --- a/media/extra_grf/openttd.nfo +++ b/media/extra_grf/openttd.nfo @@ -60,10 +60,11 @@ 00 // GRF ID, must start with FF so it gets ignored - -1 * 0 08 08 FF "OTT" +//@@WARNING DISABLE 101 + -1 * 0 08 08 FF FF FF FE // Name of the GRF - "OpenTTD's base graphics " 00 + "OpenTTD's default and fallback extra graphics" 00 // Description of the GRF. "License: GNU General Public License version 2" 0D @@ -86,7 +87,6 @@ #include "canals.nfo" #include "oneway.nfo" #include "tramtracks.nfo" -#include "shore.nfo" #include "sloped_tracks.nfo" #include "airports.nfo" #include "roadstops.nfo" @@ -97,11 +97,5 @@ #include "airport_preview.nfo" #include "chars.nfo" #include "mono.nfo" -#include "fix_graphics.nfo" -#include "rivers/rapids.nfo" -#include "rivers/temperate.nfo" -#include "rivers/arctic.nfo" -#include "rivers/tropic.nfo" -#include "rivers/toyland.nfo" #include "tunnel_portals.nfo" #include "palette.nfo" diff --git a/media/extra_grf/orig_extra.nfo b/media/extra_grf/orig_extra.nfo new file mode 100644 index 0000000000..228aa2841c --- /dev/null +++ b/media/extra_grf/orig_extra.nfo @@ -0,0 +1,84 @@ +// Automatically generated by GRFCODEC. Do not modify! +// (Info version 32) +// Format: spritenum imagefile depth xpos ypos xsize ysize xrel yrel zoom flags +// +// $Id$ +// +// 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 . +// +// Sources for extra graphics to complement the original graphics. +// Checks whether the correct version of OpenTTD is used before +// allowing it to be used. +// + +// +// Number of sprites, it is wrong, but GRFcodec automagically gets it right. +// + 0 * 4 00 00 00 00 + + +// +// Check whether we are running OTTD or not. +// + -1 * 0 07 9D 04 \7= 01 00 00 00 01 + -1 * 0 0B 03 7F FF 80 " is not for TTDPatch. Use ttdpatch(w).grf." 00 + + +// +// Check for OTTD's version number +// + +// First step... Variable A1 might not exist. If that's the case it always +// skips. As we do not want to skip out of the whole testing, we skip over +// the real version check. + -1 * 0 07 A1 04 \7= FF FF FF FF 02 + +// Real version check. + -1 * 0 07 A1 04 \7> \w20304 01 01 03 + +// If the version check is supported, the string is translateable via OpenTTD +// itself. Use it!. + + -1 * 0 0B 03 7F 06 "1.1 (or trunk r20304)" 00 + +// Some OTTD versions before r11130 did support Action B, so use the English +// phrase there + -1 * 0 0B 03 7F FF "Requires OpenTTD version 1.1 (or trunk r20304) or better." 00 + +// Final fallback. No Action B support, just skip to the end of the file. + -1 * 0 07 A1 04 \7= FF FF FF FF 00 + +// We are a DOS paletted NewGRF, so tell OpenTTD that. Then it can actually +// do the right thing. Yay for that feature as that means no duplicate NewGRF! + -1 * 0 14 + "C" "INFO" + "B" "PALS" \w1 "D" + 00 + 00 + +// GRF ID, must start with FF so it gets ignored +//@@WARNING DISABLE 101 + -1 * 0 08 08 FF "OTT" + +// Name of the GRF + "Original baseset extra graphics" 00 + +// Description of the GRF. + "License: GNU General Public License version 2" 0D + "Andrew Parkhouse: rivers" 0D + "Addi and PaulC: original graphics fixes" 0D + "OpenTTD developers: other graphics" 00 + +// +// The real data of the GRF is acquired from several subfiles. +// +#include "shore.nfo" +#include "fix_graphics.nfo" +#include "rivers/rapids.nfo" +#include "rivers/temperate.nfo" +#include "rivers/arctic.nfo" +#include "rivers/tropic.nfo" +#include "rivers/toyland.nfo" diff --git a/os/windows/installer/install.nsi b/os/windows/installer/install.nsi index 9eb869f2d3..c7b8c82af4 100644 --- a/os/windows/installer/install.nsi +++ b/os/windows/installer/install.nsi @@ -408,6 +408,7 @@ Section "Uninstall" ; Baseset files Delete "$INSTDIR\baseset\opntitle.dat" Delete "$INSTDIR\baseset\openttd.grf" + Delete "$INSTDIR\baseset\orig_extra.grf" Delete "$INSTDIR\baseset\orig_win.obg" Delete "$INSTDIR\baseset\orig_dos.obg" Delete "$INSTDIR\baseset\orig_dos_de.obg" diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp index 10bc0afa17..23172bdd5e 100644 --- a/src/gfxinit.cpp +++ b/src/gfxinit.cpp @@ -197,31 +197,41 @@ static void LoadSpriteTables() InitializeUnicodeGlyphMap(); /* - * Load the base NewGRF with OTTD required graphics as first NewGRF. + * Load the base and extra NewGRF with OTTD required graphics as first NewGRF. * However, we do not want it to show up in the list of used NewGRFs, * so we have to manually add it, and then remove it later. */ GRFConfig *top = _grfconfig; - GRFConfig *master = new GRFConfig(used_set->files[GFT_EXTRA].filename); + + /* Default extra graphics */ + GRFConfig *master = new GRFConfig("OPENTTD.GRF"); + master->palette |= GRFP_GRF_DOS; + FillGRFDetails(master, false, BASESET_DIR); + ClrBit(master->flags, GCF_INIT_ONLY); + + /* Baseset extra graphics */ + GRFConfig *extra = new GRFConfig(used_set->files[GFT_EXTRA].filename); /* We know the palette of the base set, so if the base NewGRF is not * setting one, use the palette of the base set and not the global * one which might be the wrong palette for this base NewGRF. * The value set here might be overridden via action14 later. */ switch (used_set->palette) { - case PAL_DOS: master->palette |= GRFP_GRF_DOS; break; - case PAL_WINDOWS: master->palette |= GRFP_GRF_WINDOWS; break; + case PAL_DOS: extra->palette |= GRFP_GRF_DOS; break; + case PAL_WINDOWS: extra->palette |= GRFP_GRF_WINDOWS; break; default: break; } - FillGRFDetails(master, false, BASESET_DIR); + FillGRFDetails(extra, false, BASESET_DIR); + ClrBit(extra->flags, GCF_INIT_ONLY); - ClrBit(master->flags, GCF_INIT_ONLY); - master->next = top; + extra->next = top; + master->next = extra; _grfconfig = master; - LoadNewGRF(SPR_NEWGRFS_BASE, i); + LoadNewGRF(SPR_NEWGRFS_BASE, i, 2); /* Free and remove the top element. */ + delete extra; delete master; _grfconfig = top; } diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 7b862149d4..e0246bdf67 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -9203,8 +9203,9 @@ static void AfterLoadGRFs() * Load all the NewGRFs. * @param load_index The offset for the first sprite to add. * @param file_index The Fio index of the first NewGRF to load. + * @param num_baseset Number of NewGRFs at the front of the list to look up in the baseset dir instead of the newgrf dir. */ -void LoadNewGRF(uint load_index, uint file_index) +void LoadNewGRF(uint load_index, uint file_index, uint num_baseset) { /* In case of networking we need to "sync" the start values * so all NewGRFs are loaded equally. For this we use the @@ -9270,7 +9271,7 @@ void LoadNewGRF(uint load_index, uint file_index) if (c->status == GCS_DISABLED || c->status == GCS_NOT_FOUND) continue; if (stage > GLS_INIT && HasBit(c->flags, GCF_INIT_ONLY)) continue; - Subdirectory subdir = slot == file_index ? BASESET_DIR : NEWGRF_DIR; + Subdirectory subdir = slot < file_index + num_baseset ? BASESET_DIR : NEWGRF_DIR; if (!FioCheckFileExists(c->filename, subdir)) { DEBUG(grf, 0, "NewGRF file is missing '%s'; disabling", c->filename); c->status = GCS_NOT_FOUND; diff --git a/src/newgrf.h b/src/newgrf.h index 51b00da7c6..1ab55dd044 100644 --- a/src/newgrf.h +++ b/src/newgrf.h @@ -183,7 +183,7 @@ extern GRFLoadedFeatures _loaded_newgrf_features; byte GetGRFContainerVersion(); void LoadNewGRFFile(struct GRFConfig *config, uint file_index, GrfLoadingStage stage, Subdirectory subdir); -void LoadNewGRF(uint load_index, uint file_index); +void LoadNewGRF(uint load_index, uint file_index, uint num_baseset); void ReloadNewGRFData(); // in saveload/afterload.cpp void ResetNewGRFData(); void ResetPersistentNewGRFData();