- externalized the vector graphics for the automap arrows and the key.

SVN r2949 (trunk)
This commit is contained in:
Christoph Oelckers 2010-10-16 22:37:30 +00:00
parent 9e2e9262a4
commit ce7921c9d9
12 changed files with 119 additions and 81 deletions

View file

@ -287,53 +287,9 @@ struct islope_t
// A line drawing of the player pointing right, // A line drawing of the player pointing right,
// starting from the middle. // starting from the middle.
// //
#define R ((8*PLAYERRADIUS)/7) TArray<mline_t> MapArrow;
mline_t player_arrow[] = { TArray<mline_t> CheatMapArrow;
{ { -R+R/8, 0 }, { R, 0 } }, // ----- TArray<mline_t> CheatKey;
{ { 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
#define R (MAPUNIT) #define R (MAPUNIT)
// [RH] Avoid lots of warnings without compiler-specific #pragmas // [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)) #define NUMSQUAREGUYLINES (sizeof(square_guy)/sizeof(mline_t))
#undef R #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<mline_t> &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 // called by the coordinate drawer
@ -1066,6 +1047,8 @@ bool AM_clearMarks ()
void AM_LevelInit () void AM_LevelInit ()
{ {
if (MapArrow.Size() == 0) AM_InitArrows();
leveljuststarted = 0; leveljuststarted = 0;
AM_clearMarks(); AM_clearMarks();
@ -2047,20 +2030,15 @@ void AM_drawPlayers ()
angle = players[consoleplayer].camera->angle; angle = players[consoleplayer].camera->angle;
} }
if (gameinfo.gametype & GAME_Raven) if (am_cheat != 0 && CheatMapArrow.Size() > 0)
{ {
arrow = player_arrow_raven; arrow = &CheatMapArrow[0];
numarrowlines = NUMPLYRLINES_RAVEN; numarrowlines = CheatMapArrow.Size();
}
else if (am_cheat != 0)
{
arrow = cheat_player_arrow;
numarrowlines = NUMCHEATPLYRLINES;
} }
else else
{ {
arrow = player_arrow; arrow = &MapArrow[0];
numarrowlines = NUMPLYRLINES; numarrowlines = MapArrow.Size();
} }
AM_drawLineCharacter(arrow, numarrowlines, 0, angle, YourColor, pt.x, pt.y); AM_drawLineCharacter(arrow, numarrowlines, 0, angle, YourColor, pt.x, pt.y);
return; return;
@ -2113,9 +2091,7 @@ void AM_drawPlayers ()
angle -= players[consoleplayer].camera->angle - ANG90; angle -= players[consoleplayer].camera->angle - ANG90;
} }
AM_drawLineCharacter AM_drawLineCharacter(&MapArrow[0], MapArrow.Size(), 0, angle, color, pt.x, pt.y);
(player_arrow, NUMPLYRLINES, 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)); if (c >= 0) color.FromRGB(RPART(c), GPART(c), BPART(c));
else color = ThingColor_CountItem; else color = ThingColor_CountItem;
AM_drawLineCharacter(key_guy, NUMKEYGUYLINES, 16<<MAPBITS, 0, color, p.x, p.y); AM_drawLineCharacter(&CheatKey[0], CheatKey.Size(), 0, 0, color, p.x, p.y);
color.Index = -1; color.Index = -1;
} }
else else

View file

@ -247,6 +247,17 @@ void FMapInfoParser::ParseGameInfo()
gameinfo.ArmorIcon2[8] = 0; gameinfo.ArmorIcon2[8] = 0;
} }
} }
else if(nextKey.CompareNoCase("maparrow") == 0)
{
sc.MustGetToken(TK_StringConst);
gameinfo.mMapArrow = sc.String;
if (sc.CheckToken(','))
{
sc.MustGetToken(TK_StringConst);
gameinfo.mCheatMapArrow = sc.String;
}
else gameinfo.mCheatMapArrow = "";
}
// Insert valid keys here. // Insert valid keys here.
GAMEINFOKEY_CSTRING(titlePage, "titlePage", 8) GAMEINFOKEY_CSTRING(titlePage, "titlePage", 8)
GAMEINFOKEY_STRINGARRAY(creditPages, "creditPage", 8) GAMEINFOKEY_STRINGARRAY(creditPages, "creditPage", 8)

View file

@ -129,6 +129,7 @@ struct gameinfo_t
int TextScreenX; int TextScreenX;
int TextScreenY; int TextScreenY;
FName DefaultEndSequence; FName DefaultEndSequence;
FString mMapArrow, mCheatMapArrow;
const char *GetFinalePage(unsigned int num) const; const char *GetFinalePage(unsigned int num) const;
}; };

View file

@ -0,0 +1,7 @@
(-0.875, 0), (1, 0) // -----
(1, 0), (0.5, 0.25) // ----->
(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)

View file

@ -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)

View file

@ -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)

View file

@ -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)

View file

@ -60,6 +60,7 @@ gameinfo
textscreenx = 10 textscreenx = 10
textscreeny = 10 textscreeny = 10
defaultendsequence = "Inter_Pic1" defaultendsequence = "Inter_Pic1"
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
} }
skill baby skill baby

View file

@ -61,6 +61,7 @@ gameinfo
textscreenx = 10 textscreenx = 10
textscreeny = 10 textscreeny = 10
defaultendsequence = "Inter_Cast" defaultendsequence = "Inter_Cast"
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
} }
skill baby skill baby

View file

@ -60,6 +60,7 @@ gameinfo
textscreenx = 20 textscreenx = 20
textscreeny = 5 textscreeny = 5
defaultendsequence = "Inter_Pic1" defaultendsequence = "Inter_Pic1"
maparrow = "maparrows/dagger.txt"
} }
skill baby skill baby

View file

@ -58,6 +58,7 @@ gameinfo
textscreenx = 10 textscreenx = 10
textscreeny = 5 textscreeny = 5
defaultendsequence = "Inter_Chess" defaultendsequence = "Inter_Chess"
maparrow = "maparrows/dagger.txt"
} }
skill baby skill baby

View file

@ -60,6 +60,7 @@ gameinfo
textscreenx = 10 textscreenx = 10
textscreeny = 10 textscreeny = 10
defaultendsequence = "Inter_Strife" defaultendsequence = "Inter_Strife"
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
} }
Intermission Inter_Strife_Good Intermission Inter_Strife_Good