en_invadepoh OK (#200)

* Applied changes to master on new branch

* some docs

* minor change

* Slight improvement to last draw func

* Got rid of all warnings

* Removed extra text file

* Readded warnings text file

* Fixed warnings text file

* Some cleanup, added engineer's new matched functions!

* Marked non-equivalent functions as such

* Improved last draw func (still non-equivalent)

* Made most of anghelo's suggested changes

* Slightly better code for func_80B4A350, though it's not matching still

* Engineer matched 2 funcs so I'm pushing those

* Added a function from engineer and one of my own

* Fixed warning

* Slightly better code for func_80B44C80

* Slightly better code for func_80B44C80

* Matched func_80B44C80

* Pushing engineer's matched draw func. All rodata funcs matched!

* Build NOT OK - rodata. Pushing anyway because I did a lot of work and it's close

* Build NOT OK (see previous commit) - func_80B440B8 matched

* Build NOT OK (see previous commit) - func_80B43BC8 matched

* All funcs matched! Build not OK still though

* almost ok

* OK now

* Fixed some warnings

* Fixed more warnings

* More warnings work

* Fixed all warnings (I think)

* Fixed all warnings (I think)

* Moderate amount of cleanup

* More cleanup

* More cleanup and some slight documentation

* Decent amount of documentation

* More documentation

* Fixed build (forgot to replace one struct member)

* More documentation and cleanup

* Fixed merge conflict, added binang_sub macro usages, and otherwise added most of the suggested changes f

git commit

* Organized things a bit, added a few more CLOCKTIME macros

* Added extra output to timeconvert.py

* Formatting

* Made all suggested changes

* 'Downgraded' timeconv script to version without seconds

* Added a macro for part of the params usages plus an enum

* Actually fixed header file (didn't save before)

* Renamed milk get item in enum

* Fixed GI enum update

Co-authored-by: Zelllll <56516451+Zelllll@users.noreply.github.com>
Co-authored-by: Zelllll <elilee968@gmail.com>
Co-authored-by: angie <angheloalf95@gmail.com>
This commit is contained in:
kyleburnette 2021-07-16 21:04:37 -07:00 committed by GitHub
parent 66d0656128
commit e1219e7351
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 4828 additions and 475 deletions

View File

@ -1769,7 +1769,7 @@ void func_800F6FF8(GlobalContext* globalCtx, EnvironmentContext* envCtx, LightCo
// void func_800F8CD4(GlobalContext* globalCtx, EnvironmentContext* envCtx, LightContext* lightCtx, s32 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
// void func_800F8D84(void);
// void func_800F9728(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
// void func_800F9824(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE2 param_10, UNK_TYPE1 param_11);
void func_800F9824(GlobalContext* globalCtx, EnvironmentContext* envCtx, View* view, GraphicsContext* gfxCtx, Vec3f vec, f32 arg5, f32 arg6, s8 arg7, s8 arg8);
// void func_800FA39C(void);
// void func_800FA3C4(void);
// void func_800FA9FC(void);
@ -1814,7 +1814,7 @@ u32 func_800FE4B8(GlobalContext* globalCtx);
// void func_800FE590(void);
// void func_800FE5D0(void);
// UNK_TYPE4 func_800FE610(void);
// void func_800FE620(void);
s32 func_800FE620(GlobalContext* globalCtx);
// void func_800FE658(void);
// UNK_TYPE4 func_800FE6F8(UNK_TYPE4 param_1, s16 param_2, s16 param_3);
// void func_800FE778(void);
@ -3935,7 +3935,7 @@ void func_801A2ED8(void);
// void func_801A2F88(void);
// void func_801A3000(void);
// void func_801A3038(void);
// void func_801A3098(void);
void func_801A3098(u16 arg0);
// void func_801A312C(void);
void func_801A31EC(UNK_TYPE1 arg1, UNK_TYPE4 arg2, u8 arg3);
// void func_801A3238(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE1 param_5);

View File

@ -32,6 +32,8 @@
#define CURRENT_DAY (gSaveContext.day % 5)
#define CLOCK_TIME(hr, min) ((s32)(((hr) * 60 + (min)) * 0x10000 / (24 * 60)))
#define SLOT(item) gItemSlots[item]
#define AMMO(item) gSaveContext.inventory.ammo[SLOT(item)]
#define INV_CONTENT(item) gSaveContext.inventory.items[SLOT(item)]

View File

@ -986,11 +986,9 @@ typedef struct {
/* 0x12070 */ UNK_TYPE1 pad12070[0x8];
/* 0x12078 */ s32 bankRupeesSelected;
/* 0x1207C */ s32 bankRupees;
/* 0x12080 */ UNK_TYPE1 pad12080[0x30];
/* 0x120B0 */ UNK_TYPE1 pad120B0[0x1];
/* 0x120B1 */ u8 unk_120B1;
/* 0x120B2 */ UNK_TYPE1 pad120B2[0x2];
/* 0x120B4 */ UNK_TYPE1 pad120B4[0x2C];
/* 0x12080 */ UNK_TYPE1 pad12080[0x31];
/* 0x120B1 */ u8 unk120B1;
/* 0x120B2 */ UNK_TYPE1 pad120B2[0x2E];
} MessageContext; // size = 0x120E0
typedef struct ActorBgMbarChair ActorBgMbarChair;

View File

@ -90,6 +90,7 @@ typedef enum {
/* 0x5C */ GI_POTION_GREEN,
/* 0x5D */ GI_POTION_BLUE,
/* 0x5E */ GI_FAIRY,
/* 0x60 */ GI_MILK_BOTTLE = 0x60,
/* 0x7E */ GI_MASK_ALL_NIGHT = 0x7E,
/* 0x8C */ GI_MASK_BREMEN = 0x8C,
/* 0x9B */ GI_SWORD_GREAT_FAIRY = 0x9B,

View File

@ -470,7 +470,7 @@ typedef struct {
typedef struct {
/* 0x00 */ u8 count; // number of points in the path
/* 0x01 */ s8 unk1;
/* 0x01 */ u8 unk1;
/* 0x02 */ s16 unk2;
/* 0x04 */ Vec3s* points; // Segment Address to the array of points
} Path; // size = 0x8

View File

@ -6925,9 +6925,9 @@ SECTIONS
ovl_En_Invadepoh : AT(RomLocation)
{
build/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.o(.text)
build/asm/overlays/ovl_En_Invadepoh_data.o(.data)
build/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.o(.data)
build/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.o(.rodata)
build/asm/overlays/ovl_En_Invadepoh_rodata.o(.rodata)
build/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh_overlay.o(.ovl)
ovl_En_Invadepoh_bss_start = .;
}
. += 0x170;

View File

@ -1,9 +1,14 @@
/* KEEPS */
/* gameplay_keep (segment 04) */
D_040008D0 = 0x040008D0;
D_0400DEA8 = 0x0400DEA8;
D_0400E2A8 = 0x0400E2A8;
D_04023210 = 0x04023210;
D_0402E510 = 0x0402E510;
D_04029CB0 = 0x04029CB0;
D_04029CF0 = 0x04029CF0;
D_04029CB0 = 0x04029CB0;
D_04029CF0 = 0x04029CF0;
D_04058BA0 = 0x04058BA0;
@ -39,6 +44,7 @@ D_0408EFE0 = 0x0408EFE0;
D_0408F3E0 = 0x0408F3E0;
D_0408F7E0 = 0x0408F7E0;
/* gameplay_dangeon_keep (segment 05) */
D_05018090 = 0x05018090;
D_05017EA0 = 0x05017EA0;
@ -349,6 +355,53 @@ D_06012A78 = 0x06012A78;
D_060137A0 = 0x060137A0;
D_06014860 = 0x06014860;
/* z_en_invadepoh */
D_06000080 = 0x06000080;
D_06000550 = 0x06000550;
D_06000560 = 0x06000560;
D_06000608 = 0x06000608;
D_060006C8 = 0x060006C8;
D_06000720 = 0x06000720;
D_06000998 = 0x06000998;
D_06001560 = 0x06001560;
D_06001674 = 0x06001674;
D_06001BD8 = 0x06001BD8;
D_06001D80 = 0x06001D80;
D_060021C8 = 0x060021C8;
D_06002A8C = 0x06002A8C;
D_06004010 = 0x06004010;
D_06004264 = 0x06004264;
D_06004C30 = 0x06004C30;
D_06004E50 = 0x06004E50;
D_06004E98 = 0x06004E98;
D_06007328 = 0x06007328;
D_060080F0 = 0x060080F0;
D_06009E58 = 0x06009E58;
D_0600A174 = 0x0600A174;
D_0600FFC8 = 0x0600FFC8;
D_060107C8 = 0x060107C8;
D_06010FC8 = 0x06010FC8;
D_060117C8 = 0x060117C8;
D_06011AD8 = 0x06011AD8;
D_06011FC8 = 0x06011FC8;
D_060122D8 = 0x060122D8;
D_060127C8 = 0x060127C8;
D_06012AD8 = 0x06012AD8;
D_06012BC8 = 0x06012BC8;
D_06012FC8 = 0x06012FC8;
D_060132D8 = 0x060132D8;
D_060133C8 = 0x060133C8;
D_06013928 = 0x06013928;
D_06013AD8 = 0x06013AD8;
D_06014088 = 0x06014088;
D_060142D8 = 0x060142D8;
D_06014AD8 = 0x06014AD8;
D_06014ED8 = 0x06014ED8;
D_060152D8 = 0x060152D8;
D_06015C28 = 0x06015C28;
D_060156D8 = 0x060156D8;
D_06016720 = 0x06016720;
/* z_en_jc_mato */
D_06000390 = 0x06000390;

View File

@ -7,7 +7,9 @@ struct EnDoor;
typedef struct EnDoor {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x88];
/* 0x144 */ char unk_144[0x63];
/* 0x1A7 */ s8 unk1A7;
/* 0x1A8 */ char unk1A8[0x24];
} EnDoor; // size = 0x1CC
extern const ActorInit En_Door_InitVars;

File diff suppressed because it is too large Load Diff

View File

@ -5,9 +5,151 @@
struct EnInvadepoh;
typedef void (*EnInvadepohInitFunc)(struct EnInvadepoh*, GlobalContext*);
typedef void (*EnInvadepohDestroyFunc)(struct EnInvadepoh*, GlobalContext*);
typedef void (*EnInvadepohActionFunc)(struct EnInvadepoh*, GlobalContext*);
#define INVADEPOH_TYPE(x) (x->actor.params >> 4 & 0xF)
typedef enum{
/* 0 */ TYPE_UNK0,
/* 1 */ TYPE_ALIEN,
/* 2 */ TYPE_PARENT_COW,
/* 3 */ TYPE_CHILD_COW,
/* 4 */ TYPE_ROMANI,
/* 5 */ TYPE_ROMANI1,
/* 6 */ TYPE_UNK6,
/* 7 */ TYPE_ROMANI2,
/* 8 */ TYPE_ROMANI3,
/* 9 */ TYPE_ROMANI4,
/* 10 */ TYPE_DOG,
/* 11 */ TYPE_CREMIA,
/* 12 */ TYPE_ROMANI5,
/* 13 */ TYPE_ALIEN1
} EnInvadepohType;
typedef enum {
/* -1 */ DIRECTION_BACKWARD = -1,
/* 1 */ DIRECTION_FORWARD = 1,
} EnInvadepohDirection;
typedef struct unkStruct80B50350 {
/* 0x000 */ s8 unk0;
/* 0x001 */ s8 unk1;
/* 0x002 */ u8 unk2;
/* 0x004 */ Vec3f unk4;
} unkStruct80B50350; // size = 0x10;
typedef struct {
/* 0x00 */ s8* unk00;
/* 0x04 */ s8 unk04;
} unkstructInvadepoh0; // size = 0x08
typedef struct {
/* 0x00 */ s8 unk00;
/* 0x04 */ f32 unk04;
} unkstructInvadepoh1; // size = 0x08
typedef struct {
/* 0x00 */ s8 unk00;
/* 0x04 */ unkstructInvadepoh0* unk04;
} unkstructInvadepoh2; // size = 0x08
typedef struct {
/* 0x00 */ s8 unk0;
/* 0x04 */ unkstructInvadepoh0* unk4;
/* 0x08 */ s8 unk8;
/* 0x0C */ unkstructInvadepoh1* unkC;
} unkstructInvadepoh3; // size = 0x10
typedef struct {
/* 0x00 */ s8 unk00;
/* 0x04 */ unkstructInvadepoh0* unk04;
/* 0x08 */ s8 unk08;
/* 0x0C */ unkstructInvadepoh1* unk0C;
/* 0x10 */ s16 unk10;
/* 0x12 */ s16 unk12;
} unkstructInvadepoh4; // size = 0x14
typedef struct {
/* 0x00 */ f32 unk00;
/* 0x04 */ s16 unk04;
/* 0x06 */ s16 unk06;
} unkstruct80B4EE0C; // size = 0x08
typedef struct EnInvadePohStruct {
/* 0x000 */ unkstructInvadepoh4* unk0;
/* 0x004 */ s8 unk4;
/* 0x008 */ unkstructInvadepoh4* unk8;
/* 0x00C */ s16 unkC;
/* 0x00E */ s8 unkE;
/* 0x00F */ s8 unkF;
} EnInvadePohStruct; // size = 0x10;
typedef struct AlienBehaviorInfo {
/* 0x000 */ EnInvadePohStruct unk0;
/* 0x010 */ EnInvadePohStruct unk10;
/* 0x020 */ Vec3s unk20;
/* 0x026 */ Vec3s unk26;
/* 0x02C */ s16 unk2C;
/* 0x02E */ u16 unk2E;
/* 0x030 */ f32 unk30;
/* 0x034 */ f32 unk34;
/* 0x038 */ f32 unk38;
/* 0x03C */ f32 unk3C;
/* 0x040 */ s16 unk40;
/* 0x042 */ s16 unk42;
/* 0x044 */ f32 unk44;
/* 0x048 */ s16 unk48;
/* 0x04A */ char unk4A[0x2];
/* 0x04C */ s16 unk4C;
/* 0x04E */ s16 unk4E;
} AlienBehaviorInfo; // size = 0x50
typedef struct EnInvadepoh {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x27C];
/* 0x144 */ SkelAnime skelAnime;
/* 0x188 */ Vec3s limbDrawTable[23];
/* 0x212 */ Vec3s transitionDrawTable[23];
/* 0x29C */ s8 animPlayFlag;
/* 0x2A0 */ ColliderCylinder collider;
/* 0x2EC */ EnInvadepohActionFunc actionFunc;
/* 0x2F0 */ s16 actionTimer;
/* 0x2F2 */ s16 counter; // general counter variable
/* 0x2F4 */ s8 bankIndex;
/* 0x2F8 */ f32 xzPosAdjFactor;
/* 0x2FC */ UNK_TYPE unk2FC; // unused
/* 0x300 */ f32 velocityStep;
/* 0x304 */ s16 unk304; // angle of some sort
/* 0x306 */ s16 unk306;
/* 0x308 */ s8 endPoint;
/* 0x309 */ s8 pathIndex;
/* 0x30A */ s8 direction; // only ever 1 or -1
/* 0x30C */ Vec3s* pathPoints;
/* 0x310 */ f32 pathTotalDist;
/* 0x314 */ Vec3f curPathPos;
/* 0x320 */ f32 clockTime;
/* 0x324 */ AlienBehaviorInfo behaviorInfo;
/* 0x374 */ s8 rand;
/* 0x376 */ u16 textId;
/* 0x378 */ s8 unk378;
/* 0x379 */ s8 unk379;
/* 0x37C */ f32 unk37C[3];
/* 0x388 */ s8 unk388; // unused
/* 0x389 */ u8 alienAlpha;
/* 0x38A */ s8 unk38A; // bool
/* 0x38B */ s8 drawAlien;
/* 0x38C */ s8 drawAlienDeathEffect;
/* 0x38D */ u8 alienBeamAlpha;
/* 0x390 */ Vec3f alienDeathEffectScale;
/* 0x39C */ f32 scaleFactorAdj;
/* 0x3A0 */ f32 scaleTarget;
/* 0x3A4 */ f32 scaleStep;
/* 0x3A8 */ s16 scaleAdjAngle;
/* 0x3AA */ s16 unk3AA;
/* 0x3AC */ s8 unk3AC; // index for D_80B4EDD0
/* 0x3AD */ char unk3AD[0xF];
/* 0x3BC */ s8 unk3BC;
} EnInvadepoh; // size = 0x3C0
extern const ActorInit En_Invadepoh_InitVars;

View File

@ -663,7 +663,7 @@ void EnMa4_DialogueHandler(EnMa4* this, GlobalContext* globalCtx) {
case 6: // End conversation
if (func_80147624(globalCtx) != 0) {
if ((globalCtx->msgCtx.unk_120B1 == 0) ||
if ((globalCtx->msgCtx.unk120B1 == 0) ||
(((temp_v0 = gSaveContext.inventory.questItems) & gBitFlags[0x12]) == 0)) {
EnMa4_SetupWait(this);
}

View File

@ -13748,9 +13748,9 @@
0x80B43DD4:("func_80B43DD4",),
0x80B43E6C:("func_80B43E6C",),
0x80B43F0C:("func_80B43F0C",),
0x80B43F70:("func_80B43F70",),
0x80B43F70:("EnInvadepoh_GetTotalPathDistance",),
0x80B44024:("func_80B44024",),
0x80B4407C:("func_80B4407C",),
0x80B4407C:("EnInvadepoh_SetPathPointToWorldPos",),
0x80B440B8:("func_80B440B8",),
0x80B44234:("func_80B44234",),
0x80B442E4:("func_80B442E4",),
@ -13784,9 +13784,9 @@
0x80B453F4:("func_80B453F4",),
0x80B45460:("func_80B45460",),
0x80B454BC:("func_80B454BC",),
0x80B45518:("func_80B45518",),
0x80B45518:("EnInvadepoh_SetSysMatrix",),
0x80B45550:("func_80B45550",),
0x80B4560C:("func_80B4560C",),
0x80B4560C:("EnInvadepoh_SetTextID",),
0x80B45648:("func_80B45648",),
0x80B456A8:("func_80B456A8",),
0x80B457A0:("func_80B457A0",),
@ -13804,13 +13804,13 @@
0x80B46184:("func_80B46184",),
0x80B461DC:("func_80B461DC",),
0x80B4627C:("func_80B4627C",),
0x80B46414:("func_80B46414",),
0x80B46520:("func_80B46520",),
0x80B465CC:("func_80B465CC",),
0x80B46644:("func_80B46644",),
0x80B46414:("EnInvadepoh_InitAlien",),
0x80B46520:("EnInvadepoh_InitParentCow",),
0x80B465CC:("EnInvadepoh_InitChildCow",),
0x80B46644:("EnInvadepoh_InitRomani",),
0x80B468B4:("func_80B468B4",),
0x80B469C4:("func_80B469C4",),
0x80B46A80:("func_80B46A80",),
0x80B469C4:("EnInvadepoh_InitDog",),
0x80B46A80:("EnInvadepoh_InitCremia",),
0x80B46B74:("EnInvadepoh_Init",),
0x80B46BB0:("func_80B46BB0",),
0x80B46BC0:("func_80B46BC0",),

View File

@ -16056,21 +16056,6 @@
0x80B4EE0C:("D_80B4EE0C","UNK_TYPE1","",0x1),
0x80B4EE24:("D_80B4EE24","UNK_TYPE1","",0x1),
0x80B4EE30:("D_80B4EE30","UNK_TYPE1","",0x1),
0x80B4EE40:("D_80B4EE40","f32","",0x4),
0x80B4EE44:("D_80B4EE44","f32","",0x4),
0x80B4EE48:("D_80B4EE48","f32","",0x4),
0x80B4EE4C:("D_80B4EE4C","f32","",0x4),
0x80B4EE50:("D_80B4EE50","f32","",0x4),
0x80B4EE54:("D_80B4EE54","f32","",0x4),
0x80B4EE58:("D_80B4EE58","f32","",0x4),
0x80B4EE5C:("D_80B4EE5C","f32","",0x4),
0x80B4EE60:("D_80B4EE60","f32","",0x4),
0x80B4EE64:("D_80B4EE64","f32","",0x4),
0x80B4EE68:("D_80B4EE68","f32","",0x4),
0x80B4EE6C:("D_80B4EE6C","f32","",0x4),
0x80B4EE70:("D_80B4EE70","f32","",0x4),
0x80B4EE74:("D_80B4EE74","f32","",0x4),
0x80B4EE78:("D_80B4EE78","f32","",0x4),
0x80B4EE7C:("D_80B4EE7C","f32","",0x4),
0x80B4EE80:("D_80B4EE80","f32","",0x4),
0x80B4EE84:("D_80B4EE84","f32","",0x4),

24
tools/timeconv.py Executable file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env python3
#
# Convert time values such as 0x1AAA to their clock time, i.e. 2,30
# The time is output with a comma for easy copy-pasting into a macro
#
import sys
time = sys.argv[1]
time = int(time, 16 if time.startswith("0x") else 10)
minutes = round(((24 * 60) / 0x10000) * time)
hours = int(minutes // 60)
minutes = round(minutes - 60 * hours)
# Since multiple values are mapped to the same clock time, check that it
# still matches once converted. If it doesn't match as it is, print a warning.
macro_val = int((hours * 60 + minutes) * (0x10000 / (24 * 60)))
print(f"{hours},{minutes:02} -> 0x{macro_val:04X}")
print(f"CLOCK_TIME({hours}, {minutes})")
if time != macro_val:
print("Warning: Result does not match as-is")

View File

@ -4,4 +4,4 @@ In function strncpy,
inlined from parse_int at vtxdis.c:41:9:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:106:10: warning: __builtin_strncpy specified bound 20 equals destination size [-Wstringop-truncation]
106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~