コード例 #1
0
ファイル: LevelScript.cs プロジェクト: aglab2/f3dfix
        private static void RelocationParse_cmd24(ROM rom, RelocationTable table, RegionParseState state)
        {
            int behaviour = rom.Read32(0x14);

            if (behaviour == scrollBehaviour || behaviour == scrollBehaviourLegacy)
            {
                int address = 0;

                int    intX  = rom.Read16(0x04);
                float  X     = intX;
                byte[] Xdata = BitConverter.GetBytes(X);

                address += Xdata[2] * 0x10000;
                address += (ushort)rom.Read16(0x10);

                int segmentedAddress = address - 0x20000 + 0x0E000000;

                int newSegmentedAddress = table.Relocate((int)state.area, segmentedAddress);
                if (newSegmentedAddress == -1)
                {
                    throw new ArgumentException("Failed to relocate scrolling texture!");
                }

                int newAddress = newSegmentedAddress - 0x0E000000 + 0x20000;

                Xdata[2] = (byte)((newAddress >> 16) & 0xFF);
                float newX    = BitConverter.ToSingle(Xdata, 0);
                int   newIntX = Convert.ToInt16(newX);

                rom.Write16(newIntX, 0x04);
                rom.Write16(newAddress & 0xFFFF, 0x10);
                rom.Write32(scrollBehaviourLegacy, 0x14);
            }
        }
コード例 #2
0
        private static void FixParse_cmdBC(ROM rom, DisplayListRegion region, RegionFixState state)
        {
            if (state.config.disableFog)
            {
                rom.Write64(0);
                return;
            }

            if (state.config.nerfFog)
            {
                float A = rom.Read16(4);
                float B = rom.Read16(6);

                float min = 500 * (1 - B / A);
                float max = 128000 / A + min;

                // nerf fog
                min += 5;
                A    = 128000 / (max - min);
                B    = (500 - min) * 256 / (max - min);

                int Aint = (int)A;
                int Bint = (int)B;

                rom.Write16(Aint, 4);
                rom.Write16(Bint, 6);
            }
        }
コード例 #3
0
ファイル: Scrolls.cs プロジェクト: aglab2/f3dfix
 public override void WriteScroll(ROM rom)
 {
     rom.PushOffset(romOffset);
     rom.Write8(acts, 0x02);
     rom.Write16(X, 0x04);
     rom.Write16(Y, 0x06);
     rom.Write32(segmentedAddress, 0x10);
     rom.Write32(behavior, 0x14);
     rom.PopOffset();
 }
コード例 #4
0
ファイル: Scrolls.cs プロジェクト: aglab2/f3dfix
 public override void WriteScroll(ROM rom)
 {
     rom.PushOffset(romOffset);
     rom.Write8(acts, 0x02);
     rom.Write16(X, 0x04);
     rom.Write16(Y, 0x06);
     rom.Write16(Z, 0x08);
     rom.Write16(BParam, 0x10);
     rom.Write16(BParam2, 0x12);
     rom.Write32(behavior, 0x14);
     rom.PopOffset();
 }