coastline 0.0.4
Loading...
Searching...
No Matches
decaldraw.h File Reference

The drawing of the paint shop: the texels of the decal being edited and the shapes painted into them, the dashed outlines of a shape not yet painted, and the text and the decal on the screen. More...

#include <PR/ultratypes.h>
Include dependency graph for decaldraw.h:

Go to the source code of this file.

Functions

u8 GetPixel4Bit (s32 x, s32 y)
 Read a texel of the decal being edited.
u8 ReadPixel4Bit (u8 *texels, s32 x, s32 y)
 Read a texel of a decal the size of the one being edited.
void FloodFill4Bit (s32 x, s32 y)
 Fill the area of the color under a point with the color painted with.
void StampTextOnDecal (s32 x, s32 y)
 Paint the text into the decal, centered on a point, with its shadow when the text tool has it.
void DrawLine4Bit (s32 x0, s32 y0, s32 x1, s32 y1)
 Paint a line with the brush.
void SetPixel4Bit (s32 x, s32 y, u8 color)
 Write a texel of the decal being edited, unless it is outside the decal or the mask protects it.
void FillRect4Bit (s32 x0, s32 y0, s32 x1, s32 y1)
 Fill a rectangle, excluding its far column and row.
void StrokeDecalRectangle (s32 x0, s32 y0, s32 x1, s32 y1)
 Paint the outline of a rectangle with the brush.
void FillDecalRoundRect (s32 x0, s32 y0, s32 x1, s32 y1)
 Fill a rectangle with rounded corners.
void DrawDecalRoundedRectOutline (s32 x0, s32 y0, s32 x1, s32 y1)
 Paint the outline of a rectangle with rounded corners with the brush.
void DrawDecalFilledEllipse (s32 x0, s32 y0, s32 x1, s32 y1)
 Fill the ellipse in a rectangle.
void DrawDecalEllipseOutline (s32 x0, s32 y0, s32 x1, s32 y1)
 Paint the outline of the ellipse in a rectangle with the brush.
void FillCircle4Bit (s32 x, s32 y, s32 radius, u8 fromScreen)
 Fill a circle.
void DrawDecalCircleOutline (s32 x, s32 y, s32 radius)
 Paint the outline of a circle with the brush.
void DrawDashedLine (s32 x0, s32 y0, s32 x1, s32 y1)
 Draw the dashed line from the first point of a line to the cursor.
void DrawDashedRectangle (s32 x0, s32 y0, s32 x1, s32 y1)
 Draw the dashed outline of a rectangle.
void DrawDashedRoundedRect (s32 x0, s32 y0, s32 x1, s32 y1)
 Draw the dashed outline of a rectangle with rounded corners.
void DrawDashedEllipse (s32 x0, s32 y0, s32 x1, s32 y1)
 Draw the dashed outline of the ellipse in a rectangle.
void DrawDashedCircle (s32 x, s32 y, s32 radius)
 Draw the dashed outline of a circle, the part over the decal only.
void DrawDecalTextPreview (s32 x, s32 y)
 Draw the text not yet painted on the screen, centered on a point, with its shadow when the text tool has it.
void SwapBytes (u8 *a, u8 *b)
 Swap two bytes.
void EmitScaledTextureRect (s32 textureWidth, s32 textureHeight, s32 x, s32 y, s32 width, s32 height)
 Draw the texture already loaded over a rectangle of the screen, upside down: the decal being edited.

Detailed Description

The drawing of the paint shop: the texels of the decal being edited and the shapes painted into them, the dashed outlines of a shape not yet painted, and the text and the decal on the screen.

The decal is 4 bits a texel, the even texel of a pair in the high nibble, with the words of every odd row swapped as the RDP loads them. Its rows go upwards from the bottom of g_rcDecalCanvas, where each texel is 4 pixels square. A routine that takes screen coordinates converts them.

Function Documentation

◆ GetPixel4Bit()

u8 GetPixel4Bit ( s32 x,
s32 y )

Read a texel of the decal being edited.

