diff --git a/polymer/eduke32/package/sdk/tiles.cfg b/polymer/eduke32/package/sdk/tiles.cfg index 00dfc6323..a7d0e10eb 100644 --- a/polymer/eduke32/package/sdk/tiles.cfg +++ b/polymer/eduke32/package/sdk/tiles.cfg @@ -3,25 +3,14 @@ #include "names.h" +// NOTE: See the end of the tile group declarations [OLD_COLOR_SCHEME] for how +// one can create a color scheme similar to earlier Mapster32 builds +// (non-blocking sprites have an orange tint, blocking ones are purple). + tilegroup "Actors" { hotkey "A" - // NOTE: colors specified here (as well as in the first argument to the DEF - // commands '2dcol' and '2dcolidxrange') refer to Mapster32's editorcolor[] - // index. They can be viewed with "set showpal 1" assuming that a.m32 has - // been loaded. - // - // The actual color indices will be offset in the range [0 .. 4] when the - // mouse hovers near them. - // - // For example, under the Duke3D palette, one can create a color scheme - // similar to earlier Mapster32 builds (non-blocking sprites have an orange - // tint, blocking ones are purple) by declaring in a loaded DEF file - // 2dcolidxrange 33 33 255 - // which maps editorcolor[] indices 33 through 255 to the same actual color - // indices, and then setting here: -// colors 139 231 colors 31 31 tiles @@ -170,6 +159,34 @@ tilegroup "Exploding stuff" } } +/* +// Comment out this group to get the [OLD_COLOR_SCHEME]. +tilegroup "All" +{ + tilerange 0 30704 // MAXUSERTILES + + // NOTE: no hotkey, this group will not show up in the 'T' menu. + + // NOTE: colors specified here (as well as in the first argument to the DEF + // commands '2dcol' and '2dcolidxrange') refer to Mapster32's editorcolor[] + // index. They can be viewed with "do set showpal 1" assuming that a.m32 + // has been loaded. + // + // The actual color indices will be offset in the range [0 .. 4] when the + // mouse hovers near them. + // + // For example, under the Duke3D palette, one can create a color scheme + // similar to earlier Mapster32 builds (non-blocking sprites have an orange + // tint, blocking ones are purple) by declaring in a loaded DEF file + // 2dcolidxrange 33 33 255 + // which maps editorcolor[] indices 33 through 255 to the same actual color + // indices, and then setting here: + colors 139 231 + // This sets tile colors for all sprites excluding those which have been + // assigned a color by the above tile group declarations. +} +*/ + // Alphabet configuration for text entry tool in 3D mode // (press Ctrl-T on a wall-aligned letter) // 32 alphabets max. diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index c0d5eb8ba..17b3ebc1f 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -3285,13 +3285,20 @@ static int32_t OnSelectTile(int32_t iTile) // // Display the description strings for each available tile group // + int32_t j = 0; + for (i = 0; i < tile_groups; i++) { if (s_TileGroups[i].szText != NULL) { - if ((i+2)*16 > ydimgame) break; - Bsprintf(tempbuf,"(%c) %s",s_TileGroups[i].key1,s_TileGroups[i].szText); - printext256(10L, (i+1)*16, whitecol, -1, tempbuf, 0); + if ((j+2)*16 > ydimgame) break; + + if (s_TileGroups[i].key1) + { + Bsprintf(tempbuf, "(%c) %s", s_TileGroups[i].key1, s_TileGroups[i].szText); + printext256(10L, (j+1)*16, whitecol, -1, tempbuf, 0); + j++; + } } } showframe(1); @@ -3301,7 +3308,7 @@ static int32_t OnSelectTile(int32_t iTile) for (i = 0; i < tile_groups; i++) { if (s_TileGroups[i].pIds != NULL && s_TileGroups[i].key1) - if ((ch == s_TileGroups[i].key1) || (ch == s_TileGroups[i].key2)) + if (ch == s_TileGroups[i].key1 || ch == s_TileGroups[i].key2) { iTile = LoadTileSet(iTile, s_TileGroups[i].pIds, s_TileGroups[i].nIds); bDone = 1; @@ -9386,7 +9393,7 @@ int32_t parsetilegroups(scriptfile *script) case T_TILE: { if (scriptfile_getsymbol(script,&i)) break; - if (i >= 0 && i < MAXTILES && tileGrp->nIds < MAX_TILE_GROUP_ENTRIES) + if (i >= 0 && i < MAXUSERTILES && tileGrp->nIds < MAX_TILE_GROUP_ENTRIES) tileGrp->pIds[tileGrp->nIds++] = i; // OSD_Printf("added tile %d to group %d\n",i,g); break; @@ -9620,11 +9627,18 @@ static int32_t loadtilegroups(const char *fn) // If the colors were specified... if (s_TileGroups[i].color1 && s_TileGroups[i].color2) { + // Apply the colors to all tiles in the group... for (j = s_TileGroups[i].nIds-1; j >= 0 ; j--) { - // Apply the colors to all tiles in the group. - spritecol2d[s_TileGroups[i].pIds[j]][0] = s_TileGroups[i].color1; - spritecol2d[s_TileGroups[i].pIds[j]][1] = s_TileGroups[i].color2; + int const tilenum = s_TileGroups[i].pIds[j]; + + // ... but for each tile, only if no color has been specified + // for it previously. + if (spritecol2d[tilenum][0] == 0) + { + spritecol2d[tilenum][0] = s_TileGroups[i].color1; + spritecol2d[tilenum][1] = s_TileGroups[i].color2; + } } } } diff --git a/polymer/eduke32/source/mapster32.h b/polymer/eduke32/source/mapster32.h index b407751fa..4c51148cd 100644 --- a/polymer/eduke32/source/mapster32.h +++ b/polymer/eduke32/source/mapster32.h @@ -107,7 +107,7 @@ typedef struct } TileGroup; #define MAX_TILE_GROUPS 32 -#define MAX_TILE_GROUP_ENTRIES 1024 +#define MAX_TILE_GROUP_ENTRIES MAXUSERTILES static TileGroup s_TileGroups[MAX_TILE_GROUPS]; static int32_t tilegroupItems;