22 changes: 21 additions & 1 deletion data/base/components/bodies/runanim.pie
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ POLYGONS 10
4200 3 11 9 8 2 1 8 18 7 146 1 162 7 162
4200 3 15 14 13 2 1 8 18 158 98 152 98 152 114
4200 3 15 13 12 2 1 8 18 158 98 152 114 158 114
ANIMOBJECT 250 0 4
0 0 0 0 0 0 0 1000 1000 1000
1 0 0 0 0 0 0 -1000 -1000 -1000
2 0 0 0 0 0 0 -1000 -1000 -1000
3 0 0 0 0 0 0 -1000 -1000 -1000
LEVEL 2
POINTS 18
9 0 -12
Expand Down Expand Up @@ -62,6 +67,11 @@ POLYGONS 10
4200 3 13 11 10 2 1 11 18 32 128 23 144 32 144
4200 3 17 16 15 2 1 11 18 52 146 43 146 43 162
4200 3 17 15 14 2 1 11 18 52 146 43 162 52 162
ANIMOBJECT 250 0 4
0 0 0 0 0 0 0 -1000 -1000 -1000
1 0 0 0 0 0 0 1000 1000 1000
2 0 0 0 0 0 0 -1000 -1000 -1000
3 0 0 0 0 0 0 -1000 -1000 -1000
LEVEL 3
POINTS 16
9 0 -12
Expand Down Expand Up @@ -91,6 +101,11 @@ POLYGONS 10
4200 3 11 9 8 2 1 8 18 7 146 1 162 7 162
4200 3 15 14 13 2 1 8 18 158 98 152 98 152 114
4200 3 15 13 12 2 1 8 18 158 98 152 114 158 114
ANIMOBJECT 250 0 4
0 0 0 0 0 0 0 -1000 -1000 -1000
1 0 0 0 0 0 0 -1000 -1000 -1000
2 0 0 0 0 0 0 1000 1000 1000
3 0 0 0 0 0 0 -1000 -1000 -1000
LEVEL 4
POINTS 18
9 0 -3
Expand Down Expand Up @@ -121,4 +136,9 @@ POLYGONS 10
4200 3 13 12 11 2 1 11 18 43 146 52 146 52 162
4200 3 13 11 10 2 1 11 18 43 146 52 162 43 162
4200 3 17 16 15 2 1 11 18 23 128 32 128 32 144
4200 3 17 15 14 2 1 11 18 23 128 32 144 23 144
4200 3 17 15 14 2 1 11 18 23 128 32 144 23 144
ANIMOBJECT 250 0 4
0 0 0 0 0 0 0 -1000 -1000 -1000
1 0 0 0 0 0 0 -1000 -1000 -1000
2 0 0 0 0 0 0 -1000 -1000 -1000
3 0 0 0 0 0 0 1000 1000 1000
22 changes: 21 additions & 1 deletion data/base/components/bodies/runflame.pie
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ POLYGONS 8
200 3 7 5 4 38 235 50 255 38 255
200 3 11 10 9 24 232 16 232 16 255
200 3 11 9 8 24 232 16 255 24 255
ANIMOBJECT 250 0 4
0 0 0 0 0 0 0 1000 1000 1000
1 0 0 0 0 0 0 -1000 -1000 -1000
2 0 0 0 0 0 0 -1000 -1000 -1000
3 0 0 0 0 0 0 -1000 -1000 -1000
LEVEL 2
POINTS 14
3 0 -7
Expand All @@ -50,6 +55,11 @@ POLYGONS 8
200 3 11 9 8 138 195 126 221 138 221
200 3 13 12 2 111 220 125 220 125 196
200 3 13 2 3 111 220 125 196 111 196
ANIMOBJECT 250 0 4
0 0 0 0 0 0 0 -1000 -1000 -1000
1 0 0 0 0 0 0 1000 1000 1000
2 0 0 0 0 0 0 -1000 -1000 -1000
3 0 0 0 0 0 0 -1000 -1000 -1000
LEVEL 3
POINTS 12
7 0 0
Expand All @@ -73,6 +83,11 @@ POLYGONS 8
200 3 7 5 4 16 232 24 255 16 255
200 3 11 10 9 50 235 38 235 38 255
200 3 11 9 8 50 235 38 255 50 255
ANIMOBJECT 250 0 4
0 0 0 0 0 0 0 -1000 -1000 -1000
1 0 0 0 0 0 0 -1000 -1000 -1000
2 0 0 0 0 0 0 1000 1000 1000
3 0 0 0 0 0 0 -1000 -1000 -1000
LEVEL 4
POINTS 14
-4 0 -7
Expand All @@ -97,4 +112,9 @@ POLYGONS 8
200 3 11 10 9 37 234 25 234 25 255
200 3 11 9 8 37 234 25 255 37 255
200 3 1 3 13 126 167 111 167 111 194
200 3 1 13 12 126 167 111 194 126 194
200 3 1 13 12 126 167 111 194 126 194
ANIMOBJECT 250 0 4
0 0 0 0 0 0 0 -1000 -1000 -1000
1 0 0 0 0 0 0 -1000 -1000 -1000
2 0 0 0 0 0 0 -1000 -1000 -1000
3 0 0 0 0 0 0 1000 1000 1000
52 changes: 52 additions & 0 deletions data/base/structs/blderik.pie
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,32 @@ POLYGONS 10
200 3 1 7 6 240 48 234 1 240 1
200 3 0 3 5 240 49 234 49 234 1
200 3 0 5 7 240 49 234 1 240 1
ANIMOBJECT 60 0 25
0 0 0 0 0 0 0 999 1000 1000
1 0 0 544 0 0 0 999 1000 1000
2 0 0 2056 0 0 0 999 1000 1000
3 0 0 4349 0 0 0 999 1000 1000
4 0 0 7242 0 0 0 999 1000 1000
5 0 0 10548 0 0 0 999 1000 1000
6 0 0 14085 0 0 0 999 1000 1000
7 0 0 17668 0 0 0 999 1000 1000
8 0 0 21112 0 0 0 999 1000 1000
9 0 0 24235 0 0 0 999 1000 1000
10 0 0 26851 0 0 0 999 1000 1000
11 0 0 28776 0 0 0 999 1000 1000
12 0 0 29827 0 0 0 999 1000 1000
13 0 0 29827 0 0 0 999 1000 1000
14 0 0 28776 0 0 0 999 1000 1000
15 0 0 26851 0 0 0 999 1000 1000
16 0 0 24235 0 0 0 999 1000 1000
17 0 0 21112 0 0 0 999 1000 1000
18 0 0 17668 0 0 0 999 1000 1000
19 0 0 14085 0 0 0 999 1000 1000
20 0 0 10548 0 0 0 999 1000 1000
21 0 0 7242 0 0 0 999 1000 1000
22 0 0 4349 0 0 0 999 1000 1000
23 0 0 2056 0 0 0 999 1000 1000
24 0 0 544 0 0 0 999 1000 1000
LEVEL 3
POINTS 26
31 85 7
Expand Down Expand Up @@ -207,3 +233,29 @@ POLYGONS 30
200 3 16 24 22 31 252 0 252 0 244
200 3 16 22 20 31 252 0 244 17 242
200 3 16 20 17 31 252 17 242 31 244
ANIMOBJECT 60 0 25
0 0 0 0 0 0 0 1000 1000 1000
1 -671 0 168 0 480 0 999 1000 999
2 -2680 0 707 0 1921 0 999 1000 999
3 -6001 0 1720 0 4328 0 999 1000 999
4 -10581 0 3374 0 7705 0 999 1000 999
5 -16322 0 5895 0 12052 0 999 1000 999
6 -23053 0 9556 0 17365 0 1000 1000 1000
7 -29891 0 14178 0 23089 0 999 1000 999
8 -35243 0 18562 0 27886 0 1000 1000 1000
9 -39228 0 22361 0 31703 0 1000 1000 1000
10 -42031 0 25362 0 34550 0 1000 1000 1000
11 -43808 0 27430 0 36440 0 1000 1000 1000
12 -44668 0 28482 0 37382 0 999 1000 999
13 -44668 0 28482 0 37382 0 999 1000 999
14 -43808 0 27430 0 36440 0 1000 1000 1000
15 -42031 0 25362 0 34550 0 1000 1000 1000
16 -39228 0 22361 0 31703 0 1000 1000 1000
17 -35243 0 18562 0 27886 0 1000 1000 1000
18 -29891 0 14178 0 23089 0 999 1000 999
19 -23053 0 9556 0 17365 0 1000 1000 1000
20 -16322 0 5895 0 12052 0 999 1000 999
21 -10581 0 3374 0 7705 0 999 1000 999
22 -6001 0 1720 0 4328 0 999 1000 999
23 -2680 0 707 0 1921 0 999 1000 999
24 -671 0 168 0 480 0 999 1000 999
12 changes: 0 additions & 12 deletions data/base/wrf/basic.wrf
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,3 @@ file IMD "cybdplnd.pie"
file IMD "cybdprun.pie"
file IMD "cybd_std.pie"
file IMD "cybd_run.pie"
directory "anims"
file ANI "runanim.ani"
file ANI "runflame.ani"
file ANI "flamfall.ani"
file ANI "fireknee.ani"
file ANI "walkanim.ani"
file ANI "blderik.ani"
file ANI "cybd_run.ani"
file ANI "cybdpjmp.ani"
file ANI "cybdplnd.ani"
file ANI "cybdprun.ani"
file ANIMCFG "anim.cfg"
15 changes: 0 additions & 15 deletions data/mp/anims/anim.cfg

