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

The bitmaps of the paint shop of the PC port. More...

#include <windows.h>
Include dependency graph for paintshop.h:

Go to the source code of this file.

Classes

struct  CarPaintTextureSet
 The bitmaps, selection option and rectangle of a car paint set. More...

Macros

#define CAR_PAINT_GROUP_COUNT   16
 The number of groups of g_CarPaintTextureSets.
#define CAR_PAINT_SET_COUNT   30
 The number of sets of a group of g_CarPaintTextureSets.
#define CAR_PAINT_BITMAP_COUNT   4
 The number of bitmaps of a set of g_CarPaintTextureSets.
#define PAINT_DAMAGE_BITMAP_COUNT   3
 The number of entries of g_apPaintDamageBitmaps.

Typedefs

typedef struct CarPaintTextureSet CarPaintTextureSet
 The bitmaps, selection option and rectangle of a car paint set.

Functions

void * GetPaintImage (int nGroup, int nSet, int nDamage)
 Select a paint set and return its bitmap for a damage level.
void GetPaintRectangle (int nGroup, int nSet, int *pLeft, int *pRight, int *pTop, int *pBottom)
 Get the bounds of the rectangle of a paint set.
int GetSelectedPaintOption (void)
 Get the option of the paint set selected last.
int HasPaintTintPixels (const void *pImage, int nLeft, int nRight, int nTop, int nBottom)
 Test whether packed paint pixels contain a pixel to tint.
int BlitPaintImageToPixels (const void *pImage, int nLeft, int nRight, int nTop, int nBottom, unsigned char *pDest, int nWidth, int nHeight)
 Copy paint pixels into the destination rectangle, flipping rows and applying the paint tint.
void ApplyPaintDamageOverlay (int damage, unsigned char *pixels, int width, int height)
 Scale RGB by the first channel of the selected 64 by 64 damage mask, preserving alpha.
void ModulateRgbaByMask (unsigned char *pixels, int width, int height, const unsigned char *mask)
 Multiply each pixel's RGB channels by the first channel of its mask pixel, preserving alpha.
void LoadCarPaintTextures (int group, int damageVariants)
 Load one car group's paint bitmaps and optionally generate damage variants.
void SetColorTintMultipliers (int nRed, int nGreen, int nBlue)
 Set the multipliers of the tint of the paint.
void CopyBgr24ToRgba32Flipped (unsigned char *pDest, const unsigned char *pSrc, int nWidth, int nHeight, int nStride)
 Copy the rows of a bitmap of 24 bits from the bottom up into pixels of RGBA 8888, opaque.
void * ConvertBitmap24ToRgba32 (const BITMAP *pBitmap)
 Convert a bitmap of 24 bits to pixels of RGBA 8888 from malloc(), and record its size in g_dwConvertedBitmapWidth and g_dwConvertedBitmapHeight.
void * LoadBitmapFromFile (const char *pszPath)
 Load a bitmap file of 24 bits as pixels of RGBA 8888.
void LoadPaintDamageBitmaps (void)
 Load the bitmaps of the damage of the paint from Paint\damaged.bmp.
void FreeCarPaintTextures (void)
 Free the bitmaps of every set of paint of the cars.
void FreeAllPaintBitmaps (void)
 Free the bitmaps of the paint of the cars and of the damage of the paint.

Variables

int g_nSelectedPaintOption10
 The option at offset 16 of the paint set selected last.
int g_nPaintTextureGroup
 The group used to prepare car paint textures.
int g_nPaintTextureSetIndex
 The paint set index, advanced before preparing each texture.
CarPaintTextureSet g_CarPaintTextureSets [CAR_PAINT_GROUP_COUNT][CAR_PAINT_SET_COUNT]
 The sets of paint of the cars.
void * g_apPaintDamageBitmaps [PAINT_DAMAGE_BITMAP_COUNT]
 The bitmaps of the damage of the paint, from malloc().
int g_bCarPaintTexturesEnabled
 Whether additional car-paint damage variants are generated when paint textures load.
int g_dwColorTintRed
 The multiplier of the red of the tint of the paint.
int g_dwColorTintGreen
 The multiplier of the green of the tint of the paint.
int g_dwColorTintBlue
 The multiplier of the blue of the tint of the paint.
int g_dwConvertedBitmapWidth
 The width of the bitmap ConvertBitmap24ToRgba32() converted last.
int g_dwConvertedBitmapHeight
 The height of the bitmap ConvertBitmap24ToRgba32() converted last.

Detailed Description

The bitmaps of the paint shop of the PC port.

Macro Definition Documentation

◆ CAR_PAINT_GROUP_COUNT

#define CAR_PAINT_GROUP_COUNT   16

The number of groups of g_CarPaintTextureSets.

◆ CAR_PAINT_SET_COUNT

#define CAR_PAINT_SET_COUNT   30

The number of sets of a group of g_CarPaintTextureSets.

◆ CAR_PAINT_BITMAP_COUNT

