Skip to content

Document villa furniture#1076

Merged
lhearachel merged 1 commit intopret:mainfrom
CharlesFolz4:VillaFurniture
Apr 19, 2026
Merged

Document villa furniture#1076
lhearachel merged 1 commit intopret:mainfrom
CharlesFolz4:VillaFurniture

Conversation

@CharlesFolz4
Copy link
Copy Markdown
Contributor

Document villa furniture

Copy link
Copy Markdown
Contributor

@Kuruyia Kuruyia left a comment

Choose a reason for hiding this comment

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

Only minor stuff here, this looks very clean!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: I think this can be merged into villa_furniture.h.

Comment on lines +4 to +6
typedef struct VillaPersistedFeature {
int persistedFeature;
} VillaPersistedFeature;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: Rename to VillaPersistedData

I initially wanted to have the PersistedMapFeatures_GetBuffer-related structs all end in PersistedData, but I know some of them already fell through the cracks.

Suggested change
typedef struct VillaPersistedFeature {
int persistedFeature;
} VillaPersistedFeature;
typedef struct VillaPersistedData {
int persistedFeature;
} VillaPersistedData;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated for consistency, but I disagree with this naming convention on grounds that ending any struct name with "-Data" is inherently redundant, outside of very specific circumstances that I don't think applies here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The rationale behind suffixing this family of structs with Data is that their content are directly written to the save data. So this is a pretty generic system.

I'm not really attached to that naming convention tho'. We can discuss about that for another PR. As long as the naming stays consistent :)

Comment thread include/map_object.h Outdated
Comment on lines +28 to +29
#define MAP_OBJECT_COORD_TO_FX32(coord) ((coord << 4) * FX32_ONE) + (MAP_OBJECT_TILE_SIZE >> 1)
#define ALSO_MAP_OBJECT_COORD_TO_FX32(coord) ((coord << 4) * FX32_ONE)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question: Shouldn't MAP_OBJECT_COORD_TO_FX32 be MAP_OBJECT_COORD_TO_FX32_CENTERED?

Suggested change
#define MAP_OBJECT_COORD_TO_FX32(coord) ((coord << 4) * FX32_ONE) + (MAP_OBJECT_TILE_SIZE >> 1)
#define ALSO_MAP_OBJECT_COORD_TO_FX32(coord) ((coord << 4) * FX32_ONE)
#define MAP_OBJECT_COORD_TO_FX32(coord) ((coord << 4) * FX32_ONE)
#define MAP_OBJECT_COORD_TO_FX32_CENTERED(coord) ((coord << 4) * FX32_ONE) + (MAP_OBJECT_TILE_SIZE >> 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additionally, we can improve those macros a bit:

#define MAP_OBJECT_COORD_TO_FX32(coord)          (coord * MAP_OBJECT_TILE_SIZE)
#define MAP_OBJECT_COORD_TO_FX32_CENTERED(coord) (MAP_OBJECT_COORD_TO_FX32(coord) + MAP_OBJECT_TILE_SIZE / 2)

#define POKEPLATINUM_STRUCT_VILLA_PERSISTED_FEATURE_H

typedef struct VillaPersistedFeature {
int persistedFeature;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

question: Is this actually referenced anywhere? If not, I think you can rename it to dummy.

Suggested change
int persistedFeature;
int dummy;

Comment thread src/overlay005/villa_furniture.c Outdated
return FALSE;
}

static const VillaFurnitureCollision sVillaFurnitureCollision[FURNITURE_SLOTS] = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion: Seeing that it also holds the position of the furniture, the name can be simplified.

Suggested change
static const VillaFurnitureCollision sVillaFurnitureCollision[FURNITURE_SLOTS] = {
static const VillaFurniture sVillaFurnitures[FURNITURE_SLOTS] = {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

VillaFurniture is already defined as the name of the enum, the compiler doesn't like it when that symbol gets redefined as a struct here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it make sense to rename this enum to VillaFurnitureType?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This whole thing comes together pretty nicely when the enum is VillaFurnitureID.

@CharlesFolz4 CharlesFolz4 force-pushed the VillaFurniture branch 2 times, most recently from 823b48a to 98cb9ce Compare April 15, 2026 22:59
Comment thread src/overlay005/villa_furniture.c Outdated

typedef struct VillaDynamicMapData {
FieldSystem *fieldSystem;
VillaPersistedData *persistedFeature;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

polish: Consistency with the rename that was done.

Suggested change
VillaPersistedData *persistedFeature;
VillaPersistedData *persistedData;

Comment thread src/overlay005/villa_furniture.c Outdated
void Villa_DynamicMapFeaturesInit(FieldSystem *fieldSystem)
{
PersistedMapFeatures *persistedFeatures = MiscSaveBlock_GetPersistedMapFeatures(FieldSystem_GetSaveData(fieldSystem));
VillaPersistedData *villaPersistedFeatures = PersistedMapFeatures_GetBuffer(persistedFeatures, DYNAMIC_MAP_FEATURES_VILLA);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

polish: Consistency with the rename that was done.

Suggested change
VillaPersistedData *villaPersistedFeatures = PersistedMapFeatures_GetBuffer(persistedFeatures, DYNAMIC_MAP_FEATURES_VILLA);
VillaPersistedData *persistedData = PersistedMapFeatures_GetBuffer(persistedFeatures, DYNAMIC_MAP_FEATURES_VILLA);

@CharlesFolz4 CharlesFolz4 force-pushed the VillaFurniture branch 2 times, most recently from 4c5e81e to 0610030 Compare April 16, 2026 00:48
Comment thread src/overlay005/villa_furniture.c Outdated
} FurnitureCollisionBoundingBox;

typedef struct VillaFurniture {
u16 furnitureID;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nitpick: It can be even nicer :)

Suggested change
u16 furnitureID;
u16 id;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Given that the index of sVillaFurnitures doesn't always match up with the furnitureIDs, I think it's better to keep this field explicit to avoid any potential confusion.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the initial Type suggestion would be more appropriate here then. Also because I see that in the mentioned array there are multiple entries with the same furnitureID.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right. Updated.

@lhearachel lhearachel merged commit 85a21e9 into pret:main Apr 19, 2026
2 checks passed
github-actions Bot pushed a commit that referenced this pull request Apr 19, 2026
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.

3 participants