1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 14:20:11 +00:00

Merge branch 'master' into z_en_tk

This commit is contained in:
glank 2020-03-22 18:43:40 +01:00
commit d7b0ba7c06
199 changed files with 2054 additions and 3329 deletions

View file

@ -1,14 +1,306 @@
/*
* File: z_bg_toki_swd.c
* Overlay: ovl_Bg_Toki_Swd
* Description: Master Sword (Contains Cutscenes)
*/
#include "z_bg_toki_swd.h"
#define ROOM 0x00
#define FLAGS 0x00000010
void BgTokiSwd_Init(BgTokiSwd* this, GlobalContext* globalCtx);
void BgTokiSwd_Destroy(BgTokiSwd* this, GlobalContext* globalCtx);
void BgTokiSwd_Update(BgTokiSwd* this, GlobalContext* globalCtx);
void BgTokiSwd_Draw(BgTokiSwd* this, GlobalContext* globalCtx);
static void BgTokiSwd_Init(BgTokiSwd* this, GlobalContext* globalCtx);
static void BgTokiSwd_Destroy(BgTokiSwd* this, GlobalContext* globalCtx);
static void BgTokiSwd_Update(BgTokiSwd* this, GlobalContext* globalCtx);
static void BgTokiSwd_Draw(BgTokiSwd* this, GlobalContext* globalCtx);
static void BgTokiSwd_SetupAction(BgTokiSwd* this, ActorFunc actionFunc);
static void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx);
static void func_808BB0AC(BgTokiSwd* this, GlobalContext* globalCtx);
static void func_808BB128(BgTokiSwd* this, GlobalContext* globalCtx);
extern u32 D_06001BD0;
static u32 D_808BB2F0[] =
{
0x00000009, 0x000001A9, 0x0000000A, 0x00000001,
0x000C0000, 0x01000000, 0x00000000, 0x00000000,
0x00000036, 0x00000034, 0x00000000, 0x00000036,
0x00000034, 0x00000000, 0x00000000, 0x00000000,
0x00000004, 0x00000001, 0x0002006E, 0x006F0000,
0x00000000, 0x00000000, 0xFFFFFFE3, 0xFFFFFFC5,
0x00000000, 0xFFFFFFE3, 0xFFFFFFC5, 0x00000000,
0x00000000, 0x00000000, 0x00000003, 0x00000001,
0x000A006E, 0x006F0000, 0x00000000, 0x00000000,
0x0000002E, 0xFFFFFFE6, 0x00000000, 0x0000002E,
0xFFFFFFE6, 0x00000000, 0x00000000, 0x00000000,
0x000003E8, 0x00000001, 0x000800E6, 0x00E700E7,
0x0000002D, 0x00000001, 0x000100D2, 0x00E600E6,
0x00000001, 0x00010000, 0x00F10000, 0x00000000,
0x42700000, 0xFFD60048, 0xFFD9018C, 0x00000000,
0x42700000, 0xFFD60048, 0xFFD9019D, 0x00000000,
0x42700000, 0xFFD60048, 0xFFD901AE, 0x00000000,
0x42700000, 0xFFD60048, 0xFFD902A8, 0x00000000,
0x42700000, 0xFFD60048, 0xFFD90000, 0x00000000,
0x42700000, 0xFFD60048, 0xFFD9007A, 0x00000000,
0x42700000, 0xFFD60048, 0xFFD90064, 0x00000000,
0x42700000, 0xFFD60048, 0xFFD90074, 0xFF000000,
0x42700000, 0xFFD60048, 0xFFD9005F, 0x00000001,
0x00010050, 0x01960000, 0x00000000, 0x42700000,
0xFFFF005F, 0xFFED2F73, 0x00000000, 0x42700000,
0xFFFF005F, 0xFFED6B2F, 0x00000000, 0x42700000,
0xFFFF005F, 0xFFED6169, 0x00000000, 0x42700000,
0xFFFF005F, 0xFFED0000, 0x00000000, 0x42700000,
0xFFFF005F, 0xFFED0005, 0x00000000, 0x42700000,
0xFFFF0081, 0xFFDE7961, 0x00000000, 0x42700000,
0xFFFF00AD, 0xFFED742F, 0x00000000, 0x42700000,
0xFFEF00D9, 0xFFEC2E64, 0x00000000, 0x42700000,
0xFFE80148, 0xFFF40000, 0x00000000, 0x42700000,
0xFFE501FD, 0xFFFE2F73, 0x00000000, 0x42700000,
0xFFD7032D, 0x000A6B2F, 0x00000000, 0x42700000,
0xFFC40505, 0x00266D61, 0x00000000, 0x42700000,
0xFFC60776, 0x005B0000, 0x00000000, 0x42700000,
0xFFCB09DE, 0x00850005, 0x00000000, 0x42700000,
0xFFDF0D75, 0x00C17961, 0x00000000, 0x42700000,
0x00000F78, 0x00E1742F, 0x00000000, 0x42700000,
0x000710DD, 0x00F56565, 0x00000000, 0x42700000,
0x000710DC, 0x00F50000, 0x00000000, 0x42700000,
0x000710DC, 0x00F52F73, 0xFF000000, 0x42700000,
0x000710DC, 0x00F56B2F, 0x00000002, 0x00010000,
0x010E0000, 0x0000001E, 0x42700000, 0xFFEC0055,
0xFFF72F73, 0x0000001E, 0x42700000, 0xFFEC0055,
0xFFF76B2F, 0x0000001E, 0x42700000, 0xFFEC0055,
0xFFF76169, 0x0000001E, 0x42700000, 0xFFEC0055,
0xFFF70000, 0x0000001E, 0x42700000, 0xFFEC0055,
0xFFF70005, 0x0000001E, 0x42700000, 0xFFEC0055,
0xFFF77961, 0x0000001E, 0x42700000, 0xFFEC0055,
0xFFF7742F, 0x0000001E, 0x42700000, 0xFFEC0055,
0xFFF72E64, 0xFF00001E, 0x42700000, 0xFFEC0055,
0xFFF70000, 0x00000002, 0x00010050, 0x01A90000,
0x00000005, 0x42700000, 0xFFFF0070, 0x00072F73,
0x00000005, 0x42700000, 0xFFFF0070, 0x00076B2F,
0x00000005, 0x42700000, 0xFFFF0070, 0x00076169,
0x00000005, 0x42700000, 0xFFFF0070, 0x00070000,
0x0000000F, 0x42700000, 0xFFFF0070, 0x00070005,
0x00000014, 0x42700000, 0xFFFF0075, 0x00077961,
0x00000019, 0x42700000, 0xFFFF0075, 0x0007742F,
0x00000019, 0x42700000, 0xFFFF0075, 0x00072E64,
0x00000014, 0x42700000, 0xFFFF0075, 0x00070000,
0x00000014, 0x42700000, 0xFFFF0075, 0x00072F73,
0x00000014, 0x42700000, 0xFFFF0075, 0x00076B2F,
0x00000014, 0x42700000, 0xFFFF0075, 0x00076D61,
0x00000014, 0x42700000, 0xFFFF0075, 0x00070000,
0x00000014, 0x42700000, 0xFFFF0075, 0x00070005,
0x00000014, 0x42700000, 0xFFFF0075, 0x00077961,
0x00000014, 0x42700000, 0xFFFF0075, 0x0007742F,
0x00000014, 0x42700000, 0xFFFF0075, 0x00076565,
0x00000014, 0x42700000, 0xFFFF0075, 0x00070000,
0x00000014, 0x42700000, 0xFFFF0075, 0x00072F73,
0xFF000014, 0x42700000, 0xFFFF0075, 0x00076B2F,
0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000,
};
static u32 D_808BB7A0[] =
{
0x00000009, 0x00000170, 0x00000001, 0x00010000,
0x007E0000, 0x00000000, 0x42700000, 0xFFFF0065,
0xFF92616D, 0x00000000, 0x42200000, 0xFFFF0065,
0xFF926964, 0x00000000, 0x42200000, 0xFFFF0065,
0xFF9200FB, 0x00000000, 0x42200000, 0xFFFF0065,
0xFF920111, 0x00000000, 0x42200000, 0xFFFF0065,
0xFF93012D, 0x00000000, 0x42200000, 0xFFFF0047,
0xFF920033, 0x00000000, 0x42200000, 0xFFFF0048,
0xFF9200FB, 0x00000000, 0x42200000, 0xFFFF0048,
0xFF9200FB, 0x00000000, 0x42200000, 0xFFFF0048,
0xFF922F68, 0xFF000000, 0x42200000, 0xFFFF0048,
0xFF92612F, 0x00000001, 0x0001003A, 0x01530000,
0x00000000, 0x42700001, 0xFFF7006A, 0xFFFDA1BC,
0x00000000, 0x42700000, 0xFFF7006A, 0xFFFDA5F3,
0x00000000, 0x42700000, 0xFFF7006A, 0xFFFDA5EB,
0x00000000, 0x42700000, 0xFFF7006A, 0xFFFDA5A2,
0x00000000, 0x42700000, 0xFFBD006C, 0xFFCBBAEE,
0x00000000, 0x42700000, 0xFFBD006C, 0xFFCBC9B8,
0x00000000, 0x42700000, 0xFFBD006C, 0xFFCB0020,
0x00000000, 0x42700000, 0xFFBD006C, 0xFFCBA5A4,
0x00000000, 0x42700000, 0xFFBD006C, 0xFFCB0020,
0x00000000, 0x42700000, 0xFFAD0066, 0xFFD6A5E1,
0x00000000, 0x42700000, 0xFF8C0051, 0xFFEDA5D0,
0x00000000, 0x42700000, 0xFF8A0051, 0x00360020,
0x00000000, 0x42700000, 0xFF96004E, 0x0074A5A6,
0x00000000, 0x42700000, 0xFFE5004B, 0x00E2A5E5,
0x00000000, 0x42700000, 0x00790052, 0x0138C0AE,
0x00000000, 0x42700000, 0x0128004C, 0x0176A5E5,
0x00000000, 0x42700000, 0x02350050, 0x01010020,
0x00000000, 0x42700000, 0x02660050, 0xFFFFA5EB,
0x00000000, 0x42700000, 0x02520050, 0xFF6FA5E1,
0x00000000, 0x42700000, 0x01DB0050, 0xFE840020,
0x00000000, 0x42700000, 0x01430050, 0xFDFFA5E1,
0x00000000, 0x42700000, 0x00C00050, 0xFDC2A5D0,
0x00000000, 0x42700000, 0xFFD30050, 0xFDA40020,
0x00000000, 0x42700000, 0xFF720050, 0xFDB3A5A6,
0x00000000, 0x42700000, 0xFF1C0050, 0xFDCEA5E5,
0x00000000, 0x42700000, 0xFE88005D, 0xFE23C0AE,
0x00000000, 0x42700000, 0xFDB8005F, 0xFF49A5E5,
0x00000000, 0x42700000, 0xFD9B005F, 0xFFDE0020,
0xFF000000, 0x42700000, 0xFDAD005F, 0x00A1A5EB,
0x00000002, 0x00010000, 0x009B0000, 0x00000005,
0x4221999A, 0xFFFF006F, 0x0005A1BC, 0x00000005,
0x42200000, 0xFFFF006F, 0x0005A5F3, 0x00000005,
0x42200000, 0xFFFF006F, 0x0005A5EB, 0x0000000F,
0x42200000, 0xFFFF006F, 0x0005A5A2, 0x0000000F,
0x42200000, 0xFFFF006F, 0x0005BAEE, 0x0000000F,
0x42200000, 0xFFFF0068, 0x0008C9B8, 0x00000005,
0x42200000, 0xFFFF0068, 0x00080020, 0x0000001E,
0x42200000, 0xFFFF0068, 0x0008A5A4, 0x0000001E,
0x42200000, 0xFFFF0068, 0x00080020, 0xFF00001E,
0x42200000, 0xFFFF0068, 0x0008A5E1, 0x00000002,
0x0001003A, 0x01700000, 0x00000005, 0x42700001,
0x00000078, 0x000CA1BC, 0x00000005, 0x42700000,
0x00000078, 0x000CA5F3, 0x00000005, 0x42700000,
0x00000078, 0x000CA5EB, 0x0000000A, 0x42700000,
0x00000078, 0x000CA5A2, 0x00000005, 0x42700000,
0xFFFF005F, 0x000BBAEE, 0x00000005, 0x42700000,
0xFFFF005F, 0x000BC9B8, 0x00000005, 0x42700000,
0xFFFF005F, 0x000B0020, 0x00000005, 0x42700000,
0xFFFF005F, 0x000BA5A4, 0x00000005, 0x42700000,
0xFFFF005F, 0x000B0020, 0x0000000A, 0x42700000,
0xFFFD005F, 0x0008A5E1, 0x0000000A, 0x42700000,
0xFFFD005F, 0x0008A5D0, 0x0000000A, 0x42700000,
0xFFFD005F, 0x00080020, 0x0000000A, 0x42700000,
0xFFFD005F, 0x0008A5A6, 0x0000000A, 0x42700000,
0xFFFD005F, 0x0008A5E5, 0x0000000A, 0x42700000,
0xFFFD005F, 0x0008C0AE, 0x0000000A, 0x42700000,
0xFFFD005F, 0x0008A5E5, 0x0000000A, 0x42700000,
0xFFFD005F, 0x00080020, 0x0000000A, 0x42700000,
0xFFFD005F, 0x0008A5EB, 0x0000000A, 0x42700000,
0xFFFD005F, 0x0008A5E1, 0x0000000A, 0x42700000,
0xFFFD005F, 0x00080020, 0x0000000F, 0x42700000,
0xFFFD005F, 0x0008A5E1, 0x0000000F, 0x42700000,
0xFFFD005F, 0x0008A5D0, 0x0000000F, 0x42700000,
0xFFFD005F, 0x00080020, 0x0000000F, 0x42700000,
0xFFFD005F, 0x0008A5A6, 0x0000000F, 0x42700000,
0xFFFD005F, 0x0008A5E5, 0x0000000F, 0x42700000,
0xFFFD005F, 0x0008C0AE, 0x0000000F, 0x42700000,
0xFFFD005F, 0x0008A5E5, 0x0000000F, 0x42700000,
0xFFFD005F, 0x00080020, 0xFF00001E, 0x42700000,
0xFFFD005F, 0x0008A5EB, 0x0000000A, 0x00000001,
0x000C0000, 0x00B40000, 0x00000000, 0x00000000,
0x0000001C, 0xFFFFFFF6, 0x00000000, 0xFFFFFFF2,
0x00000009, 0x00000000, 0xBE6EEEEF, 0x00000000,
0x00000004, 0x00000001, 0x0002005A, 0x005B0000,
0x00000000, 0x00000000, 0xFFFFFFF2, 0x00000024,
0x00000000, 0xFFFFFFF2, 0x00000024, 0x00000000,
0x00000000, 0x00000000, 0x00000003, 0x00000001,
0x000A005A, 0x005B0000, 0x00000000, 0x00000000,
0xFFFFFFF8, 0xFFFFFFDD, 0x00000000, 0xFFFFFFF8,
0xFFFFFFDD, 0x00000000, 0x00000000, 0x00000000,
0x0000002D, 0x00000001, 0x000100BE, 0x00D200D2,
0x000003E8, 0x00000001, 0x000800D2, 0x00D300D3,
0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000,
};
static u32 D_808BBD90[] =
{
0x0000000B, 0x00000BB8, 0x00000021, 0x00000001,
0x00010000, 0x0BB80000, 0x00000000, 0x00000000,
0xFFFFFFF8, 0xFFFFFFFF, 0x00000000, 0xFFFFFFF8,
0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000,
0x0000000A, 0x00000003, 0x00050000, 0x00010000,
0x80000000, 0x00000000, 0x00000000, 0x00000334,
0x00000000, 0x00000000, 0x00000334, 0x00000000,
0x00000000, 0x00000001, 0x00020001, 0x00100000,
0x80000000, 0x00000000, 0x00000000, 0x00000334,
0x00000000, 0x00000000, 0x000002D0, 0x00000000,
0x00000000, 0x00000001, 0x00050010, 0x00B00000,
0x80000000, 0x00000000, 0x00000000, 0x000002D0,
0x00000000, 0x00000000, 0x000002D0, 0x00000000,
0x00000000, 0x00000001, 0x0000003E, 0x00000003,
0x00040028, 0x00467D74, 0x00000000, 0xFFFFFFFF,
0x00000031, 0x000002CF, 0x00000001, 0x0000002F,
0x000002AF, 0x3D888889, 0xBD888889, 0xBD888889,
0x00040046, 0x00DC8010, 0x00000000, 0x00000001,
0x0000002F, 0x000002AF, 0x00000000, 0x00000086,
0x00000015, 0xBBDA740E, 0x3F147AE1, 0x3BDA740E,
0x000200DC, 0x01108000, 0x00000000, 0x00000000,
0x00000086, 0x00000015, 0x00000000, 0x00000065,
0x00000002, 0x00000000, 0xBF227627, 0x00000000,
0x00000003, 0x00000001, 0x000C0154, 0x01550000,
0x00000000, 0xFFFFFFFF, 0x00000000, 0xFFFFFFFD,
0xFFFFFFFF, 0x00000000, 0xFFFFFFFD, 0x00000000,
0x00000000, 0x00000000, 0x00000013, 0x00000006,
0xFFFF0000, 0x0032FFFF, 0xFFFFFFFF, 0x70E60032,
0x003C0000, 0x00000000, 0xFFFF003C, 0x00FAFFFF,
0xFFFFFFFF, 0x70E700FA, 0x01040000, 0x00000000,
0xFFFF0104, 0x0122FFFF, 0xFFFFFFFF, 0x70E80122,
0x01400000, 0x00000000, 0x00000001, 0x00010000,
0x00FB0000, 0x00000000, 0x42700000, 0xFFC5000C,
0x02B20222, 0x00000000, 0x42700000, 0xFFC5000C,
0x02B200FA, 0x00000000, 0x42700000, 0xFFC5000C,
0x02B20000, 0x00000000, 0x42700000, 0xFFC5000C,
0x02B20000, 0x00000000, 0x42700000, 0xFFC5000C,
0x02B20000, 0x00000000, 0x42700000, 0xFFE10018,
0x02BD0000, 0x00000000, 0x42700000, 0xFFE10018,
0x02BD0000, 0x00000000, 0x42700000, 0xFFE10018,
0x02BD0000, 0x00000000, 0x42700000, 0xFFE10018,
0x02BD2D70, 0x00000000, 0x42700000, 0xFFE10018,
0x02BD0085, 0x00000000, 0x42700000, 0xFFE10018,
0x02BD01E6, 0xFF000000, 0x42700000, 0xFFE10018,
0x02BD0000, 0x00000001, 0x0001005A, 0x014B0000,
0x00000000, 0x42700000, 0xFF66005C, 0x00EC0222,
0x00000000, 0x42700000, 0xFF66005C, 0x00EC00FA,
0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000,
0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000,
0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000,
0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000,
0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000,
0x00000000, 0x42700000, 0xFF66005C, 0x00EC0000,
0xFF000000, 0x42700000, 0xFF66005C, 0x00EC2D70,
0x00000001, 0x000100DC, 0x01EB0000, 0x00000000,
0x42700001, 0xFFFE007A, 0x00270222, 0x00000000,
0x42700001, 0xFFFE007A, 0x002700FA, 0x00000000,
0x42700001, 0xFFFE0066, 0x00270000, 0x00000000,
0x42700001, 0xFFFE005A, 0x00270000, 0x00000000,
0x42700001, 0xFFFE0051, 0x003E0000, 0x00000000,
0x42700001, 0xFFFE0051, 0x003E0000, 0x00000000,
0x42700001, 0xFFFE0051, 0x003E0000, 0x00000000,
0x42700001, 0xFFFE0051, 0x003E0000, 0x00000000,
0x42700001, 0xFFFE0051, 0x003E2D70, 0xFF000000,
0x42700001, 0xFFFE0051, 0x003E0085, 0x00000002,
0x00010000, 0x01180000, 0x0000001E, 0x42700000,
0x002B0034, 0x02CC0222, 0x0000001E, 0x42700000,
0x002B0034, 0x02CC00FA, 0x0000000A, 0x42700000,
0x002B0034, 0x02CC0000, 0x0000000A, 0x42700000,
0x002B0034, 0x02CC0000, 0x0000000A, 0x42700000,
0x002B0034, 0x02CC0000, 0x0000000A, 0x42700000,
0x003F0056, 0x02D20000, 0x0000001E, 0x42700000,
0x003F0056, 0x02D20000, 0x0000001E, 0x42700000,
0x003F0056, 0x02D20000, 0x0000001E, 0x42700000,
0x003F0056, 0x02D22D70, 0x0000001E, 0x42700000,
0x003F0055, 0x02D10085, 0x0000001E, 0x42700000,
0x003F0055, 0x02D101E6, 0xFF00001E, 0x42700000,
0x003E0055, 0x02D10000, 0x00000002, 0x0001005A,
0x01680000, 0x0000001E, 0x42700000, 0xFF970053,
0x016E0222, 0x0000001E, 0x42700000, 0xFF980053,
0x016C00FA, 0x0000001E, 0x42700000, 0xFFC10053,
0x01530000, 0x0000001E, 0x42700000, 0xFFF00063,
0x00FF0000, 0x0000001E, 0x42700000, 0xFFE2006F,
0x00B10000, 0x0000001E, 0x42700000, 0xFFB00070,
0x00790000, 0x0000001E, 0x42700000, 0xFFB00070,
0x00790000, 0x0000001E, 0x42700000, 0xFFB00070,
0x00790000, 0xFF00001E, 0x42700000, 0xFFB00070,
0x00792D70, 0x00000002, 0x000100DC, 0x02080000,
0x0000001E, 0x42700001, 0x00000089, 0xFFC90222,
0x0000001E, 0x42700001, 0x00000089, 0xFFC900FA,
0x0000001E, 0x42700001, 0x00000075, 0xFFC90000,
0x0000001E, 0x42700001, 0x00000069, 0xFFC90000,
0x0000001E, 0x42700001, 0x00000062, 0xFFE10000,
0x0000001E, 0x42700001, 0x00000062, 0xFFE10000,
0x0000001E, 0x42700001, 0x00000062, 0xFFE10000,
0x0000001E, 0x42700001, 0x00000062, 0xFFE10000,
0x0000001E, 0x42700001, 0x00000062, 0xFFE12D70,
0xFF00001E, 0x42700001, 0x00000062, 0xFFE10085,
0xFFFFFFFF, 0x00000000, 0x00000000, 0x00000000,
};
/*
const ActorInit Bg_Toki_Swd_InitVars =
{
ACTOR_BG_TOKI_SWD,
@ -22,19 +314,178 @@ const ActorInit Bg_Toki_Swd_InitVars =
(ActorFunc)BgTokiSwd_Update,
(ActorFunc)BgTokiSwd_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BAE40.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Init.s")
static ColliderCylinderInit colliderInit =
{
0x0A, 0x00, 0x00, 0x39,
0x12, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0xFFCFFFFF,
0x00, 0x00, 0x00, 0x00,
0xFFCFFFFF,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x00,
0x000A,
0x0046,
0x0000000000000000,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Destroy.s")
static SubActor98Init subActor98Init =
{
0x0A,
0x0023,
0x0064,
0xFF,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BAF40.s")
static InitChainEntry initChain[] =
{
ICHAIN_VEC3F_DIV1000(scale, 0x19, ICHAIN_STOP),
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BB0AC.s")
static void BgTokiSwd_SetupAction(BgTokiSwd* this, ActorFunc actionFunc)
{
this->actionFunc = actionFunc;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/func_808BB128.s")
static void BgTokiSwd_Init(BgTokiSwd* this, GlobalContext* globalCtx)
{
ColliderCylinderMain* collision;
Actor* thisx = &this->actor;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Update.s")
Actor_ProcessInitChain(thisx, initChain);
this->actor.shape.unk_08 = 800.0f;
BgTokiSwd_SetupAction(thisx, func_808BAF40);
collision = &this->collider;
if (LINK_IS_ADULT)
{
thisx->draw = NULL;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Toki_Swd/BgTokiSwd_Draw.s")
if (gSaveContext.scene_setup_index == 5)
{
globalCtx->unk_11D30[0] = 0xFF;
}
ActorCollider_AllocCylinder(globalCtx, collision);
ActorCollider_InitCylinder(globalCtx, collision, thisx, &colliderInit);
ActorCollider_Cylinder_Update(thisx, collision);
func_80061ED4(&thisx->sub_98, 0, &subActor98Init);
}
static void BgTokiSwd_Destroy(BgTokiSwd* this, GlobalContext* globalCtx)
{
ColliderCylinderMain* collider = &this->collider;
ActorCollider_FreeCylinder(globalCtx, collider);
}
static void func_808BAF40(BgTokiSwd* this, GlobalContext* globalCtx)
{
if (((gSaveContext.event_chk_inf[4] & 0x8000) == 0) && (gSaveContext.scene_setup_index < 4) &&
(func_8002E12C(&this->actor, 800.0f, 0x7530) != 0) && (func_800BFC84(globalCtx) == 0))
{
gSaveContext.event_chk_inf[4] |= 0x8000;
globalCtx->csCtx.segment = D_808BBD90;
gSaveContext.cutscene_trigger = 1;
}
if (LINK_IS_CHILD || ((gSaveContext.event_chk_inf[5] & 0x20) != 0))
{
if (func_8002F410(&this->actor, globalCtx) != 0)
{
if (LINK_IS_CHILD)
{
Item_Give(globalCtx, ITEM_SWORD_MASTER);
globalCtx->csCtx.segment = D_808BB2F0;
}
else
{
globalCtx->csCtx.segment = D_808BB7A0;
}
Audio_SetBGM(NA_BGM_STOP);
Audio_SetBGM(NA_SE_PL_BOUND_DIRT);
gSaveContext.cutscene_trigger = 1;
this->actor.attachedA = 0;
BgTokiSwd_SetupAction(this, func_808BB0AC);
}
else
{
if (func_8002E084(&this->actor, 0x2000) != 0)
{
func_8002F580(&this->actor, globalCtx);
}
}
}
if (gSaveContext.scene_setup_index == 5)
{
if (globalCtx->unk_11D30[0] > 0)
{
globalCtx->unk_11D30[0]--;
}
else
{
globalCtx->unk_11D30[0] = 0;
}
}
}
static void func_808BB0AC(BgTokiSwd* this, GlobalContext* globalCtx)
{
Player* player;
//if attached is set, sword has been pulled/placed from the pedestal
if (func_8002F410(&this->actor, globalCtx) != 0)
{
if (LINK_IS_CHILD)
{
Audio_PlayActorSound2(&this->actor, NA_SE_IT_SWORD_PUTAWAY_STN);
this->actor.draw = NULL; //sword has been pulled, dont draw sword
}
else
{
this->actor.draw = BgTokiSwd_Draw; //sword has been placed, draw the master sword
}
BgTokiSwd_SetupAction(this, func_808BB128);
}
else
{
player = PLAYER;
player->interactRangeActor = &this->actor;
}
}
static void func_808BB128(BgTokiSwd* this, GlobalContext* globalCtx)
{
if ((func_8006C4A4(globalCtx, 1) != 0) && (globalCtx->unk_11D30[0] < 0xFF))
{
globalCtx->unk_11D30[0] += 5;
}
}
static void BgTokiSwd_Update(BgTokiSwd* this, GlobalContext* globalCtx)
{
this->actionFunc(&this->actor, globalCtx);
Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider);
}
static void BgTokiSwd_Draw(BgTokiSwd* this, GlobalContext* globalCtx)
{
s32 pad[4];
GameState* state;
GraphicsContext* gfxCtx;
Gfx* gfxArr[4];
state = &globalCtx->state;
gfxCtx = globalCtx->state.gfxCtx;
func_800C6AC4(gfxArr, state->gfxCtx, "../z_bg_toki_swd.c", 727);
func_80093D18(globalCtx->state.gfxCtx);
func_8002EBCC(&this->actor, globalCtx, 0);
gSPSegment(gfxCtx->polyOpa.p++, 0x08, Draw_TexScroll(globalCtx->state.gfxCtx, 0,
-(globalCtx->gameplayFrames % 0x80), 32, 32));
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_toki_swd.c", 742),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfxCtx->polyOpa.p++, &D_06001BD0);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_bg_toki_swd.c", 776);
}

View file

@ -7,7 +7,8 @@
typedef struct
{
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x50];
/* 0x014C */ ActorFunc actionFunc;
/* 0x0150 */ ColliderCylinderMain collider;
} BgTokiSwd; // size = 0x019C
extern const ActorInit Bg_Toki_Swd_InitVars;

