mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-24 00:02:43 +02:00
Merge pull request #243 from Bobbar/unlock_everything_gamesave
Option to unlock everything.
This commit is contained in:
3 files changed
+141
No files matched your search
@@ -7,6 +7,7 @@
|
||||
#include "types.h"
|
||||
#include "game/mainmenu.h"
|
||||
#include "game/menu.h"
|
||||
#include "game/gamefile.h"
|
||||
#include "video.h"
|
||||
#include "input.h"
|
||||
#include "config.h"
|
||||
@@ -1072,6 +1073,83 @@ static MenuItemHandlerResult menuhandlerOpenBindsMenu(s32 operation, struct menu
|
||||
return 0;
|
||||
}
|
||||
|
||||
static MenuItemHandlerResult menuhandlerUnlockEverything(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||
{
|
||||
if (operation == MENUOP_SET) {
|
||||
gamefileUnlockEverything();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct menuitem g_ConfirmUnlockMenuItems[] = {
|
||||
{
|
||||
MENUITEMTYPE_LABEL,
|
||||
0,
|
||||
MENUITEMFLAG_LITERAL_TEXT,
|
||||
(uintptr_t)"Are you sure?\n\nThis will overwrite any progress\nsaved to the current profile.\n",
|
||||
0,
|
||||
NULL,
|
||||
},
|
||||
{
|
||||
MENUITEMTYPE_SEPARATOR,
|
||||
0,
|
||||
0,
|
||||
0x00000082,
|
||||
0,
|
||||
NULL,
|
||||
},
|
||||
{
|
||||
MENUITEMTYPE_MARQUEE,
|
||||
0,
|
||||
MENUITEMFLAG_SMALLFONT | MENUITEMFLAG_MARQUEE_FADEBOTHSIDES | MENUITEMFLAG_LITERAL_TEXT,
|
||||
(uintptr_t)"Unlocks all cheats, weapons, missions, challenges and combat simulator items.\n",
|
||||
0,
|
||||
NULL,
|
||||
},
|
||||
{
|
||||
MENUITEMTYPE_SEPARATOR,
|
||||
0,
|
||||
0,
|
||||
0x00000082,
|
||||
0,
|
||||
NULL,
|
||||
},
|
||||
{
|
||||
MENUITEMTYPE_SELECTABLE,
|
||||
0,
|
||||
MENUITEMFLAG_SELECTABLE_CENTRE | MENUITEMFLAG_SELECTABLE_CLOSESDIALOG,
|
||||
L_OPTIONS_191, // "No"
|
||||
0,
|
||||
NULL,
|
||||
},
|
||||
{
|
||||
MENUITEMTYPE_SELECTABLE,
|
||||
0,
|
||||
MENUITEMFLAG_SELECTABLE_CENTRE | MENUITEMFLAG_SELECTABLE_CLOSESDIALOG,
|
||||
L_OPTIONS_190, // "Yes"
|
||||
0,
|
||||
menuhandlerUnlockEverything,
|
||||
},
|
||||
{ MENUITEMTYPE_END },
|
||||
};
|
||||
|
||||
struct menudialogdef g_ConfirmUnlockMenuDialog = {
|
||||
MENUDIALOGTYPE_DANGER,
|
||||
L_OPTIONS_188, // "Warning"
|
||||
g_ConfirmUnlockMenuItems,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static MenuItemHandlerResult menuhandlerUnlockEverythingPrompt(s32 operation, struct menuitem *item, union handlerdata *data)
|
||||
{
|
||||
if (operation == MENUOP_SET) {
|
||||
menuPushDialog(&g_ConfirmUnlockMenuDialog);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct menuitem g_ExtendedMenuItems[] = {
|
||||
{
|
||||
MENUITEMTYPE_SELECTABLE,
|
||||
@@ -1113,6 +1191,14 @@ struct menuitem g_ExtendedMenuItems[] = {
|
||||
0,
|
||||
menuhandlerOpenBindsMenu,
|
||||
},
|
||||
{
|
||||
MENUITEMTYPE_SELECTABLE,
|
||||
0,
|
||||
MENUITEMFLAG_LITERAL_TEXT,
|
||||
(uintptr_t)"Unlock Everything\n",
|
||||
0,
|
||||
menuhandlerUnlockEverythingPrompt,
|
||||
},
|
||||
{
|
||||
MENUITEMTYPE_SEPARATOR,
|
||||
0,
|
||||
|
||||
@@ -567,3 +567,57 @@ void gamefileGetOverview(char *arg0, char *name, u8 *stage, u8 *difficulty, u32
|
||||
|
||||
*difficulty = savebufferReadBits(&buffer, 2);
|
||||
}
|
||||
|
||||
#ifndef PLATFORM_N64
|
||||
// Unlock all of the unlockables.
|
||||
// These hacks are taken from the original debug mode.
|
||||
void gamefileUnlockEverything(void)
|
||||
{
|
||||
s32 i, j;
|
||||
|
||||
// unlock all challenges
|
||||
for (i = 0; i < ARRAYCOUNT(g_MpChallenges); ++i) {
|
||||
for (j = 0; j < MAX_PLAYERS; ++j) {
|
||||
g_MpChallenges[i].completions[j] = 0x0f;
|
||||
}
|
||||
}
|
||||
challengeDetermineUnlockedFeatures();
|
||||
|
||||
// complete all missions in coop
|
||||
for (i = 0; i < ARRAYCOUNT(g_GameFile.coopcompletions); ++i) {
|
||||
g_GameFile.coopcompletions[i] = 0x1fffff;
|
||||
}
|
||||
|
||||
// unlock all guns
|
||||
for (i = 0; i < ARRAYCOUNT(g_GameFile.weaponsfound); ++i) {
|
||||
g_GameFile.weaponsfound[i] = 0xff;
|
||||
}
|
||||
|
||||
// unlock all campaign levels
|
||||
for (i = 0; i < NUM_SOLOSTAGES; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
g_GameFile.besttimes[i][j] = 7;
|
||||
}
|
||||
}
|
||||
|
||||
// unlock alternate intro sequence
|
||||
g_AltTitleUnlocked = true;
|
||||
|
||||
// unlock all firing range challenges
|
||||
for (i = 0; i < ARRAYCOUNT(g_GameFile.firingrangescores); ++i) {
|
||||
g_GameFile.firingrangescores[i] = 0xff;
|
||||
}
|
||||
|
||||
// unlock all device training
|
||||
gamefileSetFlag(GAMEFILEFLAG_CI_CLOAK_DONE);
|
||||
gamefileSetFlag(GAMEFILEFLAG_CI_DISGUISE_DONE);
|
||||
gamefileSetFlag(GAMEFILEFLAG_CI_XRAY_DONE);
|
||||
gamefileSetFlag(GAMEFILEFLAG_CI_IR_DONE);
|
||||
gamefileSetFlag(GAMEFILEFLAG_CI_RTRACKER_DONE);
|
||||
gamefileSetFlag(GAMEFILEFLAG_CI_DOORDECODER_DONE);
|
||||
gamefileSetFlag(GAMEFILEFLAG_CI_NIGHTVISION_DONE);
|
||||
gamefileSetFlag(GAMEFILEFLAG_CI_CAMSPY_DONE);
|
||||
gamefileSetFlag(GAMEFILEFLAG_CI_ECMMINE_DONE);
|
||||
gamefileSetFlag(GAMEFILEFLAG_CI_UPLINK_DONE);
|
||||
}
|
||||
#endif
|
||||
@@ -13,5 +13,6 @@ void gamefileLoadDefaults(struct gamefile *file);
|
||||
s32 gamefileLoad(s32 device);
|
||||
s32 gamefileSave(s32 device, s32 filenum, u16 deviceserial);
|
||||
void gamefileGetOverview(char *arg0, char *name, u8 *stage, u8 *difficulty, u32 *time);
|
||||
void gamefileUnlockEverything(void);
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user