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

Map object documentation #333

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Viperio19
Copy link
Contributor

Documentation centered around map_object.c and map_object_save.c

src/map_object.c Outdated Show resolved Hide resolved
src/map_object.c Outdated Show resolved Hide resolved
src/map_object.c Outdated Show resolved Hide resolved
src/map_object_move.c Show resolved Hide resolved
}

int sub_02064488(int param0, int param1, int param2, int param3)
int sub_02064488(int x, int z, int xPrev, int zPrev)
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you sure about these parameter names? They don't look quite right.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems like I focussed a bit too much on one specific instance of it being used:

static int sub_0206A034(MapObject *mapObj, UnkStruct_02069F48 *param1)
{
    int v0 = MapObject_GetX(mapObj);
    int v1 = MapObject_GetZ(mapObj);
    int v2 = MapObject_GetX(param1->unk_08);
    int v3 = MapObject_GetZ(param1->unk_08);
    int v4 = MapObject_GetXPrev(param1->unk_08);
    int v5 = MapObject_GetZPrev(param1->unk_08);
    int v6;

    if ((v0 == v2) && (v1 == v3)) {
        return 0;
    }

    v6 = sub_02064488(v0, v1, v4, v5);

It varies quite a bit tough, so you're right in that it doesn't really make sense. I don't think there's really descriptive names I could give them that covers all usages of the function besides just x1, z1, x2 and z2, do you think I should do that, or revert them back to paramX names?

Copy link
Contributor

Choose a reason for hiding this comment

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

Keep as paramX if unsure.

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 am sure that the params are two sets of coordinates, so x1, z1, x2 and z2 would be true, but they're not very descriptive besides that it's two sets of coordinates. The issue is that I don't think there's a more descriptive option because of this function being used in different ways, so the param names can't be more specific I think. Sorry I should've made that a bit more clear, I'm just not sure if it's then still worth it to give the names x1, z1, x2 and z2.

Copy link
Contributor

Choose a reason for hiding this comment

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

If you're unsure then it's okay to leave this function as it is for now and not rename anything. We can always come back again when the other functions (that invoke this function) themselves get documented.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I have changed it back and committed that together with fixes for your other comments, thanks for all the feedback!

src/map_object.c Show resolved Hide resolved
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