Merge branch 'develop' into 3DProjectiles

This commit is contained in:
Baoulettes 2022-05-29 23:02:19 +02:00 committed by GitHub
commit ea0ea0366b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 970 additions and 367 deletions

View file

@ -18,8 +18,8 @@ WARN := \
-funsigned-char \
-m32 -mhard-float -fno-stack-protector -fno-common -fno-zero-initialized-in-bss -fno-strict-aliasing -fno-inline-functions -fno-inline-small-functions -fno-toplevel-reorder -ffreestanding -fwrapv \
CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -no-pie -nostdlib -march=i386
CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -no-pie -nostdlib -march=i386
CXXFLAGS := $(WARN) -std=c++20 -D_GNU_SOURCE -fpermissive -no-pie -nostdlib -march=i386 -msse2 -mfpmath=sse
CFLAGS := $(WARN) -std=c99 -D_GNU_SOURCE -no-pie -nostdlib -march=i386 -msse2 -mfpmath=sse
LDFLAGS := -m32
CPPFLAGS := -MMD

View file

@ -1,6 +1,6 @@
<Root>
<File Name="object_triforce_spot" Segment="6">
<Array Name="gTriforceVtx" Count="32" Offset="0x0000">
<Array Name="gTriforceVtx" Count="96" Offset="0x0000">
<Vtx/>
</Array>

View file

