mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-16 14:50:17 +00:00
GOB: Move recolor() into class Surface
This commit is contained in:
parent
57b1b7ad24
commit
baec4d8778
@ -1492,12 +1492,6 @@ enum CharGenState {
|
||||
kCharGenStateFinish // Finished
|
||||
};
|
||||
|
||||
void OnceUpon::recolor(Surface &surface, uint8 from, uint8 to) {
|
||||
for (Pixel p = surface.get(); p.isValid(); ++p)
|
||||
if (p.get() == from)
|
||||
p.set(to);
|
||||
}
|
||||
|
||||
void OnceUpon::charGenSetup(uint stage) {
|
||||
Surface choix(320, 200, 1), elchoix(320, 200, 1), paperDoll(65, 137, 1);
|
||||
|
||||
@ -1518,12 +1512,14 @@ void OnceUpon::charGenSetup(uint stage) {
|
||||
_vm->_draw->_backSurface->blit(choix, 0, 38, 159, 121, 140, 54);
|
||||
|
||||
// Recolor the paper doll parts
|
||||
if (_colorHair != 0xFF)
|
||||
recolor(elchoix , 0x0C, _colorHair);
|
||||
if (_colorJacket != 0xFF)
|
||||
recolor(paperDoll, 0x0A, _colorJacket);
|
||||
if (_colorHair != 0xFF)
|
||||
elchoix.recolor(0x0C, _colorHair);
|
||||
|
||||
if (_colorJacket != 0xFF)
|
||||
paperDoll.recolor(0x0A, _colorJacket);
|
||||
|
||||
if (_colorTrousers != 0xFF)
|
||||
recolor(paperDoll, 0x09, _colorTrousers);
|
||||
paperDoll.recolor(0x09, _colorTrousers);
|
||||
|
||||
_vm->_draw->_backSurface->blit(paperDoll, 32, 51);
|
||||
|
||||
|
@ -314,7 +314,6 @@ private:
|
||||
void charGenSetup(uint stage);
|
||||
void charGenDrawName();
|
||||
|
||||
static void recolor(Surface &surface, uint8 from, uint8 to);
|
||||
static bool enterString(Common::String &name, int16 key, uint maxLength, const Font &font);
|
||||
|
||||
|
||||
|
@ -684,6 +684,12 @@ void Surface::shadeRect(uint16 left, uint16 top, uint16 right, uint16 bottom,
|
||||
|
||||
}
|
||||
|
||||
void Surface::recolor(uint8 from, uint8 to) {
|
||||
for (Pixel p = get(); p.isValid(); ++p)
|
||||
if (p.get() == from)
|
||||
p.set(to);
|
||||
}
|
||||
|
||||
void Surface::putPixel(uint16 x, uint16 y, uint32 color) {
|
||||
if ((x >= _width) || (y >= _height))
|
||||
return;
|
||||
|
@ -156,6 +156,8 @@ public:
|
||||
void shadeRect(uint16 left, uint16 top, uint16 right, uint16 bottom,
|
||||
uint32 color, uint8 strength);
|
||||
|
||||
void recolor(uint8 from, uint8 to);
|
||||
|
||||
void putPixel(uint16 x, uint16 y, uint32 color);
|
||||
void drawLine(uint16 x0, uint16 y0, uint16 x1, uint16 y1, uint32 color);
|
||||
void drawRect(uint16 left, uint16 top, uint16 right, uint16 bottom, uint32 color);
|
||||
|
Loading…
Reference in New Issue
Block a user