Example #1
0
        public EventScene(byte[] file, int address, uint imageBase, bool battle, Dictionary <string, NJS_OBJECT> models, List <NJS_MOTION> motions)
        {
            int ptr = file.GetPointer(address, imageBase);

            if (ptr != 0)
            {
                int cnt = ByteConverter.ToInt32(file, address + 4);
                Entities = new List <EventEntity>(cnt);
                for (int i = 0; i < cnt; i++)
                {
                    Entities.Add(new EventEntity(file, ptr, imageBase, battle, models, motions));
                    ptr += EventEntity.Size(battle);
                }
            }
            ptr = file.GetPointer(address + 8, imageBase);
            if (ptr != 0)
            {
                int cnt = ByteConverter.ToInt32(file, address + 12);
                CameraMotions = new List <NJS_MOTION>(cnt);
                for (int i = 0; i < cnt; i++)
                {
                    if (battle)
                    {
                        CameraMotions.Add(motions[ByteConverter.ToInt32(file, ptr)]);
                    }
                    else
                    {
                        CameraMotions.Add(new NJS_MOTION(file, file.GetPointer(ptr, imageBase), imageBase, 1));
                    }
                    ptr += sizeof(int);
                }
            }
            ptr = file.GetPointer(address + 24, imageBase);
            if (ptr != 0)
            {
                Big = new EventBig(file, ptr, imageBase, battle, models, motions);
            }
            FrameCount = ByteConverter.ToInt32(file, address + 28);
        }