author | skidd13 |
Mon, 16 Jun 2008 17:10:55 +0000 | |
changeset 10981 | 20a58e431c29 |
parent 10792 | 95b6eb9fcc9e |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
10429
1b99254f9607
(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
parents:
10272
diff
changeset
|
3 |
/** @file effectvehicle.cpp Implementation of everything generic to vehicles. */ |
6919
339210ecccd3
(svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents:
6676
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1881
diff
changeset
|
6 |
#include "openttd.h" |
3957
3c39694becd2
(svn r5116) Move the overly generic GetDepotDirection() from a header to its only consumer
tron
parents:
3953
diff
changeset
|
7 |
#include "road_map.h" |
3959 | 8 |
#include "roadveh.h" |
3961
e2783f244ac6
(svn r5120) Add IsShipInDepot{Stopped,}() and remove some redundant checks
tron
parents:
3959
diff
changeset
|
9 |
#include "ship.h" |
1349
07514c2cc6d1
(svn r1853) Move spritecache function declarations into a header of their own and use SpriteID as parameter type where appropriate
tron
parents:
1328
diff
changeset
|
10 |
#include "spritecache.h" |
8615
6b91ca653bad
(svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents:
8612
diff
changeset
|
11 |
#include "tile_cmd.h" |
6949
72d11a1e1e60
(svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents:
6940
diff
changeset
|
12 |
#include "landscape.h" |
7476
7f086e4b2a76
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
7451
diff
changeset
|
13 |
#include "timetable.h" |
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8710
diff
changeset
|
14 |
#include "viewport_func.h" |
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8710
diff
changeset
|
15 |
#include "gfx_func.h" |
9259
088d3649dd4f
(svn r12459) -Codechange: split news.h into news_type.h and news_func.h.
rubidium
parents:
9232
diff
changeset
|
16 |
#include "news_func.h" |
8612
6414fc21c2f3
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8610
diff
changeset
|
17 |
#include "command_func.h" |
0 | 18 |
#include "saveload.h" |
8750
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8741
diff
changeset
|
19 |
#include "player_func.h" |
1601
9fd461d00287
(svn r2105) -Codechange: Added a cache for the first vehicle of a chain to increase performance, especially with many long trains
celestar
parents:
1600
diff
changeset
|
20 |
#include "debug.h" |
1752
cdbfb2f23e72
(svn r2256) - Fix: Trains cannot find a depot when they are in a tunnel. (glx)
matthijs
parents:
1735
diff
changeset
|
21 |
#include "vehicle_gui.h" |
8599
b609cdeeff3f
(svn r11664) -Codechange: use more specific ("rail_type.h" instead of "rail.h" that includes way more than only "rail_type.h") includes at some places.
rubidium
parents:
8577
diff
changeset
|
22 |
#include "rail_type.h" |
2676
2ba71e034d97
(svn r3218) -Feature: Multiheaded train engines will now stay in the same train
bjarni
parents:
2666
diff
changeset
|
23 |
#include "train.h" |
4662
a20121e5442b
(svn r6552) -Feature: [depot window] added a "autoreplace all vehicles in depot" button
bjarni
parents:
4659
diff
changeset
|
24 |
#include "aircraft.h" |
3428
62682d91b4cd
(svn r4256) - Codechange: Replace lone map access in vehicle.c with its map accessor.
peter1138
parents:
3422
diff
changeset
|
25 |
#include "industry_map.h" |
3404
3ac4f7fedfb5
(svn r4215) -Codechange: Renamed *RoadStation* functions to *RoadStop* and moved them to station_map.h to keep consistency
celestar
parents:
3393
diff
changeset
|
26 |
#include "station_map.h" |
3957
3c39694becd2
(svn r5116) Move the overly generic GetDepotDirection() from a header to its only consumer
tron
parents:
3953
diff
changeset
|
27 |
#include "water_map.h" |
4130
9c293b171871
(svn r5483) -Fix: [YAPF] desync - for MP games invalidate YAPF cache on every tick to keep it exactly the same on server and clients (it doesn't fix the real source of the problem, but should solve it). Thanks TrueLight for hunting this bug.
KUDr
parents:
4124
diff
changeset
|
28 |
#include "yapf/yapf.h" |
5968
eecf6681445e
(svn r8211) -Codechange: (NewGRF) Implement callback 2D, explicit vehicle colour map
peter1138
parents:
5944
diff
changeset
|
29 |
#include "newgrf_callbacks.h" |
4603
3ccd4ee0a2e2
(svn r6455) - Feature: Add 2cc (two company colours) livery schemes. This replaces the original colour selection window and bumps the saveload version. Liveries are supported for all vehicles, not just those with 2cc support. Thanks to lakie for GUI inspiration.
peter1138
parents:
4574
diff
changeset
|
30 |
#include "newgrf_engine.h" |
4656
acffecd6f484
(svn r6532) - Feature: Add support for NewGRF sound effects. Currently sound priority isn't supported.
peter1138
parents:
4648
diff
changeset
|
31 |
#include "newgrf_sound.h" |
7139
4ae3ab180d05
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
7137
diff
changeset
|
32 |
#include "group.h" |
9280
9c03416d26b1
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium
parents:
9259
diff
changeset
|
33 |
#include "order_func.h" |
8610
17cc343a23dd
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8604
diff
changeset
|
34 |
#include "strings_func.h" |
8619
c2434269c3eb
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8617
diff
changeset
|
35 |
#include "zoom_func.h" |
8627
448ebf3a8291
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8626
diff
changeset
|
36 |
#include "functions.h" |
8636
2b158acb649c
(svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents:
8635
diff
changeset
|
37 |
#include "date_func.h" |
8627
448ebf3a8291
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8626
diff
changeset
|
38 |
#include "window_func.h" |
8640
1e93b81e96d2
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8636
diff
changeset
|
39 |
#include "vehicle_func.h" |
8734
b7fc8c6fd379
(svn r11802) -Fix [FS#716]: do not crash trains when leaving depot to a very long track
smatz
parents:
8726
diff
changeset
|
40 |
#include "signal_func.h" |
8653
a83f7a536919
(svn r11719) -Codechange: split sound.h in a header with types and one with functions.
rubidium
parents:
8640
diff
changeset
|
41 |
#include "sound_func.h" |
8707
55835d8fbfcd
(svn r11774) -Change: do not include variables.h in a header when it is not needed.
rubidium
parents:
8668
diff
changeset
|
42 |
#include "variables.h" |
8708
0c29fbc79be4
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
8707
diff
changeset
|
43 |
#include "autoreplace_func.h" |
0c29fbc79be4
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
8707
diff
changeset
|
44 |
#include "autoreplace_gui.h" |
8710
52015340050c
(svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents:
8708
diff
changeset
|
45 |
#include "string_func.h" |
8766
c86cfa3a7580
(svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents:
8760
diff
changeset
|
46 |
#include "settings_type.h" |
9343
c30fd350dd8c
(svn r12599) -Codechange: force AllocateSafeRaw() to be linked to simplify compiler's decisions about inlining
smatz
parents:
9339
diff
changeset
|
47 |
#include "oldpool_func.h" |
10222
b6919c94cc77
(svn r12754) -Codechange: split depot.h into depot_map.h, depot_func.h and depot_base.h and remove quite a lot of unneeded (before this) includes of depot.h.
rubidium
parents:
10221
diff
changeset
|
48 |
#include "depot_map.h" |
10268
434c8d706e7e
(svn r12800) -Codechange: move the animated tile related functions out of texteff.cpp (it isn't a text effect after all). Also remove a few more functions from functions.
rubidium
parents:
10260
diff
changeset
|
49 |
#include "animated_tile_func.h" |
10272
2014f0bdc800
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium
parents:
10271
diff
changeset
|
50 |
#include "effectvehicle_base.h" |
2014f0bdc800
(svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium
parents:
10271
diff
changeset
|
51 |
#include "effectvehicle_func.h" |
0 | 52 |
|
8760
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8754
diff
changeset
|
53 |
#include "table/sprites.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8754
diff
changeset
|
54 |
#include "table/strings.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8754
diff
changeset
|
55 |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
56 |
static void ChimneySmokeInit(Vehicle *v) |
0 | 57 |
{ |
58 |
uint32 r = Random(); |
|
2140
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2116
diff
changeset
|
59 |
v->cur_image = SPR_CHIMNEY_SMOKE_0 + GB(r, 0, 3); |
d708eb80ab8b
(svn r2650) Convert many explicit shifts+ands to extract bits to invocations of GB - should be a bit nicer to read
tron
parents:
2116
diff
changeset
|
60 |
v->progress = GB(r, 16, 3); |
0 | 61 |
} |
62 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
63 |
static void ChimneySmokeTick(Vehicle *v) |
0 | 64 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
65 |
if (v->progress > 0) { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
66 |
v->progress--; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
67 |
} else { |
0 | 68 |
BeginVehicleMove(v); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
164
diff
changeset
|
69 |
|
10240
c4788a9b2cdf
(svn r12772) -Codechange: some vehicle.cpp coding style.
rubidium
parents:
10230
diff
changeset
|
70 |
TileIndex tile = TileVirtXY(v->x_pos, v->y_pos); |
1035
0a170deb6e33
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents:
1024
diff
changeset
|
71 |
if (!IsTileType(tile, MP_INDUSTRY)) { |
0 | 72 |
EndVehicleMove(v); |
7894
dbe6e9295ec5
(svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents:
7883
diff
changeset
|
73 |
delete v; |
0 | 74 |
return; |
75 |
} |
|
76 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
77 |
if (v->cur_image != SPR_CHIMNEY_SMOKE_7) { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
78 |
v->cur_image++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
79 |
} else { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
80 |
v->cur_image = SPR_CHIMNEY_SMOKE_0; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
81 |
} |
0 | 82 |
v->progress = 7; |
83 |
VehiclePositionChanged(v); |
|
84 |
EndVehicleMove(v); |
|
85 |
} |
|
86 |
} |
|
87 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
88 |
static void SteamSmokeInit(Vehicle *v) |
0 | 89 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
90 |
v->cur_image = SPR_STEAM_SMOKE_0; |
0 | 91 |
v->progress = 12; |
92 |
} |
|
93 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
94 |
static void SteamSmokeTick(Vehicle *v) |
0 | 95 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
96 |
bool moved = false; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
164
diff
changeset
|
97 |
|
0 | 98 |
BeginVehicleMove(v); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
164
diff
changeset
|
99 |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
100 |
v->progress++; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
164
diff
changeset
|
101 |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
102 |
if ((v->progress & 7) == 0) { |
0 | 103 |
v->z_pos++; |
104 |
moved = true; |
|
105 |
} |
|
106 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
107 |
if ((v->progress & 0xF) == 4) { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
108 |
if (v->cur_image != SPR_STEAM_SMOKE_4) { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
109 |
v->cur_image++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
110 |
} else { |
0 | 111 |
EndVehicleMove(v); |
7894
dbe6e9295ec5
(svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents:
7883
diff
changeset
|
112 |
delete v; |
0 | 113 |
return; |
114 |
} |
|
115 |
moved = true; |
|
116 |
} |
|
117 |
||
118 |
if (moved) { |
|
119 |
VehiclePositionChanged(v); |
|
120 |
EndVehicleMove(v); |
|
121 |
} |
|
122 |
} |
|
123 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
124 |
static void DieselSmokeInit(Vehicle *v) |
0 | 125 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
126 |
v->cur_image = SPR_DIESEL_SMOKE_0; |
0 | 127 |
v->progress = 0; |
128 |
} |
|
129 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
130 |
static void DieselSmokeTick(Vehicle *v) |
0 | 131 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
132 |
v->progress++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
133 |
|
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
134 |
if ((v->progress & 3) == 0) { |
0 | 135 |
BeginVehicleMove(v); |
136 |
v->z_pos++; |
|
137 |
VehiclePositionChanged(v); |
|
138 |
EndVehicleMove(v); |
|
139 |
} else if ((v->progress & 7) == 1) { |
|
140 |
BeginVehicleMove(v); |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
141 |
if (v->cur_image != SPR_DIESEL_SMOKE_5) { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
142 |
v->cur_image++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
143 |
VehiclePositionChanged(v); |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
144 |
EndVehicleMove(v); |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
145 |
} else { |
0 | 146 |
EndVehicleMove(v); |
7894
dbe6e9295ec5
(svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents:
7883
diff
changeset
|
147 |
delete v; |
0 | 148 |
} |
149 |
} |
|
150 |
} |
|
151 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
152 |
static void ElectricSparkInit(Vehicle *v) |
0 | 153 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
154 |
v->cur_image = SPR_ELECTRIC_SPARK_0; |
0 | 155 |
v->progress = 1; |
156 |
} |
|
157 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
158 |
static void ElectricSparkTick(Vehicle *v) |
0 | 159 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
160 |
if (v->progress < 2) { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
161 |
v->progress++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
162 |
} else { |
0 | 163 |
v->progress = 0; |
164 |
BeginVehicleMove(v); |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
165 |
if (v->cur_image != SPR_ELECTRIC_SPARK_5) { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
166 |
v->cur_image++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
167 |
VehiclePositionChanged(v); |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
168 |
EndVehicleMove(v); |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
169 |
} else { |
0 | 170 |
EndVehicleMove(v); |
7894
dbe6e9295ec5
(svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents:
7883
diff
changeset
|
171 |
delete v; |
0 | 172 |
} |
173 |
} |
|
174 |
} |
|
175 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
176 |
static void SmokeInit(Vehicle *v) |
0 | 177 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
178 |
v->cur_image = SPR_SMOKE_0; |
0 | 179 |
v->progress = 12; |
180 |
} |
|
181 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
182 |
static void SmokeTick(Vehicle *v) |
0 | 183 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
184 |
bool moved = false; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
164
diff
changeset
|
185 |
|
0 | 186 |
BeginVehicleMove(v); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
164
diff
changeset
|
187 |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
188 |
v->progress++; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
164
diff
changeset
|
189 |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
190 |
if ((v->progress & 3) == 0) { |
0 | 191 |
v->z_pos++; |
192 |
moved = true; |
|
193 |
} |
|
194 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
195 |
if ((v->progress & 0xF) == 4) { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
196 |
if (v->cur_image != SPR_SMOKE_4) { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
197 |
v->cur_image++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
198 |
} else { |
0 | 199 |
EndVehicleMove(v); |
7894
dbe6e9295ec5
(svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents:
7883
diff
changeset
|
200 |
delete v; |
0 | 201 |
return; |
202 |
} |
|
203 |
moved = true; |
|
204 |
} |
|
205 |
||
206 |
if (moved) { |
|
207 |
VehiclePositionChanged(v); |
|
208 |
EndVehicleMove(v); |
|
209 |
} |
|
210 |
} |
|
211 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
212 |
static void ExplosionLargeInit(Vehicle *v) |
0 | 213 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
214 |
v->cur_image = SPR_EXPLOSION_LARGE_0; |
0 | 215 |
v->progress = 0; |
216 |
} |
|
217 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
218 |
static void ExplosionLargeTick(Vehicle *v) |
0 | 219 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
220 |
v->progress++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
221 |
if ((v->progress & 3) == 0) { |
0 | 222 |
BeginVehicleMove(v); |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
223 |
if (v->cur_image != SPR_EXPLOSION_LARGE_F) { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
224 |
v->cur_image++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
225 |
VehiclePositionChanged(v); |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
226 |
EndVehicleMove(v); |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
227 |
} else { |
0 | 228 |
EndVehicleMove(v); |
7894
dbe6e9295ec5
(svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents:
7883
diff
changeset
|
229 |
delete v; |
0 | 230 |
} |
231 |
} |
|
232 |
} |
|
233 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
234 |
static void BreakdownSmokeInit(Vehicle *v) |
0 | 235 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
236 |
v->cur_image = SPR_BREAKDOWN_SMOKE_0; |
0 | 237 |
v->progress = 0; |
238 |
} |
|
239 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
240 |
static void BreakdownSmokeTick(Vehicle *v) |
0 | 241 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
242 |
v->progress++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
243 |
if ((v->progress & 7) == 0) { |
0 | 244 |
BeginVehicleMove(v); |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
245 |
if (v->cur_image != SPR_BREAKDOWN_SMOKE_3) { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
246 |
v->cur_image++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
247 |
} else { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
248 |
v->cur_image = SPR_BREAKDOWN_SMOKE_0; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
249 |
} |
0 | 250 |
VehiclePositionChanged(v); |
251 |
EndVehicleMove(v); |
|
252 |
} |
|
253 |
||
10271
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
254 |
v->u.effect.animation_state--; |
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
255 |
if (v->u.effect.animation_state == 0) { |
0 | 256 |
BeginVehicleMove(v); |
257 |
EndVehicleMove(v); |
|
7894
dbe6e9295ec5
(svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents:
7883
diff
changeset
|
258 |
delete v; |
0 | 259 |
} |
260 |
} |
|
261 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
262 |
static void ExplosionSmallInit(Vehicle *v) |
0 | 263 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
264 |
v->cur_image = SPR_EXPLOSION_SMALL_0; |
0 | 265 |
v->progress = 0; |
266 |
} |
|
267 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
268 |
static void ExplosionSmallTick(Vehicle *v) |
0 | 269 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
270 |
v->progress++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
271 |
if ((v->progress & 3) == 0) { |
0 | 272 |
BeginVehicleMove(v); |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
273 |
if (v->cur_image != SPR_EXPLOSION_SMALL_B) { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
274 |
v->cur_image++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
275 |
VehiclePositionChanged(v); |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
276 |
EndVehicleMove(v); |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
277 |
} else { |
0 | 278 |
EndVehicleMove(v); |
7894
dbe6e9295ec5
(svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents:
7883
diff
changeset
|
279 |
delete v; |
0 | 280 |
} |
281 |
} |
|
282 |
} |
|
283 |
||
1364
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
284 |
static void BulldozerInit(Vehicle *v) |
0 | 285 |
{ |
1364
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
286 |
v->cur_image = SPR_BULLDOZER_NE; |
0 | 287 |
v->progress = 0; |
10271
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
288 |
v->u.effect.animation_state = 0; |
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
289 |
v->u.effect.animation_substate = 0; |
0 | 290 |
} |
291 |
||
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
292 |
struct BulldozerMovement { |
1365
7eff6abe942a
(svn r1869) Fix some bugs in the bulldozer movement implementation.
tron
parents:
1364
diff
changeset
|
293 |
byte direction:2; |
1364
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
294 |
byte image:2; |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
295 |
byte duration:3; |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
296 |
}; |
0 | 297 |
|
1364
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
298 |
static const BulldozerMovement _bulldozer_movement[] = { |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
299 |
{ 0, 0, 4 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
300 |
{ 3, 3, 4 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
301 |
{ 2, 2, 7 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
302 |
{ 0, 2, 7 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
303 |
{ 1, 1, 3 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
304 |
{ 2, 2, 7 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
305 |
{ 0, 2, 7 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
306 |
{ 1, 1, 3 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
307 |
{ 2, 2, 7 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
308 |
{ 0, 2, 7 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
309 |
{ 3, 3, 6 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
310 |
{ 2, 2, 6 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
311 |
{ 1, 1, 7 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
312 |
{ 3, 1, 7 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
313 |
{ 0, 0, 3 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
314 |
{ 1, 1, 7 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
315 |
{ 3, 1, 7 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
316 |
{ 0, 0, 3 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
317 |
{ 1, 1, 7 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
318 |
{ 3, 1, 7 } |
0 | 319 |
}; |
320 |
||
1364
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
321 |
static const struct { |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
322 |
int8 x; |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
323 |
int8 y; |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
324 |
} _inc_by_dir[] = { |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
325 |
{ -1, 0 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
326 |
{ 0, 1 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
327 |
{ 1, 0 }, |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
328 |
{ 0, -1 } |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
329 |
}; |
0 | 330 |
|
1364
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
331 |
static void BulldozerTick(Vehicle *v) |
0 | 332 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
333 |
v->progress++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
334 |
if ((v->progress & 7) == 0) { |
10271
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
335 |
const BulldozerMovement* b = &_bulldozer_movement[v->u.effect.animation_state]; |
0 | 336 |
|
337 |
BeginVehicleMove(v); |
|
338 |
||
1364
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
339 |
v->cur_image = SPR_BULLDOZER_NE + b->image; |
0 | 340 |
|
1364
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
341 |
v->x_pos += _inc_by_dir[b->direction].x; |
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
342 |
v->y_pos += _inc_by_dir[b->direction].y; |
0 | 343 |
|
10271
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
344 |
v->u.effect.animation_substate++; |
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
345 |
if (v->u.effect.animation_substate >= b->duration) { |
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
346 |
v->u.effect.animation_substate = 0; |
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
347 |
v->u.effect.animation_state++; |
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
348 |
if (v->u.effect.animation_state == lengthof(_bulldozer_movement)) { |
0 | 349 |
EndVehicleMove(v); |
7894
dbe6e9295ec5
(svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents:
7883
diff
changeset
|
350 |
delete v; |
0 | 351 |
return; |
352 |
} |
|
353 |
} |
|
354 |
VehiclePositionChanged(v); |
|
355 |
EndVehicleMove(v); |
|
356 |
} |
|
357 |
} |
|
358 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
359 |
static void BubbleInit(Vehicle *v) |
0 | 360 |
{ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
361 |
v->cur_image = SPR_BUBBLE_GENERATE_0; |
0 | 362 |
v->spritenum = 0; |
363 |
v->progress = 0; |
|
364 |
} |
|
365 |
||
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
366 |
struct BubbleMovement { |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
367 |
int8 x:4; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
368 |
int8 y:4; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
369 |
int8 z:4; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
370 |
byte image:4; |
6574
e1d1a12faaf7
(svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents:
6573
diff
changeset
|
371 |
}; |
0 | 372 |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
373 |
#define MK(x, y, z, i) { x, y, z, i } |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
374 |
#define ME(i) { i, 4, 0, 0 } |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
375 |
|
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
376 |
static const BubbleMovement _bubble_float_sw[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
377 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
378 |
MK(1, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
379 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
380 |
MK(1, 0, 1, 2), |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
381 |
ME(1) |
0 | 382 |
}; |
383 |
||
384 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
385 |
static const BubbleMovement _bubble_float_ne[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
386 |
MK( 0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
387 |
MK(-1, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
388 |
MK( 0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
389 |
MK(-1, 0, 1, 2), |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
390 |
ME(1) |
0 | 391 |
}; |
392 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
393 |
static const BubbleMovement _bubble_float_se[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
394 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
395 |
MK(0, 1, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
396 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
397 |
MK(0, 1, 1, 2), |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
398 |
ME(1) |
0 | 399 |
}; |
400 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
401 |
static const BubbleMovement _bubble_float_nw[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
402 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
403 |
MK(0, -1, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
404 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
405 |
MK(0, -1, 1, 2), |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
406 |
ME(1) |
0 | 407 |
}; |
408 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
409 |
static const BubbleMovement _bubble_burst[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
410 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
411 |
MK(0, 0, 1, 7), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
412 |
MK(0, 0, 1, 8), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
413 |
MK(0, 0, 1, 9), |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
414 |
ME(0) |
0 | 415 |
}; |
416 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
417 |
static const BubbleMovement _bubble_absorb[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
418 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
419 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
420 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
421 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
422 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
423 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
424 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
425 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
426 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
427 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
428 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
429 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
430 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
431 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
432 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
433 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
434 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
435 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
436 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
437 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
438 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
439 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
440 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
441 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
442 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
443 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
444 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
445 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
446 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
447 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
448 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
449 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
450 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
451 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
452 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
453 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
454 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
455 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
456 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
457 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
458 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
459 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
460 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
461 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
462 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
463 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
464 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
465 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
466 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
467 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
468 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
469 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
470 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
471 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
472 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
473 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
474 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
475 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
476 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
477 |
MK(0, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
478 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
479 |
MK(0, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
480 |
MK(2, 1, 3, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
481 |
MK(1, 1, 3, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
482 |
MK(2, 1, 3, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
483 |
MK(1, 1, 3, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
484 |
MK(2, 1, 3, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
485 |
MK(1, 1, 3, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
486 |
MK(2, 1, 3, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
487 |
MK(1, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
488 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
489 |
MK(1, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
490 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
491 |
MK(1, 0, 1, 2), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
492 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
493 |
MK(1, 0, 1, 1), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
494 |
MK(0, 0, 1, 0), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
495 |
MK(1, 0, 1, 2), |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
496 |
ME(2), |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
497 |
MK(0, 0, 0, 0xA), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
498 |
MK(0, 0, 0, 0xB), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
499 |
MK(0, 0, 0, 0xC), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
500 |
MK(0, 0, 0, 0xD), |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
501 |
MK(0, 0, 0, 0xE), |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
502 |
ME(0) |
0 | 503 |
}; |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
504 |
#undef ME |
0 | 505 |
#undef MK |
506 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
507 |
static const BubbleMovement * const _bubble_movement[] = { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
508 |
_bubble_float_sw, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
509 |
_bubble_float_ne, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
510 |
_bubble_float_se, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
511 |
_bubble_float_nw, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
512 |
_bubble_burst, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
513 |
_bubble_absorb, |
0 | 514 |
}; |
515 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
516 |
static void BubbleTick(Vehicle *v) |
0 | 517 |
{ |
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
518 |
/* |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
519 |
* Warning: those effects can NOT use Random(), and have to use |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
520 |
* InteractiveRandom(), because somehow someone forgot to save |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
521 |
* spritenum to the savegame, and so it will cause desyncs in |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
522 |
* multiplayer!! (that is: in ToyLand) |
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
541
diff
changeset
|
523 |
*/ |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
524 |
uint et; |
0 | 525 |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
526 |
v->progress++; |
10128
01890f2a49ad
(svn r12659) -Cleanup: some style cleanups in vehicle.cpp.
rubidium
parents:
10127
diff
changeset
|
527 |
if ((v->progress & 3) != 0) return; |
0 | 528 |
|
529 |
BeginVehicleMove(v); |
|
530 |
||
531 |
if (v->spritenum == 0) { |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
532 |
v->cur_image++; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
533 |
if (v->cur_image < SPR_BUBBLE_GENERATE_3) { |
0 | 534 |
VehiclePositionChanged(v); |
535 |
EndVehicleMove(v); |
|
536 |
return; |
|
537 |
} |
|
10271
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
538 |
if (v->u.effect.animation_substate != 0) { |
2635 | 539 |
v->spritenum = GB(InteractiveRandom(), 0, 2) + 1; |
0 | 540 |
} else { |
541 |
v->spritenum = 6; |
|
542 |
} |
|
543 |
et = 0; |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
544 |
} else { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
545 |
et = v->engine_type + 1; |
0 | 546 |
} |
547 |
||
10128
01890f2a49ad
(svn r12659) -Cleanup: some style cleanups in vehicle.cpp.
rubidium
parents:
10127
diff
changeset
|
548 |
const BubbleMovement *b = &_bubble_movement[v->spritenum - 1][et]; |
0 | 549 |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
550 |
if (b->y == 4 && b->x == 0) { |
0 | 551 |
EndVehicleMove(v); |
7894
dbe6e9295ec5
(svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents:
7883
diff
changeset
|
552 |
delete v; |
0 | 553 |
return; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
164
diff
changeset
|
554 |
} |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
164
diff
changeset
|
555 |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
556 |
if (b->y == 4 && b->x == 1) { |
8463
3920ac0ab803
(svn r11523) -Codechange: Move the CHANCE macros to core/random_func.cpp cause they depend on Random()
skidd13
parents:
8446
diff
changeset
|
557 |
if (v->z_pos > 180 || Chance16I(1, 96, InteractiveRandom())) { |
0 | 558 |
v->spritenum = 5; |
541 | 559 |
SndPlayVehicleFx(SND_2F_POP, v); |
0 | 560 |
} |
561 |
et = 0; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
164
diff
changeset
|
562 |
} |
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
164
diff
changeset
|
563 |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
564 |
if (b->y == 4 && b->x == 2) { |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
565 |
TileIndex tile; |
0 | 566 |
|
567 |
et++; |
|
541 | 568 |
SndPlayVehicleFx(SND_31_EXTRACT, v); |
0 | 569 |
|
1980
9ea0c89fbb58
(svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents:
1977
diff
changeset
|
570 |
tile = TileVirtXY(v->x_pos, v->y_pos); |
7962 | 571 |
if (IsTileType(tile, MP_INDUSTRY) && GetIndustryGfx(tile) == GFX_BUBBLE_CATCHER) AddAnimatedTile(tile); |
0 | 572 |
} |
573 |
||
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
574 |
v->engine_type = et; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
575 |
b = &_bubble_movement[v->spritenum - 1][et]; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
576 |
|
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
577 |
v->x_pos += b->x; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
578 |
v->y_pos += b->y; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
579 |
v->z_pos += b->z; |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
580 |
v->cur_image = SPR_BUBBLE_0 + b->image; |
0 | 581 |
|
582 |
VehiclePositionChanged(v); |
|
583 |
EndVehicleMove(v); |
|
584 |
} |
|
585 |
||
586 |
||
587 |
typedef void EffectInitProc(Vehicle *v); |
|
588 |
typedef void EffectTickProc(Vehicle *v); |
|
589 |
||
590 |
static EffectInitProc * const _effect_init_procs[] = { |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
591 |
ChimneySmokeInit, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
592 |
SteamSmokeInit, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
593 |
DieselSmokeInit, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
594 |
ElectricSparkInit, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
595 |
SmokeInit, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
596 |
ExplosionLargeInit, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
597 |
BreakdownSmokeInit, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
598 |
ExplosionSmallInit, |
1364
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
599 |
BulldozerInit, |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
600 |
BubbleInit, |
0 | 601 |
}; |
602 |
||
603 |
static EffectTickProc * const _effect_tick_procs[] = { |
|
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
604 |
ChimneySmokeTick, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
605 |
SteamSmokeTick, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
606 |
DieselSmokeTick, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
607 |
ElectricSparkTick, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
608 |
SmokeTick, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
609 |
ExplosionLargeTick, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
610 |
BreakdownSmokeTick, |
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
611 |
ExplosionSmallTick, |
1364
9fad41818ac1
(svn r1868) Improve readability of the bulldozer movement code
tron
parents:
1359
diff
changeset
|
612 |
BulldozerTick, |
1371
76c98f1ff2bf
(svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents:
1365
diff
changeset
|
613 |
BubbleTick, |
0 | 614 |
}; |
615 |
||
616 |
||
10271
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
617 |
Vehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicleType type) |
0 | 618 |
{ |
10271
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
619 |
Vehicle *v = new EffectVehicle(); |
0 | 620 |
if (v != NULL) { |
621 |
v->subtype = type; |
|
622 |
v->x_pos = x; |
|
623 |
v->y_pos = y; |
|
624 |
v->z_pos = z; |
|
625 |
v->tile = 0; |
|
7054
edbb4d7765f2
(svn r9760) -Codechange: remove the need for saving some vehicle variables.
rubidium
parents:
7049
diff
changeset
|
626 |
v->UpdateDeltaXY(INVALID_DIR); |
0 | 627 |
v->vehstatus = VS_UNCLICKABLE; |
628 |
||
629 |
_effect_init_procs[type](v); |
|
630 |
||
631 |
VehiclePositionChanged(v); |
|
632 |
BeginVehicleMove(v); |
|
633 |
EndVehicleMove(v); |
|
634 |
} |
|
635 |
return v; |
|
636 |
} |
|
637 |
||
10271
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
638 |
Vehicle *CreateEffectVehicleAbove(int x, int y, int z, EffectVehicleType type) |
0 | 639 |
{ |
8418
b49fc6be1ab9
(svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13
parents:
8363
diff
changeset
|
640 |
int safe_x = Clamp(x, 0, MapMaxX() * TILE_SIZE); |
b49fc6be1ab9
(svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13
parents:
8363
diff
changeset
|
641 |
int safe_y = Clamp(y, 0, MapMaxY() * TILE_SIZE); |
5295
ab31e01faa80
(svn r7448) -Fix (r5794): use the height of the edge of the map for effect vehicles that are outside the map.
rubidium
parents:
5256
diff
changeset
|
642 |
return CreateEffectVehicle(x, y, GetSlopeZ(safe_x, safe_y) + z, type); |
0 | 643 |
} |
644 |
||
10271
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
645 |
Vehicle *CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVehicleType type) |
0 | 646 |
{ |
647 |
return CreateEffectVehicle(v->x_pos + x, v->y_pos + y, v->z_pos + z, type); |
|
648 |
} |
|
649 |
||
10271
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
650 |
void EffectVehicle::Tick() |
0 | 651 |
{ |
7631
e810ef25497e
(svn r10409) -Codechange: replace (Aircraft|RoadVeh|Ship|Train)_Tick with a Tick method in the Vehicle class.
rubidium
parents:
7630
diff
changeset
|
652 |
_effect_tick_procs[this->subtype](this); |
0 | 653 |
} |
654 |
||
10271
a20997d33fe8
(svn r12803) -Cleanup: rename SpecialVehicle to EffectVehicle to have a uniform naming of the thing instead of using both names for the same thing.
rubidium
parents:
10268
diff
changeset
|
655 |
void EffectVehicle::UpdateDeltaXY(Direction direction) |
7054
edbb4d7765f2
(svn r9760) -Codechange: remove the need for saving some vehicle variables.
rubidium
parents:
7049
diff
changeset
|
656 |
{ |
edbb4d7765f2
(svn r9760) -Codechange: remove the need for saving some vehicle variables.
rubidium
parents:
7049
diff
changeset
|
657 |
this->x_offs = 0; |
edbb4d7765f2
(svn r9760) -Codechange: remove the need for saving some vehicle variables.
rubidium
parents:
7049
diff
changeset
|
658 |
this->y_offs = 0; |
9289
92f1249c304e
(svn r12531) -Codechange: Rename some variables for consistency.
frosch
parents:
9282
diff
changeset
|
659 |
this->x_extent = 1; |
92f1249c304e
(svn r12531) -Codechange: Rename some variables for consistency.
frosch
parents:
9282
diff
changeset
|
660 |
this->y_extent = 1; |
92f1249c304e
(svn r12531) -Codechange: Rename some variables for consistency.
frosch
parents:
9282
diff
changeset
|
661 |
this->z_extent = 1; |
7054
edbb4d7765f2
(svn r9760) -Codechange: remove the need for saving some vehicle variables.
rubidium
parents:
7049
diff
changeset
|
662 |
} |