Jump to content

SharpOcarina - Zelda OoT Scene Development System


xdaniel
 Share

Recommended Posts

Collision fiasco definitely seems like the right choice of words here. All the errors are tiny things that it's difficult for anybody to notice really...

I think I've got a proper fix this time, no guarantees though.

 

...
		nf[0] = (float)(dy[0] * dz[1]) - (dz[0] * dy[1]);
		nf[1] = (float)(dz[0] * dx[1]) - (dx[0] * dz[1]);
		nf[2] = (float)(dx[0] * dy[1]) - (dy[0] * dx[1]);
 
		/*calculate length of normal vector*/
		nd = Math.Sqrt((nf[0]*nf[0]) + (nf[1]*nf[1]) + (nf[2]*nf[2]));
 
		for (i = 0; i < 3; i++)
		{
			if (nd != 0)
				uv[i] = nf[i] / nd; /*uv being the unit normal vector*/
			nf[i] = uv[i]*0x7FFF;   /*nf being the way OoT uses it*/
		}
 
		/*distance from origin...*/
		dn = (int)Math.Round(((uv[0] * p1[0]) + (uv[1] * p1[1]) + (uv[2] * p1[2])) * -1);
	  
		if (dn < 0)
			dn += 0x10000;
		Helpers.Overwrite16(ref Data, pos + 0xE, (ushort)(dn & 0xFFFF));
		for (i = 0; i < 3; i++)
		{
			ni[i] = (int)Math.Round(nf[i]);
			if (ni[i] < 0)
				ni[i] += 0x10000;
			Helpers.Overwrite16(ref Data, (pos + 8 + (i << 1)), (ushort)(ni[i] & 0xFFFF));
		}
Obviously you'll need to define uv as new float[3]. This should produce correct results without having to rewrite the function completely unless I've made a mistake somewhere...
Link to comment
Share on other sites

Collision fiasco definitely seems like the right choice of words here. All the errors are tiny things that it's difficult for anybody to notice really...

I think I've got a proper fix this time, no guarantees though.

 

...

 

Obviously you'll need to define uv as new float[3]. This should produce correct results without having to rewrite the function completely unless I've made a mistake somewhere...

 

YES, this appears to have fixed it! Now the collision data produced by SharpOcarina is identical to when being fixed by your tool, and of course the game doesn't crash anymore either! Committing code to SVN in a second, new build comes... well, at some later point, seeing how it's 1:30 AM an I've got some appointments today -.-
Link to comment
Share on other sites

As Okami said, the preview is showing the alpha set at 128 fine, and the value is also changing in the saved xml file. I'm not sure why it's not working, perhaps the blendmode isn't being correctly assigned?

 

I have the same problem. It's not that big of a deal to me though

Link to comment
Share on other sites

The code determines which combiner and render modes to set in this order:

 

If the texture has an alpha channel, set modes for that; else, if the group alpha is set to something less than 255, set modes for that; else, just set modes for normal, opaque surfaces.

 

I could switch the first two around, so that group alpha takes precedence over the texture's alpha channel. That would mean, if you set a group alpha value and your texture has an alpha channel, the texture's alpha would be ignored instead. Any thoughts?

Link to comment
Share on other sites

That would probably help a lot.

Not sure if this is a bug or my own blunder, but on a multi room map, I have two waterboxes so far, each in a different room. The box in the first room works fine, but the second one won't. Do I need to alter anything to fix that or is it an importer bug?

Link to comment
Share on other sites

I don't know all that much about waterboxes, to be honest, but I assume it has something to do with their properties. Looking at the example properties on the Wiki, I'd imagine the second byte (or maybe last digit alone) controls in which room the waterbox appears, I have not yet tested this, tho.

Link to comment
Share on other sites

This is looking amazing! Keep up the great work xdan! Now onto a question I have, since there are a couple of us who plan to replace a few ingame maps with our own versions of it, would it be possible to have the importer take wavepoints from a preexisting map and add it to our custom one?

Link to comment
Share on other sites

Stupid question...I have read the threads on this in all three forums and I am missing a critical piece of info which others have (which means it is my own fault, but hey...it happens). I have an obj file from sketchUp and i have NO idea how to make it XML. If I try to open the obj file in SharpOcarina it tells me it isn't a valid XML file (obviously).

Can someone give me the intermediary step between exporting the obj and importing the xml file into #Ocarina?

Link to comment
Share on other sites

The XML is generated by SharpOcarina. You'd create a new scene then load your obj file as the collision and room models and to generate an XML you would go to File > Save Scene. It is not actually needed, just a way of saving your setup so that you could continue working on it at another time.

Link to comment
Share on other sites

Bleh! Thanks guys!

No matter what model I load in collison/rooms it never displays anything (except the little triangle :D . I ran into this same thing with spinout's tool. Not sure what I am doing wrong...

 

WAIT. The demo has seperate obj files for rooms and collision. How do I export the room and scenes to different files? The ruby exporter makes them one obj...

 

Yeah I have tried models as small (SketchUp says) as 200 square feet and as large as 100,000 square feet to test and either way the only thing that happens is that the vertical line in the triangle has a small black dot in it just above the tip of the triangle.

Link to comment
Share on other sites

haddockd, if you're using the ruby plugin then unfortunately it ignores groups and SharpOcarina doesn't seem to display anything if no groups are present. You can fix it by opening your .obj file and writing "g (something)" at the top but since everything is in one group you won't be able to assign different collision types or other things to specific parts of the map. I don't think there's anything you can do without making your own version of the plugin or just using a different program.

Link to comment
Share on other sites

SharpOcarina v0.4/r6: http://code.google.com/p/sharpocarina/downloads/detail?name=SharpOcarina-v04.rar

 

Changelog since last build:

r6: Added exit selection to Polygon Type editor, changed logic for render mode setting generation (group alpha takes priority over texture alpha channels), other minor changes

r5: Temporary fix to textures not showing in the preview, added to-do list (Notes.txt), upped version number in advance for next build

r4: Calculation of collision normals fixed (thanks, DeathBasket!); render mode setting for textures with alpha channel fixed

Link to comment
Share on other sites

I get errors when trying to save binary or inject into the ROM:

 

See the end of this message for details on invoking

just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index

at System.ThrowHelper.ThrowArgumentOutOfRangeException()

at SharpOcarina.NDisplayList.Convert(ObjFile Obj, Int32 Group, List`1 Textures, UInt32 BaseOffset) in C:\Dokumente und Einstellungen\Daniel\Eigene Dateien\Visual Studio 2010\Projects\MapDev\MapDev\NDisplayList.cs:line 362

at SharpOcarina.ZScene.ConvertScene(Boolean ConsecutiveRoomInject) in C:\Dokumente und Einstellungen\Daniel\Eigene Dateien\Visual Studio 2010\Projects\MapDev\MapDev\ZScene.cs:line 353

at SharpOcarina.ZScene.ConvertSave(String Filepath, Boolean ConsecutiveRoomInject) in C:\Dokumente und Einstellungen\Daniel\Eigene Dateien\Visual Studio 2010\Projects\MapDev\MapDev\ZScene.cs:line 235

at SharpOcarina.MainForm.saveBinaryToolStripMenuItem_Click(Object sender, EventArgs e) in C:\Dokumente und Einstellungen\Daniel\Eigene Dateien\Visual Studio 2010\Projects\MapDev\MapDev\MainForm.cs:line 884

at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)

at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)

at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)

at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)

at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)

at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)

at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)

at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)

at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.ScrollableControl.WndProc(Message& m)

at System.Windows.Forms.ToolStrip.WndProc(Message& m)

at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)

at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

 

************** Loaded Assemblies **************

mscorlib

Assembly Version: 4.0.0.0

Win32 Version: 4.0.30319.235 (RTMGDR.030319-2300)

CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll

----------------------------------------

MapDev

Assembly Version: 1.0.0.0

Win32 Version: 1.0.0.0

CodeBase: file:///C:/Users/Wesley/Desktop/SharpOcarina-v04/MapDev.exe

----------------------------------------

System.Windows.Forms

Assembly Version: 4.0.0.0

Win32 Version: 4.0.30319.235 built by: RTMGDR

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

----------------------------------------

System.Drawing

Assembly Version: 4.0.0.0

Win32 Version: 4.0.30319.1 built by: RTMRel

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

----------------------------------------

System

Assembly Version: 4.0.0.0

Win32 Version: 4.0.30319.236 built by: RTMGDR

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

----------------------------------------

OpenTK

Assembly Version: 1.0.0.0

Win32 Version: 1.0.278.44921

CodeBase: file:///C:/Users/Wesley/Desktop/SharpOcarina-v04/OpenTK.DLL

----------------------------------------

OpenTK.GLControl

Assembly Version: 1.0.0.0

Win32 Version: 1.0.278.44921

CodeBase: file:///C:/Users/Wesley/Desktop/SharpOcarina-v04/OpenTK.GLControl.DLL

----------------------------------------

System.Xml

Assembly Version: 4.0.0.0

Win32 Version: 4.0.30319.1 built by: RTMRel

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

----------------------------------------

System.Core

Assembly Version: 4.0.0.0

Win32 Version: 4.0.30319.1 built by: RTMRel

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

----------------------------------------

System.Configuration

Assembly Version: 4.0.0.0

Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

----------------------------------------

m3ol20jv

Assembly Version: 1.0.0.0

Win32 Version: 4.0.30319.236 built by: RTMGDR

CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

----------------------------------------

************** JIT Debugging **************

To enable just-in-time (JIT) debugging, the .config file for this

application or computer (machine.config) must have the

jitDebugging value set in the system.windows.forms section.

The application must also be compiled with debugging

enabled.

For example:

<configuration>

<system.windows.forms jitDebugging="true" />

</configuration>

When JIT debugging is enabled, any unhandled exception

will be sent to the JIT debugger registered on the computer

rather than be handled by this dialog box.

 

 

In a later version would it be possible to have group names displayed instead of Mesh1, Mesh2, etc.? It's not important but it'd just be quicker for selecting the right part of the map to edit.

Selecting the right rooms for waterboxes is definitely a must for the next build, so I'll probably take a look at that at some point.

Link to comment
Share on other sites

DeathBasket: Ouch, that didn't happen with the previous build, I assume? Still works for me with ex. the demo dungeon...

 

As for the group names, they are being displayed and Mesh1, Mesh2, etc. are the group names...? Unless the modelling program you use uses that as a prefix or whatever, and the group name you define comes after a space or something? I'll just change it to simply read the rest of the line as the group name instead.

 

EDIT: Please redownload the file; reverted the only thing I can imagine being the problem right now.

Edited by xdaniel
Link to comment
Share on other sites

What the hell, I think Google Code uploaded the wrong file or something <.< A second...

 

EDIT: http://code.google.com/p/sharpocarina/downloads/detail?name=SharpOcarina-v04-b.rar <- if that doesn't work, I don't care for now. It's past midnight, I'll fix that later...

Edited by xdaniel
Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.