This file was deleted.

80 changes: 79 additions & 1 deletion data/mp/components/bodies/scbd_run.pie
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ POLYGONS 8
200 3 4 6 7 171 212 179 200 171 200
200 3 7 6 5 171 200 179 200 179 212
200 3 7 5 4 171 200 179 212 171 212
ANIMOBJECT 125 0 12
0 0 0 0 0 0 0 1000 999 1000
1 -714 -8165 -1355 -16390 580 -3905 1000 1000 1000
2 -1744 -7453 -2027 -15079 3125 -3354 1000 1000 999
3 -3609 4551 2870 9450 7260 3275 1000 1000 1000
4 -5345 18190 14007 40900 5066 11365 1000 999 1000
5 -4557 17791 10195 39328 3913 10398 1000 999 999
6 -3293 20365 7244 45218 46 9700 1000 999 1000
7 -1567 24268 8671 55849 -4754 7202 1000 999 1000
8 -1358 27834 15171 70938 -9037 5927 1000 999 999
9 1387 18232 7141 37833 -5305 2155 1000 999 999
10 1451 27 5639 -31 -3055 -2368 1000 999 999
11 1189 -6440 2231 -12520 -2894 -1638 1000 999 999
LEVEL 2
POINTS 8
3 2 -19
Expand All @@ -40,6 +53,19 @@ POLYGONS 8
200 3 4 6 7 152 199 158 189 152 189
200 3 7 6 5 152 189 158 189 158 199
200 3 7 5 4 152 189 158 199 152 199
ANIMOBJECT 125 0 12
0 0 0 0 0 0 0 1000 1000 999
1 -3342 4103 8894 26830 -199 7249 1000 1000 999
2 -5223 6358 14534 45014 -478 11311 1000 1000 999
3 -5500 10789 16307 49841 2347 12367 1000 1000 1000
4 -5326 18152 13852 40476 5137 11279 1000 1000 999
5 -5858 18134 19627 64345 -1164 14567 1000 1000 1000
6 -6103 17064 22002 85713 -9517 14325 1000 999 999
7 -5517 17714 22887 98385 -15562 9959 1000 1000 1000
8 -4130 22852 23301 96734 -15826 6829 1000 1000 999
9 -3400 17040 22066 78629 -14411 8147 1000 999 999
10 -3578 9276 22168 51683 -8710 10000 1000 1000 999
11 -930 1868 8070 14301 -2851 5524 1000 999 1000
LEVEL 3
POINTS 8
3 4 -33
Expand All @@ -59,6 +85,19 @@ POLYGONS 8
200 3 4 6 7 166 199 175 195 166 195
200 3 7 6 5 166 195 175 195 175 199
200 3 7 5 4 166 195 175 199 166 199
ANIMOBJECT 125 0 12
0 0 0 0 0 0 0 1000 1000 1000
1 -1136 5405 1452 3144 2914 -205 1000 1000 999
2 -2194 10817 2579 5590 5186 -255 1000 999 1000
3 -2908 16335 3701 8045 7457 -207 1000 1000 1000
4 -2931 21957 5128 11227 10372 0 1000 999 999
5 -2651 27621 5945 15586 4460 73 1000 999 999
6 -1880 33148 6846 20720 -2507 -419 1000 1000 1000
7 -432 35431 15077 41718 -2009 -1131 1000 1000 999
8 1058 35103 21457 62702 -1288 -1617 1000 999 999
9 1941 25881 19407 52959 -425 -1150 1000 999 999
10 744 14989 15534 24860 538 -356 1000 999 999
11 880 2837 7378 10419 812 -143 1000 999 999
LEVEL 4
POINTS 8
-20 10 2
Expand All @@ -78,6 +117,19 @@ POLYGONS 8
200 3 4 6 7 179 212 171 200 179 200
200 3 7 6 5 179 200 171 200 171 212
200 3 7 5 4 179 200 171 212 179 212
ANIMOBJECT 125 0 12
0 0 0 0 0 0 0 1000 999 1000
1 -1304 3662 -2676 6797 2433 2555 1000 1000 999
2 -2292 9685 -2225 18615 3987 3365 1000 1000 999
3 -2155 -6678 1771 -13022 6739 8069 1000 1000 1000
4 192 -22105 15193 -47988 10957 9498 1000 1000 999
5 113 -25227 16055 -57707 12197 7323 1000 1000 1000
6 -807 -24497 10272 -54886 10990 5388 1000 999 999
7 1351 -28384 15866 -72431 12260 6534 1000 1000 1000
8 1663 -27868 14498 -69706 8975 6853 1000 1000 1000
9 1263 -20154 9092 -42806 686 4610 1000 999 999
10 1439 -4874 6647 -9144 -3192 -899 1000 1000 999
11 786 -5917 2534 -11342 -1697 119 1000 999 999
LEVEL 5
POINTS 8
-18 4 17
Expand All @@ -97,6 +149,19 @@ POLYGONS 8
200 3 4 6 7 158 199 152 189 158 189
200 3 7 6 5 158 189 152 189 152 199
200 3 7 5 4 158 189 152 199 158 199
ANIMOBJECT 125 0 12
0 0 0 0 0 0 0 1000 1000 1000
1 -1373 5449 -2417 14614 2710 1280 1000 1000 1000
2 -2262 9152 -2368 16234 3857 3743 1000 1000 999
3 -2654 -3315 1292 1689 6561 5581 1000 1000 1000
4 -1104 -17588 11643 -22708 8593 5913 1000 1000 999
5 157 -25306 16200 -58439 12300 7393 1000 1000 999
6 892 -26386 16282 -83211 15341 7240 1000 1000 999
7 426 -26804 12189 -54730 9643 5117 1000 1000 1000
8 416 -23402 8069 -35022 4539 3213 1000 1000 999
9 1070 -17758 7174 -29382 -571 2782 1000 1000 1000
10 1541 -10944 9705 -39296 -1301 3631 1000 1000 1000
11 785 -5683 2479 -10290 -1725 -51 1000 1000 1000
LEVEL 6
POINTS 8
-21 4 0
Expand All @@ -115,4 +180,17 @@ POLYGONS 8
200 3 4 5 6 175 199 166 199 166 195
200 3 4 6 7 175 199 166 195 175 195
200 3 7 6 5 175 195 166 195 166 199
200 3 7 5 4 175 195 166 199 175 199
200 3 7 5 4 175 195 166 199 175 199
ANIMOBJECT 125 0 12
0 0 0 0 0 0 0 1000 1000 1000
1 -1210 6421 -3442 21363 -130 -116 1000 1000 1000
2 -2368 14099 -6253 42726 -208 -272 1000 1000 999
3 -3058 1070 -4128 32853 -1147 -389 1000 1000 1000
4 -2362 -16919 6113 4279 -2380 -151 1000 1000 1000
5 -2940 -29324 6227 -10418 -2690 176 1000 1000 1000
6 -3096 -35736 5550 -21375 -2490 509 1000 1000 1000
7 -1763 -30007 4996 -18155 -5426 580 1000 1000 1000
8 -375 -24118 4554 -15641 -7710 521 1000 1000 999
9 740 -18057 4104 -13108 -9989 360 1000 999 999
10 1252 -11832 3516 -9812 -12905 0 1000 1000 999
11 1100 -5401 1905 -5446 -6747 -237 1000 1000 999
1 change: 1 addition & 0 deletions data/mp/components/bodies/scbd_std.pie
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PIE 2
TYPE 200
TEXTURE 0 page-14-droid-hubs.png 256 256
EVENT 0 scbd_run.pie
LEVELS 1
LEVEL 1
POINTS 48
Expand Down
13 changes: 0 additions & 13 deletions data/mp/wrf/basic.wrf
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,3 @@ file IMD "cybd_std.pie"
file IMD "cybd_run.pie"
file IMD "scbd_std.pie"
file IMD "scbd_run.pie"
directory "anims"
file ANI "runanim.ani"
file ANI "runflame.ani"
file ANI "flamfall.ani"
file ANI "fireknee.ani"
file ANI "walkanim.ani"
file ANI "blderik.ani"
file ANI "cybd_run.ani"
file ANI "cybdpjmp.ani"
file ANI "cybdplnd.ani"
file ANI "cybdprun.ani"
file ANI "scbd_run.ani"
file ANIMCFG "anim.cfg"
24 changes: 24 additions & 0 deletions doc/Animation.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Animation system
================

