Mercurial > hg > openttd
annotate src/effectvehicle.cpp @ 20307:93d7e37bd666 draft
(svn r25259) -Codechange: track capacities and usage of links
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sun, 19 May 2013 14:22:04 +0000 |
parents | 0dba7f49118c |
children |
rev | line source |
---|---|
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
2 |
12778
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
11978
diff
changeset
|
3 /* |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
11978
diff
changeset
|
4 * This file is part of OpenTTD. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
11978
diff
changeset
|
5 * 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. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
11978
diff
changeset
|
6 * 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. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
11978
diff
changeset
|
7 * 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/>. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
11978
diff
changeset
|
8 */ |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
11978
diff
changeset
|
9 |
9111
d48433370037
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium <rubidium@openttd.org>
parents:
9009
diff
changeset
|
10 /** @file effectvehicle.cpp Implementation of everything generic to vehicles. */ |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
11 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
12 #include "stdafx.h" |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
13 #include "landscape.h" |
13186
afdfdda87cd4
(svn r17693) -Cleanup: remove some unneeded includes
rubidium <rubidium@openttd.org>
parents:
12826
diff
changeset
|
14 #include "core/random_func.hpp" |
afdfdda87cd4
(svn r17693) -Cleanup: remove some unneeded includes
rubidium <rubidium@openttd.org>
parents:
12826
diff
changeset
|
15 #include "industry_map.h" |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
16 #include "vehicle_func.h" |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
17 #include "sound_func.h" |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
18 #include "animated_tile_func.h" |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
19 #include "effectvehicle_func.h" |
14258
a899d4e5ee1a
(svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
20 #include "effectvehicle_base.h" |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
21 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
22 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
23 static void ChimneySmokeInit(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
24 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
25 uint32 r = Random(); |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
26 v->cur_image = SPR_CHIMNEY_SMOKE_0 + GB(r, 0, 3); |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
27 v->progress = GB(r, 16, 3); |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
28 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
29 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
30 static bool ChimneySmokeTick(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
31 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
32 if (v->progress > 0) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
33 v->progress--; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
34 } else { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
35 TileIndex tile = TileVirtXY(v->x_pos, v->y_pos); |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
36 if (!IsTileType(tile, MP_INDUSTRY)) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
37 delete v; |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
38 return false; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
39 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
40 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
41 if (v->cur_image != SPR_CHIMNEY_SMOKE_7) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
42 v->cur_image++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
43 } else { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
44 v->cur_image = SPR_CHIMNEY_SMOKE_0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
45 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
46 v->progress = 7; |
18864
c8717ac828d0
(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible
truebrain <truebrain@openttd.org>
parents:
18255
diff
changeset
|
47 VehicleUpdatePositionAndViewport(v); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
48 } |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
49 |
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
50 return true; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
51 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
52 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
53 static void SteamSmokeInit(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
54 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
55 v->cur_image = SPR_STEAM_SMOKE_0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
56 v->progress = 12; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
57 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
58 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
59 static bool SteamSmokeTick(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
60 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
61 bool moved = false; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
62 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
63 v->progress++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
64 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
65 if ((v->progress & 7) == 0) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
66 v->z_pos++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
67 moved = true; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
68 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
69 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
70 if ((v->progress & 0xF) == 4) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
71 if (v->cur_image != SPR_STEAM_SMOKE_4) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
72 v->cur_image++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
73 } else { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
74 delete v; |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
75 return false; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
76 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
77 moved = true; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
78 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
79 |
18864
c8717ac828d0
(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible
truebrain <truebrain@openttd.org>
parents:
18255
diff
changeset
|
80 if (moved) VehicleUpdatePositionAndViewport(v); |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
81 |
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
82 return true; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
83 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
84 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
85 static void DieselSmokeInit(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
86 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
87 v->cur_image = SPR_DIESEL_SMOKE_0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
88 v->progress = 0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
89 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
90 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
91 static bool DieselSmokeTick(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
92 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
93 v->progress++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
94 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
95 if ((v->progress & 3) == 0) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
96 v->z_pos++; |
18864
c8717ac828d0
(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible
truebrain <truebrain@openttd.org>
parents:
18255
diff
changeset
|
97 VehicleUpdatePositionAndViewport(v); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
98 } else if ((v->progress & 7) == 1) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
99 if (v->cur_image != SPR_DIESEL_SMOKE_5) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
100 v->cur_image++; |
18864
c8717ac828d0
(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible
truebrain <truebrain@openttd.org>
parents:
18255
diff
changeset
|
101 VehicleUpdatePositionAndViewport(v); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
102 } else { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
103 delete v; |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
104 return false; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
105 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
106 } |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
107 |
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
108 return true; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
109 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
110 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
111 static void ElectricSparkInit(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
112 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
113 v->cur_image = SPR_ELECTRIC_SPARK_0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
114 v->progress = 1; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
115 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
116 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
117 static bool ElectricSparkTick(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
118 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
119 if (v->progress < 2) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
120 v->progress++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
121 } else { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
122 v->progress = 0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
123 if (v->cur_image != SPR_ELECTRIC_SPARK_5) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
124 v->cur_image++; |
18864
c8717ac828d0
(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible
truebrain <truebrain@openttd.org>
parents:
18255
diff
changeset
|
125 VehicleUpdatePositionAndViewport(v); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
126 } else { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
127 delete v; |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
128 return false; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
129 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
130 } |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
131 |
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
132 return true; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
133 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
134 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
135 static void SmokeInit(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
136 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
137 v->cur_image = SPR_SMOKE_0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
138 v->progress = 12; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
139 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
140 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
141 static bool SmokeTick(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
142 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
143 bool moved = false; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
144 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
145 v->progress++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
146 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
147 if ((v->progress & 3) == 0) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
148 v->z_pos++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
149 moved = true; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
150 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
151 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
152 if ((v->progress & 0xF) == 4) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
153 if (v->cur_image != SPR_SMOKE_4) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
154 v->cur_image++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
155 } else { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
156 delete v; |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
157 return false; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
158 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
159 moved = true; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
160 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
161 |
18864
c8717ac828d0
(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible
truebrain <truebrain@openttd.org>
parents:
18255
diff
changeset
|
162 if (moved) VehicleUpdatePositionAndViewport(v); |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
163 |
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
164 return true; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
165 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
166 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
167 static void ExplosionLargeInit(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
168 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
169 v->cur_image = SPR_EXPLOSION_LARGE_0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
170 v->progress = 0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
171 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
172 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
173 static bool ExplosionLargeTick(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
174 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
175 v->progress++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
176 if ((v->progress & 3) == 0) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
177 if (v->cur_image != SPR_EXPLOSION_LARGE_F) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
178 v->cur_image++; |
18864
c8717ac828d0
(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible
truebrain <truebrain@openttd.org>
parents:
18255
diff
changeset
|
179 VehicleUpdatePositionAndViewport(v); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
180 } else { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
181 delete v; |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
182 return false; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
183 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
184 } |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
185 |
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
186 return true; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
187 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
188 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
189 static void BreakdownSmokeInit(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
190 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
191 v->cur_image = SPR_BREAKDOWN_SMOKE_0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
192 v->progress = 0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
193 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
194 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
195 static bool BreakdownSmokeTick(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
196 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
197 v->progress++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
198 if ((v->progress & 7) == 0) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
199 if (v->cur_image != SPR_BREAKDOWN_SMOKE_3) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
200 v->cur_image++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
201 } else { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
202 v->cur_image = SPR_BREAKDOWN_SMOKE_0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
203 } |
18864
c8717ac828d0
(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible
truebrain <truebrain@openttd.org>
parents:
18255
diff
changeset
|
204 VehicleUpdatePositionAndViewport(v); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
205 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
206 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
207 v->animation_state--; |
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
208 if (v->animation_state == 0) { |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
209 delete v; |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
210 return false; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
211 } |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
212 |
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
213 return true; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
214 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
215 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
216 static void ExplosionSmallInit(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
217 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
218 v->cur_image = SPR_EXPLOSION_SMALL_0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
219 v->progress = 0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
220 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
221 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
222 static bool ExplosionSmallTick(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
223 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
224 v->progress++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
225 if ((v->progress & 3) == 0) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
226 if (v->cur_image != SPR_EXPLOSION_SMALL_B) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
227 v->cur_image++; |
18864
c8717ac828d0
(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible
truebrain <truebrain@openttd.org>
parents:
18255
diff
changeset
|
228 VehicleUpdatePositionAndViewport(v); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
229 } else { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
230 delete v; |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
231 return false; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
232 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
233 } |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
234 |
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
235 return true; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
236 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
237 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
238 static void BulldozerInit(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
239 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
240 v->cur_image = SPR_BULLDOZER_NE; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
241 v->progress = 0; |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
242 v->animation_state = 0; |
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
243 v->animation_substate = 0; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
244 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
245 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
246 struct BulldozerMovement { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
247 byte direction:2; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
248 byte image:2; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
249 byte duration:3; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
250 }; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
251 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
252 static const BulldozerMovement _bulldozer_movement[] = { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
253 { 0, 0, 4 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
254 { 3, 3, 4 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
255 { 2, 2, 7 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
256 { 0, 2, 7 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
257 { 1, 1, 3 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
258 { 2, 2, 7 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
259 { 0, 2, 7 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
260 { 1, 1, 3 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
261 { 2, 2, 7 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
262 { 0, 2, 7 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
263 { 3, 3, 6 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
264 { 2, 2, 6 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
265 { 1, 1, 7 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
266 { 3, 1, 7 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
267 { 0, 0, 3 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
268 { 1, 1, 7 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
269 { 3, 1, 7 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
270 { 0, 0, 3 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
271 { 1, 1, 7 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
272 { 3, 1, 7 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
273 }; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
274 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
275 static const struct { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
276 int8 x; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
277 int8 y; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
278 } _inc_by_dir[] = { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
279 { -1, 0 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
280 { 0, 1 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
281 { 1, 0 }, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
282 { 0, -1 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
283 }; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
284 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
285 static bool BulldozerTick(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
286 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
287 v->progress++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
288 if ((v->progress & 7) == 0) { |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
289 const BulldozerMovement *b = &_bulldozer_movement[v->animation_state]; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
290 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
291 v->cur_image = SPR_BULLDOZER_NE + b->image; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
292 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
293 v->x_pos += _inc_by_dir[b->direction].x; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
294 v->y_pos += _inc_by_dir[b->direction].y; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
295 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
296 v->animation_substate++; |
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
297 if (v->animation_substate >= b->duration) { |
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
298 v->animation_substate = 0; |
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
299 v->animation_state++; |
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
300 if (v->animation_state == lengthof(_bulldozer_movement)) { |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
301 delete v; |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
302 return false; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
303 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
304 } |
18864
c8717ac828d0
(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible
truebrain <truebrain@openttd.org>
parents:
18255
diff
changeset
|
305 VehicleUpdatePositionAndViewport(v); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
306 } |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
307 |
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
308 return true; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
309 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
310 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
311 static void BubbleInit(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
312 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
313 v->cur_image = SPR_BUBBLE_GENERATE_0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
314 v->spritenum = 0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
315 v->progress = 0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
316 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
317 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
318 struct BubbleMovement { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
319 int8 x:4; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
320 int8 y:4; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
321 int8 z:4; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
322 byte image:4; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
323 }; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
324 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
325 #define MK(x, y, z, i) { x, y, z, i } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
326 #define ME(i) { i, 4, 0, 0 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
327 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
328 static const BubbleMovement _bubble_float_sw[] = { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
329 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
330 MK(1, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
331 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
332 MK(1, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
333 ME(1) |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
334 }; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
335 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
336 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
337 static const BubbleMovement _bubble_float_ne[] = { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
338 MK( 0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
339 MK(-1, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
340 MK( 0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
341 MK(-1, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
342 ME(1) |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
343 }; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
344 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
345 static const BubbleMovement _bubble_float_se[] = { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
346 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
347 MK(0, 1, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
348 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
349 MK(0, 1, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
350 ME(1) |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
351 }; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
352 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
353 static const BubbleMovement _bubble_float_nw[] = { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
354 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
355 MK(0, -1, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
356 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
357 MK(0, -1, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
358 ME(1) |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
359 }; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
360 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
361 static const BubbleMovement _bubble_burst[] = { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
362 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
363 MK(0, 0, 1, 7), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
364 MK(0, 0, 1, 8), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
365 MK(0, 0, 1, 9), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
366 ME(0) |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
367 }; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
368 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
369 static const BubbleMovement _bubble_absorb[] = { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
370 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
371 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
372 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
373 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
374 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
375 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
376 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
377 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
378 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
379 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
380 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
381 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
382 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
383 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
384 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
385 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
386 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
387 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
388 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
389 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
390 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
391 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
392 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
393 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
394 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
395 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
396 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
397 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
398 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
399 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
400 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
401 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
402 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
403 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
404 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
405 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
406 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
407 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
408 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
409 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
410 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
411 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
412 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
413 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
414 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
415 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
416 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
417 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
418 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
419 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
420 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
421 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
422 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
423 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
424 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
425 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
426 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
427 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
428 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
429 MK(0, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
430 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
431 MK(0, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
432 MK(2, 1, 3, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
433 MK(1, 1, 3, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
434 MK(2, 1, 3, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
435 MK(1, 1, 3, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
436 MK(2, 1, 3, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
437 MK(1, 1, 3, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
438 MK(2, 1, 3, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
439 MK(1, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
440 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
441 MK(1, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
442 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
443 MK(1, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
444 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
445 MK(1, 0, 1, 1), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
446 MK(0, 0, 1, 0), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
447 MK(1, 0, 1, 2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
448 ME(2), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
449 MK(0, 0, 0, 0xA), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
450 MK(0, 0, 0, 0xB), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
451 MK(0, 0, 0, 0xC), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
452 MK(0, 0, 0, 0xD), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
453 MK(0, 0, 0, 0xE), |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
454 ME(0) |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
455 }; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
456 #undef ME |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
457 #undef MK |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
458 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
459 static const BubbleMovement * const _bubble_movement[] = { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
460 _bubble_float_sw, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
461 _bubble_float_ne, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
462 _bubble_float_se, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
463 _bubble_float_nw, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
464 _bubble_burst, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
465 _bubble_absorb, |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
466 }; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
467 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
468 static bool BubbleTick(EffectVehicle *v) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
469 { |
10633
d9df294b8547
(svn r14931) -Fix [FS#2512]: the "animation state" of the bubbles was stored in a variable that was not stored in the savegame. Using a variable that gets saved in the savegame solves the desync and makes it a bit clearer.
rubidium <rubidium@openttd.org>
parents:
10571
diff
changeset
|
470 uint anim_state; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
471 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
472 v->progress++; |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
473 if ((v->progress & 3) != 0) return true; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
474 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
475 if (v->spritenum == 0) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
476 v->cur_image++; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
477 if (v->cur_image < SPR_BUBBLE_GENERATE_3) { |
18864
c8717ac828d0
(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible
truebrain <truebrain@openttd.org>
parents:
18255
diff
changeset
|
478 VehicleUpdatePositionAndViewport(v); |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
479 return true; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
480 } |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
481 if (v->animation_substate != 0) { |
9955
c2dfac401633
(svn r14110) -Fix: desyncs due to bubbles in toyland
glx <glx@openttd.org>
parents:
9428
diff
changeset
|
482 v->spritenum = GB(Random(), 0, 2) + 1; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
483 } else { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
484 v->spritenum = 6; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
485 } |
10633
d9df294b8547
(svn r14931) -Fix [FS#2512]: the "animation state" of the bubbles was stored in a variable that was not stored in the savegame. Using a variable that gets saved in the savegame solves the desync and makes it a bit clearer.
rubidium <rubidium@openttd.org>
parents:
10571
diff
changeset
|
486 anim_state = 0; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
487 } else { |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
488 anim_state = v->animation_state + 1; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
489 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
490 |
10633
d9df294b8547
(svn r14931) -Fix [FS#2512]: the "animation state" of the bubbles was stored in a variable that was not stored in the savegame. Using a variable that gets saved in the savegame solves the desync and makes it a bit clearer.
rubidium <rubidium@openttd.org>
parents:
10571
diff
changeset
|
491 const BubbleMovement *b = &_bubble_movement[v->spritenum - 1][anim_state]; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
492 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
493 if (b->y == 4 && b->x == 0) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
494 delete v; |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
495 return false; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
496 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
497 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
498 if (b->y == 4 && b->x == 1) { |
9955
c2dfac401633
(svn r14110) -Fix: desyncs due to bubbles in toyland
glx <glx@openttd.org>
parents:
9428
diff
changeset
|
499 if (v->z_pos > 180 || Chance16I(1, 96, Random())) { |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
500 v->spritenum = 5; |
19913
f4e2c852270b
(svn r24846) -Add: Advanced settings to disable certain sound effects.
frosch <frosch@openttd.org>
parents:
18891
diff
changeset
|
501 if (_settings_client.sound.ambient) SndPlayVehicleFx(SND_2F_POP, v); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
502 } |
10633
d9df294b8547
(svn r14931) -Fix [FS#2512]: the "animation state" of the bubbles was stored in a variable that was not stored in the savegame. Using a variable that gets saved in the savegame solves the desync and makes it a bit clearer.
rubidium <rubidium@openttd.org>
parents:
10571
diff
changeset
|
503 anim_state = 0; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
504 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
505 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
506 if (b->y == 4 && b->x == 2) { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
507 TileIndex tile; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
508 |
10633
d9df294b8547
(svn r14931) -Fix [FS#2512]: the "animation state" of the bubbles was stored in a variable that was not stored in the savegame. Using a variable that gets saved in the savegame solves the desync and makes it a bit clearer.
rubidium <rubidium@openttd.org>
parents:
10571
diff
changeset
|
509 anim_state++; |
19913
f4e2c852270b
(svn r24846) -Add: Advanced settings to disable certain sound effects.
frosch <frosch@openttd.org>
parents:
18891
diff
changeset
|
510 if (_settings_client.sound.ambient) SndPlayVehicleFx(SND_31_EXTRACT, v); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
511 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
512 tile = TileVirtXY(v->x_pos, v->y_pos); |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
513 if (IsTileType(tile, MP_INDUSTRY) && GetIndustryGfx(tile) == GFX_BUBBLE_CATCHER) AddAnimatedTile(tile); |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
514 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
515 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
516 v->animation_state = anim_state; |
10633
d9df294b8547
(svn r14931) -Fix [FS#2512]: the "animation state" of the bubbles was stored in a variable that was not stored in the savegame. Using a variable that gets saved in the savegame solves the desync and makes it a bit clearer.
rubidium <rubidium@openttd.org>
parents:
10571
diff
changeset
|
517 b = &_bubble_movement[v->spritenum - 1][anim_state]; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
518 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
519 v->x_pos += b->x; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
520 v->y_pos += b->y; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
521 v->z_pos += b->z; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
522 v->cur_image = SPR_BUBBLE_0 + b->image; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
523 |
18864
c8717ac828d0
(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible
truebrain <truebrain@openttd.org>
parents:
18255
diff
changeset
|
524 VehicleUpdatePositionAndViewport(v); |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
525 |
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
526 return true; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
527 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
528 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
529 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
530 typedef void EffectInitProc(EffectVehicle *v); |
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
531 typedef bool EffectTickProc(EffectVehicle *v); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
532 |
17723
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
533 /** Functions to initialise an effect vehicle after construction. */ |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
534 static EffectInitProc * const _effect_init_procs[] = { |
17723
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
535 ChimneySmokeInit, // EV_CHIMNEY_SMOKE |
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
536 SteamSmokeInit, // EV_STEAM_SMOKE |
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
537 DieselSmokeInit, // EV_DIESEL_SMOKE |
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
538 ElectricSparkInit, // EV_ELECTRIC_SPARK |
17725
2bb554b0fa09
(svn r22505) -Add: Separate EffectVehicleTypes for broken aircraft and smoke at copper ore mine, to make them distinguishable from each other and from smoke due to disasters. (only affects newly spawned effects)
frosch <frosch@openttd.org>
parents:
17724
diff
changeset
|
539 SmokeInit, // EV_CRASH_SMOKE |
17723
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
540 ExplosionLargeInit, // EV_EXPLOSION_LARGE |
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
541 BreakdownSmokeInit, // EV_BREAKDOWN_SMOKE |
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
542 ExplosionSmallInit, // EV_EXPLOSION_SMALL |
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
543 BulldozerInit, // EV_BULLDOZER |
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
544 BubbleInit, // EV_BUBBLE |
17725
2bb554b0fa09
(svn r22505) -Add: Separate EffectVehicleTypes for broken aircraft and smoke at copper ore mine, to make them distinguishable from each other and from smoke due to disasters. (only affects newly spawned effects)
frosch <frosch@openttd.org>
parents:
17724
diff
changeset
|
545 SmokeInit, // EV_BREAKDOWN_SMOKE_AIRCRAFT |
2bb554b0fa09
(svn r22505) -Add: Separate EffectVehicleTypes for broken aircraft and smoke at copper ore mine, to make them distinguishable from each other and from smoke due to disasters. (only affects newly spawned effects)
frosch <frosch@openttd.org>
parents:
17724
diff
changeset
|
546 SmokeInit, // EV_COPPER_MINE_SMOKE |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
547 }; |
17724
f7682d8d5e9a
(svn r22504) -Codechange: Add EV_END and use it to check the lengths of _effect_init_procs and _effect_tick_procs.
frosch <frosch@openttd.org>
parents:
17723
diff
changeset
|
548 assert_compile(lengthof(_effect_init_procs) == EV_END); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
549 |
19968
0dba7f49118c
(svn r24900) -Fix [FS#5389]: Comments with typos (most fixes supplied by Eagle_rainbow)
planetmaker <planetmaker@openttd.org>
parents:
19913
diff
changeset
|
550 /** Functions for controlling effect vehicles at each tick. */ |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
551 static EffectTickProc * const _effect_tick_procs[] = { |
17723
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
552 ChimneySmokeTick, // EV_CHIMNEY_SMOKE |
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
553 SteamSmokeTick, // EV_STEAM_SMOKE |
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
554 DieselSmokeTick, // EV_DIESEL_SMOKE |
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
555 ElectricSparkTick, // EV_ELECTRIC_SPARK |
17725
2bb554b0fa09
(svn r22505) -Add: Separate EffectVehicleTypes for broken aircraft and smoke at copper ore mine, to make them distinguishable from each other and from smoke due to disasters. (only affects newly spawned effects)
frosch <frosch@openttd.org>
parents:
17724
diff
changeset
|
556 SmokeTick, // EV_CRASH_SMOKE |
17723
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
557 ExplosionLargeTick, // EV_EXPLOSION_LARGE |
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
558 BreakdownSmokeTick, // EV_BREAKDOWN_SMOKE |
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
559 ExplosionSmallTick, // EV_EXPLOSION_SMALL |
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
560 BulldozerTick, // EV_BULLDOZER |
99fb3fa73940
(svn r22503) -Doc: EffectVehicleType.
frosch <frosch@openttd.org>
parents:
17640
diff
changeset
|
561 BubbleTick, // EV_BUBBLE |
17725
2bb554b0fa09
(svn r22505) -Add: Separate EffectVehicleTypes for broken aircraft and smoke at copper ore mine, to make them distinguishable from each other and from smoke due to disasters. (only affects newly spawned effects)
frosch <frosch@openttd.org>
parents:
17724
diff
changeset
|
562 SmokeTick, // EV_BREAKDOWN_SMOKE_AIRCRAFT |
2bb554b0fa09
(svn r22505) -Add: Separate EffectVehicleTypes for broken aircraft and smoke at copper ore mine, to make them distinguishable from each other and from smoke due to disasters. (only affects newly spawned effects)
frosch <frosch@openttd.org>
parents:
17724
diff
changeset
|
563 SmokeTick, // EV_COPPER_MINE_SMOKE |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
564 }; |
17724
f7682d8d5e9a
(svn r22504) -Codechange: Add EV_END and use it to check the lengths of _effect_init_procs and _effect_tick_procs.
frosch <frosch@openttd.org>
parents:
17723
diff
changeset
|
565 assert_compile(lengthof(_effect_tick_procs) == EV_END); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
566 |
17726
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
567 /** Transparency options affecting the effects. */ |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
568 static const TransparencyOption _effect_transparency_options[] = { |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
569 TO_INDUSTRIES, // EV_CHIMNEY_SMOKE |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
570 TO_INVALID, // EV_STEAM_SMOKE |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
571 TO_INVALID, // EV_DIESEL_SMOKE |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
572 TO_INVALID, // EV_ELECTRIC_SPARK |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
573 TO_INVALID, // EV_CRASH_SMOKE |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
574 TO_INVALID, // EV_EXPLOSION_LARGE |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
575 TO_INVALID, // EV_BREAKDOWN_SMOKE |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
576 TO_INVALID, // EV_EXPLOSION_SMALL |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
577 TO_INVALID, // EV_BULLDOZER |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
578 TO_INDUSTRIES, // EV_BUBBLE |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
579 TO_INVALID, // EV_BREAKDOWN_SMOKE_AIRCRAFT |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
580 TO_INDUSTRIES, // EV_COPPER_MINE_SMOKE |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
581 }; |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
582 assert_compile(lengthof(_effect_transparency_options) == EV_END); |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
583 |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
584 |
17640
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
585 /** |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
586 * Create an effect vehicle at a particular location. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
587 * @param x The x location on the map. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
588 * @param y The y location on the map. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
589 * @param z The z location on the map. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
590 * @param type The type of effect vehicle. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
591 * @return The effect vehicle. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
592 */ |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
593 EffectVehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicleType type) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
594 { |
10634
66515fd11ca9
(svn r14933) -Codechange: check the whether a pool item can be constructed instead of trying to make it and check for NULL.
rubidium <rubidium@openttd.org>
parents:
10633
diff
changeset
|
595 if (!Vehicle::CanAllocateItem()) return NULL; |
66515fd11ca9
(svn r14933) -Codechange: check the whether a pool item can be constructed instead of trying to make it and check for NULL.
rubidium <rubidium@openttd.org>
parents:
10633
diff
changeset
|
596 |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
597 EffectVehicle *v = new EffectVehicle(); |
10634
66515fd11ca9
(svn r14933) -Codechange: check the whether a pool item can be constructed instead of trying to make it and check for NULL.
rubidium <rubidium@openttd.org>
parents:
10633
diff
changeset
|
598 v->subtype = type; |
66515fd11ca9
(svn r14933) -Codechange: check the whether a pool item can be constructed instead of trying to make it and check for NULL.
rubidium <rubidium@openttd.org>
parents:
10633
diff
changeset
|
599 v->x_pos = x; |
66515fd11ca9
(svn r14933) -Codechange: check the whether a pool item can be constructed instead of trying to make it and check for NULL.
rubidium <rubidium@openttd.org>
parents:
10633
diff
changeset
|
600 v->y_pos = y; |
66515fd11ca9
(svn r14933) -Codechange: check the whether a pool item can be constructed instead of trying to make it and check for NULL.
rubidium <rubidium@openttd.org>
parents:
10633
diff
changeset
|
601 v->z_pos = z; |
66515fd11ca9
(svn r14933) -Codechange: check the whether a pool item can be constructed instead of trying to make it and check for NULL.
rubidium <rubidium@openttd.org>
parents:
10633
diff
changeset
|
602 v->tile = 0; |
66515fd11ca9
(svn r14933) -Codechange: check the whether a pool item can be constructed instead of trying to make it and check for NULL.
rubidium <rubidium@openttd.org>
parents:
10633
diff
changeset
|
603 v->UpdateDeltaXY(INVALID_DIR); |
66515fd11ca9
(svn r14933) -Codechange: check the whether a pool item can be constructed instead of trying to make it and check for NULL.
rubidium <rubidium@openttd.org>
parents:
10633
diff
changeset
|
604 v->vehstatus = VS_UNCLICKABLE; |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
605 |
10634
66515fd11ca9
(svn r14933) -Codechange: check the whether a pool item can be constructed instead of trying to make it and check for NULL.
rubidium <rubidium@openttd.org>
parents:
10633
diff
changeset
|
606 _effect_init_procs[type](v); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
607 |
18864
c8717ac828d0
(svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible
truebrain <truebrain@openttd.org>
parents:
18255
diff
changeset
|
608 VehicleUpdatePositionAndViewport(v); |
10634
66515fd11ca9
(svn r14933) -Codechange: check the whether a pool item can be constructed instead of trying to make it and check for NULL.
rubidium <rubidium@openttd.org>
parents:
10633
diff
changeset
|
609 |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
610 return v; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
611 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
612 |
17640
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
613 /** |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
614 * Create an effect vehicle above a particular location. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
615 * @param x The x location on the map. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
616 * @param y The y location on the map. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
617 * @param z The offset from the ground. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
618 * @param type The type of effect vehicle. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
619 * @return The effect vehicle. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
620 */ |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
621 EffectVehicle *CreateEffectVehicleAbove(int x, int y, int z, EffectVehicleType type) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
622 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
623 int safe_x = Clamp(x, 0, MapMaxX() * TILE_SIZE); |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
624 int safe_y = Clamp(y, 0, MapMaxY() * TILE_SIZE); |
18255
b3cb40aab91b
(svn r23091) -Codechange: rename some Get*Z functions to Get*PixelZ functions if they return the Z in pixels (like TilePixelHeight)
rubidium <rubidium@openttd.org>
parents:
17726
diff
changeset
|
625 return CreateEffectVehicle(x, y, GetSlopePixelZ(safe_x, safe_y) + z, type); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
626 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
627 |
17640
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
628 /** |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
629 * Create an effect vehicle above a particular vehicle. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
630 * @param v The vehicle to base the position on. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
631 * @param x The x offset to the vehicle. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
632 * @param y The y offset to the vehicle. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
633 * @param z The z offset to the vehicle. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
634 * @param type The type of effect vehicle. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
635 * @return The effect vehicle. |
99d6211b8c36
(svn r22411) -Document: another bunch of bits
rubidium <rubidium@openttd.org>
parents:
14258
diff
changeset
|
636 */ |
11978
2e291154df46
(svn r16384) -Codechange: move u.effect to EffectVehicle
rubidium <rubidium@openttd.org>
parents:
11970
diff
changeset
|
637 EffectVehicle *CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVehicleType type) |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
638 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
639 return CreateEffectVehicle(v->x_pos + x, v->y_pos + y, v->z_pos + z, type); |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
640 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
641 |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
642 bool EffectVehicle::Tick() |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
643 { |
11970
2286db6ac0bb
(svn r16376) -Codechange: Vehicle::Tick() now returns false if the vehicle was deleted
smatz <smatz@openttd.org>
parents:
11326
diff
changeset
|
644 return _effect_tick_procs[this->subtype](this); |
9009
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
645 } |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
646 |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
647 void EffectVehicle::UpdateDeltaXY(Direction direction) |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
648 { |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
649 this->x_offs = 0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
650 this->y_offs = 0; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
651 this->x_extent = 1; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
652 this->y_extent = 1; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
653 this->z_extent = 1; |
870efbdb988d
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium <rubidium@openttd.org>
parents:
diff
changeset
|
654 } |
17726
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
655 |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
656 /** |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
657 * Determines the transparency option affecting the effect. |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
658 * @return Transparency option, or TO_INVALID if none. |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
659 */ |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
660 TransparencyOption EffectVehicle::GetTransparencyOption() const |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
661 { |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
662 return _effect_transparency_options[this->subtype]; |
7ed1b225f4c2
(svn r22506) -Feature [FS#4625]: Make the transparency options for industries also affect the effect vehicles created by industries.
frosch <frosch@openttd.org>
parents:
17725
diff
changeset
|
663 } |