Skip to content

Commit

Permalink
feat: initial update to 2.2
Browse files Browse the repository at this point in the history
does not work yet

Signed-off-by: rooot <hey@rooot.gay>
  • Loading branch information
RoootTheFox committed Jan 5, 2024
1 parent 645494b commit 490d5ea
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 365 deletions.
34 changes: 13 additions & 21 deletions include/hooks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#pragma once

#include "include.hpp"
#include "layer/MultiplayerLayer.hpp"
#include "layer/GDMPMultiplayerLayer.hpp"
#include "utils.hpp"

std::vector<std::function<void()>> functionQueue;
Expand Down Expand Up @@ -44,7 +44,7 @@ class $modify(MenuLayer) {
auto button = CCMenuItemSpriteExtra::create(
buttonSprite,
this,
menu_selector(MultiplayerLayer::switchToCustomLayerButton));
menu_selector(GDMPMultiplayerLayer::switchToCustomLayerButton));

auto menu = cocos2d::CCMenu::create();
menu->addChild(button);
Expand All @@ -57,8 +57,8 @@ class $modify(MenuLayer) {
};

class $modify(PlayLayer) {
bool init(GJGameLevel* level) {
if (!PlayLayer::init(level)) return false;
bool init(GJGameLevel* level, bool p1, bool p2) {
if (!PlayLayer::init(level, p1, p2)) return false;

auto global = Global::get();

Expand Down Expand Up @@ -92,9 +92,9 @@ class $modify(PlayLayer) {
uint32_t secondaryColor = 0;

// hope this works c:
if (this->m_player1->m_iconSprite) {
/*if (this->m_player1->m_iconSprite) {
secondaryColor = getIntFromCCColor(this->m_player1->m_iconSprite->getColor());
}
}*/
#endif

color_p1.set_primary(getIntFromCCColor(this->m_player1->getColor()));
Expand Down Expand Up @@ -131,9 +131,10 @@ class $modify(PlayLayer) {
}

void onQuit() {
fmt::print("onQuit\n");
auto global = Global::get();
for (auto &item: global->players) {
item.second.p1->removeMeAndCleanup();
//item.second.p1->removeMeAndCleanup(); // THIS CRASHES IN 2.2
}
global->players.clear();

Expand Down Expand Up @@ -178,7 +179,7 @@ class $modify(PlayLayer) {
auto gameMode1 = getGameModeFromGamemode(getGamemodeFromPlayer(this->m_player1));
player_move->set_gamemode_p1(gameMode1);

if (this->m_player2 && this->m_isDualMode) {
if (this->m_player2 && /*this->m_isDualMode*/ false) { // todo
auto pos2 = getPositionDataFromPlayer(this->m_player2);
player_move->set_allocated_pos_p2(&pos2);

Expand All @@ -201,22 +202,13 @@ class $modify(PlayLayer) {
};

class $modify(GJBaseGameLayer) {
void pushButton(int i, bool pl) {
GJBaseGameLayer::pushButton(i, pl);

auto global = Global::get();

if (pl) global->P1_pushing = true;
if (!pl) global->P2_pushing = true;
}

void releaseButton(int i, bool pl) {
GJBaseGameLayer::releaseButton(i, pl);
void handleButton(bool push, int button, bool player1) {
GJBaseGameLayer::handleButton(push, button, player1);

auto global = Global::get();

if (pl) global->P1_pushing = false;
if (!pl) global->P2_pushing = false;
if (player1) global->P1_pushing = push;
if (!player1) global->P2_pushing = push;
}
};

Expand Down
93 changes: 0 additions & 93 deletions include/layer/MultiplayerLayer.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion mod.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"geode": "v1.0.0",
"geode": "v2.0.0",
"version": "v0.0.0",
"id": "rooot.gdmp",
"name": "gdmp",
Expand Down
2 changes: 1 addition & 1 deletion proto
Submodule proto updated 1 files
+39 −15 packet.proto
Loading

0 comments on commit 490d5ea

Please sign in to comment.