There are two ways to implement animation in Warzone.

Texture animation
-----------------

You can make flip through a stack of textures to implement
animation. They need to be lined up in the texture page
horizontally, and the offset and number of frames to cycle
through are specified in the model file.

See the [PIE format specification](PIE.markdown) for details.

Model animation
---------------

Currently implemented for structures and droid bodies (which includes
cyborg feet). You can specify animations that trigger on movement,
structure activation (only implemented for Power Generator so far),
shooting, and dying.

See the [PIE format specification](PIE.markdown) for details.
143 changes: 143 additions & 0 deletions doc/PIE.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
PIE 2
=====

Description
-----------

The PIE format is a custom model format created by Pumpkin.

It has gone through two iterations since the original commercial release. PIE2 was
used until version 2.3 and is still supported. PIE3 is the latest version and is
described here.

The big change between PIE2 and PIE3 is that values are floating point in the latter,
whereas values in PIE2 are scaled up 256 times.

Format
------

### PIE

PIE 3

The first line specifies the version number (3) and MUST read like that.

### TYPE

TYPE X

This indicates the type of the file through a hexadecimal combination of flags. The following values can be used:
* 0x00200 - Reserved for backward compatibility.
* 0x01000 - Specifies that the model should not be stretched to fit terrain. For defensive buildings that have a deep foundation.
* 0x10000 - Specifies the usage of TCMask feature (Replacement for the old team coloration methods. Check ticket #851).

### TEXTURE

TEXTURE 0 page-7-barbarians-arizona.png 0 0

This sets the texture page for the model. The second value gives you the filename of the texture page, which must end with ".png". The PIE file MUST contain exactly one TEXTURE line. The filename MUST only contain [a-zA-Z0-9._\-]. The file name SHOULD start with "page-NN-" for correct handling of dynamic texture replacement. The first, third and fourth values are ignored, and should be zero.

### NORMALMAP

NORMALMAP 0 page-7-barbarians-arizona_normal.png 0 0

Optional. As above, but this sets the normal map texture page for the model.

### SPECULARMAP

SPECULARMAP 0 page-7-barbarians-arizona.png 0 0

Optional. As above, but this sets the specular map texture page for the model.

### EVENT

EVENT type filename.pie

An animation event associated with this model. If the event type is triggered, the model is
replaced with the specified model for the duration of the event. The following event types are defined:

* 1 - Active event. What this means depends on the type of model. For droids this means movement,
while for power generators it means they are linked to a power source.
* 2 - Firing. The model is firing at some enemy.
* 3 - Dying. The model is dying. You (almost) always want to make sure animation cycles for this model is set to 1
for the specified model - if it is zero, it will never die!

### LEVELS

LEVELS 1

This gives the number of meshes that are contained in this model. Each mesh can be animated separately in ANI files.

### LEVEL

LEVEL 1

This starts the model description for mesh 1. Repeat the below as necessary while incrementing the value above as needed.

### SHADERS

SHADERS 2 vertex.vert fragment.vert

Optional. Create a specific shader program for this mesh. The number '2' is not parsed but should always be '2'.

### POINTS

POINTS n

This starts a list of vertex coordinates (points) that is ''n'' lines long. ''n'' MUST be less than or equal to 768. This is followed by the list of points.

#### Point

-4.0 4.0 8.0

Each point MUST be on a seperate line and MUST be indented with a tab. It MUST contain exactly 3 floating-point values in the order ''x y z''. Y denotes "up".

### POLYGONS

POLYGONS n

This starts a list of polygon faces. ''n'' MUST be less than or equal to 512.

#### Polygon

200 3 3 2 1 0.82 0.78 0.186 0.78 0.199 0.82

Each polygon MUST be on a separate line and MUST be indented with a tab.

It is made out of following sections:

Flags Points Texture_coordinates

''' Flags '''
* +200 means the polygon is textured. Each entry in POLYGONS MUST have this flag.
* No other flags are supported. Note that if you want a surface to display something on both sides, make two polygons, one for each side.

''' Points '''
* First number is the number of points for this polygon. Each entry MUST be between 3 and 6 points, however using triangles only is STRONGLY RECOMMENDED. At some later point, only triangles will be supported, and other polygons will be tessellated.
* Then follows a list of indexes to the points list.

''' Texture coordinates '''
* Give texture coordinates for each point. There are two texture floating-point coordinates for each point, hence this list should be twice as long as the number of points. The coordinate is given in UV 0.0-1.0 range.

### CONNECTORS

CONNECTORS n

This starts a list of connectors for the model. These are used to place other components against this one. For each line following this, you should indent by a tab, then give the x, y, and z coordinates of a connector. Z denotes "up." The meaning of each connector is special and hard-coded. Some models do not need connectors.

The exact purpose of each connector is hard-coded for each model type. TODO: List these purposes here.

### ANIMOBJECT

ANIMOBJECT time cycles frames

If the mesh is animated, this directive will tell the game how to animate it. The values
are the total animation time (of all frames), the number of cycles to render the animation,
where zero is infinitely many, and finally the number of animation frames that follows.

#### Animation frame

frame xpos ypos zpos xrot yrot zrot xscale yscale zscale

Each animation line starts with the serially increasing frame number, followed by
three (x, y, z) vectors, one for position, one for rotation, and one for scaling.
7 changes: 1 addition & 6 deletions lib/gamelib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@ AM_CXXFLAGS = $(WZ_CXXFLAGS) $(QT5_CFLAGS)

noinst_LIBRARIES = libgamelib.a
noinst_HEADERS = \
anim.h \
audp_parser.h \
gtime.h \
hashtable.h \
parser.h

libgamelib_a_SOURCES = \
anim.cpp \
audp_lexer.cpp \
audp_parser.cpp \
gtime.cpp \
hashtable.cpp

gtime.cpp
344 changes: 0 additions & 344 deletions lib/gamelib/anim.cpp

This file was deleted.

86 changes: 0 additions & 86 deletions lib/gamelib/anim.h

This file was deleted.

465 changes: 191 additions & 274 deletions lib/gamelib/audp_lexer.cpp

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions lib/gamelib/audp_lexer.lpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,7 @@ extern void audp_set_extra(YY_EXTRA_TYPE user_defined);
oneshot { return ONESHOT; }
loop { return LOOP; }
audio { return AUDIO; }
anim3dfile { return ANIM3DFILE; }
audio_module { return AUDIO_MODULE; }
anim_module { return ANIM_MODULE; }
ANIM3DFRAMES { return ANIM3DFRAMES; }
ANIM3DTRANS { return ANIM3DTRANS; }
ANIMOBJECT { return ANIMOBJECT; }

/* Match floating point numbers */
/* This is a problem with the PSX so is disabled
Expand Down
1,196 changes: 439 additions & 757 deletions lib/gamelib/audp_parser.cpp

Large diffs are not rendered by default.

123 changes: 62 additions & 61 deletions lib/gamelib/audp_parser.h
Original file line number Diff line number Diff line change
@@ -1,82 +1,83 @@
/*
This file is part of Warzone 2100.
Copyright (C) 2005-2015 Warzone 2100 Project
Warzone 2100 is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Warzone 2100 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Warzone 2100; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

/* A Bison parser, made by GNU Bison 3.0.4. */

/* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */

/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */

#ifndef YY_AUDP_AUDP_PARSER_TAB_HPP_INCLUDED
# define YY_AUDP_AUDP_PARSER_TAB_HPP_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int audp_debug;
#endif

/* Tokens. */
/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
FLOAT_T = 258,
INTEGER = 259,
QTEXT = 260,
ONESHOT = 261,
LOOP = 262,
AUDIO = 263,
ANIM3DFRAMES = 264,
ANIM3DTRANS = 265,
ANIM3DFILE = 266,
AUDIO_MODULE = 267,
ANIM_MODULE = 268,
ANIMOBJECT = 269
};
enum yytokentype
{
FLOAT_T = 258,
INTEGER = 259,
QTEXT = 260,
ONESHOT = 261,
LOOP = 262,
AUDIO = 263,
AUDIO_MODULE = 264
};
#endif
/* Tokens. */
#define FLOAT_T 258
#define INTEGER 259
#define QTEXT 260
#define ONESHOT 261
#define LOOP 262
#define AUDIO 263
#define ANIM3DFRAMES 264
#define ANIM3DTRANS 265
#define ANIM3DFILE 266
#define AUDIO_MODULE 267
#define ANIM_MODULE 268
#define ANIMOBJECT 269




