File diff r21719:0f172a6b8939 → r21720:231348c28655
src/effectvehicle.cpp
Show inline comments
 
@@ -43,13 +43,13 @@ static bool ChimneySmokeTick(EffectVehic
 
		if (v->cur_image != SPR_CHIMNEY_SMOKE_7) {
 
			v->cur_image++;
 
		} else {
 
			v->cur_image = SPR_CHIMNEY_SMOKE_0;
 
		}
 
		v->progress = 7;
 
		VehicleUpdatePositionAndViewport(v);
 
		v->UpdatePositionAndViewport();
 
	}
 

	
 
	return true;
 
}
 

	
 
static void SteamSmokeInit(EffectVehicle *v)
 
@@ -76,13 +76,13 @@ static bool SteamSmokeTick(EffectVehicle
 
			delete v;
 
			return false;
 
		}
 
		moved = true;
 
	}
 

	
 
	if (moved) VehicleUpdatePositionAndViewport(v);
 
	if (moved) v->UpdatePositionAndViewport();
 

	
 
	return true;
 
}
 

	
 
static void DieselSmokeInit(EffectVehicle *v)
 
{
 
@@ -93,17 +93,17 @@ static void DieselSmokeInit(EffectVehicl
 
static bool DieselSmokeTick(EffectVehicle *v)
 
{
 
	v->progress++;
 

	
 
	if ((v->progress & 3) == 0) {
 
		v->z_pos++;
 
		VehicleUpdatePositionAndViewport(v);
 
		v->UpdatePositionAndViewport();
 
	} else if ((v->progress & 7) == 1) {
 
		if (v->cur_image != SPR_DIESEL_SMOKE_5) {
 
			v->cur_image++;
 
			VehicleUpdatePositionAndViewport(v);
 
			v->UpdatePositionAndViewport();
 
		} else {
 
			delete v;
 
			return false;
 
		}
 
	}
 

	
 
@@ -121,13 +121,13 @@ static bool ElectricSparkTick(EffectVehi
 
	if (v->progress < 2) {
 
		v->progress++;
 
	} else {
 
		v->progress = 0;
 
		if (v->cur_image != SPR_ELECTRIC_SPARK_5) {
 
			v->cur_image++;
 
			VehicleUpdatePositionAndViewport(v);
 
			v->UpdatePositionAndViewport();
 
		} else {
 
			delete v;
 
			return false;
 
		}
 
	}
 

	
 
@@ -158,13 +158,13 @@ static bool SmokeTick(EffectVehicle *v)
 
			delete v;
 
			return false;
 
		}
 
		moved = true;
 
	}
 

	
 
	if (moved) VehicleUpdatePositionAndViewport(v);
 
	if (moved) v->UpdatePositionAndViewport();
 

	
 
	return true;
 
}
 

	
 
static void ExplosionLargeInit(EffectVehicle *v)
 
{
 
@@ -175,13 +175,13 @@ static void ExplosionLargeInit(EffectVeh
 
static bool ExplosionLargeTick(EffectVehicle *v)
 
{
 
	v->progress++;
 
	if ((v->progress & 3) == 0) {
 
		if (v->cur_image != SPR_EXPLOSION_LARGE_F) {
 
			v->cur_image++;
 
			VehicleUpdatePositionAndViewport(v);
 
			v->UpdatePositionAndViewport();
 
		} else {
 
			delete v;
 
			return false;
 
		}
 
	}
 

	
 
@@ -200,13 +200,13 @@ static bool BreakdownSmokeTick(EffectVeh
 
	if ((v->progress & 7) == 0) {
 
		if (v->cur_image != SPR_BREAKDOWN_SMOKE_3) {
 
			v->cur_image++;
 
		} else {
 
			v->cur_image = SPR_BREAKDOWN_SMOKE_0;
 
		}
 
		VehicleUpdatePositionAndViewport(v);
 
		v->UpdatePositionAndViewport();
 
	}
 

	
 
	v->animation_state--;
 
	if (v->animation_state == 0) {
 
		delete v;
 
		return false;
 
@@ -224,13 +224,13 @@ static void ExplosionSmallInit(EffectVeh
 
static bool ExplosionSmallTick(EffectVehicle *v)
 
{
 
	v->progress++;
 
	if ((v->progress & 3) == 0) {
 
		if (v->cur_image != SPR_EXPLOSION_SMALL_B) {
 
			v->cur_image++;
 
			VehicleUpdatePositionAndViewport(v);
 
			v->UpdatePositionAndViewport();
 
		} else {
 
			delete v;
 
			return false;
 
		}
 
	}
 

	
 
@@ -301,13 +301,13 @@ static bool BulldozerTick(EffectVehicle 
 
			v->animation_state++;
 
			if (v->animation_state == lengthof(_bulldozer_movement)) {
 
				delete v;
 
				return false;
 
			}
 
		}
 
		VehicleUpdatePositionAndViewport(v);
 
		v->UpdatePositionAndViewport();
 
	}
 

	
 
	return true;
 
}
 

	
 
static void BubbleInit(EffectVehicle *v)
 
@@ -474,13 +474,13 @@ static bool BubbleTick(EffectVehicle *v)
 
	v->progress++;
 
	if ((v->progress & 3) != 0) return true;
 

	
 
	if (v->spritenum == 0) {
 
		v->cur_image++;
 
		if (v->cur_image < SPR_BUBBLE_GENERATE_3) {
 
			VehicleUpdatePositionAndViewport(v);
 
			v->UpdatePositionAndViewport();
 
			return true;
 
		}
 
		if (v->animation_substate != 0) {
 
			v->spritenum = GB(Random(), 0, 2) + 1;
 
		} else {
 
			v->spritenum = 6;
 
@@ -520,13 +520,13 @@ static bool BubbleTick(EffectVehicle *v)
 

	
 
	v->x_pos += b->x;
 
	v->y_pos += b->y;
 
	v->z_pos += b->z;
 
	v->cur_image = SPR_BUBBLE_0 + b->image;
 

	
 
	VehicleUpdatePositionAndViewport(v);
 
	v->UpdatePositionAndViewport();
 

	
 
	return true;
 
}
 

	
 

	
 
typedef void EffectInitProc(EffectVehicle *v);
 
@@ -604,13 +604,13 @@ EffectVehicle *CreateEffectVehicle(int x
 
	v->tile = 0;
 
	v->UpdateDeltaXY(INVALID_DIR);
 
	v->vehstatus = VS_UNCLICKABLE;
 

	
 
	_effect_init_procs[type](v);
 

	
 
	VehicleUpdatePositionAndViewport(v);
 
	v->UpdatePositionAndViewport();
 

	
 
	return v;
 
}
 

	
 
/**
 
 * Create an effect vehicle above a particular location.