예제 #1
0
        public void ReadFromSaveGame(VFile savefile)
        {
            savefile.Read(out enabled);
            savefile.Read(out type);
            savefile.Read(out regCount);
            savefile.ReadTMany(out regs, regs.Length);

            savefile.Read(out int len); savefile.ReadASCII(out name, len);

            var.ReadFromSaveGame(savefile);
        }
예제 #2
0
        public override bool InitFromFile(string qpath, bool looping)
        {
            ushort RoQID;

            Close();

            inMemory        = false;
            animationLength = 100000;

            fileName = !qpath.Contains('/') && !qpath.Contains('\\')
                ? $"video/{qpath}"
                : qpath;
            iFile = fileSystem.OpenFileRead(fileName);
            if (iFile == null)
            {
                return(false);
            }
            ROQSize = iFile.Length;

            this.looping = looping;

            CIN_HEIGHT      = DEFAULT_CIN_HEIGHT;
            CIN_WIDTH       = DEFAULT_CIN_WIDTH;
            samplesPerPixel = 4;
            startTime       = 0;
            buf             = null;

            iFile.Read(file, 16);
            RoQID = (ushort)(file[0] + (file[1] * 256));

            frameRate = file[6];
            if (frameRate == 32f)
            {
                frameRate = 1000f / 32f;
            }

            if (RoQID == ROQ_FILE)
            {
                RoQ_init();
                status = CinStatus.FMV_PLAY;
                ImageForTime(0);
                status = looping ? CinStatus.FMV_PLAY : CinStatus.FMV_IDLE;
                return(true);
            }

            RoQShutdown();
            return(false);
        }
예제 #3
0
        public virtual void ReadFromSaveGame(VFile savefile, GameBustOutWindow game)
        {
            savefile.Read(out x);
            savefile.Read(out y);
            savefile.Read(out width);
            savefile.Read(out height);

            savefile.Read(out powerup);
            savefile.Read(out isBroken);

            savefile.Read(out int index);
            ent = game.entities[index];
        }
예제 #4
0
        public virtual void ReadFromSaveGame(VFile savefile, GameBearShootWindow game)
        {
            this.game = game;

            game.ReadSaveGameString(out materialName, savefile); SetMaterial(materialName);

            savefile.Read(out width);
            savefile.Read(out height);
            savefile.Read(out visible);

            savefile.ReadT(out entColor);
            savefile.ReadT(out position);
            savefile.Read(out rotation);
            savefile.Read(out rotationSpeed);
            savefile.ReadT(out velocity);

            savefile.Read(out fadeIn);
            savefile.Read(out fadeOut);
        }
예제 #5
0
        public virtual void ReadFromSaveGame(VFile savefile, GameBustOutWindow game)
        {
            this.game = game;

            savefile.Read(out visible);

            game.ReadSaveGameString(out materialName, savefile); SetMaterial(materialName);

            savefile.Read(out width);
            savefile.Read(out height);

            savefile.ReadT(out color);
            savefile.ReadT(out position);
            savefile.ReadT(out velocity);

            savefile.Read(out powerup);
            savefile.Read(out removed);
            savefile.Read(out fadeOut);
        }
예제 #6
0
        void RoQInterrupt()
        {
            byte *framedata;

            iFile.Read(file, RoQFrameSize + 8);
            if (RoQPlayed >= ROQSize)
            {
                if (looping)
                {
                    RoQReset();
                }
                else
                {
                    status = CinStatus.FMV_EOF;
                }
                return;
            }

            framedata = file;

            // new frame is ready
redump:
            switch (roq_id)
            {
            case ROQ_QUAD_VQ:
                if ((numQuads & 1) != 0)
                {
                    normalBuffer0 = t1; RoQPrepMcomp(roqF0, roqF1); blitVQQuad32fs(qStatus1, framedata); buf = image + screenDelta;
                }
                else
                {
                    normalBuffer0 = t0; RoQPrepMcomp(roqF0, roqF1); blitVQQuad32fs(qStatus0, framedata); buf = image;
                }
                // first frame
                if (numQuads == 0)
                {
                    Unsafe.CopyBlock(image + screenDelta, image, (uint)(samplesPerLine * ysize));
                }
                numQuads++;
                dirty = true;
                break;

            case ROQ_CODEBOOK: decodeCodeBook(framedata, (ushort)roq_flags); break;

            case ZA_SOUND_MONO: break;

            case ZA_SOUND_STEREO: break;

            case ROQ_QUAD_INFO: if (numQuads == -1)
                {
                    readQuadInfo(framedata); setupQuad(0, 0);
                }
                if (numQuads != 1)
                {
                    numQuads = 0;
                }
                break;

            case ROQ_PACKET: inMemory = roq_flags != 0; RoQFrameSize = 0; break;             // for header

            case ROQ_QUAD_HANG: RoQFrameSize = 0; break;

            case ROQ_QUAD_JPEG: if (numQuads == 0)
                {
                    normalBuffer0 = t0; JPEGBlit(image, framedata, RoQFrameSize); Unsafe.CopyBlock(image + screenDelta, image, (uint)(samplesPerLine * ysize)); numQuads++;
                }
                break;

            default: status = CinStatus.FMV_EOF; break;
            }

            // read in next frame data
            if (RoQPlayed >= ROQSize)
            {
                if (looping)
                {
                    RoQReset();
                }
                else
                {
                    status = CinStatus.FMV_EOF;
                }
                return;
            }

            framedata   += RoQFrameSize;
            roq_id       = framedata[0] + framedata[1] * 256;
            RoQFrameSize = framedata[2] + framedata[3] * 256 + framedata[4] * 65536;
            roq_flags    = framedata[6] + framedata[7] * 256;
            roqF0        = framedata[7];
            roqF1        = framedata[6];

            if (RoQFrameSize > 65536 || roq_id == 0x1084)
            {
                common.DPrintf("roq_size>65536||roq_id==0x1084\n"); status = CinStatus.FMV_EOF; if (looping)
                {
                    RoQReset();
                }
                return;
            }
            if (inMemory && status != CinStatus.FMV_EOF)
            {
                inMemory = false; framedata += 8; goto redump;
            }

            // one more frame hits the dust
            //
            //	assert(RoQFrameSize <= 65536);
            //	r = Sys_StreamedRead( file, RoQFrameSize+8, 1, iFile );
            RoQPlayed += RoQFrameSize + 8;
        }
