diff --git a/games/hyperrogue/Makefile b/games/hyperrogue/Makefile index 20ea34facc8..08962d6618b 100644 --- a/games/hyperrogue/Makefile +++ b/games/hyperrogue/Makefile @@ -1,7 +1,8 @@ -# $OpenBSD: Makefile,v 1.8 2018/11/21 01:58:38 bcallah Exp $ +# $OpenBSD: Makefile,v 1.9 2019/01/17 00:14:58 cwen Exp $ COMMENT = roguelike game in a non-Euclidean world CATEGORIES = games x11 +REVISION = 0 GH_ACCOUNT = zenorogue GH_PROJECT = hyperrogue @@ -17,7 +18,7 @@ WANTLIB += ${COMPILER_LIBCXX} GL GLEW SDL SDL_gfx SDL_mixer SDL_ttf WANTLIB += c m png # C++11 -COMPILER = base-clang ports-clang ports-gcc +COMPILER = base-clang ports-gcc BUILD_DEPENDS = ${MODGNU_AUTOCONF_DEPENDS} \ ${MODGNU_AUTOMAKE_DEPENDS} diff --git a/games/hyperrogue/patches/patch-polygons_cpp b/games/hyperrogue/patches/patch-polygons_cpp new file mode 100644 index 00000000000..01e6d540629 --- /dev/null +++ b/games/hyperrogue/patches/patch-polygons_cpp @@ -0,0 +1,20 @@ +$OpenBSD: patch-polygons_cpp,v 1.1 2019/01/17 00:14:58 cwen Exp $ +Fix colors on big-endian machines in non-OpenGL mode. +See https://github.com/zenorogue/hyperrogue/pull/70 +Index: polygons.cpp +--- polygons.cpp.orig ++++ polygons.cpp +@@ -762,7 +762,12 @@ void fixMercator(bool tinf) { + } + + unsigned char& part(color_t& col, int i) { +- unsigned char* c = (unsigned char*) &col; return c[i]; ++ unsigned char* c = (unsigned char*) &col; ++#if SDL_BYTEORDER == SDL_BIG_ENDIAN ++ return c[sizeof(col) - 1 - i]; ++#else ++ return c[i]; ++#endif + } + + bool in_twopoint = false; diff --git a/games/hyperrogue/patches/patch-shaders_cpp b/games/hyperrogue/patches/patch-shaders_cpp new file mode 100644 index 00000000000..ba079955675 --- /dev/null +++ b/games/hyperrogue/patches/patch-shaders_cpp @@ -0,0 +1,30 @@ +$OpenBSD: patch-shaders_cpp,v 1.1 2019/01/17 00:14:58 cwen Exp $ +Fix colors for big endian archs in OpenGL mode. +See https://github.com/zenorogue/hyperrogue/pull/70 +Index: shaders.cpp +--- shaders.cpp.orig ++++ shaders.cpp +@@ -339,9 +339,9 @@ void id_modelview() { + #endif + + void color2(color_t color, ld part) { +- unsigned char *c = (unsigned char*) (&color); + GLfloat cols[4]; +- for(int i=0; i<4; i++) cols[i] = c[3-i] / 255.0 * part; ++ for(int i=0; i<4; i++) ++ cols[i] = (color >> ((3-i) * 8) & 0xff) / 255.0 * part; + #if CAP_SHADER + // glUniform4fv(current->uFog, 4, cols); + glUniform4f(current->uColor, cols[0], cols[1], cols[2], cols[3]); +@@ -352,7 +352,11 @@ void color2(color_t color, ld part) { + + void colorClear(color_t color) { + unsigned char *c = (unsigned char*) (&color); ++#if SDL_BYTEORDER == SDL_BIG_ENDIAN ++ glClearColor(c[0] / 255.0, c[1] / 255.0, c[2]/255.0, c[3] / 255.0); ++#else + glClearColor(c[3] / 255.0, c[2] / 255.0, c[1]/255.0, c[0] / 255.0); ++#endif + } + + void be_nontextured(shader_projection sp) { switch_mode(gmColored, sp); }