-
Notifications
You must be signed in to change notification settings - Fork 647
Commit and split gameplay_keep #2612
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense for massive objects like gameplay_keep to keep headers separated, so actors can only include what they use.
What kind of help are you looking for?
| @@ -660,7 +665,7 @@ def write_source(self): | |||
| referenced_file, | |||
| ) | |||
| assert hasattr(referenced_file, "source_h_path") | |||
| file_include_paths_complete.append(referenced_file.source_h_path) | |||
| file_include_paths_complete.append(strip_extracted_prefix(referenced_file.source_h_path)) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this doing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
referenced_file.source_h_path is the path to the generated .h, including the leading extracted/VERSION/
so currently the #includes of other assets in generated source look like
#include "extracted/gc-eu-mq-dbg/assets/objects/gameplay_keep/gameplay_keep.h"instead of
#include "assets/objects/gameplay_keep/gameplay_keep.h"(see eg extracted/gc-eu-mq-dbg/assets/objects/object_fish/object_fish.c)
this is a fix/workaround for that behavior
|
That's a lot of work done already ( 👏 ) and there's a lot to unpack I made a little script for renaming gkeep files: Usage: any of #!/usr/bin/env python3
# SPDX-FileCopyrightText: 2024 Dragorn421
# SPDX-License-Identifier: CC0-1.0
import argparse
from pathlib import Path
def main():
parser = argparse.ArgumentParser()
parser.add_argument("from_name")
parser.add_argument("to_name")
args = parser.parse_args()
from_name = Path(args.from_name).stem
to_name = Path(args.to_name).stem
p = Path("assets/objects/gameplay_keep") / from_name
h_p = p.with_suffix(".h")
lines = h_p.read_text().splitlines(keepends=True)
assert lines[0].startswith("#ifndef ")
assert lines[1].startswith("#define ")
include_guard = "GAMEPLAY_KEEP_" + to_name.upper() + "_H"
h_p.write_text(
"".join(
[
f"#ifndef {include_guard}\n",
f"#define {include_guard}\n",
]
+ lines[2:]
)
)
h_p.rename(p.with_name(f"{to_name}.h"))
p.with_suffix(".c").rename(p.with_name(f"{to_name}.c"))
from_name = from_name.encode()
to_name = to_name.encode()
for root_p in (
Path("src"),
Path("include"),
Path("assets"),
Path("spec"),
):
for dir_p, dirnames, filenames in root_p.walk():
for filename in filenames:
file_p = dir_p / filename
contents = file_p.read_bytes()
if from_name in contents:
contents_new = contents.replace(from_name, to_name)
file_p.write_bytes(contents_new)
if __name__ == "__main__":
main() |
|
I made some commits naming a few more things (feel free to force-push them away if you don't like them) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the gArrowSkelLimbN, gDoorSkelLimbN, gFairySkelLimbN, gFishSkelLimbN, gBugSkelLimbN names final?
If not I'd like to name them Limb_N (with an underscore), as I've been using "has an underscore in the name" as a heuristic for "is undocumented"
|
Limb names are not final, I just needed to rename them in at least one xml to avoid ifdefs, and figured I'd do something at least better than "gameplay_keep_0x..." |
Many files still unnamed, help wanted