mirror of
https://github.com/pret/pmd-red.git
synced 2026-08-24 09:44:17 -05:00
Document floorProps->enemyDensity bug
This commit is contained in:
@@ -120,12 +120,12 @@ typedef struct UnkDungeonGlobal_unk181E8_sub
|
||||
typedef struct FloorProperties
|
||||
{
|
||||
u8 layout;
|
||||
s8 roomDensity;
|
||||
s8 roomDensity; // If positive, allow variance. If negative, use exact value of abs(roomDensity).
|
||||
u8 tileset;
|
||||
u8 bgMusic;
|
||||
u8 weather; // Uses the weather constants in weather.h.
|
||||
u8 floorConnectivity;
|
||||
u8 enemyDensity;
|
||||
u8 enemyDensity; // Game treats this as signed. See SpawnEnemies in src/dungeon_generation.asm for details.
|
||||
u8 kecleonShopChance; // Percentage chance 0-100%
|
||||
u8 monsterHouseChance; // Percentage chance 0-100%
|
||||
u8 mazeRoomChance; // Percentage chance 0-100%
|
||||
|
||||
@@ -4423,6 +4423,9 @@ static void SpawnEnemies(FloorProperties *floorProps, bool8 isEmptyMonsterHouse)
|
||||
s32 numEnemies, numMonsterHouseEnemies;
|
||||
s32 enemyDensity = floorProps->enemyDensity;
|
||||
|
||||
// BUG: Game assumes floorProps->enemyDensity is a signed byte, but in reality it's unsigned.
|
||||
// Attempting to use a negative density will instead produce a very large positive density up to 255.
|
||||
// This only matters for unused dungeons, as Deoxys has its own logic despite Meteor Cave having an effective enemy density of 255.
|
||||
if (enemyDensity > 0) {
|
||||
// Positive means value with variance
|
||||
numEnemies = DungeonRandRange(enemyDensity / 2, enemyDensity);
|
||||
|
||||
Reference in New Issue
Block a user