Author Topic: Temple Of Astarte Map 3 - Random Crash  (Read 23 times)

peewee_RotA

  • Sr. Member
  • Posts: 268
  • Karma: +8/-0
    • View Profile
Temple Of Astarte Map 3 - Random Crash
« on: September 02, 2018, 06:02:16 AM »
There is a random crash near the end of the level. It's the room where you get dispell magic scrolls. One of the trap spell's projectiles can cause a game crash. The projectile is a dispell magic projectile. The cause of the problem is that somehow an effect already on the player is way too high.

The crash happens here:
https://github.com/cabbruzzese/AmuletsArmor/blob/master/Source/EFFECT.C#L1146

It appears the power of the effect when it was first applied was set to a garbage value.

What ultimately crashes is this debug line:
https://github.com/cabbruzzese/AmuletsArmor/blob/master/Source/EFFECT.C#L1749


After doing some digging, it looks like there was a line to protect from this by clamping the value to the max power.
https://github.com/cabbruzzese/AmuletsArmor/blame/master/Source/EFFECT.C#L1014

Unfortunately that was commented out a long time ago. I'm just wondering if there was a known reason for removing this line. I'm going to re-enable it and test for a bit to see if it has any unwanted side effects. I know that the magic map has some quirks when it comes to power levels, but it should never go above 4.

The only other thing I can think of is the wrap around powerlevel issue. This is why the one priest spell made player's vision dark because it had such a high power it wrapped around to a lower value when converted. I wonder if this was removed to make sure that a wrap around powerlevel effect would have the same value as the source when the remove effect code runs (because it compares type and power level to find the correct effect to account for stacking effects). Anyway, I'm going to just test it a bit and hopefully find any possible side effects.
« Last Edit: September 02, 2018, 06:07:57 AM by peewee_RotA »