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

The weather of a race and the flags the renderer tests. More...

#include "common/types.h"
#include "common/vecmath.h"
Include dependency graph for weather.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WEATHER_VIEWS   2
 The views that keep their own rain.
#define RAIN_PARTICLES   512
 The rain particles of all views, shared among the views on the screen.
#define RAIN_PARTICLE_SLOTS   522
 The particle slots each view keeps, more than the particles it draws.
#define RAIN_STREAK_TEXTURE_SIDE   64
 The side of the texture of the rain streaks, in texels.
#define PARTICLE_SCALE   6.10370189e-05f
 The scale from a particle position back to world units.
#define PARTICLE_NEAR   0.1f
 The nearest distance at which a rain or snow particle is drawn.
#define RAIN_STREAK_TEXTURE_BYTES_PER_TEXEL   1
 The byte width of a rain-streak texel outside the Direct3D renderer.
#define LIGHTNING_BOLT_POINTS   459
 The points of the lightning bolt.
#define PARTICLE_TEXTURE_LAST_T   (63 << 5)
 The last texel of the particle texture, in the 10.5 fixed point of a coordinate.
#define PARTICLE_TEXTURE_STEPS   (63 << 12)
 The last texel of the particle texture, in the 20.12 fixed point of a step.
#define PARTICLE_LOAD_TEXELS   2047
#define PARTICLE_LOAD_DXT   0x100

Enumerations

enum  {
  WEATHER_SUNNY , WEATHER_FOG , WEATHER_RAIN , WEATHER_SNOW ,
  WEATHER_NIGHT
}
 The weathers, in the order of the weather menu. More...

Functions

void InitRandomRainParticles (void)
 Scatter the rain particles of every view.
void UpdateWindDirection (void)
 Turn the wind and change its strength at random, and set its velocity for the frame.
void SubdivideLightningBolt (s32 index, s32 span)
 Put a point of the lightning bolt at random near the middle of the points a span before and after it, then divide the two halves the same way.
void UpdateLightningFlash (void)
 Count down the flash of a strike, and strike at random when the last strike is long enough ago.
void StubWeatherUpdate (void)
 Called each frame of rain before the rain is drawn.
void UpdatePrecipitationParticles (void)
 Move the wind and the lightning, and move the rain or snow of each view against its camera.
void RenderPrecipitationEffect (void)
 Draw the rain or snow of the current view, unless a placed model shelters the camera.

Variables

u32 g_dwCurrentWeather
 The weather the player chose.
u32 g_dwWeatherActive
 Whether the weather is anything but sunny.
u32 g_dwNightMode
 Whether the race uses night lighting.
u32 g_dwSnowMode
 Whether the race uses snow effects.
u32 g_dwRainMode
 Whether the race uses rain effects.
u8 g_bFogR
 The colour of the fog.
u8 g_bFogG
 The green component of the fog colour.
u8 g_bFogB
 The blue component of the fog colour.
u8 g_bFogIntensity
 How far the fog colour covers the sky.
s32 g_dwLightningFlashCounter
 The frames of lightning left, during which the sky flashes on the odd ones.
s32 g_dwRainParticleCount
 The particles each view draws.
f32 g_fWindAngle
 The direction the wind blows towards, in radians.
f32 g_fWindStrength
 The strength of the wind, from 0.5 to 1.
f32 g_fRainCameraSpeed
 The speed of the camera of the last view through the rain, limited.
f32 g_fRainCameraSpeedScale
 The share of its movement the camera of the last view passes on to the rain.
s32 g_nLightningBoltDepth
 Four times the depth of the lightning bolt being divided.
f32 g_fLightningFlashTimer
 The time since the last strike, in 343 units a second.
s32 g_bRainParticlesInitialized
 Whether the rain particles have their first positions.
u8 g_aParticleTexture []
 The texture of the snowflakes and other particles, 64 texels square.
s16 g_awRainParticlePos [WEATHER_VIEWS][RAIN_PARTICLE_SLOTS][3]
 The positions of the rain particles of each view, in a cube around the camera that wraps.
Vec3f g_avRainPrevCameraPos [WEATHER_VIEWS]
 The point ahead of the camera of each view last frame.
Vec3f g_vWindVelocity
 How far the wind moves things in a frame.
Vec3f g_avRainVelocity [WEATHER_VIEWS]
 How far the rain of each view falls in a frame, against its camera.
Vec3f g_avLightningBolt [LIGHTNING_BOLT_POINTS]
 The points of the lightning bolt.
u8 g_abPrecipitationTextures [WEATHER_VIEWS][RAIN_STREAK_TEXTURE_SIDE *RAIN_STREAK_TEXTURE_SIDE *RAIN_STREAK_TEXTURE_BYTES_PER_TEXEL]
 The texture of the rain streaks of each view, drawn along the fall of the rain.

Detailed Description

The weather of a race and the flags the renderer tests.

Macro Definition Documentation

◆ WEATHER_VIEWS

#define WEATHER_VIEWS   2

The views that keep their own rain.

◆ RAIN_PARTICLES

#define RAIN_PARTICLES   512

The rain particles of all views, shared among the views on the screen.

◆ RAIN_PARTICLE_SLOTS

#define RAIN_PARTICLE_SLOTS   522

The particle slots each view keeps, more than the particles it draws.

◆ RAIN_STREAK_TEXTURE_SIDE

#define RAIN_STREAK_TEXTURE_SIDE   64

The side of the texture of the rain streaks, in texels.

◆ PARTICLE_SCALE

#define PARTICLE_SCALE   6.10370189e-05f

The scale from a particle position back to world units.

◆ PARTICLE_NEAR

#define PARTICLE_NEAR   0.1f

The nearest distance at which a rain or snow particle is drawn.

◆ RAIN_STREAK_TEXTURE_BYTES_PER_TEXEL

#define RAIN_STREAK_TEXTURE_BYTES_PER_TEXEL   1

The byte width of a rain-streak texel outside the Direct3D renderer.

◆ LIGHTNING_BOLT_POINTS

#define LIGHTNING_BOLT_POINTS   459

The points of the lightning bolt.

◆ PARTICLE_TEXTURE_LAST_T

#define PARTICLE_TEXTURE_LAST_T   (63 << 5)

The last texel of the particle texture, in the 10.5 fixed point of a coordinate.

◆ PARTICLE_TEXTURE_STEPS

#define PARTICLE_TEXTURE_STEPS   (63 << 12)

The last texel of the particle texture, in the 20.12 fixed point of a step.

◆ PARTICLE_LOAD_TEXELS

#define PARTICLE_LOAD_TEXELS   2047

The texels to load as 16-bit texels, less one.

◆ PARTICLE_LOAD_DXT

#define PARTICLE_LOAD_DXT   0x100

The step of the load to the next line of texels.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

The weathers, in the order of the weather menu.

Enumerator
WEATHER_SUNNY 

Clear weather by day.

WEATHER_FOG 

Fog.

WEATHER_RAIN 

Rain.

WEATHER_SNOW 

Snow.

WEATHER_NIGHT 

Night.

Function Documentation

◆ InitRandomRainParticles()

void InitRandomRainParticles ( void )

Scatter the rain particles of every view.

Ghidra address:
USA: 0x80239cf0
Ghidra address:
Asia: 0x80239840
Ghidra address:
EUR: 0x8023b200
Ghidra address:
JPN: 0x8023ad00
Ghidra address:
BRD3D: 0x10019490
Ghidra address:
BRGlide: 0x10016a50

◆ UpdateWindDirection()

void UpdateWindDirection ( void )

Turn the wind and change its strength at random, and set its velocity for the frame.

Ghidra address:
USA: 0x80239d84
Ghidra address:
Asia: 0x802398D4
Ghidra address:
EUR: 0x8023b294
Ghidra address:
JPN: 0x8023ad94
Ghidra address:
BRD3D: 0x100194e0
Ghidra address:
BRGlide: 0x10016aa0

◆ SubdivideLightningBolt()

void SubdivideLightningBolt ( s32 index,
s32 span )

Put a point of the lightning bolt at random near the middle of the points a span before and after it, then divide the two halves the same way.

Parameters
indexThe index of the point in the bolt.
spanThe distance in points to the neighbours, halved at each level.
Ghidra address:
USA: 0x80239f28
Ghidra address:
Asia: 0x80239A78
Ghidra address:
EUR: 0x8023b438
Ghidra address:
JPN: 0x8023af38

◆ UpdateLightningFlash()

void UpdateLightningFlash ( void )

Count down the flash of a strike, and strike at random when the last strike is long enough ago.

Ghidra address:
USA: 0x8023a0bc
Ghidra address:
Asia: 0x80239C0C
Ghidra address:
EUR: 0x8023b5cc
Ghidra address:
JPN: 0x8023b0cc
Ghidra address:
BRD3D: 0x10019620
Ghidra address:
BRGlide: 0x10016be0

◆ StubWeatherUpdate()

void StubWeatherUpdate ( void )

Called each frame of rain before the rain is drawn.

It does nothing.

Ghidra address:
USA: 0x8023a1c0
Ghidra address:
Asia: 0x80239D10
Ghidra address:
EUR: 0x8023b6d0
Ghidra address:
JPN: 0x8023b1d0

◆ UpdatePrecipitationParticles()

void UpdatePrecipitationParticles ( void )

Move the wind and the lightning, and move the rain or snow of each view against its camera.

Ghidra address:
USA: 0x8023a1c8
Ghidra address:
Asia: 0x80239D18
Ghidra address:
EUR: 0x8023b6d8
Ghidra address:
JPN: 0x8023b1d8
Ghidra address:
BRD3D: 0x100196d0
Ghidra address:
BRGlide: 0x10016c90

◆ RenderPrecipitationEffect()

void RenderPrecipitationEffect ( void )

Draw the rain or snow of the current view, unless a placed model shelters the camera.

Ghidra address:
USA: 0x8023a784
Ghidra address:
Asia: 0x8023A2D4
Ghidra address:
EUR: 0x8023bc94
Ghidra address:
JPN: 0x8023b794
Ghidra address:
BRD3D: 0x10019b50
Ghidra address:
BRGlide: 0x10017110

Variable Documentation

◆ g_dwCurrentWeather

u32 g_dwCurrentWeather
extern

The weather the player chose.

Ghidra address:
USA: 0x8028c800
Ghidra address:
Asia: 0x8028C350
Ghidra address:
EUR: 0x8028ef60
Ghidra address:
JPN: 0x8028e9b0
Ghidra address:
BRD3D: 0x104bbe08
Ghidra address:
BRGlide: 0x104b15e8

◆ g_dwWeatherActive

u32 g_dwWeatherActive
extern

Whether the weather is anything but sunny.

Ghidra address:
USA: 0x8028aa78
Ghidra address:
Asia: 0x8028A5C8
Ghidra address:
EUR: 0x8028cc80
Ghidra address:
JPN: 0x8028c750
Ghidra address:
BRD3D: 0x106c6618
Ghidra address:
BRGlide: 0x106ed6a8

◆ g_dwNightMode

u32 g_dwNightMode
extern

Whether the race uses night lighting.

Ghidra address:
USA: 0x8028aa80
Ghidra address:
Asia: 0x8028A5D0
Ghidra address:
EUR: 0x8028cc88
Ghidra address:
JPN: 0x8028c758
Ghidra address:
BRD3D: 0x106c661c
Ghidra address:
BRGlide: 0x106ed6ac

◆ g_dwSnowMode

u32 g_dwSnowMode
extern

Whether the race uses snow effects.

Ghidra address:
USA: 0x8028aa84
Ghidra address:
Asia: 0x8028A5D4
Ghidra address:
EUR: 0x8028cc8c
Ghidra address:
JPN: 0x8028c75c
Ghidra address:
BRD3D: 0x106c6620
Ghidra address:
BRGlide: 0x106ed6b0

◆ g_dwRainMode

u32 g_dwRainMode
extern

Whether the race uses rain effects.

Ghidra address:
USA: 0x8028aa8c
Ghidra address:
Asia: 0x8028A5DC
Ghidra address:
EUR: 0x8028cc94
Ghidra address:
JPN: 0x8028c764
Ghidra address:
BRD3D: 0x106c6624
Ghidra address:
BRGlide: 0x106ed6b4

◆ g_bFogR

u8 g_bFogR
extern

The colour of the fog.

Ghidra address:
USA: 0x8028ab20
Ghidra address:
Asia: 0x8028A670
Ghidra address:
EUR: 0x8028cd28
Ghidra address:
JPN: 0x8028c7f8
Ghidra address:
BRD3D: 0x106c0260
Ghidra address:
BRGlide: 0x106e72f0

◆ g_bFogG

u8 g_bFogG
extern

The green component of the fog colour.

Ghidra address:
USA: 0x8028ab24
Ghidra address:
Asia: 0x8028A674
Ghidra address:
EUR: 0x8028cd2c
Ghidra address:
JPN: 0x8028c7fc
Ghidra address:
BRD3D: 0x106c1614
Ghidra address:
BRGlide: 0x106e86a4

◆ g_bFogB

u8 g_bFogB
extern

The blue component of the fog colour.

Ghidra address:
USA: 0x8028ab28
Ghidra address:
Asia: 0x8028A678
Ghidra address:
EUR: 0x8028cd30
Ghidra address:
JPN: 0x8028c800
Ghidra address:
BRD3D: 0x106c0200
Ghidra address:
BRGlide: 0x106e7290

◆ g_bFogIntensity

u8 g_bFogIntensity
extern

How far the fog colour covers the sky.

Ghidra address:
USA: 0x8028ab2c
Ghidra address:
Asia: 0x8028A67C
Ghidra address:
EUR: 0x8028cd34
Ghidra address:
JPN: 0x8028c804
Ghidra address:
BRD3D: 0x10690be8
Ghidra address:
BRGlide: 0x106b7c78

◆ g_dwLightningFlashCounter

s32 g_dwLightningFlashCounter
extern

The frames of lightning left, during which the sky flashes on the odd ones.

It stays 0 until the next strike is allowed, and is -1 while a strike may come.

Ghidra address:
USA: 0x8028c818
Ghidra address:
Asia: 0x8028C368
Ghidra address:
EUR: 0x8028ef78
Ghidra address:
JPN: 0x8028e9c8
Ghidra address:
BRD3D: 0x100a79cc
Ghidra address:
BRGlide: 0x100a718c

◆ g_dwRainParticleCount

s32 g_dwRainParticleCount
extern

The particles each view draws.

Ghidra address:
USA: 0x8028c804
Ghidra address:
Asia: 0x8028C354
Ghidra address:
EUR: 0x8028ef64
Ghidra address:
JPN: 0x8028e9b4
Ghidra address:
BRD3D: 0x104b2550
Ghidra address:
BRGlide: 0x104add38

◆ g_fWindAngle

f32 g_fWindAngle
extern

The direction the wind blows towards, in radians.

Ghidra address:
USA: 0x8028c808
Ghidra address:
Asia: 0x8028C358
Ghidra address:
EUR: 0x8028ef68
Ghidra address:
JPN: 0x8028e9b8
Ghidra address:
BRD3D: 0x104bbe0c
Ghidra address:
BRGlide: 0x104b15ec

◆ g_fWindStrength

f32 g_fWindStrength
extern

The strength of the wind, from 0.5 to 1.

Ghidra address:
USA: 0x8028c80c
Ghidra address:
Asia: 0x8028C35C
Ghidra address:
EUR: 0x8028ef6c
Ghidra address:
JPN: 0x8028e9bc
Ghidra address:
BRD3D: 0x100a79c8
Ghidra address:
BRGlide: 0x100a7188

◆ g_fRainCameraSpeed

f32 g_fRainCameraSpeed
extern

The speed of the camera of the last view through the rain, limited.

Ghidra address:
USA: 0x8028c810
Ghidra address:
Asia: 0x8028C360
Ghidra address:
EUR: 0x8028ef70
Ghidra address:
JPN: 0x8028e9c0
Ghidra address:
BRD3D: 0x104bbde8
Ghidra address:
BRGlide: 0x104b15c8

◆ g_fRainCameraSpeedScale

f32 g_fRainCameraSpeedScale
extern

The share of its movement the camera of the last view passes on to the rain.

Ghidra address:
USA: 0x8028c814
Ghidra address:
Asia: 0x8028C364
Ghidra address:
EUR: 0x8028ef74
Ghidra address:
JPN: 0x8028e9c4
Ghidra address:
BRD3D: 0x104b1f00
Ghidra address:
BRGlide: 0x104ad6e8

◆ g_nLightningBoltDepth

s32 g_nLightningBoltDepth
extern

Four times the depth of the lightning bolt being divided.

Ghidra address:
USA: 0x8028c81c
Ghidra address:
Asia: 0x8028C36C
Ghidra address:
EUR: 0x8028ef7c
Ghidra address:
JPN: 0x8028e9cc

◆ g_fLightningFlashTimer

f32 g_fLightningFlashTimer
extern

The time since the last strike, in 343 units a second.

Ghidra address:
USA: 0x8028c820
Ghidra address:
Asia: 0x8028C370
Ghidra address:
EUR: 0x8028ef80
Ghidra address:
JPN: 0x8028e9d0
Ghidra address:
BRD3D: 0x104b255c
Ghidra address:
BRGlide: 0x104add3c

◆ g_bRainParticlesInitialized

s32 g_bRainParticlesInitialized
extern

Whether the rain particles have their first positions.

Ghidra address:
USA: 0x8028c824
Ghidra address:
Asia: 0x8028C374
Ghidra address:
EUR: 0x8028ef84
Ghidra address:
JPN: 0x8028e9d4
Ghidra address:
BRD3D: 0x104bbe14
Ghidra address:
BRGlide: 0x104b15f4

◆ g_aParticleTexture

u8 g_aParticleTexture[]
extern

The texture of the snowflakes and other particles, 64 texels square.

Ghidra address:
USA: 0x802a3790
Ghidra address:
Asia: 0x802A32E0
Ghidra address:
EUR: 0x802a5f50
Ghidra address:
JPN: 0x802a59f0
Ghidra address:
BRD3D: 0x100baac8
Ghidra address:
BRGlide: 0x100ba2d0

◆ g_awRainParticlePos

s16 g_awRainParticlePos[WEATHER_VIEWS][RAIN_PARTICLE_SLOTS][3]
extern

The positions of the rain particles of each view, in a cube around the camera that wraps.

Ghidra address:
USA: 0x80361c40
Ghidra address:
Asia: 0x803616F0
Ghidra address:
EUR: 0x80364140
Ghidra address:
JPN: 0x80362db0
Ghidra address:
BRD3D: 0x104b2570
Ghidra address:
BRGlide: 0x104add50

◆ g_avRainPrevCameraPos

Vec3f g_avRainPrevCameraPos[WEATHER_VIEWS]
extern

The point ahead of the camera of each view last frame.

Ghidra address:
USA: 0x803634b8
Ghidra address:
Asia: 0x80362F68
Ghidra address:
EUR: 0x803659b8
Ghidra address:
JPN: 0x80364628
Ghidra address:
BRD3D: 0x104b0688
Ghidra address:
BRGlide: 0x104abe70

◆ g_vWindVelocity

Vec3f g_vWindVelocity
extern

How far the wind moves things in a frame.

Ghidra address:
USA: 0x803634d0
Ghidra address:
Asia: 0x80362F80
Ghidra address:
EUR: 0x803659d0
Ghidra address:
JPN: 0x80364640
Ghidra address:
BRD3D: 0x104b2560
Ghidra address:
BRGlide: 0x104add40

◆ g_avRainVelocity

Vec3f g_avRainVelocity[WEATHER_VIEWS]
extern

How far the rain of each view falls in a frame, against its camera.

Ghidra address:
USA: 0x803634e0
Ghidra address:
Asia: 0x80362F90
Ghidra address:
EUR: 0x803659e0
Ghidra address:
JPN: 0x80364650
Ghidra address:
BRD3D: 0x104bbdf0
Ghidra address:
BRGlide: 0x104b15d0

◆ g_avLightningBolt

Vec3f g_avLightningBolt[LIGHTNING_BOLT_POINTS]
extern

The points of the lightning bolt.

The first is the point the lightning strikes.

Ghidra address:
USA: 0x803634f8
Ghidra address:
Asia: 0x80362FA8
Ghidra address:
EUR: 0x803659f8
Ghidra address:
JPN: 0x80364668
Ghidra address:
BRD3D: 0x104b0378
Ghidra address:
BRGlide: 0x104abb60

◆ g_abPrecipitationTextures

The texture of the rain streaks of each view, drawn along the fall of the rain.

Ghidra address:
USA: 0x80364a80
Ghidra address:
Asia: 0x80364530
Ghidra address:
EUR: 0x80366f80
Ghidra address:
JPN: 0x80365bf0
Ghidra address:
BRD3D: 0x104b3de8
Ghidra address:
BRGlide: 0x104af5c8