Created
February 18, 2025 01:52
-
-
Save camprevail/129f545c4b5e11c6389c4312487f4ef8 to your computer and use it in GitHub Desktop.
museca - judge_spin_note decomp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void __fastcall judge_spin_note(CGameSceneComponent *cGSC_, NoteStruct *noteStruct) | |
{ | |
NoteStruct *NS; // rbx | |
CGameSceneComponent *cGSC; // rdi | |
NOTE_KIND_INTERNAL kind; // er8 | |
int stime; // eax | |
float v6; // xmm0_4 | |
int adjTime; // edx | |
float noteTimeDelta__; // xmm4_4 | |
__int64 lane; // rax | |
int v10; // er9 | |
int analogDiff; // er15 | |
char triggered; // r13 | |
char v13; // r14 | |
char v14; // si | |
char v15; // r11 | |
signed __int64 v16; // rdx | |
signed int v17; // er12 | |
char v18; // r10 | |
__int64 *v19; // rcx | |
bool v20; // sf | |
NOTE_KIND_INTERNAL kind_; // er8 | |
JUDGETYPE v22; // eax | |
bool v23; // zf | |
bool v24; // sf | |
unsigned __int8 v25; // of | |
NOTE_TYPE_INTERNAL v26; // eax | |
int v27; // eax | |
int v28; // ecx | |
char v29; // al | |
signed int v30; // eax | |
__m128i duration; // xmm0 | |
__int64 v32; // rax | |
signed int v33; // ecx | |
int judgeType; // esi | |
NOTE_KIND_INTERNAL v35; // eax | |
NOTE_KIND_INTERNAL v36; // eax | |
signed int abs_noteTimeDelta; // ecx | |
float abs_noteTimeDelta_; // xmm1_4 | |
NOTE_KIND_INTERNAL v39; // eax | |
int v40; // eax | |
NOTE_TYPE_INTERNAL v41; // eax | |
NOTE_KIND_INTERNAL v42; // eax | |
int judgeFrame; // ecx | |
PlayScore *PS; // rcx | |
signed __int64 v45; // rdx | |
__int64 v46; // rcx | |
NOTE_KIND_INTERNAL v47; // eax | |
__int64 v48; // rax | |
__int64 v49; // rax | |
signed int v50; // ecx | |
signed int v51; // ecx | |
int noteTimeDelta; // [rsp+40h] [rbp-58h] | |
int endTimeDelta; // [rsp+B0h] [rbp+18h] | |
int noteTimeDelta_; // [rsp+B8h] [rbp+20h] | |
NS = noteStruct; | |
cGSC = cGSC_; | |
if ( !noteStruct ) | |
return; | |
kind = noteStruct->kind_internal; | |
if ( kind == EVENT_KIND_HIT_NOTE ) | |
return; | |
if ( kind == 1 ) | |
return; | |
stime = noteStruct->stime_ms; | |
v6 = -300.0; | |
adjTime = cGSC_->currentTime - cGSC_->offset; | |
noteTimeDelta = adjTime - stime; | |
noteTimeDelta_ = adjTime - stime; | |
endTimeDelta = adjTime - NS->duration_ms_ - stime; | |
noteTimeDelta__ = (adjTime - stime); | |
if ( noteTimeDelta__ <= -300.0 ) | |
return; | |
lane = NS->lane; | |
v10 = *(&cGSC_->field_4EC4 + lane); | |
analogDiff = *(&cGSC_->analogDiff + lane); | |
triggered = 0; | |
v13 = 0; | |
v14 = 0; | |
v15 = 0; | |
v16 = 0i64; | |
v17 = 1; | |
v18 = 1; | |
v19 = &cGSC_->field_4EDC + 4 * lane; | |
while ( !*v19 ) | |
{ | |
++v16; | |
v19 = (v19 + 4); | |
if ( v16 >= 8 ) | |
goto LABEL_11; | |
} | |
v18 = 0; | |
LABEL_11: | |
if ( kind == 2 || kind == 4 || kind == 3 ) // if large spin kind | |
{ | |
v6 = PlayScore::GetJudgeWindow(&cGSC->PlayScore, NEAR) * 4.0; | |
if ( v6 > noteTimeDelta__ ) | |
{ | |
v17 = 4; | |
if ( analogDiff > 4 ) | |
v15 = 1; | |
if ( analogDiff >= -4 ) | |
goto LABEL_42; | |
goto LABEL_41; | |
} | |
v6 = endTimeDelta; | |
if ( endTimeDelta >= 0.0 ) | |
goto LABEL_45; | |
v17 = 0; | |
v20 = analogDiff < 0; | |
if ( analogDiff > 0 ) | |
{ | |
if ( analogDiff - v10 > 0 || v10 < 0 || v18 ) | |
v15 = 1; | |
v20 = analogDiff < 0; | |
} | |
if ( !v20 ) | |
goto LABEL_42; | |
if ( analogDiff - v10 < 0 || v10 > 0 ) | |
goto LABEL_41; | |
} | |
else | |
{ | |
if ( analogDiff > 1 && (analogDiff - v10 > 1 || v10 < 0) || analogDiff > 0 && v18 ) | |
v15 = 1; | |
if ( analogDiff < -1 && (analogDiff - v10 < -1 || v10 > 0) ) | |
goto LABEL_41; | |
if ( analogDiff >= 0 ) | |
goto LABEL_42; | |
} | |
if ( v18 ) | |
LABEL_41: | |
v14 = 1; | |
LABEL_42: | |
if ( v15 || v14 ) | |
v13 = 1; | |
LABEL_45: | |
if ( cGSC->autoplay || dead_debug_check() ) | |
triggered = 1; | |
kind_ = NS->kind_internal; | |
switch ( kind_ ) | |
{ | |
case EVENT_KIND_LARGE_SPINNER: | |
if ( NS->judged ) | |
{ | |
++NS->holdnote_active_frames; | |
if ( *&cGSC->gapE8[64] ) | |
{ | |
v22 = NS->judgeType; | |
if ( v22 == 3 ) | |
{ | |
triggered = 1; | |
} | |
else if ( v22 == 2 ) | |
{ | |
v6 = NS->stime_ms; | |
if ( ((NS->duration_ms * 0.5) + v6) > cGSC->currentTime ) | |
triggered = 1; | |
} | |
} | |
else if ( abs(analogDiff) > v17 ) | |
{ | |
triggered = 1; | |
} | |
} | |
else if ( v13 ) | |
{ | |
triggered = 1; | |
v25 = 0; | |
v23 = analogDiff == 0; | |
v24 = analogDiff < 0; | |
if ( analogDiff >= 0 ) | |
goto LABEL_78; | |
NS->field_5C = -1; | |
} | |
break; | |
case EVENT_KIND_LARGE_SPINNER_LEFT: | |
if ( !NS->judged ) | |
goto LABEL_80; | |
if ( analogDiff < -v17 ) | |
triggered = 1; | |
goto LABEL_67; | |
case EVENT_KIND_LARGE_SPINNER_RIGHT: | |
if ( !NS->judged ) | |
goto LABEL_72; | |
if ( analogDiff > v17 ) | |
triggered = 1; | |
LABEL_67: | |
if ( *&cGSC->gapE8[64] == 2 ) | |
triggered = 1; | |
break; | |
case EVENT_KIND_SMALL_SPINNER: | |
if ( !v13 ) | |
break; | |
triggered = 1; | |
if ( analogDiff >= -v17 ) | |
{ | |
v25 = __OFSUB__(analogDiff, v17); | |
v23 = analogDiff == v17; | |
v24 = analogDiff - v17 < 0; | |
LABEL_78: | |
if ( (v24 ^ v25) | v23 ) | |
{ | |
v26 = NS->lane; | |
if ( v26 && v26 != 1 ) | |
NS->field_5C = 1; | |
else | |
LABEL_82: | |
NS->field_5C = -1; | |
} | |
else | |
{ | |
NS->field_5C = 1; | |
} | |
} | |
else | |
{ | |
NS->field_5C = -1; | |
} | |
break; | |
case EVENT_KIND_SMALL_SPINNER_LEFT: | |
LABEL_80: | |
if ( !v14 ) | |
break; | |
triggered = 1; | |
goto LABEL_82; | |
case EVENT_KIND_SMALL_SPINNER_RIGHT: | |
LABEL_72: | |
if ( v15 ) | |
{ | |
triggered = 1; | |
NS->field_5C = 1; | |
} | |
break; | |
default: | |
break; | |
} | |
v27 = NS->holdnote_freewheel_frames; | |
if ( v27 ) | |
NS->holdnote_freewheel_frames = v27 - 1; | |
if ( !NS->judged ) | |
{ | |
judgeType = 0; | |
if ( endTimeDelta <= 0.0 || kind_ != 2 && kind_ != 3 && kind_ != 4 ) | |
{ | |
v6 = PlayScore::GetJudgeWindow(&cGSC->PlayScore, NEAR) * 2.0; | |
if ( noteTimeDelta__ <= v6 || (v35 = NS->kind_internal, v35 != 5) && v35 != 6 && v35 != 7 ) | |
{ | |
if ( cGSC->autoplay || dead_debug_check() ) | |
{ | |
v40 = NS->stime_ms; | |
v25 = __OFSUB__(cGSC->currentTime, v40); | |
v20 = cGSC->currentTime - v40 < 0; | |
v41 = NS->lane; | |
if ( !(v20 ^ v25) ) | |
judgeType = CRITICAL; | |
if ( v41 && v41 != 1 ) | |
NS->field_5C = 1; | |
else | |
NS->field_5C = -1; | |
v42 = NS->kind_internal; | |
if ( v42 == 6 || v42 == CRITICAL ) | |
NS->field_5C = -1; | |
if ( v42 == 7 || v42 == 4 ) | |
NS->field_5C = 1; | |
} | |
else | |
{ | |
if ( !triggered ) | |
return; | |
v36 = NS->kind_internal; | |
abs_noteTimeDelta = abs(noteTimeDelta_); | |
if ( v36 == 2 || v36 == 3 || v36 == 4 )// large spinnies | |
{ | |
v6 = -PlayScore::GetJudgeWindow(&cGSC->PlayScore, CRITICAL) * 2.0;// -96 | |
if ( noteTimeDelta__ < v6 // if noteTimeDelta is between -144 and -96 (-144 is the beginning of the near window for all notes) | |
|| (v6 = PlayScore::GetJudgeWindow(&cGSC->PlayScore, NEAR) * 4.0, v6 <= noteTimeDelta__) )// noteTimeDelta >= 288 | |
{ | |
if ( endTimeDelta < 0.0 ) // if note hasn't ended yet | |
judgeType = NEAR; | |
} | |
else | |
{ | |
judgeType = CRITICAL; | |
} | |
} | |
else | |
{ // small spinnies | |
abs_noteTimeDelta_ = abs_noteTimeDelta; | |
v6 = PlayScore::GetJudgeWindow(&cGSC->PlayScore, CRITICAL) * 2.0; | |
if ( v6 < abs_noteTimeDelta_ ) | |
{ | |
v6 = PlayScore::GetJudgeWindow(&cGSC->PlayScore, NEAR) * 2.0; | |
if ( v6 >= abs_noteTimeDelta_ ) | |
judgeType = NEAR; | |
} | |
else | |
{ | |
judgeType = CRITICAL; | |
} | |
} | |
if ( *&cGSC->gapE8[64] ) | |
{ | |
if ( !judgeType ) | |
return; | |
v39 = NS->kind_internal; | |
if ( v39 == 2 || v39 == 3 || v39 == 4 ) | |
{ | |
if ( abs(analogDiff) > 4 ) | |
{ | |
NS->field_28 = 1; | |
goto LABEL_150; | |
} | |
NS->field_28 = 0; | |
if ( judgeType == CRITICAL ) | |
{ | |
judgeType = NEAR; | |
LABEL_151: | |
NoteStruct::SetJudgeInfo(NS, judgeType, cGSC->currentTime); | |
cGSC->field_4FE7 = 1; | |
cGSC->early_late_indicator = 0; | |
if ( judgeType != 1 && (NS->kind_internal - 5) <= 2 ) | |
cGSC->note_hit_array[NS->lane] = 1; | |
if ( judgeType == NEAR ) | |
{ | |
if ( noteTimeDelta < 0.0 ) | |
{ | |
v6 = floorf((abs(noteTimeDelta) + 8.335) / 16.67); | |
judgeFrame = -v6; | |
} | |
else | |
{ | |
v6 = floorf((noteTimeDelta + 8.335) / 16.67); | |
judgeFrame = v6; | |
} | |
cGSC->early_late_indicator = (judgeFrame >= 0) + 2; | |
} | |
PS = &cGSC->PlayScore; | |
if ( NS->is_GA_note ) | |
{ | |
v45 = (&cGSC->GiftParam + 397 * NS->GA_grafica_index); | |
cGSC->PlayScore.GiftParam__ = cGSC->PlayScore.GiftParam.GiftParam_Current; | |
cGSC->PlayScore.GiftParam.GiftParam_Current = v45; | |
update_playscore( | |
cGSC->currentTime, | |
PS, | |
NS->lane, | |
NS->kind_internal, | |
v6, | |
judgeType, | |
2, | |
NS->GA_grafica_index); | |
} | |
else | |
{ | |
update_playscore( | |
cGSC->currentTime, | |
PS, | |
NS->lane, | |
NS->kind_internal, | |
v6, | |
judgeType, | |
1, | |
NS->GA_grafica_index); | |
} | |
copyNoteStruct(&cGSC->CGameSequence, NS); | |
set_judge_frame_labels(cGSC->CLayerJudgeComponent, NS->lane, NS->judgeType); | |
if ( judgeType != 1 ) | |
sub_1801FF080(&cGSC->field_1C60, NS->lane, judgeType); | |
NS->holdnote_freewheel_frames = 10; | |
NS->field_44 = 0; | |
v46 = cGSC->GameMatchingComponent; | |
if ( v46 ) | |
{ | |
sub_1801F6C50(v46, cGSC->PlayScore.total_score); | |
if ( cGSC->mission_mode == 1 ) | |
sub_1801F6C20(cGSC->GameMatchingComponent, *&cGSC->PlayScore.gap1B0[4]); | |
sub_1801F7C30(cGSC->GameMatchingComponent); | |
} | |
if ( judgeType != 1 ) | |
{ | |
if ( cGSC->field_20427 ) | |
++cGSC->field_19196; | |
if ( cGSC->field_20428 ) | |
++cGSC->field_19200; | |
} | |
if ( !NS->holdnote_freewheel_frames ) | |
{ | |
NS->holdnote_freewheel_frames = 10; | |
NS->field_44 = 0; | |
} | |
if ( judgeType != 1 ) | |
{ | |
cGSC->field_4FBC = 10; | |
if ( NS->field_5C > 0.0 ) | |
{ | |
*(&cGSC->CGameSceneComponent.vftable + 3i64 * NS->lane + 624) = 1065353216; | |
*(&cGSC->field_9C4[8] + NS->lane + 1) = 14; | |
} | |
if ( NS->field_5C < 0.0 ) | |
{ | |
*(&cGSC->CGameSceneComponent.vftable + 3i64 * NS->lane + 624) = -1082130432; | |
*(&cGSC->field_9C4[8] + NS->lane + 1) = 14; | |
} | |
v47 = NS->kind_internal; | |
if ( v47 >= EVENT_KIND_LARGE_SPINNER ) | |
{ | |
if ( v47 <= EVENT_KIND_LARGE_SPINNER_RIGHT ) | |
{ | |
if ( NS->judgeType == CRITICAL ) | |
cGSC->spin_note_crit_lanemask |= 1 << NS->lane; | |
if ( NS->judgeType == NEAR ) | |
cGSC->spin_note_near_lanemask |= 1 << NS->lane; | |
if ( NS->judgeType == CRITICAL ) | |
cGSC->large_spin_note_crit_lanemask |= 1 << NS->lane; | |
if ( NS->judgeType == NEAR ) | |
cGSC->large_spin_note_near_lanemask |= 1 << NS->lane; | |
v49 = NS->lane; | |
if ( !*(&cGSC->field_4FA4 + v49) ) | |
{ | |
v50 = -20; | |
if ( NS->field_5C <= 0 ) | |
v50 = 20; | |
*(&cGSC->field_4FA4 + v49) = v50; | |
} | |
++NS->holdnote_active_frames_; | |
} | |
else if ( v47 <= EVENT_KIND_SMALL_SPINNER_RIGHT ) | |
{ | |
v48 = NS->lane; | |
if ( NS->field_5C > 0 ) | |
*(&cGSC->field_4FA4 + v48) = -20; | |
else | |
*(&cGSC->field_4FA4 + v48) = 20; | |
if ( NS->judgeType == 3 ) | |
cGSC->small_spin_crit_lanemask |= 1 << NS->lane; | |
if ( NS->judgeType == 2 ) | |
cGSC->small_spin_near_lanemask |= 1 << NS->lane; | |
} | |
} | |
goto LABEL_203; | |
} | |
v51 = cGSC->field_4FC0; | |
if ( !v51 ) | |
v51 = 10; | |
cGSC->field_4FC0 = v51; | |
return; | |
} | |
} | |
} | |
} | |
LABEL_150: | |
if ( !judgeType ) | |
return; | |
goto LABEL_151; | |
} | |
} | |
judgeType = 1; | |
if ( !cGSC->field_4FC0 ) | |
cGSC->field_4FC0 = 10; | |
goto LABEL_151; | |
} | |
v28 = NS->holdnote_freewheel_frames; | |
v29 = triggered; | |
if ( v28 ) | |
v29 = 1; | |
if ( kind_ == 2 || kind_ == 3 || kind_ == 4 || v29 )// large spin kinds | |
{ | |
v30 = NS->holdnote_freewheel_frames; | |
if ( !v28 ) | |
v30 = 10; | |
NS->field_44 = 0; | |
NS->holdnote_freewheel_frames = v30; | |
if ( (kind_ - 2) > 2 ) // if large spin kind | |
goto LABEL_203; | |
if ( NS->judgeType == 3 ) | |
cGSC->spin_note_crit_lanemask |= 1 << NS->lane; | |
if ( NS->judgeType == 2 ) | |
cGSC->spin_note_near_lanemask |= 1 << NS->lane; | |
duration = _mm_cvtsi32_si128(NS->duration_ms); | |
if ( (COERCE_FLOAT(_mm_cvtepi32_ps(duration)) / 16.66666) >= ++NS->holdnote_active_frames_ ) | |
{ | |
v32 = NS->lane; | |
if ( !*(&cGSC->field_4FA4 + v32) ) | |
{ | |
v33 = -20; | |
if ( NS->field_5C <= 0 ) | |
v33 = 20; | |
*(&cGSC->field_4FA4 + v32) = v33; | |
} | |
LABEL_203: | |
sub_1801F81A0(&cGSC->DrawLane, NS->lane, NS->judgeType); | |
return; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment