Skip to content

Commit

Permalink
add QuestLogic and JournalData stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Auto committed Nov 24, 2024
1 parent f6b2bbb commit 82b3ca3
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 14 deletions.
65 changes: 61 additions & 4 deletions src/game_api/game_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
#include <cstddef> // for size_t
#include <cstdint> // 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;
Expand Down Expand Up @@ -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> 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<uint8_t, JournalData> places_data;
game_unordered_map<ENT_TYPE, JournalBestiaryData> bestiary_data;
game_unordered_map<ENT_TYPE, ENT_TYPE> monster_part_to_main; // used to map stuff like Osiris_Hand -> Osiris_Head, Hundun limbs -> Hundun etc.
game_unordered_map<ENT_TYPE, JournalPeopleData> people_info;
game_unordered_map<ENT_TYPE, ENT_TYPE> people_part_to_main; // used to map shopkeeper clone to shopkeeper only
game_unordered_map<ENT_TYPE, JournalData> item_info;
game_unordered_map<ENT_TYPE, JournalData> trap_info;
game_unordered_map<ENT_TYPE, ENT_TYPE> trap_part_to_main; // used for stuff like upsidedown_spikes -> spikes, skulldrop skulls -> skulldrop trap etc.
game_unordered_map<ENT_TYPE, StickersData> stickers_data;
};

struct BGMUnknown
Expand Down
8 changes: 4 additions & 4 deletions src/game_api/screen.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 29 additions & 6 deletions src/game_api/state_structs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 82b3ca3

Please sign in to comment.