Advertiser Content

Pokeemerald Costume Menu

Started by slawter666 November 6th, 2018 7:01 PM
  • 3299 views
  • 11 replies
Seen May 29th, 2019
Posted May 26th, 2019
106 posts
11.1 Years
I've always enjoyed the idea of customisation in games, so I've implemented a costume menu for Pokémon Emerald using the pokeemerald disassembly, and the best part is the source code is available for all to enjoy (src/costume_menu.c).

Features:
  • Ability to change the character you play as via a menu.
  • Up to 255 costumes (though that can be easily expanded if required)
  • Filter costumes by male/female/unlocked.
  • Locked costumes are displayed in greyscale.
  • Ability to hide specific costumes from being displayed until they’ve been unlocked.
  • Dynamic overworld and reflection palette system.
  • Support for asymmetric overworlds.

Planned features:
  • Expanded overworlds (Whilst I have started this and am fairly sure on how to do the rest, I am unable to do so until more code has been decompiled, specifically any code that references gSaveBlock1Ptr).
  • Accurate Gen IV style overworlds (Requires custom graphics, if you’re interested in contributing check out the Playable Character Community Project thread).

Known issues:
  • Due to having started the overworld expansion but being unable to complete is at present, any event object over 255 cannot be displayed.
  • As custom graphics are required there are some graphical issues with placeholder graphics that share the same palette slot (such as the player’s running pose for instance) but use a different palette.

I may provide a standalone branch with only the costume menu and dynamic palette system if it is wanted.

Adding new costumes
  • Within “include/constants/costumes.h” Add new defines (before NUMBER_OF_COSTUMES) for your new costumes and renumber them accordingly, this will affect SaveBlock2 so any previous save will be incompatible after these changes.
  • Next add a name and description for your costume in “src/data/costume_menu/costume_descriptions.h”
  • Add an entry to gCostumes within “src/data/costume_menu/costumes.h”
  • To be able to use your costume in-game you need to create a script to unlock it:
    UnlockCostume_ExampleScript::
    setvar VAR_0x8004 COSTUME_RED
    special UnlockCostume_Special
    end

Although I intend to simplify it as well as adding an unlock message automatically, akin to picking up an item.

At present pokeemerald is 68% decompiled, meaning that there are still limitations on what can be done with it and it is not in a user friendly state, but I would still recommend playing around with it as it allows for much more complex changes than a binary ROM hack.
I will periodically be merging with the master branch until it is completely decompiled.

FAQ:

Is this compatible with existing hacks?
If the hack is using the pokeemerald disassembly then yes, it should also be fairly simple to port to pokeruby. You will need to understand how to use github though.
If you’re doing a traditional binary ROM hack then no, but the benefits of learning how to use the disassemblies are significant.

Will a patch be made?
It could but that would defeat the point of using the disassemblies.

I don’t want it on the start menu, can I access it some other way?
Yes, you have the source code available, you can undo the changes I made by comparing it with the master branch and going to src/start_menu.c: https://github.com/pret/pokeemerald/compare/master...Slawter666:costume#diff-bafcaeb8ddf95aafdb833e0768944e24
You will need to familiarise yourself with pokeemerald to understand where to insert the callback for the costume menu (CB2_CostumeMenu) if you want to access it from somewhere else.

MrDollSteak

Formerly known as 11bayerf1

Age 24
Male
Hong Kong
Seen 4 Weeks Ago
Posted May 15th, 2019
846 posts
10.8 Years
This looks incredible. Amazing work.

I just have a few questions / suggestions.

One suggestion I would make is documenting how to make the costume menu be accessible from a script or item, etc. In case people don't want it in the menu. For example maybe someone can make a portable wardrobe item that opens this menu, or a wardrobe in buildings with an NPC that allows you to access it. This way there can be clothing stores like in newer games where you can buy 'costumes' and then cycle through what you have in the wardrobe.

On this note I want to ask if it currently supports changing the backsprites of the trainer for battles. That would obviously also require a ton more assets, but it certainl would make the costumes feel more real.
Seen May 29th, 2019
Posted May 26th, 2019
106 posts
11.1 Years
This looks incredible. Amazing work.

I just have a few questions / suggestions.

One suggestion I would make is documenting how to make the costume menu be accessible from a script or item, etc. In case people don't want it in the menu. For example maybe someone can make a portable wardrobe item that opens this menu, or a wardrobe in buildings with an NPC that allows you to access it. This way there can be clothing stores like in newer games where you can buy 'costumes' and then cycle through what you have in the wardrobe.
Thank you and thanks for the suggestions.

