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

Rename some 'sub_' functions #115

Closed
wants to merge 12 commits into from
Closed

Conversation

ecopsychologer
Copy link
Contributor

I've added a few comments as I've been trying to improve readability of the code, but my main goal has been to rename the functions from 'sub_XXXXXXXX' to a descriptive name. On my machine the rom builds successfully and runs.

also seemingly located the party healing function
Adds names to many unnamed functions for readability. Also adds names to a couple structs.
Copy link
Collaborator

@lhearachel lhearachel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contributions! I've got some feedback to make sure that the function names match the general style of the repository.

include/constants/pokemon.h Outdated Show resolved Hide resolved
include/overlay006/battle_params.h Outdated Show resolved Hide resolved
include/overlay016/ov16_0223DF00.h Outdated Show resolved Hide resolved
include/overlay016/struct_ov16_02264408.h Outdated Show resolved Hide resolved
Comment on lines 181 to 192
u32 unk_00;
u8 level; //!< The pokemons level
u8 unk_05;
u16 unk_06;
u16 unk_08;
u16 unk_0A;
u16 unk_0C;
u16 unk_0E;
u16 unk_10;
u16 unk_12;
u32 status;
u8 level;
u8 mail;
u16 hp;
u16 maxHP;
u16 attack;
u16 defense;
u16 speed;
u16 spAtk;
u16 spDef;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, maintain the Doxygen comments on struct fields (and add them, if possible).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I'm sorry I'm fairly new to this and thought that was an excited comment, I'll try to add some. What does it do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-added there

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Doxygen comments are for whenever we want to generate documentation, similar to Javadoc or Sphinx: https://www.doxygen.nl/

void sub_0209304C(Pokemon * param0, TrainerInfo * param1, int param2, int param3, int param4);
void sub_0209305C(BoxPokemon * param0, TrainerInfo * param1, int param2, int param3, int param4);
void ProcessBoxPokemonWithTrainerInfo(BoxPokemon * param0, TrainerInfo * param1, int param2, int param3, int param4);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this function do? Process is a bit generic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated it, it does kind of a bunch with cases but basically sets or processes the setting of box pokemon trainer info and met location

Comment on lines +126 to +130
static BOOL IsBoxPokemonInfectedWithPokerus(BoxPokemon *boxMon);
static BOOL CanBoxPokemonSpreadPokerus(BoxPokemon *boxMon);
static void InitializeBoxPokemonAfterCapture(BoxPokemon *boxMon, TrainerInfo *param1, int monPokeball, int param3, int param4, int param5);
static void PostCaptureBoxPokemonProcessing(BoxPokemon *boxMon, TrainerInfo *param1, int monPokeball, int param3, int param4, int param5);
static BOOL CanBoxPokemonLearnTM(BoxPokemon *boxMon, u8 tmID);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
static BOOL IsBoxPokemonInfectedWithPokerus(BoxPokemon *boxMon);
static BOOL CanBoxPokemonSpreadPokerus(BoxPokemon *boxMon);
static void InitializeBoxPokemonAfterCapture(BoxPokemon *boxMon, TrainerInfo *param1, int monPokeball, int param3, int param4, int param5);
static void PostCaptureBoxPokemonProcessing(BoxPokemon *boxMon, TrainerInfo *param1, int monPokeball, int param3, int param4, int param5);
static BOOL CanBoxPokemonLearnTM(BoxPokemon *boxMon, u8 tmID);
static BOOL BoxPokemon_InfectedWithPokerus(BoxPokemon *boxMon);
static BOOL BoxPokemon_CanSpreadPokerus(BoxPokemon *boxMon);
static void BoxPokemon_InitAfterCatch(BoxPokemon *boxMon, TrainerInfo *param1, int monPokeball, int param3, int param4, int param5);
static void BoxPokemon_UpdateAfterCatch(BoxPokemon *boxMon, TrainerInfo *param1, int monPokeball, int param3, int param4, int param5);
static BOOL BoxPokemon_LearnsTM(BoxPokemon *boxMon, u8 tmID);

Comment on lines 14 to 25
BOOL CheckMicRecordingStatus(void);
BOOL IsChatotCryStructReadyForProcessing(const ChatotCryData * param0);
BOOL ProcessAudioInput(const ChatotCryData * param0, u32 param1, int param2, int param3);
void ResetMicStatusFlags(void);
MICResult StartMicSampling(void);
MICResult StopMicSampling(void);
void StoreMicDataInChatotCryStruct(ChatotCryData * param0);
void SetMicProcessingFlag(u8 param0);
BOOL ProcessChatotCryStructWithAudioParams(ChatotCryData * param0, u32 param1, int param2, int param3);
BOOL ProcessChatotCryStructWithExtendedAudioParams(ChatotCryData * param0, u32 param1, int param2, int param3, u8 param4);
int Sound_Chatter(ChatotCryData * param0);
BOOL IsAudioParamValid(int param0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just delete these, their declarations should be included by the header.

Comment on lines 10 to 13
typedef struct ChatotCryData_t {
BOOL unk_00;
s8 unk_04[1000];
} UnkStruct_0202CC84;
} ChatotCryData;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this struct transparent.

@@ -13,25 +13,25 @@
#include "pokemon.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file related to the Summary Screen?

@ecopsychologer
Copy link
Contributor Author

I'll look more at this later, thank you for reviewing!

@@ -1,7 +1,7 @@
#ifndef POKEPLATINUM_STRUCT_02013A04_T_H
#define POKEPLATINUM_STRUCT_02013A04_T_H

struct UnkStruct_02013A04_t {
struct ResourceMetadata_t {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicking on this one since it's short and a good example.

In an earlier file include/struct_decls/struct_02013A04_decl.h, we have this typedef:

typedef struct ResourceMetadata_t ResourceMetadata;

The general style we're using for the gen4 projects is to merge these together and make the struct definition transparent. So, we'd instead have the single file with this:

typedef struct ResourceMetadata {
    const void * unk_00;
    u32 unk_04;
} ResourceMetadata;

Then remove the includes for the previous file:

#include "struct_decls/struct_02013A04_decl.h"

And, finally, delete the decl file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants