Advertisement
Benji23245

Untitled

Jun 12th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.43 KB | None | 0 0
  1. // Basics-Sonic.cpp : Defines the exported functions for the DLL application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "SADXModLoader.h"
  6. #include <cstdlib>
  7. #include <vector>
  8. #include <math.h>
  9. //#include "LandTableInfo.h"
  10. #include "Models_Header.h"
  11. #include "functions.h"
  12.  
  13. PVMEntry SonicTextures[] = {
  14. { "SON_SONIC", (TexList *)0x91CB58 },
  15. { "SON_SON_EFF", (TexList *)0x927CB8 },
  16. { "KNU_EFF", (TexList *)0x91BD28 },
  17. { "SON_AMY_EFF", (TexList *)0x91C808 },
  18. { "SON_SUPERSONIC", (NJS_TEXLIST*)0x142272C },
  19. { 0 }
  20. };
  21.  
  22. //DataPointer(char, Sonic_LightSpeedShoesObtained, 0x3B18895);
  23. //DataPointer(char, Sonic_CrystalRingObtained, 0x3B18896);
  24. //DataPointer(char, Sonic_AncientLightObtained, 0x3B188A7);
  25. //DataPointer(int, CurrentMusic, 0x0912698);
  26. //DataPointer(int, YGravity, 0x3B0F0FC);
  27.  
  28. using std::vector;
  29.  
  30. vector<NJS_MATERIAL *> materials;
  31.  
  32. //To animate Super Sonic textures
  33. void processobject(NJS_OBJECT *obj)
  34. {
  35. do
  36. {
  37. if (obj->basicdxmodel)
  38. {
  39. NJS_MODEL_SADX *mdl = obj->basicdxmodel;
  40. for (int i = 0; i < mdl->nbMat; i++)
  41. if (mdl->mats[i].attr_texId == 29)
  42. materials.push_back(&mdl->mats[i]);
  43. }
  44. if (obj->child)
  45. processobject(obj->child);
  46. obj = obj->sibling;
  47. } while (obj);
  48. }
  49.  
  50.  
  51. using std::vector;
  52.  
  53. vector<NJS_MATERIAL *> materials2;
  54.  
  55. //To animate Hyper Sonic textures
  56. void processobject2(NJS_OBJECT *obj)
  57. {
  58. do
  59. {
  60. if (obj->basicdxmodel)
  61. {
  62. NJS_MODEL_SADX *mdl = obj->basicdxmodel;
  63. for (int i = 0; i < mdl->nbMat; i++)
  64. if (mdl->mats[i].attr_texId == 95)
  65. materials2.push_back(&mdl->mats[i]);
  66. }
  67. if (obj->child)
  68. processobject2(obj->child);
  69. obj = obj->sibling;
  70. } while (obj);
  71. }
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79. ////////////Timer bonus points
  80. //////////float __cdecl GetTimeBonus_r()
  81. //////////{
  82. ////////// double result; // st7@3
  83. //////////
  84. ////////// if (GetCurrentCharacterID() == Characters_Gamma)
  85. ////////// {
  86. ////////// if (TimeMinutes < 3)
  87. ////////// {
  88. ////////// return (double)(TimeSeconds + 60 * TimeMinutes) * 25.0;
  89. ////////// }
  90. ////////// return 5000.0;
  91. ////////// }
  92. ////////// if (!TimeMinutes)
  93. ////////// {
  94. ////////// return 10000.0;
  95. ////////// }
  96. ////////// result = 10000.0 - (double)(TimeSeconds + 60 * (TimeMinutes - 1)) * 20.0;
  97. ////////// if (result < 0.0)
  98. ////////// {
  99. ////////// result = 0.0;
  100. ////////// }
  101. ////////// return result;
  102. //////////}
  103.  
  104.  
  105. ////////////Stuff to hover on EC act1's water
  106. //////////static int __stdcall SuperWaterCheck_C(EntityData1* data1, CharObj2* data2)
  107. //////////{
  108. ////////// auto pad = ControllerPointers[data1->CharIndex];
  109. //////////
  110. ////////// if (data1->CharID == Characters_Sonic)
  111. ////////// {
  112. ////////// return pad && !(pad->HeldButtons & AttackButtons);
  113. ////////// }
  114. //////////
  115. ////////// return false;
  116. //////////}
  117. //////////static const void* surface_solid = (void*)0x004496E7;
  118. //////////static const void* surface_water = (void*)0x004497B6;
  119. //////////static void __declspec(naked) SuperWaterCheck()
  120. //////////{
  121. ////////// __asm
  122. ////////// {
  123. ////////// // If Gamma, treat surface as solid
  124. ////////// jnz not_gamma
  125. ////////// jmp surface_solid
  126. //////////
  127. ////////// not_gamma :
  128. ////////// // Save whatever's in EAX
  129. ////////// push eax
  130. //////////
  131. ////////// push[esp + 6A8h + 4h + 0Ch] // CharObj2
  132. ////////// push ebx // EntityData1
  133. ////////// call SuperWaterCheck_C
  134. //////////
  135. ////////// test eax, eax
  136. //////////
  137. ////////// jnz is_true
  138. //////////
  139. ////////// // Restore EAX
  140. ////////// pop eax
  141. //////////
  142. ////////// jmp surface_water
  143. //////////
  144. ////////// is_true :
  145. ////////// // Restore EAX
  146. ////////// pop eax
  147. ////////// jmp surface_solid
  148. ////////// }
  149. //////////}
  150.  
  151.  
  152. //WriteData((void*)0x4A1413, TrailData); Re-set the trail data (appear/disappear)
  153.  
  154. //OnFrame variables
  155. bool air_boost_used = false;
  156. bool stomp_was_used = false;
  157. bool bouncing = false;
  158. bool stomp_was_used_twice = false;
  159. bool can_use_twice = false;
  160. bool B_or_X_pressed = false;
  161. bool bounce_attacking = false;
  162. bool lightdashflag = false;
  163. bool NoBoost_OnWater = false;
  164. bool is_super = false;
  165. bool is_hyper = false;
  166. bool transforming = false;
  167. bool just_transformed = false;
  168. bool is_boosting = false;
  169. bool is_flying = false;
  170. bool up_was_pressed = false;
  171. bool down_was_pressed = false;
  172. bool spincharging = false;
  173. bool no_LSA_sound = false;
  174. bool lightattacking = false;
  175. bool stop_flying = false;
  176. bool LSA_charged = false;
  177. bool no_boost_aura = false;
  178.  
  179.  
  180. char LightDashSpeedOUT_unNOP[] = { 0xC7, 0x47, 0x38, 0, 0, 0, 0 };
  181. char StompAnim[] = { 0x66, 0xC7, 0x87, 0x24, 0x01, 0, 0, 0x40, 0 };
  182. char HomingSpeed_Data[] = { 0xD9, 0x5F, 0x38 };
  183. char oldaction;
  184. char oldmusic;
  185. char invinsize[] = { 0xC7, 0x46, 0x2C, 0x9A, 0x99, 0x99, 0x3F, 0x90, 0x90 };
  186. char jumpdashspeed1_hyper[] = { 0xC7, 0x47, 0x38, 0, 0, 0xE4, 0x40 };
  187. char jumpdashspeed1_super[] = { 0xC7, 0x47, 0x38, 0, 0, 0xD0, 0x40 };
  188. char jumpdashspeed2_hyper[] = { 0xC7, 0x47, 0x38, 0, 0, 0xE4, 0x40 };
  189. char jumpdashspeed2_super[] = { 0xC7, 0x47, 0x38, 0, 0, 0xD0, 0x40 };
  190. char SonicLSAcharged_RunSpeed[] = { 0xC7, 0x86, 0xAC, 0, 0, 0, 0, 0, 0x40, 0x40 }; //original 0000003F
  191. char SuperLSAcharged_RunSpeed[] = { 0xC7, 0x86, 0xAC, 0, 0, 0, 0, 0, 0xC0, 0x40 };
  192. char alpha = 0;
  193.  
  194.  
  195. ObjectMaster *hypersparkles = nullptr;
  196.  
  197. float SuperDash = 0.0f;
  198. float SuperTornado = 16.0f;
  199. float HyperLightAttackMoving = 16.0f;
  200. float ringdist = 100.0f;
  201. float ringmaxspeed = 16.0f;
  202. float LDringmaxspeed = 0.0f;
  203. float ringaccel = 0.052f;
  204. float ringspeedmultiplier = 1.0f;
  205. float average[2160000]{};//speedometer ************************ TO PUT IN SONIC+MISCELLANEOUS SINCE IT'S COMMON TO EVERYONE
  206. float dist = 0;
  207. float invinmult = 0.9;
  208. float SuperHomingSpeed = 6.0f;
  209. float HyperHomingSpeed = 7.0f;
  210. float mult = 5;
  211. float Testtt = 0.0f;
  212.  
  213. float S_GA_NO_B_NO_SS = 0.05f;
  214. float S_GA_NO_B_SS = 0.1f;
  215. float S_GA_B1_NO_SS = 0.225f;
  216. float S_GA_B2_NO_SS = 0.15f;
  217. float S_GA_B1_SS = 0.45f;
  218. float S_GA_B2_SS = 0.225f;
  219.  
  220. float SS_GA_NO_B_NO_SS = 0.085f;
  221. float SS_GA_NO_B_SS = 0.125f;
  222. float SS_GA_B1_NO_SS = 0.4f;
  223. float SS_GA_B2_NO_SS = 0.2f;
  224. float SS_GA_B1_SS = 0.6f;
  225. float SS_GA_B2_SS = 0.3f;
  226.  
  227. float HS_GA_NO_B_NO_SS = 0.11f;
  228. float HS_GA_NO_B_SS = 0.15f;
  229. float HS_GA_B1_NO_SS = 0.5f;
  230. float HS_GA_B2_NO_SS = 0.25f;
  231. float HS_GA_B1_SS = 0.75f;
  232. float HS_GA_B2_SS = 0.375f;
  233.  
  234. float S_MA_NO_B_NO_SS = 6.0f;
  235. float S_MA_NO_B_SS = 9.0f;
  236. float S_MA_B_NO_SS = 7.0f;
  237. float S_MA_B_SS = 10.5f;
  238.  
  239. float SS_MA_NO_B_NO_SS = 8.5f;
  240. float SS_MA_NO_B_SS = 12.75f;
  241. float SS_MA_B_NO_SS = 10.25f;
  242. float SS_MA_B_SS = 15.375f;
  243.  
  244. float HS_MA_NO_B_NO_SS = 10.5f;
  245. float HS_MA_NO_B_SS = 15.75f;
  246. float HS_MA_B_NO_SS = 13.5f;
  247. float HS_MA_B_SS = 20.25f;
  248.  
  249. float sonic_accel = 0.0f;
  250.  
  251. float GD_NO_B = -0.06f;
  252. float S_GD_B = 0.098f;
  253. float SS_GD_B = 0.143f;
  254. float HS_GD_B = 0.193f;
  255.  
  256.  
  257. int BoostSFX[]{ 780, 781 };
  258. int BoostVoices[]{ 770, 773, 776 };
  259. int FOV = 70;
  260. int SonicTrick3Timer1 = 0;
  261. int SonicTrick3Timer2 = 0;
  262. int BoostVarGrd = 0;
  263. int BoostVarAir = 0;
  264. int stompvar = 0;
  265. int stompvar2 = 0;
  266. int bouncevar = 0;
  267. int boostvoice = 0;
  268. int animation = 0;
  269. int average_index = 0;//speedometer
  270. int current_length = 0;
  271. int transforming_time = 0;
  272. int transform_anim = 0;
  273. int firstanim_speedup = 0;
  274. int untransforming = 0;
  275. int SUPERSpinballtextures[] = { 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92 };
  276. int HYPERSpinballtextures[] = { 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158 };
  277. int testvar = 0;
  278. int super_rings_depletion = 0;
  279. int hyper_rings_depletion = 0;
  280. int testvar3 = 0;
  281. int LSA_var = 0;
  282. int fly_then_ground = 0;
  283. int flying_to_NOTflying = 0;
  284.  
  285. short oldanim;
  286. //short values[] = { 20, 20, 20, 20, 20, 20 };
  287.  
  288. ObjectFunc(sub_485B00, 0x485B00);//Hammer impact object
  289.  
  290.  
  291.  
  292.  
  293. //Make SADX Super Sonic use Sonic's model
  294. HMODULE hmodule = GetModuleHandle(L"CHRMODELS_orig");
  295. NJS_ACTION **___SONIC_ACTIONS = (NJS_ACTION **)GetProcAddress(hmodule, "___SONIC_ACTIONS");
  296.  
  297. //Original __SONIC_ACTIONS[]
  298. NJS_MOTION *sonicaction1motion;
  299. NJS_MOTION *sonicaction2motion;
  300. NJS_MOTION *sonicaction3motion;
  301. NJS_MOTION *sonicaction4motion;
  302. NJS_MOTION *sonicaction5motion;
  303. NJS_MOTION *sonicaction6motion;
  304. NJS_MOTION *sonicaction18motion;
  305. NJS_MOTION *sonicaction120motion;
  306. NJS_MOTION *sonicaction121motion;
  307. NJS_MOTION *sonicaction122motion;
  308. NJS_MOTION *sonicaction123motion;
  309.  
  310.  
  311.  
  312. ///////////////////////////////////////////////////////////////////////// INIT FUNCTION ///////////////////////////////////////////////////////////////////////////////////////
  313.  
  314.  
  315. void Sonic_Init()
  316. {
  317.  
  318. //Animated texture stuff
  319. HMODULE hmodule = GetModuleHandle(L"CHRMODELS_orig");
  320. NJS_OBJECT **___SONIC_OBJECTS = (NJS_OBJECT **)GetProcAddress(hmodule, "___SONIC_OBJECTS");
  321. processobject(&object_010056AF50);
  322. processobject(&object_01005729CC);
  323. processobject2(&object_020056AF50);
  324. processobject2(&object_02005729CC);
  325.  
  326. //To get the right anim without the weird crashes...
  327. HMODULE handle = GetModuleHandle(L"CHRMODELS_orig");
  328. NJS_ACTION **___SONIC_ACTIONS = (NJS_ACTION **)GetProcAddress(handle, "___SONIC_ACTIONS");
  329. NJS_MODEL_SADX **___SONIC_MODELS = (NJS_MODEL_SADX **)GetProcAddress(handle, "___SONIC_MODELS");
  330. ___SONIC_OBJECTS[0] = &object_0056AF50;
  331. ___SONIC_ACTIONS[6]->motion = &___SONIC_ACTIONS_6;
  332.  
  333. //Original __SONIC_ACTIONS[]
  334. sonicaction1motion = ___SONIC_ACTIONS[1]->motion;
  335. sonicaction2motion = ___SONIC_ACTIONS[2]->motion;
  336. sonicaction3motion = ___SONIC_ACTIONS[3]->motion;
  337. sonicaction4motion = ___SONIC_ACTIONS[4]->motion;
  338. sonicaction5motion = ___SONIC_ACTIONS[5]->motion;
  339. sonicaction6motion = ___SONIC_ACTIONS[6]->motion;
  340. sonicaction18motion = ___SONIC_ACTIONS[18]->motion;
  341. sonicaction120motion = ___SONIC_ACTIONS[120]->motion;
  342. sonicaction121motion = ___SONIC_ACTIONS[121]->motion;
  343. sonicaction122motion = ___SONIC_ACTIONS[122]->motion;
  344. sonicaction123motion = ___SONIC_ACTIONS[123]->motion;
  345.  
  346. Gauge = 10000;
  347.  
  348. };
  349.  
  350. ///////////////////////////////////////////////////////////////////////// OnInput FUNCTION ///////////////////////////////////////////////////////////////////////////////////////
  351.  
  352.  
  353.  
  354.  
  355. void Sonic_OnInput()
  356. {
  357. if (GameState != 15 && GameState != 16)
  358. {
  359. memset(average, 0, sizeof(average));
  360. average_index = 0;
  361. current_length = 0;
  362. return;
  363. }
  364.  
  365.  
  366.  
  367. CharObj2* data2 = GetCharObj2(0);
  368.  
  369. if (data2 == 0)
  370. return;
  371.  
  372. //const float x1 = data2->Speed.x;
  373. //const float z1 = data2->Speed.z;
  374. //const float speed = sqrt((x1 * x1) + (z1 * z1));
  375.  
  376.  
  377. //SetDebugFontSize(30);
  378. //DisplayDebugStringFormatted((40 << 16) | 28, "%4i km/h", (int)ceil(speed * 21.6f));
  379. //DisplayDebugStringFormatted((41 << 16) | 29, "%4i m/s", (int)ceil(speed * 6.0f));
  380. //DisplayDebugStringFormatted((42 << 16) | 31, "%4.1f km", speed * 0.0001);
  381. //SetDebugFontSize(12);
  382.  
  383. //if (speed > 7.0f)
  384. // ControllersRaw[0].RightStickY = -127;
  385.  
  386. //******************************************************************************************DisplayDebugStringFormatted((43 << 16) | 32, "%4i points", EnemyBonus);
  387.  
  388. if (GameState == 15)
  389. {
  390. const float x = data2->Speed.x;
  391. const float z = data2->Speed.z;
  392. const float m = sqrt((x * x) + (z * z));
  393.  
  394.  
  395. average[average_index] = m;
  396. ++average_index;
  397. average_index %= 2160000;
  398. if (current_length < 2160000);
  399. current_length++;
  400. }
  401.  
  402. float something = 0.0f;
  403. for (int i = 0; i < current_length; i++)
  404. {
  405. something += average[i];
  406. }
  407. something /= (float)current_length;
  408. //SetDebugFontSize(15);
  409. //DisplayDebugStringFormatted((83 << 16) | 65, "%6.0f km/h.avg", something * 21.6f);
  410. //SetDebugFontSize(12);
  411.  
  412. }
  413.  
  414.  
  415.  
  416.  
  417.  
  418. ///////////////////////////////////////////////////////////////////////// OnFrame FUNCTION ///////////////////////////////////////////////////////////////////////////////////////
  419.  
  420.  
  421. void Sonic_OnFrame()
  422. {
  423.  
  424. HMODULE hmodule = GetModuleHandle(L"CHRMODELS_orig");
  425. NJS_OBJECT **___SONIC_OBJECTS = (NJS_OBJECT **)GetProcAddress(hmodule, "___SONIC_OBJECTS");
  426.  
  427.  
  428.  
  429.  
  430.  
  431. WriteData((PVMEntry**)0x90ED54, SonicTextures);
  432.  
  433.  
  434.  
  435. WriteCall((void*)0x4959AA, MetalSonic_AfterImage_Display_r);
  436. WriteData((ObjectFuncPtr*)0x495AED, MetalSonic_AfterImage_Display_r);
  437. WriteCall((void*)0x494BE7, PlayHomingSound);
  438. WriteCall((void*)0x4BA525, SetInvincible);
  439. WriteCall((void*)0x4BA537, UnsetInvincible);
  440. WriteData((void(**)(ObjectMaster*))0x441E10, &SetSpeedShoes);
  441. WriteData((void(**)(ObjectMaster*))0x441DEA, &UnsetSpeedShoes);
  442. WriteData<4>((void*)0x4A1413, 0x90u); //Trail stuff
  443. //WriteData((void*)0x55E95C, 0x90u, 6);//Sonic can animate the SuperAura
  444. //WriteData<3>((void*)0x610113, 0x90);
  445. //ResizeTextureList((NJS_TEXLIST *)0xB98BF8, 201); //For WaveOcean
  446.  
  447. //To get the right model and anim for Sonic but causes weird crashes...
  448. //ChangeToSonicModel();
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456. ////To get the right anim without the weird crashes...
  457. //if (!is_hyper && !is_super)
  458. //{
  459. // ChangeToSonicModel();
  460. // //HMODULE handle = GetModuleHandle(L"CHRMODELS_orig");
  461. // //NJS_ACTION **___SONIC_ACTIONS = (NJS_ACTION **)GetProcAddress(handle, "___SONIC_ACTIONS");
  462. // //NJS_MODEL_SADX **___SONIC_MODELS = (NJS_MODEL_SADX **)GetProcAddress(handle, "___SONIC_MODELS");
  463. // //*___SONIC_OBJECTS[0] = object_0056AF50;
  464. // //*___SONIC_ACTIONS[6]->motion = ___SONIC_ACTIONS_6;
  465.  
  466. //}
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473. //PVMEntry pvm = { "AMY_EFF", (NJS_TEXLIST*)0x91C808 };// helperFunctions.RegisterCharacterPVM(Characters_Sonic, pvm);
  474. //pvm = { "SUPERSONIC", (NJS_TEXLIST*)0x142272C }; helperFunctions.RegisterCharacterPVM(Characters_Sonic, pvm);
  475.  
  476. //WaveOceanTEST
  477. // char pathbuf[MAX_PATH];
  478. // _snprintf(pathbuf, MAX_PATH, "%s\\LandTable.sa1lvl", path);
  479. // LandTableInfo *landtableinfo = new LandTableInfo(pathbuf);
  480. // LandTable *landtable = landtableinfo->getlandtable();
  481. // WriteData((LandTable**)0x97DA48, landtable);
  482.  
  483.  
  484. EntityData1* co1 = EntityData1Ptrs[0];
  485. CharObj2 *co2 = GetCharObj2(0);
  486.  
  487. //if (CharacterSelection == 0)
  488. //{
  489. // ChangeToSonicModel();
  490. // njReleaseTexture((NJS_TEXLIST*)0x927CB8);
  491. // LoadPVM("SON_EFF", (NJS_TEXLIST*)0x927CB8);
  492. // njReleaseTexture((NJS_TEXLIST*)0x142272C);
  493. // LoadPVM("SUPERSONIC", (NJS_TEXLIST*)0x142272C);
  494. // njReleaseTexture((NJS_TEXLIST*)0x94A2A8);
  495. // LoadPVM("EFF_REGULAR", (NJS_TEXLIST*)0x94A2A8);
  496. //}
  497.  
  498.  
  499. if (GameState == 15)
  500. {
  501. if (CurrentLevel == 26 || CurrentLevel == 29 || CurrentLevel == 33)
  502. {
  503. Sonic_LightSpeedShoesObtained = 1;
  504. Sonic_CrystalRingObtained = 1;
  505. Sonic_AncientLightObtained = 1;
  506. }
  507. else if (EntityData1Ptrs[0]->Action != 4 || (co1->Status & Status_LightDash) != Status_LightDash)
  508. {
  509. Sonic_LightSpeedShoesObtained = 1;
  510. Sonic_CrystalRingObtained = 0;
  511. Sonic_AncientLightObtained = 0;
  512. }
  513. else
  514. {
  515. Sonic_LightSpeedShoesObtained = 1;
  516. Sonic_CrystalRingObtained = 0;
  517. Sonic_AncientLightObtained = 1;
  518. }
  519. }
  520.  
  521.  
  522.  
  523. if (CurrentMusic == 24 || CurrentMusic == 72 || CurrentMusic == 101 || CurrentMusic == 102 || CurrentMusic == 103)
  524. {
  525. ChangeToSonicModel();
  526. }
  527.  
  528.  
  529.  
  530. ////FOR SHADOW'S CHAOS BOOST
  531. //if (Rings == 1)
  532. //{
  533. // Knuckles_MaximumHeat_Draw(&EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin, (njSin(++alpha << 10) + 1.0) * 0.2);
  534. //}
  535. //if (Lives == 1 && !hypersparkles)
  536. //{
  537. // hypersparkles = LoadObject(LoadObj_Data1, 2, Invincibility_Load);
  538. // if (hypersparkles) hypersparkles->Data1->CharIndex = 0;
  539. //}
  540. //if (Lives != 1)
  541. //{
  542. // DeleteObject_(hypersparkles);
  543. // hypersparkles = nullptr;
  544. //}
  545.  
  546.  
  547.  
  548. //Extra transformations
  549. if (co2 == NULL) return;
  550. if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
  551. {
  552. if (CurrentMusic != 45 && CurrentMusic != 55 && CurrentMusic != 85 && CurrentMusic != 86 && CurrentMusic != 96) // FIX THIS SHIIIIIIIIIIIIIIIIIIIIIIIIIIIIT !!!!!!!!!!!!!!!!!!!!!!!
  553. {
  554. oldmusic = CurrentMusic;
  555. }
  556. //if (CurrentMusic == 85)
  557. if (CurrentLevel != 26 && CurrentLevel != 29 && CurrentLevel != 33)
  558. {
  559. if (GameState != 16)
  560. {
  561. if (!is_super)
  562. {
  563. if (!is_hyper)
  564. {
  565. if (!just_transformed && Rings >= 50)
  566. {
  567. if (EntityData1Ptrs[0]->Action == 8 && !(co1->Status & Status_LightDash))
  568. {
  569. if (ControllerPointers[0]->PressedButtons & Buttons_C && co2->AnimationThing.Index != 75)//Super transformation (toggle)
  570. {
  571. PlaySound(766, 0, 0, 0);
  572. if (CurrentMusic != 96)
  573. {
  574. //PlayMusic(MusicIDs_sprsonic);
  575. CurrentMusic = 86;
  576. }
  577. transforming = true;
  578. is_super = true;
  579. just_transformed = true;
  580. ChangeToSuperSonicModel();
  581. co2->Powerups |= Powerups_Invincibility;
  582. njReleaseTexture((NJS_TEXLIST*)0x927CB8);
  583. LoadPVM("SS_SON_EFF", (NJS_TEXLIST*)0x927CB8);
  584. njReleaseTexture((NJS_TEXLIST*)0x142272C);
  585. LoadPVM("SS_SUPERSONIC", (NJS_TEXLIST*)0x142272C);
  586. njReleaseTexture((NJS_TEXLIST*)0x94A2A8);
  587. LoadPVM("SS_EFF_REGULAR", (NJS_TEXLIST*)0x94A2A8);
  588. }
  589. }
  590. }
  591. }
  592. else if (!transforming)
  593. {
  594. if (ControllerPointers[0]->PressedButtons & Buttons_C && co2->AnimationThing.Index != 75)//Super transformation (toggle)
  595. {
  596. is_super = true;
  597. is_hyper = false;
  598. PlaySound(815, 0, 0, 0);
  599. CurrentMusic = 86;
  600. //PlayMusic(MusicIDs_sprsonic);
  601. ChangeToSuperSonicModel();
  602. DeleteObject_(hypersparkles);
  603. hypersparkles = nullptr;
  604. co2->Powerups |= Powerups_Invincibility;
  605. njReleaseTexture((NJS_TEXLIST*)0x927CB8);
  606. LoadPVM("SS_SON_EFF", (NJS_TEXLIST*)0x927CB8);
  607. njReleaseTexture((NJS_TEXLIST*)0x142272C);
  608. LoadPVM("SS_SUPERSONIC", (NJS_TEXLIST*)0x142272C);
  609. njReleaseTexture((NJS_TEXLIST*)0x94A2A8);
  610. LoadPVM("SS_EFF_REGULAR", (NJS_TEXLIST*)0x94A2A8);
  611. }
  612. }
  613. }
  614. else if (!transforming)
  615. {
  616. if ((ControllerPointers[0]->PressedButtons & Buttons_C && co2->AnimationThing.Index != 75) || Rings == 0)//Super transformation (toggle)
  617. {
  618. just_untransformed = true;
  619. is_super = false;
  620. is_hyper = false;
  621. PlaySound(816, 0, 0, 0);
  622. if (CurrentMusic != 96)
  623. {
  624. CurrentMusic = oldmusic;
  625. }
  626. ChangeToSonicModel();
  627. super_rings_depletion = 0;
  628. hyper_rings_depletion = 0;
  629. WriteData((short*)0x4BA46D, (short)1380);
  630. co2->Powerups &= ~Powerups_Invincibility;
  631. njReleaseTexture((NJS_TEXLIST*)0x927CB8);
  632. LoadPVM("SON_SON_EFF", (NJS_TEXLIST*)0x927CB8);
  633. njReleaseTexture((NJS_TEXLIST*)0x142272C);
  634. LoadPVM("SON_SUPERSONIC", (NJS_TEXLIST*)0x142272C);
  635. njReleaseTexture((NJS_TEXLIST*)0x94A2A8);
  636. LoadPVM("EFF_REGULAR", (NJS_TEXLIST*)0x94A2A8);
  637. }
  638. else if (EntityData1Ptrs[0]->Action != 8 && ControllerPointers[0]->PressedButtons & Buttons_D)
  639. {
  640. just_untransformed = true;
  641. is_super = false;
  642. is_hyper = false;
  643. PlaySound(816, 0, 0, 0);
  644. if (CurrentMusic != 96)
  645. {
  646. CurrentMusic = oldmusic;
  647. }
  648. ChangeToSonicModel();
  649. super_rings_depletion = 0;
  650. hyper_rings_depletion = 0;
  651. WriteData((short*)0x4BA46D, (short)1380);
  652. co2->Powerups &= ~Powerups_Invincibility;
  653. njReleaseTexture((NJS_TEXLIST*)0x927CB8);
  654. LoadPVM("SON_SON_EFF", (NJS_TEXLIST*)0x927CB8);
  655. njReleaseTexture((NJS_TEXLIST*)0x142272C);
  656. LoadPVM("SON_SUPERSONIC", (NJS_TEXLIST*)0x142272C);
  657. njReleaseTexture((NJS_TEXLIST*)0x94A2A8);
  658. LoadPVM("EFF_REGULAR", (NJS_TEXLIST*)0x94A2A8);
  659. }
  660. }
  661. if (!is_hyper)
  662. {
  663. if (!just_transformed && Rings >= 100)
  664. {
  665. if (EntityData1Ptrs[0]->Action == 8 && !(co1->Status & Status_LightDash))
  666. {
  667. if (ControllerPointers[0]->PressedButtons & Buttons_D && co2->AnimationThing.Index != 75)//Hyper transformation (toggle)
  668. {
  669. PlaySound(814, 0, 0, 0);
  670. co2->UnderwaterTime = 1;
  671. CurrentMusic = 45;
  672. //PlayMusic(MusicIDs_fishing);
  673. transforming = true;
  674. is_super = false;
  675. is_hyper = true;
  676. just_transformed = true;
  677. ChangeToHyperSonicModel();
  678. WriteData((short*)0x4BA46D, (short)65534);
  679. co2->Powerups &= ~Powerups_Invincibility;
  680. njReleaseTexture((NJS_TEXLIST*)0x927CB8);
  681. LoadPVM("HS_SON_EFF", (NJS_TEXLIST*)0x927CB8);
  682. njReleaseTexture((NJS_TEXLIST*)0x142272C);
  683. LoadPVM("HS_SUPERSONIC", (NJS_TEXLIST*)0x142272C);
  684. njReleaseTexture((NJS_TEXLIST*)0x94A2A8);
  685. LoadPVM("HS_EFF_REGULAR", (NJS_TEXLIST*)0x94A2A8);
  686. }
  687. }
  688. }
  689. }
  690. else if (!transforming)
  691. {
  692. if ((ControllerPointers[0]->PressedButtons & Buttons_D && co2->AnimationThing.Index != 75) || Rings == 0)//Hyper transformation (toggle)
  693. {
  694. just_untransformed = true;
  695. is_super = false;
  696. is_hyper = false;
  697. PlaySound(816, 0, 0, 0);
  698. if (CurrentMusic != 96)
  699. {
  700. CurrentMusic = oldmusic;
  701. }
  702. ChangeToSonicModel();
  703. super_rings_depletion = 0;
  704. hyper_rings_depletion = 0;
  705. co2->Powerups &= ~Powerups_Invincibility;
  706. DeleteObject_(hypersparkles);
  707. hypersparkles = nullptr;
  708. WriteData((short*)0x4BA46D, (short)1380);
  709. njReleaseTexture((NJS_TEXLIST*)0x927CB8);
  710. LoadPVM("SON_SON_EFF", (NJS_TEXLIST*)0x927CB8);
  711. njReleaseTexture((NJS_TEXLIST*)0x142272C);
  712. LoadPVM("SON_SUPERSONIC", (NJS_TEXLIST*)0x142272C);
  713. njReleaseTexture((NJS_TEXLIST*)0x94A2A8);
  714. LoadPVM("EFF_REGULAR", (NJS_TEXLIST*)0x94A2A8);
  715. }
  716. }
  717. }
  718. if (transforming)
  719. {
  720. ++transforming_time;
  721. //++transform_anim;
  722. //++firstanim_speedup;
  723. //if (firstanim_speedup > 0 && firstanim_speedup < 2)
  724. //{
  725. // ((AnimData_t*)0x3C56210)[85].AnimationSpeed = 20;
  726. //}
  727. //else ((AnimData_t*)0x3C56210)[85].AnimationSpeed = 1;
  728. //if (transform_anim <= 30)
  729. //{
  730. // co2->AnimationThing.Index = 85;
  731. //}
  732. //else
  733. //{
  734. // co2->AnimationThing.Index = 84;
  735. //}
  736. co2->AnimationThing.Index = 84;
  737. co2->Speed.x = 0;
  738. co2->Speed.y = 0.125;
  739. co2->Speed.z = 0;
  740. }
  741. if (transforming_time == 40)
  742. {
  743. transforming_time = 0;
  744. transforming = false;
  745. //transform_anim = 0;
  746. //firstanim_speedup = 0;
  747. }
  748. if ((co1->Status & Status_Ground) == Status_Ground || co2->AnimationThing.Index == 0 || co2->AnimationThing.Index == 1 || co2->AnimationThing.Index == 2 || 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 == 31)
  749. {
  750. just_transformed = false;
  751. }
  752. if (GameState == 0 || GameState == 1 || GameState == 2 || GameState == 3 || GameState == 4 || GameState == 6 || GameState == 7 || GameState == 9 || GameState == 20 || GameState == 21 || GameState == 23)
  753. {
  754. if (++testvar == 1)
  755. {
  756. transforming_time = 0;
  757. transforming = false;
  758. just_transformed = false;
  759. super_rings_depletion = 0;
  760. hyper_rings_depletion = 0;
  761. //transform_anim = 0;
  762. //if (CurrentLevel != 26 && CurrentLevel != 29 && CurrentLevel != 33)
  763. //{
  764. // if (++testvar2 == 1)
  765. // {
  766. is_super = false;
  767. is_hyper = false;
  768. ChangeToSonicModel();
  769. DeleteObject_(hypersparkles);
  770. hypersparkles = nullptr;
  771. njReleaseTexture((NJS_TEXLIST*)0x927CB8);
  772. LoadPVM("SON_SON_EFF", (NJS_TEXLIST*)0x927CB8);
  773. njReleaseTexture((NJS_TEXLIST*)0x142272C);
  774. LoadPVM("SON_SUPERSONIC", (NJS_TEXLIST*)0x142272C);
  775. njReleaseTexture((NJS_TEXLIST*)0x94A2A8);
  776. LoadPVM("EFF_REGULAR", (NJS_TEXLIST*)0x94A2A8);
  777. // }
  778. //}
  779. //else testvar2 = 0;
  780. }
  781. }
  782. else testvar = 0;
  783. if (just_untransformed)
  784. {
  785. if (co2->AnimationThing.Index == 9 || co2->AnimationThing.Index == 10 || co2->AnimationThing.Index == 11 || co2->AnimationThing.Index == 12 || co2->AnimationThing.Index == 13)
  786. {
  787. if (co2->Speed.x > 0.47)
  788. {
  789. //co2->PhysicsData.RollCancel = 100;
  790. //co2->PhysicsData.RollEnd = 100; // I NEED TO DO THIS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  791. //co2->PhysicsData.Run1 = 100;
  792. //co2->PhysicsData.Run2 = 100;
  793. }
  794. if (++untransforming > 1)
  795. {
  796. just_untransformed = false;
  797. }
  798. }
  799. }
  800. else
  801. {
  802. co2->PhysicsData.RollCancel = 0.46;
  803. co2->PhysicsData.RollEnd = 1.39;
  804. co2->PhysicsData.Run1 = 4.85;
  805. untransforming = 0;
  806. }
  807. }
  808. }
  809.  
  810. //Hyper always sparkles
  811. if (is_hyper && (co2->Powerups & Powerups_Invincibility) != Powerups_Invincibility)
  812. {
  813. hypersparkles = LoadObject(LoadObj_Data1, 2, Invincibility_Load);
  814. if (hypersparkles) hypersparkles->Data1->CharIndex = 0;
  815. }
  816.  
  817.  
  818. //Super music
  819. if (is_super && co2->AnimationThing.Index != 75 && CurrentMusic != 96)
  820. {
  821. CurrentMusic = 86;
  822. //PlayMusic(MusicIDs_sprsonic);
  823. }
  824.  
  825.  
  826. //Hyper music and afterimages
  827. if (is_hyper && co2->AnimationThing.Index != 75)
  828. {
  829. CurrentMusic = 45;
  830. //PlayMusic(MusicIDs_fishing);
  831. double SpeedXYaftimages = sqrt(pow(co2->Speed.x, 2) + pow(co2->Speed.y, 2) + pow(co2->Speed.z, 2));
  832. if (GameState != 16)
  833. {
  834. if (!(co2->SurfaceFlags & 2))
  835. {
  836. if (!trailobj && !(EntityData1Ptrs[0]->Action == 6 && SpeedXYaftimages > 7.999 && SpeedXYaftimages < 8.001) && EntityData1Ptrs[0]->Action != 4 && EntityData1Ptrs[0]->Action != 5 && EntityData1Ptrs[0]->Action != 14 && EntityData1Ptrs[0]->Action != 44 && EntityData1Ptrs[0]->Action != 45)
  837. {
  838. if (++testvar3 == 2)
  839. {
  840. ObjectMaster *v1 = LoadObject(LoadObj_Data1, 3, MetalSonic_AfterImages_Main);
  841. if (v1) *(int*)&v1->Data1->Object = 1;
  842. testvar3 = 0;
  843. }
  844. }
  845. }
  846. else if (!is_boosting)
  847. {
  848. if (!(EntityData1Ptrs[0]->Action == 6 && SpeedXYaftimages > 7.999 && SpeedXYaftimages < 8.001) && EntityData1Ptrs[0]->Action != 4 && EntityData1Ptrs[0]->Action != 5 && EntityData1Ptrs[0]->Action != 14 && EntityData1Ptrs[0]->Action != 44 && EntityData1Ptrs[0]->Action != 45)
  849. {
  850. if (++testvar3 == 2)
  851. {
  852. if (GameState != 16)
  853. {
  854. ObjectMaster *v1 = LoadObject(LoadObj_Data1, 3, MetalSonic_AfterImages_Main);
  855. if (v1) *(int*)&v1->Data1->Object = 1;
  856. testvar3 = 0;
  857. }
  858. }
  859. }
  860. }
  861. }
  862. }
  863.  
  864.  
  865. //Anim data
  866. if (co2 == NULL) return;
  867. if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
  868. {
  869. if (is_super || is_hyper)
  870. {
  871. ((AnimData_t*)0x3C56210)[18].TransitionSpeed = 0.1;
  872. ((AnimData_t*)0x3C56210)[64].TransitionSpeed = 0.25;
  873. ((AnimData_t*)0x3C56210)[64].AnimationSpeed = 1.5;
  874. ((AnimData_t*)0x3C56210)[14].AnimationSpeed = 0.15;
  875. ((AnimData_t*)0x3C56210)[40].AnimationSpeed = 1.15;
  876. ((AnimData_t*)0x3C56210)[42].AnimationSpeed = 0.9;
  877. ((AnimData_t*)0x3C56210)[31].TransitionSpeed = 0.125;
  878. ((AnimData_t*)0x3C56210)[29].AnimationSpeed = 2.0;
  879. ((AnimData_t*)0x3C56210)[75].AnimationSpeed = 0.75;
  880. ((AnimData_t*)0x3C56210)[38].AnimationSpeed = 2.5;
  881. ((AnimData_t*)0x3C56210)[34].AnimationSpeed = 0.6;
  882. ((AnimData_t*)0x3C56210)[38].Property = 9;
  883. ((AnimData_t*)0x3C56210)[34].Property = 9;
  884. ((AnimData_t*)0x3C56210)[0].Property = 3;
  885. ((AnimData_t*)0x3C56210)[0].AnimationSpeed = 0.25;
  886. ((AnimData_t*)0x3C56210)[1].Property = 3;
  887. ((AnimData_t*)0x3C56210)[1].AnimationSpeed = 0.25;
  888. ((AnimData_t*)0x3C56210)[2].Property = 3;
  889. ((AnimData_t*)0x3C56210)[2].AnimationSpeed = 0.25;
  890. ((AnimData_t*)0x3C56210)[3].Property = 3;
  891. ((AnimData_t*)0x3C56210)[3].AnimationSpeed = 0.25;
  892. ((AnimData_t*)0x3C56210)[4].Property = 3;
  893. ((AnimData_t*)0x3C56210)[4].AnimationSpeed = 0.25;
  894. ((AnimData_t*)0x3C56210)[5].Property = 3;
  895. ((AnimData_t*)0x3C56210)[5].AnimationSpeed = 0.25;
  896. ((AnimData_t*)0x3C56210)[6].Property = 3;
  897. ((AnimData_t*)0x3C56210)[6].AnimationSpeed = 0.25;
  898. ((AnimData_t*)0x3C56210)[9].Property = 9;
  899. ((AnimData_t*)0x3C56210)[9].AnimationSpeed = 1.0;
  900. ((AnimData_t*)0x3C56210)[10].Property = 9;
  901. ((AnimData_t*)0x3C56210)[10].AnimationSpeed = 0.25;
  902. ((AnimData_t*)0x3C56210)[11].Property = 9;
  903. ((AnimData_t*)0x3C56210)[11].AnimationSpeed = 0.07;
  904. ((AnimData_t*)0x3C56210)[13].Property = 9;
  905. ((AnimData_t*)0x3C56210)[13].AnimationSpeed = 0.25;
  906. co2->PhysicsData.RollEnd = 3.0;
  907. co2->PhysicsData.Run1 = 12.0;
  908. ((AnimData_t*)0x3C56210)[27].AnimationSpeed = 100.0;
  909. ((AnimData_t*)0x3C56210)[28].AnimationSpeed = 100.0;
  910. if (EntityData1Ptrs[0]->Action == 18)
  911. {
  912. co2->Speed.x = 0.0;
  913. }
  914. }
  915. else
  916. {
  917. ((AnimData_t*)0x3C56210)[18].TransitionSpeed = 0.1;
  918. ((AnimData_t*)0x3C56210)[64].TransitionSpeed = 0.25;
  919. ((AnimData_t*)0x3C56210)[64].AnimationSpeed = 1.5;
  920. ((AnimData_t*)0x3C56210)[12].AnimationSpeed = 0.415;
  921. ((AnimData_t*)0x3C56210)[13].AnimationSpeed = 0.415;
  922. ((AnimData_t*)0x3C56210)[14].AnimationSpeed = 0.15;
  923. ((AnimData_t*)0x3C56210)[40].AnimationSpeed = 1.15;
  924. ((AnimData_t*)0x3C56210)[42].AnimationSpeed = 0.9;
  925. ((AnimData_t*)0x3C56210)[31].TransitionSpeed = 0.125;
  926. ((AnimData_t*)0x3C56210)[29].AnimationSpeed = 2.0;
  927. ((AnimData_t*)0x3C56210)[75].AnimationSpeed = 0.75;
  928. ((AnimData_t*)0x3C56210)[38].AnimationSpeed = 2.5;
  929. ((AnimData_t*)0x3C56210)[34].AnimationSpeed = 0.6;
  930. ((AnimData_t*)0x3C56210)[38].Property = 9;
  931. ((AnimData_t*)0x3C56210)[34].Property = 9;
  932. ((AnimData_t*)0x3C56210)[0].Property = 3;
  933. ((AnimData_t*)0x3C56210)[0].AnimationSpeed = 0.5;
  934. ((AnimData_t*)0x3C56210)[1].Property = 4;
  935. ((AnimData_t*)0x3C56210)[1].AnimationSpeed = 0.25;
  936. ((AnimData_t*)0x3C56210)[2].Property = 3;
  937. ((AnimData_t*)0x3C56210)[2].AnimationSpeed = 0.25;
  938. ((AnimData_t*)0x3C56210)[3].Property = 4;
  939. ((AnimData_t*)0x3C56210)[3].AnimationSpeed = 1.0;
  940. ((AnimData_t*)0x3C56210)[4].Property = 4;
  941. ((AnimData_t*)0x3C56210)[4].AnimationSpeed = 0.25;
  942. ((AnimData_t*)0x3C56210)[5].Property = 4;
  943. ((AnimData_t*)0x3C56210)[5].AnimationSpeed = 0.25;
  944. ((AnimData_t*)0x3C56210)[6].Property = 6;
  945. ((AnimData_t*)0x3C56210)[6].AnimationSpeed = 0.25;
  946. ((AnimData_t*)0x3C56210)[9].Property = 9;
  947. ((AnimData_t*)0x3C56210)[9].AnimationSpeed = 3.4;
  948. ((AnimData_t*)0x3C56210)[10].Property = 9;
  949. ((AnimData_t*)0x3C56210)[10].AnimationSpeed = 1.4;
  950. ((AnimData_t*)0x3C56210)[11].Property = 9;
  951. ((AnimData_t*)0x3C56210)[12].Property = 9;
  952. ((AnimData_t*)0x3C56210)[13].Property = 9;
  953. co2->PhysicsData.RollEnd = 1.39;
  954. co2->PhysicsData.Run1 = 4.85;
  955. co2->PhysicsData.AirDecel = -0.028;
  956. ((AnimData_t*)0x3C56210)[27].AnimationSpeed = 1.0;
  957. ((AnimData_t*)0x3C56210)[28].AnimationSpeed = 1.0;
  958.  
  959. //SONIC Run anim speed
  960. if (co2->Speed.x <= 2.3 && co2->Speed.x >= 1.3 && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0) ((AnimData_t*)0x3C56210)[11].AnimationSpeed = 0.9;
  961. else ((AnimData_t*)0x3C56210)[11].AnimationSpeed = 0.6225;
  962. }
  963. }
  964.  
  965. //SA2 jumpball
  966. SA2_jumpball(co1, co2);
  967.  
  968. //Super/Hyper Y Offset
  969. if (is_super || is_hyper)
  970. {
  971. double SpeedXYoffset = sqrt(pow(co2->Speed.x, 2) + pow(co2->Speed.y, 2) + pow(co2->Speed.z, 2));
  972. if ((GameState == 15 || GameState == 16 || GameState == 4) && !(co2->SurfaceFlags & 2) && !(EntityData1Ptrs[0]->Action == 6 && SpeedXYoffset > 7.999 && SpeedXYoffset < 8.001) && (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 == 9 || co2->AnimationThing.Index == 10 || co2->AnimationThing.Index == 11 || co2->AnimationThing.Index == 12 || co2->AnimationThing.Index == 13 || co2->AnimationThing.Index == 64))
  973. {
  974. co2->PhysicsData.YOff = 8.5;
  975. WriteData((float**)0x4B9D1E, &invinmult);
  976. WriteData((void*)0x4BA276, invinsize);
  977. WriteData<3>((void*)0x4BA280, 0x90);
  978. }
  979. else
  980. {
  981. co2->PhysicsData.YOff = 5.4;
  982. WriteData((float**)0x4B9D1E, &invinmult_orig);
  983. WriteData((void*)0x4BA276, invinsize_orig);
  984. WriteData((void*)0x4BA280, invin_stuff_unNOP);
  985. }
  986. }
  987. else
  988. {
  989. co2->PhysicsData.YOff = 5.4;
  990. WriteData((float**)0x4B9D1E, &invinmult_orig);
  991. WriteData((void*)0x4BA276, invinsize_orig);
  992. WriteData((void*)0x4BA280, invin_stuff_unNOP);
  993. }
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004. //Super/Hyper Sonic animated textures and ring depletion
  1005. if (GameState != 16)
  1006. {
  1007. if (is_super)
  1008. {
  1009. for (auto iter = materials.cbegin(); iter != materials.cend(); ++iter) (*iter)->attr_texId = 29 + ((FrameCounter / 3) % 32);
  1010. HMODULE handle = GetModuleHandle(L"CHRMODELS_orig");
  1011. NJS_OBJECT **___SONIC_OBJECTS = (NJS_OBJECT **)GetProcAddress(handle, "___SONIC_OBJECTS");
  1012. ___SONIC_OBJECTS[44]->basicdxmodel->mats[0].attr_texId = SUPERSpinballtextures[(FrameCounter / 3) % 32];
  1013. ++super_rings_depletion;
  1014. if (super_rings_depletion == 48 && Rings != 0 && co2->AnimationThing.Index != 75)
  1015. {
  1016. Rings -= 1;
  1017. super_rings_depletion = 0;
  1018. }
  1019. }
  1020. if (is_hyper)
  1021. {
  1022. for (auto iter = materials2.cbegin(); iter != materials2.cend(); ++iter) (*iter)->attr_texId = 95 + ((FrameCounter / 3) % 32);
  1023. HMODULE handle = GetModuleHandle(L"CHRMODELS_orig");
  1024. NJS_OBJECT **___SONIC_OBJECTS = (NJS_OBJECT **)GetProcAddress(handle, "___SONIC_OBJECTS");
  1025. ___SONIC_OBJECTS[44]->basicdxmodel->mats[0].attr_texId = HYPERSpinballtextures[(FrameCounter / 3) % 32];
  1026. ++hyper_rings_depletion;
  1027. if (hyper_rings_depletion == 24 && Rings != 0 && co2->AnimationThing.Index != 75)
  1028. {
  1029. Rings -= 1;
  1030. hyper_rings_depletion = 0;
  1031. }
  1032. }
  1033. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement