3 * Iter Vehemens ad Necem (IVAN)
4 * Copyright (C) Timo Kiviluoto
5 * Released under the GNU General
8 * See LICENSING which should be included
9 * along with this file for more details
22 typedef truth (rawbitmap::*pixelpredicate
) (v2
) const;
24 class fluid
: public entity
{
26 /* Come To The Dark Side */
31 fluid (liquid
*, lsquare
*);
32 fluid (liquid
*, item
*, cfestring
&, truth
);
36 void Save (outputfile
&) const;
37 void Load (inputfile
&);
38 void SimpleDraw (blitdata
&) const;
39 void Draw (blitdata
&) const;
40 inline liquid
*GetLiquid () const { return Liquid
; }
41 virtual square
*GetSquareUnderEntity (int = 0) const { return LSquareUnder
; }
42 inline square
*GetSquareUnder () const { return LSquareUnder
; }
43 inline void SetLSquareUnder (lsquare
*What
) { LSquareUnder
= What
; }
44 inline lsquare
*GetLSquareUnder () const { return LSquareUnder
; }
45 virtual truth
IsOnGround () const { return true; }
46 void AddLiquid (sLong
);
47 void AddLiquidAndVolume (sLong
);
48 virtual void SignalVolumeAndWeightChange ();
49 void SetMotherItem (item
*);
50 static void AddFluidInfo (const fluid
*, festring
&);
51 void CheckGearPicture (v2
, int, truth
);
52 void DrawGearPicture (blitdata
&, int) const;
53 truth
FadePictures ();
54 void DrawBodyArmorPicture (blitdata
&, int) const;
56 virtual material
*RemoveMaterial (material
*);
58 inline cfestring
&GetLocationName () const { return LocationName
; }
59 inline truth
IsInside () const { return Flags
& FLUID_INSIDE
; }
60 truth
UseImage() const;
61 virtual int GetTrapType () const { return Liquid
->GetType() | FLUID_TRAP
; }
62 virtual feuLong
GetTrapID () const { return TrapData
.TrapID
; }
63 virtual feuLong
GetVictimID () const { return TrapData
.VictimID
; }
64 virtual void AddTrapName (festring
&, int) const;
65 virtual void UnStick () { TrapData
.VictimID
= 0; }
66 virtual void UnStick (int I
) { TrapData
.BodyParts
&= ~(1 << I
); }
67 void StepOnEffect (character
*);
68 virtual truth
TryToUnStick (character
*, v2
);
69 virtual void PreProcessForBone ();
70 virtual void PostProcessForBone ();
71 virtual truth
IsStuckTo (ccharacter
*) const;
72 truth
IsDangerous (ccharacter
*) const;
77 imagedata (truth
= true);
79 void Animate (blitdata
&, int) const;
80 void AddLiquidToPicture (const rawbitmap
*, sLong
, sLong
, col16
, pixelpredicate
);
81 void Save (outputfile
&) const;
82 void Load (inputfile
&);
85 /* Only pictures of fluids not on ground have their RandMaps initialized,
86 since they are animated. Note that the picture is always unrotated. */
88 /* Used by Animate() */
89 mutable int DripTimer
;
91 mutable col16 DripColor
;
92 mutable alpha DripAlpha
;
93 /* Sum of all alphas of Picture. The volume of the liquid is currently
94 proportional to AlphaSum of the fluid's Image, limiting it
97 /* AlphaSum / (non-transparent pixels in Picture), used to synchronise
98 gear pictures with the main image */
99 packalpha AlphaAverage
;
100 /* The position of a gear picture in humanoid.pcx which binds the fluid;
101 remembered so that it can be easily determined whether the fluid needs
102 to be redistributed due to a major graphics change */
104 /* Animation of gear items needs to know whether the raw picture is
105 rotated somehow. Currently this is the case only for an item
106 in the left hand of a character. */
110 lsquare
*LSquareUnder
;
111 /* MotherItem == 0 means that the fluid is on ground */
114 /* Data of pictures shown over the player if he equips the item which
115 the fluid covers. Note that these are not destroyed when the armor
116 or weapon is unequipped. There is no real need, since the existence
117 of the fluid is very temporary anyway. */
118 imagedata
*GearImage
;
120 festring LocationName
;
121 static const sLong BodyArmorPartPixels
[];
125 outputfile
&operator << (outputfile
&, const fluid
*);
126 inputfile
&operator >> (inputfile
&, fluid
*&);