mirror of
https://github.com/zeldaret/tmc
synced 2026-08-19 13:54:04 -04:00
Putting some nonmatch functions from site
This commit is contained in:
@@ -69,7 +69,7 @@ NONMATCH("asm/non_matching/fallingBoulder/sub_0802C334.inc", void sub_0802C334(E
|
||||
u32 tmp = gRoomControls.origin_y;
|
||||
if (&gPlayerEntity == NULL)
|
||||
return;
|
||||
if (tmp - gPlayerEntity.y.HALF.HI <= 0x38) {
|
||||
if (gPlayerEntity.y.HALF.HI - tmp <= 0x38) {
|
||||
return;
|
||||
}
|
||||
this->field_0x7c.HALF.LO = 1;
|
||||
|
||||
+14
-8
@@ -209,26 +209,32 @@ void sub_0802805C(Entity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
NONMATCH("asm/non_matching/likeLike/sub_0802810C.inc", void sub_0802810C(Entity* this)) {
|
||||
void sub_0802810C(Entity* this) {
|
||||
// This matches but ugly
|
||||
#ifndef NON_MATCHING
|
||||
register u32 tmp asm("r3");
|
||||
#else
|
||||
u32 tmp;
|
||||
#endif
|
||||
gPlayerState.jump_status = 0x41;
|
||||
gPlayerState.field_0xa = 0;
|
||||
gPlayerState.flags &= PL_CAPTURED;
|
||||
gPlayerEntity.flags |= ENT_COLLIDE;
|
||||
gPlayerEntity.zVelocity = Q_16_16(1.5);
|
||||
gPlayerState.flags &= 0xffffffef;
|
||||
gPlayerEntity.flags |= 0x80;
|
||||
gPlayerEntity.zVelocity = 0x18000;
|
||||
gPlayerEntity.iframes = -60;
|
||||
tmp = 0;
|
||||
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
|
||||
gPlayerEntity.spritePriority.b1 = this->field_0x82.HALF.HI;
|
||||
gPlayerEntity.z.HALF.HI = gPlayerEntity.spriteOffsetY;
|
||||
gPlayerEntity.spriteOffsetY = 0;
|
||||
gPlayerEntity.spriteOffsetY = tmp;
|
||||
this->action = 4;
|
||||
this->timer = 80;
|
||||
this->subtimer = 0;
|
||||
this->timer = 0x50;
|
||||
this->subtimer = tmp;
|
||||
this->flags2 |= 2;
|
||||
if (this->iframes == 0) {
|
||||
this->iframes = -18;
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void sub_080281A0(Entity* this) {
|
||||
this->subtimer = 25;
|
||||
|
||||
+40
-2
@@ -149,9 +149,47 @@ void sub_08022DE8(Entity* this) {
|
||||
// this definition is only here, so clang-tidy does not mess gUnk_080CBBBC up.
|
||||
extern void sub_08022E40(Entity* this);
|
||||
|
||||
ASM_FUNC("asm/non_matching/moldorm/sub_08022E40.inc", void sub_08022E40(Entity* this))
|
||||
NONMATCH("asm/non_matching/moldorm/sub_08022E40.inc", void sub_08022E40(Entity* this)) {
|
||||
u32 bVar1;
|
||||
u32 bVar2;
|
||||
u32 tmp;
|
||||
u32 tmp2;
|
||||
u8* ptr;
|
||||
|
||||
ASM_FUNC("asm/non_matching/moldorm/sub_08022EAC.inc", void sub_08022EAC(Entity* this))
|
||||
this->field_0x74.HWORD = this->x.HALF.HI;
|
||||
this->field_0x76.HWORD = this->y.HALF.HI;
|
||||
tmp2 = (this->parent->field_0x78.HALF.HI + 1) & 7;
|
||||
bVar1 = ((u8*)&this->field_0x7c)[tmp2];
|
||||
tmp = (bVar1 & 0xf) - 8;
|
||||
bVar1 >>= 4;
|
||||
this->x.HALF.HI = ((short)((tmp * 0x100)) >> 8) + this->x.HALF.HI;
|
||||
bVar1 -= 8;
|
||||
this->y.HALF.HI = bVar1 + this->y.HALF.HI;
|
||||
bVar2 = (u8)(*(u32*)&this->cutsceneBeh >> (((this->parent->field_0x78.HALF.HI + 1) & 7) << 2)) & 7;
|
||||
this->animationState = bVar2;
|
||||
if (this->type == 3) {
|
||||
this->frameIndex = bVar2 + 10;
|
||||
} else {
|
||||
sub_08022EAC(this);
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
NONMATCH("asm/non_matching/moldorm/sub_08022EAC.inc", void sub_08022EAC(Entity* this)) {
|
||||
int iVar1;
|
||||
u32 tmp;
|
||||
u32 tmp2;
|
||||
if (this->child != NULL) {
|
||||
tmp2 = ((this->parent->field_0x78.HALF.HI) & 7);
|
||||
((u8*)&this->child->field_0x7c)[tmp2] = ((this->x.HALF_U.HI - this->field_0x74.HALF.LO + 8) & (0xf)) +
|
||||
((this->y.HALF_U.HI - this->field_0x76.HALF.LO + 8) /*& 0xf*/) * 0x10;
|
||||
iVar1 = ((this->parent->field_0x78.HALF.HI) & 7) << 2;
|
||||
tmp = (this->animationState & 7) << iVar1;
|
||||
tmp |= ~(0xf << iVar1) & (*(u32*)&this->child->cutsceneBeh);
|
||||
*(u32*)&this->child->cutsceneBeh = tmp;
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void sub_08022F14(Entity* this) {
|
||||
if (sub_08049FA0(this) == 0) {
|
||||
|
||||
+24
-1
@@ -436,7 +436,30 @@ void sub_08033320(MulldozerEntity* this) {
|
||||
}
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/mulldozer/sub_08033364.inc", bool32 sub_08033364(MulldozerEntity* this))
|
||||
NONMATCH("asm/non_matching/mulldozer/sub_08033364.inc", bool32 sub_08033364(MulldozerEntity* this)) {
|
||||
Entity* entity;
|
||||
u32 radius;
|
||||
u32 tmp;
|
||||
|
||||
entity = (Entity*)sub_08049DF4(1);
|
||||
if (entity != NULL) {
|
||||
if (super->type != 0) {
|
||||
radius = 0x48;
|
||||
} else {
|
||||
radius = 0x38;
|
||||
}
|
||||
if (EntityInRectRadius(super, entity, radius, radius) != 0) {
|
||||
if (super->type != 0) {
|
||||
return TRUE;
|
||||
}
|
||||
if (((GetFacingDirection(super, gUnk_020000B0) + 2) & 0x1c) >> 2 == super->animationState) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void (*const Mulldozer_Functions[])(MulldozerEntity*) = {
|
||||
Mulldozer_OnInit,
|
||||
|
||||
+14
-7
@@ -248,21 +248,28 @@ NONMATCH("asm/non_matching/spearMoblin/sub_08028604.inc", void sub_08028604(Enti
|
||||
this->timer = gUnk_080CC7BC[Random() & 3];
|
||||
this->speed = 0x80;
|
||||
if (sub_08049FA0(this) != 0) {
|
||||
this->direction = gUnk_080CC7D0[Random() & 7] + 0x18 + (this->direction & 0x18);
|
||||
u32 rand = Random();
|
||||
u32 tmp;
|
||||
tmp = gUnk_080CC7D0[rand & 7] + 0x18;
|
||||
tmp += this->direction;
|
||||
tmp &= 0x18;
|
||||
this->direction = tmp;
|
||||
} else {
|
||||
u32 iVar3 = sub_08049EE4(this);
|
||||
u32 uVar1;
|
||||
s8 uVar1;
|
||||
if (this->field_0x82.HALF.HI == 0) {
|
||||
uVar1 = gUnk_080CC7C0[Random() & 0xf];
|
||||
u32 rand = Random();
|
||||
iVar3 += gUnk_080CC7C0[rand & 0xf];
|
||||
} else {
|
||||
uVar1 = gUnk_080CC7C0[Random() & 7];
|
||||
this->timer = this->timer + 16;
|
||||
u32 rand = Random();
|
||||
iVar3 += gUnk_080CC7C0[rand & 7];
|
||||
this->timer = this->timer + 0x10;
|
||||
this->field_0x82.HALF.HI--;
|
||||
}
|
||||
this->direction = iVar3 + uVar1 + (4U & 0x18);
|
||||
this->direction = (iVar3 + 4U) & 0x18;
|
||||
}
|
||||
} else {
|
||||
this->timer = 12;
|
||||
this->timer = 0xc;
|
||||
this->speed = 0;
|
||||
}
|
||||
|
||||
|
||||
+29
-4
@@ -75,8 +75,8 @@ void Stalfos_OnTick(StalfosEntity* this) {
|
||||
|
||||
NONMATCH("asm/non_matching/stalfos/sub_0803933C.inc", void sub_0803933C(StalfosEntity* this)) {
|
||||
if (super->hitType == 0x44) {
|
||||
if ((super->contactFlags & 0x7f) < 7) {
|
||||
if ((super->contactFlags & 0x7f) > 3) {
|
||||
switch (super->contactFlags & 0x7f) {
|
||||
case 4 ... 6:
|
||||
if (super->iframes < 1) {
|
||||
super->action = 4;
|
||||
super->direction = super->knockbackDirection;
|
||||
@@ -84,7 +84,7 @@ NONMATCH("asm/non_matching/stalfos/sub_0803933C.inc", void sub_0803933C(StalfosE
|
||||
super->speed = 0x120;
|
||||
sub_0803981C(this);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (super->contactFlags == 0x9d) {
|
||||
@@ -441,7 +441,32 @@ void sub_08039AD4(StalfosEntity* this) {
|
||||
}
|
||||
sub_08039A48(this);
|
||||
}
|
||||
ASM_FUNC("asm/non_matching/stalfos/sub_08039B28.inc", u32 sub_08039B28(StalfosEntity* this))
|
||||
|
||||
u32 sub_08039B28(StalfosEntity* this) {
|
||||
u32 tileType;
|
||||
u32 pos;
|
||||
const u16* ptr;
|
||||
const s8* ptr2;
|
||||
|
||||
if (super->child == NULL) {
|
||||
ptr2 = &gUnk_080CF930[super->animationState * 2];
|
||||
pos = COORD_TO_TILE_OFFSET(super, -ptr2[0], -ptr2[1]);
|
||||
|
||||
tileType = GetTileType(pos, (u32)super->collisionLayer);
|
||||
ptr = gUnk_080CF938;
|
||||
do {
|
||||
if (ptr[0] != tileType) {
|
||||
ptr += 2;
|
||||
} else {
|
||||
goto found;
|
||||
}
|
||||
} while (ptr[0] != 0);
|
||||
}
|
||||
return 0xffff;
|
||||
found:
|
||||
super->type2 = ptr[1];
|
||||
return pos;
|
||||
}
|
||||
|
||||
void (*const Stalfos_Functions[])(StalfosEntity*) = {
|
||||
Stalfos_OnTick,
|
||||
|
||||
@@ -865,7 +865,7 @@ static ASM_FUNC("asm/non_matching/vaati/sub_080432A8.inc", void sub_080432A8(Ent
|
||||
Entity* entity;
|
||||
VaatiArm_HeapStruct1* s;
|
||||
u32 i;
|
||||
u8* ptr;
|
||||
VaatiArm_HeapStruct1* ptr;
|
||||
|
||||
if (this->timer != 0) {
|
||||
if (--this->timer != 0) {
|
||||
@@ -886,10 +886,10 @@ static ASM_FUNC("asm/non_matching/vaati/sub_080432A8.inc", void sub_080432A8(Ent
|
||||
}
|
||||
sub_08043B9C(this);
|
||||
for (i = 0; i < 5; i++) {
|
||||
ptr = ((u8*)((VaatiArm_HeapStruct*)this->myHeap)->s1) + 0x10 * i;
|
||||
if (gUnk_080D1414[i] > ptr[0xc]) {
|
||||
ptr[0xc]++;
|
||||
if (gUnk_080D1414[i] != ptr[0xc]) {
|
||||
ptr = &(((VaatiArm_HeapStruct*)this->myHeap)->s1)[i];
|
||||
if (gUnk_080D1414[i] > ptr->unk0c) {
|
||||
ptr->unk0c++;
|
||||
if (gUnk_080D1414[i] != ptr->unk0c) {
|
||||
return;
|
||||
}
|
||||
SoundReq(SFX_15E);
|
||||
|
||||
+17
-1
@@ -165,7 +165,23 @@ void sub_0802CF64(Entity* this) {
|
||||
sub_0802CF8C(this);
|
||||
}
|
||||
|
||||
ASM_FUNC("asm/non_matching/wallMaster2/sub_0802CF8C.inc", void sub_0802CF8C(Entity* this))
|
||||
NONMATCH("asm/non_matching/wallMaster2/sub_0802CF8C.inc", void sub_0802CF8C(Entity* this)) {
|
||||
int iVar1;
|
||||
u32 uVar2;
|
||||
const u16* ptr;
|
||||
u16* ptr2;
|
||||
|
||||
uVar2 = (this->direction + 2) & 0x1c;
|
||||
if ((uVar2 - this->animationState * 4 + 6 > 0xc) ||
|
||||
((((this->direction + 1) & 7) > 2 && (uVar2 >> 2 != this->animationState)))) {
|
||||
this->animationState = (uVar2 >> 2);
|
||||
iVar1 = (uVar2 >> 3) * 2;
|
||||
ptr = &gUnk_080CD730[iVar1];
|
||||
this->field_0x74.HWORD = ptr[0];
|
||||
this->field_0x76.HWORD = ptr[1];
|
||||
}
|
||||
}
|
||||
END_NONMATCH
|
||||
|
||||
void sub_0802CFD8(Entity* this) {
|
||||
u32 unk = gUnk_080CD740[(this->field_0x7a.HALF.LO++ >> 3) & 7];
|
||||
|
||||
Reference in New Issue
Block a user