From ec67f746cb2f4de2545d25cc30836255ba7440de Mon Sep 17 00:00:00 2001 From: laqieer Date: Tue, 18 Feb 2020 22:44:17 +0800 Subject: [PATCH] complete chapter 1 event & unit config Signed-off-by: laqieer --- CMakeLists.txt | 2 +- include/text_id.h | 6 +- res/map/event/event_chap_1.txt | 77 +++++++++++++ src/chapter_event.c | 3 +- src/res/map/event/event_chap_1.s | 71 ++++++++++++ src/text.c | 180 +++++++++++++++++++++++++++---- 6 files changed, 312 insertions(+), 27 deletions(-) create mode 100644 res/map/event/event_chap_1.txt create mode 100644 src/res/map/event/event_chap_1.s diff --git a/CMakeLists.txt b/CMakeLists.txt index e60101ec..b233a08d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ process_gfx_portrait(GFX_SRCS_PORTRAIT portrait_alfonse.grit portrait_Anna_comma add_executable(${PROJECT_NAME} ${DIR_SRCS} ${GFX_SRCS} ${GFX_SRCS_PORTRAIT} src/chapter_title_pre.s src/chapter_title_1.s src/res/map/map/map_chap_pre.s src/res/map/map/map_chap_1.s - src/res/map/event/event_chap_template.s src/res/map/event/event_chap_pre.s + src/res/map/event/event_chap_template.s src/res/map/event/event_chap_pre.s src/res/map/event/event_chap_1.s src/res/character_palette/character_palette_Alfonse.s src/res/character_palette/character_palette_Anna.s src/res/character_palette/character_palette_Sharena.s src/res/music/native_instrument_map.s src/res/music/music_event_plain_1.s src/res/music/music_event_serious_1.s src/res/music/music_event_serious_3.s src/res/music/music_map_fe3.s src/res/animation/character/animation_Sharena.s src/res/animation/character/animation_Sharena_disarmed.s diff --git a/include/text_id.h b/include/text_id.h index bcdf6e8b..f9e3ca5b 100644 --- a/include/text_id.h +++ b/include/text_id.h @@ -17,7 +17,9 @@ #define TEXT_CHAP_1_TITLE 0x1247 -#define TEXT_CHAP_1_OP 0x1248 -#define TEXT_CHAP_1_ED 0x1249 +#define TEXT_CHAP_1_OP_1 0x1248 +#define TEXT_CHAP_1_OP_2 0x1249 +#define TEXT_CHAP_1_ED_1 0x124A +#define TEXT_CHAP_1_ED_2 0x124B #endif //FE7_JP_STUNNING_TRIBBLE_TEXT_ID_H diff --git a/res/map/event/event_chap_1.txt b/res/map/event/event_chap_1.txt new file mode 100644 index 00000000..42b54811 --- /dev/null +++ b/res/map/event/event_chap_1.txt @@ -0,0 +1,77 @@ +// Chapter prologue event + +#include EAStdlib.event +#include "Project Definition.txt" + +PointerList: +POIN TurnBasedEvents +POIN CharacterBasedEvents +POIN LocationBasedEvents +POIN MiscBasedEvents +POIN TrapsEliwoodMode +POIN TrapsHectorMode +POIN EnemyUnitsENM +POIN EnemyUnitsENM +POIN EnemyUnitsENM +POIN EnemyUnitsENM +POIN AllyUnitsENM +POIN AllyUnitsENM +POIN AllyUnitsENM +POIN AllyUnitsENM +POIN BeginningScene +POIN EndingScene + +TurnBasedEvents: +TURN 0x0 BeginningScene [1,0] 0x0 0x0 +END_MAIN + +CharacterBasedEvents: +END_MAIN + +LocationBasedEvents: +END_MAIN + +MiscBasedEvents: +CauseGameOverIfLordDies +DefeatAll(EndingScene) +POIN 0x7AA5D // a bug of EA Core's C mode +END_MAIN + +BeginningScene: +LOU1 AllyUnitSharena +ENUN +LOU1 AllyUnitsENM +ENUN +TEX1 TEXT_CHAP_1_OP_1 +LOU1 EnemyUnitsENM +ENUN +TEX1 TEXT_CHAP_1_OP_2 +ENDA + +EndingScene: +TEX1 TEXT_CHAP_1_ED_1 +TEX1 TEXT_CHAP_1_ED_2 +MNCH 0 +ENDA + +AllyUnitsENM: +UNIT Alfonse AlfonseLord Anna 0x8 [7,0] [7,0] [0x0,0x0,0x0,0x0] [0x0,0x0,0x0,0x0] +UNIT Anna AnnaLord 0x0 0x8 [9,0] [9,0] [0x0,0x0,0x0,0x0] [0x0,0x0,0x0,0x0] +UNIT + +EnemyUnitsENM: +UNIT GenericSoldierSummonedWeak WyvernKnight_F 0x0 0x15 [14,16] [14,16] [IronLance,0x0,0x0,0x0] [0x0,0x3,0x9,0x0] +UNIT GenericSoldierSummonedWeak PegasusKnight 0x0 0x14 [11,18] [11,18] [IronLance,0x0,0x0,0x0] [0x0,0x3,0x9,0x0] +UNIT GenericSoldierSummonedWeak PegasusKnight 0x0 0x14 [12,18] [12,18] [IronLance,0x0,0x0,0x0] [0x0,0x3,0x9,0x0] +UNIT GenericSoldierSummonedWeak Cleric 0x0 0x14 [14,15] [14,15] [Heal,0x0,0x0,0x0] [0xe,0x3,0x0,0x0] +UNIT + +AllyUnitSharena: +UNIT Sharena SharenaLord Anna 0x8 [11,0] [11,0] [IronLance,Vulnerary,0x0,0x0] [0x0,0x0,0x0,0x0] +UNIT + +TrapsEliwoodMode: +ENDTRAP + +TrapsHectorMode: +ENDTRAP \ No newline at end of file diff --git a/src/chapter_event.c b/src/chapter_event.c index f33a8bc3..ea73e924 100644 --- a/src/chapter_event.c +++ b/src/chapter_event.c @@ -7,12 +7,13 @@ extern const u8 * const event_chap_template[]; extern const u8 * const event_chap_pre[]; +extern const u8 * const event_chap_1[]; const u8 ** const events[] = { NULL, event_chap_template, event_chap_pre, - 0x8d686f0, + event_chap_1, }; const u8 *** const pEvents = events; \ No newline at end of file diff --git a/src/res/map/event/event_chap_1.s b/src/res/map/event/event_chap_1.s new file mode 100644 index 00000000..50305b4b --- /dev/null +++ b/src/res/map/event/event_chap_1.s @@ -0,0 +1,71 @@ + .section .rodata + .align 2 + .global event_chap_1 +event_chap_1: +PointerList: + .word TurnBasedEvents + .word CharacterBasedEvents + .word LocationBasedEvents + .word MiscBasedEvents + .word TrapsEliwoodMode + .word TrapsHectorMode + .word EnemyUnitsENM + .word EnemyUnitsENM + .word EnemyUnitsENM + .word EnemyUnitsENM + .word AllyUnitsENM + .word AllyUnitsENM + .word AllyUnitsENM + .word AllyUnitsENM + .word BeginningScene + .word EndingScene +TurnBasedEvents: + .byte 0x02, 0x00, 0x00, 0x00 + .word BeginningScene + .byte 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 +CharacterBasedEvents: + .byte 0x00, 0x00, 0x00, 0x00 +LocationBasedEvents: + .byte 0x00, 0x00, 0x00, 0x00 +MiscBasedEvents: + .byte 0x01, 0x00, 0x00, 0x00, 0x1C, 0xF7, 0xD6, 0x08, 0x65, 0x00, 0x00, 0x00 + .byte 0x0E, 0x00, 0x00, 0x00 + .word EndingScene + .byte 0x5D, 0xAA, 0x07, 0x08 + .byte 0x00, 0x00, 0x00, 0x00 +BeginningScene: + .byte 0x30, 0x00, 0x00, 0x00 + .word AllyUnitSharena + .byte 0x39, 0x00, 0x00, 0x00 + .byte 0x30, 0x00, 0x00, 0x00 + .word AllyUnitsENM + .byte 0x39, 0x00, 0x00, 0x00 + .byte 0x0D, 0x00, 0x00, 0x00, 0x48, 0x12, 0x00, 0x00 + .byte 0x30, 0x00, 0x00, 0x00 + .word EnemyUnitsENM + .byte 0x39, 0x00, 0x00, 0x00 + .byte 0x0D, 0x00, 0x00, 0x00, 0x49, 0x12, 0x00, 0x00 + .byte 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +EndingScene: + .byte 0x0D, 0x00, 0x00, 0x00, 0x4A, 0x12, 0x00, 0x00 + .byte 0x0D, 0x00, 0x00, 0x00, 0x4B, 0x12, 0x00, 0x00 + .byte 0x7F, 0x00, 0x00, 0x00 + .byte 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +AllyUnitsENM: + .byte 0x01, 0x01, 0x02, 0x08, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x02, 0x03, 0x00, 0x08, 0x09, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +EnemyUnitsENM: + .byte 0x73, 0x35, 0x00, 0x15, 0x0E, 0x10, 0x0E, 0x10, 0x14, 0x00, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00 + .byte 0x73, 0x32, 0x00, 0x14, 0x0B, 0x12, 0x0B, 0x12, 0x14, 0x00, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00 + .byte 0x73, 0x32, 0x00, 0x14, 0x0C, 0x12, 0x0C, 0x12, 0x14, 0x00, 0x00, 0x00, 0x00, 0x03, 0x09, 0x00 + .byte 0x73, 0x1D, 0x00, 0x14, 0x0E, 0x0F, 0x0E, 0x0F, 0x4A, 0x00, 0x00, 0x00, 0x0E, 0x03, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +AllyUnitSharena: + .byte 0x03, 0x02, 0x02, 0x08, 0x0B, 0x00, 0x0B, 0x00, 0x14, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +TrapsEliwoodMode: + .byte 0x00 +TrapsHectorMode: + .byte 0x00 diff --git a/src/text.c b/src/text.c index 24839e97..a388411e 100644 --- a/src/text.c +++ b/src/text.c @@ -2,10 +2,16 @@ // Created by laqieer on 2019/12/12. // +// help debug: http://freaka.freehostia.com/charset_js.html + +#include + #include "text.h" #include "text_id.h" #include "portrait_id.h" +#define TEXT_AUTO_NEW_LINE false + // Add game text here const char* const texts[] = { // Tutorial Lyn's character description @@ -17,6 +23,12 @@ const char* const texts[] = { // character GenericSoldierEmblianSuperWeak description [0x221] = "エンブラ帝国の兵士", + // GenericSoldierSummoned name + [1377] = "異界の英雄", + + // GenericSoldierSummoned description + [555] = "ヴェロニカと契約を結ぶ英雄", + // character Alfonse name [0x4E4] = "アルフォンス", @@ -128,6 +140,125 @@ const char* const texts[] = { // Chapter title [TEXT_CHAP_PRE_TITLE] = "至天の世界", [TEXT_CHAP_1_TITLE] = "奴が力を示せ", + + // Chapter 1 opening part 1 + [TEXT_CHAP_1_OP_1] = TCC_OPEN_MID_LEFT + TCC_LOAD_FACE PORTRAIT_SHARENA + "アンナ隊長、お兄様!" TCC_NEWLINE + "来るのが遅いですよーっ!" TCC_PUSH_A + TCC_OPEN_RIGHT + TCC_LOAD_FACE PORTRAIT_ALFONSE + "すまない、シャロン。" TCC_NEWLINE + "ここに来るまでに戦闘があってね。" TCC_PUSH_A + TCC_OPEN_MID_LEFT + "んん?そのお隣にいる方は。。。" TCC_NEWLINE + "その手に燦然と輝く神器は。。。" TCC_NEWLINE TCC_PUSH_A + "もしやあなたが、異界の大英雄様!?" TCC_NEWLINE + "機関全員で夢にまで見た、" TCC_NEWLINE + //"噂の救世主ですかーーっ!?" TCC_PUSH_A + // somehow kanji 噂 will miss 0x5c here + "\x89\x5Cの救世主ですかーーっ!?" TCC_PUSH_A + TCC_OPEN_RIGHT + "ああ。名は"TCC_TACTICIAN_NAME"だ。" TCC_NEWLINE + "先程も見事な指揮で、" TCC_NEWLINE + "僕たちに力を貸してくれた。" TCC_PUSH_A + TCC_OPEN_MID_LEFT + "すごーーい!すごいです!!" TCC_NEWLINE + "さすが"TCC_TACTICIAN_NAME"さん!" TCC_NEWLINE + "百年前からファンでしたっ!!" TCC_NEWLINE TCC_PUSH_A + //"あ、申し遅れました!私、シャロンです!" TCC_NEWLINE + "あ、\x90\x5Cし遅れました!私、シャロンです!" TCC_NEWLINE + "アスク王国の王女で、" TCC_NEWLINE + "アルフォンスお兄様の妹なんですよ。"TCC_PUSH_A + TCC_OPEN_RIGHT + "それでシャロン、戦況は?" TCC_PUSH_A + TCC_OPEN_MID_LEFT + "一言で言うとまずいですね。" TCC_NEWLINE + "エンブラ軍の奴ら、" TCC_NEWLINE + "空飛ぶ赤い英雄を従えたんです。" TCC_PUSH_A + TCC_OPEN_RIGHT + "紋章の異界にいる、" TCC_NEWLINE + "赤色の飛兵。。。" TCC_NEWLINE + "もしやミネルバ王女か?" TCC_NEWLINE TCC_PUSH_A + "苦戦を強いられるかもしれないが、" TCC_NEWLINE + "弓兵の英雄を連れていれば" TCC_NEWLINE + "あるいは。。。" TCC_NEWLINE TCC_PUSH_A + TCC_OPEN_RIGHT + TCC_CLEAR_FACE + TCC_OPEN_MID_LEFT + TCC_CLEAR_FACE, + + // Chapter 1 opening part 2 + [TEXT_CHAP_1_OP_2] = TCC_OPEN_LEFT + TCC_LOAD_FACE PORTRAIT_ALFONSE + TCC_OPEN_MID_LEFT + TCC_LOAD_FACE PORTRAIT_SHARENA + TCC_OPEN_FAR_LEFT + TCC_LOAD_FACE PORTRAIT_ANNA + TCC_OPEN_FAR_FAR_RIGHT + "わたしはミネルバ。" TCC_NEWLINE + "マケドニア王女だ。" TCC_NEWLINE + "異邦の旅人よ。元いた世界に帰りなさい。" TCC_NEWLINE TCC_PUSH_A + "我が身は既に「契約」を結ばれた。" TCC_NEWLINE + "エンブラ皇女ヴェロニカの命により、" TCC_NEWLINE + "これから異界に攻め入ることになる。" TCC_PUSH_A + TCC_OPEN_LEFT + "ミネルバ王女、僕はアルフォンス。" TCC_NEWLINE + "あなたが攻め入ることを命じられた" TCC_NEWLINE + "アスク王国の王子です。" TCC_NEWLINE TCC_PUSH_A + "どうか、武器を収めてください。" TCC_NEWLINE + "僕たちは英雄たちとの戦争を" TCC_NEWLINE + "望んではいません。" TCC_PUSH_A + TCC_OPEN_FAR_FAR_RIGHT + "ならば、力を示しなさい。" TCC_NEWLINE + "貴殿が力を示したならば、わたしは" TCC_NEWLINE + "ヴェロニカとの契約から解き放たれる。" TCC_PUSH_A + TCC_OPEN_LEFT + "力を示す。。" TCC_NEWLINE + "それはつまり。。。" TCC_PUSH_A + TCC_OPEN_FAR_LEFT + "戦って勝ちなさいってことね。" TCC_NEWLINE + "みんな、準備は良い?" TCC_PUSH_A, + + // Chapter 1 ending part 1 + [TEXT_CHAP_1_ED_1] = TCC_OPEN_FAR_FAR_RIGHT + "見事。。。力は示された。" TCC_NEWLINE TCC_PUSH_A + "ありがとう、アルフォンス王子。" TCC_NEWLINE + "これで私たちは自由の身となった。" TCC_NEWLINE TCC_PUSH_A + "もう貴国に攻め入ることはない。" TCC_NEWLINE + "我が名において誓いましょう。" TCC_PUSH_A, + + // Chapter 1 ending part 2 + [TEXT_CHAP_1_ED_2] = TCC_OPEN_MID_LEFT + TCC_LOAD_FACE PORTRAIT_SHARENA + TCC_OPEN_LEFT + TCC_LOAD_FACE PORTRAIT_ALFONSE + "これで、任務は完了だね、" TCC_NEWLINE + TCC_TACTICIAN_NAME"。" TCC_NEWLINE TCC_PUSH_A + TCC_OPEN_MID_LEFT + TCC_TACTICIAN_NAME"さんの指揮、" TCC_NEWLINE + TCC_TACTICIAN_NAME"すっごく素晴らしかったです。。。!" TCC_NEWLINE + "ますます惚れ直しちゃいました!" TCC_PUSH_A + TCC_OPEN_RIGHT + TCC_LOAD_FACE PORTRAIT_ANNA + "みんな聞いて!" TCC_NEWLINE + "たった今入った知らせよ!" TCC_NEWLINE TCC_PUSH_A + "エンブラ軍が大規模軍を展開して" TCC_NEWLINE + "私たちの領地に侵攻してきたわ!" TCC_PUSH_A + TCC_OPEN_LEFT + "なんだって!?" TCC_NEWLINE + "まさか、この地に来させたのは陽動。。。!?" TCC_PUSH_A + TCC_OPEN_MID_LEFT + "そんなあ。。。!" TCC_NEWLINE + "私たち、まんまと敵の罠に" TCC_NEWLINE + "はまっちゃったんですか!?" TCC_PUSH_A + TCC_OPEN_RIGHT + "とにかく、" TCC_NEWLINE + "急いで帰還しましょう!" TCC_PUSH_A, + + + + }; extern int lastTextID; @@ -147,34 +278,37 @@ char *decodeText(int textID) char *q = decodedText; if(textID < sizeof(texts) / 4 && p) { - // copy text directly - if(getStringTextWidth(texts[textID]) <= TEXT_LINE_WIDTH_MAX) - while(*p) - *q++ = *p++; - else - { - // add new lines automatically - unsigned int charWidth = 0; - unsigned int lineWidth = 0; - - while(*p) - { - if(*p < 0x20) + if (TEXT_AUTO_NEW_LINE) { + // copy text directly + if (getStringTextWidth(texts[textID]) <= TEXT_LINE_WIDTH_MAX) + while (*p) *q++ = *p++; - else - { - char *p_next = getCharTextWidth(p, &charWidth); - lineWidth += charWidth; - if(lineWidth > TEXT_LINE_WIDTH_MAX) - { - *q++ = 1; // new line - lineWidth = 0; - } - while(p < p_next) + else { + // add new lines automatically + unsigned int charWidth = 0; + unsigned int lineWidth = 0; + + while (*p) { + if (*p < 0x20) *q++ = *p++; + else { + char *p_next = getCharTextWidth(p, &charWidth); + lineWidth += charWidth; + if (lineWidth > TEXT_LINE_WIDTH_MAX) { + *q++ = 1; // new line + lineWidth = 0; + } + while (p < p_next) + *q++ = *p++; + } } } } + else + { + while (*p) + *q++ = *p++; + } // add 0 to end string *q = 0;