I made some progress on the GUI, turns out it won't take as much rewriting as I thought. Most of it was having to change the PreviewList array, which is a list of the object numbers shown in the preview on the right, to a 2-d array with each object number associated with a category, and some extra checks when showing or hiding those objects according to which category is active. I didn't know that PreviewList(1) is the same as PreviewList(1, 0), where the first number is the object index and the second is the category. Maybe I'll just give you a snippet.
rem show preview objects
if ShowPreview=1
j=PrevMin
rem object preview list
for i=PrevMin to PrevMin+4
if PreviewList(i) > 0 rem check for preview items
if PreviewList(i, 1) = CurrentTab rem check for correct tab
show object PreviewList(j)
position object PreviewList(j), camera position x(), camera position y(), camera position z()
rotate object PreviewList(j), camera angle x(), camera angle y(), camera angle z()
disable object zdepth PreviewList(j)
move object PreviewList(j), 40
move object right PreviewList(j), 27
move object up PreviewList(j), 17
move object down PreviewList(j), (j-PrevMin+1)*5.6
rotate object PreviewList(j), 0, 0, 0
inc j
else
rem hide objects from other tabs
hide object PreviewList(i)
endif
endif
next i
endif
I can call PreviewList(i) instead of rewriting all those instances(and several others in the main loop) to say PreviewList(i, 0) is what I'm trying to say. Dunno if that's supposed to happen that way, but I'm happy with it. Of course, this bit of code doesn't entirely work yet with the category system. PrevMin is the number of the first visible PreviewList object, and the next four (if they exist) are drawn to the screen. But with categories, any five preview objects in one category may not be in succession in the PreviewList, so I'll probably have to change this to a while-endwhile loop, which doesn't exit until either five PreviewList objects in one category have been found, or if one has an index of 0, which means there are no more preview objects loaded. The latter will require a rewrite of the preview index assignment function, which does check if two objects have the same index, but not if there are any spaces between objects in the list. This will probably come in handy later, when I add the ability to remove objects from the preview list. Then I can just call the function again, and the list will be resorted to fill any empty spaces.
Alternately, I could rewrite just the previewlist assignment function so that all objects of one category are grouped together. Then, make PrevMin an array with each value of the array corresponding to the first PreviewList index of each object in a new category. This would probably save processing time, not having to iterate through the entire PreviewList every cycle, looking for objects of the current category.
This is why my head wouldn't wrap around it. I think it does now.