Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event queue for handling various events like giving custom items #757

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

garrettjoecox
Copy link
Contributor

@garrettjoecox garrettjoecox commented Aug 17, 2024

There's kind of a lot going on here. Fundamentally there is an event queue that's constantly being processed, which depends on the player being "ready" (no text boxes open, no cutscenes, transitions playing etc). This should be able to support various things like Randomizer, Anchor, Archipeligo, and various mods.

We can continue iterating on the shape of events, but for instance below is what the give item looks like. There are also events for spawning actors and starting scene transitions.

GameInteractor::Instance->events.push_back(GIEventGiveItem{
    .param = GID_RUPEE_GREEN, // Optional param that is accessible by give/draw
    .giveItem = [](Actor* actor, PlayState* play) {
        if (CUSTOM_ITEM_FLAGS & CustomItem::GIVE_ITEM_CUTSCENE) {
            CustomMessage::SetActiveCustomMessage("You found Greg!");
        } else {
            // This one is optional
            CustomMessage::StartTextbox("You found Greg! (While you were jumping or something) \x1C\x02\x10");
        }

        Rupees_ChangeBy(1);
    },
    .showGetItemCutscene = true,
    .drawItem = [](Actor* actor, PlayState* play) {
        Matrix_Scale(30.0f, 30.0f, 30.0f, MTXMODE_APPLY);
        GetItem_Draw(play, CUSTOM_ITEM_PARAM);
    },
});
aa.mov

Build Artifacts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant