Skip to content

Commit

Permalink
okay
Browse files Browse the repository at this point in the history
  • Loading branch information
FireMario211 committed Jun 9, 2024
1 parent d94164d commit f4c0f1d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# v1.7.1
- Fixed Noclip Accuracy for all platforms
- (hopefully) Fix the crash issue if someone has an old Prism Menu instance
# v1.7.0
- Allowed changing the keybind
- Added Ukrainian translations (Thank you Lancelot!)
Expand Down
2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"geode": "3.0.0-alpha.1",
"version": "v1.7.0",
"version": "v1.7.1",
"gd": {
"win": "2.206",
"mac": "2.206",
Expand Down
25 changes: 6 additions & 19 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ bool restoreOldFiles() {
auto currentSave = Mod::get()->getSaveDir();
auto parentDir = currentSave.parent_path();
auto oldSave = parentDir / "firee.PrismMenu";
if (oldSave.filename().string().find(".old") != std::string::npos) {
auto oldoldSave = parentDir / "firee.PrismMenu.old";
if (std::filesystem::exists(oldoldSave) && std::filesystem::is_directory(oldoldSave)) {
log::info("Files already restored. Consider deleting the \"firee.PrismMenu.old\" directory in your saves to remove this message.");
return false;
}
Expand Down Expand Up @@ -240,10 +241,7 @@ class $modify(PrismPlayLayer, PlayLayer) {
bool initedDeath = false;

// Noclip Accuracy
int frame = 0;
int playerFrame = 0;
int death = 0;
float previousPlayerX = 0.0F;
float previousDeathX = 0.0F;
CCLabelBMFont* accuracyLabel;
float flashOpacity = 1.0F;
Expand Down Expand Up @@ -398,32 +396,21 @@ class $modify(PrismPlayLayer, PlayLayer) {
void onQuit() {
if (prismButton != nullptr && Hacks::isHackEnabled("Show Button")) prismButton->setVisible(true); // look at this
m_fields->initedDeath = false;
m_fields->frame = 0;
m_fields->playerFrame = 0;
m_fields->death = 0;
PlayLayer::onQuit();
}
void resetLevel() {
m_fields->frame = 0;
m_fields->playerFrame = 0;
m_fields->death = 0;
PlayLayer::resetLevel();
}
void postUpdate(float p0) {
PlayLayer::postUpdate(p0);
if (m_player1 != nullptr) {
if (Hacks::isHackEnabled("Suicide")) return PlayLayer::destroyPlayer(m_player1, nullptr);
if (m_player1->getPositionX() != m_fields->previousPlayerX) {
m_fields->previousPlayerX = m_player1->getPositionX();
m_fields->playerFrame++;
}
m_fields->frame++;
}
if (m_player1 != nullptr && Hacks::isHackEnabled("Suicide")) return PlayLayer::destroyPlayer(m_player1, nullptr);
if (m_fields->accuracyLabel != nullptr) {
float accuracy = ((static_cast<float>(m_fields->frame - m_fields->death)) / static_cast<float>(m_fields->frame)) * 100; // for some reason this doesnt work on android, like it goes in the negatives
float accuracy = ((static_cast<float>(m_gameState.m_currentProgress - m_fields->death)) / static_cast<float>(m_gameState.m_currentProgress)) * 100; // for some reason this doesnt work on android, like it goes in the negatives
m_fields->accuracyLabel->setString(fmt::format("{}%", Utils::setPrecision(accuracy, 2)).c_str());
m_fields->accuracyLabel->setVisible(Hacks::isHackEnabled("Noclip Accuracy"));
if (m_fields->frame % 4 == 0) { // quarter step
if (m_gameState.m_currentProgress % 4 == 0) { // quarter step
m_fields->accuracyLabel->setColor({255,255,255});
if (m_fields->flashOpacity > 1.0F) {
m_fields->flashOpacity -= 10.0F;
Expand Down Expand Up @@ -463,7 +450,7 @@ class $modify(PrismPlayLayer, PlayLayer) {
m_fields->prismNode->addChild(m_fields->cheatIndicator);
}
}
if (Hacks::isHackEnabled("Instant Complete") && m_fields->frame < 5) {
if (Hacks::isHackEnabled("Instant Complete") && m_gameState.m_currentProgress < 5) {
log::debug("CRIMINAL… criminal… criminal… criminal…");
// funny message

Expand Down

0 comments on commit f4c0f1d

Please sign in to comment.