mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-24 12:51:30 +00:00
102 lines
2.3 KiB
C#
102 lines
2.3 KiB
C#
|
|
#region ================== Copyright (c) 2007 Pascal vd Heiden
|
|
|
|
/*
|
|
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
|
|
* This program is released under GNU General Public License
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
*/
|
|
|
|
#endregion
|
|
|
|
#region ================== Namespaces
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using Microsoft.Win32;
|
|
using System.Diagnostics;
|
|
using CodeImp.DoomBuilder.Data;
|
|
using CodeImp.DoomBuilder.Map;
|
|
using CodeImp.DoomBuilder.Config;
|
|
|
|
#endregion
|
|
|
|
namespace CodeImp.DoomBuilder.Interface
|
|
{
|
|
public partial class ThingInfoPanel : UserControl
|
|
{
|
|
// Constructor
|
|
public ThingInfoPanel()
|
|
{
|
|
// Initialize
|
|
InitializeComponent();
|
|
}
|
|
|
|
// This shows the info
|
|
public void ShowInfo(Thing t)
|
|
{
|
|
ThingTypeInfo ti;
|
|
int zvalue;
|
|
string zinfo;
|
|
|
|
// Lookup thing info
|
|
ti = General.Map.Config.GetThingInfo(t.Type);
|
|
|
|
// TODO: Lookup action description from config
|
|
|
|
// Determine z info to show
|
|
if(t.Sector != null)
|
|
{
|
|
// Hangs from ceiling?
|
|
if(ti.Hangs)
|
|
{
|
|
zvalue = t.Sector.CeilHeight + t.ZOffset;
|
|
zinfo = zvalue.ToString();
|
|
}
|
|
else
|
|
{
|
|
zvalue = t.Sector.FloorHeight + t.ZOffset;
|
|
zinfo = zvalue.ToString();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
zvalue = t.ZOffset;
|
|
if(zvalue > 0) zinfo = "+" + zvalue.ToString(); else zinfo = zvalue.ToString();
|
|
}
|
|
|
|
// Thing info
|
|
type.Text = t.Type + " - " + ti.Title;
|
|
action.Text = ""; // TODO
|
|
position.Text = t.X.ToString() + ", " + t.Y.ToString() + ", " + zinfo;
|
|
tag.Text = ""; // TODO
|
|
angle.Text = t.AngleDeg.ToString() + "\u00B0";
|
|
spritename.Text = ti.Sprite;
|
|
spritetex.BackgroundImage = FindSprite(ti.Sprite);
|
|
|
|
// Show the whole thing
|
|
this.Show();
|
|
this.Update();
|
|
}
|
|
|
|
// This loads and returns the sprite image if possible
|
|
private Image FindSprite(string name)
|
|
{
|
|
ImageData img;
|
|
|
|
// Get it
|
|
img = General.Map.Data.GetSpriteByName(name);
|
|
img.LoadImage();
|
|
return img.Bitmap;
|
|
}
|
|
}
|
|
}
|