Merge branch 'main' of https://github.com/TwilitRealm/dusk into randomizer

This commit is contained in:
gymnast86
2026-04-24 22:42:18 -07:00
8 changed files with 96 additions and 39 deletions
+1 -1
+11
View File
@@ -18944,11 +18944,20 @@ void daAlink_c::setDrawHand() {
mpLinkHandModel->setBaseTRMtx(mpLinkModel->getBaseTRMtx());
mpLinkHandModel->calc();
#if TARGET_PC
// FRAME INTERP NOTE: Always set these, otherwise the hands occasionally zip to origin.
// Doing it regardless of interpolation being active seems harmless.
mpLinkHandModel->setAnmMtx(1, mpLinkModel->getAnmMtx(9));
mpLinkHandModel->setAnmMtx(2, mpLinkModel->getAnmMtx(0xE));
#endif
if (var_r30 == 0xFE || var_r30 == 0xFB) {
field_0x06d0 = field_0x06d8;
} else {
field_0x06d0 = mpLinkHandModel->getModelData()->getMaterialNodePointer(var_r30)->getShape();
#if !TARGET_PC
mpLinkHandModel->setAnmMtx(1, mpLinkModel->getAnmMtx(9));
#endif
}
if (var_r30 == 0xFB) {
@@ -18967,7 +18976,9 @@ void daAlink_c::setDrawHand() {
field_0x06d4 = field_0x06dc;
} else {
field_0x06d4 = mpLinkHandModel->getModelData()->getMaterialNodePointer(var_r29)->getShape();
#if !TARGET_PC
mpLinkHandModel->setAnmMtx(2, mpLinkModel->getAnmMtx(0xE));
#endif
}
if (var_r29 == 0xFB) {
-7
View File
@@ -84,13 +84,6 @@ void dMirror_packet_c::calcMinMax() {
}
int dMirror_packet_c::entryModel(J3DModel* i_model) {
#if TARGET_PC
if (mbReset) {
mModelCount = 0;
mbReset = false;
}
#endif
if (mModelCount >= 0x40) {
return 0;
}
+2 -2
View File
@@ -265,7 +265,7 @@ int daObjDrop_c::modeParentWait() {
mModeAction = 1;
#if TARGET_PC
mModeTimer = dusk::getSettings().game.fastTears && dComIfGp_event_getMode() == 0 ? 20 : 40;
mModeTimer = dusk::getSettings().game.fastTears && dComIfGp_event_getMode() == 0 ? 0 : 40;
if (dusk::getSettings().game.fastTears && dComIfGp_event_getMode() == 0) {
current.pos.y += 100.0f;
} else {
@@ -285,7 +285,7 @@ int daObjDrop_c::modeParentWait() {
case 2:
createBodyEffect();
#if TARGET_PC
mModeTimer = dusk::getSettings().game.fastTears && dComIfGp_event_getMode() == 0 ? 5 : 45;
mModeTimer = dusk::getSettings().game.fastTears && dComIfGp_event_getMode() == 0 ? 0 : 45;
#else
mModeTimer = 45;
#endif
+6 -1
View File
@@ -1972,7 +1972,12 @@ void dPa_light8PcallBack::draw(JPABaseEmitter* param_1, JPABaseParticle* param_2
JGeometry::TVec3<f32> local_154;
JGeometry::TVec3<f32> local_160;
JGeometry::TVec3<f32> local_16c;
dPa_setWindPower(param_2);
#if TARGET_PC
if (dusk::frame_interp::is_sim_frame())
#endif
{
dPa_setWindPower(param_2);
}
MTXIdentity(local_60);
MTXIdentity(auStack_90);
param_2->getBaseAxis(&local_10c);
-4
View File
@@ -102,11 +102,7 @@ static void setIndirectTex(J3DModelData* i_modelData) {
texture->setResTIMG(i, *mDoGph_gInf_c::getFrameBufferTimg());
}
if (memcmp(textureName, "Zbuffer", 8) == 0) {
#if !TARGET_PC
texture->setResTIMG(i, *mDoGph_gInf_c::getZbufferTimg());
#else
DuskLog.warn("Zbuffer texture binding not yet supported");
#endif
}
}
}
+76 -20
View File
@@ -1347,6 +1347,51 @@ namespace dusk {
}
}
template <typename T>
concept FlagIter = requires(T t) {
++t;
--t;
t + 1;
t < t;
{ t->flagID } -> std::convertible_to<u16>;
};
template <typename T>
concept FlagTester = requires(T t, u16 flagID) {
{ t(flagID) } -> std::convertible_to<bool>;
};
static void sortByFlags(FlagIter auto begin, FlagIter auto end, FlagTester auto&& flagTester) {
if (begin == end) return;
FlagIter auto fullEnd = end;
// We want to find the location of where we can swap our `On` flags to.
// We're gonna put the `Off` bits first, and the `On` bits last. 0 < 1
// We can achieve this by skipping all the `On` bits at the end.
// backtrack until we find a bit that is off
while (begin < --end && flagTester(end->flagID)) {
// move the end pointer back while we find on bits
}
// end should now be pointing to a bit that is off
while (begin < end) {
// if there's a flag that's on
if (flagTester(begin->flagID)) {
// move it to the end
std::rotate(begin, begin + 1, fullEnd);
// move back the end of where we're checking
--end;
// begin will now point to the next piece of data
// because we've rotated the data >= begin to the left
} else {
// not on, check next flag
++begin;
}
}
}
void ImGuiSaveEditor::drawFlagsTab() {
if (ImGui::TreeNode("Current Region Flags")) {
dSv_memBit_c& membit = g_dComIfG_gameInfo.info.mMemory.mBit;
@@ -1446,30 +1491,41 @@ namespace dusk {
sort != nullptr && sort->SpecsCount > 0 &&
(sort->SpecsDirty || sort->Specs[0].ColumnIndex == COLUMN_FLAG))
{
auto column = sort->Specs->ColumnIndex;
const auto cmp = [&](const duskImguiEventFlagEntry& l,
const duskImguiEventFlagEntry& r) -> bool {
switch (column) {
case COLUMN_FLAG:
return (bool)event.isEventBit(l.flagID) <
(bool)event.isEventBit(r.flagID);
case COLUMN_NAME:
return l.flagName < r.flagName;
case COLUMN_LOC:
return l.location < r.location;
case COLUMN_DESC:
return l.description < r.description;
}
return false;
};
const auto column = sort->Specs[0].ColumnIndex;
const auto direction = sort->Specs[0].SortDirection;
if (direction == ImGuiSortDirection_Ascending) {
std::sort(std::begin(duskImguiEventFlags), std::end(duskImguiEventFlags), cmp);
// if we're sorting by flags, do special sort, regular sort is bad for sorting bools
// it can swap values that are the same, and that causes constant reordering
if (column == COLUMN_FLAG) {
const auto testEventFunc = [&event](u16 flag) -> bool { return event.isEventBit(flag); };
if (direction == ImGuiSortDirection_Ascending) {
sortByFlags(std::begin(duskImguiEventFlags),
std::end(duskImguiEventFlags), testEventFunc);
} else {
sortByFlags(std::rbegin(duskImguiEventFlags),
std::rend(duskImguiEventFlags), testEventFunc);
}
} else {
std::sort(std::rbegin(duskImguiEventFlags), std::rend(duskImguiEventFlags), cmp);
const auto cmp = [column](const duskImguiEventFlagEntry& l,
const duskImguiEventFlagEntry& r) -> bool {
switch (column) {
case COLUMN_NAME: return l.flagName < r.flagName;
case COLUMN_LOC: return l.location < r.location;
case COLUMN_DESC: return l.description < r.description;
default: return false;
}
};
if (direction == ImGuiSortDirection_Ascending) {
std::sort(std::begin(duskImguiEventFlags),
std::end(duskImguiEventFlags), cmp);
} else {
std::sort(std::rbegin(duskImguiEventFlags),
std::rend(duskImguiEventFlags), cmp);
}
}
sort->SpecsDirty = false;
}
-4
View File
@@ -1020,10 +1020,6 @@ void GXInitTexCacheRegion(GXTexRegion* region, GXBool is_32b_mipmap, u32 tmem_ev
// XXX, this should be some struct?
// GXRenderModeObj GXNtsc480IntDf;
//GXRenderModeObj GXNtsc480Int;
void GXPeekZ(u16 x, u16 y, u32* z) {
STUB_LOG();
*z = 0;
}
void GXReadXfRasMetric(u32* xf_wait_in, u32* xf_wait_out, u32* ras_busy, u32* clocks) {
STUB_LOG();
*xf_wait_in = 0;