* Move the non-mapping drawFill out of the source code function and into the Lua interface.
* Add a drawFill fallback for COLORMAP too. * Correct a few index mishaps.
This commit is contained in:
parent
c1b48ea79f
commit
da3f8ceb8d
|
@ -683,15 +683,22 @@ static int libd_fadeScreen(lua_State *L)
|
||||||
{
|
{
|
||||||
UINT16 color = luaL_checkinteger(L, 1);
|
UINT16 color = luaL_checkinteger(L, 1);
|
||||||
UINT8 strength = luaL_checkinteger(L, 2);
|
UINT8 strength = luaL_checkinteger(L, 2);
|
||||||
const UINT8 maxstrength = ((color & 0xFF00) ? 31 : 9);
|
const UINT8 maxstrength = ((color & 0xFF00) ? 32 : 10);
|
||||||
|
|
||||||
HUDONLY
|
HUDONLY
|
||||||
|
|
||||||
if (!strength)
|
if (!strength)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (strength > maxstrength)
|
if (strength > maxstrength)
|
||||||
return luaL_error(L, "%s fade strength %d out of range (0 - %d)", ((color & 0xFF00) ? "COLORMAP" : "TRANSMAP"), strength, maxstrength);
|
return luaL_error(L, "%s fade strength %d out of range (0 - %d)", ((color & 0xFF00) ? "COLORMAP" : "TRANSMAP"), strength, maxstrength);
|
||||||
|
|
||||||
|
if (strength == maxstrength) // Allow as a shortcut for drawfill...
|
||||||
|
{
|
||||||
|
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, ((color & 0xFF00) ? 31 : color));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
V_DrawFadeScreen(color, strength);
|
V_DrawFadeScreen(color, strength);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1321,7 +1321,7 @@ void V_DrawPatchFill(patch_t *pat)
|
||||||
//
|
//
|
||||||
// Fade all the screen buffer, so that the menu is more readable,
|
// Fade all the screen buffer, so that the menu is more readable,
|
||||||
// especially now that we use the small hufont in the menus...
|
// especially now that we use the small hufont in the menus...
|
||||||
// If color is 0x00 to 0xFF, draw transtable (strength range 0-10).
|
// If color is 0x00 to 0xFF, draw transtable (strength range 0-9).
|
||||||
// Else, use COLORMAP lump (strength range 0-31).
|
// Else, use COLORMAP lump (strength range 0-31).
|
||||||
// IF YOU ARE NOT CAREFUL, THIS CAN AND WILL CRASH!
|
// IF YOU ARE NOT CAREFUL, THIS CAN AND WILL CRASH!
|
||||||
// I have kept the safety checks out of this function;
|
// I have kept the safety checks out of this function;
|
||||||
|
@ -1332,12 +1332,6 @@ void V_DrawFadeScreen(UINT16 color, UINT8 strength)
|
||||||
if (!strength)
|
if (!strength)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(color & 0xFF00) && strength == 10)
|
|
||||||
{
|
|
||||||
V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, color);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
if (rendermode != render_soft && rendermode != render_none)
|
if (rendermode != render_soft && rendermode != render_none)
|
||||||
{
|
{
|
||||||
|
@ -1349,7 +1343,7 @@ void V_DrawFadeScreen(UINT16 color, UINT8 strength)
|
||||||
{
|
{
|
||||||
const UINT8 *fadetable = ((color & 0xFF00) // Color is not palette index?
|
const UINT8 *fadetable = ((color & 0xFF00) // Color is not palette index?
|
||||||
? ((UINT8 *)colormaps + strength*256) // Do COLORMAP fade.
|
? ((UINT8 *)colormaps + strength*256) // Do COLORMAP fade.
|
||||||
: ((UINT8 *)transtables + ((10-strength)<<FF_TRANSSHIFT) + color*256)); // Else, do TRANSMAP** fade.
|
: ((UINT8 *)transtables + ((9-strength)<<FF_TRANSSHIFT) + color*256)); // Else, do TRANSMAP** fade.
|
||||||
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
|
const UINT8 *deststop = screens[0] + vid.rowbytes * vid.height;
|
||||||
UINT8 *buf = screens[0];
|
UINT8 *buf = screens[0];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue