Skip to content

Commit

Permalink
Merge pull request #616 from octorock/npcs
Browse files Browse the repository at this point in the history
Create new entity structs for NPCs
  • Loading branch information
hytopoulos authored Aug 6, 2023
2 parents 064bc43 + 4881967 commit d7a82d0
Show file tree
Hide file tree
Showing 116 changed files with 4,657 additions and 3,631 deletions.
2 changes: 1 addition & 1 deletion asm/macros/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@
.2byte \s
.endm

.macro _0807E9F0
.macro UpdateFusion
.2byte 0x0456
.endm

Expand Down
2 changes: 1 addition & 1 deletion data/scripts/castorWilds/script_CastorWildsStatueLeft.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SCRIPT_START script_CastorWildsStatueLeft
EndBlock
script_0800B268:
_0807EA4C
_0807E9F0
UpdateFusion
SetPlayerIdle
CheckKinstoneFused KINSTONE_CASTOR_WILDS_STATUE_LEFT
JumpIf script_0800B2E2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SCRIPT_START script_CastorWildsStatueMiddle
EndBlock
script_0800B298:
_0807EA4C
_0807E9F0
UpdateFusion
SetPlayerIdle
CheckKinstoneFused KINSTONE_CASTOR_WILDS_STATUE_MIDDLE
JumpIf script_0800B2E2
Expand Down
2 changes: 1 addition & 1 deletion data/scripts/castorWilds/script_CastorWildsStatueRight.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ SCRIPT_START script_CastorWildsStatueRight
EndBlock
script_0800B2C8:
_0807EA4C
_0807E9F0
UpdateFusion
SetPlayerIdle
CheckKinstoneFused KINSTONE_CASTOR_WILDS_STATUE_RIGHT
JumpIf script_0800B2E2
Expand Down
2 changes: 1 addition & 1 deletion data/scripts/cloudTops/script_Npc4EFirstCloud.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ SCRIPT_START script_Npc4EFirstCloud
EndBlock
script_0800D636:
_0807EA4C
_0807E9F0
UpdateFusion
Call NPC4E_IsKinstoneFused
JumpIf script_0800D650
Call EnablePauseMenu
Expand Down
2 changes: 1 addition & 1 deletion data/scripts/lonLonRanch/script_GoronPunching.inc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ script_0800B9F4:
FacePlayer
DoPostScriptAction 0x0000
Call sub_0807F650
_0807E9F0
UpdateFusion
SetPlayerIdle
Call sub_0806948C
JumpIf script_0800BA24
Expand Down
2 changes: 1 addition & 1 deletion data/scripts/npc/script_Farmer.inc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ script_0800B134:
FacePlayer
CallWithArg sub_0806BC94, 0x00000004
Call sub_0807F650
_0807E9F0
UpdateFusion
.ifndef EU
@! @bug: In EU, Eenie is marked as done fusing if kinstone menu is closed without fusing
JumpIfNot script_0800B160
Expand Down
2 changes: 1 addition & 1 deletion data/scripts/npc/script_MysteriousWall.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SCRIPT_START script_MysteriousWall
EndBlock
script_0800B98A:
_0807EA4C
_0807E9F0
UpdateFusion
JumpIf script_0800B99E
Call EnablePauseMenu
EnablePlayerControl
Expand Down
2 changes: 1 addition & 1 deletion data/scripts/veilFalls/script_NPC4ESourceOfTheFlow.inc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SCRIPT_START script_NPC4ESourceOfTheFlow
EndBlock
script_08015FE4:
_0807EA4C
_0807E9F0
UpdateFusion
SetPlayerIdle
CheckKinstoneFused KINSTONE_SOURCE_FLOW
JumpIf script_08015FFE
Expand Down
4 changes: 2 additions & 2 deletions include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ void sub_0801E1EC(u32, u32, u32);
void sub_0801DD58(u32, u32);
void sub_0801E1B8(u32, u32);
void AddKinstoneToBag(u32);
void sub_0801DFB4(struct Entity_*, u32, u32, u32);
u32 sub_0801E00C(void);
void InitializeFuseInfo(struct Entity_* entity, u32 textIndex, u32 cancelledTextIndex, u32 fusingTextIndex);
u32 PerformFuseAction(void);
bool32 CheckFusionMapMarkerDisabled(u32);
u32 sub_0801DB94(void);
u32 GetRandomSharedFusion(u8*);
Expand Down
1 change: 0 additions & 1 deletion include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ extern void sub_0805EC60(Entity*);
extern void InitPlayerMacro(PlayerMacroEntry*);
extern u32* sub_0805F25C(u32);
extern void sub_0805F8E4(u32 r0, WStruct* r1);
extern void sub_08060158(Entity*);
extern void sub_0806D0B0(Entity*);
extern bool32 sub_080806BC(u32, u32, u32, u32);
extern void sub_0808091C(const ScreenTransitionData* screenTransition, u32 transitionType);
Expand Down
18 changes: 14 additions & 4 deletions include/kinstone.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,27 @@

