1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 09:45:02 +00:00

Decomp BgYdanMaruta (#338)

* Fix

* fix

* Fixed upstream

* PR fixes

* PR fixes

* Fix ZAP2.  Hopefully
This commit is contained in:
louist103 2020-08-23 06:44:22 -04:00 committed by GitHub
parent 6f54edd365
commit dea5f4aae5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 189 additions and 221 deletions

View file

@ -1,24 +0,0 @@
glabel BgYdanMaruta_Destroy
/* 00260 808BEFA0 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8
/* 00264 808BEFA4 00803825 */ or $a3, $a0, $zero ## $a3 = 00000000
/* 00268 808BEFA8 AFBF0014 */ sw $ra, 0x0014($sp)
/* 0026C 808BEFAC AFA5001C */ sw $a1, 0x001C($sp)
/* 00270 808BEFB0 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000
/* 00274 808BEFB4 24E5016C */ addiu $a1, $a3, 0x016C ## $a1 = 0000016C
/* 00278 808BEFB8 0C017232 */ jal Collider_DestroyTris
/* 0027C 808BEFBC AFA70018 */ sw $a3, 0x0018($sp)
/* 00280 808BEFC0 8FA70018 */ lw $a3, 0x0018($sp)
/* 00284 808BEFC4 8FA4001C */ lw $a0, 0x001C($sp)
/* 00288 808BEFC8 24010001 */ addiu $at, $zero, 0x0001 ## $at = 00000001
/* 0028C 808BEFCC 84EE001C */ lh $t6, 0x001C($a3) ## 0000001C
/* 00290 808BEFD0 24850810 */ addiu $a1, $a0, 0x0810 ## $a1 = 00000810
/* 00294 808BEFD4 55C10004 */ bnel $t6, $at, .L808BEFE8
/* 00298 808BEFD8 8FBF0014 */ lw $ra, 0x0014($sp)
/* 0029C 808BEFDC 0C00FB56 */ jal DynaPolyInfo_Free
## DynaPolyInfo_delReserve
/* 002A0 808BEFE0 8CE6014C */ lw $a2, 0x014C($a3) ## 0000014C
/* 002A4 808BEFE4 8FBF0014 */ lw $ra, 0x0014($sp)
.L808BEFE8:
/* 002A8 808BEFE8 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000
/* 002AC 808BEFEC 03E00008 */ jr $ra
/* 002B0 808BEFF0 00000000 */ nop

View file

@ -1,26 +0,0 @@
glabel BgYdanMaruta_Draw
/* 0054C 808BF28C 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8
/* 00550 808BF290 AFBF0014 */ sw $ra, 0x0014($sp)
/* 00554 808BF294 848E001C */ lh $t6, 0x001C($a0) ## 0000001C
/* 00558 808BF298 00A03025 */ or $a2, $a1, $zero ## $a2 = 00000000
/* 0055C 808BF29C 00C02025 */ or $a0, $a2, $zero ## $a0 = 00000000
/* 00560 808BF2A0 15C00007 */ bne $t6, $zero, .L808BF2C0
/* 00564 808BF2A4 00000000 */ nop
/* 00568 808BF2A8 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000
/* 0056C 808BF2AC 3C050601 */ lui $a1, 0x0601 ## $a1 = 06010000
/* 00570 808BF2B0 0C00D498 */ jal Gfx_DrawDListOpa
/* 00574 808BF2B4 24A58D88 */ addiu $a1, $a1, 0x8D88 ## $a1 = 06008D88
/* 00578 808BF2B8 10000005 */ beq $zero, $zero, .L808BF2D0
/* 0057C 808BF2BC 8FBF0014 */ lw $ra, 0x0014($sp)
.L808BF2C0:
/* 00580 808BF2C0 3C050600 */ lui $a1, 0x0600 ## $a1 = 06000000
/* 00584 808BF2C4 0C00D498 */ jal Gfx_DrawDListOpa
/* 00588 808BF2C8 24A56570 */ addiu $a1, $a1, 0x6570 ## $a1 = 06006570
/* 0058C 808BF2CC 8FBF0014 */ lw $ra, 0x0014($sp)
.L808BF2D0:
/* 00590 808BF2D0 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000
/* 00594 808BF2D4 03E00008 */ jr $ra
/* 00598 808BF2D8 00000000 */ nop
/* 0059C 808BF2DC 00000000 */ nop

View file

@ -24,12 +24,12 @@ glabel BgYdanMaruta_Init
/* 00054 808BED94 02003025 */ or $a2, $s0, $zero ## $a2 = 00000000
/* 00058 808BED98 8619001C */ lh $t9, 0x001C($s0) ## 0000001C
/* 0005C 808BED9C 8618001C */ lh $t8, 0x001C($s0) ## 0000001C
/* 00060 808BEDA0 3C11808C */ lui $s1, %hi(D_808BF33C) ## $s1 = 808C0000
/* 00060 808BEDA0 3C11808C */ lui $s1, %hi(D_808BF300+0x3C) ## $s1 = 808C0000
/* 00064 808BEDA4 00194203 */ sra $t0, $t9, 8
/* 00068 808BEDA8 310900FF */ andi $t1, $t0, 0x00FF ## $t1 = 00000000
/* 0006C 808BEDAC A609001C */ sh $t1, 0x001C($s0) ## 0000001C
/* 00070 808BEDB0 860A001C */ lh $t2, 0x001C($s0) ## 0000001C
/* 00074 808BEDB4 2631F33C */ addiu $s1, $s1, %lo(D_808BF33C) ## $s1 = 808BF33C
/* 00074 808BEDB4 2631F33C */ addiu $s1, $s1, %lo(D_808BF300+0x3C) ## $s1 = 808BF33C
/* 00078 808BEDB8 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 0007C 808BEDBC 15400007 */ bne $t2, $zero, .L808BEDDC
/* 00080 808BEDC0 A2180168 */ sb $t8, 0x0168($s0) ## 00000168
@ -67,8 +67,8 @@ glabel BgYdanMaruta_Init
/* 000EC 808BEE2C 10400007 */ beq $v0, $zero, .L808BEE4C
/* 000F0 808BEE30 3C0D808C */ lui $t5, %hi(func_808BF078) ## $t5 = 808C0000
/* 000F4 808BEE34 C60A000C */ lwc1 $f10, 0x000C($s0) ## 0000000C
/* 000F8 808BEE38 3C0C808C */ lui $t4, %hi(func_808BF25C) ## $t4 = 808C0000
/* 000FC 808BEE3C 258CF25C */ addiu $t4, $t4, %lo(func_808BF25C) ## $t4 = 808BF25C
/* 000F8 808BEE38 3C0C808C */ lui $t4, %hi(BgYdanMaruta_DoNothing) ## $t4 = 808C0000
/* 000FC 808BEE3C 258CF25C */ addiu $t4, $t4, %lo(BgYdanMaruta_DoNothing) ## $t4 = 808BF25C
/* 00100 808BEE40 AE0C0164 */ sw $t4, 0x0164($s0) ## 00000164
/* 00104 808BEE44 10000003 */ beq $zero, $zero, .L808BEE54
/* 00108 808BEE48 E60A0028 */ swc1 $f10, 0x0028($s0) ## 00000028

View file

@ -1,10 +0,0 @@
glabel BgYdanMaruta_Update
/* 00528 808BF268 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8
/* 0052C 808BF26C AFBF0014 */ sw $ra, 0x0014($sp)
/* 00530 808BF270 8C990164 */ lw $t9, 0x0164($a0) ## 00000164
/* 00534 808BF274 0320F809 */ jalr $ra, $t9
/* 00538 808BF278 00000000 */ nop
/* 0053C 808BF27C 8FBF0014 */ lw $ra, 0x0014($sp)
/* 00540 808BF280 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000
/* 00544 808BF284 03E00008 */ jr $ra
/* 00548 808BF288 00000000 */ nop

View file

@ -1,36 +0,0 @@
glabel func_808BEFF4
/* 002B4 808BEFF4 27BDFFD8 */ addiu $sp, $sp, 0xFFD8 ## $sp = FFFFFFD8
/* 002B8 808BEFF8 AFBF0024 */ sw $ra, 0x0024($sp)
/* 002BC 808BEFFC AFB00020 */ sw $s0, 0x0020($sp)
/* 002C0 808BF000 AFA5002C */ sw $a1, 0x002C($sp)
/* 002C4 808BF004 908E017C */ lbu $t6, 0x017C($a0) ## 0000017C
/* 002C8 808BF008 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000
/* 002CC 808BF00C 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000
/* 002D0 808BF010 31CF0002 */ andi $t7, $t6, 0x0002 ## $t7 = 00000000
/* 002D4 808BF014 11E00007 */ beq $t7, $zero, .L808BF034
/* 002D8 808BF018 02002825 */ or $a1, $s0, $zero ## $a1 = 00000000
/* 002DC 808BF01C 3C0140C0 */ lui $at, 0x40C0 ## $at = 40C00000
/* 002E0 808BF020 44812000 */ mtc1 $at, $f4 ## $f4 = 6.00
/* 002E4 808BF024 860700B6 */ lh $a3, 0x00B6($s0) ## 000000B6
/* 002E8 808BF028 3C0640E0 */ lui $a2, 0x40E0 ## $a2 = 40E00000
/* 002EC 808BF02C 0C00BDC7 */ jal func_8002F71C
/* 002F0 808BF030 E7A40010 */ swc1 $f4, 0x0010($sp)
.L808BF034:
/* 002F4 808BF034 861800B4 */ lh $t8, 0x00B4($s0) ## 000000B4
/* 002F8 808BF038 3C010001 */ lui $at, 0x0001 ## $at = 00010000
/* 002FC 808BF03C 34211E60 */ ori $at, $at, 0x1E60 ## $at = 00011E60
/* 00300 808BF040 27190360 */ addiu $t9, $t8, 0x0360 ## $t9 = 00000360
/* 00304 808BF044 A61900B4 */ sh $t9, 0x00B4($s0) ## 000000B4
/* 00308 808BF048 8FA4002C */ lw $a0, 0x002C($sp)
/* 0030C 808BF04C 2606016C */ addiu $a2, $s0, 0x016C ## $a2 = 0000016C
/* 00310 808BF050 0C0175E7 */ jal CollisionCheck_SetAT
## CollisionCheck_setAT
/* 00314 808BF054 00812821 */ addu $a1, $a0, $at
/* 00318 808BF058 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 0031C 808BF05C 0C00BE5D */ jal func_8002F974
/* 00320 808BF060 240520EC */ addiu $a1, $zero, 0x20EC ## $a1 = 000020EC
/* 00324 808BF064 8FBF0024 */ lw $ra, 0x0024($sp)
/* 00328 808BF068 8FB00020 */ lw $s0, 0x0020($sp)
/* 0032C 808BF06C 27BD0028 */ addiu $sp, $sp, 0x0028 ## $sp = 00000000
/* 00330 808BF070 03E00008 */ jr $ra
/* 00334 808BF074 00000000 */ nop

View file

@ -1,41 +0,0 @@
glabel func_808BF078
/* 00338 808BF078 27BDFFE0 */ addiu $sp, $sp, 0xFFE0 ## $sp = FFFFFFE0
/* 0033C 808BF07C AFBF001C */ sw $ra, 0x001C($sp)
/* 00340 808BF080 AFA50024 */ sw $a1, 0x0024($sp)
/* 00344 808BF084 908E017D */ lbu $t6, 0x017D($a0) ## 0000017D
/* 00348 808BF088 3C010001 */ lui $at, 0x0001 ## $at = 00010000
/* 0034C 808BF08C 00803825 */ or $a3, $a0, $zero ## $a3 = 00000000
/* 00350 808BF090 31CF0002 */ andi $t7, $t6, 0x0002 ## $t7 = 00000000
/* 00354 808BF094 11E00014 */ beq $t7, $zero, .L808BF0E8
/* 00358 808BF098 34211E60 */ ori $at, $at, 0x1E60 ## $at = 00011E60
/* 0035C 808BF09C 24180014 */ addiu $t8, $zero, 0x0014 ## $t8 = 00000014
/* 00360 808BF0A0 A498016A */ sh $t8, 0x016A($a0) ## 0000016A
/* 00364 808BF0A4 90E50168 */ lbu $a1, 0x0168($a3) ## 00000168
/* 00368 808BF0A8 AFA70020 */ sw $a3, 0x0020($sp)
/* 0036C 808BF0AC 0C00B2DD */ jal Flags_SetSwitch
/* 00370 808BF0B0 8FA40024 */ lw $a0, 0x0024($sp)
/* 00374 808BF0B4 0C01E221 */ jal func_80078884
/* 00378 808BF0B8 24044802 */ addiu $a0, $zero, 0x4802 ## $a0 = 00004802
/* 0037C 808BF0BC 8FA70020 */ lw $a3, 0x0020($sp)
/* 00380 808BF0C0 3C19808C */ lui $t9, %hi(func_808BF108) ## $t9 = 808C0000
/* 00384 808BF0C4 2739F108 */ addiu $t9, $t9, %lo(func_808BF108) ## $t9 = 808BF108
/* 00388 808BF0C8 ACF90164 */ sw $t9, 0x0164($a3) ## 00000164
/* 0038C 808BF0CC AFA00010 */ sw $zero, 0x0010($sp)
/* 00390 808BF0D0 8FA40024 */ lw $a0, 0x0024($sp)
/* 00394 808BF0D4 24050BC2 */ addiu $a1, $zero, 0x0BC2 ## $a1 = 00000BC2
/* 00398 808BF0D8 0C02003E */ jal func_800800F8
/* 0039C 808BF0DC 24060032 */ addiu $a2, $zero, 0x0032 ## $a2 = 00000032
/* 003A0 808BF0E0 10000006 */ beq $zero, $zero, .L808BF0FC
/* 003A4 808BF0E4 8FBF001C */ lw $ra, 0x001C($sp)
.L808BF0E8:
/* 003A8 808BF0E8 8FA40024 */ lw $a0, 0x0024($sp)
/* 003AC 808BF0EC 24E6016C */ addiu $a2, $a3, 0x016C ## $a2 = 0000016C
/* 003B0 808BF0F0 0C01767D */ jal CollisionCheck_SetAC
## CollisionCheck_setAC
/* 003B4 808BF0F4 00812821 */ addu $a1, $a0, $at
/* 003B8 808BF0F8 8FBF001C */ lw $ra, 0x001C($sp)
.L808BF0FC:
/* 003BC 808BF0FC 27BD0020 */ addiu $sp, $sp, 0x0020 ## $sp = 00000000
/* 003C0 808BF100 03E00008 */ jr $ra
/* 003C4 808BF104 00000000 */ nop

View file

@ -1,32 +0,0 @@
glabel func_808BF1EC
/* 004AC 808BF1EC 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8
/* 004B0 808BF1F0 AFBF0014 */ sw $ra, 0x0014($sp)
/* 004B4 808BF1F4 AFA5001C */ sw $a1, 0x001C($sp)
/* 004B8 808BF1F8 3C013F80 */ lui $at, 0x3F80 ## $at = 3F800000
/* 004BC 808BF1FC 44813000 */ mtc1 $at, $f6 ## $f6 = 1.00
/* 004C0 808BF200 C4840060 */ lwc1 $f4, 0x0060($a0) ## 00000060
/* 004C4 808BF204 00803825 */ or $a3, $a0, $zero ## $a3 = 00000000
/* 004C8 808BF208 24840028 */ addiu $a0, $a0, 0x0028 ## $a0 = 00000028
/* 004CC 808BF20C 46062200 */ add.s $f8, $f4, $f6
/* 004D0 808BF210 E4880038 */ swc1 $f8, 0x0038($a0) ## 00000060
/* 004D4 808BF214 8CE60060 */ lw $a2, 0x0060($a3) ## 00000060
/* 004D8 808BF218 8CE5000C */ lw $a1, 0x000C($a3) ## 0000000C
/* 004DC 808BF21C 0C01DE80 */ jal Math_ApproxF
/* 004E0 808BF220 AFA70018 */ sw $a3, 0x0018($sp)
/* 004E4 808BF224 10400009 */ beq $v0, $zero, .L808BF24C
/* 004E8 808BF228 8FA70018 */ lw $a3, 0x0018($sp)
/* 004EC 808BF22C 00E02025 */ or $a0, $a3, $zero ## $a0 = 00000000
/* 004F0 808BF230 24052860 */ addiu $a1, $zero, 0x2860 ## $a1 = 00002860
/* 004F4 808BF234 0C00BE0A */ jal Audio_PlayActorSound2
/* 004F8 808BF238 AFA70018 */ sw $a3, 0x0018($sp)
/* 004FC 808BF23C 8FA70018 */ lw $a3, 0x0018($sp)
/* 00500 808BF240 3C0E808C */ lui $t6, %hi(func_808BF25C) ## $t6 = 808C0000
/* 00504 808BF244 25CEF25C */ addiu $t6, $t6, %lo(func_808BF25C) ## $t6 = 808BF25C
/* 00508 808BF248 ACEE0164 */ sw $t6, 0x0164($a3) ## 00000164
.L808BF24C:
/* 0050C 808BF24C 8FBF0014 */ lw $ra, 0x0014($sp)
/* 00510 808BF250 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000
/* 00514 808BF254 03E00008 */ jr $ra
/* 00518 808BF258 00000000 */ nop

View file

@ -1,4 +0,0 @@
glabel func_808BF25C
/* 0051C 808BF25C AFA40000 */ sw $a0, 0x0000($sp)
/* 00520 808BF260 03E00008 */ jr $ra
/* 00524 808BF264 AFA50004 */ sw $a1, 0x0004($sp)

View file

@ -1,27 +0,0 @@
.include "macro.inc"
# assembler directives
.set noat # allow manual use of $at
.set noreorder # don't insert nops after branches
.set gp=64 # allow use of 64-bit general purpose registers
.section .data
.balign 16
glabel Bg_Ydan_Maruta_InitVars
.word 0x00510600, 0x00000000, 0x00360000, 0x00000244
.word BgYdanMaruta_Init
.word BgYdanMaruta_Destroy
.word BgYdanMaruta_Update
.word BgYdanMaruta_Draw
glabel D_808BF300
.word 0x00000000, 0x20000000, 0x00040000, 0x00000004, 0x00000000, 0x11010000, 0x435C0000, 0xC1200000, 0x00000000, 0x435C0000, 0x41200000, 0x00000000, 0xC35C0000, 0x41200000, 0x00000000
glabel D_808BF33C
.word 0x00000000, 0x20000000, 0x00040000, 0x00000004, 0x00000000, 0x11010000, 0x41800000, 0x00000000, 0x00000000, 0x41800000, 0x43070000, 0x00000000, 0xC1800000, 0x43070000, 0x00000000
glabel D_808BF378
.word 0x0A110900, 0x20020000, 0x00000002
.word D_808BF300
glabel D_808BF388
.word 0x48500064, 0x00000000

5
spec
View file

@ -1434,8 +1434,11 @@ endseg
beginseg
name "ovl_Bg_Ydan_Maruta"
include "build/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.o"
include "build/data/overlays/actors/z_bg_ydan_maruta.data.o"
#ifdef NON_MATCHING
include "build/src/overlays/actors/ovl_Bg_Ydan_Maruta/ovl_Bg_Ydan_Maruta_reloc.o"
#else
include "build/data/overlays/actors/z_bg_ydan_maruta.reloc.o"
#endif
endseg
beginseg

View file

@ -69,7 +69,7 @@ void func_80897970(BgJyaGoroiwa* this) {
void func_808979C0(BgJyaGoroiwa* this, GlobalContext* globalCtx) {
s32 pad;
Collider_InitJntSph(globalCtx, &this->collider);
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, &this->colliderItem);
func_80897970(this);

View file

@ -107,7 +107,8 @@ void BgMoriElevator_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->dyna.actor, sInitChain);
DynaPolyInfo_SetActorMove(&this->dyna, DPM_PLAYER);
DynaPolyInfo_Alloc(&D_060035F8, &localConst);
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, localConst);
this->dyna.dynaPolyId =
DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, localConst);
BgMoriElevator_SetupWaitAfterInit(this);
break;
case 1:

View file

@ -1,3 +1,9 @@
/*
* File: z_bg_ydan_maruta.c
* Overlay: ovl_Bg_Ydan_Maruta
* Description: Rotating spike log in Deku Tree
*/
#include "z_bg_ydan_maruta.h"
#define FLAGS 0x00000000
@ -9,7 +15,11 @@ void BgYdanMaruta_Destroy(Actor* thisx, GlobalContext* globalCtx);
void BgYdanMaruta_Update(Actor* thisx, GlobalContext* globalCtx);
void BgYdanMaruta_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
void func_808BEFF4(BgYdanMaruta* this, GlobalContext* globalCtx);
void BgYdanMaruta_DoNothing(BgYdanMaruta* this, GlobalContext* globalCtx);
void func_808BF078(BgYdanMaruta* this, GlobalContext* globalCtx);
void func_808BF108(BgYdanMaruta* this, GlobalContext* globalCtx);
const ActorInit Bg_Ydan_Maruta_InitVars = {
ACTOR_BG_YDAN_MARUTA,
ACTORTYPE_PROP,
@ -21,21 +31,164 @@ const ActorInit Bg_Ydan_Maruta_InitVars = {
(ActorFunc)BgYdanMaruta_Update,
(ActorFunc)BgYdanMaruta_Draw,
};
*/
ColliderTrisItemInit D_808BF300[2] = {
{
{ 0x00, { 0x20000000, 0x00, 0x04 }, { 0x00000004, 0x00, 0x00 }, 0x11, 0x01, 0x00 },
{ { { 220.0f, -10.0f, 0.0f }, { 220.0f, 10.0f, 0.0f }, { -220.0f, 10.0f, 0.0f } } },
},
{
{ 0x00, { 0x20000000, 0x00, 0x04 }, { 0x00000004, 0x00, 0x00 }, 0x11, 0x01, 0x00 },
{ { { 16.0f, 0.0f, 0.0f }, { 16.0f, 135.0f, 0.0f }, { -16.0f, 135.0f, 0.0f } } },
},
};
ColliderTrisInit D_808BF378 = {
{ COLTYPE_UNK10, 0x11, 0x09, 0x00, 0x20, COLSHAPE_TRIS },
2,
D_808BF300,
};
InitChainEntry D_808BF388[] = {
ICHAIN_VEC3F_DIV1000(scale, 100, ICHAIN_STOP),
};
extern UNK_TYPE D_060066A8;
extern Gfx D_06008D88[];
extern Gfx D_06006570[];
#ifdef NON_MATCHING
// Register issues
void BgYdanMaruta_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 i;
BgYdanMaruta* this = THIS;
Vec3f sp4C[3];
s32 pad;
f32 sinRotY;
f32 cosRotY;
s32 localConst = 0;
ColliderTrisItemInit* items;
Actor_ProcessInitChain(thisx, D_808BF388);
Collider_InitTris(globalCtx, &this->collider);
Collider_SetTris(globalCtx, &this->collider, thisx, &D_808BF378, &this->colliderItems);
this->unk_168 = thisx->params;
thisx->params = ((thisx->params >> 8) & 0xFF) & 0xFF;
items = &D_808BF300[1];
if (thisx->params == 0) {
items = &D_808BF300[0];
this->actionFunc = func_808BEFF4;
} else {
DynaPolyInfo_SetActorMove(&this->dyna, 0);
DynaPolyInfo_Alloc(&D_060066A8, &localConst);
this->dyna.dynaPolyId = DynaPolyInfo_RegisterActor(globalCtx, &globalCtx->colCtx.dyna, thisx, localConst);
thisx->initPosRot.pos.y += -280.0f;
if (Flags_GetSwitch(globalCtx, this->unk_168)) {
thisx->posRot.pos.y = thisx->initPosRot.pos.y;
this->actionFunc = BgYdanMaruta_DoNothing;
} else {
this->actionFunc = func_808BF078;
}
}
sinRotY = Math_Sins(thisx->shape.rot.y);
cosRotY = Math_Coss(thisx->shape.rot.y);
for (i = 0; i < 3; i++) {
sp4C[i].x = (items->dim.vtx[i].x * cosRotY) + thisx->posRot.pos.x;
sp4C[i].y = items->dim.vtx[i].y + thisx->posRot.pos.y;
sp4C[i].z = thisx->posRot.pos.z - (items->dim.vtx[i].x * sinRotY);
}
func_800627A0(&this->collider, 0, &sp4C[0], &sp4C[1], &sp4C[2]);
sp4C[1].x = (items->dim.vtx[2].x * cosRotY) + thisx->posRot.pos.x;
sp4C[1].y = items->dim.vtx[0].y + thisx->posRot.pos.y;
sp4C[1].z = thisx->posRot.pos.z - (items->dim.vtx[2].x * sinRotY);
func_800627A0(&this->collider, 1, &sp4C[0], &sp4C[2], &sp4C[1]);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ydan_Maruta/BgYdanMaruta_Init.s")
#endif
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ydan_Maruta/BgYdanMaruta_Destroy.s")
void BgYdanMaruta_Destroy(Actor* thisx, GlobalContext* globalCtx) {
BgYdanMaruta* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ydan_Maruta/func_808BEFF4.s")
Collider_DestroyTris(globalCtx, &this->collider);
if (thisx->params == 1) {
DynaPolyInfo_Free(globalCtx, &globalCtx->colCtx.dyna, this->dyna.dynaPolyId);
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ydan_Maruta/func_808BF078.s")
void func_808BEFF4(BgYdanMaruta* this, GlobalContext* globalCtx) {
if (this->collider.base.atFlags & 2) {
func_8002F71C(globalCtx, &this->dyna.actor, 7.0f, this->dyna.actor.shape.rot.y, 6.0f);
}
this->dyna.actor.shape.rot.x += 0x360;
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider);
func_8002F974(&this->dyna.actor, NA_SE_EV_TOGE_STICK_ROLLING - SFX_FLAG);
}
void func_808BF078(BgYdanMaruta* this, GlobalContext* globalCtx) {
if (this->collider.base.acFlags & 2) {
this->unk_16A = 20;
Flags_SetSwitch(globalCtx, this->unk_168);
func_80078884(NA_SE_SY_CORRECT_CHIME);
this->actionFunc = func_808BF108;
func_800800F8(globalCtx, 0xBC2, 0x32, &this->dyna.actor, 0);
} else {
CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider);
}
}
#ifdef NON_EQUIVALENT
// Casting issues and a branch issue
void func_808BF108(BgYdanMaruta* this, GlobalContext* globalCtx) {
s16 phi_v0;
if (this->unk_16A != 0) {
this->unk_16A--;
}
if (this->unk_16A == 0) {
this->actionFunc = func_808BF1EC;
}
phi_v0 = this->unk_16A;
if ((phi_v0 < 0) && ((phi_v0 % 4) != 0)) {
phi_v0 -= 4;
}
phi_v0 -= 2;
if (phi_v0 == -2) {
phi_v0 = 0;
} else {
phi_v0 *= 2;
}
this->dyna.actor.posRot.pos.x =
(Math_Coss(this->dyna.actor.shape.rot.y) * phi_v0) + this->dyna.actor.initPosRot.pos.x;
this->dyna.actor.posRot.pos.z =
(Math_Sins(this->dyna.actor.shape.rot.y) * phi_v0) + this->dyna.actor.initPosRot.pos.z;
func_8002F974(&this->dyna.actor, NA_SE_EV_TRAP_OBJ_SLIDE - SFX_FLAG);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ydan_Maruta/func_808BF108.s")
#endif
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ydan_Maruta/func_808BF1EC.s")
void func_808BF1EC(BgYdanMaruta* this, GlobalContext* globalCtx) {
this->dyna.actor.velocity.y += 1.0f;
if (Math_ApproxF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, this->dyna.actor.velocity.y)) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_LADDER_DOUND);
this->actionFunc = BgYdanMaruta_DoNothing;
}
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ydan_Maruta/func_808BF25C.s")
void BgYdanMaruta_DoNothing(BgYdanMaruta* this, GlobalContext* globalCtx) {
}
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ydan_Maruta/BgYdanMaruta_Update.s")
void BgYdanMaruta_Update(Actor* thisx, GlobalContext* globalCtx) {
BgYdanMaruta* this = THIS;
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Bg_Ydan_Maruta/BgYdanMaruta_Draw.s")
this->actionFunc(this, globalCtx);
}
void BgYdanMaruta_Draw(Actor* thisx, GlobalContext* globalCtx) {
if (thisx->params == 0) {
Gfx_DrawDListOpa(globalCtx, D_06008D88);
} else {
Gfx_DrawDListOpa(globalCtx, D_06006570);
}
}