/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
{

/* Line 2068 of yacc.c */
#line 44 "audp_parser.ypp"
union YYSTYPE
{
#line 40 "../lib/gamelib/audp_parser.ypp" /* yacc.c:1909 */

float fval;
long ival;
bool bval;
char* sval;

#line 71 "audp_parser.tab.hpp" /* yacc.c:1909 */
};


/* Line 2068 of yacc.c */
#line 87 "audp_parser.h"
} YYSTYPE;
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif


extern YYSTYPE audp_lval;

int audp_parse (void);

#endif /* !YY_AUDP_AUDP_PARSER_TAB_HPP_INCLUDED */
110 changes: 2 additions & 108 deletions lib/gamelib/audp_parser.ypp
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,8 @@
#include "lib/framework/frame.h"
#include "lib/gamelib/parser.h"
#include "lib/sound/audio.h"
#include "lib/gamelib/anim.h"
#include "lib/framework/lexer_input.h"

static int g_iCurAnimID = 0;
static Vector3i vecPos, vecRot, vecScale;

extern int audp_lex(void);
extern int audp_lex_destroy(void);
extern int audp_get_lineno(void);
Expand Down Expand Up @@ -67,26 +63,21 @@ void yyerror(const char* fmt);
%token ONESHOT
%token LOOP
%token AUDIO
%token ANIM3DFRAMES
%token ANIM3DTRANS
%token ANIM3DFILE
%token AUDIO_MODULE
%token ANIM_MODULE
%token ANIMOBJECT

/* rule types */
%type <bval> looping

%%

data_file: module_file | anim_file
data_file: module_file
;

module_file: module_file data_list |
data_list
;

data_list: audio_module | anim_module
data_list: audio_module
;

audio_header: AUDIO_MODULE '{'
Expand Down Expand Up @@ -116,103 +107,6 @@ looping: LOOP
{ $$ = false; }
;

anim_module_header: ANIM_MODULE '{'
{
}
;

anim_module: anim_module_header anim_file_list '}' |
anim_module_header anim_config_list '}'
/* NULL */
;

anim_config_list: anim_config_list anim_config |
anim_config
/* NULL */
;

anim_file_list: anim_file_list anim_file |
anim_file
/* NULL */
;

anim_file: anim_trans | anim_frames
;

anim_config: QTEXT INTEGER
{
g_iCurAnimID = $2;
anim_SetVals( $1, $2 );
free($1);
}
;

/*
* anim_Create3D( char szAniFileName[], char szPieFileName[], UWORD uwFrames,
* UWORD uwFrameRate, UWORD uwNumObj, char cType, UWORD uwID )
*/

anim_trans: ANIM3DTRANS QTEXT INTEGER INTEGER INTEGER
{
anim_Create3D( $2, $3, $4, $5, ANIM_3D_TRANS, g_iCurAnimID );
free($2);
}
'{' anim_obj_list '}'
{
g_iCurAnimID++;
}
;

anim_frames: ANIM3DFRAMES QTEXT INTEGER INTEGER
{
anim_Create3D( $2, $3, $4, 1, ANIM_3D_FRAMES, g_iCurAnimID );
free($2);
}
'{'
{
anim_BeginScript();
}
anim_script '}'
{
anim_EndScript();
g_iCurAnimID++;
}
;

anim_obj_list: anim_obj anim_obj_list |
anim_obj
;

anim_obj: ANIMOBJECT INTEGER QTEXT '{'
{
anim_BeginScript();
free($3);
}
anim_script '}'
{
anim_EndScript();
}
;

anim_script: anim_script anim_state |
anim_state
;

anim_state: INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER INTEGER
{
vecPos.x = $2;
vecPos.y = $3;
vecPos.z = $4;
vecRot.x = $5;
vecRot.y = $6;
vecRot.z = $7;
vecScale.x = $8;
vecScale.y = $9;
vecScale.z = $10;
anim_AddFrameToAnim( $1, vecPos, vecRot, vecScale );
}
;

%%

/* A simple error reporting routine */
Expand Down
6 changes: 1 addition & 5 deletions lib/gamelib/gamelib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,15 @@
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="anim.cpp" />
<ClCompile Include="audp_lexer.cpp" />
<ClCompile Include="audp_parser.cpp" />
<ClCompile Include="gtime.cpp" />
<ClCompile Include="hashtable.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="anim.h" />
<ClInclude Include="audp_parser.h" />
<ClInclude Include="gtime.h" />
<ClInclude Include="hashtable.h" />
<ClInclude Include="parser.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets" />
</Project>
</Project>
14 changes: 1 addition & 13 deletions lib/gamelib/gamelib.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,9 @@
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="anim.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gtime.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="hashtable.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="audp_parser.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand All @@ -28,20 +22,14 @@
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="anim.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gtime.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="hashtable.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="parser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="audp_parser.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
</Project>
406 changes: 0 additions & 406 deletions lib/gamelib/hashtable.cpp

This file was deleted.

195 changes: 0 additions & 195 deletions lib/gamelib/hashtable.h

This file was deleted.

157 changes: 98 additions & 59 deletions lib/ivis_opengl/imdload.cpp

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions lib/ivis_opengl/ivisdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ struct EDGE
int from, to;
};

struct ANIMFRAME
{
Position pos;
Rotation rot;
Vector3f scale;
};

struct iIMDPoly
{
uint32_t flags;
Expand All @@ -90,6 +97,15 @@ enum VBO_TYPE
VBO_COUNT
};

enum ANIMATION_EVENTS
{
ANIM_EVENT_NONE,
ANIM_EVENT_ACTIVE,
ANIM_EVENT_FIRING, // should not be combined with fire-on-move, as this will look weird
ANIM_EVENT_DYING,
ANIM_EVENT_COUNT
};

struct iIMDShape
{
iIMDShape();
Expand Down Expand Up @@ -122,6 +138,15 @@ struct iIMDShape
GLuint buffers[VBO_COUNT];
SHADER_MODE shaderProgram; // if using specialized shader for this model

// object animation (animating a level, rather than its texture)
std::vector<ANIMFRAME> objanimdata;
int objanimframes;

// more object animation, but these are only set for the first level
int objanimtime; ///< total time to render all animation frames
int objanimcycles; ///< Number of cycles to render, zero means infinitely many
iIMDShape *objanimpie[ANIM_EVENT_COUNT];

iIMDShape *next; // next pie in multilevel pies (NULL for non multilevel !)
};

Expand Down
25 changes: 25 additions & 0 deletions lib/ivis_opengl/piematrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,31 @@ void pie_MatScale(float scale)
}
}

void pie_MatScale(Vector3f scale)
{
psMatrix->a = psMatrix->a * scale.x;
psMatrix->b = psMatrix->b * scale.y;
psMatrix->c = psMatrix->c * scale.z;

psMatrix->d = psMatrix->d * scale.x;
psMatrix->e = psMatrix->e * scale.y;
psMatrix->f = psMatrix->f * scale.z;

psMatrix->g = psMatrix->g * scale.x;
psMatrix->h = psMatrix->h * scale.y;
psMatrix->i = psMatrix->i * scale.z;

if (!psMatrix->cached)
{
glScalef(scale.x, scale.y, scale.z);
}
else
{
glm::vec3 v(scale.x, scale.y, scale.z);
psMatrix->matrix = glm::scale(psMatrix->matrix, v);
}
}


//*************************************************************************
//*** matrix rotate y (yaw) current transformation matrix
Expand Down
15 changes: 9 additions & 6 deletions lib/ivis_opengl/piematrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,15 @@ void pie_MatEnd();

//*************************************************************************

extern void pie_TRANSLATE(int32_t x, int32_t y, int32_t z);
extern void pie_MatScale(float scale);
extern void pie_MatRotX(uint16_t x);
extern void pie_MatRotY(uint16_t y);
extern void pie_MatRotZ(uint16_t z);
extern int32_t pie_RotateProject(const Vector3i *src, Vector2i *dest);
void pie_TRANSLATE(int32_t x, int32_t y, int32_t z);
static inline void pie_TRANSLATE(Position p) { pie_TRANSLATE(p.x, p.y, p.z); }
void pie_MatScale(float scale);
void pie_MatScale(Vector3f scale);
void pie_MatRotX(uint16_t pitch);
void pie_MatRotY(uint16_t direction);
void pie_MatRotZ(uint16_t roll);
static inline void pie_MatRot(Rotation rot) { pie_MatRotX(rot.pitch); pie_MatRotY(rot.direction); pie_MatRotZ(rot.roll); }
int32_t pie_RotateProject(const Vector3i *src, Vector2i *dest);
void pie_GetMatrix(float *matrix);

