Skip to content

Commit b28ff64

Browse files
committed
a
1 parent 7673049 commit b28ff64

8 files changed

Lines changed: 172 additions & 52 deletions

File tree

changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2.8.3
2+
3+
- Fixed No Rotation changing the players rotated hitbox
4+
- Fixed Show Trajectory having a trail
5+
- Fixed Hitboxes not updating when dead
6+
17
# 2.8.2
28

39
- Added Label Rotation

mod-2.2074.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"geode": "4.10.0",
3-
"version": "v2.8.2-beta.1",
3+
"version": "v2.8.3-beta.1",
44
"gd": {
55
"win": "2.2074",
66
"android": "2.2074",

mod.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"geode": "5.4.0",
3-
"version": "v2.8.2",
3+
"version": "v2.8.3",
44
"gd": {
55
"win": "2.2081",
66
"android": "2.2081",

src/Hacks/Cosmetic/NoPlayerRotation.cpp

Lines changed: 75 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "../../Client/Module.hpp"
2-
#include <Geode/modify/GJBaseGameLayer.hpp>
2+
#include <Geode/modify/PlayerObject.hpp>
3+
#include <VisitHook.hpp>
34

45
using namespace geode::prelude;
56

@@ -125,62 +126,87 @@ SUBMIT_OPTION(NoPlayerRotation, NoRotRobot);
125126
SUBMIT_OPTION(NoPlayerRotation, NoRotSpider);
126127
SUBMIT_OPTION(NoPlayerRotation, NoRotSwing);
127128

128-
class $modify (GJBaseGameLayer)
129+
namespace qolmod
129130
{
130-
bool noRotateEnabled(PlayerObject* po)
131+
class PlayerObjectVisitHook : public qolmod::VisitHook
131132
{
132-
if (po->m_isShip)
133-
{
134-
if (po->m_isPlatformer)
135-
return NoRotJetpack::get()->getRealEnabled();
136-
else
137-
return NoRotShip::get()->getRealEnabled();
138-
}
139-
else if (po->m_isBall)
140-
{
141-
return NoRotBall::get()->getRealEnabled();
142-
}
143-
else if (po->m_isBird)
144-
{
145-
return NoRotUfo::get()->getRealEnabled();
146-
}
147-
else if (po->m_isDart)
148-
{
149-
return NoRotWave::get()->getRealEnabled();
150-
}
151-
else if (po->m_isRobot)
152-
{
153-
return NoRotRobot::get()->getRealEnabled();
154-
}
155-
else if (po->m_isSpider)
156-
{
157-
return NoRotSpider::get()->getRealEnabled();
158-
}
159-
else if (po->m_isSwing)
160-
{
161-
return NoRotSwing::get()->getRealEnabled();
162-
}
133+
public:
134+
CREATE_FUNC(PlayerObjectVisitHook)
135+
PlayerObject* player = nullptr;
136+
float rot = 0;
137+
float rot2 = 0;
163138

164-
return NoRotCube::get()->getRealEnabled();
165-
}
166-
167-
virtual void update(float dt)
168-
{
169-
GJBaseGameLayer::update(dt);
139+
bool noRotateEnabled(PlayerObject* po)
140+
{
141+
if (!NoPlayerRotation::get()->getRealEnabled())
142+
return false;
143+
144+
if (po->m_isShip)
145+
{
146+
if (po->m_isPlatformer)
147+
return NoRotJetpack::get()->getRealEnabled();
148+
else
149+
return NoRotShip::get()->getRealEnabled();
150+
}
151+
else if (po->m_isBall)
152+
{
153+
return NoRotBall::get()->getRealEnabled();
154+
}
155+
else if (po->m_isBird)
156+
{
157+
return NoRotUfo::get()->getRealEnabled();
158+
}
159+
else if (po->m_isDart)
160+
{
161+
return NoRotWave::get()->getRealEnabled();
162+
}
163+
else if (po->m_isRobot)
164+
{
165+
return NoRotRobot::get()->getRealEnabled();
166+
}
167+
else if (po->m_isSpider)
168+
{
169+
return NoRotSpider::get()->getRealEnabled();
170+
}
171+
else if (po->m_isSwing)
172+
{
173+
return NoRotSwing::get()->getRealEnabled();
174+
}
175+
176+
return NoRotCube::get()->getRealEnabled();
177+
}
170178

171-
if (NoPlayerRotation::get()->getRealEnabled())
172-
{
173-
if (m_player1 && noRotateEnabled(m_player1))
179+
virtual void preVisit()
174180
{
175-
m_player1->setRotation(0);
176-
m_player1->m_iconSprite->setRotation(0);
181+
rot = player->getRotation();
182+
rot2 = player->m_iconSprite->getRotation();
183+
184+
if (noRotateEnabled(player))
185+
{
186+
player->setRotation(0);
187+
player->m_iconSprite->setRotation(0);
188+
}
177189
}
178190

179-
if (m_player2 && noRotateEnabled(m_player1))
191+
virtual void postVisit(cocos2d::CCNode* node)
180192
{
181-
m_player2->setRotation(0);
182-
m_player2->m_iconSprite->setRotation(0);
193+
player->setRotation(rot);
194+
player->m_iconSprite->setRotation(rot2);
183195
}
184-
}
196+
};
197+
};
198+
199+
class $modify (PlayerObject)
200+
{
201+
bool init(int player, int ship, GJBaseGameLayer* gameLayer, cocos2d::CCLayer* layer, bool playLayer)
202+
{
203+
if (!PlayerObject::init(player, ship, gameLayer, layer, playLayer))
204+
return false;
205+
206+
auto vh = qolmod::PlayerObjectVisitHook::create();
207+
vh->player = this;
208+
209+
this->setGrid(vh);
210+
return true;
185211
}
186212
};

src/Hacks/Level/ShowTrajectory/TrajectoryNode.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ void TrajectoryNode::simulate(PlayerObject* plr, bool held)
120120
ShowTrajectoryP2Release::get()->getColour());
121121
}
122122

123+
if (player->m_regularTrail)
124+
player->m_regularTrail->setVisible(false);
125+
123126
for (size_t i = 0; i < getIterCount(); i++)
124127
{
125128
player->m_collisionLogTop->removeAllObjects();

src/UI/BaseDrawNode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ class $modify (GJBaseGameLayer)
295295
{
296296
GJBaseGameLayer::update(dt);
297297

298-
if (!m_started || __didTickThisFrame)
298+
if (!m_started || __didTickThisFrame || m_player1->m_isDead)
299299
{
300300
__didTickThisFrame = false;
301301
redrawAll();

src/UI/VisitHook.cpp

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#include "VisitHook.hpp"
2+
#include <Geode/modify/CCGridBase.hpp>
3+
4+
using namespace geode::prelude;
5+
using namespace qolmod;
6+
7+
bool VisitHook::init()
8+
{
9+
initWithSize(CCSizeMake(100, 100));
10+
m_bActive = true;
11+
return true;
12+
}
13+
14+
void VisitHook::setCallbackPre(const VisitHook::VisitCallbackFunc& func)
15+
{
16+
this->callbackPre = std::move(func);
17+
}
18+
19+
void VisitHook::setCallbackPost(const VisitHook::VisitCallbackFunc& func)
20+
{
21+
this->callbackPost = std::move(func);
22+
}
23+
24+
void VisitHook::preVisit()
25+
{
26+
if (callbackPre)
27+
callbackPre(nullptr);
28+
}
29+
30+
void VisitHook::postVisit(cocos2d::CCNode* node)
31+
{
32+
if (callbackPost)
33+
callbackPost(node);
34+
}
35+
36+
class $modify (VisitHookGridBase, CCGridBase)
37+
{
38+
void beforeDraw(void)
39+
{
40+
if (auto hook = typeinfo_cast<VisitHook*>(this))
41+
{
42+
hook->preVisit();
43+
return;
44+
}
45+
46+
CCGridBase::beforeDraw();
47+
}
48+
49+
void afterDraw(CCNode *pTarget)
50+
{
51+
if (auto hook = typeinfo_cast<VisitHook*>(this))
52+
{
53+
hook->postVisit(pTarget);
54+
return;
55+
}
56+
57+
CCGridBase::afterDraw(pTarget);
58+
}
59+
};

src/UI/VisitHook.hpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#pragma once
2+
3+
#include <Geode/Geode.hpp>
4+
5+
namespace qolmod
6+
{
7+
class VisitHook : public cocos2d::CCGridBase
8+
{
9+
using VisitCallbackFunc = std::function<void(cocos2d::CCNode* node)>;
10+
11+
protected:
12+
VisitCallbackFunc callbackPre = nullptr;
13+
VisitCallbackFunc callbackPost = nullptr;
14+
15+
virtual bool init();
16+
17+
public:
18+
CREATE_FUNC(VisitHook);
19+
20+
void setCallbackPre(const VisitCallbackFunc& func);
21+
void setCallbackPost(const VisitCallbackFunc& func);
22+
23+
virtual void preVisit();
24+
virtual void postVisit(cocos2d::CCNode* node);
25+
};
26+
};

0 commit comments

Comments
 (0)