Skip to content

Commit

Permalink
Migrate ft/code_*.s to C (#526)
Browse files Browse the repository at this point in the history
* Migrate `code_8007C114` to C

* Migrate `code_8007C630` to C

* Migrate `code_80081B38` to C

* Migrate `code_80081938` to C
  • Loading branch information
ribbanya authored Sep 1, 2022
1 parent b30677f commit b3abf02
Show file tree
Hide file tree
Showing 41 changed files with 812 additions and 453 deletions.
2 changes: 1 addition & 1 deletion asm/melee/ft/chara/ftkirby.s
Original file line number Diff line number Diff line change
Expand Up @@ -6066,7 +6066,7 @@ lbl_800F3B94:
/* 800F3BA0 000F0780 FF E0 00 90 */ fmr f31, f0
lbl_800F3BA4:
/* 800F3BA4 000F0784 7F E3 FB 78 */ mr r3, r31
/* 800F3BA8 000F0788 4B F9 0E 99 */ bl func_80084A40
/* 800F3BA8 000F0788 4B F9 0E 99 */ bl Stage_GetGroundFrictionMultiplier
/* 800F3BAC 000F078C C0 02 99 B0 */ lfs f0, lbl_804D9390@sda21(r2)
/* 800F3BB0 000F0790 FC 1F 00 40 */ fcmpo cr0, f31, f0
/* 800F3BB4 000F0794 40 80 00 0C */ bge lbl_800F3BC0
Expand Down
6 changes: 3 additions & 3 deletions asm/melee/ft/ft_unknown_006.s
Original file line number Diff line number Diff line change
Expand Up @@ -16592,7 +16592,7 @@ func_800965DC:
/* 800965F0 000931D0 7C 7E 1B 78 */ mr r30, r3
/* 800965F4 000931D4 83 E3 00 2C */ lwz r31, 0x2c(r3)
/* 800965F8 000931D8 7F E3 FB 78 */ mr r3, r31
/* 800965FC 000931DC 4B FE E4 45 */ bl func_80084A40
/* 800965FC 000931DC 4B FE E4 45 */ bl Stage_GetGroundFrictionMultiplier
/* 80096600 000931E0 C0 42 8B DC */ lfs f2, lbl_804D85BC@sda21(r2)
/* 80096604 000931E4 3C 60 80 3C */ lis r3, ft_SpecialS@ha
/* 80096608 000931E8 C0 1F 01 C8 */ lfs f0, 0x1c8(r31)
Expand Down Expand Up @@ -76627,7 +76627,7 @@ lbl_800CA4C0:
/* 800CA4FC 000C70DC 48 00 00 28 */ b lbl_800CA524
lbl_800CA500:
/* 800CA500 000C70E0 7F E3 FB 78 */ mr r3, r31
/* 800CA504 000C70E4 4B FB A5 3D */ bl func_80084A40
/* 800CA504 000C70E4 4B FB A5 3D */ bl Stage_GetGroundFrictionMultiplier
/* 800CA508 000C70E8 80 6D AE B4 */ lwz r3, p_ftCommonData@sda21(r13)
/* 800CA50C 000C70EC C0 5F 00 EC */ lfs f2, 0xec(r31)
/* 800CA510 000C70F0 C0 03 00 54 */ lfs f0, 0x54(r3)
Expand Down Expand Up @@ -76823,7 +76823,7 @@ func_800CA77C:
/* 800CA790 000C7370 7C 7E 1B 78 */ mr r30, r3
/* 800CA794 000C7374 83 E3 00 2C */ lwz r31, 0x2c(r3)
/* 800CA798 000C7378 7F E3 FB 78 */ mr r3, r31
/* 800CA79C 000C737C 4B FB A2 A5 */ bl func_80084A40
/* 800CA79C 000C737C 4B FB A2 A5 */ bl Stage_GetGroundFrictionMultiplier
/* 800CA7A0 000C7380 C0 02 94 C4 */ lfs f0, lbl_804D8EA4@sda21(r2)
/* 800CA7A4 000C7384 FC 01 00 40 */ fcmpo cr0, f1, f0
/* 800CA7A8 000C7388 40 80 00 0C */ bge lbl_800CA7B4
Expand Down
47 changes: 1 addition & 46 deletions include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,7 @@ void func_8007BAC0();
f32 func_8007BBCC(struct _HSD_GObj *);
void func_8007BC90();
void func_8007BE3C(struct _HSD_GObj *);
void func_8007C114();
void func_8007C17C(struct _HSD_GObj *);
void func_8007C224();

void func_8007C4BC();
void func_8007C630(struct _HSD_GObj *);
void func_8007C6DC();
void func_8007C77C();

void func_8007C930(struct _Fighter *, f32);

void func_8007CB74(struct _HSD_GObj *);
Expand Down Expand Up @@ -310,43 +303,8 @@ void func_8008031C();
f32 func_800804EC(struct _Fighter *); // DataOffset_PlayerScale_MultiplyBySomething, returns fp->x40*fp->x34
void func_800804FC();

void func_80081938(struct _HSD_GObj *);
void func_800819A8();

void func_80081B38(struct _HSD_GObj *);
void func_80081C88(struct _HSD_GObj *, f32);
s32 func_80081D0C(struct _HSD_GObj *);

s32 func_800821DC();
s32 func_8008239C(HSD_GObj *, s32, f32 *);

s32 func_80082708(struct _HSD_GObj *);
s32 func_800827A0(struct _HSD_GObj *);

s32 func_80082A68(struct _HSD_GObj *);
void func_80082B1C(struct _HSD_GObj *); /* extern */

struct _HSD_GObj *func_80082E3C(struct _HSD_GObj *);

void func_800831CC(struct _HSD_GObj *, s32 (*)(struct _HSD_GObj *), void (*)(struct _HSD_GObj *));

void func_80083B68(struct _HSD_GObj *);

void func_80083F88(struct _HSD_GObj *);

void func_80084104(struct _HSD_GObj *);

f32 func_80084A40(struct _Fighter *); // Stage_GetGroundFrictionMultiplier very short function

void func_80084EEC(struct _HSD_GObj *);
void func_80084F3C(struct _HSD_GObj *);
void func_80084FA8(struct _HSD_GObj *);

void func_80085134(struct _HSD_GObj *);
void func_80085154(struct _HSD_GObj *);

void func_80085204(struct _HSD_GObj *);

void func_800852B0();
void func_8008549C();

Expand Down Expand Up @@ -739,8 +697,6 @@ void func_801C95C4(struct _HSD_GObj *);

s32 Stage_80225194(void);

void func_8026A8EC();

void func_8026ABD8(struct _HSD_GObj *, Vec *, f32);

BOOL func_8026B2B4(struct _HSD_GObj *);
Expand Down Expand Up @@ -900,7 +856,6 @@ void func_80390228(struct _HSD_GObj *);

void efLib_PauseAll(struct _HSD_GObj *);
void efLib_ResumeAll(struct _HSD_GObj *);
BOOL EnvColl_CheckGroundAndLedge(HSD_GObj *, s32);
s32 func_80096CC8(struct _HSD_GObj *);
void ef_Spawn(s32, ...);
f32 HSD_Randf(void);
Expand Down
43 changes: 22 additions & 21 deletions include/sysdolphin/baselib/gobj.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,33 +60,34 @@ typedef struct _HSD_GObjLibInitData
} HSD_GObjLibInitData;

