mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 02:25:32 -04:00
Now changing sun/shadow color updates modern lighting colors
This commit is contained in:
parent
ff3752a26d
commit
c601405db0
@ -425,7 +425,10 @@ void Lighting_SwitchActive(void) {
|
||||
Lighting.AllocState();
|
||||
}
|
||||
|
||||
static void OnInit(void) { Lighting_ApplyActive(); }
|
||||
static void OnInit(void) {
|
||||
Event_Register_(&WorldEvents.EnvVarChanged, NULL, ModernLighting_OnEnvVariableChanged);
|
||||
Lighting_ApplyActive();
|
||||
}
|
||||
static void OnReset(void) { Lighting.FreeState(); }
|
||||
static void OnNewMapLoaded(void) { Lighting.AllocState(); }
|
||||
|
||||
|
@ -63,6 +63,7 @@ CC_VAR extern struct _Lighting {
|
||||
void Lighting_SwitchActive(void);
|
||||
void Lighting_ApplyActive(void);
|
||||
void ModernLighting_SetActive(void);
|
||||
void ModernLighting_OnEnvVariableChanged(void* obj, int envVar);
|
||||
|
||||
void ClassicLighting_FreeState(void);
|
||||
void ClassicLighting_AllocState(void);
|
||||
|
@ -504,7 +504,11 @@ static void CalculateChunkLightingAll(int chunkIndex, int cx, int cy, int cz) {
|
||||
chunkLightingDataFlags[chunkIndex] = CHUNK_ALL_CALCULATED;
|
||||
}
|
||||
|
||||
static void ModernLighting_OnBlockChanged(int x, int y, int z, BlockID oldBlock, BlockID newBlock) { }
|
||||
static void ModernLighting_OnBlockChanged(int x, int y, int z, BlockID oldBlock, BlockID newBlock) {
|
||||
|
||||
}
|
||||
/* Invalidates/Resets lighting state for all of the blocks in the world */
|
||||
/* (e.g. because a block changed whether it is full bright or not) */
|
||||
static void ModernLighting_Refresh(void) {
|
||||
ModernLighting_InitPalettes();
|
||||
/* Set all the chunk lighting data flags to CHUNK_UNCALCULATED? */
|
||||
@ -583,4 +587,12 @@ void ModernLighting_SetActive(void) {
|
||||
Lighting.FreeState = ModernLighting_FreeState;
|
||||
Lighting.AllocState = ModernLighting_AllocState;
|
||||
Lighting.LightHint = ModernLighting_LightHint;
|
||||
}
|
||||
|
||||
void ModernLighting_OnEnvVariableChanged(void* obj, int envVar) {
|
||||
/* This is always called, but should only do anything if modern lighting is on */
|
||||
if (!Lighting_Modern) { return; }
|
||||
if (envVar == ENV_VAR_SUN_COLOR || envVar == ENV_VAR_SHADOW_COLOR) {
|
||||
ModernLighting_InitPalettes();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user