define collisions

This commit is contained in:
theo3
2023-12-31 21:24:07 -08:00
parent 48fdf9d827
commit dcc596ed87
125 changed files with 388 additions and 336 deletions
+4 -4
View File
@@ -40,7 +40,7 @@ void BarrelSpiderweb_Init(Entity* this) {
this->hitType = 1;
this->collisionFlags = 7;
this->hurtType = 0x48;
this->flags2 = 4;
this->collisionMask = 4;
this->hitbox = (Hitbox*)&gHitbox_0;
this->frameIndex = 2;
this->collisionLayer = gPlayerEntity.base.collisionLayer;
@@ -64,7 +64,7 @@ void sub_0808BBE0(Entity* this) {
ptr = &gUnk_0812144C[diff * 2];
SetAffineInfo(this, ptr[0], ptr[1], 0);
} else {
this->contactFlags &= ~CONTACT_TAKE_DAMAGE;
this->contactFlags &= ~CONTACT_NOW;
}
}
@@ -74,7 +74,7 @@ void BarrelSpiderweb_Action1(Entity* this) {
tmp = -0x170;
this->y.HALF.HI = gRoomControls.origin_y - ((this->parent)->zVelocity + tmp);
sub_0808BBE0(this);
if (this->contactFlags == (CONTACT_TAKE_DAMAGE | 0x13)) {
if (this->contactFlags == (CONTACT_NOW | 0x13)) {
this->timer--;
this->spriteSettings.draw = 1;
if (this->timer == 0) {
@@ -114,7 +114,7 @@ void BarrelSpiderweb_Action2(Entity* this) {
this->subtimer -= 8;
SetAffineInfo(this, 0x200 - this->subtimer, 0x200 - this->subtimer, 0);
}
if (this->contactFlags == (CONTACT_TAKE_DAMAGE | 0x13)) {
if (this->contactFlags == (CONTACT_NOW | 0x13)) {
this->direction = GetFacingDirection(this, &gPlayerEntity.base);
LinearMoveUpdate(this);
if (EntityWithinDistance(this, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI - 6, 0x1c)) {
+1 -1
View File
@@ -48,7 +48,7 @@ void BigIceBlock_Init(BigIceBlockEntity* this) {
super->collisionFlags = 7;
super->hurtType = 0x48;
super->hitType = 1;
super->flags2 = 0x80;
super->collisionMask = 0x80;
super->hitbox = (Hitbox*)&gUnk_080FD190;
sub_08099910(this);
InitializeAnimation(super, super->type);
+1 -1
View File
@@ -64,7 +64,7 @@ void Bush_Init(BushEntity* this) {
super->health = 1;
super->collisionFlags = 7;
super->hitType = 0x6e;
super->flags2 = 4;
super->collisionMask = 4;
super->hitbox = (Hitbox*)&gUnk_081205B4;
this->unk_72 = 0;
this->unk_70 = GetTileIndex(COORD_TO_TILE(super), super->collisionLayer);
+3 -3
View File
@@ -78,7 +78,7 @@ void DirtParticle_Init(DirtParticleEntity* this) {
super->health = 1;
super->collisionFlags = 7;
super->hitType = 0xaa;
super->flags2 = 0x0e;
super->collisionMask = 0x0e;
super->hitbox = (Hitbox*)&gUnk_08120A8C;
super->gustJarFlags = 0;
case 2:
@@ -101,7 +101,7 @@ void DirtParticle_Init(DirtParticleEntity* this) {
void DirtParticle_Action1(DirtParticleEntity* this) {
DirtParticleEntity* entity;
if ((super->contactFlags & CONTACT_TAKE_DAMAGE) == 0) {
if ((super->contactFlags & CONTACT_NOW) == 0) {
return;
}
switch (super->contactFlags & 0x7f) {
@@ -128,7 +128,7 @@ void DirtParticle_Action3(DirtParticleEntity* this) {
sub_08087B9C,
sub_08087B9C,
};
if ((super->contactFlags & CONTACT_TAKE_DAMAGE) != 0) {
if ((super->contactFlags & CONTACT_NOW) != 0) {
gUnk_08120A80[super->subAction](this);
} else {
super->action = 1;
+1 -1
View File
@@ -55,7 +55,7 @@ void EvilSpirit_Init(EvilSpiritEntity* this) {
COLLISION_ON(super);
super->collisionFlags = 7;
super->hitType = 1;
super->flags2 = 4;
super->collisionMask = 4;
for (index = 0; index < 4; index++) {
evilSpiritEnt = CreateObjectWithParent(super, EVIL_SPIRIT, index + 1, 0);
super->child = evilSpiritEnt;
+2 -2
View File
@@ -37,7 +37,7 @@ void EyeSwitch_Init(EyeSwitchEntity* this) {
super->collisionFlags = 7;
super->hurtType = 0x48;
super->hitType = 1;
super->flags2 = 2;
super->collisionMask = 2;
super->hitbox = (Hitbox*)&gHitbox_1;
if (CheckFlags(this->eyeSwitchFlags)) {
super->action = 3;
@@ -50,7 +50,7 @@ void EyeSwitch_Init(EyeSwitchEntity* this) {
}
void EyeSwitch_Action1(EyeSwitchEntity* this) {
if ((super->contactFlags == (CONTACT_TAKE_DAMAGE | 0x15) || super->contactFlags == (CONTACT_TAKE_DAMAGE | 0xe)) &&
if ((super->contactFlags == (CONTACT_NOW | 0x15) || super->contactFlags == (CONTACT_NOW | 0xe)) &&
(DirectionRoundUp(super->contactedEntity->direction) >> 3 == (super->animationState & 3))) {
super->action = 2;
COLLISION_OFF(super);
+3 -3
View File
@@ -40,7 +40,7 @@ void Fairy(FairyEntity* this) {
Fairy_Init, Fairy_Action1, Fairy_Action2, Fairy_Action3, Fairy_Action4,
};
if (((super->contactFlags & CONTACT_TAKE_DAMAGE) != 0)) {
if (((super->contactFlags & CONTACT_NOW) != 0)) {
switch (super->contactFlags & 0x7f) {
case 0x14:
super->action = 3;
@@ -103,7 +103,7 @@ void Fairy_Init(FairyEntity* this) {
super->collisionFlags = 0x17;
super->hurtType = 0x49;
super->hitType = 7;
super->flags2 = 0x17;
super->collisionMask = 0x17;
super->health = 0xff;
super->hitbox = (Hitbox*)&gUnk_080FD1A8;
super->gustJarFlags = 1;
@@ -253,6 +253,6 @@ void sub_0808DB2C(FairyEntity* this) {
super->action = 2;
super->subAction = 0;
super->flags |= ENT_COLLIDE;
super->flags2 = 1;
super->collisionMask = 1;
CopyPosition(&gPlayerEntity.base, super);
}
+1 -1
View File
@@ -152,7 +152,7 @@ void GleerokParticle_Init(GleerokParticleEntity* this) {
super->collisionFlags = 7;
super->hurtType = 0x48;
super->hitType = 0x7a;
super->flags2 = 1;
super->collisionMask = 1;
}
break;
case 0x80:
+2 -2
View File
@@ -32,7 +32,7 @@ void HittableLever_Init(HittableLeverEntity* this) {
super->flags |= ENT_COLLIDE;
super->collisionFlags = 7;
super->hitType = 0x8f;
super->flags2 = 0xa;
super->collisionMask = 0xa;
super->hitbox = (Hitbox*)&HittableLever_Hitbox;
if (super->type == 0) {
if (CheckFlags(this->hitFlag)) {
@@ -47,7 +47,7 @@ void HittableLever_Init(HittableLeverEntity* this) {
}
void HittableLever_Idle(HittableLeverEntity* this) {
if (((super->contactFlags & CONTACT_TAKE_DAMAGE) != 0) && (this->wasHit == 0)) {
if (((super->contactFlags & CONTACT_NOW) != 0) && (this->wasHit == 0)) {
this->wasHit = 1;
super->type ^= 1;
super->iframes = -0x18;
+4 -4
View File
@@ -63,7 +63,7 @@ void ItemOnGround(ItemOnGroundEntity* this) {
static void (*const ItemOnGround_Actions[])(ItemOnGroundEntity*) = {
ItemOnGround_Init, ItemOnGround_Action1, ItemOnGround_Action2, ItemOnGround_Action3, ItemOnGround_Action4,
};
if (super->contactFlags & CONTACT_TAKE_DAMAGE) {
if (super->contactFlags & CONTACT_NOW) {
switch (super->contactFlags & 0x7F) {
case 20:
super->action = 3;
@@ -130,10 +130,10 @@ void ItemOnGround_Init(ItemOnGroundEntity* this) {
case ITEM_BOMBS5:
case ITEM_ARROWS5:
case ITEM_HEART:
super->flags2 = 0x17;
super->collisionMask = 0x17;
break;
default:
super->flags2 = 0x11;
super->collisionMask = 0x11;
break;
}
@@ -186,7 +186,7 @@ void sub_080810FC(ItemOnGroundEntity* this) {
super->action = 2;
super->subAction = 0;
COLLISION_ON(super);
super->flags2 = 0x11;
super->collisionMask = 0x11;
CopyPosition(&gPlayerEntity.base, super);
}
}
+2 -2
View File
@@ -39,7 +39,7 @@ void JarPortal_Init(JarPortalEntity* this) {
super->hitType = 1;
super->collisionFlags = 0x47;
super->hurtType = 0x44;
super->flags2 = 0x80;
super->collisionMask = 0x80;
this->unk_68 = 0;
if (CheckLocalFlag(super->type)) {
if (this->unk_7c != 0) {
@@ -170,7 +170,7 @@ void JarPortal_Action4(JarPortalEntity* this) {
}
u32 sub_0808C128(JarPortalEntity* this) {
return super->contactFlags == (CONTACT_TAKE_DAMAGE | 0x1d);
return super->contactFlags == (CONTACT_NOW | 0x1d);
}
void sub_0808C13C(JarPortalEntity* this) {
+3 -3
View File
@@ -112,7 +112,7 @@ void LavaPlatform_Type1Init(LavaPlatformEntity* this) {
super->spritePriority.b0 = 7;
super->hurtType = 0x48;
super->collisionFlags = 7;
super->flags2 = 0x81;
super->collisionMask = 0x81;
super->hitbox = (Hitbox*)&gUnk_080FD280;
sub_0809264C(this);
}
@@ -131,7 +131,7 @@ void LavaPlatform_Type1Action1(LavaPlatformEntity* this) {
}
void LavaPlatform_Type1Action2(LavaPlatformEntity* this) {
if (super->contactFlags == (CONTACT_TAKE_DAMAGE | 0x1d)) {
if (super->contactFlags == (CONTACT_NOW | 0x1d)) {
sub_08092620(this);
} else {
if (LavaPlatform_IsPlayerOnPlatform(this)) {
@@ -223,7 +223,7 @@ void LavaPlatform_Type1Action6(LavaPlatformEntity* this) {
}
void LavaPlatform_Type1Action7(LavaPlatformEntity* this) {
if (super->contactFlags == (CONTACT_TAKE_DAMAGE | 0x1d)) {
if (super->contactFlags == (CONTACT_NOW | 0x1d)) {
sub_08092620(this);
}
}
+4 -4
View File
@@ -58,7 +58,7 @@ void LightableSwitch_Type0_Init(LightableSwitchEntity* this) {
super->collisionFlags = 7;
super->hurtType = 0x48;
super->hitType = 0x28;
super->flags2 = 10;
super->collisionMask = 10;
super->hitbox = (Hitbox*)&gHitbox_0;
sub_0809EAD8(this);
UpdateSpriteForCollisionLayer(super);
@@ -67,7 +67,7 @@ void LightableSwitch_Type0_Init(LightableSwitchEntity* this) {
void LightableSwitch_Type0_Action1(LightableSwitchEntity* this) {
if ((super->contactFlags & CONTACT_TAKE_DAMAGE) != 0) {
if ((super->contactFlags & CONTACT_NOW) != 0) {
if (CheckFlags(this->unk_86) != 0) {
ClearFlag(this->unk_86);
} else {
@@ -136,7 +136,7 @@ void LightableSwitch_Type1_Init(LightableSwitchEntity* this) {
super->collisionFlags = 7;
super->hurtType = 0x48;
super->hitType = 0x28;
super->flags2 = 10;
super->collisionMask = 10;
super->hitbox = (Hitbox*)&gHitbox_0;
sub_0809EAD8(this);
UpdateSpriteForCollisionLayer(super);
@@ -147,7 +147,7 @@ void LightableSwitch_Type1_Init(LightableSwitchEntity* this) {
}
void LightableSwitch_Type1_Action1(LightableSwitchEntity* this) {
if ((super->contactFlags & CONTACT_TAKE_DAMAGE) != 0) {
if ((super->contactFlags & CONTACT_NOW) != 0) {
super->action = 2;
super->timer = 16;
super->frameIndex = 2;
+1 -1
View File
@@ -76,7 +76,7 @@ void LilypadLarge_Init(LilypadLargeEntity* this) {
super->flags |= ENT_COLLIDE;
super->collisionFlags = 7;
super->hitType = 1;
super->flags2 = 4;
super->collisionMask = 4;
this->unk_78.WORD = 0x1000000;
this->unk_7c.HALF_U.HI = 0x1000;
this->unk_85 = 0;
+3 -3
View File
@@ -54,7 +54,7 @@ void Minecart_Init(MinecartEntity* this) {
super->hitType = 1;
super->collisionFlags = 0x47;
super->hurtType = 0x44;
super->flags2 = 0x80;
super->collisionMask = 0x80;
super->direction = DirectionFromAnimationState(super->animationState);
super->speed = 0x700;
super->spritePriority.b1 = 3;
@@ -112,7 +112,7 @@ void Minecart_Action2(MinecartEntity* this) {
super->flags |= ENT_PERSIST;
super->hitType = 0x97;
super->collisionFlags = (gPlayerEntity.base.collisionFlags + 1) | 0x20;
super->flags2 = gPlayerEntity.base.flags2;
super->collisionMask = gPlayerEntity.base.collisionMask;
super->hurtType = 0x18;
super->damage = 8;
sub_0801766C(super);
@@ -176,7 +176,7 @@ void Minecart_Action3(MinecartEntity* this) {
super->hitType = 1;
super->collisionFlags = 0x47;
super->hurtType = 0x44;
super->flags2 = 0x80;
super->collisionMask = 0x80;
super->action = 6;
sub_08017744(super);
gPlayerState.jump_status = 0x41;
+1 -1
View File
@@ -46,7 +46,7 @@ void MineralWaterSource_Init(Entity* this) {
this->collisionFlags = 7;
this->hitType = 145;
this->flags2 = 2;
this->collisionMask = 2;
this->action = 1;
}
+2 -2
View File
@@ -39,7 +39,7 @@ void ObjectA8(ObjectA8Entity* this) {
ObjectA8_Init, ObjectA8_Action1, ObjectA8_Action2, ObjectA8_Action3,
ObjectA8_Action4, ObjectA8_Action5, ObjectA8_Action6,
};
if ((super->contactFlags & CONTACT_TAKE_DAMAGE) != 0) {
if ((super->contactFlags & CONTACT_NOW) != 0) {
switch (super->contactFlags & 0x7f) {
case 0:
case 1:
@@ -77,7 +77,7 @@ void ObjectA8_Init(ObjectA8Entity* this) {
super->collisionFlags = 0x17;
super->hurtType = 0x48;
super->hitType = 7;
super->flags2 = 0x17;
super->collisionMask = 0x17;
super->hitbox = (Hitbox*)&gUnk_080FD1A8;
super->gustJarFlags = 1;
this->unk_74 = super->x.HALF.HI;
+3 -3
View File
@@ -54,7 +54,7 @@ void ObjectOnSpinyBeetle_Init(ObjectOnSpinyBeetleEntity* this) {
super->spriteRendering.b3 = 2;
super->subtimer = 0;
super->hitType = 0x6e;
super->flags2 = 0x86;
super->collisionMask = 0x86;
super->carryFlags = 0;
if (super->type != 0) {
super->gustJarFlags = 2;
@@ -72,7 +72,7 @@ void ObjectOnSpinyBeetle_Action1(ObjectOnSpinyBeetleEntity* this) {
sub_080989C0(this);
return;
}
if ((super->contactFlags & CONTACT_TAKE_DAMAGE) != 0) {
if ((super->contactFlags & CONTACT_NOW) != 0) {
switch (super->contactFlags & 0x3f) {
case 0x13:
super->action = 3;
@@ -138,7 +138,7 @@ void ObjectOnSpinyBeetle_Action2Subaction0(ObjectOnSpinyBeetleEntity* this) {
super->flags |= ENT_COLLIDE;
super->collisionFlags = 7;
super->hitType = 1;
super->flags2 = gPlayerEntity.base.flags2;
super->collisionMask = gPlayerEntity.base.collisionMask;
super->spriteOffsetY = 0;
(super->parent)->child = NULL;
super->subAction++;
+1 -1
View File
@@ -163,7 +163,7 @@ void sub_08084B1C(PlayerCloneEntity* this) {
super->spritePriority.b0 = gPlayerEntity.base.spritePriority.b0;
super->spriteOrientation.flipY = gPlayerEntity.base.spriteOrientation.flipY;
super->collisionLayer = gPlayerEntity.base.collisionLayer;
super->flags2 = gPlayerEntity.base.flags2;
super->collisionMask = gPlayerEntity.base.collisionMask;
super->hitType = gPlayerEntity.base.hitType;
super->collisionFlags = gPlayerEntity.base.collisionFlags;
super->hurtType = gPlayerEntity.base.hurtType;
+2 -2
View File
@@ -72,7 +72,7 @@ void Pot_Init(PotEntity* this) {
super->health = 1;
super->collisionFlags = 7;
super->hitType = 0x6E;
super->flags2 = 0x84;
super->collisionMask = 0x84;
super->gustJarFlags = 0x12;
if (super->collisionLayer == 0) {
ResolveCollisionLayer(super);
@@ -156,7 +156,7 @@ void sub_08082510(PotEntity* this) {
super->hitbox = (Hitbox*)&gUnk_080FD340;
super->collisionFlags = 7;
super->hitType = 1;
super->flags2 = gPlayerEntity.base.flags2;
super->collisionMask = gPlayerEntity.base.collisionMask;
super->spriteOffsetY = 0;
SetBottomTile((u16)this->unk_70, COORD_TO_TILE(super), super->collisionLayer);
super->subAction++;
+2 -2
View File
@@ -63,7 +63,7 @@ void PullableMushroom_Init(PullableMushroomEntity* this) {
super->health = 1;
super->collisionFlags = 7;
super->hitType = 0x6e;
super->flags2 = 0x0e;
super->collisionMask = 0x0e;
super->gustJarFlags = 1;
super->flags |= 0x80;
super->spriteOffsetY = 4;
@@ -76,7 +76,7 @@ void PullableMushroom_Init(PullableMushroomEntity* this) {
super->health = 1;
super->collisionFlags = 7;
super->hitType = 0x6e;
super->flags2 = 4;
super->collisionMask = 4;
super->gustJarFlags = 1;
super->action = 3;
}
+2 -2
View File
@@ -37,14 +37,14 @@ void SanctuaryStoneTablet_Init(SanctuaryStoneTabletEntity* this) {
super->collisionFlags = 7;
super->hurtType = 0x48;
super->hitType = 1;
super->flags2 = 2;
super->collisionMask = 2;
super->hitbox = (Hitbox*)&gHitbox_0;
}
void SanctuaryStoneTablet_Action1(SanctuaryStoneTabletEntity* this) {
Entity* fxEnt;
if (super->contactFlags == (CONTACT_TAKE_DAMAGE | 0x21)) {
if (super->contactFlags == (CONTACT_NOW | 0x21)) {
fxEnt = CreateFx(super, FX_MAGIC_STORM, 0);
if (fxEnt != NULL) {
fxEnt->spritePriority.b0 = 3;
+2 -2
View File
@@ -60,7 +60,7 @@ void SmallIceBlock_Init(SmallIceBlockEntity* this) {
super->collisionFlags = 7;
super->hurtType = 0x48;
super->hitType = 1;
super->flags2 = 0x80;
super->collisionMask = 0x80;
super->hitbox = (Hitbox*)&gUnk_080FD408;
sub_08099468(this);
InitializeAnimation(super, super->type);
@@ -281,7 +281,7 @@ bool32 sub_0809963C(SmallIceBlockEntity* this) {
}
}
}
if (super->contactFlags == (CONTACT_TAKE_DAMAGE | 0x7)) {
if (super->contactFlags == (CONTACT_NOW | 0x7)) {
return TRUE;
}
return FALSE;
+1 -1
View File
@@ -36,7 +36,7 @@ void SmokeParticle_Init(Entity* this) {
this->hitType = 0xa9;
this->hurtType = 0x16;
this->hitbox = (Hitbox*)gUnk_08120A54[0];
this->flags2 = 0x8b;
this->collisionMask = 0x8b;
sub_080878CC(this);
InitializeAnimation(this, 1);
sub_0801766C(this);
+1 -1
View File
@@ -26,7 +26,7 @@ void TreeThorns(Entity* this) {
this->collisionFlags = 7;
this->hurtType = 0x48;
this->hitType = 0x7a;
this->flags2 = 1;
this->collisionMask = 1;
this->hitbox = (Hitbox*)&gHitbox_1;
tilePos = COORD_TO_TILE(this);
SetBottomTile(0x4066, tilePos - 1, *layer);
+2 -2
View File
@@ -36,7 +36,7 @@ void UnusedSkull_Init(UnusedSkullEntity* this) {
super->collisionFlags = 7;
super->hitType = 1;
super->hurtType = 0x47;
super->flags2 = 2;
super->collisionMask = 2;
super->hitbox = (Hitbox*)&gHitbox_4;
SetBottomTile(0x4050, COORD_TO_TILE(super), super->collisionLayer);
if (super->type == 1 || CheckFlags(this->unk_86)) {
@@ -49,7 +49,7 @@ void UnusedSkull_Init(UnusedSkullEntity* this) {
}
void UnusedSkull_Action1(UnusedSkullEntity* this) {
if (super->contactFlags == (CONTACT_TAKE_DAMAGE | 0x1c)) {
if (super->contactFlags == (CONTACT_NOW | 0x1c)) {
super->action = 2;
super->flags &= ~0x80;
CreateFx(super, FX_ICE, 0);
+2 -2
View File
@@ -33,7 +33,7 @@ void Whirlwind_Init(Entity* this) {
this->hitType = 1;
this->collisionFlags = 0x47;
this->hurtType = 0x44;
this->flags2 = 0x80;
this->collisionMask = 0x80;
this->spriteOrientation.flipY = 1;
this->spriteRendering.b3 = 1;
this->animationState = this->type;
@@ -58,7 +58,7 @@ void Whirlwind_Action1(Entity* this) {
}
if (this->spriteSettings.draw != 0) {
GetNextFrame(this);
if ((((((gPlayerState.flags & PL_MINISH) == 0)) && (gPlayerState.field_0x3c == 0)) &&
if ((((((gPlayerState.flags & PL_MINISH) == 0)) && (gPlayerState.killed == 0)) &&
((gPlayerEntity.base.action == PLAYER_JUMP || ((gPlayerEntity.base.flags & ENT_COLLIDE) != 0)))) &&
((gPlayerEntity.base.action != PLAYER_BOUNCE &&
(sub_0800419C(this, &gPlayerEntity.base, 0xc, 0xc) != 0)))) {