- added the animated player display.

This commit is contained in:
Christoph Oelckers 2019-12-05 19:52:46 +01:00
parent 98d3cb19c9
commit 54177cd27d
10 changed files with 59 additions and 26 deletions

View file

@ -236,6 +236,7 @@ struct GameInterface
f.VFormat(fmt, ap);
DoPrintMessage(prio, f);
}
virtual void DrawPlayerSprite(const DVector2& origin, bool onteam) {}
};
extern GameInterface* gi;

View file

@ -571,7 +571,7 @@ CUSTOM_CVAR(Int, playerteam, 0, CVAR_USERINFO) // this one is transient and won'
else ;// gi->UpdatePlayerTeam(); // this part is game specific
}
// Will only become useful if the obituary system gets overhauled.
// Will only become useful if the obituary system gets overhauled and for localization
CUSTOM_CVAR(Int, playergender, 0, CVAR_USERINFO|CVAR_ARCHIVE)
{
if (self < 0 || self > 3) self = 0;

View file

@ -57,6 +57,7 @@ void RegisterRedneckMenus();
void RegisterBloodMenus();
void RegisterSWMenus();
void RegisterLoadsaveMenus();
void RegisterOptionMenus();
extern bool rotatesprite_2doverride;
bool help_disabled, credits_disabled;
int g_currentMenu; // accessible by CON scripts - contains the current menu's script ID if defined or INT_MAX if none given.
@ -546,10 +547,23 @@ bool M_SetMenu(FName menu, int param, FName caller)
else if ((*desc)->mType == MDESC_OptionsMenu)
{
FOptionMenuDescriptor *ld = static_cast<FOptionMenuDescriptor*>(*desc);
//const PClass *cls = ld->mClass == NULL? RUNTIME_CLASS(DOptionMenu) : ld->mClass;
ld->CalcIndent();
DOptionMenu *newmenu = new DOptionMenu;
DOptionMenu* newmenu;
if (ld->mClass != NAME_None)
{
auto ndx = menuClasses.FindEx([=](const auto p) { return p->mName == ld->mClass; });
if (ndx == menuClasses.Size())
{
I_Error("Bad menu class %s\n", ld->mClass.GetChars());
}
else
{
newmenu = (DOptionMenu*)menuClasses[ndx]->CreateNew();
}
}
else
{
newmenu = new DOptionMenu;
}
newmenu->Init(DMenu::CurrentMenu, ld);
M_ActivateMenu(newmenu);
}
@ -922,6 +936,7 @@ void M_Init (void)
RegisterBloodMenus();
RegisterSWMenus();
RegisterLoadsaveMenus();
RegisterOptionMenus();
timerSetCallback(M_Ticker);
M_ParseMenuDefs();
}

View file

@ -539,3 +539,23 @@ FOptionMenuItem *FOptionMenuDescriptor::GetItem(FName name)
}
return NULL;
}
class PlayerMenu : public DOptionMenu
{
using Super = DOptionMenu;
public:
void Drawer()
{
// Hack: The team item is #3. This part doesn't work properly yet.
gi->DrawPlayerSprite(origin, (mDesc->mSelectedItem == 3));
Super::Drawer();
}
};
static TMenuClassDescriptor<PlayerMenu> _ppm("NewPlayerMenu");
void RegisterOptionMenus()
{
menuClasses.Push(&_ppm);
}

View file

@ -757,12 +757,10 @@ void GameInterface::DrawCenteredTextScreen(const DVector2 &origin, const char *t
mgametextcenter(int(origin.X * 65536), int((origin.Y + position) * 65536), text);
}
#if 0
void GameInterface::DrawPlayerSprite(int x, int y)
void GameInterface::DrawPlayerSprite(const DVector2& origin, bool onteam)
{
rotatesprite_fs(origin.x + (260<<16), origin.y + ((24+(tilesiz[APLAYER].y>>1))<<16), 49152L,0,1441-((((4-((int32_t) totalclock>>4)))&3)*5),0,entry == &ME_PLAYER_TEAM ? G_GetTeamPalette(playerteam) : playercolor,10);
rotatesprite_fs(int(origin.X * 65536) + (260<<16), int(origin.Y*65536) + ((24+(tilesiz[APLAYER].y>>1))<<16), 49152L,0,1441-((((4-((int32_t) totalclock>>4)))&3)*5),0,onteam ? G_GetTeamPalette(playerteam) : G_CheckPlayerColor(playercolor),10);
}
#endif
END_DUKE_NS

View file

@ -169,6 +169,7 @@ struct GameInterface : ::GameInterface
bool SaveGame(FSaveGameNode*) override;
bool LoadGame(FSaveGameNode*) override;
void DoPrintMessage(int prio, const char*) override;
void DrawPlayerSprite(const DVector2& origin, bool onteam) override;
};

View file

@ -475,15 +475,13 @@ void GameInterface::DrawCenteredTextScreen(const DVector2 &origin, const char *t
}
#if 0
void GameInterface::DrawPlayerSprite(int x, int y)
void GameInterface::DrawPlayerSprite(const DVector2& origin, bool onteam)
{
if (RR)
rotatesprite_fs(origin.x + (260<<16), origin.y + ((24+(tilesiz[APLAYER].y>>2))<<16), 24576L,0,3845+36-((((8-((int32_t) totalclock>>4)))&7)*5),0,entry == &ME_PLAYER_TEAM ? G_GetTeamPalette(playerteam) : playercolor,10);
rotatesprite_fs(int(origin.X * 65536) + (260<<16), int(origin.Y * 65536) + ((24+(tilesiz[APLAYER].y>>2))<<16), 24576L,0,3845+36-((((8-((int32_t) totalclock>>4)))&7)*5),0,onteam ? G_GetTeamPalette(playerteam) : G_CheckPlayerColor(playercolor),10);
else
rotatesprite_fs(origin.x + (260<<16), origin.y + ((24+(tilesiz[APLAYER].y>>1))<<16), 49152L,0,1441-((((4-((int32_t) totalclock>>4)))&3)*5),0,entry == &ME_PLAYER_TEAM ? G_GetTeamPalette(playerteam) : playercolor,10);
rotatesprite_fs(int(origin.X * 65536) + (260<<16), int(origin.Y * 65536) + ((24+(tilesiz[APLAYER].y>>1))<<16), 49152L,0,1441-((((4-((int32_t) totalclock>>4)))&3)*5),0,onteam ? G_GetTeamPalette(playerteam) : G_CheckPlayerColor(playercolor),10);
}
#endif
END_RR_NS

View file

@ -169,6 +169,7 @@ struct GameInterface : ::GameInterface
bool SaveGame(FSaveGameNode*) override;
bool LoadGame(FSaveGameNode*) override;
void DoPrintMessage(int prio, const char* text) override;
void DrawPlayerSprite(const DVector2& origin, bool onteam) override;
};
END_RR_NS

View file

@ -307,7 +307,7 @@ void fadepal(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t ste
//void fadepaltile(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step,int32_t tile);
void G_InitTimer(int32_t ticspersec);
static inline int32_t G_GetTeamPalette(int32_t team)
inline int32_t G_GetTeamPalette(int32_t team)
{
int8_t pal[] = { 3, 10, 11, 12 };

View file

@ -965,15 +965,15 @@ OptionValue "PlayerColors"
{
0, "$OPTVAL_AUTO"
1, "$TXT_COLOR_BLUE"
2, "TXT_COLOR_RED"
3, "TXT_COLOR_GREEN"
4, "TXT_COLOR_GRAY"
5, "TXT_COLOR_DARKGRAY"
6, "TXT_COLOR_DARKGREEN"
7, "TXT_COLOR_BROWN"
8, "TXT_COLOR_DARKBLUE"
9, "TXT_COLOR_LIGHTRED"
10, "TXT_COLOR_YELLOW"
2, "$TXT_COLOR_RED"
3, "$TXT_COLOR_GREEN"
4, "$TXT_COLOR_GRAY"
5, "$TXT_COLOR_DARKGRAY"
6, "$TXT_COLOR_DARKGREEN"
7, "$TXT_COLOR_BROWN"
8, "$TXT_COLOR_DARKBLUE"
9, "$TXT_COLOR_LIGHTRED"
//10, "TXT_COLOR_YELLOW"
}
OptionValue "PlayerTeam"
@ -997,9 +997,9 @@ OptionMenu "NewPlayerMenu" //protected
{
Title "$MNU_PLAYERSETUP"
TextField "$PLYRMNU_NAME", playername
Option "$PLYRMNU_TEAM", "playerteam", "PlayerTeam"
Option "$PLYRMNU_PLAYERCOLOR", "playercolor", "PlayerColors"
Option "$PLYRMNU_PLAYERGENDER", "playergender", "Gender"
Option "$PLYRMNU_TEAM", "playerteam", "PlayerTeam"
Submenu "$PLRMNU_TAUNTS", "TauntsMenu"
Class "NewPlayerMenu"
}
@ -1048,7 +1048,6 @@ OptionValue "WeapSwitch"
OptionMenu GameplayOptions //protected
{
Position -35
Title "$GMPLYMNU_TITLE"
Option "$PLRMNU_AUTOAIM", "cl_autoaim", "AimMode"
Option "$PLRMNU_ALWAYSRUN", "cl_autorun", "OnOff"