#define CAR_PAINT_BITMAP_COUNT   4

The number of bitmaps of a set of g_CarPaintTextureSets.

◆ PAINT_DAMAGE_BITMAP_COUNT

#define PAINT_DAMAGE_BITMAP_COUNT   3

The number of entries of g_apPaintDamageBitmaps.

Typedef Documentation

◆ CarPaintTextureSet

typedef struct CarPaintTextureSet CarPaintTextureSet

The bitmaps, selection option and rectangle of a car paint set.

Function Documentation

◆ GetPaintImage()

void * GetPaintImage ( int nGroup,
int nSet,
int nDamage )

Select a paint set and return its bitmap for a damage level.

Parameters
nGroupThe paint group.
nSetThe paint set.
nDamageThe damage level.
Returns
The selected bitmap.
Ghidra address:
BRD3D: 0x10060f70
Ghidra address:
BRGlide: 0x10059fe0

◆ GetPaintRectangle()

void GetPaintRectangle ( int nGroup,
int nSet,
int * pLeft,
int * pRight,
int * pTop,
int * pBottom )

Get the bounds of the rectangle of a paint set.

Parameters
nGroupThe paint group.
nSetThe paint set.
pLeftReceives the left bound.
pRightReceives the right bound.
pTopReceives the top bound.
pBottomReceives the bottom bound.
Ghidra address:
BRD3D: 0x10060fb0
Ghidra address:
BRGlide: 0x1005a020

◆ GetSelectedPaintOption()

int GetSelectedPaintOption ( void )

Get the option of the paint set selected last.

Returns
The captured selection option.
Ghidra address:
BRD3D: 0x10061000
Ghidra address:
BRGlide: 0x1005a070

◆ HasPaintTintPixels()

int HasPaintTintPixels ( const void * pImage,
int nLeft,
int nRight,
int nTop,
int nBottom )

Test whether packed paint pixels contain a pixel to tint.

Parameters
pImageThe packed rectangle pixels.
nLeftThe left bound.
nRightThe right bound.
nTopThe top bound.
nBottomThe bottom bound.
Returns
Whether a pixel has red zero and equal green and blue.
Ghidra address:
BRD3D: 0x100615b0
Ghidra address:
BRGlide: 0x1005a630

◆ BlitPaintImageToPixels()

int BlitPaintImageToPixels ( const void * pImage,
int nLeft,
int nRight,
int nTop,
int nBottom,
unsigned char * pDest,
int nWidth,
int nHeight )

Copy paint pixels into the destination rectangle, flipping rows and applying the paint tint.

Parameters
pImageThe paint image.
nLeftThe left bound.
nRightThe right bound.
nTopThe top bound.
nBottomThe bottom bound.
pDestReceives the pixels.
nWidthThe destination width.
nHeightThe destination height.
Returns
Always 1, including a null image or an empty rectangle.
Ghidra address:
BRD3D: 0x10061480
Ghidra address:
BRGlide: 0x1005a500

◆ ApplyPaintDamageOverlay()

void ApplyPaintDamageOverlay ( int damage,
unsigned char * pixels,
int width,
int height )

Scale RGB by the first channel of the selected 64 by 64 damage mask, preserving alpha.

Parameters
damageThe damage level, from 1 to 3.
pixelsThe RGBA pixels to update.
widthThe width in pixels.
heightThe height in pixels.
Ghidra address:
BRD3D: 0x10061290
Ghidra address:
BRGlide: 0x1005a300

◆ ModulateRgbaByMask()

void ModulateRgbaByMask ( unsigned char * pixels,
int width,
int height,
const unsigned char * mask )

Multiply each pixel's RGB channels by the first channel of its mask pixel, preserving alpha.

Parameters
pixelsRGBA pixels to update.
widthImage width in pixels.
heightImage height in pixels.
maskRGBA mask pixels.
Ghidra address:
BRD3D: 0x10061210
Ghidra address:
BRGlide: 0x1005a280

◆ LoadCarPaintTextures()

void LoadCarPaintTextures ( int group,
int damageVariants )

Load one car group's paint bitmaps and optionally generate damage variants.

Parameters
groupIndex of the car-paint texture group.
damageVariantsWhether to generate damaged bitmaps when enabled.
Ghidra address:
BRD3D: 0x10061010
Ghidra address:
BRGlide: 0x1005a080

◆ SetColorTintMultipliers()

void SetColorTintMultipliers ( int nRed,
int nGreen,
int nBlue )

Set the multipliers of the tint of the paint.

Parameters
nRedThe multiplier of the red.
nGreenThe multiplier of the green.
nBlueThe multiplier of the blue.
Ghidra address:
BRD3D: 0x10061460
Ghidra address:
BRGlide: 0x1005a4e0

◆ CopyBgr24ToRgba32Flipped()

void CopyBgr24ToRgba32Flipped ( unsigned char * pDest,
const unsigned char * pSrc,
int nWidth,
int nHeight,
int nStride )

Copy the rows of a bitmap of 24 bits from the bottom up into pixels of RGBA 8888, opaque.

Parameters
pDestThe pixels, width by height.
pSrcThe rows of the bitmap, the bottom row first in memory.
nWidthThe width.
nHeightThe height.
nStrideThe bytes of a row of the bitmap.
Ghidra address:
BRD3D: 0x10060f00
Ghidra address:
BRGlide: 0x10059f70

◆ ConvertBitmap24ToRgba32()

void * ConvertBitmap24ToRgba32 ( const BITMAP * pBitmap)

Convert a bitmap of 24 bits to pixels of RGBA 8888 from malloc(), and record its size in g_dwConvertedBitmapWidth and g_dwConvertedBitmapHeight.

Parameters
pBitmapThe bitmap.
Returns
The pixels, or null for a bitmap of another depth or when they are not allocated.
Ghidra address:
BRD3D: 0x10060ea0
Ghidra address:
BRGlide: 0x10059f10

◆ LoadBitmapFromFile()

void * LoadBitmapFromFile ( const char * pszPath)

Load a bitmap file of 24 bits as pixels of RGBA 8888.

Parameters
pszPathThe path of the file.
Returns
The pixels from malloc(), or null.
Ghidra address:
BRD3D: 0x100611a0
Ghidra address:
BRGlide: 0x1005a210

◆ LoadPaintDamageBitmaps()

void LoadPaintDamageBitmaps ( void )

Load the bitmaps of the damage of the paint from Paint\damaged.bmp.

Ghidra address:
BRD3D: 0x10061410
Ghidra address:
BRGlide: 0x1005a490

◆ FreeCarPaintTextures()

void FreeCarPaintTextures ( void )

Free the bitmaps of every set of paint of the cars.

Ghidra address:
BRD3D: 0x100613b0
Ghidra address:
BRGlide: 0x1005a420

◆ FreeAllPaintBitmaps()

void FreeAllPaintBitmaps ( void )

Free the bitmaps of the paint of the cars and of the damage of the paint.

Ghidra address:
BRD3D: 0x10061620
Ghidra address:
BRGlide: 0x1005a6a0

Variable Documentation

◆ g_nSelectedPaintOption10

int g_nSelectedPaintOption10
extern

The option at offset 16 of the paint set selected last.

Ghidra address:
BRD3D: 0x100b2ad0

◆ g_nPaintTextureGroup

int g_nPaintTextureGroup
extern

The group used to prepare car paint textures.

Ghidra address:
BRD3D: 0x10aa3444
Ghidra address:
BRGlide: 0x10ac67a4

◆ g_nPaintTextureSetIndex

int g_nPaintTextureSetIndex
extern

The paint set index, advanced before preparing each texture.

Ghidra address:
BRD3D: 0x10aa3460
Ghidra address:
BRGlide: 0x10ac67c0

◆ g_CarPaintTextureSets

The sets of paint of the cars.

The meaning of the two dimensions is not recovered yet.

Ghidra address:
BRD3D: 0x100adfd0
Ghidra address:
BRGlide: 0x100ad7d8

◆ g_apPaintDamageBitmaps

void* g_apPaintDamageBitmaps[PAINT_DAMAGE_BITMAP_COUNT]
extern

The bitmaps of the damage of the paint, from malloc().

Ghidra address:
BRD3D: 0x10aa3450
Ghidra address:
BRGlide: 0x10ac67b0

◆ g_bCarPaintTexturesEnabled

int g_bCarPaintTexturesEnabled
extern

Whether additional car-paint damage variants are generated when paint textures load.

Ghidra address:
BRD3D: 0x100adfc8

◆ g_dwColorTintRed

int g_dwColorTintRed
extern

The multiplier of the red of the tint of the paint.

Ghidra address:
BRD3D: 0x10aa3440
Ghidra address:
BRGlide: 0x10ac67a0

◆ g_dwColorTintGreen

int g_dwColorTintGreen
extern

The multiplier of the green of the tint of the paint.

Ghidra address:
BRD3D: 0x10aa3448
Ghidra address:
BRGlide: 0x10ac67a8

◆ g_dwColorTintBlue

int g_dwColorTintBlue
extern

The multiplier of the blue of the tint of the paint.

Ghidra address:
BRD3D: 0x10aa345c
Ghidra address:
BRGlide: 0x10ac67bc

◆ g_dwConvertedBitmapWidth

int g_dwConvertedBitmapWidth
extern

The width of the bitmap ConvertBitmap24ToRgba32() converted last.

Ghidra address:
BRD3D: 0x10aa3464
Ghidra address:
BRGlide: 0x10ac67c4

◆ g_dwConvertedBitmapHeight

int g_dwConvertedBitmapHeight
extern

The height of the bitmap ConvertBitmap24ToRgba32() converted last.

Ghidra address:
BRD3D: 0x10aa3468
Ghidra address:
BRGlide: 0x10ac67c8