typedef struct _HSD_GObjList {
struct _HSD_GObj *x0; //0x0
struct _HSD_GObj *x4; //0x4
struct _HSD_GObj *x8; //0x8
struct _HSD_GObj *xC; //0xC
struct _HSD_GObj *x10; //0x10
struct _HSD_GObj *x14; //0x14
struct _HSD_GObj *x18; //0x18
struct _HSD_GObj *x1C; //0x1C
struct _HSD_GObj *x20_fighters; //0x20
struct _HSD_GObj *x24; //0x24
struct _HSD_GObj *x28; //0x28
struct _HSD_GObj *x2C; //0x2C
struct _HSD_GObj *x30; //0x30
struct _HSD_GObj *x34; //0x34
struct _HSD_GObj *x38; //0x38
struct _HSD_GObj *x3C; //0x3C
struct _HSD_GObj *x40; //0x40
struct _HSD_GObj *x44; //0x44
struct _HSD_GObj *x48; //0x48
HSD_GObj *x0; //0x0
HSD_GObj *x4; //0x4
HSD_GObj *x8; //0x8
HSD_GObj *xC; //0xC
HSD_GObj *x10; //0x10
HSD_GObj *x14; //0x14
HSD_GObj *x18; //0x18
HSD_GObj *x1C; //0x1C
HSD_GObj *x20_fighters; //0x20
HSD_GObj *x24_items; //0x24
HSD_GObj *x28; //0x28
HSD_GObj *x2C; //0x2C
HSD_GObj *x30; //0x30
HSD_GObj *x34; //0x34
HSD_GObj *x38; //0x38
HSD_GObj *x3C; //0x3C
HSD_GObj *x40; //0x40
HSD_GObj *x44; //0x44
HSD_GObj *x48; //0x48
} HSD_GObjList;

#endif

extern u8 lbl_804D784B[5];
extern HSD_GObj* lbl_804D797C;
extern HSD_GObjList* lbl_804D782C;

void func_80390C5C(HSD_GObj *gobj);
void func_80390C84(HSD_GObj *gobj);
void func_80390CAC(HSD_GObj *gobj);
void func_803910D8(HSD_GObj *, s32);

#endif
6 changes: 0 additions & 6 deletions include/sysdolphin/baselib/objalloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ typedef struct _HSD_ObjAllocData {
struct _HSD_ObjAllocData* next;
} HSD_ObjAllocData;

