forked from Mirrors/openclonk
OnNameChanged-callback, disabled DX in the options
parent
528621bde8
commit
ca7b610dca
|
@ -13,11 +13,8 @@
|
|||
|
||||
#include Library_Bars
|
||||
|
||||
/*
|
||||
TODO: Callback when the name is changed
|
||||
*/
|
||||
|
||||
local crew, breathbar, magicbar, hotkey, cleared;
|
||||
local crew, breathbar, magicbar, hotkey;
|
||||
local energypos, magicpos;
|
||||
|
||||
public func BarSpacing() { return -4; }
|
||||
public func HealthBarHeight() { return 14; }
|
||||
|
@ -58,7 +55,8 @@ protected func Construction()
|
|||
breathbar = false;
|
||||
magicbar = false;
|
||||
hotkey = false;
|
||||
cleared = false;
|
||||
energypos = 0;
|
||||
magicpos = 0;
|
||||
|
||||
// parallaxity
|
||||
this["Parallaxity"] = [0,0];
|
||||
|
@ -118,18 +116,24 @@ public func SetHotkey(int num)
|
|||
SetClrModulation(HSL(0,0,180),12);
|
||||
}
|
||||
|
||||
private func ClearMessage()
|
||||
{
|
||||
if(cleared) return;
|
||||
CustomMessage("",this,crew->GetOwner());
|
||||
cleared = true;
|
||||
}
|
||||
|
||||
public func CrewGone()
|
||||
{
|
||||
RemoveObject();
|
||||
}
|
||||
|
||||
private func UpdateTexts()
|
||||
{
|
||||
CustomMessage("",this,crew->GetOwner());
|
||||
|
||||
if(crew->GetEnergy() > 0)
|
||||
CustomMessage(Format("@<c dddd00>%d</c>",crew->GetEnergy()), this, crew->GetOwner(), energypos, GetDefHeight()/2 + BarOffset(0) + 14, nil, nil, nil, MSG_Multiple);
|
||||
|
||||
if(crew->GetMagicEnergy() > 0)
|
||||
CustomMessage(Format("@<c 1188cc>%d</c>",crew->GetMagicEnergy()), this, crew->GetOwner(), magicpos, GetDefHeight()/2 + BarOffset(1) + 14, nil, nil, nil, MSG_Multiple);
|
||||
|
||||
CustomMessage(Format("@%s",crew->GetName()), this, crew->GetOwner(), 0, GetDefHeight(), nil, nil, nil, MSG_Multiple);
|
||||
}
|
||||
|
||||
public func UpdateController()
|
||||
{
|
||||
if(!crew) return;
|
||||
|
@ -178,7 +182,7 @@ public func UpdateTitleGraphic()
|
|||
//SetColorDw(crew->GetColorDw());
|
||||
}
|
||||
|
||||
public func UpdateHealthBar(bool nocall)
|
||||
public func UpdateHealthBar()
|
||||
{
|
||||
if(!crew) return;
|
||||
var phys = crew->GetPhysical("Energy");
|
||||
|
@ -186,16 +190,10 @@ public func UpdateHealthBar(bool nocall)
|
|||
if(phys == 0) promille = 0;
|
||||
else promille = 1000 * crew->GetEnergy() / (phys / 1000);
|
||||
|
||||
// if this function has not been called by UpdateMagicBar
|
||||
if(!nocall)
|
||||
{
|
||||
ClearMessage();
|
||||
UpdateMagicBar(true);
|
||||
SetBarProgress(promille,0);
|
||||
UpdateName();
|
||||
}
|
||||
if(promille > 0)
|
||||
CustomMessage(Format("@<c dddd00>%d</c>",crew->GetEnergy()), this, crew->GetOwner(), -GetDefWidth()/2*(1000-promille)/1000, GetDefHeight()/2 + BarOffset(0) + 14, nil, nil, nil, MSG_Multiple);
|
||||
energypos = -GetDefWidth()/2*(1000-promille)/1000;
|
||||
|
||||
SetBarProgress(promille,0);
|
||||
UpdateTexts();
|
||||
}
|
||||
|
||||
public func UpdateBreathBar()
|
||||
|
@ -223,20 +221,14 @@ public func UpdateBreathBar()
|
|||
|
||||
}
|
||||
|
||||
public func UpdateMagicBar(bool nocall)
|
||||
public func UpdateMagicBar()
|
||||
{
|
||||
if(!crew) return;
|
||||
var phys = crew->GetPhysical("Magic");
|
||||
var promille = 0;
|
||||
if(phys != 0) promille = 1000 * crew->GetMagicEnergy() / (phys / 1000);
|
||||
|
||||
// if this function has not been called by UpdateHealthBar
|
||||
if(!nocall)
|
||||
{
|
||||
ClearMessage();
|
||||
UpdateHealthBar(true);
|
||||
UpdateName();
|
||||
}
|
||||
magicpos = -GetDefWidth()/2*(1000-promille)/1000;
|
||||
|
||||
// remove magic bar if no physical magic!
|
||||
if(phys == 0)
|
||||
|
@ -249,19 +241,15 @@ public func UpdateMagicBar(bool nocall)
|
|||
{
|
||||
if(!magicbar)
|
||||
AddMagicBar();
|
||||
|
||||
if(promille > 0)
|
||||
CustomMessage(Format("@<c 1188cc>%d</c>",crew->GetMagicEnergy()), this, crew->GetOwner(), -GetDefWidth()/2*(1000-promille)/1000, GetDefHeight()/2 + BarOffset(1) + 14, nil, nil, nil, MSG_Multiple);
|
||||
|
||||
if(!nocall)
|
||||
SetBarProgress(promille,2);
|
||||
SetBarProgress(promille,2);
|
||||
}
|
||||
UpdateTexts();
|
||||
}
|
||||
|
||||
private func UpdateName()
|
||||
{
|
||||
CustomMessage(Format("@%s",crew->GetName()), this, crew->GetOwner(), 0, GetDefHeight(), nil, nil, nil, MSG_Multiple);
|
||||
cleared = false;
|
||||
UpdateTexts();
|
||||
}
|
||||
|
||||
private func BarOffset(int num)
|
||||
|
|
|
@ -42,6 +42,7 @@ protected func OnPromotion() { if(HUDselector) HUDselector->UpdateRank(); return
|
|||
protected func OnEnergyChange() { if(HUDselector) HUDselector->UpdateHealthBar(); return _inherited(...); }
|
||||
protected func OnBreathChange() { if(HUDselector) HUDselector->UpdateBreathBar(); return _inherited(...); }
|
||||
protected func OnMagicEnergyChange() { if(HUDselector) HUDselector->UpdateMagicBar(); return _inherited(...); }
|
||||
protected func OnNameChanged() { if(HUDselector) HUDselector->UpdateName(); return _inherited(...); }
|
||||
|
||||
protected func OnPhysicalChange(string physical, int change, int mode)
|
||||
{
|
||||
|
|
|
@ -9,12 +9,18 @@ public func GetGeneratorPriority() { return 256; }
|
|||
|
||||
local wind_anim;
|
||||
|
||||
protected func Construction()
|
||||
{
|
||||
SetProperty("MeshTransformation",Trans_Rotate(RandomX(5,25)*(Random(2)*2-1),0,1,0));
|
||||
return _inherited(...);
|
||||
}
|
||||
|
||||
protected func Initialize()
|
||||
{
|
||||
wind_anim = PlayAnimation("Turn", 5, Anim_Const(0), Anim_Const(1000));
|
||||
// Set initial position
|
||||
Wind2Turn();
|
||||
return _inherited(...);
|
||||
wind_anim = PlayAnimation("Turn", 5, Anim_Const(0), Anim_Const(1000));
|
||||
// Set initial position
|
||||
Wind2Turn();
|
||||
return _inherited(...);
|
||||
}
|
||||
|
||||
func Wind2Turn()
|
||||
|
|
|
@ -1076,11 +1076,13 @@ static bool FnSetName(C4AulContext *cthr, C4String *pNewName, bool fSetInInfo, b
|
|||
}
|
||||
SCopy(szName, pInfo->Name, C4MaxName);
|
||||
cthr->Obj->SetName(); // make sure object uses info name
|
||||
cthr->Obj->Call(PSF_NameChange,&C4AulParSet(C4VBool(true)));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!pNewName) cthr->Obj->SetName();
|
||||
else cthr->Obj->SetName(pNewName->GetCStr());
|
||||
cthr->Obj->Call(PSF_NameChange,&C4AulParSet(C4VBool(false)));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -81,7 +81,6 @@ bool C4ValueToMatrix(const C4ValueArray& array, StdMeshMatrix* matrix);
|
|||
#define PSF_InitializeScriptPlayer "~InitializeScriptPlayer" // iPlayer, idTeam
|
||||
#define PSF_PreInitializePlayer "~PreInitializePlayer" // iPlayer
|
||||
#define PSF_RemovePlayer "~RemovePlayer" // iPlayer
|
||||
#define PSF_OnGameOver "~OnGameOver"
|
||||
#define PSF_Time1 "~Time1"
|
||||
#define PSF_Hit "~Hit"
|
||||
#define PSF_Hit2 "~Hit2"
|
||||
|
@ -115,8 +114,6 @@ bool C4ValueToMatrix(const C4ValueArray& array, StdMeshMatrix* matrix);
|
|||
#define PSF_CatchBlow "~CatchBlow" // iLevel, pByObject
|
||||
#define PSF_QueryCatchBlow "~QueryCatchBlow" // pByObject
|
||||
#define PSF_Stuck "~Stuck"
|
||||
#define PSF_RejectCollection "~RejectCollect" // idObject, pObject
|
||||
#define PSF_RejectContents "~RejectContents" // blocks opening of activate/get/contents menus; no parameters
|
||||
#define PSF_GrabLost "~GrabLost"
|
||||
#define PSF_LineBreak "~LineBreak" // iCause
|
||||
#define PSF_BuildNeedsMaterial "~BuildNeedsMaterial" // idMat1, iAmount1, idMat2, iAmount2...
|
||||
|
@ -129,52 +126,69 @@ bool C4ValueToMatrix(const C4ValueArray& array, StdMeshMatrix* matrix);
|
|||
#define PSF_MenuQueryCancel "~MenuQueryCancel" // int iSelection
|
||||
#define PSF_IsFulfilled "~IsFulfilled"
|
||||
#define PSF_IsFulfilledforPlr "~IsFulfilledforPlr" // int iCallPlayer
|
||||
#define PSF_RejectEntrance "~RejectEntrance" // C4Object *pIntoObj
|
||||
#define PSF_RejectFight "~RejectFight" // C4Object* pEnemy
|
||||
#define PSF_AttachTargetLost "~AttachTargetLost"
|
||||
#define PSF_CrewSelection "~CrewSelection" // bool fDeselect, bool fCursorOnly
|
||||
#define PSF_GetObject2Drop "~GetObject2Drop" // C4Object *pForCollectionOfObj
|
||||
#define PSF_LeagueGetResult "~LeagueGetResult" // int iForPlr
|
||||
#define PSF_MenuSelection "~OnMenuSelection" // int iItemIndex, C4Object *pMenuObject
|
||||
#define PSF_OnActionJump "~OnActionJump" // int iXDir100, iYDir100
|
||||
#define PSF_FireMode "~FireMode"
|
||||
#define PSF_FrameDecoration "~FrameDecoration%s"
|
||||
#define PSF_GetFairCrewPhysical "~GetFairCrewPhysical" // C4String *szPhysicalName, int iRank, int iPrevPhysical
|
||||
#define PSF_DoMagicEnergy "DoMagicEnergy" // int iChange, C4Object *pObj, bool fAllowPartial
|
||||
#define PSF_GetCustomComponents "~GetCustomComponents" // C4Object *pBuilder
|
||||
#define PSF_CalcBuyValue "~CalcBuyValue" // C4ID idItem, int iDefValue
|
||||
#define PSF_CalcSellValue "~CalcSellValue" // C4Object *pObj, int iObjValue
|
||||
#define PSF_MouseSelection "~MouseSelection" // int iByPlr
|
||||
#define PSF_MouseSelectionAlt "~MouseSelectionAlt" // int iByPlr
|
||||
#define PSF_OnOwnerChanged "~OnOwnerChanged" // iNewOwner, iOldOwner
|
||||
#define PSF_OnJoinCrew "~Recruitment" // int Player
|
||||
#define PSF_OnRemoveCrew "~DeRecruitment" // int Player
|
||||
|
||||
|
||||
// Effect callbacks
|
||||
|
||||
#define PSF_FxStart "Fx%sStart" // C4Object *pTarget, int iEffectNumber, int iTemp, C4Value vVar1, C4Value vVar2, C4Value vVar3, C4Value vVar4
|
||||
#define PSF_FxStop "Fx%sStop" // C4Object *pTarget, int iEffectNumber, int iReason, bool fTemp
|
||||
#define PSF_FxTimer "Fx%sTimer" // C4Object *pTarget, int iEffectNumber, int iEffectTime
|
||||
#define PSF_FxEffect "Fx%sEffect" // C4String *szNewEffect, C4Object *pTarget, int iEffectNumber, int iNewEffectNumber, C4Value vNewEffectVar1, C4Value vNewEffectVar2, C4Value vNewEffectVar3, C4Value vNewEffectVar4
|
||||
#define PSF_FxDamage "Fx%sDamage" // C4Object *pTarget, int iEffectNumber, int iDamage, int iCause, int iCausePlayer
|
||||
#define PSF_FxCustom "Fx%s%s" // C4Object *pTarget, int iEffectNumber, C4Value vVar1, C4Value vVar2, C4Value vVar3, C4Value vVar4, C4Value vVar5, C4Value vVar6, C4Value vVar7
|
||||
#define PSF_FireMode "~FireMode"
|
||||
#define PSF_FrameDecoration "~FrameDecoration%s"
|
||||
#define PSF_GetFairCrewPhysical "~GetFairCrewPhysical" // C4String *szPhysicalName, int iRank, int iPrevPhysical
|
||||
#define PSF_DoMagicEnergy "DoMagicEnergy" // int iChange, C4Object *pObj, bool fAllowPartial
|
||||
#define PSF_GetCustomComponents "~GetCustomComponents" // C4Object *pBuilder
|
||||
#define PSF_RejectHostilityChange "~RejectHostilityChange" // int iPlr1, int iPlr2, bool fNewHostility
|
||||
#define PSF_RejectTeamSwitch "~RejectTeamSwitch" // int iPlr, int idNewTeam
|
||||
#define PSF_OnHostilityChange "~OnHostilityChange" // int iPlr1, int iPlr2, bool fNewHostility, bool fOldHostility
|
||||
#define PSF_OnTeamSwitch "~OnTeamSwitch" // int iPlr1, int idNewTeam, int idOldTeam
|
||||
#define PSF_OnOwnerRemoved "~OnOwnerRemoved"
|
||||
#define PSF_PlayerControl "PlayerControl" // int iPlr, int iControl, C4ID idControlExtraData, int x, int y, int iStrength, bool fRepeated, bool fReleased
|
||||
#define PSF_Definition "~Definition" // proplist definition
|
||||
|
||||
// Controls
|
||||
|
||||
#define PSF_PlayerControl "PlayerControl" // int iPlr, int iControl, C4ID idControlExtraData, int x, int y, int iStrength, bool fRepeated, bool fReleased
|
||||
#define PSF_MouseSelection "~MouseSelection" // int iByPlr
|
||||
#define PSF_MouseSelectionAlt "~MouseSelectionAlt" // int iByPlr
|
||||
#define PSF_MouseDragDrop "~MouseDragDrop" // int iPlr, C4Object *source, C4Object *target
|
||||
|
||||
// Proplist
|
||||
|
||||
#define PSF_Definition "~Definition" // proplist definition
|
||||
|
||||
// Reject* Callbacks
|
||||
|
||||
#define PSF_RejectHostilityChange "~RejectHostilityChange" // int iPlr1, int iPlr2, bool fNewHostility
|
||||
#define PSF_RejectTeamSwitch "~RejectTeamSwitch" // int iPlr, int idNewTeam
|
||||
#define PSF_RejectEntrance "~RejectEntrance" // C4Object *pIntoObj
|
||||
#define PSF_RejectFight "~RejectFight" // C4Object* pEnemy
|
||||
#define PSF_RejectCollection "~RejectCollect" // idObject, pObject
|
||||
#define PSF_RejectContents "~RejectContents" // blocks opening of activate/get/contents menus; no parameters
|
||||
|
||||
// On* Callbacks
|
||||
|
||||
#define PSF_OnGameOver "~OnGameOver"
|
||||
#define PSF_MenuSelection "~OnMenuSelection" // int iItemIndex, C4Object *pMenuObject
|
||||
#define PSF_OnActionJump "~OnActionJump" // int iXDir100, iYDir100
|
||||
#define PSF_OnOwnerChanged "~OnOwnerChanged" // iNewOwner, iOldOwner
|
||||
#define PSF_EnergyChange "~OnEnergyChange" // int iChange, int iCause, int iCausedByPlayer
|
||||
#define PSF_BreathChange "~OnBreathChange" // int iChange
|
||||
#define PSF_OnHostilityChange "~OnHostilityChange" // int iPlr1, int iPlr2, bool fNewHostility, bool fOldHostility
|
||||
#define PSF_OnTeamSwitch "~OnTeamSwitch" // int iPlr1, int idNewTeam, int idOldTeam
|
||||
#define PSF_OnOwnerRemoved "~OnOwnerRemoved"
|
||||
#define PSF_MagicEnergyChange "~OnMagicEnergyChange" // int iChange
|
||||
#define PSF_Promotion "~OnPromotion"
|
||||
#define PSF_PhysicalChange "~OnPhysicalChange" // C4String *Physical, int iChange, int iMode
|
||||
#define PSF_CrewEnabled "~OnCrewEnabled"
|
||||
#define PSF_CrewDisabled "~OnCrewDisabled"
|
||||
|
||||
#define PSF_NameChange "~OnNameChanged" // bool inInfoSection
|
||||
#define PSF_OnWealthChanged "~OnWealthChanged" // int iPlr
|
||||
|
||||
#define PSF_MouseDragDrop "~MouseDragDrop" // int iPlr, C4Object *source, C4Object *target
|
||||
|
||||
// Fx%s is automatically prefixed
|
||||
#define PSFS_FxAdd "Add" // C4Object *pTarget, int iEffectNumber, C4String *szNewEffect, int iNewTimer, C4Value vNewEffectVar1, C4Value vNewEffectVar2, C4Value vNewEffectVar3, C4Value vNewEffectVar4
|
||||
#define PSFS_FxInfo "Info" // C4Object *pTarget, int iEffectNumber
|
||||
|
|
|
@ -786,6 +786,7 @@ C4StartupOptionsDlg::C4StartupOptionsDlg() : C4StartupDlg(LoadResStrNoAmp("IDS_D
|
|||
#ifndef USE_GL
|
||||
pCheckGfxEngines[GFXENGN_OPENGL]->SetEnabled(false);
|
||||
#endif
|
||||
pCheckGfxEngines[GFXENGN_DIRECTX]->SetEnabled(false); // as long as DX doesnt work, its disabled
|
||||
pCheckGfxEngines[GFXENGN_DIRECTXS]->SetEnabled(false); // better not using this
|
||||
// --subgroup resolution
|
||||
C4GUI::GroupBox *pGroupResolution = new C4GUI::GroupBox(caSheetGraphics.GetGridCell(1,2,0,3));
|
||||
|
|
Loading…
Reference in New Issue