diff --git a/src/am_map.cpp b/src/am_map.cpp index 6fde814bf..8fab7e5ac 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -121,6 +121,7 @@ CVAR (Color, am_thingcolor_monster, 0xfcfcfc, CVAR_ARCHIVE); CVAR (Color, am_thingcolor_ncmonster, 0xfcfcfc, CVAR_ARCHIVE); CVAR (Color, am_thingcolor_item, 0xfcfcfc, CVAR_ARCHIVE); CVAR (Color, am_thingcolor_citem, 0xfcfcfc, CVAR_ARCHIVE); +CVAR (Color, am_portalcolor, 0x404040, CVAR_ARCHIVE); CVAR (Color, am_ovyourcolor, 0xfce8d8, CVAR_ARCHIVE); CVAR (Color, am_ovwallcolor, 0x00ff00, CVAR_ARCHIVE); @@ -141,6 +142,7 @@ CVAR (Color, am_ovthingcolor_monster, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_ncmonster, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_item, 0xe88800, CVAR_ARCHIVE); CVAR (Color, am_ovthingcolor_citem, 0xe88800, CVAR_ARCHIVE); +CVAR (Color, am_ovportalcolor, 0x004022, CVAR_ARCHIVE); //============================================================================= // @@ -206,6 +208,7 @@ static const char *ColorNames[] = { "IntraTeleportColor", "InterTeleportColor", "SecretSectorColor", + "PortalColor", "AlmostBackgroundColor", NULL }; @@ -236,6 +239,7 @@ struct AMColorset IntraTeleportColor, InterTeleportColor, SecretSectorColor, + PortalColor, AlmostBackgroundColor, AM_NUM_COLORS }; @@ -335,7 +339,8 @@ static FColorCVar *cv_standard[] = { &am_lockedcolor, &am_intralevelcolor, &am_interlevelcolor, - &am_secretsectorcolor + &am_secretsectorcolor, + &am_portalcolor }; static FColorCVar *cv_overlay[] = { @@ -360,7 +365,8 @@ static FColorCVar *cv_overlay[] = { &am_ovlockedcolor, &am_ovtelecolor, &am_ovinterlevelcolor, - &am_ovsecretsectorcolor + &am_ovsecretsectorcolor, + &am_ovportalcolor }; CCMD(am_restorecolors) @@ -403,6 +409,7 @@ static unsigned char DoomColors[]= { NOT_USED, // interteleport NOT_USED, // secretsector 0x10,0x10,0x10, // almostbackground + 0x40,0x40,0x40 // portal }; static unsigned char StrifeColors[]= { @@ -429,6 +436,7 @@ static unsigned char StrifeColors[]= { NOT_USED, // interteleport NOT_USED, // secretsector 0x10,0x10,0x10, // almostbackground + 0x40,0x40,0x40 // portal }; static unsigned char RavenColors[]= { @@ -455,6 +463,7 @@ static unsigned char RavenColors[]= { NOT_USED, // interteleport NOT_USED, // secretsector 0x10,0x10,0x10, // almostbackground + 0x50,0x50,0x50 // portal }; #undef NOT_USED @@ -577,6 +586,7 @@ inline fixed_t MTOF(fixed_t x) static int bigstate = 0; static bool textured = 1; // internal toggle for texture mode +static int MapPortalGroup; CUSTOM_CVAR(Bool, am_textured, false, CVAR_ARCHIVE) { @@ -812,6 +822,7 @@ void AM_minOutWindowScale (); CVAR(Bool, am_followplayer, true, CVAR_ARCHIVE) +CVAR(Bool, am_portaloverlay, true, CVAR_ARCHIVE) CCMD(am_togglefollow) @@ -1925,6 +1936,12 @@ void AM_drawSubsectors() { continue; } + + if (am_portaloverlay && subsectors[i].render_sector->PortalGroup != MapPortalGroup && subsectors[i].render_sector->PortalGroup != 0) + { + continue; + } + // Fill the points array from the subsector. points.Resize(subsectors[i].numlines); for (DWORD j = 0; j < subsectors[i].numlines; ++j) @@ -2389,108 +2406,143 @@ void AM_drawWalls (bool allmap) static mline_t l; int lock, color; - for (i = 0; i < numlines; i++) + int numportalgroups = am_portaloverlay ? Displacements.size : 0; + + for (int p = numportalgroups - 1; p >= -1; p--) { - l.a.x = lines[i].v1->x >> FRACTOMAPBITS; - l.a.y = lines[i].v1->y >> FRACTOMAPBITS; - l.b.x = lines[i].v2->x >> FRACTOMAPBITS; - l.b.y = lines[i].v2->y >> FRACTOMAPBITS; + if (p == MapPortalGroup) continue; - if (am_rotate == 1 || (am_rotate == 2 && viewactive)) + + for (i = 0; i < numlines; i++) { - AM_rotatePoint (&l.a.x, &l.a.y); - AM_rotatePoint (&l.b.x, &l.b.y); - } - - if (am_cheat != 0 || (lines[i].flags & ML_MAPPED)) - { - if ((lines[i].flags & ML_DONTDRAW) && (am_cheat == 0 || am_cheat >= 4)) + int pg; + + if (lines[i].sidedef[0]->Flags & WALLF_POLYOBJ) { - if (!am_showallenabled || CheckCheatmode(false)) + // For polyobjects we must test the surrounding sector to get the proper group. + pg = P_PointInSector(lines[i].v1->x + lines[i].dx / 2, lines[i].v1->y + lines[i].dy / 2)->PortalGroup; + } + else + { + pg = lines[i].frontsector->PortalGroup; + } + fixedvec2 offset; + bool portalmode = numportalgroups > 0 && pg != MapPortalGroup; + if (pg == p) + { + offset = Displacements.getOffset(pg, MapPortalGroup); + } + else if (p == -1 && (pg == MapPortalGroup || !am_portaloverlay)) + { + offset = { 0, 0 }; + } + else continue; + + l.a.x = (lines[i].v1->x + offset.x) >> FRACTOMAPBITS; + l.a.y = (lines[i].v1->y + offset.y) >> FRACTOMAPBITS; + l.b.x = (lines[i].v2->x + offset.x) >> FRACTOMAPBITS; + l.b.y = (lines[i].v2->y + offset.y) >> FRACTOMAPBITS; + + if (am_rotate == 1 || (am_rotate == 2 && viewactive)) + { + AM_rotatePoint(&l.a.x, &l.a.y); + AM_rotatePoint(&l.b.x, &l.b.y); + } + + if (am_cheat != 0 || (lines[i].flags & ML_MAPPED)) + { + if ((lines[i].flags & ML_DONTDRAW) && (am_cheat == 0 || am_cheat >= 4)) { - continue; + if (!am_showallenabled || CheckCheatmode(false)) + { + continue; + } + } + + if (portalmode) + { + AM_drawMline(&l, AMColors.PortalColor); + } + else if (AM_CheckSecret(&lines[i])) + { + // map secret sectors like Boom + 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, AMColors.SecretWallColor); + else + AM_drawMline(&l, AMColors.WallColor); + } + else if (AM_isTeleportBoundary(lines[i]) && AMColors.isValid(AMColors.IntraTeleportColor)) + { // intra-level teleporters + AM_drawMline(&l, AMColors.IntraTeleportColor); + } + else if (AM_isExitBoundary(lines[i]) && AMColors.isValid(AMColors.InterTeleportColor)) + { // inter-level/game-ending teleporters + AM_drawMline(&l, AMColors.InterTeleportColor); + } + else if (AM_isLockBoundary(lines[i], &lock)) + { + if (AMColors.displayLocks) + { + color = P_GetMapColorForLock(lock); + + AMColor c; + + if (color >= 0) c.FromRGB(RPART(color), GPART(color), BPART(color)); + else c = AMColors[AMColors.LockedColor]; + + AM_drawMline(&l, c); + } + else + { + AM_drawMline(&l, AMColors.LockedColor); // locked special + } + } + else if (am_showtriggerlines + && AMColors.isValid(AMColors.SpecialWallColor) + && AM_isTriggerBoundary(lines[i])) + { + AM_drawMline(&l, AMColors.SpecialWallColor); // wall with special non-door action the player can do + } + else if (lines[i].backsector == NULL) + { + AM_drawMline(&l, AMColors.WallColor); // one-sided wall + } + else if (lines[i].backsector->floorplane + != lines[i].frontsector->floorplane) + { + AM_drawMline(&l, AMColors.FDWallColor); // floor level change + } + else if (lines[i].backsector->ceilingplane + != lines[i].frontsector->ceilingplane) + { + AM_drawMline(&l, AMColors.CDWallColor); // ceiling level change + } + else if (AM_Check3DFloors(&lines[i])) + { + AM_drawMline(&l, AMColors.EFWallColor); // Extra floor border + } + else if (am_cheat > 0 && am_cheat < 4) + { + AM_drawMline(&l, AMColors.TSWallColor); } } - - if (AM_CheckSecret(&lines[i])) + else if (allmap) { - // map secret sectors like Boom - 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, AMColors.SecretWallColor); - else - AM_drawMline(&l, AMColors.WallColor); - } - else if (AM_isTeleportBoundary(lines[i]) && AMColors.isValid(AMColors.IntraTeleportColor)) - { // intra-level teleporters - AM_drawMline(&l, AMColors.IntraTeleportColor); - } - else if (AM_isExitBoundary(lines[i]) && AMColors.isValid(AMColors.InterTeleportColor)) - { // inter-level/game-ending teleporters - AM_drawMline(&l, AMColors.InterTeleportColor); - } - else if (AM_isLockBoundary(lines[i], &lock)) - { - if (AMColors.displayLocks) + if ((lines[i].flags & ML_DONTDRAW) && (am_cheat == 0 || am_cheat >= 4)) { - color = P_GetMapColorForLock(lock); - - AMColor c; - - if (color >= 0) c.FromRGB(RPART(color), GPART(color), BPART(color)); - else c = AMColors[AMColors.LockedColor]; - - AM_drawMline (&l, c); + if (!am_showallenabled || CheckCheatmode(false)) + { + continue; + } } - else - { - AM_drawMline (&l, AMColors.LockedColor); // locked special - } - } - else if (am_showtriggerlines - && AMColors.isValid(AMColors.SpecialWallColor) - && AM_isTriggerBoundary(lines[i])) - { - AM_drawMline(&l, AMColors.SpecialWallColor); // wall with special non-door action the player can do - } - else if (lines[i].backsector == NULL) - { - AM_drawMline(&l, AMColors.WallColor); // one-sided wall - } - else if (lines[i].backsector->floorplane - != lines[i].frontsector->floorplane) - { - AM_drawMline(&l, AMColors.FDWallColor); // floor level change - } - else if (lines[i].backsector->ceilingplane - != lines[i].frontsector->ceilingplane) - { - AM_drawMline(&l, AMColors.CDWallColor); // ceiling level change - } - else if (AM_Check3DFloors(&lines[i])) - { - AM_drawMline(&l, AMColors.EFWallColor); // Extra floor border - } - else if (am_cheat > 0 && am_cheat < 4) - { - AM_drawMline(&l, AMColors.TSWallColor); + AM_drawMline(&l, AMColors.NotSeenColor); } } - else if (allmap) - { - if ((lines[i].flags & ML_DONTDRAW) && (am_cheat == 0 || am_cheat >= 4)) - { - if (!am_showallenabled || CheckCheatmode(false)) - { - continue; - } - } - AM_drawMline(&l, AMColors.NotSeenColor); - } - } + } } @@ -2616,8 +2668,9 @@ void AM_drawPlayers () mline_t *arrow; int numarrowlines; - pt.x = players[consoleplayer].camera->X() >> FRACTOMAPBITS; - pt.y = players[consoleplayer].camera->Y() >> FRACTOMAPBITS; + fixedvec2 pos = am_portaloverlay? players[consoleplayer].camera->GetPortalTransition(players[consoleplayer].viewheight) : (fixedvec2)players[consoleplayer].camera->Pos(); + pt.x = pos.x >> FRACTOMAPBITS; + pt.y = pos.y >> FRACTOMAPBITS; if (am_rotate == 1 || (am_rotate == 2 && viewactive)) { angle = ANG90; @@ -2679,8 +2732,10 @@ void AM_drawPlayers () if (p->mo != NULL) { - pt.x = p->mo->X() >> FRACTOMAPBITS; - pt.y = p->mo->Y() >> FRACTOMAPBITS; + fixedvec3 pos = p->mo->PosRelative(MapPortalGroup); + pt.x = pos.x >> FRACTOMAPBITS; + pt.y = pos.y >> FRACTOMAPBITS; + angle = p->mo->angle; if (am_rotate == 1 || (am_rotate == 2 && viewactive)) @@ -2711,8 +2766,10 @@ void AM_drawKeys () while ((key = it.Next()) != NULL) { - p.x = key->X() >> FRACTOMAPBITS; - p.y = key->Y() >> FRACTOMAPBITS; + fixedvec3 pos = key->PosRelative(MapPortalGroup); + p.x = pos.x >> FRACTOMAPBITS; + p.y = pos.y >> FRACTOMAPBITS; + angle = key->angle; if (am_rotate == 1 || (am_rotate == 2 && viewactive)) @@ -2756,8 +2813,9 @@ void AM_drawThings () { if (am_cheat > 0 || !(t->flags6 & MF6_NOTONAUTOMAP)) { - p.x = t->X() >> FRACTOMAPBITS; - p.y = t->Y() >> FRACTOMAPBITS; + fixedvec3 pos = t->PosRelative(MapPortalGroup); + p.x = pos.x >> FRACTOMAPBITS; + p.y = pos.y >> FRACTOMAPBITS; if (am_showthingsprites > 0 && t->sprite > 0) { @@ -3017,6 +3075,13 @@ void AM_Drawer () bool allmap = (level.flags2 & LEVEL2_ALLMAP) != 0; bool allthings = allmap && players[consoleplayer].mo->FindInventory(RUNTIME_CLASS(APowerScanner), true) != NULL; + if (am_portaloverlay) + { + sector_t *sec; + players[consoleplayer].camera->GetPortalTransition(players[consoleplayer].viewheight, &sec); + MapPortalGroup = sec->PortalGroup; + } + else MapPortalGroup = 0; AM_initColors (viewactive); if (!viewactive) diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index e507a8d68..3217c7fce 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -1880,6 +1880,7 @@ AUTOMAPMNU_DRAWMAPBACK = "Draw map background"; AUTOMAPMNU_SHOWKEYS = "Show keys (cheat)"; AUTOMAPMNU_SHOWTRIGGERLINES = "Show trigger lines"; AUTOMAPMNU_SHOWTHINGSPRITES = "Show things as sprites"; +AUTOMAPMNU_PTOVERLAY = "Overlay portals"; // Automap Controls MAPCNTRLMNU_TITLE = "CUSTOMIZE MAP CONTROLS"; @@ -1925,6 +1926,7 @@ MAPCOLORMNU_ITEMCOLOR = "Items"; MAPCOLORMNU_COUNTITEMCOLOR = "Count Items"; MAPCOLORMNU_OVERLAY = "Overlay Mode"; MAPCOLORMNU_OVCHEATMODE = "Overlay Cheat Mode"; +MAPCOLORMNU_PORTAL = "Portal Overlays"; // Message Options MSGMNU_TITLE = "MESSAGES"; diff --git a/wadsrc/static/menudef.txt b/wadsrc/static/menudef.txt index 19b5cd771..d74a3e3f0 100644 --- a/wadsrc/static/menudef.txt +++ b/wadsrc/static/menudef.txt @@ -970,6 +970,7 @@ OptionMenu AutomapOptions Option "$AUTOMAPMNU_OVERLAY", "am_overlay", "OverlayTypes" Option "$AUTOMAPMNU_TEXTURED", "am_textured", "OnOff" Option "$AUTOMAPMNU_FOLLOW", "am_followplayer", "OnOff" + Option "$AUTOMAPMNU_PTOVERLAY", "am_portaloverlay", "OnOff" StaticText " " Option "$AUTOMAPMNU_SHOWITEMS", "am_showitems", "OnOff" Option "$AUTOMAPMNU_SHOWMONSTERS", "am_showmonsters", "OnOff" @@ -1036,6 +1037,7 @@ OptionMenu MapColorMenu ColorPicker "$MAPCOLORMNU_INTERLEVELCOLOR", "am_interlevelcolor" ColorPicker "$MAPCOLORMNU_SECRETSECTORCOLOR", "am_secretsectorcolor" ColorPicker "$MAPCOLORMNU_SPECIALWALLCOLOR", "am_specialwallcolor" + ColorPicker "$MAPCOLORMNU_PORTAL", "am_portalcolor" StaticText " " StaticText "$MAPCOLORMNU_CHEATMODE", 1 ColorPicker "$MAPCOLORMNU_TSWALLCOLOR", "am_tswallcolor" @@ -1059,6 +1061,7 @@ OptionMenu MapColorMenu ColorPicker "$MAPCOLORMNU_INTERLEVELCOLOR", "am_ovinterlevelcolor" ColorPicker "$MAPCOLORMNU_SECRETSECTORCOLOR", "am_ovsecretsectorcolor" ColorPicker "$MAPCOLORMNU_SPECIALWALLCOLOR", "am_ovspecialwallcolor" + ColorPicker "$MAPCOLORMNU_PORTAL", "am_ovportalcolor" StaticText " " StaticText "$MAPCOLORMNU_OVCHEATMODE", 1 ColorPicker "$MAPCOLORMNU_TSWALLCOLOR", "am_ovotherwallscolor"