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

Added "overlay" functionality for player/NPCs. #8993

Merged
merged 4 commits into from Sep 17, 2014

Conversation

Projects
None yet
8 participants
@CIB
Copy link
Contributor

commented Sep 14, 2014

New tileset IDs:

  • overlay_worn_{ITEM ID}, overlay drawn over the character when the item is worn
  • overlay_wielded_{ITEM ID}, overlay drawn over the character when the item is wielded

Yes, this currently requires all character sprites to be compatible. Probably not an issue, otherwise we'll really want to think of a better system than mangling stuff into IDs with _.

Tested this by modifying existing tileset.

        {
          "rotates": false,
          "id": "overlay_wielded_crowbar",
          "fg": 2470,
          "bg": 2
        },
        {
          "rotates": false,
          "id": "overlay_worn_sunglasses",
          "fg": 2471,
          "bg": 2
        },
        {
          "rotates": false,
          "id": "overlay_wielded_sunglasses",
          "fg": 2472,
          "bg": 2
        },
        {
          "rotates": false,
          "id": "overlay_mutation_ARM_TENTACLES",
          "fg": 2473,
          "bg": 2
        }

Wielded crowbar, worn sunglasses:
wielding_crowbar

Wielded sunglasses:
wielding_sunglasses

Tentacle arms:
tentacle_arms

Added "overlay" functionality for player/NPCs.
New tileset IDs:
- overlay_worn_{ITEM ID}, overlay drawn over the character when the item is worn
- overlay_wielded_{ITEM ID}, overlay drawn over the character when the item is wielded
@Mshock777

This comment has been minimized.

Copy link
Contributor

commented Sep 14, 2014

WOW....

Does it lokk better?
1

// next clothing
// TODO: worry about correct order of clothing overlays
for(const item& worn_item : worn) {
if(worn_item.is_null()) {

This comment has been minimized.

Copy link
@kevingranade

kevingranade Sep 14, 2014

Member

Can this actually happen? 'worn' can be empty, but that results in not entering the loop at all.

This comment has been minimized.

Copy link
@CIB

CIB Sep 14, 2014

Author Contributor

It probably can't happen, but I wasn't sure at that point. There certainly are bugs where you get null items in your inventory, though I guess it wouldn't be too horrible to include those(they'll just not get rendered).

@CIB

This comment has been minimized.

Copy link
Contributor Author

commented Sep 14, 2014

@Mshock777 I'm sure anything will look better than my coder art. Just testing functionality. I think to make this properly work, you'd have to design the character sprite from scratch to work well with overlays, the way e.g. DCSS does it.

Fix draw_entity_with_overlays return type.
Function doesn't return anything.
@Mshock777

This comment has been minimized.

Copy link
Contributor

commented Sep 14, 2014

Yeah, I already guessed it. :-(
3

Looks like now this world will be like internet, where men are men and women are also men. :-)

Can you tell me, does it look normal?
4a
4b

@BevapDin

This comment has been minimized.

Copy link
Contributor

commented Sep 14, 2014

Just for the record: You can use item::typeId(), it returns the item type id, just some_item.type->id, but it also handles the case when item::type is null (and returns a string containing "null" in that case). That way you don't need to check for is_null.

Edit: no item in the worn vector should ever have null pointer as type, actually they should all have pointers to it_armor. Otherwise many other places will cause a crash as usually the type of a worn item is simply casted to it_armor, without checking for null, e.g. in player::volume_capacity, player::warmth, player::encumb and probably more.

@Zireael07

This comment has been minimized.

Copy link
Contributor

commented Sep 14, 2014

pinch self This is happening? pinch self this IS happening!!!

@KA101

This comment has been minimized.

Copy link
Contributor

commented Sep 14, 2014

Well, Waldo wanted his stuff replaced anyway.

Mshock, ease off the sexism. The PC tiles were both kinda stereotypical there, and unifying 'em a bit would probably be worthwhile.

@CIB

This comment has been minimized.

Copy link
Contributor Author

commented Sep 14, 2014

btw, not ready for merge yet, need to still replace the item->type thing as BevapDin pointed out.

@Rivet-the-Zombie

This comment has been minimized.

Copy link
Member

commented Sep 14, 2014

This is so cool!

@CIB

This comment has been minimized.

Copy link
Contributor Author

commented Sep 15, 2014

Okay, ready.

@Mshock777

This comment has been minimized.

Copy link
Contributor

commented Sep 15, 2014

I have a question, in what order overlays will be drawn? Like knee-high boots should be over pants,trenchcoats too. And, as I imagine, layered clothes work properly?

@CIB

This comment has been minimized.

Copy link
Contributor Author

commented Sep 15, 2014

Yeah, order is still an issue. How does layered clothing work? It allows you to re-arrange anything that covers the same slot? If so, using that should work for doing rendering order properly.

Otherwise: eyes > head > mouth > torso > boots = hands > legs = arms?

@Mshock777

This comment has been minimized.

Copy link
Contributor

commented Sep 15, 2014

I think mouth is over head.
Also try this, it's paint.net file with layers (not finished tiles)
http://www.mediafire.com/download/712015prfar1km9/4.pdn

@kevingranade kevingranade merged commit 93a99ac into CleverRaven:master Sep 17, 2014

1 check passed

default This has been rescheduled for testing as the 'master' branch has been updated.
@Robik81

This comment has been minimized.

Copy link
Contributor

commented Sep 21, 2014

Cool!

// TODO: distinguish between male/female?

I think it is good idea, if it also work with only one available. Some tileset makers will prefer to do only one, others might want to separate.

@KA101

This comment has been minimized.

Copy link
Contributor

commented Sep 21, 2014

FWIW no mutation discriminates based on character sex/gender, and neither does any gear.

@Robik81

This comment has been minimized.

Copy link
Contributor

commented Sep 21, 2014

Indeed. Still, men and women look different, even when dressed up in same clothing. And it does not have to be same clothing. Men pants and women pants are both pants, yet they often differ.

Some tileset makers might want to differentiate.

This was referenced Sep 23, 2014

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.