diff --git a/linuxdoom-1.10/r_data.cpp b/linuxdoom-1.10/r_data.cpp index b110b23..0e01146 100644 --- a/linuxdoom-1.10/r_data.cpp +++ b/linuxdoom-1.10/r_data.cpp @@ -520,10 +520,6 @@ void R_InitColormaps(void) { // Load in the light tables, // 256 byte align tables. auto lump = W_GetNumForName("COLORMAP"); - auto length = W_LumpLength(lump) + 255; - colormaps.resize(length); - // TODO JONNY wtf - //colormaps = (std::byte *)((reinterpret_cast(colormaps) + 255) & ~0xff); W_ReadLump(lump, colormaps.data()); } diff --git a/linuxdoom-1.10/r_draw.cpp b/linuxdoom-1.10/r_draw.cpp index d9fe0b0..7aa3ed9 100644 --- a/linuxdoom-1.10/r_draw.cpp +++ b/linuxdoom-1.10/r_draw.cpp @@ -316,7 +316,7 @@ void R_DrawFuzzColumn(void) { // a pixel that is either one column // left or right of the current one. // Add index from colormap to index. - *dest = colormaps[6 * 256 + static_cast(dest[fuzzoffset[fuzzpos]])]; + *dest = colormaps[6][static_cast(dest[fuzzoffset[fuzzpos]])]; // Clamp table lookup index. if (++fuzzpos == FUZZTABLE) diff --git a/linuxdoom-1.10/r_main.cpp b/linuxdoom-1.10/r_main.cpp index 5ddfe8e..98ede23 100644 --- a/linuxdoom-1.10/r_main.cpp +++ b/linuxdoom-1.10/r_main.cpp @@ -532,7 +532,7 @@ void R_InitLightTables(void) { if (level >= NUMCOLORMAPS) level = NUMCOLORMAPS - 1; - zlight[i][j] = colormaps.data() + level * 256; + zlight[i][j] = colormaps[level].data(); } } } @@ -631,7 +631,7 @@ void R_ExecuteSetViewSize(void) { if (level >= NUMCOLORMAPS) level = NUMCOLORMAPS - 1; - scalelight[i][j] = colormaps.data() + level * 256; + scalelight[i][j] = colormaps[level].data(); } } } @@ -703,8 +703,7 @@ void R_SetupFrame(player_t *player) { sscount = 0; if (player->fixedcolormap) { - fixedcolormap = - colormaps.data() + player->fixedcolormap * 256 * sizeof(lighttable_t); + fixedcolormap = colormaps[player->fixedcolormap].data(); walllights = scalelightfixed; diff --git a/linuxdoom-1.10/r_plane.cpp b/linuxdoom-1.10/r_plane.cpp index 5ba15ad..90bfba6 100644 --- a/linuxdoom-1.10/r_plane.cpp +++ b/linuxdoom-1.10/r_plane.cpp @@ -329,7 +329,7 @@ void R_DrawPlanes(void) { // i.e. colormaps[0] is used. // Because of this hack, sky is not affected // by INVUL inverse mapping. - dc_colormap = colormaps.data(); + dc_colormap = colormaps[0].data(); dc_texturemid = skytexturemid; for (x = pl->minx; x <= pl->maxx; x++) { dc_yl = static_cast(pl->top[x]); diff --git a/linuxdoom-1.10/r_state.h b/linuxdoom-1.10/r_state.h index b9a14f2..be885aa 100644 --- a/linuxdoom-1.10/r_state.h +++ b/linuxdoom-1.10/r_state.h @@ -41,7 +41,8 @@ extern fixed_t *spritewidth; extern fixed_t *spriteoffset; extern fixed_t *spritetopoffset; -inline std::vector colormaps; +using colormap = std::array; +inline std::array colormaps; extern int scaledviewwidth; diff --git a/linuxdoom-1.10/r_things.cpp b/linuxdoom-1.10/r_things.cpp index 82fe159..ae5f07c 100644 --- a/linuxdoom-1.10/r_things.cpp +++ b/linuxdoom-1.10/r_things.cpp @@ -464,7 +464,7 @@ void R_ProjectSprite(mobj_t *thing) { vis->colormap = fixedcolormap; } else if (thing->frame & FF_FULLBRIGHT) { // full bright - vis->colormap = colormaps.data(); + vis->colormap = colormaps[0].data(); } else { // diminished light index = xscale >> (LIGHTSCALESHIFT - detailshift); @@ -586,7 +586,7 @@ void R_DrawPSprite(pspdef_t *psp) { vis->colormap = fixedcolormap; } else if (psp->state->frame & FF_FULLBRIGHT) { // full bright - vis->colormap = colormaps.data(); + vis->colormap = colormaps[0].data(); } else { // local light vis->colormap = spritelights[MAXLIGHTSCALE - 1];