87 [[nodiscard]]
virtual auto Copy()
const ->
Actor*;
88 virtual void InitState();
89 virtual void LoadFromNode(
const XNode* pNode);
91 static void SetBGMTime(
float fTime,
95 static void SetPlayerBGMBeat(
float fBeat,
float fBeatNoOffset);
127 CLOCK_BGM_TIME_NO_OFFSET,
128 CLOCK_BGM_BEAT_NO_OFFSET,
129 CLOCK_BGM_BEAT_PLAYER1,
130 CLOCK_BGM_BEAT_PLAYER2,
131 CLOCK_LIGHT_1 = 1000,
132 CLOCK_LIGHT_LAST = 1100,
142 static void MakeWeightedAverage(
TweenState& average_out,
145 float fPercentBetween);
146 auto operator==(
const TweenState& other)
const -> bool;
147 auto operator!=(
const TweenState& other)
const ->
bool
149 return !operator==(other);
157 float fSkewX{}, fSkewY{};
180 [[nodiscard]]
auto PartiallyOpaque() const ->
bool;
181 auto IsOver(
float mx,
float my) ->
bool;
183 auto GetFakeParentOrParent() ->
Actor*;
184 auto GetTrueX() ->
float;
185 auto GetTrueY() ->
float;
186 auto GetTrueZ() ->
float;
187 auto GetTrueRotationX() ->
float;
188 auto GetTrueRotationY() ->
float;
189 auto GetTrueRotationZ() ->
float;
190 auto GetTrueZoom() ->
float;
191 auto GetTrueZoomX() ->
float;
192 auto GetTrueZoomY() ->
float;
193 auto GetTrueZoomZ() ->
float;
194 auto IsVisible() ->
bool;
244 virtual void UpdateInternal(
float fDeltaTime);
245 void UpdateTweening(
float fDeltaTime);
246 void CalcPercentThroughTween();
249 virtual void SetCurrentTweenStart() {}
250 virtual void EraseHeadTween() {}
251 virtual void UpdatePercentThroughTween(
float PercentThroughTween) {}
253 [[nodiscard]]
auto get_tween_uses_effect_delta() const ->
bool
255 return m_tween_uses_effect_delta;
257 void set_tween_uses_effect_delta(
bool t) { m_tween_uses_effect_delta = t; }
278 [[nodiscard]]
auto GetLineage() const -> std::
string;
280 void SetFakeParent(
Actor* mailman) { m_FakeParent = mailman; }
281 [[nodiscard]]
auto GetFakeParent() const ->
Actor* {
return m_FakeParent; }
283 void AddWrapperState();
284 void RemoveWrapperState(
size_t i);
285 auto GetWrapperState(
size_t i) ->
Actor*;
286 [[nodiscard]]
auto GetNumWrapperStates() const ->
size_t
288 return m_WrapperStates.size();
294 [[nodiscard]]
auto GetX() const ->
float {
return m_current.pos.x; };
298 [[nodiscard]]
auto GetY() const ->
float {
return m_current.pos.y; };
302 [[nodiscard]]
auto GetZ() const ->
float {
return m_current.pos.z; };
303 [[nodiscard]]
auto GetDestX() const ->
float
305 return DestTweenState().pos.x;
307 [[nodiscard]]
auto GetDestY() const ->
float
309 return DestTweenState().pos.y;
311 [[nodiscard]]
auto GetDestZ() const ->
float
313 return DestTweenState().pos.z;
315 void SetX(
float x) { DestTweenState().pos.x = x; };
316 void SetY(
float y) { DestTweenState().pos.y = y; };
317 void SetZ(
float z) { DestTweenState().pos.z = z; };
318 void SetXY(
float x,
float y)
320 DestTweenState().pos.x = x;
321 DestTweenState().pos.y = y;
326 void AddX(
float x) { SetX(GetDestX() + x); }
330 void AddY(
float y) { SetY(GetDestY() + y); }
334 void AddZ(
float z) { SetZ(GetDestZ() + z); }
337 [[nodiscard]]
auto GetUnzoomedWidth() const ->
float {
return m_size.x; }
338 [[nodiscard]]
auto GetUnzoomedHeight() const ->
float {
return m_size.y; }
340 [[nodiscard]]
auto GetZoomedWidth() const ->
float
342 return m_size.x * m_baseScale.x * DestTweenState().scale.x;
345 [[nodiscard]]
auto GetZoomedHeight() const ->
float
347 return m_size.y * m_baseScale.y * DestTweenState().scale.y;
349 void SetWidth(
float width) { m_size.x = width; }
350 void SetHeight(
float height) { m_size.y = height; }
353 [[nodiscard]]
auto GetBaseZoomX() const ->
float {
return m_baseScale.x; }
354 void SetBaseZoomX(
float zoom) { m_baseScale.x = zoom; }
355 [[nodiscard]]
auto GetBaseZoomY() const ->
float {
return m_baseScale.y; }
356 void SetBaseZoomY(
float zoom) { m_baseScale.y = zoom; }
357 [[nodiscard]]
auto GetBaseZoomZ() const ->
float {
return m_baseScale.z; }
358 void SetBaseZoomZ(
float zoom) { m_baseScale.z = zoom; }
359 void SetBaseZoom(
float zoom)
363 void SetBaseRotationX(
float rot) { m_baseRotation.x = rot; }
364 void SetBaseRotationY(
float rot) { m_baseRotation.y = rot; }
365 void SetBaseRotationZ(
float rot) { m_baseRotation.z = rot; }
366 void SetBaseRotation(
const RageVector3& rot) { m_baseRotation = rot; }
367 virtual void SetBaseAlpha(
float fAlpha) { m_fBaseAlpha = fAlpha; }
368 void SetInternalDiffuse(
const RageColor& c) { m_internalDiffuse = c; }
369 void SetInternalGlow(
const RageColor& c) { m_internalGlow = c; }
379 return DestTweenState().scale.x;
386 return DestTweenState().scale.x;
393 return DestTweenState().scale.y;
400 return DestTweenState().scale.z;
407 DestTweenState().scale.x = zoom;
408 DestTweenState().scale.y = zoom;
409 DestTweenState().scale.z = zoom;
414 void SetZoomX(
float zoom) { DestTweenState().scale.x = zoom; }
418 void SetZoomY(
float zoom) { DestTweenState().scale.y = zoom; }
422 void SetZoomZ(
float zoom) { DestTweenState().scale.z = zoom; }
423 void ZoomTo(
float fX,
float fY)
428 void ZoomToWidth(
float zoom) {
SetZoomX(zoom / GetUnzoomedWidth()); }
429 void ZoomToHeight(
float zoom) {
SetZoomY(zoom / GetUnzoomedHeight()); }
431 [[nodiscard]]
auto GetRotationX() const ->
float
433 return DestTweenState().rotation.x;
435 [[nodiscard]]
auto GetRotationY() const ->
float
437 return DestTweenState().rotation.y;
439 [[nodiscard]]
auto GetRotationZ() const ->
float
441 return DestTweenState().rotation.z;
443 void SetRotationX(
float rot) { DestTweenState().rotation.x = rot; }
444 void SetRotationY(
float rot) { DestTweenState().rotation.y = rot; }
445 void SetRotationZ(
float rot) { DestTweenState().rotation.z = rot; }
447 void AddRotationX(
float rot) { DestTweenState().rotation.x += rot; };
448 void AddRotationY(
float rot) { DestTweenState().rotation.y += rot; };
449 void AddRotationZ(
float rot) { DestTweenState().rotation.z += rot; };
451 void AddRotationH(
float rot);
452 void AddRotationP(
float rot);
453 void AddRotationR(
float rot);
455 void SetSkewX(
float fAmount) { DestTweenState().fSkewX = fAmount; }
457 [[nodiscard]]
auto GetSkewX(
float )
const ->
float
459 return DestTweenState().fSkewX;
461 void SetSkewY(
float fAmount) { DestTweenState().fSkewY = fAmount; }
463 [[nodiscard]]
auto GetSkewY(
float )
const ->
float
465 return DestTweenState().fSkewY;
468 [[nodiscard]]
auto GetCropLeft() const ->
float
470 return DestTweenState().crop.left;
472 [[nodiscard]]
auto GetCropTop() const ->
float
474 return DestTweenState().crop.top;
476 [[nodiscard]]
auto GetCropRight() const ->
float
478 return DestTweenState().crop.right;
480 [[nodiscard]]
auto GetCropBottom() const ->
float
482 return DestTweenState().crop.bottom;
484 void SetCropLeft(
float percent) { DestTweenState().crop.left = percent; }
485 void SetCropTop(
float percent) { DestTweenState().crop.top = percent; }
486 void SetCropRight(
float percent) { DestTweenState().crop.right = percent; }
487 void SetCropBottom(
float percent)
489 DestTweenState().crop.bottom = percent;
492 void SetFadeLeft(
float percent) { DestTweenState().fade.left = percent; }
493 void SetFadeTop(
float percent) { DestTweenState().fade.top = percent; }
494 void SetFadeRight(
float percent) { DestTweenState().fade.right = percent; }
495 void SetFadeBottom(
float percent)
497 DestTweenState().fade.bottom = percent;
500 void SetGlobalDiffuseColor(
const RageColor& c);
502 virtual void SetDiffuse(
const RageColor& c)
504 for (
auto& i : DestTweenState().diffuse) {
508 virtual void SetDiffuseAlpha(
float f)
510 for (
auto i = 0; i < NUM_DIFFUSE_COLORS; ++i) {
511 auto c = GetDiffuses(i);
517 [[nodiscard]]
auto GetCurrentDiffuseAlpha() const ->
float
521 void SetDiffuseColor(
const RageColor& c);
522 void SetDiffuses(
int i,
const RageColor& c)
524 DestTweenState().diffuse[i] = c;
526 void SetDiffuseUpperLeft(
const RageColor& c)
528 DestTweenState().diffuse[0] = c;
530 void SetDiffuseUpperRight(
const RageColor& c)
532 DestTweenState().diffuse[1] = c;
534 void SetDiffuseLowerLeft(
const RageColor& c)
536 DestTweenState().diffuse[2] = c;
538 void SetDiffuseLowerRight(
const RageColor& c)
540 DestTweenState().diffuse[3] = c;
542 void SetDiffuseTopEdge(
const RageColor& c)
544 DestTweenState().diffuse[0] = DestTweenState().diffuse[1] = c;
546 void SetDiffuseRightEdge(
const RageColor& c)
548 DestTweenState().diffuse[1] = DestTweenState().diffuse[3] = c;
550 void SetDiffuseBottomEdge(
const RageColor& c)
552 DestTweenState().diffuse[2] = DestTweenState().diffuse[3] = c;
554 void SetDiffuseLeftEdge(
const RageColor& c)
556 DestTweenState().diffuse[0] = DestTweenState().diffuse[2] = c;
558 [[nodiscard]]
auto GetDiffuse() const ->
RageColor
560 return DestTweenState().diffuse[0];
562 [[nodiscard]]
auto GetDiffuses(
int i)
const ->
RageColor
564 return DestTweenState().diffuse[i];
566 [[nodiscard]]
auto GetDiffuseAlpha() const ->
float
568 return DestTweenState().diffuse[0].a;
570 void SetGlow(
const RageColor& c) { DestTweenState().glow = c; };
571 [[nodiscard]]
auto GetGlow() const ->
RageColor
573 return DestTweenState().glow;
576 void SetAux(
float f) { DestTweenState().aux = f; }
577 [[nodiscard]]
auto GetAux() const ->
float {
return m_current.
aux; }
579 virtual void BeginTweening(
float time,
ITween* pInterp);
580 virtual void BeginTweening(
float time, TweenType tt = TWEEN_LINEAR);
581 virtual void StopTweening();
582 void Sleep(
float time);
583 void QueueCommand(
const std::string& sCommandName);
584 void QueueMessage(
const std::string& sMessageName);
585 virtual void FinishTweening();
586 virtual void HurryTweening(
float factor);
588 [[nodiscard]]
virtual auto GetTweenTimeLeft() const
590 auto DestTweenState()
593 if (m_Tweens.empty()) {
597 return m_Tweens.back()->state;
601 [[nodiscard]]
auto DestTweenState() const -> const TweenState&
603 return const_cast<Actor*
>(
this)->DestTweenState();
614 void ScaleToCover(
const RectF& rect) { ScaleTo(rect,
cover); }
615 void ScaleToFitInside(
const RectF& rect) { ScaleTo(rect,
fit_inside); };
618 void StretchTo(
const RectF& rect);
622 virtual void SetVertAlign(
float f) {
m_fVertAlign = f; }
623 void SetHorizAlign(HorizAlign ha)
625 SetHorizAlign((ha == HorizAlign_Left)
627 : (ha == HorizAlign_Center) ? 0.5F : +1.0F);
629 void SetVertAlign(VertAlign va)
631 SetVertAlign((va == VertAlign_Top)
633 : (va == VertAlign_Middle) ? 0.5F : +1.0F);
635 virtual auto GetHorizAlign() ->
float {
return m_fHorizAlign; }
636 virtual auto GetVertAlign() ->
float {
return m_fVertAlign; }
639#if defined(SSC_FUTURES)
641 Effect GetEffect(
int i)
const {
return m_Effects[i]; }
643 void StopEffect() { m_Effect = no_effect; }
644 [[nodiscard]]
auto GetEffect() const ->
Effect {
return m_Effect; }
646 [[nodiscard]]
auto GetSecsIntoEffect() const ->
float
648 return m_fSecsIntoEffect;
650 [[nodiscard]]
auto GetEffectDelta() const ->
float
652 return m_fEffectDelta;
657 void SetEffectColor1(
const RageColor& c) { m_effectColor1 = c; }
658 void SetEffectColor2(
const RageColor& c) { m_effectColor2 = c; }
659 void RecalcEffectPeriod();
660 void SetEffectPeriod(
float fTime);
661 [[nodiscard]]
auto GetEffectPeriod() const ->
float
663 return m_effect_period;
665 auto SetEffectTiming(
float ramp_toh,
670 std::string& err) -> bool;
671 auto SetEffectHoldAtFull(
float haf, std::string& err) -> bool;
672 void SetEffectOffset(
float fTime) { m_fEffectOffset = fTime; }
673 void SetEffectClock(
EffectClock c) { m_EffectClock = c; }
674 void SetEffectClockString(
const std::string& s);
678 m_vEffectMagnitude = vec;
681 [[nodiscard]]
auto GetEffectMagnitude() const ->
RageVector3
683 return m_vEffectMagnitude;
686 void ResetEffectTimeIfDifferent(
Effect new_effect);
687 void SetEffectDiffuseBlink(
float fEffectPeriodSeconds,
690 void SetEffectDiffuseShift(
float fEffectPeriodSeconds,
693 void SetEffectDiffuseRamp(
float fEffectPeriodSeconds,
696 void SetEffectGlowBlink(
float fEffectPeriodSeconds,
699 void SetEffectGlowShift(
float fEffectPeriodSeconds,
702 void SetEffectGlowRamp(
float fEffectPeriodSeconds,
705 void SetEffectRainbow(
float fEffectPeriodSeconds);
706 void SetEffectWag(
float fPeriod,
const RageVector3& vect);
707 void SetEffectBounce(
float fPeriod,
const RageVector3& vect);
708 void SetEffectBob(
float fPeriod,
const RageVector3& vect);
709 void SetEffectPulse(
float fPeriod,
float fMinZoom,
float fMaxZoom);
717 [[nodiscard]]
auto GetVisible() const ->
bool {
return m_bVisible; }
718 void SetVisible(
bool b) { m_bVisible = b; }
719 void SetShadowLength(
float fLength)
721 m_fShadowLengthX = fLength;
722 m_fShadowLengthY = fLength;
724 void SetShadowLengthX(
float fLengthX) { m_fShadowLengthX = fLengthX; }
725 void SetShadowLengthY(
float fLengthY) { m_fShadowLengthY = fLengthY; }
726 void SetShadowColor(
const RageColor& c) { m_ShadowColor = c; }
728 void SetDrawOrder(
int iOrder) {
m_iDrawOrder = iOrder; }
729 [[nodiscard]]
auto GetDrawOrder() const ->
int {
return m_iDrawOrder; }
731 virtual void EnableAnimation(
bool b)
735 void StartAnimating() { this->EnableAnimation(
true); }
736 void StopAnimating() { this->EnableAnimation(
false); }
739 void SetBlendMode(BlendMode mode) { m_BlendMode = mode; }
740 void SetTextureTranslate(
float x,
float y)
742 m_texTranslate.x = x;
743 m_texTranslate.y = y;
745 void SetTextureWrapping(
bool b) { m_bTextureWrapping = b; }
746 void SetTextureFiltering(
bool b) { m_bTextureFiltering = b; }
747 void SetClearZBuffer(
bool b) { m_bClearZBuffer = b; }
748 void SetUseZBuffer(
bool b)
750 SetZTestMode(b ? ZTEST_WRITE_ON_PASS : ZTEST_OFF);
753 virtual void SetZTestMode(ZTestMode mode) { m_ZTestMode = mode; }
754 virtual void SetZWrite(
bool b) { m_bZWrite = b; }
755 void SetZBias(
float f) {
m_fZBias = f; }
756 virtual void SetCullMode(CullMode mode) { m_CullMode = mode; }
759 virtual void PushSelf(lua_State* L);
760 virtual void PushContext(lua_State* L);
763 void AddCommand(
const std::string& sCmdName,
764 const apActorCommands& apac,
766 [[nodiscard]]
auto HasCommand(
const std::string& sCmdName)
const -> bool;
767 [[nodiscard]]
auto GetCommand(
const std::string& sCommandName)
const
768 ->
const apActorCommands*;
769 void PlayCommand(
const std::string& sCommandName)
771 HandleMessage(
Message(sCommandName));
773 void PlayCommandNoRecurse(
const Message& msg);
779 virtual void RunCommands(
const apActorCommands& cmds,
782 this->RunCommands(*cmds, pParamTable);
784 virtual void RunCommandsRecursively(
788 RunCommands(cmds, pParamTable);
791 virtual void RunCommandsOnLeaves(
const LuaReference& cmds,
794 RunCommands(cmds, pParamTable);
798 void HandleMessage(
const Message& msg)
override;
801 [[nodiscard]]
virtual auto GetNumStates() const ->
int {
return 1; }
802 virtual void SetState(
int ) {}
803 [[nodiscard]]
virtual auto GetAnimationLengthSeconds() const ->
float
807 virtual void SetSecondsIntoAnimation(
float ) {}
808 virtual void SetUpdateRate(
float ) {}
809 virtual auto GetUpdateRate() ->
float {
return 1.0F; }
811 std::unique_ptr<LuaClass> m_pLuaInstance;
824 std::vector<Actor*> m_WrapperStates;
848 float m_fBaseAlpha{};
853 TweenState m_current;
860 std::vector<TweenStateAndInfo*> m_Tweens;
876#if defined(SSC_FUTURES)
877 std::vector<Effect> m_Effects;
881 float m_fSecsIntoEffect{};
882 float m_fEffectDelta{};
885 float m_effect_ramp_to_half{};
886 float m_effect_hold_at_half{};
887 float m_effect_ramp_to_full{};
888 float m_effect_hold_at_full{};
889 float m_effect_hold_at_zero{};
890 float m_fEffectOffset{};
894 float m_effect_period{};
896 bool m_tween_uses_effect_delta;
900 [[nodiscard]]
auto GetEffectDeltaTime() const ->
float
902 return m_fEffectDelta;
912 bool m_bIsAnimating{};
913 float m_fShadowLengthX{};
914 float m_fShadowLengthY{};
922 BlendMode m_BlendMode;
923 ZTestMode m_ZTestMode;
926 bool m_bTextureWrapping{};
927 bool m_bTextureFiltering{};
928 bool m_bClearZBuffer{};
937 static float g_fCurrentBGMTime, g_fCurrentBGMBeat;
938 static float g_fCurrentBGMTimeNoOffset, g_fCurrentBGMBeatNoOffset;
939 static std::vector<float> g_vfCurrentBGMBeatPlayer;
940 static std::vector<float> g_vfCurrentBGMBeatPlayerNoOffset;
944 std::map<std::string, apActorCommands> m_mapNameToCommands;