Question About objects rendering in world?

francot514

Well-Known Member
Hi, i want to ask to those who knows, special for Afr0 and Rhys, what is the chunk that defines the object rendering in world, is a 2d sprite for the spr2??? or the bmp from the files?? Also how draw groups handles it, i want to know to try for something...
 
This is how I concluded it worked when I started the world rendering. https://github.com/Afr0/Project-Dol...7db/TSOClient/tso.world/utils/DGRPRenderer.cs

The bit that took a little bit to work out (but is quite easy) was the positioning & offsets:

var pxX = (world.WorldSpace.CadgeWidth / 2.0f) + dgrpSprite.SpriteOffset.X;
var pxY = (world.WorldSpace.CadgeBaseLine - sprite.Pixel.Height) + dgrpSprite.SpriteOffset.Y;

You can see all the cadge values here (depends on zoom): https://github.com/Afr0/Project-Dol...f7a8be5dfd6/TSOClient/tso.world/WorldState.cs
 
You know about how to get extract the sprites from the drawgroups and after that showing it in the render ???
 
Is possible to do some render to objects to show it in a simple window, like it does in sims transmogrifier???
 
Yes. Each object has DRGP chunks which tell the game what sprites (SPR2) to use and where to draw them. I've forgotten nearly all of the specifics, but you should be able to find information on both the SPR2 and DGRP chunks in the PD source code. This is what transmogrifier uses to draw objects.
 
Here's a page on the chunk format for spr2:
http://wiki.niotso.org/IFF#SPR2
You shouls be able to generate bitmaps for each spr2 using this information. There might be some code in the standalone Simslib for this, but the most up to date code is in Project Dollhouse atm. (do a search for "SPR2" in visual studio)
 
What i can do searching for the spr2 is see their properties, and there are also some classes that uses it, like WallComponent.cs and FloorComponent.cs
By example, this code for creating new floor:

Code:
var far = iff.Get<SPR2>(1);
  var medium = iff.Get<SPR2>(257);
  var near = iff.Get<SPR2>(513);
  AddFloor(new Floor {
  ID = floorID,
  Near = near,
  Medium = medium,
  Far = far

That means get the number of spriff.Get<SPR2>(513). Also the sprites seems to be draw with Xna.graphics, then is not possible using it without xna application...


And what is doing this class called "IFFPrinter"???
 
The sprites are drawn with XNA graphics, yes, but this doesn't mean that you can't extend and alter the code to output to your desired format.
 
Back
Top