Skip to content

Commit

Permalink
wave fix, smaller move buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Pololak committed Oct 26, 2024
1 parent 7249e4f commit 02c449e
Show file tree
Hide file tree
Showing 9 changed files with 533 additions and 29 deletions.
16 changes: 6 additions & 10 deletions GJGarageLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ class IconKitPreview : public CCLayer {
menu->addChild(closeBtn);

auto gm = gd::GameManager::sharedState();
int selected_dart = gm->getIntGameVariable(GameVariable::SELECTED_DART);

auto playerIcon = gd::SimplePlayer::create(gd::GameManager::sharedState()->getPlayerFrame());
playerIcon->baseSpr()->setColor(gm->colorForIdx(gm->getPlayerColor()));
Expand Down Expand Up @@ -117,8 +116,8 @@ class IconKitPreview : public CCLayer {
birdIcon->setPosition({ 50, 0 });
menu->addChild(birdIcon);

auto waveIcon = gd::SimplePlayer::create(selected_dart);
waveIcon->updatePlayerFrame(selected_dart, gd::IconType::Wave);
auto waveIcon = gd::SimplePlayer::create(setting().selected_dart);
waveIcon->updatePlayerFrame(setting().selected_dart, gd::IconType::Wave);
waveIcon->baseSpr()->setColor(gm->colorForIdx(gm->getPlayerColor()));
waveIcon->colorSpr()->setColor(gm->colorForIdx(gm->getPlayerColor2()));
waveIcon->glowSpr()->setColor(gm->colorForIdx(gm->getPlayerColor2()));
Expand Down Expand Up @@ -202,7 +201,6 @@ void __fastcall GJGarageLayer::setupIconSelectH(gd::GJGarageLayer* self) {
auto winSize = CCDirector::sharedDirector()->getWinSize();

auto GM = gd::GameManager::sharedState();
int selected_dart = gd::GameManager::sharedState()->getIntGameVariable(GameVariable::SELECTED_DART);

auto itemMenu = cocos::getChildOfType<CCMenu>(self, 0);

Expand Down Expand Up @@ -260,7 +258,7 @@ void __fastcall GJGarageLayer::setupIconSelectH(gd::GJGarageLayer* self) {
auto btn = gd::CCMenuItemSpriteExtra::create(base, nullptr, self, menu_selector(GJGarageLayer::Callback::onDartIcon));
totalWaves++;
btn->setPosition({ -165 + (posLimit * 30), -6 - (rows * 30) }); //guh
if (i + 1 == selected_dart) fields->m_dartSelector->setPosition(btn->getPosition());
if (i + 1 == setting().selected_dart) fields->m_dartSelector->setPosition(btn->getPosition());

btn->setTag(totalWaves);
dartMenu->addChild(btn);
Expand Down Expand Up @@ -304,13 +302,12 @@ void __fastcall GJGarageLayer::setupIconSelectH(gd::GJGarageLayer* self) {
//auto dartMenu = gd::GaragePage::create(gd::IconType::Ball, this, menu_selector(GJGarageLayer::onDartIcon));

GJGarageLayer::selectPage(self, 0);
GJGarageLayer::switchToPage((ceilf(selected_dart / 36)));
GJGarageLayer::switchToPage((ceilf(setting().selected_dart / 36)));
}

void GJGarageLayer::Callback::onDartIcon(CCObject* sender) {
auto newSender = static_cast<CCNode*>(sender);
gd::GameManager::sharedState()->setIntGameVariable(GameVariable::SELECTED_DART, newSender->getTag());
//selected_dart = newSender->getTag();
setting().selected_dart = newSender->getTag();
Icons::patchDart(Icons::getCount("dart", "001"), newSender->getTag());
auto playerIcon = garageLayer->getPlayerIcon();
playerIcon->updatePlayerFrame(newSender->getTag(), gd::IconType::Wave);
Expand All @@ -333,14 +330,13 @@ void GJGarageLayer::Callback::onPrev(CCObject* sender) {
}

void GJGarageLayer::switchToPage(int page) {
int selected_dart = gd::GameManager::sharedState()->getIntGameVariable(GameVariable::SELECTED_DART);
std::cout << page << " " << fields->m_totalWavePages - 1 << std::endl;
for (int i = 0; i < fields->m_totalWavePages; i++) {
auto node = static_cast<CCNode*>(fields->m_dartPage->getChildren()->objectAtIndex(i));
if (i == page) node->setVisible(true);
else node->setVisible(false);
}
float selectedWavePage = (ceilf(selected_dart / 36));
float selectedWavePage = (ceilf(setting().selected_dart / 36));
if (selectedWavePage == page) fields->m_dartSelector->setVisible(true);
else fields->m_dartSelector->setVisible(false);
}
Expand Down
3 changes: 1 addition & 2 deletions Icons.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ struct Icons {
}

static void patchDart(int amount, int dartID) {
int selected_dart = gd::GameManager::sharedState()->getIntGameVariable(GameVariable::SELECTED_DART);
auto count = getCount("dart", "001");
if (dartID > amount) {
dartID = amount;
selected_dart = amount;
setting().selected_dart = amount;
}
auto dartAmount = patchUtils::intToBytes(amount);
//patch(gd::base + 0x7fef6, { 0xbe, dartAmount[0], dartAmount[1], dartAmount[2], dartAmount[3] }); //GaragePage::init
Expand Down
3 changes: 1 addition & 2 deletions MenuLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,11 @@ bool __fastcall MenuLayer::init_H(gd::MenuLayer* self, void* edx) {
menu->addChild(reloadBtn);
self->addChild(menu);

int selected_dart = gd::GameManager::sharedState()->getIntGameVariable(GameVariable::SELECTED_DART);
Icons::patchCube(Icons::getCount("player", "001"));
Icons::patchShip(Icons::getCount("ship", "001"));
Icons::patchBall(Icons::getCount("player_ball", "001"));
Icons::patchBird(Icons::getCount("bird", "001"));
Icons::patchDart(Icons::getCount("dart", "001"), selected_dart);
Icons::patchDart(Icons::getCount("dart", "001"), setting().selected_dart);
//Icons::patchTrail(Icons::getCount("player_special", "001"));

return true;
Expand Down
15 changes: 6 additions & 9 deletions ObjectToolbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,12 @@ void __fastcall ObjectToolbox::triggerTab_H() {
ObjectToolbox::triggerTab();
}

void __fastcall ObjectToolbox::gridNodeSizeForKeyH(int objectID) {
//if (setting().onGridSize) {
// float gridSize = setting().gridSize;
// __asm {
// movss xmm0, gridSize
// add esp, 0x4
// }
//}
ObjectToolbox::gridNodeSizeForKey(objectID);
void __stdcall ObjectToolbox::gridNodeSizeForKeyH(int objectID) {
//float gridSize = setting().gridSize;
//__asm {
// movss xmm0, gridSize
// add esp, 0x4
//}
}

void ObjectToolbox::mem_init() {
Expand Down
2 changes: 1 addition & 1 deletion ObjectToolbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace ObjectToolbox {
void __fastcall triggerTab_H();

inline void(__thiscall* gridNodeSizeForKey)(int);
void __fastcall gridNodeSizeForKeyH(int objectID);
void __stdcall gridNodeSizeForKeyH(int objectID);

void mem_init();
}
32 changes: 28 additions & 4 deletions moveForCommand.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
#pragma once
#include "pch.h"

static constexpr const gd::EditCommand kEditCommandHalfLeft = static_cast<gd::EditCommand>(0x400);
static constexpr const gd::EditCommand kEditCommandHalfRight = static_cast<gd::EditCommand>(0x401);
static constexpr const gd::EditCommand kEditCommandHalfUp = static_cast<gd::EditCommand>(0x402);
static constexpr const gd::EditCommand kEditCommandHalfDown = static_cast<gd::EditCommand>(0x403);
namespace moveForCommand {
static constexpr const gd::EditCommand kEditCommandHalfLeft = static_cast<gd::EditCommand>(0x400);
static constexpr const gd::EditCommand kEditCommandHalfRight = static_cast<gd::EditCommand>(0x401);
static constexpr const gd::EditCommand kEditCommandHalfUp = static_cast<gd::EditCommand>(0x402);
static constexpr const gd::EditCommand kEditCommandHalfDown = static_cast<gd::EditCommand>(0x403);

static constexpr const gd::EditCommand kEditCommandQuarterLeft = static_cast<gd::EditCommand>(0x404);
static constexpr const gd::EditCommand kEditCommandQuarterRight = static_cast<gd::EditCommand>(0x405);
static constexpr const gd::EditCommand kEditCommandQuarterUp = static_cast<gd::EditCommand>(0x406);
static constexpr const gd::EditCommand kEditCommandQuarterDown = static_cast<gd::EditCommand>(0x407);

static constexpr const gd::EditCommand kEditCommandEightLeft = static_cast<gd::EditCommand>(0x408);
static constexpr const gd::EditCommand kEditCommandEightRight = static_cast<gd::EditCommand>(0x409);
static constexpr const gd::EditCommand kEditCommandEightUp = static_cast<gd::EditCommand>(0x40a);
static constexpr const gd::EditCommand kEditCommandEightDown = static_cast<gd::EditCommand>(0x40b);

static constexpr const gd::EditCommand kEditCommandSmallerLeft = static_cast<gd::EditCommand>(0x40c);
static constexpr const gd::EditCommand kEditCommandSmallerRight = static_cast<gd::EditCommand>(0x40d);
static constexpr const gd::EditCommand kEditCommandSmallerUp = static_cast<gd::EditCommand>(0x40e);
static constexpr const gd::EditCommand kEditCommandSmallerDown = static_cast<gd::EditCommand>(0x40f);

static constexpr const gd::EditCommand kEditCommandQUnitLeft = static_cast<gd::EditCommand>(0x410);
static constexpr const gd::EditCommand kEditCommandQUnitRight = static_cast<gd::EditCommand>(0x411);
static constexpr const gd::EditCommand kEditCommandQUnitUp = static_cast<gd::EditCommand>(0x412);
static constexpr const gd::EditCommand kEditCommandQUnitDown = static_cast<gd::EditCommand>(0x413);
}


Loading

0 comments on commit 02c449e

Please sign in to comment.