What about if say theres a material called soot or charred.
.....like a black water for now.....but it covers stuff similar to how water does. When items burn.
//In object.h: class object : public entity, public id { public: ... truth Burning; //Added virtual void SetIsBurning(truth What) {Burning = What;} //Added virtual truth IsBurning() const { return Burning; } //Added //In miscitem.h: ITEM(stick, item) { public: virtual truth Apply(character*); //Added virtual truth IsAppliable(ccharacter*) const { return true; } //Added protected: virtual void AddPostFix(festring& String, int) const { AddLumpyPostFix(String); } virtual truth ShowMaterial() const { return false; } virtual truth WeightIsIrrelevant() const { return true; } }; //in miscitem.cpp truth stick::Apply(character* Applier) //Added this function { if(Applier->IsPlayer()) { ADD_MESSAGE("You light %s.", CHAR_NAME(DEFINITE)); ADD_MESSAGE("Burning is %d", Burning); ADD_MESSAGE("IsBurning is %d", IsBurning()); } SetIsBurning(true); UpdatePictures(); ADD_MESSAGE("The %s now burns brightly.", CHAR_NAME(DEFINITE)); ADD_MESSAGE("Burning is %d", Burning); ADD_MESSAGE("IsBurning is %d", IsBurning()); return true; } //in object.cpp: void object::UpdatePictures(graphicdata& GraphicData, v2 Position, int SpecialFlags, alpha MaxAlpha, int GraphicsContainerIndex, bposretriever BitmapPosRetriever) const { ... alpha Alpha; // added this new condition below if(IsBurning()) //is burning is sometimes initially filled with crap, so Burning should be initialised to zero { SpecialFlags &= ST_FLAMES; //this should be the |= operator, not the &= operator. }
Synchronised to sandbox repo: 20141116 - Graded charring in the bitmap, achieved by selecting the RGB colour with the max intensity, RSHIFT max intensity by 2, RSHIFT old RGB by 3 and then add these together with Max>>2 to form the new 'burnt' RGB values Different materials now have different burn times. Introduced a BurnModifier() which determines the duration of burning based on material strength, fire resistance and density, according to the formula (500 + Den + ((Str * FR) >> 1)) 20141116 - Made it so that the words "(on fire)" appear in the post-fix of meleeweapons and armors that are on fire, a la fluids (covered in ...) 20141116 - Prevented wooden flaming swords from catching fire. Achieved this via CanBeBurned in item.h and item.dat and test condition in item::ReceiveDamage 20141116 - Caused burning phoenix feather to reset and stop burning once it gets completely burnt. Wondering if this needs a separate message. 20141116 - Introduced code for extinguishing flames via the function Extinguish() (opposite function to Ignite()) - wielded equipment graphics still do not extinguish for some reason 20141116 - Ghosts, powder, fluids were all burning. Even the snow in Attnam was on fire! This was fixed by adding "virtual int IsBurning() const { return 0; }" to liquids (therefore powders) and gasses. Not ideal means of fixing this. it should really be fixed at the level of object.h Updated the Activation energy threshold to the following formula: ActivationEnergy = 0.5 x MaterialStrength + 5 x MaterialFireResistance + FireResistanceItemEnchantment Revised hence the FireResistance of all materials key: (YYYYMMDD) = complete BF = bugfix FE = feature BA = balancing To do: BF - Graded charring in the bitmap BF - Whenever a meleeweapon or something with a secondary material is completely burnt, then a lump of the secondary material is created BF - Flames do not go away on wielded equipment when extiguished. Clue: The flames do go away when the (phoenix feather) sword is covered in blood BF - Flames do not animate when a stick of balsa is ignited (item sitting far away when ignited??) FE - Once something is on fire, try to get it to infect the rest of the stack and player inventory FE - Introduce the 'on fire' postfix, for (all) things that are presently on fire FE - Include wetness in the formula for activation energy FE - Handle the duration of burning via mass-density, fire resistance, enchantments and material wetness FE - Implement ways of putting flames out FE - Introduce thermal energy (integrate fire damage over cascading explosions) FE - Chance to decrement enchantment when gear is burnt (magic fire?) FE - Flaming sword burning effect FE - Smashing lanterns should be a source of fire FE - Get tailors to repair burnt fabric FE - Burning bodyparts FE - ?Create smoke in tunnels FE - ?Vomit to extinguish fires FE - Burning objects persisting in the bonefile FE - Burning golems FE - Burning phoenix feather golems FE - Make it so melee weapons that are on fire spread fire to enemies BA - Hard code ironalloys so that they cannot burn (avoiding (possible?/untested) conflict with rusting graphics) BA - Give goblinoid magic users mirrored wands Partially done: 20141116 - FE - Destroy objects once they are completely burnt up 20141116 - FE - Special property for phoenix feather material 20141116 - FE - Introduce the 'on fire' postfix, for meleeweapons and armors that are presently on fire 20141116 - BA - Improve ignition by way of explosions. Get Explosion Strength to scale nice and linearly with Activation Energy Complete: 20141116 - BF - Stop - f.ex. wooden - flaming swords from catching fire 20141116 - BF - Ghosts, powder, fluids are all burning. Even the snow in Attnam is on fire! 20141116 - BA - Prevent the TestActivationEnergy algorithm from testing objects that cannot burn anyway
int rightarm::GetSpecialFlags() const { return !GetMaster()->IsPlayer() ? SpecialFlags|ST_RIGHT_ARM : SpecialFlags|ST_RIGHT_ARM|ST_FLAME_1; }