MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / ProcessEffects

Function ProcessEffects

TombEngine/Game/effects/effects.cpp:1787–1942  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1785}
1786
1787void ProcessEffects(ItemInfo* item)
1788{
1789 constexpr auto MAX_LIGHT_FALLOFF = 13;
1790 constexpr auto BURN_HEALTH_LARA = 7;
1791 constexpr auto BURN_HEALTH_NPC = 1;
1792 constexpr auto BURN_AFTERMATH_TIMEOUT = 4 * FPS;
1793 constexpr auto BURN_DAMAGE_PROBABILITY = 1 / 8.0f;
1794
1795 if (item->Effect.Type == EffectType::None)
1796 return;
1797
1798 if (item->Effect.Count > 0)
1799 {
1800 item->Effect.Count--;
1801
1802 if (!item->Effect.Count)
1803 {
1804 if (item->Effect.Type == EffectType::Fire ||
1805 item->Effect.Type == EffectType::Custom ||
1806 item->Effect.Type == EffectType::ElectricIgnite ||
1807 item->Effect.Type == EffectType::RedIgnite)
1808 {
1809 item->Effect.Type = EffectType::Smoke;
1810 item->Effect.Count = BURN_AFTERMATH_TIMEOUT;
1811 }
1812 else
1813 {
1814 item->Effect.Type = EffectType::None;
1815 return;
1816 }
1817 }
1818 }
1819
1820 int numMeshes = Objects[item->ObjectNumber].nmeshes;
1821 for (int i = 0; i < numMeshes; i++)
1822 {
1823 auto pos = GetJointPosition(item, i);
1824
1825 switch (item->Effect.Type)
1826 {
1827 case EffectType::Fire:
1828 if (TestProbability(1 / 8.0f))
1829 TriggerFireFlame(pos.x, pos.y, pos.z, TestProbability(1 / 10.0f) ? FlameType::Trail : FlameType::Medium);
1830
1831 break;
1832
1833 case EffectType::Custom:
1834 if (TestProbability(1 / 8.0f))
1835 {
1836 TriggerFireFlame(
1837 pos.x, pos.y, pos.z, TestProbability(1 / 10.0f) ? FlameType::Trail : FlameType::Medium,
1838 item->Effect.PrimaryEffectColor, item->Effect.SecondaryEffectColor);
1839 }
1840
1841 break;
1842
1843 case EffectType::Sparks:
1844 if (TestProbability(1 / 10.0f))

Callers 2

UpdateAllItemsFunction · 0.85
UpdateLaraFunction · 0.85

Calls 15

GetJointPositionFunction · 0.85
TestProbabilityFunction · 0.85
TriggerFireFlameFunction · 0.85
TriggerElectricSparkFunction · 0.85
GenerateAngleFunction · 0.85
TriggerRocketSmokeFunction · 0.85
SpawnDynamicLightFunction · 0.85
GenerateIntFunction · 0.85
SoundEffectFunction · 0.85
DoDamageFunction · 0.85
GetPointCollisionFunction · 0.85
IsLaraMethod · 0.80

Tested by

no test coverage detected