Back in late 2016, I looked back to my old geometry layout 0x18 command notes and figured out how to edit the paintings inside the castle; so I thought I would share the notes on how the castle paintings work.
Setting up paintings requires at least 2 0x18 commands in the geometry layout:
The XX parameter tells the game which painting list to use (0 = HMC pool, 1 = Castle Paintings, 2 = TTM slide entrance), while the YY parameter tells the game which painting in that list to use.
Each segmented address you see in the painting list points to a C structure containing information on that painting.
Painting struct (0x78 bytes)
So, where is the data in the ROM file and in RAM?
The painting data is loaded into memory as soon as the game boots up. You can find the list pointers starting at ROM address 0xEC34C, which is loaded into RAM at 0x8033134C. You will have to look at the level script 0x17 command to find out where segment 0x07 is loaded from.
If you have any questions or additions to the topic, please leave a reply below. I'll try to update the main post as much as I can.
Setting up paintings requires at least 2 0x18 commands in the geometry layout:
Code:
[ 18 00 00 00 80 2D 5D 0C ] -- Processes Mario's position (Used for the ripple effect)
[ 18 00 XX YY 80 2D 5B 98 ] -- Renders a painting
The XX parameter tells the game which painting list to use (0 = HMC pool, 1 = Castle Paintings, 2 = TTM slide entrance), while the YY parameter tells the game which painting in that list to use.
Painting list
Painting struct (0x78 bytes)
Code:
Offsets:
(u16) 0x00 - Index in a list?
(u8) 0x02 - List number?
(u8) 0x03 - Render texture mode? 0 for Normal paintings, 1 for shiny textures (DDD and shiny HMC pool).
(u8) 0x04 - Previous value of 0x05 [see function 0x802D3A2C]
(u8) 0x05 - Current painting collision(s) being processed** [see function 0x802D3A2C]
(u8) 0x06 - (painting->0x04 XOR painting->0x05) AND painting->0x05 [see function 0x802D3A2C]
(u8) 0x07 - Ripple flag. 0 = not rippling, 1 = infront of painting, 2 = jumped into painting
(float) 0x08 - Rotation around X-axis
(float) 0x0C - Rotation around Y-axis
(float) 0x10 - X position
(float) 0x14 - Y position
(float) 0x18 - Z position
(float) 0x1C - Current ripple height
(float) 0x20 - Ripple height (infront of painting, copied to offset 0x1C)
(float) 0x24 - Ripple height (jumping into painting, copied to offset 0x1C)
(float) 0x28 - Current ripple height multiplier
(float) 0x2C - Ripple height multiplier (infront of painting, copied to offset 0x28)
(float) 0x30 - Ripple height multiplier (jumping into painting, copied to offset 0x28)
(float) 0x34 - Current ripple pattern?
(float) 0x38 - Ripple pattern? (infront of painting, copied to offset 0x34)
(float) 0x3C - Ripple pattern? (jumping into painting, copied to offset 0x34)
(float) 0x40 - Current size of ripple wave
(float) 0x44 - Size of the ripple wave (infront of painting, copied to offset 0x40)
(float) 0x48 - Size of the ripple wave (jumping into painting, copied to offset 0x40)
(float) 0x4C - Ripple seed or timer?
(float) 0x50 - X position of ripple center
(float) 0x54 - Y position of ripple center
(u32) 0x58 - Segment address to painting F3D cmds.
(u32) 0x5C - Segment address to another segment address to ???.
(u32) 0x60 - Segment address to another segment address to the painting texture.
(u16) 0x64 - ripple painting texture offset?
(u16) 0x66 - ripple painting texture offset?
(u32) 0x68 - A segmented address. 0x07022640, 0x07021AC0. ???
(u8) 0x6C - ??? usually 0x0A or 0x14
(u8) 0x6D - Transparency while rippling.
(u8) 0x6E - Previous value of 0x6F [see function 0x802D3A2C]
(u8) 0x6F - *((float*)0x80361308) < painting->0x14 ? 1 : 0 [see function 0x802D3A2C]
(u8) 0x70 - (painting->0x6E XOR painting->0x6F) AND painting->0x6F [see function 0x802D3A2C]
(u8) 0x71-0x73 - Unused bytes
(float) 0x74 - Size of painting
** collision values are: 0x20(painting wobble left side), 0x10(painting wobble middle), 0x8(painting wobble right side), 0x4(level entrance left side), 0x02(level entrance middle), or 0x01(level entrance right side).
So, where is the data in the ROM file and in RAM?
The painting data is loaded into memory as soon as the game boots up. You can find the list pointers starting at ROM address 0xEC34C, which is loaded into RAM at 0x8033134C. You will have to look at the level script 0x17 command to find out where segment 0x07 is loaded from.
If you have any questions or additions to the topic, please leave a reply below. I'll try to update the main post as much as I can.