mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-09-10 03:01:56 -04:00
Merge remote-tracking branch 'origin/main' into feature/autosave
# Conflicts: # src/dusk/imgui/ImGuiConsole.cpp
This commit is contained in:
@@ -4258,6 +4258,12 @@ int daAlink_c::createHeap() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
// lets try to zero-initialize the arrays instead of having garbage values
|
||||
std::memset(sp1C, 0, sizeof(J3DTransformInfo) * sp38);
|
||||
std::memset(sp30, 0, sizeof(Quaternion) * sp38);
|
||||
#endif
|
||||
|
||||
field_0x2060 = JKR_NEW mDoExt_MtxCalcOldFrame(sp1C, sp30);
|
||||
if (field_0x2060 == NULL) {
|
||||
return 0;
|
||||
|
||||
+119
-1
@@ -12,6 +12,7 @@
|
||||
|
||||
#if TARGET_PC
|
||||
#include "dusk/dvd_asset.hpp"
|
||||
#include "dusk/frame_interpolation.h"
|
||||
static u8* l_Egnd_mantTEX_get() { alignas(32) static u8 buf[0x4000]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", 0x1C00, 0x4000), true); return buf; }
|
||||
static u8* l_Egnd_mantTEX_U_get() { alignas(32) static u8 buf[0x4000]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", 0x5C00, 0x4000), true); return buf; }
|
||||
static u8* l_Egnd_mantPAL_get() { alignas(32) static u8 buf[0x60]; static bool _ = (dusk::LoadRelAsset(buf, "/rel/Final/Release/d_a_mant.rel", 0x9C00, 0x60), true); return buf; }
|
||||
@@ -267,6 +268,37 @@ static void* tex_d[2] = {
|
||||
|
||||
static char lbl_277_bss_0;
|
||||
|
||||
#if TARGET_PC
|
||||
static void mant_build_anchor_frame(const cXyz& anchor_a, const cXyz& anchor_b, Mtx out) {
|
||||
cXyz axis_x = anchor_b - anchor_a;
|
||||
if (!axis_x.normalizeRS()) {
|
||||
axis_x = cXyz::BaseX;
|
||||
}
|
||||
|
||||
cXyz helper = fabsf(axis_x.y) > 0.95f ? cXyz::BaseZ : cXyz::BaseY;
|
||||
cXyz axis_z = axis_x.getCrossProduct(helper);
|
||||
if (!axis_z.normalizeRS()) {
|
||||
axis_z = cXyz::BaseZ;
|
||||
}
|
||||
|
||||
cXyz axis_y = axis_z.getCrossProduct(axis_x);
|
||||
if (!axis_y.normalizeRS()) {
|
||||
axis_y = cXyz::BaseY;
|
||||
}
|
||||
|
||||
const cXyz center = anchor_a + ((anchor_b - anchor_a) * 0.5f);
|
||||
|
||||
const cXyz col[3] = { axis_x, axis_y, axis_z };
|
||||
const f32 t[3] = { center.x, center.y, center.z };
|
||||
for (int r = 0; r < 3; ++r) {
|
||||
out[r][0] = (&col[0].x)[r];
|
||||
out[r][1] = (&col[1].x)[r];
|
||||
out[r][2] = (&col[2].x)[r];
|
||||
out[r][3] = t[r];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void daMant_packet_c::draw() {
|
||||
#if TARGET_PC
|
||||
void* image = l_Egnd_mantTEX;
|
||||
@@ -290,8 +322,72 @@ void daMant_packet_c::draw() {
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_NRM, GX_CLR_RGB, GX_F32, 0);
|
||||
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_F32, 0);
|
||||
|
||||
#if TARGET_PC
|
||||
cXyz* draw_pos = &this->mNrm[0][0];
|
||||
{
|
||||
const u8 curr_buffer = this->field_0x74;
|
||||
const cXyz* curr_pos = &this->mPos[curr_buffer][0];
|
||||
const MtxP curr_frame = curr_buffer == 0 ? this->mMtx : this->mMtx2;
|
||||
|
||||
Mtx curr_frame_inverse;
|
||||
MTXInverse(curr_frame, curr_frame_inverse);
|
||||
|
||||
const u8 prev_buffer = curr_buffer ^ 1;
|
||||
const cXyz* prev_pos = &this->mPos[prev_buffer][0];
|
||||
Mtx prev_frame_inverse;
|
||||
MTXInverse(prev_buffer == 0 ? this->mMtx : this->mMtx2, prev_frame_inverse);
|
||||
|
||||
Mtx presented_frame;
|
||||
MTXCopy(curr_frame, presented_frame);
|
||||
|
||||
mant_class* mant_p = reinterpret_cast<mant_class*>(reinterpret_cast<u8*>(this) - offsetof(mant_class, field_0x0570));
|
||||
if (mant_p != NULL) {
|
||||
b_gnd_class* parent = (b_gnd_class*)fopAcM_SearchByID(mant_p->parentActorID);
|
||||
if (parent != NULL && parent->mpModelMorf != NULL) {
|
||||
J3DModel* model = parent->mpModelMorf->getModel();
|
||||
if (model != NULL) {
|
||||
MtxP src34 = model->getAnmMtx(34);
|
||||
MtxP src25 = model->getAnmMtx(25);
|
||||
Mtx joint_34_scratch;
|
||||
Mtx joint_25_scratch;
|
||||
MtxP joint_34 = dusk::frame_interp::lookup_replacement(src34, joint_34_scratch) ? joint_34_scratch : src34;
|
||||
MtxP joint_25 = dusk::frame_interp::lookup_replacement(src25, joint_25_scratch) ? joint_25_scratch : src25;
|
||||
|
||||
cXyz presented_anchor_a;
|
||||
cXyz presented_anchor_b;
|
||||
cXyz local_offset;
|
||||
|
||||
MTXCopy(joint_34, *calc_mtx);
|
||||
local_offset.set(10.0f, 5.0f, -17.0f);
|
||||
MtxPosition(&local_offset, &presented_anchor_a);
|
||||
|
||||
MTXCopy(joint_25, *calc_mtx);
|
||||
local_offset.set(10.0f, 5.0f, 17.0f);
|
||||
MtxPosition(&local_offset, &presented_anchor_b);
|
||||
|
||||
mant_build_anchor_frame(presented_anchor_a, presented_anchor_b, presented_frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const f32 step = dusk::frame_interp::get_interpolation_step();
|
||||
for (int i = 0; i < 169; ++i) {
|
||||
cXyz curr_local;
|
||||
MTXMultVec(curr_frame_inverse, &curr_pos[i], &curr_local);
|
||||
|
||||
cXyz prev_local;
|
||||
MTXMultVec(prev_frame_inverse, &prev_pos[i], &prev_local);
|
||||
cXyz local = prev_local + ((curr_local - prev_local) * step);
|
||||
|
||||
MTXMultVec(presented_frame, &local, &draw_pos[i]);
|
||||
}
|
||||
}
|
||||
GXSETARRAY(GX_VA_POS, draw_pos, sizeof(mNrm[0]), 12, true);
|
||||
GXSETARRAY(GX_VA_NRM, &l_normal, sizeof(l_normal), 12, false);
|
||||
#else
|
||||
GXSETARRAY(GX_VA_POS, this->getPos(), sizeof(mPos[0]), 12, true);
|
||||
GXSETARRAY(GX_VA_NRM, this->getNrm(), sizeof(mNrm[0]), 12, true);
|
||||
#endif
|
||||
GXSETARRAY(GX_VA_TEX0, &l_texCoord, sizeof(l_texCoord), 8, false); // TODO: set to true when converted to float literals
|
||||
|
||||
GXSetZCompLoc(0);
|
||||
@@ -329,9 +425,14 @@ void daMant_packet_c::draw() {
|
||||
|
||||
GXSetCullMode(GX_CULL_BACK);
|
||||
|
||||
GXLoadPosMtxImm(this->mMtx, GX_PNMTX0);
|
||||
Mtx MStack_54;
|
||||
#if TARGET_PC
|
||||
GXLoadPosMtxImm(j3dSys.getViewMtx(), GX_PNMTX0);
|
||||
cMtx_inverseTranspose(j3dSys.getViewMtx(), MStack_54);
|
||||
#else
|
||||
GXLoadPosMtxImm(this->mMtx, GX_PNMTX0);
|
||||
cMtx_inverseTranspose(this->mMtx, MStack_54);
|
||||
#endif
|
||||
|
||||
GXLoadNrmMtxImm(MStack_54, GX_PNMTX0);
|
||||
GXCallDisplayList(l_Egnd_mantDL, 0x3e0);
|
||||
@@ -347,8 +448,13 @@ void daMant_packet_c::draw() {
|
||||
GXSetTevKColor(GX_KCOLOR0, COMPOUND_LITERAL(GXColor){0, 0, 0, 0});
|
||||
|
||||
GXSetCullMode(GX_CULL_FRONT);
|
||||
#if TARGET_PC
|
||||
GXLoadPosMtxImm(j3dSys.getViewMtx(), GX_PNMTX0);
|
||||
cMtx_inverseTranspose(j3dSys.getViewMtx(), MStack_54);
|
||||
#else
|
||||
GXLoadPosMtxImm(this->mMtx2, GX_PNMTX0);
|
||||
cMtx_inverseTranspose(this->mMtx2, MStack_54);
|
||||
#endif
|
||||
|
||||
GXLoadNrmMtxImm(MStack_54, GX_PNMTX0);
|
||||
GXCallDisplayList(l_Egnd_mantDL, 0x3e0);
|
||||
@@ -360,11 +466,13 @@ void daMant_packet_c::draw() {
|
||||
static int daMant_Draw(mant_class* i_this) {
|
||||
g_env_light.settingTevStruct(0, &i_this->current.pos, &i_this->tevStr);
|
||||
|
||||
#if !TARGET_PC
|
||||
MtxTrans(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
|
||||
cMtx_concat(j3dSys.getViewMtx(), *calc_mtx, i_this->field_0x0570.getMtx());
|
||||
|
||||
cMtx_concat(j3dSys.getViewMtx(), *calc_mtx, i_this->field_0x0570.getMtx2());
|
||||
#endif
|
||||
|
||||
i_this->field_0x0570.setTevStr(&i_this->tevStr);
|
||||
|
||||
@@ -635,8 +743,13 @@ static void mant_v_calc(mant_class* i_this) {
|
||||
}
|
||||
|
||||
static void mant_move(mant_class* i_this) {
|
||||
#if TARGET_PC
|
||||
u8 uVar1 = i_this->field_0x0570.field_0x74 ^ 1;
|
||||
cXyz* pcVar5 = &i_this->field_0x0570.mPos[uVar1][0];
|
||||
#else
|
||||
u8 uVar1 = i_this->field_0x0570.field_0x74;
|
||||
cXyz* pcVar5 = i_this->field_0x0570.getPos();
|
||||
#endif
|
||||
mant_v_calc(i_this);
|
||||
for (int i = 0; i < 13; i++) {
|
||||
for (int j = 0; j < 13; j++) {
|
||||
@@ -644,7 +757,12 @@ static void mant_move(mant_class* i_this) {
|
||||
}
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
mant_build_anchor_frame(i_this->field_0x3928[0], i_this->field_0x3928[1], uVar1 == 0 ? i_this->field_0x0570.mMtx : i_this->field_0x0570.mMtx2);
|
||||
i_this->field_0x0570.field_0x74 = uVar1;
|
||||
#else
|
||||
DCStoreRangeNoSync(i_this->field_0x0570.getPos(), 0x7ec);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int mant_cut_type;
|
||||
|
||||
@@ -147,7 +147,7 @@ void dBrightCheck_c::modeMove() {
|
||||
void dBrightCheck_c::brightCheckWide() {
|
||||
// Main Canvas
|
||||
mBrightCheck.Scr->scale(mDoGph_gInf_c::hudAspectScaleUp, 1.0f);
|
||||
mBrightCheck.Scr->translate(mDoGph_gInf_c::getMinXF(), 0.0f);
|
||||
mBrightCheck.Scr->translate(mDoGph_gInf_c::getSafeMinXF(), 0.0f);
|
||||
|
||||
// Right Square
|
||||
mBrightCheck.Scr->search(MULTI_CHAR('fuchi_1'))->scale(mDoGph_gInf_c::hudAspectScaleDown, 1.0f);
|
||||
|
||||
@@ -3776,7 +3776,7 @@ bool dFile_select_c::yesnoWakuAlpahAnm(u8 param_1) {
|
||||
#if TARGET_PC
|
||||
void dFile_select_c::fileSelectWide() {
|
||||
mYnSel.ScrYn->scale(mDoGph_gInf_c::hudAspectScaleUp, 1.0f);
|
||||
mYnSel.ScrYn->translate(mDoGph_gInf_c::getMinXF(), 0.0f);
|
||||
mYnSel.ScrYn->translate(mDoGph_gInf_c::getSafeMinXF(), 0.0f);
|
||||
|
||||
mYnSel.ScrYn->search(MULTI_CHAR('w_no_t'))->scale(mDoGph_gInf_c::hudAspectScaleDown, 1.0f);
|
||||
mYnSel.ScrYn->search(MULTI_CHAR('f_no_t'))->scale(mDoGph_gInf_c::hudAspectScaleDown, 1.0f);
|
||||
@@ -3784,7 +3784,7 @@ void dFile_select_c::fileSelectWide() {
|
||||
mYnSel.ScrYn->search(MULTI_CHAR('f_yes_t'))->scale(mDoGph_gInf_c::hudAspectScaleDown, 1.0f);
|
||||
|
||||
m3mSel.Scr3m->scale(mDoGph_gInf_c::hudAspectScaleUp, 1.0f);
|
||||
m3mSel.Scr3m->translate(mDoGph_gInf_c::getMinXF(), 0.0f);
|
||||
m3mSel.Scr3m->translate(mDoGph_gInf_c::getSafeMinXF(), 0.0f);
|
||||
|
||||
m3mSel.Scr3m->search(MULTI_CHAR('w_sta'))->scale(mDoGph_gInf_c::hudAspectScaleDown, 1.0f);
|
||||
m3mSel.Scr3m->search(MULTI_CHAR('f_sta'))->scale(mDoGph_gInf_c::hudAspectScaleDown, 1.0f);
|
||||
@@ -3794,7 +3794,7 @@ void dFile_select_c::fileSelectWide() {
|
||||
m3mSel.Scr3m->search(MULTI_CHAR('f_cop_t'))->scale(mDoGph_gInf_c::hudAspectScaleDown, 1.0f);
|
||||
|
||||
fileSel.Scr->scale(mDoGph_gInf_c::hudAspectScaleUp, 1.0f);
|
||||
fileSel.Scr->translate(mDoGph_gInf_c::getMinXF(), 0.0f);
|
||||
fileSel.Scr->translate(mDoGph_gInf_c::getSafeMinXF(), 0.0f);
|
||||
|
||||
fileSel.Scr->search(MULTI_CHAR('t_for'))->scale(mDoGph_gInf_c::hudAspectScaleDown, 1.0f);
|
||||
fileSel.Scr->search(MULTI_CHAR('t_for1'))->scale(mDoGph_gInf_c::hudAspectScaleDown, 1.0f);
|
||||
@@ -5584,7 +5584,13 @@ void dFile_select3D_c::createMirrorModel() {
|
||||
void dFile_select3D_c::toItem3Dpos(f32 param_0, f32 param_1, f32 param_2, cXyz* param_3) {
|
||||
Mtx adStack_98;
|
||||
Mtx auStack_c8;
|
||||
#if TARGET_PC
|
||||
param_0 =
|
||||
(2.0f * ((param_0 - mDoGph_gInf_c::getSafeMinXF()) / mDoGph_gInf_c::getSafeWidthF()) -
|
||||
1.0f);
|
||||
#else
|
||||
param_0 = (2.0f * ((param_0 - mDoGph_gInf_c::getMinXF()) / mDoGph_gInf_c::getWidthF()) - 1.0f);
|
||||
#endif
|
||||
param_1 = (2.0f * ((param_1 - -100.0f) / FB_HEIGHT_BASE) - 1.0f);
|
||||
calcViewMtx(adStack_98);
|
||||
cMtx_inverse(adStack_98, auStack_c8);
|
||||
@@ -5601,4 +5607,3 @@ void dFile_select3D_c::calcViewMtx(Mtx param_0) {
|
||||
cXyz pos2(0.0f, 1.0f, 0.0f);
|
||||
cMtx_lookAt(param_0, &pos1, &cXyz::Zero, &pos2, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ dMenu_Collect2D_c::~dMenu_Collect2D_c() {
|
||||
void dMenu_Collect2D_c::menuCollectWide() {
|
||||
// Main Canvas
|
||||
mpScreen->scale(mDoGph_gInf_c::hudAspectScaleUp, 1.0f);
|
||||
mpScreen->translate(mDoGph_gInf_c::getMinXF(), 0.0f);
|
||||
mpScreen->translate(mDoGph_gInf_c::getSafeMinXF(), 0.0f);
|
||||
|
||||
// Pieces of Heart
|
||||
mpScreen->search(MULTI_CHAR('heart_n'))->scale(mDoGph_gInf_c::hudAspectScaleDown, 1.0f);
|
||||
@@ -182,7 +182,7 @@ void dMenu_Collect2D_c::_create() {
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
mpScreenIcon->translate(-mDoGph_gInf_c::getMinXF(), 0.0f);
|
||||
mpScreenIcon->translate(-mDoGph_gInf_c::getSafeMinXF(), 0.0f);
|
||||
#endif
|
||||
|
||||
dPaneClass_showNullPane(mpScreenIcon);
|
||||
@@ -2706,8 +2706,14 @@ void dMenu_Collect3D_c::setupItem3D(Mtx param_0) {
|
||||
void dMenu_Collect3D_c::toItem3Dpos(f32 param_0, f32 param_1, f32 param_2, cXyz* param_3) {
|
||||
Mtx adStack_98;
|
||||
Mtx auStack_c8;
|
||||
#if TARGET_PC
|
||||
param_0 =
|
||||
(2.0f * ((param_0 - mDoGph_gInf_c::getSafeMinXF()) / mDoGph_gInf_c::getSafeWidthF()) -
|
||||
1.0f);
|
||||
#else
|
||||
param_0 =
|
||||
(2.0f * ((param_0 - mDoGph_gInf_c::getMinXF()) / mDoGph_gInf_c::getWidthF()) - 1.0f);
|
||||
#endif
|
||||
param_1 = (2.0f * ((param_1 - -100.0f) / FB_HEIGHT_BASE) - 1.0f);
|
||||
calcViewMtx(adStack_98);
|
||||
MTXInverse(adStack_98, auStack_c8);
|
||||
|
||||
@@ -2779,7 +2779,7 @@ void dMenu_save_c::_draw() {
|
||||
#if TARGET_PC
|
||||
void dMenu_save_c::menuSaveWide() {
|
||||
mSaveSel.Scr->scale(mDoGph_gInf_c::hudAspectScaleUp, 1.0f);
|
||||
mSaveSel.Scr->translate(mDoGph_gInf_c::getMinXF(), 0.0f);
|
||||
mSaveSel.Scr->translate(mDoGph_gInf_c::getSafeMinXF(), 0.0f);
|
||||
|
||||
mSaveSel.Scr->search(MULTI_CHAR('t_for'))->scale(mDoGph_gInf_c::hudAspectScaleDown, 1.0f);
|
||||
mSaveSel.Scr->search(MULTI_CHAR('t_for1'))->scale(mDoGph_gInf_c::hudAspectScaleDown, 1.0f);
|
||||
|
||||
Reference in New Issue
Block a user