src/effectvehicle.cpp
author rubidium
Thu, 18 Dec 2008 12:23:08 +0000
changeset 10436 8d3a9fbe8f19
parent 10208 72c00af5c95d
permissions -rw-r--r--
(svn r14689) -Change: make configure die on commonly made user mistakes, like not having SDL development files or zlib headers installed; you can still compile a dedicated server or a binary without zlib, but you have to explicitly force it.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     2
9111
48ce04029fe4 (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: 9009
diff changeset
     3
/** @file effectvehicle.cpp Implementation of everything generic to vehicles. */
6423
8e10e79e0fd1 (svn r9559) -Documentation: doxygen and comment changes: 'U' and 'V' now. Almost done. Yeah. I know, I've already said that...
belugas
parents: 6350
diff changeset
     4
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
#include "stdafx.h"
1891
862800791170 (svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents: 1881
diff changeset
     6
#include "openttd.h"
3957
25f4a4f22e05 (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
48f178431701 (svn r5118) Add IsRoadVehInDepot{Stopped,}()
tron
parents: 3957
diff changeset
     8
#include "roadveh.h"
3961
9868b766fda7 (svn r5120) Add IsShipInDepot{Stopped,}() and remove some redundant checks
tron
parents: 3959
diff changeset
     9
#include "ship.h"
1349
15979a2e9001 (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"
8119
52b48108425a (svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents: 8116
diff changeset
    11
#include "tile_cmd.h"
6453
226bcddeba32 (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: 6444
diff changeset
    12
#include "landscape.h"
6980
c7c4f3bf5901 (svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents: 6955
diff changeset
    13
#include "timetable.h"
8224
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8214
diff changeset
    14
#include "viewport_func.h"
c5a64d87cc54 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8214
diff changeset
    15
#include "gfx_func.h"
8763
81fadd257f67 (svn r12459) -Codechange: split news.h into news_type.h and news_func.h.
rubidium
parents: 8736
diff changeset
    16
#include "news_func.h"
8116
8da76dcb3287 (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents: 8114
diff changeset
    17
#include "command_func.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
#include "saveload.h"
10208
72c00af5c95d (svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium
parents: 9955
diff changeset
    19
#include "company_func.h"
1601
83fbe3bfb847 (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
d65cd19f7117 (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"
8103
cf92483a0abf (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: 8081
diff changeset
    22
#include "rail_type.h"
2676
59b65b4fb480 (svn r3218) -Feature: Multiheaded train engines will now stay in the same train
bjarni
parents: 2666
diff changeset
    23
#include "train.h"
4662
e36935c7bdde (svn r6552) -Feature: [depot window] added a "autoreplace all vehicles in depot" button
bjarni
parents: 4659
diff changeset
    24
#include "aircraft.h"
3428
146dc5f172fc (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
eb8ebfe5df67 (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
25f4a4f22e05 (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
fd86f49a1e96 (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"
5717
b6fb89cd9cce (svn r8211) -Codechange: (NewGRF) Implement callback 2D, explicit vehicle colour map
peter1138
parents: 5693
diff changeset
    29
#include "newgrf_callbacks.h"
4603
20c816f664de (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
9c1d8c4d3e60 (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"
6643
f81bee57bc09 (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: 6641
diff changeset
    32
#include "group.h"
8784
c2e9d649a9ce (svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium
parents: 8763
diff changeset
    33
#include "order_func.h"
8114
dd6d21dc99c1 (svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents: 8108
diff changeset
    34
#include "strings_func.h"
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8121
diff changeset
    35
#include "zoom_func.h"
8131
160939e24ed3 (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: 8130
diff changeset
    36
#include "functions.h"
8140
0d0d8c94f84b (svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents: 8139
diff changeset
    37
#include "date_func.h"
8131
160939e24ed3 (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: 8130
diff changeset
    38
#include "window_func.h"
8144
65cec0877b78 (svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents: 8140
diff changeset
    39
#include "vehicle_func.h"
8238
d47a86c79603 (svn r11802) -Fix [FS#716]: do not crash trains when leaving depot to a very long track
smatz
parents: 8230
diff changeset
    40
#include "signal_func.h"
8157
1505def01945 (svn r11719) -Codechange: split sound.h in a header with types and one with functions.
rubidium
parents: 8144
diff changeset
    41
#include "sound_func.h"
8211
29a8510dfd62 (svn r11774) -Change: do not include variables.h in a header when it is not needed.
rubidium
parents: 8172
diff changeset
    42
#include "variables.h"
8212
cf3fce5c7464 (svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents: 8211
diff changeset
    43
#include "autoreplace_func.h"
cf3fce5c7464 (svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents: 8211
diff changeset
    44
#include "autoreplace_gui.h"
8214
971f861d5543 (svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents: 8212
diff changeset
    45
#include "string_func.h"
8270
e7c342f6b14c (svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents: 8264
diff changeset
    46
#include "settings_type.h"
8847
426dd2d582e7 (svn r12599) -Codechange: force AllocateSafeRaw() to be linked to simplify compiler's decisions about inlining
smatz
parents: 8843
diff changeset
    47
#include "oldpool_func.h"
8962
1b263c69799d (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: 8961
diff changeset
    48
#include "depot_map.h"
9005
d6b0e0a54ef2 (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: 8997
diff changeset
    49
#include "animated_tile_func.h"
9009
6684576ef32b (svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium
parents: 9008
diff changeset
    50
#include "effectvehicle_base.h"
6684576ef32b (svn r12804) -Codechange: move the effect vehicle handling out of vehicle.cpp
rubidium
parents: 9008
diff changeset
    51
#include "effectvehicle_func.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    52
8264
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8258
diff changeset
    53
#include "table/sprites.h"
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8258
diff changeset
    54
#include "table/strings.h"
b1e85998c7d3 (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8258
diff changeset
    55
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    57
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    58
	uint32 r = Random();
2140
a04d0142ad65 (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);
a04d0142ad65 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    61
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    62
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    64
{
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
    65
	if (v->progress > 0) {
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
    66
		v->progress--;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
    67
	} else {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    68
		BeginVehicleMove(v);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 164
diff changeset
    69
8980
3f434ded0a30 (svn r12772) -Codechange: some vehicle.cpp coding style.
rubidium
parents: 8970
diff changeset
    70
		TileIndex tile = TileVirtXY(v->x_pos, v->y_pos);
1035
812f837ee03f (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    72
			EndVehicleMove(v);
7398
b933416cf32b (svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents: 7387
diff changeset
    73
			delete v;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    74
			return;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    75
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    76
1371
fc15eaac6bb2 (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) {
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
    78
			v->cur_image++;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
    79
		} else {
fc15eaac6bb2 (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;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
    81
		}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    82
		v->progress = 7;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    83
		VehiclePositionChanged(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    84
		EndVehicleMove(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    85
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    86
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    87
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    89
{
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    91
	v->progress = 12;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    92
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    93
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    95
{
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    98
	BeginVehicleMove(v);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 164
diff changeset
    99
1371
fc15eaac6bb2 (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
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   103
		v->z_pos++;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   104
		moved = true;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   105
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   106
1371
fc15eaac6bb2 (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) {
fc15eaac6bb2 (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) {
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   109
			v->cur_image++;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   110
		} else {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   111
			EndVehicleMove(v);
7398
b933416cf32b (svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents: 7387
diff changeset
   112
			delete v;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   113
			return;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   114
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   115
		moved = true;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   116
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   117
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   118
	if (moved) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   119
		VehiclePositionChanged(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   120
		EndVehicleMove(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   121
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   122
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   123
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   125
{
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   127
	v->progress = 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   128
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   129
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   131
{
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   132
	v->progress++;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   133
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   135
		BeginVehicleMove(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   136
		v->z_pos++;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   137
		VehiclePositionChanged(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   138
		EndVehicleMove(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   139
	} else if ((v->progress & 7) == 1) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   140
		BeginVehicleMove(v);
1371
fc15eaac6bb2 (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) {
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   142
			v->cur_image++;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   143
			VehiclePositionChanged(v);
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   144
			EndVehicleMove(v);
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   145
		} else {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   146
			EndVehicleMove(v);
7398
b933416cf32b (svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents: 7387
diff changeset
   147
			delete v;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   148
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   149
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   150
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   151
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   153
{
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   155
	v->progress = 1;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   156
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   157
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   159
{
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   160
	if (v->progress < 2) {
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   161
		v->progress++;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   162
	} else {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   163
		v->progress = 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   164
		BeginVehicleMove(v);
1371
fc15eaac6bb2 (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) {
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   166
			v->cur_image++;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   167
			VehiclePositionChanged(v);
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   168
			EndVehicleMove(v);
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   169
		} else {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   170
			EndVehicleMove(v);
7398
b933416cf32b (svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents: 7387
diff changeset
   171
			delete v;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   172
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   173
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   174
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   175
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   177
{
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
	v->progress = 12;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   180
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   181
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   183
{
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   186
	BeginVehicleMove(v);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 164
diff changeset
   187
1371
fc15eaac6bb2 (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
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   191
		v->z_pos++;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   192
		moved = true;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   193
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   194
1371
fc15eaac6bb2 (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) {
fc15eaac6bb2 (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) {
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   197
			v->cur_image++;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   198
		} else {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   199
			EndVehicleMove(v);
7398
b933416cf32b (svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents: 7387
diff changeset
   200
			delete v;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   201
			return;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   202
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   203
		moved = true;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   204
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   205
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   206
	if (moved) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   207
		VehiclePositionChanged(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   208
		EndVehicleMove(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   209
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   210
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   211
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   213
{
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   215
	v->progress = 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   216
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   217
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   219
{
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   220
	v->progress++;
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   222
		BeginVehicleMove(v);
1371
fc15eaac6bb2 (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) {
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   224
			v->cur_image++;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   225
			VehiclePositionChanged(v);
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   226
			EndVehicleMove(v);
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   227
		} else {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   228
			EndVehicleMove(v);
7398
b933416cf32b (svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents: 7387
diff changeset
   229
			delete v;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   230
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   231
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   232
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   233
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   235
{
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   237
	v->progress = 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   238
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   239
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   241
{
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   242
	v->progress++;
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   244
		BeginVehicleMove(v);
1371
fc15eaac6bb2 (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) {
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   246
			v->cur_image++;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   247
		} else {
fc15eaac6bb2 (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;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   249
		}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   250
		VehiclePositionChanged(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   251
		EndVehicleMove(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   252
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   253
9008
de19c73e405f (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: 9005
diff changeset
   254
	v->u.effect.animation_state--;
de19c73e405f (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: 9005
diff changeset
   255
	if (v->u.effect.animation_state == 0) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   256
		BeginVehicleMove(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   257
		EndVehicleMove(v);
7398
b933416cf32b (svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents: 7387
diff changeset
   258
		delete v;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   259
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   260
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   261
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   263
{
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   265
	v->progress = 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   266
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   267
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   269
{
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   270
	v->progress++;
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   272
		BeginVehicleMove(v);
1371
fc15eaac6bb2 (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) {
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   274
			v->cur_image++;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   275
			VehiclePositionChanged(v);
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   276
			EndVehicleMove(v);
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   277
		} else {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   278
			EndVehicleMove(v);
7398
b933416cf32b (svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents: 7387
diff changeset
   279
			delete v;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   280
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   281
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   282
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   283
1364
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   284
static void BulldozerInit(Vehicle *v)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   285
{
1364
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   286
	v->cur_image = SPR_BULLDOZER_NE;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   287
	v->progress = 0;
9008
de19c73e405f (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: 9005
diff changeset
   288
	v->u.effect.animation_state = 0;
de19c73e405f (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: 9005
diff changeset
   289
	v->u.effect.animation_substate = 0;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   290
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   291
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
   292
struct BulldozerMovement {
1365
3ec3ff0adc01 (svn r1869) Fix some bugs in the bulldozer movement implementation.
tron
parents: 1364
diff changeset
   293
	byte direction:2;
1364
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   294
	byte image:2;
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   295
	byte duration:3;
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
   296
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   297
1364
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   298
static const BulldozerMovement _bulldozer_movement[] = {
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   299
	{ 0, 0, 4 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   300
	{ 3, 3, 4 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   301
	{ 2, 2, 7 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   302
	{ 0, 2, 7 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   303
	{ 1, 1, 3 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   304
	{ 2, 2, 7 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   305
	{ 0, 2, 7 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   306
	{ 1, 1, 3 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   307
	{ 2, 2, 7 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   308
	{ 0, 2, 7 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   309
	{ 3, 3, 6 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   310
	{ 2, 2, 6 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   311
	{ 1, 1, 7 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   312
	{ 3, 1, 7 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   313
	{ 0, 0, 3 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   314
	{ 1, 1, 7 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   315
	{ 3, 1, 7 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   316
	{ 0, 0, 3 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   317
	{ 1, 1, 7 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   318
	{ 3, 1, 7 }
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   319
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   320
1364
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   321
static const struct {
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   322
	int8 x;
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   323
	int8 y;
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   324
} _inc_by_dir[] = {
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   325
	{ -1,  0 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   326
	{  0,  1 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   327
	{  1,  0 },
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   328
	{  0, -1 }
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   329
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   330
1364
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   331
static void BulldozerTick(Vehicle *v)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   332
{
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   333
	v->progress++;
fc15eaac6bb2 (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) {
9008
de19c73e405f (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: 9005
diff changeset
   335
		const BulldozerMovement* b = &_bulldozer_movement[v->u.effect.animation_state];
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   336
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   337
		BeginVehicleMove(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   338
1364
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   339
		v->cur_image = SPR_BULLDOZER_NE + b->image;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   340
1364
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   341
		v->x_pos += _inc_by_dir[b->direction].x;
238934514bfd (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   343
9008
de19c73e405f (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: 9005
diff changeset
   344
		v->u.effect.animation_substate++;
de19c73e405f (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: 9005
diff changeset
   345
		if (v->u.effect.animation_substate >= b->duration) {
de19c73e405f (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: 9005
diff changeset
   346
			v->u.effect.animation_substate = 0;
de19c73e405f (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: 9005
diff changeset
   347
			v->u.effect.animation_state++;
de19c73e405f (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: 9005
diff changeset
   348
			if (v->u.effect.animation_state == lengthof(_bulldozer_movement)) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   349
				EndVehicleMove(v);
7398
b933416cf32b (svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents: 7387
diff changeset
   350
				delete v;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   351
				return;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   352
			}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   353
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   354
		VehiclePositionChanged(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   355
		EndVehicleMove(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   356
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   357
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   358
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   360
{
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   362
	v->spritenum = 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   363
	v->progress = 0;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   364
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   365
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
   366
struct BubbleMovement {
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   367
	int8 x:4;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   368
	int8 y:4;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   369
	int8 z:4;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   370
	byte image:4;
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 6247
diff changeset
   371
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   372
1371
fc15eaac6bb2 (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 }
fc15eaac6bb2 (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 }
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   375
fc15eaac6bb2 (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
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   381
	ME(1)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   382
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   383
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   384
1371
fc15eaac6bb2 (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
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   390
	ME(1)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   391
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   392
1371
fc15eaac6bb2 (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
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   398
	ME(1)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   399
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   400
1371
fc15eaac6bb2 (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
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   406
	ME(1)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   407
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   408
1371
fc15eaac6bb2 (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
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   414
	ME(0)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   415
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   416
1371
fc15eaac6bb2 (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
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   496
	ME(2),
4344
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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),
7e123fec5b0b (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
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   502
	ME(0)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   503
};
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   504
#undef ME
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   505
#undef MK
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   506
1371
fc15eaac6bb2 (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[] = {
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   508
	_bubble_float_sw,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   509
	_bubble_float_ne,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   510
	_bubble_float_se,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   511
	_bubble_float_nw,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   512
	_bubble_burst,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   513
	_bubble_absorb,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   514
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   515
1371
fc15eaac6bb2 (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
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   517
{
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   518
	uint et;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   519
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   520
	v->progress++;
8892
8401e1338665 (svn r12659) -Cleanup: some style cleanups in vehicle.cpp.
rubidium
parents: 8891
diff changeset
   521
	if ((v->progress & 3) != 0) return;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   522
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   523
	BeginVehicleMove(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   524
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   525
	if (v->spritenum == 0) {
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   526
		v->cur_image++;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   527
		if (v->cur_image < SPR_BUBBLE_GENERATE_3) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   528
			VehiclePositionChanged(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   529
			EndVehicleMove(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   530
			return;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   531
		}
9008
de19c73e405f (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: 9005
diff changeset
   532
		if (v->u.effect.animation_substate != 0) {
9955
1a16c6aee460 (svn r14110) -Fix: desyncs due to bubbles in toyland
glx
parents: 9428
diff changeset
   533
			v->spritenum = GB(Random(), 0, 2) + 1;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   534
		} else {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   535
			v->spritenum = 6;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   536
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   537
		et = 0;
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   538
	} else {
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   539
		et = v->engine_type + 1;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   540
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   541
8892
8401e1338665 (svn r12659) -Cleanup: some style cleanups in vehicle.cpp.
rubidium
parents: 8891
diff changeset
   542
	const BubbleMovement *b = &_bubble_movement[v->spritenum - 1][et];
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   543
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   544
	if (b->y == 4 && b->x == 0) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   545
		EndVehicleMove(v);
7398
b933416cf32b (svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
rubidium
parents: 7387
diff changeset
   546
		delete v;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   547
		return;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 164
diff changeset
   548
	}
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 164
diff changeset
   549
1371
fc15eaac6bb2 (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 == 1) {
9955
1a16c6aee460 (svn r14110) -Fix: desyncs due to bubbles in toyland
glx
parents: 9428
diff changeset
   551
		if (v->z_pos > 180 || Chance16I(1, 96, Random())) {
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   552
			v->spritenum = 5;
541
625227bb2a3d (svn r925) Use sound enums
tron
parents: 537
diff changeset
   553
			SndPlayVehicleFx(SND_2F_POP, v);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   554
		}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   555
		et = 0;
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 164
diff changeset
   556
	}
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 164
diff changeset
   557
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   558
	if (b->y == 4 && b->x == 2) {
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   559
		TileIndex tile;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   560
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   561
		et++;
541
625227bb2a3d (svn r925) Use sound enums
tron
parents: 537
diff changeset
   562
		SndPlayVehicleFx(SND_31_EXTRACT, v);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   563
1980
6c5917cfcb78 (svn r2486) Turn TILE_FROM_XY into an inline function and rename it to TileVirtXY
tron
parents: 1977
diff changeset
   564
		tile = TileVirtXY(v->x_pos, v->y_pos);
7466
830dce38f50a (svn r10971) -Codechange: One less magical number
belugas
parents: 7415
diff changeset
   565
		if (IsTileType(tile, MP_INDUSTRY) && GetIndustryGfx(tile) == GFX_BUBBLE_CATCHER) AddAnimatedTile(tile);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   566
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   567
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   568
	v->engine_type = et;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   569
	b = &_bubble_movement[v->spritenum - 1][et];
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   570
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   571
	v->x_pos += b->x;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   572
	v->y_pos += b->y;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   573
	v->z_pos += b->z;
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   574
	v->cur_image = SPR_BUBBLE_0 + b->image;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   575
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   576
	VehiclePositionChanged(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   577
	EndVehicleMove(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   578
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   579
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   580
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   581
typedef void EffectInitProc(Vehicle *v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   582
typedef void EffectTickProc(Vehicle *v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   583
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   584
static EffectInitProc * const _effect_init_procs[] = {
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   585
	ChimneySmokeInit,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   586
	SteamSmokeInit,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   587
	DieselSmokeInit,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   588
	ElectricSparkInit,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   589
	SmokeInit,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   590
	ExplosionLargeInit,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   591
	BreakdownSmokeInit,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   592
	ExplosionSmallInit,
1364
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   593
	BulldozerInit,
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   594
	BubbleInit,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   595
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   596
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   597
static EffectTickProc * const _effect_tick_procs[] = {
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   598
	ChimneySmokeTick,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   599
	SteamSmokeTick,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   600
	DieselSmokeTick,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   601
	ElectricSparkTick,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   602
	SmokeTick,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   603
	ExplosionLargeTick,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   604
	BreakdownSmokeTick,
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   605
	ExplosionSmallTick,
1364
238934514bfd (svn r1868) Improve readability of the bulldozer movement code
tron
parents: 1359
diff changeset
   606
	BulldozerTick,
1371
fc15eaac6bb2 (svn r1875) Effect vehicle overhaul: enumerate sprites, descriptive names for functions and miscellaneous improvements
tron
parents: 1365
diff changeset
   607
	BubbleTick,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   608
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   609
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   610
9008
de19c73e405f (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: 9005
diff changeset
   611
Vehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicleType type)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   612
{
9008
de19c73e405f (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: 9005
diff changeset
   613
	Vehicle *v = new EffectVehicle();
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   614
	if (v != NULL) {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   615
		v->subtype = type;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   616
		v->x_pos = x;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   617
		v->y_pos = y;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   618
		v->z_pos = z;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   619
		v->tile = 0;
6558
c88e142f896e (svn r9760) -Codechange: remove the need for saving some vehicle variables.
rubidium
parents: 6553
diff changeset
   620
		v->UpdateDeltaXY(INVALID_DIR);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   621
		v->vehstatus = VS_UNCLICKABLE;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   622
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   623
		_effect_init_procs[type](v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   624
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   625
		VehiclePositionChanged(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   626
		BeginVehicleMove(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   627
		EndVehicleMove(v);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   628
	}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   629
	return v;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   630
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   631
9008
de19c73e405f (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: 9005
diff changeset
   632
Vehicle *CreateEffectVehicleAbove(int x, int y, int z, EffectVehicleType type)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   633
{
7922
a7e266f966d9 (svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13
parents: 7867
diff changeset
   634
	int safe_x = Clamp(x, 0, MapMaxX() * TILE_SIZE);
a7e266f966d9 (svn r11475) -Codechange: rename clamp and clampu to Clamp and ClampU to fit with the coding style
skidd13
parents: 7867
diff changeset
   635
	int safe_y = Clamp(y, 0, MapMaxY() * TILE_SIZE);
5295
9cdf003cf6d1 (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
   636
	return CreateEffectVehicle(x, y, GetSlopeZ(safe_x, safe_y) + z, type);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   637
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   638
9008
de19c73e405f (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: 9005
diff changeset
   639
Vehicle *CreateEffectVehicleRel(const Vehicle *v, int x, int y, int z, EffectVehicleType type)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   640
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   641
	return CreateEffectVehicle(v->x_pos + x, v->y_pos + y, v->z_pos + z, type);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   642
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   643
9008
de19c73e405f (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: 9005
diff changeset
   644
void EffectVehicle::Tick()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   645
{
7135
3c1bcca0d6bb (svn r10409) -Codechange: replace (Aircraft|RoadVeh|Ship|Train)_Tick with a Tick method in the Vehicle class.
rubidium
parents: 7134
diff changeset
   646
	_effect_tick_procs[this->subtype](this);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   647
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   648
9008
de19c73e405f (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: 9005
diff changeset
   649
void EffectVehicle::UpdateDeltaXY(Direction direction)
6558
c88e142f896e (svn r9760) -Codechange: remove the need for saving some vehicle variables.
rubidium
parents: 6553
diff changeset
   650
{
c88e142f896e (svn r9760) -Codechange: remove the need for saving some vehicle variables.
rubidium
parents: 6553
diff changeset
   651
	this->x_offs        = 0;
c88e142f896e (svn r9760) -Codechange: remove the need for saving some vehicle variables.
rubidium
parents: 6553
diff changeset
   652
	this->y_offs        = 0;
8793
5e35232593c3 (svn r12531) -Codechange: Rename some variables for consistency.
frosch
parents: 8786
diff changeset
   653
	this->x_extent      = 1;
5e35232593c3 (svn r12531) -Codechange: Rename some variables for consistency.
frosch
parents: 8786
diff changeset
   654
	this->y_extent      = 1;
5e35232593c3 (svn r12531) -Codechange: Rename some variables for consistency.
frosch
parents: 8786
diff changeset
   655
	this->z_extent      = 1;
6558
c88e142f896e (svn r9760) -Codechange: remove the need for saving some vehicle variables.
rubidium
parents: 6553
diff changeset
   656
}