View file

@ -6,9 +6,15 @@
struct BgYdanMaruta;
typedef void (*BgYdanMarutaActionFunc)(struct BgYdanMaruta*, GlobalContext*);
typedef struct BgYdanMaruta {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0xF8];
/* 0x0000 */ DynaPolyActor dyna;
/* 0x0164 */ BgYdanMarutaActionFunc actionFunc;
/* 0x0168 */ u8 unk_168;
/* 0x016A */ s16 unk_16A;
/* 0x016C */ ColliderTris collider;
/* 0x018C */ ColliderTrisItem colliderItems[2];
} BgYdanMaruta; // size = 0x0244
extern const ActorInit Bg_Ydan_Maruta_InitVars;

View file

@ -47,7 +47,8 @@ void EnAttackNiw_Init(Actor* thisx, GlobalContext* globalCtx) {
Actor_ProcessInitChain(&this->actor, sInitChain);
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFunc_Circle, 25.0f);
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06002530, &D_060000E8, this->limbDrawTable, this->transitionDrawTable, 16);
SkelAnime_InitSV(globalCtx, &this->skelAnime, &D_06002530, &D_060000E8, this->limbDrawTable,
this->transitionDrawTable, 16);
if (this->actor.params < 0) {
this->actor.params = 0;
}
@ -218,8 +219,7 @@ void func_809B5670(EnAttackNiw* this, GlobalContext* globalCtx) {
this->unk_2E0 = 5.0f;
this->unk_288 = 0.0f;
this->actionFunc = func_809B59B0;
} else if (((this->actor.projectedPos.z > 0.0f) &&
(fabsf(sp34.x - this->actor.posRot.pos.x) < 50.0f) &&
} else if (((this->actor.projectedPos.z > 0.0f) && (fabsf(sp34.x - this->actor.posRot.pos.x) < 50.0f) &&
(fabsf(sp34.y - this->actor.posRot.pos.y) < 50.0f) &&
(fabsf(sp34.z - this->actor.posRot.pos.z) < 50.0f)) ||
(this->actor.bgCheckFlags & 1)) {

View file

@ -255,6 +255,11 @@ D_06005780 = 0x06005780;
D_06007798 = 0x06007798;
D_06005DE0 = 0x06005DE0;
// z_bg_ydan_maruta
D_060066A8 = 0x060066A8;
D_06008D88 = 0x06008D88;
D_06006570 = 0x06006570;
// z_en_ma1
D_06000820 = 0x06000820;
D_06008460 = 0x06008460;