Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Ngolinvaux committed Apr 5, 2021
1 parent 13b720d commit 90bbe71
Show file tree
Hide file tree
Showing 23 changed files with 6,508 additions and 383 deletions.
1,783 changes: 1,783 additions & 0 deletions Animations.cpp

Large diffs are not rendered by default.

145 changes: 121 additions & 24 deletions ChaoRando.cpp
Expand Up @@ -157,9 +157,19 @@ ChaoDataBaseGap randomizeChao(ChaoDataBaseGap cdb) {
saveChao = cdb;

saveChao.Color = rand() % 256;
saveChao.Shiny = rand() % 2;
saveChao.MonotoneHighlights = rand() % 2;
saveChao.Texture = rand() % 110;
saveChao.Shiny = rand() % 5;
if (saveChao.Shiny == 4) saveChao.Shiny = 1;
else saveChao.Shiny = 0;
if (saveChao.Shiny) {
saveChao.MonotoneHighlights = rand() % 5;
if (saveChao.MonotoneHighlights) saveChao.MonotoneHighlights = 1;
else saveChao.MonotoneHighlights = 0;
}
else {
saveChao.MonotoneHighlights = rand() % 2;
saveChao.Texture = rand() % 110;
}




Expand Down Expand Up @@ -214,27 +224,91 @@ ChaoDataBaseGap randomizeChao(ChaoDataBaseGap cdb) {

saveChao.Lifespan = 200;
saveChao.EvolutionProgress = rand() % 13 / 10.0;

//saveChao.field_190[0x4E4] |= 2;
//saveChao.Garden = 1;
cdb = saveChao;
return saveChao;
}


ChaoType intToType(int i) {
ChaoType ar[] = {
ChaoType_Good,
ChaoType_Bad,
ChaoType_Neutral_Normal,
ChaoType_Hero_Normal,
ChaoType_Dark_Normal,
ChaoType_Neutral_Swim,
ChaoType_Hero_Swim,
ChaoType_Dark_Swim,
ChaoType_Neutral_Fly,
ChaoType_Hero_Fly,
ChaoType_Dark_Fly,
ChaoType_Neutral_Run,
ChaoType_Hero_Run,
ChaoType_Dark_Run,
ChaoType_Neutral_Power,
ChaoType_Hero_Power,
ChaoType_Dark_Power,
ChaoType_Neutral_Chaos,
ChaoType_Hero_Chaos,
ChaoType_Dark_Chaos,
ChaoType_Tails,
ChaoType_Knuckles,
ChaoType_Amy };

return ar[i];

}

ChaoData* randomizeCarriedChao(ChaoData* cdb) {



cdb->data.Color = rand() % 256;
cdb->data.Shiny = rand() % 2;
cdb->data.MonotoneHighlights = rand() % 2;
cdb->data.Texture = rand() % 110;


string name(chao[rand() % chaoCNT]);
int len = 7;
if (name.length() < 7) len = name.length();
for (int i = 0; i < len; i++) {
cdb->data.Name[i] = encodeLetter(name[i]);
}


cdb->data.Type = intToType(rand() % 25 + 1);


if (rand() % 2 == 0) cdb->data.PowerRun = rand() % 3 - 1;
else cdb->data.FlySwim = rand() % 3 - 1;

cdb->data.Lifespan = 200;
cdb->data.EvolutionProgress = rand() % 13 / 10.0;

//cdb.data.Garden = 1;

return cdb;
}


ChaoDataBaseGap maxChao(ChaoDataBaseGap cdb) {



saveChao = cdb;

saveChao.RunLevel = 99;
saveChao.FlyLevel = 99;
saveChao.SwimLevel = 99;
saveChao.PowerLevel = 99;
saveChao.RunLevel = 0;
saveChao.FlyLevel = 0;
saveChao.SwimLevel = 0;
saveChao.PowerLevel = 0;
saveChao.StaminaLevel = 99;
saveChao.LuckLevel = 99;
saveChao.LuckLevel = 0;
saveChao.IntelligenceLevel = 99;
//saveChao.Happiness = rand() % 201 - 100;
saveChao.Type = 2 + (3 * (rand() % 8));
//saveChao.Type = 2 + (3 * (rand() % 8));
//saveChao.Alignment = rand() % 3 - 1;
saveChao.FlyGrade = 5;
saveChao.RunGrade = 5;
Expand All @@ -250,8 +324,8 @@ ChaoDataBaseGap maxChao(ChaoDataBaseGap cdb) {
saveChao.PowerStat = 3600;
saveChao.SwimStat = 9999;
saveChao.StaminaStat = 65535;
saveChao.LuckStat = 3600;
saveChao.IntelligenceStat = 3600;
saveChao.LuckStat = 3000;
saveChao.IntelligenceStat = 3000;
//saveChao.PowerRun = rand() % 500 - 250;
//saveChao.FlySwim = rand() % 500 - 250;
//saveChao.Lifespan = 200;
Expand Down Expand Up @@ -282,7 +356,22 @@ ChaoDataBaseGap animalChao(ChaoDataBaseGap cdb) {
cdb = saveChao;
return saveChao;
}

void printChao(RaceBotData c) {
string s = "";
s += "somestatthing: ";
s += std::to_string(c.someStatThing);
s += " stat: " + std::to_string(c.stat);
s+= " swim " + std::to_string(c.swim);
s+= " s3a " + std::to_string(c.field_3A);
s+= " fly " + std::to_string(c.fly);
s+= " s3E " + std::to_string(c.field_3E);
s+= " run " + std::to_string(c.run);
s+= " s42 " + std::to_string(c.field_42);
s+= " power " + std::to_string(c.power);
s+= " s46 " + std::to_string(c.field_46);

PrintDebug(s.c_str());
}
RaceBotData randomRaceChao(int idx, RaceBotData rChao) {
rChao.typeRandom = rand() % 27 + 2;
rChao.BallType = rand() % 3;
Expand All @@ -295,16 +384,24 @@ RaceBotData randomRaceChao(int idx, RaceBotData rChao) {
rChao.ShinyMonotone = rand() % 2;
rChao.Medal = rand() % 16;
rChao.AlignmentBase = 1.2;
rChao.stat *= idx;
rChao.swim *= idx;
rChao.run *= idx;
rChao.fly *= idx;
if (rChao.fly > 4000) rChao.fly = 4000;
rChao.power *= idx;
if (rChao.power > 3600) rChao.power = 3600;
rChao.stamina *= idx;
rChao.luck = 3600;
rChao.intelligence = 3600;
//rChao.stat *= idx;
//printChao(rChao);
if (idx > 0) {
if (rChao.someStatThing == 1) {
idx *= 100;
rChao.swim += idx;
rChao.run += idx;
rChao.fly += idx;
rChao.power += idx;
}
else {
rChao.stat += idx * 100;
}
}
//if (rChao.power > 1000 || rChao.power < 0) rChao.power = 1000;
//rChao.stamina *= idx;
//rChao.luck = 3000;
//rChao.intelligence = 3000;
rChao.animalpartRandom = rand() % 8;
rChao.eyeRandom = rand() % 14;
rChao.mouthRandom = rand() % 16;
Expand Down Expand Up @@ -366,7 +463,7 @@ struct_a1R randomKarateChao(int idx,struct_a1R kChao) {
kChao.StatPoints[6] = (mul) * 3600 + rand() % 1000;
kChao.StatPoints[7] = 0;*/

for (int i = 0; i < 8; i++) kChao.StatPoints[i] *= idx;


return kChao;
}
138 changes: 138 additions & 0 deletions Coloring.cpp
@@ -0,0 +1,138 @@
#include "stdafx.h"
#include "Coloring.h"







DataPointer(NJS_ARGB, constMaterial, 0x25effd0);
DataPointer(int, njControl3D, 0x25F02D8);
int storenjControl;
NJS_ARGB color;
float increment = 0.0;
bool up = true;
bool set = false;

void pickColor() {
color.a = 1.0;
color.r = (rand() % 1001) / 1000.0;
color.g = (rand() % 1001) / 1000.0;
color.b = (rand() % 1001) / 1000.0;

}
void setEColor(int r, int g, int b) {
color.a = 1.0;
color.r = r / 255.0;
color.g = g / 255.0;
color.b = b / 255.0;
set = true;
}

void setColor() {
//PrintDebug("set");

constMaterial = color;
if (isHuntingStage()) {
njControl3D_Add(0x10);
increment += 0.000008;

}
if ((isHuntingStage() && !set) || !isHuntingStage()) {
increment += 0.00000001;
if (up) {
if (color.r < 1) color.r += increment;
else if (color.g < 1) color.g += increment;
else if (color.b < 1) color.b += increment;
else {
up = false;
increment = 0.0;
}
}
else {
if (color.r > 0.1) color.r -= increment;
else if (color.g > 0.1) color.g -= increment;
else if (color.b > 0.1) color.b -= increment;
else {
up = true;
increment = 0.0;
}
}
}

}

void resetColor() {
njControl3D_Remove(0x10);
//PrintDebug("resret");

}


static void __declspec(naked) setEmeraldColoring() {
__asm {
pushad
pushfd
call setColor
popfd
popad

sub esp,0x10
xor eax,eax

push 0x6d02f5
ret

}
}

static void __declspec(naked) resetEmeraldColoring() {
__asm {
pushad
pushfd
call resetColor
popfd
popad
ret
}
}


DataPointer(int, d, 0x1a4a918);
static void __declspec(naked) setBallColoring() {
__asm {
pushad
pushfd
call setColor
popfd
popad

cmp esi,d

push 0x66fc32
ret

}
}



void initColoring() {
pickColor();
WriteJump((void*)0x6d02f0, setEmeraldColoring);
WriteJump((void*)0x6d0314, resetEmeraldColoring);
//WriteData<2>((void*)0x73b4b3, 0x90); //remove emerald get sign
WriteData<1>((void*)0x6d26f4, 0x0f); // slow down strobe
//WriteData<5>((void*)0x6d0282, 0x90); // remove strobe
//WriteData<5>((void*)0x66fc1b, 0x90); // remove menu balls



//WriteJump((void*)0x66f5fb, setBallColoring);
WriteJump((void*)0x66fc2c, setBallColoring);
//WriteJump((void*)0x6bf610, setOmochaoColoring);

}
void onFrameColoring() {
}

0 comments on commit 90bbe71

Please sign in to comment.