diff --git a/src/game/data/data_0160b0.c b/src/game/data/data_0160b0.c index e6c855c3e..dca2f220e 100644 --- a/src/game/data/data_0160b0.c +++ b/src/game/data/data_0160b0.c @@ -2683,50 +2683,44 @@ struct menu_dialog menudialog_status = { }; // 196f8 -struct cutsceneentry cutscenetable[] = { - // stage ID, mission, scene, name file ID - { /* 0*/ STAGE_DEFECTION, 0, 0, 0x57c2 }, - { /* 1*/ STAGE_DEFECTION, 0, 1, 0x57c3 }, - { /* 2*/ STAGE_INVESTIGATION, 1, 0, 0x57c4 }, - { /* 3*/ STAGE_INVESTIGATION, 1, 1, 0x57c5 }, - { /* 4*/ STAGE_EXTRACTION, 2, 0, 0x57c6 }, - { /* 5*/ STAGE_EXTRACTION, 2, 1, 0x57c7 }, - { /* 6*/ STAGE_VILLA, 3, 0, 0x57c8 }, - { /* 7*/ STAGE_VILLA, 3, 2, 0x57ca }, - { /* 8*/ STAGE_CHICAGO, 4, 0, 0x57cb }, - { /* 9*/ STAGE_CHICAGO, 4, 1, 0x57cc }, - { /*10*/ STAGE_G5BUILDING, 5, 0, 0x57cd }, - { /*11*/ STAGE_G5BUILDING, 5, 1, 0x57ce }, - { /*12*/ STAGE_G5BUILDING, 5, 2, 0x57cf }, - { /*13*/ STAGE_INFILTRATION, 6, 0, 0x57d0 }, - { /*14*/ STAGE_INFILTRATION, 6, 1, 0x57d1 }, - { /*15*/ STAGE_RESCUE, 7, 0, 0x57d2 }, - { /*16*/ STAGE_RESCUE, 7, 1, 0x57d3 }, - { /*17*/ STAGE_ESCAPE, 8, 0, 0x57d4 }, - { /*18*/ STAGE_ESCAPE, 8, 1, 0x57d5 }, - { /*19*/ STAGE_ESCAPE, 8, 2, 0x57d6 }, - { /*20*/ STAGE_AIRBASE, 9, 0, 0x57d7 }, - { /*21*/ STAGE_AIRBASE, 9, 1, 0x57d8 }, - { /*22*/ STAGE_AIRFORCEONE, 10, 0, 0x57d9 }, - { /*23*/ STAGE_AIRFORCEONE, 10, 1, 0x57da }, - { /*24*/ STAGE_AIRFORCEONE, 10, 2, 0x57db }, - { /*25*/ STAGE_CRASHSITE, 11, 0, 0x57dc }, - { /*26*/ STAGE_CRASHSITE, 11, 1, 0x57dd }, - { /*27*/ STAGE_PELAGIC, 12, 0, 0x57de }, - { /*28*/ STAGE_PELAGIC, 12, 1, 0x57df }, - { /*29*/ STAGE_DEEPSEA, 13, 0, 0x57e0 }, - { /*30*/ STAGE_DEEPSEA, 13, 1, 0x57e1 }, - { /*31*/ STAGE_DEEPSEA, 13, 2, 0x57e2 }, - { /*32*/ STAGE_DEFENSE, 14, 0, 0x57e3 }, - { /*33*/ STAGE_DEFENSE, 14, 1, 0x57e4 }, - { /*34*/ STAGE_ATTACKSHIP, 15, 0, 0x57e5 }, - { /*35*/ STAGE_ATTACKSHIP, 15, 1, 0x57e6 }, - { /*36*/ STAGE_SKEDARRUINS, 16, 0, 0x57e7 }, - { /*37*/ STAGE_SKEDARRUINS, 16, 1, 0x57e8 }, +struct cutscene g_Cutscenes[] = { + // stage ID, mission, scene, name + { /* 0*/ STAGE_DEFECTION, 0, 0, L_OPTIONS(450) }, + { /* 1*/ STAGE_DEFECTION, 0, 1, L_OPTIONS(451) }, + { /* 2*/ STAGE_INVESTIGATION, 1, 0, L_OPTIONS(452) }, + { /* 3*/ STAGE_INVESTIGATION, 1, 1, L_OPTIONS(453) }, + { /* 4*/ STAGE_EXTRACTION, 2, 0, L_OPTIONS(454) }, + { /* 5*/ STAGE_EXTRACTION, 2, 1, L_OPTIONS(455) }, + { /* 6*/ STAGE_VILLA, 3, 0, L_OPTIONS(456) }, + { /* 7*/ STAGE_VILLA, 3, 2, L_OPTIONS(458) }, + { /* 8*/ STAGE_CHICAGO, 4, 0, L_OPTIONS(459) }, + { /* 9*/ STAGE_CHICAGO, 4, 1, L_OPTIONS(460) }, + { /*10*/ STAGE_G5BUILDING, 5, 0, L_OPTIONS(461) }, + { /*11*/ STAGE_G5BUILDING, 5, 1, L_OPTIONS(462) }, + { /*12*/ STAGE_G5BUILDING, 5, 2, L_OPTIONS(463) }, + { /*13*/ STAGE_INFILTRATION, 6, 0, L_OPTIONS(464) }, + { /*14*/ STAGE_INFILTRATION, 6, 1, L_OPTIONS(465) }, + { /*15*/ STAGE_RESCUE, 7, 0, L_OPTIONS(466) }, + { /*16*/ STAGE_RESCUE, 7, 1, L_OPTIONS(467) }, + { /*17*/ STAGE_ESCAPE, 8, 0, L_OPTIONS(468) }, + { /*18*/ STAGE_ESCAPE, 8, 1, L_OPTIONS(469) }, + { /*19*/ STAGE_ESCAPE, 8, 2, L_OPTIONS(470) }, + { /*20*/ STAGE_AIRBASE, 9, 0, L_OPTIONS(471) }, + { /*21*/ STAGE_AIRBASE, 9, 1, L_OPTIONS(472) }, + { /*22*/ STAGE_AIRFORCEONE, 10, 0, L_OPTIONS(473) }, + { /*23*/ STAGE_AIRFORCEONE, 10, 1, L_OPTIONS(474) }, + { /*24*/ STAGE_AIRFORCEONE, 10, 2, L_OPTIONS(475) }, + { /*25*/ STAGE_CRASHSITE, 11, 0, L_OPTIONS(476) }, + { /*26*/ STAGE_CRASHSITE, 11, 1, L_OPTIONS(477) }, + { /*27*/ STAGE_PELAGIC, 12, 0, L_OPTIONS(478) }, + { /*28*/ STAGE_PELAGIC, 12, 1, L_OPTIONS(479) }, + { /*29*/ STAGE_DEEPSEA, 13, 0, L_OPTIONS(480) }, + { /*30*/ STAGE_DEEPSEA, 13, 1, L_OPTIONS(481) }, + { /*31*/ STAGE_DEEPSEA, 13, 2, L_OPTIONS(482) }, + { /*32*/ STAGE_DEFENSE, 14, 0, L_OPTIONS(483) }, + { /*33*/ STAGE_DEFENSE, 14, 1, L_OPTIONS(484) }, + { /*34*/ STAGE_ATTACKSHIP, 15, 0, L_OPTIONS(485) }, + { /*35*/ STAGE_ATTACKSHIP, 15, 1, L_OPTIONS(486) }, + { /*36*/ STAGE_SKEDARRUINS, 16, 0, L_OPTIONS(487) }, + { /*37*/ STAGE_SKEDARRUINS, 16, 1, L_OPTIONS(488) }, }; - -// 198c0 -// Indexes into the above cutscenetable, where each entry is the first cutscene -// of each mission. - -// 19908 diff --git a/src/game/game_102240.c b/src/game/game_102240.c index 857d4702a..e2d4eec3b 100644 --- a/src/game/game_102240.c +++ b/src/game/game_102240.c @@ -4360,53 +4360,35 @@ glabel func0f106508 /* f1065bc: 00000000 */ sll $zero,$zero,0x0 ); -GLOBAL_ASM( -glabel func0f1065c0 -/* f1065c0: 3c06800a */ lui $a2,%hi(g_SoloSaveFile) -/* f1065c4: 3c08800a */ lui $t0,%hi(g_SoloSaveFile) -/* f1065c8: 00001825 */ or $v1,$zero,$zero -/* f1065cc: 25082200 */ addiu $t0,$t0,%lo(g_SoloSaveFile) -/* f1065d0: 24c62200 */ addiu $a2,$a2,%lo(g_SoloSaveFile) -/* f1065d4: 00001025 */ or $v0,$zero,$zero -/* f1065d8: 240a0003 */ addiu $t2,$zero,0x3 -/* f1065dc: 24090011 */ addiu $t1,$zero,0x11 -.L0f1065e0: -/* f1065e0: 00002025 */ or $a0,$zero,$zero -/* f1065e4: 00002825 */ or $a1,$zero,$zero -/* f1065e8: 00c03825 */ or $a3,$a2,$zero -.L0f1065ec: -/* f1065ec: 94ee0020 */ lhu $t6,0x20($a3) -/* f1065f0: 00057880 */ sll $t7,$a1,0x2 -/* f1065f4: 24a50001 */ addiu $a1,$a1,0x1 -/* f1065f8: 15c00007 */ bnez $t6,.L0f106618 -/* f1065fc: 010fc021 */ addu $t8,$t0,$t7 -/* f106600: 8f1900a0 */ lw $t9,0xa0($t8) -/* f106604: 240b0001 */ addiu $t3,$zero,0x1 -/* f106608: 004b6004 */ sllv $t4,$t3,$v0 -/* f10660c: 032c6824 */ and $t5,$t9,$t4 -/* f106610: 11a00004 */ beqz $t5,.L0f106624 -/* f106614: 00000000 */ sll $zero,$zero,0x0 -.L0f106618: -/* f106618: 24630001 */ addiu $v1,$v1,0x1 -/* f10661c: 10000003 */ beqz $zero,.L0f10662c -/* f106620: 24040001 */ addiu $a0,$zero,0x1 -.L0f106624: -/* f106624: 14aafff1 */ bne $a1,$t2,.L0f1065ec -/* f106628: 24e70002 */ addiu $a3,$a3,0x2 -.L0f10662c: -/* f10662c: 10800003 */ beqz $a0,.L0f10663c -/* f106630: 24420001 */ addiu $v0,$v0,0x1 -/* f106634: 1449ffea */ bne $v0,$t1,.L0f1065e0 -/* f106638: 24c60006 */ addiu $a2,$a2,0x6 -.L0f10663c: -/* f10663c: 03e00008 */ jr $ra -/* f106640: 00601025 */ or $v0,$v1,$zero -); - //-----------------------------------------------------------------------------\ // @dialog Cinema -------------------------------------------------------------/ //----------------------------------------------------------------------------/ +s32 getNumCompletedMissions(void) +{ + s32 s; + s32 d; + s32 count = 0; + + for (s = 0; s != 17; s++) { + bool done = false; + + for (d = 0; d != 3; d++) { + if (g_SoloSaveFile.besttimes[s][d] || (g_SoloSaveFile.coopcompletions[d] & (1 << s))) { + count++; + done = true; + break; + } + } + + if (!done) { + break; + } + } + + return count; +} + u32 g_CutsceneIndexes[] = { /* 0*/ 1, /* 1*/ 3, @@ -4451,17 +4433,17 @@ char *menuhandlerCinema(u32 operation, struct menu_item *item, s32 *value) switch (operation) { case MENUOP_GETOPTIONCOUNT: - *value = g_CutsceneIndexes[func0f1065c0()] + 1; + *value = g_CutsceneIndexes[getNumCompletedMissions()] + 1; break; case MENUOP_GETOPTIONTEXT: if (*value == 0) { sprintf(g_StringPointer, langGet(L_OPTIONS(448))); // "Play All" return g_StringPointer; } - return langGet(cutscenetable[*value - 1].name); + return langGet(g_Cutscenes[*value - 1].name); case MENUOP_SET: if (*value == 0) { - s32 index = func0f1065c0(); + s32 index = getNumCompletedMissions(); g_Vars.unk0004d4 = 0; g_Vars.unk0004d5 = g_CutsceneIndexes[index]; menuPopDialog(); diff --git a/src/game/game_167ae0.c b/src/game/game_167ae0.c index a26acea49..15d2f2d1a 100644 --- a/src/game/game_167ae0.c +++ b/src/game/game_167ae0.c @@ -3464,9 +3464,9 @@ glabel var7f1b7868 /* f16af48: 00000000 */ sll $zero,$zero,0x0 /* f16af4c: 826e04d4 */ lb $t6,0x4d4($s3) /* f16af50: 2414000c */ addiu $s4,$zero,0xc -/* f16af54: 3c118007 */ lui $s1,%hi(cutscenetable) +/* f16af54: 3c118007 */ lui $s1,%hi(g_Cutscenes) /* f16af58: 01d40019 */ multu $t6,$s4 -/* f16af5c: 263136d8 */ addiu $s1,$s1,%lo(cutscenetable) +/* f16af5c: 263136d8 */ addiu $s1,$s1,%lo(g_Cutscenes) /* f16af60: 3c10800a */ lui $s0,%hi(g_MissionConfig) /* f16af64: 2610dfe8 */ addiu $s0,$s0,%lo(g_MissionConfig) /* f16af68: 920c0003 */ lbu $t4,0x3($s0) diff --git a/src/include/game/data/data_0160b0.h b/src/include/game/data/data_0160b0.h index 9aeb79a37..483af80d1 100644 --- a/src/include/game/data/data_0160b0.h +++ b/src/include/game/data/data_0160b0.h @@ -211,7 +211,7 @@ extern struct menu_dialog menudialog_weaponsavailable; extern struct menu_dialog g_SoloPauseMenuDialog; extern struct menu_dialog menudialog_196c8; extern struct menu_dialog menudialog_status; -extern struct cutsceneentry cutscenetable[]; +extern struct cutscene g_Cutscenes[]; extern struct cutscenegroup cutscenegrouptable[]; extern struct menu_dialog g_CinemaMenuDialog; extern struct menu_dialog g_SelectMissionMenuDialog; diff --git a/src/include/game/game_102240.h b/src/include/game/game_102240.h index b4990d077..37981c87c 100644 --- a/src/include/game/game_102240.h +++ b/src/include/game/game_102240.h @@ -22,7 +22,6 @@ char *invMenuTextWeaponName(struct menu_item *item); char *invMenuTextWeaponManufacturer(struct menu_item *item); char *invMenuTextWeaponDescription(struct menu_item *item); u32 func0f106508(void); -u32 func0f1065c0(void); bool soloChoosePauseDialog(void); s32 menudialog00103368(u32, u32, u32 *); void menudialog00103608(void); diff --git a/src/include/types.h b/src/include/types.h index 62d99a0c3..34ddb4554 100644 --- a/src/include/types.h +++ b/src/include/types.h @@ -3013,7 +3013,7 @@ struct weapon { /*0x4c*/ u32 flags; }; -struct cutsceneentry { +struct cutscene { u16 stage_id; u16 mission; u32 scene; @@ -4315,9 +4315,7 @@ struct savefile_solo { /*0x18*/ u32 unk18; /*0x1c*/ u32 unk1c; /*0x20*/ u16 besttimes[NUM_SOLOSTAGES][3]; - /*0xa0*/ u32 var800a22a0; - /*0xa4*/ u32 var800a22a4; - /*0xa8*/ u32 var800a22a8; + /*0xa0*/ s32 coopcompletions[3]; /*0xac*/ u8 firingrangescores[4]; };