Added origin adjustment for item equip animation in pause screen, disabled some WIP patches

This commit is contained in:
Mr-Wiseguy 2023-12-24 02:01:22 -05:00
parent 1a6af79048
commit 899bbb205e
4 changed files with 81 additions and 10 deletions

View File

@ -1,8 +1,8 @@
#include "patches.h"
#include "input.h"
#include "z64quake.h"
RecompCameraMode recomp_camera_mode = RECOMP_CAMERA_DUALANALOG;
#if 0
RecompCameraMode recomp_camera_mode = RECOMP_CAMERA_NORMAL;
VecGeo recomp_camera_pos = { .r = 66.0f, .pitch = 0, .yaw = 0 };
@ -272,11 +272,6 @@ Vec3s Camera_Update(Camera* camera) {
}
// Call the camera update function
recomp_printf(
"Camera:\n"
" setting: %d\n"
" mode: %d\n"
" funcId: %d\n", camera->setting, camera->mode, sCameraSettings[camera->setting].cameraModes[camera->mode].funcId);
sCameraUpdateHandlers[sCameraSettings[camera->setting].cameraModes[camera->mode].funcId](camera);
// @recomp
@ -411,8 +406,6 @@ s32 Camera_Normal1(Camera* camera) {
f32 phi_f2;
f32 rand;
recomp_printf("Camera_Normal1\n");
roData->unk_00 = GET_NEXT_RO_DATA(values) * (sp88 * 0.01f * (0.8f - ((68.0f / sp88) * -0.2f)));
roData->unk_04 = GET_NEXT_RO_DATA(values) * (sp88 * 0.01f * (0.8f - ((68.0f / sp88) * -0.2f)));
roData->unk_08 = GET_NEXT_RO_DATA(values) * (sp88 * 0.01f * (0.8f - ((68.0f / sp88) * -0.2f)));
@ -790,3 +783,4 @@ s32 Camera_Normal1(Camera* camera) {
return true;
}
#endif // #if 0

View File

@ -29,6 +29,49 @@ s32 func_800BA2FC(PlayState* play, Actor* actor, Vec3f* projectedPos, f32 projec
return false;
}
// Disable frustum culling for bush spawning
// s32 EnWood02_SpawnZoneCheck(EnWood02* this, PlayState* play, Vec3f* arg2) {
// f32 phi_f12;
// SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, arg2, &this->actor.projectedPos, &this->actor.projectedW);
// if (this->actor.projectedW == 0.0f) {
// phi_f12 = 1000.0f;
// } else {
// phi_f12 = fabsf(1.0f / this->actor.projectedW);
// }
// if (((-this->actor.uncullZoneScale < this->actor.projectedPos.z) &&
// (this->actor.projectedPos.z < (this->actor.uncullZoneForward + this->actor.uncullZoneScale)) /* &&
// (((fabsf(this->actor.projectedPos.x) - this->actor.uncullZoneScale) * phi_f12) < 1.0f)) &&
// (((this->actor.projectedPos.y + this->actor.uncullZoneDownward) * phi_f12) > -1.0f) &&
// (((this->actor.projectedPos.y - this->actor.uncullZoneScale) * phi_f12) < 1.0f */)) {
// return true;
// }
// return false;
// }
// Disable frustum culling for grass
s32 func_809A9110(PlayState* play, Vec3f* pos) {
f32 w;
Vec3f projectedPos;
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, pos, &projectedPos, &w);
if ((play->projectionMtxFDiagonal.z * -130.13191f) < projectedPos.z) {
if (w < 1.0f) {
w = 1.0f;
}
// if (((fabsf(projectedPos.x) - (130.13191f * play->projectionMtxFDiagonal.x)) < w) &&
// ((fabsf(projectedPos.y) - (130.13191f * play->projectionMtxFDiagonal.y)) < w)) {
return true;
// }
}
return false;
}
// Override LOD to 0
void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList,
OverrideLimbDrawFlex overrideLimbDraw) {

View File

@ -1,6 +1,6 @@
#include "patches.h"
#include "input.h"
#if 0
u32 sPlayerItemButtons[] = {
BTN_B,
BTN_CLEFT,
@ -154,3 +154,4 @@ ItemId Player_GetItemOnButton(PlayState* play, Player* player, EquipSlot slot) {
return C_BTN_ITEM(EQUIP_SLOT_C_RIGHT);
}
*/
#endif // #if 0

View File

@ -389,6 +389,39 @@ void Interface_Draw(PlayState* play) {
Interface_DrawAButton(play);
// @recomp Move the item being equipped from the center of the screen to the right edge as the timer counts down
if (gKaleidoMgrOverlayTable[0].loadedRamAddr != NULL) {
// These are overlay symbols, so their addresses need to be offset to get their actual loaded vram address.
// TODO remove this once the recompiler is able to handle overlay symbols automatically for patch functions.
extern s16 sEquipAnimTimer;
extern s16 sMaskEquipAnimTimer;
extern s16 sEquipState;
extern s16 sMaskEquipState;
s16 equip_timer = *(s16*)((u8*)&sEquipAnimTimer + gKaleidoMgrOverlayTable[0].offset);
s16 mask_equip_timer = *(s16*)((u8*)&sMaskEquipAnimTimer + gKaleidoMgrOverlayTable[0].offset);
s16 equip_state = *(s16*)((u8*)&sEquipState + gKaleidoMgrOverlayTable[0].offset);
s16 mask_equip_state = *(s16*)((u8*)&sMaskEquipState + gKaleidoMgrOverlayTable[0].offset);
s16 timer = MIN(equip_timer, mask_equip_timer);
s32 max_timer = 10;
// Prevent the timer from being used to calculate the origin when an arrow effect is taking place.
if (equip_timer < 10 && equip_state != EQUIP_STATE_MOVE_TO_C_BTN) {
timer = 10;
}
// Adjust the max timer value if a magic arrow is being equipped.
if ((pauseCtx->equipTargetItem == ITEM_BOW_FIRE) ||
(pauseCtx->equipTargetItem == ITEM_BOW_ICE) ||
(pauseCtx->equipTargetItem == ITEM_BOW_LIGHT)) {
max_timer = 6;
}
s32 origin = (G_EX_ORIGIN_CENTER - G_EX_ORIGIN_RIGHT) * (timer - 1) / (max_timer - 1) + G_EX_ORIGIN_RIGHT;
s32 offset = (SCREEN_WIDTH / 2) * (timer - 1) / (max_timer - 1) - SCREEN_WIDTH;
gEXSetRectAlign(OVERLAY_DISP++, origin, origin, offset * 4, 0, offset * 4, 0);
gEXSetViewportAlign(OVERLAY_DISP++, origin, offset * 4, 0);
}
Interface_DrawPauseMenuEquippingIcons(play);
// Draw either the minigame countdown or the three-day clock