@@ -68,29 +68,17 @@ if (eventVal.contains(#type)) {
6868 } \
6969}
7070
71- #define setCellColors (class, method, paramType ) \
72- struct My ##class : geode::Modify<My##class , class > { \
73- static void onModify (auto & self) { \
74- HOOK_LATEST (#class " ::" #method); \
75- } \
76- struct Fields { \
77- ccColor3B m_lastBG; \
78- }; \
79- void method (paramType* p0) { \
80- class::method (p0); \
71+ #define setCellColors (className ) \
72+ class $nodeModify(My##className, className) { \
73+ void modify () { \
8174 if (UIModding::get ()->doModify ) { \
8275 checkBG (0 ); \
83- this ->schedule (schedule_selector (My##class ::checkBG)); \
76+ this ->schedule (schedule_selector (My##className ::checkBG)); \
8477 } \
8578 } \
8679 void checkBG (float dt) { \
87- auto * child = this ->getChildByType <CCLayerColor>(0 ); \
88- if (!child) return ; \
89- \
90- auto color = child->getColor (); \
91- auto fields = m_fields.self (); \
92- if (fields->m_lastBG == color) return ; \
93- fields->m_lastBG = color; \
80+ auto self = reinterpret_cast <className*>(this ); \
81+ auto color = self->m_backgroundLayer ->getColor (); \
9482 \
9583 struct ColorMap { \
9684 ccColor3B match; \
@@ -107,14 +95,14 @@ struct My##class : geode::Modify<My##class, class> {
10795 if (color == entry.match ) { \
10896 if (auto dataOpt = UIModding::get ()->getColors (entry.ID )) { \
10997 const auto & data = *dataOpt; \
110- child-> setColor (data.color ); \
111- child-> setOpacity (data.alpha ); \
98+ self-> m_backgroundLayer -> setColor (data.color ); \
99+ self-> m_backgroundLayer -> setOpacity (data.alpha ); \
112100 } \
113101 break ; \
114102 } \
115103 } \
116104 } \
117- };
105+ }
118106
119107#define LABEL (name, value ) {name, rift::Value::from (value)}
120108
0 commit comments