Last active
February 17, 2025 22:57
-
-
Save camprevail/e2b70948ae85c38b5dae742f57a77099 to your computer and use it in GitHub Desktop.
museca - judge_hit_notes 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_hit_note(CGameSceneComponent *cGSC_, NoteStruct *noteStruct_) | |
{ | |
NoteStruct *noteStruct; // rdi | |
CGameSceneComponent *cGSC; // rbx | |
int v4; // eax | |
int noteTimeDelta; // er13 | |
float flt_noteTimeDelta; // xmm6_4 | |
float temp_flt; // xmm0_4 | |
int judgeType; // esi | |
NOTE_TYPE_INTERNAL lane; // er11 | |
char btnPressed; // r9 | |
signed int abs_noteTimeDelta; // er10 | |
BUTTON_TYPE btn; // ecx | |
PlayScore *ptr_PlayScore_; // rcx | |
int judgeFrame; // eax | |
int v15; // er12 | |
int judgeFrame_; // eax | |
PlayScore *ptr_PlayScore; // rcx | |
signed __int64 v18; // rdx | |
__int64 v19; // rcx | |
signed int v20; // eax | |
if ( !noteStruct_ ) | |
return; | |
noteStruct = noteStruct_; | |
cGSC = cGSC_; | |
if ( noteStruct_->judged ) | |
return; | |
if ( noteStruct_->kind_internal ) // if it's anything but a hit note | |
return; | |
v4 = cGSC_->hit_note_judgedLaneMask; | |
if ( _bittest(&v4, noteStruct_->lane) ) | |
return; | |
noteTimeDelta = cGSC_->currentTime - cGSC_->offset - noteStruct_->stime_ms; | |
if ( noteTimeDelta <= -300 ) | |
return; | |
flt_noteTimeDelta = noteTimeDelta; | |
temp_flt = PlayScore::GetJudgeWindow(&cGSC_->PlayScore, NEAR) * 2.0;// Getting some value from PlayScore->GiftParam. | |
// For NEAR, 72 is returned | |
if ( noteTimeDelta <= temp_flt ) | |
{ | |
lane = noteStruct_->lane; | |
btnPressed = 0; | |
abs_noteTimeDelta = abs(noteTimeDelta); | |
switch ( lane ) | |
{ | |
case 0: | |
btn = 4; | |
goto LABEL_15; | |
case 1: | |
btn = 5; | |
goto LABEL_15; | |
case 2: | |
btn = 6; | |
goto LABEL_15; | |
case 3: | |
btn = 7; | |
goto LABEL_15; | |
case 4: | |
btn = 8; | |
LABEL_15: | |
if ( CRVOLDevice::GetButtonTrigger(btn) ) | |
btnPressed = 1; | |
break; | |
case 5: | |
if ( CRVOLDevice::GetButtonTrigger(btn_pedal) ) | |
btnPressed = 1; | |
break; | |
default: | |
break; | |
} | |
if ( cGSC->autoplay || dead_debug_check() ) | |
{ | |
if ( cGSC->currentTime < (noteStruct->stime_ms - 8.335) ) | |
return; | |
judgeType = CRITICAL; | |
if ( flt_noteTimeDelta >= 0.0 ) | |
{ | |
temp_flt = floorf((flt_noteTimeDelta + 8.335) / 16.67);// 16.67 is the length of one frame in ms | |
judgeFrame = temp_flt; | |
goto update_just_checker; | |
} | |
} | |
else | |
{ | |
if ( !btnPressed ) | |
return; | |
judgeType = CRITICAL; | |
ptr_PlayScore_ = &cGSC->PlayScore; | |
if ( lane == PEDAL_AND_MARKERS ) | |
{ // this code doesn't belong here lol. It'll never get called | |
temp_flt = PlayScore::GetJudgeWindow(ptr_PlayScore_, CRITICAL) * 1.5; | |
if ( temp_flt < abs_noteTimeDelta ) | |
{ | |
temp_flt = PlayScore::GetJudgeWindow(&cGSC->PlayScore, NEAR) * 3.0; | |
if ( temp_flt < abs_noteTimeDelta ) | |
return; | |
judgeType = NEAR; | |
} | |
goto NEAR_stuff; | |
} | |
if ( abs_noteTimeDelta > PlayScore::GetJudgeWindow(ptr_PlayScore_, CRITICAL) )// returns 48 for crit | |
{ | |
temp_flt = PlayScore::GetJudgeWindow(&cGSC->PlayScore, NEAR) * 2.0;// returns 72 * 2.0 (144 for near) | |
if ( temp_flt < abs_noteTimeDelta ) // if note is past the near window, just return. But this judge function should never be entered if this were the case anyways. | |
return; | |
judgeType = NEAR; | |
goto NEAR_stuff; // TLDR: | |
// judgeType = CRITICAL | |
// if abs_noteTimeDelta is in range(48, 144): | |
// judgeType = NEAR | |
// else: | |
// return | |
} | |
if ( flt_noteTimeDelta >= 0.0 ) | |
{ | |
temp_flt = floorf((flt_noteTimeDelta + 8.335) / 16.67); | |
judgeFrame = temp_flt; | |
goto update_just_checker; | |
} | |
} | |
temp_flt = floorf((abs_noteTimeDelta + 8.335) / 16.67); | |
judgeFrame = -temp_flt; | |
update_just_checker: | |
if ( judgeFrame ) // Increments the just_checker values seen in the save_m request. | |
// Appears to be for critical notes only. | |
{ | |
switch ( judgeFrame ) | |
{ | |
case 1: | |
++cGSC->after_1; | |
break; | |
case 0xFFFFFFFF: | |
++cGSC->before_1; | |
break; | |
case 2: | |
++cGSC->after_2; | |
break; | |
case 0xFFFFFFFE: | |
++cGSC->before_2; | |
break; | |
default: | |
if ( judgeFrame <= 2 ) | |
{ | |
if ( judgeFrame < -2 ) | |
++cGSC->before_3; | |
} | |
else | |
{ | |
++cGSC->after_3; | |
} | |
break; | |
} | |
} | |
else | |
{ | |
++cGSC->just; | |
} | |
goto NEAR_stuff; | |
} | |
judgeType = 1; | |
if ( !cGSC->field_4FC0 ) | |
cGSC->field_4FC0 = 10; | |
NEAR_stuff: | |
v15 = 0; | |
cGSC->field_4FE7 = 1; | |
cGSC->field_4FBC = 10; | |
cGSC->early_late_indicator = 0; | |
if ( judgeType != ERROR ) | |
cGSC->note_hit_array[noteStruct->lane] = 1; // a byte array that sets a value at the index of the lane if the note was hit | |
if ( judgeType == NEAR ) | |
{ | |
if ( flt_noteTimeDelta < 0.0 ) // if early | |
{ | |
temp_flt = floorf((abs(noteTimeDelta) + 8.335) / 16.67); | |
judgeFrame_ = -temp_flt; // negate if early | |
} | |
else | |
{ | |
temp_flt = floorf((flt_noteTimeDelta + 8.335) / 16.67); | |
judgeFrame_ = temp_flt; | |
} | |
LOBYTE(v15) = judgeFrame_ >= 0; | |
cGSC->early_late_indicator = v15 + 2; | |
} | |
NoteStruct::SetJudgeInfo(noteStruct, judgeType, cGSC->currentTime); | |
ptr_PlayScore = &cGSC->PlayScore; | |
if ( noteStruct->is_GA_note ) | |
{ | |
v18 = (&cGSC->GiftParam + 397 * noteStruct->GA_grafica_index); | |
cGSC->PlayScore.GiftParam__ = cGSC->PlayScore.GiftParam.GiftParam_Current; | |
cGSC->PlayScore.GiftParam.GiftParam_Current = v18; | |
update_playscore( | |
cGSC->currentTime, | |
ptr_PlayScore, | |
noteStruct->lane, | |
noteStruct->kind_internal, | |
temp_flt, | |
judgeType, | |
2, | |
noteStruct->GA_grafica_index); | |
} | |
else | |
{ | |
update_playscore( | |
cGSC->currentTime, | |
ptr_PlayScore, | |
noteStruct->lane, | |
noteStruct->kind_internal, | |
temp_flt, | |
judgeType, | |
1, | |
noteStruct->GA_grafica_index); | |
} | |
copyNoteStruct(&cGSC->CGameSequence, noteStruct);// move note struct to judged note structs | |
set_judge_frame_labels(cGSC->CLayerJudgeComponent, noteStruct->lane, noteStruct->judgeType); | |
v19 = cGSC->GameMatchingComponent; | |
if ( v19 ) | |
{ | |
sub_1801F6C50(v19, cGSC->PlayScore.total_score); | |
if ( cGSC->mission_mode == 1 ) | |
sub_1801F6C20(cGSC->GameMatchingComponent, *&cGSC->PlayScore.gap1B0[4]); | |
sub_1801F7C30(cGSC->GameMatchingComponent); | |
} | |
if ( judgeType == ERROR ) | |
{ | |
v20 = cGSC->field_4FC0; | |
if ( !v20 ) | |
v20 = 10; | |
cGSC->field_4FC0 = v20; | |
} | |
else | |
{ | |
sub_1801FF080(&cGSC->field_1C60, noteStruct->lane, judgeType); | |
*(cGSC->field_9C4 + 3 * noteStruct->lane) = 0x3F800000; | |
cGSC->hold_note_hit_array[noteStruct->lane] = 14; | |
if ( noteStruct->lane == PEDAL_AND_MARKERS ) | |
{ | |
if ( noteStruct->judgeType == CRITICAL ) | |
cGSC->pedalnote_crit_lanemask |= 1 << noteStruct->lane; | |
if ( noteStruct->judgeType == NEAR ) | |
cGSC->pedalnote_near_lanemask |= 1 << noteStruct->lane; | |
} | |
else | |
{ | |
if ( noteStruct->judgeType == CRITICAL ) | |
cGSC->hit_note_crit_lanemask |= 1 << noteStruct->lane; | |
if ( noteStruct->judgeType == NEAR ) | |
cGSC->hit_note_near_lanemask |= 1 << noteStruct->lane; | |
cGSC->hit_note_judgedLaneMask |= 1 << noteStruct->lane; | |
} | |
if ( cGSC->field_20427 ) | |
++cGSC->field_19196; | |
if ( cGSC->field_20428 ) | |
++cGSC->field_19200; | |
sub_1801F81A0(&cGSC->DrawLane, noteStruct->lane, judgeType); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment