sm64coopdx/text/define_text.inc.c
Beckowl 03b29489b1
Some checks failed
Build coop / build-linux (push) Has been cancelled
Build coop / build-steamos (push) Has been cancelled
Build coop / build-windows-opengl (push) Has been cancelled
Build coop / build-windows-directx (push) Has been cancelled
Build coop / build-macos-arm (push) Has been cancelled
Build coop / build-macos-intel (push) Has been cancelled
Add `smlua_text_utils_allocate_dialog` (#896)
* wip

* get rid of seg2_dialog_table and fix crashes

* remove unused include

* change more types to s32

* remove dialog tables from eu_translation.h

* fix dialog_table_get signature

* Change `oToadMessageDialogId` to s32

* remove exit from dialog_table_add

* warning

* calloc allocated dialogs

* avoid memcpy on allocation fail

* Move dialog entry text field init to dialog_table_init

* Free original dialog entries' text field

* Put all reset logic in one place

* Run autogen

* Remove ``get_dialog_text_ascii`` from autogen

* minor fix

* free dialog->str if replaced

* nevermind

* remove get_dialog_unmodified from autogen

* Change -1 to DIALOG_NONE

* update stuff to s32

* use growing array functions

* Change limit to something more reasonable

* add null check

* remove explicit cast

* Minor fixes

* more type fix

* peachy review

* Fix weird enums in autogen

* remove extra newline :p

* add dialog restore

* bump max dialogs just a lil bit 🥺

* add lua behavior params

* all OBJECT fields are now Lua variables

* Revert lua behavior params changes

* isaac review

* fix segfault

---------

Co-authored-by: PeachyPeachSM64 <72323920+PeachyPeachSM64@users.noreply.github.com>
2025-08-03 17:49:45 +02:00

74 lines
1.9 KiB
C

// == dialog ==
// (defines en_dialog_table etc.)
#define DEFINE_DIALOG(id, _1, _2, _3, _4, _len) \
static u8 dialog_text_ ## id[_len] = { 0xFF };
#include "dialogs.h"
#undef DEFINE_DIALOG
#define DEFINE_DIALOG(id, unused, linesPerBox, leftOffset, width, _) \
static const struct DialogEntry dialog_entry_orig_ ## id = { \
unused, linesPerBox, leftOffset, width, dialog_text_ ## id, NULL, false \
};
#include "dialogs.h"
#undef DEFINE_DIALOG
#define DEFINE_DIALOG(id, _1, _2, _3, _4, _5) &dialog_entry_orig_ ## id,
const struct DialogEntry *const seg2_dialog_original[] = {
#include "dialogs.h"
NULL
};
#undef DEFINE_DIALOG
// == courses ==
// (defines en_course_name_table etc.)
// The game duplicates this in levels/menu/leveldata.c in EU, so we split
// it out into a separate include file.
#define COURSE_TABLE seg2_course_name_table
#include "define_courses.inc.c"
// == acts ==
// (defines en_act_name_table etc.)
#define COURSE_ACTS(id, name, a,b,c,d,e,f) \
static u8 act_name_ ## id ## _1[a] = { 0xFF }; \
static u8 act_name_ ## id ## _2[b] = { 0xFF }; \
static u8 act_name_ ## id ## _3[c] = { 0xFF }; \
static u8 act_name_ ## id ## _4[d] = { 0xFF }; \
static u8 act_name_ ## id ## _5[e] = { 0xFF }; \
static u8 act_name_ ## id ## _6[f] = { 0xFF };
#define SECRET_STAR(id, name)
#define CASTLE_SECRET_STARS(str)
#undef EXTRA_TEXT
#define EXTRA_TEXT(id, str) \
static u8 extra_text_ ## id[str] = { 0xFF };
#include "courses.h"
#undef COURSE_ACTS
#undef EXTRA_TEXT
#define COURSE_ACTS(id, name, a,b,c,d,e,f) \
act_name_ ## id ## _1, act_name_ ## id ## _2, act_name_ ## id ## _3, \
act_name_ ## id ## _4, act_name_ ## id ## _5, act_name_ ## id ## _6,
#define EXTRA_TEXT(id, str) extra_text_ ## id,
const u8* seg2_act_name_table[] = {
#include "courses.h"
NULL
};
const u8* seg2_act_name_table_original[] = {
#include "courses.h"
NULL
};
#include "dialog_assets.inc.c"
#include "courses_assets.inc.c"