コード例 #1
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);
            }
        }
コード例 #2
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);
            }
        }
コード例 #3
0
ファイル: Scrolls.cs プロジェクト: aglab2/f3dfix
 public EditorScroll(ROM rom) : base(rom)
 {
     segmentedAddress = 0x0e000000;
     acts             = rom.Read8(0x02);
     X       = rom.Read16(0x04);
     Y       = rom.Read16(0x06);
     Z       = rom.Read16(0x08);
     BParam  = rom.Read16(0x10);
     BParam2 = rom.Read16(0x12);
 }
コード例 #4
0
        private static void RegionParse_common(ROM rom, List <Region> regions)
        {
            // Triangles of any collision

            int size = rom.Read16(2);

            if (size == 0)
            {
                throw new ArgumentException("common collision loop detected");
            }

            int collType     = rom.Read8(1);
            int triangleSize = 6;

            switch (collType)
            {
            case 0x0E:
            case 0x24:
            case 0x25:
            case 0x27:
            case 0x2C:
            case 0x2D:
                triangleSize = 8;
                break;
            }

            rom.AddOffset(4 + size * triangleSize);
        }
コード例 #5
0
        private static void RegionParse_cmd40(ROM rom, List <Region> regions)
        {
            // Vertexes
            int size = rom.Read16(2);

            rom.AddOffset(4 + size * 6);
        }
コード例 #6
0
        private static void RegionParse_cmdF0(ROM rom, List <Region> regions, RegionParseState state)
        {
            if (state.FDAddress == -1)
            {
                return;
            }

            int w0         = rom.Read16(5);
            int colorCount = (w0 >> (4 + 2)) + 1;

            state.textureData.AddRegion(state.FDAddress, colorCount * 2);
        }
コード例 #7
0
        private static void RegionParse_cmd04(ROM rom, List <Region> regions, RegionParseState state)
        {
            int segment = rom.Read8(4);

            if (segment != 0x0e)
            {
                return;
            }

            int segmentedAddress = rom.Read32(4);
            int address          = rom.GetROMAddress(segmentedAddress);

            state.vertexData.AddRegion(address, rom.Read16(2));
            //regions.Add(new Region(address, rom.Read16(2), RegionState.VertexInfo));
        }