88 [[nodiscard]]
virtual auto Copy()
const ->
Actor*;
89 virtual void InitState();
90 virtual void LoadFromNode(
const XNode* pNode);
92 static void SetBGMTime(
float fTime,
96 static void SetPlayerBGMBeat(
float fBeat,
float fBeatNoOffset);
128 CLOCK_BGM_TIME_NO_OFFSET,
129 CLOCK_BGM_BEAT_NO_OFFSET,
130 CLOCK_BGM_BEAT_PLAYER1,
131 CLOCK_BGM_BEAT_PLAYER2,
132 CLOCK_LIGHT_1 = 1000,
133 CLOCK_LIGHT_LAST = 1100,
143 static void MakeWeightedAverage(
TweenState& average_out,
146 float fPercentBetween);
147 auto operator==(
const TweenState& other)
const -> bool;
148 auto operator!=(
const TweenState& other)
const ->
bool
150 return !operator==(other);
158 float fSkewX{}, fSkewY{};
181 [[nodiscard]]
auto PartiallyOpaque() const ->
bool;
182 auto IsOver(
float mx,
float my) ->
bool;
184 auto GetFakeParentOrParent() ->
Actor*;
185 auto GetTrueX() ->
float;
186 auto GetTrueY() ->
float;
187 auto GetTrueZ() ->
float;
188 auto GetTrueRotationX() ->
float;
189 auto GetTrueRotationY() ->
float;
190 auto GetTrueRotationZ() ->
float;
191 auto GetTrueZoom() ->
float;
192 auto GetTrueZoomX() ->
float;
193 auto GetTrueZoomY() ->
float;
194 auto GetTrueZoomZ() ->
float;
195 auto IsVisible() ->
bool;
245 virtual void UpdateInternal(
float fDeltaTime);
246 void UpdateTweening(
float fDeltaTime);
247 void CalcPercentThroughTween();
250 virtual void SetCurrentTweenStart() {}
251 virtual void EraseHeadTween() {}
252 virtual void UpdatePercentThroughTween(
float PercentThroughTween) {}
254 [[nodiscard]]
auto get_tween_uses_effect_delta() const ->
bool
256 return m_tween_uses_effect_delta;
258 void set_tween_uses_effect_delta(
bool t) { m_tween_uses_effect_delta = t; }
279 [[nodiscard]]
auto GetLineage() const -> std::
string;
281 void SetFakeParent(
Actor* mailman) { m_FakeParent = mailman; }
282 [[nodiscard]]
auto GetFakeParent() const ->
Actor* {
return m_FakeParent; }
284 void AddWrapperState();
285 void RemoveWrapperState(
size_t i);
286 auto GetWrapperState(
size_t i) ->
Actor*;
287 [[nodiscard]]
auto GetNumWrapperStates() const ->
size_t
289 return m_WrapperStates.size();
295 [[nodiscard]]
auto GetX() const ->
float {
return m_current.pos.x; };
299 [[nodiscard]]
auto GetY() const ->
float {
return m_current.pos.y; };
303 [[nodiscard]]
auto GetZ() const ->
float {
return m_current.pos.z; };
304 [[nodiscard]]
auto GetDestX() const ->
float
306 return DestTweenState().pos.x;
308 [[nodiscard]]
auto GetDestY() const ->
float
310 return DestTweenState().pos.y;
312 [[nodiscard]]
auto GetDestZ() const ->
float
314 return DestTweenState().pos.z;
316 void SetX(
float x) { DestTweenState().pos.x = x; };
317 void SetY(
float y) { DestTweenState().pos.y = y; };
318 void SetZ(
float z) { DestTweenState().pos.z = z; };
319 void SetXY(
float x,
float y)
321 DestTweenState().pos.x = x;
322 DestTweenState().pos.y = y;
327 void AddX(
float x) { SetX(GetDestX() + x); }
331 void AddY(
float y) { SetY(GetDestY() + y); }
335 void AddZ(
float z) { SetZ(GetDestZ() + z); }
338 [[nodiscard]]
auto GetUnzoomedWidth() const ->
float {
return m_size.x; }
339 [[nodiscard]]
auto GetUnzoomedHeight() const ->
float {
return m_size.y; }
341 [[nodiscard]]
auto GetZoomedWidth() const ->
float
343 return m_size.x * m_baseScale.x * DestTweenState().scale.x;
346 [[nodiscard]]
auto GetZoomedHeight() const ->
float
348 return m_size.y * m_baseScale.y * DestTweenState().scale.y;
350 void SetWidth(
float width) { m_size.x = width; }
351 void SetHeight(
float height) { m_size.y = height; }
354 [[nodiscard]]
auto GetBaseZoomX() const ->
float {
return m_baseScale.x; }
355 void SetBaseZoomX(
float zoom) { m_baseScale.x = zoom; }
356 [[nodiscard]]
auto GetBaseZoomY() const ->
float {
return m_baseScale.y; }
357 void SetBaseZoomY(
float zoom) { m_baseScale.y = zoom; }
358 [[nodiscard]]
auto GetBaseZoomZ() const ->
float {
return m_baseScale.z; }
359 void SetBaseZoomZ(
float zoom) { m_baseScale.z = zoom; }
360 void SetBaseZoom(
float zoom)
364 void SetBaseRotationX(
float rot) { m_baseRotation.x = rot; }
365 void SetBaseRotationY(
float rot) { m_baseRotation.y = rot; }
366 void SetBaseRotationZ(
float rot) { m_baseRotation.z = rot; }
367 void SetBaseRotation(
const RageVector3& rot) { m_baseRotation = rot; }
368 virtual void SetBaseAlpha(
float fAlpha) { m_fBaseAlpha = fAlpha; }
369 void SetInternalDiffuse(
const RageColor& c) { m_internalDiffuse = c; }
370 void SetInternalGlow(
const RageColor& c) { m_internalGlow = c; }
380 return DestTweenState().scale.x;
387 return DestTweenState().scale.x;
394 return DestTweenState().scale.y;
401 return DestTweenState().scale.z;
408 DestTweenState().scale.x = zoom;
409 DestTweenState().scale.y = zoom;
410 DestTweenState().scale.z = zoom;
415 void SetZoomX(
float zoom) { DestTweenState().scale.x = zoom; }
419 void SetZoomY(
float zoom) { DestTweenState().scale.y = zoom; }
423 void SetZoomZ(
float zoom) { DestTweenState().scale.z = zoom; }
424 void ZoomTo(
float fX,
float fY)
429 void ZoomToWidth(
float zoom) {
SetZoomX(zoom / GetUnzoomedWidth()); }
430 void ZoomToHeight(
float zoom) {
SetZoomY(zoom / GetUnzoomedHeight()); }
432 [[nodiscard]]
auto GetRotationX() const ->
float
434 return DestTweenState().rotation.x;
436 [[nodiscard]]
auto GetRotationY() const ->
float
438 return DestTweenState().rotation.y;
440 [[nodiscard]]
auto GetRotationZ() const ->
float
442 return DestTweenState().rotation.z;
444 void SetRotationX(
float rot) { DestTweenState().rotation.x = rot; }
445 void SetRotationY(
float rot) { DestTweenState().rotation.y = rot; }
446 void SetRotationZ(
float rot) { DestTweenState().rotation.z = rot; }
448 void AddRotationX(
float rot) { DestTweenState().rotation.x += rot; };
449 void AddRotationY(
float rot) { DestTweenState().rotation.y += rot; };
450 void AddRotationZ(
float rot) { DestTweenState().rotation.z += rot; };
452 void AddRotationH(
float rot);
453 void AddRotationP(
float rot);
454 void AddRotationR(
float rot);
456 void SetSkewX(
float fAmount) { DestTweenState().fSkewX = fAmount; }
458 [[nodiscard]]
auto GetSkewX(
float )
const ->
float
460 return DestTweenState().fSkewX;
462 void SetSkewY(
float fAmount) { DestTweenState().fSkewY = fAmount; }
464 [[nodiscard]]
auto GetSkewY(
float )
const ->
float
466 return DestTweenState().fSkewY;
469 [[nodiscard]]
auto GetCropLeft() const ->
float
471 return DestTweenState().crop.left;
473 [[nodiscard]]
auto GetCropTop() const ->
float
475 return DestTweenState().crop.top;
477 [[nodiscard]]
auto GetCropRight() const ->
float
479 return DestTweenState().crop.right;
481 [[nodiscard]]
auto GetCropBottom() const ->
float
483 return DestTweenState().crop.bottom;
485 void SetCropLeft(
float percent) { DestTweenState().crop.left = percent; }
486 void SetCropTop(
float percent) { DestTweenState().crop.top = percent; }
487 void SetCropRight(
float percent) { DestTweenState().crop.right = percent; }
488 void SetCropBottom(
float percent)
490 DestTweenState().crop.bottom = percent;
493 void SetFadeLeft(
float percent) { DestTweenState().fade.left = percent; }
494 void SetFadeTop(
float percent) { DestTweenState().fade.top = percent; }
495 void SetFadeRight(
float percent) { DestTweenState().fade.right = percent; }
496 void SetFadeBottom(
float percent)
498 DestTweenState().fade.bottom = percent;
501 void SetGlobalDiffuseColor(
const RageColor& c);
503 virtual void SetDiffuse(
const RageColor& c)
505 for (
auto& i : DestTweenState().diffuse) {
509 virtual void SetDiffuseAlpha(
float f)
511 for (
auto i = 0; i < NUM_DIFFUSE_COLORS; ++i) {
512 auto c = GetDiffuses(i);
518 [[nodiscard]]
auto GetCurrentDiffuseAlpha() const ->
float
522 void SetDiffuseColor(
const RageColor& c);
523 void SetDiffuses(
int i,
const RageColor& c)
525 DestTweenState().diffuse[i] = c;
527 void SetDiffuseUpperLeft(
const RageColor& c)
529 DestTweenState().diffuse[0] = c;
531 void SetDiffuseUpperRight(
const RageColor& c)
533 DestTweenState().diffuse[1] = c;
535 void SetDiffuseLowerLeft(
const RageColor& c)
537 DestTweenState().diffuse[2] = c;
539 void SetDiffuseLowerRight(
const RageColor& c)
541 DestTweenState().diffuse[3] = c;
543 void SetDiffuseTopEdge(
const RageColor& c)
545 DestTweenState().diffuse[0] = DestTweenState().diffuse[1] = c;
547 void SetDiffuseRightEdge(
const RageColor& c)
549 DestTweenState().diffuse[1] = DestTweenState().diffuse[3] = c;
551 void SetDiffuseBottomEdge(
const RageColor& c)
553 DestTweenState().diffuse[2] = DestTweenState().diffuse[3] = c;
555 void SetDiffuseLeftEdge(
const RageColor& c)
557 DestTweenState().diffuse[0] = DestTweenState().diffuse[2] = c;
559 [[nodiscard]]
auto GetDiffuse() const ->
RageColor
561 return DestTweenState().diffuse[0];
563 [[nodiscard]]
auto GetDiffuses(
int i)
const ->
RageColor
565 return DestTweenState().diffuse[i];
567 [[nodiscard]]
auto GetDiffuseAlpha() const ->
float
569 return DestTweenState().diffuse[0].a;
571 void SetGlow(
const RageColor& c) { DestTweenState().glow = c; };
572 [[nodiscard]]
auto GetGlow() const ->
RageColor
574 return DestTweenState().glow;
577 void SetAux(
float f) { DestTweenState().aux = f; }
578 [[nodiscard]]
auto GetAux() const ->
float {
return m_current.
aux; }
580 virtual void BeginTweening(
float time,
ITween* pInterp);
581 virtual void BeginTweening(
float time, TweenType tt = TWEEN_LINEAR);
582 virtual void StopTweening();
583 void Sleep(
float time);
584 void QueueCommand(
const std::string& sCommandName);
585 void QueueMessage(
const std::string& sMessageName);
586 virtual void FinishTweening();
587 virtual void HurryTweening(
float factor);
589 [[nodiscard]]
virtual auto GetTweenTimeLeft() const
591 auto DestTweenState()
594 if (m_Tweens.empty()) {
598 return m_Tweens.back()->state;
602 [[nodiscard]]
auto DestTweenState() const -> const TweenState&
604 return const_cast<Actor*
>(
this)->DestTweenState();
615 void ScaleToCover(
const RectF& rect) { ScaleTo(rect,
cover); }
616 void ScaleToFitInside(
const RectF& rect) { ScaleTo(rect,
fit_inside); };
619 void StretchTo(
const RectF& rect);
623 virtual void SetVertAlign(
float f) {
m_fVertAlign = f; }
624 void SetHorizAlign(HorizAlign ha)
626 SetHorizAlign((ha == HorizAlign_Left)
628 : (ha == HorizAlign_Center) ? 0.5F : +1.0F);
630 void SetVertAlign(VertAlign va)
632 SetVertAlign((va == VertAlign_Top)
634 : (va == VertAlign_Middle) ? 0.5F : +1.0F);
636 virtual auto GetHorizAlign() ->
float {
return m_fHorizAlign; }
637 virtual auto GetVertAlign() ->
float {
return m_fVertAlign; }
640#if defined(SSC_FUTURES)
642 Effect GetEffect(
int i)
const {
return m_Effects[i]; }
644 void StopEffect() { m_Effect = no_effect; }
645 [[nodiscard]]
auto GetEffect() const ->
Effect {
return m_Effect; }
647 [[nodiscard]]
auto GetSecsIntoEffect() const ->
float
649 return m_fSecsIntoEffect;
651 [[nodiscard]]
auto GetEffectDelta() const ->
float
653 return m_fEffectDelta;
658 void SetEffectColor1(
const RageColor& c) { m_effectColor1 = c; }
659 void SetEffectColor2(
const RageColor& c) { m_effectColor2 = c; }
660 void RecalcEffectPeriod();
661 void SetEffectPeriod(
float fTime);
662 [[nodiscard]]
auto GetEffectPeriod() const ->
float
664 return m_effect_period;
666 auto SetEffectTiming(
float ramp_toh,
671 std::string& err) -> bool;
672 auto SetEffectHoldAtFull(
float haf, std::string& err) -> bool;
673 void SetEffectOffset(
float fTime) { m_fEffectOffset = fTime; }
674 void SetEffectClock(
EffectClock c) { m_EffectClock = c; }
675 void SetEffectClockString(
const std::string& s);
679 m_vEffectMagnitude = vec;
682 [[nodiscard]]
auto GetEffectMagnitude() const ->
RageVector3
684 return m_vEffectMagnitude;
687 void ResetEffectTimeIfDifferent(
Effect new_effect);
688 void SetEffectDiffuseBlink(
float fEffectPeriodSeconds,
691 void SetEffectDiffuseShift(
float fEffectPeriodSeconds,
694 void SetEffectDiffuseRamp(
float fEffectPeriodSeconds,
697 void SetEffectGlowBlink(
float fEffectPeriodSeconds,
700 void SetEffectGlowShift(
float fEffectPeriodSeconds,
703 void SetEffectGlowRamp(
float fEffectPeriodSeconds,
706 void SetEffectRainbow(
float fEffectPeriodSeconds);
707 void SetEffectWag(
float fPeriod,
const RageVector3& vect);
708 void SetEffectBounce(
float fPeriod,
const RageVector3& vect);
709 void SetEffectBob(
float fPeriod,
const RageVector3& vect);
710 void SetEffectPulse(
float fPeriod,
float fMinZoom,
float fMaxZoom);
718 [[nodiscard]]
auto GetVisible() const ->
bool {
return m_bVisible; }
719 void SetVisible(
bool b) { m_bVisible = b; }
720 void SetShadowLength(
float fLength)
722 m_fShadowLengthX = fLength;
723 m_fShadowLengthY = fLength;
725 void SetShadowLengthX(
float fLengthX) { m_fShadowLengthX = fLengthX; }
726 void SetShadowLengthY(
float fLengthY) { m_fShadowLengthY = fLengthY; }
727 void SetShadowColor(
const RageColor& c) { m_ShadowColor = c; }
729 void SetDrawOrder(
int iOrder) {
m_iDrawOrder = iOrder; }
730 [[nodiscard]]
auto GetDrawOrder() const ->
int {
return m_iDrawOrder; }
732 virtual void EnableAnimation(
bool b)
736 void StartAnimating() { this->EnableAnimation(
true); }
737 void StopAnimating() { this->EnableAnimation(
false); }
740 void SetBlendMode(BlendMode mode) { m_BlendMode = mode; }
741 void SetTextureTranslate(
float x,
float y)
743 m_texTranslate.x = x;
744 m_texTranslate.y = y;
746 void SetTextureWrapping(
bool b) { m_bTextureWrapping = b; }
747 void SetTextureFiltering(
bool b) { m_bTextureFiltering = b; }
748 void SetClearZBuffer(
bool b) { m_bClearZBuffer = b; }
749 void SetUseZBuffer(
bool b)
751 SetZTestMode(b ? ZTEST_WRITE_ON_PASS : ZTEST_OFF);
754 virtual void SetZTestMode(ZTestMode mode) { m_ZTestMode = mode; }
755 virtual void SetZWrite(
bool b) { m_bZWrite = b; }
756 void SetZBias(
float f) {
m_fZBias = f; }
757 virtual void SetCullMode(CullMode mode) { m_CullMode = mode; }
760 virtual void PushSelf(lua_State* L);
761 virtual void PushContext(lua_State* L);
764 void AddCommand(
const std::string& sCmdName,
765 const apActorCommands& apac,
767 [[nodiscard]]
auto HasCommand(
const std::string& sCmdName)
const -> bool;
768 [[nodiscard]]
auto GetCommand(
const std::string& sCommandName)
const
769 ->
const apActorCommands*;
770 void PlayCommand(
const std::string& sCommandName)
772 HandleMessage(
Message(sCommandName));
774 void PlayCommandNoRecurse(
const Message& msg);
780 virtual void RunCommands(
const apActorCommands& cmds,
783 this->RunCommands(*cmds, pParamTable);
785 virtual void RunCommandsRecursively(
789 RunCommands(cmds, pParamTable);
792 virtual void RunCommandsOnLeaves(
const LuaReference& cmds,
795 RunCommands(cmds, pParamTable);
799 void HandleMessage(
const Message& msg)
override;
802 [[nodiscard]]
virtual auto GetNumStates() const ->
int {
return 1; }
803 virtual void SetState(
int ) {}
804 [[nodiscard]]
virtual auto GetAnimationLengthSeconds() const ->
float
808 virtual void SetSecondsIntoAnimation(
float ) {}
809 virtual void SetUpdateRate(
float ) {}
810 virtual auto GetUpdateRate() ->
float {
return 1.0F; }
812 void SetShaders(
const std::string& vertexShaderPath,
813 const std::string& fragmentShaderPath);
814 void ResetShaders() { m_CustomShaders = { 0 }; }
815 bool GetShaderPersistence()
const {
return m_ShaderPersistence; }
816 void SetShaderPersistence(
bool persist) { m_ShaderPersistence = persist; }
817 std::vector<uint8_t> m_VertexShaderArgs, m_FragmentShaderArgs;
819 std::unique_ptr<LuaClass> m_pLuaInstance;
832 std::vector<Actor*> m_WrapperStates;
856 float m_fBaseAlpha{};
861 TweenState m_current;
868 std::vector<TweenStateAndInfo*> m_Tweens;
884#if defined(SSC_FUTURES)
885 std::vector<Effect> m_Effects;
889 float m_fSecsIntoEffect{};
890 float m_fEffectDelta{};
893 float m_effect_ramp_to_half{};
894 float m_effect_hold_at_half{};
895 float m_effect_ramp_to_full{};
896 float m_effect_hold_at_full{};
897 float m_effect_hold_at_zero{};
898 float m_fEffectOffset{};
902 float m_effect_period{};
904 bool m_tween_uses_effect_delta;
908 [[nodiscard]]
auto GetEffectDeltaTime() const ->
float
910 return m_fEffectDelta;
920 bool m_bIsAnimating{};
921 float m_fShadowLengthX{};
922 float m_fShadowLengthY{};
930 BlendMode m_BlendMode;
931 ZTestMode m_ZTestMode;
934 bool m_bTextureWrapping{};
935 bool m_bTextureFiltering{};
936 bool m_bClearZBuffer{};
945 static float g_fCurrentBGMTime, g_fCurrentBGMBeat;
946 static float g_fCurrentBGMTimeNoOffset, g_fCurrentBGMBeatNoOffset;
947 static std::vector<float> g_vfCurrentBGMBeatPlayer;
948 static std::vector<float> g_vfCurrentBGMBeatPlayerNoOffset;
951 bool m_ShaderPersistence =
false;
954 std::map<std::string, apActorCommands> m_mapNameToCommands;