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
16 #include "ivancommon.h"
30 template <class type
> class databasecreator
;
32 typedef std::vector
<item
*> itemvector
;
33 typedef std::vector
<fluid
*> fluidvector
;
34 typedef truth (rawbitmap::*pixelpredicate
)(v2
) const;
35 typedef truth (material::*materialpredicate
)() const;
36 typedef truth (item::*sorter
)(ccharacter
*) const;
37 typedef item
* (*itemspawner
)(int, int);
38 typedef item
* (*itemcloner
)(citem
*);
40 extern materialpredicate TrueMaterialPredicate
;
44 sortdata(itemvector
& AllItems
, ccharacter
* Character
, truth Recurse
, sorter Sorter
)
50 ccharacter
* Character
;
57 idholder(feuLong ID
) : ID(ID
) { }
62 outputfile
& operator<<(outputfile
&, const idholder
*);
63 inputfile
& operator>>(inputfile
&, idholder
*&);
68 typedef itemprototype prototype
;
71 itemlock() : Locked(false) { }
72 virtual ~itemlock () { }
75 void Save(outputfile
&) const;
76 void Load(inputfile
&);
77 virtual truth
TryKey(item
*, character
*);
78 virtual int GetVirtualConfig() const = 0;
79 virtual void SetVirtualConfig(int, int = 0) = 0;
80 virtual const prototype
* GetVirtualProtoType() const = 0;
81 virtual festring
GetVirtualDescription(int) const = 0;
83 virtual void PostConstruct();
87 typedef lockable
<item
, itemlock
> lockableitem
;
89 struct itemdatabase
: public databasebase
91 typedef itemprototype prototype
;
92 void InitDefaults (const itemprototype
*NewProtoType
, int NewConfig
, cfestring
&acfgstrname
);
93 truth
AllowRandomInstantiation() const;
94 void PostProcess() { }
96 const prototype
* ProtoType
;
97 /* Maintained by configcontainer */
98 sLong PartialPossibilitySum
;
99 sLong PartialCategoryPossibilitySum
;
104 truth IsMaterialChangeable
;
105 truth IsPolymorphSpawnable
;
106 truth IsAutoInitializable
;
108 truth IsPolymorphable
;
109 truth CanBeGeneratedInContainer
;
111 truth CreateDivineConfigurations
;
114 truth AffectsArmStrength
;
115 truth AffectsLegStrength
;
116 truth AffectsDexterity
;
117 truth AffectsAgility
;
118 truth AffectsEndurance
;
119 truth AffectsPerception
;
120 truth AffectsIntelligence
;
122 truth AffectsWillPower
;
123 truth AffectsCharisma
;
125 truth PriceIsProportionalToEnchantment
;
126 truth CanBeUsedBySmith
;
127 truth AffectsCarryingCapacity
;
129 truth CanBeEnchanted
;
131 truth IsGoodWithPlants
;
132 truth CreateLockConfigurations
;
134 truth HasSecondaryMaterial
;
137 truth HasNormalPictureDirection
;
138 truth IsKamikazeWeapon
;
139 truth FlexibilityIsEssential
;
143 int EnergyResistance
;
145 int PoisonResistance
;
146 int ElectricityResistance
;
149 int StrengthModifier
;
152 sLong DefaultMainVolume
;
153 sLong DefaultSecondaryVolume
;
157 truth UsesLongArticle
;
159 truth UsesLongAdjectiveArticle
;
160 festring NameSingular
;
164 fearray
<sLong
> MainMaterialConfig
;
165 fearray
<sLong
> SecondaryMaterialConfig
;
166 fearray
<sLong
> MaterialConfigChances
;
167 sLong MaterialConfigChanceSum
;
168 fearray
<festring
> Alias
;
170 int ForcedVisualEffects
;
175 festring FlexibleNameSingular
;
179 int MaxGeneratedContainedItems
;
181 int InElasticityPenaltyModifier
;
188 int BreakEffectRangeSquare
;
191 v2 TorsoArmorBitmapPos
;
192 v2 ArmArmorBitmapPos
;
193 v2 AthleteArmArmorBitmapPos
;
194 v2 LegArmorBitmapPos
;
198 v2 GauntletBitmapPos
;
201 int EnchantmentMinusChance
;
202 int EnchantmentPlusChance
;
203 int TeleportPriority
;
206 truth IsSadistWeapon
;
207 truth IsThrowingWeapon
;
208 sLong ThrowItemTypes
;
211 RandomChance MagicEffectDuration
;
212 RandomChance MagicEffectChance
;
213 fearray
<festring
> MagicMessageCanSee
;
214 fearray
<festring
> MagicMessageCannotSee
;
215 fearray
<int> AllowedDungeons
;
216 fearray
<festring
> LevelTags
;
222 friend class databasecreator
<item
>;
224 itemprototype(const itemprototype
*, itemspawner
, itemcloner
, cchar
*);
225 virtual ~itemprototype () {}
227 item
* Spawn(int Config
= 0, int SpecialFlags
= 0) const { return Spawner(Config
, SpecialFlags
); }
228 item
* SpawnAndLoad(inputfile
&) const;
229 item
* Clone(citem
* Item
) const { return Cloner(Item
); }
230 cchar
* GetClassID() const { return ClassID
; }
231 int GetIndex() const { return Index
; }
232 const itemprototype
* GetBase() const { return Base
; }
233 int CreateSpecialConfigurations(itemdatabase
**, int, int);
234 const itemdatabase
* ChooseBaseForConfig(itemdatabase
**, int, int);
235 const itemdatabase
*const* GetConfigData() const { return ConfigData
; }
236 int GetConfigSize() const { return ConfigSize
; }
239 const itemprototype
* Base
;
240 itemdatabase
** ConfigData
;
241 itemdatabase
** ConfigTable
[CONFIG_TABLE_SIZE
];
248 EventHandlerMap mOnEvents
;
252 class item
: public object
255 friend class databasecreator
<item
>;
256 typedef itemprototype prototype
;
257 typedef itemdatabase database
;
265 inline truth
IsSteppedOn () const { return mIsStepedOn
; }
266 inline void SetSteppedOn (truth v
) { mIsStepedOn
= v
; }
268 virtual double GetWeaponStrength() const;
269 virtual truth
Open(character
*);
270 truth
Consume(character
*, sLong
);
271 virtual truth
CanBeRead(character
*) const { return false; }
272 virtual truth
Read(character
*);
273 virtual void FinishReading(character
*) { }
274 virtual truth
HitEffect(character
*, character
*, v2
, int, int, truth
) { return false; }
275 virtual void DipInto(liquid
*, character
*) { }
276 virtual truth
DumpTo (character
*dumper
, v2 dest
) { return false; }
277 virtual liquid
* CreateDipLiquid() { return 0; }
278 virtual item
* BetterVersion() const { return 0; }
279 virtual int GetOfferValue(int) const;
280 virtual void Fly(character
*, int, int);
281 int HitCharacter(character
*, character
*, int, double, int);
282 virtual truth
DogWillCatchAndConsume(ccharacter
*) const { return false; }
283 virtual truth
Apply(character
*);
284 virtual truth
Zap(character
*, v2
, int) { return false; }
285 virtual truth
Burn(character
*, v2
, int);
286 virtual truth
Polymorph(character
*, stack
*);
287 virtual truth
CheckPickUpEffect(character
*) { return true; }
288 virtual void StepOnEffect(character
*) { }
289 virtual void SignalSquarePositionChange(int);
290 virtual truth
CanBeEatenByAI(ccharacter
*) const;
291 virtual void Save(outputfile
&) const;
292 virtual void Load(inputfile
&);
293 virtual void ChargeFully(character
*) { }
294 void SetSize(int Value
) { Size
= Value
; }
295 virtual int GetSize() const { return Size
; }
296 feuLong
GetID() const { return ID
; }
297 virtual void TeleportRandomly();
298 virtual int GetStrengthValue() const;
299 slot
* GetSlot(int I
= 0) const { return Slot
[I
]; }
300 void SetMainSlot(slot
* What
) { Slot
[0] = What
; }
301 void PlaceToSlot(slot
* Slot
) { Slot
->PutInItem(this); }
302 virtual void RemoveFromSlot();
303 void MoveTo(stack
*Stack
, truth setPickupTime
=false);
304 truth
IsMainSlot(const slot
* What
) const { return Slot
[0] == What
; }
305 static cchar
* GetItemCategoryName(sLong
);
306 truth
IsEatable(ccharacter
*) const;
307 truth
IsDrinkable(ccharacter
*) const;
308 virtual truth
IsOpenable(ccharacter
*) const { return false; }
309 virtual truth
IsReadable(ccharacter
*) const { return false; }
310 virtual truth
IsDippable(ccharacter
*) const { return false; }
311 virtual truth
IsDipDestination(ccharacter
*) const { return false; }
312 virtual truth
IsDumpable(ccharacter
*) const { return false; }
313 virtual truth
IsAppliable(ccharacter
*) const { return false; }
314 virtual truth
IsZappable(ccharacter
*) const { return false; }
315 virtual truth
IsChargeable(ccharacter
*) const { return false; }
316 virtual truth
IsHelmet(ccharacter
*) const { return false; }
317 virtual truth
IsAmulet(ccharacter
*) const { return false; }
318 virtual truth
IsCloak(ccharacter
*) const { return false; }
319 virtual truth
IsBodyArmor(ccharacter
*) const { return false; }
320 virtual truth
IsRing(ccharacter
*) const { return false; }
321 virtual truth
IsGauntlet(ccharacter
*) const { return false; }
322 virtual truth
IsBelt(ccharacter
*) const { return false; }
323 virtual truth
IsBoot(ccharacter
*) const { return false; }
324 virtual truth
IsShield(ccharacter
*) const { return false; }
325 virtual truth
IsWeapon(ccharacter
*) const { return false; }
326 virtual truth
IsArmor(ccharacter
*) const { return false; }
327 virtual truth
IsEnchantable(ccharacter
*) const { return CanBeEnchanted(); }
328 virtual truth
IsRepairable(ccharacter
*) const { return IsBroken() || IsRusted(); }
329 virtual truth
IsDecosAdShirt(ccharacter
*) const { return false; }
330 virtual truth
IsLuxuryItem(ccharacter
*) const { return false; }
331 virtual truth
MaterialIsChangeable(ccharacter
*) const { return true; }
332 virtual truth
IsBeverage(ccharacter
*) const;
333 virtual truth
CanBeHardened(ccharacter
*) const;
334 virtual truth
HasLock(ccharacter
*) const { return false; }
335 virtual truth
IsOnGround() const;
336 virtual truth
IsFlaming (ccharacter
*) const { return CanFlame(); }
337 virtual truth
IsLockableContainer () const { return false; }
338 int GetResistance(int) const;
340 int GetType() const { return GetProtoType()->GetIndex(); }
341 virtual truth
ReceiveDamage(character
*, int, int, int = YOURSELF
);
342 virtual truth
RaiseTheDead(character
*) { return false; }
343 virtual int GetBodyPartIndex() const { return 0xFF; }
344 const database
* GetDataBase() const { return DataBase
; }
345 virtual truth
CanOpenLockType(int) const { return false; }
346 DATA_BASE_VALUE(const prototype
*, ProtoType
);
347 DATA_BASE_VALUE(int, Config
);
348 virtual DATA_BASE_TRUTH_WITH_PARAMETER(IsDestroyable
, ccharacter
*);
349 DATA_BASE_TRUTH(IsMaterialChangeable
);
350 DATA_BASE_VALUE(int, WeaponCategory
);
351 DATA_BASE_TRUTH(IsAutoInitializable
);
352 DATA_BASE_VALUE(sLong
, Category
);
353 DATA_BASE_VALUE(int, EnergyResistance
);
354 DATA_BASE_VALUE(int, FireResistance
);
355 DATA_BASE_VALUE(int, PoisonResistance
);
356 DATA_BASE_VALUE(int, ElectricityResistance
);
357 DATA_BASE_VALUE(int, AcidResistance
);
358 DATA_BASE_VALUE(int, SoundResistance
);
359 DATA_BASE_VALUE(int, StrengthModifier
);
360 virtual DATA_BASE_VALUE(int, FormModifier
);
361 DATA_BASE_VALUE(int, DefaultSize
);
362 DATA_BASE_VALUE(sLong
, DefaultMainVolume
);
363 DATA_BASE_VALUE(sLong
, DefaultSecondaryVolume
);
364 virtual DATA_BASE_VALUE_WITH_PARAMETER(v2
, BitmapPos
, int);
365 virtual DATA_BASE_VALUE(sLong
, Price
);
366 virtual DATA_BASE_VALUE(col24
, BaseEmitation
);
367 virtual DATA_BASE_TRUTH(UsesLongArticle
);
368 virtual DATA_BASE_VALUE(cfestring
&, Adjective
);
369 virtual DATA_BASE_TRUTH(UsesLongAdjectiveArticle
);
370 virtual DATA_BASE_VALUE(cfestring
&, NameSingular
);
371 virtual DATA_BASE_VALUE(cfestring
&, NamePlural
);
372 virtual DATA_BASE_VALUE(cfestring
&, PostFix
);
373 virtual DATA_BASE_VALUE(int, ArticleMode
);
374 DATA_BASE_VALUE(const fearray
<sLong
>&, MainMaterialConfig
);
375 DATA_BASE_VALUE(const fearray
<sLong
>&, SecondaryMaterialConfig
);
376 virtual DATA_BASE_VALUE(const fearray
<sLong
>&, MaterialConfigChances
);
377 virtual DATA_BASE_VALUE(sLong
, MaterialConfigChanceSum
);
378 DATA_BASE_TRUTH(IsPolymorphable
);
379 virtual DATA_BASE_VALUE(int, OKVisualEffects
);
380 DATA_BASE_TRUTH(CanBeGeneratedInContainer
);
381 virtual DATA_BASE_VALUE(int, ForcedVisualEffects
);
382 DATA_BASE_VALUE(int, Roundness
);
383 DATA_BASE_VALUE(sLong
, GearStates
);
384 DATA_BASE_TRUTH(IsTwoHanded
);
385 DATA_BASE_TRUTH(CanBeBroken
);
386 DATA_BASE_VALUE_WITH_PARAMETER(v2
, WallBitmapPos
, int);
387 DATA_BASE_VALUE(cfestring
&, FlexibleNameSingular
);
388 DATA_BASE_TRUTH(CanBePiled
);
389 DATA_BASE_TRUTH(AffectsArmStrength
);
390 DATA_BASE_TRUTH(AffectsLegStrength
);
391 DATA_BASE_TRUTH(AffectsDexterity
);
392 DATA_BASE_TRUTH(AffectsAgility
);
393 DATA_BASE_TRUTH(AffectsEndurance
);
394 DATA_BASE_TRUTH(AffectsPerception
);
395 DATA_BASE_TRUTH(AffectsIntelligence
);
396 DATA_BASE_TRUTH(AffectsWisdom
);
397 DATA_BASE_TRUTH(AffectsWillPower
);
398 DATA_BASE_TRUTH(AffectsCharisma
);
399 DATA_BASE_TRUTH(AffectsMana
);
400 DATA_BASE_TRUTH(AffectsCarryingCapacity
);
401 DATA_BASE_VALUE(int, BaseEnchantment
);
402 DATA_BASE_TRUTH(PriceIsProportionalToEnchantment
);
403 DATA_BASE_VALUE(int, MaxCharges
);
404 DATA_BASE_VALUE(int, MinCharges
);
405 DATA_BASE_VALUE(int, InElasticityPenaltyModifier
);
406 DATA_BASE_VALUE(sLong
, StorageVolume
);
407 DATA_BASE_VALUE(int, MaxGeneratedContainedItems
);
408 virtual DATA_BASE_TRUTH(CanBeCloned
);
409 virtual DATA_BASE_TRUTH(CanBeMirrored
);
410 DATA_BASE_VALUE(int, BeamRange
);
411 DATA_BASE_TRUTH(CanBeUsedBySmith
);
412 DATA_BASE_VALUE(int, DamageDivider
);
413 DATA_BASE_TRUTH(HandleInPairs
);
414 DATA_BASE_TRUTH(CanBeEnchanted
);
415 DATA_BASE_VALUE(sLong
, BeamColor
);
416 DATA_BASE_VALUE(int, BeamEffect
);
417 DATA_BASE_VALUE(int, BeamStyle
);
418 DATA_BASE_VALUE(int, WearWisdomLimit
);
419 DATA_BASE_VALUE(int, BreakEffectRangeSquare
);
420 virtual DATA_BASE_VALUE_WITH_PARAMETER(v2
, WieldedBitmapPos
, int);
421 DATA_BASE_TRUTH(IsQuestItem
);
422 DATA_BASE_TRUTH(IsGoodWithPlants
);
423 DATA_BASE_TRUTH(CanBePickedUp
);
424 DATA_BASE_VALUE(int, CoverPercentile
);
425 DATA_BASE_VALUE_WITH_PARAMETER(v2
, TorsoArmorBitmapPos
, int);
426 DATA_BASE_VALUE_WITH_PARAMETER(v2
, ArmArmorBitmapPos
, int);
427 DATA_BASE_VALUE_WITH_PARAMETER(v2
, AthleteArmArmorBitmapPos
, int);
428 DATA_BASE_VALUE_WITH_PARAMETER(v2
, LegArmorBitmapPos
, int);
429 DATA_BASE_VALUE_WITH_PARAMETER(v2
, HelmetBitmapPos
, int);
430 DATA_BASE_VALUE_WITH_PARAMETER(v2
, CloakBitmapPos
, int);
431 DATA_BASE_VALUE_WITH_PARAMETER(v2
, BeltBitmapPos
, int);
432 DATA_BASE_VALUE_WITH_PARAMETER(v2
, GauntletBitmapPos
, int);
433 DATA_BASE_VALUE_WITH_PARAMETER(v2
, BootBitmapPos
, int);
434 DATA_BASE_TRUTH(AllowEquip
);
435 DATA_BASE_VALUE(int, ReadDifficulty
);
436 DATA_BASE_VALUE(int, EnchantmentMinusChance
);
437 DATA_BASE_VALUE(int, EnchantmentPlusChance
);
438 virtual DATA_BASE_VALUE(int, TeleportPriority
);
439 DATA_BASE_TRUTH(HasNormalPictureDirection
);
440 DATA_BASE_VALUE(int, DamageFlags
);
441 DATA_BASE_TRUTH(FlexibilityIsEssential
);
442 DATA_BASE_VALUE(cfestring
&, BreakMsg
);
443 DATA_BASE_TRUTH(IsSadistWeapon
);
444 DATA_BASE_TRUTH(IsThrowingWeapon
);
445 DATA_BASE_VALUE(sLong
, ThrowItemTypes
);
446 DATA_BASE_TRUTH(CanFlame
);
447 DATA_BASE_VALUE(int, MagicEffect
);
448 DATA_BASE_VALUE(RandomChance
, MagicEffectDuration
);
449 DATA_BASE_VALUE(RandomChance
, MagicEffectChance
);
450 DATA_BASE_VALUE(fearray
<festring
>, MagicMessageCanSee
);
451 DATA_BASE_VALUE(fearray
<festring
>, MagicMessageCannotSee
);
452 DATA_BASE_VALUE(const fearray
<int> &, AllowedDungeons
);
453 DATA_BASE_VALUE(const fearray
<festring
> &, LevelTags
);
454 truth
CanBeSoldInLibrary(character
* Librarian
) const { return CanBeRead(Librarian
); }
455 virtual truth
TryKey(item
*, character
*) { return false; }
456 sLong
GetBlockModifier() const;
457 truth
IsSimiliarTo(item
*) const;
458 virtual truth
IsPickable(character
*) const { return true; }
459 truth
CanBeSeenByPlayer() const;
460 virtual truth
CanBeSeenBy(ccharacter
*) const;
461 festring
GetDescription(int) const;
462 virtual square
* GetSquareUnderEntity(int = 0) const;
463 virtual square
* GetSquareUnder(int = 0) const;
464 virtual lsquare
* GetLSquareUnder(int = 0) const;
465 level
* GetLevel() const { return static_cast<level
*>(Slot
[0]->GetSquareUnder()->GetArea()); }
466 area
* GetArea() const { return Slot
[0]->GetSquareUnder()->GetArea(); }
467 v2
GetPos(int I
= 0) const { return Slot
[I
]->GetSquareUnder()->GetPos(); }
468 square
* GetNearSquare(v2 Pos
) const { return Slot
[0]->GetSquareUnder()->GetArea()->GetSquare(Pos
); }
469 square
* GetNearSquare(int x
, int y
) const { return Slot
[0]->GetSquareUnder()->GetArea()->GetSquare(x
, y
); }
470 lsquare
* GetNearLSquare(v2 Pos
) const { return static_cast<lsquare
*>(Slot
[0]->GetSquareUnder()->GetArea()->GetSquare(Pos
)); }
471 lsquare
* GetNearLSquare(int x
, int y
) const { return static_cast<lsquare
*>(Slot
[0]->GetSquareUnder()->GetArea()->GetSquare(x
, y
)); }
472 virtual void SignalVolumeAndWeightChange();
473 virtual void CalculateVolumeAndWeight();
474 sLong
GetVolume() const { return Volume
; }
475 sLong
GetWeight() const { return Weight
; }
476 virtual void SignalEmitationIncrease(col24
);
477 virtual void SignalEmitationDecrease(col24
);
479 virtual void DropEquipment(stack
* = 0) { }
480 virtual truth
IsDangerous(ccharacter
*) const { return false; }
481 virtual truth
NeedDangerSymbol() const { return false; }
482 void WeaponSkillHit(int);
483 virtual void SetTeam(int) { }
484 void SpecialGenerationHandler();
485 item
* Duplicate(feuLong
= 0);
486 virtual void SetIsActive(truth
) { }
487 double GetBaseDamage() const;
488 int GetBaseMinDamage() const;
489 int GetBaseMaxDamage() const;
490 int GetBaseToHitValue() const;
491 int GetBaseBlockValue() const;
492 virtual void AddInventoryEntry(ccharacter
*, festring
&, int, truth
) const;
493 sLong
GetNutritionValue() const;
494 virtual void SignalSpoil(material
*);
495 virtual truth
AllowSpoil() const;
496 item
* DuplicateToStack(stack
*, feuLong
= 0);
497 virtual truth
CanBePiledWith(citem
*, ccharacter
*) const;
498 virtual sLong
GetTotalExplosivePower() const { return 0; }
499 virtual void Break(character
*, int = YOURSELF
);
500 virtual void SetEnchantment(int) { }
501 virtual void EditEnchantment(int) { }
502 virtual void SignalEnchantmentChange();
503 virtual double GetTHVBonus() const { return 0.; }
504 virtual double GetDamageBonus() const { return 0.; }
505 virtual void DrawContents(ccharacter
*) { }
506 virtual int GetEnchantment() const { return 0; }
507 sLong
GetEnchantedPrice(int) const;
509 int GetStrengthRequirement() const;
510 virtual int GetInElasticityPenalty(int) const { return 0; }
511 virtual truth
IsFixableBySmith(ccharacter
*) const { return false; }
512 virtual truth
IsFixableByTailor(ccharacter
*) const { return false; }
513 virtual sLong
GetFixPrice() const;
514 virtual void DonateSlotTo(item
*);
515 virtual int GetSpoilLevel() const;
516 virtual void SignalSpoilLevelChange(material
*);
517 void ResetSpoiling();
518 virtual void SetItemsInside(const fearray
<contentscript
<item
> >&, int) { }
519 virtual int GetCarryingBonus() const { return 0; }
520 cchar
* GetStrengthValueDescription() const;
521 cchar
* GetBaseToHitValueDescription() const;
522 cchar
* GetBaseBlockValueDescription() const;
523 virtual truth
IsInCorrectSlot(int) const;
524 truth
IsInCorrectSlot() const;
525 int GetEquipmentIndex() const;
526 room
* GetRoom(int I
= 0) const { return GetLSquareUnder(I
)->GetRoom(); }
527 virtual truth
HasBetterVersion() const { return false; }
528 virtual void SortAllItems(const sortdata
&) const;
529 virtual truth
AllowAlphaEverywhere() const { return false; }
530 virtual int GetAttachedGod() const;
531 virtual sLong
GetTruePrice() const;
532 virtual void Search(ccharacter
*, int) { }
533 virtual head
* Behead() { return 0; }
534 virtual truth
EffectIsGood() const { return false; }
536 virtual void AddAttackInfo(felist
&) const;
537 void AddMiscellaneousInfo(felist
&) const;
539 virtual void PreProcessForBone();
540 virtual void PostProcessForBone();
541 virtual void FinalProcessForBone() { }
542 virtual truth
SuckSoul(character
*, character
* = 0) { return false; }
543 void SetConfig(int, int = 0);
544 god
* GetMasterGod() const;
545 idholder
* GetCloneMotherID() const { return CloneMotherID
; }
546 virtual void SignalStackAdd(stackslot
*, void (stack::*)(item
*, truth
));
547 virtual int GetSquareIndex(v2
) const { return 0; }
548 virtual void Draw(blitdata
&) const;
549 v2
GetLargeBitmapPos(v2
, int) const;
550 void LargeDraw(blitdata
&) const;
551 virtual truth
BunnyWillCatchAndConsume(ccharacter
*) const { return false; }
552 void DonateIDTo(item
*);
553 virtual void SignalRustLevelChange();
554 virtual void SendNewDrawAndMemorizedUpdateRequest() const;
555 virtual void CalculateSquaresUnder() { SquaresUnder
= 1; }
556 int GetSquaresUnder() const { return SquaresUnder
; }
557 virtual void CalculateEmitation();
558 void FillFluidVector(fluidvector
&, int = 0) const;
559 virtual void SpillFluid(character
*, liquid
*, int = 0);
560 virtual void TryToRust(sLong
);
561 void RemoveFluid(fluid
*);
562 void RemoveAllFluids ();
563 void AddFluid(liquid
*, festring
, int, truth
);
564 virtual truth
IsAnimated() const;
565 const rawbitmap
* GetRawPicture() const;
566 void DrawFluidGearPictures(blitdata
&, int = 0) const;
567 void DrawFluidBodyArmorPictures(blitdata
&, int) const;
568 void CheckFluidGearPictures(v2
, int, truth
);
569 void DrawFluids(blitdata
&) const;
570 virtual void ReceiveAcid(material
*, cfestring
&, sLong
);
571 virtual truth
ShowFluids() const { return true; }
572 void DonateFluidsTo(item
*);
573 void Destroy(character
*, int);
574 virtual truth
AllowFluidBe() const { return true; }
575 virtual truth
IsRusted() const;
576 virtual void RemoveRust();
577 void SetSpoilPercentage(int);
578 virtual pixelpredicate
GetFluidPixelAllowedPredicate() const;
579 void RedistributeFluids();
580 virtual material
* GetConsumeMaterial(ccharacter
*, materialpredicate
= TrueMaterialPredicate
) const;
581 virtual material
* RemoveMaterial(material
*);
582 virtual void Cannibalize();
583 void InitMaterials(material
*, truth
= true);
584 void SetMainMaterial(material
*, int = 0);
585 void ChangeMainMaterial(material
*, int = 0);
586 virtual void GenerateMaterials();
587 virtual void InitMaterials(const materialscript
*, const materialscript
*, truth
);
588 int GetSquarePosition() const { return (Flags
& SQUARE_POSITION_BITS
) >> SQUARE_POSITION_SHIFT
; }
589 virtual void DestroyBodyPart(stack
*) { SendToHell(); }
590 int GetLifeExpectancy() const { return LifeExpectancy
; }
591 virtual void SetLifeExpectancy(int, int);
592 int NeedsBe() const { return LifeExpectancy
; }
593 truth
IsVeryCloseToDisappearance() const { return LifeExpectancy
&& LifeExpectancy
< 10; }
594 truth
IsVeryCloseToSpoiling() const;
595 virtual truth
IsValuable() const;
596 virtual truth
Necromancy(character
*) { return false; }
597 virtual void CalculateEnchantment() { }
598 virtual character
* GetBodyPartMaster() const { return 0; }
599 virtual truth
AllowFluids() const { return false; }
600 int GetHinderVisibilityBonus(ccharacter
*) const;
601 virtual DATA_BASE_TRUTH_WITH_PARAMETER(IsKamikazeWeapon
, ccharacter
*);
602 virtual void AddTrapName(festring
&, int) const;
603 int GetMainMaterialRustLevel() const;
604 truth
HasID(feuLong What
) const { return ID
== What
; }
605 virtual truth
Spoils() const;
606 int GetMaxSpoilPercentage() const;
607 truth
HasPrice() const;
608 virtual void Disappear();
609 festring
GetLocationDescription() const;
610 truth
IsEquipped() const;
611 festring
GetExtendedDescription() const;
612 virtual ccharacter
* FindCarrier() const;
613 virtual void BlockEffect(character
*, character
*, item
*, int type
) { }
614 virtual bool WillExplodeSoon() const { return false; }
615 virtual const character
* GetWearer() const;
616 virtual bool SpecialOfferEffect(int) { return false; }
619 void SendMemorizedUpdateRequest() const;
621 festring
ProcessMessage (cfestring
&xmsg
, ccharacter
*hitter
=0, ccharacter
*enemy
=0) const;
622 void ProcessAndAddMessage (cfestring
&xmsg
, ccharacter
*hitter
=0, ccharacter
*enemy
=0) const;
623 void ProcessAndAddRandomMessage (const fearray
<festring
> &list
, ccharacter
*hitter
=0, ccharacter
*enemy
=0) const;
625 virtual truth
IsHeadOfElpuri() const { return false; }
626 virtual truth
IsPetrussNut() const { return false; }
627 virtual truth
IsGoldenEagleShirt() const { return false; }
628 virtual truth
IsMoneyBag () const { return false; }
629 virtual truth
IsKleinBottle () const { return false; }
630 virtual truth
IsTheAvatar() const { return false; }
631 virtual truth
IsExplosive() const { return false; }
632 virtual truth
IsConsumable() const { return true; }
633 virtual truth
IsWhip() const { return false; }
634 virtual truth
IsBroken() const;
635 virtual truth
IsFood() const;
636 virtual truth
IsBanana() const { return false; }
637 virtual truth
IsEncryptedScroll() const { return false; }
638 virtual truth
IsShadowVeil () const { return false; }
639 virtual truth
IsLostRubyFlamingSword () const { return false; }
640 virtual truth
IsMangoSeedling() const { return false; }
641 virtual truth
IsMondedrPass () const { return false; }
642 virtual truth
IsRingOfThieves () const { return false; }
643 virtual truth
IsGorovitsFamilyRelic() const { return false; }
644 virtual truth
IsBananaPeel() const { return false; }
645 virtual truth
IsLanternOnWall() const { return false; }
646 virtual truth
IsABone () const { return false; }
647 virtual truth
IsASkull () const { return false; }
649 //FIXME:k8: are there such functions already? can we use RTTI?
650 virtual truth
IsCorpse () const { return false; }
651 virtual truth
IsBodyPart () const { return false; }
652 virtual truth
IsBottle () const { return false; }
653 virtual truth
IsCan () const { return false; }
654 virtual truth
IsScroll () const { return false; }
655 virtual truth
IsMango () const { return false; }
657 virtual truth
AllowDetailedDescription () const { return false; }
659 virtual truth
IsBoneNameSingular () const override
{ return (GetNameSingular() == "bone"); }
661 inline cchar
*GetClassID () const { return (FindProtoType() ? FindProtoType()->GetClassID() : ""); }
662 virtual const prototype
* FindProtoType () const { return &ProtoType
; }
665 virtual cchar
* GetBreakVerb() const;
666 virtual sLong
GetMaterialPrice() const;
667 void LoadDataBaseStats();
668 virtual void PostConstruct() { }
669 void Initialize(int, int);
670 virtual int GetGraphicsContainerIndex() const;
671 virtual truth
ShowMaterial() const;
672 virtual truth
AllowSparkling() const { return !Fluid
; }
673 virtual truth
WeightIsIrrelevant() const { return false; }
674 virtual truth
AddStateDescription(festring
&, truth
) const;
675 static const prototype ProtoType
;
679 const database
* DataBase
;
682 idholder
* CloneMotherID
;
684 int FluidCount
; // same as 'SquaresUnder'?
694 #ifdef __FILE_OF_STATIC_ITEM_PROTOTYPE_DEFINITIONS__
695 #define ITEM_PROTO(name, base)\
696 template<> const itemprototype\
697 name##sysbase::ProtoType(&base::ProtoType,\
698 (itemspawner)(&name##sysbase::Spawn),\
699 (itemcloner)(&name##sysbase::Clone), #name);
701 #define ITEM_PROTO(name, base)
704 #define ITEM(name, base)\
706 typedef sysbase<name, base, itemprototype> name##sysbase;\
707 ITEM_PROTO(name, base)\
708 class name : public name##sysbase