Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Left/right sprite flipping in iso mode. Run and crouch overlay. Minor extras. #31439

Merged
merged 2 commits into from Jun 16, 2019

Conversation

Projects
None yet
5 participants
@AnthonBerg
Copy link
Contributor

commented Jun 15, 2019

  • add isometric branches to facing-left/facing-right calculations for monsters and player (including actions and ranged). The calculations are reasonably simple and fast.

  • enable sprite flipping in isometric mode when appropriate

  • clarify to-flip-or-not-to-flip code for right/left-facing stuff

  • flip all entity and overlay sprites in hitbutton_iso so they are facing right like in all the other tilesets :)

  • add run and crouch tile overlay support

  • add run and crouch overlay tiles to hitbutton_iso tileset

  • add parameter comments to some function calls that have many parameters

  • sneak brainless zombie sprite into hitbutton_iso tileset

  • bonus: unshadow a couple of variables in a big tile-drawing function (x, y, col)

Summary

SUMMARY: Interface "Left/right sprite flipping in iso mode, run and crouch overlay"

Purpose of change

Until now it has only been in non-isometric mode that sprites have been flipped right/left to match orientation. Here's an attempt at addressing that. Run and crouch sprite overlay support is also added, as well as tiles to support it in hitbutton_iso.

Describe the solution

Added simple and fast logic to get the left/right movement in isometric space. Added iso logic to sprite-orientation draw calls to allow horizontal flipping. (Still no rotation or vertical flipping in iso mode.) Clarified some code a little bit too.

Also flipped all entity sprites in hitbutton_iso to be RIGHT-facing instead of left-facing. All the other tilesets have right-facing sprites out of the box.

We also add a RUN and CROUCH overlay tile support.

Plus some comments and cleanup, and a brainless zombie sprite.

Sending this in as one big pull request. My apologies. Thanks for your patience. The thing is that because of the sprite flipping that was required for hitbutton_iso, untangling this into separate PRs was a noticeable amount of hassle. The work came about in a long hacking session. Maybe this is all decent enough to be accepted as-is? If it's hard to work with this PR as is I'll rework it. Thanks.

I see these as only small changes that bring out the expressivity that's already in the engine. L/R facing sprites, sees-player alerts, and run/crouch overlays add A LOT to the gameplay in isometric mode.

Additional context

Screenshots:

Little computer person running to the left with lots of zombies approaching from both sides. Most of the zombies see the player, except some brainless zombies.
Screenshot 2019-06-13 at 23 04 10

Little computer person crouches behind a road roller. Most of the zombies don't see us anymore.
Screenshot 2019-06-13 at 23 09 30

* add isometric branches to facing-left/facing-right calculations for
monsters and player (including actions and ranged). The calculations are
 simple and fast.
* enable sprite flipping in isometric mode when appropriate
* clarify to-flip-or-not-to-flip code for right/left-facing stuff
* flip all entity and overlay sprites in hitbutton_iso so they are
facing right like in all the other tilesets :)

* add run and crouch tile overlay support
* add run and crouch overlay tiles to hitbutton_iso tileset

* add parameter comments to some function calls that have many
parameters

* sneak brainless zombie sprite into hitbutton_iso tileset

* bonus: unshadow a couple of variables in big tile-drawing functions(x,
 y, col)
@kevingranade

This comment has been minimized.

Copy link
Member

commented Jun 15, 2019

This pull request has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/tileset-editing-with-imagemagick-jq-fish-clion-and-pixelmator-pro/20228/13

@kevingranade

This comment has been minimized.

Copy link
Member

commented Jun 15, 2019

Nice, minor thing, needs astyling.

@SomeDeadGuy

This comment has been minimized.

Copy link
Contributor

commented Jun 15, 2019

Yes, thank you! This is something i wanted for a long time!

@AnthonBerg

This comment has been minimized.

Copy link
Contributor Author

commented Jun 15, 2019

Thanks for the kind words! – I am undeserving as I keep forgetting to astyle! :) I am full of ambition to improve my citizenship. I'll fix!

(The chipper tone here is due to recent consumption of coffee (hot) and not intended to be sarcastic :) )

* convert "if ( not tile_iso )" to "if ( ! tile_iso )" because MSVC
doesn't seem to have the `not` keyword. (Honestly I was surprised it
worked at all in C++. Kind of typed it by accident to begin with!)

* make astyle :)
@AnthonBerg

This comment has been minimized.

Copy link
Contributor Author

commented Jun 15, 2019

There we go!

I also notice that my Summary line could be improved – thanks Night-Pryanik! :)

@Night-Pryanik

This comment has been minimized.

Copy link
Member

commented Jun 15, 2019

You are welcome!

@ZhilkinSerg ZhilkinSerg self-assigned this Jun 15, 2019

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor

commented Jun 16, 2019

@ZhilkinSerg ZhilkinSerg merged commit 11bdd78 into CleverRaven:master Jun 16, 2019

2 of 3 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
gorgon-ghprb Build finished.
Details

@ZhilkinSerg ZhilkinSerg removed their assignment Jun 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.