summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-04-26 06:49:32 +0000
committerpeter1138 <peter1138@openttd.org>2007-04-26 06:49:32 +0000
commit5b5598b2a673844abb75c52e3deec073b912b865 (patch)
tree3ef89e563e65e20a8c0a75a7ab3e385183dc13b7 /src
parentc1b898392ea3aa03c89d1222ad9558eb02ac25b6 (diff)
downloadopenttd-5b5598b2a673844abb75c52e3deec073b912b865.tar.xz
(svn r9717) -Codechange: (NewGRF) Skip Action 5 & A sprites in all loading stages except activation.
Diffstat (limited to 'src')
-rw-r--r--src/newgrf.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 4920ca3d6..495428536 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -2916,6 +2916,21 @@ static void GraphicsNew(byte *buf, int len)
}
}
+/* Action 0x05 (SKIP) */
+static void SkipAct5(byte *buf, int len)
+{
+ if (!check_length(len, 2, "SkipAct5")) return;
+ buf++;
+
+ /* Ignore type byte */
+ grf_load_byte(&buf);
+
+ /* Skip the sprites of this action */
+ _skip_sprites = grf_load_extended(&buf);
+
+ grfmsg(3, "SkipAct5: Skipping %d sprites", _skip_sprites);
+}
+
static uint32 GetParamVal(byte param, uint32 *cond_val)
{
switch (param) {
@@ -3283,6 +3298,22 @@ static void SpriteReplace(byte *buf, int len)
}
}
+/* Action 0x0A (SKIP) */
+static void SkipActA(byte *buf, int len)
+{
+ buf++;
+ uint8 num_sets = grf_load_byte(&buf);
+
+ for (uint i = 0; i < num_sets; i++) {
+ /* Skip the sprites this replaces */
+ _skip_sprites += grf_load_byte(&buf);
+ /* But ignore where they go */
+ grf_load_word(&buf);
+ }
+
+ grfmsg(3, "SkipActA: Skipping %d sprites", _skip_sprites);
+}
+
/* Action 0x0B */
static void GRFLoadError(byte *buf, int len)
{
@@ -4588,12 +4619,12 @@ static void DecodeSpecialSprite(uint num, GrfLoadingStage stage)
/* 0x02 */ { NULL, GRFUnsafe, NULL, NULL, NULL, NewSpriteGroup, },
/* 0x03 */ { NULL, GRFUnsafe, NULL, NULL, NULL, FeatureMapSpriteGroup, },
/* 0x04 */ { NULL, NULL, NULL, NULL, NULL, FeatureNewName, },
- /* 0x05 */ { NULL, NULL, NULL, NULL, NULL, GraphicsNew, },
+ /* 0x05 */ { SkipAct5, SkipAct5, SkipAct5, SkipAct5, SkipAct5, GraphicsNew, },
/* 0x06 */ { NULL, NULL, NULL, CfgApply, CfgApply, CfgApply, },
/* 0x07 */ { NULL, NULL, NULL, NULL, SkipIf, SkipIf, },
/* 0x08 */ { ScanInfo, NULL, NULL, GRFInfo, NULL, GRFInfo, },
/* 0x09 */ { NULL, NULL, NULL, SkipIf, SkipIf, SkipIf, },
- /* 0x0A */ { NULL, NULL, NULL, NULL, NULL, SpriteReplace, },
+ /* 0x0A */ { SkipActA, SkipActA, SkipActA, SkipActA, SkipActA, SpriteReplace, },
/* 0x0B */ { NULL, NULL, NULL, GRFLoadError, GRFLoadError, GRFLoadError, },
/* 0x0C */ { NULL, NULL, NULL, GRFComment, NULL, GRFComment, },
/* 0x0D */ { NULL, SafeParamSet, NULL, ParamSet, ParamSet, ParamSet, },