X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fsoft%2Frender.c;h=bda872709396df868677befde09a226678e5b2b4;hb=ce966b1616662fdba1adac371205cd93ee741588;hp=2036b083631be16bf6ea778ffd75718b039d7851;hpb=82b3e1cc221312a5bd549d1f2d14bb682a311751;p=flatwaifu.git diff --git a/src/soft/render.c b/src/soft/render.c index 2036b08..bda8727 100644 --- a/src/soft/render.c +++ b/src/soft/render.c @@ -22,6 +22,7 @@ #include "game.h" #include "sound.h" #include "music.h" +#include "system.h" // game static vgaimg *scrnh[3]; // TITLEPIC INTERPIC ENDPIC @@ -1342,37 +1343,56 @@ void R_setgamma(int g) { std_pal[t][1]=gamcor[gammaa][main_pal[t][1]]; std_pal[t][2]=gamcor[gammaa][main_pal[t][2]]; } - VP_setall(std_pal); + Y_set_vga_palette(std_pal); } int R_getgamma (void) { return gammaa; } +void R_set_videomode (int w, int h, int fullscreen) { + assert(w > 0); + assert(h > 0); + int was = Y_videomode_setted(); + int res = Y_set_videomode_software(w, h, fullscreen); + if (res == 0) { + if (was == 0) { + ERR_failinit("Unable to set video mode"); + } + } else { + Y_get_videomode(&SCRW, &SCRH); + V_update_buffer(); + R_setgamma(gammaa); + } +} + void R_toggle_fullscreen (void) { - fullscreen = !fullscreen; - V_toggle(); + Y_set_fullscreen(!Y_get_fullscreen()); + fullscreen = Y_get_fullscreen(); + Y_get_videomode(&SCRW, &SCRH); + V_update_buffer(); + R_setgamma(gammaa); } void R_init () { int i; + logo("R_init: initialize software render\n"); F_loadres(F_getresid("PLAYPAL"), main_pal, 0, 768); for (i = 0; i < 256; ++i) { bright[i] = ((int) main_pal[i][0] + main_pal[i][1] + main_pal[i][2]) * 8 / (63 * 3); } F_loadres(F_getresid("MIXMAP"), mixmap, 0, 0x10000); F_loadres(F_getresid("COLORMAP"), clrmap, 0, 256*12); - logo("V_init: настройка видео\n"); - if (V_init() != 0) { - ERR_failinit("Не могу установить видеорежим VGA"); - } - R_setgamma(gammaa); + R_set_videomode(SCRW, SCRH, fullscreen); V_setrect(0, SCRW, 0, SCRH); -// V_setscr(scrbuf); V_clr(0, SCRW, 0, SCRH, 0); R_alloc(); } void R_done (void) { - V_done(); + buffer = NULL; + buf_w = 0; + buf_h = 0; + pitch = 0; + Y_unset_videomode(); }