mirror of
https://github.com/ApfelTeeSaft/lightspeed64.git
synced 2026-08-26 19:33:24 +00:00
[OoT] Fix includes for z64 prefix removal (#549)
* [OoT] Fix includes for z64 prefix removal * review
This commit is contained in:
@@ -109,14 +109,20 @@ class OOT_Properties(bpy.types.PropertyGroup):
|
||||
else:
|
||||
return f"extracted/{self.oot_version if self.oot_version != 'Custom' else self.oot_version_custom}"
|
||||
|
||||
def is_globalh_present(self):
|
||||
def is_include_present(self, include_file: str):
|
||||
decomp_path = Path(bpy.context.scene.ootDecompPath).resolve()
|
||||
|
||||
if not decomp_path.exists():
|
||||
raise PluginError(f"ERROR: invalid decomp path ('{decomp_path}').")
|
||||
|
||||
global_h_path = decomp_path / "include" / "global.h"
|
||||
return global_h_path.exists()
|
||||
include_file_path = decomp_path / "include" / include_file
|
||||
return include_file_path.exists()
|
||||
|
||||
def is_globalh_present(self):
|
||||
return self.is_include_present("global.h")
|
||||
|
||||
def is_z64sceneh_present(self):
|
||||
return self.is_include_present("z64scene.h")
|
||||
|
||||
useDecompFeatures: bpy.props.BoolProperty(
|
||||
name="Use decomp for export", description="Use names and macros from decomp when exporting", default=True
|
||||
|
||||
@@ -30,8 +30,10 @@ class OOTAnimation:
|
||||
|
||||
if bpy.context.scene.fast64.oot.is_globalh_present():
|
||||
data.header += '#include "ultra64.h"\n' + '#include "global.h"\n\n'
|
||||
else:
|
||||
elif bpy.context.scene.fast64.oot.is_z64sceneh_present():
|
||||
data.header += '#include "ultra64.h"\n' + '#include "array_count.h"\n' + '#include "z64animation.h"\n\n'
|
||||
else:
|
||||
data.header += '#include "ultra64.h"\n' + '#include "array_count.h"\n' + '#include "animation.h"\n\n'
|
||||
data.source = f'#include "{self.filename}.h"\n\n'
|
||||
|
||||
# values
|
||||
@@ -102,11 +104,16 @@ class OOTLinkAnimation:
|
||||
if bpy.context.scene.fast64.oot.is_globalh_present():
|
||||
data.header = '#include "ultra64.h"\n' + '#include "global.h"\n\n'
|
||||
animHeaderData.header = '#include "ultra64.h"\n' + '#include "global.h"\n\n'
|
||||
else:
|
||||
elif bpy.context.scene.fast64.oot.is_z64sceneh_present():
|
||||
data.header = '#include "ultra64.h"\n' + '#include "array_count.h"\n' + '#include "z64animation.h"\n\n'
|
||||
animHeaderData.header = (
|
||||
'#include "ultra64.h"\n' + '#include "array_count.h"\n' + '#include "z64animation.h"\n\n'
|
||||
)
|
||||
else:
|
||||
data.header = '#include "ultra64.h"\n' + '#include "array_count.h"\n' + '#include "animation.h"\n\n'
|
||||
animHeaderData.header = (
|
||||
'#include "ultra64.h"\n' + '#include "array_count.h"\n' + '#include "animation.h"\n\n'
|
||||
)
|
||||
|
||||
data.source = f'#include "{self.dataName()}.h"\n\n'
|
||||
animHeaderData.source = f'#include "{self.headerName}.h"\n'
|
||||
|
||||
@@ -307,7 +307,7 @@ def exportCollisionToC(
|
||||
'#include "macros.h"',
|
||||
]
|
||||
)
|
||||
else:
|
||||
elif bpy.context.scene.fast64.oot.is_z64sceneh_present():
|
||||
includes.extend(
|
||||
[
|
||||
'#include "ultra64.h"',
|
||||
@@ -316,6 +316,15 @@ def exportCollisionToC(
|
||||
'#include "array_count.h"',
|
||||
]
|
||||
)
|
||||
else:
|
||||
includes.extend(
|
||||
[
|
||||
'#include "ultra64.h"',
|
||||
'#include "z_math.h"',
|
||||
'#include "bgcheck.h"',
|
||||
'#include "array_count.h"',
|
||||
]
|
||||
)
|
||||
|
||||
colData.header = "\n".join(includes) + "\n\n"
|
||||
colData.source = f'#include "{filename}.h"\n'
|
||||
|
||||
@@ -44,7 +44,7 @@ def ootCutsceneIncludes(headerfilename):
|
||||
+ '#include "command_macros_base.h"\n'
|
||||
+ '#include "z64cutscene_commands.h"\n\n'
|
||||
)
|
||||
else:
|
||||
elif bpy.context.scene.fast64.oot.is_z64sceneh_present():
|
||||
ret.header += (
|
||||
'#include "ultra64.h"\n'
|
||||
+ '#include "sequence.h"\n'
|
||||
@@ -54,6 +54,16 @@ def ootCutsceneIncludes(headerfilename):
|
||||
+ '#include "z64ocarina.h"\n'
|
||||
+ '#include "z64player.h"\n\n'
|
||||
)
|
||||
else:
|
||||
ret.header += (
|
||||
'#include "ultra64.h"\n'
|
||||
+ '#include "sequence.h"\n'
|
||||
+ '#include "z_math.h"\n'
|
||||
+ '#include "cutscene.h"\n'
|
||||
+ '#include "cutscene_commands.h"\n'
|
||||
+ '#include "ocarina.h"\n'
|
||||
+ '#include "player.h"\n\n'
|
||||
)
|
||||
|
||||
if len(headerfilename) > 0:
|
||||
ret.source = f'#include "{headerfilename}"\n\n'
|
||||
|
||||
@@ -242,7 +242,7 @@ class Scene:
|
||||
'#include "macros.h"',
|
||||
'#include "z64.h"',
|
||||
]
|
||||
else:
|
||||
elif bpy.context.scene.fast64.oot.is_z64sceneh_present():
|
||||
includes = [
|
||||
'#include "ultra64.h"',
|
||||
'#include "romfile.h"',
|
||||
@@ -262,6 +262,26 @@ class Scene:
|
||||
'#include "z64room.h"',
|
||||
'#include "z64scene.h"',
|
||||
]
|
||||
else:
|
||||
includes = [
|
||||
'#include "ultra64.h"',
|
||||
'#include "romfile.h"',
|
||||
'#include "array_count.h"',
|
||||
'#include "sequence.h"',
|
||||
'#include "actor_profile.h"',
|
||||
'#include "bgcheck.h"',
|
||||
'#include "camera.h"',
|
||||
'#include "cutscene.h"',
|
||||
'#include "cutscene_commands.h"',
|
||||
'#include "environment.h"',
|
||||
'#include "z_math.h"',
|
||||
'#include "object.h"',
|
||||
'#include "ocarina.h"',
|
||||
'#include "path.h"',
|
||||
'#include "player.h"',
|
||||
'#include "room.h"',
|
||||
'#include "scene.h"',
|
||||
]
|
||||
|
||||
return SceneFile(
|
||||
self.name,
|
||||
|
||||
@@ -284,8 +284,10 @@ def ootConvertArmatureToC(
|
||||
|
||||
if bpy.context.scene.fast64.oot.is_globalh_present():
|
||||
data.header += '#include "ultra64.h"\n' + '#include "global.h"\n'
|
||||
else:
|
||||
elif bpy.context.scene.fast64.oot.is_z64sceneh_present():
|
||||
data.header += '#include "ultra64.h"\n' + '#include "array_count.h"\n' + '#include "z64animation.h"\n'
|
||||
else:
|
||||
data.header += '#include "ultra64.h"\n' + '#include "array_count.h"\n' + '#include "animation.h"\n'
|
||||
|
||||
data.source = f'#include "{header_filename}.h"\n\n'
|
||||
if not isCustomExport:
|
||||
|
||||
Reference in New Issue
Block a user