diff --git a/src/soft/render.c b/src/soft/render.c
index 224d926f679b30e7ea15c2b331914f6a49f3cff2..74a3c0f898f2a776467ecd3c134161d82fca6e1f 100644 (file)
--- a/src/soft/render.c
+++ b/src/soft/render.c
#include "game.h"
#include "sound.h"
#include "music.h"
+#include "system.h"
// game
static vgaimg *scrnh[3]; // TITLEPIC INTERPIC ENDPIC
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);
+ Y_get_buffer(&buffer, &buf_w, &buf_h, &pitch);
+ 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);
+ Y_get_buffer(&buffer, &buf_w, &buf_h, &pitch);
+ 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();
}