From 82b3ca3a9e55864f1103e9f76ab19c3f0d0b6156 Mon Sep 17 00:00:00 2001 From: Mr-Auto <36127424+Mr-Auto@users.noreply.github.com> Date: Sun, 24 Nov 2024 17:22:15 +0100 Subject: [PATCH] add QuestLogic and JournalData stuff --- src/game_api/game_manager.hpp | 65 +++++++++++++++++++++++++++++++--- src/game_api/screen.hpp | 8 ++--- src/game_api/state_structs.hpp | 35 ++++++++++++++---- 3 files changed, 94 insertions(+), 14 deletions(-) diff --git a/src/game_api/game_manager.hpp b/src/game_api/game_manager.hpp index 0ac64c11b..704d31068 100644 --- a/src/game_api/game_manager.hpp +++ b/src/game_api/game_manager.hpp @@ -3,10 +3,11 @@ #include // for size_t #include // for uint32_t, uint8_t, int8_t -#include "aliases.hpp" // for MAX_PLAYERS -#include "render_api.hpp" // for TextureRenderingInfo -#include "sound_manager.hpp" -#include "thread_utils.hpp" // for OnHeapPointer +#include "aliases.hpp" // for MAX_PLAYERS +#include "containers/game_unordered_map.hpp" // for game_unordered_map +#include "render_api.hpp" // for TextureRenderingInfo +#include "sound_manager.hpp" // for BackgroundSound +#include "thread_utils.hpp" // for OnHeapPointer struct SaveData; class ScreenCamp; @@ -35,12 +36,68 @@ struct JournalPopupUI uint32_t timer; float slide_position; uint8_t unknown; + // uint8_t padding[3]; // probably? +}; + +class JournalData +{ + uint32_t page_nr; + uint32_t sprite_id; + STRINGID name; + STRINGID description; + float scale; + float offset_x; + float offset_y; +}; + +class JournalBestiaryData : public JournalData +{ + TEXTURE texture; + uint32_t background_sprite_id; + bool killed_by_NA; + bool defeated_NA; +}; + +class JournalPeopleData : public JournalData +{ + TEXTURE texture; + uint32_t background_sprite_id; + bool killed_by_NA; + bool defeated_NA; + // uint16_t padding; + TEXTURE portret_texture; +}; + +class JournalTrapData : public JournalData +{ + TEXTURE texture; + uint32_t background_sprite_id; +}; + +struct StickersData +{ + uint32_t sprite_id; + TEXTURE texture; }; struct SaveRelated { OnHeapPointer savedata; JournalPopupUI journal_popup_ui; + + ENT_TYPE player_entity; // for the journal stuff, probably the leader? + ENT_TYPE progress_stickers_powerups[29]; // pre-journal progress setup, maybe gathering from all players or something? + + /// Scale and offset not used + game_unordered_map places_data; + game_unordered_map bestiary_data; + game_unordered_map monster_part_to_main; // used to map stuff like Osiris_Hand -> Osiris_Head, Hundun limbs -> Hundun etc. + game_unordered_map people_info; + game_unordered_map people_part_to_main; // used to map shopkeeper clone to shopkeeper only + game_unordered_map item_info; + game_unordered_map trap_info; + game_unordered_map trap_part_to_main; // used for stuff like upsidedown_spikes -> spikes, skulldrop skulls -> skulldrop trap etc. + game_unordered_map stickers_data; }; struct BGMUnknown diff --git a/src/game_api/screen.hpp b/src/game_api/screen.hpp index d8517594a..6307b76b6 100644 --- a/src/game_api/screen.hpp +++ b/src/game_api/screen.hpp @@ -505,10 +505,10 @@ class ScreenCharacterSelect : public Screen // ID: 9 float topleft_woodpanel_esc_slidein; float start_panel_slidein; float action_buttons_keycap_size; - bool unknown64a; - bool unknown64b; - bool unknown64c; - bool unknown64d; + bool screen_loading; // locks the inputs? + bool unknown64b; // sets the state.ingame + bool seeded_run; + bool daily_challenge; uint32_t next_screen_to_load; bool not_ready_to_start_yet; uint8_t available_mine_entrances; // The rest are boarded off diff --git a/src/game_api/state_structs.hpp b/src/game_api/state_structs.hpp index dfccf900e..9cccdd475 100644 --- a/src/game_api/state_structs.hpp +++ b/src/game_api/state_structs.hpp @@ -91,14 +91,37 @@ struct PlayerInputs }; }; +struct QuestLogic +{ + // used to access flags in QuestsInfo + uint32_t id; + + // called during layer loading by the state update, sets the level generation flags etc. + virtual void pre_level_gen() = 0; + + // Gets called on every non-CO level by 18 virtual in current theme. Function checks whether the quest needs to be initialized. + // Yang: checks whether his quest status = 1 -> makes his pen work + // Sisters: make them appear on Olmec + // Horsing: makes him appear in Vlad's castle + // Sparrow: nop + // Tusk: populates pleasure palace with other characters depending on their quest state + // Beg: nop + virtual void post_level_gen() = 0; + + // Only implemented for Beg quest, called by the 24 virtual in current theme + virtual void post_level_gen2() = 0; + + virtual ~QuestLogic() = delete; +}; + struct QuestsInfo { - size_t unknown1; // the first six are pointers to small similar objects - size_t unknown2; // that don't appear to change at all - size_t unknown3; - size_t unknown4; - size_t unknown5; - size_t unknown6; + QuestLogic* yang; + QuestLogic* jungle_sisters; + QuestLogic* van_horsing; + QuestLogic* sparrow; + QuestLogic* madame_tusk; + QuestLogic* beg; int8_t yang_state; int8_t jungle_sisters_flags; // flags! not state ; -1 = sisters angry int8_t van_horsing_state;