From 7805af0167cce253311de3aa23face0b4b4f374b Mon Sep 17 00:00:00 2001 From: thecozies Date: Wed, 15 Sep 2021 06:59:28 -0500 Subject: [PATCH 1/2] added forced includes to c vscode configuration --- .vscode/c_cpp_properties.json | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index a429e4a7..8d90657a 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -8,6 +8,17 @@ "${workspaceFolder}/textures/**", "${workspaceFolder}/**" ], + "forcedInclude": [ + "${workspaceFolder}/include/types.h", + "${workspaceFolder}/include/n64/ultra64.h", + "${workspaceFolder}/include/sm64.h", + "${workspaceFolder}/include/config.h", + "${workspaceFolder}/include/make_const_nonconst.h", + "${workspaceFolder}/include/geo_commands.h", + "${workspaceFolder}/include/level_commands.h", + "${workspaceFolder}/include/segment_symbols.h", + "${workspaceFolder}/include/command_macros_base.h" + ], "defines": [ "TARGET_N64=1", "VERSION_US=1", @@ -24,4 +35,4 @@ } ], "version": 4 -} \ No newline at end of file +} From fc30f1bb1ee28690ec1fbb38adb8112e87bec374 Mon Sep 17 00:00:00 2001 From: Reonu Date: Fri, 17 Sep 2021 00:18:52 +0300 Subject: [PATCH 2/2] add obj_get_model_id function --- README.md | 1 + src/game/object_helpers.c | 14 ++++++++++++-- src/game/object_helpers.h | 5 +++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f5a45825..75ff3e77 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ This is a fork of the ultrasm64 repo by CrashOveride which includes the followin - Apply_patch.sh improved - Removed the ifdef hell in `file_select.c` and `ingame_menu.c` - Added Blake's custom function for object model stuff: `obj_set_model` and `obj_has_model` +- Added function to get the model ID from an object: `obj_get_model_id` (by Arceveti) - The "far" variable is now u16, allowing you to increase the farclip (the max distance at which geometry is rendered). However, when increasing the farclip, make sure to increase the nearclip by the same ratio, or rendering will break on console and LLE plugins. - Many general use defines for object struct members, meant for use in custom object behaviors. Check `object_fields.h` for more info on this. (By MrComit) - Included `actors/group0.c` in `behavior_data.c` diff --git a/src/game/object_helpers.c b/src/game/object_helpers.c index c4e4068a..9e81bd8d 100644 --- a/src/game/object_helpers.c +++ b/src/game/object_helpers.c @@ -2911,7 +2911,7 @@ void cur_obj_spawn_star_at_y_offset(f32 targetX, f32 targetY, f32 targetZ, f32 o } #endif -// Extra functions for ultrasm64-extbounds +// Extra functions for HackerSM64 void obj_set_model(struct Object *obj, s32 modelID) { obj->header.gfx.sharedChild = gLoadedGraphNodes[modelID]; } @@ -2919,5 +2919,15 @@ void obj_set_model(struct Object *obj, s32 modelID) { s32 obj_has_model(struct Object *obj, u16 modelID) { return (obj->header.gfx.sharedChild == gLoadedGraphNodes[modelID]); } -// End of ultrasm64-extbounds stuff + +u32 obj_get_model_id(struct Object *obj) { + s32 i; + for (i = 0; i < MODEL_ID_COUNT; i++) { + if (obj->header.gfx.sharedChild == gLoadedGraphNodes[i]) { + return i; + } + } + return 0; +} +// End of HackerSM64 stuff diff --git a/src/game/object_helpers.h b/src/game/object_helpers.h index 00adcec8..3cd8b8b6 100644 --- a/src/game/object_helpers.h +++ b/src/game/object_helpers.h @@ -298,9 +298,10 @@ void cur_obj_spawn_loot_blue_coin(void); void cur_obj_spawn_star_at_y_offset(f32 targetX, f32 targetY, f32 targetZ, f32 offsetY); #endif -// Extra functions for ultrasm64-extbounds +// Extra functions for HackerSM64 void obj_set_model(struct Object *obj, s32 modelID); s32 obj_has_model(struct Object *obj, u16 modelID); -// End of ultrasm64-extbounds stuff +u32 obj_get_model_id(struct Object *obj); +// End of HackerSM64 stuff #endif // OBJECT_HELPERS_H