View file

@ -1,14 +1,38 @@
/*
* File: z_demo_geff.c
* Overlay: Demo_Geff
* Description:
*/
#include "z_demo_geff.h"
#include <vt.h>
#define ROOM 0x00
#define FLAGS 0x00000030
void DemoGeff_Init(DemoGeff* this, GlobalContext* globalCtx);
void DemoGeff_Destroy(DemoGeff* this, GlobalContext* globalCtx);
void DemoGeff_Update(DemoGeff* this, GlobalContext* globalCtx);
void DemoGeff_Draw(DemoGeff* this, GlobalContext* globalCtx);
static void DemoGeff_Init(DemoGeff* this, GlobalContext* globalCtx);
static void DemoGeff_Destroy(DemoGeff* this, GlobalContext* globalCtx);
static void DemoGeff_Update(DemoGeff* this, GlobalContext* globalCtx);
static void DemoGeff_Draw(DemoGeff* this, GlobalContext* globalCtx);
static void func_80978030(DemoGeff* this, GlobalContext* globalCtx);
static void func_809783D4(DemoGeff* this, GlobalContext* globalCtx);
static void func_80978308(DemoGeff* this, GlobalContext* globalCtx);
static void func_809784D4(DemoGeff* this, GlobalContext* globalCtx);
static void func_80978344(DemoGeff* this, GlobalContext* globalCtx);
s16 objectIds[] = { OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF, OBJECT_GEFF,
OBJECT_GEFF, OBJECT_GEFF, };
ActorFunc scaleFuncs[] = { (ActorFunc)func_80978030, (ActorFunc)func_80978030, (ActorFunc)func_80978030,
(ActorFunc)func_80978030, (ActorFunc)func_80978030, (ActorFunc)func_80978030,
(ActorFunc)func_80978030, (ActorFunc)func_80978030, (ActorFunc)func_80978030, };
ActorFunc actionFuncs[] = { (ActorFunc)func_809783D4, (ActorFunc)func_80978308, };
ActorFunc drawFuncs[] = { (ActorFunc)func_809784D4, (ActorFunc)func_80978344, };
/*
const ActorInit Demo_Geff_InitVars =
{
ACTOR_DEMO_GEFF,
@ -22,33 +46,177 @@ const ActorInit Demo_Geff_InitVars =
(ActorFunc)DemoGeff_Update,
(ActorFunc)DemoGeff_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/DemoGeff_Destroy.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/DemoGeff_Init.s")
extern UNK_TYPE D_06000EA0;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80977EA8.s")
static void DemoGeff_Destroy(DemoGeff* this, GlobalContext* globalCtx) {
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80977F80.s")
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80978030.s")
static void DemoGeff_Init(DemoGeff* this, GlobalContext* globalCtx) {
if (this->actor.params < 0 || this->actor.params >= 9) {
osSyncPrintf(VT_FGCOL(RED) "Demo_Geff_Actor_ct:arg_dataがおかしい!!!!!!!!!!!!\n" VT_RST);
Actor_Kill(&this->actor);
return;
}
this->action = 0;
this->drawConfig = 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809780E0.s")
static void func_80977EA8(GlobalContext* globalCtx, u32 dlist) {
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809781FC.s")
func_800C6AC4(gfxArr, gfxCtx, "../z_demo_geff.c", 181);
func_80093D18(gfxCtx);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809782A0.s")
gSPMatrix(gfxCtx->polyOpa.p++, Matrix_NewMtx(gfxCtx, "../z_demo_geff.c", 183),
G_MTX_PUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPDisplayList(gfxCtx->polyOpa.p++, dlist);
gSPPopMatrix(gfxCtx->polyOpa.p++, G_MTX_MODELVIEW);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80978308.s")
func_800C6B54(gfxArr, gfxCtx, "../z_demo_geff.c", 188);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80978344.s")
static void func_80977F80(DemoGeff* this, GlobalContext* globalCtx) {
s32 pad[2];
s32 objBankIndex = this->objBankIndex;
GraphicsContext* gfxCtx = globalCtx->state.gfxCtx;
Gfx* gfxArr[5];
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_80978370.s")
func_800C6AC4(gfxArr, gfxCtx, "../z_demo_geff.c", 204);
gSPSegment(gfxCtx->polyOpa.p++, 0x06, globalCtx->objectCtx.status[objBankIndex].segment);
gSegments[6] = PHYSICAL_TO_VIRTUAL(globalCtx->objectCtx.status[objBankIndex].segment);
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809783D4.s")
// Necessary to match
if (!globalCtx) {}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/DemoGeff_Update.s")
func_800C6B54(gfxArr, gfxCtx, "../z_demo_geff.c", 212);
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/func_809784D4.s")
static void func_80978030(DemoGeff* this, GlobalContext* globalCtx) {
Vec3f* thisScale = &this->actor.scale;
this->action = 1;
this->drawConfig = 1;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Demo_Geff/DemoGeff_Draw.s")
switch (this->actor.params) {
case 0:
case 3:
case 6:
thisScale->x = (kREG(7) * 0.01f) + 0.3f;
thisScale->y = (kREG(8) * 0.01f) + 0.3f;
thisScale->z = (kREG(9) * 0.01f) + 0.3f;
break;
case 1:
case 4:
case 7:
thisScale->x = (kREG(10) * 0.01f) + 0.15f;
thisScale->y = (kREG(11) * 0.01f) + 0.29f;
thisScale->z = (kREG(12) * 0.01f) + 0.12f;
break;
default:
thisScale->x = (kREG(13) * 0.01f) + 0.1f;
thisScale->y = (kREG(14) * 0.01f) + 0.15f;
thisScale->z = (kREG(15) * 0.01f) + 0.2f;
break;
}
}
static void func_809781FC(DemoGeff* this, GlobalContext* globalCtx) {
s32 targetParams = 2;
Actor* propIt;
if (this->demoGt == NULL) {
propIt = globalCtx->actorCtx.actorList[ACTORTYPE_PROP].first;
if ((this->actor.params != 0) && (this->actor.params != 1) && (this->actor.params != 2)) {
targetParams = 2;
} else {
targetParams = 1;
}
while (propIt != NULL) {
if (propIt->id == ACTOR_DEMO_GT && propIt->params == targetParams) {
this->deltaPosX = this->actor.posRot.pos.x - propIt->posRot.pos.x;
this->deltaPosY = this->actor.posRot.pos.y - propIt->posRot.pos.y;
this->deltaPosZ = this->actor.posRot.pos.z - propIt->posRot.pos.z;
this->demoGt = propIt;
}
propIt = propIt->next;
}
}
}
static void func_809782A0(DemoGeff* this, GlobalContext* globalCtx) {
DemoGt* demoGt = this->demoGt;
s16 params = this->actor.params;
if (demoGt != NULL && (params != 6) && (params != 7) && (params != 8)) {
this->actor.posRot.pos.x = demoGt->actor.posRot.pos.x + this->deltaPosX;
this->actor.posRot.pos.y = demoGt->actor.posRot.pos.y + this->deltaPosY;
this->actor.posRot.pos.z = demoGt->actor.posRot.pos.z + this->deltaPosZ;
}
}
static void func_80978308(DemoGeff* this, GlobalContext* globalCtx) {
func_809781FC(this, globalCtx);
func_809782A0(this, globalCtx);
func_80978030(this, globalCtx);
}
static void func_80978344(DemoGeff* this, GlobalContext* globalCtx) {
func_80977EA8(globalCtx, &D_06000EA0);
}
static void func_80978370(DemoGeff* this, GlobalContext* globalCtx) {
s16 params = this->actor.params;
ActorFunc actorFunc = scaleFuncs[params];
if (actorFunc == NULL) {
osSyncPrintf(VT_FGCOL(RED) " Demo_Geff_main_init:初期化処理がおかしいarg_data = %d!\n" VT_RST, params);
Actor_Kill(&this->actor);
return;
}
actorFunc(this, globalCtx);
}
static void func_809783D4(DemoGeff* this, GlobalContext* globalCtx) {
ObjectContext* objCtx = &globalCtx->objectCtx;
Actor* thisx = &this->actor;
s32 params = thisx->params;
s16 objectId = objectIds[params];
s32 objBankIndex = Object_GetIndex(objCtx, objectId);
s32 pad;
if (objBankIndex < 0) {
osSyncPrintf(VT_FGCOL(RED) "Demo_Geff_main_bank:バンクを読めない arg_data = %d!\n" VT_RST, params);
Actor_Kill(thisx);
return;
}
if (Object_IsLoaded(objCtx, objBankIndex)) {
this->objBankIndex = objBankIndex;
func_80978370(this, globalCtx);
}
}
static void DemoGeff_Update(DemoGeff* this, GlobalContext* globalCtx) {
if (this->action < 0 || this->action >= 2 || actionFuncs[this->action] == NULL) {
osSyncPrintf(VT_FGCOL(RED) "メインモードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST);
return;
}
actionFuncs[this->action](this, globalCtx);
}
static void func_809784D4(DemoGeff* this, GlobalContext* globalCtx) {
}
static void DemoGeff_Draw(DemoGeff* this, GlobalContext* globalCtx) {
s32 drawConfig = this->drawConfig;
s16 pad;
if (drawConfig < 0 || drawConfig >= 2 || drawFuncs[drawConfig] == NULL) {
osSyncPrintf(VT_FGCOL(RED) "描画モードがおかしい!!!!!!!!!!!!!!!!!!!!!!!!!\n" VT_RST);
return;
}
if (drawConfig != 0) {
func_80977F80(this, globalCtx);
}
drawFuncs[drawConfig](this, globalCtx);
}

View file

@ -4,10 +4,18 @@
#include <ultra64.h>
#include <global.h>
#include "../ovl_Demo_Gt/z_demo_gt.h"
typedef struct
{
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x1C];
/* 0x014C */ s32 action;
/* 0x0150 */ s32 drawConfig;
/* 0x0154 */ s32 objBankIndex;
/* 0x0158 */ DemoGt* demoGt;
/* 0x015C */ f32 deltaPosX;
/* 0x0160 */ f32 deltaPosY;
/* 0x0164 */ f32 deltaPosZ;
} DemoGeff; // size = 0x0168
extern const ActorInit Demo_Geff_InitVars;

View file

@ -3,12 +3,18 @@
#define ROOM 0x00
#define FLAGS 0x00000000
void EnDog_Init(EnDog* this, GlobalContext* globalCtx);
void EnDog_Destroy(EnDog* this, GlobalContext* globalCtx);
void EnDog_Update(EnDog* this, GlobalContext* globalCtx);
void EnDog_Draw(EnDog* this, GlobalContext* globalCtx);
static void EnDog_Init(EnDog* this, GlobalContext* globalCtx);
static void EnDog_Destroy(EnDog* this, GlobalContext* globalCtx);
static void EnDog_Update(EnDog* this, GlobalContext* globalCtx);
static void EnDog_Draw(EnDog* this, GlobalContext* globalCtx);
static void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx);
static void EnDog_ChooseMovement(EnDog* this, GlobalContext* globalCtx);
static void EnDog_FollowLink(EnDog* this, GlobalContext* globalCtx);
static void EnDog_RunAway(EnDog* this, GlobalContext* globalCtx);
static void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx);
static void EnDog_Wait(EnDog* this, GlobalContext* globalCtx);
/*
const ActorInit En_Dog_InitVars =
{
ACTOR_EN_DOG,
@ -22,41 +28,576 @@ const ActorInit En_Dog_InitVars =
(ActorFunc)EnDog_Update,
(ActorFunc)EnDog_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FAFD0.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FB038.s")
static ColliderCylinderInit cylinderInit =
{
0x06, 0x00, 0x09, 0x39,
0x10, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00000000,
0x00, 0x00, 0x00, 0x00,
0xFFCFFFFF,
0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x01, 0x00,
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FB0A0.s")
0x0010,
0x0014,
0x0000,
0x0000, 0x0000, 0x0000,
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FB108.s")
// There are multiple versions of sub98 init structs
// Keeping these local until z_collision_check is decompiled
typedef struct
{
/* 0x00 */ u8 health;
/* 0x02 */ s16 unk_10;
/* 0x04 */ s16 unk_12;
/* 0x06 */ u16 unk_14;
/* 0x08 */ u8 mass;
}sub98Init;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FB29C.s")
static sub98Init sub98Data =
{
0x00, //health
0x0000, //unk_10
0x0000, //unk_12
0x0000, //unk_14
0x32, //mass
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FB320.s")
static struct_80034EC0_Entry animations[]=
{
{0x06001368, 1.0f, 0.0f, -1.0f, 0x00, 0.0f},
{0x06001368, 1.0f, 0.0f, -1.0f, 0x00, -6.0f},
{0x06000D78, 1.0f, 0.0f, -1.0f, 0x00, -6.0f},
{0x06000278, 1.0f, 0.0f, -1.0f, 0x00, -6.0f},
{0x06001150, 1.0f, 0.0f, 4.0f, 0x02, -6.0f},
{0x06001150, 1.0f, 5.0f, 25.0f,0x04, -6.0f},
{0x06000928, 1.0f, 0.0f, 6.0f, 0x02, -6.0f},
{0x06000C28, 1.0f, 0.0f, -1.0f, 0x00, -6.0f},
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FB3AC.s")
// Bandaid fix for a lw vs lh issue in EnDog_FollowPath. Roman will look at it later.
typedef union
{
/* 0x00 */ s32 entry;
struct
{
s16 unk_0;
s16 unk_2;
};
}s16ArrEntry;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/EnDog_Init.s")
typedef enum
{
/* 0x00 */ DOG_WALK,
/* 0x01 */ DOG_RUN,
/* 0x02 */ DOG_BARK,
/* 0x03 */ DOG_SIT,
/* 0x04 */ DOG_SIT_2,
/* 0x05 */ DOG_BOW,
/* 0x06 */ DOG_BOW_2,
} DogBehavior;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/EnDog_Destroy.s")
extern UNK_PTR D_06007290;
extern UNK_PTR D_06001368;
extern UNK_PTR D_06000D78;
extern UNK_PTR D_06000278;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FB6C4.s")
static void EnDog_PlayWalkSFX(EnDog* this)
{
u32* walk = &D_06001368;
if (this->skelAnime.animCurrent == walk)
{
if ((this->skelAnime.animCurrentFrame == 1.0f) || (this->skelAnime.animCurrentFrame == 7.0f))
{
Audio_PlayActorSound2(&this->actor, NA_SE_EV_CHIBI_WALK);
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FB858.s")
static void EnDog_PlayRunSFX(EnDog* this)
{
u32* run = &D_06000D78;
if (this->skelAnime.animCurrent == run)
{
if ((this->skelAnime.animCurrentFrame == 2.0f) || (this->skelAnime.animCurrentFrame == 4.0f))
{
Audio_PlayActorSound2(&this->actor, NA_SE_EV_CHIBI_WALK);
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FB940.s")
static void EnDog_PlayBarkSFX(EnDog* this)
{
u32* bark = &D_06000278;
if (this->skelAnime.animCurrent == bark)
{
if ((this->skelAnime.animCurrentFrame == 13.0f) || (this->skelAnime.animCurrentFrame == 19.0f))
{
Audio_PlayActorSound2(&this->actor, NA_SE_EV_SMALL_DOG_BARK);
}
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FBABC.s")
static s32 EnDog_PlayAnimAndSFX(EnDog* this)
{
s32 animation;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FBB64.s")
if (this->behavior != this->nextBehavior)
{
if (this->nextBehavior == DOG_SIT_2)
{
this->nextBehavior = DOG_SIT;
}
if (this->nextBehavior == DOG_BOW_2)
{
this->nextBehavior = DOG_BOW;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FBC6C.s")
this->behavior = this->nextBehavior;
switch(this->behavior)
{
case DOG_WALK:
animation = 1;
break;
case DOG_RUN:
animation = 2;
break;
case DOG_BARK:
animation = 3;
break;
case DOG_SIT:
animation = 4;
break;
case DOG_BOW:
animation = 6;
break;
}
func_80034EC0(&this->skelAnime, &animations, animation);
}
switch(this->behavior)
{
case DOG_SIT:
if (func_800A56C8(&this->skelAnime, this->skelAnime.animFrameCount) != 0)
{
func_80034EC0(&this->skelAnime, &animations, 5);
this->behavior = this->nextBehavior = DOG_SIT_2;
}
break;
case DOG_BOW:
if (func_800A56C8(&this->skelAnime, this->skelAnime.animFrameCount) != 0)
{
func_80034EC0(&this->skelAnime, &animations, 7);
this->behavior = this->nextBehavior = DOG_BOW_2;
}
break;
case DOG_WALK:
EnDog_PlayWalkSFX(this);
break;
case DOG_RUN:
EnDog_PlayRunSFX(this);
break;
case DOG_BARK:
EnDog_PlayBarkSFX(this);
if (this){} // needed for regalloc
break;
}
return 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/EnDog_Update.s")
static s8 EnDog_CanFollow(EnDog* this, GlobalContext* globalCtx)
{
if ((this->collider.base.collideFlags & 2))
{
this->collider.base.collideFlags &= ~2;
return 2;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FBD8C.s")
if (globalCtx->sceneNum == SCENE_MARKET_DAY)
{
return 0;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/func_809FBDA4.s")
if ((this->collider.base.maskB & 1))
{
this->collider.base.maskB &= ~1;
if (gSaveContext.dogParams != 0)
{
return 0;
}
gSaveContext.dogParams = (this->actor.params & 0x7FFF);
return 1;
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_En_Dog/EnDog_Draw.s")
return 0;
}
static EnDog_UpdateWaypoint(EnDog* this, GlobalContext* globalCtx)
{
s32 change;
if (this->path == NULL)
{
return 0;
}
if (this->reverse)
{
change = -1;
}
else
{
change = 1;
}
this->waypoint += change;
if (this->reverse)
{
if (this->waypoint < 0)
{
this->waypoint = this->path->count - 1;
}
}
else
{
if ((this->path->count - 1) < this->waypoint)
{
this->waypoint = 0;
}
}
return 1;
}
static s32 EnDog_Orient(EnDog* this, GlobalContext* globalCtx)
{
s16 targetYaw;
f32 waypointDistSq;
waypointDistSq = func_8008E520(&this->actor, this->path, this->waypoint, &targetYaw);
Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, targetYaw, 10, 1000, 1);
if ((waypointDistSq > 0.0f) && (waypointDistSq < 1000.0f))
{
return EnDog_UpdateWaypoint(this, globalCtx);
}
else
{
return 0;
}
}
static void EnDog_Init(EnDog* this, GlobalContext* globalCtx)
{
SkelAnime* skelAnime;
s16 followingDog;
ColliderCylinderMain* collider;
collider = &this->collider;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 24.0f);
skelAnime = &this->skelAnime;
func_800A46F8(globalCtx, skelAnime, &D_06007290, 0, &this->unk_1F4, &this->unk_242, 13);
func_80034EC0(skelAnime, animations, 0);
if ((this->actor.params & 0x8000) == 0)
{
this->actor.params = (this->actor.params & 0xF0FF) | ((((this->actor.params & 0x0F00) >> 8) + 1) << 8);
}
followingDog = ((gSaveContext.dogParams & 0x0F00) >> 8);
if (followingDog == ((this->actor.params & 0x0F00) >> 8) && ((this->actor.params & 0x8000) == 0))
{
Actor_Kill(&this->actor);
return;
}
ActorCollider_AllocCylinder(globalCtx, collider);
ActorCollider_InitCylinder(globalCtx, collider, &this->actor, &cylinderInit);
func_80061EFC(&this->actor.sub_98, 0, &sub98Data);
Actor_SetScale(&this->actor, 0.0075f);
this->waypoint = 0;
this->actor.gravity = -1.0f;
this->path = func_8008E4E0(globalCtx, (s16)((this->actor.params & 0x00F0) >> 4), 0xF);
switch (globalCtx->sceneNum)
{
case SCENE_MARKET_NIGHT:
if ((!gSaveContext.dogIsLost) && (((this->actor.params & 0x0F00) >> 8) == 1))
{
Actor_Kill(&this->actor);
}
break;
case SCENE_IMPA: // Richard's Home
if ((u32)(this->actor.params & 0x8000) == 0)
{
if (!gSaveContext.dogIsLost)
{
this->nextBehavior = DOG_SIT;
this->actionFunc = EnDog_Wait;
this->actor.speedXZ = 0.0f;
return;
}
else
{
Actor_Kill(&this->actor);
return;
}
}
break;
}
if ((u32)(this->actor.params & 0x8000) != 0)
{
this->nextBehavior = DOG_WALK;
this->actionFunc = EnDog_FollowLink;
}
else
{
this->nextBehavior = DOG_SIT;
this->actionFunc = EnDog_ChooseMovement;
}
}
static void EnDog_Destroy(EnDog* this, GlobalContext* globalCtx)
{
ColliderCylinderMain* collider = &this->collider;
ActorCollider_FreeCylinder(globalCtx, collider);
}
static void EnDog_FollowPath(EnDog* this, GlobalContext* globalCtx)
{
s16ArrEntry behaviors[] = { DOG_SIT, DOG_BOW, DOG_BARK };
s16ArrEntry unused[] = { 40, 80, 20 };
f32 speed;
s32 frame;
if (EnDog_CanFollow(this, globalCtx) == 1)
{
this->actionFunc = EnDog_FollowLink;
}
if (DECR(this->behaviorTimer) != 0)
{
if (this->nextBehavior == DOG_WALK)
{
speed = 1.0f;
}
else
{
speed = 4.0f;
}
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, speed, 0.4f, 1.0f, 0.0f);
EnDog_Orient(this, globalCtx);
this->actor.shape.rot = this->actor.posRot.rot;
// Used to change between two text boxes for Richard's owner in the Market Day scene
// depending on where he is on his path. En_Hy checks these event flags.
if (this->waypoint < 9)
{
// Richard is close to her, text says something about his coat
gSaveContext.event_inf[3] |= 1;
}
else
{
// Richard is far, text says something about running fast
gSaveContext.event_inf[3] &= ~1;
}
}
else
{
frame = globalCtx->state.frames % 3;
this->nextBehavior = behaviors[frame].entry;
// no clue why they're using the action id to calculate timer. possibly meant to use the unused array?
this->behaviorTimer = Math_Rand_S16Offset(60, behaviors[frame].unk_2);
this->actionFunc = EnDog_ChooseMovement;
}
}
static void EnDog_ChooseMovement(EnDog* this, GlobalContext* globalCtx)
{
if (EnDog_CanFollow(this, globalCtx) == 1)
{
this->actionFunc = EnDog_FollowLink;
}
if (DECR(this->behaviorTimer) == 0)
{
this->behaviorTimer = Math_Rand_S16Offset(200, 100);
if (globalCtx->state.frames % 2)
{
this->nextBehavior = DOG_WALK;
}
else
{
this->nextBehavior = DOG_RUN;
}
if (this->nextBehavior == DOG_RUN)
{
this->behaviorTimer /= 2;
}
this->actionFunc = EnDog_FollowPath;
}
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 0.4f, 1.0f, 0.0f);
}
static void EnDog_FollowLink(EnDog* this, GlobalContext* globalCtx)
{
f32 speed;
if (gSaveContext.dogParams == 0)
{
this->nextBehavior = DOG_SIT;
this->actionFunc = EnDog_Wait;
this->actor.speedXZ = 0.0f;
return;
}
if (this->actor.xzDistanceFromLink > 400.0f)
{
if (this->nextBehavior != DOG_SIT && this->nextBehavior != DOG_SIT_2)
{
this->nextBehavior = DOG_BOW;
}
gSaveContext.dogParams = 0;
speed = 0.0f;
}
else if (this->actor.xzDistanceFromLink > 100.0f)
{
this->nextBehavior = DOG_RUN;
speed = 4.0f;
}
else if (this->actor.xzDistanceFromLink < 40.0f)
{
if (this->nextBehavior != DOG_BOW && this->nextBehavior != DOG_BOW_2)
{
this->nextBehavior = DOG_BOW;
}
speed = 0.0f;
}
else
{
this->nextBehavior = DOG_WALK;
speed = 1.0f;
}
Math_SmoothScaleMaxF(&this->actor.speedXZ, speed, 0.6f, 1.0f);
if (!(this->actor.xzDistanceFromLink > 400.0f))
{
Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, this->actor.rotTowardsLinkY, 10, 1000, 1);
this->actor.shape.rot = this->actor.posRot.rot;
}
}
static void EnDog_RunAway(EnDog* this, GlobalContext* globalCtx)
{
if (this->actor.xzDistanceFromLink < 200.0f)
{
Math_SmoothScaleMaxF(&this->actor.speedXZ, 4.0f, 0.6f, 1.0f);
Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, (this->actor.rotTowardsLinkY ^ 0x8000), 10, 1000, 1);
}
else
{
this->actionFunc = EnDog_FaceLink;
}
this->actor.shape.rot = this->actor.posRot.rot;
}
static void EnDog_FaceLink(EnDog* this, GlobalContext* globalCtx)
{
s16 rotTowardLink;
s16 prevRotY;
f32 absAngleDiff;
// if the dog is more than 200 units away from Link, turn to face him then wait
if (200.0f <= this->actor.xzDistanceFromLink)
{
this->nextBehavior = DOG_WALK;
Math_SmoothScaleMaxF(&this->actor.speedXZ, 1.0f, 0.6f, 1.0f);
rotTowardLink = this->actor.rotTowardsLinkY;
prevRotY = this->actor.posRot.rot.y;
Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, rotTowardLink, 10, 1000, 1);
absAngleDiff = this->actor.posRot.rot.y;
absAngleDiff -= prevRotY;
absAngleDiff = fabsf(absAngleDiff);
if (absAngleDiff < 200.0f)
{
this->nextBehavior = DOG_SIT;
this->actionFunc = EnDog_Wait;
this->actor.speedXZ = 0.0f;
}
}
else
{
this->nextBehavior = DOG_RUN;
this->actionFunc = EnDog_RunAway;
}
this->actor.shape.rot = this->actor.posRot.rot;
}
static void EnDog_Wait(EnDog* this, GlobalContext* globalCtx)
{
this->unusedAngle = (this->actor.rotTowardsLinkY - this->actor.shape.rot.y);
// If another dog is following Link and he gets within 200 units of waiting dog, run away
if ((gSaveContext.dogParams != 0) && (this->actor.xzDistanceFromLink < 200.0f))
{
this->nextBehavior = DOG_RUN;
this->actionFunc = EnDog_RunAway;
}
}
static void EnDog_Update(EnDog* this, GlobalContext* globalCtx)
{
s32 pad1;
s32 pad2;
EnDog_PlayAnimAndSFX(this);
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
func_8002E4B4(globalCtx, &this->actor, this->collider.dim.radius,
this->collider.dim.height * 0.5f, 0.0f, 5);
Actor_MoveForward(&this->actor);
this->actionFunc(this, globalCtx);
ActorCollider_Cylinder_Update(&this->actor, &this->collider);
Actor_CollisionCheck_SetOT(globalCtx, &globalCtx->sub_11E60, &this->collider);
}
static UNK_TYPE EnDog_Callback1(UNK_TYPE unused1, UNK_TYPE unused2, UNK_TYPE unused3, UNK_TYPE unused4)
{
return 0;
}
static void EnDog_Callback2(UNK_TYPE unused1, UNK_TYPE unused2, UNK_TYPE unused3, UNK_TYPE unused4)
{
}
static void EnDog_Draw(EnDog* this, GlobalContext* globalCtx)
{
s32 pad;
Color_RGBA8 colors[] = { {0xFF, 0xFF, 0xC8, 0x00}, {0x96, 0x64, 0x32, 0x00} };
GraphicsContext* gfxCtx;
s32 pad2[2];
Gfx* gfxArr[2];
gfxCtx = globalCtx->state.gfxCtx;
func_800C6AC4(gfxArr, globalCtx->state.gfxCtx, "../z_en_dog.c", 972);
func_80093D18(globalCtx->state.gfxCtx);
gDPPipeSync(gfxCtx->polyOpa.p++);
gDPSetEnvColor(gfxCtx->polyOpa.p++,
colors[this->actor.params & 0xF].r, colors[this->actor.params & 0xF].g,
colors[this->actor.params & 0xF].b, colors[this->actor.params & 0xF].a);
func_800A1AC8(globalCtx, this->skelAnime.limbIndex, this->skelAnime.actorDrawTbl,
this->skelAnime.dListCount, EnDog_Callback1, EnDog_Callback2, &this->actor);
func_800C6B54(gfxArr, globalCtx->state.gfxCtx, "../z_en_dog.c", 994);
}

View file

@ -7,7 +7,22 @@
typedef struct
{
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x144];
/* 0x014C */ SkelAnime skelAnime;
/* 0x0190 */ ActorFunc actionFunc;
/* 0x0194 */ ColliderCylinderMain collider;
/* 0x01E0 */ Path* path;
/* 0x01E4 */ u8 reverse;
/* 0x01E6 */ s16 waypoint;
/* 0x01E8 */ s16 unusedAngle;
/* 0x01EA */ s16 pad1;
/* 0x01EC */ s16 behaviorTimer;
/* 0x01EE */ s16 pad2;
/* 0x01F0 */ s16 nextBehavior;
/* 0x01F2 */ s16 behavior;
/* 0x01F4 */ u8 unk_1F4; // I believe this and the rest below belong to something skelanime
/* 0x01F5 */ char unk_1F5[0x4D];
/* 0x0242 */ u8 unk_242;
/* 0x0243 */ char unk_243[0x4D];
} EnDog; // size = 0x0290
extern const ActorInit En_Dog_InitVars;