Skip to content

Commit cfd49e6

Browse files
committed
Fix low% loadout. Add IS start/stop. Add version in menu.
1 parent 90ccb86 commit cfd49e6

File tree

8 files changed

+67
-4
lines changed

8 files changed

+67
-4
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ set(SOURCE_FILES
7474
src/include/prime/CScriptRelay.hpp
7575
src/include/prime/CScriptDoor.hpp
7676
src/include/prime/CScriptCameraHint.hpp
77+
src/include/prime/CCameraBobber.hpp
7778
src/include/STriggerRenderConfig.hpp
7879
src/include/NewPauseScreen.hpp
7980
src/include/GetField.hpp
@@ -98,6 +99,7 @@ set(SOURCE_FILES
9899
src/libc/printf.c
99100
src/libc/sscanf.c
100101

102+
src/version.h
101103
src/new.cpp
102104
src/NewPauseScreen.cpp
103105
src/duk_mem.h

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ Youtube video on macOS (Linux is similar): [https://www.youtube.com/watch?v=fyz6
6767

6868
## Changelog
6969

70+
### 2.3.1 (beta)
71+
- Add IS & lightshowfix to player menu
72+
- Add version to main menu
73+
7074
### 2.3.0 (beta)
7175
- Compile statically & link directly into default.dol
7276
- This reduces the size of the mod by ~100k

src/NewPauseScreen.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include "settings.hpp"
2323
#include "font_atlas.hpp"
2424
#include "ImGuiEngine.hpp"
25+
#include "version.h"
2526

2627
#define PAD_MAX_CONTROLLERS 4
2728

@@ -147,6 +148,7 @@ void NewPauseScreen::RenderMenu() {
147148
GUI::drawPlayerMenu();
148149
GUI::drawInventoryMenu();
149150
GUI::drawSettingsMenu();
151+
ImGui::Text("v%s", PRAC_MOD_VERSION);
150152
}
151153
ImGui::End();
152154

src/UI/InventoryMenu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static constexpr SItemAmt StartingItems[] = {
4444
};
4545

4646
static constexpr SItemAmt LowPercentItems[] = {
47-
{CPlayerState::EItemType::EnergyTanks, 1},
47+
{CPlayerState::EItemType::EnergyTanks, 0},
4848
{CPlayerState::EItemType::Missiles, 5},
4949

5050
{CPlayerState::EItemType::MorphBall},

src/UI/PlayerMenu.cpp

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,44 @@ namespace GUI {
6767
ImGui::Text("Saved position: %.2fx, %.2fy, %.2fz", savedPos.x, savedPos.y, savedPos.z);
6868
}
6969

70+
float xyz[3] = {
71+
player->getTransform()->x,
72+
player->getTransform()->y,
73+
player->getTransform()->z
74+
};
75+
76+
ImGui::DragFloat3("", xyz, 1.f, -FLT_MAX, FLT_MAX, "%.3f", flags);
77+
player->getTransform()->x = xyz[0];
78+
player->getTransform()->y = xyz[1];
79+
player->getTransform()->z = xyz[2];
80+
81+
if (ImGui::Button("IS on")) {
82+
player->GetAngularVelocity()->x = NAN;
83+
player->GetAngularVelocity()->y = NAN;
84+
player->GetAngularVelocity()->z = NAN;
85+
}
86+
ImGui::SameLine();
87+
ImGui::Text("Use while morphed");
88+
89+
auto *bobber = player->getCameraBobber();
90+
if (ImGui::Button("Lightshow fix")) {
91+
player->GetAngularVelocity()->x = 0;
92+
player->GetAngularVelocity()->y = 0;
93+
player->GetAngularVelocity()->z = 0;
94+
95+
96+
*(bobber->getTargetBobMagnitude()) = 0;
97+
*(bobber->getBobMagnitude()) = 0;
98+
*(bobber->getBobTimescale()) = 0;
99+
*(bobber->getBobTime()) = 0;
100+
bobber->getCameraBobTransform()->x = 0;
101+
bobber->getCameraBobTransform()->y = 0;
102+
bobber->getCameraBobTransform()->z = 0;
103+
}
104+
105+
ImGui::SameLine();
106+
ImGui::Text("Use while unmorphed");
70107

71-
ImGui::DragFloat("X", &player->getTransform()->x, 1.f, -FLT_MAX, FLT_MAX, "%.3f", flags);
72-
ImGui::DragFloat("Y", &player->getTransform()->y, 1.f, -FLT_MAX, FLT_MAX, "%.3f", flags);
73-
ImGui::DragFloat("Z", &player->getTransform()->z, 1.f, -FLT_MAX, FLT_MAX, "%.3f", flags);
74108
ImGui::TreePop();
75109
}
76110
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef PRIME_PRACTICE_NATIVE_CCAMERABOBBER_HPP
2+
#define PRIME_PRACTICE_NATIVE_CCAMERABOBBER_HPP
3+
4+
#include "GetField.hpp"
5+
#include "MathyTypes.hpp"
6+
7+
class CCameraBobber {
8+
public:
9+
float *getTargetBobMagnitude() { return GetField<float>(this, 0x10); }
10+
float *getBobMagnitude() { return GetField<float>(this, 0x14); }
11+
float *getBobTimescale() { return GetField<float>(this, 0x18); }
12+
float *getBobTime() { return GetField<float>(this, 0x1C); }
13+
CTransform4f *getCameraBobTransform() { return GetField<CTransform4f>(this, 0x38); }
14+
};
15+
16+
#endif //PRIME_PRACTICE_NATIVE_CCAMERABOBBER_HPP

src/include/prime/CPlayer.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@
33

44
#include "prime/CStateManager.hpp"
55
#include "prime/CPhysicsActor.hpp"
6+
#include "prime/CCameraBobber.hpp"
67

78
class CPlayer : public CPhysicsActor {
89
public:
910
void Teleport(const CTransform4f& newTransform, CStateManager&, bool resetBallCam);
11+
12+
13+
CCameraBobber *getCameraBobber() { return *GetField<CCameraBobber*>(this, 0x76C); }
1014
};
1115

1216
#endif //PRIME_PRACTICE_CPLAYER_HPP

src/version.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#define PRAC_MOD_VERSION "2.3.1"

0 commit comments

Comments
 (0)