add friend area dialogue to C

This commit is contained in:
DizzyEggg 2025-06-15 12:47:29 +02:00
parent f5a45e74d2
commit 44ffeb47f7
11 changed files with 66 additions and 150 deletions

View File

@ -1,5 +0,0 @@
.section .rodata
@ ?
.string "pksdir0\0"

View File

@ -1,6 +0,0 @@
#define TILE_SIZE_2BPP 32
.section .rodata
@ ???
.align 2, 0
.string "pksdir0\0"

View File

@ -1,123 +0,0 @@
.section .rodata
.string "pksdir0\0"
.align 2,0
.global gFriendAreaDialogue
gFriendAreaDialogue: @ 813237C
@ replacing .incbin "baserom.gba", 0x0013237c, 0x13d610
.4byte FriendAreaFullEnergy
.4byte FriendAreaLikesPlace
.4byte FriendAreaVeryHappy
.4byte FriendAreaGrinning
.4byte FriendAreaStraight
.4byte FriendAreaHappy
.4byte FriendAreaRelax
.4byte FriendAreaTense
.4byte FriendAreaMood
.4byte FriendAreaFidge
.4byte FriendAreaDeep
.4byte FriendAreaWorried
.4byte FriendAreaEager
.4byte FriendAreaGrin
.4byte FriendAreaPensive
.4byte FriendAreaAnxious
.4byte FriendAreaGummi
.4byte FriendAreaSleepyEnergy
.global FriendAreaSleepyEnergy
FriendAreaSleepyEnergy:
.string "{CENTER_ALIGN}It appears to be a little sleepy,\n"
.string "{CENTER_ALIGN}but it's still full of energy.\0"
.align 2,0
.global FriendAreaGummi
FriendAreaGummi:
.string "{CENTER_ALIGN}It may want a Gummi.\0"
.align 2,0
.global FriendAreaAnxious
FriendAreaAnxious:
.string "{CENTER_ALIGN}It appears to be very anxious\n"
.string "{CENTER_ALIGN}to go on an adventure.\0"
.align 2,0
.global FriendAreaPensive
FriendAreaPensive:
.string "{CENTER_ALIGN}It looked pensive for a moment,\n"
.string "{CENTER_ALIGN}but it's grinning widely again.\0"
.align 2,0
.global FriendAreaGrin
FriendAreaGrin:
.string "{CENTER_ALIGN}It's looking this way with a grin.\0"
.align 2,0
.global FriendAreaEager
FriendAreaEager:
.string "{CENTER_ALIGN}It appears very eager\n"
.string "{CENTER_ALIGN}to go to a dungeon.\0"
.align 2,0
.global FriendAreaWorried
FriendAreaWorried:
.string "{CENTER_ALIGN}It appeared to have been worried,\n"
.string "{CENTER_ALIGN}but seems to have solved it.\0"
.align 2,0
.global FriendAreaDeep
FriendAreaDeep:
.string "{CENTER_ALIGN}It suddenly appears to be deep in thought.\0"
.align 2,0
.global FriendAreaFidge
FriendAreaFidge:
.string "{CENTER_ALIGN}It suddenly turned fidgety.\0"
.align 2,0
.global FriendAreaMood
FriendAreaMood:
.string "{CENTER_ALIGN}Its mood appears to have changed.\0"
.align 2,0
.global FriendAreaTense
FriendAreaTense:
.string "{CENTER_ALIGN}It appears to be a little tense.\0"
.align 2,0
.global FriendAreaRelax
FriendAreaRelax:
.string "{CENTER_ALIGN}It is relaxing at its favorite spot.\0"
.align 2,0
.global FriendAreaHappy
FriendAreaHappy:
.string "{CENTER_ALIGN}It is very happy!\0"
.align 2,0
.global FriendAreaStraight
FriendAreaStraight:
.string "{CENTER_ALIGN}It's trying to keep a straight face,\n"
.string "{CENTER_ALIGN}but it can't stop laughing!\0"
.align 2,0
.global FriendAreaGrinning
FriendAreaGrinning:
.string "{CENTER_ALIGN}It is grinning happily.\0"
.align 2,0
.global FriendAreaVeryHappy
FriendAreaVeryHappy:
.string "{CENTER_ALIGN}It appears to be very happy!\0"
.align 2,0
.global FriendAreaLikesPlace
FriendAreaLikesPlace:
.string "{CENTER_ALIGN}It appears to like this place a lot!\0"
.align 2,0
.global FriendAreaFullEnergy
FriendAreaFullEnergy:
.string "{CENTER_ALIGN}It seems to be full of energy!\0"
.align 2,0

