Dedupe PrizeDropFall (#1714)

Progress towards fixing CEN HD
This commit is contained in:
sozud 2024-10-02 12:10:44 -07:00 committed by GitHub
parent eff7109db4
commit 1117ef0af1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 34 additions and 46 deletions

View File

@ -71,7 +71,7 @@ SetStep = 0x80194DF8;
InitializeEntity = 0x80194EC8; InitializeEntity = 0x80194EC8;
CheckFieldCollision = 0x80195114; CheckFieldCollision = 0x80195114;
GetPlayerCollisionWith = 0x8019526C; GetPlayerCollisionWith = 0x8019526C;
func_8018CAB0 = 0x80195668; PrizeDropFall = 0x80195668;
func_8018CB34 = 0x801956EC; func_8018CB34 = 0x801956EC;
CollectHeart = 0x80195848; CollectHeart = 0x80195848;
CollectGold = 0x801958C8; CollectGold = 0x801958C8;

View File

@ -22,7 +22,7 @@ UpdateStageEntities = 0x0923ac50;
EntitySoulStealOrb = 0x0923b780; EntitySoulStealOrb = 0x0923b780;
EntityEnemyBlood = 0x0923bce0; EntityEnemyBlood = 0x0923bce0;
BlitChar = 0x0923c3d0; BlitChar = 0x0923c3d0;
func_8018CAB0 = 0x0923c988; PrizeDropFall = 0x0923c988;
func_8018CB34 = 0x0923ca60; func_8018CB34 = 0x0923ca60;
CollectHeart = 0x0923cbe0; CollectHeart = 0x0923cbe0;
CollectGold = 0x0923cc80; CollectGold = 0x0923cc80;

View File

@ -51,7 +51,7 @@ UnkCollisionFunc = 0x801973E4;
CheckFieldCollision = 0x8019750C; CheckFieldCollision = 0x8019750C;
GetPlayerCollisionWith = 0x80197664; GetPlayerCollisionWith = 0x80197664;
ReplaceBreakableWithItemDrop = 0x801979A8; ReplaceBreakableWithItemDrop = 0x801979A8;
func_8018CAB0 = 0x80197A60; PrizeDropFall = 0x80197A60;
func_8018CB34 = 0x80197AE4; func_8018CB34 = 0x80197AE4;
CollectHeart = 0x80197C40; CollectHeart = 0x80197C40;
CollectGold = 0x80197CC0; CollectGold = 0x80197CC0;

View File

@ -110,7 +110,7 @@ UnkCollisionFunc = 0x801C8634;
CheckFieldCollision = 0x801C875C; CheckFieldCollision = 0x801C875C;
GetPlayerCollisionWith = 0x801C88B4; GetPlayerCollisionWith = 0x801C88B4;
ReplaceBreakableWithItemDrop = 0x801C8BF8; ReplaceBreakableWithItemDrop = 0x801C8BF8;
func_8018CAB0 = 0x801C8CB0; PrizeDropFall = 0x801C8CB0;
func_8018CB34 = 0x801C8D34; func_8018CB34 = 0x801C8D34;
CollectHeart = 0x801C8E90; CollectHeart = 0x801C8E90;
CollectGold = 0x801C8F10; CollectGold = 0x801C8F10;

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
#include "common.h" #include "common.h"
#include "stage.h"
INCLUDE_ASM("boss/rbo3/nonmatchings/us", func_801A7D64); INCLUDE_ASM("boss/rbo3/nonmatchings/us", func_801A7D64);
@ -138,7 +139,7 @@ INCLUDE_ASM("boss/rbo3/nonmatchings/us", GetPlayerCollisionWith);
INCLUDE_ASM("boss/rbo3/nonmatchings/us", ReplaceBreakableWithItemDrop); INCLUDE_ASM("boss/rbo3/nonmatchings/us", ReplaceBreakableWithItemDrop);
INCLUDE_ASM("boss/rbo3/nonmatchings/us", func_8018CAB0); #include "../../st/prize_drop_fall.h"
INCLUDE_ASM("boss/rbo3/nonmatchings/us", func_8018CB34); INCLUDE_ASM("boss/rbo3/nonmatchings/us", func_8018CB34);

View File

@ -9,7 +9,7 @@
// e_collect // e_collect
INCLUDE_ASM("st/cen/nonmatchings/e_collect", func_8018CAB0); #include "../prize_drop_fall.h"
INCLUDE_ASM("st/cen/nonmatchings/e_collect", func_8018CB34); INCLUDE_ASM("st/cen/nonmatchings/e_collect", func_8018CB34);

View File

@ -142,23 +142,7 @@ static u8* g_ExplosionAnimations[] = {
// from another file // from another file
extern u16 g_InitializeData0[]; extern u16 g_InitializeData0[];
static void func_8018CAB0(void) { #include "prize_drop_fall.h"
if (g_CurrentEntity->velocityY >= 0) {
g_CurrentEntity->ext.equipItemDrop.fallSpeed +=
g_CurrentEntity->ext.equipItemDrop.gravity;
g_CurrentEntity->velocityX =
g_CurrentEntity->ext.equipItemDrop.fallSpeed;
if (g_CurrentEntity->velocityX == FIX(1) ||
g_CurrentEntity->velocityX == FIX(-1)) {
g_CurrentEntity->ext.equipItemDrop.gravity =
-g_CurrentEntity->ext.equipItemDrop.gravity;
}
}
if (g_CurrentEntity->velocityY < FIX(0.25)) {
g_CurrentEntity->velocityY += FIX(0.125);
}
}
static void func_8018CB34(u16 arg0) { static void func_8018CB34(u16 arg0) {
Collider collider; Collider collider;
@ -192,7 +176,7 @@ static void func_8018CB34(u16 arg0) {
} else { } else {
if (!(collider.effects & EFFECT_NOTHROUGH)) { if (!(collider.effects & EFFECT_NOTHROUGH)) {
MoveEntity(); MoveEntity();
func_8018CAB0(); PrizeDropFall();
} }
} }
} }
@ -414,7 +398,7 @@ void EntityPrizeDrop(Entity* self) {
self->ext.equipItemDrop.aliveTimer = 0x60; self->ext.equipItemDrop.aliveTimer = 0x60;
self->step++; self->step++;
} else { } else {
func_8018CAB0(); PrizeDropFall();
} }
break; break;
case 3: case 3:

