forked from Mirrors/openclonk
Player options dialogue, let the player choose a clonk skin
parent
af699844de
commit
d468862159
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
|
@ -160,6 +160,7 @@ IDS_CTL_CHAT=Cha&t:
|
|||
IDS_CTL_CLIMATE2=heiß
|
||||
IDS_CTL_CLIMATE3=kalt
|
||||
IDS_CTL_CLIMATE=Klima
|
||||
IDS_CTL_CLONKSKIN=Clonk-Stil:
|
||||
IDS_CTL_COLOR=Farbe
|
||||
IDS_CTL_COMMENT=Kommentar
|
||||
IDS_CTL_CONTROL=Steuerung
|
||||
|
@ -435,6 +436,7 @@ IDS_DLGTIP_PLAYERCOLORSTGB=Mischt eine eigene Spielerfarbe aus Rot, Grün und Bl
|
|||
IDS_DLGTIP_PLAYERCONTROL=Wählt eine Steuerungsmethode aus.
|
||||
IDS_DLGTIP_PLAYERCONTROLMOUSE=Schaltet zur ausgewählten Steuerungsmethode zusätzlich Maussteurung ein.
|
||||
IDS_DLGTIP_PLAYERCREW=Zeigt die Stammcrew des Spielers an.
|
||||
IDS_DLGTIP_PLAYERCREWSKIN=Wählt das Aussehen der Clonks aus.
|
||||
IDS_DLGTIP_PLAYERDELETE=Löscht den ausgewählten Spieler.
|
||||
IDS_DLGTIP_PLAYERFILES=Liste aller Spielerdateien auf diesem Rechner
|
||||
IDS_DLGTIP_PLAYERPROPERTIES=Ändert die Spielereigenschaften.
|
||||
|
|
|
@ -160,6 +160,7 @@ IDS_CTL_CHAT=Cha&t:
|
|||
IDS_CTL_CLIMATE2=hot
|
||||
IDS_CTL_CLIMATE3=cold
|
||||
IDS_CTL_CLIMATE=Climate
|
||||
IDS_CTL_CLONKSKIN=Clonk style:
|
||||
IDS_CTL_COLOR=Color
|
||||
IDS_CTL_COMMENT=Comment
|
||||
IDS_CTL_CONTROL=Control
|
||||
|
@ -434,6 +435,7 @@ IDS_DLGTIP_PLAYERCOLORSTGB=Composes a custom player color from red, green, and b
|
|||
IDS_DLGTIP_PLAYERCONTROL=Selects a control method.
|
||||
IDS_DLGTIP_PLAYERCONTROLMOUSE=Activates mouse control in addition to the selected control method.
|
||||
IDS_DLGTIP_PLAYERCREW=Display the permanent crew of the selected player.
|
||||
IDS_DLGTIP_PLAYERCREWSKIN=Selects the appearance of the player's clonks.
|
||||
IDS_DLGTIP_PLAYERDELETE=Delete the selected player file.
|
||||
IDS_DLGTIP_PLAYERFILES=List of all player files stored on this computer.
|
||||
IDS_DLGTIP_PLAYERPROPERTIES=Change player color and preferred controls.
|
||||
|
|
|
@ -51,6 +51,7 @@ void C4PlayerInfoCore::Default(C4RankSystem *pRanks)
|
|||
SCopy("Neuling",PrefName);
|
||||
if (pRanks) SCopy(pRanks->GetRankName(Rank,false).getData(),RankName);
|
||||
else SCopy("Rang",RankName);
|
||||
PrefClonkSkin=0;
|
||||
PrefColor=0;
|
||||
PrefColorDw=0xff;
|
||||
PrefColor2Dw=0;
|
||||
|
@ -164,6 +165,7 @@ void C4PlayerInfoCore::CompileFunc(StdCompiler *pComp)
|
|||
pComp->Value(mkNamingAdapt(OldPrefControlStyle, "AutoStopControl", 0));
|
||||
pComp->Value(mkNamingAdapt(OldPrefAutoContextMenu, "AutoContextMenu", -1)); // compiling default is -1 (if this is detected, AutoContextMenus will be defaulted by control style)
|
||||
pComp->Value(mkNamingAdapt(PrefControl, "ControlSet", StdStrBuf()));
|
||||
pComp->Value(mkNamingAdapt(PrefClonkSkin, "ClonkSkin", 0));
|
||||
pComp->NameEnd();
|
||||
|
||||
pComp->Value(mkNamingAdapt(LastRound, "LastRound"));
|
||||
|
|
|
@ -105,6 +105,7 @@ public:
|
|||
int32_t PrefColor;
|
||||
uint32_t PrefColorDw, PrefColor2Dw;
|
||||
int32_t PrefPosition;
|
||||
int32_t PrefClonkSkin;
|
||||
// Old control method - loaded for backwards compatilibity if PrefControl is unassigned
|
||||
// and stored back so you can use the same player file for CR and OC
|
||||
int32_t OldPrefControl;
|
||||
|
|
|
@ -1346,11 +1346,20 @@ C4StartupPlrPropertiesDlg::C4StartupPlrPropertiesDlg(C4StartupPlrSelDlg::PlayerL
|
|||
AddElement(pNameEdit);
|
||||
SetFocus(pNameEdit, false);
|
||||
caMain.ExpandTop(-BetweenElementDist);
|
||||
|
||||
int32_t iControlPicSize = C4GUI::ArrowButton::GetDefaultHeight(); // GetGridCell(0,3,0,1,-1,-1,false,2)
|
||||
int32_t label_hgt = pSmallFont->GetLineHeight();
|
||||
|
||||
// place color label
|
||||
AddElement(new C4GUI::Label(FormatString("%s:", LoadResStr("IDS_CTL_COLOR")).getData(), caMain.GetFromTop(pSmallFont->GetLineHeight()), ALeft, C4StartupFontClr, pSmallFont, false));
|
||||
// place color controls
|
||||
C4GUI::ComponentAligner caColorArea(caMain.GetFromTop(C4GUI::ArrowButton::GetDefaultHeight()), 2, 0);
|
||||
C4GUI::ComponentAligner caColorArea(caMain.GetFromTop(iControlPicSize + BetweenElementDist + label_hgt), 2, 0);
|
||||
C4GUI::ComponentAligner caPictureArea(caColorArea.GetFromRight(iControlPicSize, iControlPicSize + BetweenElementDist + label_hgt), 2,0);
|
||||
caColorArea.ExpandLeft(2);
|
||||
AddElement(new C4GUI::Label(FormatString("%s:", LoadResStr("IDS_CTL_COLOR")).getData(), caColorArea.GetFromTop(label_hgt), ALeft, C4StartupFontClr, pSmallFont, false));
|
||||
caColorArea.ExpandTop(-BetweenElementDist);
|
||||
// place picture label
|
||||
AddElement(new C4GUI::Label(LoadResStr("IDS_CTL_PICTURE"), caPictureArea.GetFromTop(label_hgt), ALeft, C4StartupFontClr, pSmallFont, false));
|
||||
caPictureArea.ExpandTop(-BetweenElementDist);
|
||||
// place color controls
|
||||
C4GUI::Button *pBtn; const char *szTip;
|
||||
szTip = LoadResStr("IDS_DLGTIP_PLAYERCOLORS");
|
||||
AddElement(pBtn = new C4GUI::CallbackButton<C4StartupPlrPropertiesDlg, C4GUI::ArrowButton>(C4GUI::ArrowButton::Left, caColorArea.GetFromLeft(C4GUI::ArrowButton::GetDefaultWidth()), &C4StartupPlrPropertiesDlg::OnClrChangeLeft));
|
||||
|
@ -1362,39 +1371,50 @@ C4StartupPlrPropertiesDlg::C4StartupPlrPropertiesDlg(C4StartupPlrSelDlg::PlayerL
|
|||
AddElement(pBtn = new C4GUI::CallbackButton<C4StartupPlrPropertiesDlg, C4GUI::ArrowButton>(C4GUI::ArrowButton::Right, caColorArea.GetFromLeft(C4GUI::ArrowButton::GetDefaultWidth()), &C4StartupPlrPropertiesDlg::OnClrChangeRight));
|
||||
pBtn->SetToolTip(szTip);
|
||||
if (!C4P.PrefColorDw) C4P.PrefColorDw=0xff;
|
||||
// Place picture controls
|
||||
AddElement(pPictureBtn = new C4GUI::CallbackButton<C4StartupPlrPropertiesDlg, C4GUI::IconButton>(C4GUI::Ico_Player, caPictureArea.GetAll(), 'P' /* 2do */, &C4StartupPlrPropertiesDlg::OnPictureBtn));
|
||||
pPictureBtn->SetToolTip(LoadResStr("IDS_DESC_SELECTAPICTUREANDORLOBBYI"));
|
||||
UpdateBigIcon();
|
||||
UpdatePlayerColor(true);
|
||||
caMain.ExpandTop(-BetweenElementDist);
|
||||
// place control and picture label
|
||||
int32_t iControlPicSize = C4GUI::ArrowButton::GetDefaultHeight(); // GetGridCell(0,3,0,1,-1,-1,false,2)
|
||||
C4GUI::ComponentAligner caControlArea(caMain.GetFromTop(iControlPicSize + pSmallFont->GetLineHeight() + BetweenElementDist), 0,0, false);
|
||||
C4GUI::ComponentAligner caPictureArea(caControlArea.GetFromRight(iControlPicSize), 0,0, false);
|
||||
AddElement(new C4GUI::Label(FormatString("%s:", LoadResStr("IDS_CTL_CONTROL")).getData(), caControlArea.GetFromTop(pSmallFont->GetLineHeight()), ALeft, C4StartupFontClr, pSmallFont, false));
|
||||
AddElement(new C4GUI::Label(LoadResStr("IDS_CTL_PICTURE"), caPictureArea.GetFromTop(pSmallFont->GetLineHeight()), ACenter, C4StartupFontClr, pSmallFont, false));
|
||||
caControlArea.ExpandTop(-BetweenElementDist); caPictureArea.ExpandTop(-BetweenElementDist);
|
||||
// place control label
|
||||
C4GUI::ComponentAligner caControlArea(caMain.GetFromTop(iControlPicSize + label_hgt + BetweenElementDist), 0,0, false);
|
||||
C4GUI::ComponentAligner caSkinArea(caControlArea.GetFromRight(iControlPicSize + label_hgt + BetweenElementDist), 0,0, false);
|
||||
AddElement(new C4GUI::Label(FormatString("%s:", LoadResStr("IDS_CTL_CONTROL")).getData(), caControlArea.GetFromTop(label_hgt), ALeft, C4StartupFontClr, pSmallFont, false));
|
||||
caControlArea.ExpandTop(-BetweenElementDist);
|
||||
// place clonk style label
|
||||
AddElement(new C4GUI::Label(LoadResStr("IDS_CTL_CLONKSKIN"), caSkinArea.GetFromTop(label_hgt), ALeft, C4StartupFontClr, pSmallFont, false));
|
||||
caSkinArea.ExpandTop(-BetweenElementDist);
|
||||
// place control controls
|
||||
C4GUI::ComponentAligner caControl(caControlArea.GetFromTop(iControlPicSize), 2,0);
|
||||
szTip = LoadResStr("IDS_DLGTIP_PLAYERCONTROL");
|
||||
AddElement(pBtn = new C4GUI::CallbackButton<C4StartupPlrPropertiesDlg, C4GUI::ArrowButton>(C4GUI::ArrowButton::Left, caControl.GetFromLeft(C4GUI::ArrowButton::GetDefaultWidth()), &C4StartupPlrPropertiesDlg::OnCtrlChangeLeft));
|
||||
pBtn->SetToolTip(szTip);
|
||||
int32_t ctrl_name_hgt = pSmallFont->GetLineHeight();
|
||||
caControl.ExpandBottom(ctrl_name_hgt); C4Rect ctrl_name_rect = caControl.GetFromBottom(ctrl_name_hgt);
|
||||
caControl.ExpandBottom(label_hgt); C4Rect ctrl_name_rect = caControl.GetFromBottom(label_hgt);
|
||||
C4Facet &rfctCtrlPic = ::GraphicsResource.fctKeyboard; // UpdatePlayerControl() will alternatively set fctGamepad
|
||||
AddElement(pCtrlImg = new C4GUI::Picture(caControl.GetFromLeft(rfctCtrlPic.GetWidthByHeight(caControl.GetHeight())), true));
|
||||
pCtrlImg->SetToolTip(szTip);
|
||||
AddElement(pBtn = new C4GUI::CallbackButton<C4StartupPlrPropertiesDlg, C4GUI::ArrowButton>(C4GUI::ArrowButton::Right, caControl.GetFromLeft(C4GUI::ArrowButton::GetDefaultWidth()), &C4StartupPlrPropertiesDlg::OnCtrlChangeRight));
|
||||
pBtn->SetToolTip(szTip);
|
||||
caControl.ExpandLeft(-10);
|
||||
// Mouse control, currently mandatory with keyboard and this will probably never change again!
|
||||
// AddElement(pMouseBtn = new C4GUI::CallbackButton<C4StartupPlrPropertiesDlg, C4GUI::IconButton>(C4GUI::Ico_MouseOff, caControl.GetFromLeft(caControl.GetHeight()), 'M' /* 2do */, &C4StartupPlrPropertiesDlg::OnCtrlChangeMouse));
|
||||
// pMouseBtn->SetToolTip(LoadResStr("IDS_DLGTIP_PLAYERCONTROLMOUSE"));
|
||||
C4P.OldPrefControl = BoundBy<int32_t>(C4P.OldPrefControl, 0, C4MaxControlSet-1);
|
||||
ctrl_name_lbl = new C4GUI::Label("CtrlName", ctrl_name_rect, ALeft, C4StartupFontClr, pSmallFont, false, false, true);
|
||||
AddElement(ctrl_name_lbl);
|
||||
UpdatePlayerControl();
|
||||
// place picture button
|
||||
AddElement(pPictureBtn = new C4GUI::CallbackButton<C4StartupPlrPropertiesDlg, C4GUI::IconButton>(C4GUI::Ico_Player, caPictureArea.GetAll(), 'P' /* 2do */, &C4StartupPlrPropertiesDlg::OnPictureBtn));
|
||||
pPictureBtn->SetToolTip(LoadResStr("IDS_DESC_SELECTAPICTUREANDORLOBBYI"));
|
||||
UpdateBigIcon();
|
||||
UpdatePlayerColor(true);
|
||||
|
||||
C4GUI::ComponentAligner caSkin(caSkinArea.GetFromTop(iControlPicSize), 2,0);
|
||||
szTip = LoadResStr("IDS_DLGTIP_PLAYERCREWSKIN");
|
||||
AddElement(pBtn = new C4GUI::CallbackButton<C4StartupPlrPropertiesDlg, C4GUI::ArrowButton>(C4GUI::ArrowButton::Left, caSkin.GetFromLeft(C4GUI::ArrowButton::GetDefaultWidth()), &C4StartupPlrPropertiesDlg::OnSkinChangeLeft));
|
||||
pBtn->SetToolTip(szTip);
|
||||
C4Facet &rfctSkinPic = ::GraphicsResource.fctClonkSkin.GetPhase(0);
|
||||
AddElement(pSkinImg = new C4GUI::Picture(caSkin.GetFromLeft(rfctSkinPic.GetWidthByHeight(caSkin.GetHeight())), true));
|
||||
pSkinImg->SetToolTip(szTip);
|
||||
pSkinImg->SetFacet(::GraphicsResource.fctClonkSkin.GetPhase(0));
|
||||
AddElement(pBtn = new C4GUI::CallbackButton<C4StartupPlrPropertiesDlg, C4GUI::ArrowButton>(C4GUI::ArrowButton::Right, caSkin.GetFromLeft(C4GUI::ArrowButton::GetDefaultWidth()), &C4StartupPlrPropertiesDlg::OnSkinChangeRight));
|
||||
pBtn->SetToolTip(szTip);
|
||||
caSkin.ExpandLeft(-10);
|
||||
UpdatePlayerSkin();
|
||||
|
||||
caMain.ExpandTop(-BetweenElementDist);
|
||||
// AutoStopControl: currently unused
|
||||
// once we have an idea how many control schemes we have, we might revive this for selecting e.g. between "Mouse+Keyboard" and "Gamepad".
|
||||
|
@ -1475,10 +1495,6 @@ void C4StartupPlrPropertiesDlg::UpdatePlayerControl()
|
|||
ctrl_name_lbl->SetText(control_set->GetGUIName());
|
||||
else
|
||||
ctrl_name_lbl->SetText("???");
|
||||
// update mouse image
|
||||
// button only available if selected control set offers mouse control
|
||||
// pMouseBtn->SetVisibility(control_set && control_set->HasMouse());
|
||||
// pMouseBtn->SetIcon((C4P.PrefMouse) ? C4GUI::Ico_MouseOn : C4GUI::Ico_MouseOff);
|
||||
}
|
||||
|
||||
void C4StartupPlrPropertiesDlg::OnCtrlChangeLeft(C4GUI::Control *pBtn)
|
||||
|
@ -1505,11 +1521,22 @@ void C4StartupPlrPropertiesDlg::OnCtrlChangeRight(C4GUI::Control *pBtn)
|
|||
UpdatePlayerControl();
|
||||
}
|
||||
|
||||
void C4StartupPlrPropertiesDlg::OnCtrlChangeMouse(C4GUI::Control *pBtn)
|
||||
void C4StartupPlrPropertiesDlg::UpdatePlayerSkin()
|
||||
{
|
||||
// toggle mouse usage
|
||||
C4P.PrefMouse = !C4P.PrefMouse;
|
||||
UpdatePlayerControl();
|
||||
pSkinImg->SetFacet(::GraphicsResource.fctClonkSkin.GetPhase(C4P.PrefClonkSkin));
|
||||
}
|
||||
|
||||
void C4StartupPlrPropertiesDlg::OnSkinChangeLeft(C4GUI::Control *pBtn)
|
||||
{
|
||||
// previous skin in list
|
||||
C4P.PrefClonkSkin = C4P.PrefClonkSkin ? C4P.PrefClonkSkin - 1 : 3;
|
||||
UpdatePlayerSkin();
|
||||
}
|
||||
void C4StartupPlrPropertiesDlg::OnSkinChangeRight(C4GUI::Control *pBtn)
|
||||
{
|
||||
// next skin in list
|
||||
C4P.PrefClonkSkin = (C4P.PrefClonkSkin + 1) % 4;
|
||||
UpdatePlayerSkin();
|
||||
}
|
||||
|
||||
void C4StartupPlrPropertiesDlg::UserClose(bool fOK)
|
||||
|
|
|
@ -242,6 +242,7 @@ protected:
|
|||
C4GUI::CheckBox *pAutoStopControl; // wether the player uses AutoStopControl
|
||||
C4GUI::IconButton *pClrPreview;
|
||||
C4GUI::Picture *pCtrlImg;
|
||||
C4GUI::Picture *pSkinImg;
|
||||
C4GUI::IconButton *pMouseBtn, *pJumpNRunBtn, *pClassicBtn, *pPictureBtn;
|
||||
C4GUI::Label *ctrl_name_lbl;
|
||||
C4PlayerInfoCore C4P; // player info core copy currently being edited
|
||||
|
@ -264,12 +265,14 @@ protected:
|
|||
void OnClrChangeCustom(C4GUI::Control *pBtn);
|
||||
void OnCtrlChangeLeft(C4GUI::Control *pBtn);
|
||||
void OnCtrlChangeRight(C4GUI::Control *pBtn);
|
||||
void OnCtrlChangeMouse(C4GUI::Control *pBtn);
|
||||
void OnSkinChangeLeft(C4GUI::Control *pBtn);
|
||||
void OnSkinChangeRight(C4GUI::Control *pBtn);
|
||||
void OnPictureBtn(C4GUI::Control *pBtn);
|
||||
|
||||
private:
|
||||
void UpdatePlayerColor(bool fUpdateSliders);
|
||||
void UpdatePlayerControl();
|
||||
void UpdatePlayerSkin();
|
||||
void UpdateBigIcon();
|
||||
|
||||
bool SetNewPicture(C4Surface &srcSfc, C4FacetSurface *trgFct, int32_t iMaxSize, bool fColorize);
|
||||
|
|
|
@ -52,9 +52,12 @@ void C4GraphicsResource::Default()
|
|||
|
||||
sfcControl.Default();
|
||||
idSfcControl = 0;
|
||||
sfcClonkSkins.Default();
|
||||
idSfcClonkSkins = 0;
|
||||
|
||||
fctPlayer.Default();
|
||||
fctFlag.Default();
|
||||
fctClonkSkin.Default();
|
||||
fctCrew.Default();
|
||||
fctWealth.Default();
|
||||
fctRank.Default();
|
||||
|
@ -97,6 +100,8 @@ void C4GraphicsResource::Clear()
|
|||
|
||||
sfcControl.Clear();
|
||||
idSfcControl = 0;
|
||||
sfcClonkSkins.Clear();
|
||||
idSfcClonkSkins = 0;
|
||||
|
||||
fctCrewClr.Clear();
|
||||
fctFlagClr.Clear();
|
||||
|
@ -224,6 +229,10 @@ bool C4GraphicsResource::Init()
|
|||
fctOKCancel.Set(&sfcControl,128,100,32,32);
|
||||
fctMouse.Set(&sfcControl,198,100,32,32);
|
||||
|
||||
// Clonk style selection
|
||||
if (!LoadFile(sfcClonkSkins, "ClonkSkins", Files, idSfcClonkSkins)) return false;
|
||||
fctClonkSkin.Set(&sfcClonkSkins,0,0,64,64);
|
||||
|
||||
// Facet bitmap resources
|
||||
if (!LoadFile(fctFire, "Fire", Files, C4FCT_Height)) return false;
|
||||
if (!LoadFile(fctBackground, "Background", Files)) return false;
|
||||
|
|
|
@ -37,10 +37,10 @@ public:
|
|||
C4GraphicsResource();
|
||||
~C4GraphicsResource();
|
||||
protected:
|
||||
C4Surface sfcControl;
|
||||
C4Surface sfcControl, sfcClonkSkins;
|
||||
C4Surface sfcCaption, sfcButton, sfcButtonD;
|
||||
C4Surface sfcScroll, sfcContext;
|
||||
int32_t idSfcCaption, idSfcButton, idSfcButtonD, idSfcScroll, idSfcContext;
|
||||
int32_t idSfcCaption, idSfcButton, idSfcButtonD, idSfcScroll, idSfcContext, idSfcClonkSkins;
|
||||
int32_t idSfcControl; // id of source group of control surface
|
||||
// ID of last group in main group set that was already registered into the Files-set
|
||||
// used to avoid doubled entries by subsequent calls to RegisterMainGroups
|
||||
|
@ -70,6 +70,7 @@ public:
|
|||
C4FacetID fctHand;
|
||||
C4FacetID fctGamepad;
|
||||
C4FacetID fctBuild;
|
||||
C4Facet fctClonkSkin;
|
||||
C4Facet fctCursor;
|
||||
C4Facet fctDropTarget;
|
||||
C4Facet fctKeyboard;
|
||||
|
|
Loading…
Reference in New Issue