-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Creatures above cast shadows onto tiles below #66730
Conversation
also remove some rogue code comments from my previous PRs
I guess it should resolve #66657 |
Thanks. Updated main comment. |
Co-Authored-By: Jianxiang Wang (王健翔) <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auto-requesting reviews from non-collaborators: @jbytheway
I hope you don't mind some questions How does it handle if a creature(with its own sprite) is occupying the tile where the shadow would be placed? (Looking at the changes, seems it just doesn't draw the shadow?) What if the creature on z=0 does not have a sprite defined (or is using ASCII fallback), does it still cancel out drawing the shadow sprite? Does it draw the shadow if the shadow would be placed on an 'impassable' tile (e.g. the walled edge of a building)? |
Yup. Tilesets like Ultica give creatures their own shadows so I didn't think it necessary.
Any draw function with a fallback should still return true which should stop the shadow drawing. If nothing is drawn, such as in the case of an invisible creature, then the shadow function will run.
Nope. Both walls and the ceiling above them should return true on |
Summary
Features "Creatures above cast shadows onto tiles below"
Purpose of change
Creatures above the z-level of the player can be difficult to detect due to the lack of visual indications of their presence.
Fixes #66657
Describe the solution
Make creatures cast shadows unto tiles below. Image used for the shadow is determined by each tileset via the new
shadow
sprite id. The hostility indicator will also be drawn when applicable. Naturally, this feature will not be functional until ashadow
sprite is assigned to the tilesets and the next tileset update takes place. I will work on that unless someone else wants to.A simpler version is used in curses which mimics how critters below the current z-level are currently drawn. Because the "critter above" indicator has the potential to obscure the underlying tile, both the "critter above" and "critter below" indicator were made to blink. These are affected by the "Blinking effects speed" setting.
Describe alternatives you've considered
Testing
Builds ok in both tiles and curses.
Tested in both isometric and non-isometric mode by assigning a
shadow
sprite using a modBoth shadow and hostility indicators are drawn correctly.
Performance impact is negligible.
Additional context