Skip to content

Commit

Permalink
Add an option to set textures type
Browse files Browse the repository at this point in the history
  • Loading branch information
Sora-yx committed Sep 13, 2022
1 parent dbce3d8 commit bdb6518
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 29 deletions.
4 changes: 2 additions & 2 deletions Super-Tails/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bool RemoveLimitations = false;
bool AlwaysSuperMiles = false;
bool superAura = true;
bool customPhysics = true;
bool textureChanges = true;
int charType = Dreamcast;

Buttons TransformButton = Buttons_Y;

Expand All @@ -23,7 +23,7 @@ void initConfig(const char* path)
//Ini file configuration
const IniFile* config = new IniFile(std::string(path) + "\\config.ini");

textureChanges = config->getBool("General", "textureChanges", true);
charType = config->getInt("General", "charType", Dreamcast);
TransformButton = ButtonsList[config->getInt("General", "TransformButton", 1)];
AnimationTransfo = config->getBool("General", "AnimationTransfo", true);
RemoveLimitations = config->getBool("General", "RemoveLimitations", false);
Expand Down
12 changes: 9 additions & 3 deletions Super-Tails/helper.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

extern bool isDCCharUsed;
extern int CurrentSuperMusic;
extern bool RemoveLimitations;
extern int CurrentSFX;
Expand All @@ -10,7 +9,7 @@ extern bool isSuperTails;
extern bool AlwaysSuperMiles;
extern bool superAura;
extern bool customPhysics;
extern bool textureChanges;
extern int charType;
extern Buttons TransformButton;

extern HelperFunctions help;
Expand All @@ -20,7 +19,7 @@ extern HelperFunctions help;

ObjectFunc(UpdateSetDataAndDelete, 0x46C150);
VoidFunc(FUN_00412ad0, 0x412ad0);
ObjectFunc(EV_ClrFace, 0x4310F0);
TaskFunc(EV_ClrFace, 0x4310F0);

void __cdecl Audio_Init(const char* path, const HelperFunctions& helperFunctions);
void __cdecl SuperTails_Init(const char* path, const HelperFunctions& helperFunctions);
Expand Down Expand Up @@ -63,3 +62,10 @@ enum TailsActions {

};


enum charTypeE
{
none,
Dreamcast,
DX,
};
47 changes: 23 additions & 24 deletions Super-Tails/super-tails.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ TaskHook Tails_Main_t(MilesTalesPrower);
TaskHook Tails_Display_t(MilesDisplay);
TaskHook Invincibility_restart_t((intptr_t)0x441F80);

bool isDCCharUsed = false;
bool isSuperTails = false;

static void Tails_Display_r(task* tsk)
Expand All @@ -19,13 +18,12 @@ static void Tails_Display_r(task* tsk)
Tails_Display_t.Original(tsk);
}


// Sets the texture list to use when rendering.
Sint32 __cdecl setSuperTailsTexture(NJS_TEXLIST* texlist)
{
if (isSuperTails && textureChanges) {
if (isSuperTails && charType != none) {

if (isDCCharUsed)
if (charType == Dreamcast)
texlist = &SuperMilesDC_TEXLIST;
else
texlist = &SuperMilesDX_TEXLIST;
Expand All @@ -50,16 +48,18 @@ void SubRings(unsigned char player, EntityData1* data) {
return;
}

void unSuper(unsigned char player) {
void unSuper(unsigned char pnum) {

if (AlwaysSuperMiles)
return;

TailsAnimData[30].AnimationSpeed = 0;
isSuperTails = false;

EntityData1* data = EntityData1Ptrs[player];
CharObj2* co2 = CharObj2Ptrs[player];
auto player = playertp[pnum];

EntityData1* data = EntityData1Ptrs[pnum];
CharObj2* co2 = CharObj2Ptrs[pnum];

if (!data)
return;
Expand All @@ -68,9 +68,8 @@ void unSuper(unsigned char player) {
co2->PhysicsData = PhysicsArray[Characters_Tails];

data->Status = 0;
EV_ClrFace(player);
ForcePlayerAction(0, 24);
EV_ClrFace(PlayerPtrs[player]);


if (IsIngame())
{
Expand Down Expand Up @@ -171,29 +170,30 @@ bool CheckPlayer_Input(unsigned char playerID) {
return false;
}

facewk* face = 0;

void Miles_SetAngryFace(unsigned char playerID) {

if (!IsIngame() || EV_MainThread_ptr)
return;

task* player = (task*)PlayerPtrs[playerID];
auto player = playertp[playerID];

if (!player)
return;

int curchar = PlayerPtrs[playerID]->Data1->CharID;
auto data = player->twp;

char curchar = playertwp[playerID]->counter.b[1];

if (curchar != Characters_Tails)
return;

auto face = &player->twp->ewp->face;
char number = 13;

if (data->mode > 2)
number = 0;

int faceaddress = (int)&player->twp->ewp->face;
faceaddress = faceaddress; //Adjust address because this is 8 bytes off
face = (facewk*)faceaddress;
int number = 13;
face->old = number;
face->__new = number;
face->frame = 1;
Expand Down Expand Up @@ -323,21 +323,22 @@ void Tails_Main_r(task* obj) {

void __cdecl Init_SuperTailsTextures(const char* path, const HelperFunctions& helperFunctions) {

HMODULE SA1Char = GetModuleHandle(L"SA1_Chars");

if (SA1Char)
if (charType == Dreamcast)
{
for (int i = 0; i < LengthOfArray(superTails_DCEntry); i++) {
helperFunctions.RegisterCharacterPVM(Characters_Tails, superTails_DCEntry[i]);
}
isDCCharUsed = true;
}
else
else if (charType == DX)
{
for (int i = 0; i < LengthOfArray(superTails_DXEntry); i++) {
helperFunctions.RegisterCharacterPVM(Characters_Tails, superTails_DXEntry[i]);
}
isDCCharUsed = false;
}
else {
for (int i = 0; i < LengthOfArray(superTails_Entry); i++) {
helperFunctions.RegisterCharacterPVM(Characters_Tails, superTails_Entry[i]);
}
}
}

Expand All @@ -354,14 +355,12 @@ void InvincibilityRestart_r(task* obj)
return;
}


Invincibility_restart_t.Original(obj);
}


void __cdecl SuperTails_Init(const char* path, const HelperFunctions& helperFunctions)
{

Init_SuperTailsTextures(path, helperFunctions);
Tails_Main_t.Hook(Tails_Main_r);
Tails_Display_t.Hook(Tails_Display_r);
Expand Down
6 changes: 6 additions & 0 deletions Super-Tails/super-tails.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ PVMEntry superTails_DXEntry[] = {
{"SUPERSONIC", &SUPERSONIC_TEXLIST},
};

//if player set "no textures changes"
PVMEntry superTails_Entry[] = {
{"flickyTex", &Flicky_TEXLIST },
{"SUPERSONIC", &SUPERSONIC_TEXLIST},
};

void Load_SuperPhysics(taskwk* data1);

0 comments on commit bdb6518

Please # to comment.