//*************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion lib/ivis_opengl/pietypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
#define pie_ECM 0x1
#define pie_TRANSLUCENT 0x2
#define pie_ADDITIVE 0x4
#define pie_FORCE_FOG 0x8
#define pie_FORCE_FOG 0x8
#define pie_HEIGHT_SCALED 0x10
#define pie_RAISE 0x20
#define pie_BUTTON 0x40
Expand Down
9 changes: 3 additions & 6 deletions lib/sound/audio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -591,13 +591,10 @@ void audio_Update()
sound_StopTrack(psSample);
psSample->psObj = NULL;
}
else
else // update sample position
{
// update sample position
{
audio_GetObjectPos(psSample->psObj, &psSample->x, &psSample->y, &psSample->z);
sound_SetObjectPosition(psSample);
}
audio_GetObjectPos(psSample->psObj, &psSample->x, &psSample->y, &psSample->z);
sound_SetObjectPosition(psSample);
}
}
// next sample
Expand Down
18 changes: 0 additions & 18 deletions macosx/Warzone.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@
0246A0CD0BD3CBD5004D1C70 /* strres.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0246A0B70BD3CBD5004D1C70 /* strres.cpp */; };
0246A0CE0BD3CBD5004D1C70 /* treap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0246A0BA0BD3CBD5004D1C70 /* treap.cpp */; };
0246A0CF0BD3CBD5004D1C70 /* trig.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0246A0BD0BD3CBD5004D1C70 /* trig.cpp */; };
0246A0E30BD3CC0B004D1C70 /* anim.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0246A0D70BD3CC0B004D1C70 /* anim.cpp */; };
0246A0E40BD3CC0B004D1C70 /* animobj.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0246A0D90BD3CC0B004D1C70 /* animobj.cpp */; };
0246A0E70BD3CC0B004D1C70 /* gtime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0246A0DD0BD3CC0B004D1C70 /* gtime.cpp */; };
0246A1030BD3CC29004D1C70 /* bitimage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0246A0EA0BD3CC29004D1C70 /* bitimage.cpp */; };
0246A1050BD3CC29004D1C70 /* imdload.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0246A0F00BD3CC29004D1C70 /* imdload.cpp */; };
Expand Down Expand Up @@ -679,7 +677,6 @@
43F4DA3716FD0B3D00C566E3 /* scriptvals_parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 43F4DA3316FD0B3D00C566E3 /* scriptvals_parser.cpp */; };
647D9C571039289A006D37CF /* challenge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 647D9C551039289A006D37CF /* challenge.cpp */; };
9742E5730DF9975E000A5D41 /* lexer_input.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9742E5710DF9975E000A5D41 /* lexer_input.cpp */; };
974964240F5ABBBB00A38899 /* hashtable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 974964220F5ABBBB00A38899 /* hashtable.cpp */; };
9749642C0F5ABBE100A38899 /* stdio_ext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 974964280F5ABBE100A38899 /* stdio_ext.cpp */; };
974964330F5ABC3F00A38899 /* eventsave.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9749642F0F5ABC3F00A38899 /* eventsave.cpp */; };
974964340F5ABC3F00A38899 /* interpreter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 974964310F5ABC3F00A38899 /* interpreter.cpp */; };
Expand Down Expand Up @@ -1271,10 +1268,6 @@
0246A0BE0BD3CBD5004D1C70 /* trig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = trig.h; path = ../lib/framework/trig.h; sourceTree = SOURCE_ROOT; };
0246A0BF0BD3CBD5004D1C70 /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = types.h; path = ../lib/framework/types.h; sourceTree = SOURCE_ROOT; };
0246A0C00BD3CBD5004D1C70 /* wzglobal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wzglobal.h; path = ../lib/framework/wzglobal.h; sourceTree = SOURCE_ROOT; };
0246A0D70BD3CC0B004D1C70 /* anim.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = anim.cpp; path = ../lib/gamelib/anim.cpp; sourceTree = SOURCE_ROOT; };
0246A0D80BD3CC0B004D1C70 /* anim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = anim.h; path = ../lib/gamelib/anim.h; sourceTree = SOURCE_ROOT; };
0246A0D90BD3CC0B004D1C70 /* animobj.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = animobj.cpp; path = ../lib/gamelib/animobj.cpp; sourceTree = SOURCE_ROOT; };
0246A0DA0BD3CC0B004D1C70 /* animobj.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = animobj.h; path = ../lib/gamelib/animobj.h; sourceTree = SOURCE_ROOT; };
0246A0DD0BD3CC0B004D1C70 /* gtime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = gtime.cpp; path = ../lib/gamelib/gtime.cpp; sourceTree = SOURCE_ROOT; };
0246A0DE0BD3CC0B004D1C70 /* gtime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = gtime.h; path = ../lib/gamelib/gtime.h; sourceTree = SOURCE_ROOT; };
0246A0E20BD3CC0B004D1C70 /* parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = parser.h; path = ../lib/gamelib/parser.h; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -2021,8 +2014,6 @@
9742E5710DF9975E000A5D41 /* lexer_input.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lexer_input.cpp; path = ../lib/framework/lexer_input.cpp; sourceTree = SOURCE_ROOT; };
9742E5720DF9975E000A5D41 /* lexer_input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = lexer_input.h; path = ../lib/framework/lexer_input.h; sourceTree = SOURCE_ROOT; };
9749641E0F5ABB9E00A38899 /* stringdef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = stringdef.h; path = ../src/stringdef.h; sourceTree = SOURCE_ROOT; };
974964220F5ABBBB00A38899 /* hashtable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = hashtable.cpp; path = ../lib/gamelib/hashtable.cpp; sourceTree = SOURCE_ROOT; };
974964230F5ABBBB00A38899 /* hashtable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hashtable.h; path = ../lib/gamelib/hashtable.h; sourceTree = SOURCE_ROOT; };
974964250F5ABBE100A38899 /* endian_hack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = endian_hack.h; path = ../lib/framework/endian_hack.h; sourceTree = SOURCE_ROOT; };
974964260F5ABBE100A38899 /* fixedpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = fixedpoint.h; path = ../lib/framework/fixedpoint.h; sourceTree = SOURCE_ROOT; };
974964270F5ABBE100A38899 /* math_ext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = math_ext.h; path = ../lib/framework/math_ext.h; sourceTree = SOURCE_ROOT; };
Expand Down Expand Up @@ -2361,12 +2352,6 @@
43F4DA2216FD0A8900C566E3 /* audp_lexer.cpp */,
43F4DA2316FD0A8900C566E3 /* audp_parser.cpp */,
43F4DA2416FD0A8900C566E3 /* audp_parser.h */,
974964220F5ABBBB00A38899 /* hashtable.cpp */,
974964230F5ABBBB00A38899 /* hashtable.h */,
0246A0D70BD3CC0B004D1C70 /* anim.cpp */,
0246A0D80BD3CC0B004D1C70 /* anim.h */,
0246A0D90BD3CC0B004D1C70 /* animobj.cpp */,
0246A0DA0BD3CC0B004D1C70 /* animobj.h */,
0246A0DD0BD3CC0B004D1C70 /* gtime.cpp */,
0246A0DE0BD3CC0B004D1C70 /* gtime.h */,
0246A0E20BD3CC0B004D1C70 /* parser.h */,
Expand Down Expand Up @@ -4873,8 +4858,6 @@
0246A0CD0BD3CBD5004D1C70 /* strres.cpp in Sources */,
0246A0CE0BD3CBD5004D1C70 /* treap.cpp in Sources */,
0246A0CF0BD3CBD5004D1C70 /* trig.cpp in Sources */,
0246A0E30BD3CC0B004D1C70 /* anim.cpp in Sources */,
0246A0E40BD3CC0B004D1C70 /* animobj.cpp in Sources */,
0246A0E70BD3CC0B004D1C70 /* gtime.cpp in Sources */,
0246A1030BD3CC29004D1C70 /* bitimage.cpp in Sources */,
0246A1050BD3CC29004D1C70 /* imdload.cpp in Sources */,
Expand Down Expand Up @@ -5012,7 +4995,6 @@
024480240C5E4BEE00E1A641 /* utf.cpp in Sources */,
976AE8280EA0B59A00F2473F /* timer.cpp in Sources */,
974EDB380EDC818D00A25352 /* terrain.cpp in Sources */,
974964240F5ABBBB00A38899 /* hashtable.cpp in Sources */,
9749642C0F5ABBE100A38899 /* stdio_ext.cpp in Sources */,
974964330F5ABC3F00A38899 /* eventsave.cpp in Sources */,
974964340F5ABC3F00A38899 /* interpreter.cpp in Sources */,
Expand Down
3 changes: 0 additions & 3 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ noinst_HEADERS = \
actiondef.h \
advvis.h \
ai.h \
anim_id.h \
animobj.h \
astar.h \
atmos.h \
basedef.h \
Expand Down Expand Up @@ -177,7 +175,6 @@ COMMONSOURCES = \
action.cpp \
advvis.cpp \
ai.cpp \
animobj.cpp \
astar.cpp \
atmos.cpp \
aud.cpp \
Expand Down
3 changes: 0 additions & 3 deletions src/Warzone2100.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ call $(ProjectDir)..\build_tools\autorevision.bat $(ProjectDir)</Command>
<ClCompile Include="action.cpp" />
<ClCompile Include="advvis.cpp" />
<ClCompile Include="ai.cpp" />
<ClCompile Include="animobj.cpp" />
<ClCompile Include="astar.cpp" />
<ClCompile Include="atmos.cpp" />
<ClCompile Include="aud.cpp" />
Expand Down Expand Up @@ -412,8 +411,6 @@ call $(ProjectDir)..\build_tools\autorevision.bat $(ProjectDir)</Command>
<ClInclude Include="actiondef.h" />
<ClInclude Include="advvis.h" />
<ClInclude Include="ai.h" />
<ClInclude Include="animobj.h" />
<ClInclude Include="anim_id.h" />
<ClInclude Include="astar.h" />
<ClInclude Include="atmos.h" />
<ClInclude Include="autorevision.h" />
Expand Down
9 changes: 0 additions & 9 deletions src/Warzone2100.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,6 @@
<ClCompile Include="qtscriptdebug.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="animobj.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="action.h">
Expand All @@ -350,9 +347,6 @@
<ClInclude Include="ai.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="anim_id.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="astar.h">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down Expand Up @@ -713,9 +707,6 @@
<ClInclude Include="terrain.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="animobj.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="..\win32\warzone2100.rc">
Expand Down
36 changes: 0 additions & 36 deletions src/anim_id.h

