Vs Seeker - PokemonSanFran/pokeemerald GitHub Wiki
Introduction
This is a port of the Vs. Seeker from Pokémon FireRed/LeafGreen for use in decomp projects.
Thank you very much to Jaizu who originally wrote this implementation, and Sbird / Bassoonian for providing a code review. Please read more about their contributions and support their projects!
Features
When the Vs. Seeker is used, the Trainers currently visible to the player will indicate one of three states:
Ready For Rematch
This Trainer is ready for a rematch! Talking to them will start another battle. These trainers will show a !! over the heads and begin to spin in place.
Undefeated
This Trainer has not been defeated for the first time. These trainers will show a ! over their head.
Not Ready For Rematch
This Trainer is not ready for a rematch. These Trainers will show a X over their heads.
Installation
These instructions assume that you can build pokeemerald, and have a basic understanding of C. If you do not, please watch the tutorials series from Team Aqua's Hideout.
git merge (recommended)
From the root directory of your project, run the following commands in your terminal program of choice:
git remote add psf_emerald https://github.com/PokemonSanFran/pokeemerald/ # This adds our team's pokeemerald branch as a remote repo.
git pull psf_emerald vs_seeker #This pulls in the vs_seeker feature branch
Manual merge
If your project is:
- Too far behind pokeemerald
- Some other reason that I can't think of
You can manually implement the features using the diff between this branch and vanilla pokeemerald as a guide. You will need to manually edit or create each of these files in your own project to properly recreate the feature.
Warnings
Match Call Disabled
pokeemerald already has a system for rematches, called Match Call. Having the two enabled at the same time would result in a user experience where Match Call and the Vs. Seeker would turn on and off the rematch state of Trainers independently of each other.
To fix this, when the player acquires the Vs. Seeker, the following changes occur.
UpdateRandomTrainerRematches
no longer runs when the player loads a new map. This means Trainers will never try to rematch outside of use of the Vs. Seeker.IncrementRematchStepCounter
will no longer increment when the player walks, meaning only the Vs. Seeker's steps will count.
Animation Changes
FireRed and LeafGreen show custom animations for both the use and response of the Vs. Seeker. Those animations do not exist in Emerald, and this branch has been adapated as such. Developers can restore those animations, which is covered in restoring animations.
May / Brendan
The Vs. Seeker animation has been replaced with the Field Move animation.
Trainers
Trainers who are ready to rematch do not raise their hand and jump in place, but instead will spin in place like they do in the Sinnoh games (Diamond, Pearl, Platinum, Brilliant Diamond, Shining Pearl).
Functionality
Charge Battery
Once the player recieves the Vs. Seeker, the top half of gSaveBlock1Ptr->trainerRematchStepCounter
increases by 1 everytime the player takes a step, until it equals VSSEEKER_RECHARGE_STEPS
(which is default 100).
The Vs. Seeker cannot be used until the Vs. Seeker is charged, and attempting to do so will return an error message.
The battery isn't charged enough. No. of steps required to fully charge the battery: N
Usage
If the Vs. Seeker is charged and used in a valid location, the Trainers that are on screen will indicate their state. Talking to the Trainers that have a valid battle state, will begin a rematch battle against them. The difficulty level will depend on the player's progress throughout the game.
Rematch State
Trainers that are Ready for Rematch will engage the player so long as the lower half of gSaveBlock1Ptr->trainerRematchStepCounter
is less than VSSEEKER_RECHARGE_STEPS
.
This increments for every step that is taken after the Vs. Seeker is used, and when it reaches VSSEEKER_RECHARGE_STEPS
, the rematch state for these Trainers is reset.
When the player loads a new map, all reset states for all Traienrs are reset by MapResetTrainerRematches
.
Functional Changes from Fire Red
This branch aims to replicate the Vs. Seeker as close as possible, only making changes to fit things that are specific to Kanto or the plot of Fire Red / LeafGreen.
Gym Leader Rematches
src/item_use.c
Emerald's Match Call supports Gym Leader rematches, but Fire Red / Leaf Green's VS Seeker does not.
To enable these rematches, the Vs. Seeker will function inside Gyms. Gym Leaders will respond as regular Trainers do.
Valid Locations
src/item_use.c
(https://github.com/PokemonSanFran/pokeemerald/bl)
The Vs. Seeker can only be used in places that are:
Fire Red / Leaf Green:
- Towns (
MAP_TYPE_TOWN
) - Cities (
MAP_TYPE_CITY
) - Routes (
MAP_TYPE_ROUTE
) - or are not:
Emerald:
- Towns (
MAP_TYPE_TOWN
) - Cities (
MAP_TYPE_CITY
) - Routes (
MAP_TYPE_ROUTE
) - Ocean Routes (
MAP_TYPE_OCEAN_ROUTE
) - Indoor (
MAP_TYPE_INDOOR
) and a Pokémon Gym - or are not:
Rematch Difficulty
src/vs_seeker.c
Some Trainers that can be rematched have several different teams that increase in difficulty. When a trainer is rematched, the trainerID
that is loaded depeneds on the player's progress through the game. These checkpoints are when the player:
Fire Red / Leaf Green:
- gets the Vs. Seeker (
FLAG_GOT_VS_SEEKER
) - visits in Celdaon City for the first time (
FLAG_WORLD_MAP_CELADON_CITY
) - visits in Fuschia City for the first time (
FLAG_WORLD_MAP_FUCHSIA_CITY
) - becomes the Pokemon League Champion for the first time (
FLAG_SYS_GAME_CLEAR
) - delivers the Sapphire to Celio (
FLAG_SYS_CAN_LINK_WITH_RS
)
Emerald:
- visits Lavaridge Town for the first time (
FLAG_VISITED_LAVARIDGE_TOWN
) - visits Fortree City for the first time (
FLAG_VISITED_FORTREE_CITY
) - becomes the Pokemon League Champion for the first time (
FLAG_SYS_GAME_CLEAR
) - defeats Steven in Meteor Falls (
FLAG_DEFEATED_METEOR_FALLS_STEVEN
)
When engaging a Trainer, the player's progress is calculated, and a rematch Trainer is assigned based on that progress. If the player has not defeated the Trainer prior to that, the player will battle the first unmatched Trainer in the list.
Example
[REMATCH_ROSE] = REMATCH(TRAINER_ROSE_1, TRAINER_ROSE_2, TRAINER_ROSE_3, TRAINER_ROSE_4, TRAINER_ROSE_5, ROUTE118),
If the player has visited Lavaridge Town and Fortree City, the player is eligible to battle TRAINER_ROSE_3
. The player has not yet defeated TRAINER_ROSE_2
, and so the player will battle TRAINER_ROSE_2
.
Developer Functionality
Trainers
src/battle_setup.c
The Vs. Seeker and Match Call use the same table for rematches, gRematchTable
.
Adding new Trainers
Each row in the table starts with a rematch constant, defined in include/gym_leader_rematch.h
. Each TrainerId (defined in include/constants/opponents.h
) is then placed in the REMATCH
macro. Each Trainer has four rematch variants. The final member of the row is the MAP_NUM
that the Trainer is found on.
Change existing Trainers
This can be done by either changing the constant to point to a different Trainer in gRematchTable
, or directly modifiing a Trainer's party in src/data/trainer_parties.h
.
Restoring Animations
Enabling animations will require the developer to either create sprites for the desired case.
Brendan / May
The Vs. Seeker animation for protagaonists requires its own sprite sheet, arranged as seen above. The animation will then need to be enabled. Uncommenting the listed items in the following files will enable the animation for that protagonist.
src/field_player_avatar.c
PLAYER_AVATAR_STATE_VSSEEKER
(both instances)
include/constants/event_objects.h
OBJ_EVENT_GFX_BRENDAN_VS_SEEKER
OBJ_EVENT_GFX_MAY_VS_SEEKER
src/data/object_events/object_event_pic_tables.h
sPicTable_MayVSSeeker
sPicTable_BrendanVSSeeker
src/data/object_events/object_event_graphics_info.h
gObjectEventGraphicsInfo_BrendanVSSeeker
gObjectEventGraphicsInfo_MayVSSeeker
src/data/object_events/object_event_graphics_info_pointers.h
&gObjectEventGraphicsInfo_BrendanVSSeeker
&gObjectEventGraphicsInfo_MayVSSeeker
src/data/object_events/object_event_graphics.h
gObjectEventPic_BrendanVSSeeker
gObjectEventPic_MayVSSeeker
Trainers
To give a specific NPC the raise hand and jump animation, their spritesheet must be modified to include states those states.
For each NPC, in GetResponseMovementTypeFromTrainerGraphicsId
, the applicable NPC will need to be changed from MOVEMENT_TYPE_ROTATE_CLOCKWISE
.
In this example, the Beauty has been given the new animation.
static u8 GetResponseMovementTypeFromTrainerGraphicsId(u8 graphicsId)
{
+ if (graphicsId == OBJ_EVENT_GFX_BEAUTY)
+ return MOVEMENT_TYPE_RAISE_HAND_AND_JUMP;
+
if (IsRegularLandTrainer(graphicsId))
//return MOVEMENT_TYPE_RAISE_HAND_AND_JUMP;
return MOVEMENT_TYPE_ROTATE_CLOCKWISE;
if (IsRegularWaterTrainer(graphicsId))
//return MOVEMENT_TYPE_RAISE_HAND_AND_SWIM;
return MOVEMENT_TYPE_ROTATE_CLOCKWISE;
//return MOVEMENT_TYPE_RAISE_HAND_AND_STOP;
return MOVEMENT_TYPE_FACE_DOWN;
}
Known Issues
There are none at this time!
Support
Frequently Asked Questions (FAQ)
There are none at this time.
If you have read all of the documentation here and still have questions, please ask a good question in the pokeemerald channel of the pret Discord server. You can tag pkmnsnfrn
or 671gz
and we will try to help if we can.
Donations
If you got some use out of this feature, please consider donating.
- Jaizu's Ko-fi
- Centre for Effective Altruism USA Inc.
- Doctors Without Borders, USA
- The Climate Reality Project
- First Nations Development Institute
Contributors
671gz
- Wrote the original implementation.
Karathan#1337
Bassoonian
RavePossum
- Updated branch to properly build when using modern compiler
CHANGELOG
All changes to this project will be documented in this section. The format is based on Keep a Changelog, and this project tries to adhere to Semantic Versioning.
[1.0.1] - 2024-04-06
Added
- Updated branch to properly build when using modern compiler. (RavePossum) · (1007cc241)