View File

@ -1,7 +1,8 @@
// SPDX-License-Identifier: AGPL-3.0-or-later // SPDX-License-Identifier: AGPL-3.0-or-later
#include "common.h" #include "common.h"
#include "stage.h"
INCLUDE_ASM("st/no0/nonmatchings/e_collect", func_8018CAB0); #include "../prize_drop_fall.h"
INCLUDE_ASM("st/no0/nonmatchings/e_collect", func_8018CB34); INCLUDE_ASM("st/no0/nonmatchings/e_collect", func_8018CB34);

18
src/st/prize_drop_fall.h Normal file
View File

@ -0,0 +1,18 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
static void PrizeDropFall(void) {
if (g_CurrentEntity->velocityY >= 0) {
g_CurrentEntity->ext.equipItemDrop.fallSpeed +=
g_CurrentEntity->ext.equipItemDrop.gravity;
g_CurrentEntity->velocityX =
g_CurrentEntity->ext.equipItemDrop.fallSpeed;
if (g_CurrentEntity->velocityX == FIX(1) ||
g_CurrentEntity->velocityX == FIX(-1)) {
g_CurrentEntity->ext.equipItemDrop.gravity =
-g_CurrentEntity->ext.equipItemDrop.gravity;
}
}
if (g_CurrentEntity->velocityY < FIX(0.25)) {
g_CurrentEntity->velocityY += FIX(0.125);
}
}

View File

@ -6,7 +6,7 @@ void HitDetection(void);
void CreateEntityWhenInHorizontalRange(LayoutEntity*); void CreateEntityWhenInHorizontalRange(LayoutEntity*);
void func_8018A520(s16); void func_8018A520(s16);
void UpdateRoomPosition(void); void UpdateRoomPosition(void);
void func_8018CAB0(void); void PrizeDropFall(void);
void InitRoomEntities(s32 objLayoutId); void InitRoomEntities(s32 objLayoutId);
void PlaySfxPositional(u16); void PlaySfxPositional(u16);
void BottomCornerText(u8*, u8); void BottomCornerText(u8*, u8);

View File

@ -98,23 +98,7 @@ static s8 c_HeartPrizes[] = {1, 5};
static s32 g_ExplosionYVelocities[] = { static s32 g_ExplosionYVelocities[] = {
FIX(-1.0), FIX(-1.5), FIX(-1.5), FIX(-1.5), FIX(-3.0)}; FIX(-1.0), FIX(-1.5), FIX(-1.5), FIX(-1.5), FIX(-3.0)};
static void func_8018CAB0(void) { #include "../prize_drop_fall.h"
if (g_CurrentEntity->velocityY >= 0) {
g_CurrentEntity->ext.equipItemDrop.fallSpeed +=
g_CurrentEntity->ext.equipItemDrop.gravity;
g_CurrentEntity->velocityX =
g_CurrentEntity->ext.equipItemDrop.fallSpeed;
if (g_CurrentEntity->velocityX == FIX(1) ||
g_CurrentEntity->velocityX == FIX(-1)) {
g_CurrentEntity->ext.equipItemDrop.gravity =
-g_CurrentEntity->ext.equipItemDrop.gravity;
}
}
if (g_CurrentEntity->velocityY < FIX(0.25)) {
g_CurrentEntity->velocityY += FIX(0.125);
}
}
static void func_8018CB34(u16 arg0) { static void func_8018CB34(u16 arg0) {
Collider collider; Collider collider;
@ -151,7 +135,7 @@ static void func_8018CB34(u16 arg0) {
if (!(collider.effects & EFFECT_NOTHROUGH)) { if (!(collider.effects & EFFECT_NOTHROUGH)) {
MoveEntity(); MoveEntity();
func_8018CAB0(); PrizeDropFall();
} }
} }
@ -350,7 +334,7 @@ void EntityPrizeDrop(Entity* self) {
self->ext.equipItemDrop.aliveTimer = 0x60; self->ext.equipItemDrop.aliveTimer = 0x60;
self->step++; self->step++;
} else { } else {
func_8018CAB0(); PrizeDropFall();
} }
break; break;
case 3: case 3: