Entity 2.1.24

A wealth of applications with which you will need to mod Halo 2.
Post Reply
User avatar
CaptainPoopface
Posts: 714
Joined: Sat Feb 16, 2008 5:47 am

Re: Entity 2.1.5

Post by CaptainPoopface »

In real time, the BSP Viewer would only render the scaled visual model of the parallelpiped (the type used in I Can Has Cubes). The user would select a box (which would already have its tag and scnr palette and placement chunks before going into BSP Viewer), and enter 3 values for the length, width and height. Then BSPV would scale the selected box to that size. You could do it as much as you want, editing as many boxes as you want (however many unique boxes you have), one at a time. When you're ready to commit to all the cube edits you've made, you'd click some button like "fix cube collision," and it would then apply the length, width and height values for each box to their coll and phmo.

I'm not talking about making it a CAD program where you'd click and drag cubes to new sizes in real time with the mouse, nor would I intend for mode, coll and phmo to be adjusted automatically after each edit. Basically, it would be like using I Can Has Cubes at the same time as BSPV. I Can Has Cubes is buggy and can only adjust one cube, then must be closed and reopened to edit another cube. And changes you make there are not synchronized with what you see in BSPV while it is open.

As a first pass, BSPV could just make some output text file describing the dimensions of each edited cube by name, then a simple program could open the map and apply those dimensions to coll and phmo.

I'm after just 2 things here: Make a quick way to change the visual size of different boxes and position them to your liking in the viewer; and then apply the corresponding changes to the coll and phmo in batch processing fashion, offline if necessary, even if it takes a few minutes to process.

This map took several hours to make, over a couple of days if I recall correctly. With the method I'm talking about here, it could be done in minutes.
User avatar
JacksonCougar
Huurcat
Posts: 2460
Joined: Thu Dec 06, 2007 11:30 pm
Location: Somewhere in Canada

Re: Entity 2.1.5

Post by JacksonCougar »

Its so improper and really should not be done. And injector for phmo boxes, and coll, etc would solve your problem much better.
User avatar
CaptainPoopface
Posts: 714
Joined: Sat Feb 16, 2008 5:47 am

Re: Entity 2.1.5

Post by CaptainPoopface »

Moving on...

The meta editor has a couple of quirks that impede my workflow.

1) I need to be able to manually type a new string ID in, as opposed to being forced to select it from a very, very long list (twice). The old system that would list only the partial matches of the typed string was much more efficient. Any time I have to mess with SIDs right now, I always close Entity 2.1.5 and open some other version.

2) When I'm scrolling through the dropdown list of chunks in a reflexive but looking at fields that are more than a screen length down, I am forced to select the chunk, then scroll down in the meta editor, then look at the value, scroll back up, move to the next chunk, and repeat over and over. I cannot keep the meta editor focused on the field I'm looking at while moving through the chunks if I have to scroll at any point in the process, because scrolling takes the cursor focus off the dropdown list and moves it to the scroll bar. This is most obnoxious in the scnr, when I'm trying to find a specific spawn out of the 70 or so in the list. It's another reason I close this Entity and open a different version.

3) This is more of a suggestion than a complaint. When the user clicks the "-" to minimize a reflexive, it would be nice if the editor (or the plugin) could remember that and keep it hidden until the next time the user specifically clicks to show it again, even after other plugin loads or program shutdowns. Right now, it is maximized when the user loads some other plugin and comes back.
Basically, it would be dynamic plugin editing, faster and more flexible than manually editing the plugin. But since I have a way of dealing with this already, maybe save it for a rainy day, or for when you're stuck somewhere else and want the sense of accomplishment from doing something (seemingly) easy.
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Entity 2.1.5

Post by troymac1ure »