To access it from elsewhere it's as simple as adding
SetMainCallback2(CB2_CostumeMenu);
to whatever function gets called. The function you add it to will depend on the use case. I'm not sure how to use it via scripts as I haven't done much work with them yet.

I may do a more thorough explanation if it's needed.

On this note I want to ask if it currently supports changing the backsprites of the trainer for battles. That would obviously also require a ton more assets, but it certainl would make the costumes feel more real.
Funnily enough I was so focused on getting the menu itself right that it slipped my mind to add this, but it is a planned feature and one that I don't think would take long to implement. The code that handles the trainer card still needs to be decompiled so the front sprite won't change just yet either but again that should be easy to implement.

I agree it would be much more immersive if there were accurate trainer sprites for each costume, it is also one of the reasons I made the Playable Character Community Project and whilst the current focus is overworld sprites, trainer sprites are within the scope of the project if anyone is interested in contributing.

wanderlustdemon

I'll get angry, and take a nap.

Age 25
Female
Kalt Island
Seen 4 Hours Ago
Posted 1 Day Ago
177 posts
284 Days
This looks soo good.

If I was using pokeemerald I'd def use it.~
More hacks need a costume system!
Seen 1 Week Ago
Posted March 19th, 2019
202 posts
2 Years
This looks amazing!

One feature suggestion, though, is to add a callable routine that returns the costume id of the player, for use in scripts. This could be really useful for a lot of reasons, for example, you can't enter the factory without safety gear, or if you're wearing a team rocket disguise you can skip most fights, etc.

I also can't wait for your OW expansion! Will this work globally or just with the costume selector?
I'm still quite active, just not on Pokecommunity.

While Pokecommunity is still a great resource and discussion board for binary hacking, binary hacking is slowly but surely becoming irrelevant. If you are ready to jump ship and switch to pokeemerald some great places to try would be Silph Co. and the pret Discord. Happy hacking!

You can always reach out to me directly at hjk321#1337
Seen May 29th, 2019
Posted May 26th, 2019
106 posts
11.1 Years
This looks amazing!

One feature suggestion, though, is to add a callable routine that returns the costume id of the player, for use in scripts. This could be really useful for a lot of reasons, for example, you can't enter the factory without safety gear, or if you're wearing a team rocket disguise you can skip most fights, etc.

I also can't wait for your OW expansion! Will this work globally or just with the costume selector?
Thanks for the suggestion, that's a good idea.

The overworld expansion will be global, pokeemerald is now roughly 87% decompiled and I expect to be able to complete the expansion at around 95-98%.
Seen 1 Week Ago
Posted March 19th, 2019
202 posts
2 Years
Thanks for the suggestion, that's a good idea.

The overworld expansion will be global, pokeemerald is now roughly 87% decompiled and I expect to be able to complete the expansion at around 95-98%.
Oh, also, two other things:

How do you use the dynamic pallete system? Is it automatic?
What is an asymmetric sprite and how do you implement it?

Edit: and how do I merge this into my fork? It says I have to use the command line to resolve conflicts wtf

Thanks.
I'm still quite active, just not on Pokecommunity.

While Pokecommunity is still a great resource and discussion board for binary hacking, binary hacking is slowly but surely becoming irrelevant. If you are ready to jump ship and switch to pokeemerald some great places to try would be Silph Co. and the pret Discord. Happy hacking!

You can always reach out to me directly at hjk321#1337
Seen May 29th, 2019
Posted May 26th, 2019
106 posts
11.1 Years
Oh, also, two other things:

How do you use the dynamic pallete system? Is it automatic?
What is an asymmetric sprite and how do you implement it?

Edit: and how do I merge this into my fork? It says I have to use the command line to resolve conflicts wtf

Thanks.
The dynamic palette system is automatic, it just means that only the palettes being used currently are loaded, which means adding new overworlds is much easier. However, I need to update the field weather to use this system as it was previously using the players sprite palette, so changing that has caused the fog and rain to be the wrong colour.

Asymmetric overworlds are used when a character's left and right sprite look different.



Here's a tutorial I've written for inserting new overworlds using pokeemerald:
https://github.com/pret/pokeemerald/wiki/Adding-new-overworlds

To add an asymmetric overworld you'll have to add extra entries to the characters PicTable as shown below. (Pryce is asymmetric whereas Clair is not.)

