diff --git a/src/am_map.cpp b/src/am_map.cpp index 45cb3f980..ce2c55979 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -287,53 +287,9 @@ struct islope_t // A line drawing of the player pointing right, // starting from the middle. // -#define R ((8*PLAYERRADIUS)/7) -mline_t player_arrow[] = { - { { -R+R/8, 0 }, { R, 0 } }, // ----- - { { R, 0 }, { R-R/2, R/4 } }, // -----> - { { R, 0 }, { R-R/2, -R/4 } }, - { { -R+R/8, 0 }, { -R-R/8, R/4 } }, // >----> - { { -R+R/8, 0 }, { -R-R/8, -R/4 } }, - { { -R+3*R/8, 0 }, { -R+R/8, R/4 } }, // >>---> - { { -R+3*R/8, 0 }, { -R+R/8, -R/4 } } -}; -#define NUMPLYRLINES (sizeof(player_arrow)/sizeof(mline_t)) - -mline_t player_arrow_raven[] = { - { { -R+R/4, 0 }, { 0, 0} }, // center line. - { { -R+R/4, R/8 }, { R, 0} }, // blade - { { -R+R/4, -R/8 }, { R, 0 } }, - { { -R+R/4, -R/4 }, { -R+R/4, R/4 } }, // crosspiece - { { -R+R/8, -R/4 }, { -R+R/8, R/4 } }, - { { -R+R/8, -R/4 }, { -R+R/4, -R/4} }, //crosspiece connectors - { { -R+R/8, R/4 }, { -R+R/4, R/4} }, - { { -R-R/4, R/8 }, { -R-R/4, -R/8 } }, //pommel - { { -R-R/4, R/8 }, { -R+R/8, R/8 } }, - { { -R-R/4, -R/8}, { -R+R/8, -R/8 } } -}; -#define NUMPLYRLINES_RAVEN (sizeof(player_arrow_raven)/sizeof(mline_t)) - -mline_t cheat_player_arrow[] = { - { { -R+R/8, 0 }, { R, 0 } }, // ----- - { { R, 0 }, { R-R/2, R/6 } }, // -----> - { { R, 0 }, { R-R/2, -R/6 } }, - { { -R+R/8, 0 }, { -R-R/8, R/6 } }, // >-----> - { { -R+R/8, 0 }, { -R-R/8, -R/6 } }, - { { -R+3*R/8, 0 }, { -R+R/8, R/6 } }, // >>-----> - { { -R+3*R/8, 0 }, { -R+R/8, -R/6 } }, - { { -R/2, 0 }, { -R/2, -R/6 } }, // >>-d---> - { { -R/2, -R/6 }, { -R/2+R/6, -R/6 } }, - { { -R/2+R/6, -R/6 }, { -R/2+R/6, R/4 } }, - { { -R/6, 0 }, { -R/6, -R/6 } }, // >>-dd--> - { { -R/6, -R/6 }, { 0, -R/6 } }, - { { 0, -R/6 }, { 0, R/4 } }, - { { R/6, R/4 }, { R/6, -R/7 } }, // >>-ddt-> - { { R/6, -R/7 }, { R/6+R/32, -R/7-R/32 } }, - { { R/6+R/32, -R/7-R/32 }, { R/6+R/10, -R/7 } } -}; -#define NUMCHEATPLYRLINES (sizeof(cheat_player_arrow)/sizeof(mline_t)) - -#undef R +TArray MapArrow; +TArray CheatMapArrow; +TArray CheatKey; #define R (MAPUNIT) // [RH] Avoid lots of warnings without compiler-specific #pragmas @@ -361,26 +317,6 @@ mline_t square_guy[] = { #define NUMSQUAREGUYLINES (sizeof(square_guy)/sizeof(mline_t)) #undef R -#define R (MAPUNIT) - -mline_t key_guy[] = { - L (-2, 0, -1.7, -0.5), - L (-1.7, -0.5, -1.5, -0.7), - L (-1.5, -0.7, -0.8, -0.5), - L (-0.8, -0.5, -0.6, 0), - L (-0.6, 0, -0.8, 0.5), - L (-1.5, 0.7, -0.8, 0.5), - L (-1.7, 0.5, -1.5, 0.7), - L (-2, 0, -1.7, 0.5), - L (-0.6, 0, 2, 0), - L (1.7, 0, 1.7, -1), - L (1.5, 0, 1.5, -1), - L (1.3, 0, 1.3, -1) -}; -#define NUMKEYGUYLINES (sizeof(key_guy)/sizeof(mline_t)) - -#undef L -#undef R @@ -545,6 +481,51 @@ void AM_getIslope (mline_t *ml, islope_t *is) } */ + +void AM_ParseArrow(TArray &Arrow, const char *lumpname) +{ + const int R = ((8*PLAYERRADIUS)/7); + FScanner sc; + int lump = Wads.CheckNumForFullName(lumpname, true); + if (lump >= 0) + { + sc.OpenLumpNum(lump); + sc.SetCMode(true); + while (sc.GetToken()) + { + mline_t line; + sc.TokenMustBe('('); + sc.MustGetFloat(); + line.a.x = xs_RoundToInt(sc.Float*R); + sc.MustGetToken(','); + sc.MustGetFloat(); + line.a.y = xs_RoundToInt(sc.Float*R); + sc.MustGetToken(')'); + sc.MustGetToken(','); + sc.MustGetToken('('); + sc.MustGetFloat(); + line.b.x = xs_RoundToInt(sc.Float*R); + sc.MustGetToken(','); + sc.MustGetFloat(); + line.b.y = xs_RoundToInt(sc.Float*R); + sc.MustGetToken(')'); + Arrow.Push(line); + } + } +} + +void AM_InitArrows() +{ + + MapArrow.Clear(); + CheatMapArrow.Clear(); + + if (gameinfo.mMapArrow.IsNotEmpty()) AM_ParseArrow(MapArrow, gameinfo.mMapArrow); + if (gameinfo.mCheatMapArrow.IsNotEmpty()) AM_ParseArrow(CheatMapArrow, gameinfo.mCheatMapArrow); + AM_ParseArrow(CheatKey, "maparrows/key.txt"); + if (MapArrow.Size() == 0) I_FatalError("No automap arrow defined"); +} + //============================================================================= // // called by the coordinate drawer @@ -1066,6 +1047,8 @@ bool AM_clearMarks () void AM_LevelInit () { + if (MapArrow.Size() == 0) AM_InitArrows(); + leveljuststarted = 0; AM_clearMarks(); @@ -2047,20 +2030,15 @@ void AM_drawPlayers () angle = players[consoleplayer].camera->angle; } - if (gameinfo.gametype & GAME_Raven) + if (am_cheat != 0 && CheatMapArrow.Size() > 0) { - arrow = player_arrow_raven; - numarrowlines = NUMPLYRLINES_RAVEN; - } - else if (am_cheat != 0) - { - arrow = cheat_player_arrow; - numarrowlines = NUMCHEATPLYRLINES; + arrow = &CheatMapArrow[0]; + numarrowlines = CheatMapArrow.Size(); } else { - arrow = player_arrow; - numarrowlines = NUMPLYRLINES; + arrow = &MapArrow[0]; + numarrowlines = MapArrow.Size(); } AM_drawLineCharacter(arrow, numarrowlines, 0, angle, YourColor, pt.x, pt.y); return; @@ -2113,9 +2091,7 @@ void AM_drawPlayers () angle -= players[consoleplayer].camera->angle - ANG90; } - AM_drawLineCharacter - (player_arrow, NUMPLYRLINES, 0, angle, - color, pt.x, pt.y); + AM_drawLineCharacter(&MapArrow[0], MapArrow.Size(), 0, angle, color, pt.x, pt.y); } } } @@ -2171,7 +2147,7 @@ void AM_drawThings () if (c >= 0) color.FromRGB(RPART(c), GPART(c), BPART(c)); else color = ThingColor_CountItem; - AM_drawLineCharacter(key_guy, NUMKEYGUYLINES, 16< +(1, 0), (0.5, -0.25) +(-0.875, 0), (-1.125, -0.25) // >----> +(-0.875, 0), (-1.125, 0.25) +(-0.625, 0), (-0.875, -0.25) // >>---> +(-0.625, 0), (-0.875, 0.25) diff --git a/wadsrc/static/maparrows/dagger.txt b/wadsrc/static/maparrows/dagger.txt new file mode 100644 index 000000000..0c16efc56 --- /dev/null +++ b/wadsrc/static/maparrows/dagger.txt @@ -0,0 +1,10 @@ +(-0.75, 0), (0, 0) // center line. +(-0.75, 0.125), (1, 0) // blade +(-0.75, -0.125), (1, 0 ) +(-0.75, -0.25), (-0.75, 0.25 ) // crosspiece +(-0.875, -0.25), (-0.875, 0.25 ) +(-0.875, -0.25), (-0.75, -0.25) //crosspiece connectors +(-0.875, 0.25), (-0.75, 0.25) +(-1.125, 0.125), (-1.125, -0.125 ) //pommel +(-1.125, 0.125), (-0.875, 0.125 ) +(-1.125, -0.125), (-0.875, -0.125) diff --git a/wadsrc/static/maparrows/ddtarrow.txt b/wadsrc/static/maparrows/ddtarrow.txt new file mode 100644 index 000000000..51919c72d --- /dev/null +++ b/wadsrc/static/maparrows/ddtarrow.txt @@ -0,0 +1,16 @@ +(-0.875, 0), (1, 0) // ----- +(1, 0), (0.5, 0.167) // -----> +(1, 0), (0.5, -0.167) +(-0.875, 0), (-1.125, -0.167) // >----> +(-0.875, 0), (-1.125, 0.167) +(-0.625, 0), (-0.875, -0.167) // >>---> +(-0.625, 0), (-0.875, 0.167) +(-0.5, 0), (-0.5, -0.167) // >>-d---> +(-0.5, -0.167), (-0.333, -0.167) +(-0.333, -0.167), (-0.333, 0.25) +(-0.167, 0), (-0.167, -0.167) // >>-dd--> +(-0.167, -0.167), (0, -0.167) +(0, -0.167), (0, 0.25) +(0.167, 0.25), (0.167, -0.143) // >>-ddt-> +(0.167, -0.143), (0.198, -0.174) +(0.198, -0.174), (0.267, -0.143) diff --git a/wadsrc/static/maparrows/key.txt b/wadsrc/static/maparrows/key.txt new file mode 100644 index 000000000..f252d0bfd --- /dev/null +++ b/wadsrc/static/maparrows/key.txt @@ -0,0 +1,12 @@ +(-2, 0), (-1.7, -0.5) +(-1.7, -0.5), (-1.5, -0.7) +(-1.5, -0.7), (-0.8, -0.5) +(-0.8, -0.5), (-0.6, 0) +(-0.6, 0), (-0.8, 0.5) +(-1.5, 0.7), (-0.8, 0.5) +(-1.7, 0.5), (-1.5, 0.7) +(-2, 0), (-1.7, 0.5) +(-0.6, 0), (2, 0) +(1.7, 0), (1.7, -1) +(1.5, 0), (1.5, -1) +(1.3, 0), (1.3, -1) diff --git a/wadsrc/static/mapinfo/chex.txt b/wadsrc/static/mapinfo/chex.txt index 7ff6e2d67..79f27f5bf 100644 --- a/wadsrc/static/mapinfo/chex.txt +++ b/wadsrc/static/mapinfo/chex.txt @@ -60,6 +60,7 @@ gameinfo textscreenx = 10 textscreeny = 10 defaultendsequence = "Inter_Pic1" + maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt" } skill baby diff --git a/wadsrc/static/mapinfo/doomcommon.txt b/wadsrc/static/mapinfo/doomcommon.txt index 0ad964ca5..73d003795 100644 --- a/wadsrc/static/mapinfo/doomcommon.txt +++ b/wadsrc/static/mapinfo/doomcommon.txt @@ -61,6 +61,7 @@ gameinfo textscreenx = 10 textscreeny = 10 defaultendsequence = "Inter_Cast" + maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt" } skill baby diff --git a/wadsrc/static/mapinfo/heretic.txt b/wadsrc/static/mapinfo/heretic.txt index 0e269c8f7..57aa839f4 100644 --- a/wadsrc/static/mapinfo/heretic.txt +++ b/wadsrc/static/mapinfo/heretic.txt @@ -60,6 +60,7 @@ gameinfo textscreenx = 20 textscreeny = 5 defaultendsequence = "Inter_Pic1" + maparrow = "maparrows/dagger.txt" } skill baby diff --git a/wadsrc/static/mapinfo/hexen.txt b/wadsrc/static/mapinfo/hexen.txt index 6022c541e..eeef3b92a 100644 --- a/wadsrc/static/mapinfo/hexen.txt +++ b/wadsrc/static/mapinfo/hexen.txt @@ -58,6 +58,7 @@ gameinfo textscreenx = 10 textscreeny = 5 defaultendsequence = "Inter_Chess" + maparrow = "maparrows/dagger.txt" } skill baby diff --git a/wadsrc/static/mapinfo/strife.txt b/wadsrc/static/mapinfo/strife.txt index aed50b223..2e6c242cb 100644 --- a/wadsrc/static/mapinfo/strife.txt +++ b/wadsrc/static/mapinfo/strife.txt @@ -60,6 +60,7 @@ gameinfo textscreenx = 10 textscreeny = 10 defaultendsequence = "Inter_Strife" + maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt" } Intermission Inter_Strife_Good