This file was deleted.

232 changes: 0 additions & 232 deletions src/animobj.cpp

This file was deleted.

75 changes: 0 additions & 75 deletions src/animobj.h

This file was deleted.

5 changes: 3 additions & 2 deletions src/basedef.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#define __INCLUDED_BASEDEF_H__

#include "lib/framework/vector.h"
#include "animobj.h"
#include "displaydef.h"
#include "statsdef.h"

Expand Down Expand Up @@ -118,7 +117,9 @@ struct BASE_OBJECT : public SIMPLE_OBJECT
UDWORD periodicalDamage; ///< How much damage has been done since the object entered the fire
uint16_t flags; ///< Various flags
TILEPOS *watchedTiles; ///< Variable size array of watched tiles, NULL for features
ANIM_OBJECT *psCurAnim; ///< Animation frames

UDWORD timeAnimationStarted; ///< Animation start time, zero for do not animate
UBYTE animationEvent; ///< If animation start time > 0, this points to which animation to run

NEXTOBJ psNext; ///< Pointer to the next object in the object list
NEXTOBJ psNextFunc; ///< Pointer to the next object in the function list
Expand Down
3 changes: 2 additions & 1 deletion src/baseobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ BASE_OBJECT::BASE_OBJECT(OBJECT_TYPE type, uint32_t id, unsigned player)
, periodicalDamage(0)
, flags(0)
, watchedTiles(NULL)
, psCurAnim(NULL)
, timeAnimationStarted(0)
, animationEvent(ANIM_EVENT_NONE)
{
memset(visible, 0, sizeof(visible));
sDisplay.imd = NULL;
Expand Down
35 changes: 0 additions & 35 deletions src/bucket3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void *pObject)
DROID *psDroid;
BODY_STATS *psBStats;
SIMPLE_OBJECT *psSimpObj;
COMPONENT_OBJECT *psCompObj;
const iIMDShape *pImd;
Spacetime spacetime;

Expand Down Expand Up @@ -186,33 +185,6 @@ static SDWORD bucketCalculateZ(RENDER_TYPE objectType, void *pObject)
z = -1;
}
}
break;
case RENDER_ANIMATION://not depth sorted
psCompObj = (COMPONENT_OBJECT *) pObject;
spacetime = interpolateObjectSpacetime((SIMPLE_OBJECT *)psCompObj->psParent, graphicsTime);
position.x = spacetime.pos.x - player.p.x;
position.z = -(spacetime.pos.y - player.p.z);
position.y = spacetime.pos.z;

/* object offset translation */
position.x += psCompObj->psShape->ocen.x;
position.y += psCompObj->psShape->ocen.z;
position.z -= psCompObj->psShape->ocen.y;

pie_MatBegin(true);

/* object (animation) translations - ivis z and y flipped */
pie_TRANSLATE(psCompObj->position.x, psCompObj->position.z, psCompObj->position.y);

/* object (animation) rotations */
pie_MatRotY(-psCompObj->orientation.z);
pie_MatRotZ(-psCompObj->orientation.y);
pie_MatRotX(-psCompObj->orientation.x);

z = pie_RotateProject(&position, &pixel);

pie_MatEnd();

break;
case RENDER_DROID:
case RENDER_SHADOW:
Expand Down Expand Up @@ -391,10 +363,6 @@ void bucketAddTypeToList(RENDER_TYPE objectType, void *pObject)
pie = ((FEATURE *)pObject)->sDisplay.imd;
z = INT32_MAX - pie->texpage;
break;
case RENDER_ANIMATION:
pie = ((COMPONENT_OBJECT *)pObject)->psShape;
z = INT32_MAX - pie->texpage;
break;
case RENDER_DELIVPOINT:
pie = pAssemblyPointIMDs[((FLAG_POSITION *)pObject)->
factoryType][((FLAG_POSITION *)pObject)->factoryInc];
Expand Down Expand Up @@ -451,9 +419,6 @@ void bucketRenderCurrentList(void)
case RENDER_PROJECTILE:
renderProjectile((PROJECTILE *)thisTag->pObject);
break;
case RENDER_ANIMATION:
renderAnimComponent((COMPONENT_OBJECT *)thisTag->pObject);
break;
case RENDER_DELIVPOINT:
renderDeliveryPoint((FLAG_POSITION *)thisTag->pObject, false);
break;
Expand Down
1 change: 0 additions & 1 deletion src/bucket3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ enum RENDER_TYPE
RENDER_PROXMSG,
RENDER_PROJECTILE,
RENDER_SHADOW,
RENDER_ANIMATION,
RENDER_EFFECT,
RENDER_DELIVPOINT,
RENDER_PARTICLE
Expand Down
72 changes: 30 additions & 42 deletions src/component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ void drawMuzzleFlash(WEAPON sWeap, iIMDShape *weaponImd, iIMDShape *flashImd, PI
// removed mountRotation,they get such stuff from psObj directly now
static void displayCompObj(DROID *psDroid, bool bButton)
{
iIMDShape *psShape, *psMoveAnim, *psStillAnim, *psShapeTemp = NULL, *psMountShape;
iIMDShape *psMoveAnim, *psStillAnim;
SDWORD iConnector;
PROPULSION_STATS *psPropStats;
SDWORD pieFlag, iPieData;
Expand Down Expand Up @@ -460,11 +460,10 @@ static void displayCompObj(DROID *psDroid, bool bButton)
pie_TRANSLATE(0, -world_coord(1) / 2.3f, 0);
}

//uses psShapeTemp too separate it from turret's psShape
psShapeTemp = (leftFirst ? getLeftPropulsionIMD(psDroid) : getRightPropulsionIMD(psDroid));
if (psShapeTemp != NULL)
iIMDShape *psShapeProp = (leftFirst ? getLeftPropulsionIMD(psDroid) : getRightPropulsionIMD(psDroid));
if (psShapeProp)
{
pie_Draw3DShape(psShapeTemp, 0, colour, brightness, pieFlag, iPieData);
pie_Draw3DShape(psShapeProp, 0, colour, brightness, pieFlag, iPieData);
}

/* set default components transparent */
Expand All @@ -480,32 +479,22 @@ static void displayCompObj(DROID *psDroid, bool bButton)
}

/* Get the body graphic now*/
//uses psShapeTemp too separate it from turret's psShape
psShapeTemp = BODY_IMD(psDroid, psDroid->player);
if (psShapeTemp != NULL)
iIMDShape *psShapeBody = BODY_IMD(psDroid, psDroid->player);
if (psShapeBody)
{
// FIXME
iIMDShape *strImd = psShapeBody;
if (psDroid->droidType == DROID_PERSON)
{
/* draw body if not animating */
if (psDroid->psCurAnim == NULL || psDroid->psCurAnim->bVisible == false)
{
// FIXME - hideous....!!!!
pie_MatScale(.75f);
pie_Draw3DShape(psShapeTemp, 0, psDroid->player, brightness, pieFlag, iPieData);
}
pie_MatScale(.75f); // FIXME - hideous....!!!!
}
else if (cyborgDroid(psDroid))
if (psDroid->timeAnimationStarted && strImd->objanimpie[psDroid->animationEvent])
{
/* draw body if cyborg not animating */
if (psDroid->psCurAnim == NULL || psDroid->psCurAnim->bVisible == false)
{
pie_Draw3DShape(psShapeTemp, 0, colour, brightness, pieFlag, iPieData);
}
strImd = psShapeBody->objanimpie[psDroid->animationEvent];
}
else
while (strImd)
{
pie_Draw3DShape(psShapeTemp, 0, colour, brightness, pieFlag, iPieData);
drawShape(psDroid, strImd, colour, brightness, pieFlag, iPieData);
strImd = strImd->next;
}
}

