Пример #1
0
        private void LoadEnemies(int oData)
        {
            HasBridge = false;

            _doors.Clear();
            _enemies.Clear();

            byte dataByte = data[oData];

            while (dataByte != RomValues.EndOfScreenData)
            {
                // Low nibble of first byte indentifies object type
                RomValues.EnemyIdentifiers objectType = (RomValues.EnemyIdentifiers)(dataByte & 0x0F);

                if (objectType == RomValues.EnemyIdentifiers.Door)
                {
                    _doors.Add(DoorInstance.LoadInstance(data, ref oData));
                }
                else if (objectType == RomValues.EnemyIdentifiers.Enemy || objectType == RomValues.EnemyIdentifiers.RespawnEnemy)
                {
                    _enemies.Add(EnemyInstance.LoadInstance(data, ref oData));
                }
                else if (objectType == RomValues.EnemyIdentifiers.Bridge)
                {
                    HasBridge = true;
                    oData++;
                }
                else
                {
                    break; // Invalid data, stop parsing enemy data
                }

                dataByte = data[oData];
            }
        }