public static bool Delete(NPC npc) { if (!Program.currentMap.NPCs.Remove(npc)) return false; Program.isEdited = true; return true; }
public void LoadNPCView(NPC npc) { loadingEntityView = true; panelSpriteEvent.Visible = true; nudEntityNum.Enabled = true; nudNPCNum.Value = npc.npcNumber; nudNPCSpriteNum.Value = npc.spriteNumber; hexNumberBoxNPCReplacement.Text = npc.replacement.ToString("X2"); hexNumberBoxNPCFiller1.Text = npc.filler1.ToString("X2"); hexNumberBoxNPCXPos.Text = npc.xPos.ToString("X4"); hexNumberBoxNPCYPos.Text = npc.yPos.ToString("X4"); hexNumberBoxNPCHeight.Text = npc.height.ToString("X2"); SetupNPCReplacement(npc); hexNumberBoxNPCIdleAnim.Text = npc.idleAnimation.ToString("X2"); cbNPCIdleAnim.SelectedIndex = npc.idleAnimation; hexNumberBoxNPCXBound.Text = npc.xBounds.ToString("X1"); hexNumberBoxNPCYBound.Text = npc.yBounds.ToString("X1"); hexNumberBoxNPCFiller2.Text = npc.filler2.ToString("X2"); hexNumberBoxNPCTrainer.Text = npc.trainer.ToString("X2"); hexNumberBoxNPCFiller3.Text = npc.filler3.ToString("X2"); hexNumberBoxNPCViewRadius.Text = npc.viewRadius.ToString("X2"); hexNumberBoxNPCFiller4.Text = npc.filler4.ToString("X2"); hexNumberBoxNPCScriptOffset.Text = (npc.scriptOffset + 0x8000000).ToString("X8"); hexNumberBoxNPCVisibilityFlag.Text = npc.visibilityFlag.ToString("X4"); hexNumberBoxNPCFiller5.Text = npc.filler5.ToString("X2"); hexNumberBoxNPCFiller6.Text = npc.filler6.ToString("X2"); labelNPCOffset.Text = settings.HexPrefix + (npc.offset + 0x8000000).ToString("X8"); hexViewerRawNPC.ByteProvider = new DynamicByteProvider(npc.rawData, true, false, false); PGMEBackend.Program.glEntityEditor.currentEntities = new List<Entity> { npc }; loadingEntityView = false; RefreshEntityEditorControl(); }
public void SetupNPCReplacement(NPC npc) { if (npc.replacement == 0xFF) { cbNPCHeight.Enabled = false; cbNPCHeight.Text = string.Empty; labelNPCHeight.Text = PGMEBackend.Program.rmInternalStrings.GetString("ReplacementNPCNumber"); labelNPCTrainer.Text = PGMEBackend.Program.rmInternalStrings.GetString("ReplacementNPCMap"); labelNPCViewRadius.Text = PGMEBackend.Program.rmInternalStrings.GetString("ReplacementNPCMapBank"); } else { cbNPCHeight.Enabled = true; cbNPCHeight.SelectedIndex = npc.height; cbNPCHeight.Text = cbNPCHeight.GetItemText(cbNPCHeight.SelectedItem); labelNPCHeight.Text = PGMEBackend.Program.rmInternalStrings.GetString("NPCHeight"); labelNPCTrainer.Text = PGMEBackend.Program.rmInternalStrings.GetString("NPCTrainer"); labelNPCViewRadius.Text = PGMEBackend.Program.rmInternalStrings.GetString("NPCViewRadius"); } }
private void WriteNPCData(NPC npc) { PGMEBackend.Program.isEdited = true; npc.WriteDataToRaw(); hexViewerRawNPC.ByteProvider = new DynamicByteProvider(npc.rawData, true, false, false); }
public Entity CreateNewEntity(Entity.EntityType entityType, int xPos = 0, int yPos = 0) { Entity entity; switch (entityType) { default: entity = new NPC((short)xPos, (short)yPos); break; case Entity.EntityType.Warp: entity = new Warp((short)xPos, (short)yPos); break; case Entity.EntityType.Trigger: entity = new Trigger((short)xPos, (short)yPos); break; case Entity.EntityType.Sign: entity = new Sign((short)xPos, (short)yPos); break; } CreateNewEntity(entity); return entity; }