struct r13_EntityPointers {
HSD_GObj* x0[8];
HSD_GObj* x20_fighterGObj;
HSD_GObj* x24_itemGObj;
};

typedef struct ItemCommonData
{
u32 x0;
Expand Down
2 changes: 0 additions & 2 deletions include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ extern void* lbl_804D6510;
extern void* lbl_804D6514;
extern void* lbl_804D6518;
extern void* lbl_804D651C;
extern void* lbl_804D6520;
extern void* lbl_804D6524;
extern void* lbl_804D6528;
// extern ? lbl_804D652C;
Expand All @@ -24,6 +23,5 @@ extern void* lbl_804D6544;
extern void* lbl_804D6548;
extern void* lbl_804D654C;
extern void* lbl_804D6550;
extern struct _ftCommonData* p_ftCommonData;
// extern ? lbl_804D4A00;
extern s32 g_debugLevel;
8 changes: 4 additions & 4 deletions obj_files.mk
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,15 @@ TEXT_O_FILES +=\
$(BUILD_DIR)/asm/melee/ft/ftparts.s.o\
$(BUILD_DIR)/src/melee/ft/ftcamera.c.o\
$(BUILD_DIR)/asm/melee/ft/ftcoll.s.o\
$(BUILD_DIR)/asm/melee/ft/code_8007C114.s.o\
$(BUILD_DIR)/asm/melee/ft/code_8007C630.s.o\
$(BUILD_DIR)/src/melee/ft/code_8007C114.c.o\
$(BUILD_DIR)/src/melee/ft/code_8007C630.c.o\
$(BUILD_DIR)/src/melee/ft/ftcommon.c.o\
$(BUILD_DIR)/src/melee/ft/ftdrawcommon.c.o\
$(BUILD_DIR)/asm/melee/ft/ftdrawcommon_data.s.o\
$(BUILD_DIR)/src/melee/ft/ftcliffcommon.c.o\
$(BUILD_DIR)/src/melee/ft/ftwalljump.c.o\
$(BUILD_DIR)/asm/melee/ft/code_80081938.s.o\
$(BUILD_DIR)/asm/melee/ft/code_80081B38.s.o\
$(BUILD_DIR)/src/melee/ft/code_80081938.c.o\
$(BUILD_DIR)/src/melee/ft/code_80081B38.c.o\
$(BUILD_DIR)/asm/melee/ft/ft_unknown_005.s.o\
$(BUILD_DIR)/asm/melee/ft/ftdata.s.o\
$(BUILD_DIR)/src/melee/ft/ftlib.c.o\
Expand Down
2 changes: 0 additions & 2 deletions src/melee/ft/chara/ftGameWatch/ftGameWatch_Attack11.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ void ftGameWatch_Attack11_IASA(HSD_GObj* fighter_gobj)
func_8008ACD8(fighter_gobj);
}

extern void func_80084FA8(HSD_GObj*);

// 0x8014C194 - Mr. Game & Watch's Jab Physics callback
void ftGameWatch_Attack11_Phys(HSD_GObj* fighter_gobj)
{
Expand Down
1 change: 0 additions & 1 deletion src/melee/ft/chara/ftGameWatch/ftGameWatch_AttackAir.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ void ftGameWatch_AttackAirN_Coll(HSD_GObj* fighter_gobj)
func_80082C74(fighter_gobj, ftGameWatch_LandingAirN_Action);
}

void func_800D5BF8(HSD_GObj*);
void ftGameWatch_LandingAirN_Init(HSD_GObj*);

// 0x8014B7A8
Expand Down
2 changes: 0 additions & 2 deletions src/melee/ft/chara/ftMasterHand/ftMasterHand_9.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,6 @@ void lbl_8015204C(HSD_GObj* gobj) {

// 80152090 14EC70
// https://decomp.me/scratch/B021s
void func_80085134(HSD_GObj*); /* extern */

void lbl_80152090(HSD_GObj* gobj) {
ftData* r4_ftData;
Fighter* r31_fp;
Expand Down
3 changes: 0 additions & 3 deletions src/melee/ft/chara/ftNess/ftNess_AttackHi4.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ void ftNess_YoyoApplyDamage(f32 unk_float, HSD_GObj* fighter_gobj) // Apply modi
// 0x80114FF8 //
// https://decomp.me/scratch/omC8O //

void func_80041EE4(CollData*);
void func_8004730C(CollData*, f32(*x)[6]);

inline void push_ecb(CollData* a, Vec3* b)
{
a->x1C_vec = a->x4_vec; // old = curr
Expand Down
1 change: 1 addition & 0 deletions src/melee/ft/chara/ftPikachu/ftpikachu4.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <ftpikachu.h>
#include <melee/ft/code_80081B38.h>

#define HALF_PI 1.5707963705062866f
#define DEG_TO_RAD 0.017453292f
Expand Down
Loading

0 comments on commit b3abf02

Please sign in to comment.