Skip to content
Merged
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
27 changes: 8 additions & 19 deletions src/SB/Game/zTalkBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ namespace
}
}

static void flush_triggered()
{
}

static void reset_auto_wait()
{
}

void trigger_pads(U32 pressed)
{
if ((pressed & 0x10) != 0)
Expand Down Expand Up @@ -109,6 +101,14 @@ namespace
}
}

void flush_triggered()
{
}

void reset_auto_wait()
{
}

void deactivate()
{
stop_audio_effect();
Expand All @@ -127,7 +127,6 @@ namespace
active->dialog_box->flag.visible = false;
}

void flush_triggered();
void stop_wait(ztalkbox& talkbox, const F32*, U32);

static void stop();
Expand Down Expand Up @@ -291,23 +290,13 @@ void ztalkbox::reset()

namespace
{

struct state_type
{
state_enum type;

void start();
void stop();
};

void state_type::start()
{
}

void state_type::stop()
{
}

} // namespace

void ztalkbox::clear_text()
Expand Down
302 changes: 149 additions & 153 deletions src/SB/Game/zTalkBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,6 @@

#include "xScene.h"

enum state_enum
{
STATE_INVALID = -1,
BEGIN_STATE = 0,
STATE_START = 1,
STATE_NEXT = 2,
STATE_WAIT = 3,
STATE_STOP = 4,
END_STATE = 5,
MAX_STATE = 5,
};

enum query_enum
{
Q_SKIP,
Q_YESNO
};

struct ztalkbox : xBase
{
struct asset_type : xDynAsset
Expand Down Expand Up @@ -145,155 +127,169 @@ struct ztalkbox : xBase
void hide();
};

struct state_type
namespace
{
state_enum type;
};
enum state_enum
{
STATE_INVALID = -1,
BEGIN_STATE = 0,
STATE_START = 1,
STATE_NEXT = 2,
STATE_WAIT = 3,
STATE_STOP = 4,
END_STATE = 5,
MAX_STATE = 5,
};

struct jot;
enum query_enum
{
Q_SKIP,
Q_YESNO
};

struct callback
{
void (*render)(jot&, xtextbox&, F32, F32);
void (*layout_update)(jot&, xtextbox&, xtextbox&);
void (*render_update)(jot&, xtextbox&, xtextbox&);
};
struct state_type
{
state_enum type;

struct split_tag
{
substr tag;
substr name;
substr action;
substr value;
};
void start();
void stop();
};

struct tag_type
{
substr name;
void (*parse_tag)(jot&, xtextbox&, xtextbox&, split_tag&);
void (*reset_tag)(jot&, xtextbox&, xtextbox&, split_tag&);
void* context;
};
struct jot;
struct callback
{
void (*render)(jot&, xtextbox&, F32, F32);
void (*layout_update)(jot&, xtextbox&, xtextbox&);
void (*render_update)(jot&, xtextbox&, xtextbox&);
};

struct jot
{
substr s;
struct split_tag
{
substr tag;
substr name;
substr action;
substr value;
};

struct
struct tag_type
{
// Offset: 0x8
bool invisible : 1; // bit 24
bool ethereal : 1; // bit 25
bool merge : 1; // bit 26
bool word_break : 1; // bit 27
bool word_end : 1; // bit 28
bool line_break : 1; // bit 29
bool stop : 1; // bit 30
bool tab : 1; // bit 31

// Offset: 0x9
bool insert : 1; // bit 24
bool dynamic : 1; // bit 25
bool page_break : 1; // bit 26
bool stateful : 1; // bit 27
U16 dummy : 4; // bits 28-31
} flag;
// Offset: 0xC
U16 context_size;

// Offset: 0x10
void* context;
basic_rect<F32> bounds;
basic_rect<F32> render_bounds;
callback* cb;
tag_type* tag;

void intersect_flags(const jot& other);
void reset_flags();
};
substr name;
void (*parse_tag)(jot&, xtextbox&, xtextbox&, split_tag&);
void (*reset_tag)(jot&, xtextbox&, xtextbox&, split_tag&);
void* context;
};

struct jot_line
{
basic_rect<F32> bounds;
F32 baseline;
U32 first;
U32 last;
U8 page_break;
};
struct jot
{
substr s;

struct layout
{
xtextbox tb; // offset 0x0, size 0x68
jot _jots[512]; // offset 0x68, size 0x7000
U32 _jots_size; // offset 0x7068, size 0x4
jot_line _lines[128]; // offset 0x706C, size 0x1000
U32 _lines_size; // offset 0x806C, size 0x4
U8 context_buffer[1024]; // offset 0x8070, size 0x400
U32 context_buffer_size; // offset 0x8470, size 0x4
U16 dynamics[64]; // offset 0x8474, size 0x80
U32 dynamics_size; // offset 0x84F4, size 0x4
};
struct
{
// Offset: 0x8
bool invisible : 1; // bit 24
bool ethereal : 1; // bit 25
bool merge : 1; // bit 26
bool word_break : 1; // bit 27
bool word_end : 1; // bit 28
bool line_break : 1; // bit 29
bool stop : 1; // bit 30
bool tab : 1; // bit 31

// Offset: 0x9
bool insert : 1; // bit 24
bool dynamic : 1; // bit 25
bool page_break : 1; // bit 26
bool stateful : 1; // bit 27
U16 dummy : 4; // bits 28-31
} flag;
// Offset: 0xC
U16 context_size;

// Offset: 0x10
void* context;
basic_rect<F32> bounds;
basic_rect<F32> render_bounds;
callback* cb;
tag_type* tag;

void intersect_flags(const jot& other);
void reset_flags();
};

struct wait_context
{
struct
struct jot_line
{
U8 time : 1; // offset 0x0, size 0x1
U8 prompt : 1; // offset 0x0, size 0x1
U8 sound : 1; // offset 0x0, size 0x1
U8 event : 1; // offset 0x0, size 0x1
U16 pad : 12; // offset 0x0, size 0x2
} type; // offset 0x0, size 0x2
U8 need; // offset 0x2, size 0x1
F32 delay; // offset 0x4, size 0x4
U32 event_mask; // offset 0x8, size 0x4
query_enum query; // offset 0xC, size 0x4
};
basic_rect<F32> bounds;
F32 baseline;
U32 first;
U32 last;
U8 page_break;
};

struct sound_queue
{
U32 _playing[5];
S32 head;
S32 tail;
};
struct layout
{
xtextbox tb;
jot _jots[512]; // 0x68
U32 _jots_size; // 0x7068
jot_line _lines[128]; // 0x706C
U32 _lines_size; // 0x806C
U8 context_buffer[1024]; // 0x8070
U32 context_buffer_size; // 0x8470
U16 dynamics[64]; // 0x8474
U32 dynamics_size; // 0x84F4
};

struct trigger_pair
{
ztalkbox* origin;
U32 event;
};
struct wait_context
{
struct
{
U8 time : 1;
U8 prompt : 1;
U8 sound : 1;
U8 event : 1;
U16 pad : 12;
} type;
U8 need;
F32 delay;
U32 event_mask;
query_enum query;
};

struct shared_type
{
S32 flags; // offset 0x0, size 0x4
U32 permit; // offset 0x4, size 0x4
ztalkbox* active; // offset 0x8, size 0x4
state_type* state; // offset 0xC, size 0x4
state_type* states[5]; // offset 0x10, size 0x14
layout lt; // offset 0x24, size 0x84F8
S32 begin_jot; // offset 0x851C, size 0x4
S32 end_jot; // offset 0x8520, size 0x4
S32 page_end_jot; // offset 0x8524, size 0x4
wait_context wait; // offset 0x8528, size 0x10
wait_context auto_wait; // offset 0x8538, size 0x10
U32 wait_event_mask; // offset 0x8548, size 0x4
F32 prompt_delay; // offset 0x854C, size 0x4
F32 quit_delay; // offset 0x8550, size 0x4
U8 prompt_ready; // offset 0x8554, size 0x1
U8 quit_ready; // offset 0x8555, size 0x1
U8 stream_locked[2]; // offset 0x8556, size 0x2
S32 next_stream; // offset 0x8558, size 0x4
// The below builds perfectly fine, unsure if its 100% correct though
sound_queue<4> sounds; // offset 0x855C, size 0x1C
U8 allow_quit; // offset 0x8578, size 0x1
U8 quitting; // offset 0x8579, size 0x1
U8 delay_events; // offset 0x857A, size 0x1
callback* cb; // offset 0x857C, size 0x4
// The below builds perfectly fine, unsure if its 100% correct though
fixed_queue<trigger_pair, 32> triggered; // offset 0x8580, size 0x110
F32 volume; // offset 0x8690, size 0x4
zNPCCommon* speak_npc; // offset 0x8694, size 0x4
U32 speak_player; // offset 0x8698, size 0x4
};
struct trigger_pair
{
ztalkbox* origin;
U32 event;
};

struct shared_type
{
S32 flags;
U32 permit;
ztalkbox* active; // 0x8
state_type* state; // 0xC
state_type* states[5]; // 0x10, size 0x14
layout lt; // 0x24
S32 begin_jot; // 0x851C
S32 end_jot; // 0x8520
S32 page_end_jot; // 0x8524
wait_context wait; // 0x8528
wait_context auto_wait; // 0x8538
U32 wait_event_mask; // 0x8548
F32 prompt_delay; // 0x854C
F32 quit_delay;
U8 prompt_ready; // 0x8554, size 0x1
U8 quit_ready;
U8 stream_locked[2]; // 0x8556
S32 next_stream; // 0x8558
sound_queue<4> sounds; // 0x855C
U8 allow_quit; // 0x8578
U8 quitting; // 0x8579
U8 delay_events; // 0x857A
callback* cb; // 0x857C
fixed_queue<trigger_pair, 32> triggered; // 0x8580
F32 volume; // 0x8690
zNPCCommon* speak_npc; // 0x8694
U32 speak_player; // 0x8698
};
}

#endif