Should be a new release very soon. I was just looking for some time to compile & u/l it, but I may withhold for a little yet due to the following:
CaptainPoopface wrote: 1) I need to be able to manually type a new string ID in, as opposed to being forced to select it from a very, very long list (twice). The old system that would list only the partial matches of the typed string was much more efficient. Any time I have to mess with SIDs right now, I always close Entity 2.1.5 and open some other version.
I agree. I'm not a fan of the new method. At the least it should be in alphabetical order, but I may try to implement the old method and have the popup box on double-click (sorted though)
CaptainPoopface wrote: 2) When I'm scrolling through the dropdown list of chunks in a reflexive but looking at fields that are more than a screen length down, I am forced to select the chunk, then scroll down in the meta editor, then look at the value, scroll back up, move to the next chunk, and repeat over and over. I cannot keep the meta editor focused on the field I'm looking at while moving through the chunks if I have to scroll at any point in the process, because scrolling takes the cursor focus off the dropdown list and moves it to the scroll bar. This is most obnoxious in the scnr, when I'm trying to find a specific spawn out of the 70 or so in the list. It's another reason I close this Entity and open a different version.
I haven't noticed this, but I've been doing almost strictly programming and not using. lol.
I will look into this and make the scroll bar return focus to the last control before it was selected.
Also, I may try to implement the PageUp/PageDown keys to dec/inc the current refelexive chunk no matter what field you are on. Then you wouldn't have to always scroll up & back down. Thoughts??
CaptainPoopface wrote: 3) This is more of a suggestion than a complaint. When the user clicks the "-" to minimize a reflexive, it would be nice if the editor (or the plugin) could remember that and keep it hidden until the next time the user specifically clicks to show it again, even after other plugin loads or program shutdowns. Right now, it is maximized when the user loads some other plugin and comes back.
Basically, it would be dynamic plugin editing, faster and more flexible than manually editing the plugin. But since I have a way of dealing with this already, maybe save it for a rainy day, or for when you're stuck somewhere else and want the sense of accomplishment from doing something (seemingly) easy.
Sorry, Not going to rush on this one. Other things to do first, but I have changed it so that all reflexives are collapsed on load. Works very nicely for the SNCR tag. I will add this to the end of my list though.
User avatar
CaptainPoopface
Posts: 714
Joined: Sat Feb 16, 2008 5:47 am

Re: Entity 2.1.5

Post by CaptainPoopface »

PgUp/PgDn to change reflexive chunks is a decent solution, although it means the user can't page through the list of chunks anymore (something I do in scnr fairly often). Not a big loss, but I have another idea. How about if the ctrl key is used as a modifier for scroll functions? So Ctrl + Down will scroll the editor down a little, Ctrl + PgDn will scroll it down more, and Ctrl + MouseWheel will scroll the editor up or down, no matter where the cursor is. That way you can mousewheel through the chunks like normal, but ctrl + mousewheel to scroll while retaining cursor focus in the dropdown box. All the keys retain their normal function, too.

You could use Alt as a modifier for changing chunks within a reflexive. So while editing the fields of one chunk, you could do Alt + Up/Dn or Alt + PgUp/PgDn to inc/dec or page past the current chunk. Maybe Alt + LeftMouseButton could assign what dropdown list should be affected by the Alt commands.


Starting all reflexives collapsed in the scnr is a very good idea.
User avatar
Ogrish
Posts: 1512
Joined: Wed Dec 12, 2007 2:56 am

Re: Entity 2.1.5

Post by Ogrish »

It would be fucking awsome if you could add an ident fixer.
I hate it when im almost done with a mod, and decide i need one more thing, then when i add that chunk in scrn, it breaks 50 idents.

Most of the time they can be relinked and there fine. :|
relinking 50 gets on my nerves. :x
User avatar
NotZachary82
Posts: 1846
Joined: Thu Dec 20, 2007 8:39 pm

Re: Entity 2.1.5

Post by NotZachary82 »

Ogrish wrote:It would be fucking awsome if you could add an ident fixer.
I hate it when im almost done with a mod, and decide i need one more thing, then when i add that chunk in scrn, it breaks 50 idents.

Most of the time they can be relinked and there fine. :|
relinking 50 gets on my nerves. :x
That's your own fault. Troy shouldn't have to fix your problems when it was you who used shitty plugins in the first place.

I've NEVER gotten a broken ident in the last year. I'd like to know what the hell you're doing to your plugins :|.
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Entity 2.1.5

Post by troymac1ure »

Ogrish wrote:It would be fucking awsome if you could add an ident fixer.
I hate it when im almost done with a mod, and decide i need one more thing, then when i add that chunk in scrn, it breaks 50 idents.

Most of the time they can be relinked and there fine. :|
relinking 50 gets on my nerves. :x
Ogrish, I hear alot of your ideas, but I rarely get anywhere with them. Sorry. I would love to fix the chunk cloner, duplicator and all that jazz, but when I bring the topics up, people say," that's not needed, this is what's needed", etc, etc.

Maybe my terms aren't all correct or I don't realize exactly what the issues are as I don't mod much anymore. Most of my time is on programming now. If you can give me a step-by-step of what you do to break your map and also if you know how to fix it, that as well, it would give me something I can physically see, it helps me understand better what needs to be done.

Anything you can give me that will show me issues, will help me fix the issues.
NotZachary82 wrote: That's your own fault. Troy shouldn't have to fix your problems when it was you who used shitty plugins in the first place.

I've NEVER gotten a broken ident in the last year. I'd like to know what the hell you're doing to your plugins :|.
Are you using the plugins I ship with Entity? If not, then we should encorporate yours into the releases.
User avatar
socrates
Posts: 565
Joined: Tue May 27, 2008 9:22 pm
Location: Oklahoma

Re: Entity 2.1.5

Post by socrates »

last time I added to scnr placement for a map I got tons of broken idents too
my way of fixing it used a macro program such as autohotkey and a small amount of patience, I programmed it to go down the list and relink all the idents... Ogrish hit me up on msn if you want me to send it to you, if I'm not available or not answering ...like you are now.. you could probably find it easy enough through google
User avatar
Ogrish
Posts: 1512
Joined: Wed Dec 12, 2007 2:56 am

Re: Entity 2.1.5

Post by Ogrish »

Often after doing a conversion with H2core, if you clone chunks with Entity it will breaks idents.

Im not using my own plugins for cloning, i use origanal 1.3, or the one Demonic gave me, both work fine for cloning.

Thanks anyways Troy, my ideas are always whats best, when it comes to Apps but that wont stop me from posting em. If you can get the max chuck thing done for E73RN4L, ill be happy.

Thanks for the mature critism Zack.

Image
User avatar
NotZachary82
Posts: 1846
Joined: Thu Dec 20, 2007 8:39 pm

Re: Entity 2.1.5

Post by NotZachary82 »

Ogrish wrote:Often after doing a conversion with H2core, if you clone chunks with Entity it will breaks idents.
Oh, yes. H2Core fucks that up. I jumped to the conclusion that chunk cloning for you in general breaks idents.

Moving on.
User avatar
Aumaan Anubis
Staff
Posts: 1812
Joined: Thu Dec 13, 2007 12:18 am
Contact:

Re: Entity 2.1.5

Post by Aumaan Anubis »

I open a clean map in Entity UE 1.6 and idents are already broken.
I promptly lose motivation to do any modding.

Yeahhhhhhh.
User avatar
JacksonCougar
Huurcat
Posts: 2460
Joined: Thu Dec 06, 2007 11:30 pm
Location: Somewhere in Canada

Re: Entity 2.1.5

Post by JacksonCougar »

UE stopped working for me awhile ago: no clue why. It stopped injecting normal-maps without bricking my maps.
User avatar
DemonicSandwich
Trollwich
Posts: 1620
Joined: Sat Dec 08, 2007 9:47 pm
Location: I...huh...I don't really know. x.x

Re: Entity 2.1.5

Post by DemonicSandwich »

One feature I find useful is how you can display the entire tag list in order by index rather than directory or tag class.

One bug I find extremely annoying is that the "Open With" function is broken. As in where you could drag and drop the map file over a shortcut to the application and it opens the map in said application.

When I do this is claims it can't find the Main Menu and crashes, requiring me to open the app and manually navigate to the directory of the map.
Map paths are set btw.
Model Customization Pt.01|Model Customization Pt.02|Bipd Attachments|True Marker Rotations
"I'm the h4x man! Skibby Dibby Dib YoDahDubDub, YoDahDubDub"
User avatar
socrates
Posts: 565
Joined: Tue May 27, 2008 9:22 pm
Location: Oklahoma

Re: Entity 2.1.5

Post by socrates »

>.< I double click the map and it opens in UE
I do need to change this since UE gives me problems too..
"default map viewer"
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Entity 2.1.5

Post by troymac1ure »

DemonicSandwich wrote:One feature I find useful is how you can display the entire tag list in order by index rather than directory or tag class.

One bug I find extremely annoying is that the "Open With" function is broken. As in where you could drag and drop the map file over a shortcut to the application and it opens the map in said application.

When I do this is claims it can't find the Main Menu and crashes, requiring me to open the app and manually navigate to the directory of the map.
Map paths are set btw.
*noted* I'll look into this and see why it's doing that.

*UPDATE* : Fixed. It was loading the maps before loading the map directories. thanks.
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Entity 2.1.6

Post by troymac1ure »

New Entity released. Check it out. Lots of updates and add-ons.
xxpenguinxx
Posts: 1974
Joined: Sun Jan 27, 2008 4:50 am

Re: Entity 2.1.6

Post by xxpenguinxx »

For some odd reason when I try to scroll in the hex editor, it resizes the editor instead...
DemonicSandwich wrote:See that? You see that how it is highlighted down here but it's not highlighted right there? Ah, I guess that's what I get for pirating it.
In Soviet Russia, DS touches you. Say it again and I'll do more than touch. ~DS -Oh baby
A cat was licking itself to the sound of potato chips.
User avatar
CaptainPoopface
Posts: 714
Joined: Sat Feb 16, 2008 5:47 am

Re: Entity 2.1.6

Post by CaptainPoopface »

Very nice. Thank you for incorporating the suggestions I made. Entering coordinates for spawns in the BSP Viewer is a fantastic addition. I look forward to using it.
User avatar
Ogrish
Posts: 1512
Joined: Wed Dec 12, 2007 2:56 am

Re: Entity 2.1.6

Post by Ogrish »

great work on this!

In the model tag, you can expand it to view the raw chunks, can you make it duplicate a modelraw chunk in the tag?

Example: open flag_base, and expand by hitting the plus. Now it shows RAW Data Chunk #0,
i want to duplicate raw chunk #0 so i will have #0 and #1
Last edited by Ogrish on Tue Aug 04, 2009 8:19 pm, edited 1 time in total.
User avatar
JacksonCougar
Huurcat
Posts: 2460
Joined: Thu Dec 06, 2007 11:30 pm
Location: Somewhere in Canada

Re: Entity 2.1.6

Post by JacksonCougar »

I'm gonna' download this: please dun' eat my maps dar' mister application. :l0l:
  • Bugs
  • Settings Dialog Window - Needs a a button to save and continue the operation. Form should not be resizable.
  • Bitmaps - Clicking on raw subtree node does not update the displayed bitmap. LODs are treated as chunks.
BSP improvements are awesome. I would love to be able to use lowers LODs however ;p

Bitmap Display Code: do with as you will, this is old code, so forgive the layout and horrid syntax :l0l:

Code: Select all

/// <summary>
        /// Returns Decoded Byte Array Of Bitmap Raw
        /// </summary>
        /// <param name="_width">Width Of Image</param>
        /// <param name="_height">Height Of Image</param>
        /// <param name="_offset">Image Raw Offset</param>
        /// <returns></returns>
        internal byte[] DecodeBitmapRaw(ref short _Width_, ref short _Height_, int _Offset, long _Pointer, out PixelFormat _pixelFormat, out int _lengthMiltiplier)
        {
            #region Decode
            FileStream fs = Map.GetResourceStream(_Pointer);
            BinaryReader _Map = new BinaryReader(fs);
            _Map.BaseStream.Position = _Offset;
            byte[] RecodedLOD;
            byte[] DecodedLOD;
            _pixelFormat = PixelFormat.Format32bppArgb;
            _lengthMiltiplier = 4;
            DecodedLOD = _Map.ReadBytes(LOD1Size);
            if (DecodedLOD.Length == 0) return null;
            switch (Type)
            {
                case TypeEnum.Texture_2D:
                    {
                        switch (Format)
                        {
                            case FormatEnum.DXT1://Working
                                DecodedLOD = Soffish.BitmapSection_old.DecodeDXT1(_Width_, _Height_, DecodedLOD);
                                break;
                            case FormatEnum.DXT2And3://Working

                                _Width_ = BitmapMethods.CalculateTrueDimensions(_Height_, _Width_, Format, LOD1Size, 8);
                                DecodedLOD = Soffish.BitmapSection_old.DecodeDXT23(_Width_, _Height_, DecodedLOD);
                                break;
                            case FormatEnum.DXT4And5://Working
                                DecodedLOD = Soffish.BitmapSection_old.DecodeDXT45(_Width_, _Height_, DecodedLOD);
                                break;
                            case FormatEnum.A8R8G8B8://Working?
                                if (Swizzle == true)
                                    DecodedLOD = BitmapSection_old.Swizzle(DecodedLOD, _Width_, _Height_, Depth, 32, true);
                                _Width_ = BitmapMethods.CalculateTrueDimensions(_Height_, _Width_, Format, LOD1Size, 32);
                                break;
                            case FormatEnum.X8R8G8B8://Working
                                if (Swizzle == true)
                                    DecodedLOD = BitmapSection_old.Swizzle(DecodedLOD, _Width_, _Height_, Depth, 32, true);
                                _pixelFormat = PixelFormat.Format32bppRgb;
                                break;
                            case FormatEnum.A4R4G4B4://Working
                                if (Swizzle == true)
                                    DecodedLOD = BitmapSection_old.Swizzle(DecodedLOD, PixelOffset, _Width_, _Height_, Depth, 16, true);
                                _Width_ = BitmapMethods.CalculateTrueDimensions(_Height_, _Width_, Format, LOD1Size, 32);
                                int QuarterSourceDataLength = DecodedLOD.Length;
                                RecodedLOD = new byte[DecodedLOD.Length * 2];
                                for (int i = 0; i < QuarterSourceDataLength; i += 2)
                                {
                                    RecodedLOD[(i * 2) + 3] = (byte)(DecodedLOD[i] & 0XF0);
                                    RecodedLOD[(i * 2) + 2] = (byte)(DecodedLOD[i] & 0X0F);
                                    RecodedLOD[(i * 2) + 1] = (byte)(DecodedLOD[i + 1] & 0XF0);
                                    RecodedLOD[(i * 2)] = (byte)(DecodedLOD[i + 1] & 0X0F);
                                }
                                DecodedLOD = RecodedLOD;
                                break;
                            case FormatEnum.U8V8://Working
                                if (Swizzle == true)
                                    DecodedLOD = BitmapSection_old.Swizzle(DecodedLOD, PixelOffset, _Width_, _Height_, Depth, 16, true);
                                _pixelFormat = PixelFormat.Format32bppRgb;
                                DecodedLOD = Soffish.BitmapSection_old.DecodeU8V8((float)_Width_, (float)_Height_, DecodedLOD, MipMapCount, 16F);
                                RecodedLOD = new byte[DecodedLOD.Length * 2];
                                for (int i = 0; i < DecodedLOD.Length; i += 2)
                                {
                                    int a = i * 2;
                                    RecodedLOD[a + 3] = 0;//unused
                                    RecodedLOD[a + 2] = BitmapMethods.CalculateU8V8Color(DecodedLOD[i]);// > 127 ? (byte)(256 - DecodedLOD[i]) : (byte)DecodedLOD[i];//red
                                    RecodedLOD[a + 1] = BitmapMethods.CalculateU8V8Color(DecodedLOD[i + 1]);// > 127 ? (byte)(256 - DecodedLOD[i + 1]) : (byte)DecodedLOD[i + 1]; ;//green
                                    RecodedLOD[a] = 255;//CalculateUVW(DecodedLOD[i + 1], DecodedLOD[i]);
                                }
                                DecodedLOD = RecodedLOD;
                                break;
                            case FormatEnum.A1R5G5B5://Working
                                if (Swizzle == true)
                                    DecodedLOD = BitmapSection_old.Swizzle(DecodedLOD, PixelOffset, _Width_, _Height_, Depth, 16, true);
                                _lengthMiltiplier = 2;
                                _pixelFormat = PixelFormat.Format16bppArgb1555;
                                break;
                            case FormatEnum.R5G6B5://Working
                                if (Swizzle == true)
                                    DecodedLOD = BitmapSection_old.Swizzle(DecodedLOD, PixelOffset, _Width_, _Height_, Depth, 16, true);
                                _lengthMiltiplier = 2;
                                _pixelFormat = PixelFormat.Format16bppRgb565;
                                break;
                            case FormatEnum.A8Y8://Working
                                if (Swizzle == true)
                                    DecodedLOD = BitmapSection_old.Swizzle(DecodedLOD, PixelOffset, _Width_, _Height_, Depth, 16, true);
                                _Width_ = BitmapMethods.CalculateTrueDimensions(_Height_, _Width_, Format, LOD1Size, 16); 
                                RecodedLOD = new byte[DecodedLOD.Length * 2];
                                for (int i = 0; i < DecodedLOD.Length; i += 2)
                                {
                                    RecodedLOD[i * 2] = DecodedLOD[i + 1];
                                    RecodedLOD[(i * 2) + 1] = DecodedLOD[i + 1];
                                    RecodedLOD[(i * 2) + 2] = DecodedLOD[i + 1];
                                    RecodedLOD[(i * 2) + 3] = DecodedLOD[i];
                                }
                                DecodedLOD = RecodedLOD;
                                break;
                            case FormatEnum.P8://Working
                                if (Swizzle == true)
                                    DecodedLOD = BitmapSection_old.Swizzle(DecodedLOD, PixelOffset, _Width_, _Height_, Depth, 8, true);
                                if (!BitmapSection_old.H2PaletteLoaded) BitmapSection_old.LoadHalo2Palette();
                                RecodedLOD = new byte[DecodedLOD.Length * 4];
                                for (int i = 0; i < DecodedLOD.Length; i++)
                                {
                                    int a = i * 4;
                                    RecodedLOD[a] = BitmapSection_old.H2Palette[DecodedLOD[i]].R;
                                    RecodedLOD[a + 1] = BitmapSection_old.H2Palette[DecodedLOD[i]].G;
                                    RecodedLOD[a + 2] = BitmapSection_old.H2Palette[DecodedLOD[i]].B;
                                    RecodedLOD[a + 3] = BitmapSection_old.H2Palette[DecodedLOD[i]].A;
                                }
                                DecodedLOD = RecodedLOD;
                                break;
                            case FormatEnum.Y8://Working
                                if (Swizzle == true)
                                    DecodedLOD = BitmapSection_old.Swizzle(DecodedLOD, PixelOffset, _Width_, _Height_, Depth, 8, true);
                                RecodedLOD = new byte[DecodedLOD.Length * 4];
                                for (int i = 0; i < DecodedLOD.Length; i++)
                                {
                                    int a = i * 4;
                                    RecodedLOD[a] = DecodedLOD[i];
                                    RecodedLOD[a + 1] = DecodedLOD[i];
                                    RecodedLOD[a + 2] = DecodedLOD[i];
                                    RecodedLOD[a + 3] = 255;
                                }
                                DecodedLOD = RecodedLOD;
                                break;
                            case FormatEnum.Lightmap://Not Working?
                                //if (Swizzle)
                                //    DecodedLOD = BitmapFunctions.Swizzle(DecodedLOD, PixelOffset, _Width_, _Height_, Depth, 8, true);
                                //RecodedLOD = new byte[DecodedLOD.Length * 4];
                                //LightMap.Palette Palette = Map.Sbsp[SBSPIndex, Tags.SearchType.Index].LightMap.Palettes[PaletteIndex];
                                //for (int i = 0; i < DecodedLOD.Length; i++)
                                //{
                                //    int a = i * 4;
                                //    RecodedLOD[a + 0] = Palette.Colors[DecodedLOD[i]].R;
                                //    RecodedLOD[a + 1] = Palette.Colors[DecodedLOD[i]].G;
                                //    RecodedLOD[a + 2] = Palette.Colors[DecodedLOD[i]].B;
                                //    RecodedLOD[a + 3] = Palette.Colors[DecodedLOD[i]].A;
                                //}
                                //DecodedLOD = RecodedLOD;
                                break;
                            case FormatEnum.AY8:
                                if (Swizzle == true)
                                    DecodedLOD = BitmapSection_old.Swizzle(DecodedLOD, PixelOffset, _Width_, _Height_, Depth, 8, true);
                                _Width_ = BitmapMethods.CalculateTrueDimensions(_Height_, _Width_, Format, LOD1Size, 8);
                                RecodedLOD = new byte[DecodedLOD.Length * 4];
                                for (int i = 0; i < DecodedLOD.Length; i++)
                                {
                                    int a = i * 4;
                                    RecodedLOD[a] = (byte)(DecodedLOD[i]);
                                    RecodedLOD[a + 1] = (byte)(DecodedLOD[i]);
                                    RecodedLOD[a + 2] = (byte)(DecodedLOD[i]);
                                    RecodedLOD[a + 3] = (byte)(DecodedLOD[i]);
                                }
                                DecodedLOD = RecodedLOD;
                                break;
                            case FormatEnum.A8://Working
                                if (Swizzle == true)
                                    DecodedLOD = BitmapSection_old.Swizzle(DecodedLOD, PixelOffset, _Width_, _Height_, Depth, 8, true);
                                _Width_ = BitmapMethods.CalculateTrueDimensions(_Height_, _Width_, Format, LOD1Size, 8);
                                RecodedLOD = new byte[DecodedLOD.Length * 4];
                                for (int i = 0; i < DecodedLOD.Length; i++)
                                {
                                    int a = i * 4;
                                    RecodedLOD[a] = 255;
                                    RecodedLOD[a + 1] = 255;
                                    RecodedLOD[a + 2] = 255;
                                    RecodedLOD[a + 3] = DecodedLOD[i];
                                }
                                DecodedLOD = RecodedLOD;
                                break;
                            default:
                                return null;
                        }
                        break;
                    }
                case TypeEnum.Texture_3D:
                    {
                        switch (Format)
                        {
                            case FormatEnum.A8Y8://Working
                                if (Swizzle == true)
                                    DecodedLOD = BitmapSection_old.Swizzle(DecodedLOD, PixelOffset, _Width_, _Height_, Depth, 16, true);
                                _Width_ = BitmapMethods.CalculateTrueDimensions(_Height_, _Width_, Format, LOD1Size, 16);
                                RecodedLOD = new byte[DecodedLOD.Length * 2];
                                for (int i = 0; i < DecodedLOD.Length; i += 2)
                                {
                                    RecodedLOD[i * 2] = DecodedLOD[i + 1];
                                    RecodedLOD[(i * 2) + 1] = DecodedLOD[i + 1];
                                    RecodedLOD[(i * 2) + 2] = DecodedLOD[i + 1];
                                    RecodedLOD[(i * 2) + 3] = DecodedLOD[i];
                                }
                                _Width_ *= Depth;
                                DecodedLOD = RecodedLOD;
                                break;
                            case FormatEnum.AY8:
                                if (Swizzle == true)
                                    DecodedLOD = BitmapSection_old.Swizzle(DecodedLOD, PixelOffset, _Width_, _Height_, Depth, 8, true);
                                _Width_ = BitmapMethods.CalculateTrueDimensions(_Height_, _Width_, Format, LOD1Size, 16);
                                RecodedLOD = new byte[DecodedLOD.Length * 4];
                                for (int i = 0; i < DecodedLOD.Length; i++)
                                {
                                    int a = i * 4;
                                    RecodedLOD[a] = DecodedLOD[i] == 0 ? (byte)255 : (byte)0;
                                    RecodedLOD[a + 1] = (byte)255;
                                    RecodedLOD[a + 2] = (byte)255;
                                    RecodedLOD[a + 3] = (byte)255;
                                }
                                _Width_ *= Depth;
                                DecodedLOD = RecodedLOD;
                                break;
                        }
                        break;
                    }
                case TypeEnum.Cubemap:
                    {
                        switch (Format)
                        {
                            case FormatEnum.DXT1://Working
                                DecodedLOD = Soffish.BitmapSection_old.DecodeCubemap(_Height_, DecodedLOD, 4, MipMapCount, 86);
                                DecodedLOD = Soffish.BitmapSection_old.DecodeDXT1(_Width_, _Height_ * 6, DecodedLOD);
                                _Height_ *= 6;
                                break;

                            case FormatEnum.X8R8G8B8://Working
                                int Padding = BitmapMethods.CalculateCubemapPadding(Width, Height, MipMapCount, 32, LOD1Size);
                                DecodedLOD = Soffish.BitmapSection_old.DecodeCubemap(_Height_, DecodedLOD, 32, MipMapCount, Padding);
                                _Height_ *= 6;
                                if (Swizzle == true)
                                    DecodedLOD = BitmapSection_old.Swizzle(DecodedLOD, _Width_, _Height_, Depth, 32, true);
                                break;
                        }
                        break;
                    }
                case TypeEnum.Sprite:
                    {
                        break;
                    }
            }
            return DecodedLOD;
            #endregion
        }

        public enum TypeEnum : short
        {
            Texture_2D = 0,
            Texture_3D = 1,
            Cubemap = 2,
            Sprite = 3
        }

        public enum FormatEnum
        {
            A8 = 0,
            Y8 = 1,
            AY8 = 2,
            A8Y8 = 3,
            R5G6B5 = 6,
            A1R5G5B5 = 8,
            A4R4G4B4 = 9,
            X8R8G8B8 = 10,
            A8R8G8B8 = 11,
            DXT1 = 14,
            DXT2And3 = 15,
            DXT4And5 = 16,
            P8 = 17,
            Lightmap = 18,
            U8V8 = 22
        }

Code: Select all

public static short CalculateTrueDimensions(short Height, short width, Soffish.Bitmap.FormatEnum Format, int Rawsize, int BitsPerPixel)
        {
            switch (Format)
            {
                case Soffish.Bitmap.FormatEnum.A8R8G8B8:
                    {
                        Rawsize = (int)(Rawsize * (8F / (float)BitsPerPixel));//Size directly related to Dimensions.
                        short Width = (short)(Rawsize / Height);
                        if (Width % 8 != 0)
                        {
                            float Remainder = (float)Width % 8F;
                            Width = (short)(Width - Remainder);
                        }
                        if ((Width - width) % 8 == 0 && (Width - width) >= 16 || (Width - width) <= -16)
                        {
                            Width = (short)(Width - (Width - width));
                        }
                        return Width;
                    }
                case Soffish.Bitmap.FormatEnum.A4R4G4B4:
                    {
                        Rawsize = (int)(Rawsize * (8F / (float)BitsPerPixel));//Size directly related to Dimensions.
                        short Width = (short)(Rawsize / Height);
                        if (Width % 8 != 0)
                        {
                            float Remainder = (float)Width % 8F;
                            Width = (short)(Width - Remainder);
                        }
                        if ((Width - width) % 8 == 0 && (Width - width) >= 16 || (Width - width) <= -16)
                        {
                            Width = (short)(Width - (Width - width));
                        }
                        return Width;
                    }
                case Soffish.Bitmap.FormatEnum.DXT2And3:
                    {
                        if (width % 4 != 0)
                        {
                            width = (short)(width - (width % 4));
                            return width;
                        }
                    }
                    break;
                case Soffish.Bitmap.FormatEnum.A8:
                    {
                        Rawsize = (int)(Rawsize * (8F / (float)BitsPerPixel));//Size directly related to Dimensions.
                        short Width = (short)(Rawsize / Height);
                        if (Width % 8 != 0)
                        {
                            float Remainder = (float)Width % 8F;
                            Width = (short)(Width - Remainder);
                        }
                        if ((Width - width) % 8 == 0 && (Width - width) == 16 || (Width - width) == -16)
                        {
                            Width = (short)(Width - (Width - width));
                        }
                        return Width;
                    }
                case Soffish.Bitmap.FormatEnum.AY8:
                    {
                        if (Height == width) { return width; }
                        Rawsize = (int)(Rawsize * (8F / (float)BitsPerPixel));//Size directly related to Dimensions.
                        short Width = (short)(Rawsize / Height);
                        if (Width % 8 != 0)
                        {
                            float Remainder = (float)Width % 8F;
                            Width = (short)(Width - Remainder);
                        }
                        if ((Width - width) % 8 == 0 && (Width - width) == 16 || (Width - width) == -16)
                        {
                            Width = (short)(Width - (Width - width));
                        }
                        return Width;
                    }
                case Soffish.Bitmap.FormatEnum.A8Y8:
                    {
                        if (width % 8 == 0 && Height == width || 2 * (Height) == width || 2 * (width) == Height) { return width; }
                        Rawsize = (int)(Rawsize * (8F / (float)BitsPerPixel));//Size directly related to Dimensions.
                        short Width = (short)(Rawsize / Height);
                        if (Width % 8 != 0)
                        {
                            float Remainder = (float)Width % 8F;
                            Width = (short)(Width - Remainder);
                        }
                        return Width;
                    }
            }
            return width;
        }

        public static int CalculateCubemapPadding(int Width, int Height, int MipCount, float BitsPerPixel, int RawSize)
        {
            int Padding = (Height * Width);
            for (int x = 0; x < MipCount; x++)
            {
                Width /= 2;
                Height /= 2;
                Padding += (Height * Width);
            }
            Padding *= 6;
            Padding = (int)(Padding / (8f / BitsPerPixel));
            Padding = RawSize - Padding;
            return Padding / 6;
        }

        public static byte CalculateUVW(byte Green, byte Red)
        {
            int Blue = ((255 * 255) - ((Green * Green) + (Red * Red))) / 255;
            return (byte)Blue;
        }

        public static byte CalculateU8V8Color(byte Color)
        {
            if (Color == 0)
            {
                Color = 127;
                return Color;
            }
            else
            {
                Color += 127;
                return (byte)Color;
            }
        }
User avatar
Ogrish
Posts: 1512
Joined: Wed Dec 12, 2007 2:56 am

Re: Entity 2.1.6

Post by Ogrish »

BUG: this dosnt want to close for me, but thats ok the last one did the same.
Now this needs a string editor, or swapper.
I saved and built a custom bloc, recursive, and parsed, but i had to relink hlmt,coll,mode,phmo,shader,even the basemap bitm needed to be relinked.
User avatar
troymac1ure
Keeper of Entity
Posts: 1282
Joined: Sat Aug 09, 2008 4:16 am
Location: British Columbia, Canada, eh
Contact:

Re: Entity 2.1.6

Post by troymac1ure »

JacksonCougar wrote:I'm gonna' download this: please dun' eat my maps dar' mister application. :l0l:
  • Bugs
  • Settings Dialog Window - Needs a a button to save and continue the operation. Form should not be resizable.
  • Bitmaps - Clicking on raw subtree node does not update the displayed bitmap. LODs are treated as chunks.
BSP improvements are awesome. I would love to be able to use lowers LODs however ;p

Bitmap Display Code: do with as you will, this is old code, so forgive the layout and horrid syntax :l0l:
The settings box auo saves, but a save button would make ppl feel better ;)

The raw chunks were added just for testing stuff as they are all different. You could make a plugin for one, but it ould only work on that specific chunk on that map. It's basically just a quick visual as to how many chunks there are and size of each. It does load the RAW ino the hex editor, but the hex editor needs work. I started updating it, but forgot and left it only partially changed :(

I'm looking into the LOD stuff. As of now I believe that entity just uses the highest LOD at all times (I could be wrong here) so I would like to implement LOD and have a lowest LOD override as well.

Thanks for the code. Haven't looked at it yet, but I definately will! From glancing over this is just the bitm stuff I believe. Any chance of getting PMI code as well?
Ogrish wrote:BUG: this dosnt want to close for me, but thats ok the last one did the same.
Now this needs a string editor, or swapper.
I saved and built a custom bloc, recursive, and parsed, but i had to relink hlmt,coll,mode,phmo,shader,even the basemap bitm needed to be relinked.
Can you tell me what you do when it doesn't close? I had that at one point in updating, but fixed it. There must be another bug somewhere.

Can you expand on the String Swapper/Editor thing? Terminology is a weak point :roll:

And should the stuff above be linked automatically? If so list a quick step by step I can follow to see the results you are getting.


Thanks for all the feedback.
User avatar
JacksonCougar
Huurcat
Posts: 2460
Joined: Thu Dec 06, 2007 11:30 pm
Location: Somewhere in Canada

Re: Entity 2.1.6

Post by JacksonCougar »

I'll post a PMI class once I finish messing with my current one. I have some bugs I need to work out. The process is not very hard if you just want to make your own code however.
User avatar
Zieon Eslador
Posts: 731
Joined: Wed Apr 30, 2008 1:16 am
Location: Virginia Awesome?: Yes

Re: Entity 2.1.6

Post by Zieon Eslador »

Maybe I missed something, but why can't I view Onyx maps in the BSP Viewer?
Zieon Eslador (1:23:09 AM): I haven't seen Watchmen, but I plan to eventually...
NotZachary (1:23:15 AM): it has nukes, random things happening, and retards screaming
NotZachary (1:23:19 AM): kinda like MW2
Post Reply