Cache sprite sequence bounds for vehicles
This commit is contained in:
@@ -32,6 +32,7 @@ static bool IncrementSprite(EffectVehicle *v, SpriteID last)
|
||||
{
|
||||
if (v->sprite_seq.seq[0].sprite != last) {
|
||||
v->sprite_seq.seq[0].sprite++;
|
||||
v->UpdateSpriteSeqBound();
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -42,6 +43,7 @@ static void ChimneySmokeInit(EffectVehicle *v)
|
||||
{
|
||||
uint32 r = Random();
|
||||
v->sprite_seq.Set(SPR_CHIMNEY_SMOKE_0 + GB(r, 0, 3));
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->progress = GB(r, 16, 3);
|
||||
}
|
||||
|
||||
@@ -59,6 +61,7 @@ static bool ChimneySmokeTick(EffectVehicle *v)
|
||||
if (!IncrementSprite(v, SPR_CHIMNEY_SMOKE_7)) {
|
||||
v->sprite_seq.Set(SPR_CHIMNEY_SMOKE_0);
|
||||
}
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->progress = 7;
|
||||
v->UpdatePositionAndViewport();
|
||||
}
|
||||
@@ -69,6 +72,7 @@ static bool ChimneySmokeTick(EffectVehicle *v)
|
||||
static void SteamSmokeInit(EffectVehicle *v)
|
||||
{
|
||||
v->sprite_seq.Set(SPR_STEAM_SMOKE_0);
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->progress = 12;
|
||||
}
|
||||
|
||||
@@ -88,6 +92,7 @@ static bool SteamSmokeTick(EffectVehicle *v)
|
||||
delete v;
|
||||
return false;
|
||||
}
|
||||
v->UpdateSpriteSeqBound();
|
||||
moved = true;
|
||||
}
|
||||
|
||||
@@ -99,6 +104,7 @@ static bool SteamSmokeTick(EffectVehicle *v)
|
||||
static void DieselSmokeInit(EffectVehicle *v)
|
||||
{
|
||||
v->sprite_seq.Set(SPR_DIESEL_SMOKE_0);
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->progress = 0;
|
||||
}
|
||||
|
||||
@@ -114,6 +120,7 @@ static bool DieselSmokeTick(EffectVehicle *v)
|
||||
delete v;
|
||||
return false;
|
||||
}
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->UpdatePositionAndViewport();
|
||||
}
|
||||
|
||||
@@ -123,6 +130,7 @@ static bool DieselSmokeTick(EffectVehicle *v)
|
||||
static void ElectricSparkInit(EffectVehicle *v)
|
||||
{
|
||||
v->sprite_seq.Set(SPR_ELECTRIC_SPARK_0);
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->progress = 1;
|
||||
}
|
||||
|
||||
@@ -137,6 +145,7 @@ static bool ElectricSparkTick(EffectVehicle *v)
|
||||
delete v;
|
||||
return false;
|
||||
}
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->UpdatePositionAndViewport();
|
||||
}
|
||||
|
||||
@@ -146,6 +155,7 @@ static bool ElectricSparkTick(EffectVehicle *v)
|
||||
static void SmokeInit(EffectVehicle *v)
|
||||
{
|
||||
v->sprite_seq.Set(SPR_SMOKE_0);
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->progress = 12;
|
||||
}
|
||||
|
||||
@@ -165,6 +175,7 @@ static bool SmokeTick(EffectVehicle *v)
|
||||
delete v;
|
||||
return false;
|
||||
}
|
||||
v->UpdateSpriteSeqBound();
|
||||
moved = true;
|
||||
}
|
||||
|
||||
@@ -176,6 +187,7 @@ static bool SmokeTick(EffectVehicle *v)
|
||||
static void ExplosionLargeInit(EffectVehicle *v)
|
||||
{
|
||||
v->sprite_seq.Set(SPR_EXPLOSION_LARGE_0);
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->progress = 0;
|
||||
}
|
||||
|
||||
@@ -187,6 +199,7 @@ static bool ExplosionLargeTick(EffectVehicle *v)
|
||||
delete v;
|
||||
return false;
|
||||
}
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->UpdatePositionAndViewport();
|
||||
}
|
||||
|
||||
@@ -196,6 +209,7 @@ static bool ExplosionLargeTick(EffectVehicle *v)
|
||||
static void BreakdownSmokeInit(EffectVehicle *v)
|
||||
{
|
||||
v->sprite_seq.Set(SPR_BREAKDOWN_SMOKE_0);
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->progress = 0;
|
||||
}
|
||||
|
||||
@@ -206,6 +220,7 @@ static bool BreakdownSmokeTick(EffectVehicle *v)
|
||||
if (!IncrementSprite(v, SPR_BREAKDOWN_SMOKE_3)) {
|
||||
v->sprite_seq.Set(SPR_BREAKDOWN_SMOKE_0);
|
||||
}
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->UpdatePositionAndViewport();
|
||||
}
|
||||
|
||||
@@ -221,6 +236,7 @@ static bool BreakdownSmokeTick(EffectVehicle *v)
|
||||
static void ExplosionSmallInit(EffectVehicle *v)
|
||||
{
|
||||
v->sprite_seq.Set(SPR_EXPLOSION_SMALL_0);
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->progress = 0;
|
||||
}
|
||||
|
||||
@@ -232,6 +248,7 @@ static bool ExplosionSmallTick(EffectVehicle *v)
|
||||
delete v;
|
||||
return false;
|
||||
}
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->UpdatePositionAndViewport();
|
||||
}
|
||||
|
||||
@@ -241,6 +258,7 @@ static bool ExplosionSmallTick(EffectVehicle *v)
|
||||
static void BulldozerInit(EffectVehicle *v)
|
||||
{
|
||||
v->sprite_seq.Set(SPR_BULLDOZER_NE);
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->progress = 0;
|
||||
v->animation_state = 0;
|
||||
v->animation_substate = 0;
|
||||
@@ -292,6 +310,7 @@ static bool BulldozerTick(EffectVehicle *v)
|
||||
const BulldozerMovement *b = &_bulldozer_movement[v->animation_state];
|
||||
|
||||
v->sprite_seq.Set(SPR_BULLDOZER_NE + b->image);
|
||||
v->UpdateSpriteSeqBound();
|
||||
|
||||
v->x_pos += _inc_by_dir[b->direction].x;
|
||||
v->y_pos += _inc_by_dir[b->direction].y;
|
||||
@@ -314,6 +333,7 @@ static bool BulldozerTick(EffectVehicle *v)
|
||||
static void BubbleInit(EffectVehicle *v)
|
||||
{
|
||||
v->sprite_seq.Set(SPR_BUBBLE_GENERATE_0);
|
||||
v->UpdateSpriteSeqBound();
|
||||
v->spritenum = 0;
|
||||
v->progress = 0;
|
||||
}
|
||||
@@ -477,6 +497,7 @@ static bool BubbleTick(EffectVehicle *v)
|
||||
|
||||
if (v->spritenum == 0) {
|
||||
v->sprite_seq.seq[0].sprite++;
|
||||
v->UpdateSpriteSeqBound();
|
||||
if (v->sprite_seq.seq[0].sprite < SPR_BUBBLE_GENERATE_3) {
|
||||
v->UpdatePositionAndViewport();
|
||||
return true;
|
||||
@@ -523,6 +544,7 @@ static bool BubbleTick(EffectVehicle *v)
|
||||
v->y_pos += b->y;
|
||||
v->z_pos += b->z;
|
||||
v->sprite_seq.Set(SPR_BUBBLE_0 + b->image);
|
||||
v->UpdateSpriteSeqBound();
|
||||
|
||||
v->UpdatePositionAndViewport();
|
||||
|
||||
|
Reference in New Issue
Block a user