Skip to content

Commit

Permalink
math is so fun!
Browse files Browse the repository at this point in the history
  • Loading branch information
SpazElectro committed Jan 8, 2025
1 parent 8014708 commit 512054a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 15 deletions.
60 changes: 45 additions & 15 deletions mutators/cartoonfade/STVcartoonfade.mut
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,33 @@
#include "STVutil.asc"

bool fading = false;
float fadeTimer = 1;
int blackMapping = 0;

// properties
float baseScale = 1.0;
float circleMult = 0.09;
float circleCount = 93.0;

bool onLocalChat(string &in stringReceived, CHAT::Type chatType) {
if (stringReceived.findFirst("s ") >= 0) {
float value = parseFloat(stringReceived.substr(2));
baseScale = value;
}
if (stringReceived.findFirst("m ") >= 0) {
float value = parseFloat(stringReceived.substr(2));
circleMult = value;
}
if (stringReceived.findFirst("c ") >= 0) {
float value = parseFloat(stringReceived.substr(2));
circleCount = value;
}
if (stringReceived.findFirst("fade") >= 0) {
fade();
}

return false;
}

void onLevelLoad() {
jjAnimSets[45].load();

Expand All @@ -15,13 +39,21 @@ void onLevelLoad() {
jjConsole("Could not find available mapping slot!");
return;
}

fade();
}

void onMain() {
if (fading)
fadeTimer += 1;
if (fading) {
float decrease = 0.1;
baseScale += decrease;
circleCount -= decrease*10;

if (circleCount <= 0) {
// defaults
baseScale = 1.0;
circleCount = 93.0;
fading = false;
}
}
}

void fade() {
Expand All @@ -38,19 +70,17 @@ void drawCircle(jjCANVAS@ canvas, int x, int y, float scale) {
}

void onDrawLayer4(jjPLAYER@ player, jjCANVAS@ canvas) {
float baseScale = -5;
float scaleModifier = -0.2/((fadeTimer/70)*50);
float circleCount = 10;
float i = 0;

/*
it's a black circle growing from the player until
the whole screen is black
*/

drawCircle(
canvas,
player.xPos, player.yPos,
baseScale-(i*scaleModifier)
);
for (float i = 0; i < circleCount; i++)
drawCircle(
canvas,
player.xPos, player.yPos,
-(baseScale+(i*circleMult))
);

canvas.drawString(0, 15, "FPS: "+jjFPS);
}
Binary file modified re/jj2/ida/Jazz2.exe - Pro.i64
Binary file not shown.

0 comments on commit 512054a

Please sign in to comment.