extern void sub_08018C58(u32);

typedef enum {
FUSION_STATE_0, // fusion was not yet started
FUSION_STATE_1, // failed?
FUSION_STATE_2, // successful?
FUSION_STATE_3, // fusion is being performed
FUSION_STATE_4, // player has closed the first messagebox
FUSION_STATE_5, // fusion declined by the player
FUSION_STATE_6, // Successful, but not yet finished?
} FusionState;

typedef struct {
u8 _0;
u8 fusionState; /** @see FusionState */
u8 action;
u8 _2;
u8 kinstoneId;
u8 prevUpdatePriority;
u8 _5;
u16 textIndex;
u16 _8;
u16 _a;
Entity* ent;
u16 cancelledTextIndex;
u16 fusingTextIndex;
Entity* entity;
} FuseInfo;
static_assert(sizeof(FuseInfo) == 0x10);
extern FuseInfo gFuseInfo;
Expand Down
121 changes: 60 additions & 61 deletions include/npc.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ s32 GetFacingDirectionInRectRadius(Entity* ent, u32 x, u32 y);
void sub_0806EE04(Entity* ent, void* a2, u32 a3);
u32 sub_0806EE20(Entity* ent);
s32 sub_0806F078(Entity* ent, s32 a2);
void sub_0806F118(Entity* ent);
void InitializeNPCFusion(Entity* ent);
void MarkFuserDone(Entity* ent);
void ShowNPCDialogue(Entity* ent, const Dialog* dia);

Expand All @@ -85,7 +85,6 @@ void CollideFollowers(void);

// TODO move?
void AddInteractableWhenBigFuser(Entity* ent, u32 kinstoneId);
u32 sub_0806F5A4(u32);
u32 GetFusionToOffer(Entity*);
void AddInteractableWhenBigObject(Entity*);
void sub_0807000C(Entity*);
Expand Down Expand Up @@ -222,114 +221,114 @@ enum NPC {
/*0x7f*/ NPC_NONE_39,
};

