forked from mirror/OpenTTD
(svn r12452) -Feature: [NewGRF] Add random action 2 type 84. For vehicles only.
This commit is contained in:
@@ -2584,13 +2584,19 @@ static void NewSpriteGroup(byte *buf, int len)
|
||||
/* Randomized Sprite Group */
|
||||
case 0x80: // Self scope
|
||||
case 0x83: // Parent scope
|
||||
case 0x84: // Relative scope
|
||||
{
|
||||
if (!check_length(bufend - buf, 7, "NewSpriteGroup (Randomized) (1)")) return;
|
||||
if (!check_length(bufend - buf, HasBit(type, 2) ? 8 : 7, "NewSpriteGroup (Randomized) (1)")) return;
|
||||
|
||||
group = AllocateSpriteGroup();
|
||||
group->type = SGT_RANDOMIZED;
|
||||
group->g.random.var_scope = HasBit(type, 1) ? VSG_SCOPE_PARENT : VSG_SCOPE_SELF;
|
||||
|
||||
if (HasBit(type, 2) && feature <= GSF_AIRCRAFT) {
|
||||
group->g.random.var_scope = VSG_SCOPE_RELATIVE;
|
||||
group->g.random.count = grf_load_byte(&buf);
|
||||
}
|
||||
|
||||
uint8 triggers = grf_load_byte(&buf);
|
||||
group->g.random.triggers = GB(triggers, 0, 7);
|
||||
group->g.random.cmp_mode = HasBit(triggers, 7) ? RSG_CMP_ALL : RSG_CMP_ANY;
|
||||
|
Reference in New Issue
Block a user