diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index 65e120002..af06ecba6 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -319,7 +319,7 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe patch_t *realpatch; INT32 blockwidth, blockheight, blocksize; - INT32 i; + INT32 i, idx; boolean skyspecial = false; //poor hack for Legacy large skies.. RGBA_t *palette; @@ -368,12 +368,10 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe col = palette[HWR_CHROMAKEY_EQUIVALENTCOLORINDEX]; - for (j = 0; j < blockheight; j++) + for (idx = 0, j = 0; j < blockheight; j++) { - for (i = 0; i < blockwidth; i++) + for (i = 0; i < blockwidth; i++, idx++) { - int idx = (j*blockwidth+i); - block[4*idx+0] = col.s.red; block[4*idx+1] = col.s.green; block[4*idx+2] = col.s.blue; diff --git a/src/hardware/r_opengl/r_opengl.c b/src/hardware/r_opengl/r_opengl.c index 5e072e600..3d40f4c03 100644 --- a/src/hardware/r_opengl/r_opengl.c +++ b/src/hardware/r_opengl/r_opengl.c @@ -1604,6 +1604,7 @@ static void GL_UpdateTexture(GLMipmap_t *pTexInfo) INT32 w = pTexInfo->width, h = pTexInfo->height; INT32 i, j; + INT32 idx; const GLubyte *pImgData = (const GLubyte *)pTexInfo->data; const GLvoid *ptex = NULL; @@ -1632,18 +1633,13 @@ static void GL_UpdateTexture(GLMipmap_t *pTexInfo) const int chromakeyed = (pTexInfo->flags & TF_CHROMAKEYED); - for (j = 0; j < h; j++) + for (idx = 0, j = 0; j < h; j++) { - for (i = 0; i < w; i++) + for (i = 0; i < w; i++, idx++) { - int idx = (w*j+i); - if (chromakeyed && (*pImgData == HWR_PATCHES_CHROMAKEY_COLORINDEX)) { - tex[idx].s.red = 0; - tex[idx].s.green = 0; - tex[idx].s.blue = 0; - tex[idx].s.alpha = 0; + tex[idx].s = (byteColor_t){0, 0, 0, 0}; pTexInfo->flags |= TF_TRANSPARENT; // there is a hole in it } else @@ -1672,12 +1668,10 @@ static void GL_UpdateTexture(GLMipmap_t *pTexInfo) ptex = tex = textureBuffer; texformat = GL_LUMINANCE_ALPHA; - for (j = 0; j < h; j++) + for (idx = 0, j = 0; j < h; j++) { - for (i = 0; i < w; i++) + for (i = 0; i < w; i++, idx++) { - int idx = (w*j+i); - tex[idx].s.red = *pImgData; tex[idx].s.green = *pImgData; tex[idx].s.blue = *pImgData; @@ -1692,17 +1686,13 @@ static void GL_UpdateTexture(GLMipmap_t *pTexInfo) ptex = tex = textureBuffer; texformat = GL_ALPHA; - for (j = 0; j < h; j++) - { - for (i = 0; i < w; i++) - { - int idx = (w*j+i); + memset(&tex->s, 255, sizeof(byteColor_t)*w*h); // 255 because the fade mask is modulated with the screen texture, so alpha affects it while the colours don't - tex[idx].s.red = 255; // 255 because the fade mask is modulated with the screen texture, so alpha affects it while the colours don't - tex[idx].s.green = 255; - tex[idx].s.blue = 255; - tex[idx].s.alpha = *pImgData; - pImgData++; + for (idx = 0, j = 0; j < h; j++) + { + for (i = 0; i < w; i++, idx++) + { + tex[idx].s.alpha = *pImgData++; } } break; diff --git a/src/qs22j.c b/src/qs22j.c index 17f2b7c2e..c610bde4d 100644 --- a/src/qs22j.c +++ b/src/qs22j.c @@ -16,6 +16,7 @@ #include #include + #include "qs22j.h" #define INSORTTHRESH 5 // if n < this use insertion sort diff --git a/src/s_sound.c b/src/s_sound.c index 58146d1a8..7904ae90e 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -2037,7 +2037,7 @@ void S_InitMapMusic(void) { char *maptitle = G_BuildMapTitle(gamemap); // for some reason, occasionally the title screen music doesent seem to be reset in time, so skipping the intro may make it just continue playing it instead, weird.. - skipintromus = (stricmp(music_name, "titles") != 0) && (maptitle && (stricmp(maptitle, "Wandering Falls") != 0)); // thanks diggle! + skipintromus = gamestate == GS_LEVEL && (stricmp(music_name, "titles") != 0) && (maptitle && (stricmp(maptitle, "Wandering Falls") != 0)); // thanks diggle! if (maptitle) Z_Free(maptitle); }