Expand Down Expand Up @@ -545,8 +534,7 @@ static void displayCompObj(DROID *psDroid, bool bButton)
iPieData = 0;
}

psShapeTemp = BODY_IMD(psDroid, psDroid->player);
if (psShapeTemp && psShapeTemp->nconnectors)
if (psShapeBody && psShapeBody->nconnectors)
{
/* vtol weapons attach to connector 2 (underneath);
* all others to connector 1 */
Expand Down Expand Up @@ -577,7 +565,7 @@ static void displayCompObj(DROID *psDroid, bool bButton)
for (i = 0; i < psDroid->numWeaps; i++)
{
if ((psDroid->asWeaps[i].nStat > 0 || psDroid->droidType == DROID_DEFAULT)
&& psShapeTemp->connectors)
&& psShapeBody->connectors)
{
Rotation rot = getInterpolatedWeaponRotation(psDroid, i, graphicsTime);

Expand All @@ -586,15 +574,15 @@ static void displayCompObj(DROID *psDroid, bool bButton)
//to skip number of VTOL_CONNECTOR_START ground unit connectors
if (iConnector < VTOL_CONNECTOR_START)
{
pie_TRANSLATE(psShapeTemp->connectors[i].x,
psShapeTemp->connectors[i].z,
psShapeTemp->connectors[i].y);
pie_TRANSLATE(psShapeBody->connectors[i].x,
psShapeBody->connectors[i].z,
psShapeBody->connectors[i].y);
}
else
{
pie_TRANSLATE(psShapeTemp->connectors[iConnector + i].x,
psShapeTemp->connectors[iConnector + i].z,
psShapeTemp->connectors[iConnector + i].y);
pie_TRANSLATE(psShapeBody->connectors[iConnector + i].x,
psShapeBody->connectors[iConnector + i].z,
psShapeBody->connectors[iConnector + i].y);
}

pie_MatRotY(-rot.direction);
Expand All @@ -606,7 +594,7 @@ static void displayCompObj(DROID *psDroid, bool bButton)
}

/* Get the mount graphic */
psShape = WEAPON_MOUNT_IMD(psDroid, i);
iIMDShape *psShape = WEAPON_MOUNT_IMD(psDroid, i);

int recoilValue = getRecoil(psDroid->asWeaps[i]);
pie_TRANSLATE(0, 0, recoilValue / 3);
Expand Down Expand Up @@ -660,6 +648,7 @@ static void displayCompObj(DROID *psDroid, bool bButton)
case DROID_CYBORG_REPAIR:
{
Rotation rot = getInterpolatedWeaponRotation(psDroid, 0, graphicsTime);
iIMDShape *psShape, *psMountShape;

switch (psDroid->droidType)
{
Expand Down Expand Up @@ -698,9 +687,9 @@ static void displayCompObj(DROID *psDroid, bool bButton)
pie_MatRotZ(65536 / 2); //this might affect gun rotation
}

pie_TRANSLATE(psShapeTemp->connectors[0].x,
psShapeTemp->connectors[0].z,
psShapeTemp->connectors[0].y);
pie_TRANSLATE(psShapeBody->connectors[0].x,
psShapeBody->connectors[0].z,
psShapeBody->connectors[0].y);

pie_MatRotY(-rot.direction);
/* Draw it */
Expand Down Expand Up @@ -763,8 +752,6 @@ static void displayCompObj(DROID *psDroid, bool bButton)
break;
}
}
/* We've also got a handle on the psShape here for the weapon which has a connector to point to
muzzle flash attachment points - just grab it from psShape->connectors->[x|y|z] */

/* set default components transparent */
if (psDroid->asBits[COMP_PROPULSION] == 0)
Expand All @@ -778,10 +765,11 @@ static void displayCompObj(DROID *psDroid, bool bButton)
iPieData = 0;
}

psShape = (leftFirst ? getRightPropulsionIMD(psDroid) : getLeftPropulsionIMD(psDroid));
if (psShape != NULL)
// now render the other propulsion side
psShapeProp = (leftFirst ? getRightPropulsionIMD(psDroid) : getLeftPropulsionIMD(psDroid));
if (psShapeProp)
{
pie_Draw3DShape(psShape, 0, colour, brightness, pieFlag, iPieData);
pie_Draw3DShape(psShapeProp, 0, colour, brightness, pieFlag, iPieData);
}
}

Expand Down
46 changes: 0 additions & 46 deletions src/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -562,50 +562,6 @@ static bool dataAudioCfgLoad(const char *fileName, void **ppData)
return success;
}

/* Load an anim file */
static bool dataAnimLoad(const char *fileName, void **ppData)
{
PHYSFS_file *fileHandle = PHYSFS_openRead(fileName);
debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(fileName), fileName);
if (fileHandle == NULL)
{
*ppData = NULL;
return false;
}

*ppData = anim_LoadFromFile(fileHandle);

PHYSFS_close(fileHandle);

return *ppData != NULL;
}

/* Load an audio config file */
static bool dataAnimCfgLoad(const char *fileName, void **ppData)
{
bool success;
PHYSFS_file *fileHandle = PHYSFS_openRead(fileName);
*ppData = NULL;

debug(LOG_WZ, "Reading...[directory: %s] %s", PHYSFS_getRealDir(fileName), fileName);
if (fileHandle == NULL)
{
return false;
}

success = ParseResourceFile(fileHandle);

PHYSFS_close(fileHandle);

return success;
}


static void dataAnimRelease(void *pData)
{
anim_ReleaseAnim((BASEANIM *)pData);
}

