1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-29 03:34:07 +00:00

Ovl_Obj_Hana OK (#394)

* initial commit

* Deleted unused asm files.

* Formatting, simplified scale floats in HanaParams structs

* Removed a comment, replaced thisx with this->actor

* Renamed hanaParams data symbol, added missing static keywords, formatting

* Formatting suggestions
This commit is contained in:
emilybrooks 2020-09-20 06:37:54 -07:00 committed by GitHub
parent 44dac7af67
commit 7bd4686f1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 70 additions and 194 deletions

View file

@ -1,21 +0,0 @@
glabel ObjHana_Destroy
/* 000F8 80B93958 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8
/* 000FC 80B9395C AFBF0014 */ sw $ra, 0x0014($sp)
/* 00100 80B93960 848E001C */ lh $t6, 0x001C($a0) ## 0000001C
/* 00104 80B93964 3C1980B9 */ lui $t9, %hi(D_80B93AB0) ## $t9 = 80B90000
/* 00108 80B93968 00803025 */ or $a2, $a0, $zero ## $a2 = 00000000
/* 0010C 80B9396C 31CF0003 */ andi $t7, $t6, 0x0003 ## $t7 = 00000000
/* 00110 80B93970 000FC100 */ sll $t8, $t7, 4
/* 00114 80B93974 0338C821 */ addu $t9, $t9, $t8
/* 00118 80B93978 87393AB0 */ lh $t9, %lo(D_80B93AB0)($t9)
/* 0011C 80B9397C 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000
/* 00120 80B93980 07220004 */ bltzl $t9, .L80B93994
/* 00124 80B93984 8FBF0014 */ lw $ra, 0x0014($sp)
/* 00128 80B93988 0C0170EB */ jal Collider_DestroyCylinder
/* 0012C 80B9398C 24C5014C */ addiu $a1, $a2, 0x014C ## $a1 = 0000014C
/* 00130 80B93990 8FBF0014 */ lw $ra, 0x0014($sp)
.L80B93994:
/* 00134 80B93994 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000
/* 00138 80B93998 03E00008 */ jr $ra
/* 0013C 80B9399C 00000000 */ nop

View file

@ -1,18 +0,0 @@
glabel ObjHana_Draw
/* 001B0 80B93A10 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8
/* 001B4 80B93A14 AFBF0014 */ sw $ra, 0x0014($sp)
/* 001B8 80B93A18 00803825 */ or $a3, $a0, $zero ## $a3 = 00000000
/* 001BC 80B93A1C 84EE001C */ lh $t6, 0x001C($a3) ## 0000001C
/* 001C0 80B93A20 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000
/* 001C4 80B93A24 3C0580B9 */ lui $a1, %hi(D_80B93AA4) ## $a1 = 80B90000
/* 001C8 80B93A28 31CF0003 */ andi $t7, $t6, 0x0003 ## $t7 = 00000000
/* 001CC 80B93A2C 000FC100 */ sll $t8, $t7, 4
/* 001D0 80B93A30 00B82821 */ addu $a1, $a1, $t8
/* 001D4 80B93A34 0C00D498 */ jal Gfx_DrawDListOpa
/* 001D8 80B93A38 8CA53AA4 */ lw $a1, %lo(D_80B93AA4)($a1)
/* 001DC 80B93A3C 8FBF0014 */ lw $ra, 0x0014($sp)
/* 001E0 80B93A40 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000
/* 001E4 80B93A44 03E00008 */ jr $ra
/* 001E8 80B93A48 00000000 */ nop
/* 001EC 80B93A4C 00000000 */ nop

View file

@ -1,72 +0,0 @@
glabel ObjHana_Init
/* 00000 80B93860 27BDFFC8 */ addiu $sp, $sp, 0xFFC8 ## $sp = FFFFFFC8
/* 00004 80B93864 AFBF001C */ sw $ra, 0x001C($sp)
/* 00008 80B93868 AFB10018 */ sw $s1, 0x0018($sp)
/* 0000C 80B9386C AFB00014 */ sw $s0, 0x0014($sp)
/* 00010 80B93870 AFA5003C */ sw $a1, 0x003C($sp)
/* 00014 80B93874 848E001C */ lh $t6, 0x001C($a0) ## 0000001C
/* 00018 80B93878 3C0580B9 */ lui $a1, %hi(D_80B93AD4) ## $a1 = 80B90000
/* 0001C 80B9387C 00808025 */ or $s0, $a0, $zero ## $s0 = 00000000
/* 00020 80B93880 31CF0003 */ andi $t7, $t6, 0x0003 ## $t7 = 00000000
/* 00024 80B93884 A7AF0032 */ sh $t7, 0x0032($sp)
/* 00028 80B93888 0C01E037 */ jal Actor_ProcessInitChain
/* 0002C 80B9388C 24A53AD4 */ addiu $a1, $a1, %lo(D_80B93AD4) ## $a1 = 80B93AD4
/* 00030 80B93890 87B80032 */ lh $t8, 0x0032($sp)
/* 00034 80B93894 3C0880B9 */ lui $t0, %hi(D_80B93AA4) ## $t0 = 80B90000
/* 00038 80B93898 25083AA4 */ addiu $t0, $t0, %lo(D_80B93AA4) ## $t0 = 80B93AA4
/* 0003C 80B9389C 0018C900 */ sll $t9, $t8, 4
/* 00040 80B938A0 03288821 */ addu $s1, $t9, $t0
/* 00044 80B938A4 8E250004 */ lw $a1, 0x0004($s1) ## 00000004
/* 00048 80B938A8 0C00B58B */ jal Actor_SetScale
/* 0004C 80B938AC 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 00050 80B938B0 C6240008 */ lwc1 $f4, 0x0008($s1) ## 00000008
/* 00054 80B938B4 2605014C */ addiu $a1, $s0, 0x014C ## $a1 = 0000014C
/* 00058 80B938B8 E60400BC */ swc1 $f4, 0x00BC($s0) ## 000000BC
/* 0005C 80B938BC 8629000C */ lh $t1, 0x000C($s1) ## 0000000C
/* 00060 80B938C0 8FA4003C */ lw $a0, 0x003C($sp)
/* 00064 80B938C4 05200015 */ bltz $t1, .L80B9391C
/* 00068 80B938C8 00000000 */ nop
/* 0006C 80B938CC 0C0170D9 */ jal Collider_InitCylinder
/* 00070 80B938D0 AFA50024 */ sw $a1, 0x0024($sp)
/* 00074 80B938D4 3C0780B9 */ lui $a3, %hi(D_80B93A70) ## $a3 = 80B90000
/* 00078 80B938D8 24E73A70 */ addiu $a3, $a3, %lo(D_80B93A70) ## $a3 = 80B93A70
/* 0007C 80B938DC 8FA4003C */ lw $a0, 0x003C($sp)
/* 00080 80B938E0 8FA50024 */ lw $a1, 0x0024($sp)
/* 00084 80B938E4 0C01712B */ jal Collider_SetCylinder
/* 00088 80B938E8 02003025 */ or $a2, $s0, $zero ## $a2 = 00000000
/* 0008C 80B938EC 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
/* 00090 80B938F0 0C0189B7 */ jal Collider_CylinderUpdate
/* 00094 80B938F4 8FA50024 */ lw $a1, 0x0024($sp)
/* 00098 80B938F8 862A000C */ lh $t2, 0x000C($s1) ## 0000000C
/* 0009C 80B938FC 3C0680B9 */ lui $a2, %hi(D_80B93A9C) ## $a2 = 80B90000
/* 000A0 80B93900 24C63A9C */ addiu $a2, $a2, %lo(D_80B93A9C) ## $a2 = 80B93A9C
/* 000A4 80B93904 A60A018C */ sh $t2, 0x018C($s0) ## 0000018C
/* 000A8 80B93908 862B000E */ lh $t3, 0x000E($s1) ## 0000000E
/* 000AC 80B9390C 26040098 */ addiu $a0, $s0, 0x0098 ## $a0 = 00000098
/* 000B0 80B93910 00002825 */ or $a1, $zero, $zero ## $a1 = 00000000
/* 000B4 80B93914 0C0187B5 */ jal func_80061ED4
/* 000B8 80B93918 A60B018E */ sh $t3, 0x018E($s0) ## 0000018E
.L80B9391C:
/* 000BC 80B9391C 3C0C80B9 */ lui $t4, %hi(D_80B93AC4) ## $t4 = 80B90000
/* 000C0 80B93920 258C3AC4 */ addiu $t4, $t4, %lo(D_80B93AC4) ## $t4 = 80B93AC4
/* 000C4 80B93924 162C0007 */ bne $s1, $t4, .L80B93944
/* 000C8 80B93928 3C0D8016 */ lui $t5, %hi(gSaveContext+0xedc)
/* 000CC 80B9392C 95ADF53C */ lhu $t5, %lo(gSaveContext+0xedc)($t5)
/* 000D0 80B93930 31AE0001 */ andi $t6, $t5, 0x0001 ## $t6 = 00000000
/* 000D4 80B93934 51C00004 */ beql $t6, $zero, .L80B93948
/* 000D8 80B93938 8FBF001C */ lw $ra, 0x001C($sp)
/* 000DC 80B9393C 0C00B55C */ jal Actor_Kill
/* 000E0 80B93940 02002025 */ or $a0, $s0, $zero ## $a0 = 00000000
.L80B93944:
/* 000E4 80B93944 8FBF001C */ lw $ra, 0x001C($sp)
.L80B93948:
/* 000E8 80B93948 8FB00014 */ lw $s0, 0x0014($sp)
/* 000EC 80B9394C 8FB10018 */ lw $s1, 0x0018($sp)
/* 000F0 80B93950 03E00008 */ jr $ra
/* 000F4 80B93954 27BD0038 */ addiu $sp, $sp, 0x0038 ## $sp = 00000000

View file

@ -1,31 +0,0 @@
glabel ObjHana_Update
/* 00140 80B939A0 27BDFFE8 */ addiu $sp, $sp, 0xFFE8 ## $sp = FFFFFFE8
/* 00144 80B939A4 AFBF0014 */ sw $ra, 0x0014($sp)
/* 00148 80B939A8 AFA5001C */ sw $a1, 0x001C($sp)
/* 0014C 80B939AC 848E001C */ lh $t6, 0x001C($a0) ## 0000001C
/* 00150 80B939B0 3C1980B9 */ lui $t9, %hi(D_80B93AB0) ## $t9 = 80B90000
/* 00154 80B939B4 00803825 */ or $a3, $a0, $zero ## $a3 = 00000000
/* 00158 80B939B8 31CF0003 */ andi $t7, $t6, 0x0003 ## $t7 = 00000000
/* 0015C 80B939BC 000FC100 */ sll $t8, $t7, 4
/* 00160 80B939C0 0338C821 */ addu $t9, $t9, $t8
/* 00164 80B939C4 87393AB0 */ lh $t9, %lo(D_80B93AB0)($t9)
/* 00168 80B939C8 3C0143C8 */ lui $at, 0x43C8 ## $at = 43C80000
/* 0016C 80B939CC 0722000D */ bltzl $t9, .L80B93A04
/* 00170 80B939D0 8FBF0014 */ lw $ra, 0x0014($sp)
/* 00174 80B939D4 C4840090 */ lwc1 $f4, 0x0090($a0) ## 00000090
/* 00178 80B939D8 44813000 */ mtc1 $at, $f6 ## $f6 = 400.00
/* 0017C 80B939DC 3C010001 */ lui $at, 0x0001 ## $at = 00010000
/* 00180 80B939E0 34211E60 */ ori $at, $at, 0x1E60 ## $at = 00011E60
/* 00184 80B939E4 4606203C */ c.lt.s $f4, $f6
/* 00188 80B939E8 00A02025 */ or $a0, $a1, $zero ## $a0 = 00000000
/* 0018C 80B939EC 00A12821 */ addu $a1, $a1, $at
/* 00190 80B939F0 45020004 */ bc1fl .L80B93A04
/* 00194 80B939F4 8FBF0014 */ lw $ra, 0x0014($sp)
/* 00198 80B939F8 0C017713 */ jal CollisionCheck_SetOC
## CollisionCheck_setOT
/* 0019C 80B939FC 24E6014C */ addiu $a2, $a3, 0x014C ## $a2 = 0000014C
/* 001A0 80B93A00 8FBF0014 */ lw $ra, 0x0014($sp)
.L80B93A04:
/* 001A4 80B93A04 27BD0018 */ addiu $sp, $sp, 0x0018 ## $sp = 00000000
/* 001A8 80B93A08 03E00008 */ jr $ra
/* 001AC 80B93A0C 00000000 */ nop

View file

@ -1,30 +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 Obj_Hana_InitVars
.word 0x014F0600, 0x00000000, 0x00020000, 0x00000198
.word ObjHana_Init
.word ObjHana_Destroy
.word ObjHana_Update
.word ObjHana_Draw
glabel D_80B93A70
.word 0x0A000039, 0x20010000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000100, 0x0008000A, 0x00000000, 0x00000000
glabel D_80B93A9C
.word 0x0000000C, 0x003CFF00
glabel D_80B93AA4
.word 0x05000500, 0x3C23D70A, 0x00000000
glabel D_80B93AB0
.word 0xFFFF0000, 0x0500A880, 0x3DCCCCCD, 0x42680000, 0x000A0012
glabel D_80B93AC4
.word 0x0500B9D0, 0x3ECCCCCD, 0x00000000, 0x000C002C
glabel D_80B93AD4
.word 0xC850000A, 0xB0F40384, 0xB0F8003C, 0x30FC0320, 0x00000000, 0x00000000, 0x00000000

View file

@ -1,13 +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 .rodata
.balign 16
glabel D_80B93AF0
.incbin "baserom/ovl_Obj_Hana", 0x290, 0x00000070

3
spec
View file

@ -3529,8 +3529,7 @@ endseg
beginseg
name "ovl_Obj_Hana"
include "build/src/overlays/actors/ovl_Obj_Hana/z_obj_hana.o"
include "build/data/overlays/actors/z_obj_hana.data.o"
include "build/data/overlays/actors/z_obj_hana.reloc.o"
include "build/src/overlays/actors/ovl_Obj_Hana/ovl_Obj_Hana_reloc.o"
endseg
beginseg

View file

@ -15,7 +15,6 @@ void ObjHana_Destroy(Actor* thisx, GlobalContext* globalCtx);
void ObjHana_Update(Actor* thisx, GlobalContext* globalCtx);
void ObjHana_Draw(Actor* thisx, GlobalContext* globalCtx);
/*
const ActorInit Obj_Hana_InitVars = {
ACTOR_OBJ_HANA,
ACTORTYPE_PROP,
@ -27,11 +26,74 @@ const ActorInit Obj_Hana_InitVars = {
(ActorFunc)ObjHana_Update,
(ActorFunc)ObjHana_Draw,
};
*/
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Hana/ObjHana_Init.s")
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Hana/ObjHana_Destroy.s")
static ColliderCylinderInit sCylinderInit = {
{ COLTYPE_UNK10, 0x00, 0x00, 0x39, 0x20, COLSHAPE_CYLINDER },
{ 0x00, { 0x00000000, 0x00, 0x00 }, { 0x00000000, 0x00, 0x00 }, 0x00, 0x00, 0x01 },
{ 8, 10, 0, { 0, 0, 0 } },
};
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Hana/ObjHana_Update.s")
static CollisionCheckInfoInit sColChkInfoInit = { 0, 0xC, 0x3C, 0xFF };
#pragma GLOBAL_ASM("asm/non_matchings/overlays/actors/ovl_Obj_Hana/ObjHana_Draw.s")
typedef struct {
/* 0x00 */ Gfx* dList;
/* 0x04 */ f32 scale;
/* 0x08 */ f32 yOffset;
/* 0x0C */ s16 radius;
/* 0x0E */ s16 height;
} HanaParams; // size = 0x10
static HanaParams sHanaParams[] = {
{ 0x05000500, 0.01f, 0.0f, -1, 0 },
{ 0x0500A880, 0.1f, 58.0f, 10, 18 },
{ 0x0500B9D0, 0.4f, 0.0f, 12, 44 },
};
static InitChainEntry sInitChain[] = {
ICHAIN_VEC3F_DIV1000(scale, 10, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneForward, 900, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneScale, 60, ICHAIN_CONTINUE),
ICHAIN_F32(uncullZoneDownward, 800, ICHAIN_STOP),
};
void ObjHana_Init(Actor* thisx, GlobalContext* globalCtx) {
ObjHana* this = THIS;
s16 type = this->actor.params & 3;
HanaParams* params = &sHanaParams[type];
Actor_ProcessInitChain(&this->actor, sInitChain);
Actor_SetScale(&this->actor, params->scale);
this->actor.shape.unk_08 = params->yOffset;
if (params->radius >= 0) {
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
Collider_CylinderUpdate(&this->actor, &this->collider);
this->collider.dim.radius = params->radius;
this->collider.dim.height = params->height;
func_80061ED4(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
}
if (type == 2 && (gSaveContext.eventChkInf[4] & 1)) {
Actor_Kill(&this->actor);
}
}
void ObjHana_Destroy(Actor* thisx, GlobalContext* globalCtx) {
ObjHana* this = THIS;
if (sHanaParams[this->actor.params & 3].radius >= 0) {
Collider_DestroyCylinder(globalCtx, &this->collider);
}
}
void ObjHana_Update(Actor* thisx, GlobalContext* globalCtx) {
ObjHana* this = THIS;
if (sHanaParams[this->actor.params & 3].radius >= 0 && this->actor.xzDistFromLink < 400.0f) {
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
}
}
void ObjHana_Draw(Actor* thisx, GlobalContext* globalCtx) {
Gfx_DrawDListOpa(globalCtx, sHanaParams[thisx->params & 3].dList);
}

View file

@ -8,7 +8,7 @@ struct ObjHana;
typedef struct ObjHana {
/* 0x0000 */ Actor actor;
/* 0x014C */ char unk_14C[0x4C];
/* 0x014C */ ColliderCylinder collider;
} ObjHana; // size = 0x0198
extern const ActorInit Obj_Hana_InitVars;