Mapster32: changes to aid getting the old color scheme (by customizing).

- bump MAX_TILE_GROUP_ENTRIES to MAXUSERTILES
- in loadtilegroups(), only assign a tile color if it wasn't already
  assigned
- allow "hidden" tile groups by omitting the hotkey
- Tweak the description added to tiles.cfg

git-svn-id: https://svn.eduke32.com/eduke32@5430 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2015-11-14 23:41:00 +00:00
parent f8076f9207
commit 5aae37c4c5
3 changed files with 55 additions and 24 deletions

View file

@ -3,25 +3,14 @@
#include "names.h" #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" tilegroup "Actors"
{ {
hotkey "A" 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 colors 31 31
tiles 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 // Alphabet configuration for text entry tool in 3D mode
// (press Ctrl-T on a wall-aligned letter) // (press Ctrl-T on a wall-aligned letter)
// 32 alphabets max. // 32 alphabets max.

View file

@ -3285,13 +3285,20 @@ static int32_t OnSelectTile(int32_t iTile)
// //
// Display the description strings for each available tile group // Display the description strings for each available tile group
// //
int32_t j = 0;
for (i = 0; i < tile_groups; i++) for (i = 0; i < tile_groups; i++)
{ {
if (s_TileGroups[i].szText != NULL) if (s_TileGroups[i].szText != NULL)
{ {
if ((i+2)*16 > ydimgame) break; if ((j+2)*16 > ydimgame) break;
if (s_TileGroups[i].key1)
{
Bsprintf(tempbuf, "(%c) %s", s_TileGroups[i].key1, s_TileGroups[i].szText); Bsprintf(tempbuf, "(%c) %s", s_TileGroups[i].key1, s_TileGroups[i].szText);
printext256(10L, (i+1)*16, whitecol, -1, tempbuf, 0); printext256(10L, (j+1)*16, whitecol, -1, tempbuf, 0);
j++;
}
} }
} }
showframe(1); showframe(1);
@ -3301,7 +3308,7 @@ static int32_t OnSelectTile(int32_t iTile)
for (i = 0; i < tile_groups; i++) for (i = 0; i < tile_groups; i++)
{ {
if (s_TileGroups[i].pIds != NULL && s_TileGroups[i].key1) 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); iTile = LoadTileSet(iTile, s_TileGroups[i].pIds, s_TileGroups[i].nIds);
bDone = 1; bDone = 1;
@ -9386,7 +9393,7 @@ int32_t parsetilegroups(scriptfile *script)
case T_TILE: case T_TILE:
{ {
if (scriptfile_getsymbol(script,&i)) break; 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; tileGrp->pIds[tileGrp->nIds++] = i;
// OSD_Printf("added tile %d to group %d\n",i,g); // OSD_Printf("added tile %d to group %d\n",i,g);
break; break;
@ -9620,11 +9627,18 @@ static int32_t loadtilegroups(const char *fn)
// If the colors were specified... // If the colors were specified...
if (s_TileGroups[i].color1 && s_TileGroups[i].color2) 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--) for (j = s_TileGroups[i].nIds-1; j >= 0 ; j--)
{ {
// Apply the colors to all tiles in the group. int const tilenum = s_TileGroups[i].pIds[j];
spritecol2d[s_TileGroups[i].pIds[j]][0] = s_TileGroups[i].color1;
spritecol2d[s_TileGroups[i].pIds[j]][1] = s_TileGroups[i].color2; // ... 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;
}
} }
} }
} }

View file

@ -107,7 +107,7 @@ typedef struct
} TileGroup; } TileGroup;
#define MAX_TILE_GROUPS 32 #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 TileGroup s_TileGroups[MAX_TILE_GROUPS];
static int32_t tilegroupItems; static int32_t tilegroupItems;