diff options
| author | notyouraveragehooman <65437533+notyouraveragehooman@users.noreply.github.com> | 2020-08-05 20:59:51 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-05 20:59:51 -0700 |
| commit | cfaae3f47f3c6a84586389ddbefe1629486d3318 (patch) | |
| tree | df742958fd185bbf0c131d299ff5cfd911d0c3cc /src | |
| parent | dd5b9001766de50a676c95f85ead61b0c39a7305 (diff) | |
| parent | c73ef05b3d0add77917a61e9a4f67d20b4a6ed48 (diff) | |
Merge pull request #41 from notyouraveragehooman/master
wisp.c OK, misc code
Diffstat (limited to 'src')
| -rw-r--r-- | src/code_0807CC3C.c | 25 | ||||
| -rw-r--r-- | src/code_080808D8.c | 25 | ||||
| -rw-r--r-- | src/code_0808091C.c | 30 | ||||
| -rw-r--r-- | src/enemy/bombPeahat.c | 1 | ||||
| -rw-r--r-- | src/enemy/wisp.c | 149 | ||||
| -rw-r--r-- | src/npc/zeldaFollower.c | 25 | ||||
| -rw-r--r-- | src/room.c | 2 | ||||
| -rw-r--r-- | src/sub_0807C998.c | 19 |
8 files changed, 242 insertions, 34 deletions
diff --git a/src/code_0807CC3C.c b/src/code_0807CC3C.c index b5b1c4ee..e0cbbe90 100644 --- a/src/code_0807CC3C.c +++ b/src/code_0807CC3C.c @@ -7,6 +7,9 @@ extern void (*const gUnk_0811E478[])(u32); extern s16 gUnk_02021EE0[6]; +extern char gUnk_0811E484[]; +extern char gUnk_0811E4AC[]; +extern char gUnk_0811E4A4[]; void sub_0807CD9C() { sub_080530C8(); @@ -69,8 +72,6 @@ s32 sub_0807CE54(void) { return uVar1; } -extern char gUnk_0811E484[]; - u32 sub_0807CE90(void) { struct_0807D1C4 *puVar1; @@ -123,3 +124,23 @@ u32 sub_0807CF30(void* arg0) { u32 sub_0807CF3C(void* arg0) { return sub_0807D008(5, arg0); } + +void sub_0807CF48(u32 arg0) +{ + struct_0807D1C4 *temp; + + temp = sub_0807D1C4(arg0); + sub_0807D184(temp->field_0x4, gUnk_0811E4AC); + sub_0807D184(temp->field_0x2, gUnk_0811E4AC); +} + +void sub_0807CF68(u32 arg0) +{ + struct_0807D1C4 *temp; + char* str; + + temp = sub_0807D1C4(arg0); + str = gUnk_0811E4A4; + sub_0807D184(temp->field_0x4, str); + sub_0807D184(temp->field_0x2, str); +}
\ No newline at end of file diff --git a/src/code_080808D8.c b/src/code_080808D8.c deleted file mode 100644 index e9b9f8f5..00000000 --- a/src/code_080808D8.c +++ /dev/null @@ -1,25 +0,0 @@ -#include "global.h" -#include "entity.h" -#include "structures.h" -#include "functions.h" - -void sub_080808D8(void) { - gScreenTransition.transitionType = 0; -} - -void sub_080808E4(void) { - - if (sub_08052638(gScreenTransition.areaID)) { - gScreenTransition.transitionType = 0; - } else { - gScreenTransition.transitionType = 5; - } -} - -void sub_08080904(void) { - gScreenTransition.transitionType = 1; -} - -void sub_08080910(void) { - gScreenTransition.transitionType = 1; -}
\ No newline at end of file diff --git a/src/code_0808091C.c b/src/code_0808091C.c index 1607ddf0..dcb86728 100644 --- a/src/code_0808091C.c +++ b/src/code_0808091C.c @@ -1,4 +1,7 @@ #include "global.h" +#include "entity.h" +#include "structures.h" +#include "functions.h" #include "room.h" extern void sub_0805E5A8(); @@ -6,16 +9,35 @@ extern void sub_0805E5A8(); extern RoomControls gRoomControls; extern u32 gUnk_0200B650; extern u32 gUnk_02025EB0; -extern u8 gScreenTransition[10]; -extern void DoExitTransition(Entity*); +extern void DoExitTransition(ScreenTransitionData*); extern void sub_080809D4(); -void sub_0808091C(Entity* param_1, u32 param_2) +void sub_080808D8(void) { + gScreenTransition.transitionType = 0; +} + +void sub_080808E4(void) { + + if (sub_08052638(gScreenTransition.areaID)) { + gScreenTransition.transitionType = 0; + } else { + gScreenTransition.transitionType = 5; + } +} + +void sub_08080904(void) { + gScreenTransition.transitionType = 1; +} + +void sub_08080910(void) { + gScreenTransition.transitionType = 1; +} +void sub_0808091C(ScreenTransitionData* param_1, u32 param_2) { DoExitTransition(param_1); - gScreenTransition[9] = param_2; + gScreenTransition.transitionType = param_2; return; } diff --git a/src/enemy/bombPeahat.c b/src/enemy/bombPeahat.c index da782b85..1dc3d30f 100644 --- a/src/enemy/bombPeahat.c +++ b/src/enemy/bombPeahat.c @@ -8,7 +8,6 @@ extern u32 GetNextFunction(Entity*); extern void sub_0802AD54(Entity*); extern void sub_0802B048(Entity*); extern void sub_0806F4E8(Entity*); -extern void sub_0806F3E4(Entity*); extern void (*const gUnk_080012C8[])(Entity*); extern void (*const gUnk_080CD0F0[])(Entity*); diff --git a/src/enemy/wisp.c b/src/enemy/wisp.c new file mode 100644 index 00000000..d6729201 --- /dev/null +++ b/src/enemy/wisp.c @@ -0,0 +1,149 @@ +#include "global.h" +#include "entity.h" +#include "enemy.h" +#include "structures.h" +#include "link.h" +#include "functions.h" + +extern void (*const gUnk_080CEB74[])(Entity*); +extern void (*const gUnk_080CEB8C[])(Entity*); +extern void (*const gUnk_080CEB98[])(Entity*); + +extern u8 gUnk_080CEBA4[]; + +void Wisp(Entity* this) { + EnemyFunctionHandler(this, gUnk_080CEB74); +} + +void sub_0803354C(Entity* this) { + gUnk_080CEB8C[this->action](this); +} + +void sub_08033564(Entity* this) { + u32 bits; + Entity* ent; + + bits = this->bitfield; + if ((bits & 0x80) == 0) { + return; + } + + switch ((s32)bits & 0x3f) { + case 0: + this->action = 2; + this->spriteSettings.b.draw = FALSE; + this->flags &= 0x7f; + this->field_0x7c.HALF.LO = 0x27c; + gLinkState.flags.all |= 0x4000; + gUnk_02002A40.stats.filler2[4] = this->entityType.form + 1; + gUnk_02002A40.stats.field_0x20 = 600; + if (this->entityType.form == 0) { + break; + } + DeleteThisEntity(); + break; + case 0xe: + case 0x15: + this->currentHealth = 0; + break; + case 0x14: + this->flags &= 0x7f; + this->hurtBlinkTime = 0; + this->spriteSettings.b.draw = FALSE; + ent = CreateFx(this, 2, 0); + if (ent != NULL) { + this->attachedEntity = ent; + this->actionDelay = 0xe; + CopyPosition(this, ent); + } + DeleteThisEntity(); + break; + } +} + +void sub_0803362C(Entity* this) { + if (sub_0806F520() != 0) { + gUnk_080CEB98[this->previousActionFlag](this); + } +} + +void sub_08033650(Entity* this) { + this->previousActionFlag = 2; +} + +void sub_08033658(Entity* this) { + sub_0806F4E8(); +} + +void sub_08033660(Entity* this) { + if (sub_0806F3E4(this)) { + sub_0804A7D4(this); + } +} + +void sub_08033674(Entity* this) { + sub_0804A720(this); + this->actionDelay = 0; + this->action = 1; + this->filler[0] = 1; + this->field_0x80.HWORD = this->x.HALF.HI; + this->field_0x82.HWORD = this->y.HALF.HI; + sub_08033744(this); + InitializeAnimation(this, this->entityType.parameter); +} + +void sub_080336A8(Entity* this) { + if (--this->actionDelay == 0) { + sub_08033744(this); + } else if (this->collisions != 0) { + sub_0800417E(this, this->collisions); + } + sub_080AEF88(this); + GetNextFrame(this); +} + +void sub_080336DC(Entity* this) { + switch ((u16)-- this->field_0x7c.HALF.LO) { + case 0x24: + this->x.HALF.HI = this->field_0x80.HWORD; + this->y.HALF.HI = this->field_0x82.HWORD; + break; + case 0x18: + sub_080A29BC(this); + break; + case 0xc: + this->spriteSettings.b.draw = TRUE; + break; + case 0x0: + this->action = 1; + this->flags |= 0x80; + sub_08033744(this); + break; + } +} + +void sub_08033744(Entity* this) { + u32 temp; + u32 rand = (u32)Random() % 256; + + // 8 potential options + this->actionDelay = gUnk_080CEBA4[(rand & 0x70) >> 4]; + + // 4 potential options + temp = ((rand & 0xc) * 2); + + // 75% chance to pass + if ((sub_08049FA0(this) == 0) && ((rand % 4) != 0)) { + temp = sub_08049EE4(this); + + // 50% chance to pass + if ((rand & 0x80) != 0) { + temp += 0x4; + temp &= 0x18; + } else { + temp += 0x1c; + temp &= 0x18; + } + } + this->direction = temp; +}
\ No newline at end of file diff --git a/src/npc/zeldaFollower.c b/src/npc/zeldaFollower.c new file mode 100644 index 00000000..3dec4d10 --- /dev/null +++ b/src/npc/zeldaFollower.c @@ -0,0 +1,25 @@ +#include "global.h" +#include "entity.h" +#include "functions.h" + +extern void sub_08068318(Entity*); +extern void sub_0806854C(Entity*, u32); + +void ZeldaFollower(Entity *this) +{ + if (this->action == 0) { + this->action++; + this->spriteSettings.b.draw = TRUE; + this->animationState = 4; + this->field_0x68.HALF.LO = 0; + this->field_0x68.HALF.HI = 0; + sub_0805E3A0(this, 2); + InitAnimationForceUpdate(this, 0); + sub_0806854C(this, 0); + } + if ((s8)this->field_0x68.HALF.LO != 0) { + sub_08068318(this); + } else { + this->spriteSettings.b.draw = FALSE; + } +}
\ No newline at end of file @@ -665,7 +665,7 @@ void sub_0804BC70(void) { } } -extern u32 gUnk_0813AB80; +extern ScreenTransitionData gUnk_0813AB80; void sub_0804BCDC() { sub_0808091C(&gUnk_0813AB80, 4); diff --git a/src/sub_0807C998.c b/src/sub_0807C998.c index a1d16fdf..bc31e322 100644 --- a/src/sub_0807C998.c +++ b/src/sub_0807C998.c @@ -1,12 +1,29 @@ #include "global.h" +#include "entity.h" extern void sub_0807C960(); extern u32 gUnk_0202CEB4; extern u32 gUnk_02012654; +extern u8 gUnk_08324AE4; + +void sub_0807C960(void* dest, u32 offset) +{ + void* temp; + + if (offset != -1) { + temp = &gUnk_08324AE4 + (offset & 0x7fffffff); + if ((u32)dest >> 0x18 == 6) { + LZ77UnCompVram(temp, (void *)dest); + } + else { + LZ77UnCompWram(temp, (void *)dest); + } + } +} void sub_0807C998(u32* a1) { sub_0807C960(&gUnk_0202CEB4, a1[0]); sub_0807C960(&gUnk_0202CEB4 - 0x800, a1[1]); sub_0807C960(&gUnk_02012654, a1[2]); sub_0807C960(&gUnk_02012654 - 0x800, a1[3]); -} +}
\ No newline at end of file |
