C file for Fishing, some changes to collider scripts, a few minor cleanups (#210)

* Improve match in EnFirefly_Draw

* Vestigial fishing files, add enums

* Improve scripts, add ColChkInfo one

* Some minor actor cleanup (static etc)

* C file for Fishing, remove some local vars from variables.h

* Remove comma and format

* Newline

* Review suggestions
This commit is contained in:
EllipticEllipsis 2021-07-15 05:33:20 +01:00 committed by GitHub
parent 0b6aa837d2
commit 66d0656128
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 248 additions and 64 deletions

View File

@ -373,10 +373,6 @@ extern ActorInit En_A_Obj_InitVars;
extern ColliderCylinderInit enAObjCylinderInit;
extern InitChainEntry enAObjInitVar;
extern Gfx* enAObjDisplayLists[2];
extern Color_RGBA8 D_801ADF10;
extern Color_RGBA8 D_801ADF14;
extern Vec3f D_801ADF18;
extern Vec3f D_801ADF24;
extern UNK_PTR D_801ADF30[5];
extern UNK_PTR D_801ADF44[12];
extern u8 sDropTable[DROP_TABLE_SIZE * DROP_TABLE_NUMBER];

View File

@ -428,7 +428,7 @@ typedef enum {
/* 0x076 */ ACTOR_UNSET_76,
/* 0x077 */ ACTOR_UNSET_77,
/* 0x078 */ ACTOR_UNSET_78,
/* 0x079 */ ACTOR_UNSET_79,
/* 0x079 */ ACTOR_EN_FISHING,
/* 0x07A */ ACTOR_OBJ_OSHIHIKI,
/* 0x07B */ ACTOR_EFF_DUST,
/* 0x07C */ ACTOR_BG_UMAJUMP,

View File

@ -1902,8 +1902,9 @@ SECTIONS
_ovl_En_FishingSegmentStart = SegmentStart;
ovl_En_Fishing : AT(RomLocation)
{
build/asm/overlays/ovl_En_Fishing_0x808FC6C0.o(.text)
build/src/overlays/actors/ovl_En_Fishing/z_en_fishing.o(.text)
build/asm/overlays/ovl_En_Fishing_data.o(.data)
build/src/overlays/actors/ovl_En_Fishing/z_en_fishing.o(.rodata)
build/asm/overlays/ovl_En_Fishing_rodata.o(.rodata)
ovl_En_Fishing_bss_start = .;
}

View File

@ -320,10 +320,10 @@ void func_800A640C(EnItem00* this, GlobalContext* globalCtx) {
}
}
Color_RGBA8 D_801ADF10 = { 0xFF, 0xFF, 0x7F, 0x00 };
Color_RGBA8 D_801ADF14 = { 0xFF, 0xFF, 0xFF, 0x00 };
Vec3f D_801ADF18 = { 0.0f, 0.1f, 0.0f };
Vec3f D_801ADF24 = { 0.0f, 0.01f, 0.0f };
static Color_RGBA8 D_801ADF10 = { 255, 255, 127, 0 };
static Color_RGBA8 D_801ADF14 = { 255, 255, 255, 0 };
static Vec3f D_801ADF18 = { 0.0f, 0.1f, 0.0f };
static Vec3f D_801ADF24 = { 0.0f, 0.01f, 0.0f };
void func_800A6650(EnItem00* this, GlobalContext* globalCtx) {
u32 pad;

View File

@ -24,7 +24,7 @@ const ActorInit Arms_Hook_InitVars = {
(ActorFunc)ArmsHook_Draw,
};
ColliderQuadInit D_808C1BC0 = {
static ColliderQuadInit D_808C1BC0 = {
{
COLTYPE_NONE,
AT_ON | AT_TYPE_PLAYER,
@ -44,13 +44,6 @@ ColliderQuadInit D_808C1BC0 = {
{ { { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 0.0f } } },
};
Vec3f D_808C1C10 = { 0.0f, 0.0f, 0.0f };
Vec3f D_808C1C1C = { 0.0f, 0.0f, 900.0f };
Vec3f D_808C1C28 = { 0.0f, 500.0f, -3000.0f };
Vec3f D_808C1C34 = { 0.0f, -500.0f, -3000.0f };
Vec3f D_808C1C40 = { 0.0f, 500.0f, 0.0f };
Vec3f D_808C1C4C = { 0.0f, -500.0f, 0.0f };
extern Gfx D_0601D960[];
void ArmsHook_SetupAction(ArmsHook* this, ArmsHookActionFunc actionFunc) {
@ -285,6 +278,13 @@ void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx) {
this->unk1EC = this->unk1E0;
}
static Vec3f D_808C1C10 = { 0.0f, 0.0f, 0.0f };
static Vec3f D_808C1C1C = { 0.0f, 0.0f, 900.0f };
static Vec3f D_808C1C28 = { 0.0f, 500.0f, -3000.0f };
static Vec3f D_808C1C34 = { 0.0f, -500.0f, -3000.0f };
static Vec3f D_808C1C40 = { 0.0f, 500.0f, 0.0f };
static Vec3f D_808C1C4C = { 0.0f, -500.0f, 0.0f };
void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) {
ArmsHook* this = THIS;
s32 pad;

View File

@ -92,16 +92,18 @@ static ColliderJntSphInit sJntSphInit = {
sJntSphElementsInit,
};
Vec3f eyeSparkleSpawnPositions[][2] = { { { -215.0f, 139.0f, 50.0f }, { -193.0f, 139.0f, 50.0f } },
static Vec3f eyeSparkleSpawnPositions[][2] = {
{ { -215.0f, 139.0f, 50.0f }, { -193.0f, 139.0f, 50.0f } },
{ { -125.0f, 139.0f, 50.0f }, { -103.0f, 139.0f, 50.0f } },
{ { -125.0f, 139.0f, 50.0f }, { -103.0f, 139.0f, 50.0f } },
{ { 103.0f, 139.0f, 50.0f }, { 125.0f, 139.0f, 50.0f } },
{ { 103.0f, 139.0f, 50.0f }, { 125.0f, 139.0f, 50.0f } },
{ { 193.0f, 139.0f, 50.0f }, { 215.0f, 139.0f, 50.0f } } };
{ { 193.0f, 139.0f, 50.0f }, { 215.0f, 139.0f, 50.0f } },
};
Color_RGBA8 primColor = { 0xFF, 0xFF, 0xFF, 0x00 };
Color_RGBA8 envColor = { 0x00, 128, 128, 0x00 };
static Color_RGBA8 primColor = { 255, 255, 255, 0 };
static Color_RGBA8 envColor = { 0, 128, 128, 0 };
static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_CONTINUE),

View File

@ -788,13 +788,13 @@ void EnFirefly_Draw(Actor* thisx, GlobalContext* globalCtx) {
gSPDisplayList(gfx, &sSetupDL[150]);
if (this->currentType == KEESE_FIRE) {
gDPSetEnvColor(gfx + 1, 0, 0, 0, 0);
gDPSetEnvColor(&gfx[1], 0, 0, 0, 0);
} else {
gDPSetEnvColor(gfx + 1, 0, 0, 0, 255);
gDPSetEnvColor(&gfx[1], 0, 0, 0, 255);
}
gfx = SkelAnime_Draw2(globalCtx, this->skelAnime.skeleton, this->skelAnime.limbDrawTbl, EnFirefly_OverrideLimbDraw,
EnFirefly_PostLimbDraw, &this->actor, gfx + 2);
EnFirefly_PostLimbDraw, &this->actor, &gfx[2]);
if (this->isInvisible) {
POLY_XLU_DISP = gfx;
} else {

View File

@ -0,0 +1,2 @@
ovl_En_Fishing
z_en_fishing.c

View File

@ -0,0 +1,122 @@
/*
* File: z_en_fishing.c
* Overlay: ovl_En_Fishing
* Description: Fishing
*/
#include "z_en_fishing.h"
#define FLAGS 0x00000010
#define THIS ((EnFishing*)thisx)
void EnFishing_Init(Actor* thisx, GlobalContext* globalCtx);
void EnFishing_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnFishing_Update(Actor* thisx, GlobalContext* globalCtx);
void EnFishing_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit En_Fishing_InitVars = {
ACTOR_EN_FISHING,
ACTORCAT_NPC,
FLAGS,
OBJECT_FISH,
sizeof(EnFishing),
(ActorFunc)EnFishing_Init,
(ActorFunc)EnFishing_Destroy,
(ActorFunc)EnFishing_Update,
(ActorFunc)EnFishing_Draw,
};
*/
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FC6C0.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FC770.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FC790.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FC8B8.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FC964.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FCABC.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FCC0C.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FCDBC.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FCF60.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FD054.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/EnFishing_Init.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/EnFishing_Destroy.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FDCDC.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FE3F8.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FEE1C.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FEF70.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FF064.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FF5E0.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FF750.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FFC44.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_808FFF3C.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_80900228.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_80900A04.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_80901480.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_809033F0.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_809036BC.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_809038A4.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_80903C60.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_80903E20.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/EnFishing_Update.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_80908554.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_80908674.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_809086B4.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_80908734.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/EnFishing_Draw.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_809089B8.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_80908A64.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_80908B4C.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_80908E08.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_80909234.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_80909AD0.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_80909CC0.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_8090AB6C.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_8090C884.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_8090C8BC.asm")
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Fishing_0x808FC6C0/func_8090C96C.asm")

View File

@ -0,0 +1,17 @@
#ifndef Z_EN_FISHING_H
#define Z_EN_FISHING_H
#include "global.h"
struct EnFishing;
typedef void (*EnFishingActionFunc)(struct EnFishing*, GlobalContext*);
typedef struct EnFishing {
/* 0x000 */ Actor actor;
/* 0x144 */ char unk_144[0x404];
} EnFishing; // size = 0x548
extern const ActorInit En_Fishing_InitVars;
#endif // Z_EN_FISHING_H

View File

@ -141,9 +141,7 @@ static ColliderJntSphInit sJntSphInit = {
sJntSphElementsInit,
};
CollisionCheckInfoInit2 sColChkInfoInit2 = {
0, 0, 0, 0, MASS_HEAVY,
};
static CollisionCheckInfoInit2 sColChkInfoInit2 = { 0, 0, 0, 0, MASS_HEAVY };
static DamageTable sDamageTable = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

View File

@ -56,6 +56,8 @@ static DamageTable sDamageTable = {
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
};
extern Gfx D_06000390[];
s32 EnJcMato_CheckForHit(EnJcMato* this, GlobalContext* globalCtx) {
this->collider.dim.worldSphere.center.x = this->pos.x;
this->collider.dim.worldSphere.center.y = this->pos.y;
@ -122,8 +124,7 @@ void EnJcMato_Update(Actor* thisx, GlobalContext* globalCtx) {
}
}
extern Gfx D_06000390[];
Vec3f movement = { 0.0f, -2500.0f, 0.0f };
static Vec3f movement = { 0.0f, -2500.0f, 0.0f };
void EnJcMato_Draw(Actor* thisx, GlobalContext* globalCtx) {
EnJcMato* this = THIS;

View File

@ -71,7 +71,6 @@ static Gfx* sLightswitchFaceGfx[] = {
};
static Color_RGBA8 sLightswitchEffectPrimColor = { 255, 255, 160, 160 };
static Color_RGBA8 sLightswitchEffectEnvColor = { 255, 0, 0, 0 };
static InitChainEntry sInitChain[] = {

View File

@ -124,7 +124,7 @@ actor_names = [
"",
"",
"",
"",
"ovl_En_Fishing",
"ovl_Obj_Oshihiki",
"ovl_Eff_Dust",
"ovl_Bg_Umajump",
@ -719,6 +719,7 @@ def read_actor_ovl_tbl():
actortbl.append((actor_names[i], entry[0], entry[1], entry[2], entry[3]))
entry = as_word_list(codefile.read(0x20))
i += 1
actortbl[0] = ['ovl_Player_Actor', 0xCA7F00, 0xCDCF60, 0x8082DA90, 0x80862B70 ]
return actortbl
actor_tbl = read_actor_ovl_tbl()
@ -735,7 +736,7 @@ def resolve_symbol(address):
if entry[1] <= address < entry[2]:
return repo + "baserom/overlays" + os.sep + entry[0], address - entry[1]
else:
return None, None
raise RuntimeError('Symbol not found in actor overlay table file ranges. Are you sure the file is an actor overlay?')
def HexParse(s):
return int(s, 16)

View File

@ -0,0 +1,41 @@
#!/usr/bin/env python3
import struct
import argparse
from actor_symbols import resolve_symbol
def HexParse(s):
return int(s, 16)
def NameMass(info):
if info[-1] == 0xFE:
info[-1] = "MASS_HEAVY"
else:
if info[-1] == 0xFF:
info[-1] = "MASS_IMMOVABLE"
def main():
parser = argparse.ArgumentParser(description='Decompiles a ColChkInfoInit')
parser.add_argument('address', help='VRAM or VROM address of a ColChkInfoInit', type=HexParse)
parser.add_argument('type', help="Type: ColChkInfoInit or ColChkInfoInit2", choices=['ColChkInfoInit', 'ColChkInfoInit2'])
args = parser.parse_args()
file_path, file_offset = resolve_symbol(args.address)
with open(file_path, 'rb') as f:
filedata = f.read()
if args.type == "ColChkInfoInit":
info = list(struct.unpack(">Bx2hB", filedata[file_offset:file_offset+7]))
NameMass(info)
output="// colChkInfoInit\nstatic CollisionCheckInfoInit D_{0:08X} = {{ ".format(args.address) + ", ".join(map(str,info)) + "};"
else:
info = struct.unpack(">B3hB", filedata[file_offset:file_offset+9])
NameMass(info)
output="// sColChkInfoInit\nstatic CollisionCheckInfoInit2 D_{0:08X} = {{ ".format(args.address) + ", ".join(map(str,info)) + "};"
print(output)
if __name__ == "__main__":
main()

View File

@ -272,34 +272,37 @@ def GetItems(data, off, count, structf, fmt, size):
}},'''.format(f_ColliderBodyInit.format(*cBody), fmt.format(*cItem))
return result
def GetJntSphElements(data, off, count):
def GetJntSphElements(address, data, off, count):
items = GetItems(data, off, count, sf_JntSphElement, f_JntSphElement, 0x24)
return('''
static ColliderJntSphElementInit sJntSphElementsInit[{0}] = {{{1}
// static ColliderJntSphElementInit sJntSphElementsInit[{0}] = {{
static ColliderJntSphElementInit D_{2:08X}[{0}] = {{{1}
}};
'''.format(count, items))
'''.format(count, items, address))
def GetJntSph(data, off, type):
def GetJntSph(address, data, off, type):
sBase = GetColliderStr(data, off, type)
cJntSph = struct.unpack_from(sf_JntSph, data, off + 8)
return('''
static ColliderJntSphInit{0} sJntSphInit = {{
// static ColliderJntSphInit{0} sJntSphInit = {{
static ColliderJntSphInit{0} D_{3:08X} = {{
{1},
{2},
}};
'''.format(type, sBase, f_JntSph.format(*cJntSph)))
'''.format(type, sBase, f_JntSph.format(*cJntSph), address))
def GetTrisElements(data, off, count):
def GetTrisElements(address, data, off, count):
items = GetItems(data, off, count, sf_TrisElement, f_TrisElement, 0x3C)
return('''
static ColliderTrisElementInit sTrisElementsInit[{0}] = {{{1}
// static ColliderTrisElementInit sTrisElementsInit[{0}] = {{
static ColliderTrisElementInit D_{2:08X}[{0}] = {{{1}
}};
'''.format(count, items))
'''.format(count, items, address))
def GetCylinder(data, off, type):
def GetCylinder(address, data, off, type):
sBase = GetColliderStr(data, off, type)
cBody = list(struct.unpack_from(sf_ColliderBodyInit, data, off + 0x08))
cCyl16 = struct.unpack_from(sf_Cylinder16, data, off + 0x20)
@ -314,25 +317,27 @@ def GetCylinder(data, off, type):
cBody[9] = GetOcElemFlags(cBody[9])
return('''
static ColliderCylinderInit{0} sCylinderInit = {{
// static ColliderCylinderInit{0} sCylinderInit = {{
static ColliderCylinderInit{0} D_{4:08X} = {{
{1},
{2},
{3},
}};
'''.format(type,sBase,f_ColliderBodyInit.format(*cBody),f_Cylinder16.format(*cCyl16)))
'''.format(type,sBase,f_ColliderBodyInit.format(*cBody),f_Cylinder16.format(*cCyl16), address))
def GetTris(data, off, type):
def GetTris(address, data, off, type):
sBase = GetColliderStr(data, off, type)
cTris = struct.unpack_from(sf_Tris, data, off + 8)
return('''
static ColliderTrisInit{0} sTrisInit = {{
// static ColliderTrisInit{0} sTrisInit = {{
static ColliderTrisInit{0} D_{3:08X} = {{
{1},
{2},
}};
'''.format(type, sBase, f_Tris.format(*cTris)))
'''.format(type, sBase, f_Tris.format(*cTris), address))
def GetQuad(data, off, type):
def GetQuad(address, data, off, type):
sBase = GetColliderStr(data, off, type)
cBody = list(struct.unpack_from(sf_ColliderBodyInit, data, off + 0x08))
cQuad = struct.unpack_from(sf_Quad, data, off + 0x20)
@ -347,14 +352,15 @@ def GetQuad(data, off, type):
cBody[9] = GetOcElemFlags(cBody[9])
return('''
static ColliderQuadInit{0} sQuadInit = {{
// static ColliderQuadInit{0} sQuadInit = {{
static ColliderQuadInit{0} D_{4:08X} = {{
{1},
{2},
{3},
}};
'''.format(type, sBase, f_ColliderBodyInit.format(*cBody), f_Quad.format(*cQuad)))
'''.format(type, sBase, f_ColliderBodyInit.format(*cBody), f_Quad.format(*cQuad), address))
def GetSphere(data, off, type):
def GetSphere(address, data, off, type):
sBase = GetColliderStr(data, off, type)
cBody = list(struct.unpack_from(sf_ColliderBodyInit, data, off + 0x08))
cSphere = struct.unpack_from(sf_Sphere, data, off + 0x20)
@ -369,12 +375,13 @@ def GetSphere(data, off, type):
cBody[9] = GetOcElemFlags(cBody[9])
return('''
static ColliderSphereInit{0} sSphereInit = {{
// static ColliderSphereInit{0} sSphereInit = {{
static ColliderSphereInit{0} D_{4:08X} = {{
{1},
{2},
{3},
}};
'''.format(type, sBase, f_ColliderBodyInit.format(*cBody), f_Sphere.format(*cSphere)))
'''.format(type, sBase, f_ColliderBodyInit.format(*cBody), f_Sphere.format(*cSphere), address))
def GetColliderInit(address, type, num):
TYPE_DICT = {
@ -394,9 +401,6 @@ def GetColliderInit(address, type, num):
fileResult = resolve_symbol(address)
if fileResult[0] is None:
return("Invalid address")
print(hex(fileResult[1]), "in", fileResult[0].split(os.sep)[-1])
selectedType = TYPE_DICT[type]
@ -412,7 +416,7 @@ def GetColliderInit(address, type, num):
ovlData = bytearray(ovlFile.read())
ovlFile.close()
return selectedType[0](ovlData, fileResult[1], arg2)
return selectedType[0](address, ovlData, fileResult[1], arg2)
def GetColliderInitFull(address, type, num):
if(type.find('Element') != -1):
@ -421,21 +425,21 @@ def GetColliderInitFull(address, type, num):
base = GetColliderInit(address, type, 0)
if(type.find('JntSph') != -1):
[num, address2, dummy] = base.split('\n')[3].split(',')
[num, address2, dummy] = base.split('\n')[4].split(',')
hexaddress = int(address2.strip(' D_'), 16)
if(hexaddress == 0):
return base.replace(address2,' NULL')
else:
elements = GetColliderInit(hexaddress, 'ColliderJntSphElementInit', int(num))
return elements + base.replace(address2,' sJntSphElementsInit')
return elements + base.replace(address2, address2 + ', // sJntSphElementsInit')
elif(type.find('Tris') != -1):
[num, address2, dummy] = base.split('\n')[3].split(',')
[num, address2, dummy] = base.split('\n')[4].split(',')
hexaddress = int(address2.strip(' D_'), 16)
if(hexaddress == 0):
return base.replace(address2,' NULL')
else:
elements = GetColliderInit(hexaddress, 'ColliderTrisElementInit', int(num))
return elements + base.replace(address2,' sTrisElementsInit')
return elements + base.replace(address2, address2 + ', // sTrisElementsInit')
else:
return base