func_8018A950 OK + macros.h + ABS (#2)

This commit is contained in:
Alejandro Asenjo 2022-10-15 19:17:26 -03:00 committed by GitHub
parent 722079c61d
commit 095ebbe09c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View File

@ -2,6 +2,7 @@
#define COMMON_H
#include "include_asm.h"
#include "macros.h"
#include "types.h"
#endif

2
include/macros.h Normal file
View File

@ -0,0 +1,2 @@
#define ABS(x) ((x) >= 0 ? (x) : -(x))
#define ABS_ALT(x) ((x) < 0 ? -(x) : (x))

View File

@ -493,7 +493,21 @@ void func_8018A8D4(u16 objectId, Entity *source, Entity *entity) {
}
#endif
INCLUDE_ASM("asm/st/wrp/nonmatchings/6FD0", func_8018A950);
s32 func_8018A950(Unkstruct5 *arg0) {
s16 var_v0_2;
var_v0_2 = (u16)D_800733DA - arg0->unk2;
var_v0_2 = ABS_ALT(var_v0_2);
if (var_v0_2 >= 0x11) {
var_v0_2 = 0;
} else {
var_v0_2 = (u16)D_800733DE - arg0->unk6;
var_v0_2 = ABS_ALT(var_v0_2);
var_v0_2 = var_v0_2 < 0x21;
}
return var_v0_2;
}
INCLUDE_ASM("asm/st/wrp/nonmatchings/6FD0", func_8018A9C8);