diff --git a/specs/udmf_zdoom.txt b/specs/udmf_zdoom.txt index bdd70322eb..4fc57f8565 100644 --- a/specs/udmf_zdoom.txt +++ b/specs/udmf_zdoom.txt @@ -186,6 +186,7 @@ Note: All fields default to false unless mentioned otherwise. soundsequence = ; // The sound sequence to play when this sector moves. Placing a // sound sequence thing in the sector will override this property. hidden = ; // if true this sector will not be drawn on the textured automap. + waterzone = ; // Sector is under water and swimmable * Note about dropactors @@ -328,6 +329,9 @@ Added back locknumber property. 1.20 25.02.2012 Added arg0str thing property. +1.21 09.08.2013 +Added waterzone sector property. + =============================================================================== EOF =============================================================================== diff --git a/src/am_map.cpp b/src/am_map.cpp index 0c8293ebe5..bae48120d5 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -68,12 +68,81 @@ #include "a_keys.h" #include "r_data/colormaps.h" + +//============================================================================= +// +// CVARs +// +//============================================================================= + +CVAR (Int, am_rotate, 0, CVAR_ARCHIVE); +CVAR (Int, am_overlay, 0, CVAR_ARCHIVE); +CVAR (Bool, am_showsecrets, true, CVAR_ARCHIVE); +CVAR (Bool, am_showmonsters, true, CVAR_ARCHIVE); +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 (Int, am_drawmapback, 1, CVAR_ARCHIVE); +CVAR (Bool, am_showkeys, true, CVAR_ARCHIVE); +CVAR (Bool, am_showtriggerlines, false, CVAR_ARCHIVE); +CVAR (Int, am_showthingsprites, 0, CVAR_ARCHIVE); + //============================================================================= // // Automap colors // //============================================================================= +CVAR (Color, am_backcolor, 0x6c5440, CVAR_ARCHIVE); +CVAR (Color, am_yourcolor, 0xfce8d8, CVAR_ARCHIVE); +CVAR (Color, am_wallcolor, 0x2c1808, CVAR_ARCHIVE); +CVAR (Color, am_secretwallcolor, 0x000000, CVAR_ARCHIVE); +CVAR (Color, am_specialwallcolor, 0xffffff, CVAR_ARCHIVE); +CVAR (Color, am_tswallcolor, 0x888888, CVAR_ARCHIVE); +CVAR (Color, am_fdwallcolor, 0x887058, CVAR_ARCHIVE); +CVAR (Color, am_cdwallcolor, 0x4c3820, CVAR_ARCHIVE); +CVAR (Color, am_efwallcolor, 0x665555, CVAR_ARCHIVE); +CVAR (Color, am_thingcolor, 0xfcfcfc, CVAR_ARCHIVE); +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_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_ovinterlevelcolor, 0xffff00, CVAR_ARCHIVE); +CVAR (Color, am_ovsecretsectorcolor,0x00ffff, 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); + +//============================================================================= +// +// internal representation of a single color +// +//============================================================================= + struct AMColor { int Index; @@ -90,48 +159,367 @@ struct AMColor 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; + void setInvalid() + { + Index = -1; + RGB = -1; + } -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, + bool isValid() const + { + return Index > -1; + } }; //============================================================================= // -// globals +// a complete color set +// +//============================================================================= + +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 + { + 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; + bool defined; // only for mod specific colorsets: must be true to be usable + + void initFromCVars(FColorCVar **values) + { + for(int i=0;i MapArrow; static TArray CheatMapArrow; static TArray CheatKey; @@ -342,15 +698,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; @@ -560,21 +912,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]); - } } //============================================================================= @@ -910,131 +1247,39 @@ 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 = FDWallColor = CDWallColor = LockedColor; - TSWallColor.FromCVar (am_ovunseencolor); - NotSeenColor = TSWallColor; - InterTeleportColor.FromCVar (am_ovtelecolor); - IntraTeleportColor = InterTeleportColor; + if (am_customcolors && AMModOverlay.defined) + { + AMColors = AMModOverlay; + } + else + { + AMColors.initFromCVars(cv_overlay); + } + } + else if (am_customcolors && AMMod.defined) + { + AMColors = AMMod; } 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; } @@ -1363,7 +1608,17 @@ void AM_Ticker () void AM_clearFB (const AMColor &color) { - if (!mapback.isValid() || !am_drawmapback) + bool drawback = mapback.isValid() && am_drawmapback != 0; + if (am_drawmapback == 2) + { + // only draw background when using a mod defined custom color set or Raven colors, if am_drawmapback is 2. + if (!am_customcolors || !AMMod.defined) + { + drawback &= (am_colorset == 3); + } + } + + if (!drawback) { screen->Clear (0, 0, f_w, f_h, color.Index, color.RGB); } @@ -1536,13 +1791,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; @@ -1781,20 +2041,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; @@ -1966,7 +2229,7 @@ void AM_drawWalls (bool allmap) if (am_cheat != 0 || (lines[i].flags & ML_MAPPED)) { - if ((lines[i].flags & ML_DONTDRAW) && am_cheat == 0) + if ((lines[i].flags & ML_DONTDRAW) && (am_cheat == 0 || am_cheat >= 4)) { if (!am_showallenabled || CheckCheatmode(false)) { @@ -1977,39 +2240,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 || @@ -2017,7 +2283,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); @@ -2030,16 +2296,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 @@ -2048,43 +2314,43 @@ 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) + else if (am_cheat > 0 && am_cheat < 4) { - AM_drawMline(&l, TSWallColor); + AM_drawMline(&l, AMColors.TSWallColor); } } else if (allmap) { - if ((lines[i].flags & ML_DONTDRAW) && am_cheat == 0) + if ((lines[i].flags & ML_DONTDRAW) && (am_cheat == 0 || am_cheat >= 4)) { if (!am_showallenabled || CheckCheatmode(false)) { continue; } } - AM_drawMline(&l, NotSeenColor); + AM_drawMline(&l, AMColors.NotSeenColor); } } } @@ -2197,7 +2463,7 @@ AM_drawLineCharacter void AM_drawPlayers () { - if (am_cheat >= 2 && am_showthingsprites > 0) + if (am_cheat >= 2 && am_cheat != 4 && am_showthingsprites > 0) { // Player sprites are drawn with the others return; @@ -2234,7 +2500,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; } @@ -2261,7 +2527,7 @@ void AM_drawPlayers () if (p->mo->alpha < OPAQUE) { - color = AlmostBackground; + color = AMColors[AMColors.AlmostBackgroundColor]; } else { @@ -2317,7 +2583,6 @@ void AM_drawKeys () angle += ANG90 - players[consoleplayer].camera->angle; } - color = ThingColor; if (key->flags & MF_SPECIAL) { // Find the key's own color. @@ -2327,7 +2592,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); } } @@ -2397,13 +2662,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) { @@ -2423,19 +2688,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) @@ -2445,7 +2710,7 @@ void AM_drawThings () 16<= 3) + if (am_cheat == 3 || am_cheat == 6) { static const mline_t box[4] = { @@ -2621,7 +2886,7 @@ void AM_Drawer () f_h = ST_Y; f_p = screen->GetPitch (); - AM_clearFB(Background); + AM_clearFB(AMColors[AMColors.Background]); } else { @@ -2637,19 +2902,19 @@ void AM_Drawer () AM_drawSubsectors(); if (grid) - AM_drawGrid(GridColor); + AM_drawGrid(AMColors.GridColor); AM_drawWalls(allmap); AM_drawPlayers(); if (G_SkillProperty(SKILLP_EasyKey)) AM_drawKeys(); - if (am_cheat >= 2 || allthings) + if ((am_cheat >= 2 && am_cheat != 4) || allthings) AM_drawThings(); AM_drawAuthorMarkers(); if (!viewactive) - AM_drawCrosshair(XHairColor); + AM_drawCrosshair(AMColors[AMColors.XHairColor]); AM_drawMarks(); diff --git a/src/b_game.cpp b/src/b_game.cpp index a4c0a18428..ed3a5c8487 100644 --- a/src/b_game.cpp +++ b/src/b_game.cpp @@ -505,7 +505,7 @@ bool FCajunMaster::LoadBots () bool gotteam = false; bglobal.ForgetBots (); -#ifndef unix +#ifndef __unix__ tmp = progdir; tmp += "zcajun/" BOTFILENAME; if (!FileExists (tmp)) diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index ada1f93bad..0a94587ddb 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -49,6 +49,7 @@ #include "i_system.h" +#include "doomerrors.h" #include "doomstat.h" #include "gstrings.h" #include "s_sound.h" @@ -341,22 +342,30 @@ CCMD (changemap) if (argv.argc() > 1) { - if (!P_CheckMapData(argv[1])) + try { - Printf ("No map %s\n", argv[1]); - } - else - { - if (argv.argc() > 2) + if (!P_CheckMapData(argv[1])) { - Net_WriteByte (DEM_CHANGEMAP2); - Net_WriteByte (atoi(argv[2])); + Printf ("No map %s\n", argv[1]); } else { - Net_WriteByte (DEM_CHANGEMAP); + if (argv.argc() > 2) + { + Net_WriteByte (DEM_CHANGEMAP2); + Net_WriteByte (atoi(argv[2])); + } + else + { + Net_WriteByte (DEM_CHANGEMAP); + } + Net_WriteString (argv[1]); } - Net_WriteString (argv[1]); + } + catch(CRecoverableError &error) + { + if (error.GetMessage()) + Printf("%s", error.GetMessage()); } } else diff --git a/src/c_console.cpp b/src/c_console.cpp index 170cc97d44..0c02d0489b 100644 --- a/src/c_console.cpp +++ b/src/c_console.cpp @@ -1742,7 +1742,7 @@ static bool C_HandleKey (event_t *ev, BYTE *buffer, int len) } break; -#ifdef unix +#ifdef __unix__ case EV_GUI_MButtonDown: C_PasteText(I_GetFromClipboard(true), buffer, len); break; @@ -2121,7 +2121,20 @@ static bool C_TabCompleteList () Printf (TEXTCOLOR_BLUE "Completions for %s:\n", CmdLine+2); for (i = TabPos; nummatches > 0; ++i, --nummatches) { - Printf ("%-*s", int(maxwidth), TabCommands[i].TabName.GetChars()); + // [Dusk] Print console commands blue, CVars green, aliases red. + const char* colorcode = ""; + FConsoleCommand* ccmd; + if (FindCVar (TabCommands[i].TabName, NULL)) + colorcode = TEXTCOLOR_GREEN; + else if ((ccmd = FConsoleCommand::FindByName (TabCommands[i].TabName)) != NULL) + { + if (ccmd->IsAlias()) + colorcode = TEXTCOLOR_RED; + else + colorcode = TEXTCOLOR_LIGHTBLUE; + } + + Printf ("%s%-*s", colorcode, int(maxwidth), TabCommands[i].TabName.GetChars()); x += maxwidth; if (x > ConCols - maxwidth) { diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index d253549868..88dbc5d649 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -955,6 +955,11 @@ bool FConsoleCommand::AddToHash (FConsoleCommand **table) return true; } +FConsoleCommand* FConsoleCommand::FindByName (const char* name) +{ + return FindNameInHashTable (Commands, name, strlen (name)); +} + FConsoleCommand::FConsoleCommand (const char *name, CCmdRun runFunc) : m_RunFunc (runFunc) { @@ -1501,7 +1506,7 @@ CCMD (pullin) { const char *lastSlash; -#ifdef unix +#ifdef __unix__ lastSlash = strrchr (PullinFile, '/'); #else const char *lastSlash1, *lastSlash2; diff --git a/src/c_dispatch.h b/src/c_dispatch.h index 12ea559de3..96dc50644e 100644 --- a/src/c_dispatch.h +++ b/src/c_dispatch.h @@ -93,6 +93,7 @@ public: void PrintCommand () { Printf ("%s\n", m_Name); } virtual void Run (FCommandLine &args, APlayerPawn *instigator, int key); + static FConsoleCommand* FindByName (const char* name); FConsoleCommand *m_Next, **m_Prev; char *m_Name; diff --git a/src/ct_chat.cpp b/src/ct_chat.cpp index d99acda42d..c0c1f13f0a 100644 --- a/src/ct_chat.cpp +++ b/src/ct_chat.cpp @@ -169,7 +169,7 @@ bool CT_Responder (event_t *ev) } return true; } -#ifdef unix +#ifdef __unix__ else if (ev->subtype == EV_GUI_MButtonDown) { CT_PasteChat(I_GetFromClipboard(true)); diff --git a/src/d_dehacked.cpp b/src/d_dehacked.cpp index a375b34358..7311f6a7f7 100644 --- a/src/d_dehacked.cpp +++ b/src/d_dehacked.cpp @@ -1813,21 +1813,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; @@ -2383,6 +2383,18 @@ static int DoInclude (int dummy) return GetLine(); } +CVAR(Int, dehload, 0, CVAR_ARCHIVE) // Autoloading of .DEH lumps is disabled by default. + +// checks if lump is a .deh or .bex file. Only lumps in the root directory are considered valid. +static bool isDehFile(int lumpnum) +{ + const char* const fullName = Wads.GetLumpFullName(lumpnum); + const char* const extension = strrchr(fullName, '.'); + + return NULL != extension && strchr(fullName, '/') == NULL + && (0 == stricmp(extension, ".deh") || 0 == stricmp(extension, ".bex")); +} + int D_LoadDehLumps() { int lastlump = 0, lumpnum, count = 0; @@ -2392,23 +2404,29 @@ int D_LoadDehLumps() count += D_LoadDehLump(lumpnum); } - if (0 == PatchSize) + if (0 == PatchSize && dehload > 0) { // No DEH/BEX patch is loaded yet, try to find lump(s) with specific extensions - for (lumpnum = 0, lastlump = Wads.GetNumLumps(); - lumpnum < lastlump; - ++lumpnum) + if (dehload == 1) // load all .DEH lumps that are found. { - const char* const fullName = Wads.GetLumpFullName(lumpnum); - const char* const extension = strrchr(fullName, '.'); - - const bool isDehOrBex = NULL != extension - && (0 == stricmp(extension, ".deh") || 0 == stricmp(extension, ".bex")); - - if (isDehOrBex) + for (lumpnum = 0, lastlump = Wads.GetNumLumps(); lumpnum < lastlump; ++lumpnum) { - count += D_LoadDehLump(lumpnum); + if (isDehFile(lumpnum)) + { + count += D_LoadDehLump(lumpnum); + } + } + } + else // only load the last .DEH lump that is found. + { + for (lumpnum = Wads.GetNumLumps()-1; lumpnum >=0; --lumpnum) + { + if (isDehFile(lumpnum)) + { + count += D_LoadDehLump(lumpnum); + break; + } } } } @@ -2962,7 +2980,7 @@ void FinishDehPatch () PClassActor *subclass = static_cast(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/d_main.cpp b/src/d_main.cpp index 7d3ecb7469..f2097d3b4a 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -38,7 +38,7 @@ #endif #include -#if defined(unix) || defined(__APPLE__) +#if defined(__unix__) || defined(__APPLE__) #include #endif @@ -2029,7 +2029,7 @@ static void AddAutoloadFiles(const char *gamesection) D_AddFile (allwads, wad); // [RH] Add any .wad files in the skins directory -#ifdef unix +#ifdef __unix__ file = SHARE_DIR; #else file = progdir; @@ -2037,7 +2037,7 @@ static void AddAutoloadFiles(const char *gamesection) file += "skins"; D_AddDirectory (allwads, file); -#ifdef unix +#ifdef __unix__ file = NicePath("~/" GAME_DIR "/skins"); D_AddDirectory (allwads, file); #endif @@ -2157,7 +2157,7 @@ static void CheckCmdLine() Printf ("%s", GStrings("D_DEVSTR")); } -#if !defined(unix) && !defined(__APPLE__) +#if !defined(__unix__) && !defined(__APPLE__) // We do not need to support -cdrom under Unix, because all the files // that would go to c:\\zdoomdat are already stored in .zdoom inside // the user's home directory. diff --git a/src/d_player.h b/src/d_player.h index 839ea1b6e3..190689ca0e 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -161,8 +161,10 @@ public: FNameNoInit MorphWeapon; fixed_t AttackZOffset; // attack height, relative to player center fixed_t UseRange; // [NS] Distance at which player can +use + fixed_t AirCapacity; // Multiplier for air supply underwater. PClassActor *FlechetteType; + // [CW] Fades for when you are being damaged. PalEntry DamageFade; diff --git a/src/decallib.cpp b/src/decallib.cpp index ca9e066803..1bfe5142c0 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/g_doom/a_archvile.cpp b/src/g_doom/a_archvile.cpp index 1e69bb5558..1700191d2e 100644 --- a/src/g_doom/a_archvile.cpp +++ b/src/g_doom/a_archvile.cpp @@ -110,6 +110,10 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileTarget) // // A_VileAttack // + +// A_VileAttack flags +#define VAF_DMGTYPEAPPLYTODIRECT 1 + DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileAttack) { PARAM_ACTION_PROLOGUE; @@ -119,6 +123,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileAttack) PARAM_INT_OPT (blastrad) { blastrad = 70; } PARAM_FIXED_OPT (thrust) { thrust = FRACUNIT; } PARAM_NAME_OPT (dmgtype) { dmgtype = NAME_Fire; } + PARAM_INT_OPT (flags) { flags = 0; } AActor *fire, *target; angle_t an; @@ -132,7 +137,15 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_VileAttack) return 0; S_Sound (self, CHAN_WEAPON, snd, 1, ATTN_NORM); - int newdam = P_DamageMobj (target, self, self, dmg, NAME_None); + + int newdam; + + if (flags & VAF_DMGTYPEAPPLYTODIRECT) + newdam = P_DamageMobj (target, self, self, dmg, dmgtype); + + else + newdam = P_DamageMobj (target, self, self, dmg, NAME_None); + P_TraceBleed (newdam > 0 ? newdam : dmg, target); an = self->angle >> ANGLETOFINESHIFT; diff --git a/src/g_game.cpp b/src/g_game.cpp index f4ca6aded9..e1e88d0d19 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -865,7 +865,10 @@ static void ChangeSpy (int changespy) int pnum = consoleplayer; if (changespy != SPY_CANCEL) { - pnum = int(players[consoleplayer].camera->player - players); + player_t *player = players[consoleplayer].camera->player; + // only use the camera as starting index if it's a valid player. + if (player != NULL) pnum = int(players[consoleplayer].camera->player - players); + int step = (changespy == SPY_NEXT) ? 1 : -1; do @@ -1919,7 +1922,7 @@ FString G_BuildSaveName (const char *prefix, int slot) leader = Args->CheckValue ("-savedir"); if (leader.IsEmpty()) { -#if !defined(unix) && !defined(__APPLE__) +#if !defined(__unix__) && !defined(__APPLE__) if (Args->CheckParm ("-cdrom")) { leader = CDROM_DIR "/"; @@ -1931,7 +1934,7 @@ FString G_BuildSaveName (const char *prefix, int slot) } if (leader.IsEmpty()) { -#ifdef unix +#ifdef __unix__ leader = "~/" GAME_DIR; #elif defined(__APPLE__) char cpath[PATH_MAX]; diff --git a/src/g_level.cpp b/src/g_level.cpp index a452d55767..7e56d8843d 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -40,6 +40,7 @@ #include "s_sound.h" #include "d_event.h" #include "m_random.h" +#include "doomerrors.h" #include "doomstat.h" #include "wi_stuff.h" #include "w_wad.h" @@ -170,13 +171,21 @@ CCMD (map) } if (argv.argc() > 1) { - if (!P_CheckMapData(argv[1])) + try { - Printf ("No map %s\n", argv[1]); + if (!P_CheckMapData(argv[1])) + { + Printf ("No map %s\n", argv[1]); + } + else + { + G_DeferedInitNew (argv[1]); + } } - else + catch(CRecoverableError &error) { - G_DeferedInitNew (argv[1]); + if (error.GetMessage()) + Printf("%s", error.GetMessage()); } } else diff --git a/src/g_level.h b/src/g_level.h index 2cf8332026..a6b1f5aa1f 100644 --- a/src/g_level.h +++ b/src/g_level.h @@ -101,6 +101,7 @@ struct FMapInfoParser void ParseIntermissionAction(FIntermissionDescriptor *Desc); void ParseIntermission(); + void ParseAMColors(bool); FName CheckEndSequence(); FName ParseEndGame(); }; diff --git a/src/g_mapinfo.cpp b/src/g_mapinfo.cpp index cf469cbe89..6c5bea4561 100644 --- a/src/g_mapinfo.cpp +++ b/src/g_mapinfo.cpp @@ -1842,6 +1842,18 @@ void FMapInfoParser::ParseMapInfo (int lump, level_info_t &gamedefaults, level_i sc.ScriptError("intermission definitions not supported with old MAPINFO syntax"); } } + else if (sc.Compare("automap") || sc.Compare("automap_overlay")) + { + if (format_type != FMT_Old) + { + format_type = FMT_New; + ParseAMColors(sc.Compare("automap_overlay")); + } + else + { + sc.ScriptError("automap colorset definitions not supported with old MAPINFO syntax"); + } + } else { sc.ScriptError("%s: Unknown top level keyword", sc.String); diff --git a/src/g_shared/shared_sbar.cpp b/src/g_shared/shared_sbar.cpp index cc5d65e93e..86f5adc922 100644 --- a/src/g_shared/shared_sbar.cpp +++ b/src/g_shared/shared_sbar.cpp @@ -53,6 +53,7 @@ #include "d_player.h" #include "farchive.h" #include "a_hexenglobal.h" +#include "gstrings.h" #include "../version.h" @@ -1375,8 +1376,8 @@ void DBaseStatusBar::Draw (EHudState state) // Draw monster count if (am_showmonsters) { - mysnprintf (line, countof(line), "MONSTERS:" TEXTCOLOR_GREY " %d/%d", - level.killed_monsters, level.total_monsters); + mysnprintf (line, countof(line), "%s" TEXTCOLOR_GREY " %d/%d", + GStrings("AM_MONSTERS"), level.killed_monsters, level.total_monsters); screen->DrawText (SmallFont, highlight, 8, y, line, DTA_CleanNoMove, true, TAG_DONE); y += height; @@ -1385,8 +1386,8 @@ void DBaseStatusBar::Draw (EHudState state) // Draw secret count if (am_showsecrets) { - mysnprintf (line, countof(line), "SECRETS:" TEXTCOLOR_GREY " %d/%d", - level.found_secrets, level.total_secrets); + mysnprintf (line, countof(line), "%s" TEXTCOLOR_GREY " %d/%d", + GStrings("AM_SECRETS"), level.found_secrets, level.total_secrets); screen->DrawText (SmallFont, highlight, 8, y, line, DTA_CleanNoMove, true, TAG_DONE); y += height; @@ -1395,8 +1396,8 @@ void DBaseStatusBar::Draw (EHudState state) // Draw item count if (am_showitems) { - mysnprintf (line, countof(line), "ITEMS:" TEXTCOLOR_GREY " %d/%d", - level.found_items, level.total_items); + mysnprintf (line, countof(line), "%s" TEXTCOLOR_GREY " %d/%d", + GStrings("AM_ITEMS"), level.found_items, level.total_items); screen->DrawText (SmallFont, highlight, 8, y, line, DTA_CleanNoMove, true, TAG_DONE); } diff --git a/src/gameconfigfile.cpp b/src/gameconfigfile.cpp index 5c6fb0ce2e..211ef96c65 100644 --- a/src/gameconfigfile.cpp +++ b/src/gameconfigfile.cpp @@ -135,7 +135,7 @@ FGameConfigFile::FGameConfigFile () local_app_support << cpath << "/" GAME_DIR; SetValueForKey("Path", local_app_support, true); } -#elif !defined(unix) +#elif !defined(__unix__) SetValueForKey ("Path", "$HOME", true); SetValueForKey ("Path", "$PROGDIR", true); #else @@ -153,7 +153,7 @@ FGameConfigFile::FGameConfigFile () SetValueForKey ("Path", user_app_support, true); SetValueForKey ("Path", "$PROGDIR", true); SetValueForKey ("Path", local_app_support, true); -#elif !defined(unix) +#elif !defined(__unix__) SetValueForKey ("Path", "$PROGDIR", true); #else SetValueForKey ("Path", "~/" GAME_DIR, true); @@ -683,7 +683,7 @@ void FGameConfigFile::CreateStandardAutoExec(const char *section, bool start) { path << cpath << "/" GAME_DIR "/autoexec.cfg"; } -#elif !defined(unix) +#elif !defined(__unix__) path = "$PROGDIR/autoexec.cfg"; #else path = GetUserFile ("autoexec.cfg"); diff --git a/src/m_misc.cpp b/src/m_misc.cpp index a8c6b73802..e218cadc44 100644 --- a/src/m_misc.cpp +++ b/src/m_misc.cpp @@ -333,7 +333,7 @@ static long ParseCommandLine (const char *args, int *argc, char **argv) } -#if defined(unix) +#if defined(__unix__) FString GetUserFile (const char *file) { FString path; @@ -698,7 +698,7 @@ void M_ScreenShot (const char *filename) // find a file name to save it to if (filename == NULL || filename[0] == '\0') { -#if !defined(unix) && !defined(__APPLE__) +#if !defined(__unix__) && !defined(__APPLE__) if (Args->CheckParm ("-cdrom")) { autoname = CDROM_DIR "\\"; @@ -715,7 +715,7 @@ void M_ScreenShot (const char *filename) dirlen = autoname.Len(); if (dirlen == 0) { -#ifdef unix +#ifdef __unix__ autoname = "~/" GAME_DIR "/screenshots/"; #elif defined(__APPLE__) char cpath[PATH_MAX]; diff --git a/src/menu/loadsavemenu.cpp b/src/menu/loadsavemenu.cpp index 20779a221b..f16e1cbc22 100644 --- a/src/menu/loadsavemenu.cpp +++ b/src/menu/loadsavemenu.cpp @@ -131,7 +131,8 @@ void ClearSaveGames() { for(unsigned i=0;ibNoDelete) + delete DLoadSaveMenu::SaveGames[i]; } DLoadSaveMenu::SaveGames.Clear(); } @@ -344,7 +345,7 @@ void DLoadSaveMenu::NotifyNewSave (const char *file, const char *title, bool okF for (unsigned i=0; iFilename.Compare (file) == 0) #else if (node->Filename.CompareNoCase (file) == 0) diff --git a/src/menu/menudef.cpp b/src/menu/menudef.cpp index 00af179a5c..616bdf2ca3 100644 --- a/src/menu/menudef.cpp +++ b/src/menu/menudef.cpp @@ -158,7 +158,7 @@ static bool CheckSkipOptionBlock(FScanner &sc) } else if (sc.Compare("unix")) { - #ifdef unix + #ifdef __unix__ filter = true; #endif } diff --git a/src/namedef.h b/src/namedef.h index 1d0d95d79e..d995a4d68b 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -444,6 +444,7 @@ xx(Alphafloor) xx(Alphaceiling) xx(Renderstylefloor) xx(Renderstyleceiling) +xx(Waterzone) xx(offsetx_top) xx(offsety_top) diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 585c8e63da..abd420de40 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -3511,6 +3511,8 @@ enum APROP_Radius = 36, APROP_ReactionTime = 37, APROP_MeleeRange = 38, + APROP_ViewHeight = 39, + APROP_AttackZOffset = 40 }; // These are needed for ACS's APROP_RenderStyle @@ -3726,6 +3728,16 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value) actor->reactiontime = value; break; + case APROP_ViewHeight: + if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + static_cast(actor)->ViewHeight = value; + break; + + case APROP_AttackZOffset: + if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + static_cast(actor)->AttackZOffset = value; + break; + default: // do nothing. break; @@ -3798,6 +3810,23 @@ int DLevelScript::GetActorProperty (int tid, int property, const SDWORD *stack, case APROP_Radius: return actor->radius; case APROP_ReactionTime:return actor->reactiontime; case APROP_MeleeRange: return actor->meleerange; + case APROP_ViewHeight: if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + { + return static_cast(actor)->ViewHeight; + } + else + { + return 0; + } + case APROP_AttackZOffset: + if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + { + return static_cast(actor)->AttackZOffset; + } + else + { + return 0; + } case APROP_SeeSound: return GlobalACSStrings.AddString(actor->SeeSound, stack, stackdepth); case APROP_AttackSound: return GlobalACSStrings.AddString(actor->AttackSound, stack, stackdepth); @@ -3850,6 +3879,8 @@ int DLevelScript::CheckActorProperty (int tid, int property, int value) case APROP_Radius: case APROP_ReactionTime: case APROP_MeleeRange: + case APROP_ViewHeight: + case APROP_AttackZOffset: return (GetActorProperty(tid, property, NULL, 0) == value); // Boolean values need to compare to a binary version of value diff --git a/src/p_conversation.cpp b/src/p_conversation.cpp index fa907ab839..843bd99b90 100644 --- a/src/p_conversation.cpp +++ b/src/p_conversation.cpp @@ -1152,7 +1152,7 @@ void P_StartConversation (AActor *npc, AActor *pc, bool facetalker, bool saveang break; } } - if (jump) + if (jump && CurNode->ItemCheckNode > 0) { int root = pc->player->ConversationNPC->ConversationRoot; CurNode = StrifeDialogues[root + CurNode->ItemCheckNode - 1]; diff --git a/src/p_interaction.cpp b/src/p_interaction.cpp index 16e79b2c49..192630fe4d 100644 --- a/src/p_interaction.cpp +++ b/src/p_interaction.cpp @@ -739,9 +739,12 @@ void AActor::Die (AActor *source, AActor *inflictor, int dmgflags) { SetState (diestate); - tics -= pr_killmobj() & 3; - if (tics < 1) - tics = 1; + if (tics > 1) + { + tics -= pr_killmobj() & 3; + if (tics < 1) + tics = 1; + } } else { diff --git a/src/p_setup.cpp b/src/p_setup.cpp index a0f0b83ebb..6fe5d722c5 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -329,7 +329,15 @@ MapData *P_OpenMapData(const char * mapname) // Since levels must be stored in WADs they can't really have full // names and for any valid level lump this always returns the short name. const char * lumpname = Wads.GetLumpFullName(lump_name + i); - index = GetMapIndex(mapname, index, lumpname, i != 1 || Wads.LumpLength(lump_name + i) == 0); + try + { + index = GetMapIndex(mapname, index, lumpname, true); + } + catch(...) + { + delete map; + throw; + } if (index == ML_BEHAVIOR) map->HasBehavior = true; // The next lump is not part of this map anymore @@ -461,7 +469,15 @@ MapData *P_OpenMapData(const char * mapname) if (i>0) { - index = GetMapIndex(maplabel, index, lumpname, true); + try + { + index = GetMapIndex(maplabel, index, lumpname, true); + } + catch(...) + { + delete map; + throw; + } if (index == ML_BEHAVIOR) map->HasBehavior = true; // The next lump is not part of this map anymore diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index c1d18fd4c7..91e4c85650 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -1326,7 +1326,11 @@ public: continue; case NAME_hidden: - sec->MoreFlags |= SECF_HIDDEN; + Flag(sec->MoreFlags, SECF_HIDDEN, key); + break; + + case NAME_Waterzone: + Flag(sec->MoreFlags, SECF_UNDERWATER, key); break; default: diff --git a/src/p_usdf.cpp b/src/p_usdf.cpp index 372a8d0a6c..a63d1d5bc6 100644 --- a/src/p_usdf.cpp +++ b/src/p_usdf.cpp @@ -284,6 +284,7 @@ class USDFParser : public UDMFParserBase //node->ItemCheckCount[0] = node->ItemCheckCount[1] = node->ItemCheckCount[2] = -1; node->ThisNodeNum = StrifeDialogues.Push(node); + node->ItemCheckNode = -1; FString SpeakerName; FString Dialogue; diff --git a/src/p_user.cpp b/src/p_user.cpp index 0ace36a6b0..5cb505a7f6 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -560,6 +560,10 @@ void APlayerPawn::Serialize (FArchive &arc) { arc << UseRange; } + if (SaveVersion >= 4503) + { + arc << AirCapacity; + } } //=========================================================================== @@ -1149,7 +1153,7 @@ bool APlayerPawn::ResetAirSupply (bool playgasp) { S_Sound (this, CHAN_VOICE, "*gasp", 1, ATTN_NORM); } - if (level.airsupply> 0) player->air_finished = level.time + level.airsupply; + if (level.airsupply> 0 && player->mo->AirCapacity > 0) player->air_finished = level.time + FixedMul(level.airsupply, player->mo->AirCapacity); else player->air_finished = INT_MAX; return wasdrowning; } diff --git a/src/resourcefiles/file_zip.cpp b/src/resourcefiles/file_zip.cpp index 7e59bd35ad..101b519823 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 diff --git a/src/sdl/i_system.cpp b/src/sdl/i_system.cpp index 292da5930b..def35606a4 100644 --- a/src/sdl/i_system.cpp +++ b/src/sdl/i_system.cpp @@ -749,6 +749,8 @@ int I_FindClose (void *handle) findstate_t *state = (findstate_t *)handle; if (handle != (void*)-1 && state->count > 0) { + for(int i = 0;i < state->count;++i) + free (state->namelist[i]); state->count = 0; free (state->namelist); state->namelist = NULL; diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index c21ba40549..f832183c0d 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -816,7 +816,7 @@ bool FMODSoundRenderer::Init() } result = Sys->getNumDrivers(&driver); -#ifdef unix +#ifdef __unix__ if (result == FMOD_OK) { // On Linux, FMOD defaults to OSS. If OSS is not present, it doesn't diff --git a/src/sound/music_fluidsynth_mididevice.cpp b/src/sound/music_fluidsynth_mididevice.cpp index 53a93fe099..af8fe6667f 100644 --- a/src/sound/music_fluidsynth_mididevice.cpp +++ b/src/sound/music_fluidsynth_mididevice.cpp @@ -295,7 +295,7 @@ FluidSynthMIDIDevice::FluidSynthMIDIDevice() fluid_chorus_speed, fluid_chorus_depth, fluid_chorus_type); if (0 == LoadPatchSets(fluid_patchset)) { -#ifdef unix +#ifdef __unix__ // This is the standard location on Ubuntu. if (0 == LoadPatchSets("/usr/share/sounds/sf2/FluidR3_GS.sf2:/usr/share/sounds/sf2/FluidR3_GM.sf2")) { @@ -322,7 +322,7 @@ FluidSynthMIDIDevice::FluidSynthMIDIDevice() } } #endif -#ifdef unix +#ifdef __unix__ } #endif } diff --git a/src/textures/texturemanager.cpp b/src/textures/texturemanager.cpp index 0302ca5435..f28026f193 100644 --- a/src/textures/texturemanager.cpp +++ b/src/textures/texturemanager.cpp @@ -127,7 +127,7 @@ void FTextureManager::DeleteAll() { if (mAnimatedDoors[i].TextureFrames != NULL) { - delete mAnimatedDoors[i].TextureFrames; + delete[] mAnimatedDoors[i].TextureFrames; mAnimatedDoors[i].TextureFrames = NULL; } } diff --git a/src/thingdef/thingdef.h b/src/thingdef/thingdef.h index 6a1f4fb007..9835caa154 100644 --- a/src/thingdef/thingdef.h +++ b/src/thingdef/thingdef.h @@ -332,11 +332,11 @@ int MatchString (const char *in, const char **strings); #define DEFINE_MEMBER_VARIABLE(name, cls) \ - static FVariableInfo GlobalDef__##name = { #name, myoffsetof(cls, name), &RUNTIME_CLASS_CASTLESS(cls) }; \ + static FVariableInfo GlobalDef__##name = { #name, static_cast(myoffsetof(cls, name)), &RUNTIME_CLASS_CASTLESS(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_CASTLESS(cls) }; \ + static FVariableInfo GlobalDef__##name = { #name, static_cast(myoffsetof(cls, alias)), &RUNTIME_CLASS_CASTLESS(cls) }; \ MSVC_MSEG FVariableInfo *infoptr_GlobalDef__##name GCC_MSEG = &GlobalDef__##name; diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index 12cb318b10..7472d38060 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -447,7 +447,7 @@ DEFINE_PROPERTY(skip_super, 0, Actor) return; } - memcpy (defaults, GetDefault(), sizeof(AActor)); + memcpy ((void *)defaults, (void *)GetDefault(), sizeof(AActor)); ResetBaggage (&bag, RUNTIME_CLASS(AActor)); } @@ -2471,6 +2471,15 @@ DEFINE_CLASS_PROPERTY_PREFIX(player, userange, F, PlayerPawn) defaults->UseRange = z; } +//========================================================================== +// +//========================================================================== +DEFINE_CLASS_PROPERTY_PREFIX(player, aircapacity, F, PlayerPawn) +{ + PROP_FIXED_PARM(z, 0); + defaults->AirCapacity = z; +} + //========================================================================== // //========================================================================== diff --git a/src/timidity/instrum.cpp b/src/timidity/instrum.cpp index 55683cb4e1..5ab55201e0 100644 --- a/src/timidity/instrum.cpp +++ b/src/timidity/instrum.cpp @@ -166,7 +166,7 @@ static Instrument *load_instrument(Renderer *song, const char *name, int percuss tmp += ".pat"; if ((fp = open_filereader(tmp, openmode, NULL)) == NULL) { -#ifdef unix // Windows isn't case-sensitive. +#ifdef __unix__ // Windows isn't case-sensitive. tmp.ToUpper(); if ((fp = open_filereader(tmp, openmode, NULL)) == NULL) #endif diff --git a/src/version.h b/src/version.h index 8bdd8ca818..4a2cc07019 100644 --- a/src/version.h +++ b/src/version.h @@ -76,7 +76,7 @@ const char *GetVersionString(); // Use 4500 as the base git save version, since it's higher than the // SVN revision ever got. -#define SAVEVER 4502 +#define SAVEVER 4503 #define SAVEVERSTRINGIFY2(x) #x #define SAVEVERSTRINGIFY(x) SAVEVERSTRINGIFY2(x) @@ -91,7 +91,7 @@ const char *GetVersionString(); #define FORUM_URL "http://forum.zdoom.org" #define BUGS_FORUM_URL "http://forum.zdoom.org/index.php?c=3" -#ifdef unix +#ifdef __unix__ #define GAME_DIR ".config/zdoom" #elif defined(__APPLE__) #define GAME_DIR GAMENAME diff --git a/wadsrc/static/actors/actor.txt b/wadsrc/static/actors/actor.txt index 939b730704..ade730ee7d 100644 --- a/wadsrc/static/actors/actor.txt +++ b/wadsrc/static/actors/actor.txt @@ -84,7 +84,7 @@ ACTOR Actor native //: Thinker action native A_VileChase(); action native A_VileStart(); action native A_VileTarget(class fire = "ArchvileFire"); - action native A_VileAttack(sound snd = "vile/stop", int initialdmg = 20, int blastdmg = 70, int blastradius = 70, float thrustfac = 1.0, name damagetype = "Fire"); + action native A_VileAttack(sound snd = "vile/stop", int initialdmg = 20, int blastdmg = 70, int blastradius = 70, float thrustfac = 1.0, name damagetype = "Fire", int flags = 0); action native A_StartFire(); action native A_Fire(float spawnheight = 0); action native A_FireCrackle(); diff --git a/wadsrc/static/actors/constants.txt b/wadsrc/static/actors/constants.txt index 2c38c242e9..da9493f1c2 100644 --- a/wadsrc/static/actors/constants.txt +++ b/wadsrc/static/actors/constants.txt @@ -4,6 +4,9 @@ const int PAF_NOSKULLATTACK = 1; const int PAF_AIMFACING = 2; const int PAF_NOTARGET = 4; +// Flags for A_VileAttack +const int VAF_DMGTYPEAPPLYTODIRECT = 1; + // Flags for A_Saw const int SF_NORANDOM = 1; const int SF_RANDOMLIGHTMISS = 2; diff --git a/wadsrc/static/actors/shared/player.txt b/wadsrc/static/actors/shared/player.txt index 5457880a76..159d4cca94 100644 --- a/wadsrc/static/actors/shared/player.txt +++ b/wadsrc/static/actors/shared/player.txt @@ -32,6 +32,7 @@ Actor PlayerPawn : Actor native Player.DamageScreenColor "ff 00 00" Player.MugShotMaxHealth 0 Player.FlechetteType "ArtiPoisonBag3" + Player.AirCapacity 1 Obituary "$OB_MPDEFAULT" } diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 4b5225f547..8a0a5f4ee6 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -1615,6 +1615,10 @@ MNU_EPISODE = "Select Episode"; WI_FINISHED = "finished"; WI_ENTERING = "Now entering:"; +AM_MONSTERS = "Monsters:"; +AM_SECRETS = "Secrets:"; +AM_ITEMS = "Items:"; + // Bloodbath announcer BBA_BONED = "%k boned %o like a fish"; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 21f19c1068..b2a46469a6 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -850,6 +850,13 @@ OptionValue Autosave 2, "Never" } +OptionValue dehopt +{ + 0, "Never" + 1, "All" + 2, "Only last one" +} + OptionMenu "MiscOptions" { Title "Miscellaneous Options" @@ -864,6 +871,7 @@ OptionMenu "MiscOptions" Option "Enable cheats from all games", "allcheats", "OnOff" Option "Enable autosaves", "disableautosave", "Autosave" Slider "Number of autosaves", "autosavecount", 1, 20, 1, 0 + Option "Load *.deh/*.bex lumps", "dehload", "dehopt" StaticText " " Option "Cache nodes", "gl_cachenodes", "OnOff" Slider "Time threshold for node caching", "gl_cachetime", 0.0, 2.0, 0.1 @@ -920,10 +928,18 @@ OptionValue STSTypes 3, "Rotated" } +OptionValue MapBackTypes +{ + 0, "Off" + 1, "On" + 2, "Map defined colors only" +} + OptionMenu AutomapOptions { Title "AUTOMAP OPTIONS" Option "Map color set", "am_colorset", "MapColorTypes" + Option "Allow map defined colors", "am_customcolors", "YesNo" Submenu "Set custom colors", "MapColorMenu" Submenu "Customize map controls", "MapControlsMenu" StaticText " " @@ -939,7 +955,7 @@ OptionMenu AutomapOptions Option "Show total time elapsed", "am_showtotaltime", "OnOff" Option "Show secrets on map", "am_map_secrets", "SecretTypes" Option "Show map label", "am_showmaplabel", "MaplabelTypes" - Option "Draw map background", "am_drawmapback", "OnOff" + Option "Draw map background", "am_drawmapback", "MapBackTypes" Option "Show keys (cheat)", "am_showkeys", "OnOff" Option "Show trigger lines", "am_showtriggerlines", "OnOff" Option "Show things as sprites", "am_showthingsprites", "STSTypes" @@ -1010,13 +1026,19 @@ OptionMenu MapColorMenu StaticText "Overlay Mode", 1 ColorPicker "You", "am_ovyourcolor" ColorPicker "1-sided walls", "am_ovwallcolor" - ColorPicker "2-sided walls", "am_ovotherwallscolor" + ColorPicker "2-sided walls with different floors", "am_ovfdwallcolor" + 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 "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"