Adding Faerie to CMakeLists (#1913)

Adding Faerie to CMakeLists

Seems like SFX not working, but Faerie at least loads.  

~~Possibly also an issue with with the g_Entities array as the wings
should occupy g_Entities[5] (set up in line 550 of Faerie.c), but they
don't seem to either load or update (unsure which).~~
Seems this was either a graphical bug or something transient as the
wings seem to work now...

I'm not particularly interested in debugging this issue at this time, so
if you'd rather I abandon the PR, I can do that too. There wasn't a lot
of change.
This commit is contained in:
H.M. Burger 2024-11-19 08:23:05 -06:00 committed by GitHub
parent a3678181dc
commit ceb671f716
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 439 additions and 341 deletions

View File

@ -256,6 +256,15 @@ set(SOURCE_FILES_TT_001
src/servant/tt_001/servant_events.c
)
set(SOURCE_FILES_TT_002
src/servant/tt_002/faerie.c
src/servant/tt_002/faerie_ability_data.c
src/servant/tt_002/faerie_animation_data.c
src/servant/tt_002/faerie_data.c
src/servant/tt_002/faerie_spriteparts.c
src/servant/tt_002/servant_events.c
)
set(SOURCE_FILES_STAGE_SEL
src/pc/stages/stage_sel.c
src/st/sel/banks.c
@ -422,6 +431,7 @@ set(SOURCE_FILES_CORE
${SOURCE_FILES_WEAPON}
${SOURCE_FILES_TT_000}
${SOURCE_FILES_TT_001}
${SOURCE_FILES_TT_002}
)
add_library(core ${SOURCE_FILES_CORE})

View File

@ -1,5 +1,5 @@
thisFamiliar = 0x800736C8;
g_ServantSpriteParts = 0x80170040;
g_FaerieSpriteParts = 0x80170040;
g_FaerieClut = 0x801722E8;
g_FaerieAnimationFrames = 0x80172B14;
g_Events = 0x80172D2C;

View File

@ -70,7 +70,7 @@ typedef struct ServantEvent {
#define FOR_CASTLE_FLAG(x) CHECK_CASTLE_FLAG | x
extern SpriteParts* g_ServantSpriteParts[];
extern u16 g_ServantClut[];
extern u16 g_ServantClut[48];
extern s32 g_PlaySfxStep;
extern EntitySearch g_EntityRanges[];

View File

@ -5,11 +5,13 @@
extern ServantDesc bat_ServantDesc;
extern ServantDesc ghost_ServantDesc;
extern ServantDesc faerie_ServantDesc;
extern ServantDesc D_80170000;
// To add a new servant, replace proper null with it's servant desc
ServantDesc* servantDescs[] = {
NULL, &bat_ServantDesc, &ghost_ServantDesc, NULL, NULL, NULL, NULL};
NULL, &bat_ServantDesc, &ghost_ServantDesc, &faerie_ServantDesc, NULL, NULL,
NULL};
void HandleServantPrg() { D_80170000 = *servantDescs[g_Servant]; }

View File

@ -87,6 +87,18 @@ SimFile D_800A036C[] = {
D_80280000,
SD_TUKA2_VB_LEN,
SIM_VB,
},
{
"SERVANT/SD_FAIRY.VH",
aPbav_1,
SD_TUKA2_VH_LEN,
SIM_VH,
},
{
"SERVANT/SD_FAIRY.VB",
D_80280000,
SD_TUKA2_VB_LEN,
SIM_VB,
}};
const char* D_800A04AC[] = {

View File

@ -482,10 +482,6 @@ void SwitchModeInitialize(Entity* self) {
g_api.GetServantStats(self, 0, 0, &s_BatStats);
}
#ifdef VERSION_PC
extern u16 g_ServantClut[48];
#endif
void ServantInit(InitializeMode mode) {
u16* dst;
u16* src;

View File

@ -63,7 +63,7 @@ static s32 s_LastTargetedEntityIndex;
extern AnimationFrame g_DefaultGhostAnimationFrame[];
extern AnimationFrame* g_GhostAnimationFrames[];
extern GhostAbilityValues g_GhostAbilityStats[];
extern u16 g_GhostClut[];
extern u16 g_GhostClut[16];
extern s16
g_ConfusedOffsetsX[]; // Array of X-axis offsets for positioning primitives
@ -281,11 +281,6 @@ Entity* CreateChildEntity(Entity* parent, ChildEntityType entityType) {
// BUG? There is a fall-through case here with no return value on PSX
}
#ifdef VERSION_PC
extern u16 g_ServantClut[48];
extern u16 g_GhostClut[16];
#endif
void ServantInit(InitializeMode mode) {
RECT rect;
u16* dst;

View File

@ -32,33 +32,28 @@ static s32 s_AllowedAngle;
static s32 s_DistToTargetLocation;
static s16 s_TargetLocOffset_calc;
extern u16 g_FaerieClut[];
extern u16 g_FaerieClut[64];
extern FaerieAbilityStats g_FaerieAbilityStats[];
extern FaerieSfx g_FaerieSfx;
extern s16 g_ResistItemsParamMap[];
extern s16 g_PotionItemsParamMap[];
extern s32 D_800973FC; // this is in unkGraphicsStruct
extern s32 D_80097420[]; // this is in unkGraphicsStruct
extern unkGraphicsStruct g_unkGraphicsStruct;
extern ItemPrimitiveParams g_ItemPrimitiveParams[];
extern u16 g_FaerieFrameCount1;
extern u16 g_FaerieFrameCount2;
extern s32 g_SfxRandomizerGrunt[];
extern s32 g_SfxRandomizerHammerResist[];
extern s32 g_FaerieIntroRandomizer[];
extern s32 g_SfxEventRandomizer[];
extern HintTriggerMap g_FaerieHints[];
extern FaerieWingAnimationParams g_WingAnimationParams[];
extern AnimationFrame* g_FaerieAnimationFrames[];
void SetAnimationFrame(Entity*, s32);
void unused_39C8(Entity*);
void CheckForValidAbility(Entity*);
static void UpdateServantDefault(Entity* self);
static void UpdateServantUseLifeApple(Entity* self);
static void UpdateServantUseHammer(Entity* self);
static void UpdateServantUseUncurse(Entity* self);
@ -468,6 +463,12 @@ void ServantInit(InitializeMode mode) {
SpriteParts** spriteBanks;
Entity* entity;
#ifdef VERSION_PC
const int len = LEN(g_FaerieClut);
#else
const int len = 256;
#endif
s_ServantId = g_Servant;
if ((mode == MENU_SWITCH_SERVANT) || (mode == MENU_SAME_SERVANT)) {
@ -479,7 +480,7 @@ void ServantInit(InitializeMode mode) {
dst = &g_Clut[CLUT_INDEX_SERVANT];
src = g_FaerieClut;
for (i = 0; i < 0x100; i++) {
for (i = 0; i < len; i++) {
*dst++ = *src++;
}
@ -493,7 +494,7 @@ void ServantInit(InitializeMode mode) {
spriteBanks = g_api.o.spriteBanks;
spriteBanks += 20;
*spriteBanks = (SpriteParts*)g_ServantSpriteParts;
*spriteBanks = (SpriteParts*)g_FaerieSpriteParts;
entity = &g_Entities[SERVANT_ENTITY_INDEX];
@ -768,7 +769,7 @@ void UpdateServantUseLifeApple(Entity* self) {
self->ext.faerie.frameCounter++;
if (self->ext.faerie.frameCounter > 90) {
if (SearchForEntityInRange(1, 0x29)) {
D_800973FC = 0;
g_unkGraphicsStruct.D_800973FC = 0;
}
for (i = 8; i < 0x40; i++) {
@ -784,7 +785,7 @@ void UpdateServantUseLifeApple(Entity* self) {
case 0xA:
self->ext.faerie.frameCounter++;
if (self->ext.faerie.frameCounter > 90) {
D_80097420[0] = 0;
g_unkGraphicsStruct.unk20 = 0;
self->step++;
}
break;
@ -1324,7 +1325,8 @@ void UpdateServantAdditionalInit(Entity* arg0) {
case 1:
SelectAnimationFrame(arg0);
if (IsMovementAllowed(1) || CheckAllEntitiesValid() ||
s_RoomSpecialState == 1 || g_CutsceneHasControl || D_800973FC) {
s_RoomSpecialState == 1 || g_CutsceneHasControl ||
g_unkGraphicsStruct.D_800973FC) {
SetAnimationFrame(arg0, 0xE);
arg0->entityId = FAERIE_MODE_DEFAULT_UPDATE;
arg0->step = 0;
@ -1343,7 +1345,7 @@ void UpdateServantAdditionalInit(Entity* arg0) {
for (i = 0; true; i++) {
if (rnd <= g_FaerieIntroRandomizer[i * 2]) {
arg0->ext.faerie.currentSfxEvent =
g_FaerieIntroRandomizer[i * 2 + 1];
(FaerieSfxEventDesc*)g_FaerieIntroRandomizer[i * 2 + 1];
break;
}
}
@ -1351,7 +1353,7 @@ void UpdateServantAdditionalInit(Entity* arg0) {
for (i = 0; true; i++) {
if (rnd <= g_SfxEventRandomizer[i * 2]) {
arg0->ext.faerie.currentSfxEvent =
g_SfxEventRandomizer[i * 2 + 1];
(FaerieSfxEventDesc*)g_SfxEventRandomizer[i * 2 + 1];
break;
}
}

View File

@ -103,3 +103,13 @@ typedef struct {
/* 0x16 */ s16 : 16;
/* 0x18 */ u32 flags;
} ItemPrimitiveParams; // size = 0x1C
extern SpriteParts* g_FaerieSpriteParts[];
#ifdef PLATFORM_64BIT
extern s64 g_FaerieIntroRandomizer[];
extern s64 g_SfxEventRandomizer[];
#else
extern s32 g_FaerieIntroRandomizer[];
extern s32 g_SfxEventRandomizer[];
#endif

View File

@ -21,7 +21,11 @@ static FaerieSfxEventDesc s_IntroEventCommandVO[] = {
{ 0, 34, NA_VO_FAERIE_INTRO_COMMAND },
{-1, 14, 0}};
#ifdef VERSION_PC
s64 g_FaerieIntroRandomizer[] = {
#else
s32 g_FaerieIntroRandomizer[] = {
#endif
0x0000007F, s_IntroEventLifeVO, 0x000000FF, s_IntroEventCommandVO};
static FaerieSfxEventDesc s_SfxEventLetsGo[] = {
@ -31,7 +35,11 @@ static FaerieSfxEventDesc s_SfxEventFollow[] = {
{ 0, 38, NA_VO_FAERIE_FOLLOW },
{-1, 14, 0}};
#ifdef VERSION_PC
s64 g_SfxEventRandomizer[] = {
#else
s32 g_SfxEventRandomizer[] = {
#endif
0x0000007F, s_SfxEventLetsGo, 0x000000FF, s_SfxEventFollow};
// position data with a flag field

File diff suppressed because it is too large Load Diff