-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c03692
commit 29663cc
Showing
1 changed file
with
43 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,75 @@ | ||
#include "Chroma.hpp" | ||
|
||
#include "hooks/colorizer/Note/ColorManager.hpp" | ||
|
||
#include "ChromaController.hpp" | ||
#include "ChromaObjectData.hpp" | ||
#include "utils/ChromaUtils.hpp" | ||
|
||
#include "colorizer/BombColorizer.hpp" | ||
#include "colorizer/NoteColorizer.hpp" | ||
|
||
#include "GlobalNamespace/ColorExtensions.hpp" | ||
#include "hooks/colorizer/Note/ColorManager.hpp" | ||
#include "GlobalNamespace/BeatEffectSpawner.hpp" | ||
#include "GlobalNamespace/BeatEffectSpawner_InitData.hpp" | ||
#include "GlobalNamespace/MemoryPoolContainer_1.hpp" | ||
#include "GlobalNamespace/LazyCopyHashSet_1.hpp" | ||
|
||
#include "custom-json-data/shared/CustomBeatmapData.h" | ||
#include "GlobalNamespace/AudioTimeSyncController.hpp" | ||
|
||
#include "colorizer/BombColorizer.hpp" | ||
#include "colorizer/NoteColorizer.hpp" | ||
#include "ChromaObjectData.hpp" | ||
#include "custom-json-data/shared/CustomBeatmapData.h" | ||
|
||
using namespace Chroma; | ||
using namespace GlobalNamespace; | ||
|
||
MAKE_HOOK_MATCH(BeatEffectSpawner_HandleNoteDidStartJump, &BeatEffectSpawner::HandleNoteDidStartJump, void, BeatEffectSpawner* self, NoteController* noteController) { | ||
// Do nothing if Chroma shouldn't run | ||
if (!ChromaController::DoChromaHooks()) { | ||
BeatEffectSpawner_HandleNoteDidStartJump(self, noteController); | ||
return; | ||
} | ||
|
||
|
||
// TODO: Transpile to force beat effect | ||
inline bool BeatEffectForce(bool hideNoteSpawnEffect, NoteController* noteController) | ||
{ | ||
auto it = ChromaObjectDataManager::ChromaObjectDatas.find(noteController->noteData); | ||
|
||
if (it != ChromaObjectDataManager::ChromaObjectDatas.end()) { | ||
auto const& chromaData = it->second; | ||
std::optional<bool> disable = chromaData.DisableSpawnEffect; | ||
|
||
if (disable && disable.value()) { | ||
return; | ||
if (disable) { | ||
return !disable.value(); | ||
} | ||
} | ||
|
||
return hideNoteSpawnEffect; | ||
} | ||
|
||
Sombrero::FastColor oldBombColorEffect = self->bombColorEffect; | ||
if (noteController->noteData->colorType == ColorType::None) { | ||
self->bombColorEffect = BombColorizer::GetBombColorizer(noteController)->getColor().Alpha(0.5f); | ||
} else { | ||
ColorManagerColorForType::EnableColorOverride(noteController); | ||
} | ||
BeatEffectSpawner_HandleNoteDidStartJump(self, noteController); | ||
if (noteController->noteData->colorType == ColorType::None) { | ||
self->bombColorEffect = oldBombColorEffect; | ||
MAKE_HOOK_MATCH(BeatEffectSpawner_HandleNoteDidStartJump, &BeatEffectSpawner::HandleNoteDidStartJump, void, BeatEffectSpawner* self, NoteController* noteController) { | ||
// Do nothing if Chroma shouldn't run | ||
if (!ChromaController::DoChromaHooks()) { | ||
BeatEffectSpawner_HandleNoteDidStartJump(self, noteController); | ||
return; | ||
} | ||
|
||
ColorManagerColorForType::DisableColorOverride(); | ||
/// TRANSPILE HERE | ||
// if (self->initData->hideNoteSpawnEffect) | ||
if (BeatEffectForce(self->initData->hideNoteSpawnEffect, noteController)) | ||
{ | ||
return; | ||
} | ||
if (noteController->hidden) | ||
{ | ||
return; | ||
} | ||
if (noteController->noteData->time + 0.1f < self->audioTimeSyncController->songTime) | ||
{ | ||
return; | ||
} | ||
ColorType colorType = noteController->noteData->colorType; | ||
Sombrero::FastColor a = (colorType != ColorType::None) ? self->colorManager->ColorForType(colorType) : self->bombColorEffect; | ||
auto beatEffect = self->beatEffectPoolContainer->Spawn(); | ||
beatEffect->didFinishEvent->Add(self->i_IBeatEffectDidFinishEvent()); | ||
beatEffect->get_transform()->SetPositionAndRotation(noteController->get_worldRotation() * noteController->get_jumpStartPos() - Sombrero::FastVector3(0.f, 0.15f, 0.f), Sombrero::FastQuaternion::identity()); | ||
beatEffect->Init(a * 1.f, self->effectDuration, noteController->get_worldRotation()); | ||
} | ||
|
||
void BeatEffectSpawnerHook(Logger& logger) { | ||
// TODO: DO TODO ABOVE | ||
// INSTALL_HOOK(logger, BeatEffectSpawner_HandleNoteDidStartJump); | ||
INSTALL_HOOK_ORIG(logger, BeatEffectSpawner_HandleNoteDidStartJump); | ||
} | ||
|
||
ChromaInstallHooks(BeatEffectSpawnerHook) |