Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mm/2s2h/GameInteractor/GameInteractor_VanillaBehavior.h
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,8 @@ typedef enum {
// - `*ColliderElement acElem`
VB_PERFORM_AC_COLLISION,

VB_PICTO_TEST,

// #### `result`
// ```c
// Rand_Next() & 0x80
Expand Down
1 change: 1 addition & 0 deletions mm/2s2h/Rando/ActorBehavior/ActorBehavior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ void Rando::ActorBehavior::OnFileLoad() {
Rando::ActorBehavior::InitObjTreeBehavior();
Rando::ActorBehavior::InitObjTsuboBehavior();
Rando::ActorBehavior::InitObjWarpstoneBehavior();
Rando::ActorBehavior::InitPictoChecksBehavior();
Rando::ActorBehavior::InitPlayerBehavior();
Rando::ActorBehavior::InitSoulsBehavior();
Rando::ActorBehavior::InitTrapsBehavior();
Expand Down
1 change: 1 addition & 0 deletions mm/2s2h/Rando/ActorBehavior/ActorBehavior.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ void InitObjTaruBehavior();
void InitObjTreeBehavior();
void InitObjTsuboBehavior();
void InitObjWarpstoneBehavior();
void InitPictoChecksBehavior();
void InitPlayerBehavior();
void InitSoulsBehavior();
void InitTrapsBehavior();
Expand Down
54 changes: 54 additions & 0 deletions mm/2s2h/Rando/ActorBehavior/PictoChecks.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "ActorBehavior.h"
#include <libultraship/bridge/consolevariablebridge.h>

extern "C" {
#include "variables.h"
#include "functions.h"

#include "z64snap.h"
}

using PictoPosFn = Vec3f* (*)(Actor*);

Vec3f* PictoFocusPos(Actor* actor) {
return &actor->focus.pos;
}

Vec3f* PictoWorldPos(Actor* actor) {
return &actor->world.pos;
}

struct PictoActorInfo {
int16_t flag;
PictoPosFn getPos;
};

std::unordered_map<int16_t, PictoActorInfo> actorPictoFlagMap = {
{ ACTOR_OBJ_WARPSTONE, { RANDO_INF_PICTO_ACTOR_OBJ_WARPSTONE, PictoFocusPos } },
{ ACTOR_EN_BAL, { RANDO_INF_PICTO_ACTOR_EN_BAL, PictoFocusPos } },
{ ACTOR_EN_ELF, { RANDO_INF_PICTO_ACTOR_EN_ELF, PictoWorldPos } },
};

void ValidateRandoPicto(Actor* actor) {
auto it = actorPictoFlagMap.find(actor->id);
if (it != actorPictoFlagMap.end()) {
int16_t flag = it->second.flag;

Vec3f* pos = it->second.getPos(actor);
// check if using PICTO_VALID_0 matters
// Snap_ValidatePictograph parameters might need tweaking per actor
if (Snap_ValidatePictograph(gPlayState, actor, PICTO_VALID_0, pos, &actor->shape.rot, 10.0f, 400.0f, -1) == 0) {
// Maybe set eligble flag instead and use randoinf flag for better picto message?
Flags_SetRandoInf(flag);
}
}
}

void Rando::ActorBehavior::InitPictoChecksBehavior() {
bool shouldRegister = IS_RANDO && RANDO_SAVE_OPTIONS[RO_SHUFFLE_PICTOS];

COND_VB_SHOULD(VB_PICTO_TEST, shouldRegister, {
Actor* actor = va_arg(args, Actor*);
ValidateRandoPicto(actor);
});
}
4 changes: 3 additions & 1 deletion mm/2s2h/Rando/CheckTracker/CheckTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ std::vector<const char*> checkTypeIconList = {
/*RCTYPE_MINIGAME*/ gArcheryScoreIconTex,
/*RCTYPE_NPC*/ gItemIconBombersNotebookTex,
/*RCTYPE_OWL*/ gWorldMapOwlFaceTex,
/*RCTYPE_PICTO*/ gItemIconPictographBoxTex,
/*RCTYPE_POT*/ gPotTrackerIcon,
/*RCTYPE_REMAINS*/ gItemIconBombersNotebookTex,
/*RCTYPE_SHOP*/ gItemIconAdultsWalletTex,
Expand Down Expand Up @@ -227,7 +228,8 @@ void initializeSceneChecks() {
for (auto& [randoCheckId, _] : staticRegion.checks) {
auto& randoStaticCheck = Rando::StaticData::Checks[randoCheckId];
RandoSaveCheck& randoSaveCheck = RANDO_SAVE_CHECKS[randoCheckId];
if (!randoSaveCheck.shuffled || randoStaticCheck.randoCheckType != RCTYPE_ENEMY_DROP) {
if (!randoSaveCheck.shuffled || (randoStaticCheck.randoCheckType != RCTYPE_ENEMY_DROP &&
randoStaticCheck.randoCheckType != RCTYPE_PICTO)) {
continue;
}

Expand Down
5 changes: 5 additions & 0 deletions mm/2s2h/Rando/Logic/GeneratePools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ void GeneratePools(RandoSaveInfo& saveInfo, std::vector<RandoCheckId>& checkPool
continue;
}

if (randoStaticCheck.randoCheckType == RCTYPE_PICTO &&
saveInfo.randoSaveOptions[RO_SHUFFLE_PICTOS] == RO_GENERIC_NO) {
continue;
}

if (randoStaticCheck.randoCheckType == RCTYPE_REMAINS &&
saveInfo.randoSaveOptions[RO_SHUFFLE_BOSS_REMAINS] == RO_GENERIC_NO) {
continue;
Expand Down
3 changes: 3 additions & 0 deletions mm/2s2h/Rando/Logic/Regions/Central.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ static RegisterShipInitFunc initFunc([]() {
CHECK(RC_CLOCK_TOWN_BOMBERS_NOTEBOOK, RANDO_EVENTS[RE_BOMBER_CODE]),
CHECK(RC_CLOCK_TOWN_POSTBOX, HAS_ITEM(ITEM_MASK_POSTMAN)),
CHECK(RC_KEATON_QUIZ, HAS_ITEM(ITEM_MASK_KEATON)),
CHECK(RC_TINGLE_PICTO, HAS_ITEM(ITEM_PICTOGRAPH_BOX)),
},
.exits = { // TO FROM
EXIT(ENTRANCE(TERMINA_FIELD, 8), ENTRANCE(NORTH_CLOCK_TOWN, 0), true),
Expand Down Expand Up @@ -200,6 +201,8 @@ static RegisterShipInitFunc initFunc([]() {
CHECK(RC_CLOCK_TOWN_SOUTH_CHEST_UPPER, ((CAN_BE_DEKU && Flags_GetRandoInf(RANDO_INF_OBTAINED_MOONS_TEAR)) || HAS_ITEM(ITEM_HOOKSHOT)) && FINAL_DAY()),
CHECK(RC_CLOCK_TOWN_SOUTH_CHEST_LOWER, (CAN_BE_DEKU && Flags_GetRandoInf(RANDO_INF_OBTAINED_MOONS_TEAR)) || HAS_ITEM(ITEM_HOOKSHOT)),
CHECK(RC_CLOCK_TOWN_SOUTH_OWL_STATUE, CAN_USE_SWORD),
CHECK(RC_OWL_STATUE_PICTO, HAS_ITEM(ITEM_PICTOGRAPH_BOX)),
CHECK(RC_FAIRY_PICTO, HAS_ITEM(ITEM_PICTOGRAPH_BOX)),
},
.exits = { // TO FROM
EXIT(ENTRANCE(CLOCK_TOWER_INTERIOR, 1), ENTRANCE(SOUTH_CLOCK_TOWN, 0), true),
Expand Down
3 changes: 3 additions & 0 deletions mm/2s2h/Rando/Logic/Regions/MilkRoad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ static RegisterShipInitFunc initFunc([]() {
.checks = {
CHECK(RC_KEATON_QUIZ, HAS_ITEM(ITEM_MASK_KEATON)),
CHECK(RC_MILK_ROAD_OWL_STATUE, CAN_USE_SWORD),
CHECK(RC_OWL_STATUE_PICTO, HAS_ITEM(ITEM_PICTOGRAPH_BOX)),
CHECK(RC_TINGLE_PICTO, HAS_ITEM(ITEM_PICTOGRAPH_BOX)),
CHECK(RC_FAIRY_PICTO, HAS_ITEM(ITEM_PICTOGRAPH_BOX)),
CHECK(RC_MILK_ROAD_TINGLE_MAP_01, CAN_USE_PROJECTILE && CAN_AFFORD(RC_MILK_ROAD_TINGLE_MAP_01)),
CHECK(RC_MILK_ROAD_TINGLE_MAP_02, CAN_USE_PROJECTILE && CAN_AFFORD(RC_MILK_ROAD_TINGLE_MAP_02)),
},
Expand Down
1 change: 1 addition & 0 deletions mm/2s2h/Rando/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ static void DrawShufflesTab() {
CVarCheckbox("Shuffle Grass Drops", Rando::StaticData::Options[RO_SHUFFLE_GRASS_DROPS].cvar);
CVarCheckbox("Shuffle Tree Drops", Rando::StaticData::Options[RO_SHUFFLE_TREE_DROPS].cvar);
CVarCheckbox("Shuffle Frogs", Rando::StaticData::Options[RO_SHUFFLE_FROGS].cvar);
CVarCheckbox("Shuffle Pictos", Rando::StaticData::Options[RO_SHUFFLE_PICTOS].cvar);
CVarCheckbox("Shuffle Hive Drops", "gPlaceholderBool",
CheckboxOptions({ { .disabled = true, .disabledTooltip = "Coming Soon" } }));
CVarCheckbox("Shuffle Freestanding Items", Rando::StaticData::Options[RO_SHUFFLE_FREESTANDING_ITEMS].cvar);
Expand Down
5 changes: 5 additions & 0 deletions mm/2s2h/Rando/StaticData/Checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2345,6 +2345,11 @@ std::map<RandoCheckId, RandoStaticCheck> Checks = {
RC(RC_ZORA_CAPE_TREE_03, RCTYPE_TREE, SCENE_31MISAKI, FLAG_NONE, 0x0, RI_NONE),
RC(RC_ZORA_CAPE_TREE_04, RCTYPE_TREE, SCENE_31MISAKI, FLAG_NONE, 0x0, RI_NONE),
RC(RC_ZORA_CAPE_TREE_05, RCTYPE_TREE, SCENE_31MISAKI, FLAG_NONE, 0x0, RI_NONE),

RC(RC_OWL_STATUE_PICTO, RCTYPE_PICTO, SCENE_MAX, FLAG_RANDO_INF, RANDO_INF_PICTO_ACTOR_OBJ_WARPSTONE, RI_NONE),
RC(RC_FAIRY_PICTO, RCTYPE_PICTO, SCENE_MAX, FLAG_RANDO_INF, RANDO_INF_PICTO_ACTOR_EN_ELF, RI_NONE),
RC(RC_TINGLE_PICTO, RCTYPE_PICTO, SCENE_MAX, FLAG_RANDO_INF, RANDO_INF_PICTO_ACTOR_EN_BAL, RI_NONE),

};
// clang-format on

Expand Down
1 change: 1 addition & 0 deletions mm/2s2h/Rando/StaticData/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ std::map<RandoOptionId, RandoStaticOption> Options = {
RO(RO_SHUFFLE_GRASS_DROPS, RO_GENERIC_OFF),
RO(RO_SHUFFLE_OCARINA_BUTTONS, RO_GENERIC_OFF),
RO(RO_SHUFFLE_OWL_STATUES, RO_GENERIC_OFF),
RO(RO_SHUFFLE_PICTOS, RO_GENERIC_OFF),
RO(RO_SHUFFLE_POT_DROPS, RO_GENERIC_OFF),
RO(RO_SHUFFLE_SHOPS, RO_GENERIC_OFF),
RO(RO_SHUFFLE_SNOWBALL_DROPS, RO_GENERIC_OFF),
Expand Down
12 changes: 12 additions & 0 deletions mm/2s2h/Rando/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ typedef enum {
RCTYPE_MINIGAME,
RCTYPE_NPC,
RCTYPE_OWL,
RCTYPE_PICTO,
RCTYPE_POT,
RCTYPE_REMAINS,
RCTYPE_SHOP,
Expand Down Expand Up @@ -2351,6 +2352,10 @@ typedef enum {
RC_ZORA_CAPE_TREE_04,
RC_ZORA_CAPE_TREE_05,

RC_OWL_STATUE_PICTO,
RC_FAIRY_PICTO,
RC_TINGLE_PICTO,

RC_MAX,
} RandoCheckId;

Expand Down Expand Up @@ -2957,6 +2962,7 @@ typedef enum {
RO_SHUFFLE_GRASS_DROPS,
RO_SHUFFLE_OCARINA_BUTTONS,
RO_SHUFFLE_OWL_STATUES,
RO_SHUFFLE_PICTOS,
RO_SHUFFLE_POT_DROPS,
RO_SHUFFLE_SHOPS,
RO_SHUFFLE_SNOWBALL_DROPS,
Expand Down Expand Up @@ -3102,6 +3108,12 @@ typedef enum {
RANDO_INF_OBTAINED_OCARINA_BUTTON_C_UP,
RANDO_INF_OBTAINED_SONG_DOUBLE_TIME,
RANDO_INF_OBTAINED_SONG_INVERTED_TIME,

// Picto flags
RANDO_INF_PICTO_ACTOR_EN_BAL,
RANDO_INF_PICTO_ACTOR_EN_ELF,
RANDO_INF_PICTO_ACTOR_OBJ_WARPSTONE,

RANDO_INF_MAX,
} RandoInf;

Expand Down
4 changes: 4 additions & 0 deletions mm/src/code/z_snap.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "z64snap.h"
#include "overlays/actors/ovl_En_Kakasi/z_en_kakasi.h"

#include "2s2h/GameInteractor/GameInteractor.h"

#define PICTO_SEEN_IN_SCENE 1
#define PICTO_SEEN_ANYWHERE 2

Expand Down Expand Up @@ -29,6 +31,8 @@ s32 Snap_RecordPictographedActors(PlayState* play) {
for (actor = play->actorCtx.actorLists[category].first; actor != NULL; actor = actor->next) {
seen = 0;

GameInteractor_Should(VB_PICTO_TEST, false, actor);

// Actors which must be pictographed in a specific scene
switch (play->sceneId) {
case SCENE_20SICHITAI:
Expand Down
Loading