예제 #7
0
        // Support function for reading from a multimedia I/O stream. mhmmio must be valid before calling.  This function uses it to update mckRiff, and mpwfx.
        unsafe int ReadMMIO()
        {
            Mminfo        ckIn;          // chunk info. for general use.
            PcmWaveFormat pcmWaveFormat; // Temp PCM structure to load in.

            mpwfx = default;

            fixed(void *mckRiff_ = &mckRiff) mhmmio.Read((byte *)mckRiff_, 12);

            Debug.Assert(!isOgg);
            mckRiff.ckid         = LittleInt(mckRiff.ckid);
            mckRiff.cksize       = LittleUInt(mckRiff.cksize);
            mckRiff.fccType      = LittleInt(mckRiff.fccType);
            mckRiff.dwDataOffset = 12;

            // Check to make sure this is a valid wave file
            if (mckRiff.ckid != SoundSystemLocal.fourcc_riff || mckRiff.fccType != SoundSystemLocal.mmioFOURCC('W', 'A', 'V', 'E'))
            {
                return(-1);
            }

            // Search the input file for for the 'fmt ' chunk.
            ckIn.dwDataOffset = 12;
            do
            {
                if (mhmmio.Read((byte *)&ckIn, 8) != 8)
                {
                    return(-1);
                }
                Debug.Assert(!isOgg);
                ckIn.ckid          = LittleInt(ckIn.ckid);
                ckIn.cksize        = LittleUInt(ckIn.cksize);
                ckIn.dwDataOffset += (int)(ckIn.cksize - 8);
            } while (ckIn.ckid != SoundSystemLocal.mmioFOURCC('f', 'm', 't', ' '));

            // Expect the 'fmt' chunk to be at least as large as <PCMWAVEFORMAT>; if there are extra parameters at the end, we'll ignore them
            if (ckIn.cksize < sizeof(PcmWaveFormat))
            {
                return(-1);
            }

            // Read the 'fmt ' chunk into <pcmWaveFormat>.
            if (mhmmio.Read((byte *)&pcmWaveFormat, sizeof(PcmWaveFormat)) != sizeof(PcmWaveFormat))
            {
                return(-1);
            }
            Debug.Assert(!isOgg);
            pcmWaveFormat.wf.wFormatTag      = (WAVE_FORMAT_TAG)LittleShort((short)pcmWaveFormat.wf.wFormatTag);
            pcmWaveFormat.wf.nChannels       = LittleShort(pcmWaveFormat.wf.nChannels);
            pcmWaveFormat.wf.nSamplesPerSec  = LittleInt(pcmWaveFormat.wf.nSamplesPerSec);
            pcmWaveFormat.wf.nAvgBytesPerSec = LittleInt(pcmWaveFormat.wf.nAvgBytesPerSec);
            pcmWaveFormat.wf.nBlockAlign     = LittleShort(pcmWaveFormat.wf.nBlockAlign);
            pcmWaveFormat.wBitsPerSample     = LittleShort(pcmWaveFormat.wBitsPerSample);

            // Copy the bytes from the pcm structure to the waveformatex_t structure
            mpwfx.memcpy(ref pcmWaveFormat);

            // Allocate the waveformatex_t, but if its not pcm format, read the next word, and thats how many extra bytes to allocate.
            if (pcmWaveFormat.wf.wFormatTag == WAVE_FORMAT_TAG.PCM)
            {
                mpwfx.Format.cbSize = 0;
            }
            else
            {
                return(-1);  // we don't handle these (32 bit wavefiles, etc)

#if false
                // Read in length of extra bytes.
                word cbExtraBytes = 0L;
                if (mhmmio.Read((char *)&cbExtraBytes, sizeof(word)) != sizeof(word))
                {
                    return(-1);
                }

                mpwfx.Format.cbSize = cbExtraBytes;

                // Now, read those extra bytes into the structure, if cbExtraAlloc != 0.
                if (mhmmio.Read((char *)(((byte *)&(mpwfx.Format.cbSize)) + sizeof(word)), cbExtraBytes) != cbExtraBytes)
                {
                    memset(&mpwfx, 0, sizeof(waveformatextensible_t)); return(-1);
                }
#endif
            }

            return(0);
        }