Fix junk puyo drop not matching the preview

Fixes #248
This commit is contained in:
Mefiresu 2023-11-10 22:40:00 +01:00
parent 8fcbc63559
commit 88cf729ea0

View File

@ -37,7 +37,7 @@ void PuyoMatch_Draw(void)
RSDK.DrawSprite(&self->beanRAnimator, &drawPos, false);
}
if (self->junkBeanCount > 0)
else if (self->junkBeanCount > 0)
PuyoMatch_DrawJunkBeanPreviews();
}
@ -137,14 +137,19 @@ void PuyoMatch_DropJunkBeans(void)
}
}
count = CLAMP(count, 30, self->junkBeanCount);
if (count > 30)
count = 30;
if (count > self->junkBeanCount)
count = self->junkBeanCount;
self->junkBeanCount -= count;
self->junkDropCount -= count << 8;
int32 id = 6 * RSDK.Rand(0, 4);
int32 spawnY = self->beanDropPos.y + 0x100000;
for (int32 i = 0; i < count; ++i) {
while (count > 0) {
int32 column = PuyoMatch->beanDropColumnIDs[id];
if (beanColumnCount[column] > 0) {
EntityPuyoBean *junkBean = CREATE_ENTITY(PuyoBean, INT_TO_VOID(30), self->beanDropPos.x - 0x200000 + (column << 20), spawnY);
@ -154,7 +159,7 @@ void PuyoMatch_DropJunkBeans(void)
self->beanPtr = junkBean;
junkBean->state = PuyoBean_State_Falling;
--count;
beanColumnCount[column]--;
--beanColumnCount[column];
}
id = (id + 1) % -24;