Rewrite fade in / fade out implementation

Before this change, fade in and fade out was implemented using a
16-steps dithering pattern.

Now fading uses alpha-blending. It behaves like the PC98 version, where
fading was done by palette animation.

This reduces `sizeof(AGS)` by 1.2MB.
This commit is contained in:
kichikuou
2021-11-20 17:09:17 +09:00
parent 8ee2e952f9
commit dc471399e5
6 changed files with 51 additions and 123 deletions
+2 -20
View File
@@ -1188,29 +1188,11 @@ void NACT_Sys2::cmd_y()
break;
case 40:
case 42:
if(ags->now_fade()) {
Uint32 dwStart = SDL_GetTicks();
for(int i = 0; i < 16; i++) {
ags->fade_in(i);
int32 ms = dwStart + param * 1000 / 60 * i - SDL_GetTicks();
if (ms > 0)
sys_sleep(ms);
}
ags->fade_end();
}
ags->fade_in(param * 16 * 1000 / 60);
break;
case 41:
case 43:
if(!ags->now_fade()) {
ags->fade_start();
Uint32 dwStart = SDL_GetTicks();
for(int i = 0; i < 16; i++) {
ags->fade_out(i, (cmd == 41) ? false : true);
int32 ms = dwStart + param * 1000 / 60 * i - SDL_GetTicks();
if (ms > 0)
sys_sleep(ms);
}
}
ags->fade_out(param * 16 * 1000 / 60, cmd == 43);
break;
case 221:
case 222: