Compare commits

..

66 Commits

Author SHA1 Message Date
SuperDude88 529a61001a RPX Loader
This is mostly a mess and should not be included in its current state, pushing it so I don't forget/lose it on my machine. Only changes Link's l_sightDL as a (messy) example since the other cases probably need further code changes.

Does not currently support multiple RPX versions/regions. Handling of SD/HD switching should be fleshed out more before integrating this fully imo.
2026-06-25 23:09:28 -04:00
Lurs d23a5c6fd1 Merge remote-tracking branch 'origin/main' into tphd 2026-06-17 19:17:52 +02:00
MelonSpeedruns ea034bf884 Add warp out sound to CoS when withdrawing to match TPHD 2026-06-14 12:28:08 -04:00
Lurs 2b266048c6 Add temple of time reflections via GX2 stencil. Temporarily point to my own aurora fork before stencil PR is merged. 2026-06-12 08:21:57 +02:00
TakaRikka c99241a662 fix withdraw functionality 2026-06-11 23:07:28 -07:00
TakaRikka 7f503c9d8f fix los lift 2026-06-11 22:29:36 -07:00
TakaRikka 776ee9b978 partially fix los exit portals 2026-06-11 21:55:58 -07:00
TakaRikka f0c2544d53 force load as wolf 2026-06-11 18:43:29 -07:00
TakaRikka cda5a17c2d disable los transforming 2026-06-11 18:27:28 -07:00
TakaRikka 645d64a73a fix los bgm 2026-06-11 13:21:57 -07:00
MelonSpeedruns 849edf4a58 fix title logo for SD & import hd particles & fix minimap crash 2026-06-11 15:22:07 -04:00
MelonSpeedruns 1d1ece9cb2 fix file select music not playing 2026-06-11 14:34:18 -04:00
MelonSpeedruns cb85470214 HD minigame icons + map files loading 2026-06-11 13:56:10 -04:00
MelonSpeedruns 273c58d927 HD title logo for pal regions 2026-06-11 13:55:46 -04:00
TakaRikka 6692eff3a3 partially working colossal wallet 2026-06-11 03:10:45 -07:00
TakaRikka 43817ea4e5 fix los fairy 2026-06-11 02:07:44 -07:00
TakaRikka 55ceab9b2d fix los wolfos 2026-06-10 23:58:09 -07:00
TakaRikka 7f2dc7902c add los table loading 2026-06-09 23:50:47 -07:00
TakaRikka e345323f0a add los swpush variant 2026-06-09 03:28:40 -07:00
TakaRikka 3d5b55ad33 fix build 2026-06-09 01:24:40 -07:00
TakaRikka 8182f6123b Merge branch 'main' of https://github.com/TwilitRealm/dusklight into tphd 2026-06-09 01:23:46 -07:00
TakaRikka 4d63aa3aad add cos shutter walls 2026-06-05 18:07:14 -07:00
MelonSpeedruns 17d9dad1d9 fixed vessel of light tears visuals 2026-06-03 18:29:59 -04:00
MelonSpeedruns dc798a931c re-add TPHD content path option in pre-launch 2026-06-03 16:45:57 -04:00
MelonSpeedruns 55a81adfad swap language names in the prelaunch menu to match the loaded ISO region 2026-06-01 12:58:14 -04:00
Lurs a2ddd3b580 change register_copied_hd_bti to register_copied_hd_resource to load BMDs as well for weapom textures 2026-05-31 09:31:37 +02:00
SuperDude88 b99ad37541 Remaining GX2SetPolygonOffset Uses
Port over the remaining uses of this from HD
2026-05-30 19:34:49 -04:00
Luke Street b6b71a32c7 Replace textures from mounted JKRArchives 2026-05-30 16:13:14 -06:00
Luke Street 458ffb17c2 Load from data/tphd/content if exists 2026-05-30 15:38:33 -06:00
Luke Street 7c17b1f5f7 Move GX2SetPolygonOffset to the right place 2026-05-30 13:40:11 -06:00
MelonSpeedruns e1d0f99fc3 language support 2026-05-30 15:19:22 -04:00
Luke Street 228d4d2bd1 Update aurora & DVD overlay API 2026-05-30 13:17:16 -06:00
Luke Street a50a8b21e1 Stop using std::format 2026-05-30 09:00:12 -06:00
Luke Street fd1a9ebd4e Unslopify a few more things 2026-05-30 08:57:14 -06:00
Lurs f73f28b4c6 added computeSurfaceInfo from decaf for NextPow2 padded mips in GTX 2026-05-30 15:53:45 +02:00
Luke Street f6d4eba130 Update aurora 2026-05-29 21:23:26 -06:00
Luke Street 20885959b7 Merge branch 'main' into tphd 2026-05-29 21:23:18 -06:00
Luke Street ae11304c66 Use DVD overlay system & runtime Aurora texture replacements 2026-05-29 21:18:04 -06:00
Luke Street bd8b3aafeb Skip unknown treasure types in dTres_c::addData 2026-05-29 00:24:54 -06:00
Luke Street 9c001114f7 Increase string capacity in dDlst_TimerScrnDraw_c 2026-05-29 00:24:35 -06:00
Luke Street 34c55700a2 CMake: Use zlib from aurora 2026-05-29 00:23:58 -06:00
Luke Street a99c8096d5 Merge branch 'refs/heads/main' into depth-bias-poc-hack 2026-05-28 22:41:45 -06:00
MelonSpeedruns 0b93dd9698 Merge remote-tracking branch 'origin/main' into depth-bias-poc-hack 2026-05-27 15:59:54 -04:00
Lurs be771e1a83 Merge branch 'depth-bias-poc-hack' of https://github.com/TwilitRealm/dusk into depth-bias-poc-hack 2026-05-27 17:28:33 +02:00
Lurs e0de71b5b4 Take widthAlignFactor into account for alignment in mipLevelDesc to fix wrong mip level 2 and above 2026-05-27 17:28:00 +02:00
MelonSpeedruns 010a4b5094 Fix fish book crash 2026-05-25 15:43:17 -04:00
MelonSpeedruns a71bd56058 Merge branch 'tphd' into depth-bias-poc-hack 2026-05-25 14:43:25 -04:00
MelonSpeedruns 63a86a456f update aurora 2026-05-25 14:37:44 -04:00
MelonSpeedruns 6304866b38 Merge remote-tracking branch 'origin/main' into tphd
# Conflicts:
#	extern/aurora
2026-05-25 14:37:26 -04:00
Lurs 54dbf20480 Fix mipmapping of BC1 textures. Update aurora. 2026-05-24 21:36:38 +02:00
MelonSpeedruns f11d4b14d9 have modified tears of light count use tphd_active function 2026-05-23 16:03:45 -04:00
SuperDude88 31298f24ba Broken Attempt at Depth Bias
Pushing so I can ask the smarter people questions
2026-05-22 13:26:39 -04:00
SuperDude88 8ae35dc9ea Add Missing BE
- Checking the values in the debugger reminded me that these need to be swapped
2026-05-21 00:21:34 -04:00
SuperDude88 9abb6bafd1 MAT4 Loading
- Properly load all MAT4 data

New fields/inlines/structs are based on what HD does. Still looking for ways to clean things up, particularly getMatInitData.
2026-05-20 23:47:24 -04:00
MelonSpeedruns 81c0c6f4d3 Merge remote-tracking branch 'origin/main' into tphd
# Conflicts:
#	extern/aurora
2026-05-19 15:49:56 -04:00
Lurs 41fe3a85a2 add Tracy zones 2026-05-18 17:31:07 +02:00
Lurs 307f626c57 fix crash when transforming into wolf 2026-05-18 17:30:03 +02:00
Lurs cd0b8b3172 fix mimapping (hopefully). update aurora 2026-05-17 09:15:53 +02:00
Lurs 8e55961e3c Merge remote-tracking branch 'origin/main' into tphd 2026-05-17 09:12:15 +02:00
MelonSpeedruns fd204062f7 Merge remote-tracking branch 'origin/main' into tphd
# Conflicts:
#	extern/aurora
2026-05-15 12:35:59 -04:00
MelonSpeedruns 89b8debe51 Merge remote-tracking branch 'origin/main' into tphd
# Conflicts:
#	CMakeLists.txt
#	extern/aurora
#	src/dusk/ui/prelaunch.cpp
#	src/dusk/ui/settings.cpp
2026-05-14 09:15:35 -04:00
MelonSpeedruns c498bf8fb8 Merge remote-tracking branch 'origin/main' into tphd
# Conflicts:
#	CMakeLists.txt
#	src/dusk/file_select.cpp
2026-05-10 14:08:25 -04:00
MelonSpeedruns 290f592098 update aurora 2026-05-10 13:51:51 -04:00
Irastris 9a80f3a08a Re-add settings options and other misc changes 2026-05-08 19:50:31 -04:00
MelonSpeedruns 41e128c582 MelonSpeedruns' squashed commits
* Fix RB channels + Remove mipmaps for now

* Remove loading most Layout files from a TPHD dump

* Fixes the main map crashing

* added folder picker to pre-launch options

* reduced tears of light needed count to 12 instead of 16
2026-05-08 19:50:31 -04:00
Lurs aa23ae244f Lurs' squashed commits
* first tphd wip

* fix CMakeLists.txt after rebase

* fix mipmapping (I hope) thanks to decaf-emu. Skipped a few textures in favor of GC assets and added new HD asset file formats

* added third hook into dusk for second JKRMemArchive constructor (e.g. for sign textures). skip texture load for textures with imageoffset = 0 to get STG.arc loaded instead. And small refactorings/rebasings. added a few parameters in logging
2026-05-08 19:43:48 -04:00
155 changed files with 4928 additions and 1725 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
[submodule "extern/aurora"]
path = extern/aurora
url = https://github.com/encounter/aurora.git
url = https://github.com/Lurs/aurora.git
+5 -6
View File
@@ -363,8 +363,7 @@ set(DUSK_COPYRIGHT "Copyright (C) Twilit Realm contributors")
source_group("dolzel" FILES ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${REL_FILES})
source_group("dusklight" FILES ${DUSK_FILES} ${DUSK_HTTP_BACKEND_FILES})
# PARTIAL_DEBUG makes debug and release share one struct/vtable ABI so a mod binary loads into either
set(GAME_COMPILE_DEFS TARGET_PC WIDESCREEN_SUPPORT=1 AVOID_UB=1 VERSION=0 MTX_USE_PS=1 PARTIAL_DEBUG=1)
set(GAME_COMPILE_DEFS TARGET_PC WIDESCREEN_SUPPORT=1 AVOID_UB=1 VERSION=0 MTX_USE_PS=1 DUSK_TPHD=1)
set(GAME_INCLUDE_DIRS
include
@@ -379,7 +378,7 @@ set(GAME_INCLUDE_DIRS
find_package(Threads REQUIRED)
set(GAME_LIBS aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os aurora::dvd
aurora::card freeverb cxxopts::cxxopts absl::flat_hash_map nlohmann_json::nlohmann_json TracyClient fmt::fmt
Threads::Threads zstd::libzstd)
Threads::Threads zstd::libzstd ZLIB::ZLIB)
if (DUSK_ENABLE_SENTRY_NATIVE)
list(APPEND GAME_LIBS sentry)
@@ -475,7 +474,7 @@ set(GAME_DEBUG_FILES
set_source_files_properties(
${GAME_DEBUG_FILES}
PROPERTIES
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:DEBUG=1>;PARTIAL_DEBUG=1"
COMPILE_DEFINITIONS "$<$<CONFIG:Debug>:DEBUG=1>;$<$<CONFIG:Debug>:PARTIAL_DEBUG=1>"
)
# game_base is for all other game code files
@@ -489,14 +488,14 @@ set(GAME_BASE_FILES
set_source_files_properties(
${GAME_BASE_FILES}
PROPERTIES
COMPILE_DEFINITIONS "NDEBUG=1;NDEBUG_DEFINED=1;DEBUG_DEFINED=0;PARTIAL_DEBUG=1"
COMPILE_DEFINITIONS "NDEBUG=1;NDEBUG_DEFINED=1;DEBUG_DEFINED=0;$<$<CONFIG:Debug>:PARTIAL_DEBUG=1>"
)
foreach(jsystem_lib IN LISTS JSYSTEM_LIBRARIES)
target_compile_definitions(${jsystem_lib} PRIVATE
${GAME_COMPILE_DEFS}
$<$<CONFIG:Debug>:DEBUG=1>
PARTIAL_DEBUG=1
$<$<CONFIG:Debug>:PARTIAL_DEBUG=1>
)
target_include_directories(${jsystem_lib} PRIVATE ${GAME_INCLUDE_DIRS})
target_link_libraries(${jsystem_lib} PRIVATE ${GAME_LIBS})
+18 -4
View File
@@ -20,17 +20,31 @@ It aims to be as accurate as possible to the original while also providing new o
> Dusklight does *not* provide any copyrighted assets. You must provide your own copy of the original game.
> [!IMPORTANT]
> At a minimum, Dusklight requires a GPU with support for D3D12, Vulkan 1.1+, or Metal. For older devices, best-effort support is provided for D3D11 and OpenGL ES (Android), but will not achieve full accuracy or performance. Your experience with specific hardware, operating systems, and drivers may vary.
> At a minimum, Dusklight requires a GPU with support for either D3D12, Vulkan, or Metal. Your experience with specific hardware, operating systems, and drivers may vary. In particular, older Intel iGPUs have a high likelihood of incompatibility. We are also aware of a number of issues on devices with Adreno GPUs and are working to resolve them.
### 1. Dump your game
You must dump your own copy of the game. Please see [this article](https://wiki.dolphin-emu.org/index.php?title=Ripping_Games) for instructions. After dumping, you can use a program like [Dolphin](https://dolphin-emu.org/) or [nodtool](https://github.com/encounter/nod/releases) to convert the `.iso` to `.rvz` to save space.
You must dump your own copy of the game, please see [this article](https://wiki.dolphin-emu.org/index.php?title=Ripping_Games) for instructions. After dumping, you can use a program like [Dolphin](https://dolphin-emu.org/) or [nodtool](https://github.com/encounter/nod/releases) to convert the `.iso` to a `.rvz` to save space.
Currently, only the GameCube USA and EUR releases are supported. Support for other versions of the game is planned in the future.
### 2. Install Dusklight
### 2. Download [Dusklight](https://github.com/TwilitRealm/dusklight/releases)
Visit the [official installation guide](https://twilitrealm.dev/install/) for full instructions.
### 3. Setup the game
**Windows / macOS / Linux**
- Extract the .zip file
- Launch Dusklight
- Press **Select Disc Image** and provide the path to your supported game dump
- Press **Play**!
**iOS**
- Follow the [iOS setup guide](docs/ios-install-altstore.md)
**Android**
- Install the Dusklight APK
- Launch Dusklight
- Press **Select Disc Image** and provide the path to your supported game dump
- Press **Play**!
# Building
+1 -1
+10
View File
@@ -1546,6 +1546,16 @@ set(DUSK_FILES
src/dusk/discord_presence.cpp
src/dusk/version.cpp
src/dusk/action_bindings.cpp
src/dusk/tphd/TphdPack.hpp
src/dusk/tphd/TphdPack.cpp
src/dusk/tphd/GtxParser.hpp
src/dusk/tphd/GtxParser.cpp
src/dusk/tphd/AddrLib.hpp
src/dusk/tphd/AddrLib.cpp
src/dusk/tphd/HdAssetLayer.hpp
src/dusk/tphd/HdAssetLayer.cpp
src/dusk/tphd/LosTable.hpp
src/dusk/tphd/LosTable.cpp
)
set(DUSK_HTTP_BACKEND_FILES
+14 -20
View File
@@ -16,37 +16,37 @@
];
forAllSystems = lib.genAttrs supportedSystems;
dawnVersion = "v20260618.032059";
nodVersion = "v2.0.0-alpha.10";
dawnVersion = "v20260423.175430";
nodVersion = "v2.0.0-alpha.8";
versionSuffix = "nix-" + (self.shortRev or self.dirtyShortRev or "dirty");
dawnInfo = {
"x86_64-linux" = {
triple = "linux-x86_64";
hash = "sha256-GFSd573b+VQx/VmFdNQgWDd0V9ayQlcw0Zuopke12ak=";
hash = "sha256-HXfKTLHtMPwupnFnaflCARtXVPuS/0PoCePXidjE5xs=";
};
"aarch64-linux" = {
triple = "linux-aarch64";
hash = "sha256-ZaoP7BAjBMnfAv2/AMRi3FNH2ZtyqASCSFyU/oB2Mzg=";
hash = "sha256-34yyFpfqBZUwoFXQ41F0AwAU78FaNihOSY0oriwn6B0=";
};
"aarch64-darwin" = {
triple = "darwin-arm64";
hash = "sha256-HT+qtlLaSHyoXPrUcXgcTGa877X5YfzbxRD4bJb7i1Y=";
hash = "sha256-eQnzrBp6gjiBek1VYQ9A5W13ClYWrDDKjIqv/7eNTR4=";
};
"x86_64-darwin" = {
triple = "darwin-x86_64";
hash = "sha256-cUNaCbA7rlKSukDVKGaVEVw0Zt1+mSbaHbmUCMvMVWc=";
hash = "sha256-QGWiGdxiI9kci3NPXH6QFFirxn16851zB/w3jqhIBJ4=";
};
};
nodPrebuiltInfo = {
"x86_64-linux" = {
triple = "linux-x86_64";
hash = "sha256-FVQWECVA2gWdc+n5OQ/Tvwn8z0qdgjSd1WlFt5HKOec=";
hash = "sha256-mUqvLsbsqaZ+HAjMmHYPYO+MgtanGRTw7Gzn5uXR5rE=";
};
"aarch64-darwin" = {
triple = "macos-arm64";
hash = "sha256-8ZEejxksVgShNKUVRCBYaLOp9x/qOC9pAeVrElQUGUk=";
hash = "sha256-UPy1ywCcv0K6VJOU3uUelJuUdBh3UNaPRlyP5LOBeDw=";
};
};
@@ -75,7 +75,7 @@
'';
dawn = pkgs.fetchzip {
url = "https://github.com/encounter/dawn/releases/download/${dawnVersion}/dawn-${dawnInfo.${system}.triple}.tar.gz";
url = "https://github.com/encounter/dawn-build/releases/download/${dawnVersion}/dawn-${dawnInfo.${system}.triple}.tar.gz";
hash = dawnInfo.${system}.hash;
stripRoot = false;
};
@@ -94,7 +94,7 @@
owner = "encounter";
repo = "nod";
rev = nodVersion;
hash = "sha256-r8qDlOVxv5iKiFjJQrcBuL9HVoOM3yEjRVnQIMqaICs=";
hash = "sha256-+zrtVzjo0+X/6uMcNUn1+FaSR+jOhrcQSDNBFjw0NDs=";
};
patches = [ ./fix-cmake-paths.patch ];
cargoDeps = pkgs.rustPlatform.importCargoLock {
@@ -141,12 +141,12 @@
XXHASH = pkgs.xxhash.src;
ZSTD = pkgs.zstd.src;
FMT = pkgs.fetchzip {
url = "https://github.com/fmtlib/fmt/archive/refs/tags/12.1.0.tar.gz";
hash = "sha256-ZmI1Dv0ZabPlxa02OpERI47jp7zFfjpeWCy1WyuPYZ0=";
url = "https://github.com/fmtlib/fmt/archive/refs/tags/11.1.4.tar.gz";
hash = "sha256-sUbxlYi/Aupaox3JjWFqXIjcaQa0LFjclQAOleT+FRA=";
};
TRACY = pkgs.fetchzip {
url = "https://github.com/wolfpld/tracy/archive/6789e7d6f9a65ec98926b602097a33a9676d2606.tar.gz";
hash = "sha256-Xxyd7G/mnXEPpN+ehmwl0AkAhS3CwObpJNDgcqbdUJg=";
url = "https://github.com/wolfpld/tracy/archive/a64b9a20294d59421a2f57aeca3c6383d8c48169.tar.gz";
hash = "sha256-hbNGOsGeyGSvCJ2No8RkwOib1lX2on3vNZSzyVkZdXw=";
};
IMGUI = pkgs.fetchFromGitHub {
owner = "ocornut";
@@ -269,12 +269,6 @@
runHook postInstall
'';
postFixup = lib.optionalString (!isDarwin) ''
patchelf \
--add-needed "${pkgs.vulkan-loader}/lib/libvulkan.so" \
$out/bin/dusklight
'';
dontStrip = true;
meta = {
@@ -20,7 +20,7 @@ public:
/* 0x14 */ cM3dGAab mM3dGAab;
/* 0x30 */ cBgS_ShdwDraw_Callback mCallbackFun;
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x34 */ int field_0x34;
#endif
};
-2
View File
@@ -48,8 +48,6 @@ public:
/* 0x1370 */ Z2FxLineMgr mFxLineMgr;
#if DEBUG
/* 0x13BC */ Z2DebugSys mDebugSys;
#elif PARTIAL_DEBUG
alignas(Z2DebugSys) u8 mDebugSys[sizeof(Z2DebugSys)];
#endif
}; // Size: 0x138C
+4
View File
@@ -158,6 +158,10 @@ enum Z2Scene {
/* 0x4E */ Z2SCENE_GROTTO_ROCK_2,
/* 0x4F */ Z2SCENE_GROTTO_POND,
/* 0x50 */ Z2SCENE_FARON_WOODS_CAVE,
#if TARGET_PC
/* 0x51 */ Z2SCENE_CAVE_OF_SHADOWS,
#endif
};
#endif /* Z2SCENEMGR_H */
+1 -1
View File
@@ -194,7 +194,7 @@ public:
JAISoundHandle* getMainBgmHandle() { return &mMainBgmHandle; }
JAISoundHandle* getSubBgmHandle() { return &mSubBgmHandle; }
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
f32 field_0x00_debug;
u8 field_0x04_debug;
#endif
+2 -2
View File
@@ -100,13 +100,13 @@ public:
bool isForceBattle() { return forceBattle_; }
JSUList<Z2CreatureEnemy>* getEnemyList() { return &field_0x0; }
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
JSUList<Z2SoundObjBase>* getAllList() { return &allList_; }
#endif
private:
/* 0x00 */ JSUList<Z2CreatureEnemy> field_0x0;
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x0C */ JSUList<Z2SoundObjBase> allList_;
#endif
/* 0x0C */ Z2EnemyArea enemyArea_;
+1 -1
View File
@@ -7,7 +7,7 @@
struct Z2SoundStarter;
class Z2SoundObjBase : public Z2SoundHandles
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
, public JSULink<Z2SoundObjBase>
#endif
{
+2
View File
@@ -4560,6 +4560,8 @@ public:
void onIronBallChainInterpCallback();
f32 mLosStickValue;
static const int IRON_BALL_CHAIN_COUNT = 102;
cXyz mIBChainInterpPrevPos[IRON_BALL_CHAIN_COUNT];
cXyz mIBChainInterpCurrPos[IRON_BALL_CHAIN_COUNT];
+2 -7
View File
@@ -88,14 +88,9 @@ public:
/* 0x396A */ u8 field_0x396A[0x399E - 0x396A];
/* 0x399E */ s16 field_0x399e;
/* 0x39A0 */ u8 field_0x39A0[0x39A4 - 0x39A0];
#if TARGET_PC
/* 0x39A4 */ cM_rnd_c mMantRng;
#endif
};
#if TARGET_PC
STATIC_ASSERT(sizeof(mant_class) == 0x39ac);
#else
STATIC_ASSERT(sizeof(mant_class) == 0x39a4);
#endif
#endif /* D_A_MANT_H */
+9 -1
View File
@@ -18,16 +18,24 @@ public:
TGXTexObj& getTexObj() { return mTexObj; }
cXyz* getQuad() { return mQuad; }
#if TARGET_PC
// TP HD reflects across N floor quads (F_SP117 room 2 uses 6); GC uses 1.
static const int MAX_QUADS = 6;
#endif
/* 0x010 */ TGXTexObj mTexObj;
/* 0x030 */ u8 mModelCount;
/* 0x034 */ J3DModel* mModels[0x40];
/* 0x134 */ cXyz mQuad[4];
/* 0x134 */ cXyz mQuad[DUSK_IF_ELSE(MAX_QUADS*4, 4)];
/* 0x164 */ cXyz mMinVal;
/* 0x170 */ cXyz mMaxVal;
/* 0x17C */ cXyz mViewScale;
#if TARGET_PC
bool mbReset = false;
bool mbHadEntry = false;
cXyz mQuadBoxMin[MAX_QUADS];
cXyz mQuadBoxMax[MAX_QUADS];
int mQuadCount = 1;
#endif
};
+4 -4
View File
@@ -142,12 +142,12 @@ namespace daObjSwpush {
int Mthd_Execute();
int Mthd_Draw();
static s16 const M_bmd[3];
static s16 const M_dzb[3];
static u32 const M_heap_size[3];
static s16 const M_bmd[DUSK_IF_ELSE(4, 3)];
static s16 const M_dzb[DUSK_IF_ELSE(4, 3)];
static u32 const M_heap_size[DUSK_IF_ELSE(4, 3)];
static Hio_c::Attr_c const M_attr[5];
static u8 const M_op_vtx[4];
static DUSK_CONST char* M_arcname[3];
static DUSK_CONST char* M_arcname[DUSK_IF_ELSE(4, 3)];
/* 0x568 */ request_of_phase_process_class mPhase;
/* 0x570 */ dBgWSv* mpBgW;
+2 -2
View File
@@ -45,7 +45,7 @@ private:
class dAttParam_c : public JORReflexible {
public:
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x04 */ s8 mHIOChildNo;
#endif
@@ -66,7 +66,7 @@ public:
/* 0x35 */ u8 mAttnCursorDisappearFrames;
/* 0x38 */ f32 field_0x38;
/* 0x3C */ f32 field_0x3c;
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x44 */ s32 mDebugDispPosX;
/* 0x48 */ s32 mDebugDispPosY;
#endif
+2 -2
View File
@@ -201,7 +201,7 @@ private:
/* 0x02C */ u32 m_flags;
/* 0x030 */ cXyz* pm_pos;
/* 0x034 */ cXyz* pm_old_pos;
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x038 */ cXyz unk_0x38;
#endif
/* 0x038 */ cXyz* pm_speed;
@@ -229,7 +229,7 @@ private:
/* 0x0CC */ f32 field_0xcc;
/* 0x0D0 */ f32 m_wtr_chk_offset;
/* 0x0D4 */ cBgS_PolyInfo* pm_out_poly_info;
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x0E4 */ cXyz unk_0xe4;
#endif
/* 0x0D8 */ f32 field_0xd8;
+1 -1
View File
@@ -79,7 +79,7 @@ public:
// /* 0x0000 */ cCcS mCCcS;
/* 0x284C */ dCcMassS_Mng mMass_Mng;
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x2AD0 */ u8 m_is_mass_all_timer;
#endif
}; // Size = 0x2AC4
+1 -1
View File
@@ -1037,7 +1037,7 @@ public:
/* 0x1DE09 */ u8 field_0x1de09;
/* 0x1DE0A */ u8 field_0x1de0a;
/* 0x1DE0B */ u8 mIsDebugMode;
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x1DE0C */ OSStopwatch mStopwatch;
#endif
+1 -1
View File
@@ -41,7 +41,7 @@ public:
BASE_ROOM5,
BASE_DEMO,
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
BASE_DEBUG,
#endif
+4
View File
@@ -400,4 +400,8 @@ BOOL isBottleItem(u8 item_no);
u8 check_itemno(int i_itemNo);
BOOL isInsect(u8 i_itemNo);
#if TARGET_PC
void item_func_WALLET_LV4();
#endif
#endif /* D_D_ITEM_H */
+7
View File
@@ -350,4 +350,11 @@ enum {
/* 0xFF */ dItemNo_NONE_e,
};
#if TARGET_PC
// HD item mappings
enum {
dItemNo_WALLET_LV4_e = 0xDA,
};
#endif
#endif /* D_D_ITEM_DATA_H */
+1 -1
View File
@@ -259,7 +259,7 @@ public:
/* 0x09B8 */ DUNGEON_LIGHT dungeonlight[8];
/* 0x0C18 */ BOSS_LIGHT field_0x0c18[8];
/* 0x0D58 */ BOSS_LIGHT field_0x0d58[6];
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x0E48 */ NAVYCHAN navy;
/* 0x0E58 */ u8 field_0xe58[0xE68 - 0xE58]; // part of NAVYCHAN?
#endif
+1 -1
View File
@@ -57,7 +57,7 @@ public:
return &mpTypeGroupData[i_typeGroupNo];
}
/* 0x0 */ fmpTresTypeGroupDataList_c mpTypeGroupData[17];
/* 0x0 */ fmpTresTypeGroupDataList_c mpTypeGroupData[DUSK_IF_ELSE(35, 17)];
};
class dMenu_Fmap_data_c {
-1
View File
@@ -218,7 +218,6 @@ private:
bool mCursorInterpPrevAngular;
bool mCursorInterpCurrAngular;
bool mCursorInterpInit;
bool mPointerTouchPressHoveredCurrent;
#endif
};
+11 -2
View File
@@ -172,6 +172,15 @@ public:
int event041(mesg_flow_node_event*, fopAc_ac_c*);
int event042(mesg_flow_node_event*, fopAc_ac_c*);
#if TARGET_PC
// HD additions
u16 query054(mesg_flow_node_branch*, fopAc_ac_c*, int);
u16 query055(mesg_flow_node_branch*, fopAc_ac_c*, int);
int event043(mesg_flow_node_event*, fopAc_ac_c*);
int event044(mesg_flow_node_event*, fopAc_ac_c*);
int event045(mesg_flow_node_event*, fopAc_ac_c*);
#endif
void initWord(fopAc_ac_c*, const char*, u8, int, fopAc_ac_c**);
#if DEBUG
@@ -185,8 +194,8 @@ public:
void setMsg(u32 msg) { mMsg = msg; }
bool checkEndFlow() { return (u32)field_0x26 == 1; }
static queryFunc mQueryList[53];
static eventFunc mEventList[43];
static queryFunc mQueryList[DUSK_IF_ELSE(55, 53)];
static eventFunc mEventList[DUSK_IF_ELSE(46, 43)];
private:
/* 0x04 */ u8* mFlow_p;
-10
View File
@@ -360,12 +360,7 @@ inline void dMsgObject_demoMessageGroup() {
}
inline bool dMsgObject_isTalkNowCheck() {
#if TARGET_PC
dMsgObject_c* msgObject = dMsgObject_getMsgObjectClass();
return msgObject != NULL && msgObject->getStatus() != 1;
#else
return dMsgObject_getMsgObjectClass()->getStatus() == 1 ? false : true;
#endif
}
inline bool dMsgObject_isKillMessageFlag() {
@@ -502,12 +497,7 @@ inline void dMsgObject_onMsgSend() {
}
inline bool dMsgObject_isFukidashiCheck() {
#if TARGET_PC
dMsgObject_c* msgObject = dMsgObject_getMsgObjectClass();
return msgObject != NULL && msgObject->getScrnDrawPtr() != NULL;
#else
return dMsgObject_getMsgObjectClass()->getScrnDrawPtr() == NULL ? false : true;
#endif
}
inline void* dMsgObject_getTalkHeap() {
+2 -2
View File
@@ -521,13 +521,13 @@ private:
/* 0x019 */ u8 field_0x19;
/* 0x01A */ u8 field_0x1a;
/* 0x01B */ u8 field_0x1b;
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x01C */ dPa_simpleEcallBack field_0x1c[48];
#else
/* 0x01C */ dPa_simpleEcallBack field_0x1c[25];
#endif
/* 0x210 */ level_c field_0x210;
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
u8 mSceneCount;
#endif
};
+1 -1
View File
@@ -59,7 +59,7 @@ private:
/* 0x18 */ JKRHeap* heap;
/* 0x1C */ JKRSolidHeap* mDataHeap;
/* 0x20 */ void** mRes;
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x24 */ int mSize;
#endif
}; // Size: 0x24
+1 -4
View File
@@ -1008,7 +1008,7 @@ public:
static const int ZONE_MAX = 0x20;
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x000 */ u8 unk_0x0;
/* 0x001 */ char unk_0x1;
/* 0x000 */ u8 unk_0x2[0x48 - 0x2];
@@ -1029,9 +1029,6 @@ public:
/* 0xF30 */ s64 mSaveTotalTime;
#if DEBUG
/* 0xF80 */ flagFile_c mFlagFile;
#elif PARTIAL_DEBUG
// flagFile_c's ctor/virtuals are only defined under #if DEBUG (d_save.cpp)
alignas(flagFile_c) u8 mFlagFile[sizeof(flagFile_c)];
#endif
}; // Size: 0xF38
+9 -4
View File
@@ -538,7 +538,7 @@ public:
/* vt[86] */ virtual stage_tgsc_class* getDrTg(void) const = 0;
/* vt[87] */ virtual void setDoor(stage_tgsc_class*) = 0;
/* vt[88] */ virtual stage_tgsc_class* getDoor(void) const = 0;
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
virtual void setUnit(void*) = 0;
virtual void* getUnit() = 0;
#endif
@@ -796,7 +796,7 @@ public:
virtual stage_tgsc_class* getDrTg(void) const { return mDrTg; }
virtual void setDoor(stage_tgsc_class* i_Door) { mDoor = i_Door; }
virtual stage_tgsc_class* getDoor(void) const { return mDoor; }
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
virtual void setUnit(void* i_Unit) { mUnit = i_Unit; }
virtual void* getUnit() { return mUnit; }
#endif
@@ -845,7 +845,7 @@ public:
/* 0x54 */ stage_tgsc_class* mDrTg;
/* 0x58 */ stage_tgsc_class* mDoor;
/* 0x5C */ dStage_FloorInfo_c* mFloorInfo;
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x60 */ void* mUnit;
#endif
/* 0x60 */ u16 mPlayerNum;
@@ -990,7 +990,7 @@ public:
/* vt[86] */ virtual stage_tgsc_class* getDrTg(void) const { return mDrTg; }
/* vt[87] */ virtual void setDoor(stage_tgsc_class* i_Door) { mDoor = i_Door; }
/* vt[88] */ virtual stage_tgsc_class* getDoor(void) const { return mDoor; }
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
virtual void setUnit(void* i_Unit) {
UNUSED(i_Unit);
OSReport("stage non unit list data !!\n");
@@ -1416,6 +1416,11 @@ dStage_KeepDoorInfo* dStage_GetKeepDoorInfo();
dStage_KeepDoorInfo* dStage_GetRoomKeepDoorInfo();
void dStage_dt_c_fieldMapLoader(void* i_data, dStage_dt_c* i_stage);
#if TARGET_PC
// TP HD Cave of Shadows (D_SB11): reveal the los next-floor when a descent gate opens.
void dStage_showLOSNextFloor(int fromRoom);
#endif
#if DEBUG
void dStage_DebugDisp();
#endif
-3
View File
@@ -97,9 +97,6 @@ public:
private:
#if DEBUG
/* 0x00 */ dVibTest_c mVibTest;
#elif PARTIAL_DEBUG
// dVibTest_c's ctor/virtuals are only defined under #if DEBUG (d_vibration.cpp)
alignas(dVibTest_c) u8 mVibTest[sizeof(dVibTest_c)];
#endif
class {
+7 -70
View File
@@ -1,11 +1,9 @@
#ifndef DUSK_CONFIG_HPP
#define DUSK_CONFIG_HPP
#include <concepts>
#include <functional>
#include <nlohmann/json.hpp>
#include <stdexcept>
#include "nlohmann/json.hpp"
#include "config_var.hpp"
namespace dusk::config {
@@ -42,7 +40,7 @@ public:
[[nodiscard]] virtual nlohmann::json dumpToJson(const ConfigVarBase& cVar) const = 0;
};
template <ConfigValue T>
template<ConfigValue T>
class ConfigImpl : public ConfigImplBase {
// Just downcasting the references...
void loadFromJson(ConfigVarBase& cVar, const nlohmann::json& jsonValue) const final {
@@ -92,28 +90,20 @@ public:
void Register(ConfigVarBase& configVar);
/**
* \brief Unregister a CVar, detaching it from the config system.
*
* If the CVar carries a user-set value (Value or Speedrun layer), it is stashed as an
* unregistered key: Save() keeps writing it, and a later Register() of the same name restores
* it through the normal back-fill path. The CVar may be destroyed after this returns.
* \brief Indicate that all registrations have happened and everything should lock in.
*/
void unregister(ConfigVarBase& configVar);
void FinishRegistration();
/**
* \brief Load config from the standard user preferences location.
*/
void load_from_user_preferences();
void load_from_file_name(const char* path);
void load_arg_override(std::string_view name, std::string_view value);
void shutdown();
void LoadFromUserPreferences();
void LoadFromFileName(const char* path);
/**
* \brief Save the config to file.
*/
void save();
void Save();
/**
* \brief Get a registered CVar by name.
@@ -134,59 +124,6 @@ void ClearAllActionBindings(int port);
*/
void EnumerateRegistered(std::function<void(ConfigVarBase&)> callback);
/**
* \brief Type-erased change callback. previousValue points at the value before the mutation
* (a `const T*` for a `ConfigVar<T>`) and is valid only for the duration of the call.
*/
using ChangeCallback = std::function<void(ConfigVarBase& cVar, const void* previousValue)>;
/**
* \brief Token identifying a change subscription. 0 is never a valid token.
*/
using Subscription = u64;
/**
* \brief Subscribe to changes of the named CVar (registered or not yet registered).
*
* Fired synchronously on the mutating thread (in practice the game thread) whenever the CVar's
* effective value changes at runtime: setValue, override/speedrun setters and clears. Values
* applied by config load or launch arguments do *not* notify: loads happen during startup
* before the subsystems callbacks push values into are initialized, and each subsystem reads
* its initial value itself at its own init. Callbacks may mutate other CVars; a nested
* mutation of the same CVar applies but does not re-notify.
*/
Subscription subscribe(std::string_view name, ChangeCallback callback);
/**
* \brief Typed convenience overload: the callback receives the current and previous values.
*/
template <ConfigValue T, typename Callback>
requires std::invocable<Callback, const T&, const T&> Subscription subscribe(
ConfigVar<T>& cVar, Callback&& callback) {
return subscribe(cVar.getName(),
[&cVar, cb = std::forward<Callback>(callback)](ConfigVarBase&, const void* previousValue) {
cb(cVar.getValue(), *static_cast<const T*>(previousValue));
});
}
void unsubscribe(Subscription token);
/**
* \brief Register a CVar and attach a change callback in one step.
*
* Useful for pushing settings into external systems (e.g. aurora) from one place instead of
* every UI setter. The callback fires only for runtime changes (see subscribe); the value
* loaded from config or launch arguments does not fire it the external system reads its
* initial value itself at its own initialization.
*/
template <ConfigValue T, typename Callback>
requires std::invocable<Callback, const T&, const T&> Subscription Register(
ConfigVar<T>& cVar, Callback&& onChange) {
auto subscription = subscribe(cVar, std::forward<Callback>(onChange));
Register(static_cast<ConfigVarBase&>(cVar));
return subscription;
}
template <ConfigValue T>
const ConfigImplBase* GetConfigImpl() {
static ConfigImpl<T> config;
+6 -82
View File
@@ -2,12 +2,10 @@
#define DUSK_CONFIG_VAR_HPP
#include "dolphin/types.h"
#include <concepts>
#include <type_traits>
#include <cstdlib>
#include <limits>
#include <optional>
#include <string>
#include <type_traits>
/**
* The configuration system.
@@ -71,7 +69,7 @@ protected:
/**
* The name of this CVar, used in the configuration file.
*/
std::string name;
const char* name;
/**
* Whether this CVar has been registered with the global managing logic.
@@ -89,8 +87,8 @@ protected:
*/
const ConfigImplBase* impl;
ConfigVarBase(const ConfigVarBase&) = delete;
ConfigVarBase(std::string name, const ConfigImplBase* impl);
ConfigVarBase(const char* name, const ConfigImplBase* impl);
virtual ~ConfigVarBase() = default;
/**
* Check that the CVar is registered, aborting if this is not the case.
@@ -100,22 +98,7 @@ protected:
abort();
}
/**
* Whether any change subscriber (see config::subscribe) is attached to this CVar's name.
*/
[[nodiscard]] bool has_subscribers() const;
/**
* Notify change subscribers (see config::subscribe) that the effective value of this CVar
* changed. Called by mutators after the change has been applied; previousValue points at
* the old value (a `const T*` for a `ConfigVar<T>`), valid only for the duration of the
* call.
*/
void notify_changed(const void* previousValue);
public:
virtual ~ConfigVarBase();
/**
* Get the name of this CVar, used in the configuration file.
*/
@@ -138,7 +121,6 @@ public:
* This is necessary to make it legal to access.
*/
void markRegistered();
void unmarkRegistered();
/**
* Clear a speedrun-mode override if one is active on this CVar.
@@ -173,7 +155,6 @@ template <typename T>
concept ConfigValue =
!std::is_const_v<T>
&& !std::is_volatile_v<T>
&& std::equality_comparable<T>
&& (std::is_same_v<T, bool>
|| ConfigValueInteger<T>
|| std::is_same_v<T, f32>
@@ -185,9 +166,6 @@ concept ConfigValue =
template <ConfigValue T>
const ConfigImplBase* GetConfigImpl();
template <ConfigValue T>
class ConfigImpl;
template <typename T>
struct ConfigEnumRange {
static constexpr auto min = std::numeric_limits<std::underlying_type_t<T>>::min();
@@ -214,12 +192,10 @@ public:
* @param arg Arguments to forward to construct the default value.
*/
template <typename... Args>
ConfigVar(std::string name, Args&&... arg)
: ConfigVarBase(std::move(name), GetConfigImpl<T>()), defaultValue(std::forward<Args>(arg)...),
ConfigVar(const char* name, Args&&... arg)
: ConfigVarBase(name, GetConfigImpl<T>()), defaultValue(std::forward<Args>(arg)...),
value(), overrideValue() {}
ConfigVar(ConfigVar const&) = delete;
/**
* \brief Get the current value of the CVar.
*
@@ -258,7 +234,6 @@ public:
*/
void setValue(T newValue, bool replaceOverride = true) {
checkRegistered();
const auto previous = previous_for_notify();
value = std::move(newValue);
if (replaceOverride) {
@@ -267,7 +242,6 @@ public:
} else if (layer != ConfigVarLayer::Override) {
layer = ConfigVarLayer::Value;
}
notify_if_changed(previous);
}
operator const T&() {
@@ -284,10 +258,8 @@ public:
*/
void setOverrideValue(T newValue) {
checkRegistered();
const auto previous = previous_for_notify();
overrideValue = std::move(newValue);
layer = ConfigVarLayer::Override;
notify_if_changed(previous);
}
/**
@@ -301,31 +273,25 @@ public:
void setSpeedrunValue(T newValue) {
checkRegistered();
if (layer != ConfigVarLayer::Override) {
const auto previous = previous_for_notify();
priorLayer = layer;
overrideValue = std::move(newValue);
layer = ConfigVarLayer::Speedrun;
notify_if_changed(previous);
}
}
void clearOverride() {
checkRegistered();
if (layer == ConfigVarLayer::Override) {
const auto previous = previous_for_notify();
overrideValue = {};
layer = ConfigVarLayer::Value;
notify_if_changed(previous);
}
}
void clearSpeedrunOverride() override {
checkRegistered();
if (layer == ConfigVarLayer::Speedrun) {
const auto previous = previous_for_notify();
overrideValue = {};
layer = priorLayer;
notify_if_changed(previous);
}
}
@@ -339,48 +305,6 @@ public:
const ConfigVarLayer effectiveLayer = (layer == ConfigVarLayer::Speedrun) ? priorLayer : layer;
return effectiveLayer == ConfigVarLayer::Default ? defaultValue : value;
}
private:
// The config loader applies values through the silent load_* methods below.
friend class ConfigImpl<T>;
/**
* Copy of the effective value before a mutation, taken only when someone is subscribed.
*/
[[nodiscard]] std::optional<T> previous_for_notify() const {
return has_subscribers() ? std::optional<T>{getValue()} : std::nullopt;
}
/**
* Notify subscribers if the effective value actually changed across a mutation.
*/
void notify_if_changed(const std::optional<T>& previous) {
if (previous.has_value() && !(getValue() == *previous)) {
notify_changed(&*previous);
}
}
/**
* setValue(newValue, false) without notifying change subscribers. Used when loading config:
* loads happen during startup before the subsystems change callbacks push values into are
* initialized, and each subsystem applies the loaded value itself at its own init.
*/
void load_value(T newValue) {
checkRegistered();
value = std::move(newValue);
if (layer != ConfigVarLayer::Override) {
layer = ConfigVarLayer::Value;
}
}
/**
* setOverrideValue without notifying change subscribers (see load_value).
*/
void load_override_value(T newValue) {
checkRegistered();
overrideValue = std::move(newValue);
layer = ConfigVarLayer::Override;
}
};
using ActionBindConfigVar = ConfigVar<int>;
+7
View File
@@ -28,4 +28,11 @@ bool LoadRelAsset(void* dst, const char* dvdPath, std::initializer_list<OffsetVe
*/
bool LoadArchivedRelAsset(void* dst, u32 memType, const char* relFileName, std::initializer_list<OffsetVersion> offset, s32 size);
#ifdef DUSK_TPHD
/**
* Load bytes from the RPX by Wii U virtual address
*/
bool LoadRPXAsset(void* dst, uint32_t virtualAddress, s32 size);
#endif
} // namespace dusk
+44
View File
@@ -602,6 +602,50 @@ static const auto gameRegions = std::to_array({
MapEntry("Grotto 5", "D_SB09", {
{4, {0, 1}},
}),
MapEntry("HD: Cave Of Shadows", "D_SB11", {
// ordered by floor rather than room number
{19, {0}},
{35, {0}},
{21, {0}},
{23, {0}},
{10, {0}},
{25, {0}},
{26, {0}},
{8, {0}},
{5, {0}},
{28, {0}},
{47, {0}},
{15, {0}},
{22, {0}},
{33, {0}},
{31, {0}},
{7, {0}},
{13, {0}},
{46, {0}},
{48, {0}},
{34, {0}},
{2, {0}},
{36, {0}},
{27, {0}},
{32, {0}},
{18, {0}},
{3, {0}},
{44, {0}},
{40, {0}},
{4, {0}},
{30, {0}},
{29, {0}},
{17, {0}},
{41, {0}},
{43, {0}},
{16, {0}},
{38, {0}},
{1, {0}},
{42, {0}},
{45, {0}},
{49, {0}},
}
),
}),
RegionEntry("Misc", {
MapEntry("Title Screen / King Bulblin 1", "F_SP102", {
+2 -7
View File
@@ -6,9 +6,6 @@ class CPaneMgr;
namespace dusk::menu_pointer {
using TargetId = u16;
constexpr TargetId InvalidTarget = 0xffff;
enum class Context {
None,
FileSelect,
@@ -46,14 +43,12 @@ bool active() noexcept;
bool enabled() noexcept;
bool mouse_capture_active() noexcept;
const State& state() noexcept;
void set_hover_target(TargetId target) noexcept;
bool consume_click() noexcept;
bool peek_click() noexcept;
void set_dialog_choice(u8 choice, bool clicked) noexcept;
bool get_dialog_choice(u8& choice) noexcept;
bool consume_dialog_click(u8& choice) noexcept;
void defer_activation(Context context, TargetId target) noexcept;
bool consume_deferred_activation(Context context, TargetId target) noexcept;
void defer_activation(Context context, u8 target) noexcept;
bool consume_deferred_activation(Context context, u8 target) noexcept;
void clear_deferred_activation(Context context) noexcept;
u32 suppressed_pad_buttons(u32 port) noexcept;
void finish_pad_suppression_read(u32 port) noexcept;
+4 -4
View File
@@ -4,9 +4,9 @@
namespace dusk::mouse {
void read();
void get_aim_deltas(float& out_yaw, float& out_pitch);
void get_camera_deltas(float& out_yaw, float& out_pitch);
void getAimDeltas(float& out_yaw, float& out_pitch);
void getCameraDeltas(float& out_yaw, float& out_pitch);
void handle_event(const SDL_Event& event) noexcept;
void on_focus_lost();
void on_focus_gained();
void onFocusLost();
void onFocusGained();
} // namespace dusk::mouse
+9 -15
View File
@@ -1,14 +1,14 @@
#pragma once
#include <array>
#include <filesystem>
#include "dusk/config_var.hpp"
#include "dusk/ui/controls.hpp"
namespace dusk {
using config::ConfigVar;
using config::ActionBindConfigVar;
using namespace config;
enum class BloomMode : int {
Off = 0,
@@ -47,12 +47,6 @@ enum class FrameInterpMode : u8 {
Unlimited = 2,
};
enum class TouchTargeting : u8 {
Hybrid = 0,
Hold = 1,
Switch = 2,
};
enum class MenuScaling : u8 {
GameCube = 0,
Wii = 1,
@@ -104,12 +98,6 @@ struct ConfigEnumRange<FrameInterpMode> {
static constexpr auto max = FrameInterpMode::Unlimited;
};
template <>
struct ConfigEnumRange<TouchTargeting> {
static constexpr auto min = TouchTargeting::Hybrid;
static constexpr auto max = TouchTargeting::Switch;
};
template <>
struct ConfigEnumRange<MenuScaling> {
static constexpr auto min = MenuScaling::GameCube;
@@ -229,7 +217,6 @@ struct UserSettings {
ConfigVar<bool> invertMouseY;
ConfigVar<bool> freeCamera;
ConfigVar<bool> enableTouchControls;
ConfigVar<TouchTargeting> touchTargeting;
ConfigVar<bool> enableMenuPointer;
ConfigVar<ui::ControlLayout> touchControlsLayout;
ConfigVar<bool> invertCameraXAxis;
@@ -287,8 +274,12 @@ struct UserSettings {
struct {
ConfigVar<std::string> isoPath;
ConfigVar<DiscVerificationState> isoVerification;
#if DUSK_TPHD
ConfigVar<std::string> hdContentPath;
#endif
ConfigVar<std::string> graphicsBackend;
ConfigVar<bool> skipPreLaunchUI;
ConfigVar<bool> showPipelineCompilation;
ConfigVar<bool> wasPresetChosen;
ConfigVar<bool> checkForUpdates;
ConfigVar<int> cardFileType;
@@ -308,6 +299,9 @@ struct UserSettings {
UserSettings& getSettings();
std::filesystem::path tphd_content_path();
bool tphd_active();
void registerSettings();
// Transient settings
+1 -1
View File
@@ -36,7 +36,7 @@ typedef struct node_create_request {
/* 0x58 */ s16 name;
/* 0x5C */ void* data;
/* 0x60 */ s16 unk_0x60;
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x64 */ int unk_0x64;
/* 0x68 */ int unk_0x68;
#endif
+2 -2
View File
@@ -11,13 +11,13 @@ class mDoAud_zelAudio_c : public Z2AudioMgr {
public:
void reset();
mDoAud_zelAudio_c() {
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
setMode(2);
#endif
}
~mDoAud_zelAudio_c() {}
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
u8 getMode() { return field_0x13bd; }
void setMode(u8 mode) { field_0x13bd = mode; }
-5
View File
@@ -35,11 +35,6 @@ public:
/* 0x4 */ s8 mNo;
/* 0x5 */ u8 mCount;
#else
#if PARTIAL_DEBUG
// Initialized here since the DEBUG ctor doesn't run.
/* 0x4 */ s8 mNo = -1;
/* 0x5 */ u8 mCount = 0;
#endif
virtual ~mDoHIO_entry_c() {}
#endif
};
@@ -1761,6 +1761,16 @@ public:
virtual ~J3DIndBlockNull() {}
};
#ifdef DUSK_TPHD
struct PolygonOffset {
BE(f32) mFrontOffset;
BE(f32) mFrontScale;
BE(f32) mBackOffset;
BE(f32) mBackScale;
BE(f32) mClamp;
};
#endif
/**
* @ingroup jsystem-j3d
*
@@ -1793,6 +1803,10 @@ public:
virtual void setDither(u8 const*) {}
virtual void setDither(u8) {}
virtual u8 getDither() const { return 0; }
#ifdef DUSK_TPHD
virtual void setPolygonOffset(const PolygonOffset&) {}
virtual PolygonOffset* getPolygonOffset() { return NULL; }
#endif
virtual u32 getFogOffset() const { return 0; }
virtual void setFogOffset(u32) {}
virtual ~J3DPEBlock() {}
@@ -1956,12 +1970,25 @@ public:
virtual void setFogOffset(u32 fogOffset) { mFogOffset = fogOffset; }
virtual ~J3DPEBlockFull() {}
#ifdef DUSK_TPHD
virtual void setPolygonOffset(const PolygonOffset& offset) {
mPolygonOffset = offset;
}
virtual PolygonOffset* getPolygonOffset() {
return &mPolygonOffset;
}
#endif
/* 0x04 */ J3DFog mFog;
/* 0x30 */ J3DAlphaComp mAlphaComp;
/* 0x34 */ J3DBlend mBlend;
/* 0x38 */ J3DZMode mZMode;
/* 0x3A */ u8 mZCompLoc;
/* 0x3B */ u8 mDither;
#ifdef DUSK_TPHD
PolygonOffset mPolygonOffset;
#endif
/* 0x3C */ u32 mFogOffset;
}; // Size: 0x40
@@ -46,6 +46,13 @@ struct J3DMaterialInitData {
/* 0x14A */ BE(u16) mNBTScaleIdx;
}; // size 0x14C
#ifdef DUSK_TPHD
struct J3DMaterialInitData_MAT4 : public J3DMaterialInitData {
/* 0x14C */ BE(u16) mPolygonOffsetIdx;
}; // size 0x14E
#endif
/**
* @ingroup jsystem-j3d
*
@@ -143,10 +150,29 @@ public:
J3DNBTScale newNBTScale(int) const;
u16 getMaterialID(int idx) const { return mpMaterialID[idx]; }
#ifdef DUSK_TPHD
u8 getMaterialMode(int idx) const { return getMatInitData(idx)->mMaterialMode; }
#else
u8 getMaterialMode(int idx) const { return mpMaterialInitData[mpMaterialID[idx]].mMaterialMode; }
#endif
#if DUSK_TPHD
const PolygonOffset newPolygonOffset(int) const;
J3DMaterialInitData* getMatInitData(int idx) const {
static const u32 sInitDataSizes[] = {0, 0, 0x138, 0x14C, 0x14E};
return (J3DMaterialInitData*)((u8*)mpMaterialInitData + sInitDataSizes[mBlockType] * getMaterialID(idx));
}
u16 mBlockType;
#endif
/* 0x00 */ u16 mMaterialNum;
#if DUSK_TPHD
/* 0x04 */ void* mpMaterialInitData;
#else
/* 0x04 */ J3DMaterialInitData* mpMaterialInitData;
#endif
/* 0x08 */ BE(u16)* mpMaterialID;
/* 0x0C */ J3DIndInitData* mpIndInitData;
/* 0x10 */ GXColor* mpMatColor;
@@ -175,6 +201,9 @@ public:
/* 0x6C */ u8* mpZCompLoc;
/* 0x70 */ u8* mpDither;
/* 0x74 */ J3DNBTScaleInfo* mpNBTScaleInfo;
#ifdef DUSK_TPHD
PolygonOffset* mpPolygonOffsets;
#endif
/* 0x78 */ J3DDisplayListInit* mpDisplayListInit;
/* 0x7C */ J3DPatchingInfo* mpPatchingInfo;
/* 0x80 */ J3DCurrentMtxInfo* mpCurrentMtxInfo;
@@ -169,6 +169,12 @@ struct J3DMaterialBlock_v21 : public J3DModelBlock {
/* 0x74 */ OFFSET_PTR_V0 mpNBTScaleInfo;
};
#ifdef DUSK_TPHD
struct J3DMaterialBlock_MAT4 : public J3DMaterialBlock {
/* 0x84 */ OFFSET_PTR_V0 mpPolygonOffsets;
};
#endif
/**
* @ingroup jsystem-j3d
*
@@ -12,23 +12,12 @@ struct JORNodeEvent;
class JORMContext;
class JORServer;
// NOTE (stable game ABI): these classes stay non-polymorphic outside DEBUG
// on purpose. Making them polymorphic under PARTIAL_DEBUG would give every one of the ~250
// derived HIO classes a vptr and turn their plain `void genMessage(JORMContext*);`
// declarations into implicit virtual overrides whose definitions are #if DEBUG-gated; every
// instantiated one then fails to link (missing vtable). Closure types shared with DEBUG TUs
// either declare their own unconditional virtuals (vptr in all TUs anyway) or add a
// PARTIAL_DEBUG-only virtual dtor for vptr parity (see dAttParam_c).
class JOREventListener {
public:
#if DEBUG
JOREventListener() {}
#if TARGET_PC
virtual void listenPropertyEvent(const JORPropertyEvent*) {}
#else
virtual void listenPropertyEvent(const JORPropertyEvent*) = 0;
#endif
#endif
};
class JORReflexible : public JOREventListener {
@@ -41,11 +30,7 @@ public:
virtual void listenPropertyEvent(const JORPropertyEvent*);
virtual void listen(u32, const JOREvent*);
virtual void genObjectInfo(const JORGenEvent*);
#if TARGET_PC
virtual void genMessage(JORMContext*) {}
#else
virtual void genMessage(JORMContext*) = 0;
#endif
virtual void listenNodeEvent(const JORNodeEvent*);
#endif
};
@@ -314,7 +314,7 @@ public:
>
{
TIterator_data_(const TFunctionValue_list_parameter& rParent, const f32* value) {
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
pOwn_ = &rParent;
#endif
pf_ = value;
@@ -372,7 +372,7 @@ public:
return (r1.pf_ - r2.pf_) / suData_size;
}
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x00 */ const TFunctionValue_list_parameter* pOwn_;
#endif
/* 0x00 */ const f32* pf_;
@@ -425,7 +425,7 @@ public:
>
{
TIterator_data_(const TFunctionValue_hermite& rParent, const f32* value) {
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
pOwn_ = &rParent;
#endif
pf_ = value;
@@ -491,7 +491,7 @@ public:
return (r1.pf_ - r2.pf_) / r1.uSize_;
}
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
/* 0x00 */ const TFunctionValue_hermite* pOwn_;
/* 0x04 */ const f32* pf_;
/* 0x08 */ u32 uSize_;
@@ -7,6 +7,9 @@
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "JSystem/JMath/JMath.h"
#include "m_Do/m_Do_mtx.h"
#if TARGET_PC
#include "dusk/settings.h"
#endif
void J3DMtxCalcJ3DSysInitBasic::init(Vec const& scale, Mtx const& mtx) {
J3DSys::mCurrentS = scale;
@@ -178,7 +181,23 @@ void J3DJoint::entryIn() {
matPacket->setMaterialAnmID(mesh->getMaterialAnm());
matPacket->setShapePacket(shapePacket);
bool isDrawModeOpaTexEdge = mesh->isDrawModeOpaTexEdge() == FALSE;
#if TARGET_PC
// TP HD J3DJoint::entryIn (FUN_02b57690):
J3DDrawBuffer* drawBuffer = j3dSys.getDrawBuffer(isDrawModeOpaTexEdge);
u8 r24;
if (dusk::tphd_active() && (mesh->mMaterialID & 0x80000000) != 0 &&
(mesh->getMaterialMode() & 0x20) != 0 &&
drawBuffer->getSortMode() == J3DDrawBufSortMode_Mat)
{
matPacket->drawClear();
shapePacket->drawClear();
r24 = drawBuffer->entryImm(matPacket, 1);
} else {
r24 = matPacket->entry(drawBuffer);
}
#else
u8 r24 = matPacket->entry(j3dSys.getDrawBuffer(isDrawModeOpaTexEdge));
#endif
if (r24) {
j3dSys.setMatPacket(matPacket);
J3DDrawBuffer::entryNum++;
@@ -230,6 +230,13 @@ void J3DMatPacket::draw() {
#endif
packet->getShape()->loadPreDrawSetting();
#if DUSK_TPHD
{
const auto* offs = mpMaterial->getPEBlock()->getPolygonOffset();
GX2SetPolygonOffset(offs->mFrontOffset, offs->mFrontScale, offs->mBackOffset, offs->mBackScale, offs->mClamp);
}
#endif
while (packet != NULL) {
if (packet->getDisplayListObj() != NULL) {
packet->getDisplayListObj()->callDL();
@@ -12,6 +12,9 @@
#include "dusk/logging.h"
J3DMaterialFactory::J3DMaterialFactory(J3DMaterialBlock const& i_block) {
#ifdef DUSK_TPHD
mBlockType = (i_block.mBlockType & 0xFF) - 0x30; // get number at last byte of block name
#endif
mMaterialNum = i_block.mMaterialNum;
mpMaterialInitData = JSUConvertOffsetToPtr<J3DMaterialInitData>(&i_block, i_block.mpMaterialInitData);
mpMaterialID = JSUConvertOffsetToPtr<BE(u16)>(&i_block, i_block.mpMaterialID);
@@ -46,6 +49,11 @@ J3DMaterialFactory::J3DMaterialFactory(J3DMaterialBlock const& i_block) {
mpZCompLoc = JSUConvertOffsetToPtr<u8>(&i_block, i_block.mpZCompLoc);
mpDither = JSUConvertOffsetToPtr<u8>(&i_block, i_block.mpDither);
mpNBTScaleInfo = JSUConvertOffsetToPtr<J3DNBTScaleInfo>(&i_block, i_block.mpNBTScaleInfo);
#ifdef DUSK_TPHD
if(mBlockType >= 4) {
mpPolygonOffsets = JSUConvertOffsetToPtr<PolygonOffset>(&i_block, reinterpret_cast<const J3DMaterialBlock_MAT4&>(i_block).mpPolygonOffsets);
}
#endif
mpDisplayListInit = NULL;
mpPatchingInfo = NULL;
mpCurrentMtxInfo = NULL;
@@ -74,7 +82,11 @@ u16 J3DMaterialFactory::countUniqueMaterials() {
}
u32 J3DMaterialFactory::countTexGens(int i_idx) const {
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mTexGenNumIdx != 0xff) {
return mpTexGenNum[mtl_init_data->mTexGenNumIdx];
}
@@ -82,7 +94,11 @@ u32 J3DMaterialFactory::countTexGens(int i_idx) const {
}
u32 J3DMaterialFactory::countStages(int i_idx) const {
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
u32 count1 = 0;
u32 count2 = 0;
if (mtl_init_data->mTevStageNumIdx != 0xff) {
@@ -157,6 +173,9 @@ J3DMaterial* J3DMaterialFactory::createNormalMaterial(J3DMaterial* i_material, i
i_material->mPEBlock->setZMode(newZMode(i_idx));
i_material->mPEBlock->setZCompLoc(newZCompLoc(i_idx));
i_material->mPEBlock->setDither(newDither(i_idx));
#ifdef DUSK_TPHD
i_material->mPEBlock->setPolygonOffset(newPolygonOffset(i_idx));
#endif
i_material->mTevBlock->setTevStageNum(newTevStageNum(i_idx));
for (u8 i = 0; i < tex_num; i++) {
i_material->mTevBlock->setTexNo(i, newTexNo(i_idx, i));
@@ -165,7 +184,11 @@ J3DMaterial* J3DMaterialFactory::createNormalMaterial(J3DMaterial* i_material, i
i_material->mTevBlock->setTevOrder(i, newTevOrder(i_idx, i));
}
for (u8 i = 0; i < tev_stage_num_max; i++) {
#ifdef DUSK_TPHD
J3DMaterialInitData* material_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* material_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
i_material->mTevBlock->setTevStage(i, newTevStage(i_idx, i));
if (material_init_data->mTevSwapModeIdx[i] != 0xffff) {
i_material->mTevBlock->getTevStage(i)->setTexSel(
@@ -200,7 +223,11 @@ J3DMaterial* J3DMaterialFactory::createNormalMaterial(J3DMaterial* i_material, i
for (u8 i = 0; i < 8; i++) {
i_material->mTexGenBlock->setTexMtx(i, newTexMtx(i_idx, i));
}
J3DMaterialInitData* material_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#ifdef DUSK_TPHD
J3DMaterialInitData* material_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* material_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
for (u8 i = 0; i < tev_stage_num_max; i++) {
if (material_init_data->mTevKColorSel[i] != 0xff) {
i_material->mTevBlock->setTevKColorSel(i, material_init_data->mTevKColorSel[i]);
@@ -273,7 +300,11 @@ J3DMaterial* J3DMaterialFactory::createPatchedMaterial(J3DMaterial* i_material,
i_material->mTevBlock->setTevColor(i, newTevColor(i_idx, i));
}
for (u8 i = 0; i < tev_stage_num; i++) {
#ifdef DUSK_TPHD
J3DMaterialInitData* material_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* material_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
i_material->mTevBlock->setTevStage(i, newTevStage(i_idx, i));
if (material_init_data->mTevSwapModeIdx[i] != 0xffff) {
i_material->mTevBlock->getTevStage(i)->setTexSel(
@@ -282,7 +313,11 @@ J3DMaterial* J3DMaterialFactory::createPatchedMaterial(J3DMaterial* i_material,
mpTevSwapModeInfo[material_init_data->mTevSwapModeIdx[i]].mRasSel);
}
}
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#ifdef DUSK_TPHD
J3DMaterialInitData* init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
for (u8 i = 0; i < tev_stage_num; i++) {
if (init_data->mTevKColorSel[i] != 0xff) {
i_material->mTevBlock->setTevKColorSel(i, init_data->mTevKColorSel[i]);
@@ -423,7 +458,11 @@ u32 J3DMaterialFactory::calcSizeNormalMaterial(J3DMaterial* i_material, int i_id
size += J3DMaterial::calcSizeTevBlock((u16)tev_stage_num_max);
size += J3DMaterial::calcSizeIndBlock(ind_flag);
size += J3DMaterial::calcSizePEBlock(pe_flag, getMaterialMode(i_idx));
#ifdef DUSK_TPHD
J3DMaterialInitData* init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
for (u32 i = 0; i < 8; i++) {
if (init_data->mTexMtxIdx[i] != 0xffff) {
size += sizeof(J3DTexMtx);
@@ -444,7 +483,11 @@ u32 J3DMaterialFactory::calcSizePatchedMaterial(J3DMaterial* i_material, int i_i
size += sizeof(J3DTevBlockPatched);
size += J3DMaterial::calcSizeIndBlock(ind_flag);
size += J3DMaterial::calcSizePEBlock(0x10000000, getMaterialMode(i_idx));
#ifdef DUSK_TPHD
J3DMaterialInitData* init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
for (u32 i = 0; i < 8; i++) {
if (init_data->mTexMtxIdx[i] != 0xffff) {
size += sizeof(J3DTexMtx);
@@ -474,7 +517,11 @@ J3DGXColor J3DMaterialFactory::newMatColor(int i_idx, int i_no) const {
#else
J3DGXColor dflt = GXColor{0xff, 0xff, 0xff, 0xff};
#endif
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mMatColorIdx[i_no] != 0xffff) {
return (GXColor) mpMatColor[mtl_init_data->mMatColorIdx[i_no]];
} else {
@@ -483,7 +530,11 @@ J3DGXColor J3DMaterialFactory::newMatColor(int i_idx, int i_no) const {
}
const u8 J3DMaterialFactory::newColorChanNum(int i_idx) const {
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mColorChanNumIdx != 0xff) {
return mpColorChanNum[mtl_init_data->mColorChanNumIdx];
} else {
@@ -493,7 +544,11 @@ const u8 J3DMaterialFactory::newColorChanNum(int i_idx) const {
J3DColorChan J3DMaterialFactory::newColorChan(int i_idx, int i_no) const {
u32 r29 = 0;
#ifdef DUSK_TPHD
J3DMaterialInitData* init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (init_data->mColorChanIdx[i_no] != 0xffff) {
return J3DColorChan(mpColorChanInfo[init_data->mColorChanIdx[i_no]]);
} else {
@@ -507,7 +562,11 @@ J3DGXColor J3DMaterialFactory::newAmbColor(int i_idx, int i_no) const {
#else
J3DGXColor dflt = GXColor{0x32, 0x32, 0x32, 0x32};
#endif
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mAmbColorIdx[i_no] != 0xffff) {
return (GXColor) mpAmbColor[mtl_init_data->mAmbColorIdx[i_no]];
} else {
@@ -517,7 +576,11 @@ J3DGXColor J3DMaterialFactory::newAmbColor(int i_idx, int i_no) const {
u32 J3DMaterialFactory::newTexGenNum(int i_idx) const {
u32 r30 = 0;
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mTexGenNumIdx != 0xff) {
return mpTexGenNum[mtl_init_data->mTexGenNumIdx];
} else {
@@ -526,7 +589,11 @@ u32 J3DMaterialFactory::newTexGenNum(int i_idx) const {
}
J3DTexCoord J3DMaterialFactory::newTexCoord(int i_idx, int i_no) const {
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mTexCoordIdx[i_no] != 0xffff) {
return J3DTexCoord(mpTexCoordInfo[mtl_init_data->mTexCoordIdx[i_no]]);
} else {
@@ -536,7 +603,11 @@ J3DTexCoord J3DMaterialFactory::newTexCoord(int i_idx, int i_no) const {
J3DTexMtx* J3DMaterialFactory::newTexMtx(int i_idx, int i_no) const {
J3DTexMtx* tex_mtx = NULL;
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mTexMtxIdx[i_no] != 0xffff) {
#if TARGET_LITTLE_ENDIAN
auto tex_mtx_info = mpTexMtxInfo[mtl_init_data->mTexMtxIdx[i_no]];
@@ -558,7 +629,11 @@ J3DTexMtx* J3DMaterialFactory::newTexMtx(int i_idx, int i_no) const {
u8 J3DMaterialFactory::newCullMode(int i_idx) const {
u32 r30 = 0;
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mCullModeIdx != 0xff) {
return mpCullMode[mtl_init_data->mCullModeIdx];
} else {
@@ -567,7 +642,11 @@ u8 J3DMaterialFactory::newCullMode(int i_idx) const {
}
u16 J3DMaterialFactory::newTexNo(int i_idx, int i_no) const {
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mTexNoIdx[i_no] != 0xffff) {
return mpTexNo[mtl_init_data->mTexNoIdx[i_no]];
} else {
@@ -576,7 +655,11 @@ u16 J3DMaterialFactory::newTexNo(int i_idx, int i_no) const {
}
J3DTevOrder J3DMaterialFactory::newTevOrder(int i_idx, int i_no) const {
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mTevOrderIdx[i_no] != 0xffff) {
return J3DTevOrder(mpTevOrderInfo[mtl_init_data->mTevOrderIdx[i_no]]);
} else {
@@ -587,7 +670,11 @@ J3DTevOrder J3DMaterialFactory::newTevOrder(int i_idx, int i_no) const {
J3DGXColorS10 J3DMaterialFactory::newTevColor(int i_idx, int i_no) const {
GXColorS10 _dflt = {0, 0, 0, 0};
J3DGXColorS10 dflt = _dflt;
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mTevColorIdx[i_no] != 0xffff) {
return (GXColorS10) mpTevColor[mtl_init_data->mTevColorIdx[i_no]];
} else {
@@ -601,7 +688,11 @@ J3DGXColor J3DMaterialFactory::newTevKColor(int i_idx, int i_no) const {
#else
J3DGXColor dflt = GXColor{0xff, 0xff, 0xff, 0xff};
#endif
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mTevKColorIdx[i_no] != 0xffff) {
return (GXColor) mpTevKColor[mtl_init_data->mTevKColorIdx[i_no]];
} else {
@@ -610,7 +701,11 @@ J3DGXColor J3DMaterialFactory::newTevKColor(int i_idx, int i_no) const {
}
const u8 J3DMaterialFactory::newTevStageNum(int i_idx) const {
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mTevStageNumIdx != 0xff) {
return mpTevStageNum[mtl_init_data->mTevStageNumIdx];
} else {
@@ -619,7 +714,11 @@ const u8 J3DMaterialFactory::newTevStageNum(int i_idx) const {
}
J3DTevStage J3DMaterialFactory::newTevStage(int i_idx, int i_no) const {
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mTevStageIdx[i_no] != 0xffff) {
return J3DTevStage(mpTevStageInfo[mtl_init_data->mTevStageIdx[i_no]]);
} else {
@@ -628,7 +727,11 @@ J3DTevStage J3DMaterialFactory::newTevStage(int i_idx, int i_no) const {
}
J3DTevSwapModeTable J3DMaterialFactory::newTevSwapModeTable(int i_idx, int i_no) const {
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mTevSwapModeTableIdx[i_no] != 0xffff) {
return J3DTevSwapModeTable(mpTevSwapModeTableInfo[mtl_init_data->mTevSwapModeTableIdx[i_no]]);
} else {
@@ -689,7 +792,11 @@ J3DIndTexCoordScale J3DMaterialFactory::newIndTexCoordScale(int i_idx, int i_no)
J3DFog J3DMaterialFactory::newFog(int i_idx) const {
J3DFog fog;
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mFogIdx != 0xffff) {
#if TARGET_LITTLE_ENDIAN
J3DFogInfo fogInfo = mpFogInfo[mtl_init_data->mFogIdx];
@@ -709,7 +816,11 @@ J3DFog J3DMaterialFactory::newFog(int i_idx) const {
}
J3DAlphaComp J3DMaterialFactory::newAlphaComp(int i_idx) const {
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mAlphaCompIdx != 0xffff) {
return J3DAlphaComp(mpAlphaCompInfo[mtl_init_data->mAlphaCompIdx]);
} else {
@@ -718,7 +829,11 @@ J3DAlphaComp J3DMaterialFactory::newAlphaComp(int i_idx) const {
}
J3DBlend J3DMaterialFactory::newBlend(int i_idx) const {
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mBlendIdx != 0xffff) {
return J3DBlend(mpBlendInfo[mtl_init_data->mBlendIdx]);
} else {
@@ -728,7 +843,11 @@ J3DBlend J3DMaterialFactory::newBlend(int i_idx) const {
J3DZMode J3DMaterialFactory::newZMode(int i_idx) const {
u32 r29 = 0;
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mZModeIdx != 0xff) {
return J3DZMode(mpZModeInfo[mtl_init_data->mZModeIdx]);
} else {
@@ -737,7 +856,11 @@ J3DZMode J3DMaterialFactory::newZMode(int i_idx) const {
}
const u8 J3DMaterialFactory::newZCompLoc(int i_idx) const {
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mZCompLocIdx != 0xff){
return mpZCompLoc[mtl_init_data->mZCompLocIdx];
} else {
@@ -746,7 +869,11 @@ const u8 J3DMaterialFactory::newZCompLoc(int i_idx) const {
}
const u8 J3DMaterialFactory::newDither(int i_idx) const {
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mDitherIdx != 0xff){
return mpDither[mtl_init_data->mDitherIdx];
} else {
@@ -754,9 +881,24 @@ const u8 J3DMaterialFactory::newDither(int i_idx) const {
}
}
#ifdef DUSK_TPHD
const PolygonOffset J3DMaterialFactory::newPolygonOffset(int i_idx) const {
J3DMaterialInitData_MAT4* mtl_init_data = (J3DMaterialInitData_MAT4*)getMatInitData(i_idx);
if (mBlockType >= 4 && mtl_init_data->mPolygonOffsetIdx != 0xffff){
return mpPolygonOffsets[mtl_init_data->mPolygonOffsetIdx];
} else {
return PolygonOffset{0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
}
}
#endif
J3DNBTScale J3DMaterialFactory::newNBTScale(int i_idx) const {
J3DNBTScale dflt(j3dDefaultNBTScaleInfo);
#ifdef DUSK_TPHD
J3DMaterialInitData* mtl_init_data = getMatInitData(i_idx);
#else
J3DMaterialInitData* mtl_init_data = &mpMaterialInitData[mpMaterialID[i_idx]];
#endif
if (mtl_init_data->mNBTScaleIdx != 0xffff) {
return J3DNBTScale(mpNBTScaleInfo[mtl_init_data->mNBTScaleIdx]);
} else {
@@ -103,6 +103,9 @@ J3DModelData* J3DModelLoader::load(void const* i_data, u32 i_flags) {
readJoint((J3DJointBlock*)block);
break;
case 'MAT3':
#if DUSK_TPHD
case 'MAT4':
#endif
readMaterial((J3DMaterialBlock*)block, (s32)i_flags);
break;
case 'MAT2':
@@ -147,6 +150,9 @@ J3DMaterialTable* J3DModelLoader::loadMaterialTable(void const* i_data) {
for (u32 block_no = 0; block_no < data->mBlockNum; block_no++) {
switch (block->mBlockType) {
case 'MAT3':
#if DUSK_TPHD
case 'MAT4':
#endif
readMaterialTable((J3DMaterialBlock*)block, flags);
break;
case 'MAT2':
@@ -212,6 +218,9 @@ J3DModelData* J3DModelLoader::loadBinaryDisplayList(void const* i_data, u32 i_fl
modifyMaterial(i_flags);
break;
case 'MAT3':
#if DUSK_TPHD
case 'MAT4':
#endif
flags = 0x50100000;
flags |= (i_flags & 0x3000000);
mpMaterialBlock = (J3DMaterialBlock*)block;
@@ -308,8 +317,22 @@ static GXVtxAttrFmtList getFmt(GXVtxAttrFmtList* i_fmtList, GXAttr i_attr) {
return *i_fmtList;
}
}
#if DUSK_TPHD
// HD BMDs occasionally have vertex arrays without a format entry. Mirror
// the GC runtime: fall back to J3DSys::initGX defaults.
GXVtxAttrFmtList def{};
def.attr = i_attr;
def.frac = 0;
if (i_attr == GX_VA_POS) { def.cnt = GX_POS_XYZ; def.type = GX_F32; }
else if (i_attr == GX_VA_NRM) { def.cnt = GX_NRM_XYZ; def.type = GX_F32; }
else if (i_attr == GX_VA_NBT) { def.cnt = GX_NRM_NBT; def.type = GX_F32; }
else if (i_attr >= GX_VA_CLR0 &&
i_attr <= GX_VA_CLR1) { def.cnt = GX_CLR_RGBA; def.type = GX_RGBA8; }
else { def.cnt = GX_TEX_ST; def.type = GX_F32; }
return def;
#else
OSPanic(__FILE__, __LINE__, "Unable to find vertex attribute format!");
#endif
}
#endif
@@ -16,7 +16,7 @@ u16 J3DModelLoader::countMaterialNum(const void* stream) {
const J3DModelBlock* block = header->mBlocks;
for (int i = 0; i < header->mBlockNum; i++)
{
if (block->mBlockType == 'MAT3') {
if (block->mBlockType == 'MAT3' || block->mBlockType == 'MAT4') {
const J3DMaterialBlock* materialBlock = (const J3DMaterialBlock*)block;
return materialBlock->mMaterialNum;
}
@@ -45,6 +45,7 @@ u32 J3DModelLoader::calcLoadSize(void const* stream, u32 flags_) {
size += calcSizeJoint((const J3DJointBlock*)nextBlock);
break;
case 'MAT3':
case 'MAT4':
size += calcSizeMaterial((const J3DMaterialBlock*)nextBlock, flags);
break;
case 'SHP1':
@@ -86,6 +87,7 @@ u32 J3DModelLoader::calcLoadMaterialTableSize(const void* stream) {
for (u32 i = 0; i < header->mBlockNum; i++) {
switch (nextBlock->mBlockType) {
case 'MAT3':
case 'MAT4':
size += calcSizeMaterialTable((const J3DMaterialBlock*)nextBlock, flags);
break;
case 'TEX1':
@@ -135,7 +137,8 @@ u32 J3DModelLoader::calcLoadBinaryDisplayListSize(const void* stream, u32 flags)
case 'MDL3':
size += calcSizeMaterialDL((const J3DMaterialDLBlock*)nextBlock, flags);
break;
case 'MAT3': {
case 'MAT3':
case 'MAT4': {
u32 flags2 = (J3DMLF_21 | J3DMLF_Material_PE_Full | J3DMLF_Material_Color_LightOn);
flags2 |= (u32)flags & (J3DMLF_Material_UseIndirect | J3DMLF_26);
mpMaterialBlock = (const J3DMaterialBlock*)nextBlock;
@@ -9,6 +9,24 @@
#include "JSystem/JKernel/JKRMemArchive.h"
#include "JSystem/JUtility/JUTAssert.h"
#if DUSK_TPHD
#include "dusk/tphd/HdAssetLayer.hpp"
namespace {
void register_copied_hd_resource(
JKRArchive* archive, JKRArchive::SDIFileEntry* fileEntry, void* buffer, u32 resourceSize) {
if (archive == NULL || fileEntry == NULL || buffer == NULL || resourceSize == 0 ||
archive->mStringTable == NULL)
{
return;
}
dusk::tphd::register_copied_hd_resource(archive->mEntryNum,
archive->mStringTable + fileEntry->getNameOffset(), buffer, resourceSize);
}
} // namespace
#endif
JKRArchive* JKRArchive::check_mount_already(s32 entryNum, JKRHeap* heap) {
if (heap == NULL) {
heap = JKRGetCurrentHeap();
@@ -196,6 +214,9 @@ u32 JKRArchive::readResource(void* buffer, u32 bufferSize, u32 type, const char*
if (fileEntry) {
u32 resourceSize;
fetchResource(buffer, bufferSize, fileEntry, &resourceSize);
#if DUSK_TPHD
register_copied_hd_resource(this, fileEntry, buffer, resourceSize);
#endif
return resourceSize;
}
@@ -214,6 +235,9 @@ u32 JKRArchive::readResource(void* buffer, u32 bufferSize, const char* path) {
if (fileEntry) {
u32 resourceSize;
fetchResource(buffer, bufferSize, fileEntry, &resourceSize);
#if DUSK_TPHD
register_copied_hd_resource(this, fileEntry, buffer, resourceSize);
#endif
return resourceSize;
}
@@ -226,6 +250,9 @@ u32 JKRArchive::readIdxResource(void* buffer, u32 bufferSize, u32 index) {
if (fileEntry) {
u32 resourceSize;
fetchResource(buffer, bufferSize, fileEntry, &resourceSize);
#if DUSK_TPHD
register_copied_hd_resource(this, fileEntry, buffer, resourceSize);
#endif
return resourceSize;
}
@@ -238,6 +265,9 @@ u32 JKRArchive::readResource(void* buffer, u32 bufferSize, u16 id) {
if (fileEntry) {
u32 resourceSize;
fetchResource(buffer, bufferSize, fileEntry, &resourceSize);
#if DUSK_TPHD
register_copied_hd_resource(this, fileEntry, buffer, resourceSize);
#endif
return resourceSize;
}
@@ -10,6 +10,10 @@
#include <stdint.h>
#include "os_report.h"
#if DUSK_TPHD
#include "dusk/tphd/HdAssetLayer.hpp"
#endif
JKRMemArchive::JKRMemArchive(s32 entryNum, JKRArchive::EMountDirection mountDirection)
: JKRArchive(entryNum, MOUNT_MEM) {
mIsMounted = false;
@@ -67,8 +71,13 @@ bool JKRMemArchive::open(s32 entryNum, JKRArchive::EMountDirection mountDirectio
mIsOpen = false;
mMountDirection = mountDirection;
#ifdef TARGET_PC
u32 loadedSize = 0;
#endif
if (mMountDirection == JKRArchive::MOUNT_DIRECTION_HEAD) {
#ifndef TARGET_PC
u32 loadedSize;
#endif
mArcHeader = (SArcHeader *)JKRDvdToMainRam(
entryNum, NULL, EXPAND_SWITCH_UNKNOWN1, 0, mHeap, JKRDvdRipper::ALLOC_DIRECTION_FORWARD,
0, (int *)&mCompression, &loadedSize);
@@ -77,7 +86,9 @@ bool JKRMemArchive::open(s32 entryNum, JKRArchive::EMountDirection mountDirectio
}
}
else {
#ifndef TARGET_PC
u32 loadedSize;
#endif
mArcHeader = (SArcHeader *)JKRDvdToMainRam(
entryNum, NULL, EXPAND_SWITCH_UNKNOWN1, 0, mHeap,
JKRDvdRipper::ALLOC_DIRECTION_BACKWARD, 0, (int *)&mCompression, &loadedSize);
@@ -90,6 +101,9 @@ bool JKRMemArchive::open(s32 entryNum, JKRArchive::EMountDirection mountDirectio
mMountMode = UNKNOWN_MOUNT_MODE;
}
else {
#if DUSK_TPHD
dusk::tphd::register_mounted_hd_archive(entryNum, mArcHeader, loadedSize);
#endif
JUT_ASSERT(438, mArcHeader->signature == 'RARC');
mArcInfoBlock = (SArcDataInfo *)((u8 *)mArcHeader + mArcHeader->header_length);
mNodes = (SDIDirEntry *)((u8 *)&mArcInfoBlock->num_nodes + mArcInfoBlock->node_offset);
+2 -52
View File
@@ -21,7 +21,6 @@ body {
}
fps,
pipeline-progress,
toast {
position: absolute;
border: 1dp #92875B;
@@ -99,7 +98,7 @@ toast message row.muted {
opacity: 0.5;
}
progress {
toast progress {
height: 4dp;
position: absolute;
left: 0;
@@ -107,50 +106,10 @@ progress {
width: 100%;
}
progress fill {
toast progress fill {
background-color: rgba(194, 164, 45, 80%);
}
pipeline-progress {
left: 12dp;
bottom: 12dp;
display: flex;
flex-flow: column;
z-index: 100;
min-width: 260dp;
max-width: 90%;
padding: 10dp 16dp 12dp;
border-radius: 7dp;
overflow: hidden;
filter: opacity(0);
transition: filter 0.2s linear-in-out;
pointer-events: none;
}
pipeline-progress[open] {
filter: opacity(1);
}
pipeline-status {
display: flex;
align-items: center;
gap: 8dp;
font-size: 18dp;
font-weight: normal;
white-space: nowrap;
}
icon.pipeline-spinner {
width: 1.2em;
height: 1.2em;
line-height: 1.2em;
font-size: 1.2em;
color: #C2A42D;
text-align: center;
transform-origin: center;
animation: 1s linear infinite pipeline-spinner-spin;
}
toast.achievement {
border: 1dp #C2A42D;
}
@@ -351,15 +310,6 @@ logo img.outer {
}
}
@keyframes pipeline-spinner-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
@media (max-height: 640dp) {
toast {
top: 20dp;
+3
View File
@@ -15,6 +15,9 @@ static const char* sSpotName[] = {
"D_MN08A", "D_MN08D", "D_MN09", "D_MN09A", "D_MN09B", "D_MN09C", "D_SB00", "D_SB01",
"D_SB02", "D_SB03", "D_SB04", "D_SB05", "D_SB06", "D_SB07", "D_SB08", "D_SB09",
"D_SB10",
#if TARGET_PC
"D_SB11",
#endif
};
#endif /* SPOTNAME_H */
+23 -1
View File
@@ -1603,13 +1603,35 @@ void Z2SceneMgr::setSceneName(char* spot, s32 room, s32 layer) {
bgm_wave1 = 0x45;
}
break;
#if TARGET_PC
case Z2SCENE_CAVE_OF_SHADOWS:
if (room == 29) {
se_wave2 = 0x16;
} else if (room == 40) {
se_wave2 = 0x12;
} else {
se_wave2 = 0x36;
}
bgm_wave1 = 0x45;
se_wave1 = 0x51;
mDoAud_zelAudio_c::onBgmSet();
bgm_id = Z2BGM_SUB_DUNGEON;
if (BGM_ID == Z2BGM_SUB_DUNGEON) {
if (sceneNum == Z2SCENE_CAVE_OF_ORDEALS) {
BGM_ID = -1;
}
}
break;
#endif
}
/*dSv_event_flag_c::M_071 - Cutscene - [cutscene: 20] Zant appears (during Midna's desperate hour) */
if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[104])
/* dSv_event_flag_c::F_0250 - Cutscene - [cutscene: 21] reunion with Zelda / Midna revived (Hyrule Castle barrier appears) */
&& !dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[250])
&& demo_wave == 0 && spotNo != Z2SCENE_ELDIN_BRIDGE_BATTLE)
&& demo_wave == 0 && spotNo != Z2SCENE_ELDIN_BRIDGE_BATTLE IF_DUSK(&& spotNo != Z2SCENE_CAVE_OF_SHADOWS))
{
bgm_wave1 = 0x36;
if (spotNo == Z2SCENE_CASTLE_TOWN_SHOPS && room == 5) {
+6
View File
@@ -583,6 +583,12 @@ void Z2SeqMgr::bgmStreamPlay() {
}
}
#if TARGET_PC
if (dusk::tphd_active()) {
return;
}
#endif
#if !PLATFORM_SHIELD
else if (getStreamBgmID() == 0x2000000) {
if (mStreamBgmHandle) {
+1 -1
View File
@@ -22,7 +22,7 @@
#include "os_report.h"
Z2SoundObjBase::Z2SoundObjBase()
#if PARTIAL_DEBUG || DEBUG
#if DEBUG
: JSULink<Z2SoundObjBase>(this)
#endif
{
+33 -31
View File
@@ -5,51 +5,53 @@
#include "d/dolzel.h" // IWYU pragma: keep
#include "d/actor/d_a_alink.h"
#include "JSystem/J2DGraph/J2DAnmLoader.h"
#include "JSystem/J3DGraphBase/J3DDrawBuffer.h"
#include "JSystem/J3DGraphBase/J3DMaterial.h"
#include "JSystem/J3DGraphLoader/J3DAnmLoader.h"
#include "JSystem/J3DGraphBase/J3DDrawBuffer.h"
#include "JSystem/JHostIO/JORServer.h"
#include "JSystem/JKernel/JKRExpHeap.h"
#include "SSystem/SComponent/c_math.h"
#include "d/d_item.h"
#include "d/d_meter2_draw.h"
#include "d/d_pane_class.h"
#include "d/d_demo.h"
#include "d/actor/d_a_alink.h"
#include "d/actor/d_a_b_mgn.h"
#include "d/actor/d_a_canoe.h"
#include "d/actor/d_a_cow.h"
#include "d/actor/d_a_crod.h"
#include "d/actor/d_a_horse.h"
#include "d/actor/d_a_kytag05.h"
#include "d/actor/d_a_mg_rod.h"
#include "d/actor/d_a_midna.h"
#include "d/actor/d_a_mirror.h"
#include "d/actor/d_a_spinner.h"
#include "d/actor/d_a_tbox.h"
#include "d/actor/d_a_tag_Lv6Gate.h"
#include "d/actor/d_a_tag_kmsg.h"
#include "d/actor/d_a_tag_magne.h"
#include "d/actor/d_a_tag_wljump.h"
#include "d/actor/d_a_npc_tk.h"
#include "d/actor/d_a_cow.h"
#include "d/actor/d_a_obj_crope.h"
#include "d/actor/d_a_obj_wchain.h"
#include "d/actor/d_a_tag_hstop.h"
#include "d/actor/d_a_scene_exit.h"
#include "d/actor/d_a_tag_mhint.h"
#include "d/actor/d_a_tag_mmsg.h"
#include "d/actor/d_a_tag_lantern.h"
#include "d/actor/d_a_horse.h"
#include "m_Do/m_Do_controller_pad.h"
#include "d/d_bomb.h"
#include "d/d_meter2_info.h"
#include "d/actor/d_a_kytag05.h"
#include "d/actor/d_a_b_mgn.h"
#include "d/actor/d_a_ni.h"
#include "d/actor/d_a_npc_bou.h"
#include "d/actor/d_a_npc_kolin.h"
#include "f_op/f_op_kankyo_mng.h"
#include "d/actor/d_a_npc_tk.h"
#include "d/actor/d_a_obj_crope.h"
#include "d/actor/d_a_obj_wchain.h"
#include "d/actor/d_a_scene_exit.h"
#include "d/actor/d_a_spinner.h"
#include "d/actor/d_a_tag_Lv6Gate.h"
#include "d/actor/d_a_tag_hstop.h"
#include "d/actor/d_a_tag_kmsg.h"
#include "d/actor/d_a_tag_lantern.h"
#include "d/actor/d_a_tag_magne.h"
#include "d/actor/d_a_tag_mhint.h"
#include "d/actor/d_a_tag_mmsg.h"
#include "d/actor/d_a_tag_mstop.h"
#include "d/actor/d_a_tag_mwait.h"
#include "d/actor/d_a_canoe.h"
#include "d/actor/d_a_ni.h"
#include "d/actor/d_a_tag_wljump.h"
#include "d/actor/d_a_tbox.h"
#include "d/d_bomb.h"
#include "d/d_demo.h"
#include "d/d_item.h"
#include "d/d_meter2_draw.h"
#include "d/d_meter2_info.h"
#include "d/d_pane_class.h"
#include "d/d_s_play.h"
#include "dusk/tphd/LosTable.hpp"
#include "dusk/tphd/TphdPack.hpp"
#include "f_op/f_op_kankyo_mng.h"
#include "m_Do/m_Do_controller_pad.h"
#if TARGET_PC
#include "dusk/action_bindings.h"
@@ -17452,7 +17454,7 @@ int daAlink_c::procCoMetamorphoseInit() {
mProcVar2.field_0x300c = shape_angle.x;
daMidna_c* midna = (daMidna_c*)getMidnaActor();
if (checkMidnaRide() && daMidna_c::checkMidnaRealBody() && midna->checkDemoTypeNone())
if (checkMidnaRide() && (daMidna_c::checkMidnaRealBody() IF_DUSK(|| dusk::tphd::is_los_active())) && midna->checkDemoTypeNone())
{
midna->changeOriginalDemo();
midna->changeDemoMode(daPy_demo_c::DEMO_UNK_15_e);
+6
View File
@@ -737,6 +737,12 @@ void daAlink_c::setDemoData() {
} else {
mDemo.setStick(1.0f);
}
#if TARGET_PC
if (dusk::tphd::is_los_active() && mLosStickValue > 0.0f) {
mDemo.setStick(mLosStickValue);
}
#endif
}
if ((demo_mode == daPy_demo_c::DEMO_UNK_2_e || demo_mode == daPy_demo_c::DEMO_UNK_3_e) && prm1_p != NULL && *prm1_p == 1) {
+6
View File
@@ -3,6 +3,7 @@
#include "d/d_meter2.h"
#include "d/d_meter2_draw.h"
#include "d/d_meter2_info.h"
#include "dusk/tphd/LosTable.hpp"
void daAlink_c::handleWolfHowl() {
if (checkWolf()) {
@@ -71,6 +72,11 @@ void daAlink_c::handleQuickTransform() {
return;
}
if (dusk::tphd::is_los_active() && !dusk::getSettings().game.canTransformAnywhere) {
Z2GetAudioMgr()->seStart(Z2SE_SYS_ERROR, NULL, 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0);
return;
}
// Check to see if Link has the ability to transform.
if (!dComIfGs_isEventBit(dSv_event_flag_c::M_077)) {
return;
+17 -6
View File
@@ -122,11 +122,18 @@ BOOL daAlink_c::setBodyAngleToCamera() {
var_f31 /= dComIfGp_getCameraZoomScale(field_0x317c);
}
shape_angle.y = shape_angle.y + (var_f31 * cM_ssin(mStickAngle) IF_DUSK(* (dusk::getSettings().game.invertFirstPersonXAxis ? -1.0f : 1.0f)));
sp8 = mBodyAngle.x + (var_f31 * cM_scos(mStickAngle) IF_DUSK(* (dusk::getSettings().game.invertFirstPersonYAxis ? -1.0f : 1.0f)));
if (checkNotItemSinkLimit() && sp8 > 0 && sp8 > mBodyAngle.x) {
#if TARGET_PC
if (dusk::getSettings().game.enableMouseAim && checkAimInputContext()) {
sp8 = mBodyAngle.x;
} else
#endif
{
shape_angle.y = shape_angle.y + (var_f31 * cM_ssin(mStickAngle) IF_DUSK(* (dusk::getSettings().game.invertFirstPersonXAxis ? -1.0f : 1.0f)));
sp8 = mBodyAngle.x + (var_f31 * cM_scos(mStickAngle) IF_DUSK(* (dusk::getSettings().game.invertFirstPersonYAxis ? -1.0f : 1.0f)));
if (checkNotItemSinkLimit() && sp8 > 0 && sp8 > mBodyAngle.x) {
sp8 = mBodyAngle.x;
}
}
} else {
sp8 = mBodyAngle.x;
@@ -149,7 +156,7 @@ BOOL daAlink_c::setBodyAngleToCamera() {
f32 final_yaw = 0.f;
f32 final_pitch = 0.f;
if (dusk::getSettings().game.enableMouseAim) {
dusk::mouse::get_aim_deltas(final_yaw, final_pitch);
dusk::mouse::getAimDeltas(final_yaw, final_pitch);
}
if (dusk::getSettings().game.enableGyroAim) {
f32 gyro_yaw = 0.f;
@@ -445,4 +452,8 @@ daAlink_c::daAlink_c()
mFaceBtkHeap(0x400),
mFaceBckHeap(0xC00),
mAnmHeap9(0x800)
{}
{
#if TARGET_PC
mLosStickValue = -1.0f;
#endif
}
+11
View File
@@ -85,6 +85,17 @@ int daAlink_c::loadModelDVD() {
}
cPhs_Reset(&mPhaseReq);
mpArcHeap->freeAll();
#if TARGET_PC
field_0x06d0 = NULL;
field_0x06d4 = NULL;
field_0x06d8 = NULL;
field_0x06dc = NULL;
field_0x06e0 = NULL;
field_0x06e4 = NULL;
field_0x06e8 = NULL;
field_0x06ec = NULL;
field_0x06f0 = NULL;
#endif
if (mProcID == PROC_METAMORPHOSE || mProcID == PROC_METAMORPHOSE_ONLY) {
setArcName(!checkWolf());
+62 -2
View File
@@ -13,6 +13,7 @@
#include "d/d_bg_parts.h"
#include "m_Do/m_Do_lib.h"
#include "d/d_demo.h"
#include "dusk/tphd/LosTable.hpp"
#include "JSystem/JKernel/JKRExpHeap.h"
#include "JSystem/JKernel/JKRSolidHeap.h"
#include "JSystem/J3DGraphAnimator/J3DMaterialAnm.h"
@@ -297,6 +298,25 @@ int daBg_c::draw() {
dComIfGd_setListBG();
mDoLib_clipper::changeFar(1000000.0f);
#if TARGET_PC
bool losClip = false;
Mtx losBgMtx;
if (dusk::tphd_active()) {
// TPHD Cave of Shadows rooms have a base matrix far from identity; it gets the room translation from 'los.bin'
// HD daBg::draw clips the shape bbox in world space, so recompute the room base matrix to transform it.
if (strcmp(dComIfGp_getStartStageName(), "D_SB11") == 0) {
f32 hx, hy, hz;
s16 ha;
if (dusk::tphd::los_get_room_trans(roomNo, &hx, &hy, &hz, &ha)) {
mDoMtx_stack_c::transS(hx, hy, hz);
mDoMtx_stack_c::YrotM(ha);
mDoMtx_copy(mDoMtx_stack_c::get(), losBgMtx);
losClip = true;
}
}
}
#endif
J3DModelData* modelData;
for (int i = 0; i < 6; i++) {
sp8 = 0;
@@ -325,8 +345,22 @@ int daBg_c::draw() {
for (u16 j = 0; j < modelData->getShapeNum(); j++) {
J3DShape* shape = modelData->getShapeNodePointer(j);
if (mDoLib_clipper::clip(j3dSys.getViewMtx(), (Vec*)shape->getMin(),
(Vec*)shape->getMax())) {
Vec* clipMin = (Vec*)shape->getMin();
Vec* clipMax = (Vec*)shape->getMax();
#if TARGET_PC
if (dusk::tphd_active()) {
Vec losClipMin, losClipMax;
if (losClip) {
// HD transforms the bbox min/max by the room base matrix; clip rebuilds
// the 8 corners (exact for the room angles, which are multiples of 90).
mDoMtx_multVec(losBgMtx, clipMin, &losClipMin);
mDoMtx_multVec(losBgMtx, clipMax, &losClipMax);
clipMin = &losClipMin;
clipMax = &losClipMax;
}
}
#endif
if (mDoLib_clipper::clip(j3dSys.getViewMtx(), clipMin, clipMax)) {
shape->hide();
} else {
shape->show();
@@ -565,17 +599,43 @@ int daBg_c::create() {
}
J3DModelData* modelData;
#if TARGET_PC
f32 transX = 0.0f;
f32 transY = 0.0f;
f32 transVert = 0.0f;
s16 angle = 0;
bool foundMapTrans = false;
if (dusk::tphd_active()) {
// TPHD positions Cave of Shadows rooms via los.bin (per-room world X/Y/Z +
// Y-rotation, incl. the vertical Y that GC's MULT lacks). Retail gates
// this on g_dComIfG_gameInfo.field_0x1e448; los.bin only carries
// D_SB11's room data, so restrict it to that stage and fall back to MULT.
if (strcmp(dComIfGp_getStartStageName(), "D_SB11") == 0) {
foundMapTrans = dusk::tphd::los_get_room_trans(roomNo, &transX, &transVert, &transY, &angle);
}
}
if (!foundMapTrans)
foundMapTrans = dComIfGp_getMapTrans(roomNo, &transX, &transY, &angle);
if (foundMapTrans) {
#else
f32 transX;
f32 transY;
s16 angle;
if (dComIfGp_getMapTrans(roomNo, &transX, &transY, &angle)) {
#endif
daBg_Part* bgPart = mBgParts;
J3DModel* model;
for (int i = 0; i < 6; i++) {
model = bgPart->model;
if (model != NULL) {
#if TARGET_PC
mDoMtx_stack_c::transS(transX, transVert, transY);
#else
mDoMtx_stack_c::transS(transX, 0.0f, transY);
#endif
mDoMtx_stack_c::YrotM(angle);
model->setBaseTRMtx(mDoMtx_stack_c::get());
+12
View File
@@ -144,7 +144,11 @@ bool daBgObj_c::spec_data_c::Set(void* i_ptr) {
default:
// Invalid data block type
OS_REPORT_ERROR("データブロックタイプが不正です<%d>\n", block_type);
#if DUSK_TPHD
return 0; // HD-port: skip actor instead of asserting.
#else
JUT_ASSERT(527, FALSE);
#endif
}
if (block_type == 0) {
@@ -185,7 +189,11 @@ bool daBgObj_c::spec_data_c::Set(void* i_ptr) {
default:
// Invalid data block type
OS_REPORT_ERROR("データブロックタイプが不正です<%d>\n", block_type);
#if DUSK_TPHD
return 0;
#else
JUT_ASSERT(570, FALSE);
#endif
}
if (block_type == 0) {
@@ -226,8 +234,12 @@ bool daBgObj_c::spec_data_c::Set(void* i_ptr) {
default:
// "Data Block type invalid<%d>\n"
OSReport_Error("データブロックタイプが不正です<%d>\n", block_type);
#if DUSK_TPHD
return 0;
#else
JUT_ASSERT(619, FALSE);
break;
#endif
}
if (block_type == 0) {
+4 -1
View File
@@ -403,7 +403,10 @@ void e_ai_class::e_ai_damage() {
if (m_timers[1] == 0) {
m_sound.startCreatureSound(Z2SE_EN_AI_FLASH, 0, -1);
mpEmitter = dComIfGp_particle_set(0x81ED, &current.pos, &tevStr, &shape_angle, NULL);
mpEmitter->becomeImmortalEmitter();
if (mpEmitter != NULL) {
mpEmitter->becomeImmortalEmitter();
}
m_timers[1] = 1000;
m_timers[2] = 56;
}
+11 -2
View File
@@ -13,6 +13,9 @@
#include "Z2AudioLib/Z2Instances.h"
#include <cstring>
#include "dusk/tphd/LosTable.hpp"
#include "dusk/tphd/TphdPack.hpp"
enum E_ww_RES_File_ID {
/* BCK */
/* 0x04 */ BCK_WW_APPEAR = 0x4,
@@ -466,7 +469,7 @@ f32 daE_WW_c::checkCreateBg(cXyz i_vector) {
return -G_CM3D_F_INF;
}
if (dComIfG_Bgsp().GetSpecialCode(gnd_chk) == 5 || dComIfG_Bgsp().GetPolyAtt0(gnd_chk) == 0xD) {
if (dComIfG_Bgsp().GetSpecialCode(gnd_chk) == 5 || dComIfG_Bgsp().GetPolyAtt0(gnd_chk) == 0xD IF_DUSK(|| dusk::tphd::is_los_active())) {
cXyz temp_r1 = daPy_getPlayerActorClass()->current.pos;
temp_r1.y += 100.0f;
sp14 = i_vector;
@@ -666,8 +669,14 @@ void daE_WW_c::executeMaster() {
sp30.set(0.0f, 0.0f, 3000.0f);
}
#if TARGET_PC
if (dusk::tphd::is_los_active()) {
sp30.z = 600.0f;
}
#endif
cLib_offsetPos(&sp3C, &sp48, fopCamM_GetAngleY(camera), &sp30);
if (current.pos.abs(sp3C) < field_0x6a8) {
if ((current.pos.abs(sp3C) < field_0x6a8) IF_DUSK(|| (dusk::tphd::is_los_active() && current.pos.y - sp48.y < field_0x6a8))) {
f32 temp_f31 = checkCreateBg(sp3C);
if (-G_CM3D_F_INF != temp_f31) {
sp3C.y = temp_f31;
+14
View File
@@ -10,6 +10,7 @@
#include "d/actor/d_a_player.h"
#include "d/d_com_inf_game.h"
#include <cstring>
#include <dusk/ui/settings.hpp>
static int daKytag04_Draw(kytag04_class* i_this) {
dScnKy_env_light_c* kankyo = dKy_getEnvlight();
@@ -260,12 +261,25 @@ static int daKytag04_Create(fopAc_ac_c* i_this) {
a_this->mNeedDropNum = i_this->current.angle.z & 0xFF;
#if TARGET_PC
if (dusk::tphd_active()) {
a_this->mNeedDropNum = 12;
}
#endif
int phase_state = dComIfG_resLoad(&a_this->mPhase, "Kytag04");
if (phase_state == cPhs_COMPLEATE_e) {
a_this->field_0x5b4 = (fopAcM_GetParam(i_this) >> 8) & 7;
a_this->mStageNo = (i_this->current.angle.z >> 8) & 0xFF;
a_this->mExitID = fopAcM_GetParam(i_this) & 0xFF;
a_this->mNeedDropNum = i_this->current.angle.z & 0xFF;
#if TARGET_PC
if (dusk::tphd_active()) {
a_this->mNeedDropNum = 12;
}
#endif
a_this->field_0x5b5 = fopAcM_GetParam(i_this) >> 0x10;
a_this->field_0x5b6 = fopAcM_GetParam(i_this) >> 0x18;
+1
View File
@@ -64,6 +64,7 @@ static dPath* get_Extent_pos_end_get(kytag10_class* i_this, dPath* i_path, cXyz*
}
static void sparks_move(kytag10_class* i_this) {
camera_process_class* camera_p = dComIfGp_getCamera(0);
cXyz ratio_pos_1;
+3 -22
View File
@@ -11,7 +11,6 @@
#include "d/d_com_inf_game.h"
#if TARGET_PC
#include <aurora/texture.hpp>
#include "dusk/dvd_asset.hpp"
#include "dusk/frame_interpolation.h"
@@ -41,8 +40,6 @@ static f32* l_texCoord_get() { alignas(32) static f32 buf[338]; static bool _
//#define l_pos (l_pos_get())
#define l_normal (l_normal_get())
#define l_texCoord (l_texCoord_get())
static bool l_Egnd_mantTEX_hasReplacement = false;
#else
#include "assets/l_Egnd_mantTEX.h"
@@ -226,7 +223,6 @@ void daMant_packet_c::draw() {
GXInitTexObjCI(
&undersideTexObj, l_Egnd_mantTEX_U, 0x80, 0x80, GX_TF_C8, GX_CLAMP, GX_CLAMP, 0, 0);
GXInitTexObjLOD(&undersideTexObj, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
l_Egnd_mantTEX_hasReplacement = aurora::texture::has_replacement(&mainTexObj, &tlutObj);
textureObjsInitialized = true;
}
#else
@@ -640,11 +636,7 @@ static int daMant_Execute(mant_class* i_this) {
iVar8 = 0;
if (i_this->field_0x3967 != 0) {
#if TARGET_PC
mant_cut_type = l_Egnd_mantTEX_hasReplacement ? 1 : i_this->field_0x3967;
#else
mant_cut_type = i_this->field_0x3967;
#endif
if (i_this->field_0x3968 < 15) {
i_this->field_0x3968++;
@@ -656,18 +648,9 @@ static int daMant_Execute(mant_class* i_this) {
iVar8 = 20;
}
#if TARGET_PC
if (l_Egnd_mantTEX_hasReplacement) {
unaff_r29 = i_this->mMantRng.getF(65536.0f);
var_f31 = i_this->mMantRng.getFX(32.0f);
var_f30 = i_this->mMantRng.getFX(32.0f);
} else
#endif
{
unaff_r29 = cM_rndF(65536.0f);
var_f31 = cM_rndFX(32.0f);
var_f30 = cM_rndFX(32.0f);
}
unaff_r29 = cM_rndF(65536.0f);
var_f31 = cM_rndFX(32.0f);
var_f30 = cM_rndFX(32.0f);
}
i_this->field_0x3967 = 0;
@@ -777,8 +760,6 @@ static int daMant_Create(fopAc_ac_c* i_this) {
if(textureObjsInitialized) {
GXInitTlutObjData(&tlutObj, l_Egnd_mantPAL); // make sure the cached textures are updated
}
m_this->mMantRng.init(66, 16983, 855);
#endif
lbl_277_bss_0 = 0;
+12 -4
View File
@@ -5,16 +5,17 @@
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_midna.h"
#include "JSystem/J3DGraphLoader/J3DAnmLoader.h"
#include "d/d_meter2_info.h"
#include "d/actor/d_a_alink.h"
#include "d/actor/d_a_kago.h"
#include "d/actor/d_a_midna.h"
#include "d/d_debug_viewer.h"
#include "d/d_demo.h"
#include "d/d_meter2_info.h"
#include "d/d_msg_object.h"
#include "d/d_s_play.h"
#include "d/d_debug_viewer.h"
#include "dusk/frame_interpolation.h"
#include "dusk/tphd/LosTable.hpp"
static f32 dummy_lit_3777(int idx, u8 foo) {
Vec dummy_vec = {0.0f, 0.0f, 0.0f};
@@ -3308,7 +3309,14 @@ int daMidna_c::execute() {
}
}
onStateFlg0(FLG0_UNK_8000);
mMsgFlow.init(this, 0xbb9, 0, NULL);
#if TARGET_PC
if (dusk::tphd::is_los_active() && !dusk::getSettings().game.canTransformAnywhere) {
mMsgFlow.init(this, 0x457, 0, NULL);
} else
#endif
{
mMsgFlow.init(this, 0xbb9, 0, NULL);
}
} else if (mMsgFlow.doFlow(this, NULL, 0)) {
int item_id;
u16 event_id = mMsgFlow.getEventId(&item_id);
+348
View File
@@ -15,6 +15,8 @@
#include "m_Do/m_Do_lib.h"
#if TARGET_PC
#include "dusk/frame_interpolation.h"
#include "dusk/settings.h"
#include <cstring>
#endif
#ifndef __MWERKS__
@@ -50,6 +52,32 @@ void dMirror_packet_c::calcMinMax() {
mMinVal.set(FLT_MAX, FLT_MAX, FLT_MAX);
mMaxVal.set(-FLT_MAX, -FLT_MAX, -FLT_MAX);
#if TARGET_PC
// HD: per-quad cull box + global bbox over all mQuadCount quads.
for (int q = 0; q < mQuadCount; q++) {
cXyz& bmin = mQuadBoxMin[q];
cXyz& bmax = mQuadBoxMax[q];
bmin.set(FLT_MAX, FLT_MAX, FLT_MAX);
bmax.set(-FLT_MAX, -FLT_MAX, -FLT_MAX);
cXyz* quad = &mQuad[q * 4];
for (int i = 0; i < 4; i++, quad++) {
if (quad->x < bmin.x) bmin.x = quad->x;
if (quad->x > bmax.x) bmax.x = quad->x;
if (quad->y < bmin.y) bmin.y = quad->y;
if (quad->y > bmax.y) bmax.y = quad->y;
if (quad->z < bmin.z) bmin.z = quad->z;
if (quad->z > bmax.z) bmax.z = quad->z;
}
if (bmin.x < mMinVal.x) mMinVal.x = bmin.x;
if (bmax.x > mMaxVal.x) mMaxVal.x = bmax.x;
if (bmin.y < mMinVal.y) mMinVal.y = bmin.y;
if (bmax.y > mMaxVal.y) mMaxVal.y = bmax.y;
if (bmin.z < mMinVal.z) mMinVal.z = bmin.z;
if (bmax.z > mMaxVal.z) mMaxVal.z = bmax.z;
}
#else
cXyz* quad = mQuad;
for (int i = 0; i < 4; i++, quad++) {
f32 val = quad->x;
@@ -82,6 +110,7 @@ void dMirror_packet_c::calcMinMax() {
mMaxVal.z = val;
}
}
#endif
}
int dMirror_packet_c::entryModel(J3DModel* i_model) {
@@ -103,6 +132,10 @@ int dMirror_packet_c::entryModel(J3DModel* i_model) {
return 1;
}
#if TARGET_PC
static f32 dMirror_quadDist(const cXyz& p, const cXyz& bmin, const cXyz& bmax);
#endif
void dMirror_packet_c::mirrorZdraw(f32* param_0, f32* param_1, f32 param_2, f32 param_3,
f32 param_4, f32 param_5, f32 param_6, f32 param_7) {
ZoneScoped;
@@ -131,11 +164,82 @@ void dMirror_packet_c::mirrorZdraw(f32* param_0, f32* param_1, f32 param_2, f32
GXLoadPosMtxImm(j3dSys.getViewMtx(), 0);
GXSetCurrentMtx(0);
#if TARGET_PC
// HD FUN_0247d9fc: with count>=2, tint only the same-height quad group nearest the camera
u32 groupMask = 1;
int groupCount = 1;
if (mQuadCount >= 2) {
const cXyz& eye = dComIfGd_getView()->lookat.eye;
int nearest = 0;
f32 best = FLT_MAX;
for (int q = 0; q < mQuadCount; q++) {
f32 dist = dMirror_quadDist(eye, mQuadBoxMin[q], mQuadBoxMax[q]);
if (dist < best) {
best = dist;
nearest = q;
}
}
groupMask = 0;
groupCount = 0;
for (int q = 0; q < mQuadCount; q++) {
if (fabsf(mQuadBoxMin[q].y - mQuadBoxMin[nearest].y) < 0.0001f) {
groupMask |= 1u << q;
groupCount++;
}
}
}
GXBegin(GX_QUADS, GX_VTXFMT0, groupCount * 4);
for (int q = 0; q < mQuadCount; q++) {
if (groupMask & (1u << q)) {
for (int i = 0; i < 4; i++) {
GXPosition3f32(mQuad[q * 4 + i].x, mQuad[q * 4 + i].y, mQuad[q * 4 + i].z);
}
}
}
GXEnd();
if (mQuadCount >= 2 && GX2SupportsStencil()) {
GXSetColorUpdate(GX_DISABLE);
GXSetAlphaUpdate(GX_DISABLE);
GXSetBlendMode(GX_BM_NONE, GX_BL_SRCALPHA, GX_BL_INVSRCALPHA, GX_LO_CLEAR);
GXSetAlphaCompare(GX_ALWAYS, 0, GX_AOP_OR, GX_ALWAYS, 0);
GX2SetStencilMask(0xff, 0xff, 0, 0xff, 0xff, 0);
GX2SetDepthStencilControl(0, 0, 7, 1, 0, 7, 3, 3, 0, 0, 0, 0, 0);
GXBegin(GX_QUADS, GX_VTXFMT0, groupCount * 4);
for (int q = 0; q < mQuadCount; q++) {
if (groupMask & (1u << q)) {
for (int i = 0; i < 4; i++) {
GXPosition3f32(mQuad[q * 4 + i].x, mQuad[q * 4 + i].y, mQuad[q * 4 + i].z);
}
}
}
GXEnd();
GX2SetDepthStencilControl(1, 1, 7, 1, 0, 2, 1, 1, 1, 0, 0, 0, 0);
Mtx44 proj;
C_MTXOrtho(proj, param_1[1], param_1[1] + param_1[3], param_1[0],
param_1[0] + param_1[2], 0, 100.0f);
GXSetProjection(proj, GX_ORTHOGRAPHIC);
GXLoadPosMtxImm(mDoMtx_getIdentity(), 0);
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
GXPosition3f32(param_1[0], param_1[1], -100.0f);
GXPosition3f32(param_1[0] + param_1[2], param_1[1], -100.0f);
GXPosition3f32(param_1[0] + param_1[2], param_1[1] + param_1[3], -100.0f);
GXPosition3f32(param_1[0], param_1[1] + param_1[3], -100.0f);
GXEnd();
GXSetProjectionv(param_0);
GXSetColorUpdate(GX_ENABLE);
GXSetAlphaUpdate(GX_DISABLE); // no stencil-off: the next material's zmode write disables it
return;
}
#else
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
for (int i = 0; i < 4; i++) {
GXPosition3f32(mQuad[i].x, mQuad[i].y, mQuad[i].z);
}
GXEnd();
#endif
if (mViewScale.y > 0.0f) {
GXSetZMode(GX_ENABLE, GX_ALWAYS, GX_ENABLE);
@@ -265,10 +369,223 @@ void dMirror_packet_c::modelDraw(J3DModel* i_model, Mtx param_1) {
}
}
#if TARGET_PC
// FUN_0247c89c: HD multi-quad floor reflection helpers (F_SP117 room 2):
static f32 dMirror_quadDist(const cXyz& p, const cXyz& bmin, const cXyz& bmax) {
f32 ox = bmin.x - p.x;
if (ox < 0.0f) ox = 0.0f;
f32 oz = bmin.z - p.z;
if (oz < 0.0f) oz = 0.0f;
f32 px = p.x - bmax.x;
if (px < 0.0f) px = 0.0f;
f32 pz = p.z - bmax.z;
if (pz < 0.0f) pz = 0.0f;
return fabsf(p.y - bmin.y) + ox + oz + px + pz;
}
static void dMirror_accumQuadBBox(view_class* view, view_port_class* view_port, const u32 scissor[4],
cXyz* quad, f32& minX, f32& maxX, f32& minY, f32& maxY, f32& maxZ) {
cXyz sp19C[5];
int prjPosNum = 4;
f32 nearZ = -view->near_;
int behind = 0;
int lastFront = 0;
for (int i = 0; i < 4; i++) {
cMtx_multVec(view->viewMtx, &quad[i], &sp19C[i]);
if (sp19C[i].z >= nearZ) {
behind++;
} else {
lastFront = i;
}
}
if (behind >= 4) {
return;
}
int var_r28 = lastFront;
if (behind != 0) {
int var_r27 = -1;
for (int i = 0; i < 4; i++) {
int temp_r5 = (var_r28 + 1) % 4;
if (var_r27 < 0) {
if (sp19C[temp_r5].z >= nearZ) {
var_r27 = temp_r5;
}
} else if (sp19C[temp_r5].z < nearZ) {
int temp_r29 = (var_r27 + 3) % 4;
cXyz d0 = sp19C[var_r27] - sp19C[temp_r29];
d0 *= (nearZ - sp19C[temp_r29].z) / d0.z;
sp19C[4] = sp19C[temp_r29] + d0;
prjPosNum++;
cXyz d1 = sp19C[var_r28] - sp19C[temp_r5];
d1 *= (nearZ - sp19C[temp_r5].z) / d1.z;
sp19C[var_r28] = sp19C[temp_r5] + d1;
for (int j = var_r27; j != var_r28; j = (j + 1) % 4) {
sp19C[j] = sp19C[var_r28];
}
break;
}
var_r28 = temp_r5;
}
}
f32 aspect = view->aspect;
f32 tanHalf = tanf(MTXDegToRad(view->fovy * 0.5f));
f32 vx, vy, vw, vh;
if (view_port->x_orig != 0.0f) {
vx = (((view_port->x_orig * 2.0f) + view_port->width) * 0.5f) - (FB_WIDTH / 2);
vw = FB_WIDTH;
} else {
vx = view_port->x_orig;
vw = view_port->width;
}
if (view_port->y_orig != 0.0f) {
vy = (((view_port->y_orig * 2.0f) + view_port->height) * 0.5f) - (FB_HEIGHT / 2);
vh = FB_HEIGHT;
} else {
vy = view_port->y_orig;
vh = view_port->height;
}
f32 sxMin = scissor[0];
f32 sxMax = sxMin + scissor[2];
f32 syMin = scissor[1];
f32 syMax = syMin + scissor[3];
Vec* p = sp19C;
for (int i = 0; i < prjPosNum; i++, p++) {
p->y = p->y / (p->z * tanHalf);
p->x = p->x / (aspect * (-p->z * tanHalf));
p->x = vx + ((1.0f + p->x) * (vw * 0.5f));
p->y = vy + ((1.0f + p->y) * (vh * 0.5f));
p->x = cLib_minMaxLimit<f32>(p->x, sxMin, sxMax);
p->y = cLib_minMaxLimit<f32>(p->y, syMin, syMax);
if (p->x < minX) minX = p->x;
if (p->x > maxX) maxX = p->x;
if (p->y < minY) minY = p->y;
if (p->y > maxY) maxY = p->y;
if (p->z > maxZ) maxZ = p->z;
}
}
#endif
void dMirror_packet_c::mainDraw() {
ZoneScoped;
j3dSys.reinitGX();
#if TARGET_PC
f32 sp150[7];
GXGetProjectionv(sp150);
f32 sp138[6];
GXGetViewportv(sp138);
u32 scissor[4];
GXGetScissor(&scissor[0], &scissor[1], &scissor[2], &scissor[3]);
view_class* view = dComIfGd_getView();
view_port_class* view_port = dComIfGd_getViewport();
// HD mainDraw (FUN_0247e6e8):
f32 minX = FLT_MAX, minY = FLT_MAX;
f32 maxX = -FLT_MAX, maxY = -FLT_MAX, maxZ = -FLT_MAX;
for (int q = 0; q < mQuadCount; q++) {
dMirror_accumQuadBBox(view, view_port, scissor, &mQuad[q * 4], minX, maxX, minY, maxY, maxZ);
}
if (maxX <= minX || maxY <= minY) {
return;
}
if (fabsf(maxX - minX) < 8.0f || fabsf(maxY - minY) < 8.0f) {
return;
}
GXSetScissor((u32)minX, (u32)minY, (u32)(maxX - minX), (u32)(maxY - minY));
Mtx reflMtx[MAX_QUADS];
for (int q = 0; q < mQuadCount; q++) {
cXyz* quad = &mQuad[q * 4];
cXyz e0 = quad[1] - quad[0];
cXyz e1 = quad[2] - quad[1];
cXyz n = e0.outprod(e1);
n.normalizeZP();
f32 planeD = (n.x * quad[0].x) + (n.y * quad[0].y) + (n.z * quad[0].z);
f32 dCenter = ((n.x * view->lookat.center.x) + (n.y * view->lookat.center.y) +
(n.z * view->lookat.center.z)) -
planeD;
cXyz reflEye =
view->lookat.eye -
(n * (2.0f * (((n.x * view->lookat.eye.x) + (n.y * view->lookat.eye.y) +
(n.z * view->lookat.eye.z)) -
planeD)));
cXyz reflCenter = view->lookat.center - (n * (2.0f * dCenter));
cXyz up(0.0f, 1.0f, 0.0f);
if (mViewScale.y > 0.0f) {
cXyz a = reflEye - view->lookat.eye;
cXyz b = a.outprod(view->lookat.up);
up = a.outprod(b);
up.normalizeZP();
up *= cXyz(-1.0f, -1.0f, -1.0f);
}
Mtx look;
mDoMtx_lookAt(look, &reflEye, &reflCenter, &up, view->bank);
mDoMtx_stack_c::scaleS(mViewScale);
mDoMtx_stack_c::concat(look);
f32 (*cur)[4] = mDoMtx_stack_c::get();
for (int r = 0; r < 3; r++) {
for (int c = 0; c < 4; c++) {
reflMtx[q][r][c] = cur[r][c];
}
}
}
J3DShape::resetVcdVatCache();
bool wallQuad = !dusk::tphd_active() ||
(mQuadCount <= 1 && mQuadBoxMax[0].y - mQuadBoxMin[0].y > 0.1f);
for (int i = 0; i < mModelCount; i++) {
Mtx& bm = mModels[i]->getBaseTRMtx();
cXyz pos(bm[0][3], bm[1][3], bm[2][3]);
int best = 0;
if (!wallQuad) {
const cXyz& eye = view->lookat.eye;
best = -1;
f32 bestDist = FLT_MAX;
for (int q = 0; q < mQuadCount; q++) {
if ((mQuadBoxMin[q].x <= pos.x || mQuadBoxMin[q].x <= eye.x) &&
(mQuadBoxMin[q].z <= pos.z || mQuadBoxMin[q].z <= eye.z) &&
(pos.x <= mQuadBoxMax[q].x || eye.x <= mQuadBoxMax[q].x) &&
(pos.z <= mQuadBoxMax[q].z || eye.z <= mQuadBoxMax[q].z))
{
f32 dist = dMirror_quadDist(pos, mQuadBoxMin[q], mQuadBoxMax[q]);
if (dist < bestDist) {
bestDist = dist;
best = q;
}
}
}
if (best < 0) {
continue;
}
}
modelDraw(mModels[i], reflMtx[best]);
}
j3dSys.reinitGX();
if (dusk::tphd_active()) {
mirrorZdraw(sp150, sp138, view->far_, minX, minY, maxX, maxY, maxZ);
GXSetScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
} else {
GXSetScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
mirrorZdraw(sp150, sp138, view->far_, minX, minY, maxX, maxY, maxZ);
}
#else
cXyz sp19C[5];
Mtx sp16C;
@@ -456,6 +773,7 @@ void dMirror_packet_c::mainDraw() {
GXSetScissor(scissor[0], scissor[1], scissor[2], scissor[3]);
mirrorZdraw(sp150, sp138, view->far_, var_f31, var_f30, var_f29, var_f28, var_f27);
}
#endif
}
void dMirror_packet_c::draw() {
@@ -536,6 +854,36 @@ int daMirror_c::create() {
mPacket.getViewScale().set(-1.0f, 1.0f, 1.0f);
} else {
if (type == 1) {
#if TARGET_PC
if (dusk::tphd_active() && strcmp(dComIfGp_getStartStageName(), "F_SP117") == 0 &&
dComIfGp_getStartStageRoomNo() == 2)
{
// HD const DAT_1002f070 (world-space floor rects)
static const struct {
f32 xMin, xMax, y, zMin, zMax;
} l_tot_quads[dMirror_packet_c::MAX_QUADS] = {
{-1800.0f, 1800.0f, 999.0f, 747.0f, 5600.0f},
{-670.0f, 670.0f, 999.0f, 5600.0f, 6400.0f},
{-3530.0f, 3530.0f, 1526.0f, -8151.0f, -2014.0f},
{-3530.0f, -1040.0f, 1526.0f, -2014.0f, -1089.0f},
{1040.0f, 3530.0f, 1526.0f, -2014.0f, -1089.0f},
{-700.0f, 700.0f, 2887.0f, -10700.0f, -8300.0f},
};
cXyz* q = mPacket.getQuad();
for (int i = 0; i < dMirror_packet_c::MAX_QUADS; i++) {
q[i * 4 + 0].set(l_tot_quads[i].xMin, l_tot_quads[i].y, l_tot_quads[i].zMin);
q[i * 4 + 1].set(l_tot_quads[i].xMax, l_tot_quads[i].y, l_tot_quads[i].zMin);
q[i * 4 + 2].set(l_tot_quads[i].xMax, l_tot_quads[i].y, l_tot_quads[i].zMax);
q[i * 4 + 3].set(l_tot_quads[i].xMin, l_tot_quads[i].y, l_tot_quads[i].zMax);
}
mPacket.mQuadCount = dMirror_packet_c::MAX_QUADS;
mPacket.getViewScale().set(1.0f, -1.0f, 1.0f);
m_myObj = this;
mPacket.calcMinMax();
eyePos.set(current.pos.x, current.pos.y, current.pos.z);
return cPhs_COMPLEATE_e;
}
#endif
scale *= 10.0f;
mPacket.getViewScale().set(1.0, -1.0, 1.0);
} else {
+14 -2
View File
@@ -10,8 +10,11 @@
#include <cstring>
static DUSK_CONSTEXPR daNpcT_evtData_c l_evtList[1] = {
static DUSK_CONSTEXPR daNpcT_evtData_c l_evtList[DUSK_IF_ELSE(2, 1)] = {
{"", 0},
#if TARGET_PC
{"DEFAULT_GETITEM", 0},
#endif
};
static DUSK_CONST char* l_resNameList[2] = {
@@ -145,7 +148,7 @@ int daNpc_FairySeirei_c::Draw() {
int daNpc_FairySeirei_c::isDelete() {
int ret = 0;
if (daNpcT_chkEvtBit(0x1F9) == false) {
if (IF_DUSK(mType != 4 &&) daNpcT_chkEvtBit(0x1F9) == false) {
ret = 1;
}
return ret;
@@ -359,6 +362,15 @@ int daNpc_FairySeirei_c::talk(int param_0) {
}
if (fopAcM_IsExecuting(mItemPartnerId)) {
mTalking = TRUE;
#if TARGET_PC
if (dusk::tphd_active() && getType() == 4) {
mEvtNo = 1;
field_0xe33 = true;
mSpeakEvent = true;
}
#endif
evtChange();
}
} else {
+50 -1
View File
@@ -14,6 +14,9 @@
#include "d/actor/d_a_obj_ystone.h"
#include <cstring>
#include "d/actor/d_a_alink.h"
#include "dusk/tphd/LosTable.hpp"
static DUSK_CONST char* l_arcName = "ef_Portal";
static char const* l_clearEvName[9] = {
@@ -101,7 +104,7 @@ int daObjBossWarp_c::Create() {
}
mBossClearMapToolId = 0xff;
if (!isFirst() || level == 8) {
if ((!isFirst() || level == 8) IF_DUSK(&& !dusk::tphd::is_los_active())) {
mBossWarpInEventId = dComIfGp_getEventManager().getEventIdx(this, "BOSS_WARPIN", 0xff);
mBossWarpInMapToolId = 0xff;
mAction = 3;
@@ -217,6 +220,31 @@ BOOL daObjBossWarp_c::checkDistance() {
}
int daObjBossWarp_c::execute() {
#if TARGET_PC
if (dusk::tphd::is_los_active()) {
u8 sw = getSwNo();
if (sw == 0xff || fopAcM_isSwitch(this, sw)) {
if (mAction == ACT_WAIT) {
mAction = ACT_WAIT_WARP;
}
set_appear();
if (!dComIfGp_evmng_checkStartDemo()) {
field_0x595 = true;
field_0x620 = current.pos;
}
event_proc_call();
daMidna_c* midna = (daMidna_c*)daPy_py_c::getMidnaActor();
if (field_0x595 && midna != NULL) {
midna->onTagWaitPos(&field_0x620);
}
}
}
#endif
if (dStage_stagInfo_GetSTType(dComIfGp_getStage()->getStagInfo()) != 3) {
u8 sw = getSwNo();
if (sw == 0xff || fopAcM_isSwitch(this, sw)) {
@@ -476,6 +504,14 @@ int daObjBossWarp_c::demoProc() {
disappear(0);
break;
case 3: // SCENE_CHG
#if TARGET_PC
if (dusk::tphd::is_los_active()) {
// tphd sets some event flags here for bookkeeping, ignoring for now
daAlink_getAlinkActorClass()->mLosStickValue = -1.0f;
break;
}
#endif
int scene;
if (isFirst()) {
scene = getSceneListNo();
@@ -536,6 +572,11 @@ int daObjBossWarp_c::demoProc() {
break;
case 6: // WALK_TARGET1
dComIfGp_evmng_setGoal(&current.pos);
#if TARGET_PC
if (dusk::tphd::is_los_active()) {
daAlink_getAlinkActorClass()->mLosStickValue = 1.0f;
}
#endif
break;
case 7: // APPEAR_END
break;
@@ -573,6 +614,14 @@ int daObjBossWarp_c::demoProc() {
dComIfGp_evmng_cutEnd(mStaffId);
break;
case 3: // SCENE_CHG
#if TARGET_PC
if (dusk::tphd::is_los_active()) {
if (mCounter++ == 0) {
fopAcM_offDraw(this);
dComIfGp_event_remove();
}
}
#endif
break;
case 4: // STONE_FALL
if (ystone != NULL) {
+11 -1
View File
@@ -26,6 +26,8 @@
daObjDrop_HIO_c l_HIO;
#endif
#include <dusk/ui/settings.hpp>
static void* searchParentSub(void* pproc, void* pdata) {
daObjDrop_c* pdrop = (daObjDrop_c*)pdata;
fopAc_ac_c* pym = (fopAc_ac_c*)pproc;
@@ -103,9 +105,17 @@ void daObjDrop_c::dropGet() {
dComIfGs_setLightDropNum(dComIfGp_getStartStageDarkArea(), num + 1);
if (dComIfGp_getStartStageDarkArea() == 2 &&
#if TARGET_PC
((dusk::tphd_active() &&
dComIfGs_getLightDropNum(dComIfGp_getStartStageDarkArea()) == 11) ||
!dusk::tphd_active() &&
dComIfGs_getLightDropNum(dComIfGp_getStartStageDarkArea()) == 15
))
#else
dComIfGs_getLightDropNum(dComIfGp_getStartStageDarkArea()) == 15)
#endif
{
/* dSv_event_flag_c::F_0005 - Misc. - Gathered 14 Tears of Light in area 4 */
/* dSv_event_flag_c::F_0005 - Misc. - Gathered 15 Tears of Light in area 4 */
dComIfGs_onEventBit(dSv_event_flag_c::saveBitLabels[9]);
}
+46 -21
View File
@@ -6,9 +6,10 @@
#include "d/dolzel_rel.h" // IWYU pragma: keep
#include "d/actor/d_a_obj_lv8Lift.h"
#include "d/d_bg_w.h"
#include "d/d_com_inf_game.h"
#include "d/d_path.h"
#include "d/d_bg_w.h"
#include "dusk/tphd/LosTable.hpp"
#if TARGET_PC
#include "dusk/frame_interpolation.h"
@@ -44,14 +45,14 @@ f32 const daL8Lift_c::mSpeed[16] = {
};
int daL8Lift_c::CreateHeap() {
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("L8Lift", 5);
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(DUSK_IF_ELSE(dusk::tphd::is_los_active() ? "L8LiftSt" : "L8Lift", "L8Lift"), 5);
JUT_ASSERT(190, modelData != NULL);
mpModel = mDoExt_J3DModel__create(modelData, 0, 0x11000284);
if (!mpModel) {
return 0;
}
int res = mBtk.init(modelData, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("L8Lift", 8),
int res = mBtk.init(modelData, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(DUSK_IF_ELSE(dusk::tphd::is_los_active() ? "L8LiftSt" : "L8Lift", "L8Lift"), 8),
1, 0, 1.0f, 0, -1);
JUT_ASSERT(207, res == 1);
@@ -63,9 +64,9 @@ static daL8Lift_HIO_c l_HIO;
int daL8Lift_c::create() {
fopAcM_ct(this, daL8Lift_c);
int phase_state = dComIfG_resLoad(&mPhase, "L8Lift");
int phase_state = dComIfG_resLoad(&mPhase, DUSK_IF_ELSE(dusk::tphd::is_los_active() ? "L8LiftSt" : "L8Lift", "L8Lift"));
if (phase_state == cPhs_COMPLEATE_e) {
if (MoveBGCreate("L8Lift", 11, dBgS_MoveBGProc_TypicalRotY, 0xd40, NULL) == cPhs_ERROR_e) {
if (MoveBGCreate(DUSK_IF_ELSE(dusk::tphd::is_los_active() ? "L8LiftSt" : "L8Lift", "L8Lift"), 11, dBgS_MoveBGProc_TypicalRotY, DUSK_IF_ELSE(dusk::tphd::is_los_active() ? 0x1D40 : 0xD40, 0xd40) , NULL) == cPhs_ERROR_e) {
return cPhs_ERROR_e;
}
@@ -92,8 +93,17 @@ int daL8Lift_c::create() {
if (mSwbit == 0xff) {
mBtk.setFrame(mBtk.getEndFrame() - 1.0f);
mLightSet = 1;
dKy_plight_set(&mLight);
#if TARGET_PC
if (dusk::tphd::is_los_active()) {
mLightSet = 0;
} else
#endif
{
mLightSet = 1;
dKy_plight_set(&mLight);
}
init_modeWaitInit();
} else {
mNoRideOffSwTimer = 0;
@@ -290,8 +300,15 @@ void daL8Lift_c::init_modeOnAnm() {
void daL8Lift_c::modeOnAnm() {
if (mBtk.play() == 1) {
field_0x808 = 1;
mLightSet = 1;
dKy_plight_set(&mLight);
#if TARGET_PC
if (!dusk::tphd::is_los_active())
#endif
{
mLightSet = 1;
dKy_plight_set(&mLight);
}
init_modeMoveWait();
}
}
@@ -428,20 +445,28 @@ int daL8Lift_c::Draw() {
J3DMaterial* mpMatNode = modelData->getMaterialNodePointer(0);
dComIfGd_setListDarkBG();
if (mpMatNode->getTexGenBlock()->getTexMtx(1)) {
J3DTexMtxInfo* texMtxInfo = &mpMatNode->getTexGenBlock()->getTexMtx(1)->getTexMtxInfo();
if (texMtxInfo) {
Mtx mMtx58;
C_MTXLightOrtho(mMtx58, 100.0f, -100.0f, -100.0f, 100.0f, 1.0f, 1.0f, 0.0f, 0.0f);
mDoMtx_stack_c::XrotS(0x4000);
mDoMtx_stack_c::transM(-current.pos.x, -current.pos.y, -current.pos.z);
cMtx_concat(mMtx58, mDoMtx_stack_c::get(), texMtxInfo->mEffectMtx);
#if TARGET_PC
if (dusk::tphd::is_los_active()) {
mDoExt_modelUpdateDL(mpModel);
} else
#endif
{
if (mpMatNode->getTexGenBlock()->getTexMtx(1)) {
J3DTexMtxInfo* texMtxInfo = &mpMatNode->getTexGenBlock()->getTexMtx(1)->getTexMtxInfo();
if (texMtxInfo) {
Mtx mMtx58;
C_MTXLightOrtho(mMtx58, 100.0f, -100.0f, -100.0f, 100.0f, 1.0f, 1.0f, 0.0f, 0.0f);
mDoMtx_stack_c::XrotS(0x4000);
mDoMtx_stack_c::transM(-current.pos.x, -current.pos.y, -current.pos.z);
cMtx_concat(mMtx58, mDoMtx_stack_c::get(), texMtxInfo->mEffectMtx);
}
}
mBtk.entry(modelData);
mDoExt_modelUpdateDL(mpModel);
mBtk.remove(modelData);
}
mBtk.entry(modelData);
mDoExt_modelUpdateDL(mpModel);
mBtk.remove(modelData);
dComIfGd_setList();
J3DGXColor* mColor = mpMatNode->getTevKColor(1);
@@ -453,7 +478,7 @@ int daL8Lift_c::Draw() {
}
int daL8Lift_c::Delete() {
dComIfG_resDelete(&mPhase, "L8Lift");
dComIfG_resDelete(&mPhase, DUSK_IF_ELSE(dusk::tphd::is_los_active() ? "L8LiftSt" : "L8Lift", "L8Lift"));
if (mLightSet) {
dKy_plight_cut(&mLight);
}
+124 -8
View File
@@ -9,9 +9,19 @@
#include "SSystem/SComponent/c_math.h"
#include "d/d_com_inf_game.h"
static DUSK_CONST char* l_resNameIdx[2] = {
static DUSK_CONST char* l_resNameIdx[DUSK_IF_ELSE(10, 2)] = {
"P_Rgate",
"SDGate",
#if TARGET_PC
"losGate1",
"SDGate",
"los_Maze",
"losGate5",
"losGate1",
"losGate2",
"losGate3",
"losGate4",
#endif
};
daSwShutter_HIO_c::daSwShutter_HIO_c() {
@@ -36,7 +46,20 @@ void daSwShutter_c::setBaseMtx() {
mpModel->setBaseTRMtx(mDoMtx_stack_c::get());
}
static const int l_bmdIdx[2] = {4, 4};
static const int l_bmdIdx[DUSK_IF_ELSE(10, 2)] = {
4,
4,
#if TARGET_PC
4,
4,
1,
4,
4,
4,
4,
4,
#endif
};
int daSwShutter_c::CreateHeap() {
J3DModelData* modelData =
@@ -50,7 +73,20 @@ int daSwShutter_c::CreateHeap() {
return 1;
}
static const int l_dzbIdx[2] = {7, 7};
static const int l_dzbIdx[DUSK_IF_ELSE(10, 2)] = {
7,
7,
#if TARGET_PC
7,
7,
2,
7,
7,
7,
7,
7,
#endif
};
int daSwShutter_c::create() {
fopAcM_ct(this, daSwShutter_c);
@@ -74,9 +110,39 @@ int daSwShutter_c::create() {
field_0x5b0 = 0.0f;
if (fopAcM_isSwitch(this, getSwBit())) {
#if TARGET_PC
if (dusk::tphd_active()) {
switch (getModelType()) {
case 4:
current.pos.y -= -370.0f;
break;
case 5:
current.pos.y -= -450.0f;
break;
case 9:
current.pos.y -= -740.0f;
break;
default:
current.pos.y += -450.0f;
break;
}
init_modeMoveDownEnd();
} else {
current.pos.y += -450.0f;
init_modeMoveDownEnd();
}
#else
current.pos.y += -450.0f;
init_modeMoveDownEnd();
#endif
} else {
#if TARGET_PC
if (dusk::tphd_active() && getModelType() == 2) {
current.pos.y += -450.0f;
}
#endif
mShakeRot.x = 0;
mShakeRot.y = 0;
mShakeRot.z = 0;
@@ -142,10 +208,23 @@ void daSwShutter_c::init_modeMoveDownInit() {
mMaxAtten = l_HIO.mMaxAtten;
mMinAtten = l_HIO.mMinAtten;
#if TARGET_PC
if (dusk::tphd_active()) {
// TPHD: opening a Cave-of-Shadows shutter gate reveals the floor below
dStage_showLOSNextFloor(fopAcM_GetRoomNo(this));
}
#endif
if (mModelType == TYPE_SUBDAN_e) {
dComIfGp_particle_set(0x8C73, &current.pos, &shape_angle, NULL);
dComIfGp_particle_set(0x8C74, &current.pos, &shape_angle, NULL);
} else {
}
#if TARGET_PC
else if (dusk::tphd_active() && (mModelType == 0 || mModelType == 3 || mModelType == 4 || mModelType == 5 || mModelType == 9)) {
mShakeStrength = 0.0f;
}
#endif
else {
dComIfGp_particle_set(0x8709, &current.pos, &shape_angle, NULL);
dComIfGp_particle_set(0x870A, &current.pos, &shape_angle, NULL);
}
@@ -163,9 +242,16 @@ void daSwShutter_c::modeMoveDownInit() {
}
void daSwShutter_c::init_modeMoveDown() {
fopAcM_SetSpeedF(this, l_HIO.mInitSpeed);
#if TARGET_PC
if (dusk::tphd_active() && mModelType == 2) {
fopAcM_SetSpeedF(this, 13.6f);
} else
#endif
{
fopAcM_SetSpeedF(this, l_HIO.mInitSpeed);
}
if (mModelType == TYPE_SUBDAN_e) {
if (mModelType == TYPE_SUBDAN_e IF_DUSK(|| (dusk::tphd_active() && (mModelType != 4 && mModelType != 5 && mModelType != 9)))) {
dComIfGp_particle_set(0x8C77, &current.pos, &shape_angle, NULL);
} else {
dComIfGp_particle_set(0x870D, &current.pos, &shape_angle, NULL);
@@ -175,11 +261,41 @@ void daSwShutter_c::init_modeMoveDown() {
}
void daSwShutter_c::modeMoveDown() {
cLib_chaseF(&speedF, l_HIO.mMaxSpeed, l_HIO.mAcceleration);
#if TARGET_PC
if (dusk::tphd_active() && mModelType == 2) {
cLib_chaseF(&speedF, l_HIO.mInitSpeed, l_HIO.mAcceleration);
} else
#endif
{
cLib_chaseF(&speedF, l_HIO.mMaxSpeed, l_HIO.mAcceleration);
}
#if TARGET_PC
f32 target_dist;
if (dusk::tphd_active()) {
switch (getModelType()) {
case 4:
target_dist = cLib_addCalc(&current.pos.y, home.pos.y - -370.0f, 1.0f, fopAcM_GetSpeedF(this), 1.0f);
break;
case 5:
target_dist = cLib_addCalc(&current.pos.y, home.pos.y - -450.0f, 1.0f, fopAcM_GetSpeedF(this), 1.0f);
break;
case 9:
target_dist = cLib_addCalc(&current.pos.y, home.pos.y - -740.0f, 1.0f, fopAcM_GetSpeedF(this), 1.0f);
break;
default:
target_dist = cLib_addCalc(&current.pos.y, home.pos.y + -450.0f, 1.0f, fopAcM_GetSpeedF(this), 1.0f);
break;
}
} else {
target_dist = cLib_addCalc(&current.pos.y, home.pos.y + -450.0f, 1.0f, fopAcM_GetSpeedF(this), 1.0f);
}
#else
f32 target_dist =
cLib_addCalc(&current.pos.y, home.pos.y + -450.0f, 1.0f, fopAcM_GetSpeedF(this), 1.0f);
#endif
if (mModelType == TYPE_SUBDAN_e) {
if (mModelType == TYPE_SUBDAN_e IF_DUSK(|| (dusk::tphd_active() && (mModelType != 4 && mModelType != 5 && mModelType != 9)))) {
mEmitterID0 = dComIfGp_particle_set(mEmitterID0, 0x8C75, &current.pos, &shape_angle, NULL);
mEmitterID1 = dComIfGp_particle_set(mEmitterID1, 0x8C76, &current.pos, &shape_angle, NULL);
} else {
+22 -4
View File
@@ -54,14 +54,27 @@ BOOL daObjSwpush::Act_c::solidHeapCB(fopAc_ac_c* a_this) {
return static_cast<daObjSwpush::Act_c*>(a_this)->create_heap();
}
s16 const daObjSwpush::Act_c::M_bmd[3] = {BMDR_KBOTA_00, BMDR_S_LV3BOTA, BMDR_S_LV6BOTA};
s16 const daObjSwpush::Act_c::M_bmd[DUSK_IF_ELSE(4, 3)] = {
BMDR_KBOTA_00, BMDR_S_LV3BOTA, BMDR_S_LV6BOTA,
#if TARGET_PC
4
#endif
};
s16 const daObjSwpush::Act_c::M_dzb[3] = {DZB_KBOTA_00, DZB_KBOTA2_00, DZB_KBOTA3_00};
s16 const daObjSwpush::Act_c::M_dzb[DUSK_IF_ELSE(4, 3)] = {
DZB_KBOTA_00, DZB_KBOTA2_00, DZB_KBOTA3_00,
#if TARGET_PC
7
#endif
};
DUSK_CONST char* daObjSwpush::Act_c::M_arcname[3] = {
DUSK_CONST char* daObjSwpush::Act_c::M_arcname[DUSK_IF_ELSE(4, 3)] = {
"Kbota_00",
"S_lv3bota",
"S_lv6bota",
#if TARGET_PC
"S_losbota",
#endif
};
bool daObjSwpush::Act_c::create_heap() {
@@ -117,7 +130,12 @@ cPhs_Step daObjSwpush::Act_c::create_res_load() {
return cPhs_COMPLEATE_e;
}
u32 const daObjSwpush::Act_c::M_heap_size[3] = {0x1000, 0x1000, 0x1000};
u32 const daObjSwpush::Act_c::M_heap_size[DUSK_IF_ELSE(4, 3)] = {
0x1000, 0x1000, 0x1000,
#if TARGET_PC
0x2000,
#endif
};
daObjSwpush::Hio_c::Attr_c const daObjSwpush::Act_c::M_attr[5] = {
{
+32 -1
View File
@@ -371,11 +371,41 @@ JKRHeap* daPy_anmHeap_c::setAnimeHeap() {
#include "dusk/dvd_asset.hpp"
using GameVersion = dusk::version::GameVersion;
static const u8* l_sightDL_get() {
#if DUSK_TPHD
if(dusk::tphd_active()) {
static u8 buf[0x89];
static bool _ = (
dusk::LoadRPXAsset(
buf,
0x1011a260,
0x89
),
true
);
return buf;
}
else {
static u8 buf[0x89];
static bool _ = (
dusk::LoadDolAsset(
buf,
{
{GameVersion::GcnUsa, 0x803BA0C0},
{GameVersion::GcnPal, 0x803BBDA0},
{GameVersion::GcnJpn, 0x803B4220}
},
0x89
),
true
);
return buf;
}
#else
static u8 buf[0x89];
static bool _ = (
dusk::LoadDolAsset(
buf,
{
{
{GameVersion::GcnUsa, 0x803BA0C0},
{GameVersion::GcnPal, 0x803BBDA0},
{GameVersion::GcnJpn, 0x803B4220}
@@ -385,6 +415,7 @@ static const u8* l_sightDL_get() {
true
);
return buf;
#endif
}
#define l_sightDL (l_sightDL_get())
#else
+15 -1
View File
@@ -126,6 +126,10 @@ int daSwc00_c::execute() {
case 1:
case 2:
case 7:
#if TARGET_PC
case 10: // HD Cave of Shadows region switch
case 11:
#endif
case 15:
if (sw2 != 0xff && !fopAcM_isSwitch(this, sw2)) {
return 1;
@@ -179,7 +183,17 @@ int daSwc00_c::execute() {
field_0x584 = 1;
}
break;
#if TARGET_PC
// HD Cave of Shadows region switch (CoS-controller bookkeeping omitted; not in this port)
case 10:
case 11:
if (hitCheck(this)) {
dComIfGs_onSwitch(sw1, fopAcM_GetRoomNo(this));
field_0x583 = 1;
field_0x584 = 1;
}
break;
#endif
case 7:
case 8:
if (hitCheck(this)) {
+7 -7
View File
@@ -101,7 +101,7 @@ void daTit_HIO_c::genMessage(JORMContext* mctx) {
#endif
int daTitle_c::CreateHeap() {
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 10);
J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(DUSK_IF_ELSE(dusk::tphd_active() ? "Title" : l_arcName, l_arcName), 10);
JUT_ASSERT(258, modelData);
mpModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000285);
@@ -109,16 +109,16 @@ int daTitle_c::CreateHeap() {
return 0;
}
int res = mBck.init((J3DAnmTransform*)dComIfG_getObjectRes(l_arcName, 7), 1, 0, 2.0f, 0, -1, false);
int res = mBck.init((J3DAnmTransform*)dComIfG_getObjectRes(DUSK_IF_ELSE(dusk::tphd_active() ? "Title" : l_arcName, l_arcName), 7), 1, 0, 2.0f, 0, -1, false);
JUT_ASSERT(276, res == 1);
res = mBpk.init(modelData, (J3DAnmColor*)dComIfG_getObjectRes(l_arcName, 13), 1, 0, 2.0f, 0, -1);
res = mBpk.init(modelData, (J3DAnmColor*)dComIfG_getObjectRes(DUSK_IF_ELSE(dusk::tphd_active() ? "Title" : l_arcName, l_arcName), 13), 1, 0, 2.0f, 0, -1);
JUT_ASSERT(283, res == 1);
res = mBrk.init(modelData, (J3DAnmTevRegKey*)dComIfG_getObjectRes(l_arcName, 16), 1, 0, 2.0f, 0, -1);
res = mBrk.init(modelData, (J3DAnmTevRegKey*)dComIfG_getObjectRes(DUSK_IF_ELSE(dusk::tphd_active() ? "Title" : l_arcName, l_arcName), 16), 1, 0, 2.0f, 0, -1);
JUT_ASSERT(290, res == 1);
res = mBtk.init(modelData, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(l_arcName, 19), 1, 0, 2.0f, 0, -1);
res = mBtk.init(modelData, (J3DAnmTextureSRTKey*)dComIfG_getObjectRes(DUSK_IF_ELSE(dusk::tphd_active() ? "Title" : l_arcName, l_arcName), 19), 1, 0, 2.0f, 0, -1);
JUT_ASSERT(297, res == 1);
return 1;
@@ -132,7 +132,7 @@ static procFunc daTitleProc[6] = {
int daTitle_c::create() {
fopAcM_ct(this, daTitle_c);
int phase_state = dComIfG_resLoad(&mPhaseReq, l_arcName);
int phase_state = dComIfG_resLoad(&mPhaseReq, DUSK_IF_ELSE(dusk::tphd_active() ? "Title" : l_arcName, l_arcName));
if (phase_state != cPhs_COMPLEATE_e) {
return phase_state;
}
@@ -408,7 +408,7 @@ int daTitle_c::Draw() {
int daTitle_c::Delete() {
mDoHIO_DELETE_CHILD(g_daTitHIO.id);
dComIfG_resDelete(&mPhaseReq, l_arcName);
dComIfG_resDelete(&mPhaseReq, DUSK_IF_ELSE(dusk::tphd_active() ? "Title" : l_arcName, l_arcName));
JKR_DELETE(mTitle.Scr);
JKR_DELETE(field_0x600);
+1 -5
View File
@@ -7602,10 +7602,6 @@ bool dCamera_c::executeDebugFlyCam() {
sFlyCamLastMousePos = mouseValid ? io.MousePos : ImVec2{-1.0f, -1.0f};
}
if (dusk::getSettings().game.enableMirrorMode) {
stickX *= -1.0f;
}
f32 verticalDisp = 0.0f;
if (trigR >= FLYCAM_TRIGGER_DEADZONE) {
verticalDisp += trigR;
@@ -7716,7 +7712,7 @@ bool dCamera_c::freeCamera() {
f32 yaw_rad = 0.0f;
f32 pitch_rad = 0.0f;
dusk::mouse::get_camera_deltas(yaw_rad, pitch_rad);
dusk::mouse::getCameraDeltas(yaw_rad, pitch_rad);
if (dusk::getSettings().game.enableMouseCamera && (yaw_rad != 0.0f || pitch_rad != 0.0f) &&
!dComIfGp_checkCameraAttentionStatus(dComIfGp_getPlayerCameraID(0), 0x8))
{
+15
View File
@@ -25,8 +25,10 @@
#include "m_Do/m_Do_graphic.h"
#include <cstdio>
#include <cstring>
#include <dusk/ui/settings.hpp>
#include "dusk/string.hpp"
#include "dusk/tphd/LosTable.hpp"
void dComIfG_play_c::ct() {
mWindowNum = 0;
@@ -2573,7 +2575,14 @@ u8 dComIfG_getNowCalcRegion() {
bool dComIfGp_isLightDropMapVisible() {
for (int i = 0; i < 3; i++) {
#if TARGET_PC
if (dComIfGs_isLightDropGetFlag(i) != FALSE &&
((dusk::tphd_active() && dComIfGs_getLightDropNum(i) < 12) ||
(!dusk::tphd_active() && dComIfGs_getLightDropNum(i) < 16)))
{
#else
if (dComIfGs_isLightDropGetFlag(i) != FALSE && dComIfGs_getLightDropNum(i) < 16) {
#endif
return true;
}
}
@@ -2855,6 +2864,12 @@ BOOL dComIfGs_Wolf_Change_Check() {
is_wolf = true;
}
#if TARGET_PC
if (dusk::tphd::is_los_active()) {
is_wolf = true;
}
#endif
OS_REPORT("dComIfGs_isSaveSwitch 12[%x] 13[%x]\n", dComIfGs_isSaveSwitch(12), dComIfGs_isSaveSwitch(13));
// Stage is Hyrule Field and Room is Eldin Gorge Entrance
+7
View File
@@ -1138,7 +1138,14 @@ void dDlst_shadowReal_c::draw() {
{
GXLoadTexMtxImm(mReceiverProjMtx, GX_TEXMTX0, GX_MTX3x4);
}
#ifdef DUSK_TPHD
GX2SetPolygonOffset(-10.0f, -10.0f, -10.0f, -10.0f, 0);
#endif
mShadowRealPoly.draw();
#ifdef DUSK_TPHD
GX2SetPolygonOffset(0.0f, 0.0f, 0.0f, 0.0f, 0);
#endif
}
static int psdRealCallBack(cBgS_ShdwDraw* param_0, cBgD_Vtx_t* param_1, int param_2,
+21 -32
View File
@@ -777,7 +777,6 @@ bool dFile_select_c::pointerDataSelect() {
if (!dusk::menu_pointer::hit_pane(mSelFilePanes[i], 8.0f)) {
continue;
}
dusk::menu_pointer::set_hover_target(pointer_target(s_pointerDataSelectTarget, i));
const bool clicked = dusk::menu_pointer::consume_click();
if (mSelectNum != i) {
mDoAud_seStart(Z2SE_FILE_SELECT_CURSOR, NULL, 0, 0);
@@ -806,7 +805,6 @@ bool dFile_select_c::pointerMenuSelect() {
if (!dusk::menu_pointer::hit_pane(m3mSelPane[i], 8.0f)) {
continue;
}
dusk::menu_pointer::set_hover_target(pointer_target(s_pointerMenuSelectTarget, i));
const bool clicked = dusk::menu_pointer::consume_click();
if (!mIsDataNew[mSelectNum] && mSelectMenuNum != i) {
mDoAud_seStart(Z2SE_SY_MENU_CURSOR_COMMON, NULL, 0, 0);
@@ -835,7 +833,6 @@ bool dFile_select_c::pointerCopyDataToSelect() {
if (!dusk::menu_pointer::hit_pane(mCpSelPane[i], 8.0f)) {
continue;
}
dusk::menu_pointer::set_hover_target(pointer_target(s_pointerCopySelectTarget, i));
const bool clicked = dusk::menu_pointer::consume_click();
if (field_0x026b != i) {
mDoAud_seStart(Z2SE_FILE_SELECT_CURSOR, NULL, 0, 0);
@@ -864,7 +861,6 @@ bool dFile_select_c::pointerYesNoSelect(bool errorSelect) {
if (!dusk::menu_pointer::hit_pane(mYnSelPane[i], 8.0f)) {
continue;
}
dusk::menu_pointer::set_hover_target(pointer_target(s_pointerYesNoSelectTarget, i));
const bool clicked =
(!errorSelect || field_0x0268 == i) && dusk::menu_pointer::consume_click();
if (field_0x0268 != i) {
@@ -1107,13 +1103,12 @@ void dFile_select_c::dataSelectAnmSet() {
void dFile_select_c::dataSelectMoveAnime() {
#if TARGET_PC
dusk::menu_pointer::begin_context(dusk::menu_pointer::Context::FileSelect);
if (mSelectNum != 0xFF && dusk::menu_pointer::hit_pane(mSelFilePanes[mSelectNum], 8.0f)) {
dusk::menu_pointer::set_hover_target(pointer_target(s_pointerDataSelectTarget, mSelectNum));
if (dusk::menu_pointer::consume_click()) {
dusk::menu_pointer::defer_activation(
dusk::menu_pointer::Context::FileSelect,
pointer_target(s_pointerDataSelectTarget, mSelectNum));
}
if (mSelectNum != 0xFF && dusk::menu_pointer::hit_pane(mSelFilePanes[mSelectNum], 8.0f) &&
dusk::menu_pointer::consume_click())
{
dusk::menu_pointer::defer_activation(
dusk::menu_pointer::Context::FileSelect,
pointer_target(s_pointerDataSelectTarget, mSelectNum));
}
#endif
bool iVar7 = true;
@@ -1499,14 +1494,12 @@ void dFile_select_c::menuSelectMoveAnm() {
#if TARGET_PC
dusk::menu_pointer::begin_context(dusk::menu_pointer::Context::FileSelect);
if (mSelectMenuNum != 0xFF &&
dusk::menu_pointer::hit_pane(m3mSelPane[mSelectMenuNum], 8.0f))
dusk::menu_pointer::hit_pane(m3mSelPane[mSelectMenuNum], 8.0f) &&
dusk::menu_pointer::consume_click())
{
dusk::menu_pointer::set_hover_target(pointer_target(s_pointerMenuSelectTarget, mSelectMenuNum));
if (dusk::menu_pointer::consume_click()) {
dusk::menu_pointer::defer_activation(
dusk::menu_pointer::Context::FileSelect,
pointer_target(s_pointerMenuSelectTarget, mSelectMenuNum));
}
dusk::menu_pointer::defer_activation(
dusk::menu_pointer::Context::FileSelect,
pointer_target(s_pointerMenuSelectTarget, mSelectMenuNum));
}
#endif
bool tmp1 = true;
@@ -2004,14 +1997,12 @@ void dFile_select_c::copyDataToSelectMoveAnm() {
#if TARGET_PC
dusk::menu_pointer::begin_context(dusk::menu_pointer::Context::FileSelect);
if (field_0x026b != 0xFF &&
dusk::menu_pointer::hit_pane(mCpSelPane[field_0x026b], 8.0f))
dusk::menu_pointer::hit_pane(mCpSelPane[field_0x026b], 8.0f) &&
dusk::menu_pointer::consume_click())
{
dusk::menu_pointer::set_hover_target(pointer_target(s_pointerCopySelectTarget, field_0x026b));
if (dusk::menu_pointer::consume_click()) {
dusk::menu_pointer::defer_activation(
dusk::menu_pointer::Context::FileSelect,
pointer_target(s_pointerCopySelectTarget, field_0x026b));
}
dusk::menu_pointer::defer_activation(
dusk::menu_pointer::Context::FileSelect,
pointer_target(s_pointerCopySelectTarget, field_0x026b));
}
#endif
bool iVar7 = true;
@@ -2531,14 +2522,12 @@ void dFile_select_c::yesNoCursorMoveAnm() {
#if TARGET_PC
dusk::menu_pointer::begin_context(dusk::menu_pointer::Context::FileSelect);
if (field_0x0268 != 0xFF &&
dusk::menu_pointer::hit_pane(mYnSelPane[field_0x0268], 8.0f))
dusk::menu_pointer::hit_pane(mYnSelPane[field_0x0268], 8.0f) &&
dusk::menu_pointer::consume_click())
{
dusk::menu_pointer::set_hover_target(pointer_target(s_pointerYesNoSelectTarget, field_0x0268));
if (dusk::menu_pointer::consume_click()) {
dusk::menu_pointer::defer_activation(
dusk::menu_pointer::Context::FileSelect,
pointer_target(s_pointerYesNoSelectTarget, field_0x0268));
}
dusk::menu_pointer::defer_activation(
dusk::menu_pointer::Context::FileSelect,
pointer_target(s_pointerYesNoSelectTarget, field_0x0268));
}
#endif
bool isYnSelMove = yesnoSelectMoveAnm();
+8 -1
View File
@@ -229,7 +229,7 @@ static void (*item_func_ptr[256])() = {
item_func_F_MAYFLY,
item_func_noentry,
item_func_noentry,
item_func_noentry,
DUSK_IF_ELSE(item_func_WALLET_LV4, item_func_noentry),
item_func_noentry,
item_func_noentry,
item_func_noentry,
@@ -2187,4 +2187,11 @@ int addBombCount(u8 i_bombType, u8 i_addNum) {
return i_addNum;
}
#if TARGET_PC
// HD item functions
void item_func_WALLET_LV4() {
dComIfGs_setWalletSize(3);
}
#endif
u8* dEnemyItem_c::mData;
+4
View File
@@ -221,7 +221,11 @@ dItem_itemResource dItem_data::item_resource[] = {
{"O_gD_kagm", 0x0009, 0x000F, 0x0006, 0x000C,-0x0001, -0x1, -0x1, 0x0031, 0x50, 0x0000},
{"F_gD_rupy", 0x0004,-0x0001,-0x0001, 0x0007,-0x0001, 0x0, -0x1, 0x002D, 0x64, 0x0000},
{"F_gD_rupy", 0x0004,-0x0001,-0x0001, 0x0007,-0x0001, 0x0, -0x1, 0x002D, 0x64, 0x0000},
#if TARGET_PC
{"O_gD_puL4", 0x0001,-0x0001,-0x0001, -0x0001,-0x0001, -0x1, -0x1, 0x00AF, 0x26, 0x0251},
#else
{"F_gD_rupy", 0x0004,-0x0001,-0x0001, 0x0007,-0x0001, 0x0, -0x1, 0x002D, 0x64, 0x0000},
#endif
{"F_gD_rupy", 0x0004,-0x0001,-0x0001, 0x0007,-0x0001, 0x0, -0x1, 0x002D, 0x64, 0x0000},
{"F_gD_rupy", 0x0004,-0x0001,-0x0001, 0x0007,-0x0001, 0x0, -0x1, 0x002D, 0x64, 0x0000},
{"F_gD_rupy", 0x0004,-0x0001,-0x0001, 0x0007,-0x0001, 0x0, -0x1, 0x002D, 0x64, 0x0000},
+1 -1
View File
@@ -118,7 +118,7 @@ static int dKyeff_Create(kankyo_class* i_this) {
if (strcmp(dComIfGp_getStartStageName(), "Name") == 0) {
camera_process_class* camera = dComIfGp_getCamera(0);
OSTime time = DUSK_IF_ELSE(OSGetSystemTime(), OSGetTime());
OSTime time = OSGetTime();
OSTicksToCalendarTime(time, &calendar);
g_env_light.global_wind_influence.vec.x = 1.0f;
+1 -6
View File
@@ -1640,7 +1640,7 @@ void dMap_c::_move(f32 i_centerX, f32 i_centerZ, int i_roomNo, f32 param_3) {
mCenterX += IF_DUSK(dusk::getSettings().game.enableMirrorMode ? -mPackX :) mPackX;
mCenterZ -= mPackZ;
mCenterX += IF_DUSK(dusk::getSettings().game.enableMirrorMode ? -field_0x64 : ) field_0x64;
mCenterX += field_0x64;
mCenterZ += mPackPlusZ;
}
@@ -1649,8 +1649,6 @@ void dMap_c::_move(f32 i_centerX, f32 i_centerZ, int i_roomNo, f32 param_3) {
{
#if DEBUG
field_0x64 = 33830.0f;
#elif TARGET_PC
field_0x64 = dusk::getSettings().game.enableMirrorMode ? 33830.0f : 0.0f;
#else
field_0x64 = 0.0f;
#endif
@@ -1659,9 +1657,6 @@ void dMap_c::_move(f32 i_centerX, f32 i_centerZ, int i_roomNo, f32 param_3) {
f32 temp = (field_0x58 * (f32)(field_0x74 + 4)) * 0.5f;
#if DEBUG
mRightEdgePlus = -(((dMpath_c::getMinZ() - (-127103.67f)) - temp) / field_0x58);
#elif TARGET_PC
mRightEdgePlus = dusk::getSettings().game.enableMirrorMode ? -(((dMpath_c::getMinX() - (-127103.67f)) - temp) / field_0x58) : 0.0f;
#else
mRightEdgePlus = 0.0f;
#endif
+2 -1
View File
@@ -689,6 +689,8 @@ void dMenu_Collect2D_c::screenSet() {
field_0x184[0][3] = 0x199;
} else if (dComIfGs_getWalletSize() == BIG_WALLET) {
field_0x184[0][3] = 0x19a;
} if (dusk::tphd_active() && dComIfGs_getWalletSize() == 3) {
field_0x184[0][3] = 0x19c;
} else {
field_0x184[0][3] = 0x19b;
}
@@ -1960,7 +1962,6 @@ bool dMenu_Collect2D_c::pointerWait() {
if (getItemTag(x, y, true) == 0 || !dusk::menu_pointer::hit_pane(mpSelPm[x][y], 8.0f)) {
continue;
}
dusk::menu_pointer::set_hover_target(static_cast<dusk::menu_pointer::TargetId>(x + y * 7));
if (mCursorX != x || mCursorY != y) {
mDoAud_seStart(Z2SE_SY_MENU_CURSOR_COMMON, NULL, 0, 0);
mCursorX = x;
+1 -24
View File
@@ -914,20 +914,6 @@ void dMenu_DmapBg_c::dMapBgWide() {
void dMenu_DmapBg_c::draw() {
#if TARGET_PC
dMapBgWide();
static bool prevMirror = false; // default state of panes is not mirrored
if(prevMirror != dusk::getSettings().game.enableMirrorMode) {
if(dusk::getSettings().game.enableMirrorMode) {
static_cast<J2DPicture*>(mFloorScreen->search(MULTI_CHAR('rink')))->setMirror(J2DMirror_X);
static_cast<J2DPicture*>(mBaseScreen->search(MULTI_CHAR('map000')))->setMirror(J2DMirror_X);
}
else {
static_cast<J2DPicture*>(mFloorScreen->search(MULTI_CHAR('rink')))->setMirror(MIRROR0);
static_cast<J2DPicture*>(mBaseScreen->search(MULTI_CHAR('map000')))->setMirror(MIRROR0);
}
prevMirror = dusk::getSettings().game.enableMirrorMode;
}
#endif
u32 scissor_left;
@@ -974,15 +960,6 @@ void dMenu_DmapBg_c::draw() {
mpBackTexture->setAlpha(dVar17 * (field_0xdbc * field_0xd9c));
f32 local_28c = mpBackTexture->getBounds().i.x;
#if TARGET_PC
if(dusk::getSettings().game.enableMirrorMode) {
CPaneMgr mgr;
Vec local_94 = mgr.getGlobalVtxCenter(mMapPane, true, 0);
local_28c = (local_94.x * 2.0f) - (local_28c + 0.5f * mpBackTexture->getWidth()) - 0.5f * mpBackTexture->getWidth();
}
#endif
mpBackTexture->setBlackWhite(color_black, color_white);
mpBackTexture->draw(local_28c, field_0xd94 + mpBackTexture->getBounds().i.y, mpBackTexture->getWidth(),
mpBackTexture->getHeight(),
@@ -2004,7 +1981,7 @@ void dMenu_Dmap_c::mapControl() {
f32 temp_f28 = (var_f29 / 100.0f) * var_f31;
f32 sp18 = temp_f28 * cM_ssin(stick_angle);
f32 sp14 = temp_f28 * cM_scos(stick_angle);
mMapCtrl->setPlusZoomCenterX(IF_DUSK(dusk::getSettings().game.enableMirrorMode ? -sp18 :) sp18);
mMapCtrl->setPlusZoomCenterX(sp18);
mMapCtrl->setPlusZoomCenterZ(sp14);
}
+20 -1
View File
@@ -359,7 +359,14 @@ f32 dMenu_StageMapCtrl_c::getPixelStageSizeZ() const {
f32 dMenu_StageMapCtrl_c::getPixelCenterX() const {
f32 var_f31 = dMpath_c::getCenterX();
#if TARGET_PC
if (dusk::getSettings().game.enableMirrorMode) {
return (1.0f / field_0xbc) * (field_0x9c + var_f31);
}
else return (1.0f / field_0xbc) * (field_0x9c - var_f31);
#else
return (1.0f / field_0xbc) * (field_0x9c - var_f31);
#endif
}
f32 dMenu_StageMapCtrl_c::getPixelCenterZ() const {
@@ -418,7 +425,18 @@ inline static f32 rightModeCnvPos(f32 param_0) {
void dMenu_StageMapCtrl_c::cnvPosTo2Dpos(f32 param_0, f32 param_1, f32* param_2,
f32* param_3) const {
if (param_2 != NULL) {
#if TARGET_PC
if (dusk::getSettings().game.enableMirrorMode) {
*param_2 =
(0.5f * field_0x94) + rightModeCnvPos((1.0f / field_0xbc) * (field_0x9c + param_0));
} else {
*param_2 =
(0.5f * field_0x94) + rightModeCnvPos((1.0f / field_0xbc) * (param_0 - field_0x9c));
}
#else
*param_2 = (0.5f * field_0x94) + rightModeCnvPos((1.0f / field_0xbc) * (param_0 - field_0x9c));
#endif
}
if (param_3 != NULL) {
@@ -915,7 +933,8 @@ void dMenu_StageMapCtrl_c::move() {
void dMenu_DmapMapCtrl_c::draw() {
if (field_0xef != 0) {
setPos(field_0xeb, field_0xec, field_0x9c,
setPos(field_0xeb, field_0xec,
IF_DUSK(dusk::getSettings().game.enableMirrorMode ? -field_0x9c :) field_0x9c,
field_0xa0, field_0xbc, true, field_0xd8);
}
}
+15 -10
View File
@@ -931,8 +931,17 @@ void dMenu_Fmap_c::region_map_proc() {
mpDraw2DBack->regionMapMove(mpStick);
int stage_no, room_no;
#if TARGET_PC
f32 arrow_pos_x = mpDraw2DBack->getArrowPos2DX();
if (dusk::getSettings().game.enableMirrorMode) {
arrow_pos_x = mpDraw2DBack->getMirrorPosX(arrow_pos_x, 0.0f);
}
f32 pos_x = arrow_pos_x - mDoGph_gInf_c::getMinXF() - mDoGph_gInf_c::getWidthF() * 0.5f;
#else
f32 pos_x = mpDraw2DBack->getArrowPos2DX() - mDoGph_gInf_c::getMinXF()
- mDoGph_gInf_c::getWidthF() * 0.5f;
#endif
f32 pos_y = mpDraw2DBack->getArrowPos2DY() - mDoGph_gInf_c::getHeightF() * 0.5f;
mpMenuFmapMap->getPointStagePathInnerNo(getNowFmapRegionData(), pos_x, pos_y,
@@ -2477,6 +2486,12 @@ void dMenu_Fmap_c::portalWarpMapMove(STControl* i_stick) {
f32 arrow_y = mpDraw2DBack->getArrowPos2DY();
u8 uVar6 = 0xff;
#if TARGET_PC
if (dusk::getSettings().game.enableMirrorMode) {
arrow_x = mpDraw2DBack->getMirrorPosX(arrow_x, 0.0f);
}
#endif
for (int i = 0; i < portal_dat->mCount; i++) {
if (portals[i].mRegionNo == mpDraw2DBack->getRegionCursor() + 1
@@ -2546,11 +2561,6 @@ void dMenu_Fmap_c::drawIcon(f32 param_0, bool param_1) {
if (mProcess == PROC_PORTAL_DEMO1) {
is_portal_demo1 = 1;
}
#if TARGET_PC
if(dusk::getSettings().game.enableMirrorMode) {
angle = 0x10000 - angle;
}
#endif
mpDraw2DBack->setIcon2DPos(0x11, stage_name, pos.x, pos.z, cM_sht2d(angle),
is_portal_demo1, param_1);
@@ -2639,11 +2649,6 @@ void dMenu_Fmap_c::drawPlayEnterIcon() {
angle = dComIfGs_getPlayerFieldLastStayAngleY();
SAFE_STRCPY(stage_name, dComIfGs_getPlayerFieldLastStayName());
}
#if TARGET_PC
if(dusk::getSettings().game.enableMirrorMode) {
angle = 0x10000 - angle;
}
#endif
mpDraw2DBack->setIcon2DPos(0x15, stage_name, pos.x, pos.z, cM_sht2d(angle), 0, false);
}
}
+19 -73
View File
@@ -426,15 +426,7 @@ void dMenu_Fmap2DBack_c::draw() {
}
mpPointParent->setAlphaRate(mArrowAlpha * mSpotTextureFadeAlpha);
f32 drawX = mArrowPos2DX + mTransX;
#ifdef TARGET_PC
if (dusk::getSettings().game.enableMirrorMode) {
drawX = getMirrorPosX(drawX, 0.0f);
}
#endif
mpPointParent->translate(drawX, mArrowPos2DY + mTransZ);
mpPointParent->translate(mArrowPos2DX + mTransX, mArrowPos2DY + mTransZ);
mpPointScreen->draw(0.0f, 0.0f, grafPort);
}
@@ -753,7 +745,7 @@ void dMenu_Fmap2DBack_c::zoomMapCalc(f32 i_zoom) {
f32 tmp2 = (dVar12 + (i_zoom * (centerX - dVar12)));
f32 tmp2_ = (dVar11 + (i_zoom * (centerY - dVar11)));
field_0xf0c[mRegionCursor] =
((tmp2 + (tmp3 * mZoom)) - mRegionMapSizeX[mRegionCursor] * mZoom * 0.5f) -
mRegionMinMapX[mRegionCursor];
@@ -1026,11 +1018,6 @@ void dMenu_Fmap2DBack_c::allmap_move2(STControl* param_0) {
f32 delta_y = speed * cM_ssin(angle);
f32 delta_x = speed * cM_scos(angle);
#ifdef TARGET_PC
if (dusk::getSettings().game.enableMirrorMode) {
delta_y = -delta_y;
}
#endif
control_xpos = control_xpos + delta_y;
control_ypos = control_ypos + delta_x;
}
@@ -1059,6 +1046,11 @@ void dMenu_Fmap2DBack_c::allmap_move2(STControl* param_0) {
calcAllMapPos2D((mArrowPos3DX + control_xpos) - mStageTransX,
(mArrowPos3DZ + control_ypos) - mStageTransZ, &sp14, &sp10);
#if TARGET_PC
if (dusk::getSettings().game.enableMirrorMode) {
sp14 = getMirrorPosX(sp14, 0.0f);
}
#endif
mSelectRegion = 0xff;
for (int i = 7; i >= 0; i--) {
@@ -1473,12 +1465,6 @@ void dMenu_Fmap2DBack_c::worldGridDraw() {
f32 dVar8 = -mStageTransZ;
calcAllMapPos2D(dVar9, dVar8, &local_74, &local_78);
#if TARGET_PC
if(dusk::getSettings().game.enableMirrorMode) {
local_74 = getMirrorPosX(local_74, 0.0f);
}
#endif
J2DDrawLine(local_74, mDoGph_gInf_c::getMinYF(), local_74,
mDoGph_gInf_c::getMinYF() + mDoGph_gInf_c::getHeightF(),
JUtility::TColor(255, 255, 255, 255), 6);
@@ -1487,11 +1473,6 @@ void dMenu_Fmap2DBack_c::worldGridDraw() {
while (true) {
calcAllMapPos2D(xPos, dVar8, &local_74, &local_78);
if (local_74 >= getMapScissorAreaLX()) {
#if TARGET_PC
if(dusk::getSettings().game.enableMirrorMode) {
local_74 = getMirrorPosX(local_74, 0.0f);
}
#endif
J2DDrawLine(local_74, mDoGph_gInf_c::getMinYF(), local_74,
mDoGph_gInf_c::getMinYF() + mDoGph_gInf_c::getHeightF(),
JUtility::TColor(255, 255, 255, 255), 6);
@@ -1553,12 +1534,6 @@ void dMenu_Fmap2DBack_c::regionGridDraw() {
f32 dVar8 = mRegionOriginZ[mRegionCursor] - mStageTransZ;
calcAllMapPos2D(dVar9, dVar8, &local_74, &local_78);
#if TARGET_PC
if(dusk::getSettings().game.enableMirrorMode) {
local_74 = getMirrorPosX(local_74, 0.0f);
}
#endif
J2DDrawLine(local_74, mDoGph_gInf_c::getMinYF(), local_74,
mDoGph_gInf_c::getMinYF() + mDoGph_gInf_c::getHeightF(),
JUtility::TColor(180, 0, 0, 255), 6);
@@ -1567,12 +1542,6 @@ void dMenu_Fmap2DBack_c::regionGridDraw() {
while (true) {
calcAllMapPos2D(xPos, dVar8, &local_74, &local_78);
if (local_74 >= getMapScissorAreaLX()) {
#if TARGET_PC
if(dusk::getSettings().game.enableMirrorMode) {
local_74 = getMirrorPosX(local_74, 0.0f);
}
#endif
J2DDrawLine(local_74, mDoGph_gInf_c::getMinYF(), local_74,
mDoGph_gInf_c::getMinYF() + mDoGph_gInf_c::getHeightF(),
JUtility::TColor(180, 0, 0, 255), 6);
@@ -1635,12 +1604,6 @@ void dMenu_Fmap2DBack_c::worldOriginDraw() {
f32 local_44, local_48;
calcAllMapPos2D(-mStageTransX, -mStageTransZ, &local_44, &local_48);
#if TARGET_PC
if(dusk::getSettings().game.enableMirrorMode) {
local_44 = getMirrorPosX(local_44, 0.0f);
}
#endif
J2DDrawLine(mDoGph_gInf_c::getMinXF(), local_48 - local_44 + mDoGph_gInf_c::getMinXF(),
mDoGph_gInf_c::getMinXF() + mDoGph_gInf_c::getWidthF(),
local_48 - local_44 + (mDoGph_gInf_c::getMinXF() + mDoGph_gInf_c::getWidthF()),
@@ -1675,13 +1638,6 @@ void dMenu_Fmap2DBack_c::scrollAreaDraw() {
calcAllMapPos2D(x_min - mStageTransX, z_min - mStageTransZ, &local_4c, &local_50);
calcAllMapPos2D(x_max - mStageTransX, z_max - mStageTransZ, &local_54, &local_58);
#if TARGET_PC
if(dusk::getSettings().game.enableMirrorMode) {
local_4c = getMirrorPosX(local_4c, 0.0f);
local_54 = getMirrorPosX(local_54, 0.0f);
}
#endif
J2DDrawLine(local_4c, local_50, local_4c, local_58,
JUtility::TColor(255, 255, 255, 255), 6);
J2DDrawLine(local_54, local_50, local_54, local_58,
@@ -1702,11 +1658,6 @@ void dMenu_Fmap2DBack_c::regionOriginDraw() {
f32 center_x, center_y;
calcAllMapPos2D(mRegionOriginX[i] - mStageTransX, mRegionOriginZ[i] - mStageTransZ,
&center_x, &center_y);
#if TARGET_PC
if(dusk::getSettings().game.enableMirrorMode) {
center_x = getMirrorPosX(center_x - 3.0f, 3.0f);
}
#endif
J2DFillBox(center_x - 3.0f, center_y - 3.0f, 6.0f, 6.0f, JUtility::TColor(255, 0, 0, 255));
}
}
@@ -1724,11 +1675,6 @@ void dMenu_Fmap2DBack_c::stageOriginDraw() {
f32 v1 = mRegionOriginX[mRegionCursor] + stage_data[i].mOffsetX - mStageTransX;
f32 v2 = mRegionOriginZ[mRegionCursor] + stage_data[i].mOffsetZ - mStageTransZ;
calcAllMapPos2D(v1, v2, &center_x, &center_y);
#if TARGET_PC
if(dusk::getSettings().game.enableMirrorMode) {
center_x = getMirrorPosX(center_x - 3.0f, 3.0f);
}
#endif
J2DFillBox(center_x - 3.0f, center_y - 3.0f, 6.0f, 6.0f,
JUtility::TColor(0, 0, 255, 255));
}
@@ -1975,7 +1921,7 @@ void dMenu_Fmap2DBack_c::regionMapMove(STControl* i_stick) {
f32 speed = base_speed / 100.0f * local_78;
f32 speed_y = speed * cM_ssin(angle);
f32 speed_x = speed * cM_scos(angle);
control_xpos += IF_DUSK(dusk::getSettings().game.enableMirrorMode ? -speed_y :) speed_y;
control_xpos += speed_y;
control_ypos += speed_x;
}
}
@@ -2000,6 +1946,11 @@ void dMenu_Fmap2DBack_c::regionMapMove(STControl* i_stick) {
calcAllMapPos2D(mArrowPos3DX + control_xpos - mStageTransX,
mArrowPos3DZ + control_ypos - mStageTransZ, &pos_x, &pos_y);
#if TARGET_PC
if (dusk::getSettings().game.enableMirrorMode) {
pos_x = getMirrorPosX(pos_x, 0.0f);
}
#endif
mSelectRegion = 0xff;
int region = mRegionCursor;
@@ -2031,6 +1982,11 @@ void dMenu_Fmap2DBack_c::stageMapMove(STControl* i_stick, u8 param_1, bool param
if (stick_value >= slow_bound && param_2 && field_0x1238 != 2) {
bVar6 = true;
s16 angle = i_stick->getAngleStick();
#if TARGET_PC
if (dusk::getSettings().game.enableMirrorMode) {
angle = -angle;
}
#endif
f32 local_68 = mTexMaxX - mTexMinX;
f32 spot_zoom = getSpotMapZoomRate();
f32 region_zoom = getRegionMapZoomRate(mRegionCursor);
@@ -2045,7 +2001,7 @@ void dMenu_Fmap2DBack_c::stageMapMove(STControl* i_stick, u8 param_1, bool param
f32 speed = base_speed / 100.0f * local_78;
f32 speed_x = speed * cM_ssin(angle);
f32 speed_z = speed * cM_scos(angle);
mStageTransX += IF_DUSK(dusk::getSettings().game.enableMirrorMode ? -speed_x :) speed_x;
mStageTransX += speed_x;
mStageTransZ += speed_z;
} else if (!param_2) {
return;
@@ -2139,11 +2095,6 @@ void dMenu_Fmap2DBack_c::drawDebugStageArea() {
if (stage_no >= 0) {
f32 v = i + mDoGph_gInf_c::getMinXF();
f32 v2 = j;
#if TARGET_PC
if(dusk::getSettings().game.enableMirrorMode) {
v = getMirrorPosX(v - 3.0f, 3.0f);
}
#endif
J2DFillBox(v - 3.0f, v2 - 3.0f, 6.0f, 6.0f, colors[stage_no % 6]);
}
}
@@ -2179,11 +2130,6 @@ void dMenu_Fmap2DBack_c::drawDebugRegionArea() {
mRegionMapSizeX[region] * mZoom, mRegionMapSizeY[region] * mZoom,
mpAreaTex[region]->getTexture(0)->getTexInfo());
if (u) {
#if TARGET_PC
if(dusk::getSettings().game.enableMirrorMode) {
pos_x = getMirrorPosX(pos_x - 3.0f, 3.0f);
}
#endif
J2DFillBox(pos_x - 3.0f, pos_y - 3.0f, 6.0f, 6.0f, colors[region]);
break;
}
-1
View File
@@ -320,7 +320,6 @@ bool dMenu_Insect_c::pointerWait() {
if (!isGetInsect(x, y) || !dusk::menu_pointer::hit_pane(mpINSParent[index], 8.0f)) {
continue;
}
dusk::menu_pointer::set_hover_target(index);
if (field_0xf4 != x || field_0xf5 != y) {
field_0xf4 = x;
-1
View File
@@ -482,7 +482,6 @@ bool dMenu_Letter_c::pointerWait() {
if (!dusk::menu_pointer::hit_pane(mpLetterParent[i], 8.0f)) {
continue;
}
dusk::menu_pointer::set_hover_target(i);
if (mIndex != i) {
mIndex = i;
+15 -7
View File
@@ -394,8 +394,21 @@ void dMenuMapCommon_c::drawIcon(f32 i_posX, f32 i_posY, f32 param_3, f32 param_4
icon_size_y *= _c7c;
}
#if TARGET_PC
f32 rotation = mIconInfo[info_idx].rotation;
if (dusk::getSettings().game.enableMirrorMode &&
(mIconInfo[info_idx].icon_no == ICON_LINK_e ||
mIconInfo[info_idx].icon_no == ICON_LINK_ENTER_e))
{
rotation = -rotation;
}
mPictures[mIconInfo[info_idx].icon_no]->rotate(icon_size_x / 2, icon_size_y / 2, ROTATE_Z,
rotation);
#else
mPictures[mIconInfo[info_idx].icon_no]->rotate(icon_size_x / 2, icon_size_y / 2, ROTATE_Z,
mIconInfo[info_idx].rotation);
#endif
if (mIconInfo[info_idx].icon_no == ICON_LIGHT_DROP_e) {
mPictures[mIconInfo[info_idx].icon_no]->setAlpha((180.0f * _c80) / 255.0f);
@@ -410,15 +423,10 @@ void dMenuMapCommon_c::drawIcon(f32 i_posX, f32 i_posY, f32 param_3, f32 param_4
}
f32 pos_x = i_posX + (icon_pos_x - (icon_size_x / 2));
bool r4 = false;
#if TARGET_PC
if (dusk::getSettings().game.enableMirrorMode) {
pos_x = getMirrorCenterPosX(i_posX + (icon_pos_x - (icon_size_x / 2)), icon_size_x / 2);
}
if(mIconInfo[info_idx].icon_no == ICON_GOLD_WOLF_e) {
r4 = true;
}
#endif
mPictures[mIconInfo[info_idx].icon_no]->draw(pos_x, (i_posY + (icon_pos_y - icon_size_y / 2)),
@@ -427,7 +435,7 @@ void dMenuMapCommon_c::drawIcon(f32 i_posX, f32 i_posY, f32 param_3, f32 param_4
if (mIconInfo[info_idx].icon_no == ICON_LIGHT_DROP_e) {
mLightDropPic->draw((pos_x + (icon_size_x / 2)) - (var_f29 / 2),
((icon_size_y / 2) + (i_posY + (icon_pos_y - icon_size_y / 2))) - (var_f28 / 2),
var_f29, var_f28, r4, false, false);
var_f29, var_f28, false, false, false);
}
}
}
@@ -861,4 +869,4 @@ void dMenuMapCommon_c::getFmapPoeCount(const int regionNo, int& nowCount, int& t
}
}
}
#endif
#endif
+5 -45
View File
@@ -83,12 +83,6 @@ enum SelectType {
SelectType8,
};
#if TARGET_PC
static dusk::menu_pointer::TargetId option_yes_no_target(u8 index) noexcept {
return static_cast<dusk::menu_pointer::TargetId>(0x100 + index);
}
#endif
dMenu_Option_c::dMenu_Option_c(JKRArchive* i_archive, STControl* i_stick) {
mUseFlag = 0;
mBarScale[0] = g_drawHIO.mOptionScreen.mBarScale[0];
@@ -1104,28 +1098,18 @@ void dMenu_Option_c::confirm_move_move() {
if (!dusk::menu_pointer::hit_pane(mpYesNoSelBase_c[i], 8.0f)) {
continue;
}
dusk::menu_pointer::set_hover_target(option_yes_no_target(i));
const bool clicked = dusk::menu_pointer::consume_click();
if (field_0x3f9 != i) {
Z2GetAudioMgr()->seStart(Z2SE_SY_MENU_CURSOR_COMMON, NULL, 0, 0, 1.0f, 1.0f, -1.0f,
-1.0f, 0);
field_0x3fa = field_0x3f9;
field_0x3f9 = i;
if (clicked) {
yesNoSelectStart();
field_0x3ef = SelectType7;
dMeter2Info_set2DVibrationM();
mpWarning->_move();
setAnimation();
return;
}
yesnoSelectAnmSet();
field_0x3ef = SelectType6;
mpWarning->_move();
setAnimation();
return;
}
if (clicked) {
if (dusk::menu_pointer::consume_click()) {
yesNoSelectStart();
field_0x3ef = SelectType7;
dMeter2Info_set2DVibrationM();
@@ -1172,36 +1156,11 @@ void dMenu_Option_c::confirm_select_init() {
}
void dMenu_Option_c::confirm_select_move() {
#if TARGET_PC
dusk::menu_pointer::begin_context(dusk::menu_pointer::Context::Options);
if (field_0x3f9 != 0xff &&
dusk::menu_pointer::hit_pane(mpYesNoSelBase_c[field_0x3f9], 8.0f))
{
const dusk::menu_pointer::TargetId target = option_yes_no_target(field_0x3f9);
dusk::menu_pointer::set_hover_target(target);
if (dusk::menu_pointer::consume_click()) {
dusk::menu_pointer::defer_activation(dusk::menu_pointer::Context::Options, target);
}
}
#endif
u8 selectMoveAnm = yesnoSelectMoveAnm();
u8 wakuAlphaAnm = yesnoWakuAlpahAnm(field_0x3fa);
if (selectMoveAnm == 1 && wakuAlphaAnm == 1) {
yesnoCursorShow();
#if TARGET_PC
if (field_0x3f9 != 0xff &&
dusk::menu_pointer::consume_deferred_activation(
dusk::menu_pointer::Context::Options, option_yes_no_target(field_0x3f9)))
{
yesNoSelectStart();
field_0x3ef = SelectType7;
dMeter2Info_set2DVibrationM();
mpWarning->_move();
setAnimation();
return;
}
#endif
field_0x3ef = SelectType5;
}
mpWarning->_move();
@@ -2237,14 +2196,16 @@ bool dMenu_Option_c::isRumbleSupported() {
#if TARGET_PC
bool dMenu_Option_c::pointerConfirmSelect() {
dusk::menu_pointer::begin_context(dusk::menu_pointer::Context::Options);
if (!dusk::menu_pointer::state().clicked) {
return false;
}
for (u8 i = 0; i < SelectType3; ++i) {
if (dusk::menu_pointer::hit_pane(mpMenuPane[i], 8.0f)) {
dusk::menu_pointer::set_hover_target(i);
return false;
}
}
dusk::menu_pointer::set_hover_target(0x200);
if (!dusk::menu_pointer::consume_click()) {
return false;
}
@@ -2265,7 +2226,6 @@ bool dMenu_Option_c::dpdMenuMove() {
if (!dusk::menu_pointer::hit_pane(mpMenuPane[i], 8.0f)) {
continue;
}
dusk::menu_pointer::set_hover_target(i);
if (getSelectType() != i) {
field_0x3ef = i;
setCursorPos(i);

Some files were not shown because too many files have changed in this diff Show More