Skip to content

Commit

Permalink
add some shit
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBearodactyl committed Jun 7, 2024
1 parent c417363 commit f54cc1d
Show file tree
Hide file tree
Showing 5 changed files with 216 additions and 61 deletions.
31 changes: 30 additions & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"id": "the_bearodactyl.gay-wave-trail",
"name": "Gay Wave Trail",
"developer": "The Bearodactyl",
"description": "make your wave trail a raging homosexual >:3",
"description": "make your wave trail (and kayla) a raging homosexual >:3",
"settings": {
"enable": {
"name": "Enable the G A E",
Expand All @@ -27,6 +27,28 @@
},
"description": "the speed of the alphabet mafia\nshould not be underestimated.\n(sets the speed at which the\nwave trail changes color)"
},
"wave-pulse-size": {
"name": "It's pulsing...",
"description": "the wave trail that is.",
"type": "float",
"default": 1,
"min": 0.05,
"max": 5,
"control": {
"slider-step": 0.05
}
},
"wave-trail-size": {
"name": "it even left a trail...",
"description": "that of which you can change the size...\noh my fucking sex,\nyou though i was talking about something else",
"type": "float",
"default": 1,
"min": 0.05,
"max": 5,
"control": {
"slider-step": 0.05
}
},
"saturation": {
"name": "HOW GAY ARE YOU???",
"type": "float",
Expand Down Expand Up @@ -56,6 +78,13 @@
"type": "bool",
"default": true
},
"gaydient-section": {
"name": "Gaydient Settings",
"type": "custom",
"description": "make kayla gay",
"scale": 300,
"posX": 80
},
"use-gradient": {
"name": "Enable the GAYDIENT",
"description": "now with 4 colors! full 256\ncolor rainbow NO MORE\n(enables the usage of\nthe below custom colors\ninstead of a vanilla rainbow)",
Expand Down
126 changes: 66 additions & 60 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,89 +3,95 @@
#include <Geode/modify/CCMotionStreak.hpp>
#include <Geode/modify/PlayLayer.hpp>
#include <Geode/modify/PlayerObject.hpp>
#include <string>
#include <cocos2d.h>
#include <cmath>
#include <cocos2d.h>

#include "Geode/loader/ModEvent.hpp"
#include "Geode/modify/Modify.hpp"
#include "settings/section.hpp"
#include "trail_customization/rainbow_trail.hpp"

using namespace geode::prelude;
using namespace cocos2d;

float phase;

class $modify(PlayerObject) {
void flashPlayer(float p0, float p1, cocos2d::ccColor3B mainColor, cocos2d::ccColor3B secondColor) {}
struct MyPlayerObject : Modify<MyPlayerObject, PlayerObject> {
void flashPlayer( float p0, float p1, cocos2d::ccColor3B mainColor, cocos2d::ccColor3B secondColor ) {}
};

class $modify(PlayLayer) {
void postUpdate(float p0) {
PlayLayer::postUpdate(p0);
struct MyPlayLayer : Modify<MyPlayLayer, PlayLayer> {
void postUpdate( float p0 ) {
PlayLayer::postUpdate( p0 );

float speed = Mod::get()->getSettingValue<double>("speed");
float saturation = Mod::get()->getSettingValue<double>("saturation");
float speed = Mod::get()->getSettingValue<double>( "speed" );
float saturation = Mod::get()->getSettingValue<double>( "saturation" );

bool mirror_players = Mod::get()->getSettingValue<bool>("mirror-players");
bool use_gradient = Mod::get()->getSettingValue<bool>("use-gradient");
bool enable = Mod::get()->getSettingValue<bool>("enable");
bool noRegularTrail = Mod::get()->getSettingValue<bool>("no-reg-trail");
bool mirror_players = Mod::get()->getSettingValue<bool>( "mirror-players" );
bool use_gradient = Mod::get()->getSettingValue<bool>( "use-gradient" );
bool enable = Mod::get()->getSettingValue<bool>( "enable" );
bool noRegularTrail = Mod::get()->getSettingValue<bool>( "no-reg-trail" );

auto color1 = Mod::get()->getSettingValue<ccColor3B>("color-one");
auto color2 = Mod::get()->getSettingValue<ccColor3B>("color-two");
auto color3 = Mod::get()->getSettingValue<ccColor3B>("color-three");
auto color4 = Mod::get()->getSettingValue<ccColor3B>("color-four");
auto color1 = Mod::get()->getSettingValue<ccColor3B>( "color-one" );
auto color2 = Mod::get()->getSettingValue<ccColor3B>( "color-two" );
auto color3 = Mod::get()->getSettingValue<ccColor3B>( "color-three" );
auto color4 = Mod::get()->getSettingValue<ccColor3B>( "color-four" );

if (ColorUtils::owo >= 360) {
ColorUtils::owo = 0;
} else {
ColorUtils::owo += speed / 10;
}
if ( ColorUtils::owo >= 360 ) {
ColorUtils::owo = 0;
} else {
ColorUtils::owo += speed / 10;
}

phase = fmod( phase + speed, 360.f );
bool p2 = true;

phase = fmod(phase + speed, 360.f);
bool p2 = true;
_ccColor3B rainbowColor = RainbowTrail::get_rainbow( 0, saturation );
_ccColor3B rainbowColor2 = RainbowTrail::get_rainbow( 180, saturation );

_ccColor3B rainbowColor = RainbowTrail::get_rainbow(0, saturation);
_ccColor3B rainbowColor2 = RainbowTrail::get_rainbow(180, saturation);
_ccColor3B gradientColor = RainbowTrail::get_gradient( phase, 0.0f, false, color1, color2, color3, color4 );
_ccColor3B gradientColor2 = RainbowTrail::get_gradient( phase, 0.0f, false, color4, color3, color2, color1 );

_ccColor3B gradientColor = RainbowTrail::get_gradient(phase, 0.0f, false, color1, color2, color3, color4);
_ccColor3B gradientColor2 = RainbowTrail::get_gradient(phase, 0.0f, false, color4, color3, color2, color1);
if ( m_player1->m_isDart && noRegularTrail ) {
m_player1->m_regularTrail
->setVisible( false );
}

if ( m_player2->m_isDart && noRegularTrail ) {
m_player2->m_regularTrail
->setVisible( false );
}

if (m_player1->m_isDart && noRegularTrail) {
m_player1->m_regularTrail
->setVisible(false);
if ( enable ) {
if ( ! use_gradient ) {
if ( m_player1->m_waveTrail ) {
m_player1->m_waveTrail
->setColor( rainbowColor );
}

if (m_player2->m_isDart && noRegularTrail) {
m_player2->m_regularTrail
->setVisible(false);
if ( m_player2->m_waveTrail ) {
m_player2->m_waveTrail
->setColor( ! mirror_players
? rainbowColor2
: rainbowColor );
}
} else {
if ( m_player1->m_waveTrail ) {
m_player1->m_waveTrail
->setColor( gradientColor );
}

if (enable) {
if (!use_gradient) {
if (m_player1->m_waveTrail) {
m_player1->m_waveTrail
->setColor(rainbowColor);
}

if (m_player2->m_waveTrail) {
m_player2->m_waveTrail
->setColor(!mirror_players
? rainbowColor2
: rainbowColor);
}
} else {
if (m_player1->m_waveTrail) {
m_player1->m_waveTrail
->setColor(gradientColor);
}

if (m_player2->m_waveTrail) {
m_player2->m_waveTrail
->setColor(!mirror_players
? gradientColor
: gradientColor2);
}
}
if ( m_player2->m_waveTrail ) {
m_player2->m_waveTrail
->setColor( ! mirror_players
? gradientColor
: gradientColor2 );
}
}
}
}
};

$on_mod( Loaded ) {
Mod::get()->addCustomSetting<SettingSectionValue>( "gaydient-section", "none" );
}
7 changes: 7 additions & 0 deletions src/settings/section.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "section.hpp"
#include <Geode/loader/Dirs.hpp>
#include <filesystem>

SettingNode *SettingSectionValue::createNode( float width ) {
return SettingSectionNode::create( this, width );
}
94 changes: 94 additions & 0 deletions src/settings/section.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#pragma once
#include <Geode/loader/SettingNode.hpp>

using namespace geode::prelude;

class SettingSectionValue;

class SettingSectionValue : public SettingValue {
protected:
std::string m_placeholder;

public:
SettingSectionValue( std::string const &key, std::string const &modID, std::string const &placeholder )
: SettingValue( key, modID ), m_placeholder( placeholder ) {}

bool load( matjson::Value const &json ) override {
return true;
}
bool save( matjson::Value &json ) const override {
return true;
}
SettingNode *createNode( float width ) override;
};

class SettingSectionNode : public SettingNode {
protected:
bool init( SettingSectionValue *value, float width ) {
if ( ! SettingNode::init( value ) )
return false;
this->setContentSize( { width, 40.f } );
auto menu = CCMenu::create();
std::string sectionName = Mod::get()->getSettingDefinition( value->getKey() )->get<CustomSetting>()->json->get<std::string>( "name" );
auto infoSpr = CCSprite::createWithSpriteFrameName( "GJ_infoIcon_001.png" );
infoSpr->setScale( .7F );
//auto infoBtn
auto infoBtn = CCMenuItemSpriteExtra::create(
infoSpr,
this,
menu_selector( SettingSectionNode::onInfoBtn ) );
infoBtn->setID( value->getKey() );
infoBtn->setPositionX( Mod::get()->getSettingDefinition( value->getKey() )->get<CustomSetting>()->json->get<int>( "posX" ) );
auto label = CCLabelBMFont::create( sectionName.c_str(), "goldFont.fnt" );

label->setScale( .6F );
menu->setPosition( width / 2, 23.f );
menu->addChild( label );
menu->addChild( infoBtn );
this->addChild( menu );
return true;
}

void onInfoBtn( CCObject *sender ) {
// i dont want to deal with template hell
auto node = reinterpret_cast<CCMenuItemSpriteExtra *>( sender );
if ( node == nullptr ) return;
FLAlertLayer::create( nullptr,
Mod::get()->getSettingDefinition( node->getID() )->get<CustomSetting>()->json->get<std::string>( "name" ).c_str(),
Mod::get()->getSettingDefinition( node->getID() )->get<CustomSetting>()->json->get<std::string>( "description" ).c_str(),
"OK",
nullptr,
Mod::get()->getSettingDefinition( node->getID() )->get<CustomSetting>()->json->get<int>( "scale" ) )
->show();
}

public:
void commit() override {
// Let the UI know you have committed the value
this->dispatchCommitted();
}

// Geode calls this to query if the setting value has been changed,
// and those changes haven't been committed
bool hasUncommittedChanges() override {
return false;
}

// Geode calls this to query if the setting has a value that is
// different from its default value
bool hasNonDefaultValue() override {
return true;
}

void resetToDefault() override {
}
static SettingSectionNode *create( SettingSectionValue *value, float width ) {
auto ret = new SettingSectionNode;
if ( ret && ret->init( value, width ) ) {
ret->autorelease();
return ret;
}
CC_SAFE_DELETE( ret );
return nullptr;
}
};
19 changes: 19 additions & 0 deletions src/trail_customization/trail_size.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "Geode/modify/Modify.hpp"
#include <Geode/Geode.hpp>
#include <Geode/modify/PlayLayer.hpp>

using namespace geode::prelude;

struct TrailPulseSize : Modify<TrailPulseSize, PlayLayer> {
void postUpdate( float p0 ) {
PlayLayer::postUpdate( p0 );

float pulse_size = Mod::get()->getSettingValue<double>( "wave-pulse-size" );
float trail_size = Mod::get()->getSettingValue<double>( "wave-trail-size" );

this->m_player1->m_waveTrail->m_pulseSize = pulse_size;
this->m_player1->m_waveTrail->m_waveSize = trail_size;
this->m_player2->m_waveTrail->m_pulseSize = pulse_size;
this->m_player2->m_waveTrail->m_waveSize = trail_size;
}
};

0 comments on commit f54cc1d

Please sign in to comment.