Exemplo n.º 1
0
IO_stat MCColors::load(IO_handle stream, uint32_t version)
{
	IO_stat stat;
	if ((stat = MCObject::load(stream, version)) != IO_NORMAL)
		return stat;
	return loadpropsets(stream, version);
}
Exemplo n.º 2
0
IO_stat MCPlayer::load(IO_handle stream, uint32_t version)
{
	IO_stat stat;
    
	if ((stat = MCObject::load(stream, version)) != IO_NORMAL)
		return stat;
	
	// MW-2013-11-19: [[ UnicodeFileFormat ]] If sfv >= 7000, use unicode.
	if ((stat = IO_read_stringref_new(filename, stream, version >= 7000)) != IO_NORMAL)
		return stat;
	uint32_t t_starttime, t_endtime;
	if ((stat = IO_read_uint4(&t_starttime, stream)) != IO_NORMAL)
		return stat;
	starttime = t_starttime;
	if ((stat = IO_read_uint4(&t_endtime, stream)) != IO_NORMAL)
		return stat;
	endtime = t_endtime;
	int4 trate;
	if ((stat = IO_read_int4(&trate, stream)) != IO_NORMAL)
		return stat;
	rate = (real8)trate * 10.0 / MAXINT4;
	
	// MW-2013-11-19: [[ UnicodeFileFormat ]] If sfv >= 7000, use unicode.
	if ((stat = IO_read_stringref_new(userCallbackStr, stream, version >= 7000)) != IO_NORMAL)
		return stat;
	return loadpropsets(stream, version);
}
Exemplo n.º 3
0
IO_stat MCVideoClip::load(IO_handle stream, const char *version)
{
	IO_stat stat;

	if ((stat = MCObject::load(stream, version)) != IO_NORMAL)
		return stat;
	if ((stat = IO_read_uint4(&size, stream)) != IO_NORMAL)
		return stat;
	if (size != 0)
	{
		frames = new uint1[size];
		if ((stat = IO_read(frames, sizeof(uint1), size, stream)) != IO_NORMAL)
			return stat;
	}
	if (flags & F_FRAME_RATE)
		if ((stat = IO_read_uint2(&framerate, stream)) != IO_NORMAL)
			return stat;
	if (flags & F_SCALE_FACTOR)
	{
		int4 i;
		if ((stat = IO_read_int4(&i, stream)) != IO_NORMAL)
			return stat;
		scale = MCU_i4tor8(i);
	}
	return loadpropsets(stream);
}
Exemplo n.º 4
0
IO_stat MCEPS::load(IO_handle stream, uint32_t version)
{
	IO_stat stat;

	if ((stat = MCObject::load(stream, version)) != IO_NORMAL)
		return stat;
	delete postscript;
	delete prolog;
	if ((stat = IO_read_uint4(&size, stream)) != IO_NORMAL)
		return stat;
	postscript = new char[size + 1];
	if ((stat = IO_read(postscript, size, stream)) != IO_NORMAL)
		return stat;
	postscript[size] = '\0';
	// MW-2013-11-19: [[ UnicodeFileFormat ]] EPS is always ASCII so legacy.
	if ((stat = IO_read_cstring_legacy(prolog, stream, 2)) != IO_NORMAL)
		return stat;
	int4 i;
	if ((stat = IO_read_int4(&i, stream)) != IO_NORMAL)
		return stat;
	xscale = MCU_i4tor8(i);
	if (flags & F_SCALE_INDEPENDENTLY)
	{
		if ((stat = IO_read_int4(&i, stream)) != IO_NORMAL)
			return stat;
		yscale = MCU_i4tor8(i);
	}
	else
		yscale = xscale;
	if ((stat = IO_read_int2(&angle, stream)) != IO_NORMAL)
		return stat;
	if ((stat = IO_read_int2(&tx, stream)) != IO_NORMAL)
		return stat;
	if ((stat = IO_read_int2(&ty, stream)) != IO_NORMAL)
		return stat;
	if ((stat = IO_read_uint2(&ex, stream)) != IO_NORMAL)
		return stat;
	if ((stat = IO_read_uint2(&ey, stream)) != IO_NORMAL)
		return stat;
	if (flags & F_RETAIN_IMAGE)
	{
		image = new MCImage;
		image->setparent(this);
		if ((stat = image->load(stream, version)) != IO_NORMAL)
			return stat;
	}
	if (version > 1300)
	{
		if ((stat = IO_read_uint2(&curpage, stream)) != IO_NORMAL)
			return stat;
		if ((stat = IO_read_uint2(&pagecount, stream)) != IO_NORMAL)
			return stat;
		if (pagecount > 0)
		{
			pageIndex = new uint4[pagecount];
			for (i = 0 ; i < pagecount ; i++)
				if ((stat = IO_read_uint4(&pageIndex[i], stream)) != IO_NORMAL)
					return stat;
		}
	}
	return loadpropsets(stream, version);
}
Exemplo n.º 5
0
IO_stat MCEPS::load(IO_handle stream, const char *version)
{
	IO_stat stat;

	if ((stat = MCObject::load(stream, version)) != IO_NORMAL)
		return stat;
	delete postscript;
	delete prolog;
	if ((stat = IO_read_uint4(&size, stream)) != IO_NORMAL)
		return stat;
	postscript = new char[size + 1];
	if ((stat = IO_read(postscript, sizeof(char), size, stream)) != IO_NORMAL)
		return stat;
	postscript[size] = '\0';
	if ((stat = IO_read_string(prolog, stream)) != IO_NORMAL)
		return stat;
	int4 i;
	if ((stat = IO_read_int4(&i, stream)) != IO_NORMAL)
		return stat;
	xscale = MCU_i4tor8(i);
	if (flags & F_SCALE_INDEPENDENTLY)
	{
		if ((stat = IO_read_int4(&i, stream)) != IO_NORMAL)
			return stat;
		yscale = MCU_i4tor8(i);
	}
	else
		yscale = xscale;
	if ((stat = IO_read_int2(&angle, stream)) != IO_NORMAL)
		return stat;
	if ((stat = IO_read_int2(&tx, stream)) != IO_NORMAL)
		return stat;
	if ((stat = IO_read_int2(&ty, stream)) != IO_NORMAL)
		return stat;
	if ((stat = IO_read_uint2(&ex, stream)) != IO_NORMAL)
		return stat;
	if ((stat = IO_read_uint2(&ey, stream)) != IO_NORMAL)
		return stat;
	if (flags & F_RETAIN_IMAGE)
	{
		image = new MCImage;
		image->setparent(this);
		if ((stat = image->load(stream, version)) != IO_NORMAL)
			return stat;
	}
	if (strncmp(version, "1.3", 3) > 0)
	{
		if ((stat = IO_read_uint2(&curpage, stream)) != IO_NORMAL)
			return stat;
		if ((stat = IO_read_uint2(&pagecount, stream)) != IO_NORMAL)
			return stat;
		if (pagecount > 0)
		{
			pageIndex = new uint4[pagecount];
			for (i = 0 ; i < pagecount ; i++)
				if ((stat = IO_read_uint4(&pageIndex[i], stream)) != IO_NORMAL)
					return stat;
		}
	}
	return loadpropsets(stream);
}