srb2::Draw: relax type on colormap/colorize color argument

Lets you pass player_t.skincolor directly to the methods
without using static_cast<skincolornum_t>.

No, I don't want type safety on enums, this is SRB2.
This commit is contained in:
James R 2024-01-23 00:27:41 -08:00
parent 84641c896e
commit 45a9042650
2 changed files with 9 additions and 9 deletions

View file

@ -155,9 +155,9 @@ public:
Chain& clipy() { return clipy(y_, y_ + height_); } Chain& clipy() { return clipy(y_, y_ + height_); }
Chain& colormap(const UINT8* colormap); Chain& colormap(const UINT8* colormap);
Chain& colormap(skincolornum_t color); Chain& colormap(UINT16 color);
Chain& colormap(INT32 skin, skincolornum_t color); Chain& colormap(INT32 skin, UINT16 color);
Chain& colorize(skincolornum_t color); Chain& colorize(UINT16 color);
void text(const char* str) const { string(str, flags_, font_); } void text(const char* str) const { string(str, flags_, font_); }
void text(const std::string& str) const { text(str.c_str()); } void text(const std::string& str) const { text(str.c_str()); }

View file

@ -103,19 +103,19 @@ inline Draw::Chain& Draw::Chain::colormap(const UINT8* colormap)
return *this; return *this;
} }
inline Draw::Chain& Draw::Chain::colormap(skincolornum_t color) inline Draw::Chain& Draw::Chain::colormap(UINT16 color)
{ {
return colormap(R_GetTranslationColormap(TC_DEFAULT, color, GTC_CACHE)); return colormap(R_GetTranslationColormap(TC_DEFAULT, static_cast<skincolornum_t>(color), GTC_CACHE));
} }
inline Draw::Chain& Draw::Chain::colormap(INT32 skin, skincolornum_t color) inline Draw::Chain& Draw::Chain::colormap(INT32 skin, UINT16 color)
{ {
return colormap(R_GetTranslationColormap(skin, color, GTC_CACHE)); return colormap(R_GetTranslationColormap(skin, static_cast<skincolornum_t>(color), GTC_CACHE));
} }
inline Draw::Chain& Draw::Chain::colorize(skincolornum_t color) inline Draw::Chain& Draw::Chain::colorize(UINT16 color)
{ {
return colormap(R_GetTranslationColormap(TC_RAINBOW, color, GTC_CACHE)); return colormap(R_GetTranslationColormap(TC_RAINBOW, static_cast<skincolornum_t>(color), GTC_CACHE));
} }
}; // namespace srb2 }; // namespace srb2