From bda5b83346773bdf2111c890f58feb37dee75b28 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Sun, 10 Jan 2021 04:04:36 -0500 Subject: [PATCH] MacOS ZAPD fixes (#606) * Adding -Wno-return-type to GCC check for MacOS * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "0325ec161" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "0325ec161" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "605f6972e" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "605f6972e" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull --force tools/ZAPD subrepo: subdir: "tools/ZAPD" merged: "6e6ad445a" upstream: origin: "https://github.com/zeldaret/ZAPD.git" branch: "master" commit: "6e6ad445a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Rewrote func to avoid returns without values --- extract_assets.py | 0 src/code/z_camera.c | 24 +++++++++---------- tools/ZAPD/.gitrepo | 4 ++-- .../ZAPD/ZAPD/ZRoom/Commands/SetPathways.cpp | 24 +++++++++++++++++-- tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.h | 2 ++ tools/ZAPD/ZAPD/ZVector.cpp | 2 +- 6 files changed, 38 insertions(+), 18 deletions(-) mode change 100644 => 100755 extract_assets.py diff --git a/extract_assets.py b/extract_assets.py old mode 100644 new mode 100755 diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 3b0a98d3c6..4f56fdf806 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -7160,26 +7160,24 @@ s32 Camera_CheckWater(Camera* camera) { if (camera->unk_150 > 0) { camera->unk_150--; camera->unk_152 |= 8; - return; } else if (camera->globalCtx->sceneNum == 0x49) { camera->unk_152 |= 0x10; - return; } else { camera->unk_152 |= 2; - return; } - } - if (camera->unk_14C & 0x100) { - camera->unk_14C &= ~0x100; - osSyncPrintf("kankyo changed water off, sound off\n"); - func_800706A0(camera->globalCtx); - if (*quakeId != 0) { - Quake_RemoveFromIdx(*quakeId); + } else { + if (camera->unk_14C & 0x100) { + camera->unk_14C &= ~0x100; + osSyncPrintf("kankyo changed water off, sound off\n"); + func_800706A0(camera->globalCtx); + if (*quakeId != 0) { + Quake_RemoveFromIdx(*quakeId); + } + camera->unk_150 = 0; + camera->unk_152 = 0; } - camera->unk_150 = 0; - camera->unk_152 = 0; + func_800F6828(0); } - func_800F6828(0); // @BUG: doesn't always return a value, but sometimes does. } diff --git a/tools/ZAPD/.gitrepo b/tools/ZAPD/.gitrepo index a8ba312130..0fe928caf7 100644 --- a/tools/ZAPD/.gitrepo +++ b/tools/ZAPD/.gitrepo @@ -6,7 +6,7 @@ [subrepo] remote = https://github.com/zeldaret/ZAPD.git branch = master - commit = fd4d53a2684871a1ac28668515d025470a45ef7f - parent = cbe216b1810f9274242d0088a7e3b15b0f95f55d + commit = 6e6ad445a69089b721bea75f6e43b23b14a553b6 + parent = cf6d96f133d98c6b69066c5ff195dc8a4d029444 method = merge cmdver = 0.4.3 diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.cpp b/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.cpp index a131ac1f09..08f745dd1c 100644 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.cpp +++ b/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.cpp @@ -59,6 +59,15 @@ string SetPathways::GenerateSourceCodePass1(string roomName, int baseAddress) currentPtr += 6; } + if (numPoints == 0) // Hack for SharpOcarina + { + for (int i = 0; i < 3; i++) + { + PathwayEntry* entry = new PathwayEntry(); + pathways.push_back(entry); + } + } + return ""; } @@ -82,7 +91,11 @@ string SetPathways::GenerateSourceCodePass2(string roomName, int baseAddress) int index = 0; for (PathwayEntry* entry : pathways) { - declaration += StringHelper::Sprintf("{ %i, %i, %i }, //0x%06X \n", entry->x, entry->y, entry->z, listSegmentOffset + (index * 6)); + declaration += StringHelper::Sprintf(" { %i, %i, %i }, //0x%06X", entry->x, entry->y, entry->z, listSegmentOffset + (index * 6)); + + if (index < pathways.size() - 1) + declaration += "\n"; + index++; } @@ -111,4 +124,11 @@ string SetPathways::GetCommandCName() RoomCommand SetPathways::GetRoomCommand() { return RoomCommand::SetPathways; -} \ No newline at end of file +} + +PathwayEntry::PathwayEntry() +{ + x = 0; + y = 0; + z = 0; +} diff --git a/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.h b/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.h index 0dab428623..67d0322d8e 100644 --- a/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.h +++ b/tools/ZAPD/ZAPD/ZRoom/Commands/SetPathways.h @@ -7,6 +7,8 @@ class PathwayEntry { public: int16_t x, y, z; + + PathwayEntry(); }; class SetPathways : public ZRoomCommand diff --git a/tools/ZAPD/ZAPD/ZVector.cpp b/tools/ZAPD/ZAPD/ZVector.cpp index 874f6848ef..c7a6c5293f 100644 --- a/tools/ZAPD/ZAPD/ZVector.cpp +++ b/tools/ZAPD/ZAPD/ZVector.cpp @@ -80,7 +80,7 @@ std::string ZVector::GetSourceTypeName() } else { - std::string output = StringHelper::Sprintf("Encountered unsupported vector type: %d dimensions, %s type", dimensions, ZScalar::MapScalarTypeToOutputType(scalarType)); + std::string output = StringHelper::Sprintf("Encountered unsupported vector type: %d dimensions, %s type", dimensions, ZScalar::MapScalarTypeToOutputType(scalarType).c_str()); if (Globals::Instance->verbosity >= VERBOSITY_DEBUG) printf("%s\n", output.c_str());