const struct SpriteFrameImage gEventObjectPicTable_Pryce[] = {
    overworld_frame(gEventObjectPic_Pryce, 4, 4, 0),
    overworld_frame(gEventObjectPic_Pryce, 4, 4, 1),
    overworld_frame(gEventObjectPic_Pryce, 4, 4, 2),
    overworld_frame(gEventObjectPic_Pryce, 4, 4, 3),
    overworld_frame(gEventObjectPic_Pryce, 4, 4, 4),
    overworld_frame(gEventObjectPic_Pryce, 4, 4, 5),
    overworld_frame(gEventObjectPic_Pryce, 4, 4, 6),
    overworld_frame(gEventObjectPic_Pryce, 4, 4, 7),
    overworld_frame(gEventObjectPic_Pryce, 4, 4, 8),
    overworld_frame(gEventObjectPic_Pryce, 4, 4, 9),
    overworld_frame(gEventObjectPic_Pryce, 4, 4, 10),
    overworld_frame(gEventObjectPic_Pryce, 4, 4, 11),
};

const struct SpriteFrameImage gEventObjectPicTable_Clair[] = {
    overworld_frame(gEventObjectPic_Clair, 4, 4, 0),
    overworld_frame(gEventObjectPic_Clair, 4, 4, 1),
    overworld_frame(gEventObjectPic_Clair, 4, 4, 2),
    overworld_frame(gEventObjectPic_Clair, 4, 4, 3),
    overworld_frame(gEventObjectPic_Clair, 4, 4, 4),
    overworld_frame(gEventObjectPic_Clair, 4, 4, 5),
    overworld_frame(gEventObjectPic_Clair, 4, 4, 6),
    overworld_frame(gEventObjectPic_Clair, 4, 4, 7),
    overworld_frame(gEventObjectPic_Clair, 4, 4, 8),
};
As well as using gEventObjectImageAnimTable_Standard_Asymmetric for the AnimTable in src/data/field_event_obj/event_object_graphics_info.h

I haven't updated the branch in months so it is over 500 commits behind so there will be a lot of conflicts so I don't recommend merging it at present. I will merge and update it as soon as the remaining save block references are decompiled.

Also as the overworld expansion is incomplete the game currently softlocks when trying to use cut or rock smash in the overworld.
Seen 1 Week Ago
Posted March 19th, 2019
202 posts
2 Years
I don't recommend merging it at present.
In that case, is there a way to manually put your code into my project? What files do I need to copy over? (My decomp is practically clean, forked 2 days ago)
I'm still quite active, just not on Pokecommunity.

While Pokecommunity is still a great resource and discussion board for binary hacking, binary hacking is slowly but surely becoming irrelevant. If you are ready to jump ship and switch to pokeemerald some great places to try would be Silph Co. and the pret Discord. Happy hacking!

You can always reach out to me directly at hjk321#1337
Seen May 29th, 2019
Posted May 26th, 2019
106 posts
11.1 Years
https://github.com/pret/pokeemerald/compare/master...Slawter666:costume

There's a list of the changes I made. If you want everything but the overworld expansion you won't need to make changes in the following files.
Spoiler:

data/cable_car.s
data/maps/BattleFrontier_BattlePyramidEmptySquare/events.inc
data/maps/LittlerootTown_BrendansHouse_1F/events.inc
data/maps/LittlerootTown_BrendansHouse_2F/events.inc
data/maps/LittlerootTown_MaysHouse_1F/events.inc
data/maps/LittlerootTown_MaysHouse_2F/events.inc
data/maps/Underwater_SeafloorCavern/events.inc
include/constants/event_objects.h
include/contest.h
include/rom6.h
src/data/field_event_obj/event_object_graphics.h
src/data/field_event_obj/event_object_graphics_info.h
src/data/field_event_obj/event_object_graphics_info_pointers.h
src/data/field_event_obj/event_object_pic_tables.h
src/rom6.c

There are also changes in src/event_object_movement.c that are for the expansion that you wouldn't need.


Personally I would wait to introduce these changes into your project until I've merged and updated it as the costume menu adds references to the save blocks, which are not shiftable yet.
Seen May 29th, 2019
Posted May 26th, 2019
106 posts
11.1 Years
Hi!

Is this updated and available on your GitHub? Also, do the back sprites work? I know someone already asked but not sure if it's been updated yet or not. Awesome hack you've made.
It's not been updated yet, I'm waiting for saveblock shiftability first as that is currently preventing me from completing the overworld expansion. Though that is likely to take upwards of two months for the relevant code to be decompiled.

At the moment only the overworld sprite changes.
Advertiser Content