Skip to content

Commit

Permalink
Merge branch 'develop-rachael' into rachael-to-zhora
Browse files Browse the repository at this point in the history
  • Loading branch information
briaguya committed Aug 4, 2022
2 parents bd86c79 + 78ad282 commit 739434e
Show file tree
Hide file tree
Showing 78 changed files with 506 additions and 46 deletions.
6 changes: 5 additions & 1 deletion libultraship/libultraship/InputEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ namespace Ship {

if (ControllerName != nullptr && ImGui::BeginCombo("##ControllerEntries", ControllerName)) {
for (uint8_t i = 0; i < controlDeck->GetNumPhysicalDevices(); i++) {
if (ImGui::Selectable(controlDeck->GetPhysicalDevice(i)->GetControllerName(), i == controlDeck->GetVirtualDevice(CurrentPort))) {
std::string DeviceName = controlDeck->GetPhysicalDevice(i)->GetControllerName();
if (DeviceName != "Keyboard" && DeviceName != "Auto") {
DeviceName+="##"+std::to_string(i);
}
if (ImGui::Selectable(DeviceName.c_str(), i == controlDeck->GetVirtualDevice(CurrentPort))) {
controlDeck->SetPhysicalDevice(CurrentPort, i);
}
}
Expand Down
6 changes: 4 additions & 2 deletions soh/include/z64effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ typedef struct {
/* 0x0C */ Vec3f position;
/* 0x18 */ Vec3s unkVelocity;
/* 0x1E */ Vec3s unkPosition;
} EffectSparkElement; // size = 0x24
/* 0x24 */ s32 epoch;
} EffectSparkElement; // size = 0x28

typedef struct {
/* 0x000 */ Vec3s position;
Expand Down Expand Up @@ -117,7 +118,8 @@ typedef struct {
/* 0x10 */ f32 startX;
/* 0x14 */ s16 yaw;
/* 0x16 */ s16 pitch;
} EffectShieldParticleElement; // size = 0x18
/* 0x18 */ s32 epoch;
} EffectShieldParticleElement; // size = 0x1C

typedef struct {
/* 0x00 */ u8 numElements;
Expand Down
5 changes: 5 additions & 0 deletions soh/soh/OTRGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1516,6 +1516,11 @@ extern "C" s32 Randomizer_GetItemIdFromKnownCheck(RandomizerCheck randomizerChec
return OTRGlobals::Instance->gRandomizer->GetRandomizedItemIdFromKnownCheck(randomizerCheck, ogId);
}

extern "C" bool Randomizer_ObtainedFreestandingIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId, Actor* actor) {
return gSaveContext.n64ddFlag && (actor->parent != NULL) &&
Randomizer_GetItemIdFromKnownCheck(randomizerCheck, ogId) == GI_ICE_TRAP;
}

extern "C" bool Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId) {
return gSaveContext.n64ddFlag && Randomizer_GetItemIdFromKnownCheck(randomizerCheck, ogId) == GI_ICE_TRAP;
}
1 change: 1 addition & 0 deletions soh/soh/OTRGlobals.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ s16 Randomizer_GetItemModelFromId(s16 itemId);
s32 Randomizer_GetItemIDFromGetItemID(s32 getItemId);
s32 Randomizer_GetRandomizedItemId(GetItemID ogId, s16 actorId, s16 actorParams, s16 sceneNum);
s32 Randomizer_GetItemIdFromKnownCheck(RandomizerCheck randomizerCheck, GetItemID ogId);
bool Randomizer_ObtainedFreestandingIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId, Actor* actor);
bool Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId);
#endif

