mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 06:53:40 +00:00
- externalized the vector graphics for the automap arrows and the key.
SVN r2949 (trunk)
This commit is contained in:
parent
9e2e9262a4
commit
ce7921c9d9
12 changed files with 119 additions and 81 deletions
138
src/am_map.cpp
138
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<mline_t> MapArrow;
|
||||
TArray<mline_t> CheatMapArrow;
|
||||
TArray<mline_t> 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<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
|
||||
|
@ -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<<MAPBITS, 0, color, p.x, p.y);
|
||||
AM_drawLineCharacter(&CheatKey[0], CheatKey.Size(), 0, 0, color, p.x, p.y);
|
||||
color.Index = -1;
|
||||
}
|
||||
else
|
||||
|
|
11
src/gi.cpp
11
src/gi.cpp
|
@ -247,6 +247,17 @@ void FMapInfoParser::ParseGameInfo()
|
|||
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.
|
||||
GAMEINFOKEY_CSTRING(titlePage, "titlePage", 8)
|
||||
GAMEINFOKEY_STRINGARRAY(creditPages, "creditPage", 8)
|
||||
|
|
1
src/gi.h
1
src/gi.h
|
@ -129,6 +129,7 @@ struct gameinfo_t
|
|||
int TextScreenX;
|
||||
int TextScreenY;
|
||||
FName DefaultEndSequence;
|
||||
FString mMapArrow, mCheatMapArrow;
|
||||
|
||||
const char *GetFinalePage(unsigned int num) const;
|
||||
};
|
||||
|
|
7
wadsrc/static/maparrows/arrow.txt
Normal file
7
wadsrc/static/maparrows/arrow.txt
Normal 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)
|
10
wadsrc/static/maparrows/dagger.txt
Normal file
10
wadsrc/static/maparrows/dagger.txt
Normal 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)
|
16
wadsrc/static/maparrows/ddtarrow.txt
Normal file
16
wadsrc/static/maparrows/ddtarrow.txt
Normal 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)
|
12
wadsrc/static/maparrows/key.txt
Normal file
12
wadsrc/static/maparrows/key.txt
Normal 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)
|
|
@ -60,6 +60,7 @@ gameinfo
|
|||
textscreenx = 10
|
||||
textscreeny = 10
|
||||
defaultendsequence = "Inter_Pic1"
|
||||
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
|
||||
}
|
||||
|
||||
skill baby
|
||||
|
|
|
@ -61,6 +61,7 @@ gameinfo
|
|||
textscreenx = 10
|
||||
textscreeny = 10
|
||||
defaultendsequence = "Inter_Cast"
|
||||
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
|
||||
}
|
||||
|
||||
skill baby
|
||||
|
|
|
@ -60,6 +60,7 @@ gameinfo
|
|||
textscreenx = 20
|
||||
textscreeny = 5
|
||||
defaultendsequence = "Inter_Pic1"
|
||||
maparrow = "maparrows/dagger.txt"
|
||||
}
|
||||
|
||||
skill baby
|
||||
|
|
|
@ -58,6 +58,7 @@ gameinfo
|
|||
textscreenx = 10
|
||||
textscreeny = 5
|
||||
defaultendsequence = "Inter_Chess"
|
||||
maparrow = "maparrows/dagger.txt"
|
||||
}
|
||||
|
||||
skill baby
|
||||
|
|
|
@ -60,6 +60,7 @@ gameinfo
|
|||
textscreenx = 10
|
||||
textscreeny = 10
|
||||
defaultendsequence = "Inter_Strife"
|
||||
maparrow = "maparrows/arrow.txt", "maparrows/ddtarrow.txt"
|
||||
}
|
||||
|
||||
Intermission Inter_Strife_Good
|
||||
|
|
Loading…
Reference in a new issue