void Gentari(Entity*);
void Gentari();
void Gentari_Fusion(Entity*);
void Festari(Entity*);
void Festari_Fusion(Entity*);
void ForestMinish(Entity*);
void Festari();
void Festari_Fusion();
void ForestMinish();
void ForestMinish_Head(Entity*);
void ForestMinish_Fusion(Entity*);
void Postman(Entity*);
void Postman();
void Postman_Fusion(Entity*);
void NPC5(Entity*);
void NPC5();
void Townsperson(Entity*);
void Townsperson_Head(Entity*);
void Townsperson_Fusion(Entity*);
void Kid(Entity*);
void Kid();
void Kid_Head(Entity*);
void Kid_Fusion(Entity*);
void Guard(Entity*);
void Guard();
void Guard_Head(Entity*);
void NPC9(Entity*);
void Stamp(Entity*);
void Maid(Entity*);
void Maid_Head(Entity*);
void Marcy(Entity*);
void Wheaton(Entity*);
void Pita(Entity*);
void Pita();
void MinishEzlo(Entity*);
void MinishEzlo_Head(Entity*);
void Mailbox(Entity*);
void Beedle(Entity*);
void Beedle_Head(Entity*);
void Brocco(Entity*);
void Brocco();
void Brocco_Fusion(Entity*);
void SittingPerson(Entity*);
void SittingPerson();
void SittingPerson_Head(Entity*);
void SittingPerson_Fusion(Entity*);
void Pina(Entity*);
void Pina();
void Pina_Fusion(Entity*);
void Din(Entity*);
void Din();
void Din_Fusion(Entity*);
void Nayru(Entity*);
void Nayru();
void Nayru_Fusion(Entity*);
void Farore(Entity*);
void Farore();
void Farore_Fusion(Entity*);
void Sturgeon(Entity*);
void Sturgeon();
void Sturgeon_Head(Entity*);
void Sturgeon_Fusion(Entity*);
void TingleSiblings(Entity*);
void TingleSiblings_Fusion(Entity*);
void Stockwell(Entity*);
void Talon(Entity*);
void Stockwell();
void Talon();
void Talon_Head(Entity*);
void Talon_Fusion(Entity*);
void Malon(Entity*);
void Malon();
void Malon_Fusion(Entity*);
void Epona(Entity*);
void Epona_Fusion(Entity*);
void Epona();
void Epona_Fusion();
void MilkCart(Entity*);
void GhostBrothers(Entity*);
void GhostBrothers();
void GhostBrothers_Fusion(Entity*);
void Smith(Entity*);
void Smith();
void Smith_Head(Entity*);
void Smith_Fusion(Entity*);
void NPC23(Entity*);
void KingDaltus(Entity*);
void NPC23();
void KingDaltus();
void KingDaltus_Fusion(Entity*);
void MinisterPotho(Entity*);
void MinisterPotho();
void MinisterPotho_Fusion(Entity*);
void NPC26(Entity*);
void Vaati(Entity*);
void Zelda(Entity*);
void Mutoh(Entity*);
void Mutoh();
void Mutoh_Head(Entity*);
void Mutoh_Fusion(Entity*);
void Carpenter(Entity*);
void Carpenter();
void Carpenter_Head(Entity*);
void Carpenter_Fusion(Entity*);
void CastorWildsStatue(Entity*);
void CastorWildsStatue();
void CastorWildsStatue_Fusion(Entity*);
void Cat(Entity*);
void Cat();
void Cat_Fusion(Entity*);
void MountainMinish(Entity*);
void MountainMinish();
void MountainMinish_Head(Entity*);
void MountainMinish_Fusion(Entity*);
void ZeldaFollower(Entity*);
void Melari(Entity*);
void Melari_Head(Entity*);
void Melari_Fusion(Entity*);
void BladeBrothers(Entity*);
void BladeBrothers();
void BladeBrothers_Fusion(Entity*);
void Cow(Entity*);
void Cow_Fusion(Entity*);
void Goron(Entity*);
void Cow();
void Cow_Fusion();
void Goron();
void Goron_Fusion(Entity*);
void GoronMerchant(Entity*);
void Gorman(Entity*);
void Gorman();
void Gorman_Head(Entity*);
void Dog(Entity*);
void Dog_Head(Entity*);
void Dog_Fusion(Entity*);
void Syrup(Entity*);
void Dog();
void Dog_Head();
void Dog_Fusion();
void Syrup();
void Syrup_Head(Entity*);
void Rem(Entity*);
void TownMinish(Entity*);
void TownMinish_Head(Entity*);
void Rem();
void TownMinish();
void TownMinish_Head();
void TownMinish_Fusion(Entity*);
void Librari(Entity*);
void Librari();
void Librari_Fusion(Entity*);
void Percy(Entity*);
void Percy();
void Percy_Head(Entity*);
void Percy_Fusion(Entity*);
void VaatiReborn(Entity*);
Expand All @@ -343,45 +342,45 @@ void Dampe(Entity*);
void Dampe_Fusion(Entity*);
void DrLeft(Entity*);
void KingGustaf(Entity*);
void Gina(Entity*);
void Gina();
void Gina_Fusion(Entity*);
void Simon(Entity*);
void Anju(Entity*);
void Anju_Fusion(Entity*);
void Mama(Entity*);
void Anju();
void Anju_Fusion();
void Mama();
void Mama_Head(Entity*);
void Mama_Fusion(Entity*);
void Emma(Entity*);
void Teachers(Entity*);
void Teachers();
void Teachers_Head(Entity*);
void Teachers_Fusion(Entity*);
void WindTribespeople(Entity*);
void WindTribespeople_Head(Entity*);
void WindTribespeople_Fusion(Entity*);
void Gregal(Entity*);
void Gregal();
void Gregal_Fusion(Entity*);
void MayorHagen(Entity*);
void MayorHagen();
void MayorHagen_Fusion(Entity*);
void BigGoron(Entity*);
void BigGoron();
void Ezlo(Entity*);
void NPC4E(Entity*);
void NPC4E_Fusion(Entity*);
void NPC4F(Entity*);
void ClothesRack(Entity*);
void PicolyteBottle(Entity*);
void SmallTownMinish(Entity*);
void HurdyGurdyMan(Entity*);
void HurdyGurdyMan();
void HurdyGurdyMan_Head(Entity*);
void HurdyGurdyMan_Fusion(Entity*);
void Cucco(Entity*);
void Cucco();
void Cucco_Fusion(Entity*);
void CuccoChick(Entity*);
void CuccoChick_Fusion(Entity*);
void CuccoChick();
void CuccoChick_Fusion();
void FusionMenuNPC(Entity*);
void FusionMenuNPC_Head(Entity*);
void Phonograph(Entity*);
void NPC58(Entity*);
void NPC58_Head(Entity*);
void NPC58();
void NPC58_Head();

extern void (*const gNPCFunctions[128][3])(Entity*);

Expand Down
20 changes: 20 additions & 0 deletions include/npc/zelda.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#ifndef ZELDA_H
#define ZELDA_H

#include "entity.h"

typedef struct {
/*0x00*/ Entity base;
/*0x68*/ u8 unused[24];
/*0x80*/ u16 unk_80;
} ZeldaEntity;

typedef struct {
/*0x00*/ Entity base;
/*0x68*/ s8 unk_68;
/*0x69*/ s8 unk_69;
/*0x6a*/ u8 unused[10];
/*0x74*/ u16 unk_74;
} ZeldaFollowerEntity;

#endif // ZELDA_H
Loading

0 comments on commit d7a82d0

Please sign in to comment.