From 2417a965801a587294309d2507ab0a888b1b70ce Mon Sep 17 00:00:00 2001 From: jonschz Date: Sat, 21 Jun 2025 08:27:22 +0200 Subject: [PATCH] Down to entropy --- LEGO1/lego/legoomni/include/legogamestate.h | 9 +++++ .../legoomni/src/common/legogamestate.cpp | 40 +++++++++---------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index 23bfb00e..a9f156eb 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -151,6 +151,15 @@ class LegoGameState { MxU8 m_scores[5][5]; // 0x02 Username m_name; // 0x1c MxS16 m_unk0x2a; // 0x2a + + ScoreItem& operator=(const ScoreItem& p_other) + { + m_totalScore = p_other.m_totalScore; + memcpy(m_scores, p_other.m_scores, sizeof(m_scores)); + m_name = p_other.m_name; + m_unk0x2a = p_other.m_unk0x2a; + return *this; + } }; // SIZE 0x372 diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 34f89c89..eab3cb88 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -1567,32 +1567,32 @@ void LegoGameState::History::WriteScoreHistory() // TODO: Possible operator= ? - tmpItem.m_totalScore = m_scores[j - 1].m_totalScore; - memcpy(tmpItem.m_scores, m_scores[j - 1].m_scores, sizeof(tmpItem.m_scores)); - // LINE: LEGO1 0x1003cbd3 - tmpItem.m_name = m_scores[j - 1].m_name; - tmpItem.m_unk0x2a = m_scores[j - 1].m_unk0x2a; + // tmpItem.m_totalScore = m_scores[j - 1].m_totalScore; + // memcpy(tmpItem.m_scores, m_scores[j - 1].m_scores, sizeof(tmpItem.m_scores)); + // // LINE: LEGO1 0x1003cbd3 + // tmpItem.m_name = m_scores[j - 1].m_name; + // tmpItem.m_unk0x2a = m_scores[j - 1].m_unk0x2a; - m_scores[j - 1].m_totalScore = m_scores[j].m_totalScore; - memcpy(m_scores[j - 1].m_scores, m_scores[j].m_scores, sizeof(m_scores[j - 1].m_scores)); - // LINE: LEGO1 0x1003cc05 - m_scores[j - 1].m_name = m_scores[j].m_name; - m_scores[j - 1].m_unk0x2a = m_scores[j].m_unk0x2a; + // m_scores[j - 1].m_totalScore = m_scores[j].m_totalScore; + // memcpy(m_scores[j - 1].m_scores, m_scores[j].m_scores, sizeof(m_scores[j - 1].m_scores)); + // // LINE: LEGO1 0x1003cc05 + // m_scores[j - 1].m_name = m_scores[j].m_name; + // m_scores[j - 1].m_unk0x2a = m_scores[j].m_unk0x2a; - // LINE: LEGO1 0x1003cc1f - m_scores[j - 1].m_totalScore = tmpItem.m_totalScore; - memcpy(m_scores[j].m_scores, tmpItem.m_scores, sizeof(m_scores[j].m_scores)); - m_scores[j].m_name = tmpItem.m_name; - m_scores[j].m_unk0x2a = tmpItem.m_unk0x2a; + // // LINE: LEGO1 0x1003cc1f + // m_scores[j - 1].m_totalScore = tmpItem.m_totalScore; + // memcpy(m_scores[j].m_scores, tmpItem.m_scores, sizeof(m_scores[j].m_scores)); + // m_scores[j].m_name = tmpItem.m_name; + // m_scores[j].m_unk0x2a = tmpItem.m_unk0x2a; // This version feels like it should be right, but it only produces 68.78 % - // tmpItem = m_scores[j - 1]; - // // LINE: LEGO1 0x1003cbf8 - // m_scores[j - 1] = m_scores[j]; - // // LINE: LEGO1 0x1003cc24 - // m_scores[j] = tmpItem; + tmpItem = m_scores[j - 1]; + // LINE: LEGO1 0x1003cbf3 + m_scores[j - 1] = m_scores[j]; + // LINE: LEGO1 0x1003cc1f + m_scores[j] = tmpItem; } } }