@ -175,8 +175,6 @@ extern "C" void Graph_StartFrame() {
// C->C++ Bridge
extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
OTRGlobals::Instance->context->GetWindow()->SetFrameDivisor(CVar_GetS32("g60FPS", 0) == 0 ? R_UPDATE_RATE : 1);
if (!audio.initialized) {
audio.initialized = true;
std::thread([]() {
@ -226,15 +224,45 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
audio.cv_to_thread.notify_one();
std::vector<std::unordered_map<Mtx*, MtxF>> mtx_replacements;
if (CVar_GetS32("g60FPS", 0) != 0) {
int to = R_UPDATE_RATE;
for (int i = 1; i < to; i++) {
mtx_replacements.push_back(FrameInterpolation_Interpolate(i / (float)to));
int target_fps = CVar_GetS32("gInterpolationFPS", 20);
static int last_fps;
static int last_update_rate;
static int time;
int fps = target_fps;
int original_fps = 60 / R_UPDATE_RATE;
if (target_fps == 20 || original_fps > target_fps) {
fps = original_fps;
}
if (last_fps != fps || last_update_rate != R_UPDATE_RATE) {
time = 0;
}
// time_base = fps * original_fps (one second)
int next_original_frame = fps;
while (time + original_fps <= next_original_frame) {
time += original_fps;
if (time != next_original_frame) {
mtx_replacements.push_back(FrameInterpolation_Interpolate((float)time / next_original_frame));
} else {
mtx_replacements.emplace_back();
}
}
time -= fps;
OTRGlobals::Instance->context->GetWindow()->SetTargetFps(fps);
int threshold = CVar_GetS32("gExtraLatencyThreshold", 80);
OTRGlobals::Instance->context->GetWindow()->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1);
OTRGlobals::Instance->context->GetWindow()->RunCommands(commands, mtx_replacements);
last_fps = fps;
last_update_rate = R_UPDATE_RATE;
{
std::unique_lock<std::mutex> Lock(audio.mutex);
while (audio.processing) {

View file

@ -451,7 +451,7 @@ void FrameInterpolation_StartRecord(void) {
current_recording = {};
current_path.clear();
current_path.push_back(&current_recording.root_path);
if (CVar_GetS32("g60FPS", 0) != 0) {
if (CVar_GetS32("gInterpolationFPS", 20) != 20) {
is_recording = true;
}
}

View file

@ -19,9 +19,50 @@ MessageTableEntry* OTRMessage_LoadTable(const char* filePath, bool isNES) {
if (file == nullptr)
return nullptr;
MessageTableEntry* table = (MessageTableEntry*)malloc(sizeof(MessageTableEntry) * file->messages.size());
// Allocate room for an additional message
MessageTableEntry* table = (MessageTableEntry*)malloc(sizeof(MessageTableEntry) * (file->messages.size() + 1));
for (int i = 0; i < file->messages.size(); i++) {
// Look for Owl Text
if (file->messages[i].id == 0x2066) {
// Create a new message based on the Owl Text
char* kaeporaPatch = (char*)malloc(sizeof(char) * file->messages[i].msg.size());
file->messages[i].msg.copy(kaeporaPatch, file->messages[i].msg.size(), 0);
// Swap the order of yes and no in this new message
if (filePath == "text/nes_message_data_static/nes_message_data_static") {
kaeporaPatch[26] = 'Y';
kaeporaPatch[27] = 'e';
kaeporaPatch[28] = 's';
kaeporaPatch[29] = 1;
kaeporaPatch[30] = 'N';
kaeporaPatch[31] = 'o';
} else if (filePath == "text/ger_message_data_static/ger_message_data_static") {
kaeporaPatch[30] = 'J';
kaeporaPatch[31] = 'a';
kaeporaPatch[32] = '!';
kaeporaPatch[33] = 1;
kaeporaPatch[34] = 'N';
kaeporaPatch[35] = 'e';
kaeporaPatch[36] = 'i';
kaeporaPatch[37] = 'n';
} else {
kaeporaPatch[26] = 'O';
kaeporaPatch[27] = 'u';
kaeporaPatch[28] = 'i';
kaeporaPatch[29] = 1;
kaeporaPatch[30] = 'N';
kaeporaPatch[31] = 'o';
kaeporaPatch[32] = 'n';
}
// load data into message
table[file->messages.size()].textId = 0x71B3;
table[file->messages.size()].typePos = (file->messages[i].textboxType << 4) | file->messages[i].textboxYPos;
table[file->messages.size()].segment = kaeporaPatch;
table[file->messages.size()].msgSize = file->messages[i].msg.size();
}
table[i].textId = file->messages[i].id;
table[i].typePos = (file->messages[i].textboxType << 4) | file->messages[i].textboxYPos;
table[i].segment = file->messages[i].msg.c_str();

View file

@ -2290,8 +2290,8 @@ void Actor_DrawFaroresWindPointer(GlobalContext* globalCtx) {
((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.y) + yOffset,
((void)0, gSaveContext.respawn[RESPAWN_MODE_TOP].pos.z), 255, 255, 255, lightRadius);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 5474);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_actor.c", 5474);
}
void func_80030488(GlobalContext* globalCtx) {

View file

@ -128,6 +128,13 @@ void HealthMeter_Init(GlobalContext* globalCtx) {
HeartDDOutline[0] = CVar_GetS32("gDDCCHeartsPrimR", 90);
HeartDDOutline[1] = CVar_GetS32("gDDCCHeartsPrimG", 90);
HeartDDOutline[2] = CVar_GetS32("gDDCCHeartsPrimB", 90);
} else {
HeartInner[0] = HEARTS_PRIM_R;
HeartInner[1] = HEARTS_PRIM_G;
HeartInner[2] = HEARTS_PRIM_B;
HeartDDOutline[0] = HEARTS_DD_PRIM_R;
HeartDDOutline[1] = HEARTS_DD_PRIM_G;
HeartDDOutline[2] = HEARTS_DD_PRIM_B;
}
interfaceCtx->unk_228 = 0x140;
@ -194,12 +201,12 @@ void HealthMeter_Update(GlobalContext* globalCtx) {
HeartDDOutline[1] = CVar_GetS32("gDDCCHeartsPrimG", sHeartsDDPrim[0][1]);
HeartDDOutline[2] = CVar_GetS32("gDDCCHeartsPrimB", sHeartsDDPrim[0][2]);
} else {
HeartInner[0] = sHeartsPrimColors[0][0];
HeartInner[1] = sHeartsPrimColors[0][1];
HeartInner[2] = sHeartsPrimColors[0][2];
HeartDDOutline[0] = sHeartsDDPrim[0][0];
HeartDDOutline[1] = sHeartsDDPrim[0][1];
HeartDDOutline[2] = sHeartsDDPrim[0][2];
HeartInner[0] = HEARTS_PRIM_R;
HeartInner[1] = HEARTS_PRIM_G;
HeartInner[2] = HEARTS_PRIM_B;
HeartDDOutline[0] = HEARTS_DD_PRIM_R;
HeartDDOutline[1] = HEARTS_DD_PRIM_G;
HeartDDOutline[2] = HEARTS_DD_PRIM_B;
}
if (interfaceCtx->unk_200 != 0) {
@ -299,33 +306,33 @@ void HealthMeter_Update(GlobalContext* globalCtx) {
sBeatingHeartsDDEnv[1] = (u8)(gFactor + HeartDDInner[1]) & 0xFF;
sBeatingHeartsDDEnv[2] = (u8)(bFactor + HeartDDInner[2]) & 0xFF;
} else {
sHeartsDDPrim[2][0] = HeartInner[0];
sHeartsDDPrim[2][1] = HeartInner[1];
sHeartsDDPrim[2][2] = HeartInner[2];
sHeartsDDPrim[2][0] = HEARTS_PRIM_R;
sHeartsDDPrim[2][1] = HEARTS_PRIM_G;
sHeartsDDPrim[2][2] = HEARTS_PRIM_B;
sHeartsDDPrim[1][0] = sHeartsDDPrimColors[ddType][0];
sHeartsDDPrim[1][1] = sHeartsDDPrimColors[ddType][1];
sHeartsDDPrim[1][2] = sHeartsDDPrimColors[ddType][2];
sHeartsDDPrim[1][0] = HEARTS_DD_PRIM_R;
sHeartsDDPrim[1][1] = HEARTS_DD_PRIM_G;
sHeartsDDPrim[1][2] = HEARTS_DD_PRIM_B;
sHeartsDDEnv[1][0] = sHeartsDDEnvColors[ddType][0];
sHeartsDDEnv[1][1] = sHeartsDDEnvColors[ddType][1];
sHeartsDDEnv[1][2] = sHeartsDDEnvColors[ddType][2];
sHeartsDDEnv[1][0] = HEARTS_PRIM_R;
sHeartsDDEnv[1][1] = HEARTS_PRIM_G;
sHeartsDDEnv[1][2] = HEARTS_PRIM_B;
rFactor = sHeartsDDPrimFactors[ddType][0] * ddFactor;
gFactor = sHeartsDDPrimFactors[ddType][1] * ddFactor;
bFactor = sHeartsDDPrimFactors[ddType][2] * ddFactor;
sBeatingHeartsDDPrim[0] = (u8)(rFactor + HeartDDOutline[0]) & 0xFF;
sBeatingHeartsDDPrim[1] = (u8)(gFactor + HeartDDOutline[1]) & 0xFF;
sBeatingHeartsDDPrim[2] = (u8)(bFactor + HeartDDOutline[2]) & 0xFF;
sBeatingHeartsDDPrim[0] = (u8)(rFactor + HEARTS_DD_PRIM_R) & 0xFF;
sBeatingHeartsDDPrim[1] = (u8)(gFactor + HEARTS_DD_PRIM_G) & 0xFF;
sBeatingHeartsDDPrim[2] = (u8)(bFactor + HEARTS_DD_PRIM_B) & 0xFF;
rFactor = sHeartsDDEnvFactors[ddType][0] * ddFactor;
gFactor = sHeartsDDEnvFactors[ddType][1] * ddFactor;
bFactor = sHeartsDDEnvFactors[ddType][2] * ddFactor;
sBeatingHeartsDDEnv[0] = (u8)(rFactor + HeartDDInner[0]) & 0xFF;
sBeatingHeartsDDEnv[1] = (u8)(gFactor + HeartDDInner[1]) & 0xFF;
sBeatingHeartsDDEnv[2] = (u8)(bFactor + HeartDDInner[2]) & 0xFF;
sBeatingHeartsDDEnv[0] = (u8)(rFactor + HEARTS_PRIM_R) & 0xFF;
sBeatingHeartsDDEnv[1] = (u8)(gFactor + HEARTS_PRIM_G) & 0xFF;
sBeatingHeartsDDEnv[2] = (u8)(bFactor + HEARTS_PRIM_B) & 0xFF;
}
}

View file

@ -272,6 +272,13 @@ void Message_FindMessage(GlobalContext* globalCtx, u16 textId) {
const char** languageSegmentTable;
Font* font;
const char* seg;
u16 bufferId = textId;
// Use the better owl message if better owl is enabled
if (CVar_GetS32("gBetterOwl", 0) != 0 && (bufferId == 0x2066 || bufferId == 0x607B ||
bufferId == 0x10C2 || bufferId == 0x10C6 || bufferId == 0x206A))
{
bufferId = 0x71B3;
}
if (gSaveContext.language == LANGUAGE_GER)
messageTableEntry = sGerMessageEntryTablePtr;
@ -287,7 +294,7 @@ void Message_FindMessage(GlobalContext* globalCtx, u16 textId) {
while (messageTableEntry->textId != 0xFFFF) {
font = &globalCtx->msgCtx.font;
if (messageTableEntry->textId == textId) {
if (messageTableEntry->textId == bufferId) {
foundSeg = messageTableEntry->segment;
font->charTexBuf[0] = messageTableEntry->typePos;
@ -298,14 +305,14 @@ void Message_FindMessage(GlobalContext* globalCtx, u16 textId) {
// "Message found!!!"
osSyncPrintf(" メッセージが,見つかった!!! = %x "
"(data=%x) (data0=%x) (data1=%x) (data2=%x) (data3=%x)\n",
textId, font->msgOffset, font->msgLength, foundSeg, seg, nextSeg);
bufferId, font->msgOffset, font->msgLength, foundSeg, seg, nextSeg);
return;
}
messageTableEntry++;
}
// "Message not found!!!"
osSyncPrintf(" メッセージが,見つからなかった!!! = %x\n", textId);
osSyncPrintf(" メッセージが,見つからなかった!!! = %x\n", bufferId);
font = &globalCtx->msgCtx.font;
messageTableEntry = sNesMessageEntryTablePtr;

View file

@ -2884,7 +2884,26 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0);
gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0,
PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0);
//There is probably a more elegant way to do it.
char* doAction = actionsTbl[3];
char newName[512];
if (gSaveContext.language != LANGUAGE_ENG) {
size_t length = strlen(doAction);
strcpy(newName, doAction);
if (gSaveContext.language == LANGUAGE_FRA) {
newName[length - 6] = 'F';
newName[length - 5] = 'R';
newName[length - 4] = 'A';
} else if (gSaveContext.language == LANGUAGE_GER) {
newName[length - 6] = 'G';
newName[length - 5] = 'E';
newName[length - 4] = 'R';
}
doAction = newName;
}
memcpy(interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE * 2, ResourceMgr_LoadTexByName(doAction), DO_ACTION_TEX_SIZE);
gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE * 2, G_IM_FMT_IA,
DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);

View file

@ -744,26 +744,38 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable,
#else
gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[eyeIndex]));
#endif
Color_RGB8 NewColor[3];
color = &sTunicColors[tunic];
if (CVar_GetS32("gUseTunicsCol",0) == 1) {
if (tunic == PLAYER_TUNIC_KOKIRI || tunic == PLAYER_TUNIC_GORON || tunic == PLAYER_TUNIC_ZORA) {
NewColor[PLAYER_TUNIC_KOKIRI].r = CVar_GetS32("gTunic_Kokiri_R", sTunicColors[PLAYER_TUNIC_KOKIRI].r);
NewColor[PLAYER_TUNIC_KOKIRI].g = CVar_GetS32("gTunic_Kokiri_G", sTunicColors[PLAYER_TUNIC_KOKIRI].g);
NewColor[PLAYER_TUNIC_KOKIRI].b = CVar_GetS32("gTunic_Kokiri_B", sTunicColors[PLAYER_TUNIC_KOKIRI].b);
NewColor[PLAYER_TUNIC_GORON].r = CVar_GetS32("gTunic_Goron_R", sTunicColors[PLAYER_TUNIC_GORON].r);
NewColor[PLAYER_TUNIC_GORON].g = CVar_GetS32("gTunic_Goron_G", sTunicColors[PLAYER_TUNIC_GORON].g);
NewColor[PLAYER_TUNIC_GORON].b = CVar_GetS32("gTunic_Goron_B", sTunicColors[PLAYER_TUNIC_GORON].b);
NewColor[PLAYER_TUNIC_ZORA].r = CVar_GetS32("gTunic_Zora_R", sTunicColors[PLAYER_TUNIC_ZORA].r);
NewColor[PLAYER_TUNIC_ZORA].g = CVar_GetS32("gTunic_Zora_G", sTunicColors[PLAYER_TUNIC_ZORA].g);
NewColor[PLAYER_TUNIC_ZORA].b = CVar_GetS32("gTunic_Zora_B", sTunicColors[PLAYER_TUNIC_ZORA].b);
Color_RGB8 sTemp;
Color_RGB8 sOriginalTunicColors[] = {
{ 30, 105, 27 },
{ 100, 20, 0 },
{ 0, 60, 100 },
};
color = &sTemp;
if (tunic == PLAYER_TUNIC_KOKIRI && CVar_GetS32("gUseTunicsCol",0)) {
color->r = CVar_GetS32("gTunic_Kokiri_R", sTunicColors[PLAYER_TUNIC_KOKIRI].r);
color->g = CVar_GetS32("gTunic_Kokiri_G", sTunicColors[PLAYER_TUNIC_KOKIRI].g);
color->b = CVar_GetS32("gTunic_Kokiri_B", sTunicColors[PLAYER_TUNIC_KOKIRI].b);
} else if (tunic == PLAYER_TUNIC_GORON && CVar_GetS32("gUseTunicsCol",0)) {
color->r = CVar_GetS32("gTunic_Goron_R", sTunicColors[PLAYER_TUNIC_GORON].r);
color->g = CVar_GetS32("gTunic_Goron_G", sTunicColors[PLAYER_TUNIC_GORON].g);
color->b = CVar_GetS32("gTunic_Goron_B", sTunicColors[PLAYER_TUNIC_GORON].b);
} else if (tunic == PLAYER_TUNIC_ZORA && CVar_GetS32("gUseTunicsCol",0)) {
color->r = CVar_GetS32("gTunic_Zora_R", sTunicColors[PLAYER_TUNIC_ZORA].r);
color->g = CVar_GetS32("gTunic_Zora_G", sTunicColors[PLAYER_TUNIC_ZORA].g);
color->b = CVar_GetS32("gTunic_Zora_B", sTunicColors[PLAYER_TUNIC_ZORA].b);
} else if (!CVar_GetS32("gUseTunicsCol",0)){
if (tunic >= 3) {
color->r = sOriginalTunicColors[0].r;
color->g = sOriginalTunicColors[0].g;
color->b = sOriginalTunicColors[0].b;
} else {
NewColor[PLAYER_TUNIC_KOKIRI].r = CVar_GetS32("gTunic_Kokiri_R", sTunicColors[PLAYER_TUNIC_KOKIRI].r);
NewColor[PLAYER_TUNIC_KOKIRI].g = CVar_GetS32("gTunic_Kokiri_G", sTunicColors[PLAYER_TUNIC_KOKIRI].g);
NewColor[PLAYER_TUNIC_KOKIRI].b = CVar_GetS32("gTunic_Kokiri_B", sTunicColors[PLAYER_TUNIC_KOKIRI].b);
color->r = sOriginalTunicColors[tunic].r;
color->g = sOriginalTunicColors[tunic].g;
color->b = sOriginalTunicColors[tunic].b;
}
color = NewColor;
}
gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 0);
sDListsLodOffset = lod * 2;
@ -1649,26 +1661,118 @@ void func_80091A24(GlobalContext* globalCtx, void* seg04, void* seg06, SkelAnime
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_player_lib.c", 3288);
}
uintptr_t SelectedAnim = 0; // Current Animaiton on the menu
s16 EquipedStance; // Link's current mode (Two handed, One handed...)
s16 FrameCountSinceLastAnim = 0; // Time since last animation
s16 MinFrameCount; // Frame to wait before checking if we need to change the animation
void func_8009214C(GlobalContext* globalCtx, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale,
s32 sword, s32 tunic, s32 shield, s32 boots) {
Input* p1Input = &globalCtx->state.input[0];
Vec3f eye = { 0.0f, 0.0f, -400.0f };
Vec3f at = { 0.0f, 0.0f, 0.0f };
Vec3s* destTable;
Vec3s* srcTable;
s32 i;
bool canswitchrnd = false;
s16 SelectedMode = CVar_GetS32("gPauseLiveLink", 1);
MinFrameCount = CVar_GetS32("gMinFrameCount", 200);
gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + 0x3800);
gSegments[6] = VIRTUAL_TO_PHYSICAL(segment + 0x8800);
if (CVar_GetS32("gPauseLiveLink", 0) || CVar_GetS32("gPauseTriforce", 0)) {
uintptr_t anim = gPlayerAnim_003238; // idle
uintptr_t* PauseMenuAnimSet[15][4] = {
{ 0, 0, 0, 0 }, // 0 = none
// IDLE // Two Handed // No shield // Kid Hylian Shield
{ gPlayerAnim_003238, gPlayerAnim_002BE0, gPlayerAnim_003240, gPlayerAnim_003240 }, // Idle
{ gPlayerAnim_003200, gPlayerAnim_003200, gPlayerAnim_003200, gPlayerAnim_003200 }, // Idle look around
{ gPlayerAnim_0033E0, gPlayerAnim_0033E0, gPlayerAnim_0033E0, gPlayerAnim_0033E0 }, // Idle Belt
{ gPlayerAnim_003418, gPlayerAnim_003418, gPlayerAnim_003418, gPlayerAnim_003418 }, // Idle shield adjust
{ gPlayerAnim_003420, gPlayerAnim_003428, gPlayerAnim_003420, gPlayerAnim_003420 }, // Idle test sword
{ gPlayerAnim_0033F0, gPlayerAnim_0033F0, gPlayerAnim_0033F0, gPlayerAnim_0033F0 }, // Idle yawn
{ gPlayerAnim_0025D0, gPlayerAnim_002BD0, gPlayerAnim_0025D0, gPlayerAnim_0025D0 }, // Battle Stance
{ gPlayerAnim_003290, gPlayerAnim_002BF8, gPlayerAnim_003290, gPlayerAnim_003290 }, // Walking (No shield)
{ gPlayerAnim_003268, gPlayerAnim_002BF8, gPlayerAnim_003268, gPlayerAnim_003268 }, // Walking (Holding shield)
{ gPlayerAnim_003138, gPlayerAnim_002B40, gPlayerAnim_003138, gPlayerAnim_003138 }, // Running (No shield)
{ gPlayerAnim_003140, gPlayerAnim_002B40, gPlayerAnim_003140, gPlayerAnim_003140 }, // Running (Holding shield)
{ gPlayerAnim_0031A8, gPlayerAnim_0031A8, gPlayerAnim_0031A8, gPlayerAnim_0031A8 }, // Hand on hip
{ gPlayerAnim_002AF0, gPlayerAnim_002928, gPlayerAnim_002AF0, gPlayerAnim_002AF0 }, // Spin Charge
{ gPlayerAnim_002820, gPlayerAnim_002820, gPlayerAnim_002820, gPlayerAnim_002820 }, // Look at hand
};
s16 AnimArraySize = ARRAY_COUNT(PauseMenuAnimSet);
if (CUR_EQUIP_VALUE(EQUIP_SWORD) >= 3)
anim = gPlayerAnim_002BE0; // Two Handed Anim
else if (CUR_EQUIP_VALUE(EQUIP_SHIELD) == 0)
anim = gPlayerAnim_003240;
else if (CUR_EQUIP_VALUE(EQUIP_SHIELD) == 2 && LINK_AGE_IN_YEARS == YEARS_CHILD)
anim = gPlayerAnim_003240;
if (CVar_GetS32("gPauseLiveLink", !0) || CVar_GetS32("gPauseTriforce", 0)) {
uintptr_t anim = 0; // Initialise anim
if (CUR_EQUIP_VALUE(EQUIP_SWORD) >= 3) {
EquipedStance = 1;
} else if (CUR_EQUIP_VALUE(EQUIP_SHIELD) == 0) {
EquipedStance = 2;
} else if (CUR_EQUIP_VALUE(EQUIP_SHIELD) == 2 && LINK_AGE_IN_YEARS == YEARS_CHILD) {
EquipedStance = 3;
} else {
// Link is idle so revert to 0
EquipedStance = 0;
}
if (SelectedMode == 16) {
// Apply Random function
s16 SwitchAtFrame = 0;
s16 CurAnimDuration = 0;
if (FrameCountSinceLastAnim == 0) {
// When opening Kaleido this will be passed one time
SelectedAnim = rand() % (AnimArraySize - 0);
if (SelectedAnim == 0) {
// prevent loading 0 that would result to a crash.
SelectedAnim = 1;
}
} else if (FrameCountSinceLastAnim >= 1) {
SwitchAtFrame = Animation_GetLastFrame(PauseMenuAnimSet[SelectedAnim][EquipedStance]);
CurAnimDuration = Animation_GetLastFrame(PauseMenuAnimSet[SelectedAnim][EquipedStance]);
if (SwitchAtFrame < MinFrameCount) {
// Animation frame count is lower than minimal wait time then we wait for another round.
// This will be looped to always add current animation time if that still lower than minimum time
while (SwitchAtFrame < MinFrameCount) {
SwitchAtFrame = SwitchAtFrame + CurAnimDuration;
}
} else if (CurAnimDuration >= MinFrameCount) {
// Since we have more (or same) animation time than min duration we set the wait time to animation
// time.
SwitchAtFrame = CurAnimDuration;
}
if (FrameCountSinceLastAnim >= SwitchAtFrame) {
SelectedAnim = rand() % (AnimArraySize - 0);
if (SelectedAnim == 0) {
// prevent loading 0 that would result to a crash.
SelectedAnim = 1;
}
FrameCountSinceLastAnim = 1;
}
anim = PauseMenuAnimSet[SelectedAnim][EquipedStance];
}
FrameCountSinceLastAnim++;
} else if (SelectedMode == 15) {
// When opening Kaleido this will be passed one time
if (FrameCountSinceLastAnim < 1) {
SelectedAnim = rand() % (AnimArraySize - 0);
FrameCountSinceLastAnim++;
if (SelectedAnim == 0) {
// prevent loading 0 that would result to a crash.
SelectedAnim = 1;
}
FrameCountSinceLastAnim = 1;
}
if (CHECK_BTN_ALL(p1Input->press.button, BTN_B) || CHECK_BTN_ALL(p1Input->press.button, BTN_START)) {
FrameCountSinceLastAnim = 0;
}
anim = PauseMenuAnimSet[SelectedAnim][EquipedStance];
} else if (SelectedMode < 16) {
// Not random so we place our CVar as SelectedAnim
SelectedAnim = SelectedMode;
anim = PauseMenuAnimSet[SelectedAnim][EquipedStance];
}
anim = PauseMenuAnimSet[SelectedAnim][EquipedStance];
//anim = gPlayerAnim_003428; // Use for biggoron sword?

View file

@ -836,7 +836,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
for (i = 0; i < ARRAY_COUNTU(sZeldaMagic) - 3; i++) {
if (sZeldaMagic[i + SRAM_HEADER_MAGIC] != sramCtx->readBuff[i + SRAM_HEADER_MAGIC]) {
osSyncPrintf("SRAM破壊!!!!!!\n"); // "SRAM destruction! ! ! ! ! !"
gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE];
gSaveContext.language = CVar_GetS32("gLanguages", 0);
memcpy(sramCtx->readBuff, sZeldaMagic, sizeof(sZeldaMagic));
sramCtx->readBuff[SRAM_HEADER_LANGUAGE] = gSaveContext.language;
Sram_WriteSramHeader(sramCtx);
@ -845,7 +845,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
gSaveContext.audioSetting = sramCtx->readBuff[SRAM_HEADER_SOUND] & 3;
gSaveContext.zTargetSetting = sramCtx->readBuff[SRAM_HEADER_ZTARGET] & 1;
gSaveContext.language = sramCtx->readBuff[SRAM_HEADER_LANGUAGE];
gSaveContext.language = CVar_GetS32("gLanguages", 0);
if (gSaveContext.language >= LANGUAGE_MAX) {
gSaveContext.language = LANGUAGE_ENG;

View file

@ -366,7 +366,9 @@ void func_80ACA7E0(EnOwl* this, GlobalContext* globalCtx) {
void EnOwl_ConfirmKokiriMessage(EnOwl* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) {
switch (globalCtx->msgCtx.choiceIndex) {
// swap the order of the responses if better owl is enabled
uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex);
switch (index) {
case OWL_REPEAT:
Message_ContinueTextbox(globalCtx, 0x2065);
break;
@ -393,7 +395,9 @@ void EnOwl_WaitOutsideKokiri(EnOwl* this, GlobalContext* globalCtx) {
void func_80ACA998(EnOwl* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) {
switch (globalCtx->msgCtx.choiceIndex) {
// swap the order of the responses if better owl is enabled
uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex);
switch (index) {
case OWL_REPEAT:
Message_ContinueTextbox(globalCtx, 0x2069);
this->actionFunc = func_80ACAA54;
@ -437,7 +441,9 @@ void EnOwl_WaitHyruleCastle(EnOwl* this, GlobalContext* globalCtx) {
void func_80ACAB88(EnOwl* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) {
switch (globalCtx->msgCtx.choiceIndex) {
// swap the order of the responses if better owl is enabled
uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex);
switch (index) {
case OWL_REPEAT:
// obtained zelda's letter
if (gSaveContext.eventChkInf[4] & 1) {
@ -478,7 +484,9 @@ void EnOwl_WaitKakariko(EnOwl* this, GlobalContext* globalCtx) {
void func_80ACAD34(EnOwl* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) {
switch (globalCtx->msgCtx.choiceIndex) {
// swap the order of the responses if better owl is enabled
uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex);
switch (index) {
case OWL_REPEAT:
Message_ContinueTextbox(globalCtx, 0x206F);
this->actionFunc = func_80ACADF0;
@ -514,7 +522,9 @@ void EnOwl_WaitGerudo(EnOwl* this, GlobalContext* globalCtx) {
void func_80ACAEB8(EnOwl* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) {
switch (globalCtx->msgCtx.choiceIndex) {
// swap the order of the responses if better owl is enabled
uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex);
switch (index) {
case OWL_REPEAT:
Message_ContinueTextbox(globalCtx, 0x2071);
this->actionFunc = func_80ACAF74;
@ -634,7 +644,9 @@ void EnOwl_WaitDeathMountainShortcut(EnOwl* this, GlobalContext* globalCtx) {
void func_80ACB344(EnOwl* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) {
switch (globalCtx->msgCtx.choiceIndex) {
// swap the order of the responses if better owl is enabled
uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex);
switch (index) {
case OWL_REPEAT:
Message_ContinueTextbox(globalCtx, 0x607A);
break;
@ -657,7 +669,9 @@ void func_80ACB3E0(EnOwl* this, GlobalContext* globalCtx) {
void func_80ACB440(EnOwl* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) {
switch (globalCtx->msgCtx.choiceIndex) {
// swap the order of the responses if better owl is enabled
uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex);
switch (index) {
case OWL_REPEAT:
Message_ContinueTextbox(globalCtx, 0x10C1);
this->actionFunc = func_80ACB4FC;
@ -692,7 +706,9 @@ void EnOwl_WaitLWPreSaria(EnOwl* this, GlobalContext* globalCtx) {
void func_80ACB5C4(EnOwl* this, GlobalContext* globalCtx) {
if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(globalCtx)) {
switch (globalCtx->msgCtx.choiceIndex) {
// swap the order of the responses if better owl is enabled
uint8_t index = CVar_GetS32("gBetterOwl", 0) == 0 ? globalCtx->msgCtx.choiceIndex : (1 - globalCtx->msgCtx.choiceIndex);
switch (index) {
case OWL_REPEAT:
Message_ContinueTextbox(globalCtx, 0x10C5);
this->actionFunc = func_80ACB680;

View file

@ -5,6 +5,8 @@
#include "textures/title_static/title_static.h"
#include "textures/parameter_static/parameter_static.h"
#include "soh/frame_interpolation.h"
static s16 sUnused = 106;
static s16 sScreenFillAlpha = 255;
@ -1136,6 +1138,8 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
FileChoose_SetWindowVtx(&this->state);
FileChoose_SetWindowContentVtx(&this->state);
FrameInterpolation_RecordOpenChild(this, this->configMode);
if ((this->configMode != CM_NAME_ENTRY) && (this->configMode != CM_START_NAME_ENTRY)) {
gDPPipeSync(POLY_OPA_DISP++);
gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
@ -1227,6 +1231,8 @@ void FileChoose_ConfigModeDraw(GameState* thisx) {
gDPPipeSync(POLY_OPA_DISP++);
FileChoose_SetView(this, 0.0f, 0.0f, 64.0f);
FrameInterpolation_RecordCloseChild();
CLOSE_DISPS(this->state.gfxCtx, "../z_file_choose.c", 2352);
}
@ -1669,7 +1675,9 @@ void FileChoose_Main(GameState* thisx) {
FileChoose_PulsateCursor(&this->state);
gFileSelectUpdateFuncs[this->menuMode](&this->state);
FrameInterpolation_StartRecord();
gFileSelectDrawFuncs[this->menuMode](&this->state);
FrameInterpolation_StopRecord();
// do not draw controls text in the options menu
if ((this->configMode <= CM_NAME_ENTRY_TO_MAIN) || (this->configMode >= CM_UNUSED_DELAY)) {

View file

@ -89,11 +89,17 @@ void KaleidoScope_DrawEquipmentImage(GlobalContext* globalCtx, void* source, u32
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_kaleido_equipment.c", 122);
}
Vec3s link_kaleido_rot = { 0, 32300, 0 }; // Default rotation link face us.
void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx) {
PauseContext* pauseCtx = &globalCtx->pauseCtx;
Vec3f pos;
Vec3s rot;
//Vec3s rot; // Removed for not having it use din the function
f32 scale;
Input* input = &globalCtx->state.input[0];
s16 RotationSpeed = 150 * CVar_GetS32("gPauseLiveLinkRotationSpeed", 0);
bool AllowCRotation = (CVar_GetS32("gPauseLiveLinkRotation", 0) == 2) ? true : false;
bool AllowDPadRotation = (CVar_GetS32("gPauseLiveLinkRotation", 0) == 1) ? true : false;
if (LINK_AGE_IN_YEARS == YEARS_CHILD) {
pos.x = 2.0f;
@ -112,11 +118,29 @@ void KaleidoScope_DrawPlayerWork(GlobalContext* globalCtx) {
scale = 0.047f;
}
rot.y = 32300;
rot.x = rot.z = 0;
link_kaleido_rot.x = link_kaleido_rot.z = 0;
if (AllowDPadRotation && CHECK_BTN_ALL(input->cur.button, BTN_DLEFT) ||
AllowCRotation && CHECK_BTN_ALL(input->cur.button, BTN_CLEFT)) {
link_kaleido_rot.y = link_kaleido_rot.y - RotationSpeed;
} else if (AllowDPadRotation && CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT) ||
AllowCRotation && CHECK_BTN_ALL(input->cur.button, BTN_CRIGHT)) {
link_kaleido_rot.y = link_kaleido_rot.y + RotationSpeed;
}
if (AllowDPadRotation && CHECK_BTN_ALL(input->press.button, BTN_DUP) ||
AllowDPadRotation && CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) {
link_kaleido_rot.y = 32300;
} else if (AllowCRotation && CHECK_BTN_ALL(input->press.button, BTN_CUP) ||
AllowCRotation && CHECK_BTN_ALL(input->press.button, BTN_CDOWN)) {
link_kaleido_rot.y = 32300;
}
link_kaleido_rot.x = 0;
extern int fbTest;
gsSPSetFB(globalCtx->state.gfxCtx->polyOpa.p++, fbTest);
func_8009214C(globalCtx, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime, &pos, &rot, scale,
func_8009214C(globalCtx, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime, &pos, &link_kaleido_rot, scale,
CUR_EQUIP_VALUE(EQUIP_SWORD), CUR_EQUIP_VALUE(EQUIP_TUNIC) - 1, CUR_EQUIP_VALUE(EQUIP_SHIELD),
CUR_EQUIP_VALUE(EQUIP_BOOTS) - 1);
gsSPResetFB(globalCtx->state.gfxCtx->polyOpa.p++);

View file

@ -976,14 +976,23 @@ void KaleidoScope_DrawCursor(GlobalContext* globalCtx, u16 pageIndex) {
temp = pauseCtx->unk_1E4;
if (CVar_GetS32("gHudColors", 1) == 0) {
sCursorColors[1][0] = 255;
sCursorColors[1][1] = 255;
sCursorColors[1][2] = 0;
sCursorColors[2][0] = 0;
sCursorColors[2][1] = 50;
sCursorColors[2][2] = 255;
} else if (CVar_GetS32("gHudColors", 1) == 1) {
sCursorColors[1][0] = 255;
sCursorColors[1][1] = 255;
sCursorColors[1][2] = 0;
sCursorColors[2][0] = 0;
sCursorColors[2][1] = 255;
sCursorColors[2][2] = 50;
} else if (CVar_GetS32("gHudColors", 1) == 2) {
sCursorColors[1][0] = CVar_GetS32("gCCCBtnPrimR", 255);
sCursorColors[1][1] = CVar_GetS32("gCCCBtnPrimG", 255);
sCursorColors[1][2] = CVar_GetS32("gCCCBtnPrimB", 0);
sCursorColors[2][0] = CVar_GetS32("gCCABtnPrimR", 0);
sCursorColors[2][1] = CVar_GetS32("gCCABtnPrimG", 255);
sCursorColors[2][2] = CVar_GetS32("gCCABtnPrimB", 50);
@ -1060,6 +1069,12 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) {
{ 0, 0, 0 }, { 255, 255, 0 }, { 0, 255, 50 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 255, 50 },
};
if (CVar_GetS32("gHudColors", 1) == 0) {
D_8082ACF4[4][0] = 255;
D_8082ACF4[4][1] = 255;
D_8082ACF4[4][2] = 0;
D_8082ACF4[7][0] = 255;
D_8082ACF4[7][1] = 255;
D_8082ACF4[7][2] = 0;
D_8082ACF4[8][0] = 0;
D_8082ACF4[8][1] = 50;
D_8082ACF4[8][2] = 255;
@ -1067,6 +1082,12 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) {
D_8082ACF4[11][1] = 50;
D_8082ACF4[11][2] = 255;
} else if (CVar_GetS32("gHudColors", 1) == 1) {
D_8082ACF4[4][0] = 255;
D_8082ACF4[4][1] = 255;
D_8082ACF4[4][2] = 0;
D_8082ACF4[7][0] = 255;
D_8082ACF4[7][1] = 255;
D_8082ACF4[7][2] = 0;
D_8082ACF4[8][0] = 0;
D_8082ACF4[8][1] = 255;
D_8082ACF4[8][2] = 50;
@ -1074,6 +1095,12 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) {
D_8082ACF4[11][1] = 255;
D_8082ACF4[11][2] = 50;
} else if (CVar_GetS32("gHudColors", 1) == 2) {
D_8082ACF4[4][0] = CVar_GetS32("gCCCBtnPrimR", 255);
D_8082ACF4[4][1] = CVar_GetS32("gCCCBtnPrimG", 255);
D_8082ACF4[4][2] = CVar_GetS32("gCCCBtnPrimB", 0);
D_8082ACF4[7][0] = CVar_GetS32("gCCCBtnPrimR", 255);
D_8082ACF4[7][1] = CVar_GetS32("gCCCBtnPrimG", 255);
D_8082ACF4[7][2] = CVar_GetS32("gCCCBtnPrimB", 0);
D_8082ACF4[8][0] = CVar_GetS32("gCCABtnPrimR", 0);
D_8082ACF4[8][1] = CVar_GetS32("gCCABtnPrimG", 255);
D_8082ACF4[8][2] = CVar_GetS32("gCCABtnPrimB", 50);