i wasnt content with previous seedvalue impl

This commit is contained in:
altalk23 2022-12-31 18:02:48 +03:00
parent a49f01b14f
commit eb3b84113c
2 changed files with 112 additions and 45 deletions

View file

@ -2149,9 +2149,8 @@ class GJGameLevel : cocos2d::CCNode {
int m_workingTime2;
bool m_lowDetailMode;
bool m_lowDetailModeToggled;
int m_isVerifiedRand;
int m_isVerifiedSeed;
bool m_isVerified;
geode::SeedValueRS m_isVerified;
bool m_isVerifiedRaw; // honestly i dont think this is need to be used
bool m_isUploaded;
bool m_hasBeenModified;
int m_levelVersion;
@ -2181,8 +2180,7 @@ class GJGameLevel : cocos2d::CCNode {
bool m_autoLevel;
int m_coins;
geode::SeedValueRSV m_coinsVerified;
int m_passwordRand;
int m_passwordSeed;
geode::SeedValueRS m_password;
geode::SeedValueRSV m_originalLevel;
bool m_twoPlayerMode;
int m_failedPasswordAttempts;
@ -2866,10 +2864,8 @@ class GameManager : GManager {
geode::SeedValueRSV m_playerColor2;
geode::SeedValueRSV m_playerStreak;
geode::SeedValueRSV m_playerDeathEffect;
int m_chkSeed;
int m_chkRand;
int m_secretNumberSeed;
int m_secretNumberRand;
geode::SeedValueSR m_chk;
geode::SeedValueSR m_secretNumber;
bool m_playerGlow;
IconType m_playerIconType;
bool m_everyPlaySetup;
@ -4288,8 +4284,7 @@ class PlayLayer : GJBaseGameLayer, CCCircleWaveDelegate, CurrencyRewardDelegate,
float unused4c8;
bool unused4cc;
bool m_hasCheated;
int m_dontSaveRand;
int m_dontSaveSeed;
geode::SeedValueRS m_dontSave;
int unknown4d8;
bool m_debugPauseOff;
bool m_shouldSmoothCamera;

View file

@ -1,15 +1,10 @@
#pragma once
#include <array>
namespace geode {
class BaseSeedValue {
protected:
int m_v1 = 0;
int m_v2 = 0;
int m_v3 = 0;
public:
BaseSeedValue(int v1, int v2, int v3) : m_v1(v1), m_v2(v2), m_v3(v3) {}
BaseSeedValue() = default;
BaseSeedValue(BaseSeedValue const& other) = default;
BaseSeedValue(BaseSeedValue&& other) = default;
@ -29,25 +24,92 @@ namespace geode {
} \
operator int() { return this->value(); }
class SeedValueVRS : public BaseSeedValue {
class SeedValueSR : public BaseSeedValue {
private:
using SeedValue = SeedValueVRS;
int& internalValue() {
return m_v1;
using SeedValue = SeedValueSR;
std::array<int, 2> m_values;
int& internalSeed() {
return m_values[0];
}
int& internalRandom() {
return m_v2;
return m_values[1];
}
public:
using BaseSeedValue::BaseSeedValue;
SeedValueSR(int value, int seed) : m_values({seed, value + seed}) {}
SeedValue& operator=(int value) {
internalRandom() = value + internalSeed();
return *this;
}
int value() {
return internalRandom() - internalSeed();
}
operator int() {
return this->value();
}
};
class SeedValueRS : public BaseSeedValue {
private:
using SeedValue = SeedValueRS;
std::array<int, 2> m_values;
int& internalRandom() {
return m_values[0];
}
int& internalSeed() {
return m_v3;
return m_values[1];
}
public:
using BaseSeedValue::BaseSeedValue;
SeedValueVRS(int value, int seed) : BaseSeedValue(value, value + seed, seed) {}
SeedValueRS(int value, int seed) : m_values({value + seed, seed}) {}
SeedValue& operator=(int value) {
internalRandom() = value + internalSeed();
return *this;
}
int value() {
return internalRandom() - internalSeed();
}
operator int() {
return this->value();
}
};
class SeedValueVRS : public BaseSeedValue {
private:
using SeedValue = SeedValueVRS;
std::array<int, 3> m_values;
int& internalValue() {
return m_values[0];
}
int& internalRandom() {
return m_values[1];
}
int& internalSeed() {
return m_values[2];
}
public:
using BaseSeedValue::BaseSeedValue;
SeedValueVRS(int value, int seed) : m_values({value, value + seed, seed}) {}
GEODE_SEED_VALUE_COMMON_OPS();
};
@ -55,22 +117,24 @@ namespace geode {
class SeedValueVSR : public BaseSeedValue {
private:
using SeedValue = SeedValueVSR;
std::array<int, 3> m_values;
int& internalValue() {
return m_v1;
return m_values[0];
}
int& internalSeed() {
return m_v2;
return m_values[1];
}
int& internalRandom() {
return m_v3;
return m_values[2];
}
public:
using BaseSeedValue::BaseSeedValue;
SeedValueVSR(int value, int seed) : BaseSeedValue(value, seed, value + seed) {}
SeedValueVSR(int value, int seed) : m_values({value, seed, value + seed}) {}
GEODE_SEED_VALUE_COMMON_OPS();
};
@ -78,22 +142,24 @@ namespace geode {
class SeedValueRVS : public BaseSeedValue {
private:
using SeedValue = SeedValueRVS;
std::array<int, 3> m_values;
int& internalRandom() {
return m_v1;
return m_values[0];
}
int& internalValue() {
return m_v2;
return m_values[1];
}
int& internalSeed() {
return m_v3;
return m_values[2];
}
public:
using BaseSeedValue::BaseSeedValue;
SeedValueRVS(int value, int seed) : BaseSeedValue(value + seed, value, seed) {}
SeedValueRVS(int value, int seed) : m_values({value + seed, value, seed}) {}
GEODE_SEED_VALUE_COMMON_OPS();
};
@ -101,22 +167,24 @@ namespace geode {
class SeedValueRSV : public BaseSeedValue {
private:
using SeedValue = SeedValueRSV;
std::array<int, 3> m_values;
int& internalRandom() {
return m_v1;
return m_values[0];
}
int& internalSeed() {
return m_v2;
return m_values[1];
}
int& internalValue() {
return m_v3;
return m_values[2];
}
public:
using BaseSeedValue::BaseSeedValue;
SeedValueRSV(int value, int seed) : BaseSeedValue(value + seed, seed, value) {}
SeedValueRSV(int value, int seed) : m_values({value + seed, seed, value}) {}
GEODE_SEED_VALUE_COMMON_OPS();
};
@ -124,22 +192,24 @@ namespace geode {
class SeedValueSVR : public BaseSeedValue {
private:
using SeedValue = SeedValueSVR;
std::array<int, 3> m_values;
int& internalSeed() {
return m_v1;
return m_values[0];
}
int& internalValue() {
return m_v2;
return m_values[1];
}
int& internalRandom() {
return m_v3;
return m_values[2];
}
public:
using BaseSeedValue::BaseSeedValue;
SeedValueSVR(int value, int seed) : BaseSeedValue(seed, value, value + seed) {}
SeedValueSVR(int value, int seed) : m_values({seed, value, value + seed}) {}
GEODE_SEED_VALUE_COMMON_OPS();
};
@ -147,22 +217,24 @@ namespace geode {
class SeedValueSRV : public BaseSeedValue {
private:
using SeedValue = SeedValueSRV;
std::array<int, 3> m_values;
int& internalSeed() {
return m_v1;
return m_values[0];
}
int& internalRandom() {
return m_v2;
return m_values[1];
}
int& internalValue() {
return m_v3;
return m_values[2];
}
public:
using BaseSeedValue::BaseSeedValue;
SeedValueSRV(int value, int seed) : BaseSeedValue(seed, value + seed, value) {}
SeedValueSRV(int value, int seed) : m_values({seed, value + seed, value}) {}
GEODE_SEED_VALUE_COMMON_OPS();
};