windcrest.c, windTribeFlag.c OK

This commit is contained in:
theo3 2020-06-16 10:31:22 -07:00
parent 90a9cd39be
commit 0105a247b8
6 changed files with 69 additions and 123 deletions

View File

@ -1,58 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start WindTribeFlag
WindTribeFlag: @ 0x0809CEC8
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xc]
cmp r0, #0
bne _0809CF06
adds r0, #1
strb r0, [r4, #0xc]
adds r1, r4, #0
adds r1, #0x38
movs r0, #2
strb r0, [r1]
ldrb r0, [r4, #0xa]
cmp r0, #0
bne _0809CEEE
ldrb r1, [r4, #0x18]
movs r0, #0x41
rsbs r0, r0, #0
ands r0, r1
b _0809CEF4
_0809CEEE:
ldrb r0, [r4, #0x18]
movs r1, #0x40
orrs r0, r1
_0809CEF4:
strb r0, [r4, #0x18]
adds r0, r4, #0
bl UpdateSpriteOrderAndFlip
adds r0, r4, #0
movs r1, #0
bl InitializeAnimation
b _0809CF0C
_0809CF06:
adds r0, r4, #0
bl sub_08004274
_0809CF0C:
adds r4, #0x59
ldrb r0, [r4]
cmp r0, #0xff
bne _0809CF20
bl Random
movs r1, #0xf
ands r0, r1
adds r0, #0x10
strb r0, [r4]
_0809CF20:
pop {r4, pc}
.align 2, 0

View File

@ -1,62 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start Windcrest
Windcrest: @ 0x080A20FC
push {r4, lr}
adds r4, r0, #0
ldrb r0, [r4, #0xc]
adds r1, r0, #0
cmp r1, #0
bne _080A2114
adds r0, #1
strb r0, [r4, #0xc]
strb r1, [r4, #0x1e]
adds r0, r4, #0
bl sub_0807DD64
_080A2114:
adds r0, r4, #0
movs r1, #0
bl sub_0807DDAC
adds r0, r4, #0
bl sub_0807DDE4
pop {r4, pc}
thumb_func_start sub_080A2124
sub_080A2124: @ 0x080A2124
push {lr}
ldr r3, _080A2134 @ =gUnk_08125010
movs r1, #1
movs r2, #0xe
bl sub_08078850
pop {pc}
.align 2, 0
_080A2134: .4byte gUnk_08125010
thumb_func_start sub_080A2138
sub_080A2138: @ 0x080A2138
push {r4, lr}
adds r4, r0, #0
movs r0, #0x72
bl PlaySFX
ldr r2, _080A2160 @ =gUnk_02002A40
ldrb r0, [r4, #0xb]
adds r0, #0x18
movs r1, #1
lsls r1, r0
ldr r0, [r2, #0x40]
orrs r0, r1
str r0, [r2, #0x40]
adds r0, r4, #0
movs r1, #0x46
movs r2, #0
bl CreateFx
pop {r4, pc}
.align 2, 0
_080A2160: .4byte gUnk_02002A40

View File

@ -109,7 +109,7 @@ typedef struct Entity {
struct Entity* parent;
struct Entity* attachedEntity;
u8 field_0x58;
u8 field_0x59;
u8 animTime;
union {
u8 all;
struct {

View File

@ -737,7 +737,7 @@ SECTIONS {
asm/object91.o(.text);
asm/bakerOven.o(.text);
asm/object93.o(.text);
asm/windTribeFlag.o(.text);
src/windTribeFlag.o(.text);
asm/bird.o(.text);
asm/object96.o(.text);
asm/object97.o(.text);
@ -777,7 +777,7 @@ SECTIONS {
asm/windTribeTeleporter.o(.text);
asm/objectB9.o(.text);
asm/objectBA.o(.text);
asm/windcrest.o(.text);
src/windcrest.o(.text);
asm/litArea.o(.text);
asm/objectBD.o(.text);
asm/pinwheel.o(.text);

25
src/windTribeFlag.c Normal file
View File

@ -0,0 +1,25 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
void WindTribeFlag(Entity *this)
{
if (this->action == 0) {
this->action++;
this->collisionLayer = 2;
if ((this->entityType).parameter1 == 0) {
this->spriteSettings.b.ss6 = 0;
}
else {
this->spriteSettings.b.ss6 = 1;
}
UpdateSpriteOrderAndFlip(this);
InitializeAnimation(this,0);
}
else {
sub_08004274(this);
}
if (this->animTime == 0xff) {
this->animTime = (Random() & 0xf) + 0x10;
}
}

41
src/windcrest.c Normal file
View File

@ -0,0 +1,41 @@
#include "global.h"
#include "entity.h"
#include "functions.h"
typedef struct {
u8 filler[64];
u32 windcrests;
} struct_02002A40;
extern void sub_0807DD64(Entity*);
extern void sub_0807DDAC(Entity*, u32);
extern void sub_0807DDE4(Entity*);
extern void sub_08078850(Entity*, u32, u32, u8*);
extern void PlaySFX(u32);
extern Entity* CreateFx (Entity*, u32, u32);
extern u8 gUnk_08125010;
extern struct_02002A40 gUnk_02002A40;
void Windcrest(Entity *this)
{
if (this->action == 0) {
this->action++;
this->animationList = 0;
sub_0807DD64(this);
}
sub_0807DDAC(this, 0);
sub_0807DDE4(this);
}
void sub_080A2124(Entity *this)
{
sub_08078850(this, 1, 0xe, &gUnk_08125010);
}
void Windcrest_Unlock(Entity *this)
{
PlaySFX(0x72);
gUnk_02002A40.windcrests = gUnk_02002A40.windcrests | 1 << (this->entityType.parameter2 + 0x18);
CreateFx(this, 0x46, 0);
}