-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Mod] Hyrule Warriors-style Link #665
base: develop
Are you sure you want to change the base?
Changes from 5 commits
6c05fb3
b0b1fd4
2194bc6
7d5030b
f9737f6
6772e21
9aec61b
5155547
ee948f7
a182218
9d427f9
671e6d2
f9c8bb4
d6369ef
e84fb67
22d54f0
cf0b86e
e3f8586
6a8bd95
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#include "HWStyledLink.h" | ||
#include "libultraship/libultraship.h" | ||
#include "2s2h/Enhancements/GameInteractor/GameInteractor.h" | ||
#include "Enhancements/FrameInterpolation/FrameInterpolation.h" | ||
|
||
extern "C" { | ||
#include "z64.h" | ||
#include "z64player.h" | ||
#include "functions.h" | ||
#include "macros.h" | ||
#include "src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" | ||
|
||
extern PlayState* gPlayState; | ||
extern const char* D_801C0B20[28]; | ||
extern SaveContext gSaveContext; | ||
#include "objects/object_link_child/object_link_child.h" | ||
void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction); | ||
void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName); | ||
} | ||
|
||
void UpdateHWStyledLink() { | ||
GameInteractor::Instance->RegisterGameHookForID<GameInteractor::OnPlayerPostLimbDraw>( | ||
PLAYER_LIMB_HEAD, [](Player* player, s32 limbIndex) { | ||
if (CVarGetInteger("gModes.HWStyledLink", 0) && player->currentMask == PLAYER_MASK_NONE && | ||
player->transformation == PLAYER_FORM_HUMAN && INV_CONTENT(ITEM_MASK_KEATON) == ITEM_MASK_KEATON) { | ||
OPEN_DISPS(gPlayState->state.gfxCtx); | ||
Matrix_Push(); | ||
Matrix_RotateYS(14563, MTXMODE_APPLY); | ||
Matrix_RotateZS(-4854, MTXMODE_APPLY); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Matrix_RotateYS and Matrix_RotateZS use 'binangs' (binary angles). Would it be alright to write this as hex? Alternatively, write it in degrees and use the DEG_TO_BINANG(angle) macro There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. tbh these first values were put in there by Proxy, I'll look into converting them tho |
||
Matrix_Translate(300.0f, -250.0f, 77.7f, MTXMODE_APPLY); | ||
Matrix_Scale(0.648f, 0.648f, 0.648f, MTXMODE_APPLY); | ||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gPlayState->state.gfxCtx), | ||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); | ||
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)D_801C0B20[PLAYER_MASK_KEATON - 1]); | ||
Matrix_Pop(); | ||
CLOSE_DISPS(gPlayState->state.gfxCtx); | ||
} | ||
}); | ||
GameInteractor::Instance->RegisterGameHookForID<GameInteractor::OnPlayerPostLimbDraw>( | ||
PLAYER_LIMB_WAIST, [](Player* player, s32 limbIndex) { | ||
if (CVarGetInteger("gModes.HWStyledLink", 0) && player->transformation == PLAYER_FORM_HUMAN && | ||
player->itemAction != PLAYER_IA_MASK_FIERCE_DEITY && | ||
INV_CONTENT(ITEM_MASK_FIERCE_DEITY) == ITEM_MASK_FIERCE_DEITY) { | ||
OPEN_DISPS(gPlayState->state.gfxCtx); | ||
Matrix_Push(); | ||
Matrix_RotateXS(-25000, MTXMODE_APPLY); | ||
Matrix_RotateYS(-2000, MTXMODE_APPLY); | ||
Matrix_RotateZS(-15000, MTXMODE_APPLY); | ||
Matrix_Translate(-85.0f, 658.0f, -165.0f, MTXMODE_APPLY); | ||
Matrix_Scale(0.635f, 0.635f, 0.635f, MTXMODE_APPLY); | ||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(gPlayState->state.gfxCtx), | ||
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); | ||
gSPDisplayList(POLY_OPA_DISP++, (Gfx*)D_801C0B20[PLAYER_MASK_FIERCE_DEITY - 1]); | ||
Matrix_Pop(); | ||
CLOSE_DISPS(gPlayState->state.gfxCtx); | ||
} | ||
}); | ||
} | ||
|
||
void RegisterHWStyledLink() { | ||
UpdateHWStyledLink(); | ||
|
||
GameInteractor::Instance->RegisterGameHook<GameInteractor::OnSceneInit>( | ||
[](s8 sceneId, s8 spawnNum) { UpdateHWStyledLink(); }); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#ifndef GRAPHICS_HW_STYLED_LINK | ||
#define GRAPHICS_HW_STYLED_LINK | ||
|
||
void RegisterHWStyledLink(); | ||
void UpdateHWStyledLink(); | ||
|
||
#endif // GRAPHICS_HW_STYLED_LINK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be easier to understand what this is doing if we write it out in full
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, absolutely, just old habits still sticking around haha