Open kamiccolo opened 6 years ago
There is a randomization on Thunderbolt so the fix is to bound check the drawing on surface. Probably in future there should be "drawPixelSafe" and "drawPixelFast" and ThunderBolt should use "drawPixelSafe"
Please update to master
(or to this revision) and report back if the issue is fixed.
Thank you @kamiccolo for bug report.
Fix commit: https://github.com/ciplogic/fheroes2enh/commit/133620872c4616b585081a181e003faae7a6ec10
The issue still persists :( It feels like color overflowing as well:
#0 0x000000000041a792 in Surface::SetPixel4 (this=0x9761c0 <Display::Get()::inside>, x=2053, y=1199, color=3993042943) at /home/zilvinas/Compile/fheroes2enh/src/engine/surface.cpp:509
#1 0x000000000041d3f8 in Surface::drawPixel (this=0x9761c0 <Display::Get()::inside>, x=2053, y=1199, brightness=0.933349609, col=65535) at /home/zilvinas/Compile/fheroes2enh/src/engine/surface.cpp:1110
#2 0x000000000041d6c3 in Surface::drawAALine (this=0x9761c0 <Display::Get()::inside>, x0=608, y0=297, x1=20864, y1=12942, col=...) at /home/zilvinas/Compile/fheroes2enh/src/engine/surface.cpp:1182
#3 0x00000000004c7fbf in RedrawSparksEffects (src=..., dst=...) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/battle/battle_interface.cpp:4205
#4 0x00000000004c827a in Battle::Interface::RedrawTroopWithFrameAnimation (this=0xb501d0, b=..., icn=599, m82=126, pain=true) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/battle/battle_interface.cpp:4256
#5 0x00000000004c4d7e in Battle::Interface::RedrawActionLightningBoltSpell (this=0xb501d0, target=...) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/battle/battle_interface.cpp:3513
#6 0x00000000004c16fc in Battle::Interface::RedrawActionSpellCastPart1 (this=0xb501d0, spell=..., dst=54, caster=0xd6e970, name="Ranloo", targets=...)
at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/battle/battle_interface.cpp:2915
#7 0x0000000000482c42 in Battle::Arena::ApplyActionSpellDefaults (this=0x7fffffffd4b0, cmd=..., spell=...) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/battle/battle_action.cpp:697
#8 0x000000000048067d in Battle::Arena::ApplyActionSpellCast (this=0x7fffffffd4b0, cmd=...) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/battle/battle_action.cpp:168
#9 0x0000000000480444 in Battle::Arena::ApplyAction (this=0x7fffffffd4b0, cmd=...) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/battle/battle_action.cpp:95
#10 0x0000000000488ddd in Battle::Arena::TurnTroop (this=0x7fffffffd4b0, current_troop=0xafbe70) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/battle/battle_arena.cpp:358
#11 0x000000000048947c in Battle::Arena::Turns (this=0x7fffffffd4b0) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/battle/battle_arena.cpp:446
#12 0x00000000004ced66 in Battle::Loader (army1=..., army2=..., mapsindex=1699) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/battle/battle_main.cpp:79
#13 0x00000000005a7a0b in BattleHeroWithMonster (hero=..., army=..., dst_index=1699) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/heroes/heroes_action.cpp:778
#14 0x00000000005b3dd0 in ActionToCaptureObject (hero=..., obj=192, dst_index=1699) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/heroes/heroes_action.cpp:2334
#15 0x00000000005b34c1 in ActionToAbandoneMine (hero=..., obj=192, dst_index=1699) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/heroes/heroes_action.cpp:2249
#16 0x00000000005a764a in Heroes::Action (this=0xd6e970, dst_index=1699) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/heroes/heroes_action.cpp:652
#17 0x00000000005ce4bc in Heroes::MoveStep (hero=..., index_from=1698, index_to=1699, newpos=true) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/heroes/heroes_move.cpp:489
#18 0x00000000005ce74f in Heroes::MoveStep (this=0xd6e970, fast=false) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/heroes/heroes_move.cpp:533
#19 0x00000000005cf98a in Heroes::Move (this=0xd6e970, fast=false) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/heroes/heroes_move.cpp:849
#20 0x0000000000577833 in Interface::Basic::HumanTurn (this=0x976ac0 <Interface::Basic::Get()::basic>, isload=true) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/game/game_startgame.cpp:912
#21 0x0000000000576446 in Interface::Basic::StartGame (this=0x976ac0 <Interface::Basic::Get()::basic>) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/game/game_startgame.cpp:585
#22 0x00000000005739e4 in Game::StartGame () at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/game/game_startgame.cpp:72
#23 0x00000000005594b6 in main (argc=1, argv=0x7fffffffe128) at /home/zilvinas/Compile/fheroes2enh/src/fheroes2/game/fheroes2.cpp:307
I will fix it this evening with the "setPixelSafe".
Mhm. I'm not sure if that's the problem.
Point interpolated = pointLerp(start, endPoint, pos);
interpolated.x += Rand::Get(-20, 20);
interpolated.y += Rand::Get(-20, 20);
Becomes {x = -10090, y = 21899}
for some weird reason o_0 So, drawPoints in populateSpark() gets fishy values.
EDIT:
Of course, Rand::Get()
is casting to uint32_t...
It looks fixed now. Can you test it by taking 'master' branch again?
Well, the master is quite messed up at the moment... ;)
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp: In function ‘int IMG_SavePNG_RW(SDL_RWops*, SDL_Surface*, int)’:
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:310:1: error: jump to label ‘savedone’ [-fpermissive]
savedone: /* clean up and return */
^
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:102:14: note: from here
goto savedone;
^
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:118:22: note: crosses initialization of ‘SDL_PixelFormat* fmt’
SDL_PixelFormat* fmt = surf->format;
^
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:310:1: error: jump to label ‘savedone’ [-fpermissive]
savedone: /* clean up and return */
^
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:94:14: note: from here
goto savedone;
^
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:118:22: note: crosses initialization of ‘SDL_PixelFormat* fmt’
SDL_PixelFormat* fmt = surf->format;
^
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:310:1: error: jump to label ‘savedone’ [-fpermissive]
savedone: /* clean up and return */
^
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:88:14: note: from here
goto savedone;
^
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:118:22: note: crosses initialization of ‘SDL_PixelFormat* fmt’
SDL_PixelFormat* fmt = surf->format;
^
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:310:1: error: jump to label ‘savedone’ [-fpermissive]
savedone: /* clean up and return */
^
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:81:14: note: from here
goto savedone;
^
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:118:22: note: crosses initialization of ‘SDL_PixelFormat* fmt’
SDL_PixelFormat* fmt = surf->format;
^
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:310:1: error: jump to label ‘savedone’ [-fpermissive]
savedone: /* clean up and return */
^
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:74:14: note: from here
goto savedone; /* Nothing to do. */
^
/home/zilvinas/Compile/fheroes2enh/src/engine/IMG_savepng.cpp:118:22: note: crosses initialization of ‘SDL_PixelFormat* fmt’
SDL_PixelFormat* fmt = surf->format;
^
CMakeFiles/fheroes2.dir/build.make:278: recipe for target 'CMakeFiles/fheroes2.dir/src/engine/IMG_savepng.cpp.o' failed
make[2]: *** [CMakeFiles/fheroes2.dir/src/engine/IMG_savepng.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
Casting Lightning Bolt on a Ghost in the Graveyard causes Segmentation Fault.
Backtrace:
Yet, another backtrace from casting Lightning Bolt on Dwarves:
Also, save file next to the graveyard. To reproduce, enter it and cast lightning bolt: https://drive.google.com/open?id=1jBq8fS8rjBBoCSIQ3F3_46EL9F_QpDnW