// Blit source ImageData onto paper doll void BlitPaperDoll(ImageData source, byte index = 0xff) { Color32[] colors = ImageReader.GetColors(source); BlitImage( ref colors, new Vector2(source.width, source.height), new Vector2(paperDollWidth, paperDollHeight), new Vector2(source.offset.X, source.offset.Y), maskColor, index); }
// Special blit for upper half of player body void BlitUpperBody(ImageData body) { // Get body above waist Color32[] colors = ImageReader.GetColors(body); Rect rect = new Rect(0, body.height - waistHeight, body.width, waistHeight); Color32[] newColors = ImageReader.GetSubColors(colors, rect, (int)rect.width, (int)rect.height); BlitImage( ref newColors, new Vector2(rect.width, rect.height), new Vector2(paperDollWidth, paperDollHeight), new Vector2(body.offset.X, body.offset.Y), maskColor); }
// Copy body parts to target void BlitBody(PlayerEntity entity) { // Get gender-based body parts ImageData nudeBody = new ImageData(); ImageData clothedBody = new ImageData(); ImageData head = new ImageData(); if (entity.Gender == Genders.Male) { nudeBody = ImageReader.GetImageData(entity.RaceTemplate.PaperDollBodyMaleUnclothed, 0, 0, true); clothedBody = ImageReader.GetImageData(entity.RaceTemplate.PaperDollBodyMaleClothed, 0, 0, true); head = ImageReader.GetImageData(entity.RaceTemplate.PaperDollHeadsMale, entity.FaceIndex, 0, true); } else if (entity.Gender == Genders.Female) { nudeBody = ImageReader.GetImageData(entity.RaceTemplate.PaperDollBodyFemaleUnclothed, 0, 0, true); clothedBody = ImageReader.GetImageData(entity.RaceTemplate.PaperDollBodyFemaleClothed, 0, 0, true); head = ImageReader.GetImageData(entity.RaceTemplate.PaperDollHeadsFemale, entity.FaceIndex, 0, true); } else { return; } // Draw standard body BlitPaperDoll(nudeBody); // Censor nudity if this setting enabled by using welded-on clothes. // But only if censored part of body is actually unclothed. // Otherwise welded-on clothes can be visible around equipped clothes. // This involves a special blit to draw top and bottom halves independently. if (!DaggerfallUnity.Settings.PlayerNudity) { if (!entity.ItemEquipTable.IsUpperClothed()) BlitUpperBody(clothedBody); if (!entity.ItemEquipTable.IsLowerClothed()) BlitLowerBody(clothedBody); } // Blit head BlitPaperDoll(head); }