Expand Down
4 changes: 2 additions & 2 deletions soh/src/code/speed_meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) {
uly = this->y;
lry = this->y + 2;

OPEN_DISPS(gfxCtx);

/*! @bug if gIrqMgrRetraceTime is 0, CLOSE_DISPS will never be reached */
if (gIrqMgrRetraceTime == 0) {
return;
}

OPEN_DISPS(gfxCtx);

sSpeedMeterTimeEntryPtr = &sSpeedMeterTimeEntryArray[0];
for (i = 0; i < ARRAY_COUNT(sSpeedMeterTimeEntryArray); i++) {
temp = ((f64) * (sSpeedMeterTimeEntryPtr->time) / gIrqMgrRetraceTime) * 64.0;
Expand Down
4 changes: 4 additions & 0 deletions soh/src/code/z_actor.c
Original file line number Diff line number Diff line change
Expand Up @@ -3957,6 +3957,8 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) {
f32 chainsTranslateX;
f32 chainsTranslateY;
f32 rotZStep;
static s32 epoch = 0;
epoch++;

entry = &sDoorLocksInfo[type];
chainRotZ = entry->chainsRotZInit;
Expand All @@ -3970,6 +3972,7 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) {
chainsTranslateY = cosf(entry->chainAngle - chainRotZ) * (10 - frame) * 0.1f * entry->chainLength;

for (i = 0; i < 4; i++) {
FrameInterpolation_RecordOpenChild(entry, epoch + i * 25);
Matrix_Put(&baseMtxF);
Matrix_RotateZ(chainRotZ, MTXMODE_APPLY);
Matrix_Translate(chainsTranslateX, chainsTranslateY, 0.0f, MTXMODE_APPLY);
Expand All @@ -3989,6 +3992,7 @@ void Actor_DrawDoorLock(GlobalContext* globalCtx, s32 frame, s32 type) {
}

chainRotZ += rotZStep;
FrameInterpolation_RecordCloseChild();
}

Matrix_Put(&baseMtxF);
Expand Down
7 changes: 5 additions & 2 deletions soh/src/code/z_eff_shield_particle.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ void EffectShieldParticle_Init(void* thisx, void* initParamsx) {
elem->endXChange = elem->initialSpeed;
elem->yaw = Rand_ZeroOne() * 65534.0f;
elem->pitch = Rand_ZeroOne() * 65534.0f;
elem->epoch++;
}

this->lightDecay = initParams->lightDecay;
Expand Down Expand Up @@ -156,7 +157,6 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) {
Color_RGBA8 primColor;
Color_RGBA8 envColor;

FrameInterpolation_RecordOpenChild(this, 0);
OPEN_DISPS(gfxCtx);

if (this != NULL) {
Expand All @@ -182,6 +182,8 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) {
gDPPipeSync(POLY_XLU_DISP++);

for (elem = &this->elements[0]; elem < &this->elements[this->numElements]; elem++) {
FrameInterpolation_RecordOpenChild(elem, elem->epoch);

Mtx* mtx;
MtxF sp104;
MtxF spC4;
Expand Down Expand Up @@ -212,9 +214,10 @@ void EffectShieldParticle_Draw(void* thisx, GraphicsContext* gfxCtx) {
gSPMatrix(POLY_XLU_DISP++, mtx, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPVertex(POLY_XLU_DISP++, sVertices, 4, 0);
gSP2Triangles(POLY_XLU_DISP++, 0, 1, 2, 0, 0, 3, 1, 0);

FrameInterpolation_RecordCloseChild();
}
}

CLOSE_DISPS(gfxCtx);
FrameInterpolation_RecordCloseChild();
}
6 changes: 6 additions & 0 deletions soh/src/code/z_eff_spark.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ void EffectSpark_Init(void* thisx, void* initParamsx) {
elem->unkPosition.x = Rand_ZeroOne() * 65534.0f;
elem->unkPosition.y = Rand_ZeroOne() * 65534.0f;
elem->unkPosition.z = Rand_ZeroOne() * 65534.0f;
elem->epoch++;
}

this->timer = 0;
Expand Down Expand Up @@ -210,6 +211,8 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
Mtx* mtx;
f32 temp;

FrameInterpolation_RecordOpenChild(elem, elem->epoch);

SkinMatrix_SetTranslate(&spEC, elem->position.x, elem->position.y, elem->position.z);
temp = ((Rand_ZeroOne() * 2.5f) + 1.5f) / 64.0f;
SkinMatrix_SetScale(&spAC, temp, temp, 1.0f);
Expand Down Expand Up @@ -264,6 +267,7 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {

mtx = SkinMatrix_MtxFToNewMtx(gfxCtx, &sp12C);
if (mtx == NULL) {
FrameInterpolation_RecordCloseChild();
goto end;
}

Expand All @@ -273,6 +277,8 @@ void EffectSpark_Draw(void* thisx, GraphicsContext* gfxCtx) {
}

gDPPipeSync(POLY_XLU_DISP++);

FrameInterpolation_RecordCloseChild();
}

end:
Expand Down
28 changes: 24 additions & 4 deletions soh/src/code/z_kankyo.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "vt.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include "objects/gameplay_field_keep/gameplay_field_keep.h"
#include "soh/frame_interpolation.h"

typedef enum {
/* 0 */ LENS_FLARE_CIRCLE0,
Expand Down Expand Up @@ -950,7 +951,6 @@ void Environment_Update(GlobalContext* globalCtx, EnvironmentContext* envCtx, Li
Gfx* prevDisplayList;

OPEN_DISPS(globalCtx->state.gfxCtx);

prevDisplayList = POLY_OPA_DISP;
displayList = Graph_GfxPlusOne(POLY_OPA_DISP);
gSPDisplayList(OVERLAY_DISP++, displayList);
Expand Down Expand Up @@ -1459,6 +1459,8 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env
LENS_FLARE_RING, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1,
LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1, LENS_FLARE_CIRCLE1,
};
static s32 epoch = 0;
epoch++;

OPEN_DISPS(gfxCtx);

Expand Down Expand Up @@ -1502,9 +1504,7 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env
unk88Target = cosAngle;
}

if (cosAngle < 0.0f) {

} else {
if (!(cosAngle < 0.0f)) {
if (arg9) {
u32 shrink = ShrinkWindow_GetCurrentVal();
func_800C016C(globalCtx, &pos, &screenPos);
Expand All @@ -1517,6 +1517,8 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env
}

for (i = 0; i < ARRAY_COUNT(lensFlareTypes); i++) {
FrameInterpolation_RecordOpenChild("Lens Flare", epoch + i * 25);

Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_NEW);

if (arg9) {
Expand Down Expand Up @@ -1573,6 +1575,8 @@ void Environment_DrawLensFlare(GlobalContext* globalCtx, EnvironmentContext* env
gSPDisplayList(POLY_XLU_DISP++, gLensFlareRingDL);
break;
}

FrameInterpolation_RecordCloseChild();
}

alphaScale = cosAngle - (1.5f - cosAngle);
Expand Down Expand Up @@ -1638,6 +1642,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext*
Vec3f unused = { 0.0f, 0.0f, 0.0f };
Vec3f windDirection = { 0.0f, 0.0f, 0.0f };
Player* player = GET_PLAYER(globalCtx);
static s32 epoch = 0;
epoch++;

if (!(globalCtx->cameraPtrs[0]->unk_14C & 0x100) && (globalCtx->envCtx.unk_EE[2] == 0)) {
OPEN_DISPS(gfxCtx);
Expand Down Expand Up @@ -1667,6 +1673,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext*

// draw rain drops
for (i = 0; i < globalCtx->envCtx.unk_EE[1]; i++) {
FrameInterpolation_RecordOpenChild("Rain Drop", epoch + i * 25);

temp2 = Rand_ZeroOne();
temp1 = Rand_ZeroOne();
temp3 = Rand_ZeroOne();
Expand All @@ -1692,13 +1700,17 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext*
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gRaindropDL);

FrameInterpolation_RecordCloseChild();
}

// draw droplet rings on the ground
if (player->actor.world.pos.y < view->eye.y) {
u8 firstDone = false;

for (i = 0; i < globalCtx->envCtx.unk_EE[1]; i++) {
FrameInterpolation_RecordOpenChild("Droplet Ring", epoch + i * 25);

if (!firstDone) {
func_80093D84(gfxCtx);
gDPSetEnvColor(POLY_XLU_DISP++, 155, 155, 155, 0);
Expand All @@ -1719,6 +1731,8 @@ void Environment_DrawRain(GlobalContext* globalCtx, View* view, GraphicsContext*
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gEffShockwaveDL);

FrameInterpolation_RecordCloseChild();
}
}

Expand Down Expand Up @@ -1911,10 +1925,14 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) {
s32 pad[2];
Vec3f unused1 = { 0.0f, 0.0f, 0.0f };
Vec3f unused2 = { 0.0f, 0.0f, 0.0f };
static s32 epoch = 0;
epoch++;

OPEN_DISPS(globalCtx->state.gfxCtx);

for (i = 0; i < ARRAY_COUNT(sLightningBolts); i++) {
FrameInterpolation_RecordOpenChild("Lightning Bolt", epoch + i * 25);

switch (sLightningBolts[i].state) {
case LIGHTNING_BOLT_START:
dx = globalCtx->view.lookAt.x - globalCtx->view.eye.x;
Expand Down Expand Up @@ -1969,6 +1987,8 @@ void Environment_DrawLightning(GlobalContext* globalCtx, s32 unused) {
gSPMatrix(POLY_XLU_DISP++, SEG_ADDR(1, 0), G_MTX_NOPUSH | G_MTX_MUL | G_MTX_MODELVIEW);
gSPDisplayList(POLY_XLU_DISP++, gEffLightningDL);
}

FrameInterpolation_RecordCloseChild();
}

CLOSE_DISPS(globalCtx->state.gfxCtx);
Expand Down
7 changes: 7 additions & 0 deletions soh/src/code/z_lifemeter.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "global.h"
#include "textures/parameter_static/parameter_static.h"
#include "soh/frame_interpolation.h"

s16 Top_LM_Margin = 0;
s16 Left_LM_Margin = 0;
Expand Down Expand Up @@ -412,6 +413,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
s32 curCombineModeSet = 0;
u8* curBgImgLoaded = NULL;
s32 ddHeartCountMinusOne = gSaveContext.inventory.defenseHearts - 1;
static s32 epoch = 0;
epoch++;

OPEN_DISPS(gfxCtx);

Expand Down Expand Up @@ -449,6 +452,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
}

for (i = 0; i < totalHeartCount; i++) {
FrameInterpolation_RecordOpenChild("HealthMeter Heart", epoch + i * 25);

if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) {
if (i < fullHeartCount) {
if (curColorSet != 0) {
Expand Down Expand Up @@ -624,6 +629,8 @@ void HealthMeter_Draw(GlobalContext* globalCtx) {
offsetX = PosX_original;
}
}

FrameInterpolation_RecordCloseChild();
}

CLOSE_DISPS(gfxCtx);
Expand Down
16 changes: 14 additions & 2 deletions soh/src/code/z_parameter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1384,6 +1384,12 @@ void Inventory_SwapAgeEquipment(void) {
u16 temp;

if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
// When becoming adult, remove swordless flag since we'll get master sword
// Only in rando to keep swordless link bugs in vanilla
if (gSaveContext.n64ddFlag) {
gSaveContext.infTable[29] &= ~1;
}

for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
if (i != 0) {
gSaveContext.childEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i];
Expand Down Expand Up @@ -1444,6 +1450,12 @@ void Inventory_SwapAgeEquipment(void) {
gSaveContext.equips.equipment = gSaveContext.adultEquips.equipment;
}
} else {
// When becoming child, set swordless flag if player doesn't have kokiri sword
// Only in rando to keep swordless link bugs in vanilla
if (gSaveContext.n64ddFlag && (1 << 0 & gSaveContext.inventory.equipment) == 0) {
gSaveContext.infTable[29] |= 1;
}

for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) {
gSaveContext.adultEquips.buttonItems[i] = gSaveContext.equips.buttonItems[i];

Expand Down Expand Up @@ -3352,8 +3364,8 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
const s16 C_Right_BTN_Pos_ori[] = { C_RIGHT_BUTTON_X+X_Margins_CR, C_RIGHT_BUTTON_Y+Y_Margins_CR };
const s16 C_Up_BTN_Pos_ori[] = { C_UP_BUTTON_X+X_Margins_CU, C_UP_BUTTON_Y+Y_Margins_CU };
const s16 C_Down_BTN_Pos_ori[] = { C_DOWN_BUTTON_X+X_Margins_CD, C_DOWN_BUTTON_Y+Y_Margins_CD };
s16 LabelX_Navi=8;
s16 LabelY_Navi=4 - !!CVar_GetS32("gNaviTextFix", 0);
s16 LabelX_Navi=7 + !!CVar_GetS32("gNaviTextFix", 0);
s16 LabelY_Navi=4;
s16 C_Left_BTN_Pos[2]; //(X,Y)
s16 C_Right_BTN_Pos[2];
s16 C_Up_BTN_Pos[2];
Expand Down
3 changes: 2 additions & 1 deletion soh/src/code/z_play.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ void GivePlayerRandoRewardSongOfTime(GlobalContext* globalCtx, RandomizerCheck c
!Flags_GetTreasure(globalCtx, 0x1F) && gSaveContext.nextTransition == 0xFF) {
GetItemID getItemId = Randomizer_GetItemIdFromKnownCheck(check, GI_SONG_OF_TIME);
GiveItemWithoutActor(globalCtx, getItemId);
Flags_SetTreasure(globalCtx, 0x1F);
player->pendingFlag.flagID = 0x1F;
player->pendingFlag.flagType = FLAG_SCENE_TREASURE;
}
}

Expand Down
Loading

0 comments on commit 739434e

Please sign in to comment.