private void FirstDynButton_Click(object sender, EventArgs e) { var sprSel = new SPR2SelectorDialog(ActiveIff, ActiveObject); sprSel.ShowDialog(); var id = sprSel.ChosenID; GameContent.Get.Changes.BlockingResMod(new ResAction(() => { ActiveObject.OBJ.DynamicSpriteBaseId = id; }, ActiveObject.OBJ)); SetActiveObject(ActiveObject); }
private void LastDynButton_Click(object sender, EventArgs e) { var sprSel = new SPR2SelectorDialog(ActiveIff, ActiveObject); sprSel.ShowDialog(); var id = sprSel.ChosenID; Content.Content.Get().Changes.BlockingResMod(new ResAction(() => { ActiveObject.OBJ.NumDynamicSprites = (ushort)Math.Max(0, (id - ActiveObject.OBJ.DynamicSpriteBaseId) + 1); }, ActiveObject.OBJ)); SetActiveObject(ActiveObject); }
private void ChangeSPR_Click(object sender, EventArgs e) { if (ActiveDGRPSprites == null) { return; } var sprSel = new SPR2SelectorDialog(ActiveIff, ActiveObject); sprSel.ShowDialog(); if (sprSel.DialogResult == DialogResult.OK) { var id = sprSel.ChosenID; var zoom = (int)(3 - ActiveDGRPImages[0].Zoom); var rot = (!AutoRot.Checked)?0:((ActiveDGRPImages[0].Direction + 2) % 4); string name = ""; float zFactor = 1.0f; GameContent.Get.Changes.BlockingResMod(new ResAction(() => { foreach (var dgrpSpr in ActiveDGRPSprites) { dgrpSpr.SpriteID = id; //default back to rotation 0 var spr = ActiveIff.Get <SPR2>(id); if (spr == null) { continue; } name = spr.ChunkLabel; dgrpSpr.SpriteFrameIndex = (uint)((spr == null) ? 0 : (zoom * spr.Frames.Length / 3) + rot); AutoOffset(dgrpSpr, spr, zFactor); zoom++; zFactor /= 2; if (zoom > 2) { zoom = (int)(3 - ActiveDGRPImages[0].Zoom); zFactor = 1.0f; rot = (rot + 1) % 4; } } }, ActiveDGRP)); UpdateImage(); } }