mirror of
https://github.com/XProger/OpenLara.git
synced 2025-02-19 21:14:37 +01:00
fix colors
This commit is contained in:
parent
d27f9de1fd
commit
2a6d533b03
26
src/utils.h
26
src/utils.h
@ -1448,17 +1448,28 @@ struct Color24 { // RGB888
|
|||||||
};
|
};
|
||||||
|
|
||||||
union Color16 { // RGBA5551
|
union Color16 { // RGBA5551
|
||||||
struct { uint16 r:5, g:5, b:5, a:1; };
|
struct { uint16 b:5, g:5, r:5, a:1; };
|
||||||
uint16 value;
|
uint16 value;
|
||||||
|
|
||||||
Color16() {}
|
Color16() {}
|
||||||
Color16(uint16 value) : value(value) {}
|
Color16(uint16 value) : value(value) {}
|
||||||
|
|
||||||
Color32 getBGR() const { return Color32((b << 3) | (b >> 2), (g << 3) | (g >> 2), (r << 3) | (r >> 2), 255); }
|
|
||||||
operator Color24() const { return Color24((r << 3) | (r >> 2), (g << 3) | (g >> 2), (b << 3) | (b >> 2)); }
|
operator Color24() const { return Color24((r << 3) | (r >> 2), (g << 3) | (g >> 2), (b << 3) | (b >> 2)); }
|
||||||
operator Color32() const { return Color32((r << 3) | (r >> 2), (g << 3) | (g >> 2), (b << 3) | (b >> 2), -a); }
|
operator Color32() const { return Color32((r << 3) | (r >> 2), (g << 3) | (g >> 2), (b << 3) | (b >> 2), -a); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
union ColorCLUT { // RGBA5551
|
||||||
|
struct { uint16 r:5, g:5, b:5, a:1; };
|
||||||
|
uint16 value;
|
||||||
|
|
||||||
|
ColorCLUT() {}
|
||||||
|
ColorCLUT(uint16 value) : value(value) {}
|
||||||
|
|
||||||
|
operator Color24() const { return Color24((r << 3) | (r >> 2), (g << 3) | (g >> 2), (b << 3) | (b >> 2)); }
|
||||||
|
operator Color32() const { return Color32((r << 3) | (r >> 2), (g << 3) | (g >> 2), (b << 3) | (b >> 2), -a); }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct ColorIndex4 {
|
struct ColorIndex4 {
|
||||||
uint8 a:4, b:4;
|
uint8 a:4, b:4;
|
||||||
};
|
};
|
||||||
@ -1485,6 +1496,7 @@ union AtlasColor {
|
|||||||
AtlasColor(const Color16 &value) : a(value.a), b(value.b), g(value.g), r(value.r) {}
|
AtlasColor(const Color16 &value) : a(value.a), b(value.b), g(value.g), r(value.r) {}
|
||||||
AtlasColor(const Color24 &value) : a(1), b(value.b >> 3), g(value.g >> 3), r(value.r >> 3) {}
|
AtlasColor(const Color24 &value) : a(1), b(value.b >> 3), g(value.g >> 3), r(value.r >> 3) {}
|
||||||
AtlasColor(const Color32 &value) : a(value.a ? 1 : 0), b(value.b >> 3), g(value.g >> 3), r(value.r >> 3) {}
|
AtlasColor(const Color32 &value) : a(value.a ? 1 : 0), b(value.b >> 3), g(value.g >> 3), r(value.r >> 3) {}
|
||||||
|
AtlasColor(const ColorCLUT &value) : a(value.a), b(value.b), g(value.g), r(value.r) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ATLAS_FORMAT FMT_RGBA16
|
#define ATLAS_FORMAT FMT_RGBA16
|
||||||
@ -1502,7 +1514,7 @@ struct Tile32 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct CLUT {
|
struct CLUT {
|
||||||
Color16 color[16];
|
ColorCLUT color[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace String {
|
namespace String {
|
||||||
@ -2123,6 +2135,14 @@ struct Array {
|
|||||||
items = NULL;
|
items = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int find(const T &item) {
|
||||||
|
for (int i = 0; i < length; i++) {
|
||||||
|
if (items[i] == item)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
void sort() {
|
void sort() {
|
||||||
::sort(items, length);
|
::sort(items, length);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user