… | |
… | |
81 | #define expect_false(expr) expect ((expr) != 0, 0) |
81 | #define expect_false(expr) expect ((expr) != 0, 0) |
82 | #define expect_true(expr) expect ((expr) != 0, 1) |
82 | #define expect_true(expr) expect ((expr) != 0, 1) |
83 | |
83 | |
84 | #define OBJ_STR "\xef\xbf\xbc" /* U+FFFC, object replacement character */ |
84 | #define OBJ_STR "\xef\xbf\xbc" /* U+FFFC, object replacement character */ |
85 | |
85 | |
86 | #define FOW_DARKNESS 16 |
86 | #define FOW_DARKNESS 64 |
|
|
87 | #define DARKNESS_ADJUST(n) ((29 * (int)(n)) >> 5) /* times 0.9 */ |
87 | |
88 | |
88 | #define MAP_EXTEND_X 32 |
89 | #define MAP_EXTEND_X 32 |
89 | #define MAP_EXTEND_Y 512 |
90 | #define MAP_EXTEND_Y 512 |
90 | |
91 | |
91 | #define MIN_FONT_HEIGHT 10 |
92 | #define MIN_FONT_HEIGHT 10 |
92 | |
93 | |
93 | /* mask out modifiers we are not interested in */ |
94 | /* mask out modifiers we are not interested in */ |
94 | #define MOD_MASK (KMOD_CTRL | KMOD_SHIFT | KMOD_ALT | KMOD_META) |
95 | #define MOD_MASK (KMOD_CTRL | KMOD_SHIFT | KMOD_ALT | KMOD_META) |
95 | |
96 | |
96 | #define KMOD_LRAM 0x10000 // our extension |
97 | #define KMOD_LRAM 0x10000 // our extension |
|
|
98 | |
|
|
99 | #define TEXID_SPEECH 1 |
|
|
100 | #define TEXID_NOFACE 2 |
|
|
101 | #define TEXID_HIDDEN 3 |
97 | |
102 | |
98 | static AV *texture_av; |
103 | static AV *texture_av; |
99 | |
104 | |
100 | static struct |
105 | static struct |
101 | { |
106 | { |
… | |
… | |
1654 | glDisable (GL_ALPHA_TEST); |
1659 | glDisable (GL_ALPHA_TEST); |
1655 | glDisable (GL_BLEND); |
1660 | glDisable (GL_BLEND); |
1656 | } |
1661 | } |
1657 | } |
1662 | } |
1658 | |
1663 | |
|
|
1664 | void |
|
|
1665 | draw_fow_texture (float intensity, int name1, float s1, float t1, float w1, float h1, float blend = 0.f, float dx = 0.f, float dy = 0.f, int name2 = 0, float s2 = 0.f, float t2 = 0.f, float w2 = 0.f, float h2 = 0.f) |
|
|
1666 | PROTOTYPE: @ |
|
|
1667 | CODE: |
|
|
1668 | { |
|
|
1669 | glEnable (GL_TEXTURE_2D); |
|
|
1670 | glEnable (GL_BLEND); |
|
|
1671 | glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA); |
|
|
1672 | glBindTexture (GL_TEXTURE_2D, name1); |
|
|
1673 | |
|
|
1674 | glColor3f (intensity, intensity, intensity); |
|
|
1675 | glPushMatrix (); |
|
|
1676 | glScalef (1./3, 1./3, 1.); |
|
|
1677 | |
|
|
1678 | if (blend > 0.f) |
|
|
1679 | { |
|
|
1680 | float S2, T2; /* 0. 0. for texture 2 */ |
|
|
1681 | float w = w1 > w2 ? w1 : w2; |
|
|
1682 | float h = h1 > h2 ? h1 : h2; |
|
|
1683 | GLfloat env_color[4] = { 0., 0., 0., blend }; |
|
|
1684 | |
|
|
1685 | /* interpolate the two shadow textures */ |
|
|
1686 | /* stage 0 == rgb(glcolor) + alpha(t0) */ |
|
|
1687 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); |
|
|
1688 | |
|
|
1689 | /* stage 1 == rgb(glcolor) + alpha(interpolate t0, t1, texenv) */ |
|
|
1690 | gl.ActiveTexture (GL_TEXTURE1); |
|
|
1691 | glEnable (GL_TEXTURE_2D); |
|
|
1692 | glBindTexture (GL_TEXTURE_2D, name2); |
|
|
1693 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); |
|
|
1694 | |
|
|
1695 | /* rgb == rgb(glcolor) */ |
|
|
1696 | glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE); |
|
|
1697 | glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_RGB, GL_CONSTANT); |
|
|
1698 | glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); |
|
|
1699 | |
|
|
1700 | /* alpha = interpolate t0, t1 by env_alpha */ |
|
|
1701 | glTexEnvfv (GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, env_color); |
|
|
1702 | |
|
|
1703 | glTexEnvi (GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_INTERPOLATE); |
|
|
1704 | glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE0_ALPHA, GL_TEXTURE); |
|
|
1705 | glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); |
|
|
1706 | |
|
|
1707 | glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE1_ALPHA, GL_PREVIOUS); |
|
|
1708 | glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); |
|
|
1709 | |
|
|
1710 | glTexEnvi (GL_TEXTURE_ENV, GL_SOURCE2_ALPHA, GL_CONSTANT); |
|
|
1711 | glTexEnvi (GL_TEXTURE_ENV, GL_OPERAND2_ALPHA, GL_SRC_ALPHA); |
|
|
1712 | |
|
|
1713 | s1 *= w / w1; |
|
|
1714 | t1 *= h / h1; |
|
|
1715 | |
|
|
1716 | dx *= -3.f / w2; |
|
|
1717 | dy *= -3.f / h2; |
|
|
1718 | dx *= w / w2; |
|
|
1719 | dy *= h / h2; |
|
|
1720 | |
|
|
1721 | s2 *= w / w2; |
|
|
1722 | t2 *= h / h2; |
|
|
1723 | |
|
|
1724 | glBegin (GL_QUADS); |
|
|
1725 | gl.MultiTexCoord2f (GL_TEXTURE0, 0, 0); gl.MultiTexCoord2f (GL_TEXTURE1, dx , dy ); glVertex2f ( 0, 0); |
|
|
1726 | gl.MultiTexCoord2f (GL_TEXTURE0, 0, t1); gl.MultiTexCoord2f (GL_TEXTURE1, dx , dy + t2); glVertex2f ( 0, h1); |
|
|
1727 | gl.MultiTexCoord2f (GL_TEXTURE0, s1, t1); gl.MultiTexCoord2f (GL_TEXTURE1, dx + s2, dy + t2); glVertex2f (w1, h1); |
|
|
1728 | gl.MultiTexCoord2f (GL_TEXTURE0, s1, 0); gl.MultiTexCoord2f (GL_TEXTURE1, dx + s2, dy ); glVertex2f (w1, 0); |
|
|
1729 | glEnd (); |
|
|
1730 | |
|
|
1731 | glDisable (GL_TEXTURE_2D); |
|
|
1732 | gl.ActiveTexture (GL_TEXTURE0); |
|
|
1733 | } |
|
|
1734 | else |
|
|
1735 | { |
|
|
1736 | /* simple blending of one texture, also opengl <1.3 path */ |
|
|
1737 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); |
|
|
1738 | |
|
|
1739 | glBegin (GL_QUADS); |
|
|
1740 | glTexCoord2f ( 0, 0); glVertex2f ( 0, 0); |
|
|
1741 | glTexCoord2f ( 0, t1); glVertex2f ( 0, h1); |
|
|
1742 | glTexCoord2f (s1, t1); glVertex2f (w1, h1); |
|
|
1743 | glTexCoord2f (s1, 0); glVertex2f (w1, 0); |
|
|
1744 | glEnd (); |
|
|
1745 | } |
|
|
1746 | |
|
|
1747 | glPopMatrix (); |
|
|
1748 | |
|
|
1749 | glDisable (GL_TEXTURE_2D); |
|
|
1750 | glDisable (GL_BLEND); |
|
|
1751 | } |
|
|
1752 | |
1659 | IV texture_valid_2d (GLint internalformat, GLsizei w, GLsizei h, GLenum format, GLenum type) |
1753 | IV texture_valid_2d (GLint internalformat, GLsizei w, GLsizei h, GLenum format, GLenum type) |
1660 | CODE: |
1754 | CODE: |
1661 | { |
1755 | { |
1662 | GLint width; |
1756 | GLint width; |
1663 | glTexImage2D (GL_PROXY_TEXTURE_2D, 0, internalformat, w, h, 0, format, type, 0); |
1757 | glTexImage2D (GL_PROXY_TEXTURE_2D, 0, internalformat, w, h, 0, format, type, 0); |
… | |
… | |
2005 | uint32_t smooth_level[256 / 32]; // one bit for every possible smooth level |
2099 | uint32_t smooth_level[256 / 32]; // one bit for every possible smooth level |
2006 | static uint8_t smooth_max[256][256]; // egad, fast and wasteful on memory (64k) |
2100 | static uint8_t smooth_max[256][256]; // egad, fast and wasteful on memory (64k) |
2007 | smooth_key skey; |
2101 | smooth_key skey; |
2008 | int pl_x, pl_y; |
2102 | int pl_x, pl_y; |
2009 | maptex pl_tex; |
2103 | maptex pl_tex; |
2010 | rc_t *rc = rc_alloc (); |
2104 | rc_t *rc = rc_alloc (); |
|
|
2105 | rc_t *rc_ov = rc_alloc (); |
2011 | rc_key_t key; |
2106 | rc_key_t key; |
2012 | rc_array_t *arr; |
2107 | rc_array_t *arr, *arr_hidden; |
2013 | |
2108 | |
2014 | pl_tex.name = 0; |
2109 | pl_tex.name = 0; |
2015 | |
2110 | |
2016 | // thats current max. sorry. |
2111 | // that's current max. sorry. |
2017 | if (sw > 255) sw = 255; |
2112 | if (sw > 255) sw = 255; |
2018 | if (sh > 255) sh = 255; |
2113 | if (sh > 255) sh = 255; |
2019 | |
2114 | |
2020 | // clear key, in case of extra padding |
2115 | // clear key, in case of extra padding |
2021 | memset (&skey, 0, sizeof (skey)); |
2116 | memset (&skey, 0, sizeof (skey)); |
… | |
… | |
2054 | } |
2149 | } |
2055 | |
2150 | |
2056 | glEnable (GL_BLEND); |
2151 | glEnable (GL_BLEND); |
2057 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
2152 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
2058 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); |
2153 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); |
|
|
2154 | |
|
|
2155 | key.texname = self->tex [TEXID_HIDDEN].name; |
|
|
2156 | arr_hidden = rc_array (rc_ov, &key); |
2059 | |
2157 | |
2060 | for (z = 0; z <= 2; z++) |
2158 | for (z = 0; z <= 2; z++) |
2061 | { |
2159 | { |
2062 | memset (smooth_level, 0, sizeof (smooth_level)); |
2160 | memset (smooth_level, 0, sizeof (smooth_level)); |
2063 | key.texname = -1; |
2161 | key.texname = -1; |
… | |
… | |
2074 | tileid tile = cell->tile [z]; |
2172 | tileid tile = cell->tile [z]; |
2075 | |
2173 | |
2076 | if (tile) |
2174 | if (tile) |
2077 | { |
2175 | { |
2078 | maptex tex = self->tex [tile]; |
2176 | maptex tex = self->tex [tile]; |
2079 | int px = (x + 1) * T - tex.w; |
2177 | int px, py; |
2080 | int py = (y + 1) * T - tex.h; |
|
|
2081 | |
2178 | |
2082 | if (key.texname != tex.name) |
2179 | if (key.texname != tex.name) |
2083 | { |
2180 | { |
2084 | self->tex [tile].unused = 0; |
2181 | self->tex [tile].unused = 0; |
2085 | |
2182 | |
2086 | if (!tex.name) |
2183 | if (!tex.name) |
2087 | tex = self->tex [2]; /* missing, replace by noface */ |
2184 | tex = self->tex [TEXID_NOFACE]; /* missing, replace by noface */ |
2088 | |
2185 | |
2089 | key.texname = tex.name; |
2186 | key.texname = tex.name; |
2090 | arr = rc_array (rc, &key); |
2187 | arr = rc_array (rc, &key); |
2091 | } |
2188 | } |
|
|
2189 | |
|
|
2190 | px = (x + 1) * T - tex.w; |
|
|
2191 | py = (y + 1) * T - tex.h; |
2092 | |
2192 | |
2093 | if (expect_false (cell->player == player) && expect_false (z == 2)) |
2193 | if (expect_false (cell->player == player) && expect_false (z == 2)) |
2094 | { |
2194 | { |
2095 | pl_x = px; |
2195 | pl_x = px; |
2096 | pl_y = py; |
2196 | pl_y = py; |
… | |
… | |
2101 | rc_t2f_v3f (arr, 0 , 0 , px , py , 0); |
2201 | rc_t2f_v3f (arr, 0 , 0 , px , py , 0); |
2102 | rc_t2f_v3f (arr, 0 , tex.t, px , py + tex.h, 0); |
2202 | rc_t2f_v3f (arr, 0 , tex.t, px , py + tex.h, 0); |
2103 | rc_t2f_v3f (arr, tex.s, tex.t, px + tex.w, py + tex.h, 0); |
2203 | rc_t2f_v3f (arr, tex.s, tex.t, px + tex.w, py + tex.h, 0); |
2104 | rc_t2f_v3f (arr, tex.s, 0 , px + tex.w, py , 0); |
2204 | rc_t2f_v3f (arr, tex.s, 0 , px + tex.w, py , 0); |
2105 | |
2205 | |
2106 | if (expect_false (cell->flags) && expect_false (z == 2)) |
|
|
2107 | { |
|
|
2108 | /* this is a workaround to make speech bubbles drawn |
|
|
2109 | * for example above walls, work. */ |
|
|
2110 | rc_draw (rc); |
|
|
2111 | rc_clear (rc); |
|
|
2112 | key.texname = -1; |
|
|
2113 | |
|
|
2114 | // overlays such as the speech bubble, probably more to come |
|
|
2115 | if (cell->flags & 1) |
|
|
2116 | { |
|
|
2117 | maptex tex = self->tex [1]; |
|
|
2118 | int px = x * T + T * 2 / 32; |
|
|
2119 | int py = y * T - T * 6 / 32; |
|
|
2120 | |
|
|
2121 | if (tex.name) |
|
|
2122 | { |
|
|
2123 | if (key.texname != tex.name) |
|
|
2124 | { |
|
|
2125 | key.texname = tex.name; |
|
|
2126 | arr = rc_array (rc, &key); |
|
|
2127 | } |
|
|
2128 | |
|
|
2129 | rc_t2f_v3f (arr, 0 , 0 , px , py , 0); |
|
|
2130 | rc_t2f_v3f (arr, 0 , tex.t, px , py + T, 0); |
|
|
2131 | rc_t2f_v3f (arr, tex.s, tex.t, px + T, py + T, 0); |
|
|
2132 | rc_t2f_v3f (arr, tex.s, 0 , px + T, py , 0); |
|
|
2133 | } |
|
|
2134 | } |
|
|
2135 | } |
|
|
2136 | |
|
|
2137 | // update smooth hash |
2206 | // update smooth hash |
2138 | if (tex.smoothtile) |
2207 | if (tex.smoothtile) |
2139 | { |
2208 | { |
2140 | skey.tile = tex.smoothtile; |
2209 | skey.tile = tex.smoothtile; |
2141 | skey.level = tex.smoothlevel; |
2210 | skey.level = tex.smoothlevel; |
… | |
… | |
2169 | // corners |
2238 | // corners |
2170 | skey.x = x + 2; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0100); |
2239 | skey.x = x + 2; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0100); |
2171 | skey.x = x ; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0200); |
2240 | skey.x = x ; skey.y = y + 2; smooth_or_bits (smooth, &skey, 0x0200); |
2172 | skey.x = x ; skey.y = y ; smooth_or_bits (smooth, &skey, 0x0400); |
2241 | skey.x = x ; skey.y = y ; smooth_or_bits (smooth, &skey, 0x0400); |
2173 | skey.x = x + 2; skey.y = y ; smooth_or_bits (smooth, &skey, 0x0800); |
2242 | skey.x = x + 2; skey.y = y ; smooth_or_bits (smooth, &skey, 0x0800); |
|
|
2243 | } |
|
|
2244 | } |
|
|
2245 | |
|
|
2246 | if (expect_false (z == 2)) |
|
|
2247 | { |
|
|
2248 | /* draw question marks on top of hidden spaces */ |
|
|
2249 | if (!cell->darkness) |
|
|
2250 | { |
|
|
2251 | maptex tex = self->tex [TEXID_HIDDEN]; |
|
|
2252 | int px = (x + 1) * T - tex.w; |
|
|
2253 | int py = (y + 1) * T - tex.h; |
|
|
2254 | |
|
|
2255 | rc_t2f_v3f (arr_hidden, 0 , 0 , px , py , 0); |
|
|
2256 | rc_t2f_v3f (arr_hidden, 0 , tex.t, px , py + tex.h, 0); |
|
|
2257 | rc_t2f_v3f (arr_hidden, tex.s, tex.t, px + tex.w, py + tex.h, 0); |
|
|
2258 | rc_t2f_v3f (arr_hidden, tex.s, 0 , px + tex.w, py , 0); |
|
|
2259 | } |
|
|
2260 | |
|
|
2261 | if (expect_false (cell->flags)) |
|
|
2262 | { |
|
|
2263 | // overlays such as the speech bubble, probably more to come |
|
|
2264 | if (cell->flags & 1) |
|
|
2265 | { |
|
|
2266 | rc_key_t key_ov = key; |
|
|
2267 | maptex tex = self->tex [TEXID_SPEECH]; |
|
|
2268 | rc_array_t *arr; |
|
|
2269 | int px = x * T + T * 2 / 32; |
|
|
2270 | int py = y * T - T * 6 / 32; |
|
|
2271 | |
|
|
2272 | key_ov.texname = tex.name; |
|
|
2273 | arr = rc_array (rc_ov, &key_ov); |
|
|
2274 | |
|
|
2275 | rc_t2f_v3f (arr, 0 , 0 , px , py , 0); |
|
|
2276 | rc_t2f_v3f (arr, 0 , tex.t, px , py + T, 0); |
|
|
2277 | rc_t2f_v3f (arr, tex.s, tex.t, px + T, py + T, 0); |
|
|
2278 | rc_t2f_v3f (arr, tex.s, 0 , px + T, py , 0); |
|
|
2279 | } |
2174 | } |
2280 | } |
2175 | } |
2281 | } |
2176 | } |
2282 | } |
2177 | } |
2283 | } |
2178 | |
2284 | |
… | |
… | |
2275 | rc_t2f_v3f (arr, tex.s, 0 , px + tex.w, py , 0); |
2381 | rc_t2f_v3f (arr, tex.s, 0 , px + tex.w, py , 0); |
2276 | |
2382 | |
2277 | rc_draw (rc); |
2383 | rc_draw (rc); |
2278 | } |
2384 | } |
2279 | |
2385 | |
|
|
2386 | rc_draw (rc_ov); |
|
|
2387 | rc_clear (rc_ov); |
|
|
2388 | |
2280 | glDisable (GL_BLEND); |
2389 | glDisable (GL_BLEND); |
2281 | rc_free (rc); |
2390 | rc_free (rc); |
|
|
2391 | rc_free (rc_ov); |
2282 | |
2392 | |
2283 | // top layer: overlays such as the health bar |
2393 | // top layer: overlays such as the health bar |
2284 | for (y = 0; y < sh; y++) |
2394 | for (y = 0; y < sh; y++) |
2285 | if (0 <= y + my && y + my < self->rows) |
2395 | if (0 <= y + my && y + my < self->rows) |
2286 | { |
2396 | { |
… | |
… | |
2346 | }; |
2456 | }; |
2347 | |
2457 | |
2348 | int x, y; |
2458 | int x, y; |
2349 | |
2459 | |
2350 | glEnable (GL_TEXTURE_2D); |
2460 | glEnable (GL_TEXTURE_2D); |
|
|
2461 | /* GL_REPLACE would be correct, as we don't need to modulate alpha, |
|
|
2462 | * but the nvidia driver (185.18.14) mishandles alpha textures |
|
|
2463 | * ansd takes the colour from god knows where instead of using |
|
|
2464 | * Cp. MODULATE results in the same colour, but slightly different |
|
|
2465 | * alpha, but atcually gives us the correct colour with nvidia. |
|
|
2466 | */ |
2351 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); |
2467 | glTexEnvi (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); |
2352 | glEnable (GL_BLEND); |
2468 | glEnable (GL_BLEND); |
2353 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
2469 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
2354 | glBegin (GL_QUADS); |
2470 | glBegin (GL_QUADS); |
2355 | |
2471 | |
2356 | for (y = 0; y < h; y++) |
2472 | for (y = 0; y < h; y++) |
… | |
… | |
2363 | float *c = color [m & 15]; |
2479 | float *c = color [m & 15]; |
2364 | |
2480 | |
2365 | float tx1 = m & 0x40 ? 0.5 : 0.; |
2481 | float tx1 = m & 0x40 ? 0.5 : 0.; |
2366 | float tx2 = tx1 + 0.5; |
2482 | float tx2 = tx1 + 0.5; |
2367 | |
2483 | |
2368 | glColor4f (c[0], c[1], c[2], 0.75); |
2484 | glColor4f (c[0], c[1], c[2], 1); |
2369 | glTexCoord2f (tx1, 0.); glVertex2i (x , y ); |
2485 | glTexCoord2f (tx1, 0.); glVertex2i (x , y ); |
2370 | glTexCoord2f (tx1, 1.); glVertex2i (x , y + 1); |
2486 | glTexCoord2f (tx1, 1.); glVertex2i (x , y + 1); |
2371 | glTexCoord2f (tx2, 1.); glVertex2i (x + 1, y + 1); |
2487 | glTexCoord2f (tx2, 1.); glVertex2i (x + 1, y + 1); |
2372 | glTexCoord2f (tx2, 0.); glVertex2i (x + 1, y ); |
2488 | glTexCoord2f (tx2, 0.); glVertex2i (x + 1, y ); |
2373 | } |
2489 | } |
… | |
… | |
2395 | SvCUR_set (darkness3_sv, sw34 * sh3); |
2511 | SvCUR_set (darkness3_sv, sw34 * sh3); |
2396 | |
2512 | |
2397 | mx += self->x - 1; |
2513 | mx += self->x - 1; |
2398 | my += self->y - 1; |
2514 | my += self->y - 1; |
2399 | |
2515 | |
2400 | memset (darkness1, 255 - FOW_DARKNESS, sw1 * sh1); |
2516 | memset (darkness1, DARKNESS_ADJUST (255 - FOW_DARKNESS), sw1 * sh1); |
2401 | |
2517 | |
2402 | for (y = 0; y < sh1; y++) |
2518 | for (y = 0; y < sh1; y++) |
2403 | if (0 <= y + my && y + my < self->rows) |
2519 | if (0 <= y + my && y + my < self->rows) |
2404 | { |
2520 | { |
2405 | maprow *row = self->row + (y + my); |
2521 | maprow *row = self->row + (y + my); |
… | |
… | |
2408 | if (row->c0 <= x + mx && x + mx < row->c1) |
2524 | if (row->c0 <= x + mx && x + mx < row->c1) |
2409 | { |
2525 | { |
2410 | mapcell *cell = row->col + (x + mx - row->c0); |
2526 | mapcell *cell = row->col + (x + mx - row->c0); |
2411 | |
2527 | |
2412 | darkness1 [y * sw1 + x] = cell->darkness |
2528 | darkness1 [y * sw1 + x] = cell->darkness |
2413 | ? 255 - (cell->darkness - 1) |
2529 | ? DARKNESS_ADJUST (255 - (cell->darkness - 1)) |
2414 | : 255 - FOW_DARKNESS; |
2530 | : DARKNESS_ADJUST (255 - FOW_DARKNESS); |
2415 | } |
2531 | } |
2416 | } |
2532 | } |
2417 | |
2533 | |
2418 | for (y = 0; y < sh; ++y) |
2534 | for (y = 0; y < sh; ++y) |
2419 | for (x = 0; x < sw; ++x) |
2535 | for (x = 0; x < sw; ++x) |
… | |
… | |
2832 | } *civ, const_iv[] = { |
2948 | } *civ, const_iv[] = { |
2833 | # define const_iv(name) { # name, (IV)name } |
2949 | # define const_iv(name) { # name, (IV)name } |
2834 | const_iv (GL_VENDOR), |
2950 | const_iv (GL_VENDOR), |
2835 | const_iv (GL_VERSION), |
2951 | const_iv (GL_VERSION), |
2836 | const_iv (GL_EXTENSIONS), |
2952 | const_iv (GL_EXTENSIONS), |
|
|
2953 | const_iv (GL_MAX_TEXTURE_UNITS), |
2837 | const_iv (GL_COLOR_MATERIAL), |
2954 | const_iv (GL_COLOR_MATERIAL), |
2838 | const_iv (GL_SMOOTH), |
2955 | const_iv (GL_SMOOTH), |
2839 | const_iv (GL_FLAT), |
2956 | const_iv (GL_FLAT), |
2840 | const_iv (GL_DITHER), |
2957 | const_iv (GL_DITHER), |
2841 | const_iv (GL_BLEND), |
2958 | const_iv (GL_BLEND), |
… | |
… | |
2853 | const_iv (GL_ZERO), |
2970 | const_iv (GL_ZERO), |
2854 | const_iv (GL_SRC_ALPHA), |
2971 | const_iv (GL_SRC_ALPHA), |
2855 | const_iv (GL_DST_ALPHA), |
2972 | const_iv (GL_DST_ALPHA), |
2856 | const_iv (GL_ONE_MINUS_SRC_ALPHA), |
2973 | const_iv (GL_ONE_MINUS_SRC_ALPHA), |
2857 | const_iv (GL_ONE_MINUS_DST_ALPHA), |
2974 | const_iv (GL_ONE_MINUS_DST_ALPHA), |
|
|
2975 | const_iv (GL_SRC_COLOR), |
|
|
2976 | const_iv (GL_DST_COLOR), |
|
|
2977 | const_iv (GL_ONE_MINUS_SRC_COLOR), |
|
|
2978 | const_iv (GL_ONE_MINUS_DST_COLOR), |
2858 | const_iv (GL_SRC_ALPHA_SATURATE), |
2979 | const_iv (GL_SRC_ALPHA_SATURATE), |
2859 | const_iv (GL_RGB), |
2980 | const_iv (GL_RGB), |
2860 | const_iv (GL_RGBA), |
2981 | const_iv (GL_RGBA), |
2861 | const_iv (GL_RGBA4), |
2982 | const_iv (GL_RGBA4), |
2862 | const_iv (GL_RGBA8), |
2983 | const_iv (GL_RGBA8), |
… | |
… | |
2930 | const_iv (GL_NICEST), |
3051 | const_iv (GL_NICEST), |
2931 | const_iv (GL_V2F), |
3052 | const_iv (GL_V2F), |
2932 | const_iv (GL_V3F), |
3053 | const_iv (GL_V3F), |
2933 | const_iv (GL_T2F_V3F), |
3054 | const_iv (GL_T2F_V3F), |
2934 | const_iv (GL_T2F_N3F_V3F), |
3055 | const_iv (GL_T2F_N3F_V3F), |
|
|
3056 | const_iv (GL_FUNC_ADD), |
|
|
3057 | const_iv (GL_FUNC_SUBTRACT), |
|
|
3058 | const_iv (GL_FUNC_REVERSE_SUBTRACT), |
2935 | # undef const_iv |
3059 | # undef const_iv |
2936 | }; |
3060 | }; |
2937 | |
3061 | |
2938 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
3062 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
2939 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
3063 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
… | |
… | |
2946 | disable_GL_EXT_blend_func_separate () |
3070 | disable_GL_EXT_blend_func_separate () |
2947 | CODE: |
3071 | CODE: |
2948 | gl.BlendFuncSeparate = 0; |
3072 | gl.BlendFuncSeparate = 0; |
2949 | gl.BlendFuncSeparateEXT = 0; |
3073 | gl.BlendFuncSeparateEXT = 0; |
2950 | |
3074 | |
|
|
3075 | void |
|
|
3076 | apple_nvidia_bug (int enable) |
|
|
3077 | |
2951 | char * |
3078 | char * |
2952 | gl_vendor () |
3079 | gl_vendor () |
2953 | CODE: |
3080 | CODE: |
2954 | RETVAL = (char *)glGetString (GL_VENDOR); |
3081 | RETVAL = (char *)glGetString (GL_VENDOR); |
2955 | OUTPUT: |
3082 | OUTPUT: |
… | |
… | |
3003 | void glBlendFunc (int sfactor, int dfactor) |
3130 | void glBlendFunc (int sfactor, int dfactor) |
3004 | |
3131 | |
3005 | void glBlendFuncSeparate (int sa, int da, int saa, int daa) |
3132 | void glBlendFuncSeparate (int sa, int da, int saa, int daa) |
3006 | CODE: |
3133 | CODE: |
3007 | gl_BlendFuncSeparate (sa, da, saa, daa); |
3134 | gl_BlendFuncSeparate (sa, da, saa, daa); |
|
|
3135 | |
|
|
3136 | # void glBlendEquation (int se) |
3008 | |
3137 | |
3009 | void glDepthMask (int flag) |
3138 | void glDepthMask (int flag) |
3010 | |
3139 | |
3011 | void glLogicOp (int opcode) |
3140 | void glLogicOp (int opcode) |
3012 | |
3141 | |