//---------------------------------------------------------------------- // For saving and loading variables... //---------------------------------------------------------------------- bool saveVariable(Variable *from, Common::WriteStream *stream) { stream->writeByte(from->varType); switch (from->varType) { case SVT_INT: case SVT_FUNC: case SVT_BUILT: case SVT_FILE: case SVT_OBJTYPE: stream->writeUint32LE(from->varData.intValue); return true; case SVT_STRING: writeString(from->varData.theString, stream); return true; case SVT_STACK: return saveStackRef(from->varData.theStack, stream); case SVT_COSTUME: saveCostume(from->varData.costumeHandler, stream); return false; case SVT_ANIM: saveAnim(from->varData.animHandler, stream); return false; case SVT_NULL: return false; default: fatal("Can't save variables of this type:", (from->varType < SVT_NUM_TYPES) ? typeName[from->varType] : "bad ID"); } return true; }
bool savePeople (FILE * fp) { onScreenPerson * me = allPeople; int countPeople = 0, a; putSigned (scaleHorizon, fp); putSigned (scaleDivide, fp); while (me) { countPeople ++; me = me -> next; } put2bytes (countPeople, fp); me = allPeople; for (a = 0; a < countPeople; a ++) { putFloat (me -> x, fp); putFloat (me -> y, fp); saveCostume (me -> myPersona, fp); saveAnim (me -> myAnim, fp); fputc (me -> myAnim == me -> lastUsedAnim, fp); putFloat (me -> scale, fp); put2bytes (me -> extra, fp); put2bytes (me -> height, fp); put2bytes (me -> walkToX, fp); put2bytes (me -> walkToY, fp); put2bytes (me -> thisStepX, fp); put2bytes (me -> thisStepY, fp); put2bytes (me -> frameNum, fp); put2bytes (me -> frameTick, fp); put2bytes (me -> walkSpeed, fp); put2bytes (me -> spinSpeed, fp); putSigned (me -> floaty, fp); fputc (me -> show, fp); fputc (me -> walking, fp); fputc (me -> spinning, fp); if (me -> continueAfterWalking) { fputc (1, fp); saveFunction (me -> continueAfterWalking, fp); } else { fputc (0, fp); } put2bytes (me -> direction, fp); put2bytes (me -> angle, fp); put2bytes (me -> angleOffset, fp); put2bytes (me -> wantAngle, fp); putSigned (me -> directionWhenDoneWalking, fp); putSigned (me -> inPoly, fp); putSigned (me -> walkToPoly, fp); fputc (me -> r, fp); fputc (me -> g, fp); fputc (me -> b, fp); fputc (me -> colourmix, fp); fputc (me -> transparency, fp); saveObjectRef (me -> thisType, fp); me = me -> next; } return true; }