/* Load a string resource file */
static bool dataStrResLoad(const char *fileName, void **ppData)
{
Expand Down Expand Up @@ -795,8 +751,6 @@ static const RES_TYPE_MIN_FILE FileResourceTypes[] =
{"SWEAPMOD", bufferSWEAPMODLoad, dataReleaseStats},
{"SPROPSND", bufferSPROPSNDLoad, dataReleaseStats},
{"AUDIOCFG", dataAudioCfgLoad, NULL},
{"ANI", dataAnimLoad, dataAnimRelease},
{"ANIMCFG", dataAnimCfgLoad, NULL},
{"IMGPAGE", dataImageLoad, dataImageRelease},
{"TERTILES", dataTERTILESLoad, NULL},
{"IMG", dataIMGLoad, dataIMGRelease},
Expand Down
308 changes: 57 additions & 251 deletions src/display3d.cpp

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/display3d.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include "objectdef.h"
#include "message.h"


/*!
* Special tile types
*/
Expand Down Expand Up @@ -70,7 +69,6 @@ extern void renderStructure(STRUCTURE *psStructure);
extern void renderFeature(FEATURE *psFeature);
extern void renderProximityMsg(PROXIMITY_DISPLAY *psProxDisp);
extern void renderProjectile(PROJECTILE *psCurr);
extern void renderAnimComponent(const COMPONENT_OBJECT *psObj);
extern void renderDeliveryPoint(FLAG_POSITION *psPosition, bool blueprint);
extern void debugToggleSensorDisplay(void);

Expand Down Expand Up @@ -125,4 +123,7 @@ extern bool CauseCrash;

extern bool tuiTargetOrigin;

/// Draws using the animation systems. Usually want to use in a while loop to get all model levels.
void drawShape(BASE_OBJECT *psObj, iIMDShape *strImd, int colour, PIELIGHT buildingBrightness, int pieFlag, int pieFlagData);

#endif // __INCLUDED_SRC_DISPLAY3D_H__
153 changes: 36 additions & 117 deletions src/droid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#include "action.h"
#include "order.h"
#include "move.h"
#include "anim_id.h"
#include "geometry.h"
#include "display.h"
#include "console.h"
Expand Down Expand Up @@ -274,16 +273,22 @@ int32_t droidDamage(DROID *psDroid, unsigned damage, WEAPON_CLASS weaponClass, W
scoreUpdateVar(WD_UNITS_KILLED);
}

// If this is droid is a person and was destroyed by flames,
// show it nicely by burning him/her to death.
if (psDroid->droidType == DROID_PERSON && weaponClass == WC_HEAT)
// Do we have a dying animation?
if (psDroid->sDisplay.imd->objanimpie[ANIM_EVENT_DYING] && psDroid->animationEvent != ANIM_EVENT_DYING)
{
droidBurn(psDroid);
debug(LOG_DEATH, "%s droid %d (%p) is starting death animation", objInfo(psDroid), (int)psDroid->id, psDroid);
psDroid->timeAnimationStarted = gameTime;
psDroid->animationEvent = ANIM_EVENT_DYING;
if (psDroid->droidType == DROID_PERSON)
{
// NOTE: 3 types of screams are available ID_SOUND_BARB_SCREAM - ID_SOUND_BARB_SCREAM3
audio_PlayObjDynamicTrack(psDroid, ID_SOUND_BARB_SCREAM + (rand() % 3), NULL);
}
}
// Otherwise use the default destruction animation
else
else if (psDroid->animationEvent != ANIM_EVENT_DYING)
{
debug(LOG_DEATH, "Droid %d (%p) is toast", (int)psDroid->id, psDroid);
debug(LOG_DEATH, "%s droid %d (%p) is toast", objInfo(psDroid), (int)psDroid->id, psDroid);
// This should be sent even if multi messages are turned off, as the group message that was
// sent won't contain the destroyed droid
if (bMultiPlayer && !bMultiMessages)
Expand Down Expand Up @@ -355,13 +360,6 @@ DROID::~DROID()
DROID *psDroid = this;
DROID *psCurr, *psNext;

/* remove animation if present */
if (psDroid->psCurAnim != NULL)
{
animObj_Remove(psDroid->psCurAnim, psDroid->psCurAnim->psAnim->uwID);
psDroid->psCurAnim = NULL;
}

if (isTransporter(psDroid))
{
if (psDroid->psGroup)
Expand Down Expand Up @@ -454,14 +452,6 @@ bool removeDroidBase(DROID *psDel)

syncDebugDroid(psDel, '#');

/* remove animation if present */
if (psDel->psCurAnim != NULL)
{
const bool bRet = animObj_Remove(psDel->psCurAnim, psDel->psCurAnim->psAnim->uwID);
ASSERT(bRet, "animObj_Remove failed");
psDel->psCurAnim = NULL;
}

//kill all the droids inside the transporter
if (isTransporter(psDel))
{
Expand Down Expand Up @@ -558,16 +548,13 @@ static void removeDroidFX(DROID *psDel, unsigned impactTime)
return;
}

if (psDel->droidType == DROID_PERSON && psDel->order.type != DORDER_RUNBURN)
if (psDel->animationEvent != ANIM_EVENT_DYING)
{
/* blow person up into blood and guts */
compPersonToBits(psDel);
}

/* if baba and not running (on fire) then squish */
if (psDel->droidType == DROID_PERSON
&& psDel->order.type != DORDER_RUNBURN
&& psDel->visible[selectedPlayer])
/* if baba then squish */
if (psDel->droidType == DROID_PERSON && psDel->visible[selectedPlayer])
{
// The babarian has been run over ...
audio_PlayStaticTrack(psDel->pos.x, psDel->pos.y, ID_SOUND_BARB_SQUISH);
Expand Down Expand Up @@ -661,90 +648,6 @@ bool droidRemove(DROID *psDroid, DROID *pList[MAX_PLAYERS])
return true;
}

static void droidFlameFallCallback(ANIM_OBJECT *psObj)
{
DROID *psDroid;

ASSERT_OR_RETURN(, psObj != NULL, "invalid anim object pointer");
psDroid = (DROID *) psObj->psParent;

ASSERT_OR_RETURN(, psDroid != NULL, "invalid Unit pointer");
psDroid->psCurAnim = NULL;

// This breaks synch, obviously. Animations are not synched, so changing game state as part of an animation is not completely ideal.
//debug(LOG_DEATH, "droidFlameFallCallback: Droid %d destroyed", (int)psDroid->id);
//destroyDroid( psDroid );
}

static void droidBurntCallback(ANIM_OBJECT *psObj)
{
DROID *psDroid;

ASSERT_OR_RETURN(, psObj != NULL, "invalid anim object pointer");
psDroid = (DROID *) psObj->psParent;

ASSERT_OR_RETURN(, psDroid != NULL, "invalid Unit pointer");

/* add falling anim */
psDroid->psCurAnim = animObj_Add(psDroid, ID_ANIM_DROIDFLAMEFALL, 1);
if (!psDroid->psCurAnim)
{
debug(LOG_ERROR, "couldn't add fall over anim");
return;
}

animObj_SetDoneFunc(psDroid->psCurAnim, droidFlameFallCallback);
}

void droidBurn(DROID *psDroid)
{
CHECK_DROID(psDroid);

if (psDroid->droidType != DROID_PERSON)
{
ASSERT(LOG_ERROR, "can't burn anything except babarians currently!");
return;
}

if (psDroid->order.type != DORDER_RUNBURN)
{
/* set droid running */
orderDroid(psDroid, DORDER_RUNBURN, ModeImmediate);
}

/* if already burning return else remove currently-attached anim if present */
if (psDroid->psCurAnim != NULL)
{
/* return if already burning */
if (psDroid->psCurAnim->psAnim->uwID == ID_ANIM_DROIDBURN)
{
return;
}
else
{
const bool bRet = animObj_Remove(psDroid->psCurAnim, psDroid->psCurAnim->psAnim->uwID);
ASSERT(bRet, "animObj_Remove failed");
psDroid->psCurAnim = NULL;
}
}

/* add burning anim */
psDroid->psCurAnim = animObj_Add(psDroid, ID_ANIM_DROIDBURN, 3);
if (psDroid->psCurAnim == NULL)
{
debug(LOG_ERROR, "couldn't add burn anim");
return;
}

/* set callback */
animObj_SetDoneFunc(psDroid->psCurAnim, droidBurntCallback);

/* add scream */
debug(LOG_NEVER, "baba burn");
// NOTE: 3 types of screams are available ID_SOUND_BARB_SCREAM - ID_SOUND_BARB_SCREAM3
audio_PlayObjDynamicTrack(psDroid, ID_SOUND_BARB_SCREAM + (rand() % 3), NULL);
}

void _syncDebugDroid(const char *function, DROID const *psDroid, char ch)
{
int list[] =
Expand Down Expand Up @@ -815,6 +718,26 @@ void droidUpdate(DROID *psDroid)
psDroid->asWeaps[i].prevRot = psDroid->asWeaps[i].rot;
}

if (psDroid->animationEvent != ANIM_EVENT_NONE)
{
iIMDShape *imd = psDroid->sDisplay.imd->objanimpie[psDroid->animationEvent];
if (imd->objanimcycles > 0 && gameTime > psDroid->timeAnimationStarted + imd->objanimtime * imd->objanimcycles)
{
// Done animating (animation is defined by body - other components should follow suit)
if (psDroid->animationEvent == ANIM_EVENT_DYING)
{
debug(LOG_DEATH, "%s (%d) died to burn anim (died=%d)", objInfo(psDroid), (int)psDroid->id, (int)psDroid->died);
destroyDroid(psDroid, gameTime);
return;
}
psDroid->animationEvent = ANIM_EVENT_NONE;
}
}
else if (psDroid->animationEvent == ANIM_EVENT_DYING)
{
return; // rest below is irrelevant if dead
}

// update the cluster of the droid
if ((psDroid->id + gameTime) / 2000 != (psDroid->id + gameTime - deltaGameTime) / 2000)
{
Expand All @@ -824,12 +747,8 @@ void droidUpdate(DROID *psDroid)
// ai update droid
aiUpdateDroid(psDroid);

// Update the droids order. The droid may be killed here due to burn out.
// Update the droids order.
orderUpdateDroid(psDroid);
if (isDead((BASE_OBJECT *)psDroid))
{
return; // FIXME: Workaround for babarians that were burned to death
}

// update the action of the droid
actionUpdateDroid(psDroid);
Expand Down
3 changes: 0 additions & 3 deletions src/droid.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ bool destroyDroid(DROID *psDel, unsigned impactTime);
/* Same as destroy droid except no graphical effects */
extern void vanishDroid(DROID *psDel);

/* Burn a barbarian then destroy it */
extern void droidBurn(DROID *psDroid);

/* Remove a droid from the apsDroidLists so doesn't update or get drawn etc*/
//returns true if successfully removed from the list
extern bool droidRemove(DROID *psDroid, DROID *pList[MAX_PLAYERS]);
Expand Down
1 change: 0 additions & 1 deletion src/feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
#include "order.h"
#include "structure.h"
#include "miscimd.h"
#include "anim_id.h"
#include "visibility.h"
#include "text.h"
#include "effects.h"
Expand Down
Loading