Advertisement
Benji23245

Untitled

Jul 18th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 182.13 KB | None | 0 0
  1. // Sonic_Adventure_3.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. //Gameplay Reset variables
  14. char invinsize_orig[] = { 0xD9, 0x41, 0x30, 0xD8, 0x0D, 0x8C, 0xD5, 0x7D, 0 };
  15. char invin_stuff_unNOP[] = { 0xD9, 0x5E, 0x2C };
  16. char gravity_orig[] = { 0x89, 0x90, 0x14, 0x01, 0, 0 };
  17. char rollingdata[] = { 0xC6, 0x07, 0x05 };
  18. char homingoutspeed_orig[] = { 0xD9, 0x5F, 0x38 };
  19. char homingaction_orig[] = { 0x80, 0x65, 0x05, 0xFA };
  20. char homingstuff_orig[] = { 0xC6, 0x45, 0, 0x0C };
  21. char enable_aiming[] = { 0x0F, 0xBE, 0x06 };
  22. char enable_shooting[] = { 0xC6, 0x46, 0x01, 0x03 };
  23. char shooting05_unNOP[] = { 0xC6, 0x46, 0x01, 0x05 };
  24. char landing_NOattack1_unNOP[] = { 0x80, 0x65, 0x05, 0xFA };
  25. char landing_NOattack2_unNOP[] = { 0x80, 0x65, 0x05, 0xFA };
  26. char landing_NOattack3_unNOP[] = { 0x80, 0x65, 0x05, 0xFA };
  27. char landing_NOattack4_unNOP[] = { 0x80, 0x65, 0x05, 0xFA };
  28. char SpindashData[] = { 0xC6, 0x7, 0x4 };
  29. char gravity_underwater_orig[] = { 0xD9, 0x98, 0x14, 0x01, 0, 0 };
  30. char shadow3rdpunchspeed_orig[] = { 0xC7, 0x47, 0x38, 0, 0, 0x80, 0x40 };
  31. char jumpdashspeed1_normal[] = { 0xC7, 0x47, 0x38, 0, 0, 0xA0, 0x40 };
  32. char jumpdashspeed2_normal[] = { 0xC7, 0x47, 0x38, 0, 0, 0xA0, 0x40 };
  33. char enable_SONIC_KNUXflashing[] = { 0x66, 0x89, 0x45, 0x06 };
  34. char HSpeed_data[] = { 0x89, 0x48, 0x3C };
  35. char VSpeed_data[] = { 0x89, 0x48, 0x38 };
  36. char to_standing_data[] = { 0x66, 0x89, 0x8E, 0x24, 0x01, 0, 0 };
  37. char SonicLSAcharged_RunSpeed_orig[] = { 0xC7, 0x86, 0xAC, 0, 0, 0, 0, 0, 0, 0x3F };
  38. char always_attract_rings_unNOP[] = { 0x0F, 0x84, 0xAF, 0x01, 0, 0 };
  39. char spindash_outspeed_orig[] = { 0x89, 0x4E, 0x38 };
  40. char blaze_lasting_time_orig[] = { 0x66, 0x3D, 0x68, 0x01 };
  41. char rollingweirdfix1[] = { 0x66, 0xC7, 0x81, 0x24, 0x01, 0, 0, 0x1D, 0 };
  42. char rollingweirdfix2[] = { 0x66, 0x89, 0x8E, 0x24, 0x01, 0, 0 };
  43. char SuperSplashData[] = { 0x8B, 0x43, 0x74, 0x85, 0xC0 };
  44. char SuperSplashScale[] = { 0x8B, 0x45, 0x74, 0x33, 0xC9 };
  45. char SuperSplashAura[] = { 0xD9, 0x43, 0x38, 0xD8, 0x1D };
  46.  
  47. char unknown_49876D[] = { 0x80, 0x65, 0x05, 0xFA };
  48. char unknown_492F73[] = { 0x66, 0xC7, 0x87, 0x24, 0x01, 0, 0, 0x12, 0 };
  49. char unknown_55E95C[] = { 0x0F, 0x84, 0x8D, 0x06, 0, 0 };
  50. char unknown_444103[] = { 0xD9, 0x87, 0xC4, 0, 0, 0 };
  51. char unknown_493067[] = { 0xC7, 0x47, 0x38, 0, 0, 0, 0x41 };
  52. char unknown_492CAE[] = { 0xD8, 0x1D, 0x48, 0xDC, 0x7D, 0 };
  53. char unknown_4975AC[] = { 0x66, 0xC7, 0x83, 0x24, 0x01, 0, 0, 0x14, 0 };
  54. char unknown_49304C[] = { 0x66, 0xC7, 0x87, 0x24, 0x01, 0, 0, 0x40, 0 };
  55. char unknown_460EA6[] = { 0xBB, 0x10, 0, 0, 0 };
  56. char unknown_4950A9[] = { 0x80, 0x4F, 0x05, 0x02 };
  57. char unknown_492F68[] = { 0xC6, 0x06, 0x0C };
  58. char unknown_4975BC[] = { 0xC7, 0x43, 0x38, 0, 0, 0, 0x40 };
  59. char unknown_494C19[] = { 0xC7, 0x47, 0x38, 0, 0, 0x20, 0x41 };
  60.  
  61. float missilespeed_orig = 5.0f;
  62. float invinmult_orig = 0.60000002;
  63. float NormalHomingSpeed = 5.0f;
  64. float ringmaxspeed_orig = 5.0f;
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. //Shared variables
  74. bool r = false;
  75. bool fall_after_roll = false;
  76. bool homing = false;
  77. bool just_homing_attacked = false;
  78. bool in_air_after_homing = false;
  79. bool dashing = false;
  80. bool no_longer_dashing = false;
  81. bool was_on_trampoline = false;
  82. bool was_invincible_before = false;
  83. bool LightDash_SuperDash_ON = false;
  84. bool just_flipped = false;
  85. bool just_spindashed = false;
  86. bool no_light_attack = false;
  87. bool Z_was_pressed_on_ground = false;
  88. bool Z_was_pressed_in_air = false;
  89. bool was_on_ground = false;
  90. bool LSA_launch = false;
  91. bool LSA_used = false;
  92. bool ok = false;
  93. bool is_paused = false;
  94. bool LD_fix = false;
  95. bool GO_sound_played = false;
  96. bool BLUE_GEM_ON = false;
  97. bool RED_GEM_ON = false;
  98. bool GREEN_GEM_ON = false;
  99. bool PURPLE_GEM_ON = false;
  100. bool SKY_GEM_ON = false;
  101. bool WHITE_GEM_ON = false;
  102. bool YELLOW_GEM_ON = false;
  103. bool NO_GEM_ON = false;
  104. bool has_rings = false;
  105. bool has_shield = false;
  106. bool has_invincibility = false;
  107. bool was_hit = false;
  108. bool gauge_full = false;
  109. bool homing_attacking = false;
  110. bool cant_play_again = false;
  111. bool just_charged = false;
  112. bool CB_active = false;
  113. bool is_super = false;
  114. bool punching = false;
  115. bool PURPLE_GEM_used = false;
  116. bool stop_sky_gem = false;
  117.  
  118. char balldata[] = { 0xBD, 0x20, 0, 0, 0 };
  119. char HangTimeCheckData[] = { 0x3B, 0x90, 0x9C, 0, 0, 0 };
  120. char LightDash_unNOP[] = { 0xC6, 0x06, 0x06, 0x33, 0xD2 };
  121. char WalkOnWaterData[] = { 0xF, 0x85, 0xCF, 0, 0, 0 };
  122. char LightDashTrail_unNOP[] = { 0xE8, 0x15, 0x91, 0xFF, 0xFF };
  123. char LD_forced_out_speed[] = { 0xC7, 0x43, 0x38, 0, 0, 0x80, 0x40 };
  124. char LSA_sound[] = { 0xE8, 0xDE, 0x0C, 0xF9, 0xFF };
  125. char TrailData[] = { 0x66, 0x09, 0x5D, 0x04 };
  126. char gravity_orig_hovering[] = { 0x89, 0x90, 0x14, 0x01, 0, 0 };
  127. char gravity_underwater_orig_hovering[] = { 0xD9, 0x98, 0x14, 0x01, 0, 0 };
  128. char disable_dying[] = { 0x90, 0xE9 };
  129. char enable_dying[] = { 0x0F, 0x84 };
  130. char enable_drowning[] = { 0x66, 0xFF, 0x46, 0x0C };
  131. char Can_get_1up[] = { 0xE8, 0x33, 0xFF, 0xFF, 0xFF };
  132. char CharSelScreen_position_orig1[] = { 0x89, 0x42, 0x24 };
  133. char CharSelScreen_position_orig2[] = { 0x89, 0x41, 0x24 };
  134. char invinsize[] = { 0xC7, 0x46, 0x2C, 0x9A, 0x99, 0x99, 0x3F, 0x90, 0x90 };
  135.  
  136. float LightDash_SuperDash = -100.0f;
  137. float Boost_SuperTornado = -100.0f;
  138. float LightAttackStatic = 0.0f;
  139. float LightAttackMoving = 8.0f;
  140. float LightAttackMoving_orig = 10.0f;
  141. float SuperLightAttackMoving = 12.0f;
  142. float LDringdist = 0.0f;
  143.  
  144. int LightAttackTimer = 0;
  145. int HangTimeLikeHeroes = 0;
  146. int OldEnemyBonus;
  147. int SpeedShoesCount = 0;
  148. int HomingSounds[]{ 762, 777, 778, 779 };
  149. int homing_reattack_timer = 0;
  150. int NOP_forced_out_speed = 0;
  151. int paused = 0;
  152. int rings_now_zero = 0;
  153. int shield_now_zero = 0;
  154. int invincibility_now_zero = 0;
  155. int OldRings;
  156. int OldLives;
  157. int OldSpeedShoesCount;
  158. int OldEnemyBonus2 = 0;
  159. int OldEnemyBonus3;
  160. int make_HA_false = 0;
  161. int restore_oldenemybonus3 = 0;
  162. int can_play_again = 0;
  163. int shield_level = 0;
  164. int FOV = 70;
  165.  
  166. ObjectMaster *auraobj = nullptr;
  167. ObjectMaster *trailobj = nullptr;
  168. ObjectMaster *hypersparkles = nullptr;
  169. CollisionInfo *oldcol = nullptr; //character change stuff
  170.  
  171. bool just_untransformed = false;
  172. bool gauge2_lv1 = false;
  173. bool gauge2_lv2 = false;
  174. bool gauge2_full = false;
  175. bool HUD_loaded = false;
  176. bool glow_down = false;
  177. bool lvl_glow_down = false;
  178. bool LV1_obtained = false;
  179. bool LV2_obtained = false;
  180. bool LV3_obtained = false;
  181. bool LV1_active = false;
  182. bool LV2_active = false;
  183. bool LV3_active = false;
  184. bool LV1_usable = false;
  185. bool LV2_usable = false;
  186. bool LV3_usable = false;
  187. bool sonic_lv1_glow_down = false;
  188. bool sonic_lv2_glow_down = false;
  189. bool sonic_lv3_glow_down = false;
  190. bool character_reset = false;
  191. bool is_sonic = false;
  192. bool is_tails = false;
  193. bool is_knuckles = false;
  194. bool is_shadow = false;
  195. bool is_amy = false;
  196. bool is_gamma = false;
  197. bool is_metalsonic = false;
  198. bool is_tailsdoll = false;
  199. bool is_metalknuckles = false;
  200. bool HUD_alpha_fix = false;
  201. bool sounds_reset = false;
  202. bool SONsounds_loaded = false;
  203. bool SHAsounds_loaded = false;
  204. bool MSsounds_loaded = false;
  205. bool PURPLE_GEM_active = false;
  206. bool black_shield_active = false;
  207. bool game_start_done = false;
  208. bool gamma_initialized = false;
  209.  
  210. bool sonic_model_loaded = false;
  211. bool sonic_init_loaded = false;
  212. bool shadow_init_loaded = false;
  213. bool metalsonic_init_loaded = false;
  214.  
  215. int Gauge;
  216. int OldGauge;
  217. int Gauge2;
  218. int OldGauge2;
  219. int Gaugebis;
  220. int OldGaugebis;
  221. int Gauge2bis;
  222. int OldGauge2bis;
  223. int OldRingsHUD;
  224. int can_animate_gain = 0;
  225. int can_animate_loss = 0;
  226. int zero_ring_alpha = 0;
  227. int energy_glow;
  228. int energy_lvl_glow;
  229. int lv1_stretch;
  230. int lv2_stretch;
  231. int lv3_stretch;
  232. int sonic_lv1_glow;
  233. int sonic_lv2_glow;
  234. int sonic_lv3_glow;
  235. int star_glow = 0;
  236. int circle_glow = 0;
  237. int level3_glow = 0;
  238. int sparkletimer = 0;
  239. int sparkleCBbolttimer = 0;
  240. int sparkleCBLV3timer = 0;
  241. float LV3alpha = 0.0f;
  242. int sparklegemstimer = 0;
  243. int sparklegems_tiny_timer = 0;
  244. int sparkleCBtimer = 0;
  245. int sparkleCB_tiny_timer = 0;
  246. int sparklechaosblasttimer = 0;
  247. int sparklechaosblast_tiny_timer = 0;
  248.  
  249. int draw = 0;
  250. int drawCB = 0;
  251. int checkH = 0;
  252. int checkV = 0;
  253.  
  254. short values[] = { 20, 20, 20, 20, 20, 20 };
  255. static float heat_float1 = 1.0f; //1
  256. static float heat_float2 = 0.2f; //0.5
  257.  
  258.  
  259.  
  260. //From SONIC
  261. bool air_boost_used = false;
  262. bool stomp_was_used = false;
  263. bool bouncing = false;
  264. bool stomp_was_used_twice = false;
  265. bool can_use_twice = false;
  266. bool B_or_X_pressed = false;
  267. bool bounce_attacking = false;
  268. bool lightdashflag = false;
  269. bool NoBoost_OnWater = false;
  270. bool is_hyper = false;
  271. bool transforming = false;
  272. bool just_transformed = false;
  273. bool is_boosting = false;
  274. bool is_flying = false;
  275. bool up_was_pressed = false;
  276. bool down_was_pressed = false;
  277. bool spincharging = false;
  278. bool no_LSA_sound = false;
  279. bool lightattacking = false;
  280. bool stop_flying = false;
  281. bool LSA_charged = false;
  282. bool no_boost_aura = false;
  283. bool bouncebracelet_obtained = false;
  284. bool flamering_obtained = false;
  285.  
  286.  
  287. char LightDashSpeedOUT_unNOP[] = { 0xC7, 0x47, 0x38, 0, 0, 0, 0 };
  288. char StompAnim[] = { 0x66, 0xC7, 0x87, 0x24, 0x01, 0, 0, 0x40, 0 };
  289. char HomingSpeed_Data[] = { 0xD9, 0x5F, 0x38 };
  290. char oldaction;
  291. char oldmusic;
  292. char jumpdashspeed1_hyper[] = { 0xC7, 0x47, 0x38, 0, 0, 0xE4, 0x40 };
  293. char jumpdashspeed1_super[] = { 0xC7, 0x47, 0x38, 0, 0, 0xD0, 0x40 };
  294. char jumpdashspeed2_hyper[] = { 0xC7, 0x47, 0x38, 0, 0, 0xE4, 0x40 };
  295. char jumpdashspeed2_super[] = { 0xC7, 0x47, 0x38, 0, 0, 0xD0, 0x40 };
  296. char SonicLSAcharged_RunSpeed[] = { 0xC7, 0x86, 0xAC, 0, 0, 0, 0, 0, 0x40, 0x40 }; //original 0000003F
  297. char SuperLSAcharged_RunSpeed[] = { 0xC7, 0x86, 0xAC, 0, 0, 0, 0, 0, 0xC0, 0x40 };
  298. char alpha = 0;
  299.  
  300. float SuperDash = 0.0f;
  301. float SuperTornado = 16.0f;
  302. float HyperLightAttackMoving = 16.0f;
  303. float ringdist = 100.0f;
  304. float ringmaxspeed = 16.0f;
  305. float LDringmaxspeed = 0.0f;
  306. float ringaccel = 0.052f;
  307. float ringspeedmultiplier = 1.0f;
  308. float average[2160000]{};//speedometer
  309. float dist = 0;
  310. float invinmult = 0.9;
  311. float SuperHomingSpeed = 6.0f;
  312. float HyperHomingSpeed = 7.0f;
  313. float mult = 5;
  314. float Testtt = 0.0f;
  315.  
  316. float S_GA_NO_B_NO_SS = 0.05f;
  317. float S_GA_NO_B_SS = 0.1f;
  318. float S_GA_B1_NO_SS = 0.225f;
  319. float S_GA_B2_NO_SS = 0.15f;
  320. float S_GA_B1_SS = 0.45f;
  321. float S_GA_B2_SS = 0.225f;
  322.  
  323. float SS_GA_NO_B_NO_SS = 0.085f;
  324. float SS_GA_NO_B_SS = 0.125f;
  325. float SS_GA_B1_NO_SS = 0.4f;
  326. float SS_GA_B2_NO_SS = 0.2f;
  327. float SS_GA_B1_SS = 0.6f;
  328. float SS_GA_B2_SS = 0.3f;
  329.  
  330. float HS_GA_NO_B_NO_SS = 0.11f;
  331. float HS_GA_NO_B_SS = 0.15f;
  332. float HS_GA_B1_NO_SS = 0.5f;
  333. float HS_GA_B2_NO_SS = 0.25f;
  334. float HS_GA_B1_SS = 0.75f;
  335. float HS_GA_B2_SS = 0.375f;
  336.  
  337. float S_MA_NO_B_NO_SS = 6.0f;
  338. float S_MA_NO_B_SS = 9.0f;
  339. float S_MA_B_NO_SS = 7.0f;
  340. float S_MA_B_SS = 10.5f;
  341.  
  342. float SS_MA_NO_B_NO_SS = 8.5f;
  343. float SS_MA_NO_B_SS = 12.75f;
  344. float SS_MA_B_NO_SS = 10.25f;
  345. float SS_MA_B_SS = 15.375f;
  346.  
  347. float HS_MA_NO_B_NO_SS = 10.5f;
  348. float HS_MA_NO_B_SS = 15.75f;
  349. float HS_MA_B_NO_SS = 13.5f;
  350. float HS_MA_B_SS = 20.25f;
  351.  
  352. float sonic_accel = 0.0f;
  353.  
  354. float GD_NO_B = -0.06f;
  355. float S_GD_B = 0.098f;
  356. float SS_GD_B = 0.143f;
  357. float HS_GD_B = 0.193f;
  358.  
  359. short oldcount;
  360.  
  361. int BoostSFX[]{ 780, 781 };
  362. int BoostVoices[]{ 770, 773, 776 };
  363. int SonicTrick3Timer1 = 0;
  364. int SonicTrick3Timer2 = 0;
  365. int BoostVarGrd = 0;
  366. int BoostVarAir = 0;
  367. int stompvar = 0;
  368. int stompvar2 = 0;
  369. int bouncevar = 0;
  370. int boostvoice = 0;
  371. int animation = 0;
  372. int average_index = 0;//speedometer
  373. int current_length = 0;
  374. int transforming_time = 0;
  375. int transform_anim = 0;
  376. int firstanim_speedup = 0;
  377. int untransforming = 0;
  378. int SUPERSONICSpinballtextures[] = { 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127 };
  379. int HYPERSONICSpinballtextures[] = { 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, 159 };
  380. int SONICBBtextures[] = { 391, 392, 393, 394, 393, 392 };
  381. int SONICFRtextures[] = { 395, 396, 397, 398, 399, 400, 400, 400, 400, 400, 400, 399, 398, 397, 396, 395 };
  382. int testvar = 0;
  383. int super_rings_depletion = 0;
  384. int hyper_rings_depletion = 0;
  385. int testvar3 = 0;
  386. int LSA_var = 0;
  387. int fly_then_ground = 0;
  388. int flying_to_NOTflying = 0;
  389.  
  390. short oldanim;
  391.  
  392.  
  393.  
  394.  
  395. //From SHADOW
  396. bool just_rolled = false;
  397. bool cant_punch_now = false;
  398. bool can_go_back_to_shadow = false;
  399. bool X_is_held = false;
  400. bool didnt_target = false;
  401. bool ready = false;
  402. bool cant_chaos_spear = false;
  403. bool cant_chaos_spear2 = false;
  404. bool is_CB = false;
  405. bool X_was_pressed = false;
  406. bool cant_chaos_spear_again = false;
  407. bool pressed_X_while_Gamma = false;
  408. bool DO_chaos_spear_again = false;
  409. bool cant_spindash = false;
  410. bool CS_launch_was_played = false;
  411. bool CS_charging_was_played = false;
  412. bool CS_empty_was_played = false;
  413. bool is_in_CS_state = false;
  414. bool X_was_released = false;
  415. bool has_homing_attacked = false;
  416. bool CB_lv1 = false;
  417. bool CB_lv2 = false;
  418. bool CB_lv3 = false;
  419. bool using_chaos_blast = false;
  420. bool transforming_CB = false;
  421. bool CHAOSBLAST_was_played = false;
  422. bool go_back_to_gameplay = false;
  423. bool do_multi_punch = false;
  424. bool has_punched_once = false;
  425. bool knuckles_teleport_to_sonic = false;
  426. bool knuckles_teleported_away = false;
  427. bool punching_1 = false;
  428. bool punching_2 = false;
  429. bool punching_3 = false;
  430. bool is_punching = false;
  431. bool can_run_again = false;
  432. bool shadow_sounds_back = false;
  433. bool stop_aim_everywhere = false;
  434.  
  435. char jumpdashspeed1[] = { 0xC7, 0x47, 0x38, 0, 0, 0xE0, 0x40 };
  436. char jumpdashspeed1_orig[] = { 0xC7, 0x47, 0x38, 0, 0, 0xA0, 0x40 };
  437. char jumpdashspeed2[] = { 0xC7, 0x47, 0x38, 0, 0, 0xE0, 0x40 };
  438. char jumpdashspeed2_orig[] = { 0xC7, 0x47, 0x38, 0, 0, 0xA0, 0x40 };
  439. char knuxattackdata[] = { 0x66, 0x89, 0xB2, 0x24, 0x01, 0, 0 };
  440. char knuxobjectcrash_NOP[] = { 0xB8, 0, 0, 0, 0 };
  441. char knuxobjectcrash_unNOP[] = { 0xE8, 0x7B, 0x0F, 0xF9, 0xFF };
  442. char jump_cancel_unNOP[] = { 0xC6, 0x06, 0x0C };
  443. char shadow3rdpunchspeed[] = { 0xC7, 0x47, 0x38, 0, 0, 0x00, 0x41 };
  444. char enable_GAMMAflashing[] = { 0x66, 0x89, 0x43, 0x06 };
  445. char supersonic_homingspeed[] = { 0xC7, 0x47, 0x38, 0, 0, 0xE0, 0x40 };
  446. char CB_LV1_stuff1[] = { 0xC6, 0x45, 0, 0x0C };
  447. char CB_LV1_stuff2[] = { 0x80, 0x65, 0x05, 0xFA };
  448. char CB_LV1_stuff3[] = { 0xD9, 0x5F, 0x38 };
  449.  
  450. float ChaosBoostLv1 = 7.0f;
  451. float UN_ChaosBoostLv1 = 5.0f;
  452. float CBHomingAttackStatic = 0.0f;
  453. float CBHomingAttackMoving = 7.0f;
  454. float missilespeed = 10.0f;
  455. float old_X_position;
  456. float old_Y_position;
  457. float old_Z_position;
  458. float OldBombRadius;
  459. float cbBLUEsize = 0.0f;
  460. float cbREDsize = 0.0f;
  461.  
  462. int CBHomingAttackTimer = 0;
  463. int ShadowTrick1Timer1 = 0;
  464. int ShadowTrick1Timer2 = 0;
  465. int ShadowTrick2Timer1 = 0;
  466. int ShadowTrick2Timer2 = 0;
  467. int ShadowTrick3Timer1 = 0;
  468. int ShadowTrick3Timer2 = 0;
  469. int SpindashNOPingTimer = 0;
  470. int punchattack = 0;
  471. int justrolled = 0;
  472. int no_longer_punching = 0;
  473. int backtoshadow1 = 0;
  474. int backtoshadow2 = 0;
  475. int LD_punch = 0;
  476. int no_z_speed = 0;
  477. int chaos_spear_stop = 0;
  478. int stop_supersonic = 0;
  479. int didnt_target_OK = 0;
  480. int can_chaos_spear_again = 0;
  481. int gonna_chaos_spear_again = 0;
  482. int X_gonna_be_unheld = 0;
  483. int transforming_CB_time = 0;
  484. int chaos_blast_active_timer = 0;
  485. int X_was_released_int = 0;
  486. int cant_release_X = 0;
  487. int anim_84_was_played = 0;
  488. int can_multi_punch = 0;
  489. int chaos_blast_radius_timer = 0;
  490. int will_punch = 0;
  491. int stopped_punching = 0;
  492. int knuckles_really_is_away = 0;
  493. int stop_punching = 0;
  494. int X_press = 0;
  495. int can_X_press = 0;
  496. int aim_everywhere = 0;
  497. int SHADOWCBfurtextures[] = { 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 314 };
  498. int SHADOWCBshoestextures[] = { 160, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 377, 376 };
  499. int SHADOWCBSpinballtextures[] = { 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248 };
  500. int SUPERSHADOWSpinballtextures[] = { 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280 };
  501. int SUPERSHADOWCBSpinballtextures[] = { 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312 };
  502. int anim84speed = 0;
  503. int chaosblasttex = 0;
  504. int transforming_CB_redball_time = 0;
  505. //int chaosblastBOLT0[] = { 433, 432, 432, 372, 433, 372, 431, 432, 372, 431, 432, 433, 433, 432, 431, 432 };
  506. //int chaosblastBOLT1[] = { 432, 431, 433, 372, 433, 372, 432, 372, 372, 433, 433, 372, 432, 372, 432, 433 };
  507. //int chaosblastBOLT2[] = { 432, 372, 372, 372, 372, 433, 432, 372, 432, 372, 372, 432, 431, 372, 433, 431 };
  508.  
  509. short oldcountSonic;
  510. short oldcountGamma;
  511. short oldcountKnux;
  512.  
  513.  
  514.  
  515. //From METALSONIC
  516. bool MagneticBarrierTakenOFF = false;
  517. bool full_barrier = false;
  518. bool fully_charged = false;
  519. bool cant_blaze_homing = false;
  520. bool blaze_homing_attacking = false;
  521. bool is_hovering = false;
  522. bool A_was_pressed = false;
  523. bool Z_WHITE_was_pressed = false;
  524. bool anim_was_17 = false;
  525. bool cant_playsound = false;
  526. bool has_played = false;
  527. bool sound_was_played = false;
  528. bool first_sound_played = false;
  529. bool _1238_was_played = false;
  530. bool _1239_was_played = false;
  531. bool _1240_was_played = false;
  532. bool _1241_was_played = false;
  533. bool _1242_was_played = false;
  534. bool no_jumping_sound = false;
  535. bool play_metal_charge_sound = false;
  536. bool can_use_dash = false;
  537. bool is_on_ground = false;
  538. bool do_dash = false;
  539. bool BLUE_GEM_active = false;
  540. bool BLUE_GEM_used = false;
  541. bool RED_GEM_active = false;
  542. bool RED_GEM_used = false;
  543. bool GREEN_GEM_active = false;
  544. bool GREEN_GEM_used = false;
  545. bool WHITE_GEM_active = false;
  546. bool SKY_GEM_active = false;
  547. bool stop_white_gem = false;
  548. bool YELLOW_GEM_active = false;
  549. bool cant_hover = false;
  550. bool reduce_invulnerable_time = false;
  551. bool gauge_auto_fill_ON = false;
  552. bool gauge_is_filling = false;
  553. bool black_shield_used = false;
  554. bool can_attack = false;
  555. bool spiiin_sound_played = false;
  556. bool can_charge = false;
  557. bool can_prepare_shield_timer = false;
  558. bool BHA_launch = false;
  559. bool from_white_to_fall = false;
  560. bool cant_use_yellow_gem = false;
  561. bool use_blaze_bomb = false;
  562. bool can_use_blaze_bomb = false;
  563. bool NJB_active = false;
  564. bool NJB_loaded = false;
  565.  
  566. char anim1data[] = { 0x66, 0xC7, 0x87, 0x24, 0x1, 0, 0, 0x40, 0 };
  567. char anim2data[] = { 0x66, 0xC7, 0x83, 0x24, 0x1, 0, 0, 0x14, 0 };
  568. char anim3data[] = { 0x66, 0xC7, 0x86, 0x24, 0x1, 0, 0, 0x09, 0 };
  569. char anim4data[] = { 0x66, 0xC7, 0x85, 0x24, 0x1, 0, 0, 0x12, 0 };
  570. char anim5data[] = { 0x66, 0xC7, 0x83, 0x24, 0x1, 0, 0, 0x01, 0 };
  571. char jumpdashdata1[] = { 0x80, 0x65, 0x5, 0xFA };
  572. char jumpdashdata2[] = { 0xC6, 0x45, 0, 0x08 };
  573. char jumpdashdata2_orig[] = { 0xC6, 0x45, 0, 0x0C };
  574. char jumpdashdata3[] = { 0x66, 0xC7, 0x83, 0x24, 0x1, 0, 0, 0x0E, 0 };
  575. char jumpdashdata3_orig[] = { 0x66, 0xC7, 0x83, 0x24, 0x1, 0, 0, 0x12, 0 };
  576. char blaze_lasting_time [] = { 0x66, 0x3D, 0xF0, 0x7F }; //orig 66 3D 68 01
  577. char amy_spinning_hammer_allow_stop[] = { 0x66, 0x89, 0xBB, 0x24, 0x01, 0, 0 };
  578. char amyobjectcrash_NOP[] = { 0xB8, 0, 0, 0, 0 };
  579. char amyobjectcrash_unNOP[] = { 0xE8, 0xF7, 0x0A, 0xF8, 0xFF };
  580. char Metal_HSpeed_data[] = { 0x89, 0x48, 0x3C };
  581. char Metal_VSpeed_data[] = { 0x89, 0x48, 0x38 };
  582.  
  583.  
  584. int charge_sound = 0;
  585. int backtometal = 0;
  586. int ObjCol = 0;
  587. int blaze_homing_timer = 0;
  588. int black_shield_timer = 0;
  589. int can_hover = 0;
  590. int MetalHoverStaticTimer = 0;
  591. int MetalHoverMovingTimer = 0;
  592. int can_hover_again = 0;
  593. int anim_can_be_32 = 0;
  594. int spinning_sound = 0;
  595. int SOUNDTEST = 0;
  596. int play_moving_sound = 0;
  597. int metal_dash_timer = 0;
  598. int do_dash_timer = 0;
  599. int metal_spinning_sound_timer = 0;
  600. int cant_hover_timer = 0;
  601. int tails_teleport_timer = 0;
  602. int tails_attack_timer = 0;
  603. int stop_supersonic_upgrade = 0;
  604. int gauge_auto_fill = 0;
  605. int can_use_spiiin_sound = 0;
  606. int white_to_NOTwhite = 0;
  607. int whiteON_then_ground = 0;
  608. int stop_LSA = 0;
  609. int use_fall_anim = 0;
  610. int stop_blaze_bomb = 0;
  611. int METALSONICFIRE_A_textures[] = { 346, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370 };
  612. int METALSONICFIRE_B_textures[] = { 347, 408, 409, 410, 411, 412, 413, 414 };
  613. int gemaura = 354;
  614. int blackshieldrotate = 0;
  615. int unload_NJB = 0;
  616.  
  617. float MetalSuperDash = 100.0f;
  618. float MetalSuperTornado = 100.0f;
  619. float MetalLightAttackMoving = 16.0f;
  620. float oldspeedx;
  621.  
  622. float MS_MA_NORMAL_NO_SS = 3.0f;
  623. float MS_MA_NORMAL_SS = 6.0f;
  624. float MS_MA_BLUE_NO_SS = 4.5f;
  625. float MS_MA_BLUE_SS = 9.0f;
  626. float MS_MA_GREEN_NO_SS = 4.5f;
  627. float MS_MA_GREEN_SS = 9.0f;
  628.  
  629. float MS_GA_NORMAL_NO_SS = 0.05f;
  630. float MS_GA_NORMAL_SS = 0.05f;
  631. float MS_GA_BLUE_NO_SS = 0.05f;
  632. float MS_GA_BLUE_SS = 0.05f;
  633. float MS_GA_GREEN_NO_SS = 0.05f;
  634. float MS_GA_GREEN_SS = 0.05f;
  635.  
  636. float MS_f68_NORMAL_NO_SS = 3.0f;
  637. float MS_f68_NORMAL_SS = 6.0f;
  638. float MS_f68_BLUE_NO_SS = -0.64125f;
  639. float MS_f68_BLUE_SS = -1.2825f;
  640. float MS_f68_GREEN_NO_SS = 4.5f;
  641. float MS_f68_GREEN_SS = 9.0f;
  642.  
  643. float MS_JS_NORMAL = 2.0f;
  644. float MS_JS_GREEN = 2.0f;
  645.  
  646. float MS_JAS_NORMAL = 0.05f;
  647. float MS_JAS_GREEN = 0.05f;
  648.  
  649. float MS_AA_NORMAL_NO_SS = 0.05f;
  650. float MS_AA_NORMAL_SS = 0.05f;
  651. float MS_AA_GREEN_NO_SS = 0.05f;
  652. float MS_AA_GREEN_SS = 0.05f;
  653. float MS_AA_WHITE_NO_SS_NO_Y = 0.02375f;
  654. float MS_AA_WHITE_SS_NO_Y = 0.03375f;
  655. float MS_AA_WHITE_NO_SS_Y = 0.0475f;
  656. float MS_AA_WHITE_SS_Y = 0.0675f;
  657.  
  658. float MS_AD_NORMAL = -0.005f;
  659. float MS_AD_GREEN = -0.005f;
  660. float MS_AD_WHITE = -0.0065f;
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.  
  669. //void __cdecl AddEnemyPoints(int points)
  670.  
  671. //{
  672. // int v1; // eax@2
  673. //
  674. // if (EnemyComboTimer <= 0)
  675. // {
  676. // EnemyComboPoints = 0;
  677. // }
  678. // v1 = EnemyComboPoints + 1;
  679. // if (v1 > 10)
  680. // {
  681. // v1 = 10;
  682. // }
  683. // EnemyComboPoints = v1;
  684. // EnemyComboTimer = 120;
  685. // switch (EnemyComboPoints)
  686. // {
  687. // case 1:
  688. // points = 100;
  689. // break;
  690. // case 2:
  691. // points = 200;
  692. // break;
  693. // case 3:
  694. // points = 300;
  695. // break;
  696. // case 4:
  697. // points = 400;
  698. // break;
  699. // case 5:
  700. // points = 500;
  701. // break;
  702. // case 6:
  703. // points = 600;
  704. // break;
  705. // case 7:
  706. // points = 800;
  707. // break;
  708. // case 8:
  709. // points = 1000;
  710. // break;
  711. // case 9:
  712. // points = 1500;
  713. // break;
  714. // default:
  715. // points = 2000;
  716. // break;
  717. // }
  718. // EnemyBonus += points;
  719. //}
  720.  
  721.  
  722. //Timer bonus points
  723. float __cdecl GetTimeBonus_r()
  724. {
  725. double result; // st7@3
  726.  
  727. if (GetCurrentCharacterID() == Characters_Gamma)
  728. {
  729. if (TimeMinutes < 3)
  730. {
  731. return (double)(TimeSeconds + 60 * TimeMinutes) * 25.0;
  732. }
  733. return 5000.0;
  734. }
  735. if (!TimeMinutes)
  736. {
  737. return 10000.0;
  738. }
  739. result = 10000.0 - (double)(TimeSeconds + 60 * (TimeMinutes - 1)) * 20.0;
  740. if (result < 0.0)
  741. {
  742. result = 0.0;
  743. }
  744. return result;
  745. }
  746.  
  747.  
  748. //For Metal's Yellow Shield
  749. ObjectMaster *magobj = nullptr;
  750. void __cdecl GiveMagneticBarrier_r(char character)
  751. {
  752. if (character >= 1 && character > 7 && !EntityData1Ptrs[character])
  753. character = 0;
  754. CharObj2 *co2 = CharObj2Ptrs[character];
  755. if (co2 && !(co2->Powerups & Powerups_MagneticBarrier))
  756. {
  757. if (shield_level == 1)
  758. {
  759. co2->Powerups &= ~Powerups_Barrier;
  760. co2->Powerups |= Powerups_MagneticBarrier;
  761. shield_level = 2;
  762. }
  763. else
  764. {
  765. magobj = LoadObject(LoadObj_Data1, 2, MagneticBarrier_Load);
  766. if (magobj)
  767. {
  768. magobj->Data1->CharIndex = character;
  769. co2->Powerups &= ~Powerups_Barrier;
  770. co2->Powerups |= Powerups_MagneticBarrier;
  771. }
  772. }
  773. }
  774. }
  775.  
  776.  
  777. //For Ingame Soundbanks Change
  778. SoundFileInfo SONSoundFiles[] = {
  779. { 0, "SON_COMMON_BANK00" },
  780. { 2, "SON_check_sheet_bank02" },
  781. { 3, "SON_P_SONICTAILS_BANK03" },
  782. { 6, "SON_V_SONICTAILS_E_BANK06" }
  783. };
  784.  
  785. SoundFileInfo SHASoundFiles[] = {
  786. { 0, "SHA_COMMON_BANK00" },
  787. { 2, "SHA_check_sheet_bank02" },
  788. { 3, "SHA_P_SONICTAILS_BANK03" },
  789. { 6, "SHA_V_SONICTAILS_E_BANK06" }
  790. };
  791.  
  792. SoundFileInfo MSSoundFiles[] = {
  793. { 0, "MS_COMMON_BANK00" },
  794. { 2, "MS_check_sheet_bank02" },
  795. { 3, "MS_P_SONICTAILS_BANK03" },
  796. { 6, "MS_V_SONICTAILS_E_BANK06" }
  797. };
  798.  
  799. SoundList SONSoundList = { arraylengthandptrT(SONSoundFiles, int) };
  800. SoundList SHASoundList = { arraylengthandptrT(SHASoundFiles, int) };
  801. SoundList MSSoundList = { arraylengthandptrT(MSSoundFiles, int) };
  802.  
  803. int SONSoundListID = -1;
  804. int SHASoundListID = -1;
  805. int MSSoundListID = -1;
  806.  
  807.  
  808.  
  809. //SA2 jumpball //njRotateY(nullptr, rotation_variable); *********** for metal's black shield
  810. NJS_VECTOR Sonic_Previous_Positions[6];
  811. int Sonic_Position_Index;
  812. void SA2_jumpball(EntityData1 *a1, CharObj2 *a2)
  813. {
  814. if (GameState == 4/* || EntityData1Ptrs[0]->Action != 8*/)
  815. {
  816. for (int i = 0; i < LengthOfArray(Sonic_Previous_Positions); i++)
  817. Sonic_Previous_Positions[i] = a1->Position;
  818. Sonic_Position_Index = 0;
  819. }
  820. if (EntityData1Ptrs[0]->Action == 8 && (a2->AnimationThing.Index == 14 || a2->AnimationThing.Index == 32) && !is_boosting && !bounce_attacking && !bouncing/* && (GameState == 4 || GameState == 15)*/)
  821. {
  822. njSetTexture((NJS_TEXLIST*)0x927CB8);
  823. HMODULE moduleHandle = GetModuleHandle(L"CHRMODELS_orig");
  824. NJS_OBJECT **___SONIC_OBJECTS = (NJS_OBJECT**)GetProcAddress(moduleHandle, "___SONIC_OBJECTS");
  825. int pos_index = Sonic_Position_Index - 1;
  826. if (pos_index < 0) pos_index += LengthOfArray(Sonic_Previous_Positions);
  827. njPushMatrix(nullptr);
  828. njTranslateV(nullptr, &Sonic_Previous_Positions[pos_index]);
  829. njTranslate(nullptr, 0, 5, 0);
  830. njRotateX(nullptr, Camera_Data1->Rotation.x);
  831. njRotateY(nullptr, Camera_Data1->Rotation.y);
  832. njRotateZ(nullptr, Camera_Data1->Rotation.z);
  833. njScale(nullptr, 1.15f, 1.15f, 1.15f);
  834. ProcessModelNode_B(___SONIC_OBJECTS[56], 1);
  835. njPopMatrix(1);
  836. pos_index -= 1;
  837. if (pos_index < 0) pos_index += LengthOfArray(Sonic_Previous_Positions);
  838. njPushMatrix(nullptr);
  839. njTranslateV(nullptr, &Sonic_Previous_Positions[pos_index]);
  840. njTranslate(nullptr, 0, 5, 0);
  841. njRotateX(nullptr, Camera_Data1->Rotation.x);
  842. njRotateY(nullptr, Camera_Data1->Rotation.y);
  843. njRotateZ(nullptr, Camera_Data1->Rotation.z);
  844. njScale(nullptr, 0.8625f, 0.8625f, 0.8625f);
  845. ProcessModelNode_B(___SONIC_OBJECTS[56], 1);
  846. njPopMatrix(1);
  847. pos_index -= 1;
  848. if (pos_index < 0) pos_index += LengthOfArray(Sonic_Previous_Positions);
  849. njPushMatrix(nullptr);
  850. njTranslateV(nullptr, &Sonic_Previous_Positions[pos_index]);
  851. njTranslate(nullptr, 0, 5, 0);
  852. njRotateX(nullptr, Camera_Data1->Rotation.x);
  853. njRotateY(nullptr, Camera_Data1->Rotation.y);
  854. njRotateZ(nullptr, Camera_Data1->Rotation.z);
  855. njScale(nullptr, 0.575f, 0.575f, 0.575f);
  856. ProcessModelNode_B(___SONIC_OBJECTS[56], 1);
  857. njPopMatrix(1);
  858. }
  859. Sonic_Previous_Positions[Sonic_Position_Index++] = a1->Position;
  860. Sonic_Position_Index %= LengthOfArray(Sonic_Previous_Positions);
  861. }
  862.  
  863.  
  864.  
  865. //ObjectFunc(sub_441D50, 0x441D50);
  866. void SetSpeedShoes(ObjectMaster *obj)
  867. {
  868. SpeedShoesCount++;
  869. sub_441D50(obj);
  870. }
  871.  
  872. //ObjectFunc(sub_441D10, 0x441D10);
  873. void UnsetSpeedShoes(ObjectMaster *obj)
  874. {
  875. if (SpeedShoesCount > 0)
  876. SpeedShoesCount--;
  877. sub_441D10(obj);
  878. }
  879.  
  880. void SetInvincible(ObjectMaster *obj)
  881. {
  882. was_invincible_before = true;
  883. RunObjectChildren(obj);
  884. }
  885.  
  886. void UnsetInvincible(ObjectMaster *obj)
  887. {
  888. was_invincible_before = false;
  889. CheckThingButThenDeleteObject(obj);
  890. }
  891.  
  892. void PlayHomingSound() { PlaySound(HomingSounds[rand() % 4], 0, 0, 0); }
  893.  
  894.  
  895. void MetalSonic_AfterImage_Display_r(ObjectMaster *obj)
  896. {
  897. njSetTexture((NJS_TEXLIST*)0x91CB58);
  898. MetalSonic_AfterImage_Display(obj);
  899. }
  900.  
  901.  
  902.  
  903. //Variable Reset Function
  904. void VariablesReset()
  905. {
  906. EntityData1* co1 = EntityData1Ptrs[0];
  907. CharObj2 *co2 = GetCharObj2(0);
  908.  
  909. ((AnimData_t*)0x3C56210)[0].Property = 3;
  910. ((AnimData_t*)0x3C56210)[0].AnimationSpeed = 0.5;
  911. ((AnimData_t*)0x3C56210)[1].Property = 4;
  912. ((AnimData_t*)0x3C56210)[1].AnimationSpeed = 0.25;
  913. ((AnimData_t*)0x3C56210)[1].TransitionSpeed = 0.25;
  914. ((AnimData_t*)0x3C56210)[2].Property = 3;
  915. ((AnimData_t*)0x3C56210)[2].AnimationSpeed = 0.25;
  916. ((AnimData_t*)0x3C56210)[2].TransitionSpeed = 0.25;
  917. ((AnimData_t*)0x3C56210)[3].Property = 4;
  918. ((AnimData_t*)0x3C56210)[3].AnimationSpeed = 1.0;
  919. ((AnimData_t*)0x3C56210)[4].Property = 4;
  920. ((AnimData_t*)0x3C56210)[4].AnimationSpeed = 0.25;
  921. ((AnimData_t*)0x3C56210)[5].Property = 4;
  922. ((AnimData_t*)0x3C56210)[5].AnimationSpeed = 0.25;
  923. ((AnimData_t*)0x3C56210)[6].Property = 6;
  924. ((AnimData_t*)0x3C56210)[6].AnimationSpeed = 0.25;
  925. ((AnimData_t*)0x3C56210)[9].Property = 10;
  926. ((AnimData_t*)0x3C56210)[9].AnimationSpeed = 3.4;
  927. ((AnimData_t*)0x3C56210)[10].Property = 10;
  928. ((AnimData_t*)0x3C56210)[10].AnimationSpeed = 1.4;
  929. ((AnimData_t*)0x3C56210)[11].Property = 10;
  930. ((AnimData_t*)0x3C56210)[11].AnimationSpeed = 0.8;
  931. ((AnimData_t*)0x3C56210)[12].Property = 10;
  932. ((AnimData_t*)0x3C56210)[12].AnimationSpeed = 0.5;
  933. ((AnimData_t*)0x3C56210)[13].Property = 9;
  934. ((AnimData_t*)0x3C56210)[13].AnimationSpeed = 0.5;
  935. ((AnimData_t*)0x3C56210)[14].Property = 10;
  936. ((AnimData_t*)0x3C56210)[14].AnimationSpeed = 0.2;
  937. ((AnimData_t*)0x3C49D90)[15].Property = 9;
  938. ((AnimData_t*)0x3C56210)[15].AnimationSpeed = 0.7;
  939. ((AnimData_t*)0x3C56210)[18].AnimationSpeed = 1;
  940. ((AnimData_t*)0x3C56210)[18].TransitionSpeed = 0.25;
  941. ((AnimData_t*)0x3C56210)[27].AnimationSpeed = 1.0;
  942. ((AnimData_t*)0x3C56210)[28].AnimationSpeed = 1.0;
  943. ((AnimData_t*)0x3C56210)[29].AnimationSpeed = 1.0;
  944. ((AnimData_t*)0x3C56210)[31].TransitionSpeed = 0.0625;
  945. ((AnimData_t*)0x3C56210)[34].Property = 3;
  946. ((AnimData_t*)0x3C56210)[34].AnimationSpeed = 1.0;
  947. ((AnimData_t*)0x3C56210)[38].Property = 3;
  948. ((AnimData_t*)0x3C56210)[38].AnimationSpeed = 1;
  949. ((AnimData_t*)0x3C56210)[40].AnimationSpeed = 1;
  950. ((AnimData_t*)0x3C56210)[42].AnimationSpeed = 1;
  951. ((AnimData_t*)0x3C56210)[54].AnimationSpeed = 0.5;
  952. ((AnimData_t*)0x3C56210)[64].TransitionSpeed = 1.0;
  953. ((AnimData_t*)0x3C56210)[64].AnimationSpeed = 1.0;
  954. ((AnimData_t*)0x3C56210)[75].AnimationSpeed = 1.0;
  955. ((AnimData_t*)0x3C56210)[84].AnimationSpeed = 0.25;
  956. ((AnimData_t*)0x3C56210)[85].AnimationSpeed = 0.5;
  957. ((AnimData_t*)0x3C56210)[116].AnimationSpeed = 0.85;
  958. ((AnimData_t*)0x3C56210)[117].AnimationSpeed = 0.85;
  959. ((AnimData_t*)0x3C56210)[119].AnimationSpeed = 0.85;
  960. ((AnimData_t*)0x3C56210)[135].AnimationSpeed = 0.5;
  961.  
  962.  
  963. //CHANGE ALL THOSE WITH THE ONES BELOW IN THE GAMEPLAY CPPS
  964. PhysicsArray[Characters_Sonic].Run1 = 2.3;
  965. PhysicsArray[Characters_Sonic].Run2 = 5.09;
  966. PhysicsArray[Characters_Sonic].HangTime = 60;
  967. PhysicsArray[Characters_Sonic].MaxAccel = 3.0;
  968. PhysicsArray[Characters_Sonic].field_68 = -0.2825;
  969. PhysicsArray[Characters_Sonic].GroundAccel = 0.05;
  970. PhysicsArray[Characters_Sonic].JumpSpeed = 1.66;
  971. PhysicsArray[Characters_Sonic].AirAccel = 0.031;
  972. PhysicsArray[Characters_Sonic].AirBrake = -0.17;
  973.  
  974.  
  975.  
  976. co2->PhysicsData.MaxAccel = 3.0;
  977. co2->PhysicsData.HangTime = 60;
  978. co2->PhysicsData.Brake = -0.18;
  979. co2->PhysicsData.RollDecel = -0.008;
  980. co2->PhysicsData.RollCancel = 0.46;
  981. co2->PhysicsData.RollEnd = 1.39;
  982. co2->PhysicsData.Run1 = 2.3;
  983. co2->PhysicsData.Run2 = 5.09;
  984. co2->PhysicsData.AirDecel = -0.028;
  985. co2->PhysicsData.YOff = 5.4;
  986. co2->PhysicsData.JumpSpeed = 1.66;
  987. co2->PhysicsData.JumpAddSpeed = 0.076;
  988. co2->PhysicsData.AirAccel = 0.031;
  989. co2->PhysicsData.RippleSize = 4;
  990. co2->PhysicsData.Gravity = 0.08;
  991. co2->PhysicsData.field_68 = -0.2825;
  992. co2->PhysicsData.GroundAccel = 0.05;
  993. co2->PhysicsData.GroundDecel = -0.06;
  994.  
  995.  
  996.  
  997.  
  998. WriteData((float**)0x4B9D1E, &invinmult_orig);
  999. WriteData((void*)0x4BA276, invinsize_orig);
  1000. WriteData((void*)0x4BA280, invin_stuff_unNOP);
  1001. WriteData((void*)0x44AE9A, enable_dying);
  1002. WriteData((void*)0x446FBB, enable_drowning);
  1003. WriteData((void*)0x43CC72, gravity_orig);
  1004. WriteData((void*)0x4951BE, rollingdata);
  1005. WriteData((void*)0x49234D, homingoutspeed_orig);
  1006. WriteData((void*)0x497CB5, homingstuff_orig);
  1007. WriteData((void*)0x497CC2, homingaction_orig);
  1008. WriteData((float*)0x496F23, (float)2.0f);
  1009. WriteData((float*)0x7DCB34, (float)10.0f);
  1010. WriteData((float*)0x7DD550, (float)0.4f);
  1011. WriteData((void*)0x4C4DA9, enable_aiming);
  1012. WriteData((void*)0x4C475B, enable_shooting);
  1013. WriteData((void*)0x4C4643, shooting05_unNOP);
  1014. WriteData((float**)0x4C41CD, &missilespeed_orig);
  1015. WriteData((float**)0x4C41DC, &missilespeed_orig);
  1016. WriteData((float**)0x4C41E8, &missilespeed_orig);
  1017. WriteData((char*)Sonic_Display, (char)0x8B);
  1018. WriteData((char*)Knuckles_Display, (char)0x83);
  1019. WriteData((char*)0x4977AB, (char)0x74);//Allows homing attack
  1020. WriteData((void*)0x4976FF, landing_NOattack1_unNOP);
  1021. WriteData((void*)0x497741, landing_NOattack2_unNOP);
  1022. WriteData((void*)0x497756, landing_NOattack3_unNOP);
  1023. WriteData((void*)0x49777A, landing_NOattack4_unNOP);
  1024. WriteData((void*)0x494AF9, balldata);
  1025. WriteData((void*)0x4496E1, WalkOnWaterData);
  1026. WriteData((void*)0x496EF8, SpindashData);
  1027. WriteData((void*)0x43CBC9, gravity_underwater_orig);
  1028. WriteData((void*)0x47419A, shadow3rdpunchspeed_orig);
  1029. WriteData((char*)0x47824B, (char)0x74);
  1030. WriteData((void*)0x497013, enable_SONIC_KNUXflashing);
  1031. WriteData((void*)0x494C56, jumpdashspeed1_normal);
  1032. WriteData((void*)0x494C2C, jumpdashspeed2_normal);
  1033. WriteData((float**)0x0049265F, &NormalHomingSpeed);
  1034. WriteData((short*)0x4C4E34, (short)180);//Gamma infinite aiming laser timer
  1035. WriteData((void*)0x43C55D, HSpeed_data);
  1036. WriteData((void*)0x43C560, VSpeed_data);
  1037. WriteData((void*)0x4916DB, to_standing_data);
  1038. WriteData((short*)0x497A88, (short)1);
  1039. WriteData((short*)0x49773F, (short)2);
  1040. WriteData((short*)0x4916FF, (short)4);
  1041. WriteData((short*)0x495E46, (short)9);
  1042. WriteData((short*)0x495E2C, (short)10);
  1043. WriteData((short*)0x495BDA, (short)11);
  1044. WriteData((short*)0x495B44, (short)12);
  1045. WriteData((short*)0x495C27, (short)13);
  1046. WriteData((void*)0x4950D9, SonicLSAcharged_RunSpeed_orig);
  1047. WriteData((void*)0x44FABF, always_attract_rings_unNOP);
  1048. WriteData((void*)0x493047, LightDash_unNOP);
  1049. WriteData((void*)0x49308D, LSA_sound);
  1050. WriteData((void*)0x49AF36, LightDashTrail_unNOP);
  1051. WriteData((float**)0x492A3B, &LightAttackMoving_orig);
  1052. WriteData((float**)0x492A4F, &LightAttackMoving_orig);
  1053. WriteData((float**)0x492A6A, &LightAttackMoving_orig);
  1054. WriteData((void*)0x43BFCB, HangTimeCheckData);
  1055. WriteData((void*)0x4951D5, spindash_outspeed_orig);
  1056. WriteData((void*)0x497B81, blaze_lasting_time_orig);
  1057. WriteData((void*)0x4930F9, rollingweirdfix1);
  1058. WriteData((void*)0x4916DB, rollingweirdfix2);
  1059. WriteData((void*)0x49876D, unknown_49876D);
  1060. WriteData((void*)0x492F73, unknown_492F73);
  1061. WriteData((void*)0x55E95C, unknown_55E95C);
  1062. WriteData((void*)0x444103, unknown_444103);
  1063. WriteData((void*)0x493067, unknown_493067);
  1064. WriteData((void*)0x492CAE, unknown_492CAE);
  1065. WriteData((void*)0x4975AC, unknown_4975AC);
  1066. WriteData((void*)0x49304C, unknown_49304C);
  1067. WriteData((void*)0x460EA6, unknown_460EA6);
  1068. WriteData((void*)0x4950A9, unknown_4950A9);
  1069. //WriteData((void*)0x492F68, unknown_492F68);
  1070. WriteData((char*)0x492F6A, (char)0x0C);
  1071. WriteData((void*)0x4975BC, unknown_4975BC);
  1072. WriteData((void*)0x494C19, unknown_494C19);
  1073. WriteData((float*)0x44FBDD, ringmaxspeed_orig);
  1074. WriteData((char*)0x496EF6, (char)0x74);
  1075. WriteData((char*)0x4C09F9, (char)0x75);
  1076. WriteData((char*)0x498763, (char)0x0C);
  1077. WriteData((char*)0x4CEA60, (char)0x8B);
  1078. WriteData((char*)0x4976AD, (char)0x75);
  1079. WriteData((char*)0x49309C, (char)0x75);
  1080. WriteData((char*)0x4975A2, (char)13);
  1081. WriteData((short*)0x49305C, (short)10);
  1082. WriteData((short*)0x4975B3, (short)20);
  1083. WriteData((short*)0x495097, (short)210);
  1084. WriteData((short*)0x495156, (short)300);
  1085. WriteData((short*)0x494FDC, (short)18);
  1086. WriteData((short*)0x497CC0, (short)18);
  1087. WriteData((short*)0x4BA46D, (short)1380);//invincibility timer
  1088. WriteData((short*)0x497754, (short)19);
  1089. WriteData((short*)0x49691F, (short)0);
  1090. WriteData((short*)0x4984A3, (short)74);
  1091. WriteData((short*)0x49629E, (short)44);
  1092. WriteData((short*)0x4962BF, (short)45);
  1093. WriteData((short*)0x4951D3, (short)15);
  1094. WriteData((float*)0x44FBBA, 50.0f);
  1095. WriteData((float*)0x492FEB, (float)0.0f);
  1096. WriteData((float**)0x44FAFF, (float*)0x7DD574);
  1097. WriteData((float**)0x44FBC4, (float*)0x7E05C4);
  1098. WriteData((float**)0x44FBCE, (float*)0x7DCCFC);
  1099. WriteData((float**)0x44FC2A, (float*)0x7DCC98);
  1100. WriteData((void*)0x55E6F5, SuperSplashAura);
  1101. WriteData((void*)0x55E7A8, SuperSplashData);
  1102. WriteData((void*)0x55EEBF, SuperSplashScale);
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118. //Shared variables
  1119. r = false;
  1120. fall_after_roll = false;
  1121. homing = false;
  1122. just_homing_attacked = false;
  1123. in_air_after_homing = false;
  1124. dashing = false;
  1125. no_longer_dashing = false;
  1126. was_on_trampoline = false;
  1127. was_invincible_before = false;
  1128. LightDash_SuperDash_ON = false;
  1129. just_flipped = false;
  1130. just_spindashed = false;
  1131. no_light_attack = false;
  1132. Z_was_pressed_on_ground = false;
  1133. Z_was_pressed_in_air = false;
  1134. was_on_ground = false;
  1135. LSA_launch = false;
  1136. LSA_used = false;
  1137. ok = false;
  1138. is_paused = false;
  1139. LD_fix = false;
  1140. GO_sound_played = false;
  1141. //BLUE_GEM_ON = false;
  1142. //RED_GEM_ON = false;
  1143. //GREEN_GEM_ON = false;
  1144. //PURPLE_GEM_ON = false;
  1145. //SKY_GEM_ON = false;
  1146. //WHITE_GEM_ON = false;
  1147. //YELLOW_GEM_ON = false;
  1148. //NO_GEM_ON = false;
  1149. has_rings = false;
  1150. has_shield = false;
  1151. has_invincibility = false;
  1152. was_hit = false;
  1153. gauge_full = false;
  1154. homing_attacking = false;
  1155. cant_play_again = false;
  1156. just_charged = false;
  1157. CB_active = false;
  1158. is_super = false;
  1159. punching = false;
  1160. PURPLE_GEM_used = false;
  1161. stop_sky_gem = false;
  1162.  
  1163.  
  1164. LightDash_SuperDash = -100.0f;
  1165. Boost_SuperTornado = -100.0f;
  1166. LightAttackStatic = 0.0f;
  1167. LightAttackMoving = 8.0f;
  1168. LightAttackMoving_orig = 10.0f;
  1169. SuperLightAttackMoving = 12.0f;
  1170. LDringdist = 0.0f;
  1171.  
  1172. LightAttackTimer = 0;
  1173. HangTimeLikeHeroes = 0;
  1174. SpeedShoesCount = 0;
  1175. homing_reattack_timer = 0;
  1176. NOP_forced_out_speed = 0;
  1177. paused = 0;
  1178. rings_now_zero = 0;
  1179. shield_now_zero = 0;
  1180. invincibility_now_zero = 0;
  1181. OldRings;
  1182. OldLives;
  1183. OldSpeedShoesCount;
  1184. OldEnemyBonus2 = 0;
  1185. OldEnemyBonus3;
  1186. make_HA_false = 0;
  1187. restore_oldenemybonus3 = 0;
  1188. can_play_again = 0;
  1189. shield_level = 0;
  1190. FOV = 70;
  1191.  
  1192. just_untransformed = false;
  1193. gauge2_lv1 = false;
  1194. gauge2_lv2 = false;
  1195. gauge2_full = false;
  1196. HUD_loaded = false;
  1197. glow_down = false;
  1198. lvl_glow_down = false;
  1199. LV1_obtained = false;
  1200. LV2_obtained = false;
  1201. LV3_obtained = false;
  1202. LV1_active = false;
  1203. LV2_active = false;
  1204. LV3_active = false;
  1205. LV1_usable = false;
  1206. LV2_usable = false;
  1207. LV3_usable = false;
  1208. sonic_lv1_glow_down = false;
  1209. sonic_lv2_glow_down = false;
  1210. sonic_lv3_glow_down = false;
  1211. character_reset = false;
  1212. is_sonic = false;
  1213. is_tails = false;
  1214. is_knuckles = false;
  1215. is_shadow = false;
  1216. is_amy = false;
  1217. is_gamma = false;
  1218. is_metalsonic = false;
  1219. is_tailsdoll = false;
  1220. is_metalknuckles = false;
  1221. HUD_alpha_fix = false;
  1222. sounds_reset = false;
  1223. SONsounds_loaded = false;
  1224. SHAsounds_loaded = false;
  1225. MSsounds_loaded = false;
  1226. PURPLE_GEM_active = false;
  1227. black_shield_active = false;
  1228.  
  1229. sonic_model_loaded = false;
  1230. sonic_init_loaded = false;
  1231. shadow_init_loaded = false;
  1232. metalsonic_init_loaded = false;
  1233.  
  1234. Gauge;
  1235. OldGauge;
  1236. Gauge2;
  1237. OldGauge2;
  1238. Gaugebis;
  1239. OldGaugebis;
  1240. Gauge2bis;
  1241. OldGauge2bis;
  1242. OldRingsHUD;
  1243. can_animate_gain = 0;
  1244. can_animate_loss = 0;
  1245. zero_ring_alpha = 0;
  1246. energy_glow;
  1247. energy_lvl_glow;
  1248. lv1_stretch;
  1249. lv2_stretch;
  1250. lv3_stretch;
  1251. sonic_lv1_glow;
  1252. sonic_lv2_glow;
  1253. sonic_lv3_glow;
  1254. star_glow = 0;
  1255. circle_glow = 0;
  1256. level3_glow = 0;
  1257. sparkletimer = 0;
  1258. sparkleCBbolttimer = 0;
  1259. sparkleCBLV3timer = 0;
  1260. LV3alpha = 0.0f;
  1261. sparklegemstimer = 0;
  1262. sparklegems_tiny_timer = 0;
  1263. sparkleCBtimer = 0;
  1264. sparkleCB_tiny_timer = 0;
  1265. sparklechaosblasttimer = 0;
  1266. sparklechaosblast_tiny_timer = 0;
  1267.  
  1268.  
  1269.  
  1270. //From SONIC
  1271. air_boost_used = false;
  1272. stomp_was_used = false;
  1273. bouncing = false;
  1274. stomp_was_used_twice = false;
  1275. can_use_twice = false;
  1276. B_or_X_pressed = false;
  1277. bounce_attacking = false;
  1278. lightdashflag = false;
  1279. NoBoost_OnWater = false;
  1280. is_hyper = false;
  1281. transforming = false;
  1282. just_transformed = false;
  1283. is_boosting = false;
  1284. is_flying = false;
  1285. up_was_pressed = false;
  1286. down_was_pressed = false;
  1287. spincharging = false;
  1288. no_LSA_sound = false;
  1289. lightattacking = false;
  1290. stop_flying = false;
  1291. LSA_charged = false;
  1292. no_boost_aura = false;
  1293. bouncebracelet_obtained = false;
  1294. flamering_obtained = false;
  1295.  
  1296.  
  1297.  
  1298. SonicTrick3Timer1 = 0;
  1299. SonicTrick3Timer2 = 0;
  1300. BoostVarGrd = 0;
  1301. BoostVarAir = 0;
  1302. stompvar = 0;
  1303. stompvar2 = 0;
  1304. bouncevar = 0;
  1305. boostvoice = 0;
  1306. animation = 0;
  1307. transforming_time = 0;
  1308. transform_anim = 0;
  1309. firstanim_speedup = 0;
  1310. untransforming = 0;
  1311. testvar = 0;
  1312. super_rings_depletion = 0;
  1313. hyper_rings_depletion = 0;
  1314. testvar3 = 0;
  1315. LSA_var = 0;
  1316. fly_then_ground = 0;
  1317. flying_to_NOTflying = 0;
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323. //From SHADOW
  1324. just_rolled = false;
  1325. cant_punch_now = false;
  1326. can_go_back_to_shadow = false;
  1327. X_is_held = false;
  1328. didnt_target = false;
  1329. ready = false;
  1330. cant_chaos_spear = false;
  1331. cant_chaos_spear2 = false;
  1332. is_CB = false;
  1333. X_was_pressed = false;
  1334. cant_chaos_spear_again = false;
  1335. pressed_X_while_Gamma = false;
  1336. DO_chaos_spear_again = false;
  1337. cant_spindash = false;
  1338. CS_launch_was_played = false;
  1339. CS_charging_was_played = false;
  1340. CS_empty_was_played = false;
  1341. is_in_CS_state = false;
  1342. X_was_released = false;
  1343. has_homing_attacked = false;
  1344. CB_lv1 = false;
  1345. CB_lv2 = false;
  1346. CB_lv3 = false;
  1347. using_chaos_blast = false;
  1348. transforming_CB = false;
  1349. CHAOSBLAST_was_played = false;
  1350. go_back_to_gameplay = false;
  1351. do_multi_punch = false;
  1352. has_punched_once = false;
  1353. knuckles_teleport_to_sonic = false;
  1354. knuckles_teleported_away = false;
  1355. punching_1 = false;
  1356. punching_2 = false;
  1357. punching_3 = false;
  1358. is_punching = false;
  1359. can_run_again = false;
  1360. shadow_sounds_back = false;
  1361. stop_aim_everywhere = false;
  1362.  
  1363. CBHomingAttackTimer = 0;
  1364. ShadowTrick1Timer1 = 0;
  1365. ShadowTrick1Timer2 = 0;
  1366. ShadowTrick2Timer1 = 0;
  1367. ShadowTrick2Timer2 = 0;
  1368. ShadowTrick3Timer1 = 0;
  1369. ShadowTrick3Timer2 = 0;
  1370. SpindashNOPingTimer = 0;
  1371. punchattack = 0;
  1372. justrolled = 0;
  1373. no_longer_punching = 0;
  1374. backtoshadow1 = 0;
  1375. backtoshadow2 = 0;
  1376. LD_punch = 0;
  1377. no_z_speed = 0;
  1378. chaos_spear_stop = 0;
  1379. stop_supersonic = 0;
  1380. didnt_target_OK = 0;
  1381. can_chaos_spear_again = 0;
  1382. gonna_chaos_spear_again = 0;
  1383. X_gonna_be_unheld = 0;
  1384. transforming_CB_time = 0;
  1385. chaos_blast_active_timer = 0;
  1386. X_was_released_int = 0;
  1387. cant_release_X = 0;
  1388. anim_84_was_played = 0;
  1389. can_multi_punch = 0;
  1390. chaos_blast_radius_timer = 0;
  1391. will_punch = 0;
  1392. stopped_punching = 0;
  1393. knuckles_really_is_away = 0;
  1394. stop_punching = 0;
  1395. X_press = 0;
  1396. can_X_press = 0;
  1397. aim_everywhere = 0;
  1398. cbBLUEsize = 0.0;
  1399. cbREDsize = 0.0;
  1400. chaosblasttex = 0;
  1401. transforming_CB_redball_time = 0;
  1402.  
  1403.  
  1404. //From METALSONIC
  1405. MagneticBarrierTakenOFF = false;
  1406. full_barrier = false;
  1407. fully_charged = false;
  1408. cant_blaze_homing = false;
  1409. blaze_homing_attacking = false;
  1410. is_hovering = false;
  1411. A_was_pressed = false;
  1412. Z_WHITE_was_pressed = false;
  1413. anim_was_17 = false;
  1414. cant_playsound = false;
  1415. has_played = false;
  1416. sound_was_played = false;
  1417. first_sound_played = false;
  1418. _1238_was_played = false;
  1419. _1239_was_played = false;
  1420. _1240_was_played = false;
  1421. _1241_was_played = false;
  1422. _1242_was_played = false;
  1423. no_jumping_sound = false;
  1424. play_metal_charge_sound = false;
  1425. can_use_dash = false;
  1426. is_on_ground = false;
  1427. do_dash = false;
  1428. BLUE_GEM_active = false;
  1429. BLUE_GEM_used = false;
  1430. RED_GEM_active = false;
  1431. RED_GEM_used = false;
  1432. GREEN_GEM_active = false;
  1433. GREEN_GEM_used = false;
  1434. WHITE_GEM_active = false;
  1435. SKY_GEM_active = false;
  1436. stop_white_gem = false;
  1437. YELLOW_GEM_active = false;
  1438. cant_hover = false;
  1439. reduce_invulnerable_time = false;
  1440. gauge_auto_fill_ON = false;
  1441. gauge_is_filling = false;
  1442. black_shield_used = false;
  1443. can_attack = false;
  1444. spiiin_sound_played = false;
  1445. can_charge = false;
  1446. can_prepare_shield_timer = false;
  1447. BHA_launch = false;
  1448. from_white_to_fall = false;
  1449. cant_use_yellow_gem = false;
  1450. use_blaze_bomb = false;
  1451. can_use_blaze_bomb = false;
  1452. NJB_active = false;
  1453. NJB_loaded = false;
  1454.  
  1455.  
  1456. charge_sound = 0;
  1457. backtometal = 0;
  1458. ObjCol = 0;
  1459. blaze_homing_timer = 0;
  1460. black_shield_timer = 0;
  1461. can_hover = 0;
  1462. MetalHoverStaticTimer = 0;
  1463. MetalHoverMovingTimer = 0;
  1464. can_hover_again = 0;
  1465. anim_can_be_32 = 0;
  1466. spinning_sound = 0;
  1467. SOUNDTEST = 0;
  1468. play_moving_sound = 0;
  1469. metal_dash_timer = 0;
  1470. do_dash_timer = 0;
  1471. metal_spinning_sound_timer = 0;
  1472. cant_hover_timer = 0;
  1473. tails_teleport_timer = 0;
  1474. tails_attack_timer = 0;
  1475. stop_supersonic_upgrade = 0;
  1476. gauge_auto_fill = 0;
  1477. can_use_spiiin_sound = 0;
  1478. white_to_NOTwhite = 0;
  1479. whiteON_then_ground = 0;
  1480. stop_LSA = 0;
  1481. use_fall_anim = 0;
  1482. stop_blaze_bomb = 0;
  1483. gemaura = 354;
  1484. blackshieldrotate = 0;
  1485. unload_NJB = 0;
  1486. }
  1487.  
  1488.  
  1489.  
  1490.  
  1491. ////////////////////// HUD //////////////////////////////////////////////////////////////////////////
  1492. enum HUDTextureIndex
  1493. {
  1494. HUD_gauge, HUD_rings, HUD_lives, HUD_score, HUD_timer, HUD_sonic_life, HUD_tails_life, HUD_knuckles_life, HUD_shadow_life, HUD_amy_life, HUD_gamma_life,
  1495. HUD_metalsonic_life, HUD_tailsdoll_life, HUD_metalknuckles_life, HUD_0, HUD_1, HUD_2, HUD_3, HUD_4, HUD_5, HUD_6, HUD_7, HUD_8, HUD_9, HUD_0s_red,
  1496. HUD_0s_red_glow, HUD_ring_a, HUD_ring_b, HUD_ring_c, HUD_ring_d, HUD_ring_e, HUD_ring_f, HUD_ring_g, HUD_ring_h, HUD_energy_1, HUD_energy_2, HUD_energy_3, HUD_energy_4,
  1497. HUD_energy_5, HUD_energy_6, HUD_energy_7, HUD_energy_8, HUD_energy_9, HUD_energy_10, HUD_energy_11, HUD_energy_12, HUD_energy_13, HUD_energy_14, HUD_energy_15, HUD_energy_16,
  1498. HUD_energy_17, HUD_energy_18, HUD_energy_19, HUD_energy_20, HUD_energy_21, HUD_energy_22, HUD_energy_23, HUD_energy_24, HUD_energy_25, HUD_energy_26, HUD_energy_27, HUD_energy_28,
  1499. HUD_energy_29, HUD_energy_30, HUD_energy_31, HUD_energy_32, HUD_energy_33, HUD_energy_34, HUD_energy_35, HUD_energy_36, HUD_energy_37, HUD_energy_38, HUD_energy_39, HUD_energy_40,
  1500. HUD_energy_41, HUD_energy_42, HUD_energy_43, HUD_energy_44, HUD_energy_45, HUD_energy_46, HUD_energy_47, HUD_energy_48, HUD_energy_49, HUD_energy_50, HUD_energy_51, HUD_energy_52,
  1501. HUD_energy_53, HUD_energy_54, HUD_energy_55, HUD_energy_56, HUD_energy_57, HUD_energy_58, HUD_energy_59, HUD_energy_60, HUD_energy_61, HUD_energy_62, HUD_energy_63, HUD_energy_64,
  1502. HUD_energy_65, HUD_energy_66, HUD_energy_67, HUD_energy_68, HUD_energy_69, HUD_energy_70, HUD_energy_71, HUD_energy_72, HUD_energy_73, HUD_energy_74, HUD_energy_75, HUD_energy_76,
  1503. HUD_energy_77, HUD_energy_78, HUD_energy_79, HUD_energy_80, HUD_energy_81, HUD_energy_82, HUD_energy_83, HUD_energy_84, HUD_energy_85, HUD_energy_86, HUD_energy_87, HUD_energy_88,
  1504. HUD_energy_89, HUD_energy_90, HUD_energy_91, HUD_energy_92, HUD_energy_93, HUD_energy_94, HUD_energy_95, HUD_energy_96, HUD_energy_97, HUD_energy_98, HUD_energy_99, HUD_energy_100,
  1505. HUD_energy_glow, HUD_sonic_lv1, HUD_sonic_lv2, HUD_sonic_lv3, HUD_shadow_lv1, HUD_shadow_lv2, HUD_shadow_lv3, HUD_metal_lv1, HUD_metal_lv2, HUD_metal_lv3, HUD_energy_lvl_1, HUD_energy_lvl_2,
  1506. HUD_energy_lvl_3, HUD_energy_lvl_4, HUD_energy_lvl_5, HUD_energy_lvl_6, HUD_energy_lvl_7, HUD_energy_lvl_8, HUD_energy_lvl_9, HUD_energy_lvl_10, HUD_energy_lvl_11, HUD_energy_lvl_12,
  1507. HUD_energy_lvl_13, HUD_energy_lvl_14, HUD_energy_lvl_15, HUD_energy_lvl_16, HUD_energy_lvl_17, HUD_energy_lvl_18, HUD_energy_lvl_19, HUD_energy_lvl_20, HUD_energy_lvl_21, HUD_energy_lvl_22,
  1508. HUD_energy_lvl_23, HUD_energy_lvl_24, HUD_energy_lvl_25, HUD_energy_lvl_26, HUD_energy_lvl_27, HUD_energy_lvl_28, HUD_energy_lvl_29, HUD_energy_lvl_30, HUD_energy_lvl_31, HUD_energy_lvl_32,
  1509. HUD_energy_lvl_33, HUD_energy_lvl_34, HUD_energy_lvl_35, HUD_energy_lvl_36, HUD_energy_lvl_37, HUD_energy_lvl_38, HUD_energy_lvl_39, HUD_energy_lvl_40, HUD_energy_lvl_41, HUD_energy_lvl_42,
  1510. HUD_energy_lvl_43, HUD_energy_lvl_44, HUD_energy_lvl_45, HUD_energy_lvl_46, HUD_energy_lvl_47, HUD_energy_lvl_48, HUD_energy_lvl_49, HUD_energy_lvl_50, HUD_energy_lvl_51, HUD_energy_lvl_52,
  1511. HUD_energy_lvl_53, HUD_energy_lvl_54, HUD_energy_lvl_55, HUD_energy_lvl_56, HUD_energy_lvl_57, HUD_energy_lvl_58, HUD_energy_lvl_59, HUD_energy_lvl_60, HUD_energy_lvl_61, HUD_energy_lvl_62,
  1512. HUD_energy_lvl_63, HUD_energy_lvl_64, HUD_energy_lvl_65, HUD_energy_lvl_66, HUD_energy_lvl_67, HUD_energy_lvl_68, HUD_energy_lvl_69, HUD_energy_lvl_70, HUD_energy_lvl_71, HUD_energy_lvl_72,
  1513. HUD_energy_lvl_73, HUD_energy_lvl_74, HUD_energy_lvl_75, HUD_energy_lvl_76, HUD_energy_lvl_77, HUD_energy_lvl_78, HUD_energy_lvl_79, HUD_energy_lvl_80, HUD_energy_lvl_81, HUD_energy_lvl_82,
  1514. HUD_energy_lvl_83, HUD_energy_lvl_84, HUD_energy_lvl_85, HUD_energy_lvl_86, HUD_energy_lvl_87, HUD_energy_lvl_88, HUD_energy_lvl_89, HUD_energy_lvl_90, HUD_energy_lvl_91, HUD_energy_lvl_92,
  1515. HUD_energy_lvl_93, HUD_energy_lvl_94, HUD_energy_lvl_95, HUD_energy_lvl_96, HUD_energy_lvl_97, HUD_energy_lvl_98, HUD_energy_lvl_99, HUD_energy_lvl_100, HUD_soniclvl_energy_glow,
  1516. HUD_shadowlvl_energy_glow, HUD_metallvl_energy_glow, HUD_sonic_lv1_glow, HUD_sonic_lv2_glow, HUD_sonic_lv3_glow, HUD_shadow_lv1_glow, HUD_shadow_lv2_glow, HUD_shadow_lv3_glow, HUD_metal_lv1_glow,
  1517. HUD_metal_lv2_glow, HUD_metal_lv3_glow, HUD_sonic_lv1_dark, HUD_sonic_lv2_dark, HUD_sonic_lv3_dark, HUD_shadow_lv1_dark, HUD_shadow_lv2_dark, HUD_shadow_lv3_dark, HUD_metal_lv1_dark,
  1518. HUD_metal_lv2_dark, HUD_metal_lv3_dark, BLUE_GEM, RED_GEM, GREEN_GEM, PURPLE_GEM, SKY_GEM, WHITE_GEM, YELLOW_GEM
  1519. };
  1520.  
  1521.  
  1522. static NJS_TEXNAME HUD_TEXNAME[150];
  1523. static NJS_TEXLIST HUD_TEXLIST = { arrayptrandlength(HUD_TEXNAME) }; //MY OWN HUD STUFF
  1524.  
  1525.  
  1526. static NJS_TEXANIM HUD_TEXANIM[] = {
  1527. // w, h, cx, cy, u1, v1, u2, v2, texid, attr
  1528. // u2 and v2 must be 0xFF
  1529. { 314, 55, 0, 0, 0, 0, 0xFF, 0xFF, HUD_rings, 0 },//cx and cy are the position on the screen cx => + or - to go left or right; cy => + or - to go up or down
  1530. { 314, 55, 0, 0, 0, 0, 0xFF, 0xFF, HUD_lives, 0 },
  1531. { 394, 55, 0, 0, 0, 0, 0xFF, 0xFF, HUD_score, 0 },
  1532. { 394, 55, 0, 0, 0, 0, 0xFF, 0xFF, HUD_timer, 0 },
  1533. { 75, 75, 0, 0, 0, 0, 0xFF, 0xFF, HUD_sonic_life, 0 },
  1534. { 75, 75, 0, 0, 0, 0, 0xFF, 0xFF, HUD_tails_life, 0 },
  1535. { 75, 75, 0, 0, 0, 0, 0xFF, 0xFF, HUD_knuckles_life, 0 },
  1536. { 75, 75, 0, 0, 0, 0, 0xFF, 0xFF, HUD_shadow_life, 0 },
  1537. { 75, 75, 0, 0, 0, 0, 0xFF, 0xFF, HUD_amy_life, 0 },
  1538. { 75, 75, 0, 0, 0, 0, 0xFF, 0xFF, HUD_gamma_life, 0 },
  1539. { 75, 75, 0, 0, 0, 0, 0xFF, 0xFF, HUD_metalsonic_life, 0 },
  1540. { 75, 75, 0, 0, 0, 0, 0xFF, 0xFF, HUD_tailsdoll_life, 0 },
  1541. { 75, 75, 0, 0, 0, 0, 0xFF, 0xFF, HUD_metalknuckles_life, 0 }
  1542. };
  1543.  
  1544. static NJS_TEXANIM HUD_TEXANIM_NUMBERS[] = {
  1545.  
  1546. { 40, 40, 0, 0, 0, 0, 0xFF, 0xFF, HUD_0, 0 },
  1547. { 40, 40, 0, 0, 0, 0, 0xFF, 0xFF, HUD_1, 0 },
  1548. { 40, 40, 0, 0, 0, 0, 0xFF, 0xFF, HUD_2, 0 },
  1549. { 40, 40, 0, 0, 0, 0, 0xFF, 0xFF, HUD_3, 0 },
  1550. { 40, 40, 0, 0, 0, 0, 0xFF, 0xFF, HUD_4, 0 },
  1551. { 40, 40, 0, 0, 0, 0, 0xFF, 0xFF, HUD_5, 0 },
  1552. { 40, 40, 0, 0, 0, 0, 0xFF, 0xFF, HUD_6, 0 },
  1553. { 40, 40, 0, 0, 0, 0, 0xFF, 0xFF, HUD_7, 0 },
  1554. { 40, 40, 0, 0, 0, 0, 0xFF, 0xFF, HUD_8, 0 },
  1555. { 40, 40, 0, 0, 0, 0, 0xFF, 0xFF, HUD_9, 0 }
  1556. };
  1557.  
  1558. static NJS_TEXANIM HUD_TEXANIM_NUMBERS_RING_ANIM[] = {
  1559.  
  1560. { 50, 50, 0, 0, 0, 0, 0xFF, 0xFF, HUD_ring_a, 0 },
  1561. { 50, 50, 0, 0, 0, 0, 0xFF, 0xFF, HUD_ring_b, 0 },
  1562. { 50, 50, 0, 0, 0, 0, 0xFF, 0xFF, HUD_ring_c, 0 },
  1563. { 50, 50, 0, 0, 0, 0, 0xFF, 0xFF, HUD_ring_d, 0 },
  1564. { 50, 50, 0, 0, 0, 0, 0xFF, 0xFF, HUD_ring_e, 0 },
  1565. { 50, 50, 0, 0, 0, 0, 0xFF, 0xFF, HUD_ring_f, 0 },
  1566. { 50, 50, 0, 0, 0, 0, 0xFF, 0xFF, HUD_ring_g, 0 },
  1567. { 50, 50, 0, 0, 0, 0, 0xFF, 0xFF, HUD_ring_h, 0 }
  1568. };
  1569.  
  1570. static NJS_TEXANIM HUD_TEXANIM_NUMBERS_RINGS_0_RED[] = {
  1571.  
  1572. { 90, 75, 0, 0, 0, 0, 0xFF, 0xFF, HUD_0s_red, 0 }, //-212 -216 why ??
  1573. { 90, 75, 0, 0, 0, 0, 0xFF, 0xFF, HUD_0s_red_glow, 0 }
  1574. };
  1575.  
  1576. static NJS_TEXANIM HUD_TEXANIM_ENERGY[] = {
  1577.  
  1578. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_gauge, 0 },
  1579. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_1, 0 },
  1580. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_2, 0 },
  1581. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_3, 0 },
  1582. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_4, 0 },
  1583. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_5, 0 },
  1584. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_6, 0 },
  1585. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_7, 0 },
  1586. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_8, 0 },
  1587. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_9, 0 },
  1588. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_10, 0 },
  1589. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_11, 0 },
  1590. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_12, 0 },
  1591. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_13, 0 },
  1592. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_14, 0 },
  1593. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_15, 0 },
  1594. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_16, 0 },
  1595. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_17, 0 },
  1596. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_18, 0 },
  1597. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_19, 0 },
  1598. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_20, 0 },
  1599. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_21, 0 },
  1600. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_22, 0 },
  1601. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_23, 0 },
  1602. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_24, 0 },
  1603. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_25, 0 },
  1604. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_26, 0 },
  1605. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_27, 0 },
  1606. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_28, 0 },
  1607. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_29, 0 },
  1608. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_30, 0 },
  1609. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_31, 0 },
  1610. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_32, 0 },
  1611. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_33, 0 },
  1612. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_34, 0 },
  1613. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_35, 0 },
  1614. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_36, 0 },
  1615. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_37, 0 },
  1616. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_38, 0 },
  1617. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_39, 0 },
  1618. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_40, 0 },
  1619. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_41, 0 },
  1620. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_42, 0 },
  1621. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_43, 0 },
  1622. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_44, 0 },
  1623. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_45, 0 },
  1624. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_46, 0 },
  1625. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_47, 0 },
  1626. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_48, 0 },
  1627. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_49, 0 },
  1628. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_50, 0 },
  1629. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_51, 0 },
  1630. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_52, 0 },
  1631. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_53, 0 },
  1632. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_54, 0 },
  1633. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_55, 0 },
  1634. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_56, 0 },
  1635. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_57, 0 },
  1636. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_58, 0 },
  1637. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_59, 0 },
  1638. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_60, 0 },
  1639. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_61, 0 },
  1640. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_62, 0 },
  1641. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_63, 0 },
  1642. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_64, 0 },
  1643. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_65, 0 },
  1644. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_66, 0 },
  1645. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_67, 0 },
  1646. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_68, 0 },
  1647. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_69, 0 },
  1648. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_70, 0 },
  1649. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_71, 0 },
  1650. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_72, 0 },
  1651. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_73, 0 },
  1652. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_74, 0 },
  1653. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_75, 0 },
  1654. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_76, 0 },
  1655. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_77, 0 },
  1656. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_78, 0 },
  1657. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_79, 0 },
  1658. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_80, 0 },
  1659. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_81, 0 },
  1660. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_82, 0 },
  1661. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_83, 0 },
  1662. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_84, 0 },
  1663. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_85, 0 },
  1664. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_86, 0 },
  1665. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_87, 0 },
  1666. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_88, 0 },
  1667. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_89, 0 },
  1668. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_90, 0 },
  1669. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_91, 0 },
  1670. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_92, 0 },
  1671. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_93, 0 },
  1672. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_94, 0 },
  1673. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_95, 0 },
  1674. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_96, 0 },
  1675. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_97, 0 },
  1676. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_98, 0 },
  1677. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_99, 0 },
  1678. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_100, 0 }
  1679. };
  1680.  
  1681. static NJS_TEXANIM HUD_TEXANIM_ENERGY_GLOW[] = {
  1682.  
  1683. { 375, 85, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_glow, 0 }
  1684. };
  1685.  
  1686. static NJS_TEXANIM HUD_TEXANIM_ENERGYLVL[] = {
  1687.  
  1688. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_1, 0 },
  1689. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_2, 0 },
  1690. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_3, 0 },
  1691. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_4, 0 },
  1692. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_5, 0 },
  1693. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_6, 0 },
  1694. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_7, 0 },
  1695. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_8, 0 },
  1696. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_9, 0 },
  1697. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_10, 0 },
  1698. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_11, 0 },
  1699. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_12, 0 },
  1700. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_13, 0 },
  1701. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_14, 0 },
  1702. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_15, 0 },
  1703. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_16, 0 },
  1704. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_17, 0 },
  1705. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_18, 0 },
  1706. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_19, 0 },
  1707. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_20, 0 },
  1708. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_21, 0 },
  1709. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_22, 0 },
  1710. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_23, 0 },
  1711. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_24, 0 },
  1712. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_25, 0 },
  1713. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_26, 0 },
  1714. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_27, 0 },
  1715. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_28, 0 },
  1716. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_29, 0 },
  1717. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_30, 0 },
  1718. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_31, 0 },
  1719. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_32, 0 },
  1720. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_33, 0 },
  1721. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_34, 0 },
  1722. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_35, 0 },
  1723. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_36, 0 },
  1724. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_37, 0 },
  1725. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_38, 0 },
  1726. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_39, 0 },
  1727. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_40, 0 },
  1728. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_41, 0 },
  1729. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_42, 0 },
  1730. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_43, 0 },
  1731. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_44, 0 },
  1732. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_45, 0 },
  1733. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_46, 0 },
  1734. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_47, 0 },
  1735. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_48, 0 },
  1736. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_49, 0 },
  1737. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_50, 0 },
  1738. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_51, 0 },
  1739. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_52, 0 },
  1740. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_53, 0 },
  1741. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_54, 0 },
  1742. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_55, 0 },
  1743. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_56, 0 },
  1744. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_57, 0 },
  1745. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_58, 0 },
  1746. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_59, 0 },
  1747. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_60, 0 },
  1748. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_61, 0 },
  1749. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_62, 0 },
  1750. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_63, 0 },
  1751. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_64, 0 },
  1752. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_65, 0 },
  1753. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_66, 0 },
  1754. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_67, 0 },
  1755. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_68, 0 },
  1756. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_69, 0 },
  1757. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_70, 0 },
  1758. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_71, 0 },
  1759. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_72, 0 },
  1760. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_73, 0 },
  1761. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_74, 0 },
  1762. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_75, 0 },
  1763. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_76, 0 },
  1764. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_77, 0 },
  1765. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_78, 0 },
  1766. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_79, 0 },
  1767. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_80, 0 },
  1768. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_81, 0 },
  1769. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_82, 0 },
  1770. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_83, 0 },
  1771. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_84, 0 },
  1772. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_85, 0 },
  1773. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_86, 0 },
  1774. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_87, 0 },
  1775. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_88, 0 },
  1776. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_89, 0 },
  1777. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_90, 0 },
  1778. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_91, 0 },
  1779. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_92, 0 },
  1780. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_93, 0 },
  1781. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_94, 0 },
  1782. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_95, 0 },
  1783. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_96, 0 },
  1784. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_97, 0 },
  1785. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_98, 0 },
  1786. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_99, 0 },
  1787. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_energy_lvl_100, 0 }
  1788. };
  1789.  
  1790. static NJS_TEXANIM HUD_TEXANIM_ENERGYLVL_GLOW[] = {
  1791.  
  1792. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_soniclvl_energy_glow, 0 },
  1793. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_shadowlvl_energy_glow, 0 },
  1794. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_metallvl_energy_glow, 0 }
  1795. };
  1796.  
  1797. static NJS_TEXANIM HUD_TEXANIM_LVLUPS[] = {
  1798.  
  1799. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_sonic_lv1, 0 }, //-1104, -700
  1800. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_sonic_lv2, 0 },
  1801. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_sonic_lv3, 0 },
  1802. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_shadow_lv1, 0 },
  1803. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_shadow_lv2, 0 },
  1804. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_shadow_lv3, 0 },
  1805. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_metal_lv1, 0 },
  1806. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_metal_lv2, 0 },
  1807. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_metal_lv3, 0 },
  1808. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_sonic_lv1_dark, 0 },
  1809. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_sonic_lv2_dark, 0 },
  1810. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_sonic_lv3_dark, 0 },
  1811. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_shadow_lv1_dark, 0 },
  1812. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_shadow_lv2_dark, 0 },
  1813. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_shadow_lv3_dark, 0 },
  1814. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_metal_lv1_dark, 0 },
  1815. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_metal_lv2_dark, 0 },
  1816. { 488, 112, 0, 0, 0, 0, 0xFF, 0xFF, HUD_metal_lv3_dark, 0 },
  1817. };
  1818.  
  1819. static NJS_TEXANIM HUD_TEXANIM_LVLUPS_GLOW[] = {
  1820.  
  1821. { 100, 40, 0, 40, 0, 0, 0xFF, 0xFF, HUD_sonic_lv1_glow, 0 }, //-1104, -700
  1822. { 100, 40, 0, 40, 0, 0, 0xFF, 0xFF, HUD_sonic_lv2_glow, 0 },
  1823. { 100, 40, 0, 40, 0, 0, 0xFF, 0xFF, HUD_sonic_lv3_glow, 0 },
  1824. { 100, 40, 0, 40, 0, 0, 0xFF, 0xFF, HUD_shadow_lv1_glow, 0 },
  1825. { 100, 40, 0, 40, 0, 0, 0xFF, 0xFF, HUD_shadow_lv2_glow, 0 },
  1826. { 100, 40, 0, 40, 0, 0, 0xFF, 0xFF, HUD_shadow_lv3_glow, 0 },
  1827. { 100, 40, 0, 40, 0, 0, 0xFF, 0xFF, HUD_metal_lv1_glow, 0 },
  1828. { 100, 40, 0, 40, 0, 0, 0xFF, 0xFF, HUD_metal_lv2_glow, 0 },
  1829. { 100, 40, 0, 40, 0, 0, 0xFF, 0xFF, HUD_metal_lv3_glow, 0 }
  1830. };
  1831.  
  1832.  
  1833. NJS_SPRITE HUD_SPRITE = { { 0.0f, 0.0f, 0.0f }, 1.3f * HorizontalResolution / 1680.0f, 1.3f * VerticalResolution / 1050.0f, 0, &HUD_TEXLIST, HUD_TEXANIM };//the three numbers in the brackets are X, Y, and Z position, then X and Y scaling, rotation, texlist, and texanim
  1834. NJS_SPRITE HUD_SPRITE_NUMBERS = { { 0.0f, 0.0f, 0.0f }, 1.3f * HorizontalResolution / 1680.0f, 1.3f * VerticalResolution / 1050.0f, 0, &HUD_TEXLIST, HUD_TEXANIM_NUMBERS };
  1835. NJS_SPRITE HUD_SPRITE_RING_ANIM = { { 0.0f, 0.0f, 0.0f }, 1.0f * HorizontalResolution / 1680.0f, 1.0f * VerticalResolution / 1050.0f, 0, &HUD_TEXLIST, HUD_TEXANIM_NUMBERS_RING_ANIM };
  1836. NJS_SPRITE HUD_SPRITE_RINGS_0_RED = { { 0.0f, 0.0f, 0.0f }, 1.0f * HorizontalResolution / 1680.0f, 1.0f * VerticalResolution / 1050.0f, 0, &HUD_TEXLIST, HUD_TEXANIM_NUMBERS_RINGS_0_RED };
  1837.  
  1838. NJS_SPRITE HUD_SPRITE_ENERGY = { { 0.0f, 0.0f, 0.0f }, 1.0f * HorizontalResolution / 1680.0f, 1.0f * VerticalResolution / 1050.0f, 0, &HUD_TEXLIST, HUD_TEXANIM_ENERGY };
  1839. NJS_SPRITE HUD_SPRITE_ENERGY_GLOW = { { 0.0f, 0.0f, 0.0f }, 1.3f * HorizontalResolution / 1680.0f, 1.3f * VerticalResolution / 1050.0f, 0, &HUD_TEXLIST, HUD_TEXANIM_ENERGY_GLOW };
  1840.  
  1841. NJS_SPRITE HUD_SPRITE_ENERGYLVL = { { 0.0f, 0.0f, 0.0f }, 1.0f * HorizontalResolution / 1680.0f, 1.0f * VerticalResolution / 1050.0f, 0, &HUD_TEXLIST, HUD_TEXANIM_ENERGYLVL };
  1842. NJS_SPRITE HUD_SPRITE_ENERGYLVL_GLOW = { { 0.0f, 0.0f, 0.0f }, 1.0f * HorizontalResolution / 1680.0f, 1.0f * VerticalResolution / 1050.0f, 0, &HUD_TEXLIST, HUD_TEXANIM_ENERGYLVL_GLOW };
  1843.  
  1844. NJS_SPRITE HUD_SPRITE_LVLUPS = { { 0.0f, 0.0f, 0.0f }, 1.0f * HorizontalResolution / 1680.0f, 1.0f * VerticalResolution / 1050.0f, 0, &HUD_TEXLIST, HUD_TEXANIM_LVLUPS };
  1845. NJS_SPRITE HUD_SPRITE_LVLUPS_GLOW = { { 0.0f, 0.0f, 0.0f }, 1.0f * HorizontalResolution / 1680.0f, 1.0f * VerticalResolution / 1050.0f, 0, &HUD_TEXLIST, HUD_TEXANIM_LVLUPS_GLOW };
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851. enum HUD3DTextureIndex
  1852. {
  1853. HUD3D_star, HUD3D_circle, HUD3D_sonic_vortex, HUD3D_shadow_vortex, HUD3D_metal_vortex, HUD3D_sparkles_0, HUD3D_sparkles_1, HUD3D_sparkles_2, HUD3D_sparkles_3, HUD3D_sparkles_4,
  1854. HUD3D_sparkles_5, HUD3D_sparkles_6, HUD3D_sparkles_7
  1855. };
  1856.  
  1857. static NJS_TEXNAME HUD3D_TEXNAME[4];
  1858. static NJS_TEXLIST HUD3D_TEXLIST = { arrayptrandlength(HUD3D_TEXNAME) }; //MY OWN HUD STUFF
  1859.  
  1860. static NJS_TEXANIM HUD3D_TEXANIM[] = {
  1861.  
  1862. { 16, 16, 8, 8, 0, 0, 0xFF, 0xFF, HUD3D_star, 0 },
  1863. { 16, 16, 8, 8, 0, 0, 0xFF, 0xFF, HUD3D_circle, 0 },
  1864. { 32, 32, 16, 16, 0, 0, 0xFF, 0xFF, HUD3D_sonic_vortex, 0 },
  1865. { 32, 32, 16, 16, 0, 0, 0xFF, 0xFF, HUD3D_shadow_vortex, 0 },
  1866. { 32, 32, 16, 16, 0, 0, 0xFF, 0xFF, HUD3D_metal_vortex, 0 },
  1867. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, HUD3D_sparkles_0, 0 },
  1868. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, HUD3D_sparkles_1, 0 },
  1869. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, HUD3D_sparkles_2, 0 },
  1870. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, HUD3D_sparkles_3, 0 },
  1871. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, HUD3D_sparkles_4, 0 },
  1872. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, HUD3D_sparkles_5, 0 },
  1873. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, HUD3D_sparkles_6, 0 },
  1874. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, HUD3D_sparkles_7, 0 }
  1875. };
  1876.  
  1877.  
  1878. NJS_SPRITE HUD3D_SPRITE_STAR = { { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, &HUD3D_TEXLIST, HUD3D_TEXANIM };
  1879. NJS_SPRITE HUD3D_SPRITE_CIRCLE = { { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, &HUD3D_TEXLIST, HUD3D_TEXANIM };
  1880. NJS_SPRITE HUD3D_SPRITE_LEVEL3 = { { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, &HUD3D_TEXLIST, HUD3D_TEXANIM };
  1881. //Level 3 sparkles
  1882. using std::vector;
  1883. struct sparkledata { NJS_VECTOR pos; int frame; };
  1884. vector<sparkledata> sparkles;
  1885. NJS_SPRITE sparklesprite = { { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, &HUD3D_TEXLIST, HUD3D_TEXANIM };
  1886.  
  1887. //Metal Sonic Gems Sparkles
  1888. enum GEMSTextureIndex
  1889. {
  1890. gem_particle_blueB, gem_particle_blueS, gem_particle_redB, gem_particle_redS, gem_particle_greenB, gem_particle_greenS, gem_particle_purpleB, gem_particle_purpleS,
  1891. gem_particle_skyB, gem_particle_skyS, gem_particle_whiteB, gem_particle_whiteS, gem_particle_yellowB, gem_particle_yellowS, chaosblastball0, chaosblastball1, sh_chaosblast_bolt0_a,
  1892. sh_chaosblast_bolt0_b, sh_chaosblast_bolt1_a, sh_chaosblast_bolt1_b, sh_chaosblast_bolt2_a, sh_chaosblast_bolt2_b, sh_chaosblast_bolt3_a, sh_chaosblast_bolt3_b, sh_chaosblast_bolt4_a,
  1893. sh_chaosblast_bolt4_b, chaosboostlvl3smoke
  1894. };
  1895.  
  1896. static NJS_TEXNAME GEMS_TEXNAME[4];
  1897. static NJS_TEXLIST GEMS_TEXLIST = { arrayptrandlength(GEMS_TEXNAME) };
  1898.  
  1899. static NJS_TEXANIM GEMS_TEXANIM[] = {
  1900.  
  1901. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, gem_particle_blueB, 0 },
  1902. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, gem_particle_blueS, 0 },
  1903. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, gem_particle_redB, 0 },
  1904. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, gem_particle_redS, 0 },
  1905. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, gem_particle_greenB, 0 },
  1906. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, gem_particle_greenS, 0 },
  1907. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, gem_particle_purpleB, 0 },
  1908. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, gem_particle_purpleS, 0 },
  1909. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, gem_particle_skyB, 0 },
  1910. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, gem_particle_skyS, 0 },
  1911. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, gem_particle_whiteB, 0 },
  1912. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, gem_particle_whiteS, 0 },
  1913. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, gem_particle_yellowB, 0 },
  1914. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, gem_particle_yellowS, 0 },
  1915. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, chaosblastball0, 0 },
  1916. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, chaosblastball1, 0 },
  1917. { 12, 12, 6, 6, 0, 0, 0xFF, 0xFF, sh_chaosblast_bolt0_a, 0 },
  1918. { 12, 12, 6, 6, 0, 0, 0xFF, 0xFF, sh_chaosblast_bolt0_a, 0 },
  1919. { 12, 12, 6, 6, 0, 0, 0xFF, 0xFF, sh_chaosblast_bolt1_a, 0 },
  1920. { 12, 12, 6, 6, 0, 0, 0xFF, 0xFF, sh_chaosblast_bolt1_b, 0 },
  1921. { 12, 12, 6, 6, 0, 0, 0xFF, 0xFF, sh_chaosblast_bolt2_a, 0 },
  1922. { 12, 12, 6, 6, 0, 0, 0xFF, 0xFF, sh_chaosblast_bolt2_b, 0 },
  1923. { 12, 12, 6, 6, 0, 0, 0xFF, 0xFF, sh_chaosblast_bolt3_a, 0 },
  1924. { 12, 12, 6, 6, 0, 0, 0xFF, 0xFF, sh_chaosblast_bolt3_b, 0 },
  1925. { 12, 12, 6, 6, 0, 0, 0xFF, 0xFF, sh_chaosblast_bolt4_a, 0 },
  1926. { 12, 12, 6, 6, 0, 0, 0xFF, 0xFF, sh_chaosblast_bolt4_b, 0 },
  1927. { 4, 4, 2, 2, 0, 0, 0xFF, 0xFF, chaosboostlvl3smoke, 0 }
  1928. };
  1929. struct sparklegemsdata
  1930. {
  1931. NJS_VECTOR pos_gems;
  1932. int framegems;
  1933. int framegems_tiny;
  1934. Rotation3 rotation;
  1935. Rotation3 speed;
  1936. float radius;
  1937. };
  1938. vector<sparklegemsdata> sparklesgems;
  1939. vector<sparklegemsdata> sparklesgems_tiny;
  1940.  
  1941. struct sparkleCBdata
  1942. {
  1943. NJS_VECTOR pos_CB;
  1944. int frameCB;
  1945. int frameCB_tiny;
  1946. Rotation3 rotation;
  1947. Rotation3 speed;
  1948. float radiusCB;
  1949. };
  1950. vector<sparkleCBdata> sparklesCB;
  1951. vector<sparkleCBdata> sparklesCB_tiny;
  1952.  
  1953. struct sparklechaosblastdata
  1954. {
  1955. NJS_VECTOR pos_chaosblast;
  1956. int framechaosblast;
  1957. int framechaosblast_tiny;
  1958. Rotation3 rotation;
  1959. Rotation3 speed;
  1960. float radiuschaosblast;
  1961. };
  1962. vector<sparklechaosblastdata> sparkleschaosblast;
  1963. vector<sparklechaosblastdata> sparkleschaosblast_tiny;
  1964.  
  1965. struct sparkleCBboltdata { NJS_VECTOR pos_CBbolt; int frameCBbolt; };
  1966. vector<sparkleCBboltdata> sparklesCBbolt;
  1967.  
  1968. struct sparkleCBLV3data { NJS_VECTOR pos_CBLV3; int frameCBLV3; };
  1969. vector<sparkleCBLV3data> sparklesCBLV3;
  1970.  
  1971. NJS_SPRITE sparklegemssprite = { { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, &GEMS_TEXLIST, GEMS_TEXANIM };
  1972. NJS_SPRITE sparkleShadowCBsprite = { { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, &GEMS_TEXLIST, GEMS_TEXANIM };
  1973. NJS_SPRITE sparkleShadowChaosBlastsprite = { { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, &GEMS_TEXLIST, GEMS_TEXANIM };
  1974. NJS_SPRITE sparkleShadowCBbolt = { { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, &GEMS_TEXLIST, GEMS_TEXANIM };
  1975. NJS_SPRITE sparkleShadowCBLV3 = { { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, &GEMS_TEXLIST, GEMS_TEXANIM };
  1976.  
  1977.  
  1978. //Metal Sonic Gems Gauge
  1979.  
  1980. static NJS_TEXANIM GEMSGauge_TEXANIM[] = {
  1981.  
  1982. { 100, 100, 50, 50, 0, 0, 0xFF, 0xFF, BLUE_GEM, 0 },
  1983. { 100, 100, 50, 50, 0, 0, 0xFF, 0xFF, RED_GEM, 0 },
  1984. { 100, 100, 50, 50, 0, 0, 0xFF, 0xFF, GREEN_GEM, 0 },
  1985. { 100, 100, 50, 50, 0, 0, 0xFF, 0xFF, PURPLE_GEM, 0 },
  1986. { 100, 100, 50, 50, 0, 0, 0xFF, 0xFF, SKY_GEM, 0 },
  1987. { 100, 100, 50, 50, 0, 0, 0xFF, 0xFF, WHITE_GEM, 0 },
  1988. { 100, 100, 50, 50, 0, 0, 0xFF, 0xFF, YELLOW_GEM, 0 }
  1989. };
  1990.  
  1991. NJS_SPRITE GEMSGauge_SPRITE = { { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, &HUD_TEXLIST, GEMSGauge_TEXANIM };
  1992.  
  1993.  
  1994. //Counter Zeros
  1995. void HudDisplayZerosSTH06(signed int ringCount, unsigned __int8 digits, NJS_SPRITE *hud_R)
  1996. {
  1997. int count_R; // edi
  1998. int i_R; // ecx
  1999. int max_R; // eax MAPDST
  2000.  
  2001. count_R = ringCount;
  2002. //if (HideHud >= 0)
  2003. //{
  2004. if (ringCount >= 100000)
  2005. {
  2006. count_R = 99999;
  2007. }
  2008. i_R = digits;
  2009. max_R = 1;
  2010. if ((signed int)digits > 0)
  2011. {
  2012. do
  2013. {
  2014. max_R *= 10;
  2015. --i_R;
  2016. } while (i_R);
  2017. }
  2018. if (count_R > --max_R)
  2019. {
  2020. count_R = max_R;
  2021. }
  2022. if (digits >= 5u)
  2023. {
  2024. njDrawSprite2D_Queue(
  2025. hud_R,
  2026. count_R / 10000,
  2027. -1,
  2028. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2029. QueuedModelFlagsB_SomeTextureThing);
  2030. hud_R->p.x = hud_R->p.x + 23.4 * HorizontalResolution / 1680.0f;
  2031. }
  2032. if (digits >= 4u)
  2033. {
  2034. njDrawSprite2D_Queue(
  2035. hud_R,
  2036. count_R % 10000 / 1000,
  2037. -1,
  2038. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2039. QueuedModelFlagsB_SomeTextureThing);
  2040. hud_R->p.x = hud_R->p.x + 23.4 * HorizontalResolution / 1680.0f;
  2041. }
  2042. if (digits >= 3u)
  2043. {
  2044. njDrawSprite2D_Queue(
  2045. hud_R,
  2046. count_R % 1000 / 100,
  2047. -1,
  2048. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2049. QueuedModelFlagsB_SomeTextureThing);
  2050. hud_R->p.x = hud_R->p.x + 23.4 * HorizontalResolution / 1680.0f;
  2051. }
  2052. if (digits >= 2u)
  2053. {
  2054. njDrawSprite2D_Queue(
  2055. hud_R,
  2056. count_R % 100 / 10,
  2057. -1,
  2058. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2059. QueuedModelFlagsB_SomeTextureThing);
  2060. hud_R->p.x = hud_R->p.x + 23.4 * HorizontalResolution / 1680.0f;
  2061. }
  2062. if (digits >= 1u)
  2063. {
  2064. njDrawSprite2D_Queue(
  2065. hud_R,
  2066. count_R % 10,
  2067. -1,
  2068. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2069. QueuedModelFlagsB_SomeTextureThing);
  2070. }
  2071. //}
  2072. }
  2073.  
  2074. //Counter No Zeros
  2075. void HudDisplayNoZerosSTH06(signed int scoreCount, unsigned __int8 digits, NJS_SPRITE *hud_S)
  2076. {
  2077. int count_S; // edi
  2078. int i_S; // ecx
  2079. int max_S; // eax MAPDST
  2080.  
  2081. count_S = scoreCount;
  2082. //if (HideHud >= 0)
  2083. //{
  2084. if (scoreCount >= 1000000000)
  2085. {
  2086. count_S = 999999999;
  2087. }
  2088. i_S = digits;
  2089. max_S = 1;
  2090. if ((signed int)digits > 0)
  2091. {
  2092. do
  2093. {
  2094. max_S *= 10;
  2095. --i_S;
  2096. } while (i_S);
  2097. }
  2098. if (count_S > --max_S)
  2099. {
  2100. count_S = max_S;
  2101. }
  2102. if (digits >= 9u)
  2103. {
  2104. njDrawSprite2D_Queue(
  2105. hud_S,
  2106. count_S / 100000000,
  2107. -1,
  2108. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2109. QueuedModelFlagsB_SomeTextureThing);
  2110. hud_S->p.x = hud_S->p.x + 23.4 * HorizontalResolution / 1680.0f;
  2111. }
  2112. if (digits >= 8u)
  2113. {
  2114. njDrawSprite2D_Queue(
  2115. hud_S,
  2116. count_S % 100000000 / 10000000,
  2117. -1,
  2118. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2119. QueuedModelFlagsB_SomeTextureThing);
  2120. hud_S->p.x = hud_S->p.x + 23.4 * HorizontalResolution / 1680.0f;
  2121. }
  2122. if (digits >= 7u)
  2123. {
  2124. njDrawSprite2D_Queue(
  2125. hud_S,
  2126. count_S % 10000000 / 1000000,
  2127. -1,
  2128. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2129. QueuedModelFlagsB_SomeTextureThing);
  2130. hud_S->p.x = hud_S->p.x + 23.4 * HorizontalResolution / 1680.0f;
  2131. }
  2132. if (digits >= 6u)
  2133. {
  2134. njDrawSprite2D_Queue(
  2135. hud_S,
  2136. count_S % 1000000 / 100000,
  2137. -1,
  2138. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2139. QueuedModelFlagsB_SomeTextureThing);
  2140. hud_S->p.x = hud_S->p.x + 23.4 * HorizontalResolution / 1680.0f;
  2141. }
  2142. if (digits >= 5u)
  2143. {
  2144. njDrawSprite2D_Queue(
  2145. hud_S,
  2146. count_S % 100000 / 10000,
  2147. -1,
  2148. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2149. QueuedModelFlagsB_SomeTextureThing);
  2150. hud_S->p.x = hud_S->p.x + 23.4 * HorizontalResolution / 1680.0f;
  2151. }
  2152. if (digits >= 4u)
  2153. {
  2154. njDrawSprite2D_Queue(
  2155. hud_S,
  2156. count_S % 10000 / 1000,
  2157. -1,
  2158. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2159. QueuedModelFlagsB_SomeTextureThing);
  2160. hud_S->p.x = hud_S->p.x + 23.4 * HorizontalResolution / 1680.0f;
  2161. }
  2162. if (digits >= 3u)
  2163. {
  2164. njDrawSprite2D_Queue(
  2165. hud_S,
  2166. count_S % 1000 / 100,
  2167. -1,
  2168. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2169. QueuedModelFlagsB_SomeTextureThing);
  2170. hud_S->p.x = hud_S->p.x + 23.4 * HorizontalResolution / 1680.0f;
  2171. }
  2172. if (digits >= 2u)
  2173. {
  2174. njDrawSprite2D_Queue(
  2175. hud_S,
  2176. count_S % 100 / 10,
  2177. -1,
  2178. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2179. QueuedModelFlagsB_SomeTextureThing);
  2180. hud_S->p.x = hud_S->p.x + 23.4 * HorizontalResolution / 1680.0f;
  2181. }
  2182. if (digits >= 1u)
  2183. {
  2184. njDrawSprite2D_Queue(
  2185. hud_S,
  2186. count_S % 10,
  2187. -1,
  2188. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2189. QueuedModelFlagsB_SomeTextureThing);
  2190. }
  2191. //}
  2192. }
  2193.  
  2194. //Timer Frames counter HUD
  2195. void HudDisplayFramesSTH06(signed int frameCount, unsigned __int8 digits, NJS_SPRITE *hud_TF)
  2196. {
  2197. int count_TF; // edi
  2198. int i_TF; // ecx
  2199. int max_TF; // eax MAPDST
  2200.  
  2201. count_TF = 16.666 * frameCount;
  2202. //if (HideHud >= 0)
  2203. //{
  2204. if (frameCount >= 10000)
  2205. {
  2206. count_TF = 9999;
  2207. }
  2208. i_TF = digits;
  2209. max_TF = 1;
  2210. if ((signed int)digits > 0)
  2211. {
  2212. do
  2213. {
  2214. max_TF *= 10;
  2215. --i_TF;
  2216. } while (i_TF);
  2217. }
  2218. if (count_TF > --max_TF)
  2219. {
  2220. count_TF = max_TF;
  2221. }
  2222. if (digits >= 3u)
  2223. {
  2224. njDrawSprite2D_Queue(
  2225. hud_TF,
  2226. count_TF / 100,
  2227. -1,
  2228. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2229. QueuedModelFlagsB_SomeTextureThing);
  2230. hud_TF->p.x = hud_TF->p.x + 23.4 * HorizontalResolution / 1680.0f;
  2231. }
  2232. if (digits >= 2u)
  2233. {
  2234. njDrawSprite2D_Queue(
  2235. hud_TF,
  2236. count_TF % 100 / 10,
  2237. -1,
  2238. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2239. QueuedModelFlagsB_SomeTextureThing);
  2240. hud_TF->p.x = hud_TF->p.x + 23.4 * HorizontalResolution / 1680.0f;
  2241. }
  2242. if (digits >= 1u)
  2243. {
  2244. njDrawSprite2D_Queue(
  2245. hud_TF,
  2246. count_TF % 10,
  2247. -1,
  2248. NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
  2249. QueuedModelFlagsB_SomeTextureThing);
  2250. }
  2251. //}
  2252. }
  2253.  
  2254.  
  2255.  
  2256.  
  2257.  
  2258. //************************************ USE SPRITES FOR SA2 JUMP BALLLLLLLLLLLLLLLLLLLLS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  2259.  
  2260.  
  2261.  
  2262.  
  2263.  
  2264.  
  2265. void CommonHUD(EntityData1 *a1, CharObj2 *a2)
  2266. {
  2267. if (GameState == 4)
  2268. {
  2269. can_animate_gain = 0;
  2270. can_animate_loss = 0;
  2271. energy_glow = 0;
  2272. glow_down = false;
  2273. energy_lvl_glow = 0;
  2274. lvl_glow_down = false;
  2275. lv1_stretch = 0;
  2276. lv2_stretch = 0;
  2277. lv3_stretch = 0;
  2278. LV1_obtained = false;
  2279. LV2_obtained = false;
  2280. LV3_obtained = false;
  2281. LV1_active = false;
  2282. LV2_active = false;
  2283. LV3_active = false;
  2284. sparkles.clear();
  2285. sparkletimer = 0;
  2286. sparkleCBbolttimer = 0;
  2287. sparkleCBLV3timer = 0;
  2288. LV3alpha = 0.0f;
  2289. sparklegemstimer = 0;
  2290. sparklegems_tiny_timer = 0;
  2291. sparkleCBtimer = 0;
  2292. sparkleCB_tiny_timer = 0;
  2293. sparklechaosblasttimer = 0;
  2294. sparklechaosblast_tiny_timer = 0;
  2295. LV1_usable = false;
  2296. LV2_usable = false;
  2297. LV3_usable = false;
  2298. sonic_lv1_glow = 0;
  2299. sonic_lv2_glow = 0;
  2300. sonic_lv3_glow = 0;
  2301. sonic_lv1_glow_down = false;
  2302. sonic_lv2_glow_down = false;
  2303. sonic_lv3_glow_down = false;
  2304. star_glow = 0;
  2305. circle_glow = 0;
  2306. level3_glow = 0;
  2307. }
  2308. if (GameState != 21)
  2309. {
  2310. if (GetCharacterObject(0))
  2311. {
  2312. njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_SRCALPHA);
  2313. njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_INVSRCALPHA);
  2314. njTextureShadingMode(NJD_TEX_SHADING_MODE_DECALALPHA);
  2315. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2316. HUD_SPRITE.p.x = -44 * 1.3f * HorizontalResolution / 1680.0f;
  2317. HUD_SPRITE.p.y = 70 * 1.3f * VerticalResolution / 1050.0f;
  2318. njDrawSprite2D_Queue(&HUD_SPRITE, 2, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2319. HUD_SPRITE.p.x = -44 * 1.3f * HorizontalResolution / 1680.0f;
  2320. HUD_SPRITE.p.y = 120 * 1.3f * VerticalResolution / 1050.0f;
  2321. njDrawSprite2D_Queue(&HUD_SPRITE, 3, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2322. HUD_SPRITE.p.x = -44 * 1.3f * HorizontalResolution / 1680.0f;
  2323. HUD_SPRITE.p.y = 170 * 1.3f * VerticalResolution / 1050.0f;
  2324. njDrawSprite2D_Queue(&HUD_SPRITE, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2325. HUD_SPRITE.p.x = -44 * 1.3f * HorizontalResolution / 1680.0f;
  2326. HUD_SPRITE.p.y = 220 * 1.3f * VerticalResolution / 1050.0f;
  2327. njDrawSprite2D_Queue(&HUD_SPRITE, 1, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2328.  
  2329.  
  2330. if ((GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0) || (is_shadow && GetCharacterID(0) == Characters_Knuckles) || (is_metalsonic && GetCharacterID(0) == Characters_Tails))
  2331. {
  2332. HUD_SPRITE.p.x = 110 * 1.3f * HorizontalResolution / 1680.0f;
  2333. HUD_SPRITE.p.y = 205 * 1.3f * VerticalResolution / 1050.0f;
  2334. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE, 4, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2335. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE, 7, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2336. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE, 10, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2337.  
  2338. //Energy Gauge
  2339. HUD_SPRITE_ENERGY.p.x = 810 * 1.3f * HorizontalResolution / 1680.0f;
  2340. HUD_SPRITE_ENERGY.p.y = 660 * 1.3f * VerticalResolution / 1050.0f;
  2341. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGY, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0); //HUD_Gauge
  2342. if (Gauge == 0)
  2343. {
  2344. energy_glow = 0;
  2345. }
  2346. if (Gauge > 0 && Gauge < 10000)
  2347. {
  2348. energy_glow = 0;
  2349. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGY, 1 + (Gauge/100), -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2350. }
  2351. else if (Gauge >= 10000)
  2352. {
  2353. HUD_SPRITE_ENERGY.p.x = 810 * 1.3f * HorizontalResolution / 1680.0f;
  2354. HUD_SPRITE_ENERGY.p.y = 660 * 1.3f * VerticalResolution / 1050.0f;
  2355. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGY, 100, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2356. if (!is_boosting)
  2357. {
  2358. HUD_SPRITE_ENERGY_GLOW.p.x = 785 * 1.3f * HorizontalResolution / 1680.0f;
  2359. HUD_SPRITE_ENERGY_GLOW.p.y = 657 * 1.3f * VerticalResolution / 1050.0f;
  2360. if (energy_glow <= 20)
  2361. {
  2362. if (!glow_down)
  2363. {
  2364. if (energy_glow < 20)
  2365. {
  2366. ++energy_glow;
  2367. SetMaterialAndSpriteColor_Float((0 + energy_glow) / 20.0f, 1, 1, 1);
  2368. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGY_GLOW, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2369. }
  2370. else if (energy_glow == 20)
  2371. {
  2372. energy_glow = 0;
  2373. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2374. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGY_GLOW, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2375. glow_down = true;
  2376. }
  2377. }
  2378. else if (glow_down)
  2379. {
  2380. if (energy_glow < 20)
  2381. {
  2382. ++energy_glow;
  2383. SetMaterialAndSpriteColor_Float((20 - energy_glow) / 20.0f, 1, 1, 1);
  2384. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGY_GLOW, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2385. }
  2386. else if (energy_glow == 20)
  2387. {
  2388. energy_glow = 0;
  2389. SetMaterialAndSpriteColor_Float(0, 1, 1, 1);
  2390. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGY_GLOW, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2391. glow_down = false;
  2392. }
  2393. }
  2394. }
  2395. }
  2396. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2397. }
  2398.  
  2399. //LVL Energy Gauge
  2400. if (GameState != 16)
  2401. {
  2402. if (LV2_usable && !LV3_usable)
  2403. {
  2404. if (ControllerPointers[0]->PressedButtons & Buttons_B)
  2405. {
  2406. PlaySound(1250, 0, 0, 0);
  2407. LV1_obtained = false;
  2408. LV2_obtained = false;
  2409. LV1_usable = false;
  2410. LV2_usable = false;
  2411. LV2_active = true;
  2412. Gauge2 = 9999;
  2413. sonic_lv1_glow = 0;
  2414. sonic_lv2_glow = 0;
  2415. sonic_lv3_glow = 0;
  2416. lvl_glow_down = false;
  2417. sonic_lv1_glow_down = false;
  2418. sonic_lv2_glow_down = false;
  2419. sonic_lv3_glow_down = false;
  2420. star_glow = 0;
  2421. circle_glow = 0;
  2422. level3_glow = 0;
  2423. }
  2424. }
  2425. }
  2426. if (LV2_active) //has to be there to avoid the weird color blinking issue
  2427. {
  2428. if (GameState != 16)
  2429. {
  2430. if (!RED_GEM_active)
  2431. {
  2432. Gauge2 -= 8;
  2433. }
  2434. else
  2435. {
  2436. Gauge2 -= 4;
  2437. }
  2438. if (Gauge2 <= 0)
  2439. {
  2440. LV2_active = false;
  2441. PlaySound(1247, 0, 0, 0);
  2442. }
  2443. //3D HUD
  2444. ParticleDepthOverride = 2000.0f;
  2445. if (star_glow < 10)
  2446. {
  2447. ++star_glow;
  2448. SetMaterialAndSpriteColor_Float((10 - star_glow) / 10.0f, 1, 1, 1);
  2449. HUD3D_SPRITE_STAR.sx = ((3 + (star_glow / 2.0f)) / 10.0f) * 1.3f * HorizontalResolution / 1680.0f;
  2450. HUD3D_SPRITE_STAR.sy = ((3 + (star_glow / 2.0f)) / 10.0f) * 1.3f * VerticalResolution / 1050.0f;
  2451. njDrawSprite3D(&HUD3D_SPRITE_STAR, 0, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR | NJD_SPRITE_SCALE);
  2452. }
  2453. else if (star_glow == 10)
  2454. {
  2455. star_glow = 0;
  2456. SetMaterialAndSpriteColor_Float(0, 1, 1, 1);
  2457. HUD3D_SPRITE_STAR.sx = 1.3f * HorizontalResolution / 1680.0f;
  2458. HUD3D_SPRITE_STAR.sy = 1.3f * VerticalResolution / 1050.0f;
  2459. njDrawSprite3D(&HUD3D_SPRITE_STAR, 0, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR | NJD_SPRITE_SCALE);
  2460. }
  2461. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2462. if (circle_glow < 14)
  2463. {
  2464. ++circle_glow;
  2465. SetMaterialAndSpriteColor_Float((14 - circle_glow) / 14.0f, 1, 1, 1);
  2466. HUD3D_SPRITE_CIRCLE.sx = (circle_glow / 14.0f) * 1.3f * HorizontalResolution / 1680.0f;
  2467. HUD3D_SPRITE_CIRCLE.sy = (circle_glow / 14.0f) * 1.3f * VerticalResolution / 1050.0f;
  2468. njDrawSprite3D(&HUD3D_SPRITE_CIRCLE, 1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR | NJD_SPRITE_SCALE);
  2469. }
  2470. else if (circle_glow == 14)
  2471. {
  2472. SetMaterialAndSpriteColor_Float(0, 1, 1, 1);
  2473. HUD3D_SPRITE_CIRCLE.sx = 1.3f * HorizontalResolution / 1680.0f;
  2474. HUD3D_SPRITE_CIRCLE.sy = 1.3f * VerticalResolution / 1050.0f;
  2475. njDrawSprite3D(&HUD3D_SPRITE_CIRCLE, 1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR | NJD_SPRITE_SCALE);
  2476. ++circle_glow;
  2477. }
  2478. else if (circle_glow > 14)
  2479. {
  2480. if (++circle_glow == 20)
  2481. {
  2482. circle_glow = 0;
  2483. }
  2484. }
  2485. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2486. ParticleDepthOverride = 0.0f;
  2487. }
  2488. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 10, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2489. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 13, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2490. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 16, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2491. if (sonic_lv2_glow <= 2)
  2492. {
  2493. if (!sonic_lv2_glow_down)
  2494. {
  2495. if (sonic_lv2_glow < 2)
  2496. {
  2497. ++sonic_lv2_glow;
  2498. SetMaterialAndSpriteColor_Float((0 + sonic_lv2_glow) / 2.0f, 1, 1, 1);
  2499. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 1, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2500. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 4, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2501. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 7, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2502. }
  2503. else if (sonic_lv2_glow == 2)
  2504. {
  2505. sonic_lv2_glow = 0;
  2506. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2507. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 1, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2508. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 4, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2509. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 7, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2510. sonic_lv2_glow_down = true;
  2511. }
  2512. }
  2513. else if (sonic_lv2_glow_down)
  2514. {
  2515. if (sonic_lv2_glow < 2)
  2516. {
  2517. ++sonic_lv2_glow;
  2518. SetMaterialAndSpriteColor_Float((2 - sonic_lv2_glow) / 2.0f, 1, 1, 1);
  2519. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 1, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2520. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 4, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2521. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 7, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2522. }
  2523. else if (sonic_lv2_glow == 2)
  2524. {
  2525. sonic_lv2_glow = 0;
  2526. SetMaterialAndSpriteColor_Float(0, 1, 1, 1);
  2527. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 1, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2528. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 4, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2529. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 7, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2530. sonic_lv2_glow_down = false;
  2531. }
  2532. }
  2533. }
  2534. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2535. if (is_sonic) SetMaterialAndSpriteColor_Float(0.35, 0.10588, 0.48235, 0.94902);
  2536. else if (is_shadow) SetMaterialAndSpriteColor_Float(0.35, 0.92157, 0.19608, 0.13725);
  2537. else if (is_metalsonic) SetMaterialAndSpriteColor_Float(0.35, 0, 0.11373, 0.54118);
  2538. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL, (Gauge2 / 100), -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2539. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2540. }
  2541. HUD_SPRITE_ENERGYLVL.p.x = 810 * 1.3f * HorizontalResolution / 1680.0f;
  2542. HUD_SPRITE_ENERGYLVL.p.y = 660 * 1.3f * VerticalResolution / 1050.0f;
  2543. if (Gauge2 > 0 && Gauge2 < 10000)
  2544. {
  2545. energy_lvl_glow = 0;
  2546. if (is_sonic) SetMaterialAndSpriteColor_Float(0.25, 0.10588, 0.48235, 0.94902);
  2547. else if (is_shadow) SetMaterialAndSpriteColor_Float(0.25, 0.92157, 0.19608, 0.13725);
  2548. else if (is_metalsonic) SetMaterialAndSpriteColor_Float(0.25, 0, 0.11373, 0.54118);
  2549. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL, (Gauge2 / 100), -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2550. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2551. }
  2552. if (Gauge2 >= 10000 && Gauge2 < 20000)
  2553. {
  2554. if (is_sonic) SetMaterialAndSpriteColor_Float(0.25, 0.10588, 0.48235, 0.94902);
  2555. else if (is_shadow) SetMaterialAndSpriteColor_Float(0.25, 0.92157, 0.19608, 0.13725);
  2556. else if (is_metalsonic) SetMaterialAndSpriteColor_Float(0.25, 0, 0.11373, 0.54118);
  2557. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL, 99, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2558. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2559. }
  2560. if (Gauge2 > 10000 && Gauge2 < 20000)
  2561. {
  2562. energy_lvl_glow = 0;
  2563. if (is_sonic) SetMaterialAndSpriteColor_Float(0.35, 0.10588, 0.48235, 0.94902);
  2564. else if (is_shadow) SetMaterialAndSpriteColor_Float(0.35, 0.92157, 0.19608, 0.13725);
  2565. else if (is_metalsonic) SetMaterialAndSpriteColor_Float(0.35, 0, 0.11373, 0.54118);
  2566. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL, ((Gauge2-10000) / 100), -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2567. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2568. }
  2569. if (Gauge2 >= 20000 && Gauge2 < 30000)
  2570. {
  2571. if (is_sonic) SetMaterialAndSpriteColor_Float(0.5, 0.10588, 0.48235, 0.94902);
  2572. else if (is_shadow) SetMaterialAndSpriteColor_Float(0.5, 0.92157, 0.19608, 0.13725);
  2573. else if (is_metalsonic) SetMaterialAndSpriteColor_Float(0.5, 0, 0.11373, 0.54118);
  2574. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL, 99, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2575. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2576. }
  2577. if (Gauge2 > 20000 && Gauge2 < 30000)
  2578. {
  2579. energy_lvl_glow = 0;
  2580. if (is_sonic) SetMaterialAndSpriteColor_Float(1, 0.10588, 0.48235, 0.94902);
  2581. else if (is_shadow) SetMaterialAndSpriteColor_Float(1, 0.92157, 0.19608, 0.13725);
  2582. else if (is_metalsonic) SetMaterialAndSpriteColor_Float(1, 0, 0.11373, 0.54118);
  2583. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL, ((Gauge2 - 20000) / 100), -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2584. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2585. }
  2586. else if (Gauge2 >= 30000)
  2587. {
  2588.  
  2589. HUD_SPRITE_ENERGYLVL.p.x = 810 * 1.3f * HorizontalResolution / 1680.0f;
  2590. HUD_SPRITE_ENERGYLVL.p.y = 660 * 1.3f * VerticalResolution / 1050.0f;
  2591. if (is_sonic) SetMaterialAndSpriteColor_Float(1, 0.10588, 0.48235, 0.94902);
  2592. else if (is_shadow) SetMaterialAndSpriteColor_Float(1, 0.92157, 0.19608, 0.13725);
  2593. else if (is_metalsonic) SetMaterialAndSpriteColor_Float(1, 0, 0.11373, 0.54118);
  2594. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL, 99, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2595. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2596. HUD_SPRITE_ENERGYLVL_GLOW.p.x = 810 * 1.3f * HorizontalResolution / 1680.0f;
  2597. HUD_SPRITE_ENERGYLVL_GLOW.p.y = 660 * 1.3f * VerticalResolution / 1050.0f;
  2598. if (Gauge >= 10000)
  2599. {
  2600. energy_lvl_glow = energy_glow;
  2601. if (!glow_down && lvl_glow_down) lvl_glow_down = false;
  2602. }
  2603. if (energy_lvl_glow <= 20)
  2604. {
  2605. if (!lvl_glow_down)
  2606. {
  2607. if (energy_lvl_glow < 20)
  2608. {
  2609. ++energy_lvl_glow;
  2610. SetMaterialAndSpriteColor_Float((0 + energy_lvl_glow) / 20.0f, 1, 1, 1);
  2611. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL_GLOW, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2612. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL_GLOW, 1, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2613. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL_GLOW, 2, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2614. }
  2615. else if (energy_lvl_glow == 20)
  2616. {
  2617. energy_lvl_glow = 0;
  2618. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2619. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL_GLOW, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2620. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL_GLOW, 1, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2621. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL_GLOW, 2, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2622. lvl_glow_down = true;
  2623. }
  2624. }
  2625. else if (lvl_glow_down)
  2626. {
  2627. if (energy_lvl_glow < 20)
  2628. {
  2629. ++energy_lvl_glow;
  2630. SetMaterialAndSpriteColor_Float((20 - energy_lvl_glow) / 20.0f, 1, 1, 1);
  2631. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL_GLOW, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2632. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL_GLOW, 1, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2633. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL_GLOW, 2, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2634. }
  2635. else if (energy_lvl_glow == 20)
  2636. {
  2637. energy_lvl_glow = 0;
  2638. SetMaterialAndSpriteColor_Float(0, 1, 1, 1);
  2639. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL_GLOW, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2640. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL_GLOW, 1, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2641. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL_GLOW, 2, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2642. lvl_glow_down = false;
  2643. }
  2644. }
  2645. }
  2646. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2647. }
  2648.  
  2649.  
  2650.  
  2651. //LVL UPS
  2652. if (Gauge2 >= 0 && Gauge2 < 10000)
  2653. {
  2654. LV1_obtained = false;
  2655. LV2_obtained = false;
  2656. LV3_obtained = false;
  2657. LV1_usable = false;
  2658. LV2_usable = false;
  2659. LV3_usable = false;
  2660. lv1_stretch = 0;
  2661. lv2_stretch = 0;
  2662. lv3_stretch = 0;
  2663. }
  2664. else if (Gauge2 >= 10000 && Gauge2 < 20000)
  2665. {
  2666. HUD_SPRITE_LVLUPS.p.x = 810 * 1.3f * HorizontalResolution / 1680.0f;
  2667. HUD_SPRITE_LVLUPS.p.y = 660 * 1.3f * VerticalResolution / 1050.0f;
  2668. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 9, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2669. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 12, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2670. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 15, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2671. if (Gauge >= 10000)
  2672. {
  2673. sonic_lv1_glow = energy_glow;
  2674. if (!glow_down && sonic_lv1_glow_down) sonic_lv1_glow_down = false;
  2675. }
  2676. if (sonic_lv1_glow <= 20)
  2677. {
  2678. if (!sonic_lv1_glow_down)
  2679. {
  2680. if (sonic_lv1_glow < 20)
  2681. {
  2682. ++sonic_lv1_glow;
  2683. SetMaterialAndSpriteColor_Float((0 + sonic_lv1_glow) / 20.0f, 1, 1, 1);
  2684. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2685. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 3, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2686. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 6, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2687. }
  2688. else if (sonic_lv1_glow == 20)
  2689. {
  2690. sonic_lv1_glow = 0;
  2691. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2692. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2693. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 3, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2694. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 6, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2695. sonic_lv1_glow_down = true;
  2696. }
  2697. }
  2698. else if (sonic_lv1_glow_down)
  2699. {
  2700. if (sonic_lv1_glow < 20)
  2701. {
  2702. ++sonic_lv1_glow;
  2703. SetMaterialAndSpriteColor_Float((20 - sonic_lv1_glow) / 20.0f, 1, 1, 1);
  2704. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2705. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 3, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2706. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 6, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2707. }
  2708. else if (sonic_lv1_glow == 20)
  2709. {
  2710. sonic_lv1_glow = 0;
  2711. SetMaterialAndSpriteColor_Float(0, 1, 1, 1);
  2712. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2713. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 3, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2714. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 6, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2715. sonic_lv1_glow_down = false;
  2716. }
  2717. }
  2718. }
  2719. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2720. if (!LV1_obtained)
  2721. {
  2722. HUD_SPRITE_LVLUPS_GLOW.p.x = 1104 * 1.3f * HorizontalResolution / 1680.0f;
  2723. HUD_SPRITE_LVLUPS_GLOW.p.y = 731 * 1.3f * VerticalResolution / 1050.0f;
  2724. if (lv1_stretch < 60)
  2725. {
  2726. if (!LV1_active)
  2727. {
  2728. LV1_usable = true;
  2729. }
  2730. ++lv1_stretch;
  2731. SetMaterialAndSpriteColor_Float((60 - lv1_stretch) / 60.0f, 1, 1, 1);
  2732. HUD_SPRITE_LVLUPS_GLOW.sx = ((60 + (2.0f * lv1_stretch)) / 60.0f) * 1.3f * HorizontalResolution / 1680.0f;
  2733. HUD_SPRITE_LVLUPS_GLOW.sy = ((60 + (2.0f * lv1_stretch)) / 60.0f) * 1.3f * VerticalResolution / 1050.0f;
  2734. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS_GLOW, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2735. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS_GLOW, 3, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2736. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS_GLOW, 6, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2737. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2738. }
  2739. else if (lv1_stretch == 60)
  2740. {
  2741. lv1_stretch = 0;
  2742. LV1_obtained = true;
  2743. }
  2744. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2745. }
  2746. }
  2747. else if (Gauge2 >= 20000 && Gauge2 < 30000)
  2748. {
  2749. lv1_stretch = 0;
  2750. LV1_obtained = false;
  2751. sonic_lv1_glow = 0;
  2752. sonic_lv1_glow_down = false;
  2753. HUD_SPRITE_LVLUPS.p.x = 810 * 1.3f * HorizontalResolution / 1680.0f;
  2754. HUD_SPRITE_LVLUPS.p.y = 660 * 1.3f * VerticalResolution / 1050.0f;
  2755. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 10, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2756. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 13, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2757. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 16, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2758. if (Gauge >= 10000)
  2759. {
  2760. sonic_lv2_glow = energy_glow;
  2761. if (!glow_down && sonic_lv2_glow_down) sonic_lv2_glow_down = false;
  2762. }
  2763. if (sonic_lv2_glow <= 20)
  2764. {
  2765. if (!sonic_lv2_glow_down)
  2766. {
  2767. if (sonic_lv2_glow < 20)
  2768. {
  2769. ++sonic_lv2_glow;
  2770. SetMaterialAndSpriteColor_Float((0 + sonic_lv2_glow) / 20.0f, 1, 1, 1);
  2771. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 1, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2772. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 4, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2773. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 7, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2774. }
  2775. else if (sonic_lv2_glow == 20)
  2776. {
  2777. sonic_lv2_glow = 0;
  2778. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2779. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 1, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2780. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 4, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2781. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 7, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2782. sonic_lv2_glow_down = true;
  2783. }
  2784. }
  2785. else if (sonic_lv2_glow_down)
  2786. {
  2787. if (sonic_lv2_glow < 20)
  2788. {
  2789. ++sonic_lv2_glow;
  2790. SetMaterialAndSpriteColor_Float((20 - sonic_lv2_glow) / 20.0f, 1, 1, 1);
  2791. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 1, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2792. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 4, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2793. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 7, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2794. }
  2795. else if (sonic_lv2_glow == 20)
  2796. {
  2797. sonic_lv2_glow = 0;
  2798. SetMaterialAndSpriteColor_Float(0, 1, 1, 1);
  2799. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 1, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2800. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 4, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2801. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 7, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2802. sonic_lv2_glow_down = false;
  2803. }
  2804. }
  2805. }
  2806. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2807. if (!LV2_obtained)
  2808. {
  2809. HUD_SPRITE_LVLUPS_GLOW.p.x = 1119 * 1.3f * HorizontalResolution / 1680.0f;
  2810. HUD_SPRITE_LVLUPS_GLOW.p.y = 731 * 1.3f * VerticalResolution / 1050.0f;
  2811.  
  2812.  
  2813. if (lv2_stretch < 60)
  2814. {
  2815. if (!LV2_active)
  2816. {
  2817. LV2_usable = true;
  2818. }
  2819. ++lv2_stretch;
  2820. SetMaterialAndSpriteColor_Float((60 - lv2_stretch) / 60.0f, 1, 1, 1);
  2821. HUD_SPRITE_LVLUPS_GLOW.sx = ((60 + (2.0f * lv2_stretch)) / 60.0f) * 1.3f * HorizontalResolution / 1680.0f;
  2822. HUD_SPRITE_LVLUPS_GLOW.sy = ((60 + (2.0f * lv2_stretch)) / 60.0f) * 1.3f * VerticalResolution / 1050.0f;
  2823. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS_GLOW, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2824. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS_GLOW, 3, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2825. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS_GLOW, 6, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2826. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2827. }
  2828. else if (lv2_stretch == 60)
  2829. {
  2830. lv2_stretch = 0;
  2831. LV2_obtained = true;
  2832. }
  2833. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2834. }
  2835. }
  2836. else if (Gauge2 >= 30000)
  2837. {
  2838. lv1_stretch = 0;
  2839. lv2_stretch = 0;
  2840. LV1_obtained = false;
  2841. LV2_obtained = false;
  2842. LV1_usable = false;
  2843. LV2_usable = false;
  2844. sonic_lv1_glow = 0;
  2845. sonic_lv1_glow_down = false;
  2846. sonic_lv2_glow = 0;
  2847. sonic_lv2_glow_down = false;
  2848. HUD_SPRITE_LVLUPS.p.x = 810 * 1.3f * HorizontalResolution / 1680.0f;
  2849. HUD_SPRITE_LVLUPS.p.y = 660 * 1.3f * VerticalResolution / 1050.0f;
  2850. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 11, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2851. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 14, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2852. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 17, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2853. if (Gauge >= 10000)
  2854. {
  2855. sonic_lv3_glow = energy_glow;
  2856. if (!glow_down && sonic_lv3_glow_down) sonic_lv3_glow_down = false;
  2857. }
  2858. if (sonic_lv3_glow <= 20)
  2859. {
  2860. if (!sonic_lv3_glow_down)
  2861. {
  2862. if (sonic_lv3_glow < 20)
  2863. {
  2864. ++sonic_lv3_glow;
  2865. SetMaterialAndSpriteColor_Float((0 + sonic_lv3_glow) / 20.0f, 1, 1, 1);
  2866. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 2, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2867. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 5, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2868. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 8, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2869. }
  2870. else if (sonic_lv3_glow == 20)
  2871. {
  2872. sonic_lv3_glow = 0;
  2873. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2874. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 2, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2875. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 5, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2876. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 8, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2877. sonic_lv3_glow_down = true;
  2878. }
  2879. }
  2880. else if (sonic_lv3_glow_down)
  2881. {
  2882. if (sonic_lv3_glow < 20)
  2883. {
  2884. ++sonic_lv3_glow;
  2885. SetMaterialAndSpriteColor_Float((20 - sonic_lv3_glow) / 20.0f, 1, 1, 1);
  2886. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 2, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2887. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 5, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2888. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 8, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2889. }
  2890. else if (sonic_lv3_glow == 20)
  2891. {
  2892. sonic_lv3_glow = 0;
  2893. SetMaterialAndSpriteColor_Float(0, 1, 1, 1);
  2894. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 2, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2895. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 5, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2896. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 8, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2897. sonic_lv3_glow_down = false;
  2898. }
  2899. }
  2900. }
  2901. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2902. if (!LV3_obtained)
  2903. {
  2904. HUD_SPRITE_LVLUPS_GLOW.p.x = 1134 * 1.3f * HorizontalResolution / 1680.0f;
  2905. HUD_SPRITE_LVLUPS_GLOW.p.y = 731 * 1.3f * VerticalResolution / 1050.0f;
  2906.  
  2907.  
  2908. if (lv3_stretch < 60)
  2909. {
  2910. if (!LV3_active)
  2911. {
  2912. LV3_usable = true;
  2913. }
  2914. ++lv3_stretch;
  2915. SetMaterialAndSpriteColor_Float((60 - lv3_stretch) / 60.0f, 1, 1, 1);
  2916. HUD_SPRITE_LVLUPS_GLOW.sx = ((60 + (2.0f * lv3_stretch)) / 60.0f) * 1.3f * HorizontalResolution / 1680.0f;
  2917. HUD_SPRITE_LVLUPS_GLOW.sy = ((60 + (2.0f * lv3_stretch)) / 60.0f) * 1.3f * VerticalResolution / 1050.0f;
  2918. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS_GLOW, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2919. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS_GLOW, 3, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2920. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS_GLOW, 6, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  2921. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2922. }
  2923. else if (lv3_stretch == 60)
  2924. {
  2925. lv3_stretch = 0;
  2926. LV3_obtained = true;
  2927. }
  2928. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2929. }
  2930. }
  2931.  
  2932.  
  2933. //LEVEL ACTIVATION
  2934. if (GameState != 16)
  2935. {
  2936. if (LV1_usable && !LV2_usable && !LV3_usable)
  2937. {
  2938. if (ControllerPointers[0]->PressedButtons & Buttons_B)
  2939. {
  2940. PlaySound(1250, 0, 0, 0);
  2941. LV1_obtained = false;
  2942. LV1_usable = false;
  2943. LV1_active = true;
  2944. Gauge2 = 9999;
  2945. sonic_lv1_glow = 0;
  2946. sonic_lv2_glow = 0;
  2947. sonic_lv3_glow = 0;
  2948. lvl_glow_down = false;
  2949. sonic_lv1_glow_down = false;
  2950. sonic_lv2_glow_down = false;
  2951. sonic_lv3_glow_down = false;
  2952. star_glow = 0;
  2953. circle_glow = 0;
  2954. level3_glow = 0;
  2955. }
  2956. }
  2957. }
  2958. if (LV1_active)
  2959. {
  2960. if (GameState != 16)
  2961. {
  2962. if (!RED_GEM_active)
  2963. {
  2964. Gauge2 -= 8;
  2965. }
  2966. else
  2967. {
  2968. Gauge2 -= 4;
  2969. }
  2970. if (Gauge2 <= 0)
  2971. {
  2972. LV1_active = false;
  2973. PlaySound(1247, 0, 0, 0);
  2974. }
  2975. //3D HUD
  2976. ParticleDepthOverride = 2000.0f;
  2977. if (star_glow < 10)
  2978. {
  2979. ++star_glow;
  2980. SetMaterialAndSpriteColor_Float((10 - star_glow) / 10.0f, 1, 1, 1);
  2981. HUD3D_SPRITE_STAR.sx = ((3 + (star_glow / 2.0f)) / 10.0f) * 1.3f * HorizontalResolution / 1680.0f;
  2982. HUD3D_SPRITE_STAR.sy = ((3 + (star_glow / 2.0f)) / 10.0f) * 1.3f * VerticalResolution / 1050.0f;
  2983. njDrawSprite3D(&HUD3D_SPRITE_STAR, 0, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR | NJD_SPRITE_SCALE);
  2984. }
  2985. else if (star_glow == 10)
  2986. {
  2987. star_glow = 0;
  2988. SetMaterialAndSpriteColor_Float(0, 1, 1, 1);
  2989. HUD3D_SPRITE_STAR.sx = 1.3f * HorizontalResolution / 1680.0f;
  2990. HUD3D_SPRITE_STAR.sy = 1.3f * VerticalResolution / 1050.0f;
  2991. njDrawSprite3D(&HUD3D_SPRITE_STAR, 0, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR | NJD_SPRITE_SCALE);
  2992. }
  2993. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  2994. ParticleDepthOverride = 0.0f;
  2995. }
  2996.  
  2997. //2D HUD
  2998.  
  2999. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 9, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3000. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 12, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3001. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 15, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3002. if (sonic_lv1_glow <= 2)
  3003. {
  3004. if (!sonic_lv1_glow_down)
  3005. {
  3006. if (sonic_lv1_glow < 2)
  3007. {
  3008. ++sonic_lv1_glow;
  3009. SetMaterialAndSpriteColor_Float((0 + sonic_lv1_glow) / 2.0f, 1, 1, 1);
  3010. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3011. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 3, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3012. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 6, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3013. }
  3014. else if (sonic_lv1_glow == 2)
  3015. {
  3016. sonic_lv1_glow = 0;
  3017. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3018. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3019. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 3, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3020. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 6, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3021. sonic_lv1_glow_down = true;
  3022. }
  3023. }
  3024. else if (sonic_lv1_glow_down)
  3025. {
  3026. if (sonic_lv1_glow < 2)
  3027. {
  3028. ++sonic_lv1_glow;
  3029. SetMaterialAndSpriteColor_Float((2 - sonic_lv1_glow) / 2.0f, 1, 1, 1);
  3030. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3031. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 3, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3032. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 6, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3033. }
  3034. else if (sonic_lv1_glow == 2)
  3035. {
  3036. sonic_lv1_glow = 0;
  3037. SetMaterialAndSpriteColor_Float(0, 1, 1, 1);
  3038. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3039. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 3, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3040. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 6, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3041. sonic_lv1_glow_down = false;
  3042. }
  3043. }
  3044. }
  3045. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3046. }
  3047. if (GameState != 16)
  3048. {
  3049. if (LV3_usable)
  3050. {
  3051. if (ControllerPointers[0]->PressedButtons & Buttons_B)
  3052. {
  3053. PlaySound(1250, 0, 0, 0);
  3054. LV1_obtained = false;
  3055. LV2_obtained = false;
  3056. LV3_obtained = false;
  3057. LV1_usable = false;
  3058. LV2_usable = false;
  3059. LV3_usable = false;
  3060. LV3_active = true;
  3061. Gauge2 = 9999;
  3062. sonic_lv1_glow = 0;
  3063. sonic_lv2_glow = 0;
  3064. sonic_lv3_glow = 0;
  3065. lvl_glow_down = false;
  3066. sonic_lv1_glow_down = false;
  3067. sonic_lv2_glow_down = false;
  3068. sonic_lv3_glow_down = false;
  3069. star_glow = 0;
  3070. circle_glow = 0;
  3071. level3_glow = 0;
  3072. }
  3073. }
  3074. }
  3075. if (LV3_active)
  3076. {
  3077. if (GameState != 16)
  3078. {
  3079. if (is_sonic) Gauge += 8;
  3080. if (is_shadow) Gauge += 4;
  3081. if (!RED_GEM_active) Gauge2 -= 8;
  3082. else Gauge2 -= 4;
  3083. if (is_metalsonic && (!(Gauge <= 0 && is_hovering) && !just_charged)) Gauge += 16;
  3084. if (Gauge2 <= 0)
  3085. {
  3086. LV3_active = false;
  3087. sparkles.clear();
  3088. sparkletimer = 0;
  3089. PlaySound(1247, 0, 0, 0);
  3090. }
  3091. //3D HUD
  3092. ParticleDepthOverride = 2000.0f;
  3093. if (star_glow < 10)
  3094. {
  3095. ++star_glow;
  3096. SetMaterialAndSpriteColor_Float((10 - star_glow) / 10.0f, 1, 1, 1);
  3097. HUD3D_SPRITE_STAR.sx = ((3 + (star_glow / 2.0f)) / 10.0f) * 1.3f * HorizontalResolution / 1680.0f;
  3098. HUD3D_SPRITE_STAR.sy = ((3 + (star_glow / 2.0f)) / 10.0f) * 1.3f * VerticalResolution / 1050.0f;
  3099. njDrawSprite3D(&HUD3D_SPRITE_STAR, 0, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR | NJD_SPRITE_SCALE);
  3100. }
  3101. else if (star_glow == 10)
  3102. {
  3103. star_glow = 0;
  3104. SetMaterialAndSpriteColor_Float(0, 1, 1, 1);
  3105. HUD3D_SPRITE_STAR.sx = 1.3f * HorizontalResolution / 1680.0f;
  3106. HUD3D_SPRITE_STAR.sy = 1.3f * VerticalResolution / 1050.0f;
  3107. njDrawSprite3D(&HUD3D_SPRITE_STAR, 0, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR | NJD_SPRITE_SCALE);
  3108. }
  3109. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3110. if (circle_glow < 14)
  3111. {
  3112. ++circle_glow;
  3113. SetMaterialAndSpriteColor_Float((14 - circle_glow) / 14.0f, 1, 1, 1);
  3114. HUD3D_SPRITE_CIRCLE.sx = (circle_glow / 14.0f) * 1.3f * HorizontalResolution / 1680.0f;
  3115. HUD3D_SPRITE_CIRCLE.sy = (circle_glow / 14.0f) * 1.3f * VerticalResolution / 1050.0f;
  3116. njDrawSprite3D(&HUD3D_SPRITE_CIRCLE, 1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR | NJD_SPRITE_SCALE);
  3117. }
  3118. else if (circle_glow == 14)
  3119. {
  3120. SetMaterialAndSpriteColor_Float(0, 1, 1, 1);
  3121. HUD3D_SPRITE_CIRCLE.sx = 1.3f * HorizontalResolution / 1680.0f;
  3122. HUD3D_SPRITE_CIRCLE.sy = 1.3f * VerticalResolution / 1050.0f;
  3123. njDrawSprite3D(&HUD3D_SPRITE_CIRCLE, 1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR | NJD_SPRITE_SCALE);
  3124. ++circle_glow;
  3125. }
  3126. else if (circle_glow > 14)
  3127. {
  3128. if (++circle_glow == 20)
  3129. {
  3130. circle_glow = 0;
  3131. }
  3132. }
  3133. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3134.  
  3135.  
  3136. //Level 3 sparkles
  3137. ParticleDepthOverride = 0.0f;
  3138. EntityData1 *co1 = EntityData1Ptrs[0];
  3139. for (auto it = sparkles.begin(); it != sparkles.end(); )
  3140. {
  3141. sparklesprite.p = it->pos;
  3142. njDrawSprite3D_Queue(&sparklesprite, 5 + (it->frame++ / 2), NJD_SPRITE_ALPHA | NJD_SPRITE_SCALE, (QueuedModelFlagsB)0);
  3143.  
  3144. if (it->frame >= 16)
  3145. it = sparkles.erase(it);
  3146. else
  3147. ++it;
  3148. }
  3149. if (++sparkletimer == 3)
  3150. {
  3151. sparkledata sp = {};
  3152. NJS_VECTOR pos = { 0, ((float)rand() / RAND_MAX) * 8.0, 0 };
  3153. njPushMatrix(nullptr);
  3154. njRotateX(nullptr, rand() & 0xFFFF);
  3155. njRotateY(nullptr, rand() & 0xFFFF);
  3156. njRotateZ(nullptr, rand() & 0xFFFF);
  3157. njCalcVector(nullptr, &pos, &sp.pos);
  3158. njPopMatrix(1);
  3159. sp.pos.x += co1->CollisionInfo->CollisionArray->origin.x;
  3160. sp.pos.y += co1->CollisionInfo->CollisionArray->origin.y;
  3161. sp.pos.z += co1->CollisionInfo->CollisionArray->origin.z;
  3162. sparkles.push_back(sp);
  3163. sparkletimer = 0;
  3164. }
  3165. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3166. }
  3167.  
  3168. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 11, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3169. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 14, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3170. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 17, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3171. if (sonic_lv3_glow <= 2)
  3172. {
  3173. if (!sonic_lv3_glow_down)
  3174. {
  3175. if (sonic_lv3_glow < 2)
  3176. {
  3177. ++sonic_lv3_glow;
  3178. SetMaterialAndSpriteColor_Float((0 + sonic_lv3_glow) / 2.0f, 1, 1, 1);
  3179. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 2, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3180. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 5, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3181. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 8, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3182. }
  3183. else if (sonic_lv3_glow == 2)
  3184. {
  3185. sonic_lv3_glow = 0;
  3186. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3187. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 2, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3188. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 5, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3189. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 8, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3190. sonic_lv3_glow_down = true;
  3191. }
  3192. }
  3193. else if (sonic_lv3_glow_down)
  3194. {
  3195. if (sonic_lv3_glow < 2)
  3196. {
  3197. ++sonic_lv3_glow;
  3198. SetMaterialAndSpriteColor_Float((2 - sonic_lv3_glow) / 2.0f, 1, 1, 1);
  3199. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 2, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3200. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 5, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3201. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 8, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3202. }
  3203. else if (sonic_lv3_glow == 2)
  3204. {
  3205. sonic_lv3_glow = 0;
  3206. SetMaterialAndSpriteColor_Float(0, 1, 1, 1);
  3207. if (is_sonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 2, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3208. else if (is_shadow) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 5, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3209. else if (is_metalsonic) njDrawSprite2D_Queue(&HUD_SPRITE_LVLUPS, 8, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3210. sonic_lv3_glow_down = false;
  3211. }
  3212. }
  3213. }
  3214. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3215. if (is_sonic) SetMaterialAndSpriteColor_Float(0.75, 0.10588, 0.48235, 0.94902);
  3216. else if (is_shadow) SetMaterialAndSpriteColor_Float(0.75, 0.92157, 0.19608, 0.13725);
  3217. else if (is_metalsonic) SetMaterialAndSpriteColor_Float(0.75, 0, 0.11373, 0.54118);
  3218. njDrawSprite2D_Queue(&HUD_SPRITE_ENERGYLVL, (Gauge2 / 100), -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3219. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3220. }
  3221. }
  3222.  
  3223. else if (GetCharacterID(0) == Characters_Tails)
  3224. {
  3225. HUD_SPRITE.p.x = 110 * 1.3f * HorizontalResolution / 1680.0f;
  3226. HUD_SPRITE.p.y = 205 * 1.3f * VerticalResolution / 1050.0f;
  3227. njDrawSprite2D_Queue(&HUD_SPRITE, 5, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3228. }
  3229. else if (GetCharacterID(0) == Characters_Knuckles)
  3230. {
  3231. HUD_SPRITE.p.x = 110 * 1.3f * HorizontalResolution / 1680.0f;
  3232. HUD_SPRITE.p.y = 205 * 1.3f * VerticalResolution / 1050.0f;
  3233. njDrawSprite2D_Queue(&HUD_SPRITE, 6, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3234. }
  3235. else if (GetCharacterID(0) == Characters_Amy)
  3236. {
  3237. HUD_SPRITE.p.x = 110 * 1.3f * HorizontalResolution / 1680.0f;
  3238. HUD_SPRITE.p.y = 205 * 1.3f * VerticalResolution / 1050.0f;
  3239. njDrawSprite2D_Queue(&HUD_SPRITE, 7, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3240. }
  3241. else if (GetCharacterID(0) == Characters_Gamma)
  3242. {
  3243. HUD_SPRITE.p.x = 110 * 1.3f * HorizontalResolution / 1680.0f;
  3244. HUD_SPRITE.p.y = 205 * 1.3f * VerticalResolution / 1050.0f;
  3245. njDrawSprite2D_Queue(&HUD_SPRITE, 8, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3246. }
  3247.  
  3248.  
  3249. //Ring Counter
  3250. HUD_SPRITE_NUMBERS.p.x = 157 * 1.3f * HorizontalResolution / 1680.0f;
  3251. HUD_SPRITE_NUMBERS.p.y = 174 * 1.3f * VerticalResolution / 1050.0f;
  3252. HUD_SPRITE_RINGS_0_RED.p.x = (HUD_SPRITE_NUMBERS.p.x/1.3f) + (55 * HorizontalResolution / 1680.0f);
  3253. HUD_SPRITE_RINGS_0_RED.p.y = (HUD_SPRITE_NUMBERS.p.y/1.3f) + (42 * VerticalResolution / 1050.0f);
  3254. if (Rings == 0)
  3255. {
  3256. njDrawSprite2D_Queue(&HUD_SPRITE_RINGS_0_RED, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3257. ++zero_ring_alpha;
  3258. SetMaterialAndSpriteColor_Float((9 - zero_ring_alpha) / 9.0f, 1, 1, 1);
  3259. njDrawSprite2D_Queue(&HUD_SPRITE_RINGS_0_RED, 1, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3260. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3261. if (zero_ring_alpha == 9)
  3262. {
  3263. zero_ring_alpha = 0;
  3264. }
  3265. }
  3266. else if (Rings > 0 && Rings < 1000)
  3267. {
  3268. HudDisplayZerosSTH06(Rings, 3, &HUD_SPRITE_NUMBERS);
  3269. zero_ring_alpha = 0;
  3270. }
  3271. else if (Rings >= 1000)
  3272. {
  3273. HudDisplayZerosSTH06(Rings, 4, &HUD_SPRITE_NUMBERS);
  3274. zero_ring_alpha = 0;
  3275. }
  3276. HUD_SPRITE_RING_ANIM.p.x = 161 * HorizontalResolution / 1680.0f;
  3277. HUD_SPRITE_RING_ANIM.p.y = 225 * VerticalResolution / 1050.0f;
  3278. if (Rings - OldRingsHUD > 0)
  3279. {
  3280. can_animate_loss = 0;
  3281. ++can_animate_gain;
  3282. njDrawSprite2D_Queue(&HUD_SPRITE_RING_ANIM, can_animate_gain, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3283. if (can_animate_gain == 7)
  3284. {
  3285. OldRingsHUD = Rings;
  3286. can_animate_gain = 0;
  3287. }
  3288. }
  3289. else if (Rings - OldRingsHUD < 0)
  3290. {
  3291. can_animate_gain = 0;
  3292. ++can_animate_loss;
  3293. njDrawSprite2D_Queue(&HUD_SPRITE_RING_ANIM, 8 - can_animate_loss, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3294. if (can_animate_loss == 7)
  3295. {
  3296. OldRingsHUD = Rings;
  3297. can_animate_loss = 0;
  3298. }
  3299. }
  3300. else if (OldRingsHUD == Rings)
  3301. {
  3302. njDrawSprite2D_Queue(&HUD_SPRITE_RING_ANIM, 0, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3303. }
  3304.  
  3305. //Timer Minutes
  3306. HUD_SPRITE_NUMBERS.p.x = (130.846 * 1.3f * HorizontalResolution / 1680.0f);
  3307. HUD_SPRITE_NUMBERS.p.y = (124 * 1.3f * VerticalResolution / 1050.0f);
  3308. HudDisplayZerosSTH06(TimeMinutes, 2, &HUD_SPRITE_NUMBERS);
  3309.  
  3310. //Timer Seconds
  3311. HUD_SPRITE_NUMBERS.p.x = HUD_SPRITE_NUMBERS.p.x + (35 *1.3f * HorizontalResolution / ( 1680.0f));
  3312. HUD_SPRITE_NUMBERS.p.y = HUD_SPRITE_NUMBERS.p.y;
  3313. HudDisplayZerosSTH06(TimeSeconds, 2, &HUD_SPRITE_NUMBERS);
  3314.  
  3315. //Timer Frames
  3316. HUD_SPRITE_NUMBERS.p.x = HUD_SPRITE_NUMBERS.p.x + (37 *1.3f * HorizontalResolution / ( 1680.0f));
  3317. HUD_SPRITE_NUMBERS.p.y = HUD_SPRITE_NUMBERS.p.y;
  3318. HudDisplayFramesSTH06(TimeFrames, 3, &HUD_SPRITE_NUMBERS);
  3319.  
  3320.  
  3321.  
  3322.  
  3323.  
  3324.  
  3325. //Lives Counter
  3326. HUD_SPRITE_NUMBERS.p.y = 224 * 1.3f * VerticalResolution / 1050.0f;
  3327. if (Lives < 10)
  3328. {
  3329. HUD_SPRITE_NUMBERS.p.x = 194.538 * 1.3f * HorizontalResolution / 1680.0f;
  3330. HudDisplayNoZerosSTH06(Lives, 1, &HUD_SPRITE_NUMBERS);
  3331. }
  3332. else if (Lives >= 10)
  3333. {
  3334. HUD_SPRITE_NUMBERS.p.x = 176.538 * 1.3f * HorizontalResolution / 1680.0f;
  3335. HudDisplayNoZerosSTH06(Lives, 2, &HUD_SPRITE_NUMBERS);
  3336. }
  3337.  
  3338.  
  3339.  
  3340.  
  3341. //Score Counter
  3342. HUD_SPRITE_NUMBERS.p.y = 71.692 * 1.3f * VerticalResolution / 1050.0f;
  3343. if (EnemyBonus < 10)
  3344. {
  3345. HUD_SPRITE_NUMBERS.p.x = 274.692 * 1.3f * HorizontalResolution / 1680.0f;
  3346. HudDisplayNoZerosSTH06(EnemyBonus, 1, &HUD_SPRITE_NUMBERS);
  3347. }
  3348. else if (EnemyBonus >= 10 && EnemyBonus < 100)
  3349. {
  3350. HUD_SPRITE_NUMBERS.p.x = 256.692 * 1.3f * HorizontalResolution / 1680.0f;
  3351. HudDisplayNoZerosSTH06(EnemyBonus, 2, &HUD_SPRITE_NUMBERS);
  3352. }
  3353. else if (EnemyBonus >= 100 && EnemyBonus < 1000)
  3354. {
  3355. HUD_SPRITE_NUMBERS.p.x = 238.692 * 1.3f * HorizontalResolution / 1680.0f;
  3356. HudDisplayNoZerosSTH06(EnemyBonus, 3, &HUD_SPRITE_NUMBERS);
  3357. }
  3358. else if (EnemyBonus >= 1000 && EnemyBonus < 10000)
  3359. {
  3360. HUD_SPRITE_NUMBERS.p.x = 220.692 * 1.3f * HorizontalResolution / 1680.0f;
  3361. HudDisplayNoZerosSTH06(EnemyBonus, 4, &HUD_SPRITE_NUMBERS);
  3362. }
  3363. else if (EnemyBonus >= 10000 && EnemyBonus < 100000)
  3364. {
  3365. HUD_SPRITE_NUMBERS.p.x = 202.692 * 1.3f * HorizontalResolution / 1680.0f;
  3366. HudDisplayNoZerosSTH06(EnemyBonus, 5, &HUD_SPRITE_NUMBERS);
  3367. }
  3368. else if (EnemyBonus >= 100000 && EnemyBonus < 1000000)
  3369. {
  3370. HUD_SPRITE_NUMBERS.p.x = 184.692 * 1.3f * HorizontalResolution / 1680.0f;
  3371. HudDisplayNoZerosSTH06(EnemyBonus, 6, &HUD_SPRITE_NUMBERS);
  3372. }
  3373. else if (EnemyBonus >= 1000000 && EnemyBonus < 10000000)
  3374. {
  3375. HUD_SPRITE_NUMBERS.p.x = 166.692 * 1.3f * HorizontalResolution / 1680.0f;
  3376. HudDisplayNoZerosSTH06(EnemyBonus, 7, &HUD_SPRITE_NUMBERS);
  3377. }
  3378. else if (EnemyBonus >= 10000000 && EnemyBonus < 100000000)
  3379. {
  3380. HUD_SPRITE_NUMBERS.p.x = 148.692 * 1.3f * HorizontalResolution / 1680.0f;
  3381. HudDisplayNoZerosSTH06(EnemyBonus, 8, &HUD_SPRITE_NUMBERS);
  3382. }
  3383. else
  3384. {
  3385. HUD_SPRITE_NUMBERS.p.x = 130.692 * 1.3f * HorizontalResolution / 1680.0f;
  3386. HudDisplayNoZerosSTH06(EnemyBonus, 9, &HUD_SPRITE_NUMBERS);
  3387. }
  3388. }
  3389. }
  3390. }
  3391.  
  3392. void MetalSonicHUD(EntityData1 *a1, CharObj2 *a2)
  3393. {
  3394. if (GameState != 21 && is_metalsonic)
  3395. {
  3396. //Metal Sonic Gems Spakles
  3397. //Value checks
  3398. //if (NO_GEM_ON) draw = 0;
  3399. if (BLUE_GEM_ON) draw = 0;
  3400. else if (RED_GEM_ON) draw = 1;
  3401. else if (GREEN_GEM_ON) draw = 2;
  3402. else if (PURPLE_GEM_ON) draw = 3;
  3403. else if (SKY_GEM_ON) draw = 4;
  3404. else if (WHITE_GEM_ON) draw = 5;
  3405. else if (YELLOW_GEM_ON) draw = 6;
  3406. if (!NO_GEM_ON)
  3407. {
  3408. //Gems on Gauge
  3409. GEMSGauge_SPRITE.p.x = 1490 * HorizontalResolution / 1680.0f;
  3410. GEMSGauge_SPRITE.p.y = 872 * VerticalResolution / 1050.0f;
  3411. njDrawSprite2D_Queue(&GEMSGauge_SPRITE, draw, -1, NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR, (QueuedModelFlagsB)0);
  3412. //Actual Sparkles
  3413. njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_ONE);
  3414. njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_ONE);
  3415. //njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_SRCALPHA);
  3416. //njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_DESTALPHA);
  3417. njTextureShadingMode(NJD_TEX_SHADING_MODE_DECALALPHA);
  3418. //Big ones
  3419. ParticleDepthOverride = 0.0f;
  3420. EntityData1 *co1 = EntityData1Ptrs[0];
  3421. for (auto it = sparklesgems.begin(); it != sparklesgems.end(); )
  3422. {
  3423. NJS_VECTOR pos_gems = { 0, it->radius, 0 };
  3424. njPushMatrix(nullptr);
  3425. njRotateX(nullptr, it->rotation.x);
  3426. njRotateY(nullptr, it->rotation.y);
  3427. njRotateZ(nullptr, it->rotation.z);
  3428. njCalcVector(nullptr, &pos_gems, &sparklegemssprite.p);
  3429. njPopMatrix(1);
  3430. sparklegemssprite.p.x += it->pos_gems.x;
  3431. sparklegemssprite.p.y += it->pos_gems.y;
  3432. sparklegemssprite.p.z += it->pos_gems.z;
  3433. if (it->framegems < 11)
  3434. {
  3435. SetMaterialAndSpriteColor_Float((11 - it->framegems) / 11.0f, 1, 1, 1);
  3436. sparklegemssprite.sx = ((22 - it->framegems) / 22.0f) * 0.6f * 1.3f * HorizontalResolution / 1680.0f;
  3437. sparklegemssprite.sy = ((22 - it->framegems) / 22.0f) * 0.6f * 1.3f * VerticalResolution / 1050.0f;
  3438. if (Gauge > 0 && a2->AnimationThing.Index != 87) njDrawSprite3D_Queue(&sparklegemssprite, (2 * draw), NJD_SPRITE_ALPHA | NJD_SPRITE_SCALE, (QueuedModelFlagsB)0);
  3439. }
  3440. it->framegems++;
  3441. if (it->framegems >= 11)
  3442. it = sparklesgems.erase(it);
  3443. else
  3444. {
  3445. it->radius += 0.15f;
  3446. ++it;
  3447. }
  3448. }
  3449. if (++sparklegemstimer == 8)
  3450. {
  3451. sparklegemsdata sp = {};
  3452. //sp.radius = ((float)rand() / RAND_MAX) * 8.0;//if I wanted them to spawn in the center
  3453. sp.radius = (((float)rand() / RAND_MAX) * 3.0) + 4.0;//sp.radius = (((float)rand() / RAND_MAX) * max_radius) + min_radius; //if min_radius is 2, and max_radius is 3, then the sparkles will spawn between 2 and 5 (2+3) away
  3454. sp.rotation.x = rand() & 0xFFFF;
  3455. sp.rotation.y = rand() & 0xFFFF;
  3456. sp.rotation.z = rand() & 0xFFFF;
  3457. sp.pos_gems = co1->CollisionInfo->CollisionArray->origin;
  3458. sparklesgems.push_back(sp);
  3459. sparklegemstimer = 0;
  3460. }
  3461. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3462.  
  3463. //Small ones
  3464. ParticleDepthOverride = 0.0f;
  3465. for (auto it = sparklesgems_tiny.begin(); it != sparklesgems_tiny.end(); )
  3466. {
  3467. NJS_VECTOR pos_gems = { 0, it->radius, 0 };
  3468. njPushMatrix(nullptr);
  3469. njRotateX(nullptr, it->rotation.x);
  3470. njRotateY(nullptr, it->rotation.y);
  3471. njRotateZ(nullptr, it->rotation.z);
  3472. njCalcVector(nullptr, &pos_gems, &sparklegemssprite.p);
  3473. njPopMatrix(1);
  3474. sparklegemssprite.p.x += it->pos_gems.x;
  3475. sparklegemssprite.p.y += it->pos_gems.y;
  3476. sparklegemssprite.p.z += it->pos_gems.z;
  3477. if (it->framegems_tiny < 11)
  3478. {
  3479. SetMaterialAndSpriteColor_Float((11 - it->framegems_tiny) / 11.0f, 1, 1, 1);
  3480. sparklegemssprite.sx = ((22 - it->framegems_tiny) / 22.0f) * 0.0375f * 1.3f * HorizontalResolution / 1680.0f;
  3481. sparklegemssprite.sy = ((22 - it->framegems_tiny) / 22.0f) * 0.0375f * 1.3f * VerticalResolution / 1050.0f;
  3482. if (Gauge > 0 && a2->AnimationThing.Index != 87) njDrawSprite3D_Queue(&sparklegemssprite, ((2 * draw) + 1), NJD_SPRITE_ALPHA | NJD_SPRITE_SCALE, (QueuedModelFlagsB)0);
  3483. }
  3484. it->framegems_tiny++;
  3485. if (it->framegems_tiny >= 15)
  3486. it = sparklesgems_tiny.erase(it);
  3487. else
  3488. {
  3489. it->radius += 0.075f;
  3490. ++it;
  3491. }
  3492. }
  3493. if (++sparklegems_tiny_timer == 3)
  3494. {
  3495. sparklegemsdata sp = {};
  3496. sp.radius = (((float)rand() / RAND_MAX) * 2.0) + 2.5;
  3497. sp.rotation.x = rand() & 0xFFFF;
  3498. sp.rotation.y = rand() & 0xFFFF;
  3499. sp.rotation.z = rand() & 0xFFFF;
  3500. sp.pos_gems = co1->CollisionInfo->CollisionArray->origin;
  3501. sparklesgems_tiny.push_back(sp);
  3502. sparklegems_tiny_timer = 0;
  3503. }
  3504. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3505. }
  3506. njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_SRCALPHA);
  3507. njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_INVSRCALPHA);
  3508. njTextureShadingMode(NJD_TEX_SHADING_MODE_DECALALPHA);
  3509. }
  3510. }
  3511.  
  3512. void ShadowCBparticles(EntityData1 *a1, CharObj2 *a2)
  3513. {
  3514. if (GameState != 21 && is_shadow)
  3515. {
  3516. if (!CB_lv1 && CB_active)
  3517. {
  3518. //Actual Sparkles
  3519. njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_ONE);
  3520. njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_ONE);
  3521. //njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_SRCALPHA);
  3522. //njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_DESTALPHA);
  3523. njTextureShadingMode(NJD_TEX_SHADING_MODE_DECALALPHA);
  3524. //Red ones
  3525. ParticleDepthOverride = 0.0f;
  3526. EntityData1 *co1 = EntityData1Ptrs[0];
  3527. for (auto it = sparklesCB.begin(); it != sparklesCB.end(); )
  3528. {
  3529. NJS_VECTOR pos_CB = { 0, it->radiusCB, 0 };
  3530. njPushMatrix(nullptr);
  3531. njRotateX(nullptr, it->rotation.x);
  3532. njRotateY(nullptr, it->rotation.y);
  3533. njRotateZ(nullptr, it->rotation.z);
  3534. ////njRotateX(nullptr, EntityData1Ptrs[0]->Rotation.x);
  3535. ////njRotateY(nullptr, EntityData1Ptrs[0]->Rotation.y);
  3536. ////njRotateZ(nullptr, EntityData1Ptrs[0]->Rotation.z);
  3537. //njRotateX(nullptr, it->rotation.x + EntityData1Ptrs[0]->Rotation.x);
  3538. //njRotateY(nullptr, it->rotation.y + EntityData1Ptrs[0]->Rotation.y);
  3539. //njRotateZ(nullptr, it->rotation.z + EntityData1Ptrs[0]->Rotation.z);
  3540. njCalcVector(nullptr, &pos_CB, &sparkleShadowCBsprite.p);
  3541. njPopMatrix(1);
  3542. sparkleShadowCBsprite.p.x += EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.x;
  3543. sparkleShadowCBsprite.p.y += EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.y;
  3544. sparkleShadowCBsprite.p.z += EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.z;
  3545. if (it->frameCB < 11)
  3546. {
  3547. SetMaterialAndSpriteColor_Float((11 - it->frameCB) / 11.0f, 1, 1, 1);
  3548. sparkleShadowCBsprite.sx = ((22 - it->frameCB) / 22.0f) * 0.6f * 1.3f * HorizontalResolution / 1680.0f;
  3549. sparkleShadowCBsprite.sy = ((22 - it->frameCB) / 22.0f) * 0.6f * 1.3f * VerticalResolution / 1050.0f;
  3550. if (a2->AnimationThing.Index != 87) njDrawSprite3D_Queue(&sparkleShadowCBsprite, 2, NJD_SPRITE_ALPHA | NJD_SPRITE_SCALE, (QueuedModelFlagsB)0);
  3551. }
  3552. it->frameCB++;
  3553. if (it->frameCB >= 11)
  3554. it = sparklesCB.erase(it);
  3555. else
  3556. {
  3557. it->radiusCB += 0.15f;
  3558. ++it;
  3559. }
  3560. }
  3561. if (++sparkleCBtimer == 8)
  3562. {
  3563. sparkleCBdata sp = {};
  3564. //sp.radius = ((float)rand() / RAND_MAX) * 8.0;//if I wanted them to spawn in the center
  3565. sp.radiusCB = (((float)rand() / RAND_MAX) * 3.0) + 4.0;//sp.radius = (((float)rand() / RAND_MAX) * max_radius) + min_radius; //if min_radius is 2, and max_radius is 3, then the sparkles will spawn between 2 and 5 (2+3) away
  3566. sp.rotation.x = rand() & 0xFFFF;
  3567. sp.rotation.y = rand() & 0xFFFF;
  3568. sp.rotation.z = rand() & 0xFFFF;
  3569. sparklesCB.push_back(sp);
  3570. sparkleCBtimer = 0;
  3571. }
  3572. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3573.  
  3574. //Purple ones
  3575. ParticleDepthOverride = 0.0f;
  3576. for (auto it = sparklesCB_tiny.begin(); it != sparklesCB_tiny.end(); )
  3577. {
  3578. NJS_VECTOR pos_CB = { 0, it->radiusCB, 0 };
  3579. njPushMatrix(nullptr);
  3580. njRotateX(nullptr, it->rotation.x);
  3581. njRotateY(nullptr, it->rotation.y);
  3582. njRotateZ(nullptr, it->rotation.z);
  3583. ////njRotateX(nullptr, EntityData1Ptrs[0]->Rotation.x);
  3584. ////njRotateY(nullptr, EntityData1Ptrs[0]->Rotation.y);
  3585. ////njRotateZ(nullptr, EntityData1Ptrs[0]->Rotation.z);
  3586. //njRotateX(nullptr, it->rotation.x + EntityData1Ptrs[0]->Rotation.x);
  3587. //njRotateY(nullptr, it->rotation.y + EntityData1Ptrs[0]->Rotation.y);
  3588. //njRotateZ(nullptr, it->rotation.z + EntityData1Ptrs[0]->Rotation.z);
  3589. njCalcVector(nullptr, &pos_CB, &sparkleShadowCBsprite.p);
  3590. njPopMatrix(1);
  3591. sparkleShadowCBsprite.p.x += EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.x;
  3592. sparkleShadowCBsprite.p.y += EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.y;
  3593. sparkleShadowCBsprite.p.z += EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.z;
  3594. if (it->frameCB_tiny < 11)
  3595. {
  3596. SetMaterialAndSpriteColor_Float((11 - it->frameCB_tiny) / 11.0f, 1, 1, 1);
  3597. sparkleShadowCBsprite.sx = ((22 - it->frameCB_tiny) / 22.0f) * 0.0375f * 3.5f * 1.3f * HorizontalResolution / 1680.0f;
  3598. sparkleShadowCBsprite.sy = ((22 - it->frameCB_tiny) / 22.0f) * 0.0375f * 3.5f * 1.3f * VerticalResolution / 1050.0f;
  3599. if (a2->AnimationThing.Index != 87) njDrawSprite3D_Queue(&sparkleShadowCBsprite, 6, NJD_SPRITE_ALPHA | NJD_SPRITE_SCALE, (QueuedModelFlagsB)0);
  3600. }
  3601. it->frameCB_tiny++;
  3602. if (it->frameCB_tiny >= 15)
  3603. it = sparklesCB_tiny.erase(it);
  3604. else
  3605. {
  3606. it->radiusCB += 0.075f;
  3607. ++it;
  3608. }
  3609. }
  3610. if (++sparkleCB_tiny_timer == 3)
  3611. {
  3612. sparkleCBdata sp = {};
  3613. sp.radiusCB = (((float)rand() / RAND_MAX) * 2.0) + 2.5;
  3614. sp.rotation.x = rand() & 0xFFFF;
  3615. sp.rotation.y = rand() & 0xFFFF;
  3616. sp.rotation.z = rand() & 0xFFFF;
  3617. sparklesCB_tiny.push_back(sp);
  3618. sparkleCB_tiny_timer = 0;
  3619. }
  3620. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3621. }
  3622. njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_SRCALPHA);
  3623. njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_INVSRCALPHA);
  3624. njTextureShadingMode(NJD_TEX_SHADING_MODE_DECALALPHA);
  3625. }
  3626. }
  3627.  
  3628. void ShadowChaosBlastparticles(EntityData1 *a1, CharObj2 *a2)
  3629. {
  3630. if (GameState != 21 && is_shadow)
  3631. {
  3632. if (chaos_blast_active_timer > 0 && chaos_blast_active_timer <= 110)
  3633. {
  3634. //Actual Sparkles
  3635. njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_ONE);
  3636. njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_ONE);
  3637. //njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_SRCALPHA);
  3638. //njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_DESTALPHA);
  3639. njTextureShadingMode(NJD_TEX_SHADING_MODE_DECALALPHA);
  3640. //White ones
  3641. ParticleDepthOverride = 0.0f;
  3642. EntityData1 *co1 = EntityData1Ptrs[0];
  3643. for (auto it = sparkleschaosblast.begin(); it != sparkleschaosblast.end(); )
  3644. {
  3645. NJS_VECTOR pos_chaosblast = { 0, it->radiuschaosblast, 0 };
  3646. njPushMatrix(nullptr);
  3647. njRotateX(nullptr, it->rotation.x);
  3648. njRotateY(nullptr, it->rotation.y);
  3649. njRotateZ(nullptr, it->rotation.z);
  3650. njCalcVector(nullptr, &pos_chaosblast, &sparkleShadowChaosBlastsprite.p);
  3651. njPopMatrix(1);
  3652. sparkleShadowChaosBlastsprite.p.x += EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.x;
  3653. sparkleShadowChaosBlastsprite.p.y += EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.y;
  3654. sparkleShadowChaosBlastsprite.p.z += EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.z;
  3655. if (it->framechaosblast < 11)
  3656. {
  3657. SetMaterialAndSpriteColor_Float((11 - it->framechaosblast) / 11.0f, 1, 1, 1);
  3658. sparkleShadowChaosBlastsprite.sx = ((22 - it->framechaosblast) / 22.0f) * 0.7f * HorizontalResolution / 1680.0f;
  3659. sparkleShadowChaosBlastsprite.sy = ((22 - it->framechaosblast) / 22.0f) * 0.7f * VerticalResolution / 1050.0f;
  3660. if (a2->AnimationThing.Index != 87) njDrawSprite3D_Queue(&sparkleShadowChaosBlastsprite, 14, NJD_SPRITE_ALPHA | NJD_SPRITE_SCALE, (QueuedModelFlagsB)0);
  3661. }
  3662. it->framechaosblast++;
  3663. if (it->framechaosblast >= 11)
  3664. it = sparkleschaosblast.erase(it);
  3665. else
  3666. {
  3667. it->radiuschaosblast += 1.2f;
  3668. ++it;
  3669. }
  3670. }
  3671. if (++sparklechaosblasttimer == 1)
  3672. {
  3673. sparklechaosblastdata sp = {};
  3674. //sp.radius = ((float)rand() / RAND_MAX) * 8.0;//if I wanted them to spawn in the center
  3675. sp.radiuschaosblast = (((float)rand() / RAND_MAX) * 8.0) + 4.0;//sp.radius = (((float)rand() / RAND_MAX) * max_radius) + min_radius; //if min_radius is 2, and max_radius is 3, then the sparkles will spawn between 2 and 5 (2+3) away
  3676. sp.rotation.x = rand() & 0xFFFF;
  3677. sp.rotation.y = rand() & 0xFFFF;
  3678. sp.rotation.z = rand() & 0xFFFF;
  3679. sparkleschaosblast.push_back(sp);
  3680. sparklechaosblasttimer = 0;
  3681. }
  3682. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3683.  
  3684. //Blue ones
  3685. ParticleDepthOverride = 0.0f;
  3686. for (auto it = sparkleschaosblast_tiny.begin(); it != sparkleschaosblast_tiny.end(); )
  3687. {
  3688. NJS_VECTOR pos_chaosblast = { 0, it->radiuschaosblast, 0 };
  3689. njPushMatrix(nullptr);
  3690. njRotateX(nullptr, it->rotation.x);
  3691. njRotateY(nullptr, it->rotation.y);
  3692. njRotateZ(nullptr, it->rotation.z);
  3693. njCalcVector(nullptr, &pos_chaosblast, &sparkleShadowChaosBlastsprite.p);
  3694. njPopMatrix(1);
  3695. sparkleShadowChaosBlastsprite.p.x += EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.x;
  3696. sparkleShadowChaosBlastsprite.p.y += EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.y;
  3697. sparkleShadowChaosBlastsprite.p.z += EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.z;
  3698. if (it->framechaosblast_tiny < 11)
  3699. {
  3700. SetMaterialAndSpriteColor_Float((11 - it->framechaosblast_tiny) / 11.0f, 1, 1, 1);
  3701. sparkleShadowChaosBlastsprite.sx = ((22 - it->framechaosblast_tiny) / 22.0f) * 0.7f * HorizontalResolution / 1680.0f;
  3702. sparkleShadowChaosBlastsprite.sy = ((22 - it->framechaosblast_tiny) / 22.0f) * 0.7f * VerticalResolution / 1050.0f;
  3703. if (a2->AnimationThing.Index != 87) njDrawSprite3D_Queue(&sparkleShadowChaosBlastsprite, 15, NJD_SPRITE_ALPHA | NJD_SPRITE_SCALE, (QueuedModelFlagsB)0);
  3704. }
  3705. it->framechaosblast_tiny++;
  3706. if (it->framechaosblast_tiny >= 15)
  3707. it = sparkleschaosblast_tiny.erase(it);
  3708. else
  3709. {
  3710. it->radiuschaosblast += 0.9f;
  3711. ++it;
  3712. }
  3713. }
  3714. if (++sparklechaosblast_tiny_timer == 3)
  3715. {
  3716. sparklechaosblastdata sp = {};
  3717. sp.radiuschaosblast = (((float)rand() / RAND_MAX) * 6.0) + 3.0;
  3718. sp.rotation.x = rand() & 0xFFFF;
  3719. sp.rotation.y = rand() & 0xFFFF;
  3720. sp.rotation.z = rand() & 0xFFFF;
  3721. sparkleschaosblast_tiny.push_back(sp);
  3722. sparklechaosblast_tiny_timer = 0;
  3723. }
  3724. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3725. }
  3726. njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_SRCALPHA);
  3727. njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_INVSRCALPHA);
  3728. njTextureShadingMode(NJD_TEX_SHADING_MODE_DECALALPHA);
  3729. }
  3730. }
  3731.  
  3732.  
  3733. void ShadowCBbolt(EntityData1 *a1, CharObj2 *a2)
  3734. {
  3735. if (GameState != 21 && is_shadow)
  3736. {
  3737. if (chaos_blast_active_timer > 42 && chaos_blast_active_timer <= 210)
  3738. {
  3739. njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_ONE);
  3740. njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_ONE);
  3741. //njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_SRCALPHA);
  3742. //njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_DESTALPHA);
  3743. njTextureShadingMode(NJD_TEX_SHADING_MODE_DECALALPHA);
  3744. //Bolt sparkles
  3745. ParticleDepthOverride = 0.0f;
  3746. EntityData1 *co1 = EntityData1Ptrs[0];
  3747. for (auto it = sparklesCBbolt.begin(); it != sparklesCBbolt.end(); )
  3748. {
  3749. sparkleShadowCBbolt.p = it->pos_CBbolt;
  3750. njDrawSprite3D_Queue(&sparkleShadowCBbolt, 16 + (it->frameCBbolt++ / 3), NJD_SPRITE_ALPHA | NJD_SPRITE_SCALE, (QueuedModelFlagsB)0);
  3751.  
  3752. if (it->frameCBbolt >= 27)
  3753. it = sparklesCBbolt.erase(it);
  3754. else
  3755. ++it;
  3756. }
  3757. if (chaos_blast_active_timer <= 110)
  3758. {
  3759. if (++sparkleCBbolttimer == 4)
  3760. {
  3761. sparkleCBboltdata sp = {};
  3762. NJS_VECTOR pos_CBbolt = { 0, (((float)rand() / RAND_MAX) * 0.0) + 17.0, 0 };
  3763. njPushMatrix(nullptr);
  3764. njRotateX(nullptr, rand() & 0xFFFF);
  3765. njRotateY(nullptr, rand() & 0xFFFF);
  3766. njRotateZ(nullptr, rand() & 0xFFFF);
  3767. njCalcVector(nullptr, &pos_CBbolt, &sp.pos_CBbolt);
  3768. njPopMatrix(1);
  3769. sp.pos_CBbolt.x += co1->CollisionInfo->CollisionArray->origin.x;
  3770. sp.pos_CBbolt.y += co1->CollisionInfo->CollisionArray->origin.y;
  3771. sp.pos_CBbolt.z += co1->CollisionInfo->CollisionArray->origin.z;
  3772. sparklesCBbolt.push_back(sp);
  3773. sparkleCBbolttimer = 0;
  3774. }
  3775. }
  3776. else
  3777. {
  3778. if (++sparkleCBbolttimer == 3)
  3779. {
  3780. sparkleCBboltdata sp = {};
  3781. NJS_VECTOR pos_CBbolt = { 0, (((float)rand() / RAND_MAX) * ((10.0f*cbREDsize) - 34.0f)) + 17.0, 0 };
  3782. njPushMatrix(nullptr);
  3783. njRotateX(nullptr, rand() & 0xFFFF);
  3784. njRotateY(nullptr, rand() & 0xFFFF);
  3785. njRotateZ(nullptr, rand() & 0xFFFF);
  3786. njCalcVector(nullptr, &pos_CBbolt, &sp.pos_CBbolt);
  3787. njPopMatrix(1);
  3788. sp.pos_CBbolt.x += co1->CollisionInfo->CollisionArray->origin.x;
  3789. sp.pos_CBbolt.y += co1->CollisionInfo->CollisionArray->origin.y;
  3790. sp.pos_CBbolt.z += co1->CollisionInfo->CollisionArray->origin.z;
  3791. sparklesCBbolt.push_back(sp);
  3792. sparkleCBbolttimer = 0;
  3793. }
  3794. }
  3795. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3796. }
  3797. else
  3798. {
  3799. sparklesCBbolt.clear();
  3800. sparkleCBbolttimer = 0;
  3801. }
  3802. njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_SRCALPHA);
  3803. njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_INVSRCALPHA);
  3804. njTextureShadingMode(NJD_TEX_SHADING_MODE_DECALALPHA);
  3805. }
  3806. }
  3807.  
  3808. //For ShadowCBLV3 alpha thing
  3809. float InverseLerp(0, 16, it->frameCBLV3)
  3810. {
  3811. return (value - low) / (high - low);
  3812. }
  3813.  
  3814.  
  3815. void ShadowCBLV3(EntityData1 *a1, CharObj2 *a2)
  3816. {
  3817. if (GameState != 21 && is_shadow)
  3818. {
  3819. if (CB_lv3)
  3820. {
  3821. njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_ONE);
  3822. njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_ONE);
  3823. njTextureShadingMode(NJD_TEX_SHADING_MODE_DECALALPHA);
  3824. njAlphaMode(1);
  3825. LV3alpha += 0.0625f;
  3826. ParticleDepthOverride = 0.0f;
  3827. EntityData1 *co1 = EntityData1Ptrs[0];
  3828. for (auto it = sparklesCBLV3.begin(); it != sparklesCBLV3.end(); )
  3829. {
  3830. sparkleShadowCBLV3.p = it->pos_CBLV3;
  3831. SetMaterialAndSpriteColor_Float(1, (1 - LV3alpha), 0, 0);
  3832. njDrawSprite3D_Queue(&sparkleShadowCBLV3, 26 + (it->frameCBLV3++ / 32), NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR | NJD_SPRITE_SCALE, (QueuedModelFlagsB)0);
  3833. //njDrawSprite3D(&sparkleShadowCBLV3, 26 + (it->frameCBLV3++ / 32), NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR | NJD_SPRITE_SCALE);
  3834. if (it->frameCBLV3 >= 16)
  3835. {
  3836. it = sparklesCBLV3.erase(it);
  3837. }
  3838. else
  3839. ++it;
  3840. }
  3841. if (LV3alpha > 1.0) LV3alpha = 0.0f;
  3842. if (++sparkleCBLV3timer == 3)
  3843. {
  3844. sparkleCBLV3data sp = {};
  3845. NJS_VECTOR pos_CBLV3 = { 0, ((float)rand() / RAND_MAX) * 3.5, 0 };
  3846. njPushMatrix(nullptr);
  3847. njRotateX(nullptr, rand() & 0xFFFF);
  3848. njRotateY(nullptr, rand() & 0xFFFF);
  3849. njRotateZ(nullptr, rand() & 0xFFFF);
  3850. njCalcVector(nullptr, &pos_CBLV3, &sp.pos_CBLV3);
  3851. njPopMatrix(1);
  3852. sp.pos_CBLV3.x += co1->CollisionInfo->CollisionArray->origin.x;
  3853. sp.pos_CBLV3.y += co1->CollisionInfo->CollisionArray->origin.y;
  3854. sp.pos_CBLV3.z += co1->CollisionInfo->CollisionArray->origin.z;
  3855. sparklesCBLV3.push_back(sp);
  3856. sparkleCBLV3timer = 0;
  3857. }
  3858. SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
  3859. }
  3860. else
  3861. {
  3862. sparklesCBLV3.clear();
  3863. sparkleCBLV3timer = 0;
  3864. }
  3865. njColorBlendingMode(NJD_SOURCE_COLOR, NJD_COLOR_BLENDING_SRCALPHA);
  3866. njColorBlendingMode(NJD_DESTINATION_COLOR, NJD_COLOR_BLENDING_INVSRCALPHA);
  3867. njTextureShadingMode(NJD_TEX_SHADING_MODE_DECALALPHA);
  3868. }
  3869. }
  3870.  
  3871.  
  3872.  
  3873.  
  3874.  
  3875.  
  3876. //To always have 2P CPU
  3877. int CheckTailsAI_r()
  3878. {
  3879. return 1;
  3880. }
  3881.  
  3882. void __cdecl Load2PTails_r(ObjectMaster *player1)
  3883. {
  3884. if (is_sonic || is_shadow || is_metalsonic || game_start_done)
  3885. {
  3886. ObjectMaster *obj = LoadObject((LoadObj)(LoadObj_UnknownA | LoadObj_Data1 | LoadObj_Data2), 1, Gamma_Main);
  3887. //obj->Data1->Position = player1->Data1->Position;
  3888. //obj->Data1->Rotation = player1->Data1->Rotation;
  3889. obj->Data1->CharIndex = 1;
  3890. ObjectMaster *obj2 = LoadObject((LoadObj)(LoadObj_UnknownA | LoadObj_Data1 | LoadObj_Data2), 1, Knuckles_Main);
  3891. //obj2->Data1->Position = player1->Data1->Position;
  3892. //obj2->Data1->Rotation = player1->Data1->Rotation;
  3893. obj2->Data1->CharIndex = 2;
  3894. }
  3895. //else if (is_metalsonic)
  3896. //{
  3897. // //Load2PTails(player1);//No longer useful since I remade the purple gem power without Tails
  3898. // ObjectMaster *obj = LoadObject((LoadObj)(LoadObj_UnknownA | LoadObj_Data1 | LoadObj_Data2), 1, Tails_Main);
  3899. // obj->Data1->Position = player1->Data1->Position;
  3900. // obj->Data1->Rotation = player1->Data1->Rotation;
  3901. // obj->Data1->CharIndex = 1;
  3902. //}
  3903. }
  3904.  
  3905.  
  3906. ///////////////////////////////////////////////////////////////////////////////////////////////////////////
  3907.  
  3908. extern "C"
  3909. {
  3910. __declspec(dllexport) ModInfo SADXModInfo = { ModLoaderVer };
  3911.  
  3912.  
  3913. __declspec(dllexport) void Init(const char *path, const HelperFunctions &helperFunctions)
  3914. {
  3915.  
  3916. // Enables WriteAnalogs for controllers >= 2 (3)
  3917. Uint8 patch[3] = { 0x83u, 0xFFu, 0x04u };
  3918. WriteData((void*)0x0040F180, patch);
  3919.  
  3920. //Sonic_Init(); is_sonic = true;
  3921. //Shadow_Init(); is_shadow = true;
  3922. //MetalSonic_Init(); is_metalsonic = true;
  3923. WriteJump((void*)0x425F90, CommonHUD);
  3924. WriteData((char*)0x427F50, (char)0xC3);
  3925.  
  3926. sonic_model_loaded = false;
  3927.  
  3928. //Disable Sonic Morphs
  3929. WriteData<3>((void*)0x493711, 0x90);
  3930. WriteData<3>((void*)0x49356D, 0x90);
  3931. WriteData<3>((void*)0x4935E3, 0x90);
  3932. WriteData<3>((void*)0x493722, 0x90);
  3933. WriteData<3>((void*)0x4936EA, 0x90);
  3934. WriteData<3>((void*)0x493657, 0x90);
  3935. WriteData<3>((void*)0x4936CD, 0x90);
  3936. WriteData<3>((void*)0x493C5D, 0x90);
  3937. WriteData<3>((void*)0x4937A1, 0x90);
  3938.  
  3939. //Disable Tails Morphs
  3940. WriteData<3>((void*)0x4622E4, 0x90);
  3941. WriteData<3>((void*)0x4622B4, 0x90);
  3942. WriteData<3>((void*)0x4622FB, 0x90);
  3943. WriteData<3>((void*)0x4622CB, 0x90);
  3944. WriteData<3>((void*)0x45BB60, 0x90);
  3945. WriteData<3>((void*)0x45B821, 0x90);
  3946. WriteData<3>((void*)0x45BB74, 0x90);
  3947. WriteData<3>((void*)0x45B835, 0x90);
  3948. WriteData<3>((void*)0x45BED3, 0x90);
  3949. WriteData<3>((void*)0x45DAB1, 0x90);
  3950. WriteData<3>((void*)0x461389, 0x90);
  3951. WriteData<3>((void*)0x461325, 0x90);
  3952. WriteData<3>((void*)0x45BEE7, 0x90);
  3953. WriteData<3>((void*)0x45DACA, 0x90);
  3954. WriteData<3>((void*)0x4613A1, 0x90);
  3955. WriteData<3>((void*)0x461339, 0x90);
  3956.  
  3957. //Disable Knuckles Morphs
  3958. WriteData<3>((void*)0x473FB2, 0x90);
  3959. WriteData<3>((void*)0x473CC1, 0x90);
  3960. WriteData<3>((void*)0x473FC7, 0x90);
  3961. WriteData<3>((void*)0x473CD5, 0x90);
  3962. WriteData<3>((void*)0x4726D3, 0x90);
  3963. WriteData<3>((void*)0x4726EA, 0x90);
  3964. WriteData<3>((void*)0x472701, 0x90);
  3965. WriteData<3>((void*)0x472719, 0x90);
  3966. WriteData<3>((void*)0x472730, 0x90);
  3967. WriteData<3>((void*)0x472747, 0x90);
  3968. WriteData<3>((void*)0x47275F, 0x90);
  3969. WriteData<3>((void*)0x472776, 0x90);
  3970. WriteData<3>((void*)0x472B4A, 0x90);
  3971. WriteData<3>((void*)0x472B61, 0x90);
  3972. WriteData<3>((void*)0x472B78, 0x90);
  3973. WriteData<3>((void*)0x472B90, 0x90);
  3974. WriteData<3>((void*)0x472BA7, 0x90);
  3975. WriteData<3>((void*)0x472BBE, 0x90);
  3976. WriteData<3>((void*)0x472BD6, 0x90);
  3977. WriteData<3>((void*)0x472BED, 0x90);
  3978.  
  3979. //For Metal's Yellow Shield
  3980. WriteJump(GiveMagneticBarrier, GiveMagneticBarrier_r); //needed to have the shield not show up when at yellow gem's shield lvl 1
  3981.  
  3982. //WriteData((void*)0x610113, 0x90, 3);
  3983. //ResizeTextureList((NJS_TEXLIST *)0x2592E8C, 201); //For R101
  3984.  
  3985. // Fixes the inverted water in Emerald Coast 2.
  3986. LandTable* ec2mesh = (LandTable*)0x01039E9C;
  3987. NJS_OBJECT *obj = ec2mesh->Col[1].Model;
  3988. obj->ang[0] = 32768;
  3989. obj->pos[1] = -3.0f;
  3990. obj->pos[2] = -5850.0f;
  3991.  
  3992. //SpeedShoes New timer
  3993. WriteData((short*)0x441CEF, (short)780);
  3994. //WriteData((short*)0x441CEF, (short)65534);
  3995.  
  3996. //Water GroundAccel fix
  3997. WriteData<6>((void*)0x43CBFB, 0x90);
  3998.  
  3999.  
  4000. //Ground Acceleration Modification Enabler
  4001. WriteData<6>((void*)0x43CC9E, 0x90);
  4002.  
  4003. ////SA2 like combos
  4004. //WriteJump((void*)0x425C70, AddEnemyPoints);
  4005.  
  4006. //WriteJump((void*)0x004496E1, SuperWaterCheck);//for EC act1 hover on water
  4007.  
  4008. //Timer bonus points
  4009. WriteJump(GetTimeBonus, GetTimeBonus_r);
  4010.  
  4011. //Always 20 rings itembox
  4012. WriteData((void*)0x7E6FE4, values);
  4013.  
  4014. //Enemy bonus points
  4015. WriteData((char*)0x4CE077, (char)0x64);
  4016.  
  4017. ////Maximum Heat Attack fix
  4018. //WriteData((float**)0x47404B, &heat_float1);
  4019. //WriteData((float**)0x474057, &heat_float2);
  4020. //WriteJump((void*)0x004C1330, Knuckles_MaximumHeat_DrawX);
  4021. //WriteJump((void*)0x004C1410, Knuckles_MaximumHeatSprite_Draw);
  4022.  
  4023.  
  4024. if (helperFunctions.Version >= 8)
  4025. SONSoundListID = helperFunctions.RegisterSoundList(SONSoundList);
  4026.  
  4027. if (helperFunctions.Version >= 8)
  4028. SHASoundListID = helperFunctions.RegisterSoundList(SHASoundList);
  4029.  
  4030. if (helperFunctions.Version >= 8)
  4031. MSSoundListID = helperFunctions.RegisterSoundList(MSSoundList);
  4032. }
  4033.  
  4034. __declspec(dllexport) void OnInput()
  4035. {
  4036.  
  4037.  
  4038. // Enables WriteAnalogs for controllers >= 2 (3)
  4039. Uint8 patch[3] = { 0x83u, 0xFFu, 0x04u };
  4040. WriteData((void*)0x0040F180, patch);
  4041.  
  4042.  
  4043.  
  4044. //Sonic_OnInput();
  4045. //Shadow_OnInput();
  4046. //MetalSonic_OnInput();
  4047.  
  4048.  
  4049. //if (GameState == 15)
  4050. //{
  4051. // if (ControllerPointers[0]->HeldButtons & Buttons_Y)
  4052. // {
  4053. // ControllerPointers[1]->PressedButtons = Buttons_X;
  4054. // ControllerPointers[1]->HeldButtons = Buttons_X;
  4055. // ControllerPointers[2]->PressedButtons = Buttons_X;
  4056. // ControllerPointers[2]->HeldButtons = Buttons_X;
  4057. // }
  4058. //}
  4059.  
  4060.  
  4061.  
  4062. //For Purple Gem (no Tails)
  4063. if (GameState != 16)
  4064. {
  4065. if (!PURPLE_GEM_active && PURPLE_GEM_used)
  4066. {
  4067. if ((EntityData1Ptrs[0]->Status & Status_Ground) == Status_Ground)
  4068. {
  4069. ControllerPointers[0]->PressedButtons = Buttons_X;
  4070. }
  4071. }
  4072. }
  4073.  
  4074.  
  4075. if (stop_sky_gem)
  4076. {
  4077. ControllerPointers[0]->PressedButtons = Buttons_X;
  4078. stop_sky_gem = false;
  4079. }
  4080.  
  4081.  
  4082.  
  4083. //For Chaos Spear
  4084. if (GameState == 15)
  4085. {
  4086. if (is_in_CS_state)
  4087. {
  4088. if (!X_was_released)
  4089. {
  4090. if (ControllerPointers[0]->HeldButtons & Buttons_X)
  4091. {
  4092. ControllerPointers[1]->PressedButtons = Buttons_X;
  4093. ControllerPointers[1]->HeldButtons = Buttons_X;
  4094. }
  4095. }
  4096. if (++cant_release_X <= 8)
  4097. {
  4098. ControllerPointers[0]->HeldButtons = Buttons_X;
  4099. ControllerPointers[1]->PressedButtons = Buttons_X;
  4100. ControllerPointers[1]->HeldButtons = Buttons_X;
  4101. }
  4102. }
  4103. }
  4104.  
  4105. }
  4106.  
  4107. __declspec(dllexport) void OnControl()
  4108. {
  4109.  
  4110. // Enables WriteAnalogs for controllers >= 2 (3)
  4111. Uint8 patch[3] = { 0x83u, 0xFFu, 0x04u };
  4112. WriteData((void*)0x0040F180, patch);
  4113.  
  4114.  
  4115. for (int i = 2; i < 4; i++)
  4116. {
  4117. if (!IsControllerEnabled(i))
  4118. {
  4119. memset(&Controllers[i], 0, sizeof(ControllerData));
  4120. continue;
  4121. }
  4122.  
  4123. memcpy(&Controllers[i], ControllerPointers[i], sizeof(ControllerData));
  4124. }
  4125. if (black_shield_active || PURPLE_GEM_active || transforming || punching || transforming_CB)
  4126. {
  4127. Controllers[0].HeldButtons &= ~(int)Buttons_A;
  4128. Controllers[0].PressedButtons &= ~(int)Buttons_A;
  4129. }
  4130. }
  4131.  
  4132. __declspec(dllexport) void OnFrame()
  4133. {
  4134.  
  4135. EntityData1* co1 = EntityData1Ptrs[0];
  4136. CharObj2 *co2 = GetCharObj2(0);
  4137.  
  4138. // Enables WriteAnalogs for controllers >= 2 (3)
  4139. Uint8 patch[3] = { 0x83u, 0xFFu, 0x04u };
  4140. WriteData((void*)0x0040F180, patch);
  4141.  
  4142.  
  4143. WriteJump(CheckTailsAI, CheckTailsAI_r);
  4144. WriteCall((void*)0x415948, Load2PTails_r);
  4145.  
  4146.  
  4147. //Sonic_OnFrame();
  4148. //Shadow_OnFrame();
  4149. //MetalSonic_OnFrame();
  4150.  
  4151.  
  4152.  
  4153. ////////////////*****************************************CHARACTER CHANGE INGAME **********************************************************************************
  4154.  
  4155. if (co2 == NULL) return;
  4156. MetalSonicHUD(co1, co2);
  4157. ShadowCBparticles(co1, co2);
  4158. ShadowChaosBlastparticles(co1, co2);
  4159. ShadowCBbolt(co1, co2);
  4160. ShadowCBLV3(co1, co2);
  4161. if (GameState == 4)
  4162. {
  4163. if (!can_run_again)
  4164. {
  4165. oldcountSonic = EntityData1Ptrs[0]->CollisionInfo[0].Count;
  4166. oldcountKnux = EntityData1Ptrs[2]->CollisionInfo[0].Count;
  4167. can_run_again = true;
  4168. }
  4169. }
  4170. if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
  4171. {
  4172. if (GameState == 21 && !game_start_done)
  4173. {
  4174. game_start_done = true;
  4175. }
  4176. if (GetCharacterObject(1) && GetCharacterID(1) == Characters_Gamma && !gamma_initialized)
  4177. {
  4178. oldcountGamma = EntityData1Ptrs[1]->CollisionInfo[0].Count;
  4179. gamma_initialized = true;
  4180. }
  4181. if (GameState == 16 || GameState == 21)
  4182. {
  4183. if (ControllerPointers[0]->PressedButtons & Buttons_Y)
  4184. {
  4185. BLUE_GEM_ON = false;
  4186. RED_GEM_ON = false;
  4187. GREEN_GEM_ON = false;
  4188. PURPLE_GEM_ON = false;
  4189. SKY_GEM_ON = false;
  4190. WHITE_GEM_ON = false;
  4191. YELLOW_GEM_ON = false;
  4192. NO_GEM_ON = false;
  4193. EntityData1Ptrs[1]->CollisionInfo[0].Count = oldcountGamma;
  4194. shield_level = 0;
  4195. DeleteObject_(auraobj);
  4196. auraobj = nullptr;
  4197. FOV = 70;
  4198. UnloadCharTextures(Characters_Sonic);
  4199. WriteData((PVMEntry**)0x90ED54, SonicTextures);
  4200. LoadCharTextures(Characters_Sonic);
  4201. njReleaseTexture((NJS_TEXLIST*)0x927CB8);
  4202. LoadPVM("SON_SON_EFF", (NJS_TEXLIST*)0x927CB8);
  4203. njReleaseTexture((NJS_TEXLIST*)0x142272C);
  4204. LoadPVM("SON_SUPERSONIC", (NJS_TEXLIST*)0x142272C);
  4205. njReleaseTexture((NJS_TEXLIST*)0x94A2A8);
  4206. LoadPVM("EFF_REGULAR", (NJS_TEXLIST*)0x94A2A8);
  4207. LoadPVM("SON_AMY_EFF", (TexList *)0x91C808);
  4208. ChangeToSonicModel();
  4209. VariablesReset();
  4210. is_sonic = true;
  4211. is_shadow = false;
  4212. shadow_init_loaded = false;
  4213. is_metalsonic = false;
  4214. metalsonic_init_loaded = false;
  4215. }
  4216. if (ControllerPointers[0]->PressedButtons & Buttons_X)
  4217. {
  4218. BLUE_GEM_ON = false;
  4219. RED_GEM_ON = false;
  4220. GREEN_GEM_ON = false;
  4221. PURPLE_GEM_ON = false;
  4222. SKY_GEM_ON = false;
  4223. WHITE_GEM_ON = false;
  4224. YELLOW_GEM_ON = false;
  4225. NO_GEM_ON = false;
  4226. shield_level = 0;
  4227. EntityData1Ptrs[1]->CollisionInfo[0].Count = 0;
  4228. DeleteObject_(auraobj);
  4229. auraobj = nullptr;
  4230. FOV = 70;
  4231. WriteData((NJS_TEXLIST**)0x47224A, (NJS_TEXLIST*)0x91CB58);//to load sonic's textures over knux to set it back => WriteData((NJS_TEXLIST**)0x47224A, (NJS_TEXLIST*)0x91BD20);
  4232. UnloadCharTextures(Characters_Sonic);
  4233. WriteData((PVMEntry**)0x90ED54, ShadowTextures);
  4234. LoadCharTextures(Characters_Sonic);
  4235. //UnloadCharTextures(Characters_Knuckles);
  4236. //WriteData((PVMEntry**)0x90ED60, ShadowKnuxTextures);
  4237. //LoadCharTextures(Characters_Knuckles);
  4238. njReleaseTexture((NJS_TEXLIST*)0x927CB8);
  4239. LoadPVM("SHA_SON_EFF", (NJS_TEXLIST*)0x927CB8);
  4240. //njReleaseTexture((NJS_TEXLIST*)0x91BD20);
  4241. //LoadPVM("SHA_KNUCKLES", (NJS_TEXLIST*)0x91BD20);
  4242. njReleaseTexture((NJS_TEXLIST*)0x91BD28);
  4243. LoadPVM("SHA_KNU_EFF", (NJS_TEXLIST*)0x91BD28);
  4244. //njReleaseTexture((NJS_TEXLIST*)0x91C568);
  4245. //LoadPVM("SHA_E102BEAM", (NJS_TEXLIST*)0x91C568);
  4246. //njReleaseTexture((NJS_TEXLIST*)0x91C570);
  4247. //LoadPVM("SHA_E102EFFECT", (NJS_TEXLIST*)0x91C570);
  4248. //njReleaseTexture((NJS_TEXLIST*)0x91D5E0);
  4249. //LoadPVM("SHA_E102TIME", (NJS_TEXLIST*)0x91D5E0);
  4250. //njReleaseTexture((NJS_TEXLIST*)0x91D15C);
  4251. //LoadPVM("SHA_E102HIT", (NJS_TEXLIST*)0x91D15C);
  4252. njReleaseTexture((NJS_TEXLIST*)0x142272C);
  4253. LoadPVM("SHA_SUPERSONIC", (NJS_TEXLIST*)0x142272C);
  4254. njReleaseTexture((NJS_TEXLIST*)0x94A2A8);
  4255. LoadPVM("EFF_REGULAR", (NJS_TEXLIST*)0x94A2A8);
  4256. ChangeToShadowModel();
  4257. VariablesReset();
  4258. is_sonic = false;
  4259. sonic_init_loaded = false;
  4260. is_shadow = true;
  4261. is_metalsonic = false;
  4262. metalsonic_init_loaded = false;
  4263. }
  4264. if (ControllerPointers[0]->PressedButtons & Buttons_Z)
  4265. {
  4266. BLUE_GEM_ON = false;
  4267. RED_GEM_ON = false;
  4268. GREEN_GEM_ON = false;
  4269. PURPLE_GEM_ON = false;
  4270. SKY_GEM_ON = false;
  4271. WHITE_GEM_ON = false;
  4272. YELLOW_GEM_ON = false;
  4273. NO_GEM_ON = true;
  4274. EntityData1Ptrs[1]->CollisionInfo[0].Count = oldcountGamma;
  4275. shield_level = 0;
  4276. DeleteObject_(auraobj);
  4277. auraobj = nullptr;
  4278. FOV = 70;
  4279. UnloadCharTextures(Characters_Sonic);
  4280. WriteData((PVMEntry**)0x90ED54, MetalSonicTextures);
  4281. LoadCharTextures(Characters_Sonic);
  4282. njReleaseTexture((NJS_TEXLIST*)0x927CB8);
  4283. LoadPVM("MS_SON_EFF", (NJS_TEXLIST*)0x927CB8);
  4284. njReleaseTexture((NJS_TEXLIST*)0x142272C);
  4285. LoadPVM("MS_SUPERSONIC", (NJS_TEXLIST*)0x142272C);
  4286. njReleaseTexture((NJS_TEXLIST*)0x94A2A8);
  4287. LoadPVM("EFF_REGULAR", (NJS_TEXLIST*)0x94A2A8);
  4288. ChangeToMetalSonicModel();
  4289. VariablesReset();
  4290. is_sonic = false;
  4291. sonic_init_loaded = false;
  4292. is_shadow = false;
  4293. shadow_init_loaded = false;
  4294. is_metalsonic = true;
  4295. }
  4296. }
  4297.  
  4298. if (is_sonic)
  4299. {
  4300. if (!sonic_init_loaded)
  4301. {
  4302. Sonic_Init();
  4303. sonic_init_loaded = true;
  4304. sounds_reset = true;
  4305. SONsounds_loaded = false;
  4306. SHAsounds_loaded = false;
  4307. MSsounds_loaded = false;
  4308. SONSoundListID == -1;
  4309. SHASoundListID == -1;
  4310. MSSoundListID == -1;
  4311. cant_play_again = true;
  4312. }
  4313. Sonic_OnInput();
  4314. Sonic_OnFrame();
  4315. }
  4316. else if (is_shadow)
  4317. {
  4318. if (!shadow_init_loaded)
  4319. {
  4320. Shadow_Init();
  4321. shadow_init_loaded = true;
  4322. sounds_reset = true;
  4323. SONsounds_loaded = false;
  4324. SHAsounds_loaded = false;
  4325. MSsounds_loaded = false;
  4326. SONSoundListID == -1;
  4327. SHASoundListID == -1;
  4328. MSSoundListID == -1;
  4329. cant_play_again = true;
  4330. }
  4331. Shadow_OnInput();
  4332. Shadow_OnFrame();
  4333. }
  4334. else if (is_metalsonic)
  4335. {
  4336. if (!metalsonic_init_loaded)
  4337. {
  4338. MetalSonic_Init();
  4339. metalsonic_init_loaded = true;
  4340. sounds_reset = true;
  4341. SONsounds_loaded = false;
  4342. SHAsounds_loaded = false;
  4343. MSsounds_loaded = false;
  4344. SONSoundListID == -1;
  4345. SHASoundListID == -1;
  4346. MSSoundListID == -1;
  4347. cant_play_again = true;
  4348. }
  4349. MetalSonic_OnInput();
  4350. MetalSonic_OnFrame();
  4351. }
  4352.  
  4353.  
  4354.  
  4355.  
  4356. if (GameState == 4 && !sounds_reset)
  4357. {
  4358. sounds_reset = true;
  4359. SONsounds_loaded = false;
  4360. SHAsounds_loaded = false;
  4361. MSsounds_loaded = false;
  4362. SONSoundListID == -1;
  4363. SHASoundListID == -1;
  4364. MSSoundListID == -1;
  4365. }
  4366. if (GameState == 15)
  4367. {
  4368. if (is_sonic)
  4369. {
  4370. if (!SONsounds_loaded && SONSoundListID != -1)
  4371. {
  4372. sounds_reset = false;
  4373. LoadSoundList(SONSoundListID);
  4374. SONsounds_loaded = true;
  4375. SHAsounds_loaded = false;
  4376. MSsounds_loaded = false;
  4377. }
  4378. }
  4379. else if (is_shadow)
  4380. {
  4381. if (!SHAsounds_loaded && SHASoundListID != -1)
  4382. {
  4383. sounds_reset = false;
  4384. LoadSoundList(SHASoundListID);
  4385. SONsounds_loaded = false;
  4386. SHAsounds_loaded = true;
  4387. MSsounds_loaded = false;
  4388. }
  4389. }
  4390. else if (is_metalsonic)
  4391. {
  4392. if (!MSsounds_loaded && MSSoundListID != -1)
  4393. {
  4394. sounds_reset = false;
  4395. LoadSoundList(MSSoundListID);
  4396. SONsounds_loaded = false;
  4397. SHAsounds_loaded = false;
  4398. MSsounds_loaded = true;
  4399. }
  4400. }
  4401. }
  4402. }
  4403.  
  4404.  
  4405. //////////////////////////////////***********************************END CHARACTER CHANGE INGAME ***********************************************************
  4406.  
  4407.  
  4408.  
  4409.  
  4410. //Character Select HUD
  4411. //if (GameState == 21)
  4412. //{
  4413. if (GetCharacterObject(0))
  4414. {
  4415. LoadPVM("HUD", &HUD_TEXLIST);// do better loading (not have it repeat)
  4416. //njDrawSprite2D_Queue(&HUD_SPRITE2, char_sel_sonic, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
  4417. LoadPVM("HUD3D", &HUD3D_TEXLIST);
  4418. LoadPVM("GEMS_EFF", &GEMS_TEXLIST);
  4419. if (GameState != 21)
  4420. {
  4421. if (!HUD_alpha_fix)
  4422. {
  4423. WriteData((char*)0x7919CD, (char)0);
  4424. HUD_alpha_fix = true;
  4425. }
  4426. }
  4427. else
  4428. {
  4429. if (HUD_alpha_fix)
  4430. {
  4431. WriteData((char*)0x7919CD, (char)0x10);
  4432. HUD_alpha_fix = false;
  4433. }
  4434. }
  4435. if (star_glow == 0)
  4436. {
  4437. HUD3D_SPRITE_STAR.p.x = EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.x;
  4438. HUD3D_SPRITE_STAR.p.y = EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.y;
  4439. HUD3D_SPRITE_STAR.p.z = EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.z;
  4440. }
  4441. HUD3D_SPRITE_CIRCLE.p.x = EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.x;
  4442. HUD3D_SPRITE_CIRCLE.p.y = EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.y;
  4443. HUD3D_SPRITE_CIRCLE.p.z = EntityData1Ptrs[0]->CollisionInfo->CollisionArray->origin.z;
  4444. }
  4445. //}
  4446.  
  4447.  
  4448. //HUD *******************************************************************************************************************************************
  4449.  
  4450.  
  4451.  
  4452.  
  4453. //if (GameState == 15)
  4454. //{
  4455. // if (CurrentLevel == 26 || CurrentLevel == 29 || CurrentLevel == 33)
  4456. // {
  4457. // Sonic_LightSpeedShoesObtained = 1;
  4458. // Sonic_CrystalRingObtained = 1;
  4459. // Sonic_AncientLightObtained = 1;
  4460. // }
  4461. // else if (EntityData1Ptrs[0]->Action != 4 && (co1->Status & Status_LightDash) != Status_LightDash)
  4462. // {
  4463. // Sonic_LightSpeedShoesObtained = 1;
  4464. // Sonic_CrystalRingObtained = 0;
  4465. // Sonic_AncientLightObtained = 0;
  4466. // }
  4467. // else
  4468. // {
  4469. Sonic_LightSpeedShoesObtained = 1;
  4470. // Sonic_CrystalRingObtained = 0;
  4471. Sonic_AncientLightObtained = 1;
  4472. // }
  4473. //}
  4474.  
  4475.  
  4476.  
  4477.  
  4478. //Gameplay Enhancements
  4479. if (GameState == 15 || GameState == 16)
  4480. {
  4481. //Floor Grip at high speed
  4482. if (co2->Speed.x >= 25) co2->PhysicsData.FloorGrip = 5.0;
  4483. else if (co2->Speed.x >= 22) co2->PhysicsData.FloorGrip = 4.0;
  4484. else if (co2->Speed.x >= 19) co2->PhysicsData.FloorGrip = 3.5;
  4485. else if (co2->Speed.x >= 16.5) co2->PhysicsData.FloorGrip = 3.0;
  4486. else if (co2->Speed.x >= 11) co2->PhysicsData.FloorGrip = 2.5;
  4487. else co2->PhysicsData.FloorGrip = 2.0;
  4488.  
  4489. //Sideway speed at high speed fix
  4490. if (!just_untransformed)
  4491. {
  4492. co2->PhysicsData.Run2 = max(co2->Speed.x - 12 + 4.85, 4.85);
  4493. }
  4494.  
  4495. //Speed Cap optimizer
  4496. if (co2->Speed.x >= 15.9 || EntityData1Ptrs[0]->Action == 4)
  4497. {
  4498. co2->PhysicsData.HSpeedCap = 60000;
  4499. co2->PhysicsData.VSpeedCap = 60000;
  4500. }
  4501. else
  4502. {
  4503. co2->PhysicsData.HSpeedCap = 16;
  4504. co2->PhysicsData.VSpeedCap = 16;
  4505. }
  4506. }
  4507.  
  4508.  
  4509. //1up only on first 100 rings + can happen only once until you restart the level/die
  4510. if (Rings >= 100)
  4511. {
  4512. WriteData<5>((void*)0x425C28, 0x90);
  4513. }
  4514. else if (GameState == 4)
  4515. {
  4516. WriteData((void*)0x425C28, Can_get_1up);
  4517. }
  4518.  
  4519.  
  4520.  
  4521. //To change the character's position in the character select screen
  4522. if (GameState == 21)
  4523. {
  4524. if (GetCharacterObject(0))
  4525. {
  4526. co2->field_A = 20;
  4527. //if (CharacterSelection != 0) CharacterSelection = 0;
  4528. EntityData1Ptrs[0]->Position.y = 100;
  4529. }
  4530. }
  4531.  
  4532.  
  4533.  
  4534.  
  4535.  
  4536. if (GameState == 15 || GameState == 16)
  4537. {
  4538. if (co2 == NULL) return;
  4539. if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
  4540. {
  4541. //To have B button do nothing
  4542. WriteData((int*)0x0040FDE1, (int)Buttons_X);
  4543.  
  4544. //Lose lvl energy when hit
  4545. if (!LV1_active && !LV2_active && !LV3_active)
  4546. {
  4547. if (EntityData1Ptrs[0]->Action == 16)
  4548. {
  4549. if (Rings - OldRings < 0)
  4550. {
  4551. if (!LV1_obtained && !LV2_obtained && !LV3_obtained)
  4552. {
  4553. if (OldRings <= 20)
  4554. {
  4555. Gauge2 -= 100 * OldRings;
  4556. }
  4557. else
  4558. {
  4559. Gauge2 -= 2000;
  4560. }
  4561. }
  4562. if (LV1_obtained && !LV2_obtained && !LV3_obtained)
  4563. {
  4564. if (OldRings <= 20)
  4565. {
  4566. Gauge2 -= 100 * OldRings;
  4567. }
  4568. else
  4569. {
  4570. Gauge2 -= 2000;
  4571. }
  4572. if (Gauge2 < 10000) Gauge2 = 10000;
  4573. }
  4574. if (LV2_obtained && !LV3_obtained)
  4575. {
  4576. if (OldRings <= 20)
  4577. {
  4578. Gauge2 -= 100 * OldRings;
  4579. }
  4580. else
  4581. {
  4582. Gauge2 -= 2000;
  4583. }
  4584. if (Gauge2 < 20000) Gauge2 = 20000;
  4585. }
  4586. }
  4587. }
  4588. }
  4589.  
  4590. //Gauge2 filling while LVLS active
  4591. if (LV1_active || LV2_active || LV3_active)
  4592. {
  4593. if (Rings - OldRings > 0)
  4594. {
  4595. if (!RED_GEM_active)
  4596. {
  4597. Gauge2bis = Gauge2bis + 100 * (Rings - OldRings);
  4598. }
  4599. else Gauge2bis = Gauge2bis + 300 * (Rings - OldRings);
  4600. OldRings = Rings;
  4601. }
  4602. else if (Rings - OldRings < 0)
  4603. {
  4604. OldRings = Rings;
  4605. }
  4606. }
  4607.  
  4608.  
  4609. //Gauge and Gauge2 sounds and more
  4610. if (LV3_active)
  4611. {
  4612. if (Gauge >= 10000)
  4613. {
  4614. if (!cant_play_again)
  4615. {
  4616. if (!gauge_full)
  4617. {
  4618. if (!is_boosting && !CB_active)//or not chaos spear, or not chaos boost etc
  4619. {
  4620. PlaySound(1245, 0, 0, 0);
  4621. }
  4622. }
  4623. cant_play_again = true;
  4624. }
  4625. else if (can_play_again < 599)
  4626. {
  4627. ++can_play_again;
  4628. }
  4629. gauge_full = true;
  4630. Gauge = 10000;
  4631. }
  4632. else if (Gauge < 0) Gauge = 0;
  4633. else if (Gauge != 10000)
  4634. {
  4635. if (cant_play_again)
  4636. {
  4637. if (++can_play_again == 600)
  4638. {
  4639. cant_play_again = false;
  4640. can_play_again = 0;
  4641. }
  4642. }
  4643. gauge_full = false;
  4644. }
  4645. }
  4646. else
  4647. {
  4648. if (can_play_again > 120)
  4649. {
  4650. cant_play_again = false;
  4651. can_play_again = 0;
  4652. }
  4653. if (Gauge >= 10000)
  4654. {
  4655. if (!cant_play_again)
  4656. {
  4657. if (!gauge_full)
  4658. {
  4659. if (!is_boosting)//or not chaos spear, or not chaos boost etc
  4660. {
  4661. PlaySound(1245, 0, 0, 0);
  4662. }
  4663. }
  4664. cant_play_again = true;
  4665. }
  4666. else if (can_play_again < 120)
  4667. {
  4668. ++can_play_again;
  4669. }
  4670. gauge_full = true;
  4671. Gauge = 10000;
  4672. }
  4673. else if (Gauge < 0) Gauge = 0;
  4674. else if (Gauge != 10000)
  4675. {
  4676. if (cant_play_again)
  4677. {
  4678. if (++can_play_again == 120)
  4679. {
  4680. cant_play_again = false;
  4681. can_play_again = 0;
  4682. }
  4683. }
  4684. gauge_full = false;
  4685. }
  4686. }
  4687.  
  4688. if (Gauge2 >= 10000)
  4689. {
  4690. if (!gauge2_lv1)
  4691. {
  4692. PlaySound(1246, 0, 0, 0);
  4693. }
  4694. gauge2_lv1 = true;
  4695. }
  4696. if (Gauge2 >= 20000)
  4697. {
  4698. if (!gauge2_lv2)
  4699. {
  4700. PlaySound(1246, 0, 0, 0);
  4701. }
  4702. gauge2_lv2 = true;
  4703. }
  4704. if (Gauge2 >= 30000)
  4705. {
  4706. if (!gauge2_full)
  4707. {
  4708. PlaySound(1246, 0, 0, 0); //can also use 1247 (B06_00_25)
  4709. //CAN'T use : B06_00_21; B06_00_26; B06_00_27
  4710. }
  4711. gauge2_full = true;
  4712. Gauge2 = 30000;
  4713. }
  4714. else if (Gauge2 < 0) Gauge2 = 0;
  4715. else if (Gauge2 != 30000) gauge2_full = false;
  4716. if (EnemyBonus - OldEnemyBonus2 > 0)
  4717. {
  4718. Gauge = Gauge + 75 * (EnemyBonus - OldEnemyBonus2) / 10;
  4719. OldEnemyBonus2 = EnemyBonus;
  4720. }
  4721. else if (EnemyBonus - OldEnemyBonus2 < 0)
  4722. {
  4723. OldEnemyBonus2 = EnemyBonus;
  4724. }
  4725. if (LV3_active)
  4726. {
  4727. if (Rings - OldRings > 0)
  4728. {
  4729. Gauge = Gauge + 100 * (Rings - OldRings);
  4730. OldRings = Rings;
  4731. }
  4732. else if (Rings - OldRings < 0)
  4733. {
  4734. OldRings = Rings;
  4735. }
  4736. }
  4737.  
  4738.  
  4739. //if (Rings - OldRings > 0)
  4740. //{
  4741. // if (!LV1_active && !LV2_active && !LV3_active)
  4742. // {
  4743. // if (Gauge2bis != 0)
  4744. // {
  4745. // Gauge2 = Gauge2bis;
  4746. // Gauge2bis = 0;
  4747. // }
  4748. // Gauge2 = Gauge2 + 100 * (Rings - OldRings);
  4749. // }
  4750. // OldRings = Rings;
  4751. //}
  4752. //else if (Rings - OldRings < 0)
  4753. //{
  4754. // OldRings = Rings;
  4755. //}
  4756.  
  4757. if (!LV1_active && !LV2_active && !LV3_active)
  4758. {
  4759. if (Gauge2bis != 0)
  4760. {
  4761. Gauge2 = Gauge2bis;
  4762. Gauge2bis = 0;
  4763. }
  4764. if (Rings - OldRings > 0)
  4765. {
  4766. if (!RED_GEM_active)
  4767. {
  4768. Gauge2 = Gauge2 + 100 * (Rings - OldRings);
  4769. }
  4770. else Gauge2 = Gauge2 + 300 * (Rings - OldRings);
  4771. OldRings = Rings;
  4772. }
  4773. else if (Rings - OldRings < 0)
  4774. {
  4775. OldRings = Rings;
  4776. }
  4777. }
  4778.  
  4779. //if (Rings - OldRings > 0)
  4780. //{
  4781. // if (LV1_active || LV2_active || LV3_active)
  4782. // {
  4783. // Gauge2bis = Gauge2bis + 100 * (Rings - OldRings);
  4784. // }
  4785. // else Gauge2bis = 0;
  4786. // OldRings = Rings;
  4787. //}
  4788. //else if (Rings - OldRings < 0)
  4789. //{
  4790. // OldRings = Rings;
  4791. //}
  4792.  
  4793. if (LV1_active)
  4794. {
  4795. gauge2_lv1 = false;
  4796. }
  4797. else if (LV2_active)
  4798. {
  4799. gauge2_lv1 = false;
  4800. gauge2_lv2 = false;
  4801. }
  4802. else if (LV3_active)
  4803. {
  4804. gauge2_lv1 = false;
  4805. gauge2_lv2 = false;
  4806. gauge2_full = false;
  4807. }
  4808. }
  4809. }
  4810.  
  4811.  
  4812. //Increased Geometry and Skybox DrawDistance for Speed Highway
  4813. //for (int i = 0; i < 3; i++) { SkyboxDrawDist_SpeedHighway1[i].Maximum = -45000.0f; DrawDist_SpeedHighway1[i].Maximum = -18500.0f; }
  4814.  
  4815. ////Increased Geometry and Skybox DrawDistance for Windy Valley
  4816. //for (int i = 0; i < 3; i++) { SkyboxDrawDist_WindyValley1[i].Maximum = -45000.0f; DrawDist_WindyValley1[i].Maximum = -18500.0f; }
  4817.  
  4818. ////Increased Geometry and Skybox DrawDistance for Emerald Coast
  4819. //for (int i = 0; i < 3; i++) { SkyboxDrawDist_EmeraldCoast1[i].Maximum = -45000.0f; DrawDist_EmeraldCoast1[i].Maximum = -18500.0f; }
  4820.  
  4821.  
  4822.  
  4823.  
  4824. //Homing attack fix (to not go through air itemboxes)
  4825. if (GetCharacterObject(0) && GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
  4826. {
  4827. if (GameState == 4)
  4828. {
  4829. homing_attacking = false;
  4830. OldEnemyBonus3 = EnemyBonus;
  4831. restore_oldenemybonus3 = 0;
  4832. make_HA_false = 0;
  4833. }
  4834. if (GameState == 15)
  4835. {
  4836. if (EntityData1Ptrs[0]->Action == 14)
  4837. {
  4838. homing_attacking = true;
  4839. }
  4840. if (homing_attacking)
  4841. {
  4842. if (EnemyBonus - OldEnemyBonus3 == 0)
  4843. {
  4844. if (EntityData1Ptrs[0]->Action == 8)
  4845. {
  4846. co2->Speed.x = 0.0;
  4847. co2->Speed.y = 2.0;
  4848. co2->Speed.z = 0.0;
  4849. homing_attacking = false;
  4850. make_HA_false = 0;
  4851. }
  4852. }
  4853. if ((co1->Status & Status_Ground) == Status_Ground)
  4854. {
  4855. homing_attacking = false;
  4856. make_HA_false = 0;
  4857. }
  4858. if (++make_HA_false == 20)
  4859. {
  4860. homing_attacking = false;
  4861. make_HA_false = 0;
  4862. }
  4863. }
  4864. if (EnemyBonus > OldEnemyBonus3)
  4865. {
  4866. if (++restore_oldenemybonus3 == 20)
  4867. {
  4868. OldEnemyBonus3 = EnemyBonus;
  4869. restore_oldenemybonus3 = 0;
  4870. }
  4871. }
  4872. }
  4873. }
  4874.  
  4875.  
  4876. //Gauge
  4877. if (GameState == 4)
  4878. {
  4879. //Rings = 0;
  4880. Gauge2 = 0;
  4881. Gauge2bis = 0;
  4882. OldEnemyBonus2 = 0;
  4883. OldRings = 0;
  4884. gauge_full = false;
  4885. gauge2_lv1 = false;
  4886. gauge2_lv2 = false;
  4887. gauge2_full = false;
  4888. cant_play_again = true;
  4889. can_play_again = 0;
  4890. }
  4891.  
  4892. //WriteData((char*)0x43CB90, (char)0xC3);//when we tried to remove the speed change when underwater
  4893. //HUD !!!!
  4894. // LoadPVM("name of your pvm without the extension", &some texlist);
  4895.  
  4896.  
  4897. //Reload all itemboxes when restarting, => fix by setting act != 0 and find a way when dying to respawn stuff too properly
  4898. //WriteData((void*)0x414637, 0x90, 7); //66 89 15 CC 2D B2 03
  4899. //if (GameState == 7 && (ControllerPointers[0]->PressedButtons & Buttons_A || ControllerPointers[0]->PressedButtons & Buttons_Start))
  4900. //{
  4901. // GameState = 17;
  4902. // CurrentAct = 0;
  4903. //}
  4904. //if (GameState == 7 && ControllerPointers[0]->PressedButtons & Buttons_Start)
  4905. //{
  4906. // GameState = 12;
  4907. //}
  4908.  
  4909. // DataPointer(type, name, address); used for some stuff
  4910.  
  4911.  
  4912. //CHARACTER SELECT ONLY 1 2 OR 3
  4913. //DataPointer(int, CharacterSelection, 0x03B2A2FD);
  4914. //if (CharacterSelection == 3) CharacterSelection = 0;
  4915. //if (CharacterSelection == 5) CharacterSelection = 2;
  4916. //if (CharacterSelection == 6) CharacterSelection = 2;
  4917.  
  4918.  
  4919. //Knuckles rolling to punching action swap
  4920. // WriteData((short*)0x00473C80, (short)18);
  4921. // if (co2 == NULL) return;
  4922. // if (GetCharacterObject(2))
  4923.  
  4924.  
  4925. // WriteData((float*)PhysicsData.MaxAccel, (float)18);
  4926.  
  4927.  
  4928. // Max Run Speed Fix RACE ONLY - Will I even ever re-use this ?
  4929. // if (GetCharacterObject(0))
  4930. // {
  4931. // if ((co1->Status & Status_OnPath) == 0)
  4932. //
  4933. // {
  4934. // if (co2->Speed.x < 4.75) co2->PhysicsData.Run2 = 5.25;
  4935. // else if (co2->Speed.x < 25.5) co2->PhysicsData.Run2 = co2->Speed.x + 0.5f;
  4936. // else co2->PhysicsData.Run2 = 26;
  4937. // }
  4938. // if (co2->PhysicsData.MaxAccel < 10) PhysicsArray[Characters_Sonic].GroundAccel = 0.05;
  4939. // if (co2->PhysicsData.MaxAccel >= 10) PhysicsArray[Characters_Sonic].GroundAccel = 0.059;
  4940. // if (co2->PhysicsData.MaxAccel >= 16) PhysicsArray[Characters_Sonic].GroundAccel = 0.075;
  4941. // if (co2->PhysicsData.MaxAccel >= 20) PhysicsArray[Characters_Sonic].GroundAccel = 0.1;
  4942. // if (co2->PhysicsData.MaxAccel >= 26) PhysicsArray[Characters_Sonic].GroundAccel = 0.15;
  4943. // }
  4944.  
  4945. }
  4946.  
  4947. }
  4948.  
  4949.  
  4950. //if (ControllerPointers[0]->HeldButtons & Buttons_B) ++checkH;
  4951. //if (ControllerPointers[0]->HeldButtons & Buttons_X) --checkH;
  4952. //if (ControllerPointers[0]->HeldButtons & Buttons_A) ++checkV;
  4953. //if (ControllerPointers[0]->HeldButtons & Buttons_Y) --checkV;
  4954. ////////////////////////////////SetDebugFontSize(15);
  4955. ////////////////////////////////DisplayDebugStringFormatted((80 << 16) | 60, "%5i", checkH);
  4956. ////////////////////////////////SetDebugFontSize(12);
  4957. ////////////////////////////////SetDebugFontSize(15);
  4958. ////////////////////////////////DisplayDebugStringFormatted((81 << 16) | 61, "%5i", checkV);
  4959. ////////////////////////////////SetDebugFontSize(12);
  4960.  
  4961. //if (ControllerPointers[0]->PressedButtons & Buttons_Left)
  4962. //{
  4963. // draw = 0;
  4964. //}
  4965. //if (ControllerPointers[0]->PressedButtons & Buttons_Right)
  4966. //{
  4967. // draw = 1;
  4968. //}
  4969. //if (ControllerPointers[0]->PressedButtons & Buttons_Down)
  4970. //{
  4971. // draw = 2;
  4972. //}
  4973. //if (ControllerPointers[0]->PressedButtons & Buttons_Up)
  4974. //{
  4975. // draw = 3;
  4976. //}
  4977. //if (ControllerPointers[0]->PressedButtons & Buttons_C)
  4978. //{
  4979. // draw = 4;
  4980. //}
  4981. //if (ControllerPointers[0]->PressedButtons & Buttons_Z)
  4982. //{
  4983. // draw = 5;
  4984. //}
  4985. //if (ControllerPointers[0]->PressedButtons & Buttons_D)
  4986. //{
  4987. // draw = 6;
  4988. //}
  4989.  
  4990.  
  4991. //////////////////Hyper Sonic S3&K like Sparkles ??
  4992. //////////////////ParticleDepthOverride = 0.0f;
  4993. //////////////////EntityData1 *co1 = EntityData1Ptrs[0];
  4994. //////////////////for (auto it = sparklesgems.begin(); it != sparklesgems.end(); )
  4995. //////////////////{
  4996. ////////////////// NJS_VECTOR pos = { 0, it->radius, 0 };
  4997. ////////////////// njPushMatrix(nullptr);
  4998. ////////////////// njRotateX(nullptr, it->rotation.x);
  4999. ////////////////// njRotateY(nullptr, it->rotation.y);
  5000. ////////////////// njRotateZ(nullptr, it->rotation.z);
  5001. ////////////////// njCalcVector(nullptr, &pos, &sparklesprite.p);
  5002. ////////////////// njPopMatrix(1);
  5003. ////////////////// sparklesprite.p.x += co1->CollisionInfo->CollisionArray->origin.x;
  5004. ////////////////// sparklesprite.p.y += co1->CollisionInfo->CollisionArray->origin.y;
  5005. ////////////////// sparklesprite.p.z += co1->CollisionInfo->CollisionArray->origin.z;
  5006. ////////////////// njDrawSprite3D_Queue(&sparklesprite, 5, NJD_SPRITE_ALPHA | NJD_SPRITE_SCALE, (QueuedModelFlagsB)0);
  5007. ////////////////// it->frame++;
  5008. ////////////////// if (it->frame >= 16)
  5009. ////////////////// it = sparklesgems.erase(it);
  5010. ////////////////// else
  5011. ////////////////// {
  5012. ////////////////// it->rotation.x = (it->rotation.x + it->speed.x) & 0xFFFF;
  5013. ////////////////// it->rotation.y = (it->rotation.y + it->speed.y) & 0xFFFF;
  5014. ////////////////// it->rotation.z = (it->rotation.z + it->speed.z) & 0xFFFF;
  5015. ////////////////// ++it;
  5016. ////////////////// }
  5017. //////////////////}
  5018. //////////////////if (++sparkletimer == 3)
  5019. //////////////////{
  5020. ////////////////// sparklegemsdata sp = {};
  5021. ////////////////// sp.radius = ((float)rand() / RAND_MAX) * 8.0;
  5022. ////////////////// sp.rotation.x = rand() & 0xFFFF;
  5023. ////////////////// sp.rotation.y = rand() & 0xFFFF;
  5024. ////////////////// sp.rotation.z = rand() & 0xFFFF;
  5025. ////////////////// sp.speed.x = (rand() & 0xFFF) - 0x800;
  5026. ////////////////// sp.speed.y = (rand() & 0xFFF) - 0x800;
  5027. ////////////////// sp.speed.z = (rand() & 0xFFF) - 0x800;
  5028. ////////////////// sparklesgems.push_back(sp);
  5029. ////////////////// sparkletimer = 0;
  5030. //////////////////}
  5031. //////////////////SetMaterialAndSpriteColor_Float(1, 1, 1, 1);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement