Attnam / ivan

Iter Vehemens ad Necem - a continuation of the graphical roguelike by members of http://attnam.com
GNU General Public License v2.0
301 stars 43 forks source link

Fix #415 #553

Closed jakwings closed 5 years ago

jakwings commented 5 years ago

No rotated pictures for equipments and newly-spawned items.

red-kangaroo commented 5 years ago

Nice!

andrewtweber commented 5 years ago

Awesome. So they only rotate if thrown?

jakwings commented 5 years ago

Yes, only when thrown/blown/kicked up. And reset when picked up.

The problem is basically caused by uninitialized values.

AquariusPower commented 5 years ago

I would like to add a minor thing you may have perceived (at least prior to this pr): after some items are thrown, after they rotate, the final rotation is not kept on next turn. So whenever you step again, that item will "become alive" and 1/4 spin (one spin step) again.

I think the rotation could be reset after thrown, no matter what spin step it was, just to prevent that glitch. I havent tested this merge yet to see if affected that.

jakwings commented 5 years ago

That isn't fixed yet.

  if(ivanconfig::GetRotateTimesPerSquare()>0 && iRotateFlyingThrownStep!=0){ //must be disabled before exiting Fly()
    iRotateFlyingThrownStep=4; //default rotation is w/o the rotation flags at the switch(){}
    //force redraw at default rotation to avoid another spin when player moves TODO how to let it stay in the last rotation?
    RemoveFromSlot();LandingSquare->GetStack()->AddItem(this, false); //TODO find a better way then remove and re-add to same square...
    game::DrawEverything();
    iRotateFlyingThrownStep=0; //disables rotation
  }

You mean this? So your solution was already there but the bug made me think the rotation should not be reset.

Now the solution is either to clean up some code from my commit and add this:

    while(clock() - StartTime < fFlyDelay * CLOCKS_PER_SEC);
    game::DrawEverything();

or remove that line:

    iRotateFlyingThrownStep=0; //disables rotation
AquariusPower commented 5 years ago
 while(clock() - StartTime < fFlyDelay * CLOCKS_PER_SEC);
 game::DrawEverything();

mmm... I cant recall it, but apparently it worked then, but not as often as it should be (always). so with that code, it would wait a tiny bit and apply the fix. if it works, would be great! :)

obs.: I think not disabling the rotation caused other problems.