diff --git a/src/gl/render.c b/src/gl/render.c
index bfd379c146f84a8f4d63e06a717806b6053638b6..f7180f9b0b8cbace0399c9827b5c6e42c0070e8d 100644 (file)
--- a/src/gl/render.c
+++ b/src/gl/render.c
#include "view.h"
#include "switch.h" // sw_secrets
#include "view.h"
#include "switch.h" // sw_secrets
+#include "cp866.h"
+
#ifdef __APPLE__
# include <OpenGL/gl.h>
#else
#ifdef __APPLE__
# include <OpenGL/gl.h>
#else
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
-#include <ctype.h>
#include <assert.h>
#define VGA_TRANSPARENT_COLOR 0
#include <assert.h>
#define VGA_TRANSPARENT_COLOR 0
/* Render Specific */
int SCRW = 320; // public
int SCRH = 200; // public
/* Render Specific */
int SCRW = 320; // public
int SCRH = 200; // public
-static int gamma;
-static int fullscreen;
static rgb playpal[256];
static byte bright[256];
static GLuint lastTexture;
static rgb playpal[256];
static byte bright[256];
static GLuint lastTexture;
static image *Z_get_char_image (image *img, int ch) {
image *p = NULL;
static image *Z_get_char_image (image *img, int ch) {
image *p = NULL;
+ ch = cp866_toupper(ch);
if (ch > 32 && ch < 160) {
p = &img[ch - '!'];
if (ch > 32 && ch < 160) {
p = &img[ch - '!'];
- if (p->n == NULL) {
- p = &img[toupper(ch) - '!'];
- }
}
return p;
}
}
return p;
}
case GM_SMALL: x = Z_get_small_string_width("%s", m->title); break;
default: assert(0);
}
case GM_SMALL: x = Z_get_small_string_width("%s", m->title); break;
default: assert(0);
}
+ y = 0;
for (i = 0; i < n; i++) {
get_entry_size(m, i, &xx, &yy);
x = max(x, xx);
for (i = 0; i < n; i++) {
get_entry_size(m, i, &xx, &yy);
x = max(x, xx);
Y_swap_buffers();
}
Y_swap_buffers();
}
-void R_alloc (void) {
+static void R_alloc (void) {
char s[10];
int i, j, n;
logo("R_alloc: load graphics\n");
char s[10];
int i, j, n;
logo("R_alloc: load graphics\n");
if (was == 0) {
ERR_failinit("Unable to set video mode\n");
}
if (was == 0) {
ERR_failinit("Unable to set video mode\n");
}
- } else {
- Y_get_videomode(&SCRW, &SCRH);
- root = R_cache_new();
- assert(root);
- R_alloc();
- R_reload_textures();
}
}
-}
-
-void R_toggle_fullscreen (void) {
- R_cache_free(root, 0);
- Y_set_fullscreen(!Y_get_fullscreen());
- fullscreen = Y_get_fullscreen();
Y_get_videomode(&SCRW, &SCRH);
root = R_cache_new();
assert(root);
Y_get_videomode(&SCRW, &SCRH);
root = R_cache_new();
assert(root);
R_reload_textures();
}
R_reload_textures();
}
+static int R_video_menu_handler (new_msg_t *msg, const new_menu_t *m, void *data) {
+ const videomode_t *v;
+ intptr_t i = (intptr_t)data;
+ static int w, h;
+ static int vmode;
+ static int fullscreen;
+ static char str[16];
+ switch (i) {
+ case -1:
+ switch (msg->type) {
+ case GM_ENTER:
+ Y_get_videomode(&w, &h);
+ fullscreen = Y_get_fullscreen();
+ v = Y_get_videomode_list_opengl(fullscreen);
+ vmode = 0;
+ while (vmode < v->n && v->modes[vmode].w != w && v->modes[vmode].h != h) {
+ vmode += 1;
+ }
+ if (vmode < v->n) {
+ w = v->modes[vmode].w;
+ h = v->modes[vmode].h;
+ }
+ snprintf(str, 16, "%ix%i", w, h);
+ return 1;
+ }
+ break;
+ case 0:
+ switch (msg->type) {
+ case GM_SELECT:
+ v = Y_get_videomode_list_opengl(fullscreen);
+ vmode = vmode + 1 >= v->n ? 0 : vmode + 1;
+ if (v->n > 0) {
+ w = v->modes[vmode].w;
+ h = v->modes[vmode].h;
+ } else {
+ Y_get_videomode(&w, &h);
+ }
+ snprintf(str, 16, "%ix%i", w, h);
+ return 1;
+ case GM_GETSTR:
+ return GM_init_str(msg, str, 16);
+ }
+ break;
+ case 1:
+ switch (msg->type) {
+ case GM_SELECT: fullscreen = !fullscreen; return 1;
+ case GM_GETSTR: return GM_init_str(msg, fullscreen ? "Yes" : "No", 3);
+ }
+ break;
+ case 2:
+ switch (msg->type) {
+ case GM_SELECT: R_set_videomode(w, h, fullscreen); return 1;
+ }
+ }
+ return 0;
+}
+
+static const new_menu_t video_menu = {
+ GM_BIG, "Video", (void*)-1, &R_video_menu_handler,
+ {
+ { GM_BUTTON, "Videomode: ", (void*)0, &R_video_menu_handler, NULL },
+ { GM_BUTTON, "Fullscreen: ", (void*)1, &R_video_menu_handler, NULL },
+ { GM_BUTTON, "Apply", (void*)2, &R_video_menu_handler, NULL },
+ { 0, NULL, NULL, NULL, NULL } // end
+ }
+};
+
+const new_menu_t *R_menu (void) {
+ return &video_menu;
+}
+
void R_init (void) {
logo("R_init: intialize opengl render\n");
R_init_playpal();
void R_init (void) {
logo("R_init: intialize opengl render\n");
R_init_playpal();
- R_set_videomode(SCRW, SCRH, fullscreen);
+ R_set_videomode(SCRW, SCRH, 0);
}
void R_done (void) {
}
void R_done (void) {
root = NULL;
}
root = NULL;
}
-void R_setgamma (int g) {
- gamma = g < 0 ? 0 : (g > 4 ? 4 : g);
-}
-
-int R_getgamma (void) {
- return gamma;
-}
-
void R_get_name (int n, char s[8]) {
assert(n >= 0 && n < 256);
if (walp[n].res == -1) {
void R_get_name (int n, char s[8]) {
assert(n >= 0 && n < 256);
if (walp[n].res == -1) {