mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 03:25:14 -04:00
Fix changing sun/shadow causing borders/edge to be recreated twice
This commit is contained in:
parent
63b20880e8
commit
bf5e1ebd04
@ -187,7 +187,7 @@ namespace ClassicalSharp.Map {
|
||||
/// <summary> Sets sunlight colour, and raises
|
||||
/// EnvVariableChanged event with variable 'SunlightColour'. </summary>
|
||||
public void SetSunlight(FastColour col) {
|
||||
if (!Set(col, ref Sunlight, EnvVar.SunlightColour)) return;
|
||||
if (col == Sunlight) return;
|
||||
|
||||
FastColour.GetShaded(Sunlight, out SunXSide,
|
||||
out SunZSide, out SunYBottom);
|
||||
@ -198,7 +198,7 @@ namespace ClassicalSharp.Map {
|
||||
/// <summary> Sets current shadowlight colour, and raises
|
||||
/// EnvVariableChanged event with variable 'ShadowlightColour'. </summary>
|
||||
public void SetShadowlight(FastColour col) {
|
||||
if (!Set(col, ref Shadowlight, EnvVar.ShadowlightColour)) return;
|
||||
if (col == Shadowlight) return;
|
||||
|
||||
FastColour.GetShaded(Shadowlight, out ShadowXSide,
|
||||
out ShadowZSide, out ShadowYBottom);
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define CC_2DSTRUCTS_H
|
||||
#include "Typedefs.h"
|
||||
/* Represents simple structures useful for 2D operations.
|
||||
Copyright 22017 ClassicalSharp | Licensed under BSD-3
|
||||
Copyright 2017 ClassicalSharp | Licensed under BSD-3
|
||||
*/
|
||||
|
||||
/* Stores location and dimensions of a 2D rectangle. */
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "Game.h"
|
||||
|
||||
UInt32 Block_DefinedCustomBlocks[BLOCK_COUNT >> 5];
|
||||
UInt8 Block_NamesBuffer[String_BufferSize(STRING_SIZE) * BLOCK_COUNT];
|
||||
#define Block_NamePtr(i) &Block_NamesBuffer[String_BufferSize(STRING_SIZE) * i]
|
||||
|
||||
TextureLoc Block_TopTex[BLOCK_CPE_COUNT] = { 0, 1, 0, 2, 16, 4, 15, 17, 14, 14,
|
||||
30, 30, 18, 19, 32, 33, 34, 21, 22, 48, 49, 64, 65, 66, 67, 68, 69, 70, 71,
|
||||
|
@ -39,9 +39,6 @@
|
||||
#define COLLIDE_LIQUID_LAVA 6 /* Lava style 'swimming'/'bobbing' interaction when player collides. */
|
||||
#define COLLIDE_CLIMB_ROPE 7 /* Rope/Ladder style climbing interaction when player collides */
|
||||
|
||||
UInt8 Block_NamesBuffer[String_BufferSize(STRING_SIZE) * BLOCK_COUNT];
|
||||
#define Block_NamePtr(i) &Block_NamesBuffer[String_BufferSize(STRING_SIZE) * i]
|
||||
|
||||
bool Block_IsLiquid[BLOCK_COUNT];
|
||||
bool Block_BlocksLight[BLOCK_COUNT];
|
||||
bool Block_FullBright[BLOCK_COUNT];
|
||||
|
@ -31,7 +31,6 @@ FN_GLGENBUFFERS glGenBuffers;
|
||||
FN_GLBUFFERDATA glBufferData;
|
||||
FN_GLBUFFERSUBDATA glBufferSubData;
|
||||
|
||||
|
||||
bool gl_lists = false;
|
||||
Int32 gl_activeList = -1;
|
||||
#define gl_DYNAMICLISTID 1234567891
|
||||
@ -95,12 +94,7 @@ void Gfx_Free(void) {
|
||||
GLContext_Free();
|
||||
}
|
||||
|
||||
#define GL_TOGGLE(cap)\
|
||||
if (enabled) {\
|
||||
glEnable(cap);\
|
||||
} else {\
|
||||
glDisable(cap);\
|
||||
}
|
||||
#define gl_Toggle(cap) if (enabled) { glEnable(cap); } else { glDisable(cap); }
|
||||
|
||||
void GL_DoMipmaps(GfxResourceID texId, Int32 x, Int32 y, Bitmap* bmp, bool partial) {
|
||||
UInt8* prev = bmp->Scan0;
|
||||
@ -168,7 +162,7 @@ void Gfx_DeleteTexture(GfxResourceID* texId) {
|
||||
*texId = NULL;
|
||||
}
|
||||
|
||||
void Gfx_SetTexturing(bool enabled) { GL_TOGGLE(GL_TEXTURE_2D); }
|
||||
void Gfx_SetTexturing(bool enabled) { gl_Toggle(GL_TEXTURE_2D); }
|
||||
void Gfx_EnableMipmaps(void) { }
|
||||
void Gfx_DisableMipmaps(void) { }
|
||||
|
||||
@ -177,7 +171,7 @@ bool gl_fogEnable;
|
||||
bool Gfx_GetFog(void) { return gl_fogEnable; }
|
||||
void Gfx_SetFog(bool enabled) {
|
||||
gl_fogEnable = enabled;
|
||||
GL_TOGGLE(GL_FOG);
|
||||
gl_Toggle(GL_FOG);
|
||||
}
|
||||
|
||||
PackedCol gl_lastFogCol;
|
||||
@ -213,13 +207,13 @@ void Gfx_SetFogMode(Int32 mode) {
|
||||
}
|
||||
|
||||
|
||||
void Gfx_SetFaceCulling(bool enabled) { GL_TOGGLE(GL_CULL_FACE); }
|
||||
void Gfx_SetAlphaTest(bool enabled) { GL_TOGGLE(GL_ALPHA_TEST); }
|
||||
void Gfx_SetFaceCulling(bool enabled) { gl_Toggle(GL_CULL_FACE); }
|
||||
void Gfx_SetAlphaTest(bool enabled) { gl_Toggle(GL_ALPHA_TEST); }
|
||||
void Gfx_SetAlphaTestFunc(Int32 func, Real32 value) {
|
||||
glAlphaFunc(gl_compare[func], value);
|
||||
}
|
||||
|
||||
void Gfx_SetAlphaBlending(bool enabled) { GL_TOGGLE(GL_BLEND); }
|
||||
void Gfx_SetAlphaBlending(bool enabled) { gl_Toggle(GL_BLEND); }
|
||||
void Gfx_SetAlphaBlendFunc(Int32 srcFunc, Int32 dstFunc) {
|
||||
glBlendFunc(gl_blend[srcFunc], gl_blend[dstFunc]);
|
||||
}
|
||||
@ -245,7 +239,7 @@ void Gfx_SetDepthWrite(bool enabled) {
|
||||
glDepthMask(enabled);
|
||||
}
|
||||
|
||||
void Gfx_SetDepthTest(bool enabled) { GL_TOGGLE(GL_DEPTH_TEST); }
|
||||
void Gfx_SetDepthTest(bool enabled) { gl_Toggle(GL_DEPTH_TEST); }
|
||||
void Gfx_SetDepthTestFunc(Int32 compareFunc) {
|
||||
glDepthFunc(gl_compare[compareFunc]);
|
||||
}
|
||||
|
@ -210,11 +210,9 @@ void PlayerListWidget_GetNameUnder(PlayerListWidget* widget, Int32 mouseX, Int32
|
||||
|
||||
typedef void (*SpecialInputAppendFunc)(void* userData, UInt8 c);
|
||||
typedef struct SpecialInputTab_ {
|
||||
String Title;
|
||||
Int32 ItemsPerRow, CharsPerItem;
|
||||
Size2D TitleSize;
|
||||
String Contents;
|
||||
Int32 ItemsPerRow;
|
||||
Int32 CharsPerItem;
|
||||
String Title, Contents;
|
||||
} SpecialInputTab;
|
||||
void SpecialInputTab_Init(SpecialInputTab* tab, STRING_REF String* title,
|
||||
Int32 itemsPerRow, Int32 charsPerItem, STRING_REF String* contents);
|
||||
|
Loading…
x
Reference in New Issue
Block a user