HarbourMasters / 2ship2harkinian

Creative Commons Zero v1.0 Universal
765 stars 64 forks source link

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

Open garrettjoecox opened 1 month ago

garrettjoecox commented 1 month ago

Depends on #669

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.

This PR includes an example usage which skips the Song of Time cutscene, and grants the Song of Time item

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.emplace_back(GIEventGiveItem{
    .getItemText = "You recieved the Song of Time",
    .showGetItemCutscene = true,
    .drawItem = []() { 
        OPEN_DISPS(gPlayState->state.gfxCtx);
        ...
        CLOSE_DISPS(gPlayState->state.gfxCtx);
    },
    .giveItem = []() {
        SET_QUEST_ITEM(QUEST_SONG_TIME); 
    }
});

https://github.com/user-attachments/assets/edd89932-8315-4a42-b168-dffb19990558

Build Artifacts