mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-13 17:47:12 -04:00
Change classicgen to use still lava/water instead of active lava/water, to match original classic
This commit is contained in:
parent
cd5f316383
commit
3ed7d1ce2d
@ -259,7 +259,7 @@ static int NotchyGen_CreateStrataFast(void) {
|
||||
Gen_CurrentProgress = 0.0f;
|
||||
Gen_CurrentState = "Filling map";
|
||||
/* Make lava layer at bottom */
|
||||
Mem_Set(Gen_Blocks, BLOCK_LAVA, oneY);
|
||||
Mem_Set(Gen_Blocks, BLOCK_STILL_LAVA, oneY);
|
||||
|
||||
/* Invariant: the lowest value dirtThickness can possible be is -14 */
|
||||
stoneHeight = minHeight - 14;
|
||||
@ -409,8 +409,8 @@ static void NotchyGen_FloodFillWaterBorders(void) {
|
||||
for (x = 0; x < World.Width; x++) {
|
||||
Gen_CurrentProgress = 0.0f + ((float)x / World.Width) * 0.5f;
|
||||
|
||||
NotchyGen_FloodFill(index1, BLOCK_WATER);
|
||||
NotchyGen_FloodFill(index2, BLOCK_WATER);
|
||||
NotchyGen_FloodFill(index1, BLOCK_STILL_WATER);
|
||||
NotchyGen_FloodFill(index2, BLOCK_STILL_WATER);
|
||||
index1++; index2++;
|
||||
}
|
||||
|
||||
@ -419,8 +419,8 @@ static void NotchyGen_FloodFillWaterBorders(void) {
|
||||
for (z = 0; z < World.Length; z++) {
|
||||
Gen_CurrentProgress = 0.5f + ((float)z / World.Length) * 0.5f;
|
||||
|
||||
NotchyGen_FloodFill(index1, BLOCK_WATER);
|
||||
NotchyGen_FloodFill(index2, BLOCK_WATER);
|
||||
NotchyGen_FloodFill(index1, BLOCK_STILL_WATER);
|
||||
NotchyGen_FloodFill(index2, BLOCK_STILL_WATER);
|
||||
index1 += World.Width; index2 += World.Width;
|
||||
}
|
||||
}
|
||||
@ -437,7 +437,7 @@ static void NotchyGen_FloodFillWater(void) {
|
||||
x = Random_Next(&rnd, World.Width);
|
||||
z = Random_Next(&rnd, World.Length);
|
||||
y = waterLevel - Random_Range(&rnd, 1, 3);
|
||||
NotchyGen_FloodFill(World_Pack(x, y, z), BLOCK_WATER);
|
||||
NotchyGen_FloodFill(World_Pack(x, y, z), BLOCK_STILL_WATER);
|
||||
}
|
||||
}
|
||||
|
||||
@ -453,7 +453,7 @@ static void NotchyGen_FloodFillLava(void) {
|
||||
x = Random_Next(&rnd, World.Width);
|
||||
z = Random_Next(&rnd, World.Length);
|
||||
y = (int)((waterLevel - 3) * Random_Float(&rnd) * Random_Float(&rnd));
|
||||
NotchyGen_FloodFill(World_Pack(x, y, z), BLOCK_LAVA);
|
||||
NotchyGen_FloodFill(World_Pack(x, y, z), BLOCK_STILL_LAVA);
|
||||
}
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ static void NotchyGen_CreateSurfaceLayer(void) {
|
||||
above = y >= World.MaxY ? BLOCK_AIR : Gen_Blocks[index + World.OneY];
|
||||
|
||||
/* TODO: update heightmap */
|
||||
if (above == BLOCK_WATER && (OctaveNoise_Calc(&n2, (float)x, (float)z) > 12)) {
|
||||
if (above == BLOCK_STILL_WATER && (OctaveNoise_Calc(&n2, (float)x, (float)z) > 12)) {
|
||||
Gen_Blocks[index] = BLOCK_GRAVEL;
|
||||
} else if (above == BLOCK_AIR) {
|
||||
Gen_Blocks[index] = (y <= waterLevel && (OctaveNoise_Calc(&n1, (float)x, (float)z) > 8)) ? BLOCK_SAND : BLOCK_GRASS;
|
||||
|
@ -61,33 +61,33 @@ static BitmapCol LButton_Expand(BitmapCol a, int amount) {
|
||||
}
|
||||
|
||||
static void LButton_DrawBackground(struct LButton* w) {
|
||||
BitmapCol col = w->hovered ? Launcher_Theme.ButtonForeActiveColor
|
||||
: Launcher_Theme.ButtonForeColor;
|
||||
BitmapCol color = w->hovered ? Launcher_Theme.ButtonForeActiveColor
|
||||
: Launcher_Theme.ButtonForeColor;
|
||||
|
||||
if (Launcher_Theme.ClassicBackground) {
|
||||
Gradient_Noise(&Launcher_Framebuffer, col, 8,
|
||||
Gradient_Noise(&Launcher_Framebuffer, color, 8,
|
||||
w->x + xBorder, w->y + yBorder,
|
||||
w->width - xBorder2, w->height - yBorder2);
|
||||
} else {
|
||||
|
||||
Gradient_Vertical(&Launcher_Framebuffer, LButton_Expand(col, 8), LButton_Expand(col, -8),
|
||||
Gradient_Vertical(&Launcher_Framebuffer, LButton_Expand(color, 8), LButton_Expand(color, -8),
|
||||
w->x + xBorder, w->y + yBorder,
|
||||
w->width - xBorder2, w->height - yBorder2);
|
||||
}
|
||||
}
|
||||
|
||||
static void LButton_DrawBorder(struct LButton* w) {
|
||||
BitmapCol backCol = Launcher_Theme.ButtonBorderColor;
|
||||
Drawer2D_Clear(&Launcher_Framebuffer, backCol,
|
||||
BitmapCol backColor = Launcher_Theme.ButtonBorderColor;
|
||||
Drawer2D_Clear(&Launcher_Framebuffer, backColor,
|
||||
w->x + xBorder, w->y,
|
||||
w->width - xBorder2, yBorder);
|
||||
Drawer2D_Clear(&Launcher_Framebuffer, backCol,
|
||||
Drawer2D_Clear(&Launcher_Framebuffer, backColor,
|
||||
w->x + xBorder, w->y + w->height - yBorder,
|
||||
w->width - xBorder2, yBorder);
|
||||
Drawer2D_Clear(&Launcher_Framebuffer, backCol,
|
||||
Drawer2D_Clear(&Launcher_Framebuffer, backColor,
|
||||
w->x, w->y + yBorder,
|
||||
xBorder, w->height - yBorder2);
|
||||
Drawer2D_Clear(&Launcher_Framebuffer, backCol,
|
||||
Drawer2D_Clear(&Launcher_Framebuffer, backColor,
|
||||
w->x + w->width - xBorder, w->y + yBorder,
|
||||
xBorder, w->height - yBorder2);
|
||||
}
|
||||
@ -169,7 +169,7 @@ static const PackedCol checkbox_palette[] = {
|
||||
};
|
||||
|
||||
static void DrawIndexed(int size, int x, int y, struct Bitmap* bmp) {
|
||||
BitmapCol* row, col;
|
||||
BitmapCol* row, color;
|
||||
int i, xx, yy;
|
||||
|
||||
for (i = 0, yy = 0; yy < size; yy++) {
|
||||
@ -178,11 +178,11 @@ static void DrawIndexed(int size, int x, int y, struct Bitmap* bmp) {
|
||||
row = Bitmap_GetRow(bmp, y + yy);
|
||||
|
||||
for (xx = 0; xx < size; xx++) {
|
||||
col = checkbox_palette[checkbox_indices[i++]];
|
||||
if (col == 0) continue; /* transparent pixel */
|
||||
color = checkbox_palette[checkbox_indices[i++]];
|
||||
if (color == 0) continue; /* transparent pixel */
|
||||
|
||||
if ((x + xx) < 0 || (x + xx) >= bmp->width) continue;
|
||||
row[x + xx] = col;
|
||||
row[x + xx] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -316,10 +316,10 @@ void LBackend_DrawLabel(struct LLabel* w) {
|
||||
/*########################################################################################################################*
|
||||
*-------------------------------------------------------LineWidget--------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
#define CLASSIC_LINE_COL BitmapCol_Make(128,128,128, 255)
|
||||
#define CLASSIC_LINE_COLOR BitmapCol_Make(128,128,128, 255)
|
||||
void LBackend_DrawLine(struct LLine* w) {
|
||||
BitmapCol col = Launcher_Theme.ClassicBackground ? CLASSIC_LINE_COL : Launcher_Theme.ButtonBorderColor;
|
||||
Gradient_Blend(&Launcher_Framebuffer, col, 128, w->x, w->y, w->width, w->height);
|
||||
BitmapCol color = Launcher_Theme.ClassicBackground ? CLASSIC_LINE_COLOR : Launcher_Theme.ButtonBorderColor;
|
||||
Gradient_Blend(&Launcher_Framebuffer, color, 128, w->x, w->y, w->width, w->height);
|
||||
}
|
||||
|
||||
|
||||
|
@ -367,19 +367,19 @@ static struct LWidget* colours_widgets[] = {
|
||||
(struct LWidget*)&ColoursScreen.btnBack, (struct LWidget*)&ColoursScreen.cbClassic
|
||||
};
|
||||
|
||||
CC_NOINLINE static void ColoursScreen_Update(struct ColoursScreen* s, int i, BitmapCol col) {
|
||||
CC_NOINLINE static void ColoursScreen_Update(struct ColoursScreen* s, int i, BitmapCol color) {
|
||||
cc_string tmp; char tmpBuffer[3];
|
||||
|
||||
String_InitArray(tmp, tmpBuffer);
|
||||
String_AppendInt(&tmp, BitmapCol_R(col));
|
||||
String_AppendInt(&tmp, BitmapCol_R(color));
|
||||
LInput_SetText(&s->iptColours[i + 0], &tmp);
|
||||
|
||||
tmp.length = 0;
|
||||
String_AppendInt(&tmp, BitmapCol_G(col));
|
||||
String_AppendInt(&tmp, BitmapCol_G(color));
|
||||
LInput_SetText(&s->iptColours[i + 1], &tmp);
|
||||
|
||||
tmp.length = 0;
|
||||
String_AppendInt(&tmp, BitmapCol_B(col));
|
||||
String_AppendInt(&tmp, BitmapCol_B(color));
|
||||
LInput_SetText(&s->iptColours[i + 2], &tmp);
|
||||
}
|
||||
|
||||
@ -394,14 +394,14 @@ CC_NOINLINE static void ColoursScreen_UpdateAll(struct ColoursScreen* s) {
|
||||
static void ColoursScreen_TextChanged(struct LInput* w) {
|
||||
struct ColoursScreen* s = &ColoursScreen;
|
||||
int index = LScreen_IndexOf((struct LScreen*)s, w);
|
||||
BitmapCol* col;
|
||||
BitmapCol* color;
|
||||
cc_uint8 r, g, b;
|
||||
|
||||
if (index < 3) col = &Launcher_Theme.BackgroundColor;
|
||||
else if (index < 6) col = &Launcher_Theme.ButtonBorderColor;
|
||||
else if (index < 9) col = &Launcher_Theme.ButtonHighlightColor;
|
||||
else if (index < 12) col = &Launcher_Theme.ButtonForeColor;
|
||||
else col = &Launcher_Theme.ButtonForeActiveColor;
|
||||
if (index < 3) color = &Launcher_Theme.BackgroundColor;
|
||||
else if (index < 6) color = &Launcher_Theme.ButtonBorderColor;
|
||||
else if (index < 9) color = &Launcher_Theme.ButtonHighlightColor;
|
||||
else if (index < 12) color = &Launcher_Theme.ButtonForeColor;
|
||||
else color = &Launcher_Theme.ButtonForeActiveColor;
|
||||
|
||||
/* if index of G input, changes to index of R input */
|
||||
index = (index / 3) * 3;
|
||||
@ -409,27 +409,27 @@ static void ColoursScreen_TextChanged(struct LInput* w) {
|
||||
if (!Convert_ParseUInt8(&s->iptColours[index + 1].text, &g)) return;
|
||||
if (!Convert_ParseUInt8(&s->iptColours[index + 2].text, &b)) return;
|
||||
|
||||
*col = BitmapCol_Make(r, g, b, 255);
|
||||
*color = BitmapCol_Make(r, g, b, 255);
|
||||
Launcher_SaveTheme();
|
||||
Launcher_Redraw();
|
||||
}
|
||||
|
||||
static void ColoursScreen_AdjustSelected(struct LScreen* s, int delta) {
|
||||
struct LInput* w;
|
||||
int index, newCol;
|
||||
cc_uint8 col;
|
||||
int index, newVal;
|
||||
cc_uint8 value;
|
||||
|
||||
if (!s->selectedWidget) return;
|
||||
index = LScreen_IndexOf(s, s->selectedWidget);
|
||||
if (index >= 15) return;
|
||||
|
||||
w = (struct LInput*)s->selectedWidget;
|
||||
if (!Convert_ParseUInt8(&w->text, &col)) return;
|
||||
newCol = col + delta;
|
||||
if (!Convert_ParseUInt8(&w->text, &value)) return;
|
||||
newVal = value + delta;
|
||||
|
||||
Math_Clamp(newCol, 0, 255);
|
||||
Math_Clamp(newVal, 0, 255);
|
||||
w->text.length = 0;
|
||||
String_AppendInt(&w->text, newCol);
|
||||
String_AppendInt(&w->text, newVal);
|
||||
|
||||
if (w->caretPos >= w->text.length) w->caretPos = -1;
|
||||
ColoursScreen_TextChanged(w);
|
||||
|
Loading…
x
Reference in New Issue
Block a user