Hmm this is odd, I tried replacing some tiles in RAY12.LEV where I replaced existing transparent textures with new transparent textures and they show up fine in the Ray1Editor but not in game.
I upated the alpha mask too whereby 0x0 is transparent and 0xFF is opaque.
I did notice though that there is a field called TransaprencyMode which has a uint value, I gather it has something to do with the issue, but I don't quite understand how that value works, I know that the initial empty tile is 2863311530 (Hex 0xAAAAAAAA) and that opaque ones show as 1431655765 (Hex 0x55555555), but the transparent ones seem to vary alot. Any ideas how that works?
FF FF FF FF FF FF FF FF FF FF FF FF FF FF 00 00
FF FF FF FF FF FF FF FF FF FF FF FF FF FF 00 00
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF 00 00 00 FF FF FF 00 00 FF FF FF FF FF
FF FF FF 00 00 00 00 FF FF 00 00 00 FF FF FF FF
FF FF 00 00 00 00 00 00 FF 00 FF FF FF FF FF FF
FF FF FF 00 00 00 00 00 00 FF FF FF FF FF FF FF
FF FF FF FF 00 00 00 00 FF FF FF FF FF FF FF FF
FF FF FF FF FF 00 00 FF FF FF FF FF FF FF FF FF
FF FF FF FF FF 00 FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
11
11
01
01
01
01
11
11
11
11
11
11
11
01
01
01
Nice!PS, got the 360° swinging plum working too as per your instructions.
ImageData:
FF FF FF FF FF FF FF C5 B2 80 80 FF FF FF FF FF
FF FF FF FF FF FF FF FF FF C8 C8 C7 80 80 80 80
FF FF FF FF FF FF FF FF FF FF FF C8 C8 C8 C7 80
FF FF FF FF FF FF FF FF FF FF FF FF FF FF C8 C8
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF C5 C5
FF FF FF FF FF FF FF FF FF FF C5 B2 80 80 80 80
FF FF FF FF FF FF FF C5 B2 80 80 80 C7 C7 C7 C7
FF FF FF FF FF C5 B2 C7 C7 C7 C8 C8 C8 C8 C8 C8
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
Alpha:
00 00 00 00 00 00 00 FF FF FF FF 00 00 00 00 00
00 00 00 00 00 00 00 00 00 FF FF FF FF FF FF FF
00 00 00 00 00 00 00 00 00 00 00 FF FF FF FF FF
00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 FF FF
00 00 00 00 00 00 00 00 00 00 FF FF FF FF FF FF
00 00 00 00 00 00 00 FF FF FF FF FF FF FF FF FF
00 00 00 00 00 FF FF FF FF FF FF FF FF FF FF FF
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
11 [Mixed]
11 [Mixed]
11 [Mixed]
11 [Mixed]
10 [Transparent]
11 [Mixed]
11 [Mixed]
11 [Mixed]
11 [Mixed]
10 [Transparent]
10 [Transparent]
10 [Transparent]
10 [Transparent]
10 [Transparent]
10 [Transparent]
10 [Transparent]
Using your bytes crashed for me at first too. I tried looking into it to see if I missed something with the transparency until I realized there's a checksum after the texture data in the file! If you load the modified level in Ray1Editor and save it will automatically correct any incorrect checksums, and after doing that it loaded in-game for meNot sure why it dosen't like the new uint32 value.
No, that should be correct. For clarity these are the values:I think Carrot wrote "if read from left to right" but meant "if read from right to left", based on his example?
01 = Opaque
10 = Transparent
11 = Mixed
If you load the modified level in Ray1Editor and save it will automatically correct any incorrect checksums, and after doing that it loaded in-game for me
Indeed it is, I looked at your alpha mask too quickly and inverted transparency and opacity, so of course it didn't make sense. My bad.No, that should be correct. For clarity these are the values:
Code:01 = Opaque 10 = Transparent 11 = Mixed
20:26:55.0019|ERROR|RayCarrot.Ray1Editor.EditorScene|Loading editor
System.InvalidOperationException: Sequence contains no matching element
at System.Linq.ThrowHelper.ThrowNoMatchException()
at RayCarrot.Ray1Editor.R1_PC_GameManager.LoadTileSet(R1_PC_GameData data, PC_LevFile lev, TextureManager textureManager)
at RayCarrot.Ray1Editor.R1_PC_GameManager.LoadMap(R1_PC_GameData data, PC_LevFile lev, TextureManager textureManager)
at RayCarrot.Ray1Editor.R1_PC_GameManager.Load(Context context, Object settings, TextureManager textureManager)
at RayCarrot.Ray1Editor.EditorScene.LoadContent()
var tex = lev.TileTextureData.NonTransparentTextures.
Concat(lev.TileTextureData.TransparentTextures).
First(x => x.Offset == lev.TileTextureData.TexturesOffsetTable[i]);
I'm not sure exactly where you modified the file, but it doesn't seem you modified the TexturesOffsetTable array which seems to be the cause of the crash. Since the transparent and opaque tile textures have different lengths the game has an offset table to more quickly be able to get to each tile texture struct. These are relative to the very first tile texture, 0x4C717 in the file you sent. So if the offset is 0x120 then the file offset is 0x4C837.
To get this to work you need to make sure the offset table points to each of the available textures. If a tile texture does not have a corresponding offset in the table then this exception will occur in the editor and the game will read the wrong texture data.
Updating all of these might be a bit time consuming. If you add a new opaque tile texture then that will shift all the transparent ones by its size (since the opaque ones always appear first), so all of their offsets need to be updated. If you add a transparent one it's simpler since then all you'd need is to add a new offset to the table and have it point to the new texture. The table always has 1200 entries, with invalid ones being 0xFFFFFFFF, so if you add a new one all you'd need is to replace one of the invalid ones.
Edit: Also I should note you don't need to manually edit any checksums or the two pointers at the start of the file. Those are all automatically updated by the editor when saving. I didn't get around to implement proper support for texture replacing and such though which is why this part is more complicated.
Ah that's nice. I would like to have the editor allow this as well, but I haven't gotten around to adding such features yet.Essentially I'm writing a tool for me to import and export the tiles easily rather than trying to manually change the files.
I had a look at the level file and it seems the issue is here:However, when I go to play this I get an error (also see below), I thought it may have been to do with the checksum again (where I save/reopen it in the editor and it fixes it) but not this time.
Again I attached the level file, but this time it's not as obvious where it falls over.
(R) PCMAP/CAKE/RAY1.LEV|0x0004C713: (UInt32) TexturesDataTableCount: 216321
So I noticed in the editor that the Rayman Edu and Designer games have the effects built into the leves (such as storm, Betailla custscene, heat waves and firefly lighting).
Rayman 1 from what I know stores this data within the EXE itself.
I just saw this video that RayCarrot you posted a few years back on how the Bzzit fight works the DOS version with the firefly lighting, do you reckon this is something that can be changed in the binary data very easilly if I went into the EXE and changed a value. If so do you know what hex address this is located at?