Parameters
xThe column of the texel.
yThe row of the texel.
Returns
The texel.
Ghidra address:
USA: 0x8024d7d8
Ghidra address:
Asia: 0x8024D328
Ghidra address:
EUR: 0x8024ed3c
Ghidra address:
JPN: 0x8024e71c

◆ ReadPixel4Bit()

u8 ReadPixel4Bit ( u8 * texels,
s32 x,
s32 y )

Read a texel of a decal the size of the one being edited.

Parameters
texelsThe texels of the decal.
xThe column of the texel.
yThe row of the texel.
Returns
The texel.
Ghidra address:
USA: 0x8024d844
Ghidra address:
Asia: 0x8024D394
Ghidra address:
EUR: 0x8024eda8
Ghidra address:
JPN: 0x8024e788

◆ FloodFill4Bit()

void FloodFill4Bit ( s32 x,
s32 y )

Fill the area of the color under a point with the color painted with.

The mask protects the texels only as the result is copied back.

Parameters
xThe X coordinate of the point on the screen.
yThe Y coordinate of the point on the screen.
Ghidra address:
USA: 0x8024dca0
Ghidra address:
Asia: 0x8024D7F0
Ghidra address:
EUR: 0x8024f204
Ghidra address:
JPN: 0x8024eb64

◆ StampTextOnDecal()

void StampTextOnDecal ( s32 x,
s32 y )

Paint the text into the decal, centered on a point, with its shadow when the text tool has it.

Parameters
xThe X coordinate of the point on the screen.
yThe Y coordinate of the point on the screen.
Ghidra address:
USA: 0x8024ec30
Ghidra address:
Asia: 0x8024E780
Ghidra address:
EUR: 0x80250194
Ghidra address:
JPN: 0x8024fa58

◆ DrawLine4Bit()

void DrawLine4Bit ( s32 x0,
s32 y0,
s32 x1,
s32 y1 )

Paint a line with the brush.

Parameters
x0The X coordinate of the start on the screen.
y0The Y coordinate of the start on the screen.
x1The X coordinate of the end on the screen.
y1The Y coordinate of the end on the screen.
Ghidra address:
USA: 0x8024f000
Ghidra address:
Asia: 0x8024EB50
Ghidra address:
EUR: 0x80250564
Ghidra address:
JPN: 0x8024fe28

◆ SetPixel4Bit()

void SetPixel4Bit ( s32 x,
s32 y,
u8 color )

Write a texel of the decal being edited, unless it is outside the decal or the mask protects it.

Parameters
xThe column of the texel.
yThe row of the texel.
colorThe color, an index of the palette.
Ghidra address:
USA: 0x8024f25c
Ghidra address:
Asia: 0x8024EDAC
Ghidra address:
EUR: 0x802507c0
Ghidra address:
JPN: 0x80250084

◆ FillRect4Bit()

void FillRect4Bit ( s32 x0,
s32 y0,
s32 x1,
s32 y1 )

Fill a rectangle, excluding its far column and row.

Parameters
x0The X coordinate of a corner on the screen.
y0The Y coordinate of a corner on the screen.
x1The X coordinate of the opposite corner on the screen.
y1The Y coordinate of the opposite corner on the screen.
Ghidra address:
USA: 0x8024f7d4
Ghidra address:
Asia: 0x8024F324
Ghidra address:
EUR: 0x80250d38
Ghidra address:
JPN: 0x80250570

◆ StrokeDecalRectangle()

void StrokeDecalRectangle ( s32 x0,
s32 y0,
s32 x1,
s32 y1 )

Paint the outline of a rectangle with the brush.

Parameters
x0The X coordinate of a corner on the screen.
y0The Y coordinate of a corner on the screen.
x1The X coordinate of the opposite corner on the screen.
y1The Y coordinate of the opposite corner on the screen.
Ghidra address:
USA: 0x8024f8cc
Ghidra address:
Asia: 0x8024F41C
Ghidra address:
EUR: 0x80250e30
Ghidra address:
JPN: 0x80250668

