diff --git a/src/soft/render.c b/src/soft/render.c
index e2cb9bf660cc9a4167a33df9168cba13b8b6383b..6c804a9a0d5f1832085ba0c9e68119f5cd5f40f3 100644 (file)
--- a/src/soft/render.c
+++ b/src/soft/render.c
+/* Copyright (C) 1996-1997 Aleksey Volynskov
+ * Copyright (C) 2011 Rambo
+ * Copyright (C) 2020 SovietPony
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License ONLY.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
#include <string.h>
#include <stdarg.h>
#include <stdlib.h> // abs()
#include "music.h"
#include "system.h"
-#include "cp866.h"
+#include "common/cp866.h"
// game
static vgaimg *scrnh[3]; // TITLEPIC INTERPIC ENDPIC
/* --- misc --- */
static void *Z_getspr (char n[4], int s, int d, char *dir) {
- int h = F_getsprid(n, s, d);
- if (dir) {
- *dir = (h & 0x8000) ? 1 : 0;
- }
+ int h = F_getsprid(n, s, d, dir);
return V_getvgaimg(h);
}
int type = 0;
menu_msg_t msg;
msg.type = GM_GETENTRY;
- assert(GM_send(m, i, &msg));
- type = msg.integer.i;
- switch (type) {
- case GM_BUTTON:
- case GM_SCROLLER:
- case GM_TEXTFIELD:
- case GM_TEXTFIELD_BUTTON:
- msg.type = GM_GETCAPTION;
- if (GM_send(m, i, &msg)) {
- x = Z_get_big_string_width("%.*s", msg.string.maxlen, msg.string.s);
- }
- break;
- case GM_SMALL_BUTTON:
- msg.type = GM_GETCAPTION;
- if (GM_send(m, i, &msg)) {
- x = Z_get_small_string_width("%.*s", msg.string.maxlen, msg.string.s);
- }
- break;
- default:
- assert(0);
- }
- switch (type) {
- case GM_BUTTON:
- msg.type = GM_GETSTR;
- if (GM_send(m, i, &msg)) {
- x += Z_get_big_string_width("%.*s", msg.string.maxlen, msg.string.s);
- }
- y = 16;
- break;
- case GM_SMALL_BUTTON:
- msg.type = GM_GETSTR;
- if (GM_send(m, i, &msg)) {
- x += Z_get_big_string_width("%.*s", msg.string.maxlen, msg.string.s);
- }
- y = 12;
- break;
- case GM_SCROLLER:
- x += (SCROLLER_MIDDLE + 2) * 8;
- y = 16;
- break;
- case GM_TEXTFIELD:
- case GM_TEXTFIELD_BUTTON:
- msg.type = GM_GETSTR;
- if (GM_send(m, i, &msg)) {
- x += (msg.string.maxlen + 2) * 8;
- } else {
- x += (TEXTFIELD_MIDDLE + 2) * 8;
- }
- y = 16;
- break;
- default:
- assert(0);
+ if (GM_send(m, i, &msg)) {
+ type = msg.integer.i;
+ switch (type) {
+ case GM_BUTTON:
+ case GM_SCROLLER:
+ case GM_TEXTFIELD:
+ case GM_TEXTFIELD_BUTTON:
+ msg.type = GM_GETCAPTION;
+ if (GM_send(m, i, &msg)) {
+ x = Z_get_big_string_width("%.*s", msg.string.maxlen, msg.string.s);
+ }
+ break;
+ case GM_SMALL_BUTTON:
+ msg.type = GM_GETCAPTION;
+ if (GM_send(m, i, &msg)) {
+ x = Z_get_small_string_width("%.*s", msg.string.maxlen, msg.string.s);
+ }
+ break;
+ default:
+ assert(0);
+ }
+ switch (type) {
+ case GM_BUTTON:
+ msg.type = GM_GETSTR;
+ if (GM_send(m, i, &msg)) {
+ x += Z_get_big_string_width("%.*s", msg.string.maxlen, msg.string.s);
+ }
+ y = 16;
+ break;
+ case GM_SMALL_BUTTON:
+ msg.type = GM_GETSTR;
+ if (GM_send(m, i, &msg)) {
+ x += Z_get_big_string_width("%.*s", msg.string.maxlen, msg.string.s);
+ }
+ y = 12;
+ break;
+ case GM_SCROLLER:
+ x += (SCROLLER_MIDDLE + 2) * 8;
+ y = 16;
+ break;
+ case GM_TEXTFIELD:
+ case GM_TEXTFIELD_BUTTON:
+ msg.type = GM_GETSTR;
+ if (GM_send(m, i, &msg)) {
+ x += (msg.string.maxlen + 2) * 8;
+ } else {
+ x += (TEXTFIELD_MIDDLE + 2) * 8;
+ }
+ y = 16;
+ break;
+ default:
+ assert(0);
+ }
}
*w = x;
*h = y;
void R_alloc (void) {
int i, j, n;
char s[10];
- logo("R_alloc: загрузка графики\n");
+ logo("R_alloc: load graphics\n");
// game
scrnh[0] = V_loadvgaimg("TITLEPIC");
scrnh[1] = V_loadvgaimg("INTERPIC");
}
static short getani (char n[8]) {
- if (strncasecmp(n, "WALL22_1", 8) == 0) {
+ if (cp866_strncasecmp(n, "WALL22_1", 8) == 0) {
return 1;
- } else if (strncasecmp(n, "WALL58_1", 8) == 0) {
+ } else if (cp866_strncasecmp(n, "WALL58_1", 8) == 0) {
return 2;
- } else if (strncasecmp(n, "W73A_1", 8) == 0) {
+ } else if (cp866_strncasecmp(n, "W73A_1", 8) == 0) {
return 3;
- } else if (strncasecmp(n, "RP2_1", 8) == 0) {
+ } else if (cp866_strncasecmp(n, "RP2_1", 8) == 0) {
return 4;
} else {
return 0;
max_textures = 1;
}
-void R_load (char s[8], int f) {
+void R_load (char s[8]) {
assert(max_textures < 256);
if (!s[0]) {
walh[max_textures] = -1;
walp[max_textures] = NULL;
} else {
- if (strncasecmp(s, "_WATER_", 7) == 0) {
+ if (cp866_strncasecmp(s, "_WATER_", 7) == 0) {
walh[max_textures] = -2;
walp[max_textures] = (void*)((intptr_t)s[7] - '0' + 1);
} else {
walh[max_textures] = F_getresid(s);
walp[max_textures] = V_getvgaimg(walh[max_textures]);
- if (f) {
- walh[max_textures] |= 0x8000;
- }
if (s[0] == 'S' && s[1] == 'W' && s[4] == '_') {
walswp[max_textures] = 0;
}
if (walswp[i] == 0) {
R_get_name(i, s);
s[5] ^= 1;
- g = F_getresid(s) | (walh[i] & 0x8000);
+ g = F_getresid(s);
k = 1;
while (k < 256 && walh[k] != g) {
k += 1;
j += 1;
walh[k] = g;
walp[k] = V_getvgaimg(g);
- walf[k] = g & 0x8000 ? 1 : 0;
+ walf[k] = walf[i];
}
walswp[i] = k;
walswp[k] = i;
@@ -1571,12 +1583,9 @@ static int video_menu_handler (menu_msg_t *msg, const menu_t *m, void *data, int
return simple_menu_handler(msg, i, __NUM__, &sm, &cur);
}
-static const menu_t video_menu = {
- NULL, &video_menu_handler
-};
-
const menu_t *R_menu (void) {
- return &video_menu;
+ static const menu_t m = { video_menu_handler };
+ return &m;
}
const cfg_t *R_args (void) {