Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Basics-Shadow.cpp : Defines the exported functions for the DLL application.
- //
- #include "stdafx.h"
- #include "SADXModLoader.h"
- #include <cstdlib>
- //#include "Sonic&KnuxToShadowModel.h"
- #include "Models_Header_Shadow.h"
- //To make the Chaos Spear model
- //WriteJump((void*)4C39A0/*address_of_missile_display_function*/, DisplayChaosSpear);
- PVMEntry SonicTextures[] = {
- { "SHA_SONIC", (TexList *)0x91CB58 },
- { "SHA_SON_EFF", (TexList *)0x927CB8 },
- { "SHA_KNUCKLES", (TexList *)0x91BD20 },
- { "SHA_KNU_EFF", (TexList *)0x91BD28 },
- { "E102BEAM", (TexList *)0x91C568 },
- { "E102EFFECT", (TexList *)0x91C570 },
- { "SHA_E102TIME", (TexList *)0x91D5E0 },
- { "E102HIT", (TexList *)0x91D15C },
- { "SUPERSONIC", (NJS_TEXLIST*)0x142272C },
- { 0 }
- };
- PVMEntry KnucklesTextures[] = {
- { "SHA_SONIC", (TexList *)0x91CB58 },
- { "SHA_SON_EFF", (TexList *)0x927CB8 },
- { "SHA_KNUCKLES", (TexList *)0x91BD20 },
- { "SHA_KNU_EFF", (TexList *)0x91BD28 },
- { "E102BEAM", (TexList *)0x91C568 },
- { "E102EFFECT", (TexList *)0x91C570 },
- { "SHA_E102TIME", (TexList *)0x91D5E0 },
- { "E102HIT", (TexList *)0x91D15C },
- { "SUPERSONIC", (NJS_TEXLIST*)0x142272C },
- { 0 }
- };
- DataPointer(short, word_3C53606, 0x3C53606);
- DataPointer(short, word_3C53616, 0x3C53616);
- DataPointer(short, word_3C53626, 0x3C53626);
- DataPointer(short, Y_gravity, 0x3B0F0FC);
- DataPointer(char, Sonic_LightSpeedShoesObtained, 0x3B18895);
- DataPointer(char, Sonic_CrystalRingObtained, 0x3B18896);
- DataPointer(char, Sonic_AncientLightObtained, 0x3B188A7);
- DataPointer(char, Gamma_JetBoosterObtained, 0x3B18991);
- DataPointer(char, Gamma_LaserBlasterObtained, 0x3B18992);
- DataPointer(int, CurrentMusic, 0x0912698);
- FunctionPointer(void, sub_43EC90, (EntityData1 *a1, NJS_VECTOR *a2), 0x43EC90);
- FastcallFunctionPointer(float, sub_788D40, (NJS_VECTOR *a1, NJS_LINE *a2, NJS_VECTOR *a3), 0x788D40);
- FunctionPointer(signed int, sub_438410, (NJS_VECTOR *a1, NJS_VECTOR *a2, NJS_VECTOR *a3), 0x438410);
- FunctionPointer(void, sub_442360, (EntityData1 *a1), 0x442360);
- //Chaos Spear stuff
- #pragma pack(push, 8)
- struct GammaShootingThing
- {
- char AimAction;
- char ShootAction;
- char gap2[14];
- __int16 AimTimer;
- __int16 field_12;
- char gap14[28];
- ObjectMaster *TargetedObject;
- NJS_VECTOR LaserPosition;
- NJS_VECTOR LaserDirection;
- float field_4C;
- float field_50;
- NJS_VECTOR GunPosition;
- NJS_VECTOR GunDirection;
- ObjectMaster *TargetThing;
- float field_70;
- char gap74[16];
- float SightAnimFrame;
- char gap88[12];
- NJS_VECTOR field_94;
- NJS_VECTOR field_A0;
- char gapAC[407];
- char placeholder;
- };
- #pragma pack(pop)
- //////////////For Chaos Spear Model
- ////////////void __cdecl DisplayChaosSpear(ObjectMaster *a1)
- ////////////{
- //////////// EntityData1 *v1 = a1->Data1;
- //////////// EntityData2 *v2 = a1->Data2;
- //////////// if (!MissedFrames)
- //////////// {
- //////////// //njSetTexture(&some_texlist);
- //////////// njPushMatrix(nullptr);
- //////////// njTranslateV(nullptr, &v1->Position);
- //////////// njRotateY(nullptr, 0x8000 - (int)(atan2(v2->VelocityDirection.z, v2->VelocityDirection.x) * 65536.0 * 0.1591549762031479));
- //////////// double v24 = v2->VelocityDirection.z;
- //////////// double v25 = v2->VelocityDirection.x;
- //////////// double v26 = v24 * v24 + v25 * v25;
- //////////// double v27 = squareroot(v26);
- //////////// njRotateZ(nullptr, (int)(atan2(v2->VelocityDirection.y, v27) * 65536.0 * -0.1591549762031479));
- //////////// //ProcessModelNode_B(&chaos_spear_model, 1);
- //////////// ClampGlobalColorThing_Thing();
- //////////// njPopMatrix(1u);
- //////////// }
- ////////////}
- //To Fix Shadow's Arms crossed anim
- void Sonic_GroundAnim_ri(EntityData1 *a1, CharObj2 *a2)
- {
- __int16 v2; // ax
- int v3; // eax
- signed int v4; // eax
- float v5; // ecx
- float v6; // edx
- float v7; // [esp+0h] [ebp-40h]
- NJS_VECTOR a2a; // [esp+4h] [ebp-3Ch]
- NJS_VECTOR a3; // [esp+10h] [ebp-30h]
- NJS_VECTOR a1a; // [esp+1Ch] [ebp-24h]
- NJS_LINE v11; // [esp+28h] [ebp-18h]
- if (a2->AnimationThing.Index != 29)
- {
- v7 = -njInnerProduct(&Gravity, &a2->SurfaceNormal);
- if (njCos(4551) >= (double)v7 || MetalSonicFlag)
- {
- v3 = a2->SurfaceFlags;
- if (!(v3 & 0x4000) && njCos(0x2000) < (double)v7)
- {
- v5 = a2->SurfaceNormal.y;
- v6 = a2->SurfaceNormal.z;
- v11.vx = a2->SurfaceNormal.x;
- v11.vy = v5;
- v11.vz = v6;
- v11.pz = 0.0;
- v11.py = 0.0;
- v11.px = 0.0;
- a2a.x = 1.0;
- a2a.z = 0.0;
- a2a.y = 0.0;
- sub_43EC90(a1, &a2a);
- sub_788D40(&a2a, &v11, &a1a);
- njUnitVector(&a1a);
- sub_788D40(&Gravity, &v11, &a3);
- njUnitVector(&a3);
- v4 = sub_438410(&a1a, &a3, &a2->SurfaceNormal);
- if (v4 <= 49152 && v4 >= 0x4000)
- {
- ++a2->IdleTime;
- a2->AnimationThing.Index = 7;
- return;
- }
- a2->AnimationThing.Index = 8;
- }
- }
- else
- {
- v2 = a2->AnimationThing.Index;
- if (v2 && v2 != 1 && v2 != 2 && v2 != 3 && v2 != 4 && v2 != 5 && v2 != 6 && v2 != 131 && v2 != 132)
- {
- ++a2->IdleTime;
- a2->AnimationThing.Index = 0;
- return;
- }
- if (a2->IdleTime > 1800)
- {
- a2->IdleTime = 0;
- a2->AnimationThing.Index = 4;
- sub_442360(a1);
- ++a2->IdleTime;
- return;
- }
- }
- ++a2->IdleTime;
- }
- }
- static void __declspec(naked) Sonic_GroundAnim_r()
- {
- __asm
- {
- push esi // a2
- push ebx // a1
- // Call your __cdecl function here:
- call Sonic_GroundAnim_ri
- pop ebx // a1
- pop esi // a2
- retn
- }
- }
- extern "C"
- {
- //__declspec(dllexport) PointerList Pointers = { arrayptrandlengthT(pointers, int) };
- __declspec(dllexport) ModInfo SADXModInfo = { ModLoaderVer };
- /////////////////////////////////////////////////////////////////// OnFrame variables //////////////////////////////////////////////////////////////////////////////////////////
- bool r = false;
- bool fall_after_roll = false;
- bool homing = false;
- bool just_homing_attacked = false;
- bool in_air_after_homing = false;
- bool dashing = false;
- bool no_longer_dashing = false;
- bool was_on_trampoline = false;
- bool was_invincible_before = false;
- bool LightDash_SuperDash_ON = false;
- bool just_flipped = false;
- bool just_spindashed = false;
- bool no_light_attack = false;
- bool Z_was_pressed_on_ground = false;
- bool Z_was_pressed_in_air = false;
- bool air_boost_used = false;
- bool was_on_ground = false;
- bool stomp_was_used = false;
- bool just_rolled = false;
- bool LSA_launch = false;
- bool LSA_used = false;
- bool ok = false;
- bool LD_fix = false;
- bool GO_sound_played = false;
- bool cant_punch_now = false;
- bool can_go_back_to_shadow = false;
- bool X_is_held = false;
- bool didnt_target = false;
- bool ready = false;
- bool is_paused = false;
- bool cant_chaos_spear = false;
- bool cant_chaos_spear2 = false;
- bool is_CB = false;
- bool X_was_pressed = false;
- bool cant_chaos_spear_again = false;
- bool pressed_X_while_Gamma = false;
- bool DO_chaos_spear_again = false;
- bool cant_spindash = false;
- bool CS_launch_was_played = false;
- bool CS_charging_was_played = false;
- bool CS_empty_was_played = false;
- bool is_in_CS_state = false;
- bool X_was_released = false;
- bool has_homing_attacked = false;
- bool CB_lv1 = false;
- bool CB_lv2 = false;
- bool CB_lv3 = false;
- bool CB_active = false;
- bool using_chaos_blast = false;
- bool transforming_CB = false;
- bool CHAOSBLAST_was_played = false;
- bool go_back_to_gameplay = false;
- bool LV1_active = false;
- bool LV2_active = false;
- bool LV3_active = false;
- bool do_multi_punch = false;
- bool is_shadow = true; //MEANT FOR ALL TOGETHER MOD
- char balldata[] = { 0xBD, 0x20, 0, 0, 0 };
- char HangTimeCheckData[] = { 0x3B, 0x90, 0x9C, 0, 0, 0 };
- char LightDash_unNOP[] = { 0xC6, 0x06, 0x06, 0x33, 0xD2 };
- //char LightDashSpeed_unNOP[] = { 0xC7, 0x47, 0x38, 0, 0, 0, 0 }; //this controls the "NoRing LightDash" speed
- //char LightDashAnim_unNOP[] = { 0x66, 0xC7, 0x87, 0x24, 0x1, 0, 0, 0x40, 0 };
- char StompAnim[] = { 0x66, 0xC7, 0x87, 0x24, 0x01, 0, 0, 0x40, 0 };
- char TrailData[] = { 0x66, 0x09, 0x5D, 0x04 };
- char WalkOnWaterData[] = { 0xF, 0x85, 0xCF, 0, 0, 0 };
- char spindashdata[] = { 0xC6, 0x7, 0x4, };
- char SuperSplashData[] = { 0x8B, 0x43, 0x74, 0x85, 0xC0 };
- char jumpdashspeed1[] = { 0xC7, 0x47, 0x38, 0, 0, 0xE0, 0x40 };
- char jumpdashspeed1_orig[] = { 0xC7, 0x47, 0x38, 0, 0, 0xA0, 0x40 };
- char jumpdashspeed2[] = { 0xC7, 0x47, 0x38, 0, 0, 0xE0, 0x40 };
- char jumpdashspeed2_orig[] = { 0xC7, 0x47, 0x38, 0, 0, 0xA0, 0x40 };
- char knuxattackdata[] = { 0x66, 0x89, 0xB2, 0x24, 0x01, 0, 0 };
- char knuxobjectcrash_NOP[] = { 0xB8, 0, 0, 0, 0 };
- char knuxobjectcrash_unNOP[] = { 0xE8, 0x7B, 0x0F, 0xF9, 0xFF };
- char jump_cancel_unNOP[] = { 0xC6, 0x06, 0x0C };
- char LSA_sound[] = { 0xE8, 0xDE, 0x0C, 0xF9, 0xFF };
- char LightDashTrail_unNOP[] = { 0xE8, 0x15, 0x91, 0xFF, 0xFF };
- char LD_forced_out_speed[] = { 0xC7, 0x43, 0x38, 0, 0, 0x80, 0x40 };
- char shadow3rdpunchspeed[] = { 0xC7, 0x47, 0x38, 0, 0, 0x00, 0x41 };
- char enable_aiming[] = { 0x0F, 0xBE, 0x06 };
- char enable_shooting[] = { 0xC6, 0x46, 0x01, 0x03 };
- char shooting05_unNOP[] = { 0xC6, 0x46, 0x01, 0x05 };
- char enable_GAMMAflashing[] = { 0x66, 0x89, 0x43, 0x06 };
- char enable_SONIC_KNUXflashing[] = { 0x66, 0x89, 0x45, 0x06 };
- char supersonic_homingspeed[] = { 0xC7, 0x47, 0x38, 0, 0, 0xE0, 0x40 };
- char CB_LV1_stuff1[] = { 0xC6, 0x45, 0, 0x0C };
- char CB_LV1_stuff2[] = { 0x80, 0x65, 0x05, 0xFA };
- char CB_LV1_stuff3[] = { 0xD9, 0x5F, 0x38 };
- char gravity_orig_hovering[] = { 0x89, 0x90, 0x14, 0x01, 0, 0 };
- char gravity_underwater_orig_hovering[] = { 0xD9, 0x98, 0x14, 0x01, 0, 0 };
- ObjectMaster *auraobj = nullptr;
- ObjectMaster *trailobj = nullptr;
- CollisionInfo *oldcol = nullptr; //character change stuff
- float ChaosBoostLv1 = 7.0f;
- float UN_ChaosBoostLv1 = 5.0f;
- float SuperDash = 8.0f;
- float SuperTornado = 16.0f;
- float LightDash_SuperDash = -100.0f;
- float Boost_SuperTornado = -100.0f;
- float LightAttackStatic = 0.0f;
- float LightAttackMoving = 10.0f;
- float SuperLightAttackMoving = 16.0f;
- float CBHomingAttackStatic = 0.0f;
- float CBHomingAttackMoving = 7.0f;
- float missilespeed = 10.0f;
- float missilespeed_orig = 5.0f;
- float LDringdist = 0.0f;
- float old_X_position;
- float old_Y_position;
- float old_Z_position;
- int LightAttackTimer = 0;
- int CBHomingAttackTimer = 0;
- int HangTimeLikeHeroes = 0;
- int OldEnemyBonus;
- int SpeedShoesCount = 0;
- int HomingSounds[]{ 762, 777, 778, 779 };
- int BoostSFX[]{ 780, 781 };
- int BoostVoices[]{ 770, 773, 776 };
- int FOV = 70;
- int SonicTrick3Timer1 = 0;
- int SonicTrick3Timer2 = 0;
- int ShadowTrick1Timer1 = 0;
- int ShadowTrick1Timer2 = 0;
- int ShadowTrick2Timer1 = 0;
- int ShadowTrick2Timer2 = 0;
- int ShadowTrick3Timer1 = 0;
- int ShadowTrick3Timer2 = 0;
- int SpindashNOPingTimer = 0;
- int homing_reattack_timer = 0;
- int punchattack = 0;
- int justrolled = 0;
- int no_longer_punching = 0;
- int punching = 0;
- int backtoshadow1 = 0;
- int backtoshadow2 = 0;
- int NOP_forced_out_speed = 0;
- int LD_punch = 0;
- int no_z_speed = 0;
- int chaos_spear_stop = 0;
- //int X_was_released = 0;
- int paused = 0;
- int stop_supersonic = 0;
- int didnt_target_OK = 0;
- int can_chaos_spear_again = 0;
- int gonna_chaos_spear_again = 0;
- int X_gonna_be_unheld = 0;
- //int Gauge = 0;
- int transforming_CB_time = 0;
- int chaos_blast_active_timer = 0;
- int X_was_released_int = 0;
- int cant_release_X = 0;
- int anim_84_was_played = 0;
- int can_multi_punch = 0;
- ObjectFunc(sub_441D50, 0x441D50);
- void SetSpeedShoes(ObjectMaster *obj)
- {
- SpeedShoesCount++;
- sub_441D50(obj);
- }
- ObjectFunc(sub_441D10, 0x441D10);
- void UnsetSpeedShoes(ObjectMaster *obj)
- {
- if (SpeedShoesCount > 0)
- SpeedShoesCount--;
- sub_441D10(obj);
- }
- void SetInvincible(ObjectMaster *obj)
- {
- was_invincible_before = true;
- RunObjectChildren(obj);
- }
- void UnsetInvincible(ObjectMaster *obj)
- {
- was_invincible_before = false;
- CheckThingButThenDeleteObject(obj);
- }
- void PlayHomingSound() { PlaySound(HomingSounds[rand() % 4], 0, 0, 0); }
- //Ingame Model Swap Stuff **** MEANT TO GO INTO THE BIG MOD (that's what "is_shadow = true" is for)
- void sub_494400_r(int a1, CharObj2 *a2)
- {
- if (is_shadow)
- {
- NJS_ACTION *v4 = a2->AnimationThing.AnimData[a1].Animation;
- NJS_OBJECT *v3 = v4->object;
- if (v3 == *SONIC_OBJECTS)
- njAction_QueueObject(&object_0056AF50, v4->motion, a2->AnimationThing.Frame);
- else if (v3 == SONIC_OBJECTS[66])
- njAction_QueueObject(&object_005729CC, v4->motion, a2->AnimationThing.Frame);
- else
- njAction(v4, a2->AnimationThing.Frame);
- }
- else if (MetalSonicFlag)
- {
- NJS_ACTION *v4 = a2->AnimationThing.AnimData[a1].Animation;
- NJS_OBJECT *v3 = v4->object;
- if (v3 == *SONIC_OBJECTS)
- {
- if (v4 == *SONIC_ACTIONS)
- {
- njSetTexture(&METALSONIC_TEXLIST);
- njAction_QueueObject(SONIC_OBJECTS[68], SONIC_MOTIONS[1], a2->AnimationThing.Frame);
- }
- else
- {
- njSetTexture(&METALSONIC_TEXLIST);
- njAction_QueueObject(SONIC_OBJECTS[68], v4->motion, a2->AnimationThing.Frame);
- }
- }
- else if (v3 == SONIC_OBJECTS[66])
- {
- njSetTexture(&METALSONIC_TEXLIST);
- njAction_QueueObject(SONIC_OBJECTS[69], v4->motion, a2->AnimationThing.Frame);
- }
- else if (v3 == SONIC_OBJECTS[67])
- {
- njSetTexture(&METALSONIC_TEXLIST);
- njAction_QueueObject(SONIC_OBJECTS[70], v4->motion, a2->AnimationThing.Frame);
- }
- else
- njAction(v4, a2->AnimationThing.Frame);
- }
- else if (*(int*)0x3ABD9CC)
- {
- DrawQueueDepthBias = -5952.0;
- njAction_Queue(a2->AnimationThing.AnimData[a1].Animation, a2->AnimationThing.Frame, QueuedModelFlagsB_EnableZWrite);
- DrawQueueDepthBias = 0.0;
- }
- else
- njAction(a2->AnimationThing.AnimData[a1].Animation, a2->AnimationThing.Frame);
- }
- static void __declspec(naked) sub_494400()
- {
- __asm
- {
- push esi // a2
- push eax // a1
- // Call your __cdecl function here:
- call sub_494400_r
- pop eax // a1
- pop esi // a2
- retn
- }
- }
- ///////////////////////////////////////////////////////////////////////// INIT FUNCTION ///////////////////////////////////////////////////////////////////////////////////////
- __declspec(dllexport) void Init(const char *path, const HelperFunctions &helperFunctions)
- {
- WriteCall((void*)0x494BE7, PlayHomingSound);
- WriteCall((void*)0x4BA525, SetInvincible);
- WriteCall((void*)0x4BA537, UnsetInvincible);
- WriteData((void(**)(ObjectMaster*))0x441E10, &SetSpeedShoes);
- WriteData((void(**)(ObjectMaster*))0x441DEA, &UnsetSpeedShoes);
- WriteData((void*)0x4A1413, 0x90u, 4); //Trail stuff
- WriteData((void*)0x55E95C, 0x90u, 6);//Shadow can animate the SuperAura
- //WriteData((void*)0x610113, 0x90, 3);
- //ResizeTextureList((NJS_TEXLIST *)0x2592E8C, 201); //For R101
- ResizeTextureList((NJS_TEXLIST *)0x91BD20, 20);//KNUCKLES.PVM
- //Disable Sonic Morphs
- WriteData((void*)0x493711, 0x90, 3);
- WriteData((void*)0x49356D, 0x90, 3);
- WriteData((void*)0x4935E3, 0x90, 3);
- WriteData((void*)0x493722, 0x90, 3);
- WriteData((void*)0x4936EA, 0x90, 3);
- WriteData((void*)0x493657, 0x90, 3);
- WriteData((void*)0x4936CD, 0x90, 3);
- WriteData((void*)0x493C5D, 0x90, 3);
- WriteData((void*)0x4937A1, 0x90, 3);
- //Disable Knuckles Morphs
- WriteData((void*)0x473FB2, 0x90, 3);
- WriteData((void*)0x473CC1, 0x90, 3);
- WriteData((void*)0x473FC7, 0x90, 3);
- WriteData((void*)0x473CD5, 0x90, 3);
- WriteData((void*)0x4726D3, 0x90, 3);
- WriteData((void*)0x4726EA, 0x90, 3);
- WriteData((void*)0x472701, 0x90, 3);
- WriteData((void*)0x472719, 0x90, 3);
- WriteData((void*)0x472730, 0x90, 3);
- WriteData((void*)0x472747, 0x90, 3);
- WriteData((void*)0x47275F, 0x90, 3);
- WriteData((void*)0x472776, 0x90, 3);
- WriteData((void*)0x472B4A, 0x90, 3);
- WriteData((void*)0x472B61, 0x90, 3);
- WriteData((void*)0x472B78, 0x90, 3);
- WriteData((void*)0x472B90, 0x90, 3);
- WriteData((void*)0x472BA7, 0x90, 3);
- WriteData((void*)0x472BBE, 0x90, 3);
- WriteData((void*)0x472BD6, 0x90, 3);
- WriteData((void*)0x472BED, 0x90, 3);
- PhysicsArray[Characters_Sonic].MaxAccel = 4.25;
- PhysicsArray[Characters_Sonic].field_68 = -0.425;
- HMODULE hmodule = GetModuleHandle(L"CHRMODELS_orig");
- NJS_OBJECT **___SONIC_OBJECTS = (NJS_OBJECT **)GetProcAddress(hmodule, "___SONIC_OBJECTS");
- //To get the right anim without the weird crashes...
- //HMODULE handle = GetModuleHandle(L"CHRMODELS_orig");
- //NJS_ACTION **___SONIC_ACTIONS = (NJS_ACTION **)GetProcAddress(handle, "___SONIC_ACTIONS");
- //NJS_MODEL_SADX **___SONIC_MODELS = (NJS_MODEL_SADX **)GetProcAddress(handle, "___SONIC_MODELS");
- //___SONIC_OBJECTS[0] = &object_0056AF50;
- //___SONIC_ACTIONS[145]->motion = &___SONIC_ACTIONS_18;
- //___SONIC_ACTIONS[146]->motion = &___SONIC_ACTIONS_122;
- //___SONIC_ACTIONS[147]->motion = &___SONIC_ACTIONS_123;
- //___KNUCKLES_OBJECTS[0] = &object_002E23B0;
- //For Character swap like SADX's Metal Sonic
- WriteJump((void*)0x494400, sub_494400);
- //To fix Shadow's arms crossed anim
- WriteJump((void*)0x491660, Sonic_GroundAnim_r);
- };
- ///////////////////////////////////////////////////////////////////////// OnInput FUNCTION ///////////////////////////////////////////////////////////////////////////////////////
- void __declspec(dllexport) OnInput()
- {
- //For multipunching
- if (GameState == 15)
- {
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Knuckles)
- {
- if (can_multi_punch > 2 && ControllerPointers[0]->PressedButtons & Buttons_X )
- {
- do_multi_punch = true;//make it so you can double punch too
- }
- if (do_multi_punch)
- {
- ControllerPointers[0]->PressedButtons = Buttons_X;
- }
- }
- }
- //For Chaos Spear
- if (GameState == 15)
- {
- if (is_in_CS_state)
- {
- if (!X_was_released)
- {
- if (ControllerPointers[0]->HeldButtons & Buttons_X)
- {
- ControllerPointers[1]->PressedButtons = Buttons_B;
- ControllerPointers[1]->HeldButtons = Buttons_B;
- }
- }
- if (++cant_release_X <= 6)
- {
- ControllerPointers[0]->HeldButtons = Buttons_X;
- ControllerPointers[1]->PressedButtons = Buttons_B;
- ControllerPointers[1]->HeldButtons = Buttons_B;
- }
- }
- }
- }
- ///////////////////////////////////////////////////////////////////////// OnFrame FUNCTION ///////////////////////////////////////////////////////////////////////////////////////
- void __declspec(dllexport) OnFrame()
- {
- HMODULE hmodule = GetModuleHandle(L"CHRMODELS_orig");
- NJS_OBJECT **___SONIC_OBJECTS = (NJS_OBJECT **)GetProcAddress(hmodule, "___SONIC_OBJECTS");
- ////For model swaps
- //if (ControllerPointers[0]->PressedButtons & Buttons_Y)
- //{
- // HMODULE handle = GetModuleHandle(L"CHRMODELS_orig");
- // NJS_OBJECT **___SONIC_OBJECTS = (NJS_OBJECT **)GetProcAddress(handle, "___SONIC_OBJECTS");
- // NJS_ACTION **___SONIC_ACTIONS = (NJS_ACTION **)GetProcAddress(handle, "___SONIC_ACTIONS");
- // NJS_OBJECT **___KNUCKLES_OBJECTS = (NJS_OBJECT **)GetProcAddress(handle, "___KNUCKLES_OBJECTS");
- // NJS_ACTION **___KNUCKLES_ACTIONS = (NJS_ACTION **)GetProcAddress(handle, "___KNUCKLES_ACTIONS");
- // ___SONIC_OBJECTS[0] = &object_0056AF50;
- // ___SONIC_OBJECTS[1] = &object_00563B7C;
- // ___SONIC_OBJECTS[2] = &object_00563D0C;
- // ___SONIC_OBJECTS[3] = &object_005654EC;
- // ___SONIC_OBJECTS[4] = &object_00564CD0;
- // ___SONIC_OBJECTS[5] = &object_005647B8;
- // ___SONIC_OBJECTS[6] = &object_00564A78;
- // ___SONIC_OBJECTS[7] = &object_00561F14;
- // ___SONIC_OBJECTS[8] = &object_005620A4;
- // ___SONIC_OBJECTS[9] = &object_005638CC;
- // ___SONIC_OBJECTS[10] = &object_005630B0;
- // ___SONIC_OBJECTS[11] = &object_00562B80;
- // ___SONIC_OBJECTS[12] = &object_0056044C;
- // ___SONIC_OBJECTS[13] = &object_005605DC;
- // ___SONIC_OBJECTS[14] = &object_00561C68;
- // ___SONIC_OBJECTS[15] = &object_005613F8;
- // ___SONIC_OBJECTS[16] = &object_00560DD0;
- // ___SONIC_OBJECTS[17] = &object_0055E99C;
- // ___SONIC_OBJECTS[18] = &object_0055EB2C;
- // ___SONIC_OBJECTS[19] = &object_005601B8;
- // ___SONIC_OBJECTS[20] = &object_0055F948;
- // ___SONIC_OBJECTS[21] = &object_0055F330;
- // ___SONIC_OBJECTS[22] = &object_0062DE88;
- // ___SONIC_OBJECTS[23] = &object_00626AB4;
- // ___SONIC_OBJECTS[24] = &object_00626C44;
- // ___SONIC_OBJECTS[25] = &object_0062840C;
- // ___SONIC_OBJECTS[26] = &object_00627BF0;
- // ___SONIC_OBJECTS[27] = &object_006276D8;
- // ___SONIC_OBJECTS[28] = &object_00624E3C;
- // ___SONIC_OBJECTS[29] = &object_00624FCC;
- // ___SONIC_OBJECTS[30] = &object_006267F4;
- // ___SONIC_OBJECTS[31] = &object_00625FD8;
- // ___SONIC_OBJECTS[32] = &object_00625AA8;
- // ___SONIC_OBJECTS[33] = &object_00623474;
- // ___SONIC_OBJECTS[34] = &object_00623604;
- // ___SONIC_OBJECTS[35] = &object_00624B78;
- // ___SONIC_OBJECTS[36] = &object_00624308;
- // ___SONIC_OBJECTS[37] = &object_00623C14;
- // ___SONIC_OBJECTS[38] = &object_00621AC4;
- // ___SONIC_OBJECTS[39] = &object_00621C54;
- // ___SONIC_OBJECTS[40] = &object_006231E0;
- // ___SONIC_OBJECTS[41] = &object_00622970;
- // ___SONIC_OBJECTS[42] = &object_00622254;
- // ___SONIC_OBJECTS[44] = &object_0057BC44;
- // ___SONIC_OBJECTS[45] = &object_0056998C;
- // ___SONIC_OBJECTS[46] = &object_00569594;
- // ___SONIC_OBJECTS[47] = &object_005812AC;
- // ___SONIC_OBJECTS[48] = &object_00569DEC;
- // ___SONIC_OBJECTS[49] = &object_00569594;
- // ___SONIC_OBJECTS[50] = &object_00569E20;
- // ___SONIC_OBJECTS[51] = &object_00569CE8;
- // ___SONIC_OBJECTS[52] = &object_005698F0;
- // ___SONIC_OBJECTS[56] = &object_0061B4DC;
- // ___SONIC_OBJECTS[57] = &object_0061AA94;
- // ___SONIC_OBJECTS[58] = &object_0055F948;
- // ___SONIC_OBJECTS[60] = &object_005613F8;
- // ___SONIC_OBJECTS[62] = &object_00565520;
- // ___SONIC_OBJECTS[63] = &object_00583284;
- // ___SONIC_OBJECTS[64] = &object_00583904;
- // ___SONIC_OBJECTS[65] = &object_00585EB4;
- // ___SONIC_OBJECTS[66] = &object_005729CC;
- // ___SONIC_OBJECTS[67] = &object_0057BC44;
- // ___SONIC_OBJECTS[68] = &object_00591068;
- // ___SONIC_OBJECTS[69] = &object_0059C234;
- // ___SONIC_OBJECTS[74] = &object_00630794;
- // ___SONIC_OBJECTS[75] = &object_00631128;
- // ___SONIC_OBJECTS[76] = &object_00631AC0;
- // ___SONIC_ACTIONS[0]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[1]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[2]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[3]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[4]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[5]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[6]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[7]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[8]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[9]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[10]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[11]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[12]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[13]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[14]->object = &object_005729CC;
- // ___SONIC_ACTIONS[15]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[16]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[17]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[18]->motion = &___SONIC_ACTIONS_18;
- // ___SONIC_ACTIONS[18]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[19]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[20]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[21]->object = &object_0057BC44;
- // ___SONIC_ACTIONS[22]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[23]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[27]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[28]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[29]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[30]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[31]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[32]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[33]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[34]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[35]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[36]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[37]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[38]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[39]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[40]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[41]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[42]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[43]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[44]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[45]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[46]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[47]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[48]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[49]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[50]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[51]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[52]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[53]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[54]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[55]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[56]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[57]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[58]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[59]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[60]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[61]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[62]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[63]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[64]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[65]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[66]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[67]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[68]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[69]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[70]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[71]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[72]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[87]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[88]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[89]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[90]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[91]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[92]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[93]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[94]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[95]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[96]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[97]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[98]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[99]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[100]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[101]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[102]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[103]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[104]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[105]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[106]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[107]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[108]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[109]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[113]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[114]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[115]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[116]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[117]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[118]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[119]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[120]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[121]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[122]->motion = &___SONIC_ACTIONS_122;
- // ___SONIC_ACTIONS[122]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[123]->motion = &___SONIC_ACTIONS_123;
- // ___SONIC_ACTIONS[123]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[124]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[125]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[126]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[127]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[128]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[129]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[130]->object = &object_0062DE88;
- // ___SONIC_ACTIONS[131]->object = &object_0062DE88;
- // ___SONIC_ACTIONS[132]->object = &object_0062DE88;
- // ___SONIC_ACTIONS[133]->object = &object_0062DE88;
- // ___SONIC_ACTIONS[134]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[135]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[136]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[137]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[138]->object = &object_0062DE88;
- // ___SONIC_ACTIONS[139]->object = &object_0062DE88;
- // ___SONIC_ACTIONS[140]->object = &object_0062DE88;
- // ___SONIC_ACTIONS[141]->object = &object_0062DE88;
- // ___SONIC_ACTIONS[142]->object = &object_0062FE6C;
- // ___SONIC_ACTIONS[143]->object = &object_0062DE88;
- // ___SONIC_ACTIONS[144]->object = &object_0062DE88;
- // ___SONIC_ACTIONS[145]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[146]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[147]->object = &object_0056AF50;
- // ___SONIC_ACTIONS[148]->object = &object_0056AF50;
- // ___KNUCKLES_OBJECTS[0] = &object_002E23B0;
- // ___KNUCKLES_OBJECTS[2] = &object_002DB8A4;
- // ___KNUCKLES_OBJECTS[3] = &object_002DBA34;
- // ___KNUCKLES_OBJECTS[4] = &object_002DD0AC;
- // ___KNUCKLES_OBJECTS[5] = &object_002DC244;
- // ___KNUCKLES_OBJECTS[6] = &object_002D9E5C;
- // ___KNUCKLES_OBJECTS[7] = &object_002D9FEC;
- // ___KNUCKLES_OBJECTS[8] = &object_002DB5F4;
- // ___KNUCKLES_OBJECTS[9] = &object_002DAB34;
- // ___KNUCKLES_OBJECTS[10] = &object_002D876C;
- // ___KNUCKLES_OBJECTS[11] = &object_002D88FC;
- // ___KNUCKLES_OBJECTS[12] = &object_002D9BB0;
- // ___KNUCKLES_OBJECTS[13] = &object_002D6FE4;
- // ___KNUCKLES_OBJECTS[14] = &object_002D7174;
- // ___KNUCKLES_OBJECTS[15] = &object_002D8438;
- // ___KNUCKLES_OBJECTS[16] = &object_002D9754;
- // ___KNUCKLES_OBJECTS[17] = &object_002D9088;
- // ___KNUCKLES_OBJECTS[18] = &object_002D7FDC;
- // ___KNUCKLES_OBJECTS[19] = &object_002D7900;
- // ___KNUCKLES_OBJECTS[20] = &object_002DC94C;
- // ___KNUCKLES_OBJECTS[21] = &object_002DC244;
- // ___KNUCKLES_OBJECTS[22] = &object_002DAEE4;
- // ___KNUCKLES_OBJECTS[23] = &object_002DAB34;
- // ___KNUCKLES_OBJECTS[49] = &object_002E191C;
- // ___KNUCKLES_OBJECTS[51] = &object_002E21A8;
- // ___KNUCKLES_OBJECTS[52] = &object_002E2070;
- // ___KNUCKLES_OBJECTS[53] = &object_002E1C78;
- // ___KNUCKLES_OBJECTS[54] = &object_002E1D14;
- // ___KNUCKLES_OBJECTS[55] = &object_002E191C;
- // ___KNUCKLES_OBJECTS[58] = &object_002DB5F4;
- // ___KNUCKLES_OBJECTS[59] = &object_002DAEE4;
- // ___KNUCKLES_OBJECTS[60] = &object_002DAB34;
- // ___KNUCKLES_OBJECTS[61] = &object_002DA324;
- // ___KNUCKLES_OBJECTS[62] = &object_002DD0AC;
- // ___KNUCKLES_OBJECTS[63] = &object_002DC94C;
- // ___KNUCKLES_OBJECTS[64] = &object_002DC244;
- // ___KNUCKLES_OBJECTS[65] = &object_002DC59C;
- // ___KNUCKLES_ACTIONS[0]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[1]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[6]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[9]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[10]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[11]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[12]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[13]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[14]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[22]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[23]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[24]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[25]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[26]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[27]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[28]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[29]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[30]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[31]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[32]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[33]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[34]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[38]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[40]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[41]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[43]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[44]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[45]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[46]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[47]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[48]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[49]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[50]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[51]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[53]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[54]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[55]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[56]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[58]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[59]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[60]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[63]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[64]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[65]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[66]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[67]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[68]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[69]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[70]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[71]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[72]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[73]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[74]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[75]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[76]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[77]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[78]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[79]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[80]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[81]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[82]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[83]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[84]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[86]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[87]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[88]->object = &object_002E23B0;
- // ___KNUCKLES_ACTIONS[89]->object = &object_002E23B0;
- //}
- WriteData((PVMEntry**)0x90ED54, SonicTextures);
- WriteData((PVMEntry**)0x90ED60, KnucklesTextures);
- //character change stuff*****************************
- if (!IsGamePaused() && oldcol)
- {
- if (HIBYTE(oldcol->Flags) & 0x80)
- {
- if (oldcol->CollisionArray)
- {
- FreeMemory(oldcol->CollisionArray);
- oldcol->CollisionArray = nullptr;
- }
- }
- FreeMemory(oldcol);
- oldcol = nullptr;
- }
- //***************************************************
- EntityData1* co1 = EntityData1Ptrs[0];
- EntityData1* co1CPU = EntityData1Ptrs[1];
- CharObj2 *co2 = GetCharObj2(0);
- CharObj2 *co2CPU = GetCharObj2(1);
- GammaShootingThing *thing = nullptr;
- if (GetCharacterObject(1) && GetCharacterID(1) == Characters_Gamma) thing = *(GammaShootingThing**)&co2CPU->SonicSpinTimeProbably;
- if (CurrentLevel == 26 || CurrentLevel == 29 || CurrentLevel == 33) //***************** WHY ....................???????????
- {
- //Sonic_LightSpeedShoesObtained = 1;
- Sonic_CrystalRingObtained = 1;
- //Sonic_AncientLightObtained = 1;
- }
- else
- {
- //Sonic_LightSpeedShoesObtained = 1;
- Sonic_CrystalRingObtained = 0;
- //Sonic_AncientLightObtained = 0;
- }
- if (CurrentMusic == 24 || CurrentMusic == 72 || CurrentMusic == 101 || CurrentMusic == 102 || CurrentMusic == 103)
- {
- //ChangeToShadowModel();
- //njReleaseTexture((NJS_TEXLIST*)0x91CB58);
- //LoadPVM("SHA_SONIC", (NJS_TEXLIST*)0x91CB58);
- //njReleaseTexture((NJS_TEXLIST*)0x927CB8);
- //LoadPVM("SHA_SON_EFF", (NJS_TEXLIST*)0x927CB8);
- //njReleaseTexture((NJS_TEXLIST*)0x142272C);
- //LoadPVM("SHA_SUPERSONIC", (NJS_TEXLIST*)0x142272C);
- //njReleaseTexture((NJS_TEXLIST*)0x94A2A8);
- //LoadPVM("SHA_KNUCKLES", (NJS_TEXLIST*)0x94A2A8);
- //njReleaseTexture((NJS_TEXLIST*)0x142272C);
- //LoadPVM("SHA_KNU_EFF", (NJS_TEXLIST*)0x142272C);
- //njReleaseTexture((NJS_TEXLIST*)0x94A2A8);
- //LoadPVM("SHA_E102BEAM", (NJS_TEXLIST*)0x94A2A8);
- }
- //Anim data
- WriteData((short*)0x00495C27, (short)13);
- if (co2 == NULL) return;
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- ((AnimData_t*)0x3C56210)[18].TransitionSpeed = 0.1;
- ((AnimData_t*)0x3C56210)[64].TransitionSpeed = 0.25;
- ((AnimData_t*)0x3C56210)[1].TransitionSpeed = 0.075;
- ((AnimData_t*)0x3C56210)[2].TransitionSpeed = 0.075;
- ((AnimData_t*)0x3C56210)[64].AnimationSpeed = 1.5;
- ((AnimData_t*)0x3C56210)[54].AnimationSpeed = 1.5;
- ((AnimData_t*)0x3C56210)[11].AnimationSpeed = 0.9;
- ((AnimData_t*)0x3C56210)[12].AnimationSpeed = 0.6;
- ((AnimData_t*)0x3C56210)[13].AnimationSpeed = 1.0;
- ((AnimData_t*)0x3C56210)[13].Property = 3;
- ((AnimData_t*)0x3C56210)[14].AnimationSpeed = 0.15;
- ((AnimData_t*)0x3C56210)[40].AnimationSpeed = 1.15;
- ((AnimData_t*)0x3C56210)[42].AnimationSpeed = 0.9;
- ((AnimData_t*)0x3C56210)[31].TransitionSpeed = 0.125;
- ((AnimData_t*)0x3C56210)[29].AnimationSpeed = 2.0;
- ((AnimData_t*)0x3C56210)[75].AnimationSpeed = 0.75;
- ((AnimData_t*)0x3C56210)[38].AnimationSpeed = 2.5;
- ((AnimData_t*)0x3C56210)[34].AnimationSpeed = 0.6;
- ((AnimData_t*)0x3C56210)[38].Property = 9;
- ((AnimData_t*)0x3C56210)[34].Property = 9;
- // PhysicsArray[Characters_Sonic].RollEnd = 1.6;
- PhysicsArray[Characters_Sonic].Run1 = 2.0;
- PhysicsArray[Characters_Sonic].Run2 = 5.25;
- co2->PhysicsData.AirDecel = -0.028;
- }
- //Remove the bounce ball when transforming/breathe bubbling
- if (co2->AnimationThing.Index == 84)
- {
- co1->Status &= ~Status_Ball;
- }
- //To be in Jump mode after LSA
- WriteData((char*)0x498763, (char)0x08);
- WriteData((void*)0x49876D, 0x90, 4);
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- if (LSA_used && (ControllerPointers[0]->PressedButtons & Buttons_B || ControllerPointers[0]->PressedButtons & Buttons_X))
- {
- EntityData1Ptrs[0]->Action = 12;
- }
- if (EntityData1Ptrs[0]->Action == 44)
- {
- LSA_used = true;
- }
- else
- {
- LSA_used = false;
- }
- }
- //No magnetic while LightDashing
- if (EntityData1Ptrs[0]->Action != 6)
- {
- WriteData((float**)0x44FAFF, (float*)0x7DD574);
- WriteData((float*)0x44FBBA, 50.0f);
- }
- else
- {
- WriteData((float**)0x44FAFF, &LDringdist);
- WriteData((float*)0x44FBBA, LDringdist);
- }
- //LSA launch a bit in the air after it's finished
- if (EntityData1Ptrs[0]->Action == 44)
- {
- LSA_launch = true;
- }
- if (LSA_launch && EntityData1Ptrs[0]->Action != 44)
- {
- co2->Speed.y = 2;
- LSA_launch = false;
- }
- //LSA don't work with Y
- if (GameState == 15)
- {
- if (Sonic_AncientLightObtained == 1)
- {
- if (EntityData1Ptrs[0]->Action == 4 || co1->Status & Status_LightDash)
- {
- co2->Upgrades |= Upgrades_AncientLight;
- }
- else
- {
- co2->Upgrades &= ~Upgrades_AncientLight;
- }
- }
- }
- //Being able to cancel Chaos Boost's homing attack
- if (GameState == 16)
- {
- paused = 0;
- is_paused = true;
- }
- else if (paused < 4)
- {
- if (++paused == 2)
- {
- is_paused = false;
- }
- }
- if (!is_paused)
- {
- if (EntityData1Ptrs[0]->Action == 14)
- {
- if (ControllerPointers[0]->PressedButtons & Buttons_X || ControllerPointers[0]->PressedButtons & Buttons_B)
- {
- cant_chaos_spear = true;
- EntityData1Ptrs[0]->Action = 8;
- X_was_pressed = true;
- }
- }
- else if (!X_was_pressed)
- {
- cant_chaos_spear = false;
- }
- else
- {
- EntityData1Ptrs[0]->Action = 14;
- X_was_pressed = false;
- }
- }
- //Being able to cancel lightdash
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- if (EntityData1Ptrs[0]->Action == 6)
- {
- if (ControllerPointers[0]->PressedButtons & Buttons_B || ControllerPointers[0]->PressedButtons & Buttons_X)
- {
- EntityData1Ptrs[0]->Action = 12;
- }
- }
- }
- //Top speed anim Shadow ADD ANIMATION SPEED CHECK => why did I write this ? I don't remember ... :/
- if (co2 == NULL) return;
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- if (co2->Speed.x >= 4.0) (WriteData((short*)0x00495B44, (short)130));
- else (WriteData((short*)0x00495B44, (short)12));
- WriteData((short*)0x00495C27, (short)130);
- WriteData((short*)0x00497A88, (short)131);
- WriteData((short*)0x0049691F, (short)131);
- WriteData((short*)0x0049773F, (short)131);
- }
- //Anims better looks => OK
- WriteData((short*)0x004984A3, (short)31);
- WriteData((short*)0x0049629E, (short)31);
- WriteData((short*)0x004962BF, (short)31);
- WriteData((short*)0x00495E2C, (short)11);
- //WriteData((short*)0x0049773F, (short)1);
- //Remove Knux's rolling => OK
- WriteData((char*)0x47824B, (char)0xEB);//74 is the original value
- //Knux's 3rd punch's stop speed => 47419A - C7 47 38 0008040
- WriteData((void*)0x47419A, shadow3rdpunchspeed);
- //If I want to have the 3rd punch not stop the speed when finished => 474293 - D9 5F 38
- //WriteData((void*)0x474293, 0x90, 3);shadow3rdpunchspeed
- //// ATTENTION : NOT ENOUGH FAST BEAMS MAKES EXPLOSIONS NOT APPEAR !!!!!!!m***************
- //// FOUND WHAT CONTROLS THE FLASHING WHEN PSEUDO-INVINCIBLE !!!!
- //// 48152E - 66 89 43 06 => NOP that and he wont flash anymore
- ////
- ////FIXED*************************************** : Exception thrown at 0x004CEB34.********************* (came from the target squares)
- //////Chaos Spear Action (no chaos boost) NEW****************************
- ////ERROR : Exception thrown at 0x3F800000 in sonic.exe: 0xC0000005: Access violation executing location 0x3F800000.
- ////ERROR : Exception thrown at 0x0040B2AF in sonic.exe: 0xC0000005: Access violation writing location 0x004BFDA0.
- ////ERROR as Gamma : Exception thrown at 0x004CEFF6 in sonic.exe: 0xC0000005: Access violation reading location 0x3F9999BA.
- ////ERROR as Sonic : Exception thrown at 0x00493CB0 in sonic.exe: 0xC0000005: Access violation reading location 0xBE561298.
- ////ERROR : Exception thrown at 0x00440243 in sonic.exe: 0xC0000005: Access violation writing location 0x00000000.
- ////ERROR : Exception thrown at 0x0043861B in sonic.exe: 0xC0000005: Access violation reading location 0x3F0B2F45.
- ////ERROR : Exception thrown at 0x0078CF24 in sonic.exe: 0xC0000005: Access violation reading location 0x00000013. => texture issue, maybe because there's no Sonic textures as Gamma ?
- ////ERROR_OFTEN : Exception thrown at 0x0040B33E in sonic.exe: 0xC0000005: Access violation reading location 0xBE03126F.
- ////ERROR_OFTEN : Exception thrown at 0x0040B3DA in sonic.exe: 0xC0000005: Access violation writing location 0x00000031. => FREEMEMORY ISSUE
- ////ERROR : Exception thrown at 0x00456F22 in sonic.exe: 0xC0000005: Access violation reading location 0x00000035. => SPRITE ISSUE
- ////ERROR : Unhandled exception at 0x0CC82BEE in sonic.exe: 0xC0000005: Access violation writing location 0x00181110.
- ////ERROR : Exception thrown at 0x0044058E in sonic.exe: 0xC0000005: Access violation reading location 0xC16FF7F4.
- //////NOP JumpCancel Action/Animation/HSpeed/VSpeed
- //WriteData((void*)0x492F68, 0x90, 3);
- ////WriteData((void*)0x43C560, 0x90, 3);
- ////WriteData((void*)0x43C55D, 0x90, 3);
- //WriteData((short*)0x4C4E34, (short)30000);//Gamma aiming laser timer
- //WriteData((void*)0x4496E1, WalkOnWaterData);
- //WriteData((void*)0x42667F, 0x90, 5); //stop the timer to go up when killing enemies as Gamma
- //if (GameState == 4)
- //{
- // backtoshadow2 = 0;
- // can_go_back_to_shadow = false;
- // chaos_spear_stop = 0;
- // WriteData((void*)0x4C4DA9, enable_aiming);
- // WriteData((void*)0x4C475B, enable_shooting);
- // WriteData((void*)0x48152E, enable_GAMMAflashing);
- // didnt_target = false;
- // ready = false;
- // X_was_released = 0;
- // cant_chaos_spear2 = false;
- // DO_chaos_spear_again = false;
- // pressed_X_while_Gamma = false;
- // gonna_chaos_spear_again = 0;
- //}
- //if ((co1->Status & Status_Ground) == Status_Ground)
- //{
- // DO_chaos_spear_again = false;
- //}
- //if (GameState == 15)
- //{
- // if (co2 == NULL) return;
- // if (is_CB)
- // {
- // Gamma_LaserBlasterObtained = 1;
- // }
- // else Gamma_LaserBlasterObtained = 0;
- // if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- // {
- // if (cant_chaos_spear_again)
- // {
- // if (++can_chaos_spear_again >= 2)
- // {
- // cant_chaos_spear_again = false;
- // can_chaos_spear_again = 0;
- // }
- // }
- // if (pressed_X_while_Gamma)
- // {
- // if (++gonna_chaos_spear_again >= 2)
- // {
- // DO_chaos_spear_again = true;
- // pressed_X_while_Gamma = false;
- // gonna_chaos_spear_again = 0;
- // }
- // }
- // if (ControllerPointers[0]->PressedButtons & Buttons_Z && !is_CB)
- // {
- // is_CB = true;
- // }
- // else if (ControllerPointers[0]->PressedButtons & Buttons_Z && is_CB)
- // {
- // is_CB = false;
- // }
- // WriteData((void*)0x48152E, enable_GAMMAflashing);
- // co2->PhysicsData.AirDecel = -0.028;
- // WriteData((void*)0x4C4DA9, enable_aiming);
- // WriteData((void*)0x4C475B, enable_shooting);
- // WriteData((void*)0x4C4643, 0x90, 4); //C6 46 01 05 - To make shooting action not go to 5, making instant shooting happen********************************************************
- // WriteData((char*)0x4CEA60, (char)0xC3);//removes the red/yellow squares
- // ready = false;
- // if (backtoshadow2 >= 27)
- // {
- // if (++backtoshadow2 == 29)
- // {
- // EntityData1Ptrs[0]->Action = 8;
- // co2->AnimationThing.Index = 119;
- // co1->Status |= Status_Ball;
- // backtoshadow2 = 0;
- // cant_chaos_spear2 = false;
- // }
- // }
- // if (didnt_target)
- // {
- // EntityData1Ptrs[0]->Action = 8;
- // co2->AnimationThing.Index = 18;
- // co1->Status |= Status_Ball;
- // if (++backtoshadow2 == 2)
- // {
- // backtoshadow2 = 0;
- // didnt_target = false;
- // cant_chaos_spear2 = false;
- // }
- // }
- // if ((co1->Status & Status_Ground) != Status_Ground && (co2->AnimationThing.Index == 14 || co2->AnimationThing.Index == 18 || co2->AnimationThing.Index == 116 || co2->AnimationThing.Index == 117 || co2->AnimationThing.Index == 119))
- // {
- // if (EntityData1Ptrs[0]->Action == 8 && !cant_chaos_spear && !cant_chaos_spear2 && !cant_chaos_spear_again) // && (co2->AnimationThing.Index == 14 || co2->AnimationThing.Index == 18)
- // {
- // if ((!X_is_held && ControllerPointers[0]->HeldButtons & Buttons_X) || (DO_chaos_spear_again)) // fix to have it false when onground !! and fix anyway that stuff
- // {
- // DO_chaos_spear_again = false;
- // X_is_held = true;
- // ObjectMaster *obj = GetCharacterObject(0);
- // CharObj2 *obj2 = ((EntityData2 *)obj->Data2)->CharacterData;
- // short powerups = obj2->Powerups;
- // short jumptime = obj2->JumpTime;
- // short underwatertime = obj2->UnderwaterTime;
- // float loopdist = obj2->LoopDist;
- // NJS_VECTOR speed = obj2->Speed;
- // ObjectMaster *heldobj = obj2->ObjectHeld;
- // obj->DeleteSub(obj);
- // obj->MainSub = Gamma_Main;
- // obj->Data1->CharID = (char)Characters_Gamma;
- // obj->Data1->Action = 0;
- // obj->Data1->Status &= ~(Status_Attack | Status_Ball | Status_LightDash | Status_Unknown3);
- // if (!oldcol)
- // {
- // oldcol = obj->Data1->CollisionInfo;
- // obj->Data1->CollisionInfo = nullptr;
- // }
- // else
- // Collision_Free(obj);
- // obj->MainSub(obj);
- // obj2 = ((EntityData2 *)obj->Data2)->CharacterData;
- // obj2->Powerups = powerups;
- // obj2->JumpTime = jumptime;
- // obj2->UnderwaterTime = underwatertime;
- // obj2->LoopDist = loopdist;
- // obj2->Speed = speed;
- // obj2->ObjectHeld = heldobj;
- // LoadSoundList(48);
- // if (VoiceLanguage)
- // LoadSoundList(68);
- // else
- // LoadSoundList(67);
- // //WriteData((char*)0x4CEA60, (char)0x8B);//put the red/yellow squares
- // WriteData((float**)0x4C41CD, &missilespeed);
- // WriteData((float**)0x4C41DC, &missilespeed);
- // WriteData((float**)0x4C41E8, &missilespeed);
- // can_chaos_spear_again = 0;
- // WriteData((void*)0x48152E, 0x90, 4); //make the character not flash when "invulnerable time"
- // EntityData1Ptrs[0]->InvulnerableTime = 60000;
- // *(*((char**)&obj2->SonicSpinTimeProbably)) = 2; //it starts at 0 (init), then it goes to 1 (normal), where it checks if you're holding B, then it goes to 2 (activating laser), which goes to 3 (using laser), where it either checks if you release B, where it goes to 5 (shooting), or the timer runs out and it goes to 4 (time out) which goes to 6 (shooting after time out), and then I guess it goes back to 1
- // }
- // }
- // }
- // if (X_is_held && !(ControllerPointers[0]->HeldButtons & Buttons_X))
- // {
- // X_is_held = false;
- // }
- // else if (ControllerPointers[0]->HeldButtons & Buttons_X)
- // {
- // X_is_held = true;
- // }
- // }
- // if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Gamma)
- // {
- // can_chaos_spear_again = 0;
- // co2->Upgrades &= ~Upgrades_JetBooster;
- // co2->PhysicsData.YOff = 5.4;
- // if (X_is_held && !(ControllerPointers[0]->HeldButtons & Buttons_X))
- // {
- // X_is_held = false;
- // }
- // else if (ControllerPointers[0]->HeldButtons & Buttons_X)
- // {
- // X_is_held = true;
- // }
- // EntityData1Ptrs[0]->Action = 7;
- // co2->AnimationThing.Index = 49;
- // co2->PhysicsData.AirDecel = -0.128;
- // co2->Speed.x = 0.0;
- // co2->Speed.y = 0.1;
- // co2->Speed.z = 0.0;
- // if (!X_is_held && X_was_released < 2)
- // {
- // ++X_was_released;
- // if (X_was_released > 1)
- // {
- // if ((*(char**)&co2->SonicSpinTimeProbably)[1] == 1)
- // {
- // didnt_target = true;
- // }
- // else
- // {
- // ready = true;
- // can_go_back_to_shadow = true;
- // didnt_target = false;
- // }
- // }
- // }
- // if (is_CB)
- // {
- // co2->Upgrades |= Upgrades_LaserBlaster;
- // if (ready && chaos_spear_stop < 4)
- // {
- // if (++chaos_spear_stop == 4)
- // {
- // WriteData((void*)0x4C4643, shooting05_unNOP);
- // WriteData((void*)0x4C475B, 0x90, 4); //to stop the shooting response
- // }
- // }
- // }
- // else
- // {
- // co2->Upgrades &= ~Upgrades_LaserBlaster;
- // if (ready && chaos_spear_stop < 2)
- // {
- // if (++chaos_spear_stop == 2)
- // {
- // WriteData((void*)0x4C4643, shooting05_unNOP);
- // WriteData((void*)0x4C475B, 0x90, 4); //to stop the shooting response
- // }
- // }
- // }
- // if (can_go_back_to_shadow && !didnt_target)
- // {
- // if (backtoshadow2 > 12 && ControllerPointers[0]->PressedButtons & Buttons_X)
- // {
- // pressed_X_while_Gamma = true;
- // }
- // ++backtoshadow2;
- // if (backtoshadow2 > 3 && backtoshadow2 < 24)
- // {
- // WriteData((void*)0x4C4DA9, 0x90, 3); //disables aiming action
- // }
- // if (backtoshadow2 == 24)
- // {
- // WriteData((float**)0x4C41CD, &missilespeed_orig);
- // WriteData((float**)0x4C41DC, &missilespeed_orig);
- // WriteData((float**)0x4C41E8, &missilespeed_orig);
- // WriteData((void*)0x4C4DA9, enable_aiming);
- // }
- // if (backtoshadow2 == 25)
- // {
- // *(*((char**)&co2->SonicSpinTimeProbably)) = 4;
- // }
- // if (backtoshadow2 == 26)
- // {
- // WriteData((void*)0x4C4DA9, 0x90, 3); //disables aiming action
- // }
- // if (backtoshadow2 == 27)
- // {
- // WriteData((char*)0x4CEA60, (char)0xC3);//removes the red/yellow squares
- // *(*((char**)&co2->SonicSpinTimeProbably)) = 4;
- // ObjectMaster *obj = GetCharacterObject(0);
- // CharObj2 *obj2 = ((EntityData2 *)obj->Data2)->CharacterData;
- // short powerups = obj2->Powerups;
- // short jumptime = obj2->JumpTime;
- // short underwatertime = obj2->UnderwaterTime;
- // float loopdist = obj2->LoopDist;
- // NJS_VECTOR speed = obj2->Speed;
- // ObjectMaster *heldobj = obj2->ObjectHeld;
- // obj->DeleteSub(obj);
- // obj->MainSub = Sonic_Main;
- // obj->Data1->CharID = (char)Characters_Sonic;
- // obj->Data1->Action = 0;
- // obj->Data1->Status &= ~(Status_Attack | Status_Ball | Status_LightDash | Status_Unknown3);
- // if (!oldcol)
- // {
- // oldcol = obj->Data1->CollisionInfo;
- // obj->Data1->CollisionInfo = nullptr;
- // }
- // else
- // Collision_Free(obj);
- // obj->MainSub(obj); // ERROR : Exception thrown at 0x00440243 in sonic.exe: 0xC0000005: Access violation writing location 0x00000000.
- // obj2 = ((EntityData2 *)obj->Data2)->CharacterData;
- // obj2->Powerups = powerups;
- // obj2->JumpTime = jumptime;
- // obj2->UnderwaterTime = underwatertime;
- // obj2->LoopDist = loopdist;
- // obj2->Speed = speed;
- // obj2->ObjectHeld = heldobj;
- // LoadSoundList(1);
- // if (VoiceLanguage)
- // LoadSoundList(72);
- // else
- // LoadSoundList(71);
- // obj2->AnimationThing.Index = 119;
- // can_go_back_to_shadow = false;
- // chaos_spear_stop = 0;
- // X_was_released = 0;
- // EntityData1Ptrs[0]->InvulnerableTime = 0;
- // cant_chaos_spear2 = true;
- // cant_chaos_spear_again = true;
- // }
- // }
- // if (didnt_target)
- // {
- // ++didnt_target_OK;
- // }
- // if (didnt_target_OK >= 2)
- // {
- // WriteData((char*)0x4CEA60, (char)0xC3);//removes the red/yellow squares
- // *(*((char**)&co2->SonicSpinTimeProbably)) = 4;
- // ObjectMaster *obj = GetCharacterObject(0);
- // CharObj2 *obj2 = ((EntityData2 *)obj->Data2)->CharacterData;
- // short powerups = obj2->Powerups;
- // short jumptime = obj2->JumpTime;
- // short underwatertime = obj2->UnderwaterTime;
- // float loopdist = obj2->LoopDist;
- // NJS_VECTOR speed = obj2->Speed;
- // ObjectMaster *heldobj = obj2->ObjectHeld;
- // obj->DeleteSub(obj);
- // obj->MainSub = Sonic_Main;
- // obj->Data1->CharID = (char)Characters_Sonic;
- // obj->Data1->Action = 0;
- // obj->Data1->Status &= ~(Status_Attack | Status_Ball | Status_LightDash | Status_Unknown3);
- // if (!oldcol)
- // {
- // oldcol = obj->Data1->CollisionInfo;
- // obj->Data1->CollisionInfo = nullptr;
- // }
- // else
- // Collision_Free(obj);
- // obj->MainSub(obj);
- // obj2 = ((EntityData2 *)obj->Data2)->CharacterData;
- // obj2->Powerups = powerups;
- // obj2->JumpTime = jumptime;
- // obj2->UnderwaterTime = underwatertime;
- // obj2->LoopDist = loopdist;
- // obj2->Speed = speed;
- // obj2->ObjectHeld = heldobj;
- // LoadSoundList(1);
- // if (VoiceLanguage)
- // LoadSoundList(72);
- // else
- // LoadSoundList(71);
- // obj2->AnimationThing.Index = 119;
- // can_go_back_to_shadow = false;
- // chaos_spear_stop = 0;
- // X_was_released = 0;
- // EntityData1Ptrs[0]->InvulnerableTime = 0;
- // cant_chaos_spear2 = true;
- // didnt_target_OK = 0;
- // cant_chaos_spear_again = true;
- // }
- // }
- //}
- // TO DISABLE THE AIMING SYSTEM => 4C4DA9 - 0FBE06
- //WriteData((void*)0x4C4DA9, enable_aiming);
- //WriteData((void*)0x4C4DA9, 0x90, 3);
- //MULTIPLE CHAOS SPEARS :
- //When 3 shots have been made, NOP this => 4C475B - C6 46 01 03 and, once 60 frames have passed, set this to 4 => *(*((char**)&co2->SonicSpinTimeProbably)) = 4;
- //*(*((char**)&co2->SonicSpinTimeProbably)) = 2; for chaos boost (to auto kill => this is just a test) AND AN IDEA => MAYBE HAVE IT TO SHOOT 2 AND 2 AND 2 etc => I THINK I WON'T USE THAT AFTER ALL.
- //WriteData((void*)0x4C4F20, 0x90, 2); for chaos boost (to auto kill => this is just a test) AND AN IDEA
- //(*(char**)&co2->SonicSpinTimeProbably)[1] => setting this to always 4 allow to shoot all at the same time
- //if (ControllerPointers[0]->HeldButtons & Buttons_Y)
- //{
- // *(*((char**)&co2->SonicSpinTimeProbably)) = 2;
- //}
- //if (ControllerPointers[0]->HeldButtons & Buttons_Left)
- //{
- // *(*((char**)&co2->SonicSpinTimeProbably)) = 3;
- //}
- //if (ControllerPointers[0]->HeldButtons & Buttons_Right)
- //{
- // *(*((char**)&co2->SonicSpinTimeProbably)) = 4;
- //}
- //if (ControllerPointers[0]->HeldButtons & Buttons_Down)
- //{
- // *(*((char**)&co2->SonicSpinTimeProbably)) = 5;
- //}
- //if (ControllerPointers[0]->HeldButtons & Buttons_Up)
- //{
- // *(*((char**)&co2->SonicSpinTimeProbably)) = 6;
- //}
- //Knuckles Punches data
- //co2->field_84 = 0;
- //((short *)&co2->field_84)[1] = 0;
- word_3C53606 = 0; //1st to 2nd no longer automatic
- //word_3C53616 = 0; //2nd to 3rd no longer automatic
- word_3C53626 = 0; //3rd to 4th and 5th no longer automatic
- //Fix Shadow punching when releasing lightattack on nothing
- if ((co1->Status & Status_LightDash) == Status_LightDash)
- {
- cant_punch_now = true;
- }
- if (((co1->Status & Status_LightDash) != Status_LightDash) && cant_punch_now)
- {
- if (++LD_punch == 2)
- {
- cant_punch_now = false;
- }
- }
- else if (LD_punch != 0 && !cant_punch_now)
- {
- LD_punch = 0;
- }
- //ERRORS Exception thrown at 0x00473D42 in sonic.exe: 0xC0000005: Access violation reading location 0x00000000.
- //ERROR : Exception thrown at 0x0040B374 in sonic.exe: 0xC0000005: Access violation writing location 0x80000000.
- //Punching Action******************************************************** DOESNT KEEP THE SPEED SHOES; SUMMONS WAY TOO MUCH BUBBLES UNDERWATER AND SUMMON A BIG BUBBLE WHEN SWAPPING;
- //FIX THAT STAYING KNUX WHEN PUNCHING INTO TRAMPOLINE
- if (GameState == 4)
- {
- can_multi_punch = 0;
- do_multi_punch = false;
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Knuckles)
- {
- no_z_speed = 1;
- ObjectMaster *obj = GetCharacterObject(0);
- CharObj2 *obj2 = ((EntityData2 *)obj->Data2)->CharacterData;
- short powerups = obj2->Powerups;
- short jumptime = obj2->JumpTime;
- short underwatertime = obj2->UnderwaterTime;
- float loopdist = obj2->LoopDist;
- NJS_VECTOR speed = obj2->Speed;
- ObjectMaster *heldobj = obj2->ObjectHeld;
- obj->DeleteSub(obj);
- obj->MainSub = Sonic_Main;
- obj->Data1->CharID = (char)Characters_Sonic;
- obj->Data1->Action = 0;
- obj->Data1->Status &= ~(Status_Attack | Status_Ball | Status_LightDash | Status_Unknown3);
- if (!oldcol)
- {
- oldcol = obj->Data1->CollisionInfo;
- obj->Data1->CollisionInfo = nullptr;
- }
- else
- Collision_Free(obj);
- obj->MainSub(obj);
- obj2 = ((EntityData2 *)obj->Data2)->CharacterData;
- obj2->Powerups = powerups;
- obj2->JumpTime = jumptime;
- obj2->UnderwaterTime = underwatertime;
- obj2->LoopDist = loopdist;
- obj2->Speed = speed;
- obj2->ObjectHeld = heldobj;
- LoadSoundList(1);
- if (VoiceLanguage)
- LoadSoundList(72);
- else
- LoadSoundList(71);
- EntityData1Ptrs[0]->InvulnerableTime = 0;
- }
- }
- if (GameState == 15 && !cant_punch_now)
- {
- if (co2 == NULL) return;
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- WriteData((void*)0x4780EE, enable_SONIC_KNUXflashing);
- if (no_z_speed > 0)
- {
- co2->Speed.z = 0; //Fix the side speed after punching
- if (++no_z_speed == 30)
- {
- no_z_speed = 0;
- }
- }
- if (backtoshadow1 > 0)
- {
- ++backtoshadow1;
- }
- if (backtoshadow1 > 2)
- {
- //co2->Powerups &= ~Powerups_Invincibility;
- backtoshadow1 = 0;
- }
- if (EntityData1Ptrs[0]->Action == 5) just_rolled = true;
- if (EntityData1Ptrs[0]->Action == 8 || co2->Speed.x <= 0.46) just_rolled = false;
- if (just_rolled && ControllerPointers[0]->PressedButtons & Buttons_X) ++justrolled;
- if (justrolled == 2)
- {
- just_rolled = false;
- justrolled = 0;
- }
- if (EntityData1Ptrs[0]->Action != 4 && EntityData1Ptrs[0]->Action != 5 && (co2->AnimationThing.Index == 0 || co2->AnimationThing.Index == 1 || co2->AnimationThing.Index == 2 || co2->AnimationThing.Index == 3 || co2->AnimationThing.Index == 4 || co2->AnimationThing.Index == 5 || co2->AnimationThing.Index == 6 || co2->AnimationThing.Index == 7 || co2->AnimationThing.Index == 8 || co2->AnimationThing.Index == 9 || co2->AnimationThing.Index == 10 || co2->AnimationThing.Index == 11 || co2->AnimationThing.Index == 12 || co2->AnimationThing.Index == 13 || co2->AnimationThing.Index == 14 || co2->AnimationThing.Index == 20 || co2->AnimationThing.Index == 25 || co2->AnimationThing.Index == 31 || co2->AnimationThing.Index == 44 || co2->AnimationThing.Index == 45 || co2->AnimationThing.Index == 71 || co2->AnimationThing.Index == 130))
- {
- if (ControllerPointers[0]->HeldButtons & Buttons_X && (co1->Status & Status_LightDash) != Status_LightDash && !just_rolled)
- {
- no_longer_punching = 0;
- ++punchattack;
- }
- if (!just_rolled && punchattack < 30 && ControllerPointers[0]->ReleasedButtons & Buttons_X)
- {
- WriteData((void*)0x47A8E0, knuxobjectcrash_NOP);
- ObjectMaster *obj = GetCharacterObject(0);
- CharObj2 *obj2 = ((EntityData2 *)obj->Data2)->CharacterData;
- short powerups = obj2->Powerups;
- short jumptime = obj2->JumpTime;
- short underwatertime = obj2->UnderwaterTime;
- float loopdist = obj2->LoopDist;
- NJS_VECTOR speed = obj2->Speed;
- ObjectMaster *heldobj = obj2->ObjectHeld;
- obj->DeleteSub(obj);
- obj->MainSub = Knuckles_Main;
- obj->Data1->CharID = (char)Characters_Knuckles;
- obj->Data1->Action = 0;
- obj->Data1->Status &= ~(Status_Attack | Status_Ball | Status_LightDash | Status_Unknown3);
- if (!oldcol)
- {
- oldcol = obj->Data1->CollisionInfo;
- obj->Data1->CollisionInfo = nullptr;
- }
- else
- Collision_Free(obj);
- obj->MainSub(obj);
- obj2 = ((EntityData2 *)obj->Data2)->CharacterData;
- obj2->PhysicsData.YOff = 5.4;
- obj2->PhysicsData.CameraY = 7.0;
- obj2->Powerups = powerups;
- obj2->JumpTime = jumptime;
- obj2->UnderwaterTime = underwatertime;
- obj2->LoopDist = loopdist;
- obj2->Speed = speed;
- obj2->ObjectHeld = heldobj;
- LoadSoundList(49);
- if (VoiceLanguage)
- {
- LoadSoundList(70);
- LoadSoundList(58);
- }
- else
- {
- LoadSoundList(69);
- LoadSoundList(57);
- }
- EntityData1Ptrs[0]->Action = 26;
- co2->AnimationThing.Index = 54;
- //co2->Powerups |= Powerups_Invincibility;
- EntityData1Ptrs[0]->InvulnerableTime = 60000;
- }
- }
- }
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Knuckles)
- {
- ++can_multi_punch;
- WriteData((void*)0x4780EE, 0x90, 4); //make knuckles not flash when "invulnerable time"
- if (co2->AnimationThing.Index == 54 || co2->AnimationThing.Index == 55 || co2->AnimationThing.Index == 56)
- {
- co2->Speed.z = 0;
- }
- punchattack = 0;
- if (no_longer_punching >= 0 && no_longer_punching < 4)
- {
- //co2->Powerups |= Powerups_Invincibility;
- EntityData1Ptrs[0]->Action = 26;
- co2->AnimationThing.Index = 54;
- }
- ++no_longer_punching;
- if (no_longer_punching > 15 && (co2->AnimationThing.Index == 0 || co2->AnimationThing.Index == 9 || co2->AnimationThing.Index == 10 || co2->AnimationThing.Index == 11 || co2->AnimationThing.Index == 12 || co2->AnimationThing.Index == 13))
- {
- if (++backtoshadow1 == 2)
- {
- no_z_speed = 1;
- ObjectMaster *obj = GetCharacterObject(0);
- CharObj2 *obj2 = ((EntityData2 *)obj->Data2)->CharacterData;
- short powerups = obj2->Powerups;
- short jumptime = obj2->JumpTime;
- short underwatertime = obj2->UnderwaterTime;
- float loopdist = obj2->LoopDist;
- NJS_VECTOR speed = obj2->Speed;
- ObjectMaster *heldobj = obj2->ObjectHeld;
- obj->DeleteSub(obj);
- obj->MainSub = Sonic_Main;
- obj->Data1->CharID = (char)Characters_Sonic;
- obj->Data1->Action = 0;
- obj->Data1->Status &= ~(Status_Attack | Status_Ball | Status_LightDash | Status_Unknown3);
- if (!oldcol)
- {
- oldcol = obj->Data1->CollisionInfo;
- obj->Data1->CollisionInfo = nullptr;
- }
- else
- Collision_Free(obj);
- obj->MainSub(obj);
- obj2 = ((EntityData2 *)obj->Data2)->CharacterData;
- obj2->Powerups = powerups;
- obj2->JumpTime = jumptime;
- obj2->UnderwaterTime = underwatertime;
- obj2->LoopDist = loopdist;
- obj2->Speed = speed;
- obj2->ObjectHeld = heldobj;
- LoadSoundList(1);
- if (VoiceLanguage)
- LoadSoundList(72);
- else
- LoadSoundList(71);
- EntityData1Ptrs[0]->InvulnerableTime = 0;
- can_multi_punch = 0;
- do_multi_punch = false;
- //WriteData((void*)0x47A8E0, knuxobjectcrash_unNOP);
- //co2->Powerups &= ~Powerups_Invincibility;
- }
- }
- if (co2->AnimationThing.Index == 17 || co2->AnimationThing.Index == 18 || co2->AnimationThing.Index == 19 || co2->AnimationThing.Index == 34 || co2->AnimationThing.Index == 51)
- {
- no_z_speed = 1;
- ObjectMaster *obj = GetCharacterObject(0);
- CharObj2 *obj2 = ((EntityData2 *)obj->Data2)->CharacterData;
- short powerups = obj2->Powerups;
- short jumptime = obj2->JumpTime;
- short underwatertime = obj2->UnderwaterTime;
- float loopdist = obj2->LoopDist;
- NJS_VECTOR speed = obj2->Speed;
- ObjectMaster *heldobj = obj2->ObjectHeld;
- obj->DeleteSub(obj);
- obj->MainSub = Sonic_Main;
- obj->Data1->CharID = (char)Characters_Sonic;
- obj->Data1->Action = 0;
- obj->Data1->Status &= ~(Status_Attack | Status_Ball | Status_LightDash | Status_Unknown3);
- if (!oldcol)
- {
- oldcol = obj->Data1->CollisionInfo;
- obj->Data1->CollisionInfo = nullptr;
- }
- else
- Collision_Free(obj);
- obj->MainSub(obj);
- obj2 = ((EntityData2 *)obj->Data2)->CharacterData;
- obj2->Powerups = powerups;
- obj2->JumpTime = jumptime;
- obj2->UnderwaterTime = underwatertime;
- obj2->LoopDist = loopdist;
- obj2->Speed = speed;
- obj2->ObjectHeld = heldobj;
- LoadSoundList(1);
- if (VoiceLanguage)
- LoadSoundList(72);
- else
- LoadSoundList(71);
- EntityData1Ptrs[0]->InvulnerableTime = 0;
- can_multi_punch = 0;
- do_multi_punch = false;
- //WriteData((void*)0x47A8E0, knuxobjectcrash_unNOP);
- //co2->Powerups &= ~Powerups_Invincibility;
- }
- }
- }
- //Shadow's Spindash => OK
- if (EntityData1Ptrs[0]->Action == 4)
- {
- WriteData((float*)0x496F23, (float)1.7f);
- WriteData((float*)0x7DCB34, (float)8.5f);
- WriteData((float*)0x7DD550, (float)0.34f);
- }
- else
- {
- WriteData((float*)0x496F23, (float)2.0f);
- WriteData((float*)0x7DCB34, (float)10.0f);
- WriteData((float*)0x7DD550, (float)0.4f);
- }
- //Try fixing the punching using the same 2P CPU technique !
- //FOR THE MODEL ANIMATION => try loading them all at once, and just swap from one another to avoid lag
- //Use MainMemory's PlayVoice lag fix
- ////Chaos Spear Action (no chaos boost) NEW****************************
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Amy)
- {
- if (GameState == 4)
- {
- backtoshadow2 = 0;
- can_go_back_to_shadow = false;
- chaos_spear_stop = 0;
- WriteData((void*)0x4C4DA9, enable_aiming);
- WriteData((void*)0x4C475B, enable_shooting);
- WriteData((void*)0x48152E, enable_GAMMAflashing);
- didnt_target = false;
- ready = false;
- X_was_released = 0;
- cant_chaos_spear2 = false;
- DO_chaos_spear_again = false;
- pressed_X_while_Gamma = false;
- gonna_chaos_spear_again = 0;
- }
- if ((co1->Status & Status_Ground) == Status_Ground)
- {
- DO_chaos_spear_again = false;
- }
- if (GameState == 15)
- {
- if (co2 == NULL) return;
- if (is_CB)
- {
- Gamma_LaserBlasterObtained = 1;
- }
- else Gamma_LaserBlasterObtained = 0;
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- if (cant_chaos_spear_again)
- {
- if (++can_chaos_spear_again >= 2)
- {
- cant_chaos_spear_again = false;
- can_chaos_spear_again = 0;
- }
- }
- if (pressed_X_while_Gamma)
- {
- if (++gonna_chaos_spear_again >= 2)
- {
- DO_chaos_spear_again = true;
- pressed_X_while_Gamma = false;
- gonna_chaos_spear_again = 0;
- }
- }
- if (ControllerPointers[0]->PressedButtons & Buttons_Z && !is_CB)
- {
- is_CB = true;
- }
- else if (ControllerPointers[0]->PressedButtons & Buttons_Z && is_CB)
- {
- is_CB = false;
- }
- WriteData((void*)0x48152E, enable_GAMMAflashing);
- co2->PhysicsData.AirDecel = -0.028;
- WriteData((void*)0x4C4DA9, enable_aiming);
- WriteData((void*)0x4C475B, enable_shooting);
- WriteData((void*)0x4C4643, 0x90, 4); //C6 46 01 05 - To make shooting action not go to 5, making instant shooting happen********************************************************
- WriteData((char*)0x4CEA60, (char)0xC3);//removes the red/yellow squares
- ready = false;
- if (backtoshadow2 >= 27)
- {
- if (++backtoshadow2 == 29)
- {
- EntityData1Ptrs[0]->Action = 8;
- co2->AnimationThing.Index = 119;
- co1->Status |= Status_Ball;
- backtoshadow2 = 0;
- cant_chaos_spear2 = false;
- }
- }
- if (didnt_target)
- {
- EntityData1Ptrs[0]->Action = 8;
- co2->AnimationThing.Index = 18;
- co1->Status |= Status_Ball;
- if (++backtoshadow2 == 2)
- {
- backtoshadow2 = 0;
- didnt_target = false;
- cant_chaos_spear2 = false;
- }
- }
- if ((co1->Status & Status_Ground) != Status_Ground && (co2->AnimationThing.Index == 14 || co2->AnimationThing.Index == 18 || co2->AnimationThing.Index == 116 || co2->AnimationThing.Index == 117 || co2->AnimationThing.Index == 119))
- {
- if (EntityData1Ptrs[0]->Action == 8 && !cant_chaos_spear && !cant_chaos_spear2 && !cant_chaos_spear_again) // && (co2->AnimationThing.Index == 14 || co2->AnimationThing.Index == 18)
- {
- if ((!X_is_held && ControllerPointers[0]->HeldButtons & Buttons_X) || (DO_chaos_spear_again)) // fix to have it false when onground !! and fix anyway that stuff
- {
- //turn to gamma
- // *(*((char**)&obj2->SonicSpinTimeProbably)) = 2; //it starts at 0 (init), then it goes to 1 (normal), where it checks if you're holding B, then it goes to 2 (activating laser), which goes to 3 (using laser), where it either checks if you release B, where it goes to 5 (shooting), or the timer runs out and it goes to 4 (time out) which goes to 6 (shooting after time out), and then I guess it goes back to 1
- }
- }
- }
- if (X_is_held && !(ControllerPointers[0]->HeldButtons & Buttons_X))
- {
- X_is_held = false;
- }
- else if (ControllerPointers[0]->HeldButtons & Buttons_X)
- {
- X_is_held = true;
- }
- }
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Gamma)
- {
- can_chaos_spear_again = 0;
- co2->Upgrades &= ~Upgrades_JetBooster;
- co2->PhysicsData.YOff = 5.4;
- if (X_is_held && !(ControllerPointers[0]->HeldButtons & Buttons_X))
- {
- X_is_held = false;
- }
- else if (ControllerPointers[0]->HeldButtons & Buttons_X)
- {
- X_is_held = true;
- }
- EntityData1Ptrs[0]->Action = 7;
- co2->AnimationThing.Index = 49;
- co2->PhysicsData.AirDecel = -0.128;
- co2->Speed.x = 0.0;
- co2->Speed.y = 0.1;
- co2->Speed.z = 0.0;
- if (!X_is_held && X_was_released < 2)
- {
- ++X_was_released;
- if (X_was_released > 1)
- {
- if ((*(char**)&co2->SonicSpinTimeProbably)[1] == 1)
- {
- didnt_target = true;
- }
- else
- {
- ready = true;
- can_go_back_to_shadow = true;
- didnt_target = false;
- }
- }
- }
- if (is_CB)
- {
- co2->Upgrades |= Upgrades_LaserBlaster;
- if (ready && chaos_spear_stop < 4)
- {
- if (++chaos_spear_stop == 4)
- {
- WriteData((void*)0x4C4643, shooting05_unNOP);
- WriteData((void*)0x4C475B, 0x90, 4); //to stop the shooting response
- }
- }
- }
- else
- {
- co2->Upgrades &= ~Upgrades_LaserBlaster;
- if (ready && chaos_spear_stop < 2)//****************************************
- {
- if (++chaos_spear_stop == 2)
- {
- WriteData((void*)0x4C4643, shooting05_unNOP);
- WriteData((void*)0x4C475B, 0x90, 4); //to stop the shooting response
- }
- }
- }
- if (can_go_back_to_shadow && !didnt_target)
- {
- if (backtoshadow2 > 12 && ControllerPointers[0]->PressedButtons & Buttons_X)
- {
- pressed_X_while_Gamma = true;
- }
- ++backtoshadow2;
- if (backtoshadow2 > 3 && backtoshadow2 < 24)
- {
- WriteData((void*)0x4C4DA9, 0x90, 3); //disables aiming action
- }
- if (backtoshadow2 == 24)
- {
- WriteData((float**)0x4C41CD, &missilespeed_orig);
- WriteData((float**)0x4C41DC, &missilespeed_orig);
- WriteData((float**)0x4C41E8, &missilespeed_orig);
- WriteData((void*)0x4C4DA9, enable_aiming);
- }
- if (backtoshadow2 == 25)
- {
- *(*((char**)&co2->SonicSpinTimeProbably)) = 4;
- }
- if (backtoshadow2 == 26)
- {
- WriteData((void*)0x4C4DA9, 0x90, 3); //disables aiming action
- }
- if (backtoshadow2 == 27)
- {
- //back to sonic
- }
- }
- if (didnt_target)
- {
- ++didnt_target_OK;
- }
- if (didnt_target_OK >= 2)
- {
- //back to sonic
- }
- }
- }
- }
- //******************************DO THE IF PRESSED X WHILE IN END OF CHAOS SPEAR THEN REDO CHAOS SPEAR ...???? REALLY DO I NEED IT ?
- //Chaos Spear Action
- Gamma_JetBoosterObtained = 0;
- WriteData((ObjectFuncPtr*)0x47EDC1, Gamma_Main);
- //*****Have that same CPU always there, in any level or adventure field, whenever Sonic is played as, that CPU must be here too
- WriteData((short*)0x4C4E34, (short)30000);//Gamma infinite aiming laser timer
- //*****Disable all Gamma sounds;
- //*****Disable Gamma "5,4,3,2,1 sec left" textures;
- //*****Make Gamma laser invisible;
- //WriteData((char*)0x4CEA60, (char)0xC3);//removes the red/yellow squares
- WriteData((void*)0x42667F, 0x90, 5);//Stop the timer from going up when killing enemies as gamma
- //*****Disable Gamma's timebonuses (sounds and textures);
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0 && GetCharacterObject(1) && GetCharacterID(1) == Characters_Gamma)
- {
- WriteData((void*)0x4C4643, 0x90, 4); //C6 46 01 05 - To make shooting action not go to 5, making instant shooting happen********************************************************
- WriteData((float**)0x4C41CD, &missilespeed);
- WriteData((float**)0x4C41DC, &missilespeed);
- WriteData((float**)0x4C41E8, &missilespeed);
- if (GameState == 4)
- {
- WriteData((void*)0x4C4DA9, enable_aiming);
- WriteData((void*)0x4C475B, enable_shooting);
- //*****load normal shadow model;
- go_back_to_gameplay = false;
- ((AnimData_t*)0x3C56210)[18].AnimationSpeed = 1;
- CS_launch_was_played = false;
- CS_charging_was_played = false;
- CS_empty_was_played = false;
- is_in_CS_state = false;
- X_was_released = false;
- can_go_back_to_shadow = false;
- co1CPU->Position.x = 500 + co1->Position.x;
- co1CPU->Position.y = 500 + co1->Position.y;
- co1CPU->Position.z = 500 + co1->Position.z;
- WriteData((char*)0x4977AB, (char)0x74);//Allows homing attack
- WriteData((void*)0x497013, enable_SONIC_KNUXflashing);
- EntityData1Ptrs[0]->InvulnerableTime = 0;
- has_homing_attacked = false;
- WriteData((void*)0x43CC72, gravity_orig_hovering);
- co2->PhysicsData.Gravity = 0.08;
- Gamma_JetBoosterObtained = 0;
- X_was_released_int = 0;
- ready = false;
- chaos_spear_stop = 0;
- cant_release_X = 0;
- //Gauge = 0;
- }
- if (GameState == 15)
- {
- Gamma_JetBoosterObtained = 0;
- int anims2[]{ 116, 117, 119 };
- EntityData1Ptrs[1]->InvulnerableTime = 65530;
- co2CPU->Speed.x = 0;
- co2CPU->Speed.y = 0;
- co2CPU->Speed.z = 0;
- EntityData1Ptrs[1]->Action = 7;
- co2CPU->AnimationThing.Index = 8;
- if (EntityData1Ptrs[0]->Action == 14)
- {
- has_homing_attacked = true;
- }
- if ((co1->Status & Status_Ground) == Status_Ground || co2->AnimationThing.Index == 0 || co2->AnimationThing.Index == 1 || co2->AnimationThing.Index == 2 || co2->AnimationThing.Index == 3 || co2->AnimationThing.Index == 4 || co2->AnimationThing.Index == 5 || co2->AnimationThing.Index == 6 || co2->AnimationThing.Index == 7 || co2->AnimationThing.Index == 8 || co2->AnimationThing.Index == 9 || co2->AnimationThing.Index == 10 || co2->AnimationThing.Index == 11 || co2->AnimationThing.Index == 12 || co2->AnimationThing.Index == 13 || co2->AnimationThing.Index == 14 || co2->AnimationThing.Index == 20 || co2->AnimationThing.Index == 25 || co2->AnimationThing.Index == 31 || co2->AnimationThing.Index == 71 || co2->AnimationThing.Index == 130 || co2->AnimationThing.Index == 131 || EntityData1Ptrs[0]->Action == 8 || EntityData1Ptrs[0]->Action == 6)
- {
- has_homing_attacked = false;
- }
- if ((co2->AnimationThing.Index == 14 || co2->AnimationThing.Index == 18 || co2->AnimationThing.Index == 116 || co2->AnimationThing.Index == 117 || co2->AnimationThing.Index == 119) && (EntityData1Ptrs[0]->Action != 4 && EntityData1Ptrs[0]->Action != 5 && EntityData1Ptrs[0]->Action != 14 && EntityData1Ptrs[0]->Action != 44) && !is_in_CS_state && !has_homing_attacked && (co1->Status & Status_LightDash) != Status_LightDash)
- {
- if (/*Gauge > 0 && */ControllerPointers[0]->PressedButtons & Buttons_X)
- {
- co1->Status &= ~Status_Ball;
- co1->Status &= ~Status_Attack;
- ((AnimData_t*)0x3C56210)[18].AnimationSpeed = 0;
- EntityData1Ptrs[0]->Action = 12;
- co2->AnimationThing.Index = 18;
- is_in_CS_state = true;
- WriteData((void*)0x4C4DA9, enable_aiming);
- }
- }
- if (is_in_CS_state)
- {
- EntityData1Ptrs[1]->Action = 7;
- co2CPU->AnimationThing.Index = 8;
- co1CPU->Position.x = old_X_position;
- co1CPU->Position.y = old_Y_position;
- co1CPU->Position.z = old_Z_position;
- co1CPU->Rotation.x = co1->Rotation.x;
- co1CPU->Rotation.y = co1->Rotation.y;
- co1CPU->Rotation.z = co1->Rotation.z;
- WriteData((char*)0x4977AB, (char)0xEB);//disables homing attack
- co1->Position.x = old_X_position;
- co1->Position.y = old_Y_position;
- co1->Position.z = old_Z_position;
- co2->Speed.x = 0.0;
- co2->Speed.y = 0.0;
- co2->Speed.z = 0.0;
- WriteData((void*)0x43CC72, 0x90, 6); //Allow gravity change for P1
- co2->PhysicsData.Gravity = 0.0;
- if (EntityData1Ptrs[0]->InvulnerableTime == 0)
- {
- WriteData((void*)0x497013, 0x90, 4);//disable sonic flashing when "invulnerable time"
- EntityData1Ptrs[0]->InvulnerableTime = 32760;
- }
- if (!CS_charging_was_played)
- {
- PlayVoice(1323);
- CS_charging_was_played = true;
- }
- if (!(ControllerPointers[0]->HeldButtons & Buttons_X))
- {
- X_was_released = true;
- }
- if (X_was_released)
- {
- if (X_was_released_int < 2)
- {
- ++X_was_released_int;
- if (X_was_released_int > 1)
- {
- if (thing->ShootAction == 1)
- {
- go_back_to_gameplay = true;
- }
- else
- {
- PlaySound(775, 0, 0, 0);
- CS_launch_was_played = true;
- ready = true;
- can_go_back_to_shadow = true;
- }
- }
- }
- if (CB_lv2 || CB_lv3)
- {
- co2->Upgrades |= Upgrades_LaserBlaster;
- if (LV2_active || LV3_active)
- {
- if (ready && chaos_spear_stop < 5)
- {
- if (++chaos_spear_stop == 5)
- {
- WriteData((void*)0x4C4643, shooting05_unNOP);
- WriteData((void*)0x4C475B, 0x90, 4); //to stop the shooting response
- CS_launch_was_played = false;
- }
- }
- }
- else
- {
- if (ready && chaos_spear_stop < 3)
- {
- if (++chaos_spear_stop == 3)
- {
- WriteData((void*)0x4C4643, shooting05_unNOP);
- WriteData((void*)0x4C475B, 0x90, 4); //to stop the shooting response
- CS_launch_was_played = false;
- }
- }
- }
- }
- else
- {
- co2->Upgrades &= ~Upgrades_LaserBlaster;
- if (LV2_active || LV3_active)
- {
- if (ready && chaos_spear_stop < 2)
- {
- if (++chaos_spear_stop == 2)
- {
- WriteData((void*)0x4C4643, shooting05_unNOP);
- WriteData((void*)0x4C475B, 0x90, 4); //to stop the shooting response
- CS_launch_was_played = false;
- }
- }
- }
- else
- {
- if (ready && chaos_spear_stop < 1)
- {
- if (++chaos_spear_stop == 1)
- {
- WriteData((void*)0x4C4643, shooting05_unNOP);
- WriteData((void*)0x4C475B, 0x90, 4); //to stop the shooting response
- CS_launch_was_played = false;
- }
- }
- }
- }
- if (can_go_back_to_shadow)
- {
- ++backtoshadow2;
- if (backtoshadow2 > 3 && backtoshadow2 < 16)
- {
- WriteData((void*)0x4C4DA9, 0x90, 3); //disables aiming action
- }
- if (backtoshadow2 == 16)
- {
- //WriteData((float**)0x4C41CD, &missilespeed_orig);
- //WriteData((float**)0x4C41DC, &missilespeed_orig);
- //WriteData((float**)0x4C41E8, &missilespeed_orig);
- WriteData((void*)0x4C4DA9, enable_aiming);
- }
- if (backtoshadow2 == 17)
- {
- thing->AimAction = 4;
- }
- if (backtoshadow2 == 18)
- {
- WriteData((void*)0x4C4DA9, 0x90, 3); //disables aiming action
- go_back_to_gameplay = true;
- }
- }
- if (!CS_empty_was_played)
- {
- PlayVoice(1321);
- CS_empty_was_played = true;
- }
- if (go_back_to_gameplay)
- {
- fall_after_roll = false;
- X_was_released_int = 0;
- chaos_spear_stop = 0;
- ready = false;
- can_go_back_to_shadow = false;
- backtoshadow2 = 0;
- //load normal shadow model;
- go_back_to_gameplay = false;
- ((AnimData_t*)0x3C56210)[18].AnimationSpeed = 1;
- CS_charging_was_played = false;
- CS_launch_was_played = false;
- CS_empty_was_played = false;
- is_in_CS_state = false;
- X_was_released = false;
- if (has_homing_attacked)
- {
- EntityData1Ptrs[0]->Action = 12;
- co2->AnimationThing.Index = 18;
- }
- else
- {
- EntityData1Ptrs[0]->Action = 8;
- co1->Status |= Status_Ball;
- co1->Status |= Status_Attack;
- }
- }
- }
- }
- else
- {
- cant_release_X = 0;
- if (GetCharacterObject(1) && GetCharacterID(1) == Characters_Gamma)
- {
- co1CPU->Position.x = 500 + co1->Position.x;
- co1CPU->Position.y = 500 + co1->Position.y;
- co1CPU->Position.z = 500 + co1->Position.z;
- }
- WriteData((void*)0x43CC72, gravity_orig_hovering);
- if (co2->_struct_a3.ColFlagsA & ColFlags_Water)
- {
- co2->PhysicsData.Gravity = 0.032;
- }
- else co2->PhysicsData.Gravity = 0.08;
- if (EntityData1Ptrs[0]->InvulnerableTime > 200)
- {
- WriteData((void*)0x497013, enable_SONIC_KNUXflashing);
- EntityData1Ptrs[0]->InvulnerableTime = 0;
- }
- WriteData((char*)0x4977AB, (char)0x74);//Allows Homing Attack
- old_X_position = co1->Position.x;
- old_Y_position = co1->Position.y;
- old_Z_position = co1->Position.z;
- }
- }
- }
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Knuckles)
- {
- co1CPU->Position.x = 500 + co1->Position.x;
- co1CPU->Position.y = 500 + co1->Position.y;
- co1CPU->Position.z = 500 + co1->Position.z;
- }
- ////FIX SUPER/HYPER TRANSFORMATION => They can homing attack while transforming
- //Chaos Blast Action
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- if (GameState == 4)
- {
- using_chaos_blast = false;
- chaos_blast_active_timer = 0;
- CHAOSBLAST_was_played = false;
- WriteData((void*)0x43CC72, gravity_orig_hovering);
- co2->PhysicsData.Gravity = 0.08;
- }
- if (GameState == 15)
- {
- if (CB_lv3)
- {
- if (EntityData1Ptrs[0]->Action != 16 && EntityData1Ptrs[0]->Action != 86 && EntityData1Ptrs[0]->Action != 44 && co2->AnimationThing.Index != 33 && co2->AnimationThing.Index != 34 && co2->AnimationThing.Index != 35 && co2->AnimationThing.Index != 36 && co2->AnimationThing.Index != 37 && co2->AnimationThing.Index != 38 && co2->AnimationThing.Index != 47 && co2->AnimationThing.Index != 48 && co2->AnimationThing.Index != 49 && co2->AnimationThing.Index != 50 && co2->AnimationThing.Index != 51 && co2->AnimationThing.Index != 52 && co2->AnimationThing.Index != 53 && co2->AnimationThing.Index != 54 && co2->AnimationThing.Index != 55 && co2->AnimationThing.Index != 56 && co2->AnimationThing.Index != 57 && co2->AnimationThing.Index != 58 && co2->AnimationThing.Index != 59 && co2->AnimationThing.Index != 60 && co2->AnimationThing.Index != 61 && co2->AnimationThing.Index != 62 && co2->AnimationThing.Index != 63 && co2->AnimationThing.Index != 65 && co2->AnimationThing.Index != 66 && co2->AnimationThing.Index != 67 && co2->AnimationThing.Index != 68 && co2->AnimationThing.Index != 69 && co2->AnimationThing.Index != 70 && co2->AnimationThing.Index != 71 && co2->AnimationThing.Index != 72 && co2->AnimationThing.Index != 73 && co2->AnimationThing.Index != 74 && co2->AnimationThing.Index != 75 && co2->AnimationThing.Index != 76 && co2->AnimationThing.Index != 77 && co2->AnimationThing.Index != 78 && co2->AnimationThing.Index != 79 && co2->AnimationThing.Index != 80 && co2->AnimationThing.Index != 81 && co2->AnimationThing.Index != 82 && co2->AnimationThing.Index != 89 && co2->AnimationThing.Index != 90 && co2->AnimationThing.Index != 91 && co2->AnimationThing.Index != 92 && co2->AnimationThing.Index != 93 && co2->AnimationThing.Index != 94 && co2->AnimationThing.Index != 95 && co2->AnimationThing.Index != 96 && co2->AnimationThing.Index != 97 && co2->AnimationThing.Index != 98 && co2->AnimationThing.Index != 99 && co2->AnimationThing.Index != 100 && co2->AnimationThing.Index != 101)
- {
- if (ControllerPointers[0]->PressedButtons & Buttons_Z && !using_chaos_blast)
- {
- using_chaos_blast = true;
- co2->field_A = 240;//to disable controls for 4 secs
- co2->Speed.x = 0;
- co2->Speed.y = 0;
- co2->Speed.z = 0;
- WriteData((void*)0x43CC72, 0x90, 6); //Allow gravity change for P1
- co2->PhysicsData.Gravity = 0.0;
- EntityData1Ptrs[0]->Action = 12;
- co2->AnimationThing.Index = 18;
- co1->Status &= ~Status_Ball;
- co1->Status &= ~Status_Attack;
- }
- if (using_chaos_blast)
- {
- co2->Speed.y += 0.025;
- ++chaos_blast_active_timer;
- if (chaos_blast_active_timer < 90)
- {
- co2->AnimationThing.Index = 85; //tweak the anim speed to make it look good
- if (!CHAOSBLAST_was_played)
- {
- PlayVoice(1326);
- CHAOSBLAST_was_played = true;
- }
- }
- else if (chaos_blast_active_timer < 210)
- {
- co2->AnimationThing.Index = 84; //tweak the anim speed to make it look good
- //*****spawn e-101-mk2's explosion;
- }
- else
- {
- using_chaos_blast = false;
- chaos_blast_active_timer = 0;
- CHAOSBLAST_was_played = false;
- WriteData((void*)0x43CC72, gravity_orig_hovering);
- if (co2->_struct_a3.ColFlagsA & ColFlags_Water)
- {
- co2->PhysicsData.Gravity = 0.032;
- }
- else co2->PhysicsData.Gravity = 0.08;
- EntityData1Ptrs[0]->Action = 12;
- co2->AnimationThing.Index = 18;
- }
- }
- }
- }
- }
- }
- ////FIX THE FACT THAT RESTART A LEVEL WHILE AS KNUCKLES WILL LEAVE KNUCKLES UNTIL WE REACH GAMESTATE == 15 => MAKE IT DO THAT SWAP ALSO WHEN GAMESTATE == 4
- //Chaos Boost Action ********************************************************************************************** USE DEACTIVATE CHARACTER LIGHTING INSTEAD OF MODEL EDIT
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- if (GameState == 4)
- {
- CB_lv1 = false;
- CB_lv2 = false;
- CB_lv3 = false;
- CB_active = false;
- transforming_CB = false;
- transforming_CB_time = 0;
- anim_84_was_played = 0;
- //load normal specular;
- //load normal Shadow model;
- //load normal Shadow textures;
- }
- if (GameState == 15)
- {
- if (CB_lv1 || CB_lv2 || CB_lv3) CB_active = true;
- else CB_active = false;
- if (CB_active)
- {
- //do the animated textures; //to have shadows shoes to light up
- //do the animated specular;
- }
- else anim_84_was_played = 0;
- //if (Gauge <= 0 && CB_active && !using_chaos_blast)
- //{
- // CB_lv1 = false;
- // CB_lv2 = false;
- // CB_lv3 = false;
- // //load normal specular;
- // //load normal Shadow model;
- // //load normal Shadow textures;
- //}
- if (/*Gauge >= 10000 && */!CB_active)
- {
- if (EntityData1Ptrs[0]->Action != 16 && EntityData1Ptrs[0]->Action != 86 && EntityData1Ptrs[0]->Action != 44 && co2->AnimationThing.Index != 33 && co2->AnimationThing.Index != 34 && co2->AnimationThing.Index != 35 && co2->AnimationThing.Index != 36 && co2->AnimationThing.Index != 37 && co2->AnimationThing.Index != 38 && co2->AnimationThing.Index != 47 && co2->AnimationThing.Index != 48 && co2->AnimationThing.Index != 49 && co2->AnimationThing.Index != 50 && co2->AnimationThing.Index != 51 && co2->AnimationThing.Index != 52 && co2->AnimationThing.Index != 53 && co2->AnimationThing.Index != 54 && co2->AnimationThing.Index != 55 && co2->AnimationThing.Index != 56 && co2->AnimationThing.Index != 57 && co2->AnimationThing.Index != 58 && co2->AnimationThing.Index != 59 && co2->AnimationThing.Index != 60 && co2->AnimationThing.Index != 61 && co2->AnimationThing.Index != 62 && co2->AnimationThing.Index != 63 && co2->AnimationThing.Index != 65 && co2->AnimationThing.Index != 66 && co2->AnimationThing.Index != 67 && co2->AnimationThing.Index != 68 && co2->AnimationThing.Index != 69 && co2->AnimationThing.Index != 70 && co2->AnimationThing.Index != 71 && co2->AnimationThing.Index != 72 && co2->AnimationThing.Index != 73 && co2->AnimationThing.Index != 74 && co2->AnimationThing.Index != 75 && co2->AnimationThing.Index != 76 && co2->AnimationThing.Index != 77 && co2->AnimationThing.Index != 78 && co2->AnimationThing.Index != 79 && co2->AnimationThing.Index != 80 && co2->AnimationThing.Index != 81 && co2->AnimationThing.Index != 82 && co2->AnimationThing.Index != 84 && co2->AnimationThing.Index != 85 && co2->AnimationThing.Index != 89 && co2->AnimationThing.Index != 90 && co2->AnimationThing.Index != 91 && co2->AnimationThing.Index != 92 && co2->AnimationThing.Index != 93 && co2->AnimationThing.Index != 94 && co2->AnimationThing.Index != 95 && co2->AnimationThing.Index != 96 && co2->AnimationThing.Index != 97 && co2->AnimationThing.Index != 98 && co2->AnimationThing.Index != 99 && co2->AnimationThing.Index != 100 && co2->AnimationThing.Index != 101)
- {
- if (ControllerPointers[0]->PressedButtons & Buttons_Z)
- {
- co1->Position.y += 1;
- CB_lv1 = true;
- //load CB specular;
- //load CB Shadow model;
- //load CB Shadow textures;
- transforming_CB = true;
- PlayVoice(1324);
- //Load the kiki's bomb model for transformation ? Use Sonic 06 CB sphere model ?;
- //Maybe do more, like a sprite animation around Shadow like it originally does in Sonic 06
- }
- }
- }
- if (CB_lv1 && !transforming_CB)
- {
- //if (Gauge > 0) Gauge -= 5
- if (ControllerPointers[0]->PressedButtons & Buttons_Z)
- {
- CB_lv1 = false;
- CB_lv2 = true;
- PlayVoice(1324);//supposed to be the chaos boost level up sound
- //Load the kiki's bomb model for transformation ? Use Sonic 06 CB sphere model ?
- }
- }
- else if (CB_lv2)
- {
- //if (Gauge > 0) Gauge -= 6
- //load CB_lv2 sprites / model / whatever
- if (ControllerPointers[0]->PressedButtons & Buttons_Z)
- {
- CB_lv2 = false;
- CB_lv3 = true;
- PlayVoice(1324);//supposed to be the chaos boost level up sound
- //Load the kiki's bomb model for transformation ? Use Sonic 06 CB sphere model ?
- }
- }
- else if (CB_lv3)
- {
- //if (Gauge > 0) Gauge -= 8
- //load CB_lv3 sprites / model / whatever
- //use after images ?
- //invincible - flashing ? invincible - supersonic ? lv2 = > lv3 ?
- }
- if (transforming_CB)
- {
- ++transforming_CB_time;
- EntityData1Ptrs[0]->Action = 8;
- if (++anim_84_was_played < 50)
- {
- co2->AnimationThing.Index = 84;
- }
- //X speed
- if (co2->Speed.x > 0.75)
- {
- co2->Speed.x -= 0.75;
- }
- else if (co2->Speed.x < 0.75)
- {
- co2->Speed.x += 0.75;
- }
- else co2->Speed.x = 0;
- //Y speed
- if (co2->Speed.y > 0.75)
- {
- co2->Speed.y -= 0.75;
- }
- else if (co2->Speed.y < 0.75)
- {
- co2->Speed.y += 0.75;
- }
- else co2->Speed.y += 0;
- //Z speed
- if (co2->Speed.z > 0.75)
- {
- co2->Speed.z -= 0.75;
- }
- else if (co2->Speed.z < 0.75)
- {
- co2->Speed.z += 0.75;
- }
- else co2->Speed.z = 0;
- co2->Speed.x = 0.0;
- co2->Speed.y = 0.1;
- co2->Speed.z = 0.0;
- if (EntityData1Ptrs[0]->InvulnerableTime == 0)
- {
- EntityData1Ptrs[0]->InvulnerableTime = 32760;
- WriteData((void*)0x497013, 0x90, 4);//disable sonic flashing when "invulnerable time"
- }
- if (transforming_CB_time == 65)
- {
- if (EntityData1Ptrs[0]->InvulnerableTime >= 300)
- {
- EntityData1Ptrs[0]->InvulnerableTime = 0;
- WriteData((void*)0x497013, enable_SONIC_KNUXflashing);
- }
- transforming_CB_time = 0;
- transforming_CB = false;
- }
- }
- }
- }
- //Shadow LightAttack Charge Speed Upgraded => OK
- WriteData((short*)0x495097, (short)60); //=> without upgrade => 100
- //Shadow random homing trick => OK
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- if (GameState != 16)
- {
- int anims[]{ 116, 117, 119 };
- if (EntityData1Ptrs[0]->Action == 14)
- {
- homing = true;
- co2->AnimationThing.Index = 83;
- }
- //TRICK 1
- if (co2->AnimationThing.Index == 112) co2->AnimationThing.Index = 18;
- if (co2->AnimationThing.Index == 116)
- {
- if (++ShadowTrick1Timer1 == 1)
- {
- ((AnimData_t*)0x3C56210)[116].AnimationSpeed = 1;
- }
- if (++ShadowTrick1Timer2 == 58)
- {
- ((AnimData_t*)0x3C56210)[116].AnimationSpeed = 9;
- }
- }
- else
- {
- ShadowTrick1Timer1 = 0;
- ShadowTrick1Timer2 = 0;
- ((AnimData_t*)0x3C56210)[116].AnimationSpeed = 9;
- }
- //TRICK 2
- if (co2->AnimationThing.Index == 117)
- {
- if (++ShadowTrick2Timer1 == 2)
- {
- ((AnimData_t*)0x3C56210)[117].AnimationSpeed = 1.1;
- }
- if (++ShadowTrick2Timer2 == 47)
- {
- ((AnimData_t*)0x3C56210)[117].AnimationSpeed = 9;
- }
- }
- else
- {
- ShadowTrick2Timer1 = 0;
- ShadowTrick2Timer2 = 0;
- ((AnimData_t*)0x3C56210)[117].AnimationSpeed = 9;
- }
- //TRICK 3
- if (co2->AnimationThing.Index == 119)
- {
- if (++ShadowTrick3Timer1 == 2)
- {
- ((AnimData_t*)0x3C56210)[119].AnimationSpeed = 1.21;
- }
- if (++ShadowTrick3Timer2 == 54)
- {
- ((AnimData_t*)0x3C56210)[119].AnimationSpeed = 11;
- }
- }
- else
- {
- ShadowTrick3Timer1 = 0;
- ShadowTrick3Timer2 = 0;
- ((AnimData_t*)0x3C56210)[119].AnimationSpeed = 11;
- }
- if (homing && (co1->Status & Status_Ground) != Status_Ground) in_air_after_homing = true;
- if (homing && ((co1->Status & Status_Ground) == Status_Ground || co2->AnimationThing.Index == 0 || co2->AnimationThing.Index == 1 || co2->AnimationThing.Index == 2 || co2->AnimationThing.Index == 9 || co2->AnimationThing.Index == 10 || co2->AnimationThing.Index == 11 || co2->AnimationThing.Index == 12 || co2->AnimationThing.Index == 13 || co2->AnimationThing.Index == 31)) in_air_after_homing = false;
- if (!in_air_after_homing) homing = false;
- if (in_air_after_homing && EntityData1Ptrs[0]->Action == 8)
- {
- WriteData((void*)0x494AF9, 0x90, 5);
- co2->AnimationThing.Index = anims[rand() % 3];
- homing = false;
- in_air_after_homing = false;
- }
- if (!auraobj && ((co1->Status & Status_Ground) == Status_Ground || homing)) WriteData((void*)0x494AF9, balldata);
- }
- }
- //No jumpball when jumping => OK
- if (r && (co1->Status & Status_Ground) != Status_Ground) fall_after_roll = true;
- if (ControllerPointers[0]->PressedButtons & Buttons_A) fall_after_roll = false;
- if ((co1->Status & Status_Ground) == Status_Ground && EntityData1Ptrs[0]->Action == 5) fall_after_roll = true;
- if ((co1->Status & Status_Ground) == Status_Ground && EntityData1Ptrs[0]->Action == 2) fall_after_roll = false;
- if (co2 == NULL) return;
- if (GetCharacterObject(0) && (EntityData1Ptrs[0]->Action != 4 || EntityData1Ptrs[0]->Action != 5 || EntityData1Ptrs[0]->Action != 14 || EntityData1Ptrs[0]->Action != 44)) WriteData((void*)0x494AF9, 0x90, 5);
- if (GetCharacterObject(0) && (EntityData1Ptrs[0]->Action == 4 || EntityData1Ptrs[0]->Action == 5 || fall_after_roll || EntityData1Ptrs[0]->Action == 14 || EntityData1Ptrs[0]->Action == 44)) WriteData((void*)0x494AF9, balldata);
- // Dash anim in air => OK
- if (co2 == NULL) return;
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- if (EntityData1Ptrs[0]->Action == 12 && co2->Speed.x >= 5) dashing = true;
- if (EntityData1Ptrs[0]->Action != 12 || co2->Speed.x <= 4) dashing = false;
- if (dashing)
- {
- co2->AnimationThing.Index = 64;
- WriteData((short*)0x00494FDC, (short)64);
- WriteData((short*)0x00497CC0, (short)64);
- }
- if (co2->AnimationThing.Index == 17 || co2->AnimationThing.Index == 26 || co2->AnimationThing.Index == 40 || co2->AnimationThing.Index == 42) was_on_trampoline = true;
- if (!was_on_trampoline && EntityData1Ptrs[0]->Action == 12 && co2->Speed.x <= 4) no_longer_dashing = true;
- if (EntityData1Ptrs[0]->Action != 12 || co2->Speed.x >= 4 || was_on_trampoline) no_longer_dashing = false;
- if (co2->AnimationThing.Index != 17 || co2->AnimationThing.Index != 26 || co2->AnimationThing.Index != 40 || co2->AnimationThing.Index != 42) was_on_trampoline = false;
- if (no_longer_dashing)
- {
- co2->AnimationThing.Index = 18;
- WriteData((short*)0x494FDC, (short)18);
- WriteData((short*)0x497CC0, (short)18);
- }
- }
- //Play GO! when doing Light Attack
- if (co2 == NULL) return;
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- if (EntityData1Ptrs[0]->Action == 44)
- {
- if (!GO_sound_played)
- {
- PlaySound(1228, 0, 0, 0);
- GO_sound_played = true;
- }
- }
- else GO_sound_played = false;
- }
- //No LightDash when charged up
- if (EntityData1Ptrs[0]->Action == 4)
- {
- WriteData((void*)0x493047, 0x90, 3);
- }
- else if (!(co1->Status & Status_LightDash))
- {
- WriteData((void*)0x493047, LightDash_unNOP);
- }
- //if you want to stop the "Go" sound, at 49AEE7 change 75 to EB
- WriteData((char*)0x49309C, (char)0xEB);
- //Fix lightdash/lightattack sound
- if ((co1->Status & Status_LightDash) == Status_LightDash || ControllerPointers[0]->PressedButtons & Buttons_Right)
- {
- WriteData((void*)0x49308D, 0x90, 5);
- }
- else WriteData((void*)0x49308D, LSA_sound);
- //LightDash with Y final
- if (GameState == 15 && co2->AnimationThing.Index != 32 && !is_in_CS_state)
- {
- double SpeedXY2 = sqrt(pow(co2->Speed.x, 2) + pow(co2->Speed.y, 2) + pow(co2->Speed.z, 2));
- WriteData((short*)0x49305C, (short)0);
- WriteData((void*)0x493067, 0x90, 7);
- WriteData((void*)0x492CAE, 0x90, 6);
- WriteData((void*)0x4975AC, 0x90, 9); //this line disables the code that sets the animation
- WriteData((float**)0x0055E739, &LightDash_SuperDash);
- if (!ok)
- {
- WriteData((void*)0x49AF36, 0x90, 5);
- WriteData((void*)0x49304C, 0x90, 9);
- }
- if (co2 == NULL) return;
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- if (ControllerPointers[0]->PressedButtons & Buttons_Y && (EntityData1Ptrs[0]->Action == 0 || EntityData1Ptrs[0]->Action == 1 || EntityData1Ptrs[0]->Action == 2 || EntityData1Ptrs[0]->Action == 8 || EntityData1Ptrs[0]->Action == 12))
- {
- WriteData((char*)0x4975A2, co1->Action);
- //WriteData((short*)0x4975B3, co2->AnimationThing.Index);
- co1->Status |= Status_LightDash;
- }
- if (EntityData1Ptrs[0]->Action == 6 && SpeedXY2 > 7.9999 && SpeedXY2 < 8.0001)
- {
- LightDash_SuperDash_ON = true;
- WriteData((void*)0x49AF36, LightDashTrail_unNOP);
- co2->AnimationThing.Index = 64;
- ok = true;
- WriteData((void*)0x4975BC, LD_forced_out_speed);
- NOP_forced_out_speed = 0;
- }
- else
- {
- ok = false;
- LightDash_SuperDash_ON = false;
- if (++NOP_forced_out_speed == 10)
- {
- WriteData((void*)0x4975BC, 0x90, 7); //nop the forced out speed
- }
- }
- }
- if (ok)
- {
- WriteData((char*)0x4975A2, (char)12);
- //WriteData((short*)0x4975B3, (short)20);
- }
- if (LightDash_SuperDash_ON)
- {
- if (!auraobj) auraobj = LoadObject(LoadObj_Data1, 2, Sonic_SuperAura_Load);
- }
- //if (auraobj && EntityData1Ptrs[0]->Action != 6 && EntityData1Ptrs[0]->Action != 14 && EntityData1Ptrs[0]->Action != 44 && (*(float**)0x55E6FA != &Boost_SuperTornado) && !(co2->gap5C[0] & 2))
- //{
- // DeleteObject_(auraobj);
- // auraobj = nullptr;
- //}
- if (EntityData1Ptrs[0]->Action == 6 && SpeedXY2 > 7.9999 && SpeedXY2 < 8.0001)
- {
- LD_fix = true;
- }
- else if (LD_fix)
- {
- LD_fix = false;
- DeleteObject_(auraobj);
- auraobj = nullptr;
- DeleteObject_(trailobj);
- trailobj = nullptr;
- }
- }
- //HangTime like Heroes
- if (co2 == NULL) return;
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- PhysicsArray[Characters_Sonic].HangTime = 60000;
- if (EntityData1Ptrs[0]->Action == 8)
- {
- if (ControllerPointers[0]->HeldButtons & Buttons_A)
- {
- if (++HangTimeLikeHeroes == 60)
- {
- WriteData((void*)0x43BFCB, 0x90, 6);
- }
- else if (EnemyBonus - OldEnemyBonus > 0 || co2->AnimationThing.Index == 40 || co2->AnimationThing.Index == 42)
- {
- WriteData((void*)0x43BFCB, HangTimeCheckData);
- OldEnemyBonus = EnemyBonus;
- }
- }
- }
- else if ((co1->Status & Status_Ground) == Status_Ground || co2->AnimationThing.Index == 0 || co2->AnimationThing.Index == 1 || co2->AnimationThing.Index == 2 || co2->AnimationThing.Index == 9 || co2->AnimationThing.Index == 10 || co2->AnimationThing.Index == 11 || co2->AnimationThing.Index == 12 || co2->AnimationThing.Index == 13 || co2->AnimationThing.Index == 18 || co2->AnimationThing.Index == 31 || EntityData1Ptrs[0]->Action != 8)
- {
- WriteData((void*)0x43BFCB, HangTimeCheckData);
- HangTimeLikeHeroes = 0;
- }
- }
- //LightAttack like SA2
- if (co2 == NULL) return;
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- if (EntityData1Ptrs[0]->Action == 44)
- {
- if ((*(float**)0x492A3B == &LightAttackStatic) && (*(float**)0x492A4F == &LightAttackStatic) && (*(float**)0x492A6A == &LightAttackStatic))
- {
- WriteData((float**)0x492A3B, &LightAttackMoving);
- WriteData((float**)0x492A4F, &LightAttackMoving);
- WriteData((float**)0x492A6A, &LightAttackMoving);
- }
- if (++LightAttackTimer == 10)
- {
- WriteData((float**)0x492A3B, &LightAttackStatic);
- WriteData((float**)0x492A4F, &LightAttackStatic);
- WriteData((float**)0x492A6A, &LightAttackStatic);
- LightAttackTimer = 0;
- }
- }
- else LightAttackTimer = 0;
- }
- //Spindash like SA2
- WriteData((char*)0x496EF6, (char)0xEB);
- if (GameState == 15)
- {
- if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- if (((co2->AnimationThing.Index == 0 || co2->AnimationThing.Index == 1 || co2->AnimationThing.Index == 2 || co2->AnimationThing.Index == 3 || co2->AnimationThing.Index == 4 || co2->AnimationThing.Index == 5 || co2->AnimationThing.Index == 6 || co2->AnimationThing.Index == 7 || co2->AnimationThing.Index == 8 || co2->AnimationThing.Index == 9 || co2->AnimationThing.Index == 10 || co2->AnimationThing.Index == 11 || co2->AnimationThing.Index == 12 || co2->AnimationThing.Index == 13 || co2->AnimationThing.Index == 14 || co2->AnimationThing.Index == 20 || co2->AnimationThing.Index == 25 || co2->AnimationThing.Index == 31 || co2->AnimationThing.Index == 44 || co2->AnimationThing.Index == 45 || co2->AnimationThing.Index == 71 || co2->AnimationThing.Index == 130 || co2->AnimationThing.Index == 131)))
- {
- if (ControllerPointers[0]->HeldButtons & Buttons_X && (co1->Status & Status_LightDash) != Status_LightDash && EntityData1Ptrs[0]->Action != 8 && !cant_spindash)
- {
- if (++SpindashNOPingTimer >= 22)
- {
- WriteData((char*)0x496EF6, (char)0x74);
- EntityData1Ptrs[0]->Action = 4;
- co2->AnimationThing.Index = 14;
- co1->Status |= Status_Ball;
- }
- if (SpindashNOPingTimer == 22)
- {
- PlaySound(770, 0, 0, 0); //I have to fix the sound when no Light Speed Shoes
- co2->SonicSpinTimer = 0;
- }
- }
- }
- if (EntityData1Ptrs[0]->Action == 8)
- {
- SpindashNOPingTimer = 0;
- punchattack = 0;
- cant_spindash = true;
- }
- if (!(ControllerPointers[0]->HeldButtons & Buttons_X))
- {
- SpindashNOPingTimer = 0;
- punchattack = 0;
- cant_spindash = false;
- }
- }
- }
- //Homing Attack like Sonic 2006
- if (EntityData1Ptrs[0]->Action == 14)
- {
- just_homing_attacked = true;
- }
- if (just_homing_attacked)
- {
- ++homing_reattack_timer;
- WriteData((char*)0x4977AB, (char)0xEB);
- }
- if (is_CB)
- {
- if (homing_reattack_timer == 12)
- {
- WriteData((char*)0x4977AB, (char)0x74);
- homing_reattack_timer = 0;
- just_homing_attacked = false;
- }
- }
- else
- {
- if (homing_reattack_timer == 18)
- {
- WriteData((char*)0x4977AB, (char)0x74);
- homing_reattack_timer = 0;
- just_homing_attacked = false;
- }
- }
- //Super Sonic/Shadow anybody LightAttack*************************************************
- //LightAttack edits for Super forms
- //WriteData((float**)0x492A3B, &LightAttackMoving);
- //WriteData((float**)0x492A4F, &LightAttackMoving);
- //WriteData((float**)0x492A6A, &LightAttackMoving);
- //if (co2 == NULL) return;
- //if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- //{
- // WriteData((float*)0x492FEB, (float)0.0f);
- // if (EntityData1Ptrs[0]->Action == 44)
- // {
- // if ((*(float**)0x492A3B == &LightAttackStatic) && (*(float**)0x492A4F == &LightAttackStatic) && (*(float**)0x492A6A == &LightAttackStatic))
- // {
- // WriteData((float**)0x492A3B, &SuperLightAttackMoving);
- // WriteData((float**)0x492A4F, &SuperLightAttackMoving);
- // WriteData((float**)0x492A6A, &SuperLightAttackMoving);
- // }
- // if ((++LightAttackTimer == 1) || EnemyBonus - OldEnemyBonus > 0)
- // {
- // WriteData((float**)0x492A3B, &LightAttackStatic);
- // WriteData((float**)0x492A4F, &LightAttackStatic);
- // WriteData((float**)0x492A6A, &LightAttackStatic);
- // }
- // }
- // else LightAttackTimer = 0;
- // OldEnemyBonus = EnemyBonus;
- //}
- //******* IMPORTANT *********
- // https://github.com/sonicretro/sadx-mod-loader/blob/master/data/Codes.lst#L239-L240
- //Shadow's NORMAL homing attack **** useless now
- //WriteData((void*)0x49234D, 0x90, 3);
- //497013 - 66 89 45 06
- //////////////////////////Chaos Boost Homing attack V2 *** fix the homing attack speed caused by Supersonic flag*******also fix the fact that pressing X while doing it in Chaos Boost doesn't let you leave it to jumping
- ////////////////////////if (co2 == NULL) return;
- ////////////////////////if (GameState == 4)
- ////////////////////////{
- //////////////////////// stop_supersonic = 0;
- //////////////////////// EntityData1Ptrs[0]->InvulnerableTime = 0;
- //////////////////////// WriteData((void*)0x497013, enable_SONIC_KNUXflashing);
- ////////////////////////}
- ////////////////////////if (is_CB)
- ////////////////////////{
- //////////////////////// //if ((co1->Status & Status_Ground) == Status_Ground)
- //////////////////////// //{
- //////////////////////// //if (stop_supersonic < 30)
- //////////////////////// //{
- //////////////////////// // EntityData1Ptrs[0]->InvulnerableTime = 0;
- //////////////////////// // stop_supersonic = 0;
- //////////////////////// //}
- //////////////////////// //if (stop_supersonic > 0)
- //////////////////////// //{
- //////////////////////// // if (++stop_supersonic == 15)
- //////////////////////// // {
- //////////////////////// // EntityData1Ptrs[0]->InvulnerableTime = 0;
- //////////////////////// // WriteData((void*)0x497013, enable_SONIC_KNUXflashing);
- //////////////////////// // co2->Upgrades &= ~Upgrades_SuperSonic;
- //////////////////////// // stop_supersonic = 0;
- //////////////////////// // }
- //////////////////////// //}
- //////////////////////// //WriteData((void*)0x497013, enable_SONIC_KNUXflashing);
- //////////////////////// //co2->Upgrades &= ~Upgrades_SuperSonic;
- //////////////////////// //}
- //////////////////////// if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- //////////////////////// {
- //////////////////////// WriteData((void*)0x494C19, supersonic_homingspeed);
- //////////////////////// WriteData((float**)0x0049265F, &ChaosBoostLv1);//5.0
- //////////////////////// WriteData((void*)0x494C56, jumpdashspeed1);//5.0
- //////////////////////// WriteData((void*)0x494C2C, jumpdashspeed2);//5.0
- //////////////////////// WriteData((void*)0x497CB5, 0x90, 4);//C6 45 00 0C
- //////////////////////// WriteData((short*)0x497CC0, (short)83);//18
- //////////////////////// WriteData((void*)0x497CC2, 0x90, 4);//80 65 05 FA
- //////////////////////// WriteData((void*)0x49234D, 0x90, 3);//D9 5F 38 (I think it removes the homing out speed)
- //////////////////////// if (GameState == 15)
- //////////////////////// {
- //////////////////////// if (EntityData1Ptrs[0]->Action == 14)
- //////////////////////// {
- //////////////////////// stop_supersonic = 1;
- //////////////////////// co2->Upgrades |= Upgrades_SuperSonic;
- //////////////////////// EntityData1Ptrs[0]->InvulnerableTime = 60000;
- //////////////////////// WriteData((void*)0x497013, 0x90, 4);//disable sonic flashing when "invulnerable time"
- //////////////////////// if ((*(float**)0x492A3B == &CBHomingAttackStatic) && (*(float**)0x492A4F == &CBHomingAttackStatic) && (*(float**)0x492A6A == &CBHomingAttackStatic))
- //////////////////////// {
- //////////////////////// WriteData((float**)0x492A3B, &CBHomingAttackMoving);
- //////////////////////// WriteData((float**)0x492A4F, &CBHomingAttackMoving);
- //////////////////////// WriteData((float**)0x492A6A, &CBHomingAttackMoving);
- //////////////////////// }
- //////////////////////// if ((++CBHomingAttackTimer == 1) || EnemyBonus - OldEnemyBonus > 0)
- //////////////////////// {
- //////////////////////// WriteData((float**)0x492A3B, &CBHomingAttackStatic);
- //////////////////////// WriteData((float**)0x492A4F, &CBHomingAttackStatic);
- //////////////////////// WriteData((float**)0x492A6A, &CBHomingAttackStatic);
- //////////////////////// }
- //////////////////////// }
- //////////////////////// else
- //////////////////////// {
- //////////////////////// if (stop_supersonic > 0)
- //////////////////////// {
- //////////////////////// if (++stop_supersonic == 20)
- //////////////////////// {
- //////////////////////// EntityData1Ptrs[0]->InvulnerableTime = 0;
- //////////////////////// WriteData((void*)0x497013, enable_SONIC_KNUXflashing);
- //////////////////////// co2->Upgrades &= ~Upgrades_SuperSonic;
- //////////////////////// stop_supersonic = 0;
- //////////////////////// }
- //////////////////////// }
- //////////////////////// CBHomingAttackTimer = 0;
- //////////////////////// }
- //////////////////////// OldEnemyBonus = EnemyBonus;
- //////////////////////// }
- //////////////////////// }
- ////////////////////////}
- ////////////////////////else
- ////////////////////////{
- //////////////////////// if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- //////////////////////// {
- //////////////////////// WriteData((float**)0x0049265F, &UN_ChaosBoostLv1);//5.0
- //////////////////////// WriteData((void*)0x494C56, jumpdashspeed1_orig);//5.0
- //////////////////////// WriteData((void*)0x494C2C, jumpdashspeed2_orig);//5.0
- //////////////////////// WriteData((void*)0x497CB5, CB_LV1_stuff1);//C6 45 00 0C
- //////////////////////// //WriteData((short*)0x497CC0, (short)18);//18
- //////////////////////// WriteData((void*)0x497CC2, CB_LV1_stuff2);//80 65 05 FA
- //////////////////////// WriteData((void*)0x49234D, 0x90, 3);//D9 5F 38 (I think it removes the homing out speed)
- //////////////////////// if (stop_supersonic != 0)
- //////////////////////// {
- //////////////////////// EntityData1Ptrs[0]->InvulnerableTime = 0;
- //////////////////////// }
- //////////////////////// WriteData((void*)0x497013, enable_SONIC_KNUXflashing);
- //////////////////////// co2->Upgrades &= ~Upgrades_SuperSonic;
- //////////////////////// stop_supersonic = 0;
- //////////////////////// }
- ////////////////////////}
- // **********************************************************************************************change trail's color to red-ish when chaosboost active
- //Chaos Boost Lvl 3 => Chaos Blast (use DROWNING as CHARGE ANIMATION and BUBBLE BREATHING as RELEASE ANIMATION (no certainly shadow actually, to not use the character switch again) <-- (or maybe Knuckles's jumping while carrying stuff animation ? 38->19->18(reversed)->17)
- //Use bomb item box to kill everyone ?
- //IDEA : USE THE AFTERIMAGES FOR CHAOS BOOST => SHOULD I USE IT FOR EVERY LEVELS ?
- //MAX SPEED = 4.25
- //MAX ACCEL = -0.425
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement