From 8cab8f180b2f80918c315a460f2e43e7aa2933a8 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Wed, 31 Jul 2013 12:15:33 +0200 Subject: [PATCH 1/7] - Be clear about the safe 'memset/memcpy' operations on virtual classes. Since I remember that 'memset/memcpy' is safe in this code, it should be okay to cast to the generic pointer all the 'virtual class' arguments before calling the above functions. Shuts up Clang warnings. --- src/d_dehacked.cpp | 2 +- src/decallib.cpp | 2 +- src/thingdef/thingdef_properties.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index eb4e2fcd6..d01e9513f 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -2945,7 +2945,7 @@ void FinishDehPatch () PClass *subclass = RUNTIME_CLASS(ADehackedPickup)->CreateDerivedClass (typeNameBuilder, sizeof(ADehackedPickup)); AActor *defaults2 = GetDefaultByType (subclass); - memcpy (defaults2, defaults1, sizeof(AActor)); + memcpy ((void *)defaults2, (void *)defaults1, sizeof(AActor)); // Make a copy of the replaced class's state labels FStateDefinitions statedef; diff --git a/src/decallib.cpp b/src/decallib.cpp index c8fe6c593..91827409b 100644 --- a/src/decallib.cpp +++ b/src/decallib.cpp @@ -452,7 +452,7 @@ void FDecalLib::ParseDecal (FScanner &sc) decalNum = GetDecalID (sc); sc.MustGetStringName ("{"); - memset (&newdecal, 0, sizeof(newdecal)); + memset ((void *)&newdecal, 0, sizeof(newdecal)); newdecal.PicNum.SetInvalid(); newdecal.ScaleX = newdecal.ScaleY = FRACUNIT; newdecal.RenderFlags = RF_WALLSPRITE; diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 61a18b370..7b922df02 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -433,7 +433,7 @@ DEFINE_PROPERTY(skip_super, 0, Actor) return; } - memcpy (defaults, GetDefault(), sizeof(AActor)); + memcpy ((void *)defaults, (void *)GetDefault(), sizeof(AActor)); if (bag.DropItemList != NULL) { FreeDropItemChain (bag.DropItemList); From 0dc70f847c5826b384bc694fd65739d964210fc7 Mon Sep 17 00:00:00 2001 From: Edoardo Prezioso Date: Wed, 31 Jul 2013 12:26:47 +0200 Subject: [PATCH 2/7] - Be more compatible with C++11 narrowing conversions system. --- src/d_dehacked.cpp | 30 +++++++++++++++--------------- src/thingdef/thingdef.h | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index d01e9513f..e6376a589 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -1755,21 +1755,21 @@ static int PatchCheats (int dummy) static int PatchMisc (int dummy) { static const struct Key keys[] = { - { "Initial Health", myoffsetof(struct DehInfo,StartHealth) }, - { "Initial Bullets", myoffsetof(struct DehInfo,StartBullets) }, - { "Max Health", myoffsetof(struct DehInfo,MaxHealth) }, - { "Max Armor", myoffsetof(struct DehInfo,MaxArmor) }, - { "Green Armor Class", myoffsetof(struct DehInfo,GreenAC) }, - { "Blue Armor Class", myoffsetof(struct DehInfo,BlueAC) }, - { "Max Soulsphere", myoffsetof(struct DehInfo,MaxSoulsphere) }, - { "Soulsphere Health", myoffsetof(struct DehInfo,SoulsphereHealth) }, - { "Megasphere Health", myoffsetof(struct DehInfo,MegasphereHealth) }, - { "God Mode Health", myoffsetof(struct DehInfo,GodHealth) }, - { "IDFA Armor", myoffsetof(struct DehInfo,FAArmor) }, - { "IDFA Armor Class", myoffsetof(struct DehInfo,FAAC) }, - { "IDKFA Armor", myoffsetof(struct DehInfo,KFAArmor) }, - { "IDKFA Armor Class", myoffsetof(struct DehInfo,KFAAC) }, - { "No Autofreeze", myoffsetof(struct DehInfo,NoAutofreeze) }, + { "Initial Health", static_cast(myoffsetof(struct DehInfo,StartHealth)) }, + { "Initial Bullets", static_cast(myoffsetof(struct DehInfo,StartBullets)) }, + { "Max Health", static_cast(myoffsetof(struct DehInfo,MaxHealth)) }, + { "Max Armor", static_cast(myoffsetof(struct DehInfo,MaxArmor)) }, + { "Green Armor Class", static_cast(myoffsetof(struct DehInfo,GreenAC)) }, + { "Blue Armor Class", static_cast(myoffsetof(struct DehInfo,BlueAC)) }, + { "Max Soulsphere", static_cast(myoffsetof(struct DehInfo,MaxSoulsphere)) }, + { "Soulsphere Health", static_cast(myoffsetof(struct DehInfo,SoulsphereHealth)) }, + { "Megasphere Health", static_cast(myoffsetof(struct DehInfo,MegasphereHealth)) }, + { "God Mode Health", static_cast(myoffsetof(struct DehInfo,GodHealth)) }, + { "IDFA Armor", static_cast(myoffsetof(struct DehInfo,FAArmor)) }, + { "IDFA Armor Class", static_cast(myoffsetof(struct DehInfo,FAAC)) }, + { "IDKFA Armor", static_cast(myoffsetof(struct DehInfo,KFAArmor)) }, + { "IDKFA Armor Class", static_cast(myoffsetof(struct DehInfo,KFAAC)) }, + { "No Autofreeze", static_cast(myoffsetof(struct DehInfo,NoAutofreeze)) }, { NULL, 0 } }; int result; diff --git a/src/thingdef/thingdef.h b/src/thingdef/thingdef.h index 08264e0a8..63d04ea29 100644 --- a/src/thingdef/thingdef.h +++ b/src/thingdef/thingdef.h @@ -354,11 +354,11 @@ int MatchString (const char *in, const char **strings); MSVC_MSEG FVariableInfo *infoptr_GlobalDef__##name GCC_MSEG = &GlobalDef__##name; #define DEFINE_MEMBER_VARIABLE(name, cls) \ - static FVariableInfo GlobalDef__##name = { #name, myoffsetof(cls, name), RUNTIME_CLASS(cls) }; \ + static FVariableInfo GlobalDef__##name = { #name, static_cast(myoffsetof(cls, name)), RUNTIME_CLASS(cls) }; \ MSVC_MSEG FVariableInfo *infoptr_GlobalDef__##name GCC_MSEG = &GlobalDef__##name; #define DEFINE_MEMBER_VARIABLE_ALIAS(name, alias, cls) \ - static FVariableInfo GlobalDef__##name = { #name, myoffsetof(cls, alias), RUNTIME_CLASS(cls) }; \ + static FVariableInfo GlobalDef__##name = { #name, static_cast(myoffsetof(cls, alias)), RUNTIME_CLASS(cls) }; \ MSVC_MSEG FVariableInfo *infoptr_GlobalDef__##name GCC_MSEG = &GlobalDef__##name; From d77673d68102d5102c37e04d49dbe6fc031fd75b Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 31 Jul 2013 22:59:35 +0200 Subject: [PATCH 3/7] - reorganization of automap color handling for easier maintenance Mostly preparation to implement a per-mod automap option but also fixes a few minor issues with some colors that are not defined in the original game specific colorsets. --- src/am_map.cpp | 655 +++++++++++++++++++++++++++++-------------------- 1 file changed, 386 insertions(+), 269 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 8a4d1cc36..466fe36ab 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -68,97 +68,13 @@ #include "a_keys.h" #include "r_data/colormaps.h" -//============================================================================= -// -// Automap colors -// -//============================================================================= - -struct AMColor -{ - int Index; - uint32 RGB; - - void FromCVar(FColorCVar & cv) - { - Index = cv.GetIndex(); - RGB = uint32(cv) | MAKEARGB(255, 0, 0, 0); - } - - void FromRGB(int r,int g, int b) - { - RGB = MAKEARGB(255, r, g, b); - Index = ColorMatcher.Pick(r, g, b); - } -}; - -static AMColor Background, YourColor, WallColor, TSWallColor, - FDWallColor, CDWallColor, EFWallColor, ThingColor, - ThingColor_Item, ThingColor_CountItem, ThingColor_Monster, ThingColor_Friend, - SpecialWallColor, SecretWallColor, GridColor, XHairColor, - NotSeenColor, - LockedColor, - AlmostBackground, - IntraTeleportColor, InterTeleportColor, - SecretSectorColor; - -static AMColor DoomColors[11]; -static BYTE DoomPaletteVals[11*3] = -{ - 0x00,0x00,0x00, 0xff,0xff,0xff, 0x10,0x10,0x10, - 0xfc,0x00,0x00, 0x80,0x80,0x80, 0xbc,0x78,0x48, - 0xfc,0xfc,0x00, 0x74,0xfc,0x6c, 0x4c,0x4c,0x4c, - 0x80,0x80,0x80, 0x6c,0x6c,0x6c -}; - -static AMColor StrifeColors[11]; -static BYTE StrifePaletteVals[11*3] = -{ - 0x00,0x00,0x00, 239, 239, 0, 0x10,0x10,0x10, - 199, 195, 195, 119, 115, 115, 55, 59, 91, - 119, 115, 115, 0xfc,0x00,0x00, 0x4c,0x4c,0x4c, - 187, 59, 0, 219, 171, 0 -}; - -static AMColor RavenColors[11]; -static BYTE RavenPaletteVals[11*3] = -{ - 0x6c,0x54,0x40, 255, 255, 255, 0x74,0x5c,0x48, - 75, 50, 16, 88, 93, 86, 208, 176, 133, - 103, 59, 31, 236, 236, 236, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -}; //============================================================================= // -// globals +// CVARs // //============================================================================= -#define MAPBITS 12 -#define MapDiv SafeDivScale12 -#define MapMul MulScale12 -#define MAPUNIT (1< -1; + } +}; + +//============================================================================= +// +// a complete color set +// +//============================================================================= + +struct AMColorset +{ + enum + { + Background, + YourColor, + WallColor, + TSWallColor, + FDWallColor, + CDWallColor, + EFWallColor, + ThingColor, + ThingColor_Item, + ThingColor_CountItem, + ThingColor_Monster, + ThingColor_Friend, + SpecialWallColor, + SecretWallColor, + GridColor, + XHairColor, + NotSeenColor, + LockedColor, + IntraTeleportColor, + InterTeleportColor, + SecretSectorColor, + AlmostBackgroundColor, + AM_NUM_COLORS + }; + + AMColor c[AM_NUM_COLORS]; + bool displayLocks; + bool forcebackground; + + void initFromCVars(FColorCVar **values) + { + for(int i=0;i MapArrow; static TArray CheatMapArrow; static TArray CheatKey; @@ -345,15 +576,11 @@ static mline_t square_guy[] = { -EXTERN_CVAR (Bool, sv_cheats) -CUSTOM_CVAR (Int, am_cheat, 0, 0) -{ - // No automap cheat in net games when cheats are disabled! - if (netgame && !sv_cheats && self != 0) - { - self = 0; - } -} +//============================================================================= +// +// +// +//============================================================================= static int grid = 0; @@ -563,21 +790,6 @@ void AM_StaticInit() } markpointnum = 0; mapback.SetInvalid(); - - static DWORD *lastpal = NULL; - //static int lastback = -1; - DWORD *palette; - - palette = (DWORD *)GPalette.BaseColors; - - int i, j; - - for (i = j = 0; i < 11; i++, j += 3) - { - DoomColors[i].FromRGB(DoomPaletteVals[j], DoomPaletteVals[j+1], DoomPaletteVals[j+2]); - StrifeColors[i].FromRGB(StrifePaletteVals[j], StrifePaletteVals[j+1], StrifePaletteVals[j+2]); - RavenColors[i].FromRGB(RavenPaletteVals[j], RavenPaletteVals[j+1], RavenPaletteVals[j+2]); - } } //============================================================================= @@ -913,133 +1125,28 @@ static void AM_initColors (bool overlayed) { if (overlayed) { - YourColor.FromCVar (am_ovyourcolor); - WallColor.FromCVar (am_ovwallcolor); - SpecialWallColor.FromCVar(am_ovspecialwallcolor); - SecretWallColor = WallColor; - SecretSectorColor.FromCVar (am_ovsecretsectorcolor); - ThingColor_Item.FromCVar (am_ovthingcolor_item); - ThingColor_CountItem.FromCVar (am_ovthingcolor_citem); - ThingColor_Friend.FromCVar (am_ovthingcolor_friend); - ThingColor_Monster.FromCVar (am_ovthingcolor_monster); - ThingColor.FromCVar (am_ovthingcolor); - LockedColor.FromCVar (am_ovotherwallscolor); - EFWallColor.FromCVar (am_ovefwallcolor); - FDWallColor.FromCVar (am_ovfdwallcolor); - CDWallColor.FromCVar (am_ovcdwallcolor); - TSWallColor.FromCVar (am_ovunseencolor); - NotSeenColor = TSWallColor; - InterTeleportColor.FromCVar (am_ovtelecolor); - IntraTeleportColor = InterTeleportColor; + AMColors.initFromCVars(cv_overlay); } else switch(am_colorset) { default: - { /* Use the custom colors in the am_* cvars */ - Background.FromCVar (am_backcolor); - YourColor.FromCVar (am_yourcolor); - SecretWallColor.FromCVar (am_secretwallcolor); - SpecialWallColor.FromCVar (am_specialwallcolor); - WallColor.FromCVar (am_wallcolor); - TSWallColor.FromCVar (am_tswallcolor); - FDWallColor.FromCVar (am_fdwallcolor); - CDWallColor.FromCVar (am_cdwallcolor); - EFWallColor.FromCVar (am_efwallcolor); - ThingColor_Item.FromCVar (am_thingcolor_item); - ThingColor_CountItem.FromCVar (am_thingcolor_citem); - ThingColor_Friend.FromCVar (am_thingcolor_friend); - ThingColor_Monster.FromCVar (am_thingcolor_monster); - ThingColor.FromCVar (am_thingcolor); - GridColor.FromCVar (am_gridcolor); - XHairColor.FromCVar (am_xhaircolor); - NotSeenColor.FromCVar (am_notseencolor); - LockedColor.FromCVar (am_lockedcolor); - InterTeleportColor.FromCVar (am_interlevelcolor); - IntraTeleportColor.FromCVar (am_intralevelcolor); - SecretSectorColor.FromCVar (am_secretsectorcolor); - - DWORD ba = am_backcolor; - - int r = RPART(ba) - 16; - int g = GPART(ba) - 16; - int b = BPART(ba) - 16; - - if (r < 0) - r += 32; - if (g < 0) - g += 32; - if (b < 0) - b += 32; - - AlmostBackground.FromRGB(r, g, b); + AMColors.initFromCVars(cv_standard); break; - } case 1: // Doom // Use colors corresponding to the original Doom's - Background = DoomColors[0]; - YourColor = DoomColors[1]; - AlmostBackground = DoomColors[2]; - SecretSectorColor = - SecretWallColor = - SpecialWallColor = - WallColor = DoomColors[3]; - TSWallColor = DoomColors[4]; - EFWallColor = FDWallColor = DoomColors[5]; - LockedColor = - CDWallColor = DoomColors[6]; - ThingColor_Item = - ThingColor_Friend = - ThingColor_Monster = - ThingColor = DoomColors[7]; - GridColor = DoomColors[8]; - XHairColor = DoomColors[9]; - NotSeenColor = DoomColors[10]; + AMColors.initFromColors(DoomColors, false); break; case 2: // Strife // Use colors corresponding to the original Strife's - Background = StrifeColors[0]; - YourColor = StrifeColors[1]; - AlmostBackground = DoomColors[2]; - SecretSectorColor = - SecretWallColor = - SpecialWallColor = - WallColor = StrifeColors[3]; - TSWallColor = StrifeColors[4]; - EFWallColor = FDWallColor = StrifeColors[5]; - LockedColor = - CDWallColor = StrifeColors[6]; - ThingColor_Item = StrifeColors[10]; - ThingColor_Friend = - ThingColor_Monster = StrifeColors[7]; - ThingColor = StrifeColors[9]; - GridColor = StrifeColors[8]; - XHairColor = DoomColors[9]; - NotSeenColor = DoomColors[10]; + AMColors.initFromColors(StrifeColors, false); break; case 3: // Raven // Use colors corresponding to the original Raven's - Background = RavenColors[0]; - YourColor = RavenColors[1]; - AlmostBackground = DoomColors[2]; - SecretSectorColor = - SecretWallColor = - SpecialWallColor = - WallColor = RavenColors[3]; - TSWallColor = RavenColors[4]; - EFWallColor = FDWallColor = RavenColors[5]; - LockedColor = - CDWallColor = RavenColors[6]; - ThingColor = - ThingColor_Item = - ThingColor_Friend = - ThingColor_Monster = RavenColors[7]; - GridColor = RavenColors[4]; - XHairColor = RavenColors[9]; - NotSeenColor = RavenColors[10]; + AMColors.initFromColors(RavenColors, true); break; } @@ -1541,13 +1648,18 @@ void AM_drawMline (mline_t *ml, const AMColor &color) } } +inline void AM_drawMline (mline_t *ml, int colorindex) +{ + AM_drawMline(ml, AMColors[colorindex]); +} + //============================================================================= // // Draws flat (floor/ceiling tile) aligned grid lines. // //============================================================================= -void AM_drawGrid (const AMColor &color) +void AM_drawGrid (int color) { fixed_t x, y; fixed_t start, end; @@ -1786,20 +1898,23 @@ void AM_drawSubsectors() static bool AM_CheckSecret(line_t *line) { - if (line->frontsector != NULL) + if (AMColors.isValid(AMColors.SecretSectorColor)) { - if (line->frontsector->secretsector) + if (line->frontsector != NULL) { - if (am_map_secrets!=0 && !(line->frontsector->special&SECRET_MASK)) return true; - if (am_map_secrets==2 && !(line->flags & ML_SECRET)) return true; + if (line->frontsector->secretsector) + { + if (am_map_secrets!=0 && !(line->frontsector->special&SECRET_MASK)) return true; + if (am_map_secrets==2 && !(line->flags & ML_SECRET)) return true; + } } - } - if (line->backsector != NULL) - { - if (line->backsector->secretsector) + if (line->backsector != NULL) { - if (am_map_secrets!=0 && !(line->backsector->special&SECRET_MASK)) return true; - if (am_map_secrets==2 && !(line->flags & ML_SECRET)) return true; + if (line->backsector->secretsector) + { + if (am_map_secrets!=0 && !(line->backsector->special&SECRET_MASK)) return true; + if (am_map_secrets==2 && !(line->flags & ML_SECRET)) return true; + } } } return false; @@ -1982,39 +2097,42 @@ void AM_drawWalls (bool allmap) if (AM_CheckSecret(&lines[i])) { // map secret sectors like Boom - AM_drawMline(&l, SecretSectorColor); + AM_drawMline(&l, AMColors.SecretSectorColor); } else if (lines[i].flags & ML_SECRET) { // secret door if (am_cheat != 0 && lines[i].backsector != NULL) - AM_drawMline(&l, SecretWallColor); + AM_drawMline(&l, AMColors.SecretWallColor); else - AM_drawMline(&l, WallColor); - } else if (lines[i].locknumber > 0) { // [Dusk] specials w/ locknumbers + AM_drawMline(&l, AMColors.WallColor); + } + else if (lines[i].locknumber > 0 && AMColors.displayLocks) + { // [Dusk] specials w/ locknumbers lock = lines[i].locknumber; color = P_GetMapColorForLock(lock); AMColor c; if (color >= 0) c.FromRGB(RPART(color), GPART(color), BPART(color)); - else c = LockedColor; + else c = AMColors[AMColors.LockedColor]; AM_drawMline (&l, c); - } else if ((lines[i].special == Teleport || + } + else if ((lines[i].special == Teleport || lines[i].special == Teleport_NoFog || lines[i].special == Teleport_ZombieChanger || lines[i].special == Teleport_Line) && (lines[i].activation & SPAC_PlayerActivate) && - am_colorset == 0) + AMColors.isValid(AMColors.IntraTeleportColor)) { // intra-level teleporters - AM_drawMline(&l, IntraTeleportColor); + AM_drawMline(&l, AMColors.IntraTeleportColor); } else if ((lines[i].special == Teleport_NewMap || lines[i].special == Teleport_EndGame || lines[i].special == Exit_Normal || lines[i].special == Exit_Secret) && - am_colorset == 0) + AMColors.isValid(AMColors.InterTeleportColor)) { // inter-level/game-ending teleporters - AM_drawMline(&l, InterTeleportColor); + AM_drawMline(&l, AMColors.InterTeleportColor); } else if (lines[i].special == Door_LockedRaise || lines[i].special == ACS_LockedExecute || @@ -2022,7 +2140,7 @@ void AM_drawWalls (bool allmap) (lines[i].special == Door_Animated && lines[i].args[3] != 0) || (lines[i].special == Generic_Door && lines[i].args[4] != 0)) { - if (am_colorset == 0 || am_colorset == 3) // Raven games show door colors + if (AMColors.displayLocks) { int P_GetMapColorForLock(int lock); @@ -2035,16 +2153,16 @@ void AM_drawWalls (bool allmap) AMColor c; if (color >= 0) c.FromRGB(RPART(color), GPART(color), BPART(color)); - else c = LockedColor; + else c = AMColors[AMColors.LockedColor]; AM_drawMline (&l, c); } else { - AM_drawMline (&l, LockedColor); // locked special + AM_drawMline (&l, AMColors.LockedColor); // locked special } } - else if (am_showtriggerlines && am_colorset == 0 && lines[i].special != 0 + else if (am_showtriggerlines && AMColors.isValid(AMColors.SpecialWallColor) && lines[i].special != 0 && lines[i].special != Door_Open && lines[i].special != Door_Close && lines[i].special != Door_CloseWaitOpen @@ -2053,31 +2171,31 @@ void AM_drawWalls (bool allmap) && lines[i].special != Generic_Door && (lines[i].activation & SPAC_PlayerActivate)) { - AM_drawMline(&l, SpecialWallColor); // wall with special non-door action the player can do + AM_drawMline(&l, AMColors.SpecialWallColor); // wall with special non-door action the player can do } else if (lines[i].backsector == NULL) { - AM_drawMline(&l, WallColor); // one-sided wall + AM_drawMline(&l, AMColors.WallColor); // one-sided wall } else if (lines[i].backsector->floorplane != lines[i].frontsector->floorplane) { - AM_drawMline(&l, FDWallColor); // floor level change + AM_drawMline(&l, AMColors.FDWallColor); // floor level change } else if (lines[i].backsector->ceilingplane != lines[i].frontsector->ceilingplane) { - AM_drawMline(&l, CDWallColor); // ceiling level change + AM_drawMline(&l, AMColors.CDWallColor); // ceiling level change } #ifdef _3DFLOORS else if (AM_Check3DFloors(&lines[i])) { - AM_drawMline(&l, EFWallColor); // Extra floor border + AM_drawMline(&l, AMColors.EFWallColor); // Extra floor border } #endif else if (am_cheat != 0) { - AM_drawMline(&l, TSWallColor); + AM_drawMline(&l, AMColors.TSWallColor); } } else if (allmap) @@ -2089,7 +2207,7 @@ void AM_drawWalls (bool allmap) continue; } } - AM_drawMline(&l, NotSeenColor); + AM_drawMline(&l, AMColors.NotSeenColor); } } } @@ -2239,7 +2357,7 @@ void AM_drawPlayers () arrow = &MapArrow[0]; numarrowlines = MapArrow.Size(); } - AM_drawLineCharacter(arrow, numarrowlines, 0, angle, YourColor, pt.x, pt.y); + AM_drawLineCharacter(arrow, numarrowlines, 0, angle, AMColors[AMColors.YourColor], pt.x, pt.y); return; } @@ -2266,7 +2384,7 @@ void AM_drawPlayers () if (p->mo->alpha < OPAQUE) { - color = AlmostBackground; + color = AMColors[AMColors.AlmostBackgroundColor]; } else { @@ -2322,7 +2440,6 @@ void AM_drawKeys () angle += ANG90 - players[consoleplayer].camera->angle; } - color = ThingColor; if (key->flags & MF_SPECIAL) { // Find the key's own color. @@ -2332,7 +2449,7 @@ void AM_drawKeys () int c = P_GetMapColorForKey(key); if (c >= 0) color.FromRGB(RPART(c), GPART(c), BPART(c)); - else color = ThingColor_CountItem; + else color = AMColors[AMColors.ThingColor_CountItem]; AM_drawLineCharacter(&EasyKey[0], EasyKey.Size(), 0, 0, color, p.x, p.y); } } @@ -2402,13 +2519,13 @@ void AM_drawThings () angle += ANG90 - players[consoleplayer].camera->angle; } - color = ThingColor; + color = AMColors[AMColors.ThingColor]; // use separate colors for special thing types if (t->flags3&MF3_ISMONSTER && !(t->flags&MF_CORPSE)) { - if (t->flags & MF_FRIENDLY || !(t->flags & MF_COUNTKILL)) color = ThingColor_Friend; - else color = ThingColor_Monster; + if (t->flags & MF_FRIENDLY || !(t->flags & MF_COUNTKILL)) color = AMColors[AMColors.ThingColor_Friend]; + else color = AMColors[AMColors.ThingColor_Monster]; } else if (t->flags&MF_SPECIAL) { @@ -2428,19 +2545,19 @@ void AM_drawThings () int c = P_GetMapColorForKey(static_cast(t)); if (c >= 0) color.FromRGB(RPART(c), GPART(c), BPART(c)); - else color = ThingColor_CountItem; + else color = AMColors[AMColors.ThingColor_CountItem]; AM_drawLineCharacter(&CheatKey[0], CheatKey.Size(), 0, 0, color, p.x, p.y); color.Index = -1; } else { - color = ThingColor_Item; + color = AMColors[AMColors.ThingColor_Item]; } } else if (t->flags&MF_COUNTITEM) - color = ThingColor_CountItem; + color = AMColors[AMColors.ThingColor_CountItem]; else - color = ThingColor_Item; + color = AMColors[AMColors.ThingColor_Item]; } if (color.Index != -1) @@ -2626,7 +2743,7 @@ void AM_Drawer () f_h = ST_Y; f_p = screen->GetPitch (); - AM_clearFB(Background); + AM_clearFB(AMColors[AMColors.Background]); } else { @@ -2642,7 +2759,7 @@ void AM_Drawer () AM_drawSubsectors(); if (grid) - AM_drawGrid(GridColor); + AM_drawGrid(AMColors.GridColor); AM_drawWalls(allmap); AM_drawPlayers(); @@ -2654,7 +2771,7 @@ void AM_Drawer () AM_drawAuthorMarkers(); if (!viewactive) - AM_drawCrosshair(XHairColor); + AM_drawCrosshair(AMColors[AMColors.XHairColor]); AM_drawMarks(); From 845020c6170aa982fa885cb78615b549d3c0cabb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 31 Jul 2013 23:13:20 +0200 Subject: [PATCH 4/7] - ovthingcolors were not properly set. - added all the missing color CVARs for the overlays which previously duplicated use of one of the other CVARs. --- src/am_map.cpp | 40 +++++++++++++++++++++------------------ wadsrc/static/menudef.txt | 7 +++++-- 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 466fe36ab..e2d32f737 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -87,6 +87,7 @@ CVAR (Int, am_map_secrets, 1, CVAR_ARCHIVE); CVAR (Bool, am_drawmapback, true, CVAR_ARCHIVE); CVAR (Bool, am_showkeys, true, CVAR_ARCHIVE); CVAR (Bool, am_showtriggerlines, false, CVAR_ARCHIVE); +CVAR (Int, am_showthingsprites, 0, CVAR_ARCHIVE); //============================================================================= // @@ -108,29 +109,32 @@ CVAR (Color, am_gridcolor, 0x8b5a2b, CVAR_ARCHIVE); CVAR (Color, am_xhaircolor, 0x808080, CVAR_ARCHIVE); CVAR (Color, am_notseencolor, 0x6c6c6c, CVAR_ARCHIVE); CVAR (Color, am_lockedcolor, 0x007800, CVAR_ARCHIVE); +CVAR (Color, am_intralevelcolor, 0x0000ff, CVAR_ARCHIVE); +CVAR (Color, am_interlevelcolor, 0xff0000, CVAR_ARCHIVE); +CVAR (Color, am_secretsectorcolor, 0xff00ff, CVAR_ARCHIVE); +CVAR (Color, am_thingcolor_friend, 0xfcfcfc, CVAR_ARCHIVE); +CVAR (Color, am_thingcolor_monster, 0xfcfcfc, CVAR_ARCHIVE); +CVAR (Color, am_thingcolor_item, 0xfcfcfc, CVAR_ARCHIVE); +CVAR (Color, am_thingcolor_citem, 0xfcfcfc, CVAR_ARCHIVE); + CVAR (Color, am_ovyourcolor, 0xfce8d8, CVAR_ARCHIVE); CVAR (Color, am_ovwallcolor, 0x00ff00, CVAR_ARCHIVE); +CVAR (Color, am_ovsecretwallcolor, 0x008844, CVAR_ARCHIVE); CVAR (Color, am_ovspecialwallcolor, 0xffffff, CVAR_ARCHIVE); -CVAR (Color, am_ovthingcolor, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovotherwallscolor, 0x008844, CVAR_ARCHIVE); +CVAR (Color, am_ovlockedcolor, 0x008844, CVAR_ARCHIVE); CVAR (Color, am_ovefwallcolor, 0x008844, CVAR_ARCHIVE); CVAR (Color, am_ovfdwallcolor, 0x008844, CVAR_ARCHIVE); CVAR (Color, am_ovcdwallcolor, 0x008844, CVAR_ARCHIVE); CVAR (Color, am_ovunseencolor, 0x00226e, CVAR_ARCHIVE); CVAR (Color, am_ovtelecolor, 0xffff00, CVAR_ARCHIVE); -CVAR (Color, am_intralevelcolor, 0x0000ff, CVAR_ARCHIVE); -CVAR (Color, am_interlevelcolor, 0xff0000, CVAR_ARCHIVE); -CVAR (Color, am_secretsectorcolor, 0xff00ff, CVAR_ARCHIVE); +CVAR (Color, am_ovinterlevelcolor, 0xffff00, CVAR_ARCHIVE); CVAR (Color, am_ovsecretsectorcolor,0x00ffff, CVAR_ARCHIVE); -CVAR (Color, am_thingcolor_friend, 0xfcfcfc, CVAR_ARCHIVE); -CVAR (Color, am_thingcolor_monster, 0xfcfcfc, CVAR_ARCHIVE); -CVAR (Color, am_thingcolor_item, 0xfcfcfc, CVAR_ARCHIVE); -CVAR (Color, am_thingcolor_citem, 0xfcfcfc, CVAR_ARCHIVE); +CVAR (Color, am_ovthingcolor, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_friend, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_monster, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_item, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_citem, 0xe88800, CVAR_ARCHIVE); -CVAR (Int, am_showthingsprites, 0, CVAR_ARCHIVE); //============================================================================= // @@ -293,23 +297,23 @@ static FColorCVar *cv_overlay[] = { &am_backcolor, // this will not be used in overlay mode &am_ovyourcolor, &am_ovwallcolor, - &am_ovspecialwallcolor, + &am_ovotherwallscolor, &am_ovfdwallcolor, &am_ovcdwallcolor, &am_ovefwallcolor, &am_ovthingcolor, - &am_ovthingcolor, - &am_ovthingcolor, - &am_ovthingcolor, - &am_ovthingcolor, + &am_ovthingcolor_item, + &am_ovthingcolor_citem, + &am_ovthingcolor_monster, + &am_ovthingcolor_friend, &am_ovspecialwallcolor, - &am_ovwallcolor, + &am_ovsecretwallcolor, &am_gridcolor, // this will not be used in overlay mode &am_xhaircolor, // this will not be used in overlay mode - &am_ovspecialwallcolor, - &am_ovspecialwallcolor, - &am_ovtelecolor, + &am_ovunseencolor, + &am_ovlockedcolor, &am_ovtelecolor, + &am_ovinterlevelcolor, &am_ovsecretsectorcolor }; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 6097643ba..6789c1436 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -1014,12 +1014,15 @@ OptionMenu MapColorMenu ColorPicker "2-sided walls with different ceilings", "am_ovcdwallcolor" ColorPicker "2-sided walls with 3D floors", "am_ovefwallcolor" ColorPicker "Not-yet-seen walls", "am_ovunseencolor" - ColorPicker "Locked doors", "am_ovotherwallscolor" - ColorPicker "Teleporter", "am_ovtelecolor" + ColorPicker "Locked doors", "am_ovlockedcolor" + ColorPicker "Teleporter to the same map", "am_ovtelecolor" + ColorPicker "Teleporter to a different map", "am_ovinterlevelcolor" ColorPicker "Secret sector", "am_ovsecretsectorcolor" ColorPicker "Special trigger lines", "am_ovspecialwallcolor" StaticText " " StaticText "Overlay Cheat Mode", 1 + ColorPicker "Invisible 2-sided walls", "am_ovotherwallscolor" + ColorPicker "Secret walls", "am_ovsecretwallcolor" ColorPicker "Actors", "am_ovthingcolor" ColorPicker "Monsters", "am_ovthingcolor_monster" ColorPicker "Friends", "am_ovthingcolor_friend" From 5c05f1f3cd315da3f4d5509dd6ffdc760eaa35a4 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 2 Aug 2013 10:17:06 +0300 Subject: [PATCH 5/7] - Ignored dehacked.exe from *.zip files to enable loading of *.deh files. --- src/resourcefiles/file_zip.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/resourcefiles/file_zip.cpp b/src/resourcefiles/file_zip.cpp index 7e59bd35a..101b51982 100644 --- a/src/resourcefiles/file_zip.cpp +++ b/src/resourcefiles/file_zip.cpp @@ -259,6 +259,13 @@ bool FZipFile::Open(bool quiet) lump_p->CompressedSize = LittleLong(zip_fh->CompressedSize); lump_p->Position = LittleLong(zip_fh->LocalHeaderOffset); lump_p->CheckEmbedded(); + + // Ignore some very specific names + if (0 == stricmp("dehacked.exe", name)) + { + memset(lump_p->Name, 0, sizeof(lump_p->Name)); + } + lump_p++; } // Resize the lump record array to its actual size From aa72857c72e8b5392efa213e9e9c89c8033432b1 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 2 Aug 2013 16:56:42 +0200 Subject: [PATCH 6/7] - implemented automap color parser for MAPINFO (code not tested yet!) --- src/am_map.cpp | 119 ++++++++++++++++++++++++++++++++++++++ src/g_level.h | 1 + src/g_mapinfo.cpp | 12 ++++ wadsrc/static/menudef.txt | 1 + 4 files changed, 133 insertions(+) diff --git a/src/am_map.cpp b/src/am_map.cpp index e2d32f737..6a765cd7a 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -83,6 +83,7 @@ CVAR (Bool, am_showitems, false, CVAR_ARCHIVE); CVAR (Bool, am_showtime, true, CVAR_ARCHIVE); CVAR (Bool, am_showtotaltime, false, CVAR_ARCHIVE); CVAR (Int, am_colorset, 0, CVAR_ARCHIVE); +CVAR (Bool, am_customcolors, true, CVAR_ARCHIVE); CVAR (Int, am_map_secrets, 1, CVAR_ARCHIVE); CVAR (Bool, am_drawmapback, true, CVAR_ARCHIVE); CVAR (Bool, am_showkeys, true, CVAR_ARCHIVE); @@ -177,6 +178,32 @@ struct AMColor // //============================================================================= +static const char *ColorNames[] = { + "Background", + "YourColor", + "WallColor", + "TwoSidedWallColor", + "FloorDiffWallColor", + "CeilingDiffWallColor", + "ExtraFloorWallColor", + "ThingColor", + "ThingColor_Item", + "ThingColor_CountItem", + "ThingColor_Monster", + "ThingColor_Friend", + "SpecialWallColor", + "SecretWallColor", + "GridColor", + "XHairColor", + "NotSeenColor", + "LockedColor", + "IntraTeleportColor", + "InterTeleportColor", + "SecretSectorColor", + "AlmostBackgroundColor", + NULL +}; + struct AMColorset { enum @@ -209,6 +236,7 @@ struct AMColorset AMColor c[AM_NUM_COLORS]; bool displayLocks; bool forcebackground; + bool defined; // only for mod specific colorsets: must be true to be usable void initFromCVars(FColorCVar **values) { @@ -252,6 +280,15 @@ struct AMColorset forcebackground = false; } + void setWhite() + { + c[0].FromRGB(0,0,0); + for(int i=1; i Date: Fri, 2 Aug 2013 18:15:39 +0200 Subject: [PATCH 7/7] - fixed typo in MENUDEFS. --- wadsrc/static/menudef.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index c722384bc..5331f5047 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -924,7 +924,7 @@ OptionMenu AutomapOptions { Title "AUTOMAP OPTIONS" Option "Map color set", "am_colorset", "MapColorTypes" - Option "Allow map defined colors" "am_customcolors", "YesNo" + Option "Allow map defined colors", "am_customcolors", "YesNo" Submenu "Set custom colors", "MapColorMenu" Submenu "Customize map controls", "MapControlsMenu" StaticText " "