Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Sonic+Miscellaneous.cpp : Defines the exported functions for the DLL application.
- //
- #include "stdafx.h"
- #include "SADXModLoader.h"
- #include "functions.h"
- bool just_untransformed = false;
- bool gauge2_lv1 = false;
- bool gauge2_lv2 = false;
- bool gauge2_full = false;
- bool HUD_loaded = false;
- //bool sonic_gameplay = false;
- int Gauge;
- int Gauge2;
- int test = 0;
- int untest = 0;
- int OldRingsHUD;
- int can_animate_gain = 0;
- int can_animate_loss = 0;
- ////////////////////// HUD //////////////////////////////////////////////////////////////////////////
- enum HUDTextureIndex
- {
- HUD_gauge, HUD_rings, HUD_lives, HUD_score, HUD_timer, 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_sonic_life, HUD_tails_life, HUD_knuckles_life, HUD_shadow_life, HUD_amy_life, HUD_gamma_life,
- 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,
- 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
- };
- static NJS_TEXNAME HUD_TEXNAME[8];
- static NJS_TEXLIST HUD_TEXLIST = { arrayptrandlength(HUD_TEXNAME) }; //MY OWN HUD STUFF
- static NJS_TEXANIM HUD_TEXANIM[] = {
- // w, h, cx, cy, u1, v1, u2, v2, texid, attr
- // u2 and v2 must be 0xFF
- { 375, 85, -810, -660, 0, 0, 0xFF, 0xFF, HUD_gauge, 0 },//width and height must be the texture's size
- { 314, 55, 44, -170, 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
- { 314, 55, 44, -220, 0, 0, 0xFF, 0xFF, HUD_lives, 0 },
- { 394, 55, 44, -70, 0, 0, 0xFF, 0xFF, HUD_score, 0 },
- { 394, 55, 44, -120, 0, 0, 0xFF, 0xFF, HUD_timer, 0 },
- { 75, 25, -1104, -700, 0, 0, 0xFF, 0xFF, HUD_sonic_lv1, 0 },
- { 75, 25, -1104, -700, 0, 0, 0xFF, 0xFF, HUD_sonic_lv2, 0 },
- { 75, 25, -1104, -700, 0, 0, 0xFF, 0xFF, HUD_sonic_lv3, 0 },
- { 75, 25, -1104, -700, 0, 0, 0xFF, 0xFF, HUD_shadow_lv1, 0 },
- { 75, 25, -1104, -700, 0, 0, 0xFF, 0xFF, HUD_shadow_lv2, 0 },
- { 75, 25, -1104, -700, 0, 0, 0xFF, 0xFF, HUD_shadow_lv3, 0 },
- { 75, 25, -1104, -700, 0, 0, 0xFF, 0xFF, HUD_metal_lv1, 0 },
- { 75, 25, -1104, -700, 0, 0, 0xFF, 0xFF, HUD_metal_lv2, 0 },
- { 75, 25, -1104, -700, 0, 0, 0xFF, 0xFF, HUD_metal_lv3, 0 },
- { 75, 75, -110, -205, 0, 0, 0xFF, 0xFF, HUD_sonic_life, 0 },
- { 75, 75, -110, -205, 0, 0, 0xFF, 0xFF, HUD_tails_life, 0 },
- { 75, 75, -110, -205, 0, 0, 0xFF, 0xFF, HUD_knuckles_life, 0 },
- { 75, 75, -110, -205, 0, 0, 0xFF, 0xFF, HUD_shadow_life, 0 },
- { 75, 75, -110, -205, 0, 0, 0xFF, 0xFF, HUD_amy_life, 0 },
- { 75, 75, -110, -205, 0, 0, 0xFF, 0xFF, HUD_gamma_life, 0 },
- { 75, 75, -110, -205, 0, 0, 0xFF, 0xFF, HUD_metalsonic_life, 0 },
- { 75, 75, -110, -205, 0, 0, 0xFF, 0xFF, HUD_tailsdoll_life, 0 },
- { 75, 75, -110, -205, 0, 0, 0xFF, 0xFF, HUD_metalknuckles_life, 0 }
- };
- static NJS_TEXANIM HUD_TEXANIM_NUMBERS_SCORE[] = {
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_0, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_1, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_2, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_3, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_4, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_5, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_6, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_7, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_8, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_9, 0 }
- };
- static NJS_TEXANIM HUD_TEXANIM_NUMBERS_TIMER_MINUTES[] = {
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_0, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_1, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_2, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_3, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_4, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_5, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_6, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_7, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_8, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_9, 0 }
- };
- static NJS_TEXANIM HUD_TEXANIM_NUMBERS_TIMER_SECONDS[] = {
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_0, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_1, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_2, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_3, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_4, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_5, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_6, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_7, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_8, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_9, 0 }
- };
- static NJS_TEXANIM HUD_TEXANIM_NUMBERS_TIMER_FRAMES[] = {
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_0, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_1, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_2, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_3, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_4, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_5, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_6, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_7, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_8, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_9, 0 }
- };
- static NJS_TEXANIM HUD_TEXANIM_NUMBERS_RING_ANIM[] = {
- { 50, 50, -161, -225, 0, 0, 0xFF, 0xFF, HUD_ring_a, 0 },
- { 50, 50, -161, -225, 0, 0, 0xFF, 0xFF, HUD_ring_b, 0 },
- { 50, 50, -161, -225, 0, 0, 0xFF, 0xFF, HUD_ring_c, 0 },
- { 50, 50, -161, -225, 0, 0, 0xFF, 0xFF, HUD_ring_d, 0 },
- { 50, 50, -161, -225, 0, 0, 0xFF, 0xFF, HUD_ring_e, 0 },
- { 50, 50, -161, -225, 0, 0, 0xFF, 0xFF, HUD_ring_f, 0 },
- { 50, 50, -161, -225, 0, 0, 0xFF, 0xFF, HUD_ring_g, 0 },
- { 50, 50, -161, -225, 0, 0, 0xFF, 0xFF, HUD_ring_h, 0 }
- };
- static NJS_TEXANIM HUD_TEXANIM_NUMBERS_RINGS[] = {
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_0, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_1, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_2, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_3, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_4, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_5, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_6, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_7, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_8, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_9, 0 }
- };
- static NJS_TEXANIM HUD_TEXANIM_NUMBERS_RINGS_0_RED[] = {
- { 90, 75, -212, -216, 0, 0, 0xFF, 0xFF, HUD_0s_red, 0 },
- { 90, 75, -212, -216, 0, 0, 0xFF, 0xFF, HUD_0s_red_glow, 0 }
- };
- static NJS_TEXANIM HUD_TEXANIM_NUMBERS_LIVES[] = {
- // w, h, cx, cy, u1, v1, u2, v2, texid, attr
- // u2 and v2 must be 0xFF
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_0, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_1, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_2, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_3, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_4, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_5, 0 }, //18 between 2 numbers
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_6, 0 }, //37 between the doublecoma numbers
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_7, 0 }, //35 between the coma numbers
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_8, 0 },
- { 40, 40, -157, -174, 0, 0, 0xFF, 0xFF, HUD_9, 0 } //-158 for ring digit 1; -18 for 2; -18 for 3
- };
- NJS_SPRITE HUD_SPRITE = { { 0.0f, 0.0f, 0.0f }, 1.3f, 1.3f, 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
- //REDO with its own NJS_TEXANIM (that's the big char sel screen pictures) NJS_SPRITE HUD_SPRITE2 = { { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, &HUD_TEXLIST, HUD_TEXANIM };
- NJS_SPRITE HUD_SPRITE_NUMBERS_SCORE = { { 0.0f, 0.0f, 0.0f }, 1.3f, 1.3f, 0, &HUD_TEXLIST, HUD_TEXANIM_NUMBERS_SCORE };
- NJS_SPRITE HUD_SPRITE_NUMBERS_TIMER_MINUTES = { { 0.0f, 0.0f, 0.0f }, 1.3f, 1.3f, 0, &HUD_TEXLIST, HUD_TEXANIM_NUMBERS_TIMER_MINUTES };
- NJS_SPRITE HUD_SPRITE_NUMBERS_TIMER_SECONDS = { { 0.0f, 0.0f, 0.0f }, 1.3f, 1.3f, 0, &HUD_TEXLIST, HUD_TEXANIM_NUMBERS_TIMER_SECONDS };
- NJS_SPRITE HUD_SPRITE_NUMBERS_TIMER_FRAMES = { { 0.0f, 0.0f, 0.0f }, 1.3f, 1.3f, 0, &HUD_TEXLIST, HUD_TEXANIM_NUMBERS_TIMER_FRAMES };
- NJS_SPRITE HUD_SPRITE_NUMBERS_RING_ANIM = { { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, &HUD_TEXLIST, HUD_TEXANIM_NUMBERS_RING_ANIM };
- NJS_SPRITE HUD_SPRITE_NUMBERS_RINGS = { { 0.0f, 0.0f, 0.0f }, 1.3f, 1.3f, 0, &HUD_TEXLIST, HUD_TEXANIM_NUMBERS_RINGS };
- NJS_SPRITE HUD_SPRITE_NUMBERS_RINGS_0_RED = { { 0.0f, 0.0f, 0.0f }, 1.0f, 1.0f, 0, &HUD_TEXLIST, HUD_TEXANIM_NUMBERS_RINGS_0_RED };
- NJS_SPRITE HUD_SPRITE_NUMBERS_LIVES = { { 0.0f, 0.0f, 0.0f }, 1.3f, 1.3f, 0, &HUD_TEXLIST, HUD_TEXANIM_NUMBERS_LIVES };
- //Score counter HUD
- void HudDisplayScoreSTH06(signed int scoreCount, unsigned __int8 digits, NJS_SPRITE *hud_S)
- {
- int count_S; // edi
- int i_S; // ecx
- int max_S; // eax MAPDST
- count_S = scoreCount;
- //if (HideHud >= 0)
- //{
- if (scoreCount >= 1000000000)
- {
- count_S = 999999999;
- }
- i_S = digits;
- max_S = 1;
- if ((signed int)digits > 0)
- {
- do
- {
- max_S *= 10;
- --i_S;
- } while (i_S);
- }
- if (count_S > --max_S)
- {
- count_S = max_S;
- }
- if (digits >= 9u)
- {
- njDrawSprite2D_Queue(
- hud_S,
- count_S / 100000000,
- 22046.498,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_S->p.x = hud_S->p.x + 23.4;
- }
- if (digits >= 8u)
- {
- njDrawSprite2D_Queue(
- hud_S,
- count_S % 100000000 / 10000000,
- 22046.498,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_S->p.x = hud_S->p.x + 23.4;
- }
- if (digits >= 7u)
- {
- njDrawSprite2D_Queue(
- hud_S,
- count_S % 10000000 / 1000000,
- 22046.498,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_S->p.x = hud_S->p.x + 23.4;
- }
- if (digits >= 6u)
- {
- njDrawSprite2D_Queue(
- hud_S,
- count_S % 1000000 / 100000,
- 22046.498,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_S->p.x = hud_S->p.x + 23.4;
- }
- if (digits >= 5u)
- {
- njDrawSprite2D_Queue(
- hud_S,
- count_S % 100000 / 10000,
- 22046.498,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_S->p.x = hud_S->p.x + 23.4;
- }
- if (digits >= 4u)
- {
- njDrawSprite2D_Queue(
- hud_S,
- count_S % 10000 / 1000,
- 22046.498,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_S->p.x = hud_S->p.x + 23.4;
- }
- if (digits >= 3u)
- {
- njDrawSprite2D_Queue(
- hud_S,
- count_S % 1000 / 100,
- 22046.498,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_S->p.x = hud_S->p.x + 23.4;
- }
- if (digits >= 2u)
- {
- njDrawSprite2D_Queue(
- hud_S,
- count_S % 100 / 10,
- 22046.496,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_S->p.x = hud_S->p.x + 23.4;
- }
- if (digits >= 1u)
- {
- njDrawSprite2D_Queue(
- hud_S,
- count_S % 10,
- 22046.496,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- }
- //}
- }
- //Timer Minutes counter HUD
- void HudDisplayMinutesSTH06(signed int minuteCount, unsigned __int8 digits, NJS_SPRITE *hud_TM)
- {
- int count_TM; // edi
- int i_TM; // ecx
- int max_TM; // eax MAPDST
- count_TM = minuteCount;
- //if (HideHud >= 0)
- //{
- if (minuteCount >= 1000)
- {
- count_TM = 999;
- }
- i_TM = digits;
- max_TM = 1;
- if ((signed int)digits > 0)
- {
- do
- {
- max_TM *= 10;
- --i_TM;
- } while (i_TM);
- }
- if (count_TM > --max_TM)
- {
- count_TM = max_TM;
- }
- if (digits >= 3u)
- {
- njDrawSprite2D_Queue(
- hud_TM,
- count_TM % 1000 / 100,
- 22046.498,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_TM->p.x = hud_TM->p.x + 23.4;
- }
- if (digits >= 2u)
- {
- njDrawSprite2D_Queue(
- hud_TM,
- count_TM % 100 / 10,
- 22046.496,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_TM->p.x = hud_TM->p.x + 23.4;
- }
- if (digits >= 1u)
- {
- njDrawSprite2D_Queue(
- hud_TM,
- count_TM % 10,
- 22046.496,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- }
- //}
- }
- //Timer Seconds counter HUD
- void HudDisplaySecondsSTH06(signed int secondCount, unsigned __int8 digits, NJS_SPRITE *hud_TS)
- {
- int count_TS; // edi
- int i_TS; // ecx
- int max_TS; // eax MAPDST
- count_TS = secondCount;
- //if (HideHud >= 0)
- //{
- if (secondCount >= 1000)
- {
- count_TS = 999;
- }
- i_TS = digits;
- max_TS = 1;
- if ((signed int)digits > 0)
- {
- do
- {
- max_TS *= 10;
- --i_TS;
- } while (i_TS);
- }
- if (count_TS > --max_TS)
- {
- count_TS= max_TS;
- }
- if (digits >= 3u)
- {
- njDrawSprite2D_Queue(
- hud_TS,
- count_TS % 1000 / 100,
- 22046.498,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_TS->p.x = hud_TS->p.x + 23.4;
- }
- if (digits >= 2u)
- {
- njDrawSprite2D_Queue(
- hud_TS,
- count_TS % 100 / 10,
- 22046.496,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_TS->p.x = hud_TS->p.x + 23.4;
- }
- if (digits >= 1u)
- {
- njDrawSprite2D_Queue(
- hud_TS,
- count_TS % 10,
- 22046.496,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- }
- //}
- }
- //Timer Frames counter HUD
- void HudDisplayFramesSTH06(signed int frameCount, unsigned __int8 digits, NJS_SPRITE *hud_TF)
- {
- int count_TF; // edi
- int i_TF; // ecx
- int max_TF; // eax MAPDST
- count_TF = 16.666 * frameCount;
- //if (HideHud >= 0)
- //{
- if (frameCount >= 10000)
- {
- count_TF = 9999;
- }
- i_TF = digits;
- max_TF = 1;
- if ((signed int)digits > 0)
- {
- do
- {
- max_TF *= 10;
- --i_TF;
- } while (i_TF);
- }
- if (count_TF > --max_TF)
- {
- count_TF = max_TF;
- }
- if (digits >= 3u)
- {
- njDrawSprite2D_Queue(
- hud_TF,
- count_TF / 100,
- 22046.496,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_TF->p.x = hud_TF->p.x + 23.4;
- }
- if (digits >= 2u)
- {
- njDrawSprite2D_Queue(
- hud_TF,
- count_TF % 100 / 10,
- 22046.496,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_TF->p.x = hud_TF->p.x + 23.4;
- }
- if (digits >= 1u)
- {
- njDrawSprite2D_Queue(
- hud_TF,
- count_TF % 10,
- 22046.496,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- }
- //}
- }
- //Ring counter HUD
- void HudDisplayRingsSTH06(signed int ringCount, unsigned __int8 digits, NJS_SPRITE *hud_R)
- {
- int count_R; // edi
- int i_R; // ecx
- int max_R; // eax MAPDST
- count_R = ringCount;
- //if (HideHud >= 0)
- //{
- if (ringCount >= 100000)
- {
- count_R = 99999;
- }
- i_R = digits;
- max_R = 1;
- if ((signed int)digits > 0)
- {
- do
- {
- max_R *= 10;
- --i_R;
- } while (i_R);
- }
- if (count_R > --max_R)
- {
- count_R = max_R;
- }
- if (digits >= 5u)
- {
- njDrawSprite2D_Queue(
- hud_R,
- count_R / 10000,
- 22046.5,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_R->p.x = hud_R->p.x + 23.4;
- }
- if (digits >= 4u)
- {
- njDrawSprite2D_Queue(
- hud_R,
- count_R % 10000 / 1000,
- 22046.498,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_R->p.x = hud_R->p.x + 23.4;
- }
- if (digits >= 3u)
- {
- njDrawSprite2D_Queue(
- hud_R,
- count_R % 1000 / 100,
- 22046.498,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_R->p.x = hud_R->p.x + 23.4;
- }
- if (digits >= 2u)
- {
- njDrawSprite2D_Queue(
- hud_R,
- count_R % 100 / 10,
- 22046.496,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_R->p.x = hud_R->p.x + 23.4;
- }
- if (digits >= 1u)
- {
- njDrawSprite2D_Queue(
- hud_R,
- count_R % 10,
- 22046.496,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- }
- //}
- }
- //Life counter HUD
- void HudDisplayLivesSTH06(signed int lifeCount, unsigned __int8 digits, NJS_SPRITE *hud_L)
- {
- int count_L; // edi
- int i_L; // ecx
- int max_L; // eax MAPDST
- count_L = lifeCount;
- //if (HideHud >= 0)
- //{
- if (lifeCount >= 1000)
- {
- count_L = 999;
- }
- i_L = digits;
- max_L = 1;
- if ((signed int)digits > 0)
- {
- do
- {
- max_L *= 10;
- --i_L;
- } while (i_L);
- }
- if (count_L > --max_L)
- {
- count_L = max_L;
- }
- if (digits >= 3u)
- {
- njDrawSprite2D_Queue(
- hud_L,
- count_L % 1000 / 100,
- 22046.498,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_L->p.x = hud_L->p.x + 23.4;
- }
- if (digits >= 2u)
- {
- njDrawSprite2D_Queue(
- hud_L,
- count_L % 100 / 10,
- 22046.496,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- hud_L->p.x = hud_L->p.x + 23.4;
- }
- if (digits >= 1u)
- {
- njDrawSprite2D_Queue(
- hud_L,
- count_L % 10,
- 22046.496,
- NJD_SPRITE_ALPHA | NJD_SPRITE_COLOR,
- QueuedModelFlagsB_SomeTextureThing);
- }
- //}
- }
- void MyHudThing()
- {
- //HUD
- if (GameState != 21)
- {
- if (GetCharacterObject(0))
- {
- //HudDisplayRingsSTH06(Rings, 3, &hud_sprite);
- njDrawSprite2D_Queue(&HUD_SPRITE, HUD_score, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- njDrawSprite2D_Queue(&HUD_SPRITE, HUD_timer, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- njDrawSprite2D_Queue(&HUD_SPRITE, HUD_rings, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- njDrawSprite2D_Queue(&HUD_SPRITE, HUD_lives, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- if (GetCharacterID(0) == Characters_Sonic && MetalSonicFlag == 0)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE, HUD_gauge, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- njDrawSprite2D_Queue(&HUD_SPRITE, HUD_sonic_life, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- else if (GetCharacterID(0) == Characters_Tails) njDrawSprite2D_Queue(&HUD_SPRITE, HUD_tails_life, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- else if (GetCharacterID(0) == Characters_Knuckles) njDrawSprite2D_Queue(&HUD_SPRITE, HUD_knuckles_life, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- else if (GetCharacterID(0) == Characters_Amy) njDrawSprite2D_Queue(&HUD_SPRITE, HUD_amy_life, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- else if (GetCharacterID(0) == Characters_Gamma) njDrawSprite2D_Queue(&HUD_SPRITE, HUD_gamma_life, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- HUD_SPRITE_NUMBERS_RINGS.p.x = 0;
- HUD_SPRITE_NUMBERS_RINGS.p.y = 0;
- HUD_SPRITE_NUMBERS_RINGS_0_RED.p.x = HUD_SPRITE_NUMBERS_RINGS.p.x;
- HUD_SPRITE_NUMBERS_RINGS_0_RED.p.y = HUD_SPRITE_NUMBERS_RINGS.p.y;
- HUD_SPRITE_NUMBERS_TIMER_MINUTES.p.x = -34;
- HUD_SPRITE_NUMBERS_TIMER_MINUTES.p.y = -65;
- HUD_SPRITE_NUMBERS_TIMER_SECONDS.p.x = HUD_SPRITE_NUMBERS_TIMER_MINUTES.p.x + 69;
- HUD_SPRITE_NUMBERS_TIMER_SECONDS.p.y = HUD_SPRITE_NUMBERS_TIMER_MINUTES.p.y;
- HUD_SPRITE_NUMBERS_TIMER_FRAMES.p.x = HUD_SPRITE_NUMBERS_TIMER_SECONDS.p.x + 71;
- HUD_SPRITE_NUMBERS_TIMER_FRAMES.p.y = HUD_SPRITE_NUMBERS_TIMER_MINUTES.p.y;
- HUD_SPRITE_NUMBERS_LIVES.p.y = 65;
- HUD_SPRITE_NUMBERS_SCORE.p.y = -133;
- //Ring Counter
- if (Rings == 0)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RINGS_0_RED, 0, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RINGS_0_RED, 1, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- else if (Rings > 0 && Rings < 1000)
- {
- HudDisplayRingsSTH06(Rings, 3, &HUD_SPRITE_NUMBERS_RINGS);
- }
- else if (Rings >= 1000)
- {
- HudDisplayRingsSTH06(Rings, 4, &HUD_SPRITE_NUMBERS_RINGS);
- }
- //Ring image animation
- //if (GameState == 4)
- //{
- // OldRingsHUD = Rings;
- // can_animate = 0;
- //}
- //if (GameState == 15 || GameState == 16)
- //{
- if (GetCharacterObject(0))
- {
- if (Rings - OldRingsHUD > 0)
- {
- can_animate_loss = 0;
- ++can_animate_gain;
- if (can_animate_gain == 1)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 1, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- else if (can_animate_gain == 2)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 2, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- else if (can_animate_gain == 3)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 3, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- else if (can_animate_gain == 4)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 4, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- else if (can_animate_gain == 5)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 5, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- else if (can_animate_gain == 6)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 6, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- else if (can_animate_gain == 7)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 7, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- OldRingsHUD = Rings;
- can_animate_gain = 0;
- }
- }
- else if (Rings - OldRingsHUD < 0)
- {
- can_animate_gain = 0;
- ++can_animate_loss;
- if (can_animate_loss == 1)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 7, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- else if (can_animate_loss == 2)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 6, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- else if (can_animate_loss == 3)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 5, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- else if (can_animate_loss == 4)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 4, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- else if (can_animate_loss == 5)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 3, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- else if (can_animate_loss == 6)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 2, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- else if (can_animate_loss == 7)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 1, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- OldRingsHUD = Rings;
- can_animate_loss = 0;
- }
- }
- else if (OldRingsHUD == Rings)
- {
- njDrawSprite2D_Queue(&HUD_SPRITE_NUMBERS_RING_ANIM, 0, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- }
- //}
- //Lives Counter
- if (Lives < 10)
- {
- HUD_SPRITE_NUMBERS_LIVES.p.x = 48.8;
- HudDisplayLivesSTH06(Lives, 1, &HUD_SPRITE_NUMBERS_LIVES);
- }
- else if (Lives >= 10)
- {
- HUD_SPRITE_NUMBERS_LIVES.p.x = 25.4;
- HudDisplayLivesSTH06(Lives, 2, &HUD_SPRITE_NUMBERS_LIVES);
- }
- //Timer Minutes
- HudDisplayMinutesSTH06(TimeMinutes, 2, &HUD_SPRITE_NUMBERS_TIMER_MINUTES);
- //Timer Minutes
- HudDisplaySecondsSTH06(TimeSeconds, 2, &HUD_SPRITE_NUMBERS_TIMER_SECONDS);
- //Score Counter
- HudDisplayFramesSTH06(TimeFrames, 3, &HUD_SPRITE_NUMBERS_TIMER_FRAMES);
- if (EnemyBonus < 10)
- {
- HUD_SPRITE_NUMBERS_SCORE.p.x = 153;
- HudDisplayScoreSTH06(EnemyBonus, 1, &HUD_SPRITE_NUMBERS_SCORE);
- }
- else if (EnemyBonus >= 10 && EnemyBonus < 100)
- {
- HUD_SPRITE_NUMBERS_SCORE.p.x = 129.6;
- HudDisplayScoreSTH06(EnemyBonus, 2, &HUD_SPRITE_NUMBERS_SCORE);
- }
- else if (EnemyBonus >= 100 && EnemyBonus < 1000)
- {
- HUD_SPRITE_NUMBERS_SCORE.p.x = 106.2;
- HudDisplayScoreSTH06(EnemyBonus, 3, &HUD_SPRITE_NUMBERS_SCORE);
- }
- else if (EnemyBonus >= 1000 && EnemyBonus < 10000)
- {
- HUD_SPRITE_NUMBERS_SCORE.p.x = 82.8;
- HudDisplayScoreSTH06(EnemyBonus, 4, &HUD_SPRITE_NUMBERS_SCORE);
- }
- else if (EnemyBonus >= 10000 && EnemyBonus < 100000)
- {
- HUD_SPRITE_NUMBERS_SCORE.p.x = 59.4;
- HudDisplayScoreSTH06(EnemyBonus, 5, &HUD_SPRITE_NUMBERS_SCORE);
- }
- else if (EnemyBonus >= 100000 && EnemyBonus < 1000000)
- {
- HUD_SPRITE_NUMBERS_SCORE.p.x = 36;
- HudDisplayScoreSTH06(EnemyBonus, 6, &HUD_SPRITE_NUMBERS_SCORE);
- }
- else if (EnemyBonus >= 1000000 && EnemyBonus < 10000000)
- {
- HUD_SPRITE_NUMBERS_SCORE.p.x = 12.6;
- HudDisplayScoreSTH06(EnemyBonus, 7, &HUD_SPRITE_NUMBERS_SCORE);
- }
- else if (EnemyBonus >= 10000000 && EnemyBonus < 100000000)
- {
- HUD_SPRITE_NUMBERS_SCORE.p.x = -10.8;
- HudDisplayScoreSTH06(EnemyBonus, 8, &HUD_SPRITE_NUMBERS_SCORE);
- }
- else
- {
- HUD_SPRITE_NUMBERS_SCORE.p.x = -34.2;
- HudDisplayScoreSTH06(EnemyBonus, 9, &HUD_SPRITE_NUMBERS_SCORE);
- }
- }
- }
- //Character Select HUD
- if (GameState == 21)
- {
- if (GetCharacterObject(0))
- {
- LoadPVM("HUD", &HUD_TEXLIST);// do better loading (not have it repeat)
- //njDrawSprite2D_Queue(&HUD_SPRITE2, char_sel_sonic, -1, NJD_SPRITE_ALPHA, (QueuedModelFlagsB)0);
- }
- }
- }
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////
- extern "C"
- {
- __declspec(dllexport) ModInfo SADXModInfo = { ModLoaderVer };
- __declspec(dllexport) void Init(const char *path, const HelperFunctions &helperFunctions)
- {
- Sonic_Init(path, helperFunctions);
- Miscellaneous_Init(path, helperFunctions);
- WriteJump((void*)0x425F90, MyHudThing);
- WriteData((char*)0x427F50, (char)0xC3);
- }
- etc
- etc
- etc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement