RenderPostOffset

Discussion about Mods for Prison Architect

Moderator: NBJeff

Sumurai8
level2
level2
Posts: 92
Joined: Fri Feb 06, 2015 1:08 am

RenderPostOffset

Postby Sumurai8 » Sun Sep 20, 2015 2:11 pm

I noticed they added a property RenderPostOffset and RenderPreOffset in materials.txt in the last few patches. Does anyone know exactly what this is supposed to do?
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: RenderPostOffset

Postby aubergine18 » Tue Oct 06, 2015 6:00 pm

Not sure but seems to be something to do with animation on things like weight bench, etc. If you find out more please let me know and I'll update the guide:

http://steamcommunity.com/sharedfiles/f ... =496272007
Meppi
level0
Posts: 6
Joined: Sun Nov 02, 2014 2:38 pm

Re: RenderPostOffset

Postby Meppi » Fri Oct 23, 2015 7:51 pm

RenderPostOffset and RenderPreOffset are used in objects that consist of two sprites, a base sprite and an overlay.
RenderPre/PostOffset offsets the RenderDepth of the overlay, i.e. RenderDepth(overlay) = RenderDepth(base) + RenderPre/PostOffset

The WeightsBench for example has RD 1 and RPO 2. A Prisoner (RD 2) is rendered on top of the WeightsBench and on top of that is rendered the WeightsBar (RD 1+2)

The other objects are ServingTable(0)/FoodTray(1)/ServingTableLid(2), DogCrate(0)/Dog(2)/DogCrateTop(3), RoadGatePosts(0)/RoadGate(2)

I have no idea though where they defined which sprite to use as an overlay. Could this be hard coded?
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: RenderPostOffset

Postby aubergine18 » Fri Oct 23, 2015 8:09 pm

From objects.spritebank:

RenderPreOffset
BEGIN "[i 488]" Name RoadGate x 39 y 4 w 14 h 2 RotateType 0 TopAligned false END
BEGIN "[i 489]" Name RoadGatePosts x 39 y 0 w 14 h 4 RotateType 4 TopAligned false END

RenderPostOffset
BEGIN "[i 87]" Name DogCrate x 36 y 52 w 2 h 4 RotateType 1 TopAligned false END
BEGIN "[i 89]" Name DogCrateTop x 36 y 56 w 2 h 4 RotateType 1 TopAligned false END

BEGIN "[i 503]" Name ServingTable x 0 y 37 w 10 h 3 RotateType 1 TopAligned false END
BEGIN "[i 504]" Name ServingTableLid x 16 y 40 w 8 h 2 RotateType 1 TopAligned false END

I thought the Pre offset might have looked for second sprite directly above the sprite named in materials.txt, and Post offset might have looked directly below... But then saw ServingTable and that blew that idea out of the water.

So looks like you are correct in both statements: Pre/Post offset affects render depth of second sprite, and second sprite is almost certainly hard-coded (which is a shame because that pre/post offset feature would probably be useful to modders). Well, at least now we know what the settings do, kudos for working it out!


EDIT: If using sprites.png for your sprites, you can define multiple BEGIN Sprite ... END blocks.... So maybe we can specify the second sprite when doing things that way? If you get chance, please test and report back.
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: RenderPostOffset

Postby aubergine18 » Fri Oct 23, 2015 8:20 pm

Hrm, look at the sprite numbering... Pre offset takes "[i sprite-1]", Post offset takes "[i sprite+1]"... that's how they do it I believe...
Meppi
level0
Posts: 6
Joined: Sun Nov 02, 2014 2:38 pm

Re: RenderPostOffset

Postby Meppi » Fri Oct 23, 2015 8:46 pm

Defining a second sprite and adding the RenderPostOffset property doesn't do anything. I tested it with 2 sprites of the same dimention and rotate type.

Hrm, look at the sprite numbering... Pre offset takes "[i sprite-1]", Post offset takes "[i sprite+1]"... that's how they do it I believe...

Thats what i thought too at first but the DogCrate doesn't follow that scheme.
And changing the offset number doesn't change the sprite used.
User avatar
aubergine18
level2
level2
Posts: 231
Joined: Sun Jul 05, 2015 3:24 pm

Re: RenderPostOffset

Postby aubergine18 » Fri Oct 23, 2015 9:09 pm

Well, the offset number is choosing the depth of whatever the second sprite is.

What I was meaning is that if you use RenderPreOffset that means 'take the sprite index directly before the index of the sprite referenced in materials.txt' and RenderPostOffset is similar but taking the sprite index after the index of the one stated in materials.txt.

So, for dog crate:

Sprite DogCrate
RenderPostOffset 3

In objects.spritebank, DogCrate i = 87. **Post**Offset (after offset) means take the sprite with i = 89, which just happens to be DogCrateTop

The the value of the offset sets the z-index of the second sprite in relation to the RenderDepth of the main sprite.

EDIT: Ignore me, 87 + 1 = 88, not 89. So yeah, must be hard-coded as to what the second sprite is. *sigh*

EDIT2: Unless it keeps looking until it finds the next (PostOffset) or previous (PreOffset) sprite definition that has same dimensions as the main sprite?

Return to “Modding”

Who is online

Users browsing this forum: No registered users and 29 guests