mirror of https://github.com/sm64pc/sm64pc.git
Merge 3e332f4c98
into 951389ca84
This commit is contained in:
commit
ea5ddd4928
|
@ -149,6 +149,7 @@
|
||||||
#define TEXT_OPT_CHEAT7 _("Exit course at any time")
|
#define TEXT_OPT_CHEAT7 _("Exit course at any time")
|
||||||
#define TEXT_OPT_CHEAT8 _("Huge Mario")
|
#define TEXT_OPT_CHEAT8 _("Huge Mario")
|
||||||
#define TEXT_OPT_CHEAT9 _("Tiny Mario")
|
#define TEXT_OPT_CHEAT9 _("Tiny Mario")
|
||||||
|
#define TEXT_OPT_CHEAT10 _("No Keys Required")
|
||||||
|
|
||||||
#endif // VERSION
|
#endif // VERSION
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "sm64.h"
|
#include "sm64.h"
|
||||||
#include "sound_init.h"
|
#include "sound_init.h"
|
||||||
#include "thread6.h"
|
#include "thread6.h"
|
||||||
|
#include "pc/cheats.h"
|
||||||
|
|
||||||
#define INT_GROUND_POUND_OR_TWIRL (1 << 0) // 0x01
|
#define INT_GROUND_POUND_OR_TWIRL (1 << 0) // 0x01
|
||||||
#define INT_PUNCH (1 << 1) // 0x02
|
#define INT_PUNCH (1 << 1) // 0x02
|
||||||
|
@ -893,6 +894,11 @@ u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Obj
|
||||||
u32 actionArg;
|
u32 actionArg;
|
||||||
|
|
||||||
if (m->action == ACT_WALKING || m->action == ACT_DECELERATING) {
|
if (m->action == ACT_WALKING || m->action == ACT_DECELERATING) {
|
||||||
|
if (Cheats.EnableCheats && Cheats.UnlockDoors) {
|
||||||
|
/* If the unlock doors cheat is enabled, skip key checks */
|
||||||
|
goto postkeycheck;
|
||||||
|
}
|
||||||
|
|
||||||
if (warpDoorId == 1 && !(saveFlags & SAVE_FLAG_UNLOCKED_UPSTAIRS_DOOR)) {
|
if (warpDoorId == 1 && !(saveFlags & SAVE_FLAG_UNLOCKED_UPSTAIRS_DOOR)) {
|
||||||
if (!(saveFlags & SAVE_FLAG_HAVE_KEY_2)) {
|
if (!(saveFlags & SAVE_FLAG_HAVE_KEY_2)) {
|
||||||
if (!sDisplayingDoorText) {
|
if (!sDisplayingDoorText) {
|
||||||
|
@ -922,6 +928,7 @@ u32 interact_warp_door(struct MarioState *m, UNUSED u32 interactType, struct Obj
|
||||||
doorAction = ACT_UNLOCKING_KEY_DOOR;
|
doorAction = ACT_UNLOCKING_KEY_DOOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postkeycheck:
|
||||||
if (m->action == ACT_WALKING || m->action == ACT_DECELERATING) {
|
if (m->action == ACT_WALKING || m->action == ACT_DECELERATING) {
|
||||||
actionArg = should_push_or_pull_door(m, o) + 0x00000004;
|
actionArg = should_push_or_pull_door(m, o) + 0x00000004;
|
||||||
|
|
||||||
|
@ -987,7 +994,27 @@ u32 interact_door(struct MarioState *m, UNUSED u32 interactType, struct Object *
|
||||||
s16 numStars = save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1);
|
s16 numStars = save_file_get_total_star_count(gCurrSaveFileNum - 1, COURSE_MIN - 1, COURSE_MAX - 1);
|
||||||
|
|
||||||
if (m->action == ACT_WALKING || m->action == ACT_DECELERATING) {
|
if (m->action == ACT_WALKING || m->action == ACT_DECELERATING) {
|
||||||
if (numStars >= requiredNumStars) {
|
if (Cheats.EnableCheats && Cheats.UnlockDoors) {
|
||||||
|
/* If the UnlockDoors Cheat is enabled, it's the same as the approach with >= requiredNumStars,
|
||||||
|
* but never use the action that 'unlocks' the door for the save file */
|
||||||
|
u32 actionArg = should_push_or_pull_door(m, o);
|
||||||
|
u32 enterDoorAction;
|
||||||
|
|
||||||
|
if (actionArg & 0x00000001) {
|
||||||
|
enterDoorAction = ACT_PULLING_DOOR;
|
||||||
|
} else {
|
||||||
|
enterDoorAction = ACT_PUSHING_DOOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
m->interactObj = o;
|
||||||
|
m->usedObj = o;
|
||||||
|
|
||||||
|
if (o->oInteractionSubtype & INT_SUBTYPE_STAR_DOOR) {
|
||||||
|
enterDoorAction = ACT_ENTERING_STAR_DOOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return set_mario_action(m, enterDoorAction, actionArg);
|
||||||
|
} else if (numStars >= requiredNumStars) {
|
||||||
u32 actionArg = should_push_or_pull_door(m, o);
|
u32 actionArg = should_push_or_pull_door(m, o);
|
||||||
u32 enterDoorAction;
|
u32 enterDoorAction;
|
||||||
u32 doorSaveFileFlag;
|
u32 doorSaveFileFlag;
|
||||||
|
|
|
@ -105,6 +105,7 @@ static const u8 optsCheatsStr[][64] = {
|
||||||
{ TEXT_OPT_CHEAT7 },
|
{ TEXT_OPT_CHEAT7 },
|
||||||
{ TEXT_OPT_CHEAT8 },
|
{ TEXT_OPT_CHEAT8 },
|
||||||
{ TEXT_OPT_CHEAT9 },
|
{ TEXT_OPT_CHEAT9 },
|
||||||
|
{ TEXT_OPT_CHEAT10 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const u8 bindStr[][32] = {
|
static const u8 bindStr[][32] = {
|
||||||
|
@ -282,6 +283,7 @@ static struct Option optsCheats[] = {
|
||||||
DEF_OPT_TOGGLE( optsCheatsStr[6], &Cheats.ExitAnywhere ),
|
DEF_OPT_TOGGLE( optsCheatsStr[6], &Cheats.ExitAnywhere ),
|
||||||
DEF_OPT_TOGGLE( optsCheatsStr[7], &Cheats.HugeMario ),
|
DEF_OPT_TOGGLE( optsCheatsStr[7], &Cheats.HugeMario ),
|
||||||
DEF_OPT_TOGGLE( optsCheatsStr[8], &Cheats.TinyMario ),
|
DEF_OPT_TOGGLE( optsCheatsStr[8], &Cheats.TinyMario ),
|
||||||
|
DEF_OPT_TOGGLE( optsCheatsStr[9], &Cheats.UnlockDoors ),
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ struct CheatList {
|
||||||
bool ExitAnywhere;
|
bool ExitAnywhere;
|
||||||
bool HugeMario;
|
bool HugeMario;
|
||||||
bool TinyMario;
|
bool TinyMario;
|
||||||
|
bool UnlockDoors;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct CheatList Cheats;
|
extern struct CheatList Cheats;
|
||||||
|
|
Loading…
Reference in New Issue