Fix opening inventory with hidden block selected not displaying the block's details as the menu title

This commit is contained in:
UnknownShadow200 2024-04-17 17:42:14 +10:00
parent 2ea26fcf5e
commit e492db93f6
2 changed files with 13 additions and 5 deletions

View File

@ -417,10 +417,11 @@ double Math_Atan2(double x, double y) {
return Atan(y / x) + PI;
return Atan(y / x) - PI;
}
if (y > 0)
return PI / 2.0;
if (y < 0)
return -PI / 2.0;
/* x = 0 case */
if (y > 0) return PI / 2.0;
if (y < 0) return -PI / 2.0;
return DBL_NAN;
}

View File

@ -1649,10 +1649,17 @@ static void InventoryScreen_MoveToSelected(struct InventoryScreen* s) {
if (Game_ClassicMode) {
/* Accuracy: Original classic preserves selected block across inventory menu opens */
TableWidget_SetToIndex(table, table->selectedIndex);
TableWidget_RecreateTitle(table, true);
} else {
TableWidget_SetToBlock(table, Inventory_SelectedBlock);
if (table->selectedIndex == -1) {
/* Hidden block in inventory - display title for it still */
InventoryScreen_OnUpdateTitle(Inventory_SelectedBlock);
} else {
TableWidget_RecreateTitle(table, true);
}
}
TableWidget_RecreateTitle(table, true);
}
static void InventoryScreen_Init(void* screen) {