◆ FillDecalRoundRect()

void FillDecalRoundRect ( s32 x0,
s32 y0,
s32 x1,
s32 y1 )

Fill a rectangle with rounded corners.

Parameters
x0The X coordinate of a corner on the screen.
y0The Y coordinate of a corner on the screen.
x1The X coordinate of the opposite corner on the screen.
y1The Y coordinate of the opposite corner on the screen.
Ghidra address:
USA: 0x8024fbc8
Ghidra address:
Asia: 0x8024F718
Ghidra address:
EUR: 0x8025112c
Ghidra address:
JPN: 0x80250964

◆ DrawDecalRoundedRectOutline()

void DrawDecalRoundedRectOutline ( s32 x0,
s32 y0,
s32 x1,
s32 y1 )

Paint the outline of a rectangle with rounded corners with the brush.

Parameters
x0The X coordinate of a corner on the screen.
y0The Y coordinate of a corner on the screen.
x1The X coordinate of the opposite corner on the screen.
y1The Y coordinate of the opposite corner on the screen.
Ghidra address:
USA: 0x8024feb8
Ghidra address:
Asia: 0x8024FA08
Ghidra address:
EUR: 0x8025141c
Ghidra address:
JPN: 0x80250c54

◆ DrawDecalFilledEllipse()

void DrawDecalFilledEllipse ( s32 x0,
s32 y0,
s32 x1,
s32 y1 )

Fill the ellipse in a rectangle.

Parameters
x0The X coordinate of a corner on the screen.
y0The Y coordinate of a corner on the screen.
x1The X coordinate of the opposite corner on the screen.
y1The Y coordinate of the opposite corner on the screen.
Ghidra address:
USA: 0x80250b58
Ghidra address:
Asia: 0x802506A8
Ghidra address:
EUR: 0x802520c0
Ghidra address:
JPN: 0x8025186c

◆ DrawDecalEllipseOutline()

void DrawDecalEllipseOutline ( s32 x0,
s32 y0,
s32 x1,
s32 y1 )

Paint the outline of the ellipse in a rectangle with the brush.

Parameters
x0The X coordinate of a corner on the screen.
y0The Y coordinate of a corner on the screen.
x1The X coordinate of the opposite corner on the screen.
y1The Y coordinate of the opposite corner on the screen.
Ghidra address:
USA: 0x80250fcc
Ghidra address:
Asia: 0x80250B1C
Ghidra address:
EUR: 0x80252534
Ghidra address:
JPN: 0x80251ce0

◆ FillCircle4Bit()

void FillCircle4Bit ( s32 x,
s32 y,
s32 radius,
u8 fromScreen )

Fill a circle.

Parameters
xThe X coordinate of the center.
yThe Y coordinate of the center.
radiusThe radius, in texels.
fromScreenWhether the center is on the screen rather than in texels.
Ghidra address:
USA: 0x8025159c
Ghidra address:
Asia: 0x802510EC
Ghidra address:
EUR: 0x80252b04
Ghidra address:
JPN: 0x802522b0

◆ DrawDecalCircleOutline()

void DrawDecalCircleOutline ( s32 x,
s32 y,
s32 radius )

Paint the outline of a circle with the brush.

Parameters
xThe X coordinate of the center on the screen.
yThe Y coordinate of the center on the screen.
radiusThe radius, in texels.
Ghidra address:
USA: 0x802517b4
Ghidra address:
Asia: 0x80251304
Ghidra address:
EUR: 0x80252d1c
Ghidra address:
JPN: 0x802524c8

◆ DrawDashedLine()

void DrawDashedLine ( s32 x0,
s32 y0,
s32 x1,
s32 y1 )

Draw the dashed line from the first point of a line to the cursor.

Parameters
x0The X coordinate of the start on the screen.
y0The Y coordinate of the start on the screen.
x1The X coordinate of the end on the screen.
y1The Y coordinate of the end on the screen.
Ghidra address:
USA: 0x80251a54
Ghidra address:
Asia: 0x802515A4
Ghidra address:
EUR: 0x80252fbc
Ghidra address:
JPN: 0x80252768

◆ DrawDashedRectangle()

void DrawDashedRectangle ( s32 x0,
s32 y0,
s32 x1,
s32 y1 )

Draw the dashed outline of a rectangle.

Parameters
x0The X coordinate of a corner on the screen.
y0The Y coordinate of a corner on the screen.
x1The X coordinate of the opposite corner on the screen.
y1The Y coordinate of the opposite corner on the screen.
Ghidra address:
USA: 0x80251cd4
Ghidra address:
Asia: 0x80251824
Ghidra address:
EUR: 0x8025323c
Ghidra address:
JPN: 0x802529e8

◆ DrawDashedRoundedRect()

void DrawDashedRoundedRect ( s32 x0,
s32 y0,
s32 x1,
s32 y1 )

Draw the dashed outline of a rectangle with rounded corners.

Parameters
x0The X coordinate of a corner on the screen.
y0The Y coordinate of a corner on the screen.
x1The X coordinate of the opposite corner on the screen.
y1The Y coordinate of the opposite corner on the screen.
Ghidra address:
USA: 0x80251f68
Ghidra address:
Asia: 0x80251AB8
Ghidra address:
EUR: 0x802534d0
Ghidra address:
JPN: 0x80252c7c

◆ DrawDashedEllipse()

void DrawDashedEllipse ( s32 x0,
s32 y0,
s32 x1,
s32 y1 )

Draw the dashed outline of the ellipse in a rectangle.

Parameters
x0The X coordinate of a corner on the screen.
y0The Y coordinate of a corner on the screen.
x1The X coordinate of the opposite corner on the screen.
y1The Y coordinate of the opposite corner on the screen.
Ghidra address:
USA: 0x802523cc
Ghidra address:
Asia: 0x80251F1C
Ghidra address:
EUR: 0x80253934
Ghidra address:
JPN: 0x802530e0

◆ DrawDashedCircle()

void DrawDashedCircle ( s32 x,
s32 y,
s32 radius )

Draw the dashed outline of a circle, the part over the decal only.

Parameters
xThe X coordinate of the center on the screen.
yThe Y coordinate of the center on the screen.
radiusThe radius, in pixels of the screen.
Ghidra address:
USA: 0x802528f8
Ghidra address:
Asia: 0x80252448
Ghidra address:
EUR: 0x80253e60
Ghidra address:
JPN: 0x8025360c

◆ DrawDecalTextPreview()

void DrawDecalTextPreview ( s32 x,
s32 y )

Draw the text not yet painted on the screen, centered on a point, with its shadow when the text tool has it.

Parameters
xThe X coordinate of the point on the screen.
yThe Y coordinate of the point on the screen.
Ghidra address:
USA: 0x80252c9c
Ghidra address:
Asia: 0x802527EC
Ghidra address:
EUR: 0x80254204
Ghidra address:
JPN: 0x802539b0

◆ SwapBytes()

void SwapBytes ( u8 * a,
u8 * b )

Swap two bytes.

Parameters
aThe first byte.
bThe second byte.
Ghidra address:
USA: 0x80252f50
Ghidra address:
Asia: 0x80252AA0
Ghidra address:
EUR: 0x802544b8
Ghidra address:
JPN: 0x80253c64

◆ EmitScaledTextureRect()

void EmitScaledTextureRect ( s32 textureWidth,
s32 textureHeight,
s32 x,
s32 y,
s32 width,
s32 height )

Draw the texture already loaded over a rectangle of the screen, upside down: the decal being edited.

Parameters
textureWidthThe width of the texture.
textureHeightThe height of the texture.
xThe left edge of the rectangle on the 640 by 480 screen.
yThe top edge of the rectangle.
widthThe width of the rectangle.
heightThe height of the rectangle.
Ghidra address:
USA: 0x80252f64
Ghidra address:
Asia: 0x80252AB4
Ghidra address:
EUR: 0x802544cc
Ghidra address:
JPN: 0x80253c78