Ejemplo n.º 1
0
bool loadVariable(Variable *to, Common::SeekableReadStream *stream) {
	to->varType = (VariableType)stream->readByte();
	switch (to->varType) {
		case SVT_INT:
		case SVT_FUNC:
		case SVT_BUILT:
		case SVT_FILE:
		case SVT_OBJTYPE:
			to->varData.intValue = stream->readUint32LE();
			return true;

		case SVT_STRING:
			to->varData.theString = createCString(readString(stream));
			return true;

		case SVT_STACK:
			to->varData.theStack = loadStackRef(stream);
			return true;

		case SVT_COSTUME:
			to->varData.costumeHandler = new Persona;
			if (!checkNew(to->varData.costumeHandler))
				return false;
			loadCostume(to->varData.costumeHandler, stream);
			return true;

		case SVT_ANIM:
			to->varData.animHandler = new PersonaAnimation ;
			if (!checkNew(to->varData.animHandler))
				return false;
			loadAnim(to->varData.animHandler, stream);
			return true;

		default:
			break;
	}
	return true;
}
Ejemplo n.º 2
0
bool loadPeople (FILE * fp) {
	onScreenPerson * * pointy = & allPeople;
	onScreenPerson * me;

	scaleHorizon = getSigned (fp);
	scaleDivide = getSigned (fp);

	int countPeople = get2bytes (fp);
	int a;

	allPeople = NULL;
	for (a = 0; a < countPeople; a ++) {
		me = new onScreenPerson;
		if (! checkNew (me)) return false;

		me -> myPersona = new persona;
		if (! checkNew (me -> myPersona)) return false;

		me -> myAnim = new personaAnimation;
		if (! checkNew (me -> myAnim)) return false;

		me -> x = getFloat (fp);
		me -> y = getFloat (fp);

		loadCostume (me -> myPersona, fp);
		loadAnim (me -> myAnim, fp);

		me -> lastUsedAnim = fgetc (fp) ? me -> myAnim : NULL;

		me -> scale = getFloat (fp);

		me -> extra = get2bytes (fp);
		me -> height = get2bytes (fp);
		me -> walkToX = get2bytes (fp);
		me -> walkToY = get2bytes (fp);
		me -> thisStepX = get2bytes (fp);
		me -> thisStepY = get2bytes (fp);
		me -> frameNum = get2bytes (fp);
		me -> frameTick = get2bytes (fp);
		me -> walkSpeed = get2bytes (fp);
		me -> spinSpeed = get2bytes (fp);
		me -> floaty = getSigned (fp);
		me -> show = fgetc (fp);
		me -> walking = fgetc (fp);
		me -> spinning = fgetc (fp);
		if (fgetc (fp)) {
			me -> continueAfterWalking = loadFunction (fp);
			if (! me -> continueAfterWalking) return false;
		} else {
			me -> continueAfterWalking = NULL;
		}
		me -> direction = get2bytes(fp);
		me -> angle = get2bytes(fp);
		if (ssgVersion >= VERSION(2,0)) {
			me -> angleOffset = get2bytes(fp);
		} else {
			me -> angleOffset = 0;
		}
		me -> wantAngle = get2bytes(fp);
		me -> directionWhenDoneWalking = getSigned(fp);
		me -> inPoly = getSigned(fp);
		me -> walkToPoly = getSigned(fp);
		if (ssgVersion >= VERSION(2,0)) {
			me -> r = fgetc (fp);
			me -> g = fgetc (fp);
			me -> b = fgetc (fp);
			me -> colourmix = fgetc (fp);
			me -> transparency = fgetc (fp);
		} else {
			setMyDrawMode(me, get2bytes(fp));
		}
		me -> thisType = loadObjectRef (fp);

		// Anti-aliasing settings
		if (ssgVersion >= VERSION(1,6))
		{
			if (ssgVersion < VERSION (2,0)) {
				// aaLoad
				fgetc (fp);
				getFloat (fp);
				getFloat (fp);
			}
		}

		me -> next = NULL;
		* pointy = me;
		pointy = & (me -> next);
	}
//	db ("End of loadPeople");
	return true;
}