Changeset - r22523:2816509b7317
[Not reviewed]
master
0 15 2
frosch - 7 years ago 2017-01-14 15:48:19
frosch@openttd.org
(svn r27730) -Change: Split openttd.grf into openttd.grf and orig_extra.grf
openttd.grf is now always loaded and provides all extra graphics in case the (possibly outdated) baseset does not.
orig_extra.grf contains graphics specific to the original baseset only.
17 files changed with 146 insertions and 47 deletions:
0 comments (0 inline, 0 general)
.gitignore
Show inline comments
 
@@ -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
Makefile.grf.in
Show inline comments
 
@@ -44,22 +44,18 @@ PNG_FILES    := $(GRF_DIR)/*.png $(GRF_D
 

	
 
# 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 @@ endif
 
	$(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 @@ endif
 
	$(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
Makefile.in
Show inline comments
 
@@ -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 \
bin/baseset/openttd.grf
Show inline comments
 
binary diff not shown
bin/baseset/orig_dos.obg
Show inline comments
 
@@ -68,7 +68,7 @@ logos        = TRGI.GRF
 
arctic       = TRGC.GRF
 
tropical     = TRGH.GRF
 
toyland      = TRGT.GRF
 
extra        = OPENTTD.GRF
 
extra             = ORIG_EXTRA.GRF
 

	
 
[md5s]
 
TRG1.GRF     = 9311676280e5b14077a8ee41c1b42192
 
@@ -76,8 +76,8 @@ TRGI.GRF     = da6a6c9dcc451eec88d792114
 
TRGC.GRF     = ed446637e034104c5559b32c18afe78d
 
TRGH.GRF     = ee6616fb0e6ef6b24892c58c93d86fc9
 
TRGT.GRF     = e30e8a398ae86c03dc534a8ac7dfb3b6
 
OPENTTD.GRF  = 505d96061556d3bb5cec6234096ec5bc
 
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.
 
ORIG_EXTRA.GRF    = This file was part of your OpenTTD installation.
bin/baseset/orig_dos_de.obg
Show inline comments
 
@@ -67,7 +67,7 @@ logos        = TRGI.GRF
 
arctic       = TRGC.GRF
 
tropical     = TRGH.GRF
 
toyland      = TRGT.GRF
 
extra        = OPENTTD.GRF
 
extra             = ORIG_EXTRA.GRF
 

	
 
[md5s]
 
TRG1.GRF     = 9311676280e5b14077a8ee41c1b42192
 
@@ -75,8 +75,8 @@ TRGI.GRF     = da6a6c9dcc451eec88d792114
 
TRGC.GRF     = ed446637e034104c5559b32c18afe78d
 
TRGH.GRF     = ee6616fb0e6ef6b24892c58c93d86fc9
 
TRGT.GRF     = fcde1d7e8a74197d72a62695884b909e
 
OPENTTD.GRF  = 505d96061556d3bb5cec6234096ec5bc
 
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.
 
ORIG_EXTRA.GRF    = This file was part of your OpenTTD installation.
bin/baseset/orig_extra.grf
Show inline comments
 
new file 100644
 
binary diff not shown
bin/baseset/orig_win.obg
Show inline comments
 
@@ -68,7 +68,7 @@ logos        = TRGIR.GRF
 
arctic       = TRGCR.GRF
 
tropical     = TRGHR.GRF
 
toyland      = TRGTR.GRF
 
extra        = OPENTTD.GRF
 
extra             = ORIG_EXTRA.GRF
 

	
 
[md5s]
 
TRG1R.GRF    = b04ce593d8c5016e07473a743d7d3358
 
@@ -76,8 +76,8 @@ TRGIR.GRF    = 0c2484ff6be49fc63a83be6ab
 
TRGCR.GRF    = 3668f410c761a050b5e7095a2b14879b
 
TRGHR.GRF    = 06bf2b7a31766f048baac2ebe43457b1
 
TRGTR.GRF    = de53650517fe661ceaa3138c6edb0eb8
 
OPENTTD.GRF  = 505d96061556d3bb5cec6234096ec5bc
 
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.
 
ORIG_EXTRA.GRF    = This file was part of your OpenTTD installation.
media/baseset/orig_dos.obg
Show inline comments
 
@@ -16,7 +16,7 @@ logos        = TRGI.GRF
 
arctic       = TRGC.GRF
 
tropical     = TRGH.GRF
 
toyland      = TRGT.GRF
 
extra        = OPENTTD.GRF
 
extra             = ORIG_EXTRA.GRF
 

	
 
[md5s]
 
TRG1.GRF     = 9311676280e5b14077a8ee41c1b42192
 
@@ -24,8 +24,8 @@ TRGI.GRF     = da6a6c9dcc451eec88d792114
 
TRGC.GRF     = ed446637e034104c5559b32c18afe78d
 
TRGH.GRF     = ee6616fb0e6ef6b24892c58c93d86fc9
 
TRGT.GRF     = e30e8a398ae86c03dc534a8ac7dfb3b6
 
OPENTTD.GRF  =
 
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.
 
ORIG_EXTRA.GRF    = This file was part of your OpenTTD installation.
media/baseset/orig_dos_de.obg
Show inline comments
 
@@ -16,7 +16,7 @@ logos        = TRGI.GRF
 
arctic       = TRGC.GRF
 
tropical     = TRGH.GRF
 
toyland      = TRGT.GRF
 
extra        = OPENTTD.GRF
 
extra             = ORIG_EXTRA.GRF
 

	
 
[md5s]
 
TRG1.GRF     = 9311676280e5b14077a8ee41c1b42192
 
@@ -24,8 +24,8 @@ TRGI.GRF     = da6a6c9dcc451eec88d792114
 
TRGC.GRF     = ed446637e034104c5559b32c18afe78d
 
TRGH.GRF     = ee6616fb0e6ef6b24892c58c93d86fc9
 
TRGT.GRF     = fcde1d7e8a74197d72a62695884b909e
 
OPENTTD.GRF  =
 
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.
 
ORIG_EXTRA.GRF    = This file was part of your OpenTTD installation.
media/baseset/orig_win.obg
Show inline comments
 
@@ -16,7 +16,7 @@ logos        = TRGIR.GRF
 
arctic       = TRGCR.GRF
 
tropical     = TRGHR.GRF
 
toyland      = TRGTR.GRF
 
extra        = OPENTTD.GRF
 
extra             = ORIG_EXTRA.GRF
 

	
 
[md5s]
 
TRG1R.GRF    = b04ce593d8c5016e07473a743d7d3358
 
@@ -24,8 +24,8 @@ TRGIR.GRF    = 0c2484ff6be49fc63a83be6ab
 
TRGCR.GRF    = 3668f410c761a050b5e7095a2b14879b
 
TRGHR.GRF    = 06bf2b7a31766f048baac2ebe43457b1
 
TRGTR.GRF    = de53650517fe661ceaa3138c6edb0eb8
 
OPENTTD.GRF  =
 
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.
 
ORIG_EXTRA.GRF    = This file was part of your OpenTTD installation.
media/extra_grf/openttd.nfo
Show inline comments
 
@@ -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"
media/extra_grf/orig_extra.nfo
Show inline comments
 
new file 100644
 
// 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 <http://www.gnu.org/licenses/>.
 
//
 
// 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"
os/windows/installer/install.nsi
Show inline comments
 
@@ -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"
src/gfxinit.cpp
Show inline comments
 
@@ -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;
 
}
src/newgrf.cpp
Show inline comments
 
@@ -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 fi
 
			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;
src/newgrf.h
Show inline comments
 
@@ -183,7 +183,7 @@ extern GRFLoadedFeatures _loaded_newgrf_
 
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();
0 comments (0 inline, 0 general)