9
data/pksdir_7.s Normal file
View File

@ -0,0 +1,9 @@
.section .rodata
.align 2, 0
@ ???
.string "pksdir0\0"
.align 2, 0

9
data/pksdir_8.s Normal file
View File

@ -0,0 +1,9 @@
.section .rodata
.align 2, 0
@ ???
.string "pksdir0\0"
.align 2, 0

View File

@ -0,0 +1,8 @@
#ifndef GUARD_FRIEND_AREA_DIALOGUE_H
#define GUARD_FRIEND_AREA_DIALOGUE_H
#define FRIEND_AREA_DIALOGUES_COUNT 18
extern const u8 *const gFriendAreaDialogue[FRIEND_AREA_DIALOGUES_COUNT];
#endif // GUARD_FRIEND_AREA_DIALOGUE_H

View File

@ -17,5 +17,6 @@ struct Struct3001B84_sub120
// ground_lives.s
s32 sub_80A7AE8(s16);
s32 sub_80A8FD8(s32 id_, PixelPos *pixelPos);
s16 GetFriendAreaDialogueId(s32 id_);
#endif // GUARD_GROUND_LIVES_H

View File

@ -444,11 +444,11 @@ SECTIONS {
src/text_1.o(.rodata);
src/text_2.o(.rodata);
src/graphics_memory.o(.rodata);
data/data2.o(.rodata);
data/pksdir_7.o(.rodata);
src/math.o(.rodata);
src/file_system.o(.rodata);
src/decompress_at.o(.rodata);
data/data_80B9BB8.o(.rodata);
data/pksdir_8.o(.rodata);
src/main.o(.rodata);
src/reg_control.o(.rodata);
data/data_80B9BB8_2.o(.rodata);
@ -734,7 +734,7 @@ SECTIONS {
src/unk_dungeon_load_maybe.o(.rodata);
data/data_8115F5C_3.o(.rodata);
src/ground_event_data.o(.rodata);
data/friend_area_dialogue.o(.rodata);
src/friend_area_dialogue.o(.rodata);
src/ground_data_t00p01_station.o(.rodata);
src/ground_data_t01p01_station.o(.rodata);
src/ground_data_t01p02a_station.o(.rodata);

View File

@ -0,0 +1,24 @@
#include "global.h"
#include "globaldata.h"
#include "friend_area_dialogue.h"
const u8 *const gFriendAreaDialogue[FRIEND_AREA_DIALOGUES_COUNT] = {
_("{CENTER_ALIGN}It seems to be full of energy!"),
_("{CENTER_ALIGN}It appears to like this place a lot!"),
_("{CENTER_ALIGN}It appears to be very happy!"),
_("{CENTER_ALIGN}It is grinning happily."),
_("{CENTER_ALIGN}It's trying to keep a straight face,\n{CENTER_ALIGN}but it can't stop laughing!"),
_("{CENTER_ALIGN}It is very happy!"),
_("{CENTER_ALIGN}It is relaxing at its favorite spot."),
_("{CENTER_ALIGN}It appears to be a little tense."),
_("{CENTER_ALIGN}Its mood appears to have changed."),
_("{CENTER_ALIGN}It suddenly turned fidgety."),
_("{CENTER_ALIGN}It suddenly appears to be deep in thought."),
_("{CENTER_ALIGN}It appeared to have been worried,\n{CENTER_ALIGN}but seems to have solved it."),
_("{CENTER_ALIGN}It appears very eager\n{CENTER_ALIGN}to go to a dungeon."),
_("{CENTER_ALIGN}It's looking this way with a grin."),
_("{CENTER_ALIGN}It looked pensive for a moment,\n{CENTER_ALIGN}but it's grinning widely again."),
_("{CENTER_ALIGN}It appears to be very anxious\n{CENTER_ALIGN}to go on an adventure."),
_("{CENTER_ALIGN}It may want a Gummi."),
_("{CENTER_ALIGN}It appears to be a little sleepy,\n{CENTER_ALIGN}but it's still full of energy."),
};

View File

@ -15,6 +15,7 @@
#include "other_random.h"
#include "text_util.h"
#include "code_8002774.h"
#include "friend_area_dialogue.h"
struct GroundLivesMeta_Sub1
{
@ -63,7 +64,7 @@ struct GroundLive
struct Struct3001B84_sub120 unk120;
s16 unk13C;
s16 unk13E;
s16 unk140;
s16 friendAreaDialogueId;
s8 direction1;
PixelPos unk144;
PixelPos unk14C;
@ -844,10 +845,10 @@ s32 GroundLives_Add(s32 id_, const GroundLivesData *ptr, s32 group_, s32 sector_
metaPtr->unk0 = 0;
metaPtr->unk4 = 0;
if (livesPtr->unk2 >= 14 && livesPtr->unk2 <= 29) {
livesPtr->unk140 = OtherRandInt(0x12);
livesPtr->friendAreaDialogueId = OtherRandInt(FRIEND_AREA_DIALOGUES_COUNT);
}
else {
livesPtr->unk140 = 0;
livesPtr->friendAreaDialogueId = 0;
}
}
@ -1489,12 +1490,12 @@ s32 sub_80A9090(s32 id_, s32 a1_)
return livesPtr->unk2;
}
s32 sub_80A90C8(s32 id_)
s16 GetFriendAreaDialogueId(s32 id_)
{
s32 id = (s16) id_;
struct GroundLive *livesPtr = &gGroundLives->array[id];
return livesPtr->unk140;
return livesPtr->friendAreaDialogueId;
}
UNUSED static bool8 sub_80A90E8(s32 id1_, s32 id2_)

View File

@ -39,6 +39,7 @@
#include "pokemon.h"
#include "wigglytuff_shop1.h"
#include "wonder_mail.h"
#include "friend_area_dialogue.h"
#include "structs/str_dungeon_setup.h"
@ -190,7 +191,6 @@ void sub_8096488(void);
bool8 sub_80964B4(void);
extern void nullsub_104(void);
s16 sub_80A8C4C();
s16 sub_80A90C8();
bool8 sub_8097640();
u8 sub_80964E4();
s32 sub_80A8E9C();
@ -199,7 +199,6 @@ bool8 sub_80A87E0();
s16 sub_80A8BFC(s16);
void sub_80A8F50(const u8 *buffer, s32, s32 size);
extern const u8 *gFriendAreaDialogue[];
extern struct unkStruct_808D144 gUnknown_8116710;
extern struct unkStruct_808D144 gUnknown_8116760;
extern struct unkStruct_808D144 gUnknown_8116794;
@ -3130,21 +3129,20 @@ s32 sub_80A14E8(Action *action, u8 idx, u32 r2, s32 r3)
break;
case 0xA:
{
s32 ret;
s32 ret2;
if ((action->unkC).arr[0] == 1)
{
u8 text[0x100];
DungeonLocation dungLocation;
ret = sub_80A8C4C((action->unkC).arr[1], &dungLocation);
if(ret != 0)
s32 ret = sub_80A8C4C(action->unkC.arr[1], &dungLocation);
if (ret != 0)
{
s32 dialogueId;
if (dungLocation.id == DUNGEON_HOWLING_FOREST_2 && ret == 0x104) {
return 2;
}
ret2 = sub_80A90C8((action->unkC).arr[1]);
InlineStrcpy(text, gFriendAreaDialogue[ret2]);
dialogueId = GetFriendAreaDialogueId(action->unkC.arr[1]);
InlineStrcpy(text, gFriendAreaDialogue[dialogueId]);
if (ScriptPrintText(0, 1, text) != 0)
return 1;
}