diff --git a/asm/non_matching/game/stage/Task_RingsMgrMain.inc b/asm/non_matching/game/stage/Task_RingsMgrMain.inc index 7c9f97028..cd5693fb1 100644 --- a/asm/non_matching/game/stage/Task_RingsMgrMain.inc +++ b/asm/non_matching/game/stage/Task_RingsMgrMain.inc @@ -339,7 +339,7 @@ _08008166: movs r0, #0xff _080081A4: strb r0, [r1] - ldr r1, _080082BC @ =gUnknown_030054A8 + ldr r1, _080082BC @ =gMusicManagerState movs r0, #0x10 strb r0, [r1, #3] _080081AC: @@ -475,7 +475,7 @@ _080082AC: .4byte gPlayer + 0x8 _080082B0: .4byte gRingCount _080082B4: .4byte gGameMode _080082B8: .4byte gNumLives -_080082BC: .4byte gUnknown_030054A8 +_080082BC: .4byte gMusicManagerState _080082C0: .4byte 0x04000128 _080082C4: .4byte gMultiplayerPlayerTasks _080082C8: .4byte IWRAM_START + 0x52 diff --git a/asm/non_matching/game/stage/rings_scatter/RingsScatterMultipak_FlippedGravity.inc b/asm/non_matching/game/stage/rings_scatter/RingsScatterMultipak_FlippedGravity.inc index d677549b0..41e89958c 100644 --- a/asm/non_matching/game/stage/rings_scatter/RingsScatterMultipak_FlippedGravity.inc +++ b/asm/non_matching/game/stage/rings_scatter/RingsScatterMultipak_FlippedGravity.inc @@ -181,7 +181,7 @@ _08020620: movs r0, #0xff _0802066A: strb r0, [r1] - ldr r1, _080206BC @ =gUnknown_030054A8 + ldr r1, _080206BC @ =gMusicManagerState movs r0, #0x10 strb r0, [r1, #3] _08020672: @@ -215,7 +215,7 @@ _080206AC: .4byte gRingCount _080206B0: .4byte gCurrentLevel _080206B4: .4byte gGameMode _080206B8: .4byte gNumLives -_080206BC: .4byte gUnknown_030054A8 +_080206BC: .4byte gMusicManagerState _080206C0: adds r3, r5, #0 adds r3, #0x14 diff --git a/asm/non_matching/game/stage/rings_scatter/RingsScatterMultipak_NormalGravity.inc b/asm/non_matching/game/stage/rings_scatter/RingsScatterMultipak_NormalGravity.inc index ba39f033e..6a3b70d92 100644 --- a/asm/non_matching/game/stage/rings_scatter/RingsScatterMultipak_NormalGravity.inc +++ b/asm/non_matching/game/stage/rings_scatter/RingsScatterMultipak_NormalGravity.inc @@ -191,7 +191,7 @@ _08020ABE: movs r0, #0xff _08020B0A: strb r0, [r1] - ldr r1, _08020B4C @ =gUnknown_030054A8 + ldr r1, _08020B4C @ =gMusicManagerState movs r0, #0x10 strb r0, [r1, #3] _08020B12: @@ -220,7 +220,7 @@ _08020B3C: .4byte gRingCount _08020B40: .4byte gCurrentLevel _08020B44: .4byte gGameMode _08020B48: .4byte gNumLives -_08020B4C: .4byte gUnknown_030054A8 +_08020B4C: .4byte gMusicManagerState _08020B50: adds r4, r5, #0 adds r4, #0x14 diff --git a/asm/non_matching/game/stage/rings_scatter/RingsScatterSinglepakMain.inc b/asm/non_matching/game/stage/rings_scatter/RingsScatterSinglepakMain.inc index d32544c44..199e5db50 100644 --- a/asm/non_matching/game/stage/rings_scatter/RingsScatterSinglepakMain.inc +++ b/asm/non_matching/game/stage/rings_scatter/RingsScatterSinglepakMain.inc @@ -243,7 +243,7 @@ _08020FAA: movs r0, #0xff _08020FF6: strb r0, [r1] - ldr r1, _08021040 @ =gUnknown_030054A8 + ldr r1, _08021040 @ =gMusicManagerState movs r0, #0x10 strb r0, [r1, #3] _08020FFE: @@ -274,7 +274,7 @@ _08021030: .4byte gRingCount _08021034: .4byte gCurrentLevel _08021038: .4byte gGameMode _0802103C: .4byte gNumLives -_08021040: .4byte gUnknown_030054A8 +_08021040: .4byte gMusicManagerState _08021044: adds r4, r5, #0 adds r4, #0x14 diff --git a/genctx.py b/genctx.py index a172347be..b84df6c3d 100644 --- a/genctx.py +++ b/genctx.py @@ -62,6 +62,9 @@ def search_directories(*patterns): print_order = tuple(ts.static_order()) with open('ctx.c', 'w') as context: + # Since the context is only used for matching anyway, auto-insert + context.write("#define PLATFORM_GBA 1\n\n") + for header in print_order: exclude = False for e in excluded: @@ -72,5 +75,3 @@ def search_directories(*patterns): if not exclude: print(header) context.write(data[header]) - - \ No newline at end of file diff --git a/include/constants/anim_sizes.h b/include/constants/anim_sizes.h new file mode 100644 index 000000000..5b6de9009 --- /dev/null +++ b/include/constants/anim_sizes.h @@ -0,0 +1,671 @@ +#ifndef GUARD_ANIM_SIZES_H +#define GUARD_ANIM_SIZES_H + +// TODO: Auto-generate this file +#define MAX_TILES(_animName) ((_animName##_WIDTH / 8) * (_animName##_HEIGHT / 8)) +#define MAX_TILES_VARIANT(_animName, _variant) ((_animName##_VAR##_variant##_WIDTH / 8) * (_animName##_VAR##_variant##_HEIGHT / 8)) +#define ALLOC_TILES(_animName) VramMalloc(((_animName##_WIDTH / 8) * (_animName##_HEIGHT / 8))) +#define ALLOC_TILES_VARIANT(_animName, _variant) \ + VramMalloc(((_animName##_VAR##_variant##_WIDTH / 8) * (_animName##_VAR##_variant##_HEIGHT / 8))) + +#if (GAME == GAME_SA1) +// +#define SA1_ANIM_GRIND_EFFECT_WIDTH 32 +#define SA1_ANIM_GRIND_EFFECT_HEIGHT 32 +#elif (GAME == GAME_SA2) +// 849 +#define SA2_ANIM_GRIND_EFFECT_WIDTH 32 +#define SA2_ANIM_GRIND_EFFECT_HEIGHT 40 +#elif (GAME == GAME_SA3) +// 858 +#define ANIM_CHAOMAP_EMERALD_WIDTH 24 +#define ANIM_CHAOMAP_EMERALD_HEIGHT 16 + +// 840 +#define ANIM_ANIMAL_WIDTH 16 +#define ANIM_ANIMAL_HEIGHT 16 + +// 866 +#define ANIM_SPRING_WIDTH 32 +#define ANIM_SPRING_HEIGHT 40 + +// 866 +#define ANIM_DASH_RING_WIDTH 48 +#define ANIM_DASH_RING_HEIGHT 48 +#define ANIM_DASH_RING_VAR0_WIDTH 16 +#define ANIM_DASH_RING_VAR0_HEIGHT 48 +#define ANIM_DASH_RING_VAR1_WIDTH 8 +#define ANIM_DASH_RING_VAR1_HEIGHT 48 +#define ANIM_DASH_RING_VAR2_WIDTH 48 +#define ANIM_DASH_RING_VAR2_HEIGHT 16 +#define ANIM_DASH_RING_VAR3_WIDTH 48 +#define ANIM_DASH_RING_VAR3_HEIGHT 8 +#define ANIM_DASH_RING_VAR4_WIDTH 48 +#define ANIM_DASH_RING_VAR4_HEIGHT 48 +#define ANIM_DASH_RING_VAR5_WIDTH 40 +#define ANIM_DASH_RING_VAR5_HEIGHT 40 + +// 869 +#define ANIM_SPIKES_WIDTH 32 +#define ANIM_SPIKES_HEIGHT 32 + +// 870 +#define ANIM_RAMP_WIDTH 40 +#define ANIM_RAMP_HEIGHT 32 +#define ANIM_RAMP_VAR0_WIDTH 40 +#define ANIM_RAMP_VAR0_HEIGHT 32 +#define ANIM_RAMP_VAR1_WIDTH 40 +#define ANIM_RAMP_VAR1_HEIGHT 24 + +// 872 +#define ANIM_ZONE_WARP_WIDTH 48 +#define ANIM_ZONE_WARP_HEIGHT 32 + +// 873 +#define ANIM_BOUNCY_BAR_WIDTH 32 +#define ANIM_BOUNCY_BAR_HEIGHT 24 + +// 874 +#define ANIM_ROTATING_HANDLE_WIDTH 24 +#define ANIM_ROTATING_HANDLE_HEIGHT 24 + +// 875 +#define ANIM_CHECKPOINT_WIDTH 24 +#define ANIM_CHECKPOINT_HEIGHT 48 +#define ANIM_CHECKPOINT_VAR0_WIDTH 16 +#define ANIM_CHECKPOINT_VAR0_HEIGHT 48 +#define ANIM_CHECKPOINT_VAR1_WIDTH 24 +#define ANIM_CHECKPOINT_VAR1_HEIGHT 48 + +// 876 +#define ANIM_LIFT_WIDTH 8 +#define ANIM_LIFT_HEIGHT 24 +#define ANIM_LIFT_VAR0_WIDTH 8 +#define ANIM_LIFT_VAR0_HEIGHT 24 +#define ANIM_LIFT_VAR1_WIDTH 8 +#define ANIM_LIFT_VAR1_HEIGHT 8 +#define ANIM_LIFT_VAR2_WIDTH 24 +#define ANIM_LIFT_VAR2_HEIGHT 16 + +// 877 +#define ANIM_PLATFORM_CRUMBLING_1_WIDTH 48 +#define ANIM_PLATFORM_CRUMBLING_1_HEIGHT 32 + +// 878 +#define ANIM_TRAMPOLINE_WIDTH 48 +#define ANIM_TRAMPOLINE_HEIGHT 32 + +// 878 +#define ANIM_BUTTON_BLUE_WIDTH 24 +#define ANIM_BUTTON_BLUE_HEIGHT 24 + +// 880 +#define ANIM_BUTTON_SPRING_1_VAR0_WIDTH 32 +#define ANIM_BUTTON_SPRING_1_VAR0_HEIGHT 40 +#define ANIM_BUTTON_SPRING_1_VAR5_WIDTH 40 +#define ANIM_BUTTON_SPRING_1_VAR5_HEIGHT 24 +#define ANIM_BUTTON_SPRING_1_VAR10_WIDTH 32 +#define ANIM_BUTTON_SPRING_1_VAR10_HEIGHT 32 +#define ANIM_BUTTON_SPRING_1_VAR15_WIDTH 24 +#define ANIM_BUTTON_SPRING_1_VAR15_HEIGHT 24 + +// 882 +#define ANIM_DECO_ROCK_WIDTH 48 +#define ANIM_DECO_ROCK_HEIGHT 32 + +// 883 +#define ANIM_FLAT_SPRING_WIDTH 32 +#define ANIM_FLAT_SPRING_HEIGHT 32 + +// 884 +#define ANIM_PLATFORM_RAISING_WHEEL_WIDTH 32 +#define ANIM_PLATFORM_RAISING_WHEEL_HEIGHT 24 +#define ANIM_PLATFORM_RAISING_WHEEL_PLATFORM_WIDTH 24 +#define ANIM_PLATFORM_RAISING_WHEEL_PLATFORM_HEIGHT 24 + +// 886 +#define ANIM_ACCORDION_SPRING_2_WIDTH 32 +#define ANIM_ACCORDION_SPRING_2_HEIGHT 24 + +// 889 +#define ANIM_PLATFORM_2_WIDTH 48 +#define ANIM_PLATFORM_2_HEIGHT 24 + +// 886 +#define ANIM_PLATFORM_CRUMBLING_2_WIDTH 48 +#define ANIM_PLATFORM_CRUMBLING_2_HEIGHT 24 + +// 898 +#define ANIM_PLATFORM_ON_A_PATH_3_WIDTH 56 +#define ANIM_PLATFORM_ON_A_PATH_3_HEIGHT 24 + +// 891 +#define ANIM_BUNGEE_CORD_WIDTH 8 +#define ANIM_BUNGEE_CORD_HEIGHT 8 +#define ANIM_BUNGEE_CORD_VAR0_WIDTH 8 +#define ANIM_BUNGEE_CORD_VAR0_HEIGHT 8 + +// 892 +#define ANIM_SUNSET_BRIDGE_WIDTH 24 +#define ANIM_SUNSET_BRIDGE_HEIGHT 32 + +// 893 +#define ANIM_PLATFORM_2_2_WIDTH 48 +#define ANIM_PLATFORM_2_2_HEIGHT 16 +#define ANIM_PLATFORM_2_2_VAR0_WIDTH 48 +#define ANIM_PLATFORM_2_2_VAR0_HEIGHT 16 + +// 894 +#define ANIM_WAGGLE_COIL_WIDTH 48 +#define ANIM_WAGGLE_COIL_HEIGHT 56 + +// 900 +#define ANIM_PLATFORM_3_0_WIDTH (48 / 2) +#define ANIM_PLATFORM_3_0_HEIGHT 24 + +// 901 +#define ANIM_SUCTION_3_VERTICAL_WIDTH 24 +#define ANIM_SUCTION_3_VERTICAL_HEIGHT 56 + +// 902 +#define ANIM_SUCTION_3_HORIZONTAL_WIDTH 56 +#define ANIM_SUCTION_3_HORIZONTAL_HEIGHT 24 + +// 903 +#define ANIM_DEATH_CRUSHER_SPIKED_WIDTH 24 +#define ANIM_DEATH_CRUSHER_SPIKED_HEIGHT 80 + +// 904 +#define ANIM_DEATH_CRUSHER_NO_LED_WIDTH 24 +#define ANIM_DEATH_CRUSHER_NO_LED_HEIGHT 48 + +// 905 +#define ANIM_DEATH_CRUSHER_WIDTH 24 +#define ANIM_DEATH_CRUSHER_HEIGHT 48 + +// 907 +#define ANIM_PLATFORM_CRUMBLING_3_WIDTH 48 +#define ANIM_PLATFORM_CRUMBLING_3_HEIGHT 48 + +// 908 - x-mirrored +#define ANIM_PROPELLER_BUTTON_PLATFORM_WIDTH (64 / 2) +#define ANIM_PROPELLER_BUTTON_PLATFORM_HEIGHT 48 + +// 910 +#define ANIM_WATER_CANNON_WIDTH 32 +#define ANIM_WATER_CANNON_HEIGHT 48 + +// 911 +#define ANIM_FACTORY_RING_WIDTH 48 +#define ANIM_FACTORY_RING_HEIGHT 48 + +// 912 +#define ANIM_SPECIAL_SPRING_WIDTH 32 +#define ANIM_SPECIAL_SPRING_HEIGHT 48 + +// 913 +#define ANIM_BONUS_UFO_WIDTH 24 +#define ANIM_BONUS_UFO_HEIGHT 48 + +// 914 +#define ANIM_BONUS_UFO_RAY_WIDTH 24 +#define ANIM_BONUS_UFO_RAY_HEIGHT 56 + +// 915 +#define ANIM_ROCKET_WIDTH 48 +#define ANIM_ROCKET_HEIGHT 48 +#define ANIM_ROCKET_VAR0_WIDTH 16 +#define ANIM_ROCKET_VAR0_HEIGHT 8 +#define ANIM_ROCKET_VAR1_WIDTH 16 +#define ANIM_ROCKET_VAR1_HEIGHT 8 +#define ANIM_ROCKET_VAR2_WIDTH 8 +#define ANIM_ROCKET_VAR2_HEIGHT 8 +#define ANIM_ROCKET_VAR3_WIDTH 8 +#define ANIM_ROCKET_VAR3_HEIGHT 8 +#define ANIM_ROCKET_VAR4_WIDTH 8 +#define ANIM_ROCKET_VAR4_HEIGHT 8 +#define ANIM_ROCKET_VAR5_WIDTH 8 +#define ANIM_ROCKET_VAR5_HEIGHT 8 +#define ANIM_ROCKET_VAR6_WIDTH 8 +#define ANIM_ROCKET_VAR6_HEIGHT 8 + +// 916 +#define ANIM_FERRIS_WHEEL_HEIGHT 8 +#define ANIM_FERRIS_WHEEL_WIDTH 8 +#define ANIM_FERRIS_WHEEL_VAR0_HEIGHT 8 +#define ANIM_FERRIS_WHEEL_VAR0_WIDTH 8 +#define ANIM_FERRIS_WHEEL_VAR1_HEIGHT 8 +#define ANIM_FERRIS_WHEEL_VAR1_WIDTH 8 + +// 917 +#define ANIM_TOY_BALLOON_WIDTH 32 +#define ANIM_TOY_BALLOON_HEIGHT 48 + +// 918 (x-mirrored) +#define ANIM_SPRING_IN_A_BOX_WIDTH (64 / 2) +#define ANIM_SPRING_IN_A_BOX_HEIGHT 64 + +// 919 +#define ANIM_PANDA_CART_WIDTH 48 +#define ANIM_PANDA_CART_HEIGHT 40 + +// 920 +#define ANIM_PENDULUM_WIDTH 40 +#define ANIM_PENDULUM_HEIGHT 40 +#define ANIM_PENDULUM_VAR0_WIDTH 40 +#define ANIM_PENDULUM_VAR0_HEIGHT 40 +#define ANIM_PENDULUM_VAR1_WIDTH 8 +#define ANIM_PENDULUM_VAR1_HEIGHT 8 + +// 921 (x-mirrored) +#define ANIM_PLATFORM_SPIKED_WIDTH 32 +#define ANIM_PLATFORM_SPIKED_HEIGHT 48 + +// 922 +#define ANIM_ICE_SPIKE_WIDTH 32 +#define ANIM_ICE_SPIKE_HEIGHT 32 + +// 923 +#define ANIM_ICE_LAUNCHER_WIDTH 48 +#define ANIM_ICE_LAUNCHER_HEIGHT 64 + +// 924 +#define ANIM_WINDUP_BLOCK_WIDTH 24 +#define ANIM_WINDUP_BLOCK_HEIGHT 24 +#define ANIM_WINDUP_BLOCK_VAR0_WIDTH 24 +#define ANIM_WINDUP_BLOCK_VAR0_HEIGHT 24 +#define ANIM_WINDUP_BLOCK_VAR1_WIDTH 24 +#define ANIM_WINDUP_BLOCK_VAR1_HEIGHT 24 +#define ANIM_WINDUP_BLOCK_VAR2_WIDTH 24 +#define ANIM_WINDUP_BLOCK_VAR2_HEIGHT 24 +#define ANIM_WINDUP_BLOCK_VAR3_WIDTH 24 +#define ANIM_WINDUP_BLOCK_VAR3_HEIGHT 24 + +// 925 +#define ANIM_MINECART_WIDTH 64 +#define ANIM_MINECART_HEIGHT 64 +#define ANIM_MINECART_VAR0_WIDTH 64 +#define ANIM_MINECART_VAR0_HEIGHT 64 +#define ANIM_MINECART_VAR1_WIDTH 64 +#define ANIM_MINECART_VAR1_HEIGHT 64 +#define ANIM_MINECART_VAR2_WIDTH 16 +#define ANIM_MINECART_VAR2_HEIGHT 16 +#define ANIM_MINECART_VAR3_WIDTH 8 +#define ANIM_MINECART_VAR3_HEIGHT 8 +#define ANIM_MINECART_VAR4_WIDTH 8 +#define ANIM_MINECART_VAR4_HEIGHT 8 + +// 926 +#define ANIM_AIR_BUBBLES_WIDTH 24 +#define ANIM_AIR_BUBBLES_HEIGHT 24 +#define ANIM_AIR_BUBBLES_VAR0_WIDTH 24 +#define ANIM_AIR_BUBBLES_VAR0_HEIGHT 24 +#define ANIM_AIR_BUBBLES_VAR1_WIDTH 8 +#define ANIM_AIR_BUBBLES_VAR1_HEIGHT 8 +#define ANIM_AIR_BUBBLES_VAR2_WIDTH 24 +#define ANIM_AIR_BUBBLES_VAR2_HEIGHT 24 + +// 927 +#define ANIM_ATTACHED_PLATFORM_WIDTH 48 +#define ANIM_ATTACHED_PLATFORM_HEIGHT 16 +#define ANIM_ATTACHED_PLATFORM_VAR0_WIDTH 48 +#define ANIM_ATTACHED_PLATFORM_VAR0_HEIGHT 16 +#define ANIM_ATTACHED_PLATFORM_VAR1_WIDTH 16 +#define ANIM_ATTACHED_PLATFORM_VAR1_HEIGHT 16 +#define ANIM_ATTACHED_PLATFORM_VAR2_WIDTH 8 +#define ANIM_ATTACHED_PLATFORM_VAR2_HEIGHT 8 + +// 929 +#define ANIM_BOULDER_WIDTH 40 +#define ANIM_BOULDER_HEIGHT 40 +#define ANIM_BOULDER_VAR0_WIDTH 40 +#define ANIM_BOULDER_VAR0_HEIGHT 40 +#define ANIM_BOULDER_VAR1_WIDTH 16 +#define ANIM_BOULDER_VAR1_HEIGHT 16 +#define ANIM_BOULDER_VAR2_WIDTH 8 +#define ANIM_BOULDER_VAR2_HEIGHT 8 + +// 931 +#define ANIM_UFO_PLATFORM_WIDTH 48 +#define ANIM_UFO_PLATFORM_HEIGHT 24 + +// 930 +#define ANIM_CLOSING_WALL_WIDTH 72 +#define ANIM_CLOSING_WALL_HEIGHT 24 + +// 933 +#define ANIM_FALL_PLATFORM_CA_WIDTH 48 +#define ANIM_FALL_PLATFORM_CA_HEIGHT 16 + +// 934 +#define ANIM_WATER_CANNON_SPLASH_WIDTH 48 +#define ANIM_WATER_CANNON_SPLASH_HEIGHT 40 + +// 935 +#define ANIM_PLATFORM_CRUMBLING_7_WIDTH 48 +#define ANIM_PLATFORM_CRUMBLING_7_HEIGHT 40 + +// 936 +#define ANIM_SPRING_6_WIDTH 24 +#define ANIM_SPRING_6_HEIGHT 40 + +// 938 +#define ANIM_PLATFORM_CRUMBLING_6_WIDTH 48 +#define ANIM_PLATFORM_CRUMBLING_6_HEIGHT 24 + +// 939 +#define ANIM_SPRING_PLATFORM_6_WIDTH 24 +#define ANIM_SPRING_PLATFORM_6_HEIGHT 64 + +// 940 +#define ANIM_MAZE_WIDTH 48 +#define ANIM_MAZE_HEIGHT 64 +#define ANIM_MAZE_VAR0_WIDTH 48 +#define ANIM_MAZE_VAR0_HEIGHT 64 +#define ANIM_MAZE_VAR1_WIDTH 48 +#define ANIM_MAZE_VAR1_HEIGHT 64 +#define ANIM_MAZE_VAR2_WIDTH 48 +#define ANIM_MAZE_VAR2_HEIGHT 64 +#define ANIM_MAZE_VAR3_WIDTH 64 +#define ANIM_MAZE_VAR3_HEIGHT 48 +#define ANIM_MAZE_VAR4_WIDTH 64 +#define ANIM_MAZE_VAR4_HEIGHT 48 +#define ANIM_MAZE_VAR5_WIDTH 64 +#define ANIM_MAZE_VAR5_HEIGHT 48 +#define ANIM_MAZE_VAR6_WIDTH 24 +#define ANIM_MAZE_VAR6_HEIGHT 24 +#define ANIM_MAZE_VAR7_WIDTH 48 +#define ANIM_MAZE_VAR7_HEIGHT 56 +#define ANIM_MAZE_VAR8_WIDTH 56 +#define ANIM_MAZE_VAR8_HEIGHT 48 + +// 942 +#define ANIM_PLATFORM_ON_A_PATH_6_WIDTH 56 +#define ANIM_PLATFORM_ON_A_PATH_6_HEIGHT 24 + +// 945 +#define ANIM_MUD_FX_WIDTH 48 +#define ANIM_MUD_FX_HEIGHT 24 +#define ANIM_MUD_FX_CHAOS_ANGEL_WIDTH 48 +#define ANIM_MUD_FX_CHAOS_ANGEL_HEIGHT 24 + +// 948 +#define ANIM_GOAL_RING_WIDTH 24 +#define ANIM_GOAL_RING_HEIGHT 24 +#define ANIM_GOAL_RING_VAR8_WIDTH 24 // Sparkle effect +#define ANIM_GOAL_RING_VAR8_HEIGHT 16 + +// 949 +#define ANIM_SUCTION_VERTICAL_WIDTH 24 +#define ANIM_SUCTION_VERTICAL_HEIGHT 56 + +// 950 +#define ANIM_SUCTION_HORIZONTAL_WIDTH 56 +#define ANIM_SUCTION_HORIZONTAL_HEIGHT 24 + +// 951 +#define ANIM_PLATFORM_CRUMBLING_4_WIDTH 48 +#define ANIM_PLATFORM_CRUMBLING_4_HEIGHT 24 + +// 952 +#define ANIM_PLATFORM_CRUMBLING_5_WIDTH 48 +#define ANIM_PLATFORM_CRUMBLING_5_HEIGHT 32 + +// 955 +#define ANIM_SUCTION_STREAM_HORIZONTAL_WIDTH 24 +#define ANIM_SUCTION_STREAM_HORIZONTAL_HEIGHT 56 + +// 956 +#define ANIM_SUCTION_STREAM_VERTICAL_WIDTH 56 +#define ANIM_SUCTION_STREAM_VERTICAL_HEIGHT 24 + +// 969 +#define ANIM_WINDUP_BLOCK_7_WIDTH 24 +#define ANIM_WINDUP_BLOCK_7_HEIGHT 24 +#define ANIM_WINDUP_BLOCK_7_VAR0_WIDTH 24 +#define ANIM_WINDUP_BLOCK_7_VAR0_HEIGHT 24 +#define ANIM_WINDUP_BLOCK_7_VAR1_WIDTH 8 +#define ANIM_WINDUP_BLOCK_7_VAR1_HEIGHT 24 +#define ANIM_WINDUP_BLOCK_7_VAR2_WIDTH 24 +#define ANIM_WINDUP_BLOCK_7_VAR2_HEIGHT 24 +#define ANIM_WINDUP_BLOCK_7_VAR3_WIDTH 24 +#define ANIM_WINDUP_BLOCK_7_VAR3_HEIGHT 8 + +// 976 +#define ANIM_TOY_BALLOON_POPPED_WIDTH 32 +#define ANIM_TOY_BALLOON_POPPED_HEIGHT 48 + +// 976 +#define ANIM_OMOCHAO0_WIDTH 24 +#define ANIM_OMOCHAO0_HEIGHT 24 + +// 977 +#define ANIM_OMOCHAO1_WIDTH 24 +#define ANIM_OMOCHAO1_HEIGHT 24 + +// 978 +#define ANIM_OMOCHAO2_WIDTH 24 +#define ANIM_OMOCHAO2_HEIGHT 24 + +// 979 +#define ANIM_OMOCHAO3_WIDTH 24 +#define ANIM_OMOCHAO3_HEIGHT 24 + +// 980 +#define ANIM_OMOCHAO4_WIDTH 24 +#define ANIM_OMOCHAO4_HEIGHT 24 + +// 981 +#define ANIM_OMOCHAO5_WIDTH 24 +#define ANIM_OMOCHAO5_HEIGHT 24 + +// 983 +#define ANIM_ACT_RING_WIDTH 32 +#define ANIM_ACT_RING_HEIGHT 32 +#define ANIM_ACT_RING_VAR0_WIDTH 32 +#define ANIM_ACT_RING_VAR0_HEIGHT 32 +#define ANIM_ACT_RING_VAR1_WIDTH 32 +#define ANIM_ACT_RING_VAR1_HEIGHT 32 +#define ANIM_ACT_RING_VAR2_WIDTH 32 +#define ANIM_ACT_RING_VAR2_HEIGHT 32 +// "Crown" signalling completion +#define ANIM_ACT_RING_VAR3_WIDTH 24 +#define ANIM_ACT_RING_VAR3_HEIGHT 16 + +// 984 +#define ANIM_SPRING_PLATFORM_4_WIDTH 24 +#define ANIM_SPRING_PLATFORM_4_HEIGHT 64 + +// 986 +#define ANIM_SLOW_LIFT_7_WIDTH (112 / 2) +#define ANIM_SLOW_LIFT_7_HEIGHT 24 + +// 987 +#define ANIM_SPRING_4_WIDTH 32 +#define ANIM_SPRING_4_HEIGHT 40 + +// 995 +#define ANIM_BUTTON_SPRING_6_VAR0_WIDTH 32 +#define ANIM_BUTTON_SPRING_6_VAR0_HEIGHT 40 +#define ANIM_BUTTON_SPRING_6_VAR5_WIDTH 40 +#define ANIM_BUTTON_SPRING_6_VAR5_HEIGHT 24 +#define ANIM_BUTTON_SPRING_6_VAR10_WIDTH 32 +#define ANIM_BUTTON_SPRING_6_VAR10_HEIGHT 32 + +// 997 +#define ANIM_PLATFORM_BONUS_WIDTH 48 +#define ANIM_PLATFORM_BONUS_HEIGHT 48 +#define ANIM_PLATFORM_BONUS_VAR0_WIDTH 48 +#define ANIM_PLATFORM_BONUS_VAR0_HEIGHT 48 +#define ANIM_PLATFORM_BONUS_VAR1_WIDTH 48 +#define ANIM_PLATFORM_BONUS_VAR1_HEIGHT 24 + +// 1004 +#define ANIM_CHAO_SITTING_WIDTH 32 +#define ANIM_CHAO_SITTING_HEIGHT 32 + +// 1042 +#define ANIM_UI_PROMPT_BUTTON_WIDTH 16 +#define ANIM_UI_PROMPT_BUTTON_HEIGHT 16 + +// 1059 +#define ANIM_BONUS_UI_TIMER_DIGITS_WIDTH 8 +#define ANIM_BONUS_UI_TIMER_DIGITS_HEIGHT 16 + +// 1063 +#define ANIM_BONUS_UI_FLOWER_WIDTH 16 +#define ANIM_BONUS_UI_FLOWER_HEIGHT 24 + +// 1064 +#define ANIM_BONUS_UI_BAR_WIDTH 16 +#define ANIM_BONUS_UI_BAR_HEIGHT 16 + +// 1065 +#define ANIM_BONUS_UI_X_WIDTH 48 +#define ANIM_BONUS_UI_X_HEIGHT 32 +#define ANIM_BONUS_UI_X_VAR0_WIDTH 16 +#define ANIM_BONUS_UI_X_VAR0_HEIGHT 16 +#define ANIM_BONUS_UI_X_VAR1_WIDTH 48 +#define ANIM_BONUS_UI_X_VAR1_HEIGHT 32 + +// 1154 +#define ANIM_BONUS_CAPSULE_WIDTH 56 +#define ANIM_BONUS_CAPSULE_HEIGHT 72 + +// 1155 +#define ANIM_BONUS_CAPSULE_POINTS_WIDTH 24 +#define ANIM_BONUS_CAPSULE_POINTS_HEIGHT 24 + +// 1156 +#define ANIM_BONUS_CAPSULE_SWITCH_WIDTH 24 +#define ANIM_BONUS_CAPSULE_SWITCH_HEIGHT 16 + +// 1160 +#define ANIM_BONUS_UI_SCORE_WIDTH 32 +#define ANIM_BONUS_UI_SCORE_HEIGHT 16 + +// Enemies +// 1166 +#define ANIM_SPINNER_WIDTH 48 +#define ANIM_SPINNER_HEIGHT 32 + +// 1168 +#define ANIM_CONDOR_WIDTH 48 +#define ANIM_CONDOR_HEIGHT 40 + +// 1168 +#define ANIM_AKATENTO_WIDTH 32 +#define ANIM_AKATENTO_HEIGHT 24 + +// 1169 +#define ANIM_AOTENTO_WIDTH 32 +#define ANIM_AOTENTO_HEIGHT 32 + +// 1171 +#define ANIM_APE_WIDTH 40 +#define ANIM_APE_HEIGHT 32 +#define ANIM_APE_VAR2_WIDTH 16 +#define ANIM_APE_VAR2_HEIGHT 16 + +// 1172 +#define ANIM_APE_PROJ_WIDTH 16 +#define ANIM_APE_PROJ_HEIGHT 16 + +// 1173 +#define ANIM_FROG_WIDTH 32 +#define ANIM_FROG_HEIGHT 48 + +// 1174 +#define ANIM_MINIMOLE_WIDTH 48 +#define ANIM_MINIMOLE_HEIGHT 24 +#define ANIM_MINIMOLE_VAR0_WIDTH 48 +#define ANIM_MINIMOLE_VAR0_HEIGHT 24 +#define ANIM_MINIMOLE_VAR1_WIDTH 32 +#define ANIM_MINIMOLE_VAR1_HEIGHT 8 + +// 1175 +#define ANIM_BUZZER_WIDTH 48 +#define ANIM_BUZZER_HEIGHT 32 + +// 1176 +#define ANIM_BUZZER_PROJ_WIDTH 16 +#define ANIM_BUZZER_PROJ_HEIGHT 16 + +// 1178 +#define ANIM_TAKKON_WIDTH 32 +#define ANIM_TAKKON_HEIGHT 48 + +// 1177 +#define ANIM_JOUSUN_WIDTH 40 +#define ANIM_JOUSUN_HEIGHT 32 + +// 1180 +#define ANIM_TAKKON_PROJ_WIDTH 24 +#define ANIM_TAKKON_PROJ_HEIGHT 24 +#define ANIM_TAKKON_PROJ_VAR0_WIDTH 8 +#define ANIM_TAKKON_PROJ_VAR0_HEIGHT 24 +#define ANIM_TAKKON_PROJ_VAR4_WIDTH 24 +#define ANIM_TAKKON_PROJ_VAR4_HEIGHT 24 + +// 1182 +#define ANIM_GAOGAO_WIDTH 32 +#define ANIM_GAOGAO_HEIGHT 32 + +// 1187 +#define ANIM_GINPE_WIDTH 24 +#define ANIM_GINPE_HEIGHT 32 + +// 1187 +#define ANIM_GINPE_PROJ_WIDTH 8 +#define ANIM_GINPE_PROJ_HEIGHT 8 + +// 1191 +#define ANIM_YADOKK_WIDTH 32 +#define ANIM_YADOKK_HEIGHT 32 +#define ANIM_YADOKK_VAR2_WIDTH 32 +#define ANIM_YADOKK_VAR2_HEIGHT 32 + +// 1315 +#define ANIM_ITEM_BOX_TYPE_WIDTH 16 +#define ANIM_ITEM_BOX_TYPE_HEIGHT 16 + +// 1316 +#define ANIM_ITEM_BOX_WIDTH 32 +#define ANIM_ITEM_BOX_HEIGHT 32 + +// 1338 +#define ANIM_ITEM_BOX_CLOUD_EFFECT_WIDTH 32 +#define ANIM_ITEM_BOX_CLOUD_EFFECT_HEIGHT 32 + +// 1139 +#define ANIM_CONDOR_PROJ_EXPLOSION_WIDTH 32 +#define ANIM_CONDOR_PROJ_EXPLOSION_HEIGHT 32 + +// 1344 +#define ANIM_ICE_SHIVER_WIDTH 16 +#define ANIM_ICE_SHIVER_HEIGHT 16 + +// 1348 +#define ANIM_SPECIAL_KEY_WIDTH 32 +#define ANIM_SPECIAL_KEY_HEIGHT 32 + +// 1423 +#define ANIM_LIFE_ICONS_WIDTH 16 +#define ANIM_LIFE_ICONS_HEIGHT 16 +#define ANIM_LIFE_ICONS_VAR0_WIDTH 16 +#define ANIM_LIFE_ICONS_VAR0_HEIGHT 16 +#define ANIM_LIFE_ICONS_VAR1_WIDTH 16 +#define ANIM_LIFE_ICONS_VAR1_HEIGHT 16 +#define ANIM_LIFE_ICONS_VAR2_WIDTH 16 +#define ANIM_LIFE_ICONS_VAR2_HEIGHT 16 +#define ANIM_LIFE_ICONS_VAR3_WIDTH 16 +#define ANIM_LIFE_ICONS_VAR3_HEIGHT 16 +#define ANIM_LIFE_ICONS_VAR4_WIDTH 16 +#define ANIM_LIFE_ICONS_VAR4_HEIGHT 16 +#define ANIM_LIFE_ICONS_VAR5_WIDTH 16 +#define ANIM_LIFE_ICONS_VAR5_HEIGHT 16 +#define ANIM_LIFE_ICONS_VAR6_WIDTH 16 +#define ANIM_LIFE_ICONS_VAR6_HEIGHT 16 +#endif + +#endif // GUARD_ANIM_SIZES_H diff --git a/include/constants/animations.h b/include/constants/animations.h index b3cd8e63c..4abd6fc72 100644 --- a/include/constants/animations.h +++ b/include/constants/animations.h @@ -74,7 +74,7 @@ #define SA2_CHAR_ANIM_52 52 #define SA2_CHAR_ANIM_53 53 #define SA2_CHAR_ANIM_54 54 -#define SA2_CHAR_ANIM_55 55 +#define SA2_CHAR_ANIM_GRINDING 55 #define SA2_CHAR_ANIM_56 56 #define SA2_CHAR_ANIM_57 57 #define SA2_CHAR_ANIM_IN_WHIRLWIND 58 diff --git a/include/constants/vram_hardcoded.h b/include/constants/vram_hardcoded.h new file mode 100644 index 000000000..5854370cd --- /dev/null +++ b/include/constants/vram_hardcoded.h @@ -0,0 +1,14 @@ +#ifndef GUARD_VRAM_HARDCODED_H +#define GUARD_VRAM_HARDCODED_H + +#if (GAME == GAME_SA1) +#define VRAM_RESERVED_DUST_EFFECT_BRAKING ((void *)OBJ_VRAM0 + 0x2100) +#define VRAM_RESERVED_BUBBLES_SMALL (void *)(OBJ_VRAM0 + 0x2A20) +#define VRAM_RESERVED_BUBBLES_GROUP (void *)(OBJ_VRAM0 + 0x2AA0) +#elif (GAME == GAME_SA2) +#define VRAM_RESERVED_DUST_EFFECT_BRAKING ((void *)OBJ_VRAM0 + 0x2300) +#define VRAM_RESERVED_BUBBLES_SMALL (void *)(OBJ_VRAM0 + 0x2A40) +#define VRAM_RESERVED_BUBBLES_GROUP (void *)(OBJ_VRAM0 + 0x2AC0) +#endif + +#endif // GUARD_VRAM_HARDCODED_H diff --git a/include/game/entity.h b/include/game/entity.h index cb357bc55..1a58087f6 100644 --- a/include/game/entity.h +++ b/include/game/entity.h @@ -129,7 +129,7 @@ u32 sub_800DF38(Sprite *, s32, s32, Player *); #define ENEMY_UPDATE_POSITION_STATIC(_enemy, _sprite, _posX, _posY) ENEMY_UPDATE_POSITION_RAW(_enemy, _sprite, _posX, _posY, 0, 0) #define ENEMY_TURN_TO_PLAYER(_posX, s) \ - if (gPlayer.x < _posX) { \ + if (gPlayer.qWorldX < _posX) { \ SPRITE_FLAG_CLEAR(s, X_FLIP); \ } else { \ SPRITE_FLAG_SET(s, X_FLIP); \ diff --git a/include/game/sa1_sa2_shared/camera.h b/include/game/sa1_sa2_shared/camera.h index 3f03eea95..c251d4af3 100644 --- a/include/game/sa1_sa2_shared/camera.h +++ b/include/game/sa1_sa2_shared/camera.h @@ -4,6 +4,12 @@ #include "core.h" #include "tilemap.h" +#if (GAME == GAME_SA1) +typedef s16 CamCoord; +#else +typedef s32 CamCoord; +#endif + // TODO: Move TILE_WIDTH into "include/tilemap.h" #define TILE_WIDTH 8 #define CAM_REGION_WIDTH 256 @@ -18,9 +24,17 @@ typedef void (*BgUpdate)(s32, s32); #define CAM_MODE_SPECTATOR 4 +// NOTE: This was copy-pasted from SA2. +// There are type differences for members struct Camera { - /* 0x00 */ s32 x; - /* 0x04 */ s32 y; + /* 0x00|0x04 */ CamCoord x; + /* 0x02|0x04 */ CamCoord y; +#if (GAME == GAME_SA1) + u8 filler4[0x2C]; + /* 0x30 */ struct Task *movementTask; + /* 0x34 */ s16 shakeOffsetX; + /* 0x36 */ s16 shakeOffsetY; +#elif (GAME == GAME_SA2) /* 0x08 */ s32 unk8; /* 0x0C */ s32 unkC; /* 0x10 */ s32 unk10; @@ -54,11 +68,12 @@ struct Camera { /* 0x56 */ s16 unk56; /* 0x58 */ BgUpdate fnBgUpdate; /* 0x5C */ struct Task *movementTask; - /* 0x60 */ s16 unk60; - /* 0x62 */ s16 unk62; + /* 0x60 */ s16 shakeOffsetX; + /* 0x62 */ s16 shakeOffsetY; /* 0x64 */ s16 unk64; /* 0x66 */ u8 spectatorTarget; -}; /* size 0x80 */ +#endif +}; /* size 0x80(in SA2) */ extern struct Camera gCamera; diff --git a/include/game/sa1_sa2_shared/globals.h b/include/game/sa1_sa2_shared/globals.h index 990fb829e..40380d1c0 100644 --- a/include/game/sa1_sa2_shared/globals.h +++ b/include/game/sa1_sa2_shared/globals.h @@ -43,8 +43,8 @@ typedef struct { u8 unk3; u8 unk4; u8 unk5; - u16 unk6; -} UNK_30054A8; /* size: 8 */ + u16 fadeoutSpeed; +} MusicManagerState; /* size: 8 */ typedef struct { s32 squarePlayerDistance; @@ -82,7 +82,7 @@ extern u8 gMultiplayerLanguage; // If you encounter it being loaded as s16, please cast it. extern u16 gRingCount; -extern UNK_30054A8 gUnknown_030054A8; +extern MusicManagerState gMusicManagerState; // Time that is being used to score the player (or in Time Attack) extern u32 gCourseTime; @@ -181,6 +181,17 @@ extern struct InputCounters gNewInputCounters[32]; extern u8 gUnknown_030055D8; +#if (GAME == GAME_SA1) +#define LIVES_BOUND_CHECK(lives) (lives) +#else +#define LIVES_BOUND_CHECK(lives) \ + ({ \ + if ((lives) > 255) \ + (lives) = 255; \ + (lives); \ + }) +#endif + #define INCREMENT_SCORE_A(incVal) \ { \ s32 divResA, divResB; \ @@ -194,11 +205,7 @@ extern u8 gUnknown_030055D8; u16 lives = divResA - divResB; \ lives += gNumLives; \ \ - gNumLives = ({ \ - if (lives > 255) \ - lives = 255; \ - lives; \ - }); \ + gNumLives = LIVES_BOUND_CHECK(lives); \ } \ } @@ -222,7 +229,7 @@ extern u8 gUnknown_030055D8; gNumLives = lives; \ } \ \ - gUnknown_030054A8.unk3 = _unk3; \ + gMusicManagerState.unk3 = _unk3; \ } \ } @@ -230,7 +237,7 @@ extern u8 gUnknown_030055D8; #define INCREMENT_SCORE_C(incVal) \ INCREMENT_SCORE_A(incVal) \ - gUnknown_030054A8.unk1 = 48; + gMusicManagerState.unk1 = 48; #define INCREMENT_SCORE(incVal) \ { \ @@ -245,13 +252,9 @@ extern u8 gUnknown_030055D8; u16 lives = divResA - divResB; \ lives += gNumLives; \ \ - gNumLives = ({ \ - if (lives > 255) \ - lives = 255; \ - lives; \ - }); \ + gNumLives = LIVES_BOUND_CHECK(lives); \ \ - gUnknown_030054A8.unk3 = 16; \ + gMusicManagerState.unk3 = 16; \ } \ } @@ -268,13 +271,9 @@ extern u8 gUnknown_030055D8; if ((newLives != prevLives) && (gGameMode == GAME_MODE_SINGLE_PLAYER)) { \ u16 lives = gNumLives + 1; \ \ - gNumLives = ({ \ - if (lives > 255) \ - lives = 255; \ - lives; \ - }); \ + gNumLives = LIVES_BOUND_CHECK(lives); \ \ - gUnknown_030054A8.unk3 = 16; \ + gMusicManagerState.unk3 = 16; \ } \ } \ } @@ -293,13 +292,9 @@ extern u8 gUnknown_030055D8; if ((newLives != prevLives) && (gGameMode == GAME_MODE_SINGLE_PLAYER)) { \ u16 lives = gNumLives + 1; \ \ - gNumLives = ({ \ - if (lives > 255) \ - lives = 255; \ - lives; \ - }); \ + gNumLives = LIVES_BOUND_CHECK(lives); \ \ - gUnknown_030054A8.unk3 = 16; \ + gMusicManagerState.unk3 = 16; \ } \ } \ } diff --git a/include/game/sa1_sa2_shared/player.h b/include/game/sa1_sa2_shared/player.h index fc3e01a6e..d70fbe146 100644 --- a/include/game/sa1_sa2_shared/player.h +++ b/include/game/sa1_sa2_shared/player.h @@ -76,8 +76,8 @@ typedef struct Player_ { /* 0x00 */ PlayerCallback callback; /* 0x04 */ u16 unk4; - /* 0x08 */ s32 x; - /* 0x0C */ s32 y; + /* 0x08 */ s32 qWorldX; + /* 0x0C */ s32 qWorldY; /* 0x10 */ s16 speedAirX; // Q_8_8 /* 0x12 */ s16 speedAirY; // Q_8_8 diff --git a/include/game/special_stage/player.h b/include/game/special_stage/player.h index f3c29fa1c..3cb8ccbf9 100644 --- a/include/game/special_stage/player.h +++ b/include/game/special_stage/player.h @@ -22,8 +22,8 @@ struct SpecialStagePlayer { u8 unkA6; // x and y may be flipped - s32 x; - s32 y; + s32 q16WorldX; + s32 q16WorldY; s16 unkB0; s16 bearing; diff --git a/include/game/stage/game_2.h b/include/game/stage/grind_effect_2.h similarity index 100% rename from include/game/stage/game_2.h rename to include/game/stage/grind_effect_2.h diff --git a/include/game/water_effects.h b/include/game/water_effects.h index bd834d725..5bea7c88f 100644 --- a/include/game/water_effects.h +++ b/include/game/water_effects.h @@ -8,12 +8,15 @@ typedef struct { u16 pal[32][16]; } WaterData; -// Seems to be belonging to water effect typedef struct { +#if (GAME == GAME_SA1) + /* 0x00*/ u8 filler0[2]; +#elif (GAME == GAME_SA2) /* 0x00 */ bool8 isActive; /* 0x01 */ u8 unk1; /* 0x02 */ u8 unk2; /* 0x03 */ u8 unk3; +#endif /* 0x04 */ s16 currentWaterLevel; /* 0x06 */ s16 targetWaterLevel; /* 0x08 */ u32 unk8; diff --git a/include/sprite.h b/include/sprite.h index cfe911189..823d0231e 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -197,10 +197,8 @@ typedef struct { typedef struct { /* 0x00 */ u16 rotation; - - // TODO: Rename to SA1/SA3 version! (width / height -> scaleX / scaleY) - /* 0x02 */ s16 width; - /* 0x04 */ s16 height; + /* 0x02 */ s16 qScaleX; + /* 0x04 */ s16 qScaleY; /* 0x06 */ s16 x; /* 0x08 */ s16 y; } SpriteTransform; /* size 0xA */ diff --git a/ldscript.txt b/ldscript.txt index 5263fc6e8..d37a4ee4a 100644 --- a/ldscript.txt +++ b/ldscript.txt @@ -173,7 +173,7 @@ SECTIONS src/game/stage/background/zone_extra_boss.o(.text); src/game/stage/background/callbacks.o(.text); src/game/stage/collision.o(.text); - src/game/stage/game_2.o(.text); + src/game/stage/grind_effect_2.o(.text); src/game/stage/dust_effect_braking.o(.text); src/game/stage/dust_effect_spindash.o(.text); src/game/stage/grind_effect_1.o(.text); @@ -454,7 +454,7 @@ SECTIONS src/game/stage/background/zone_final.o(.rodata); src/game/stage/tilemap_table.o(.rodata); src/game/stage/collision.o(.rodata); - src/game/stage/game_2.o(.rodata); + src/game/stage/grind_effect_2.o(.rodata); src/game/stage/spawn_positions.o(.rodata); src/game/stage/rings_scatter.o(.rodata); src/game/stage/player.o(.rodata); diff --git a/src/game/amy_attack_heart_effect.c b/src/game/amy_attack_heart_effect.c index e06873e94..219780f8c 100644 --- a/src/game/amy_attack_heart_effect.c +++ b/src/game/amy_attack_heart_effect.c @@ -239,8 +239,8 @@ void sub_8015E28(u16 p0) if (i < ARRAY_COUNT(hearts->params)) { Sprite *s = &hearts->sprHearts[i]; hearts->params[i].count = 0xFF; - hearts->params[i].x = gPlayer.x; - hearts->params[i].y = gPlayer.y; + hearts->params[i].x = gPlayer.qWorldX; + hearts->params[i].y = gPlayer.qWorldY; if (gPlayer.moveState & MOVESTATE_FACING_LEFT) { hearts->params[i].x -= sHeartOffsets[hearts->kind][p0][1] << 8; diff --git a/src/game/boost_effect.c b/src/game/boost_effect.c index e23d43421..af508825f 100644 --- a/src/game/boost_effect.c +++ b/src/game/boost_effect.c @@ -103,8 +103,8 @@ void sub_80156D0(void) void sub_8015750(void) { - s32 playerX = gPlayer.x; - s32 playerY = gPlayer.y; + s32 playerX = gPlayer.qWorldX; + s32 playerY = gPlayer.qWorldY; s16 i; for (i = 0; i < (s32)ARRAY_COUNT(sPlayerPosBuffer); i++) { @@ -121,8 +121,8 @@ void sub_8015790(void) INC_BE_INDEX(sPlayerPosBuffer); index = sPlayerPosBufferIndex; - sPlayerPosBuffer[index].x = gPlayer.x; - sPlayerPosBuffer[index].y = gPlayer.y; + sPlayerPosBuffer[index].x = gPlayer.qWorldX; + sPlayerPosBuffer[index].y = gPlayer.qWorldY; } void GetPreviousPlayerPos(Vec2_32 *pos, u8 pastFrameDelta) @@ -210,7 +210,7 @@ void CreateBoostEffectTasks(void) s->x = 0; s->y = 0; - actions->transform.height = +Q(1); + actions->transform.qScaleY = +Q(1); } if (s->palId != 0) { @@ -269,15 +269,15 @@ void Task_80159C8(void) s->frameFlags |= (gUnknown_030054B8++) | SPRITE_FLAG_MASK_ROT_SCALE_ENABLE; if (actions->plState.moveState & MOVESTATE_FACING_LEFT) { - transform->width = +Q(1); + transform->qScaleX = +Q(1); } else { - transform->width = -Q(1); + transform->qScaleX = -Q(1); } actions->plState.moveState &= MOVESTATE_80000000; if (actions->plState.moveState) { - transform->width = -transform->width; + transform->qScaleX = -transform->qScaleX; } TransformSprite(s, transform); diff --git a/src/game/boost_mode_particles.c b/src/game/boost_mode_particles.c index 6ac52e7ea..b0e2f7f38 100644 --- a/src/game/boost_mode_particles.c +++ b/src/game/boost_mode_particles.c @@ -57,7 +57,7 @@ void CreateBoostModeParticles(void) s->animSpeed = SPRITE_ANIM_SPEED(1.0); s->palId = 0; - SeedRng(gPlayer.x, gCamera.x); + SeedRng(gPlayer.qWorldX, gCamera.x); for (i = 0; i < 16; i++) { u8 temp1; @@ -116,14 +116,14 @@ void sub_8089E54(void) particles->unkA2[i][0] = (particles->unkA2[i][0] * 200) >> 8; particles->unkA2[i][1] = (particles->unkA2[i][1] * 200) >> 8; s = &particles->unk0; - s->x = I(gPlayer.x) - gCamera.x + (particles->unk62[i][0] >> 8); - s->y = I(gPlayer.y) - gCamera.y + (particles->unk62[i][1] >> 8); + s->x = I(gPlayer.qWorldX) - gCamera.x + (particles->unk62[i][0] >> 8); + s->y = I(gPlayer.qWorldY) - gCamera.y + (particles->unk62[i][1] >> 8); DisplaySprite(s); } if (particles->unk60++ > 8) { s->variant = 1; - SeedRng(gPlayer.x, gCamera.x); + SeedRng(gPlayer.qWorldX, gCamera.x); for (i = 0; i < 16; i++) { u8 temp; @@ -178,13 +178,13 @@ void sub_808A0A4(void) for (i = 0; i < 8; i++) { s = &particles->unk0; if (particles->unk60 & 1) { - s->x = (I(gPlayer.x) - gCamera.x) + (particles->unk62[i][0] >> 8); - s->y = (I(gPlayer.y) - gCamera.y) + (particles->unk62[i][1] >> 8); + s->x = (I(gPlayer.qWorldX) - gCamera.x) + (particles->unk62[i][0] >> 8); + s->y = (I(gPlayer.qWorldY) - gCamera.y) + (particles->unk62[i][1] >> 8); UpdateSpriteAnimation(s); } else { - s->x = (I(gPlayer.x) - gCamera.x) + (particles->unk62[i + 8][0] >> 8); - s->y = (I(gPlayer.y) - gCamera.y) + (particles->unk62[i + 8][1] >> 8); + s->x = (I(gPlayer.qWorldX) - gCamera.x) + (particles->unk62[i + 8][0] >> 8); + s->y = (I(gPlayer.qWorldY) - gCamera.y) + (particles->unk62[i + 8][1] >> 8); } DisplaySprite(s); } diff --git a/src/game/bosses/boss_1.c b/src/game/bosses/boss_1.c index 7f46ae8fc..026030752 100644 --- a/src/game/bosses/boss_1.c +++ b/src/game/bosses/boss_1.c @@ -363,8 +363,8 @@ static void sub_803A8E4(EggHammerTankII *boss) r0 = ((boss->unk54[0][5] * SIN(boss->unk54[1][5] & (SIN_PERIOD - 1)) >> 0x17)); pos.y = r2 + r0; - pos.x -= I(gPlayer.x); - pos.y -= I(gPlayer.y); + pos.x -= I(gPlayer.qWorldX); + pos.y -= I(gPlayer.qWorldY); if ((SQUARE(pos.x) + SQUARE(pos.y)) < 0x1A4) { sub_803CBFC(boss); sub_800CBA4(&gPlayer); @@ -432,11 +432,11 @@ static void sub_803AA40(void) if (IS_FINAL_STAGE(gCurrentLevel) && (boss->unkA8 == 0x22)) { s32 x, y; - x = gUnknown_080D6DE4[0][0] - I(gPlayer.x); - y = gUnknown_080D6DE4[0][1] - I(gPlayer.y); + x = gUnknown_080D6DE4[0][0] - I(gPlayer.qWorldX); + y = gUnknown_080D6DE4[0][1] - I(gPlayer.qWorldY); - gPlayer.x += QS(x); - gPlayer.y += QS(y); + gPlayer.qWorldX += QS(x); + gPlayer.qWorldY += QS(y); gCamera.x += x; gCamera.y += y; @@ -578,8 +578,8 @@ static void sub_803AC2C(EggHammerTankII *boss) transform->rotation += 10; } - transform->width = 256; - transform->height = 256; + transform->qScaleX = 256; + transform->qScaleY = 256; transform->x = s->x; transform->y = s->y; UpdateSpriteAnimation(s); @@ -868,7 +868,7 @@ static void sub_803B6AC(EggHammerTankII *boss) } if (!IS_FINAL_STAGE(gCurrentLevel) && boss->unkB0 == 4) { - gUnknown_030054A8.unk1 = 17; + gMusicManagerState.unk1 = 17; } } @@ -1391,8 +1391,8 @@ static void sub_803C198(EggHammerTankII *boss) unkB4->unkE4 = 2; } else { transform->rotation = unkB4->unk2D8; - transform->width = 256; - transform->height = 256; + transform->qScaleX = 256; + transform->qScaleY = 256; transform->x = s->x; transform->y = s->y; TransformSprite(s, transform); diff --git a/src/game/bosses/boss_2.c b/src/game/bosses/boss_2.c index e477d2b3b..025cd7a81 100644 --- a/src/game/bosses/boss_2.c +++ b/src/game/bosses/boss_2.c @@ -303,7 +303,7 @@ static void Task_BomberTankCannonReload(void) INCREMENT_SCORE_B(500); if (!IS_FINAL_STAGE(gCurrentLevel)) { - gUnknown_030054A8.unk1 = 0x11; + gMusicManagerState.unk1 = 0x11; } } @@ -436,8 +436,8 @@ static u8 RenderEggBomberTank(EggBomberTank *boss) s->frameFlags = gUnknown_030054B8++ | 0x2060; transform->rotation = boss->cannonAngle; - transform->width = 0x100; - transform->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); transform->x = s->x; transform->y = s->y; @@ -686,8 +686,8 @@ static bool8 RenderCannon(EggBomberTank *boss) s->frameFlags = gUnknown_030054B8++ | 0x2060; transform->rotation = boss->cannonAngle; - transform->width = 0x100; - transform->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); transform->x = s->x; transform->y = s->y; UpdateSpriteAnimation(s); @@ -726,7 +726,7 @@ static void HandleCannonBombTrigger(EggBomberTank *boss) INCREMENT_SCORE_B(500); if (!IS_FINAL_STAGE(gCurrentLevel)) { - gUnknown_030054A8.unk1 = 0x11; + gMusicManagerState.unk1 = 0x11; } } else { if (boss->timer == 0) { @@ -761,13 +761,13 @@ static bool8 HandleCannonCollision(EggBomberTank *boss) dX = QS(Div(boss->qWorldX, 256) - 8); x = dX + ((COS(boss->cannonAngle) * 5) >> 3); - dX = x - gPlayer.x; + dX = x - gPlayer.qWorldX; dX = I(dX); dY = QS(Div(boss->qWorldY, 256) - 22); y = dY + ((SIN(boss->cannonAngle) * 5) >> 3); - dY = y - gPlayer.y; + dY = y - gPlayer.qWorldY; dY = I(dY); distance = (SQUARE(dY) + SQUARE(dX)); diff --git a/src/game/bosses/boss_3.c b/src/game/bosses/boss_3.c index 2c3e18152..26ade3078 100644 --- a/src/game/bosses/boss_3.c +++ b/src/game/bosses/boss_3.c @@ -1230,7 +1230,7 @@ void sub_80408C4(EggTotem *totem) if (ptr->unk0 == 60 && ptr->unk2 == 0 && ptr->unk4 == 0) { if ((u16)t3c->unkE == 60) { - if (gPlayer.y < t3c->qWorldY) { + if (gPlayer.qWorldY < t3c->qWorldY) { t3c->unk15 = 1; } else { t3c->unk15 = 0; @@ -1312,8 +1312,8 @@ void sub_8040A00(EggTotem *totem) coll = sub_800CCB8(s, x, y, p); if ((p->moveState & MOVESTATE_8) && (coll & COLL_FLAG_10000)) { - p->x += t3c->qUnk8 + Q(5); - p->y += Q(2) + (s16)Q(coll); + p->qWorldX += t3c->qUnk8 + Q(5); + p->qWorldY += Q(2) + (s16)Q(coll); if (!r7) { p->speedAirX -= Q(5); @@ -1397,7 +1397,7 @@ bool32 sub_8040B30(EggTotem *totem, u8 i) lives; }); - gUnknown_030054A8.unk3 = 16; + gMusicManagerState.unk3 = 16; } } #else @@ -1452,7 +1452,7 @@ bool32 sub_8040B30(EggTotem *totem, u8 i) lives; }); - gUnknown_030054A8.unk3 = 16; + gMusicManagerState.unk3 = 16; } } #else @@ -1505,7 +1505,7 @@ void sub_8040D74(EggTotem *totem) } if (!IS_FINAL_STAGE(gCurrentLevel) && (totem->lives == 4)) { - gUnknown_030054A8.unk1 = 17; + gMusicManagerState.unk1 = 17; } } } @@ -1705,7 +1705,7 @@ void CreateEggTotemBullet(EggTotem *totem, s32 qX, s32 qY, u16 qSpeed) bullet->qScreenX = qX - Q(gCamera.x); bullet->qScreenY = qY - Q(gCamera.y); - sinIndex = sub_8004418(I(gPlayer.y) - I(qY), I(gPlayer.x) - I(qX)); + sinIndex = sub_8004418(I(gPlayer.qWorldY) - I(qY), I(gPlayer.qWorldX) - I(qX)); bullet->qDX = ((COS(sinIndex) * qSpeed) >> 14); bullet->qDX += BOSS_VELOCITY_X; bullet->qDY = ((SIN(sinIndex) * qSpeed) >> 14); diff --git a/src/game/bosses/boss_4.c b/src/game/bosses/boss_4.c index d9548d090..9b240774c 100644 --- a/src/game/bosses/boss_4.c +++ b/src/game/bosses/boss_4.c @@ -399,7 +399,7 @@ static void sub_8041B44(AeroEgg *boss) if (PLAYER_IS_ALIVE) { if (sub_800C320(s, worldX, worldY, 0, &gPlayer) == 1) { - if (I(gPlayer.y) > worldY) { + if (I(gPlayer.qWorldY) > worldY) { sub_8042774(boss); sub_800CBA4(&gPlayer); } else { @@ -728,7 +728,7 @@ static bool32 sub_80423EC(AeroEgg *boss) if (gCurrentLevel != LEVEL_INDEX(ZONE_FINAL, ACT_XX_FINAL_ZONE)) { if (boss->main.lives == 4) { - gUnknown_030054A8.unk1 = 0x11; + gMusicManagerState.unk1 = 0x11; } } diff --git a/src/game/bosses/boss_5.c b/src/game/bosses/boss_5.c index ae047b19f..dec1727a3 100644 --- a/src/game/bosses/boss_5.c +++ b/src/game/bosses/boss_5.c @@ -594,8 +594,8 @@ void sub_80438C4(EggSaucer *boss) s->frameFlags = gUnknown_030054B8++ | 0x1060; transform->rotation = boss->unk1A; - transform->width = 0x100; - transform->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); transform->x = s->x; transform->y = s->y; UpdateSpriteAnimation(s); @@ -768,8 +768,8 @@ void sub_8043E2C(EggSaucer *boss) s->frameFlags = gUnknown_030054B8++ | 0x1060; transform->rotation = boss->unk1A; - transform->width = 256; - transform->height = 256; + transform->qScaleX = 256; + transform->qScaleY = 256; transform->x = s->x; transform->y = s->y; TransformSprite(s, transform); @@ -1117,12 +1117,12 @@ void sub_8044784(EggSaucer *boss) UpdateScreenFade(fade); - y = I(gPlayer.y); + y = I(gPlayer.qWorldY); y += 0x13; y -= (I(boss->y) + ((SIN(boss->gunDiskAngle) * 5) >> 11)); x = ({ s32 temp3; - x = (I(gPlayer.x)); + x = (I(gPlayer.qWorldX)); temp3 = x + 2; temp3 - (I(boss->x) + ((COS(boss->gunDiskAngle) * 5) >> 11)); }); @@ -1283,8 +1283,8 @@ static void sub_8044CBC(EggSaucer *boss) x += 2; y -= 0x11; - x = I(gPlayer.x) - x; - y = I(gPlayer.y) - y; + x = I(gPlayer.qWorldX) - x; + y = I(gPlayer.qWorldY) - y; boss->unk32 = sub_8004418(y, x); } @@ -1435,8 +1435,8 @@ static void sub_8044FE4(EggSaucer *boss) x += 2; y -= 0x11; - x = I(gPlayer.x) - x; - y = I(gPlayer.y) - y; + x = I(gPlayer.qWorldX) - x; + y = I(gPlayer.qWorldY) - y; boss->unk32 = sub_8004418(y, x); } @@ -1617,7 +1617,7 @@ void sub_8045368(EggSaucer *boss) s->prevVariant = -1; if (gCurrentLevel != LEVEL_INDEX(ZONE_FINAL, ACT_XX_FINAL_ZONE) && boss->health == 4) { - gUnknown_030054A8.unk1 = 0x11; + gMusicManagerState.unk1 = 0x11; } } diff --git a/src/game/bosses/boss_6.c b/src/game/bosses/boss_6.c index 94ccc063a..a48531948 100644 --- a/src/game/bosses/boss_6.c +++ b/src/game/bosses/boss_6.c @@ -348,7 +348,7 @@ static void sub_8045E78(EggGoRound *boss) if (Mod(boss->unk22, 30) == 0) { u8 i; - u16 targetAngle = sub_8004418(I(gPlayer.y - boss->y), I(gPlayer.x - boss->x)); + u16 targetAngle = sub_8004418(I(gPlayer.qWorldY - boss->y), I(gPlayer.qWorldX - boss->x)); for (i = 0; i < NUM_PROJECTILES; i++) { ProjectilePosition *projPos = &boss->projectilePositions[i]; @@ -566,8 +566,8 @@ static void Render(EggGoRound *boss) if (boss->unk1E != 0 && boss->unk24 == 0 && (i % 2) && (boss->state == 1 || boss->state == 2)) { SpriteTransform *transform = &boss->platforms[i].transform; transform->rotation = I(boss->platformRotation); - transform->width = 0x100; - transform->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); transform->x = s->x; transform->y = s->y; @@ -637,8 +637,8 @@ static void sub_804655C(EggGoRound *boss, u8 val) if (boss->unk1E != 0 && boss->unk24 == 0 && (i % 2) && (boss->state == 1 || boss->state == 2)) { SpriteTransform *transform = &boss->platforms[i].transform; transform->rotation = I(boss->platformRotation); - transform->width = 0x100; - transform->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); transform->x = s->x; transform->y = s->y; @@ -853,9 +853,9 @@ static void sub_8046C28(EggGoRound *boss) return; } - gPlayer.y += Q(2) + Q_8_8(val); + gPlayer.qWorldY += Q(2) + Q_8_8(val); if (boss->prevPlatformXPositions[i] != 0) { - gPlayer.x += Q(x - (boss->prevPlatformXPositions[i])); + gPlayer.qWorldX += Q(x - (boss->prevPlatformXPositions[i])); } } else if (someBool) { gPlayer.moveState &= ~MOVESTATE_8; @@ -1120,7 +1120,7 @@ bool32 HandleHit(EggGoRound *boss) } if (!IS_FINAL_STAGE(gCurrentLevel) && boss->health == 4) { - gUnknown_030054A8.unk1 = 0x11; + gMusicManagerState.unk1 = 0x11; } return result; @@ -1185,9 +1185,9 @@ static void HandleCollisions(EggGoRound *boss) Player_UpdateHomingPosition(boss->x, boss->y); if (sub_800C320(s, x, y, 1, &gPlayer) != 0) { - if (gPlayer.x > boss->x) { + if (gPlayer.qWorldX > boss->x) { gPlayer.speedAirX += Q(2.25); - gPlayer.x += Q(2); + gPlayer.qWorldX += Q(2); } gPlayer.speedAirY += Q(2); diff --git a/src/game/bosses/boss_7.c b/src/game/bosses/boss_7.c index 6425336d7..c9cc05dda 100644 --- a/src/game/bosses/boss_7.c +++ b/src/game/bosses/boss_7.c @@ -935,7 +935,7 @@ static void sub_8048D78(EggFrog *boss) s->prevVariant = -1; if (!IS_FINAL_STAGE(gCurrentLevel) && boss->unk14 == 4) { - gUnknown_030054A8.unk1 = 0x11; + gMusicManagerState.unk1 = 0x11; } } diff --git a/src/game/bosses/boss_8.c b/src/game/bosses/boss_8.c index f9de1658d..72e4a35ad 100644 --- a/src/game/bosses/boss_8.c +++ b/src/game/bosses/boss_8.c @@ -209,10 +209,10 @@ void CreateBossRunManager(u8 bossIndex) gPlayer.speedGroundX = Q(5); // ??? - x = gUnknown_080D87E6[bossIndex - 1][0] - I(gPlayer.x); - y = gUnknown_080D87E6[bossIndex][1] - I(gPlayer.y); - gPlayer.x += Q(x); - gPlayer.y += Q(y); + x = gUnknown_080D87E6[bossIndex - 1][0] - I(gPlayer.qWorldX); + y = gUnknown_080D87E6[bossIndex][1] - I(gPlayer.qWorldY); + gPlayer.qWorldX += Q(x); + gPlayer.qWorldY += Q(y); gCamera.x += x - 120; gCamera.y += y - 120; @@ -248,14 +248,14 @@ static void Task_BossRunManagerMain(void) if (manager->bossIndex == 6) { gBossCameraClampYLower = gBossCameraYClamps[7][0]; gBossCameraClampYUpper = gBossCameraYClamps[7][1]; - if (gPlayer.x < Q(42960) && gPlayer.x > Q(gUnknown_080D8808[6][0] + 30)) { + if (gPlayer.qWorldX < Q(42960) && gPlayer.qWorldX > Q(gUnknown_080D8808[6][0] + 30)) { gPlayer.moveState |= MOVESTATE_IGNORE_INPUT; gPlayer.speedGroundX = Q(5); gPlayer.frameInput = 0; gPlayer.heldInput = 0; gPlayer.rotation = 0; - if (I(gPlayer.x) - 120 != gCamera.x) { - if (I(gPlayer.x) - 120 > gCamera.x) { + if (I(gPlayer.qWorldX) - 120 != gCamera.x) { + if (I(gPlayer.qWorldX) - 120 > gCamera.x) { gCamera.unk20++; gCamera.x++; gCamera.unk10++; @@ -265,14 +265,14 @@ static void Task_BossRunManagerMain(void) gCamera.unk10--; } } - } else if (gPlayer.x < Q(42700) && gPlayer.x > Q(gUnknown_080D8808[6][0] + 20)) { + } else if (gPlayer.qWorldX < Q(42700) && gPlayer.qWorldX > Q(gUnknown_080D8808[6][0] + 20)) { if (gActiveBossTask == NULL && !(gStageFlags & STAGE_FLAG__100)) { gPlayer.checkpointTime = gCourseTime; CreateZoneBoss(7); gStageFlags &= ~STAGE_FLAG__2; } } else { - r5 = gPlayer.x; + r5 = gPlayer.qWorldX; if (r5 > Q(42960)) { gPlayer.moveState &= ~MOVESTATE_GOAL_REACHED; gPlayer.speedGroundX = 0; @@ -287,7 +287,7 @@ static void Task_BossRunManagerMain(void) r4 = gUnknown_080D8808[manager->bossIndex][1]; r6 = Q(r4); r0 = r5 + r6; - gPlayer.x = r0; + gPlayer.qWorldX = r0; gUnknown_030054FC = r6; sub_8039F50(r6, manager->bossIndex); gBossRingsShallRespawn = 1; @@ -311,10 +311,10 @@ static void Task_BossRunManagerMain(void) } if (gUnknown_080D8808[manager->bossIndex][0] >= 0 && gActiveBossTask != NULL - && gPlayer.x >= Q(gUnknown_080D8808[manager->bossIndex][0])) { + && gPlayer.qWorldX >= Q(gUnknown_080D8808[manager->bossIndex][0])) { r4 = gUnknown_080D8808[manager->bossIndex][1]; r5 = Q(r4); - gPlayer.x += r5; + gPlayer.qWorldX += r5; gUnknown_030054FC = r5; sub_8039F50(r5, manager->bossIndex); gBossRingsShallRespawn = 1; @@ -410,7 +410,7 @@ static void Task_SuperEggRoboZTowersMain(void) sTowerStateCallbacks[towers->unk15A[i]](towers, i); } - if (I(gPlayer.y) < 133) { + if (I(gPlayer.qWorldY) < 133) { sub_800CBA4(&gPlayer); } @@ -453,10 +453,10 @@ static void sub_8049F1C(SuperEggRoboZTowers *towers, u8 towerIndex) } if (gPlayer.moveState & MOVESTATE_8 && gPlayer.unk3C == prop) { - gPlayer.y += Q(1); - gPlayer.y += preY; + gPlayer.qWorldY += Q(1); + gPlayer.qWorldY += preY; if (towers->unk15E == 1) { - gPlayer.x += Q(1); + gPlayer.qWorldX += Q(1); } } @@ -464,7 +464,7 @@ static void sub_8049F1C(SuperEggRoboZTowers *towers, u8 towerIndex) u32 result = sub_800CCB8(prop, pos.x, pos.y, &gPlayer); if (result & 0x10000) { - gPlayer.y += Q(result << 0x10) >> 0x10; + gPlayer.qWorldY += Q(result << 0x10) >> 0x10; } } @@ -495,7 +495,7 @@ static void sub_804A070(SuperEggRoboZTowers *towers, u8 towerIndex) if (!(gPlayer.moveState & MOVESTATE_400000)) { s32 result = sub_800C204(s, pos.x, pos.y, 0, &gPlayer, 0); if (result != 0) { - gPlayer.y -= Q(8); + gPlayer.qWorldY -= Q(8); gPlayer.speedAirY = -Q(3.5); gPlayer.charState = CHARSTATE_HIT_AIR; gPlayer.transition = PLTRANS_PT6; @@ -568,10 +568,10 @@ static void sub_804A1C0(SuperEggRoboZTowers *towers, u8 towerIndex) } if (gPlayer.moveState & MOVESTATE_8 && gPlayer.unk3C == s) { - gPlayer.y += preY + Q(1); + gPlayer.qWorldY += preY + Q(1); if (towers->unk15E == 1) { - gPlayer.x += Q(1); + gPlayer.qWorldX += Q(1); } } @@ -579,7 +579,7 @@ static void sub_804A1C0(SuperEggRoboZTowers *towers, u8 towerIndex) u32 result = sub_800CCB8(s, pos.x, pos.y, &gPlayer); if (result & 0x10000) { - gPlayer.y += Q(result << 0x10) >> 0x10; + gPlayer.qWorldY += Q(result << 0x10) >> 0x10; } } @@ -618,10 +618,10 @@ static void sub_804A398(SuperEggRoboZTowers *towers, u8 towerIndex) } if (gPlayer.moveState & MOVESTATE_8 && gPlayer.unk3C == s) { - gPlayer.y += preY + Q(1); + gPlayer.qWorldY += preY + Q(1); if (towers->unk15E == 1) { - gPlayer.x += Q(1); + gPlayer.qWorldX += Q(1); } } @@ -629,7 +629,7 @@ static void sub_804A398(SuperEggRoboZTowers *towers, u8 towerIndex) u32 result = sub_800CCB8(s, pos.x, pos.y, &gPlayer); if (result & 0x10000) { - gPlayer.y += Q(result << 0x10) >> 0x10; + gPlayer.qWorldY += Q(result << 0x10) >> 0x10; } } @@ -671,10 +671,10 @@ static void sub_804A53C(SuperEggRoboZTowers *towers, u8 towerIndex) } if (gPlayer.moveState & MOVESTATE_8 && gPlayer.unk3C == s) { - gPlayer.y += preY + Q(2); + gPlayer.qWorldY += preY + Q(2); if (towers->unk15E == 1) { - gPlayer.x += Q(1); + gPlayer.qWorldX += Q(1); } } @@ -682,7 +682,7 @@ static void sub_804A53C(SuperEggRoboZTowers *towers, u8 towerIndex) u32 result = sub_800CCB8(s, pos.x, pos.y, &gPlayer); if (result & 0x10000) { - gPlayer.y += Q(result << 0x10) >> 0x10; + gPlayer.qWorldY += Q(result << 0x10) >> 0x10; } } @@ -830,7 +830,7 @@ void CreateSuperEggRoboZ(void) s->palId = 0; s->hitboxes[0].index = -1; s->frameFlags = SPRITE_FLAG(PRIORITY, 3); - gUnknown_030054A8.unk6 = 200; + gMusicManagerState.fadeoutSpeed = 200; gStageFlags |= STAGE_FLAG__DISABLE_PAUSE_MENU; } @@ -876,8 +876,8 @@ static void Task_804A9D8(void) m4aSongNumStart(SE_260); - gUnknown_030054A8.unk0 = 0; - gUnknown_030054A8.unk1 = 18; + gMusicManagerState.unk0 = 0; + gMusicManagerState.unk1 = 18; gCamera.minX = 42820; boss->unkB = 0; gPlayer.moveState &= ~(MOVESTATE_IGNORE_INPUT); @@ -908,7 +908,7 @@ NONMATCH("asm/non_matching/game/bosses/boss_8__Task_804AB24.inc", static void Ta sub_804C830(boss); sub_804CA70(boss); - if ((I(gPlayer.y) > 184) && (I(gPlayer.x) >= 43034)) { + if ((I(gPlayer.qWorldY) > 184) && (I(gPlayer.qWorldX) >= 43034)) { sub_800CBA4(&gPlayer); speed = gPlayer.speedAirX; @@ -923,7 +923,7 @@ NONMATCH("asm/non_matching/game/bosses/boss_8__Task_804AB24.inc", static void Ta } // _0804ABC0 - if (I(gPlayer.x) >= 43088) { + if (I(gPlayer.qWorldX) >= 43088) { sub_800CBA4(&gPlayer); speed = gPlayer.speedAirX; @@ -1165,8 +1165,8 @@ static u8 sub_804B0EC(SuperEggRoboZ *boss, u8 arm) r3 = SIN(boss->rotation[arm]); r4 += (r3 * 190) >> 9; - r5 = (gPlayer.x - r5) >> 8; - r4 = (gPlayer.y - r4) >> 8; + r5 = (gPlayer.qWorldX - r5) >> 8; + r4 = (gPlayer.qWorldY - r4) >> 8; r5 = SQUARE(r5); r4 = SQUARE(r4); @@ -1198,8 +1198,8 @@ static u8 sub_804B0EC(SuperEggRoboZ *boss, u8 arm) } if (PLAYER_IS_ALIVE && HITBOX_IS_ACTIVE(s->hitboxes[1])) { - r5 = I(gPlayer.x - r6); - r4 = I(gPlayer.y - r7); + r5 = I(gPlayer.qWorldX - r6); + r4 = I(gPlayer.qWorldY - r7); r5 = SQUARE(r5); r4 = SQUARE(r4); @@ -1273,8 +1273,8 @@ NONMATCH("asm/non_matching/game/bosses/boss_8__sub_804B2EC.inc", static bool8 su } if (PLAYER_IS_ALIVE && HITBOX_IS_ACTIVE(s->hitboxes[1])) { - r5 = I(gPlayer.x - r6); - r4 = I(gPlayer.y - r7); + r5 = I(gPlayer.qWorldX - r6); + r4 = I(gPlayer.qWorldY - r7); r5 = SQUARE(r5); r4 = SQUARE(r4); @@ -1354,7 +1354,7 @@ static void sub_804B594(SuperEggRoboZ *boss, u8 arm) pos.x = boss->qPos.x + boss->qUnk18[arm].x + gUnknown_080D8888[arm][0]; pos.y = boss->qPos.y + boss->qUnk18[arm].y + gUnknown_080D8888[arm][1]; - angle = sub_8004418(I(gPlayer.y - pos.y), I(gPlayer.x - pos.x)); + angle = sub_8004418(I(gPlayer.qWorldY - pos.y), I(gPlayer.qWorldX - pos.x)); if (angle != boss->rotation[arm]) { if (angle < boss->rotation[arm]) { @@ -1750,8 +1750,8 @@ static void sub_804C3AC(SuperEggRoboZ *boss) = (gUnknown_030054B8++ | (SPRITE_FLAG(PRIORITY, 3) | SPRITE_FLAG_MASK_ROT_SCALE_ENABLE | SPRITE_FLAG_MASK_ROT_SCALE_DOUBLE_SIZE)); tf->rotation = boss->unk10; - tf->width = Q(1); - tf->height = Q(1); + tf->qScaleX = Q(1); + tf->qScaleY = Q(1); tf->x = s->x; tf->y = s->y; @@ -1773,8 +1773,8 @@ static void sub_804C3AC(SuperEggRoboZ *boss) | (SPRITE_FLAG(PRIORITY, 1) | SPRITE_FLAG_MASK_ROT_SCALE_ENABLE | SPRITE_FLAG_MASK_ROT_SCALE_DOUBLE_SIZE)); tf->rotation = boss->rotation[i]; - tf->width = Q(1); - tf->height = Q(1); + tf->qScaleX = Q(1); + tf->qScaleY = Q(1); tf->x = s->x; tf->y = s->y; @@ -1837,8 +1837,8 @@ static void sub_804C5B8(SuperEggRoboZ *boss) = (gUnknown_030054B8++ | (SPRITE_FLAG(PRIORITY, 3) | SPRITE_FLAG_MASK_ROT_SCALE_ENABLE | SPRITE_FLAG_MASK_ROT_SCALE_DOUBLE_SIZE)); tf->rotation = boss->unk10; - tf->width = Q(1); - tf->height = Q(1); + tf->qScaleX = Q(1); + tf->qScaleY = Q(1); tf->x = s->x; tf->y = s->y; @@ -1864,8 +1864,8 @@ static void sub_804C5B8(SuperEggRoboZ *boss) | (SPRITE_FLAG(PRIORITY, 1) | SPRITE_FLAG_MASK_ROT_SCALE_ENABLE | SPRITE_FLAG_MASK_ROT_SCALE_DOUBLE_SIZE)); tf->rotation = boss->rotation[i]; - tf->width = Q(1); - tf->height = Q(1); + tf->qScaleX = Q(1); + tf->qScaleY = Q(1); tf->x = s->x; tf->y = s->y; @@ -1930,7 +1930,7 @@ static void Boss8_HitCockpit(SuperEggRoboZ *boss) } if (boss->livesCockpit == 3) { - gUnknown_030054A8.unk1 = 19; + gMusicManagerState.unk1 = 19; } if (boss->livesCockpit == 0) { @@ -2065,7 +2065,7 @@ static void sub_804CCD0(SuperEggRoboZ *boss, s32 qP1) { Vec2_32 pos = { boss->qPos.x + Q(190), boss->qPos.y + Q(40) }; - if ((I(gPlayer.y) < pos.x) && (gPlayer.y >= (pos.y - qP1)) && (gPlayer.y <= (qP1 + pos.y))) { + if ((I(gPlayer.qWorldY) < pos.x) && (gPlayer.qWorldY >= (pos.y - qP1)) && (gPlayer.qWorldY <= (qP1 + pos.y))) { sub_800CBA4(&gPlayer); } } diff --git a/src/game/bosses/boss_9.c b/src/game/bosses/boss_9.c index 685cc7368..4fa35529a 100644 --- a/src/game/bosses/boss_9.c +++ b/src/game/bosses/boss_9.c @@ -2589,8 +2589,8 @@ void sub_80501D4(TA53Boss *boss) | (u8)gUnknown_030054B8++); transform->rotation = r7; - transform->width = 0x100; - transform->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); transform->x = s->x; transform->y = s->y; UpdateSpriteAnimation(s); @@ -2612,8 +2612,8 @@ void sub_80501D4(TA53Boss *boss) | (u8)gUnknown_030054B8++); transform->rotation = sinIndex; - transform->width = 0x100; - transform->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); transform->x = s->x; transform->y = s->y; UpdateSpriteAnimation(s); @@ -2711,8 +2711,8 @@ void sub_80505B8(TA53Boss *boss) | (u8)gUnknown_030054B8++); transform->rotation = r7; - transform->width = 0x100; - transform->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); transform->x = s->x; transform->y = s->y; UpdateSpriteAnimation(s); @@ -2734,8 +2734,8 @@ void sub_80505B8(TA53Boss *boss) | (u8)gUnknown_030054B8++); transform->rotation = sinIndex; - transform->width = 0x100; - transform->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); transform->x = s->x; transform->y = s->y; UpdateSpriteAnimation(s); diff --git a/src/game/character_select.c b/src/game/character_select.c index 37e320981..b9ca9b4c0 100644 --- a/src/game/character_select.c +++ b/src/game/character_select.c @@ -1098,7 +1098,7 @@ static void RenderTransitionInUIAnim(struct CharacterSelectionScreen *characterS u8 i; u16 x; Sprite *s; - SpriteTransform *transformOptions; + SpriteTransform *transform; if (characterScreen->amyUnlocked) { for (i = 0; i < 10; i++) { @@ -1127,22 +1127,22 @@ static void RenderTransitionInUIAnim(struct CharacterSelectionScreen *characterS } } s = &characterScreen->selectedCarouselBlob; - transformOptions = &characterScreen->selectedBlobTransform; + transform = &characterScreen->selectedBlobTransform; s->x = 101; s->y = 79; s->variant = characterScreen->selectedCharacter + SA2_ANIM_VARIANT_CHAR_SELECT_CIRCLE_ACTIVE; s->prevVariant = -1; - transformOptions->rotation = 0; - transformOptions->width = (gSineTable[(characterScreen->cursorAnimFrame * 0x10 + 0x100) & 0x3FF] >> 8) + 0xC0; - transformOptions->height = (gSineTable[(characterScreen->cursorAnimFrame * 0x10 + 0x100) & 0x3FF] >> 8) + 0xC0; - transformOptions->x = s->x; - transformOptions->y = s->y; + transform->rotation = 0; + transform->qScaleX = (gSineTable[(characterScreen->cursorAnimFrame * 0x10 + 0x100) & 0x3FF] >> 8) + 0xC0; + transform->qScaleY = (gSineTable[(characterScreen->cursorAnimFrame * 0x10 + 0x100) & 0x3FF] >> 8) + 0xC0; + transform->x = s->x; + transform->y = s->y; s->frameFlags = gUnknown_030054B8++ | 0x60; UpdateSpriteAnimation(s); - TransformSprite(s, transformOptions); + TransformSprite(s, transform); DisplaySprite(s); if (characterScreen->animFrame < 8) { @@ -1209,37 +1209,37 @@ static void RenderTransitionInUIAnim(struct CharacterSelectionScreen *characterS DisplaySprite(s); s = &characterScreen->characterTitleTextLeft; - transformOptions = &characterScreen->characterTitleLeftTransform; + transform = &characterScreen->characterTitleLeftTransform; s->x = 0x28; s->y = 0x4F; - transformOptions->rotation = 0; - transformOptions->width = 0x100; - transformOptions->height = 0x100 - ((0x10 - characterScreen->animFrame) * 0xF); - transformOptions->x = s->x; - transformOptions->y = s->y; + transform->rotation = 0; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1) - ((0x10 - characterScreen->animFrame) * 0xF); + transform->x = s->x; + transform->y = s->y; s->frameFlags = gUnknown_030054B8++ | 0x20; UpdateSpriteAnimation(s); - TransformSprite(s, transformOptions); + TransformSprite(s, transform); DisplaySprite(s); s = &characterScreen->characterTitleTextRight; - transformOptions = &characterScreen->characterTitleRightTransform; + transform = &characterScreen->characterTitleRightTransform; s->x = 0x28; s->y = 0x4F; - transformOptions->rotation = 0; - transformOptions->width = 0x100; - transformOptions->height = 0x100 - ((0x10 - characterScreen->animFrame) * 0xF); - transformOptions->x = s->x; - transformOptions->y = s->y; + transform->rotation = 0; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1) - ((0x10 - characterScreen->animFrame) * 0xF); + transform->x = s->x; + transform->y = s->y; s->frameFlags = gUnknown_030054B8++ | 0x20; UpdateSpriteAnimation(s); - TransformSprite(s, transformOptions); + TransformSprite(s, transform); DisplaySprite(s); s = &characterScreen->scrollUpArrow; @@ -1255,7 +1255,7 @@ static void RenderCarouselScrollAnim(struct CharacterSelectionScreen *characterS u8 i; s8 somethinga; Sprite *s; - SpriteTransform *transformOptions; + SpriteTransform *transform; s8 lang = gLoadedSaveGame->language - 1; @@ -1367,22 +1367,22 @@ static void RenderCarouselScrollAnim(struct CharacterSelectionScreen *characterS if (characterScreen->unk3C4 > 9) { s = &characterScreen->selectedCarouselBlob; - transformOptions = &characterScreen->selectedBlobTransform; + transform = &characterScreen->selectedBlobTransform; s->x = 0x65; s->y = 0x4F; s->variant = characterScreen->selectedCharacter + SA2_ANIM_VARIANT_CHAR_SELECT_CIRCLE_ACTIVE; s->prevVariant = -1; - transformOptions->rotation = 0; - transformOptions->width = (gSineTable[(characterScreen->cursorAnimFrame * 0x10 + 0x100) & 0x3FF] >> 8) + 0xC0; - transformOptions->height = (gSineTable[(characterScreen->cursorAnimFrame * 0x10 + 0x100) & 0x3FF] >> 8) + 0xC0; - transformOptions->x = s->x; - transformOptions->y = s->y; + transform->rotation = 0; + transform->qScaleX = (gSineTable[(characterScreen->cursorAnimFrame * 0x10 + 0x100) & 0x3FF] >> 8) + 0xC0; + transform->qScaleY = (gSineTable[(characterScreen->cursorAnimFrame * 0x10 + 0x100) & 0x3FF] >> 8) + 0xC0; + transform->x = s->x; + transform->y = s->y; s->frameFlags = gUnknown_030054B8++ | 0x60; UpdateSpriteAnimation(s); - TransformSprite(s, transformOptions); + TransformSprite(s, transform); DisplaySprite(s); } @@ -1451,20 +1451,20 @@ static void RenderCarouselScrollAnim(struct CharacterSelectionScreen *characterS DisplaySprite(s); s = &characterScreen->characterTitleTextLeft; - transformOptions = &characterScreen->characterTitleLeftTransform; + transform = &characterScreen->characterTitleLeftTransform; s->x = 40; s->y = 79; if (c < 8) { - transformOptions->rotation = 0; - transformOptions->width = 0x100; - transformOptions->height = 0x100 - ((8 - c) * 0x1E); - transformOptions->x = s->x; - transformOptions->y = s->y; + transform->rotation = 0; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1) - ((8 - c) * 0x1E); + transform->x = s->x; + transform->y = s->y; s->frameFlags = gUnknown_030054B8++ | 0x20; UpdateSpriteAnimation(s); - TransformSprite(s, transformOptions); + TransformSprite(s, transform); } else { s->frameFlags = 0; } @@ -1472,20 +1472,20 @@ static void RenderCarouselScrollAnim(struct CharacterSelectionScreen *characterS DisplaySprite(s); s = &characterScreen->characterTitleTextRight; - transformOptions = &characterScreen->characterTitleRightTransform; + transform = &characterScreen->characterTitleRightTransform; s->x = 40; s->y = 79; if (c < 8) { - transformOptions->rotation = 0; - transformOptions->width = 0x100; - transformOptions->height = 0x100 - ((8 - c) * 0x1E); - transformOptions->x = s->x; - transformOptions->y = s->y; + transform->rotation = 0; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1) - ((8 - c) * 0x1E); + transform->x = s->x; + transform->y = s->y; s->frameFlags = gUnknown_030054B8++ | 0x20; UpdateSpriteAnimation(s); - TransformSprite(s, transformOptions); + TransformSprite(s, transform); } else { s->frameFlags = 0; } @@ -1503,7 +1503,7 @@ static void RenderCarouselScrollAnim(struct CharacterSelectionScreen *characterS static void RenderUI(struct CharacterSelectionScreen *characterScreen) { - SpriteTransform *transformOptions; + SpriteTransform *transform; Sprite *s, *element2, *element3; u8 i; if (characterScreen->amyUnlocked) { @@ -1535,22 +1535,22 @@ static void RenderUI(struct CharacterSelectionScreen *characterScreen) if (characterScreen->cursorAnimFrame > 0) { s = &characterScreen->selectedCarouselBlob; - transformOptions = &characterScreen->selectedBlobTransform; + transform = &characterScreen->selectedBlobTransform; s->x = 101; s->y = 79; s->variant = characterScreen->selectedCharacter + SA2_ANIM_VARIANT_CHAR_SELECT_CIRCLE_ACTIVE; s->prevVariant = -1; - transformOptions->rotation = 0; - transformOptions->width = (gSineTable[(characterScreen->cursorAnimFrame * 0x10 + 0x100) & 0x3FF] >> 8) + 0xC0; - transformOptions->height = (gSineTable[(characterScreen->cursorAnimFrame * 0x10 + 0x100) & 0x3FF] >> 8) + 0xC0; - transformOptions->x = s->x; - transformOptions->y = s->y; + transform->rotation = 0; + transform->qScaleX = (gSineTable[(characterScreen->cursorAnimFrame * 0x10 + 0x100) & 0x3FF] >> 8) + 0xC0; + transform->qScaleY = (gSineTable[(characterScreen->cursorAnimFrame * 0x10 + 0x100) & 0x3FF] >> 8) + 0xC0; + transform->x = s->x; + transform->y = s->y; s->frameFlags = gUnknown_030054B8++ | 0x60; UpdateSpriteAnimation(s); - TransformSprite(s, transformOptions); + TransformSprite(s, transform); DisplaySprite(s); } UpdateSpriteAnimation(&characterScreen->characterSprite); diff --git a/src/game/cheese.c b/src/game/cheese.c index 9a9b72321..d83c1e5e0 100644 --- a/src/game/cheese.c +++ b/src/game/cheese.c @@ -96,8 +96,8 @@ void CreateCheese(Player *player) cheese = TASK_DATA(t); s = &cheese->s; gCheese = cheese; - cheese->posX = gPlayer.x; - cheese->posY = gPlayer.y; + cheese->posX = gPlayer.qWorldX; + cheese->posY = gPlayer.qWorldY; } else { MultiplayerPlayer *mpp = NULL; u8 i; @@ -1045,8 +1045,8 @@ bool8 sub_8015118(Cheese *cheese) sub_8014EFC(cheese, 0, 0x10, 0); } } else { - unk54->unk54 = gPlayer.x; - unk54->unk58 = gPlayer.y; + unk54->unk54 = gPlayer.qWorldX; + unk54->unk58 = gPlayer.qWorldY; unk54->unk5C = gPlayer.speedAirX; unk54->unk5E = gPlayer.speedAirY; unk54->unk68 = &gPlayer.spriteInfoBody->s; diff --git a/src/game/countdown.c b/src/game/countdown.c index eff678146..f3e6fef75 100644 --- a/src/game/countdown.c +++ b/src/game/countdown.c @@ -22,13 +22,13 @@ #if !PLATFORM_GBA && ALIGN_DIGITS_HORIZONTALLY #define DIGITS_X (DISPLAY_WIDTH / 2) #else -#define DIGITS_X ((I(gPlayer.x) - gCamera.x) + 24) +#define DIGITS_X ((I(gPlayer.qWorldX) - gCamera.x) + 24) #endif #if !PLATFORM_GBA && ALIGN_DIGITS_VERTICALLY #define DIGITS_Y (DISPLAY_HEIGHT / 2) #else -#define DIGITS_Y ((I(gPlayer.y) - gCamera.y) - 24) +#define DIGITS_Y ((I(gPlayer.qWorldY) - gCamera.y) - 24) #endif struct CourseStartCountdown { @@ -140,8 +140,8 @@ void sub_8036168(void) sub_8018818(); CreateRaceStartMessage(); - countdown->machineScreenX = I(gPlayer.x); - countdown->machineScreenY = I(gPlayer.y); + countdown->machineScreenX = I(gPlayer.qWorldX); + countdown->machineScreenY = I(gPlayer.qWorldY); m4aSongNumStart(VOICE__ANNOUNCER__GO); gCurTask->main = sub_8036398; } else { @@ -157,8 +157,8 @@ void sub_8036168(void) } s = &countdown->sprMachine; - s->x = I(gPlayer.x) - gCamera.x; - s->y = I(gPlayer.y) - gCamera.y; + s->x = I(gPlayer.qWorldX) - gCamera.x; + s->y = I(gPlayer.qWorldY) - gCamera.y; UpdateSpriteAnimation(s); DisplaySprite(s); @@ -253,7 +253,7 @@ void sub_8036524(void) { struct RaceStartMessage *startMessage = TASK_DATA(gCurTask); Sprite *s, *element2; - SpriteTransform *transformConfig; + SpriteTransform *transform; s16 unk78; startMessage->unk78--; @@ -263,47 +263,47 @@ void sub_8036524(void) } s = &startMessage->unk0; - transformConfig = &startMessage->unk30; + transform = &startMessage->unk30; s->x = (DISPLAY_WIDTH / 2); s->y = (DISPLAY_HEIGHT / 4); s->frameFlags = gUnknown_030054B8++ | 0x60; - transformConfig->rotation = 0; + transform->rotation = 0; unk78 = startMessage->unk78; if (unk78 < 0x10) { - transformConfig->width = 0x200 - startMessage->unk78 * 0x10; - transformConfig->height = (startMessage->unk78 + 1) * 0x10; + transform->qScaleX = Q(2) - startMessage->unk78 * 0x10; + transform->qScaleY = (startMessage->unk78 + 1) * 0x10; } else { - transformConfig->width = 0x100; - transformConfig->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); } - transformConfig->x = s->x; - transformConfig->y = s->y; + transform->x = s->x; + transform->y = s->y; UpdateSpriteAnimation(s); - TransformSprite(s, transformConfig); + TransformSprite(s, transform); DisplaySprite(s); s = &startMessage->unk3C; - transformConfig = &startMessage->unk6C; + transform = &startMessage->unk6C; s->x = (DISPLAY_WIDTH / 2); s->y = (DISPLAY_HEIGHT / 4); s->frameFlags = gUnknown_030054B8++ | 0x60; - transformConfig->rotation = 0; + transform->rotation = 0; unk78 = startMessage->unk78; if (unk78 < 0x10) { - transformConfig->width = 0x200 - startMessage->unk78 * 0x10; - transformConfig->height = (startMessage->unk78 + 1) * 0x10; + transform->qScaleX = Q(2) - startMessage->unk78 * 0x10; + transform->qScaleY = (startMessage->unk78 + 1) * 0x10; } else { - transformConfig->width = 0x100; - transformConfig->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); } - transformConfig->x = s->x; - transformConfig->y = s->y; + transform->x = s->x; + transform->y = s->y; UpdateSpriteAnimation(s); - TransformSprite(s, transformConfig); + TransformSprite(s, transform); DisplaySprite(s); } diff --git a/src/game/cutscenes/final_ending_land.c b/src/game/cutscenes/final_ending_land.c index d9daa347b..95c3ab670 100644 --- a/src/game/cutscenes/final_ending_land.c +++ b/src/game/cutscenes/final_ending_land.c @@ -311,8 +311,8 @@ void CreateFinalEndingLandingCutScene(void) s->hitboxes[0].index = -1; transform->rotation = 0; - transform->width = scene->unk340; - transform->height = scene->unk340; + transform->qScaleX = scene->unk340; + transform->qScaleY = scene->unk340; transform->x = s->x; transform->y = s->y; @@ -730,8 +730,8 @@ void sub_8093868(struct FinalEndingLandCutScene *scene) s->x = scene->unk5E0[0][0] >> 8; s->y = scene->unk5E0[0][1] >> 8; - transform->width = scene->unk340; - transform->height = scene->unk340; + transform->qScaleX = scene->unk340; + transform->qScaleY = scene->unk340; transform->x = s->x; transform->y = s->y; TransformSprite(s, transform); diff --git a/src/game/cutscenes/level_endings.c b/src/game/cutscenes/level_endings.c index d6f830a02..9b7c06ff8 100644 --- a/src/game/cutscenes/level_endings.c +++ b/src/game/cutscenes/level_endings.c @@ -252,14 +252,14 @@ static void sub_808DD9C(void) scene->unk76 = (scene->unk76 * 0x43) >> 6; } - if (scene->unk70 < (player->x - Q(gCamera.x) - Q(20.0))) { - scene->unk70 = (player->x - Q(gCamera.x) - Q(20.0)); + if (scene->unk70 < (player->qWorldX - Q(gCamera.x) - Q(20.0))) { + scene->unk70 = (player->qWorldX - Q(gCamera.x) - Q(20.0)); } - if (scene->unk72 > (player->y - (gCamera.y * 0x100) - 0xA00)) { + if (scene->unk72 > (player->qWorldY - (gCamera.y * 0x100) - 0xA00)) { // Required for match - scene->unk72 = scene->unk72 = player->y - (gCamera.y * 0x100) - 0xA00; - scene->unk70 = player->x - Q(gCamera.x) - Q(20.0); + scene->unk72 = scene->unk72 = player->qWorldY - (gCamera.y * 0x100) - 0xA00; + scene->unk70 = player->qWorldX - Q(gCamera.x) - Q(20.0); if (scene->unk7A == 0) { player->charState = CHARSTATE_SONIC_CAUGHT_CREAM; @@ -321,13 +321,13 @@ static void sub_808DF88(void) scene->unk76 = (scene->unk76 * 0x7F) >> 7; } - if (scene->unk70 < (player->x - Q(gCamera.x) - 0x1C00)) { - scene->unk70 = player->x - Q(gCamera.x) - 0x1C00; + if (scene->unk70 < (player->qWorldX - Q(gCamera.x) - 0x1C00)) { + scene->unk70 = player->qWorldX - Q(gCamera.x) - 0x1C00; } - if (scene->unk72 > (player->y - (gCamera.y * 0x100) - 0x1400)) { - scene->unk72 = player->y - (gCamera.y * 0x100) - 0x1400; - scene->unk70 = player->x - Q(gCamera.x) - 0x1C00; + if (scene->unk72 > (player->qWorldY - (gCamera.y * 0x100) - 0x1400)) { + scene->unk72 = player->qWorldY - (gCamera.y * 0x100) - 0x1400; + scene->unk70 = player->qWorldX - Q(gCamera.x) - 0x1C00; if (scene->unk7A == 0) { VramFree(scene->unk4.graphics.dest); @@ -379,8 +379,8 @@ static void sub_808E114(void) scene->unk74 = (scene->unk74 * 0x7F) >> 7; } - if (scene->unk70 > (player->x - (gCamera.x * 256) - 0x4000)) { - scene->unk70 = player->x - (gCamera.x * 256) - 0x4000; + if (scene->unk70 > (player->qWorldX - (gCamera.x * 256) - 0x4000)) { + scene->unk70 = player->qWorldX - (gCamera.x * 256) - 0x4000; } result = sub_801F100((scene->unk72 >> 8) + gCamera.y, (scene->unk70 >> 8) + gCamera.x + scene->unk7C, 1, 8, sub_801EC3C); diff --git a/src/game/enemies/bullet_buzzer.c b/src/game/enemies/bullet_buzzer.c index 5e9b1ddb7..05a42626b 100644 --- a/src/game/enemies/bullet_buzzer.c +++ b/src/game/enemies/bullet_buzzer.c @@ -105,7 +105,7 @@ void Task_BulletBuzzerMain(void) } ENEMY_DESTROY_IF_OFFSCREEN(bbuzzer, me, s); - value = sub_8004418(I(gPlayer.y) - pos.y, I(gPlayer.x) - pos.x); + value = sub_8004418(I(gPlayer.qWorldY) - pos.y, I(gPlayer.qWorldX) - pos.x); if (bbuzzer->unk5E == 0) { if (((u16)(value - 86) < 84 && s->frameFlags & SPRITE_FLAG_MASK_X_FLIP) diff --git a/src/game/enemies/buzzer.c b/src/game/enemies/buzzer.c index 2c0d941ad..2c1f4df84 100644 --- a/src/game/enemies/buzzer.c +++ b/src/game/enemies/buzzer.c @@ -91,28 +91,28 @@ static void Task_BuzzerMain(void) --buzzer->unk68 == 0 #endif ) - && !(s->frameFlags & SPRITE_FLAG_MASK_X_FLIP) && I(gPlayer.x) > (pos.x - 0x3C) && I(gPlayer.x) < pos.x && I(gPlayer.y) > pos.y - && I(gPlayer.y) < (pos.y + 0x50)) { + && !(s->frameFlags & SPRITE_FLAG_MASK_X_FLIP) && I(gPlayer.qWorldX) > (pos.x - 0x3C) && I(gPlayer.qWorldX) < pos.x + && I(gPlayer.qWorldY) > pos.y && I(gPlayer.qWorldY) < (pos.y + 0x50)) { gCurTask->main = sub_80534F0; s->graphics.anim = SA2_ANIM_BUZZER; s->variant = 1; s->prevVariant = -1; - buzzer->unk5C = gPlayer.y; - buzzer->unk64 = Div(gPlayer.x - QS(pos.x), 0x20); - buzzer->unk66 = Div(gPlayer.y - QS(pos.y), 0x20); - } else if (buzzer->unk68 == 0 && (s->frameFlags & SPRITE_FLAG_MASK_X_FLIP) && I(gPlayer.x) > pos.x && I(gPlayer.x) < (pos.x + 0x3C) - && I(gPlayer.y) > pos.y && I(gPlayer.y) < (pos.y + 0x50)) { + buzzer->unk5C = gPlayer.qWorldY; + buzzer->unk64 = Div(gPlayer.qWorldX - QS(pos.x), 0x20); + buzzer->unk66 = Div(gPlayer.qWorldY - QS(pos.y), 0x20); + } else if (buzzer->unk68 == 0 && (s->frameFlags & SPRITE_FLAG_MASK_X_FLIP) && I(gPlayer.qWorldX) > pos.x + && I(gPlayer.qWorldX) < (pos.x + 0x3C) && I(gPlayer.qWorldY) > pos.y && I(gPlayer.qWorldY) < (pos.y + 0x50)) { gCurTask->main = sub_80534F0; s->graphics.anim = SA2_ANIM_BUZZER; s->variant = 1; s->prevVariant = -1; - buzzer->unk5C = gPlayer.y; + buzzer->unk5C = gPlayer.qWorldY; // Wtf - buzzer->unk64 = Div(QS(pos.x) - gPlayer.x, 0x20); - buzzer->unk64 = Div(gPlayer.x - QS(pos.x), 0x20); + buzzer->unk64 = Div(QS(pos.x) - gPlayer.qWorldX, 0x20); + buzzer->unk64 = Div(gPlayer.qWorldX - QS(pos.x), 0x20); - buzzer->unk66 = Div(gPlayer.y - QS(pos.y), 0x20); + buzzer->unk66 = Div(gPlayer.qWorldY - QS(pos.y), 0x20); } else { #ifndef NON_MATCHING lab: diff --git a/src/game/enemies/hammerhead.c b/src/game/enemies/hammerhead.c index 6a63444fe..693090401 100644 --- a/src/game/enemies/hammerhead.c +++ b/src/game/enemies/hammerhead.c @@ -88,14 +88,14 @@ static void Task_Hammerhead(void) } if ((p->moveState & MOVESTATE_8) && (p->unk3C == s)) { - p->y += 0x100; - p->y += ip; + p->qWorldY += 0x100; + p->qWorldY += ip; } if (!(p->moveState & MOVESTATE_400000)) { s32 flags = sub_800CCB8(s, posX, posY + I(hammerhead->unk48), p); if (flags & 0x10000) { - p->y += (flags << 24) >> 16; + p->qWorldY += (flags << 24) >> 16; } } diff --git a/src/game/enemies/kiki.c b/src/game/enemies/kiki.c index f85adc5c4..beddc62ec 100644 --- a/src/game/enemies/kiki.c +++ b/src/game/enemies/kiki.c @@ -110,7 +110,7 @@ static void Task_KikiMain(void) return; } - if (I(gPlayer.x) < x) { + if (I(gPlayer.qWorldX) < x) { SPRITE_FLAG_CLEAR(s, X_FLIP); } else { SPRITE_FLAG_SET(s, X_FLIP); @@ -146,7 +146,7 @@ static void sub_8053A38(void) return; } - if (I(gPlayer.x) < x) { + if (I(gPlayer.qWorldX) < x) { SPRITE_FLAG_CLEAR(s, X_FLIP); } else { SPRITE_FLAG_SET(s, X_FLIP); @@ -181,13 +181,13 @@ static void CreateKikiProjectile(s16 x, s16 y) proj->unk30 = 0; proj->unk36 = 0; proj->unk38 = x; - if (I(gPlayer.x) < x) { - proj->unk34 = -Div((x - I(gPlayer.x)) * 400, 800); + if (I(gPlayer.qWorldX) < x) { + proj->unk34 = -Div((x - I(gPlayer.qWorldX)) * 400, 800); if (proj->unk34 < -0x3C) { proj->unk34 = -60; } } else { - proj->unk34 = Div((I(gPlayer.x) - x) * 400, 800); + proj->unk34 = Div((I(gPlayer.qWorldX) - x) * 400, 800); if (proj->unk34 >= 0x3D) { proj->unk34 = 60; @@ -290,7 +290,7 @@ static void CreateKikiProjectilePiece(s16 x, s16 y) proj->unk32 = -512; proj->unk30 = 0; - if (I(gPlayer.x) < x) { + if (I(gPlayer.qWorldX) < x) { proj->unk34 = -1; } else { proj->unk34 = 1; @@ -320,12 +320,12 @@ static void Task_ProjPieceMain(void) if ((s->hitboxes[0].index != -1) && (s2->hitboxes[0].index != -1)) { s32 x1, x2; x1 = x + s->hitboxes[0].left; - x2 = I(gPlayer.x) + s2->hitboxes[0].left; + x2 = I(gPlayer.qWorldX) + s2->hitboxes[0].left; if ((x1 <= x2 && x1 + (s->hitboxes[0].right - s->hitboxes[0].left) >= x2) || (x1 >= x2 && x2 + (s2->hitboxes[0].right - s2->hitboxes[0].left) >= x1)) { s32 y1, y2; y1 = y + s->hitboxes[0].top; - y2 = I(gPlayer.y) + s2->hitboxes[0].top; + y2 = I(gPlayer.qWorldY) + s2->hitboxes[0].top; if ((y1 <= y2 && y1 + (s->hitboxes[0].bottom - s->hitboxes[0].top) >= y2) || (y1 >= y2 && y2 + (s2->hitboxes[0].bottom - s2->hitboxes[0].top) >= y1)) { sub_800CBA4(&gPlayer); diff --git a/src/game/enemies/koura.c b/src/game/enemies/koura.c index 112590e09..fc07b8847 100644 --- a/src/game/enemies/koura.c +++ b/src/game/enemies/koura.c @@ -149,7 +149,7 @@ static void sub_8054224(void) koura->unk58 = NEGATE(koura->unk58); } - if ((SPRITE_FLAG_GET(s, X_FLIP) && gPlayer.x < QS(pos.x)) || (!SPRITE_FLAG_GET(s, X_FLIP) && gPlayer.x > QS(pos.x))) { + if ((SPRITE_FLAG_GET(s, X_FLIP) && gPlayer.qWorldX < QS(pos.x)) || (!SPRITE_FLAG_GET(s, X_FLIP) && gPlayer.qWorldX > QS(pos.x))) { gCurTask->main = sub_805462C; s->graphics.anim = gUnknown_080D8F38[5][0]; s->variant = gUnknown_080D8F38[5][1]; diff --git a/src/game/enemies/kubinaga.c b/src/game/enemies/kubinaga.c index 3c11875e8..1b37b61ab 100644 --- a/src/game/enemies/kubinaga.c +++ b/src/game/enemies/kubinaga.c @@ -112,15 +112,15 @@ static void sub_80524D0(void) Player_UpdateHomingPosition(k->spawnX, k->spawnY); if (k->unkB8 != 0) { k->unkB8--; - } else if (gPlayer.x > k->spawnX - 0x7800 && gPlayer.x < k->spawnX + 0x7800 && gPlayer.y > k->spawnY - 0x6400 - && gPlayer.y < k->spawnY + 0x6400) { + } else if (gPlayer.qWorldX > k->spawnX - 0x7800 && gPlayer.qWorldX < k->spawnX + 0x7800 && gPlayer.qWorldY > k->spawnY - 0x6400 + && gPlayer.qWorldY < k->spawnY + 0x6400) { k->unkBE = 0; if (k->unkC0 == 0) { - k->unkBA = sub_8004418((I(gPlayer.y) - pos.y) + 10, I(gPlayer.x) - pos.x); + k->unkBA = sub_8004418((I(gPlayer.qWorldY) - pos.y) + 10, I(gPlayer.qWorldX) - pos.x); } else if ((k->unkC0 & 1)) { - k->unkBA = sub_8004418((I(gPlayer.y) - pos.y), (I(gPlayer.x) - pos.x) + 10); + k->unkBA = sub_8004418((I(gPlayer.qWorldY) - pos.y), (I(gPlayer.qWorldX) - pos.x) + 10); } else { - k->unkBA = sub_8004418((I(gPlayer.y) - pos.y), (I(gPlayer.x) - pos.x) - 10); + k->unkBA = sub_8004418((I(gPlayer.qWorldY) - pos.y), (I(gPlayer.qWorldX) - pos.x) - 10); } k->headX = k->spawnX; @@ -349,24 +349,24 @@ static void sub_8052CC8(Sprite_Kubinaga *k) if (k->unkC0 == 0) { sHead->y = (pos.y - gCamera.y) - 10; - transform->rotation = sub_8004418(I(gPlayer.y) - pos.y + 10, I(gPlayer.x) - pos.x); + transform->rotation = sub_8004418(I(gPlayer.qWorldY) - pos.y + 10, I(gPlayer.qWorldX) - pos.x); } else { if (k->unkC0 & 1) { sHead->x = sHead->x + 10; - transform->rotation = sub_8004418(I(gPlayer.y) - pos.y, (I(gPlayer.x) - pos.x) + 10); + transform->rotation = sub_8004418(I(gPlayer.qWorldY) - pos.y, (I(gPlayer.qWorldX) - pos.x) + 10); } else { sHead->x = sHead->x - 10; - transform->rotation = sub_8004418(I(gPlayer.y) - pos.y, (I(gPlayer.x) - pos.x) - 10); + transform->rotation = sub_8004418(I(gPlayer.qWorldY) - pos.y, (I(gPlayer.qWorldX) - pos.x) - 10); } sHead->y = (pos.y - gCamera.y); } sub_800C84C(sHead, pos.x, pos.y); - transform->width = 0x100; - transform->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); transform->x = sHead->x; transform->y = sHead->y; k->unkBC = transform->rotation; diff --git a/src/game/enemies/madillo.c b/src/game/enemies/madillo.c index 8475f11eb..0bccd59c3 100644 --- a/src/game/enemies/madillo.c +++ b/src/game/enemies/madillo.c @@ -83,9 +83,9 @@ static void Task_MadilloMain(void) ENEMY_DESTROY_IF_PLAYER_HIT_2(s, pos); ENEMY_DESTROY_IF_OFFSCREEN(madillo, me, s); - if (Q(pos.y - 50) < gPlayer.y) { - if (Q(pos.y + 50) > gPlayer.y) { - if (((QS(pos.x)) > gPlayer.x) && (Q(pos.x - 120) < (gPlayer.x))) { + if (Q(pos.y - 50) < gPlayer.qWorldY) { + if (Q(pos.y + 50) > gPlayer.qWorldY) { + if (((QS(pos.x)) > gPlayer.qWorldX) && (Q(pos.x - 120) < (gPlayer.qWorldX))) { if (I(madillo->offsetX) > me->d.sData[0] * TILE_WIDTH) { gCurTask->main = Task_8056230; s->graphics.anim = SA2_ANIM_MADILLO; @@ -93,7 +93,7 @@ static void Task_MadilloMain(void) s->prevVariant = -1; SPRITE_FLAG_CLEAR(s, X_FLIP); } - } else if (Q(pos.x + 120) > gPlayer.x) { + } else if (Q(pos.x + 120) > gPlayer.qWorldX) { if (I(madillo->offsetX) < (me->d.sData[0] + me->d.uData[2]) * TILE_WIDTH) { gCurTask->main = Task_8056230; s->graphics.anim = SA2_ANIM_MADILLO; @@ -131,7 +131,7 @@ static void Task_8056230(void) s2 = &p->spriteInfoBody->s; if ((s2->hitboxes[0].index != -1)) { - if (HB_COLLISION(pos.x, pos.y, s->hitboxes[0], I(p->x), I(p->y), s2->hitboxes[0])) { + if (HB_COLLISION(pos.x, pos.y, s->hitboxes[0], I(p->qWorldX), I(p->qWorldY), s2->hitboxes[0])) { if ((p->itemEffect & 0x2) == PLAYER_ITEM_EFFECT__NONE) { sub_800CBA4(p); } diff --git a/src/game/enemies/mon.c b/src/game/enemies/mon.c index 132674f5a..2d69c3162 100644 --- a/src/game/enemies/mon.c +++ b/src/game/enemies/mon.c @@ -86,8 +86,8 @@ static void Task_MonMain(void) TaskDestroy(gCurTask); return; } else { - if ((gPlayer.x > mon->x - Q(DISPLAY_WIDTH / 2)) && (gPlayer.x < mon->x + Q(DISPLAY_WIDTH / 2)) && (gPlayer.y > mon->y - Q(50)) - && (gPlayer.y < mon->y + Q(50))) { + if ((gPlayer.qWorldX > mon->x - Q(DISPLAY_WIDTH / 2)) && (gPlayer.qWorldX < mon->x + Q(DISPLAY_WIDTH / 2)) + && (gPlayer.qWorldY > mon->y - Q(50)) && (gPlayer.qWorldY < mon->y + Q(50))) { gCurTask->main = Task_Mon_2; s->graphics.anim = SA2_ANIM_MON; s->variant = 2; @@ -183,8 +183,8 @@ static void Task_Mon_4(void) Player_UpdateHomingPosition(mon->x, mon->y); if (UpdateSpriteAnimation(s) == 0) { - if ((gPlayer.x > mon->x - Q(DISPLAY_WIDTH / 2)) && (gPlayer.x < mon->x + Q(DISPLAY_WIDTH / 2)) && (gPlayer.y > mon->y - Q(50)) - && (gPlayer.y < mon->y + Q(50))) { + if ((gPlayer.qWorldX > mon->x - Q(DISPLAY_WIDTH / 2)) && (gPlayer.qWorldX < mon->x + Q(DISPLAY_WIDTH / 2)) + && (gPlayer.qWorldY > mon->y - Q(50)) && (gPlayer.qWorldY < mon->y + Q(50))) { ENEMY_TURN_TO_PLAYER(mon->x, s); diff --git a/src/game/enemies/mouse.c b/src/game/enemies/mouse.c index 03af32eef..0b8350959 100644 --- a/src/game/enemies/mouse.c +++ b/src/game/enemies/mouse.c @@ -117,11 +117,11 @@ static void sub_8057348(void) ENEMY_DESTROY_IF_OFFSCREEN(mouse, me, s); if (s->frameFlags & SPRITE_FLAG_MASK_X_FLIP) { - if (gPlayer.x > QS(pos.x) && gPlayer.x < QS(pos.x + 100)) { + if (gPlayer.qWorldX > QS(pos.x) && gPlayer.qWorldX < QS(pos.x + 100)) { mouse->unk52 = 1; } } else { - if (gPlayer.x < QS(pos.x) && gPlayer.x > QS(pos.x - 100)) { + if (gPlayer.qWorldX < QS(pos.x) && gPlayer.qWorldX > QS(pos.x - 100)) { mouse->unk52 = 1; } } diff --git a/src/game/enemies/pen.c b/src/game/enemies/pen.c index e129f474b..c039fa8e4 100644 --- a/src/game/enemies/pen.c +++ b/src/game/enemies/pen.c @@ -86,7 +86,7 @@ static void Task_PenMove(void) ENEMY_DESTROY_IF_OFFSCREEN(pen, me, s); if (s->frameFlags & SPRITE_FLAG_MASK_X_FLIP) { - s32 playerX = gPlayer.x; + s32 playerX = gPlayer.qWorldX; // Feels like a fake match, oh well posX_24_8 = Q(pos.x); if (playerX > posX_24_8 && playerX < Q(pos.x + 100)) { @@ -98,7 +98,7 @@ static void Task_PenMove(void) pen->boosting = TRUE; } } else { - s32 playerX = gPlayer.x; + s32 playerX = gPlayer.qWorldX; posX_24_8 = Q(pos.x); if (playerX < posX_24_8 && playerX > Q(pos.x - 100)) { if (!pen->boosting) { diff --git a/src/game/enemies/spinner.c b/src/game/enemies/spinner.c index 1d71b17e0..9a2976a8a 100644 --- a/src/game/enemies/spinner.c +++ b/src/game/enemies/spinner.c @@ -70,7 +70,7 @@ void Task_EnemySpinner(void) Sprite *s2 = &p->spriteInfoBody->s; if ((s2->hitboxes[0].index != HITBOX_STATE_INACTIVE) && (s->hitboxes[1].index != HITBOX_STATE_INACTIVE)) { - if (HB_COLLISION(pos.x, pos.y, s->hitboxes[1], I(p->x), I(p->y), s2->hitboxes[0])) { + if (HB_COLLISION(pos.x, pos.y, s->hitboxes[1], I(p->qWorldX), I(p->qWorldY), s2->hitboxes[0])) { if ((p->itemEffect & 0x2) == PLAYER_ITEM_EFFECT__NONE) { sub_800CBA4(p); } diff --git a/src/game/enemies/straw.c b/src/game/enemies/straw.c index 5cc205cfe..b9e388c93 100644 --- a/src/game/enemies/straw.c +++ b/src/game/enemies/straw.c @@ -105,13 +105,13 @@ void Task_StrawMain(void) ENEMY_UPDATE_POSITION(straw, s, pos.x, pos.y); - if (gPlayer.x < QS(pos.x)) { + if (gPlayer.qWorldX < QS(pos.x)) { straw->unk4C -= 0x10; } else { straw->unk4C += 0xB; } - if (gPlayer.y < QS(pos.y)) { + if (gPlayer.qWorldY < QS(pos.y)) { straw->unk50 -= 0x10; } else { straw->unk50 += 0xB; diff --git a/src/game/enemies/yado.c b/src/game/enemies/yado.c index f841fa2e6..7c2c51e6f 100644 --- a/src/game/enemies/yado.c +++ b/src/game/enemies/yado.c @@ -34,8 +34,8 @@ void TaskDestructor_Yado(struct Task *); #define YADO_PROJ_COOLDOWN (2 * GBA_FRAMES_PER_SECOND) #define IS_YADO_FACING_PLAYER(_yado, _yadoX, _player) \ - (((I(gPlayer.x) < _yadoX) && (s->frameFlags & SPRITE_FLAG_MASK_X_FLIP)) \ - || ((I(gPlayer.x) > _yadoX) && (~s->frameFlags & SPRITE_FLAG_MASK_X_FLIP))) + (((I(gPlayer.qWorldX) < _yadoX) && (s->frameFlags & SPRITE_FLAG_MASK_X_FLIP)) \ + || ((I(gPlayer.qWorldX) > _yadoX) && (~s->frameFlags & SPRITE_FLAG_MASK_X_FLIP))) void CreateEntity_Yado(MapEntity *me, u16 spriteRegionX, u16 spriteRegionY, u8 spriteY) { diff --git a/src/game/heart_particles_effect.c b/src/game/heart_particles_effect.c index 9281a1b60..22d594d48 100644 --- a/src/game/heart_particles_effect.c +++ b/src/game/heart_particles_effect.c @@ -166,8 +166,8 @@ static void sub_8086BE8(u8 i) Sprite *s; HeartParticles *unk998 = TASK_DATA(gCurTask); - unk998->unkC4[i] = gPlayer.x; - unk998->unkD4[i] = gPlayer.y; + unk998->unkC4[i] = gPlayer.qWorldX; + unk998->unkD4[i] = gPlayer.qWorldY; if (i == 1) { unk998->unkD4[1] += 0x800; diff --git a/src/game/interactables_1/bouncy_bar.c b/src/game/interactables_1/bouncy_bar.c index 9cd917206..9222e621f 100644 --- a/src/game/interactables_1/bouncy_bar.c +++ b/src/game/interactables_1/bouncy_bar.c @@ -89,7 +89,7 @@ void Task_BouncyBarIdle(void) s->y = screenY - gCamera.y; if (!(gPlayer.moveState & MOVESTATE_DEAD) && (sub_800C204(s, screenX, screenY, 0, &gPlayer, 0) == 1) && (gPlayer.speedAirY > 0) - && (I(gPlayer.y) + 4) < screenY) { + && (I(gPlayer.qWorldY) + 4) < screenY) { gPlayer.charState = CHARSTATE_CURLED_IN_AIR; gPlayer.transition = PLTRANS_PT5; @@ -101,7 +101,7 @@ void Task_BouncyBarIdle(void) bar->unk3D = (bar->unk3C * 5) + 10; bar->unk3E = gUnknown_080D94E8[bar->unk3C]; - bar->unk40 = screenX - I(gPlayer.x) >= 0 ? screenX - I(gPlayer.x) : I(gPlayer.x) - screenX; + bar->unk40 = screenX - I(gPlayer.qWorldX) >= 0 ? screenX - I(gPlayer.qWorldX) : I(gPlayer.qWorldX) - screenX; gCurTask->main = Task_BouncyBarLaunch; gPlayer.moveState |= MOVESTATE_400000; @@ -138,7 +138,7 @@ void Task_BouncyBarLaunch(void) if (bar->unk3D != 0) { s8 temp; bar->unk3D--; - gPlayer.y += bar->unk40 * bar->unk3E; + gPlayer.qWorldY += bar->unk40 * bar->unk3E; gPlayer.speedAirY = 0; if (bar->unk3D == 0) { diff --git a/src/game/interactables_1/checkpoint.c b/src/game/interactables_1/checkpoint.c index 073c3beb3..8f3b8180c 100644 --- a/src/game/interactables_1/checkpoint.c +++ b/src/game/interactables_1/checkpoint.c @@ -117,7 +117,7 @@ void Task_8062FD8(void) TaskDestroy(chkPt->task); TaskDestroy(gCurTask); } else { - if (!(gPlayer.moveState & (MOVESTATE_400000 | MOVESTATE_DEAD)) && posX <= I(gPlayer.x)) { + if (!(gPlayer.moveState & (MOVESTATE_400000 | MOVESTATE_DEAD)) && posX <= I(gPlayer.qWorldX)) { gPlayer.checkPointX = gUnknown_080D63FC[gCurrentLevel][0]; gPlayer.checkPointY = gUnknown_080D63FC[gCurrentLevel][1]; gPlayer.checkpointTime = gCheckpointTime; @@ -229,7 +229,7 @@ static void Task_Interactable_Toggle_Checkpoint(void) if (IS_OUT_OF_CAM_RANGE(screenX, screenY)) { me->x = toggle->base.spriteX; TaskDestroy(gCurTask); - } else if (!(gPlayer.moveState & (MOVESTATE_400000 | MOVESTATE_DEAD)) && posX <= I(gPlayer.x)) { + } else if (!(gPlayer.moveState & (MOVESTATE_400000 | MOVESTATE_DEAD)) && posX <= I(gPlayer.qWorldX)) { gPlayer.checkPointX = gUnknown_080D63FC[gCurrentLevel][0]; gPlayer.checkPointY = gUnknown_080D63FC[gCurrentLevel][1]; gPlayer.checkpointTime = gCheckpointTime; diff --git a/src/game/interactables_1/corkscrew.c b/src/game/interactables_1/corkscrew.c index f13a04a6a..a36589ee5 100644 --- a/src/game/interactables_1/corkscrew.c +++ b/src/game/interactables_1/corkscrew.c @@ -35,23 +35,23 @@ void Task_8060D34(void) s32 y = TO_WORLD_POS(corkscrew->base.me->y, regionY); if (PLAYER_IS_ALIVE) { - if ((x + (me->d.sData[0] * TILE_WIDTH) <= I(gPlayer.x) - && (x + (me->d.sData[0] * TILE_WIDTH) + (me->d.uData[2] * TILE_WIDTH) >= I(gPlayer.x))) - && (y + (me->d.sData[1] * TILE_WIDTH) <= I(gPlayer.y) - && y + (me->d.sData[1] * TILE_WIDTH) + (me->d.uData[3] * TILE_WIDTH) >= I(gPlayer.y))) { - if (x < I(gPlayer.x) && (corkscrew->base.id & 1)) { + if ((x + (me->d.sData[0] * TILE_WIDTH) <= I(gPlayer.qWorldX) + && (x + (me->d.sData[0] * TILE_WIDTH) + (me->d.uData[2] * TILE_WIDTH) >= I(gPlayer.qWorldX))) + && (y + (me->d.sData[1] * TILE_WIDTH) <= I(gPlayer.qWorldY) + && y + (me->d.sData[1] * TILE_WIDTH) + (me->d.uData[3] * TILE_WIDTH) >= I(gPlayer.qWorldY))) { + if (x < I(gPlayer.qWorldX) && (corkscrew->base.id & 1)) { s32 idx; s32 y24_8; gPlayer.transition = PLTRANS_CORKSCREW; - idx = ((((I(gPlayer.x) - x) * 930) >> 8) + 256) & ONE_CYCLE; - gPlayer.x += gPlayer.speedGroundX; + idx = ((((I(gPlayer.qWorldX) - x) * 930) >> 8) + 256) & ONE_CYCLE; + gPlayer.qWorldX += gPlayer.speedGroundX; y24_8 = Q(y); - gPlayer.y = SIN_24_8(idx) * 24 + y24_8 - Q(28); + gPlayer.qWorldY = SIN_24_8(idx) * 24 + y24_8 - Q(28); gPlayer.speedAirY = 0; gCurTask->main = sub_8060ED0; - } else if ((x >= I(gPlayer.x)) && gPlayer.speedGroundX > Q_8_8(4) && !(gPlayer.moveState & MOVESTATE_IN_AIR) + } else if ((x >= I(gPlayer.qWorldX)) && gPlayer.speedGroundX > Q_8_8(4) && !(gPlayer.moveState & MOVESTATE_IN_AIR) && !(gPlayer.frameInput & gPlayerControls.jump)) { corkscrew->base.id |= 1; } else { @@ -90,7 +90,7 @@ void sub_8060ED0(void) return; } - if (I(player->x) - x > 0x230) { + if (I(player->qWorldX) - x > 0x230) { if (player->moveState & MOVESTATE_4) { player->transition = PLTRANS_PT2; } else { @@ -100,12 +100,12 @@ void sub_8060ED0(void) return; } - idx = I((I(player->x) - x) * 930); + idx = I((I(player->qWorldX) - x) * 930); idx = (idx + 256) & ONE_CYCLE; - player->x += player->speedGroundX; + player->qWorldX += player->speedGroundX; y24_8 = Q(y); - player->y = SIN_24_8(idx) * 24 + y24_8 - Q(28); + player->qWorldY = SIN_24_8(idx) * 24 + y24_8 - Q(28); player->speedAirY = 0; if (player->speedGroundX < corkscrew->unk10) { @@ -145,23 +145,23 @@ void sub_8061088(void) s32 y = TO_WORLD_POS(corkscrew->base.me->y, regionY); if (PLAYER_IS_ALIVE) { - if ((x + (me->d.sData[0] * TILE_WIDTH) <= I(gPlayer.x) - && (x + (me->d.sData[0] * TILE_WIDTH) + (me->d.uData[2] * TILE_WIDTH) >= I(gPlayer.x))) - && (y + (me->d.sData[1] * TILE_WIDTH) <= I(gPlayer.y) - && y + (me->d.sData[1] * TILE_WIDTH) + (me->d.uData[3] * TILE_WIDTH) >= I(gPlayer.y))) { - if (x > I(gPlayer.x) && (corkscrew->base.id & 1)) { + if ((x + (me->d.sData[0] * TILE_WIDTH) <= I(gPlayer.qWorldX) + && (x + (me->d.sData[0] * TILE_WIDTH) + (me->d.uData[2] * TILE_WIDTH) >= I(gPlayer.qWorldX))) + && (y + (me->d.sData[1] * TILE_WIDTH) <= I(gPlayer.qWorldY) + && y + (me->d.sData[1] * TILE_WIDTH) + (me->d.uData[3] * TILE_WIDTH) >= I(gPlayer.qWorldY))) { + if (x > I(gPlayer.qWorldX) && (corkscrew->base.id & 1)) { s32 idx; s32 y24_8; gPlayer.transition = PLTRANS_CORKSCREW; - idx = ((((I(gPlayer.x) - x) * 930) >> 8) + 256) & ONE_CYCLE; - gPlayer.x += gPlayer.speedGroundX; + idx = ((((I(gPlayer.qWorldX) - x) * 930) >> 8) + 256) & ONE_CYCLE; + gPlayer.qWorldX += gPlayer.speedGroundX; y24_8 = Q(y); - gPlayer.y = SIN_24_8(idx) * 24 + y24_8 - Q(28); + gPlayer.qWorldY = SIN_24_8(idx) * 24 + y24_8 - Q(28); gPlayer.speedAirY = 0; gCurTask->main = sub_8061228; - } else if ((x <= I(gPlayer.x)) && gPlayer.speedGroundX < -Q_8_8(4) && !(gPlayer.moveState & MOVESTATE_IN_AIR) + } else if ((x <= I(gPlayer.qWorldX)) && gPlayer.speedGroundX < -Q_8_8(4) && !(gPlayer.moveState & MOVESTATE_IN_AIR) && !(gPlayer.frameInput & gPlayerControls.jump)) { corkscrew->base.id |= 1; } else { @@ -200,7 +200,7 @@ void sub_8061228(void) return; } - if (I(player->x) - x < -0x230) { + if (I(player->qWorldX) - x < -0x230) { if (player->moveState & MOVESTATE_4) { player->transition = PLTRANS_PT2; } else { @@ -210,12 +210,12 @@ void sub_8061228(void) return; } - idx = I((I(player->x) - x) * 930); + idx = I((I(player->qWorldX) - x) * 930); idx = (idx + 256) & ONE_CYCLE; - player->x += player->speedGroundX; + player->qWorldX += player->speedGroundX; y24_8 = Q(y); - player->y = SIN_24_8(idx) * 24 + y24_8 - Q(28); + player->qWorldY = SIN_24_8(idx) * 24 + y24_8 - Q(28); player->speedAirY = 0; if (player->speedGroundX > corkscrew->unk10) { @@ -275,11 +275,11 @@ void CreateEntity_Corkscrew_End(MapEntity *me, u16 spriteRegionX, u16 spriteRegi UNUSED s32 sub_806148C(s32 x, s32 y) { s32 y24_8; - s32 idx = ((((I(gPlayer.x) - x) * 930) >> 8) + 256) & ONE_CYCLE; + s32 idx = ((((I(gPlayer.qWorldX) - x) * 930) >> 8) + 256) & ONE_CYCLE; - gPlayer.x += gPlayer.speedGroundX; + gPlayer.qWorldX += gPlayer.speedGroundX; y24_8 = Q(y); - gPlayer.y = SIN_24_8(idx) * 24 + y24_8 - Q(28); + gPlayer.qWorldY = SIN_24_8(idx) * 24 + y24_8 - Q(28); gPlayer.speedAirY = 0; return idx; } diff --git a/src/game/interactables_1/corkscrew_3d.c b/src/game/interactables_1/corkscrew_3d.c index fd38c6050..eeb6eb9e8 100644 --- a/src/game/interactables_1/corkscrew_3d.c +++ b/src/game/interactables_1/corkscrew_3d.c @@ -41,23 +41,23 @@ void Task_8061914(void) s32 y = TO_WORLD_POS(corkscrew->base.me->y, regionY); if (PLAYER_IS_ALIVE) { - if ((x + (me->d.sData[0] * TILE_WIDTH) <= I(gPlayer.x) - && (x + (me->d.sData[0] * TILE_WIDTH) + (me->d.uData[2] * TILE_WIDTH) >= I(gPlayer.x))) - && (y + (me->d.sData[1] * TILE_WIDTH) <= I(gPlayer.y) - && y + (me->d.sData[1] * TILE_WIDTH) + (me->d.uData[3] * TILE_WIDTH) >= I(gPlayer.y))) { - if (x < I(gPlayer.x) && (corkscrew->base.id & 1)) { + if ((x + (me->d.sData[0] * TILE_WIDTH) <= I(gPlayer.qWorldX) + && (x + (me->d.sData[0] * TILE_WIDTH) + (me->d.uData[2] * TILE_WIDTH) >= I(gPlayer.qWorldX))) + && (y + (me->d.sData[1] * TILE_WIDTH) <= I(gPlayer.qWorldY) + && y + (me->d.sData[1] * TILE_WIDTH) + (me->d.uData[3] * TILE_WIDTH) >= I(gPlayer.qWorldY))) { + if (x < I(gPlayer.qWorldX) && (corkscrew->base.id & 1)) { s32 idx; s32 y24_8; gPlayer.transition = PLTRANS_CORKSCREW; - idx = ((((I(gPlayer.x) - x) * 930) >> 8) + 256) & ONE_CYCLE; - gPlayer.x += gPlayer.speedGroundX; + idx = ((((I(gPlayer.qWorldX) - x) * 930) >> 8) + 256) & ONE_CYCLE; + gPlayer.qWorldX += gPlayer.speedGroundX; y24_8 = Q(y); - gPlayer.y = SIN_24_8(idx) * 24 + y24_8 - Q(28); + gPlayer.qWorldY = SIN_24_8(idx) * 24 + y24_8 - Q(28); gPlayer.speedAirY = 0; gCurTask->main = sub_8061AB0; - } else if ((x >= I(gPlayer.x)) && gPlayer.speedGroundX > Q_8_8(4) && !(gPlayer.moveState & MOVESTATE_IN_AIR) + } else if ((x >= I(gPlayer.qWorldX)) && gPlayer.speedGroundX > Q_8_8(4) && !(gPlayer.moveState & MOVESTATE_IN_AIR) && !(gPlayer.frameInput & gPlayerControls.jump)) { corkscrew->base.id |= 1; } else { @@ -96,16 +96,16 @@ void sub_8061AB0(void) return; } - idx = I((I(player->x) - x) * 930); + idx = I((I(player->qWorldX) - x) * 930); idx = (idx + 256) & ONE_CYCLE; - player->x += player->speedGroundX; + player->qWorldX += player->speedGroundX; y24_8 = Q(y); - player->y = SIN_24_8(idx) * 24 + y24_8 - Q(28); + player->qWorldY = SIN_24_8(idx) * 24 + y24_8 - Q(28); player->speedAirY = 0; - if ((I(player->x) - x) > 0x8C) { - player->x = Q(x + 0x8C); + if ((I(player->qWorldX) - x) > 0x8C) { + player->qWorldX = Q(x + 0x8C); if (!(player->moveState & MOVESTATE_4)) { player->charState = CHARSTATE_IN_CORKSCREW_3D_RUNNING_DOWN; @@ -156,12 +156,12 @@ void Task_8061C70(void) player->speedGroundX++; - player->x = x = Q(x + 0x8C); - player->y += player->speedGroundX; + player->qWorldX = x = Q(x + 0x8C); + player->qWorldY += player->speedGroundX; player->speedAirY = 0; - if ((I(player->y) - y) > 0xBE) { - player->y = Q(y + 0xBE); + if ((I(player->qWorldY) - y) > 0xBE) { + player->qWorldY = Q(y + 0xBE); if (!(player->moveState & MOVESTATE_4)) { player->charState = CHARSTATE_IN_CORKSCREW; @@ -210,7 +210,7 @@ void Task_8061DA4(void) return; } - if (I(player->x) - x > 0x1A8) { + if (I(player->qWorldX) - x > 0x1A8) { if (player->moveState & MOVESTATE_4) { player->transition = PLTRANS_PT2; } else { @@ -222,12 +222,12 @@ void Task_8061DA4(void) y += 190; - idx = I((I(player->x) - x) * 930); + idx = I((I(player->qWorldX) - x) * 930); idx = (idx + 768) & ONE_CYCLE; - player->x += player->speedGroundX; + player->qWorldX += player->speedGroundX; y24_8 = Q(y); - player->y = SIN_24_8(idx) * 24 + y24_8 - Q(28); + player->qWorldY = SIN_24_8(idx) * 24 + y24_8 - Q(28); player->speedAirY = 0; if (player->speedGroundX < corkscrew->unkC) { @@ -266,23 +266,23 @@ void Task_8061F60(void) s32 y = TO_WORLD_POS(corkscrew->base.me->y, regionY); if (PLAYER_IS_ALIVE) { - if ((x + (me->d.sData[0] * TILE_WIDTH) <= I(gPlayer.x) - && (x + (me->d.sData[0] * TILE_WIDTH) + (me->d.uData[2] * TILE_WIDTH) >= I(gPlayer.x))) - && (y + (me->d.sData[1] * TILE_WIDTH) <= I(gPlayer.y) - && y + (me->d.sData[1] * TILE_WIDTH) + (me->d.uData[3] * TILE_WIDTH) >= I(gPlayer.y))) { - if (x > I(gPlayer.x) && (corkscrew->base.id & 1)) { + if ((x + (me->d.sData[0] * TILE_WIDTH) <= I(gPlayer.qWorldX) + && (x + (me->d.sData[0] * TILE_WIDTH) + (me->d.uData[2] * TILE_WIDTH) >= I(gPlayer.qWorldX))) + && (y + (me->d.sData[1] * TILE_WIDTH) <= I(gPlayer.qWorldY) + && y + (me->d.sData[1] * TILE_WIDTH) + (me->d.uData[3] * TILE_WIDTH) >= I(gPlayer.qWorldY))) { + if (x > I(gPlayer.qWorldX) && (corkscrew->base.id & 1)) { s32 idx; s32 y24_8; gPlayer.transition = PLTRANS_CORKSCREW; - idx = ((((I(gPlayer.x) - x) * 930) >> 8) + 256) & ONE_CYCLE; - gPlayer.x += gPlayer.speedGroundX; + idx = ((((I(gPlayer.qWorldX) - x) * 930) >> 8) + 256) & ONE_CYCLE; + gPlayer.qWorldX += gPlayer.speedGroundX; y24_8 = Q(y); - gPlayer.y = SIN_24_8(idx) * 24 + y24_8 - Q(28); + gPlayer.qWorldY = SIN_24_8(idx) * 24 + y24_8 - Q(28); gPlayer.speedAirY = 0; gCurTask->main = Task_8062100; - } else if ((x <= I(gPlayer.x)) && gPlayer.speedGroundX < -Q_8_8(4) && !(gPlayer.moveState & MOVESTATE_IN_AIR) + } else if ((x <= I(gPlayer.qWorldX)) && gPlayer.speedGroundX < -Q_8_8(4) && !(gPlayer.moveState & MOVESTATE_IN_AIR) && !(gPlayer.frameInput & gPlayerControls.jump)) { corkscrew->base.id |= 1; } else { @@ -319,16 +319,16 @@ void Task_8062100(void) SET_MAP_ENTITY_NOT_INITIALIZED(me, corkscrew->base.spriteX); TaskDestroy(gCurTask); } else { - idx = I((I(player->x) - x) * 930); + idx = I((I(player->qWorldX) - x) * 930); idx = (idx + 256) & ONE_CYCLE; - player->x += player->speedGroundX; + player->qWorldX += player->speedGroundX; y24_8 = Q(y); - player->y = SIN_24_8(idx) * 24 + y24_8 - Q(28); + player->qWorldY = SIN_24_8(idx) * 24 + y24_8 - Q(28); player->speedAirY = 0; - if ((I(player->x) - x) < -288) { - player->x = Q(x + -288); + if ((I(player->qWorldX) - x) < -288) { + player->qWorldX = Q(x + -288); if (!(player->moveState & MOVESTATE_4)) { player->charState = CHARSTATE_IN_CORKSCREW_3D_RUNNING_UP; @@ -377,12 +377,12 @@ void Task_80622C8(void) } else { player->speedGroundX++; - player->x = Q(x - 288); - player->y += player->speedGroundX; + player->qWorldX = Q(x - 288); + player->qWorldY += player->speedGroundX; player->speedAirY = 0; - if ((I(player->y) - y) < -255) { - player->y = Q(y - 255); + if ((I(player->qWorldY) - y) < -255) { + player->qWorldY = Q(y - 255); if (!(player->moveState & MOVESTATE_4)) { player->charState = CHARSTATE_IN_CORKSCREW; @@ -431,7 +431,7 @@ void Task_8062414(void) return; } - if (I(player->x) - x < -424) { + if (I(player->qWorldX) - x < -424) { if (player->moveState & MOVESTATE_4) { player->transition = PLTRANS_PT2; } else { @@ -443,12 +443,12 @@ void Task_8062414(void) y -= 0xC3; - idx = I((I(player->x) - x) * 930); + idx = I((I(player->qWorldX) - x) * 930); idx = (idx + 768) & ONE_CYCLE; - player->x += player->speedGroundX; + player->qWorldX += player->speedGroundX; y24_8 = Q(y); - player->y = SIN_24_8(idx) * 24 + y24_8 - Q(28); + player->qWorldY = SIN_24_8(idx) * 24 + y24_8 - Q(28); player->speedAirY = 0; if (player->speedGroundX > -corkscrew->unkC) { @@ -512,16 +512,16 @@ s32 sub_806267C(s32 x, s32 y, s16 p2) s32 py; #ifndef NON_MATCHING - register s32 px asm("r0") = ((I(p->x) - x) * 930) >> 8; + register s32 px asm("r0") = ((I(p->qWorldX) - x) * 930) >> 8; #else - s32 px = ((I(p->x) - x) * 930) >> 8; + s32 px = ((I(p->qWorldX) - x) * 930) >> 8; #endif px = (px + p2) & ONE_CYCLE; - p->x += p->speedGroundX; + p->qWorldX += p->speedGroundX; py = Q(y); - p->y = SIN_24_8(px) * 24 + py - Q(28); + p->qWorldY = SIN_24_8(px) * 24 + py - Q(28); p->speedAirY = 0; diff --git a/src/game/interactables_1/gapped_loop.c b/src/game/interactables_1/gapped_loop.c index c9f20450b..5aaa8a0c0 100644 --- a/src/game/interactables_1/gapped_loop.c +++ b/src/game/interactables_1/gapped_loop.c @@ -30,13 +30,14 @@ static void Task_GappedLoopForwardsMain(void) s32 y = TO_WORLD_POS(me->y, regionY); if (PLAYER_IS_ALIVE) { - if (x <= I(gPlayer.x) && (x + me->d.uData[2] * 8) >= I(gPlayer.x)) { - if (y <= I(gPlayer.y) && (y + me->d.uData[3] * 8) >= I(gPlayer.y)) { - if (y <= I(gPlayer.y) && (y + me->d.uData[3] * 8) >= I(gPlayer.y)) { + if (x <= I(gPlayer.qWorldX) && (x + me->d.uData[2] * 8) >= I(gPlayer.qWorldX)) { + if (y <= I(gPlayer.qWorldY) && (y + me->d.uData[3] * 8) >= I(gPlayer.qWorldY)) { + if (y <= I(gPlayer.qWorldY) && (y + me->d.uData[3] * 8) >= I(gPlayer.qWorldY)) { if (gPlayer.speedGroundX > Q(3) && !(gPlayer.moveState & (MOVESTATE_FACING_LEFT | MOVESTATE_IN_AIR))) { gCurTask->main = Task_JumpSequenceForwards; gPlayer.moveState |= MOVESTATE_400000; - gappedLoop->playerAngle = sub_8004418(I(gPlayer.y - gappedLoop->unk10), I(gPlayer.x - gappedLoop->unkC)); + gappedLoop->playerAngle + = sub_8004418(I(gPlayer.qWorldY - gappedLoop->unk10), I(gPlayer.qWorldX - gappedLoop->unkC)); gappedLoop->spinSpeed = -8; } } @@ -73,8 +74,8 @@ static void Task_JumpSequenceForwards(void) gPlayer.rotation += gappedLoop->spinSpeed; r3 = ABS(Q(3) - gappedLoop->playerAngle) >> 4; - gPlayer.y = gappedLoop->unk10 + Q_2_14_TO_Q_24_8(SIN(gappedLoop->playerAngle) * (r3 + 135)); - gPlayer.x = gappedLoop->unkC + Q_2_14_TO_Q_24_8(COS(gappedLoop->playerAngle) * 135); + gPlayer.qWorldY = gappedLoop->unk10 + Q_2_14_TO_Q_24_8(SIN(gappedLoop->playerAngle) * (r3 + 135)); + gPlayer.qWorldX = gappedLoop->unkC + Q_2_14_TO_Q_24_8(COS(gappedLoop->playerAngle) * 135); x -= gCamera.x; y -= gCamera.y; @@ -102,14 +103,15 @@ static void Task_GappedLoopReverseMain(void) s32 y = TO_WORLD_POS(me->y, regionY); if (PLAYER_IS_ALIVE) { s32 base = (x + me->d.sData[0] * 8); - if (base <= I(gPlayer.x) && (base + me->d.uData[2] * 8) >= I(gPlayer.x)) { - if (y <= I(gPlayer.y) && (y + me->d.uData[3] * 8) >= I(gPlayer.y)) { - if (y <= I(gPlayer.y) && (y + me->d.uData[3] * 8) >= I(gPlayer.y)) { + if (base <= I(gPlayer.qWorldX) && (base + me->d.uData[2] * 8) >= I(gPlayer.qWorldX)) { + if (y <= I(gPlayer.qWorldY) && (y + me->d.uData[3] * 8) >= I(gPlayer.qWorldY)) { + if (y <= I(gPlayer.qWorldY) && (y + me->d.uData[3] * 8) >= I(gPlayer.qWorldY)) { if (gPlayer.speedGroundX < -Q(3) && (gPlayer.moveState & MOVESTATE_FACING_LEFT) && !(gPlayer.moveState & MOVESTATE_IN_AIR)) { gCurTask->main = Task_JumpSequenceReverse; gPlayer.moveState |= MOVESTATE_400000; - gappedLoop->playerAngle = sub_8004418(I(gPlayer.y - gappedLoop->unk10), I(gPlayer.x - gappedLoop->unkC)); + gappedLoop->playerAngle + = sub_8004418(I(gPlayer.qWorldY - gappedLoop->unk10), I(gPlayer.qWorldX - gappedLoop->unkC)); gappedLoop->spinSpeed = 8; } } @@ -146,8 +148,8 @@ static void Task_JumpSequenceReverse(void) gPlayer.rotation += gappedLoop->spinSpeed; r3 = ABS(Q(3) - gappedLoop->playerAngle) >> 4; - gPlayer.y = gappedLoop->unk10 + Q_2_14_TO_Q_24_8(SIN(gappedLoop->playerAngle) * (r3 + 135)); - gPlayer.x = gappedLoop->unkC + Q_2_14_TO_Q_24_8(COS(gappedLoop->playerAngle) * 135); + gPlayer.qWorldY = gappedLoop->unk10 + Q_2_14_TO_Q_24_8(SIN(gappedLoop->playerAngle) * (r3 + 135)); + gPlayer.qWorldX = gappedLoop->unkC + Q_2_14_TO_Q_24_8(COS(gappedLoop->playerAngle) * 135); x -= gCamera.x; y -= gCamera.y; diff --git a/src/game/interactables_1/incline_ramp.c b/src/game/interactables_1/incline_ramp.c index 4cfdf21c1..46fa9372d 100644 --- a/src/game/interactables_1/incline_ramp.c +++ b/src/game/interactables_1/incline_ramp.c @@ -29,8 +29,9 @@ static void Task_InclineRamp(void) screenY = TO_WORLD_POS(me->y, ramp->base.regionX); moveState = gPlayer.moveState; - if (!(moveState & MOVESTATE_DEAD) && (screenX <= I(gPlayer.x)) && ((screenX + me->d.uData[2] * TILE_WIDTH) >= I(gPlayer.x)) - && (screenY <= I(gPlayer.y)) && ((screenY + me->d.uData[3] * TILE_WIDTH) >= I(gPlayer.y)) && (!(moveState & MOVESTATE_IN_AIR))) { + if (!(moveState & MOVESTATE_DEAD) && (screenX <= I(gPlayer.qWorldX)) && ((screenX + me->d.uData[2] * TILE_WIDTH) >= I(gPlayer.qWorldX)) + && (screenY <= I(gPlayer.qWorldY)) && ((screenY + me->d.uData[3] * TILE_WIDTH) >= I(gPlayer.qWorldY)) + && (!(moveState & MOVESTATE_IN_AIR))) { // spriteY == me->d.uData[0]; (set in initSprite, below) if (((s8)ramp->base.id) == 0) { if (gPlayer.speedAirX > Q(4)) { diff --git a/src/game/interactables_1/rotating_handle.c b/src/game/interactables_1/rotating_handle.c index 3f8a60daf..921b30402 100644 --- a/src/game/interactables_1/rotating_handle.c +++ b/src/game/interactables_1/rotating_handle.c @@ -102,7 +102,7 @@ static void Task_Idle(void) if (gPlayer.speedAirX > 0) { gPlayer.moveState &= ~MOVESTATE_FACING_LEFT; - if (I(gPlayer.y) > y) { + if (I(gPlayer.qWorldY) > y) { s->frameFlags |= SPRITE_FLAG_MASK_X_FLIP; gPlayer.charState = CHARSTATE_GRABBING_HANDLE_A; rotatingHandle->unk40 = 0; @@ -113,7 +113,7 @@ static void Task_Idle(void) } } else { gPlayer.moveState |= 1; - if (I(gPlayer.y) > y) { + if (I(gPlayer.qWorldY) > y) { s->frameFlags &= ~SPRITE_FLAG_MASK_X_FLIP; gPlayer.charState = CHARSTATE_GRABBING_HANDLE_A; rotatingHandle->unk40 = 2; @@ -124,8 +124,8 @@ static void Task_Idle(void) } } - gPlayer.x = Q(x); - gPlayer.y = Q(y); + gPlayer.qWorldX = Q(x); + gPlayer.qWorldY = Q(y); gPlayer.variant = 0; gPlayer.unk6C = 1; m4aSongNumStart(SE_SPEED_BOOSTER); @@ -192,23 +192,23 @@ NONMATCH("asm/non_matching/game/interactables_1/Task_Rotating.inc", static void case 0: temp2 = (0x20 - temp) & cycle; sin = SIN(temp); - gPlayer.x += sin >> 1; + gPlayer.qWorldX += sin >> 1; cos = COS(temp); - gPlayer.y += cos >> 1; + gPlayer.qWorldY += cos >> 1; break; case 1: temp2 = (temp + 0x20) & cycle; sin = SIN(temp); - gPlayer.x += sin >> 1; + gPlayer.qWorldX += sin >> 1; cos = COS(temp); - gPlayer.y -= cos >> 1; + gPlayer.qWorldY -= cos >> 1; break; case 2: temp2 = (temp + 0x1E0) & cycle; sin = SIN(temp); - gPlayer.x -= sin >> 1; + gPlayer.qWorldX -= sin >> 1; cos = COS(temp); - gPlayer.y += cos >> 1; + gPlayer.qWorldY += cos >> 1; break; case 3: { @@ -219,9 +219,9 @@ NONMATCH("asm/non_matching/game/interactables_1/Task_Rotating.inc", static void #endif temp2 = (r1 - temp) & cycle; sin = SIN(temp); - gPlayer.x -= sin >> 1; + gPlayer.qWorldX -= sin >> 1; cos = COS(temp); - gPlayer.y -= cos >> 1; + gPlayer.qWorldY -= cos >> 1; break; } default: @@ -253,8 +253,8 @@ NONMATCH("asm/non_matching/game/interactables_1/Task_Rotating.inc", static void s->prevVariant = -1; gPlayer.variant = r2; gPlayer.unk6C = 1; - gPlayer.x = Q(x); - gPlayer.y = Q(y); + gPlayer.qWorldX = Q(x); + gPlayer.qWorldY = Q(y); gPlayer.speedAirX = 0; gPlayer.speedAirY = 0; } diff --git a/src/game/interactables_1/spikes.c b/src/game/interactables_1/spikes.c index 5b74a3f16..d5b8a006e 100644 --- a/src/game/interactables_1/spikes.c +++ b/src/game/interactables_1/spikes.c @@ -279,7 +279,7 @@ static void sub_805FBA0(void) gravityInverted = GRAVITY_IS_INVERTED; if (gravityInverted) { if (r4 & 0x10000) { - gPlayer.y += (r4 << 24) >> 16; + gPlayer.qWorldY += (r4 << 24) >> 16; gPlayer.speedAirY = 0; gPlayer.moveState &= (~MOVESTATE_8); gPlayer.moveState |= MOVESTATE_IN_AIR; @@ -289,7 +289,7 @@ static void sub_805FBA0(void) if (r4 & 0x20000) { if (sub_8060D08(s, screenX, screenY, &gPlayer) & 0x10000) { - gPlayer.y += (r4 << 24) >> 16; + gPlayer.qWorldY += (r4 << 24) >> 16; gPlayer.speedAirY = 0; gPlayer.moveState |= MOVESTATE_8; gPlayer.moveState &= ~MOVESTATE_IN_AIR; @@ -300,13 +300,13 @@ static void sub_805FBA0(void) // _0805FCC8 if (r4 & 0x10000) { if (sub_8060D08(s, screenX, screenY, &gPlayer) & 0x10000) { - gPlayer.y += (r4 << 24) >> 16; + gPlayer.qWorldY += (r4 << 24) >> 16; gPlayer.speedAirY = gravityInverted; // Q_8_8(0.5) instead? } } if (r4 & 0x20000) { - gPlayer.y += (r4 << 24) >> 16; + gPlayer.qWorldY += (r4 << 24) >> 16; gPlayer.speedAirY = Q_8_8(0); } } @@ -319,7 +319,7 @@ static void sub_805FBA0(void) register u16 iaIndex asm("r0"); #endif gPlayer.moveState |= MOVESTATE_20; - gPlayer.x += (s16)((u32)r4 & 0xFF00); + gPlayer.qWorldX += (s16)((u32)r4 & 0xFF00); gPlayer.speedAirX = 0; gPlayer.speedGroundX = 0; @@ -338,7 +338,7 @@ static void sub_805FBA0(void) register u16 iaIndex asm("r0"); #endif gPlayer.moveState |= MOVESTATE_20; - gPlayer.x += (s16)((u32)r4 & 0xFF00); + gPlayer.qWorldX += (s16)((u32)r4 & 0xFF00); gPlayer.speedAirX = 0; gPlayer.speedGroundX = 0; @@ -533,9 +533,9 @@ bool32 sub_80601F8(Sprite *s, MapEntity *me, Sprite_Spikes *spikes, Player *play } if (!GRAVITY_IS_INVERTED) { - player->y = Q(screenY + s->hitboxes[0].top - sp00[3]); + player->qWorldY = Q(screenY + s->hitboxes[0].top - sp00[3]); } else { - player->y = Q(screenY + s->hitboxes[0].bottom + sp00[3]); + player->qWorldY = Q(screenY + s->hitboxes[0].bottom + sp00[3]); } if (sub_800CBA4(player)) { @@ -572,7 +572,7 @@ bool32 sub_80601F8(Sprite *s, MapEntity *me, Sprite_Spikes *spikes, Player *play if (gravityInverted) { if (flags & 0x20000) { player->speedAirY = 0; - player->y = Q(screenY + s->hitboxes[0].bottom + player->spriteOffsetY); + player->qWorldY = Q(screenY + s->hitboxes[0].bottom + player->spriteOffsetY); player->moveState |= MOVESTATE_8; player->moveState &= ~MOVESTATE_IN_AIR; player->unk3C = s; @@ -589,7 +589,7 @@ bool32 sub_80601F8(Sprite *s, MapEntity *me, Sprite_Spikes *spikes, Player *play flags = sub_8060D08(s, screenX, screenY, player); if (flags & 0x10000) { - player->y += Q_8_8(flags); + player->qWorldY += Q_8_8(flags); player->speedAirY = 0; // _080603BC @@ -618,7 +618,7 @@ bool32 sub_80601F8(Sprite *s, MapEntity *me, Sprite_Spikes *spikes, Player *play } else if (flags & 0x0C0000) { // _08060404 player->moveState |= MOVESTATE_20; - player->x += (s16)(flags & 0xFF00); + player->qWorldX += (s16)(flags & 0xFF00); player->speedAirX = 0; player->speedGroundX = 0; } @@ -643,7 +643,7 @@ static bool32 sub_8060440(Sprite *s, MapEntity *me, Sprite_Spikes *spikes, Playe u32 flags = sub_800CCB8(s, screenX, screenY, player); if (flags) { if ((flags & 0x20000) && !GRAVITY_IS_INVERTED) { - player->y = Q((screenY + s->hitboxes[0].bottom) + player->spriteOffsetY + 1); + player->qWorldY = Q((screenY + s->hitboxes[0].bottom) + player->spriteOffsetY + 1); player->speedAirY = 0; player->speedGroundX = 0; @@ -653,7 +653,7 @@ static bool32 sub_8060440(Sprite *s, MapEntity *me, Sprite_Spikes *spikes, Playe } } else if ((flags & 0x10000) && GRAVITY_IS_INVERTED) { // _080604D0 - player->y = Q((screenY + s->hitboxes[0].top) - player->spriteOffsetY - 1); + player->qWorldY = Q((screenY + s->hitboxes[0].top) - player->spriteOffsetY - 1); player->speedAirY = 0; player->speedGroundX = 0; @@ -663,7 +663,7 @@ static bool32 sub_8060440(Sprite *s, MapEntity *me, Sprite_Spikes *spikes, Playe } } else if (flags & 0xC0000) { player->moveState |= MOVESTATE_20; - player->x += (s16)(flags & 0xFF00); + player->qWorldX += (s16)(flags & 0xFF00); player->speedAirX = 0; player->speedGroundX = 0; } @@ -745,9 +745,9 @@ static bool32 sub_8060554(Sprite *s, MapEntity *me, Sprite_Spikes *spikes, Playe s8 sp00[4] = { -v, 1 - player->spriteOffsetY, v, player->spriteOffsetY - 1 }; if (!GRAVITY_IS_INVERTED) { - player->y = Q((screenY + s->hitboxes[0].top) - sp00[3]); + player->qWorldY = Q((screenY + s->hitboxes[0].top) - sp00[3]); } else { - player->y = Q((screenY + s->hitboxes[0].bottom) + sp00[3]); + player->qWorldY = Q((screenY + s->hitboxes[0].bottom) + sp00[3]); } if (sub_800CBA4(player)) { m4aSongNumStart(SE_SPIKES); @@ -768,7 +768,7 @@ static bool32 sub_8060554(Sprite *s, MapEntity *me, Sprite_Spikes *spikes, Playe } } else if (flags & 0xC0000) { player->moveState |= MOVESTATE_20; - player->x += (s16)(flags & 0xFF00); + player->qWorldX += (s16)(flags & 0xFF00); player->speedAirX = 0; player->speedGroundX = 0; } @@ -785,7 +785,7 @@ static bool32 sub_8060554(Sprite *s, MapEntity *me, Sprite_Spikes *spikes, Playe return TRUE; } } else if ((flags & 0x20000) && GRAVITY_IS_INVERTED) { - player->y = Q(screenY + s->hitboxes[0].bottom + player->spriteOffsetY); + player->qWorldY = Q(screenY + s->hitboxes[0].bottom + player->spriteOffsetY); player->moveState |= MOVESTATE_8; player->moveState &= ~MOVESTATE_IN_AIR; player->unk3C = s; @@ -797,7 +797,7 @@ static bool32 sub_8060554(Sprite *s, MapEntity *me, Sprite_Spikes *spikes, Playe } } else if (flags & 0xC0000) { player->moveState |= MOVESTATE_20; - player->x += (s16)(flags & 0xFF00); + player->qWorldX += (s16)(flags & 0xFF00); player->speedAirX = 0; player->speedGroundX = 0; } @@ -912,9 +912,9 @@ static bool32 sub_80609B4(Sprite *s, MapEntity *me, Sprite_Spikes *spikes, Playe s8 sp00[4] = { -v, 1 - player->spriteOffsetY, v, player->spriteOffsetY - 1 }; if (!GRAVITY_IS_INVERTED) { - player->y = Q(s->hitboxes[0].bottom + screenY - sp00[1]); + player->qWorldY = Q(s->hitboxes[0].bottom + screenY - sp00[1]); } else { - player->y = Q(s->hitboxes[0].top + screenY + sp00[1]); + player->qWorldY = Q(s->hitboxes[0].top + screenY + sp00[1]); } if (!sub_800CBA4(player)) { return TRUE; diff --git a/src/game/interactables_1/stage_goal.c b/src/game/interactables_1/stage_goal.c index f4ae51989..e96caca63 100644 --- a/src/game/interactables_1/stage_goal.c +++ b/src/game/interactables_1/stage_goal.c @@ -8,7 +8,7 @@ #include "game/entity.h" #include "game/stage/player.h" #include "game/stage/camera.h" -#include "game/stage/game_2.h" +#include "game/stage/grind_effect_2.h" #include "game/interactables_1/stage_goal.h" @@ -133,12 +133,12 @@ static void Task_StageGoalToggleMain(void) s32 y = TO_WORLD_POS(me->y, regionY); if (IS_MULTI_PLAYER) { - if (x <= I(gPlayer.x) && !(gPlayer.moveState & (MOVESTATE_GOAL_REACHED | MOVESTATE_8))) { + if (x <= I(gPlayer.qWorldX) && !(gPlayer.moveState & (MOVESTATE_GOAL_REACHED | MOVESTATE_8))) { gPlayer.transition = PLTRANS_REACHED_GOAL; gStageGoalX = x; StageGoalToggle_HandleMultiplayerFinish(); } - } else if (x <= I(gPlayer.x) && !(gPlayer.moveState & MOVESTATE_GOAL_REACHED)) { + } else if (x <= I(gPlayer.qWorldX) && !(gPlayer.moveState & MOVESTATE_GOAL_REACHED)) { gPlayer.transition = PLTRANS_REACHED_GOAL; gStageFlags |= STAGE_FLAG__DISABLE_PAUSE_MENU | STAGE_FLAG__ACT_START; gStageGoalX = x; @@ -158,7 +158,7 @@ static void Task_StageGoalToggleMain(void) if (extraScore != 0) { INCREMENT_SCORE(extraScore); - CreateStageGoalBonusPointsAnim(I(gPlayer.x), I(gPlayer.y), extraScore); + CreateStageGoalBonusPointsAnim(I(gPlayer.qWorldX), I(gPlayer.qWorldY), extraScore); } } diff --git a/src/game/interactables_1/toggle_player_layer.c b/src/game/interactables_1/toggle_player_layer.c index 1487bb448..7529caa46 100644 --- a/src/game/interactables_1/toggle_player_layer.c +++ b/src/game/interactables_1/toggle_player_layer.c @@ -36,8 +36,8 @@ static void Task_MapEntity_Toggle_PlayerLayer(void) screenX = TO_WORLD_POS(spriteX, regionX); screenY = TO_WORLD_POS(me->y, regionY); - if ((screenX <= I(gPlayer.x)) && (screenX + (me->width * TILE_WIDTH) >= I(gPlayer.x)) && (screenY <= I(gPlayer.y)) - && (screenY + (me->height * TILE_WIDTH) >= I(gPlayer.y))) { + if ((screenX <= I(gPlayer.qWorldX)) && (screenX + (me->width * TILE_WIDTH) >= I(gPlayer.qWorldX)) && (screenY <= I(gPlayer.qWorldY)) + && (screenY + (me->height * TILE_WIDTH) >= I(gPlayer.qWorldY))) { // The interactable-index determines, whether the layer we switch to // should be the foreground- or the background layer. diff --git a/src/game/interactables_1/windmill.c b/src/game/interactables_1/windmill.c index bcce94f05..2430fdde5 100644 --- a/src/game/interactables_1/windmill.c +++ b/src/game/interactables_1/windmill.c @@ -123,8 +123,8 @@ static void Task_WindmillMain(void) s->x = screenX + ((COS(CLAMP_SIN_PERIOD(sinPeriod)) * ((j + 1) * 16 - 8)) >> 14); s->y = screenY + ((SIN(CLAMP_SIN_PERIOD(sinPeriod)) * ((j + 1) * 16 - 8)) >> 14); transform->rotation = CLAMP_SIN_PERIOD(sinPeriod); - transform->width = 256; - transform->height = 256; + transform->qScaleX = 256; + transform->qScaleY = 256; transform->x = s->x; transform->y = s->y; diff --git a/src/game/interactables_2/105.c b/src/game/interactables_2/105.c index 416a81636..638987c2b 100644 --- a/src/game/interactables_2/105.c +++ b/src/game/interactables_2/105.c @@ -54,8 +54,8 @@ static bool32 sub_80809B8(Sprite_IA105 *ia105) screenX = (ia105->posX + ia105->offsetX) - gCamera.x; screenY = (ia105->posY + ia105->offsetY) - gCamera.y; - playerX = I(gPlayer.x) - gCamera.x; - playerY = I(gPlayer.y) - gCamera.y; + playerX = I(gPlayer.qWorldX) - gCamera.x; + playerY = I(gPlayer.qWorldY) - gCamera.y; someX = ia105->width - ia105->offsetX; someY = ia105->height - ia105->offsetY; diff --git a/src/game/interactables_2/egg_utopia/cannon.c b/src/game/interactables_2/egg_utopia/cannon.c index 5f5cc0cc3..b89ec98bd 100644 --- a/src/game/interactables_2/egg_utopia/cannon.c +++ b/src/game/interactables_2/egg_utopia/cannon.c @@ -105,12 +105,12 @@ static void sub_807E384(Sprite_Cannon *cannon) m4aSongNumStart(SE_SPIN_ATTACK); if (cannon->unk68 == 0) { - gPlayer.x = Q(cannon->x + 40); - gPlayer.y = Q(cannon->y); + gPlayer.qWorldX = Q(cannon->x + 40); + gPlayer.qWorldY = Q(cannon->y); gPlayer.moveState |= MOVESTATE_FACING_LEFT; } else { - gPlayer.x = Q(cannon->x - 40); - gPlayer.y = Q(cannon->y); + gPlayer.qWorldX = Q(cannon->x - 40); + gPlayer.qWorldY = Q(cannon->y); gPlayer.moveState &= ~MOVESTATE_FACING_LEFT; } @@ -128,8 +128,8 @@ static void sub_807E408(Sprite_Cannon *cannon) gPlayer.moveState &= ~MOVESTATE_400000; gPlayer.transition = PLTRANS_PT5; - gPlayer.x += COS_24_8(cannon->unk6A) * 0x20; - gPlayer.y += SIN_24_8(cannon->unk6A) * 0x20; + gPlayer.qWorldX += COS_24_8(cannon->unk6A) * 0x20; + gPlayer.qWorldY += SIN_24_8(cannon->unk6A) * 0x20; gPlayer.speedAirX = COS_24_8(cannon->unk6A) * 0xF; gPlayer.speedAirY = SIN_24_8(cannon->unk6A) * 0xF; @@ -151,17 +151,17 @@ static bool32 sub_807E4E4(Sprite_Cannon *cannon) u8 temp = 0; s32 val = Q(cannon->x); - if (gPlayer.x > val) { - gPlayer.x -= Q(1); + if (gPlayer.qWorldX > val) { + gPlayer.qWorldX -= Q(1); - if (gPlayer.x < val) { - gPlayer.x = val; + if (gPlayer.qWorldX < val) { + gPlayer.qWorldX = val; } - } else if (gPlayer.x < val) { - gPlayer.x += Q(1); + } else if (gPlayer.qWorldX < val) { + gPlayer.qWorldX += Q(1); - if (gPlayer.x > val) { - gPlayer.x = val; + if (gPlayer.qWorldX > val) { + gPlayer.qWorldX = val; } } else { @@ -170,17 +170,17 @@ static bool32 sub_807E4E4(Sprite_Cannon *cannon) val = Q(cannon->y); - if (gPlayer.y > val) { - gPlayer.y -= Q(1); + if (gPlayer.qWorldY > val) { + gPlayer.qWorldY -= Q(1); - if (gPlayer.y < val) { - gPlayer.y = val; + if (gPlayer.qWorldY < val) { + gPlayer.qWorldY = val; } - } else if (gPlayer.y < val) { - gPlayer.y += Q(1); + } else if (gPlayer.qWorldY < val) { + gPlayer.qWorldY += Q(1); - if (gPlayer.y > val) { - gPlayer.y = val; + if (gPlayer.qWorldY > val) { + gPlayer.qWorldY = val; } } else { @@ -238,8 +238,8 @@ static void sub_807E5F0(Sprite_Cannon *cannon) s->y = cannon->y - gCamera.y; transform.rotation = cannon->unk6A; - transform.width = +Q(1); - transform.height = +Q(1); + transform.qScaleX = +Q(1); + transform.qScaleY = +Q(1); transform.x = s->x; transform.y = s->y; @@ -277,8 +277,8 @@ NONMATCH("asm/non_matching/game/interactables_2/egg_utopia/sub_807E66C.inc", sta x = r3->x - gCamera.x; y = r3->y - gCamera.y; - playerX = I(gPlayer.x) - gCamera.x; - playerY = I(gPlayer.y) - gCamera.y; + playerX = I(gPlayer.qWorldX) - gCamera.x; + playerY = I(gPlayer.qWorldY) - gCamera.y; // gUnknown_03005AF0.s.hitboxes[0] s-hitboxes[0], x, y, gUnknown_03005AF0.s.hitboxes[0])) { diff --git a/src/game/interactables_2/egg_utopia/flying_handle.c b/src/game/interactables_2/egg_utopia/flying_handle.c index 993680599..5bc6704d3 100644 --- a/src/game/interactables_2/egg_utopia/flying_handle.c +++ b/src/game/interactables_2/egg_utopia/flying_handle.c @@ -222,8 +222,8 @@ static bool32 IsPlayerTouching(Sprite_FlyingHandle *flyingHandle) } else { s16 x = I(flyingHandle->unk44 + flyingHandle->unk4C) - gCamera.x; s16 y = I(flyingHandle->unk48 + flyingHandle->unk50) - gCamera.y; - s16 playerX = (I(gPlayer.x) - gCamera.x); - s16 playerY = (I(gPlayer.y) - gCamera.y); + s16 playerX = (I(gPlayer.qWorldX) - gCamera.x); + s16 playerY = (I(gPlayer.qWorldY) - gCamera.y); s16 dX = x - playerX; s16 dY = y - playerY; if (dX * dX + dY * dY <= (16 * 16)) { @@ -301,11 +301,11 @@ static void sub_807F7D0(Sprite_FlyingHandle *flyingHandle) u32 r1 = player->moveState & MOVESTATE_FACING_LEFT; #endif if (r1) { - player->x = (flyingHandle->unk44 + flyingHandle->unk4C) + Q(4.0); - player->y = (flyingHandle->unk48 + flyingHandle->unk50) + Q(20.0); + player->qWorldX = (flyingHandle->unk44 + flyingHandle->unk4C) + Q(4.0); + player->qWorldY = (flyingHandle->unk48 + flyingHandle->unk50) + Q(20.0); } else { - player->x = (flyingHandle->unk44 + flyingHandle->unk4C) - Q(4.0); - player->y = (flyingHandle->unk48 + flyingHandle->unk50) + Q(20.0); + player->qWorldX = (flyingHandle->unk44 + flyingHandle->unk4C) - Q(4.0); + player->qWorldY = (flyingHandle->unk48 + flyingHandle->unk50) + Q(20.0); } } diff --git a/src/game/interactables_2/egg_utopia/gravity_toggle.c b/src/game/interactables_2/egg_utopia/gravity_toggle.c index 41f1494eb..db99316ca 100644 --- a/src/game/interactables_2/egg_utopia/gravity_toggle.c +++ b/src/game/interactables_2/egg_utopia/gravity_toggle.c @@ -108,8 +108,8 @@ static bool32 AlivePlayerIsInToggle(Sprite_GravityToggle *toggle) screenLeft = (toggle->x + toggle->left) - gCamera.x; screenTop = (toggle->y + toggle->top) - gCamera.y; - playerX = I(gPlayer.x) - gCamera.x; - playerY = I(gPlayer.y) - gCamera.y; + playerX = I(gPlayer.qWorldX) - gCamera.x; + playerY = I(gPlayer.qWorldY) - gCamera.y; if ((screenLeft <= playerX) && ((screenLeft + toggle->width) >= playerX) && (screenTop <= playerY) && ((screenTop + toggle->height) >= playerY)) { diff --git a/src/game/interactables_2/egg_utopia/launcher.c b/src/game/interactables_2/egg_utopia/launcher.c index 0f1042a0e..6c3544b1c 100644 --- a/src/game/interactables_2/egg_utopia/launcher.c +++ b/src/game/interactables_2/egg_utopia/launcher.c @@ -304,8 +304,8 @@ static bool32 sub_807DDF0(Sprite_EggUtopia_Launcher *launcher) someX = I(launcher->unk54) - gCamera.x; someY = I(launcher->unk58) - gCamera.y; - playerX = I(gPlayer.x) - gCamera.x; - playerY = I(gPlayer.y) - gCamera.y; + playerX = I(gPlayer.qWorldX) - gCamera.x; + playerY = I(gPlayer.qWorldY) - gCamera.y; if ((someX - 2 * TILE_WIDTH <= playerX) && (someX + 2 * TILE_WIDTH >= playerX) && (someY - 2 * TILE_WIDTH <= playerY) && (someY + 2 * TILE_WIDTH >= playerY)) @@ -389,23 +389,23 @@ static void sub_807DFBC(Sprite_EggUtopia_Launcher *launcher) if (PLAYER_IS_ALIVE && launcher->unk48) { switch (launcher->kind) { case LAUNCHER_KIND(LAUN_DIR_LEFT, LAUN_GRAVITY_DOWN): { - gPlayer.x = launcher->unk54 - Q(8); - gPlayer.y = launcher->unk58 - Q(16); + gPlayer.qWorldX = launcher->unk54 - Q(8); + gPlayer.qWorldY = launcher->unk58 - Q(16); } break; case LAUNCHER_KIND(LAUN_DIR_RIGHT, LAUN_GRAVITY_DOWN): { - gPlayer.x = launcher->unk54 + Q(8); - gPlayer.y = launcher->unk58 - Q(16); + gPlayer.qWorldX = launcher->unk54 + Q(8); + gPlayer.qWorldY = launcher->unk58 - Q(16); } break; case LAUNCHER_KIND(LAUN_DIR_LEFT, LAUN_GRAVITY_UP): { - gPlayer.x = launcher->unk54 - Q(8); - gPlayer.y = launcher->unk58 + Q(16); + gPlayer.qWorldX = launcher->unk54 - Q(8); + gPlayer.qWorldY = launcher->unk58 + Q(16); } break; case LAUNCHER_KIND(LAUN_DIR_RIGHT, LAUN_GRAVITY_UP): { - gPlayer.x = launcher->unk54 + Q(8); - gPlayer.y = launcher->unk58 + Q(16); + gPlayer.qWorldX = launcher->unk54 + Q(8); + gPlayer.qWorldY = launcher->unk58 + Q(16); } break; } } diff --git a/src/game/interactables_2/egg_utopia/pole.c b/src/game/interactables_2/egg_utopia/pole.c index f0d2fd825..bc62eb59c 100644 --- a/src/game/interactables_2/egg_utopia/pole.c +++ b/src/game/interactables_2/egg_utopia/pole.c @@ -78,9 +78,9 @@ static void Task_807EA8C(void) } if (GRAVITY_IS_INVERTED) { - gPlayer.y -= Q(1); + gPlayer.qWorldY -= Q(1); } else { - gPlayer.y += Q(1); + gPlayer.qWorldY += Q(1); } if (gPlayer.frameInput & gPlayerControls.jump) { @@ -133,8 +133,8 @@ static bool32 PlayerTouchesPole(Sprite_Pole *pole) poleScreenX = (pole->worldX + pole->left) - gCamera.x; poleScreenY = (pole->worldY + pole->top) - gCamera.y; - playerScreenX = I(gPlayer.x) - gCamera.x; - playerScreenY = I(gPlayer.y) - gCamera.y; + playerScreenX = I(gPlayer.qWorldX) - gCamera.x; + playerScreenY = I(gPlayer.qWorldY) - gCamera.y; if (poleScreenX <= playerScreenX && poleScreenX + pole->width >= playerScreenX) { if (poleScreenY <= playerScreenY && poleScreenY + pole->height >= playerScreenY) { @@ -186,7 +186,7 @@ static void Pole_TransitionPlayerSliding(Sprite_Pole *pole) { gPlayer.moveState |= MOVESTATE_400000; gPlayer.charState = CHARSTATE_POLE; - gPlayer.x = Q(pole->middleX); + gPlayer.qWorldX = Q(pole->middleX); gPlayer.speedGroundX = 0; gPlayer.speedAirX = 0; gPlayer.speedAirY = 0; diff --git a/src/game/interactables_2/egg_utopia/speeding_platform.c b/src/game/interactables_2/egg_utopia/speeding_platform.c index 2eaca252f..7c1786f3f 100644 --- a/src/game/interactables_2/egg_utopia/speeding_platform.c +++ b/src/game/interactables_2/egg_utopia/speeding_platform.c @@ -151,8 +151,8 @@ static void sub_807FB1C(Sprite_SpeedingPlatform *platform) platform->unk48 += platform->unk5A; if (PLAYER_IS_ALIVE && platform->unk4C) { - gPlayer.x = platform->unk50 + (Q(platform->x) + platform->unk44); - gPlayer.y = platform->unk52 + (Q(platform->y) + platform->unk48) - Q(gPlayer.spriteOffsetY); + gPlayer.qWorldX = platform->unk50 + (Q(platform->x) + platform->unk44); + gPlayer.qWorldY = platform->unk52 + (Q(platform->y) + platform->unk48) - Q(gPlayer.spriteOffsetY); platform->unk50 += gPlayer.speedAirX; platform->unk52 += gPlayer.speedAirY; } @@ -191,7 +191,7 @@ static bool32 sub_807FC9C(Sprite_SpeedingPlatform *platform) if (sub_807FD0C(platform) != 2) { s16 x = platform->x + I(platform->unk44) - gCamera.x - 27; - s16 playerX = I(gPlayer.x) - gCamera.x; + s16 playerX = I(gPlayer.qWorldX) - gCamera.x; if (x <= playerX && (x + 54) >= playerX) { return TRUE; @@ -210,13 +210,13 @@ static u32 sub_807FD0C(Sprite_SpeedingPlatform *platform) if (temp != 0) { if (temp & 0x10000) { - gPlayer.y += Q_8_8(temp); + gPlayer.qWorldY += Q_8_8(temp); gPlayer.speedAirY = 0; return 2; } if (temp & 0x40000) { - gPlayer.x += (s16)(temp & 0xFF00); + gPlayer.qWorldX += (s16)(temp & 0xFF00); gPlayer.speedAirX = 0; gPlayer.speedGroundX = 0; gPlayer.moveState |= MOVESTATE_20; @@ -224,7 +224,7 @@ static u32 sub_807FD0C(Sprite_SpeedingPlatform *platform) } if (temp & 0x80000) { - gPlayer.x += (s16)(temp & 0xFF00); + gPlayer.qWorldX += (s16)(temp & 0xFF00); gPlayer.speedAirX = 0; gPlayer.speedGroundX = 0; gPlayer.moveState |= MOVESTATE_20; @@ -232,7 +232,7 @@ static u32 sub_807FD0C(Sprite_SpeedingPlatform *platform) } if (temp & 0x20000) { - gPlayer.y += Q_8_8(temp); + gPlayer.qWorldY += Q_8_8(temp); gPlayer.speedAirY = 0; return 1; } @@ -268,8 +268,8 @@ static void TaskDestructor_Interactable097(struct Task *t) static void sub_807FE34(Sprite_SpeedingPlatform *platform) { - platform->unk50 = gPlayer.x - (Q(platform->x) + platform->unk44); - platform->unk52 = gPlayer.y - (Q(platform->y) + platform->unk48) + Q(gPlayer.spriteOffsetY); + platform->unk50 = gPlayer.qWorldX - (Q(platform->x) + platform->unk44); + platform->unk52 = gPlayer.qWorldY - (Q(platform->y) + platform->unk48) + Q(gPlayer.spriteOffsetY); platform->unk4C = TRUE; m4aSongNumStart(SE_288); gCurTask->main = sub_807FF20; diff --git a/src/game/interactables_2/hot_crater/crane.c b/src/game/interactables_2/hot_crater/crane.c index 446f8ebd6..fca820b41 100644 --- a/src/game/interactables_2/hot_crater/crane.c +++ b/src/game/interactables_2/hot_crater/crane.c @@ -607,8 +607,8 @@ static void sub_80742A8(Sprite_HCCrane *crane) if (cs->unk4 & 0x1) { transform.rotation = cs->unk14; - transform.width = +Q(1); - transform.height = +Q(1); + transform.qScaleX = +Q(1); + transform.qScaleY = +Q(1); transform.x = cs->s->x; transform.y = cs->s->y; @@ -628,8 +628,8 @@ static bool32 sub_807432C(Sprite_HCCrane *crane) if ((gPlayer.moveState & MOVESTATE_IN_AIR) && (gPlayer.speedAirY > 0)) { s16 screenX = I(crane->cs[7].screenX); s16 screenY = I(crane->cs[7].screenY); - s16 playerX = I(gPlayer.x) - gCamera.x; - s16 playerY = I(gPlayer.y) - gCamera.y; + s16 playerX = I(gPlayer.qWorldX) - gCamera.x; + s16 playerY = I(gPlayer.qWorldY) - gCamera.y; if (((screenX - 24) <= playerX) && ((screenX + 24) >= playerX) && ((screenY - 24) <= playerY) && ((screenY + 24) >= playerY)) { return TRUE; @@ -733,12 +733,12 @@ static bool32 sub_80744E0(Sprite_HCCrane *crane, u16 index, s16 p2) static void sub_8074550(Sprite_HCCrane *crane) { if (!(gPlayer.moveState & MOVESTATE_DEAD) && (crane->unk1B8.unk0 != 0)) { - gPlayer.y = crane->cs[8].screenY + Q(gCamera.y + 24); + gPlayer.qWorldY = crane->cs[8].screenY + Q(gCamera.y + 24); if (gPlayer.moveState & MOVESTATE_FACING_LEFT) { - gPlayer.x = crane->cs[8].screenX + Q(gCamera.x + 6); + gPlayer.qWorldX = crane->cs[8].screenX + Q(gCamera.x + 6); } else { - gPlayer.x = crane->cs[8].screenX + Q(gCamera.x - 6); + gPlayer.qWorldX = crane->cs[8].screenX + Q(gCamera.x - 6); } } } diff --git a/src/game/interactables_2/hot_crater/dash_ring.c b/src/game/interactables_2/hot_crater/dash_ring.c index 1f5576b0d..7a273baf3 100644 --- a/src/game/interactables_2/hot_crater/dash_ring.c +++ b/src/game/interactables_2/hot_crater/dash_ring.c @@ -175,8 +175,8 @@ static void DashRing_SetPlayerSpeedAndDir(Sprite_DashRing *ring) gPlayer.transition = PLTRANS_DASHRING; // NOTE: This doesn't take the sprite offset, is it a bug? - gPlayer.x = Q(ring->posX); - gPlayer.y = Q(ring->posY); + gPlayer.qWorldX = Q(ring->posX); + gPlayer.qWorldY = Q(ring->posY); gPlayer.unk72 = 0x10; switch (ring->orientation) { @@ -254,8 +254,8 @@ static bool32 DashRing_PlayerIsColliding(Sprite_DashRing *ring) ringScreenY = ring->posY; ringScreenY -= gCamera.y; - playerScreenX = I(gPlayer.x) - gCamera.x; - playerScreenY = I(gPlayer.y) - gCamera.y; + playerScreenX = I(gPlayer.qWorldX) - gCamera.x; + playerScreenY = I(gPlayer.qWorldY) - gCamera.y; for (i = 0; i < ARRAY_COUNT(ring->positions); i++) { ringScreenX2 = ringScreenX; diff --git a/src/game/interactables_2/hot_crater/floating_spring.c b/src/game/interactables_2/hot_crater/floating_spring.c index 9504c5cc4..48f56a77e 100644 --- a/src/game/interactables_2/hot_crater/floating_spring.c +++ b/src/game/interactables_2/hot_crater/floating_spring.c @@ -125,33 +125,33 @@ static u32 sub_8074EF4(Sprite_FloatingSpring *floatingSpring) if (PLAYER_IS_ALIVE) { u32 temp = sub_800CDBC(&floatingSpring->s, floatingSpring->unk3C, floatingSpring->unk40, &gPlayer); if (temp != 0) { - if (I(gPlayer.y) < floatingSpring->unk40) { - gPlayer.y += Q(floatingSpring->s.hitboxes[0].top); + if (I(gPlayer.qWorldY) < floatingSpring->unk40) { + gPlayer.qWorldY += Q(floatingSpring->s.hitboxes[0].top); if (gPlayer.speedAirY > 0) { gPlayer.speedAirY = 0; } return 2; } else if (temp & 0x10000) { - gPlayer.y += Q_8_8(temp); + gPlayer.qWorldY += Q_8_8(temp); if (gPlayer.speedAirY > 0) { gPlayer.speedAirY = 0; } return 2; } else if (temp & 0x20000) { - gPlayer.y += Q_8_8(temp); + gPlayer.qWorldY += Q_8_8(temp); if (gPlayer.speedAirY < 0) { gPlayer.speedAirY = 0; } return 1; } else if (temp & 0x40000) { - gPlayer.x += (s16)(temp & 0xFF00); + gPlayer.qWorldX += (s16)(temp & 0xFF00); if (gPlayer.speedAirX < 0) { gPlayer.speedAirX = 0; gPlayer.speedGroundX = 0; } return 1; } else if (temp & 0x80000) { - gPlayer.x += (s16)(temp & 0xFF00); + gPlayer.qWorldX += (s16)(temp & 0xFF00); if (gPlayer.speedAirX > 0) { gPlayer.speedAirX = 0; gPlayer.speedGroundX = 0; diff --git a/src/game/interactables_2/hot_crater/hook_rail.c b/src/game/interactables_2/hot_crater/hook_rail.c index a276f2f8b..4105e4c10 100644 --- a/src/game/interactables_2/hot_crater/hook_rail.c +++ b/src/game/interactables_2/hot_crater/hook_rail.c @@ -114,12 +114,12 @@ static void sub_8072BB8(void) } else { s16 x, playerX; sub_80731D4(); - gPlayer.x += gPlayer.speedAirX; - gPlayer.y += gPlayer.speedAirY; + gPlayer.qWorldX += gPlayer.speedAirX; + gPlayer.qWorldY += gPlayer.speedAirY; gPlayer.speedGroundX = ClampRailSpeed(gPlayer.speedGroundX); x = hookRail->x - gCamera.x; - playerX = I(gPlayer.x) - gCamera.x; + playerX = I(gPlayer.qWorldX) - gCamera.x; if (hookRail->triggerType == 0) { if (playerX < x + hookRail->width) { @@ -150,9 +150,9 @@ static void sub_8072C90(void) } else { sub_80731D4(); hookRail->grindDistance += gPlayer.speedAirX; - gPlayer.x = hookRail->joinedX + hookRail->grindDistance; + gPlayer.qWorldX = hookRail->joinedX + hookRail->grindDistance; // This sets the hook rail angle. It's always 1/2 - gPlayer.y = hookRail->joinedY + (ABS(hookRail->grindDistance) >> 1); + gPlayer.qWorldY = hookRail->joinedY + (ABS(hookRail->grindDistance) >> 1); gPlayer.speedGroundX = ClampRailSpeed(gPlayer.speedGroundX + 21); } } @@ -173,8 +173,8 @@ static void sub_8072D40(void) sub_8073148(hookRail); } else { sub_80731D4(); - gPlayer.x += gPlayer.speedAirX; - gPlayer.y += gPlayer.speedAirY; + gPlayer.qWorldX += gPlayer.speedAirX; + gPlayer.qWorldY += gPlayer.speedAirY; gPlayer.speedGroundX = ClampRailSpeed(gPlayer.speedGroundX); if (IsPlayerTouching(hookRail) == PLAYER_TOUCH_DIRECTION_NONE) { @@ -192,7 +192,7 @@ static void sub_8072DCC(Sprite_HookRail *hookRail) gPlayer.spriteOffsetX = 6; gPlayer.spriteOffsetY = 14; gPlayer.moveState &= ~MOVESTATE_4; - gPlayer.y = Q(hookRail->y + HOOK_HEIGHT); + gPlayer.qWorldY = Q(hookRail->y + HOOK_HEIGHT); hookRail->grindDistance = 0; if (hookRail->triggerType == 0) { gPlayer.moveState |= MOVESTATE_FACING_LEFT; @@ -225,8 +225,8 @@ static u32 IsPlayerTouching(Sprite_HookRail *hookRail) x = hookRail->x - gCamera.x; y = hookRail->y - gCamera.y; - playerX = I(gPlayer.x) - gCamera.x; - playerY = I(gPlayer.y) - gCamera.y; + playerX = I(gPlayer.qWorldX) - gCamera.x; + playerY = I(gPlayer.qWorldY) - gCamera.y; if (x + hookRail->width <= playerX && (x + hookRail->width) + (hookRail->offsetX - hookRail->width) >= playerX) { if (y + hookRail->height <= playerY && (y + hookRail->height) + (hookRail->offsetY - hookRail->height) >= playerY) { @@ -282,14 +282,14 @@ static void sub_8072FD4(struct Task *unused) static void sub_8072FD8(Sprite_HookRail *hookRail) { if (hookRail->triggerType == 0) { - gPlayer.x = Q(hookRail->x + hookRail->width); - hookRail->joinedX = gPlayer.x; - hookRail->joinedY = gPlayer.y; + gPlayer.qWorldX = Q(hookRail->x + hookRail->width); + hookRail->joinedX = gPlayer.qWorldX; + hookRail->joinedY = gPlayer.qWorldY; gPlayer.rotation = 109; } else { - gPlayer.x = Q(hookRail->x + hookRail->offsetX); - hookRail->joinedX = gPlayer.x; - hookRail->joinedY = gPlayer.y; + gPlayer.qWorldX = Q(hookRail->x + hookRail->offsetX); + hookRail->joinedX = gPlayer.qWorldX; + hookRail->joinedY = gPlayer.qWorldY; gPlayer.rotation = 19; } gCurTask->main = sub_8072C90; @@ -318,7 +318,7 @@ static void sub_8073088(UNUSED Sprite_HookRail *hookRail) static void sub_80730BC(Sprite_HookRail *hookRail) { - gPlayer.y = Q(hookRail->y + HOOK_HEIGHT); + gPlayer.qWorldY = Q(hookRail->y + HOOK_HEIGHT); if (gPlayer.rotation == 109) { gPlayer.rotation = 128; } else { diff --git a/src/game/interactables_2/hot_crater/turnaround_bar.c b/src/game/interactables_2/hot_crater/turnaround_bar.c index 7e98a6e6b..04eabbec1 100644 --- a/src/game/interactables_2/hot_crater/turnaround_bar.c +++ b/src/game/interactables_2/hot_crater/turnaround_bar.c @@ -69,13 +69,13 @@ static void sub_8073474(Sprite_TurnAroundBar *turnAroundBar) Player_ClearMovestate_IsInScriptedSequence(); gPlayer.moveState &= ~MOVESTATE_400000; - gPlayer.y -= turnAroundBar->unk44; + gPlayer.qWorldY -= turnAroundBar->unk44; if (gPlayer.speedGroundX > 0) { - gPlayer.x = Q(turnAroundBar->x - 6); + gPlayer.qWorldX = Q(turnAroundBar->x - 6); gPlayer.speedGroundX += Q_8_8(1.25); } else { - gPlayer.x = Q(turnAroundBar->x + 6); + gPlayer.qWorldX = Q(turnAroundBar->x + 6); gPlayer.speedGroundX -= Q_8_8(1.25); } @@ -100,8 +100,8 @@ static u32 sub_8073520(Sprite_TurnAroundBar *turnAroundBar) temp = turnAroundBar->x - gCamera.x; temp3 = turnAroundBar->y + -gCamera.y; - temp2 = I(gPlayer.x) - gCamera.x; - temp4 = I(gPlayer.y) - gCamera.y; + temp2 = I(gPlayer.qWorldX) - gCamera.x; + temp4 = I(gPlayer.qWorldY) - gCamera.y; if (temp - 6 <= temp2 && temp + 6 >= temp2) { if (temp3 - 32 <= temp4 && temp3 >= temp4) { if (abs(gPlayer.speedGroundX) < Q_8_8(4)) { @@ -168,9 +168,9 @@ static void sub_8073670(Sprite_TurnAroundBar *turnAroundBar) Player_SetMovestate_IsInScriptedSequence(); gPlayer.moveState |= MOVESTATE_400000; - turnAroundBar->unk44 = Q(turnAroundBar->y) - gPlayer.y; - gPlayer.x = Q(turnAroundBar->x); - gPlayer.y = Q(turnAroundBar->y); + turnAroundBar->unk44 = Q(turnAroundBar->y) - gPlayer.qWorldY; + gPlayer.qWorldX = Q(turnAroundBar->x); + gPlayer.qWorldY = Q(turnAroundBar->y); gPlayer.charState = CHARSTATE_TURNAROUND_BAR; s->graphics.anim = SA2_ANIM_TURNAROUND_BAR; diff --git a/src/game/interactables_2/hot_crater/windup_stick.c b/src/game/interactables_2/hot_crater/windup_stick.c index 71c9d2595..5740158e2 100644 --- a/src/game/interactables_2/hot_crater/windup_stick.c +++ b/src/game/interactables_2/hot_crater/windup_stick.c @@ -65,13 +65,13 @@ static void sub_8072650(void) if ((u8)(windUpStick->unk10 - 1) < 2) { if (gPlayer.heldInput & 0x10) { if (sub_8072A28(windUpStick)) { - gPlayer.x += 0x80; + gPlayer.qWorldX += 0x80; } } if (gPlayer.heldInput & 0x20) { if (sub_80729F4(windUpStick)) { - gPlayer.x -= 0x80; + gPlayer.qWorldX -= 0x80; } } } @@ -92,7 +92,7 @@ static void sub_80726E8(Sprite_WindUpStick *windUpStick) windUpStick->unk12 = (gUnknown_03005AF0.s.frameFlags & SPRITE_FLAG_MASK_PRIORITY) >> SPRITE_FLAG_SHIFT_PRIORITY; gUnknown_03005AF0.s.frameFlags &= ~SPRITE_FLAG_MASK_PRIORITY; gUnknown_03005AF0.s.frameFlags |= SPRITE_FLAG(PRIORITY, 1); - gPlayer.y = Q(windUpStick->unk4 + 3); + gPlayer.qWorldY = Q(windUpStick->unk4 + 3); switch (windUpStick->unk10) { case 1: @@ -143,11 +143,11 @@ static void sub_80727F4(Sprite_WindUpStick *windUpStick) switch (windUpStick->unk10) { case 1: case 3: - gPlayer.y = Q(windUpStick->unk4 + windUpStick->unkA); + gPlayer.qWorldY = Q(windUpStick->unk4 + windUpStick->unkA); break; case 2: case 4: - gPlayer.y = Q(windUpStick->unk4 + windUpStick->unkE); + gPlayer.qWorldY = Q(windUpStick->unk4 + windUpStick->unkE); break; } @@ -181,8 +181,8 @@ static u8 sub_80728D4(Sprite_WindUpStick *windUpStick) if (PLAYER_IS_ALIVE) { s16 posX = windUpStick->unk0 - gCamera.x; s16 posY = windUpStick->unk4 - gCamera.y; - s16 playerX = I(gPlayer.x) - gCamera.x; - s16 playerY = I(gPlayer.y) - gCamera.y; + s16 playerX = I(gPlayer.qWorldX) - gCamera.x; + s16 playerY = I(gPlayer.qWorldY) - gCamera.y; if ((posX + windUpStick->unk8) <= playerX && (posX + windUpStick->unk8) + (windUpStick->unkC - windUpStick->unk8) >= playerX) { if (posY + windUpStick->unkA <= playerY && (posY + windUpStick->unkA) + (windUpStick->unkE - windUpStick->unkA) >= playerY) { @@ -239,7 +239,7 @@ bool32 sub_80729F4(Sprite_WindUpStick *windUpStick) x -= camX; }); - s16 r0 = I(gPlayer.x) - gCamera.x; + s16 r0 = I(gPlayer.qWorldX) - gCamera.x; return r1 < r0; } @@ -253,7 +253,7 @@ bool32 sub_8072A28(Sprite_WindUpStick *windUpStick) x -= camX; }); - s16 r0 = I(gPlayer.x) - gCamera.x; + s16 r0 = I(gPlayer.qWorldX) - gCamera.x; return r1 > r0; } diff --git a/src/game/interactables_2/ice_paradise/big_snowball.c b/src/game/interactables_2/ice_paradise/big_snowball.c index 37b063cd7..2c87c916e 100644 --- a/src/game/interactables_2/ice_paradise/big_snowball.c +++ b/src/game/interactables_2/ice_paradise/big_snowball.c @@ -451,8 +451,8 @@ bool32 sub_80796A8(Sprite_IA69 *ia69) } else { s16 posX = ia69->unk158 + I(ia69->unk164) - gCamera.x; s16 posY = ia69->unk15C + I(ia69->unk168) - gCamera.y; - s16 playerX = I(gPlayer.x) - gCamera.x; - s16 playerY = I(gPlayer.y) - gCamera.y; + s16 playerX = I(gPlayer.qWorldX) - gCamera.x; + s16 playerY = I(gPlayer.qWorldY) - gCamera.y; if ((posX - 0x20) <= playerX && (posX + 0x20) >= playerX) { if ((posY - 0x20) <= playerY && posY >= playerY) { @@ -519,7 +519,7 @@ void sub_8079810(void) Player_ClearMovestate_IsInScriptedSequence(); gCurTask->main = Task_Interactable069; } else { - gPlayer.y = ia69->unk15C * 0x100 + ia69->unk168 - 0x1000; + gPlayer.qWorldY = ia69->unk15C * 0x100 + ia69->unk168 - 0x1000; if (ia69->unk174) { sub_8079888(ia69); diff --git a/src/game/interactables_2/ice_paradise/funnel_sphere.c b/src/game/interactables_2/ice_paradise/funnel_sphere.c index 4b5ccb15e..0ace85c2b 100644 --- a/src/game/interactables_2/ice_paradise/funnel_sphere.c +++ b/src/game/interactables_2/ice_paradise/funnel_sphere.c @@ -79,11 +79,11 @@ static void sub_8077F7C(void) r4 = (0x20 - r7) * 0x40; r4 = I(r4 * SIN_24_8(MUL_4(r6))); - gPlayer.y = funnelSphere->unkC + r4; + gPlayer.qWorldY = funnelSphere->unkC + r4; r4 = r7 * 2; r4 = I(COS_24_8(MUL_4(r6)) * 0x20 * COS_24_8(MUL_4(r4 & 0xFF))); - gPlayer.x = funnelSphere->unk8 + r4; + gPlayer.qWorldX = funnelSphere->unk8 + r4; r4 = r6; if (r4 > 0x80) { @@ -111,11 +111,11 @@ static void sub_8077F7C(void) r7 = funnelSphere->y - I(funnelSphere->unkC); r4 = (0x20 - r7) * 0x40; r4 = I(-(r4 * SIN_24_8(MUL_4(r6)))); - gPlayer.y = funnelSphere->unkC + r4; + gPlayer.qWorldY = funnelSphere->unkC + r4; r4 = r7 * 2; r4 = I(COS_24_8(MUL_4(r6)) * 0x20 * COS_24_8(MUL_4(r4 & 0xFF))); - gPlayer.x = funnelSphere->unk8 + r4; + gPlayer.qWorldX = funnelSphere->unk8 + r4; r4 = r6; if (r4 < 0x80) { @@ -221,8 +221,8 @@ static bool32 sub_80783A4(Sprite_FunnelSphere *funnelSphere) } else { s16 x = funnelSphere->x - gCamera.x; s16 y = funnelSphere->y - gCamera.y; - s16 playerX = (I(gPlayer.x) - gCamera.x); - s16 playerY = (I(gPlayer.y) - gCamera.y); + s16 playerX = (I(gPlayer.qWorldX) - gCamera.x); + s16 playerY = (I(gPlayer.qWorldY) - gCamera.y); s16 dX = x - playerX; s16 dY = y - playerY; if (dX * dX + dY * dY <= (12 * 12)) { @@ -253,19 +253,19 @@ static void sub_807844C(void) } if (gPlayer.speedAirX < 0x300) { - gPlayer.x += 0x300; + gPlayer.qWorldX += 0x300; } else { - gPlayer.x += gPlayer.speedAirX; + gPlayer.qWorldX += gPlayer.speedAirX; } - if (I(gPlayer.x) >= funnelSphere->x + 0x20) { + if (I(gPlayer.qWorldX) >= funnelSphere->x + 0x20) { sub_80784B0(funnelSphere); } } static void sub_80784B0(Sprite_FunnelSphere *funnelSphere) { - gPlayer.x = Q(funnelSphere->x + 0x20); + gPlayer.qWorldX = Q(funnelSphere->x + 0x20); funnelSphere->unk10 = 0x200; funnelSphere->unk8 = Q(funnelSphere->x + 0x40); funnelSphere->unkC = Q(funnelSphere->y); @@ -327,8 +327,8 @@ static void sub_8078634(void) return; } - gPlayer.y += gPlayer.speedAirY; - y = funnelSphere->y - I(gPlayer.y); + gPlayer.qWorldY += gPlayer.speedAirY; + y = funnelSphere->y - I(gPlayer.qWorldY); if (abs(y) >= 72) { sub_8078254(funnelSphere); diff --git a/src/game/interactables_2/ice_paradise/half_pipe.c b/src/game/interactables_2/ice_paradise/half_pipe.c index fe7090259..5ba93783f 100644 --- a/src/game/interactables_2/ice_paradise/half_pipe.c +++ b/src/game/interactables_2/ice_paradise/half_pipe.c @@ -76,8 +76,8 @@ static void Task_HalfPipeSequenceMain(void) } else { u16 posWithinHalfPipe; gPlayer.moveState |= MOVESTATE_8000; - posWithinHalfPipe = halfPipe->direction == HALF_PIPE_DIRECTION_FORWARD ? I(gPlayer.x) - (halfPipe->x + halfPipe->offsetX) - : (halfPipe->x + halfPipe->width) - I(gPlayer.x); + posWithinHalfPipe = halfPipe->direction == HALF_PIPE_DIRECTION_FORWARD ? I(gPlayer.qWorldX) - (halfPipe->x + halfPipe->offsetX) + : (halfPipe->x + halfPipe->width) - I(gPlayer.qWorldX); UpdatePlayerPosOnHalfPipe(halfPipe, posWithinHalfPipe); } } @@ -112,7 +112,7 @@ static void UpdatePlayerPosOnHalfPipe(Sprite_IceParadiseHalfPipe *halfPipe, u16 sin += Q(r3); sin = I(sin * temp2); - gPlayer.y = halfPipe->basePlayerY - sin; + gPlayer.qWorldY = halfPipe->basePlayerY - sin; gPlayer.speedAirY = 0; gPlayer.moveState &= ~MOVESTATE_IN_AIR; @@ -135,8 +135,8 @@ static bool32 PlayerWithinHalfPipe(Sprite_IceParadiseHalfPipe *halfPipe) { s16 posX = halfPipe->x - gCamera.x; s16 posY = halfPipe->y - gCamera.y; - s16 playerX = I(gPlayer.x) - gCamera.x; - s16 playerY = I(gPlayer.y) - gCamera.y; + s16 playerX = I(gPlayer.qWorldX) - gCamera.x; + s16 playerY = I(gPlayer.qWorldY) - gCamera.y; if ((posX + halfPipe->offsetX) <= playerX && (posX + halfPipe->offsetX) + (halfPipe->width - halfPipe->offsetX) >= playerX) { if (posY + halfPipe->offsetY <= playerY && (posY + halfPipe->offsetY) + (halfPipe->height - halfPipe->offsetY) >= playerY) { @@ -167,7 +167,7 @@ static void TaskDestructor_HalfPipe(struct Task *t) static void StartHalfPipeSequence(Sprite_IceParadiseHalfPipe *halfPipe) { - halfPipe->basePlayerY = gPlayer.y; + halfPipe->basePlayerY = gPlayer.qWorldY; gCurTask->main = Task_HalfPipeSequenceMain; } diff --git a/src/game/interactables_2/ice_paradise/slowing_snow.c b/src/game/interactables_2/ice_paradise/slowing_snow.c index 37ca68dc7..85fb1952c 100644 --- a/src/game/interactables_2/ice_paradise/slowing_snow.c +++ b/src/game/interactables_2/ice_paradise/slowing_snow.c @@ -60,8 +60,8 @@ static bool32 PlayerIsTouchingSnow(Sprite_SlowingSnow *snow) if (!(gPlayer.moveState & MOVESTATE_IN_AIR)) { s16 snowScreenX = snow->posX - gCamera.x; s16 snowScreenY = snow->posY - gCamera.y; - s16 playerScreenX = I(gPlayer.x) - gCamera.x; - s16 playerScreenY = I(gPlayer.y) - gCamera.y; + s16 playerScreenX = I(gPlayer.qWorldX) - gCamera.x; + s16 playerScreenY = I(gPlayer.qWorldY) - gCamera.y; if (((snowScreenX + snow->left) <= playerScreenX) && ((snowScreenX + snow->left) + (snow->right - snow->left) >= playerScreenX) && ((snowScreenY + snow->top) <= playerScreenY) diff --git a/src/game/interactables_2/music_plant/german_flute.c b/src/game/interactables_2/music_plant/german_flute.c index 8fd3c4355..b64f71341 100644 --- a/src/game/interactables_2/music_plant/german_flute.c +++ b/src/game/interactables_2/music_plant/german_flute.c @@ -76,35 +76,35 @@ static void sub_8076928(void) posX = Q(flute->posX); posY = Q(flute->posY) + Q(24); - if (gPlayer.x != posX) { - if (gPlayer.x > posX) { - gPlayer.x -= Q(0.5); + if (gPlayer.qWorldX != posX) { + if (gPlayer.qWorldX > posX) { + gPlayer.qWorldX -= Q(0.5); - if (gPlayer.x < posX) { - gPlayer.x = posX; + if (gPlayer.qWorldX < posX) { + gPlayer.qWorldX = posX; } } else { - gPlayer.x += Q(0.5); + gPlayer.qWorldX += Q(0.5); - if (gPlayer.x > posX) { - gPlayer.x = posX; + if (gPlayer.qWorldX > posX) { + gPlayer.qWorldX = posX; } } } - if (ABS(gPlayer.x - posX) <= Q(8)) { - if (gPlayer.y != posY) { + if (ABS(gPlayer.qWorldX - posX) <= Q(8)) { + if (gPlayer.qWorldY != posY) { gPlayer.speedAirY += Q(1. / 6.); - gPlayer.y += gPlayer.speedAirY; + gPlayer.qWorldY += gPlayer.speedAirY; - if (gPlayer.y > posY) { - gPlayer.y = posY; + if (gPlayer.qWorldY > posY) { + gPlayer.qWorldY = posY; } } } - if ((gPlayer.x == posX) && (gPlayer.y == posY)) { + if ((gPlayer.qWorldX == posX) && (gPlayer.qWorldY == posY)) { sub_8076C58(flute); } } @@ -124,14 +124,14 @@ static void sub_80769E0(void) sub_8076D08(flute); } - gPlayer.y += gPlayer.speedAirY; + gPlayer.qWorldY += gPlayer.speedAirY; gPlayer.speedAirY += Q(1. / 6.); // NOTE/BUG(?): Are the first 2 parameters swapped? - res = sub_801F100(I(gPlayer.y) - gPlayer.spriteOffsetY, I(gPlayer.x), gPlayer.layer, -8, sub_801EC3C); + res = sub_801F100(I(gPlayer.qWorldY) - gPlayer.spriteOffsetY, I(gPlayer.qWorldX), gPlayer.layer, -8, sub_801EC3C); if (res < 0) { - gPlayer.y -= Q(res); + gPlayer.qWorldY -= Q(res); } if (gPlayer.speedAirY >= 0) { @@ -153,33 +153,33 @@ static void Task_8076A6C(void) sub_8076D08(flute); } - gPlayer.x -= flute->unk8; - gPlayer.y -= flute->unkA; + gPlayer.qWorldX -= flute->unk8; + gPlayer.qWorldY -= flute->unkA; flute->unk8 = 0; flute->unkA = Q_2_14_TO_Q_24_8(SIN((u8)flute->timer * 4)) * 8; - r1 = gPlayer.x; - gPlayer.y += flute->unkA; + r1 = gPlayer.qWorldX; + gPlayer.qWorldY += flute->unkA; // NOTE/BUG(?): Are the first 2 parameters swapped? - res = sub_801F100(I(gPlayer.y) - gPlayer.spriteOffsetY, I(r1), gPlayer.layer, -8, sub_801EC3C); + res = sub_801F100(I(gPlayer.qWorldY) - gPlayer.spriteOffsetY, I(r1), gPlayer.layer, -8, sub_801EC3C); if (res < 0) { - gPlayer.y -= Q(res); + gPlayer.qWorldY -= Q(res); } flute->timer++; if (gPlayer.heldInput & 0x10) { - gPlayer.x += Q(0.5); + gPlayer.qWorldX += Q(0.5); gPlayer.moveState &= ~MOVESTATE_FACING_LEFT; } if (gPlayer.heldInput & 0x20) { - gPlayer.x -= Q(0.5); + gPlayer.qWorldX -= Q(0.5); gPlayer.moveState |= MOVESTATE_FACING_LEFT; } - if ((Q(flute->posX) - Q(16) > gPlayer.x) || (Q(flute->posX) + Q(16) < gPlayer.x)) { + if ((Q(flute->posX) - Q(16) > gPlayer.qWorldX) || (Q(flute->posX) + Q(16) < gPlayer.qWorldX)) { sub_8076C88(flute); } @@ -203,7 +203,7 @@ static void sub_8076B84(Sprite_GermanFlute *flute) gPlayer.speedAirX = 0; gPlayer.speedAirY = 0; - gPlayer.y = Q(flute->posY - 8); + gPlayer.qWorldY = Q(flute->posY - 8); gCurTask->main = sub_8076928; } @@ -223,8 +223,8 @@ static bool32 sub_8076BE4(Sprite_GermanFlute *flute) pos2Y = (gCamera.y + 16); screenY = posY - pos2Y; - playerX = I(gPlayer.x) - gCamera.x; - playerY = I(gPlayer.y) - gCamera.y; + playerX = I(gPlayer.qWorldX) - gCamera.x; + playerY = I(gPlayer.qWorldY) - gCamera.y; if ((screenX <= playerX) && (playerX < (screenX + 40))) { if ((screenY <= playerY) && (playerY < screenY + 32)) { diff --git a/src/game/interactables_2/music_plant/guitar_string.c b/src/game/interactables_2/music_plant/guitar_string.c index 8c6721570..814b1a3a8 100644 --- a/src/game/interactables_2/music_plant/guitar_string.c +++ b/src/game/interactables_2/music_plant/guitar_string.c @@ -133,7 +133,7 @@ void sub_8075F58(void) } if (PLAYER_IS_ALIVE) { - gPlayer.y = ((gs->posY - 16) << 8) + gs->elements[2][1]; + gPlayer.qWorldY = ((gs->posY - 16) << 8) + gs->elements[2][1]; gPlayer.rotation = 0x40; } @@ -244,8 +244,8 @@ bool32 sub_807618C(Sprite_GuitarString *gs) if (PLAYER_IS_ALIVE && gPlayer.speedAirY > 0) { s16 screenX = gs->posX - gCamera.x; s16 screenY = gs->posY - gCamera.y; - s16 playerX = I(gPlayer.x) - gCamera.x; - s16 playerY = I(gPlayer.y) - gCamera.y; + s16 playerX = I(gPlayer.qWorldX) - gCamera.x; + s16 playerY = I(gPlayer.qWorldY) - gCamera.y; if ((screenX <= playerX) && ((screenX + GUITARSTR_WIDTH_PX) >= playerX) && ((screenY - 9) <= playerY) && ((screenY + 9) >= playerY)) { @@ -305,17 +305,17 @@ void sub_80762BC(Sprite_GuitarString *gs) void sub_80762E0(Sprite_GuitarString *gs) { if (PLAYER_IS_ALIVE) { - if (gPlayer.x != LOCAL_GUITARSTR_MARGIN) { - if (gPlayer.x > LOCAL_GUITARSTR_MARGIN) { - gPlayer.x -= Q(0.5); + if (gPlayer.qWorldX != LOCAL_GUITARSTR_MARGIN) { + if (gPlayer.qWorldX > LOCAL_GUITARSTR_MARGIN) { + gPlayer.qWorldX -= Q(0.5); - if (gPlayer.x < LOCAL_GUITARSTR_MARGIN) - gPlayer.x = LOCAL_GUITARSTR_MARGIN; + if (gPlayer.qWorldX < LOCAL_GUITARSTR_MARGIN) + gPlayer.qWorldX = LOCAL_GUITARSTR_MARGIN; } else { - gPlayer.x += Q(0.5); + gPlayer.qWorldX += Q(0.5); - if (gPlayer.x > LOCAL_GUITARSTR_MARGIN) - gPlayer.x = LOCAL_GUITARSTR_MARGIN; + if (gPlayer.qWorldX > LOCAL_GUITARSTR_MARGIN) + gPlayer.qWorldX = LOCAL_GUITARSTR_MARGIN; } } } diff --git a/src/game/interactables_2/music_plant/keyboard.c b/src/game/interactables_2/music_plant/keyboard.c index d58bc15d5..ef83037cc 100644 --- a/src/game/interactables_2/music_plant/keyboard.c +++ b/src/game/interactables_2/music_plant/keyboard.c @@ -230,8 +230,8 @@ static void sub_8076448(Sprite_Keyboard *kb) } if (LEVEL_TO_ZONE(gCurrentLevel) != ZONE_6) { - sub_8080C78(I(gPlayer.x), I(gPlayer.y), 5, 30, r7, r5, 0); - sub_8080C78(I(gPlayer.x), I(gPlayer.y), 5, 30, r8, r6, 1); + sub_8080C78(I(gPlayer.qWorldX), I(gPlayer.qWorldY), 5, 30, r7, r5, 0); + sub_8080C78(I(gPlayer.qWorldX), I(gPlayer.qWorldY), 5, 30, r8, r6, 1); } } @@ -241,8 +241,8 @@ static bool32 sub_8076780(Sprite_Keyboard *kb) if (kb->unk1 == 0) { s16 screenX = kb->posX - gCamera.x; s16 screenY = kb->posY - gCamera.y; - s16 playerX = I(gPlayer.x) - gCamera.x; - s16 playerY = I(gPlayer.y) - gCamera.y; + s16 playerX = I(gPlayer.qWorldX) - gCamera.x; + s16 playerY = I(gPlayer.qWorldY) - gCamera.y; if (((screenX + kb->unkC) <= playerX) && (((screenX + kb->unkC) + (kb->unk10 - kb->unkC)) >= playerX) && ((screenY + kb->unkE) <= playerY) && (((screenY + kb->unkE) + (kb->unk12 - kb->unkE)) >= playerY)) { diff --git a/src/game/interactables_2/music_plant/note_block.c b/src/game/interactables_2/music_plant/note_block.c index 450d1056f..606b3b929 100644 --- a/src/game/interactables_2/music_plant/note_block.c +++ b/src/game/interactables_2/music_plant/note_block.c @@ -258,9 +258,9 @@ bool32 sub_8075D98(Sprite_NoteBlock *block) if (!(gPlayer.moveState & MOVESTATE_DEAD) && (block->unk4B != 0)) { s32 posX, posY; u16 otherX, otherY; - posX = I(gPlayer.x) + 16; + posX = I(gPlayer.qWorldX) + 16; posX -= block->posX; - posY = I(gPlayer.y) + 24; + posY = I(gPlayer.qWorldY) + 24; posY -= block->posY; otherY = posY; diff --git a/src/game/interactables_2/music_plant/note_sphere.c b/src/game/interactables_2/music_plant/note_sphere.c index 522589516..544952922 100644 --- a/src/game/interactables_2/music_plant/note_sphere.c +++ b/src/game/interactables_2/music_plant/note_sphere.c @@ -142,8 +142,8 @@ static u8 NoteSphere_BouncePlayer(Sprite_NoteSphere *note) u8 angle; u16 r6; s16 vecPlayerToNoteX, vecPlayerToNoteY; - vecPlayerToNoteX = I(gPlayer.x) - note->posX; - vecPlayerToNoteY = I(gPlayer.y) - note->posY; + vecPlayerToNoteX = I(gPlayer.qWorldX) - note->posX; + vecPlayerToNoteY = I(gPlayer.qWorldY) - note->posY; r6 = sub_8085530(vecPlayerToNoteX, vecPlayerToNoteY); @@ -183,8 +183,8 @@ static bool32 NoteSphere_IsPlayerColliding(Sprite_NoteSphere *note) if (!(gPlayer.moveState & MOVESTATE_DEAD)) { s16 distanceX, distanceY; - distanceX = ABS(note->posX - I(gPlayer.x)); - distanceY = ABS(note->posY - I(gPlayer.y)); + distanceX = ABS(note->posX - I(gPlayer.qWorldX)); + distanceY = ABS(note->posY - I(gPlayer.qWorldY)); if (MAX(distanceX, distanceY) < 25) { if ((distanceX * distanceX + distanceY * distanceY) <= (24 * 24)) { diff --git a/src/game/interactables_2/music_plant/pipe_horn.c b/src/game/interactables_2/music_plant/pipe_horn.c index 0dca7b5fc..fcbe692f4 100644 --- a/src/game/interactables_2/music_plant/pipe_horn.c +++ b/src/game/interactables_2/music_plant/pipe_horn.c @@ -935,8 +935,8 @@ bool32 sub_8077840(Sprite_Pipe_Horn *pipe) screenX = pipe->posX - gCamera.x; screenY = pipe->posY - gCamera.y; - playerX = I(gPlayer.x) - gCamera.x; - playerY = I(gPlayer.y) - gCamera.y; + playerX = I(gPlayer.qWorldX) - gCamera.x; + playerY = I(gPlayer.qWorldY) - gCamera.y; screenX -= playerX; screenY -= playerY; @@ -1045,8 +1045,8 @@ void TaskDestructor_Pipe(struct Task *t) { } void sub_8077AAC(Sprite_Pipe_Horn *horn) { - gPlayer.x = horn->x2; - gPlayer.y = horn->y2; + gPlayer.qWorldX = horn->x2; + gPlayer.qWorldY = horn->y2; } void sub_8077ABC(void) @@ -1104,8 +1104,8 @@ bool32 sub_8077B98(Sprite_Pipe_Horn *horn) screenX = horn->posX - gCamera.x; screenY = horn->posY - gCamera.y; - playerX = I(gPlayer.x) - gCamera.x; - playerY = I(gPlayer.y) - gCamera.y; + playerX = I(gPlayer.qWorldX) - gCamera.x; + playerY = I(gPlayer.qWorldY) - gCamera.y; screenX -= playerX; screenY -= playerY; @@ -1155,8 +1155,8 @@ void sub_8077C3C(Sprite_Pipe_Horn *horn) void sub_8077CA0(Sprite_Pipe_Horn *horn) { - gPlayer.x = horn->x2; - gPlayer.y = horn->y2; + gPlayer.qWorldX = horn->x2; + gPlayer.qWorldY = horn->y2; } bool32 sub_8077CB0(Sprite_Pipe_Horn *horn) diff --git a/src/game/interactables_2/notification_ring_bonus.c b/src/game/interactables_2/notification_ring_bonus.c index a12f139e5..6cea49bd1 100644 --- a/src/game/interactables_2/notification_ring_bonus.c +++ b/src/game/interactables_2/notification_ring_bonus.c @@ -72,7 +72,7 @@ void CreateEntity_MultiplayerTeleport(MapEntity *me, u16 spriteRegionX, u16 spri void sub_80803FC(Sprite_MultiplayerTeleport *sprite) { - if ((sprite->someX < Q(sprite->posX + sprite->unk8)) && (gPlayer.x > Q(sprite->posX + sprite->unkC))) { + if ((sprite->someX < Q(sprite->posX + sprite->unk8)) && (gPlayer.qWorldX > Q(sprite->posX + sprite->unkC))) { if (sprite->unk1C != 0) { u16 timeDiff; u16 prevRingCount; @@ -106,7 +106,7 @@ void sub_80803FC(Sprite_MultiplayerTeleport *sprite) else gNumLives = lives; - gUnknown_030054A8.unk3 = 0x10; + gMusicManagerState.unk3 = 0x10; } if (gGameMode == GAME_MODE_MULTI_PLAYER_COLLECT_RINGS) { @@ -125,13 +125,13 @@ void sub_80803FC(Sprite_MultiplayerTeleport *sprite) sprite->unk1C = 1; sprite->timer = gCheckpointTime; } - sprite->someX = gPlayer.x; - } else if ((sprite->someX > Q(sprite->posX + sprite->unkC)) && (gPlayer.x < Q(sprite->posX + sprite->unk8))) { + sprite->someX = gPlayer.qWorldX; + } else if ((sprite->someX > Q(sprite->posX + sprite->unkC)) && (gPlayer.qWorldX < Q(sprite->posX + sprite->unk8))) { if (sprite->unk1C != 0) { sprite->unk18--; } - sprite->someX = gPlayer.x; + sprite->someX = gPlayer.qWorldX; } gCurTask->main = Task_80806F4; @@ -144,8 +144,8 @@ bool32 sub_808055C(Sprite_MultiplayerTeleport *sprite) spriteX = sprite->posX - gCamera.x; spriteY = sprite->posY - gCamera.y; - playerX = I(gPlayer.x) - gCamera.x; - playerY = I(gPlayer.y) - gCamera.y; + playerX = I(gPlayer.qWorldX) - gCamera.x; + playerY = I(gPlayer.qWorldY) - gCamera.y; if ((spriteX + sprite->unk8 <= playerX) && (playerX <= spriteX + sprite->unkC) && (spriteY + sprite->unkA <= playerY) && (playerY <= spriteY + sprite->unkE)) { @@ -160,17 +160,17 @@ void sub_80805D0(Sprite_MultiplayerTeleport *sprite) if (sprite->unk1C != 0) { s32 xValue, yValue; - if ((gPlayer.x < Q(240)) && (gPlayer.y < Q(288))) { + if ((gPlayer.qWorldX < Q(240)) && (gPlayer.qWorldY < Q(288))) { xValue = Q(1440); yValue = Q(864); - } else if ((gPlayer.x > Q(1680)) && (gPlayer.y > Q(864))) { + } else if ((gPlayer.qWorldX > Q(1680)) && (gPlayer.qWorldY > Q(864))) { xValue = Q(-1440); yValue = Q(-864); } else { return; } - gPlayer.x += xValue; - gPlayer.y += yValue; + gPlayer.qWorldX += xValue; + gPlayer.qWorldY += yValue; xValue = I(xValue); yValue = I(yValue); @@ -210,7 +210,7 @@ void Task_80806F4(void) if (sub_808055C(sprite)) { sub_808073C(sprite); } else { - sprite->someX = gPlayer.x; + sprite->someX = gPlayer.qWorldX; } sub_80805D0(sprite); } diff --git a/src/game/interactables_2/sky_canyon/fan.c b/src/game/interactables_2/sky_canyon/fan.c index 883cd1abc..7196ca01f 100644 --- a/src/game/interactables_2/sky_canyon/fan.c +++ b/src/game/interactables_2/sky_canyon/fan.c @@ -122,9 +122,9 @@ static void sub_807D468(Sprite_Fan *prop) s32 temp; s32 r3; if (IS_PROPELLER_DIR_LEFT(prop->kind)) { - r3 = Q(prop->posX + prop->right) - gPlayer.x; + r3 = Q(prop->posX + prop->right) - gPlayer.qWorldX; } else { - r3 = gPlayer.x - Q(prop->posX + prop->left); + r3 = gPlayer.qWorldX - Q(prop->posX + prop->left); } r3 = (Q(prop->width) - r3) / prop->width; @@ -144,13 +144,13 @@ static void sub_807D468(Sprite_Fan *prop) gPlayer.speedGroundX = ClampPlayerSpeed(gPlayer.speedGroundX - Q(0.25)); gPlayer.speedAirX = ClampPlayerSpeed(gPlayer.speedAirX - Q(0.25)); } else { - s32 newPlayerX = gPlayer.x - prop->playerDeltaX; - gPlayer.x = newPlayerX; + s32 newPlayerX = gPlayer.qWorldX - prop->playerDeltaX; + gPlayer.qWorldX = newPlayerX; r3 = Q(prop->posX + prop->right) - Q(48); if ((prop->kind != SKYCAN_FAN_KIND(FAN_DIR_LEFT, TRUE)) && newPlayerX > r3) { - gPlayer.x = r3; + gPlayer.qWorldX = r3; } if (gPlayer.frameInput & 0x20) { @@ -163,13 +163,13 @@ static void sub_807D468(Sprite_Fan *prop) gPlayer.speedGroundX = ClampPlayerSpeed(gPlayer.speedGroundX + Q(0.25)); gPlayer.speedAirX = ClampPlayerSpeed(gPlayer.speedAirX + Q(0.25)); } else { - s32 newPlayerX = gPlayer.x + prop->playerDeltaX; - gPlayer.x = newPlayerX; + s32 newPlayerX = gPlayer.qWorldX + prop->playerDeltaX; + gPlayer.qWorldX = newPlayerX; r3 = Q(prop->posX + prop->left) + Q(48); if ((prop->kind != SKYCAN_FAN_KIND(FAN_DIR_RIGHT, TRUE)) && newPlayerX < r3) { - gPlayer.x = r3; + gPlayer.qWorldX = r3; } if (gPlayer.frameInput & 0x10) { @@ -262,8 +262,8 @@ static bool32 IsPlayerInFanRegion(Sprite_Fan *prop) s16 propX = prop->posX - gCamera.x; s16 propY = prop->posY - gCamera.y; - s16 playerX = I(gPlayer.x) - gCamera.x; - s16 playerY = I(gPlayer.y) - gCamera.y; + s16 playerX = I(gPlayer.qWorldX) - gCamera.x; + s16 playerY = I(gPlayer.qWorldY) - gCamera.y; u16 width = prop->right - prop->left; u16 height = prop->bottom - prop->top; diff --git a/src/game/interactables_2/sky_canyon/propeller.c b/src/game/interactables_2/sky_canyon/propeller.c index 384e5b6e4..64a2eb5b0 100644 --- a/src/game/interactables_2/sky_canyon/propeller.c +++ b/src/game/interactables_2/sky_canyon/propeller.c @@ -56,36 +56,36 @@ static void Task_PlayerFloating(void) } else { s32 temp; sub_807B8FC(propeller); - gPlayer.y -= Q(4); - if (I(gPlayer.y) <= propeller->y - 48) { - gPlayer.y = Q(propeller->y - 48); + gPlayer.qWorldY -= Q(4); + if (I(gPlayer.qWorldY) <= propeller->y - 48) { + gPlayer.qWorldY = Q(propeller->y - 48); sub_807B74C(propeller); } if (gPlayer.heldInput & DPAD_RIGHT) { - gPlayer.x += Q(0.5); + gPlayer.qWorldX += Q(0.5); } if (gPlayer.heldInput & DPAD_LEFT) { - gPlayer.x -= Q(0.5); + gPlayer.qWorldX -= Q(0.5); } - temp = sub_801F100(({ I(gPlayer.x) + 2; }) + gPlayer.spriteOffsetX, I(gPlayer.y), gPlayer.layer, +8, sub_801EB44); + temp = sub_801F100(({ I(gPlayer.qWorldX) + 2; }) + gPlayer.spriteOffsetX, I(gPlayer.qWorldY), gPlayer.layer, +8, sub_801EB44); if (temp < 0) { - gPlayer.x += Q(temp); + gPlayer.qWorldX += Q(temp); } - temp = sub_801F100(({ I(gPlayer.x) - 2; }) - gPlayer.spriteOffsetX, I(gPlayer.y), gPlayer.layer, -8, sub_801EB44); + temp = sub_801F100(({ I(gPlayer.qWorldX) - 2; }) - gPlayer.spriteOffsetX, I(gPlayer.qWorldY), gPlayer.layer, -8, sub_801EB44); if (temp < 0) { - gPlayer.x -= Q(temp); + gPlayer.qWorldX -= Q(temp); } - temp = sub_801F100(I(gPlayer.y) + gPlayer.spriteOffsetY, I(gPlayer.x), gPlayer.layer, 8, sub_801EC3C); + temp = sub_801F100(I(gPlayer.qWorldY) + gPlayer.spriteOffsetY, I(gPlayer.qWorldX), gPlayer.layer, 8, sub_801EC3C); if (temp < 0) { - gPlayer.y += Q(temp); + gPlayer.qWorldY += Q(temp); } - temp = sub_801F100(I(gPlayer.y) - gPlayer.spriteOffsetY, I(gPlayer.x), gPlayer.layer, -8, sub_801EC3C); + temp = sub_801F100(I(gPlayer.qWorldY) - gPlayer.spriteOffsetY, I(gPlayer.qWorldX), gPlayer.layer, -8, sub_801EC3C); if (temp < 0) { - gPlayer.y -= Q(temp); + gPlayer.qWorldY -= Q(temp); } } @@ -126,31 +126,31 @@ static void sub_807B530(void) } } - gPlayer.x += propeller->unk44; - gPlayer.y -= propeller->unk46; + gPlayer.qWorldX += propeller->unk44; + gPlayer.qWorldY -= propeller->unk46; propeller->unk46 = SIN_24_8(propeller->unk48 * 4) * 16; - gPlayer.y += propeller->unk46; + gPlayer.qWorldY += propeller->unk46; propeller->unk48 -= 4; - temp = sub_801F100(({ I(gPlayer.x) + 2; }) + gPlayer.spriteOffsetX, I(gPlayer.y), gPlayer.layer, 8, sub_801EB44); + temp = sub_801F100(({ I(gPlayer.qWorldX) + 2; }) + gPlayer.spriteOffsetX, I(gPlayer.qWorldY), gPlayer.layer, 8, sub_801EB44); if (temp < 0) { - gPlayer.x += Q(temp); + gPlayer.qWorldX += Q(temp); propeller->unk44 = 32; } - temp = sub_801F100(({ I(gPlayer.x) - 2; }) - gPlayer.spriteOffsetX, I(gPlayer.y), gPlayer.layer, -8, sub_801EB44); + temp = sub_801F100(({ I(gPlayer.qWorldX) - 2; }) - gPlayer.spriteOffsetX, I(gPlayer.qWorldY), gPlayer.layer, -8, sub_801EB44); if (temp < 0) { - gPlayer.x -= Q(temp); + gPlayer.qWorldX -= Q(temp); propeller->unk44 = -32; } - temp = sub_801F100(I(gPlayer.y) + gPlayer.spriteOffsetY, I(gPlayer.x), gPlayer.layer, 8, sub_801EC3C); + temp = sub_801F100(I(gPlayer.qWorldY) + gPlayer.spriteOffsetY, I(gPlayer.qWorldX), gPlayer.layer, 8, sub_801EC3C); if (temp < 0) { - gPlayer.y += Q(temp); + gPlayer.qWorldY += Q(temp); } - temp = sub_801F100(I(gPlayer.y) - gPlayer.spriteOffsetY, I(gPlayer.x), gPlayer.layer, -8, sub_801EC3C); + temp = sub_801F100(I(gPlayer.qWorldY) - gPlayer.spriteOffsetY, I(gPlayer.qWorldX), gPlayer.layer, -8, sub_801EC3C); if (temp < 0) { - gPlayer.y -= Q(temp); + gPlayer.qWorldY -= Q(temp); } if (!IsPlayerInAirCurrent(propeller)) { @@ -207,8 +207,8 @@ bool32 IsPlayerInteracting(Sprite_Propeller *propeller) x = propeller->x - gCamera.x; y = propeller->y - gCamera.y; - playerX = I(gPlayer.x) - gCamera.x; - playerY = I(gPlayer.y) - gCamera.y; + playerX = I(gPlayer.qWorldX) - gCamera.x; + playerY = I(gPlayer.qWorldY) - gCamera.y; if (x - (PROPELLER_HITBOX_WIDTH / 2) <= playerX && x + (PROPELLER_HITBOX_WIDTH / 2) >= playerX) { if (y - (PROPELLER_HITBOX_HEIGHT / 2) <= playerY && y + (PROPELLER_HITBOX_HEIGHT / 2) >= playerY) { return TRUE; @@ -276,7 +276,7 @@ static bool32 IsPlayerInAirCurrent(Sprite_Propeller *propeller) { if (PLAYER_IS_ALIVE) { s16 x = propeller->x - gCamera.x; - s16 playerX = I(gPlayer.x) - gCamera.x; + s16 playerX = I(gPlayer.qWorldX) - gCamera.x; if (x - (PROPELLER_HITBOX_WIDTH / 2) <= playerX && (x + (PROPELLER_HITBOX_WIDTH / 2) >= playerX)) { return TRUE; @@ -290,7 +290,7 @@ static bool32 sub_807B9F0(Sprite_Propeller *propeller) { if (PLAYER_IS_ALIVE) { s16 y = propeller->y - gCamera.y; - s16 playerY = I(gPlayer.y) - gCamera.y; + s16 playerY = I(gPlayer.qWorldY) - gCamera.y; // TODO: A Metatile/Chunk is 96 pixels wide (12 * TILE_WIDTH) // Is that the intended value here? diff --git a/src/game/interactables_2/sky_canyon/propeller_spring.c b/src/game/interactables_2/sky_canyon/propeller_spring.c index f26416e2a..39f47f858 100644 --- a/src/game/interactables_2/sky_canyon/propeller_spring.c +++ b/src/game/interactables_2/sky_canyon/propeller_spring.c @@ -125,8 +125,8 @@ static bool32 sub_807C424(Sprite_IA85 *ia85) temp = ia85->unk3C - gCamera.x; temp3 = ia85->unk40 - gCamera.y; - temp2 = I(gPlayer.x) - gCamera.x; - temp4 = I(gPlayer.y) - gCamera.y; + temp2 = I(gPlayer.qWorldX) - gCamera.x; + temp4 = I(gPlayer.qWorldY) - gCamera.y; if (temp - 0x14 <= temp2 && temp + 0x14 >= temp2) { if (temp3 - 0xC <= temp4 && temp3 + 0xC >= temp4) { return 1; diff --git a/src/game/interactables_2/sky_canyon/small_windmill.c b/src/game/interactables_2/sky_canyon/small_windmill.c index 50cc80f37..886e75f56 100644 --- a/src/game/interactables_2/sky_canyon/small_windmill.c +++ b/src/game/interactables_2/sky_canyon/small_windmill.c @@ -103,8 +103,8 @@ static void StartSpinSequence(Sprite_SmallWindmill *windmill) } windmill->rotation = windmill->rotationTarget; - gPlayer.x = COS_24_8(windmill->rotationTarget * 4) * PLAYER_SPIN_DIAMETER + Q(windmill->x); - gPlayer.y = SIN_24_8(windmill->rotationTarget * 4) * PLAYER_SPIN_DIAMETER + Q(windmill->y); + gPlayer.qWorldX = COS_24_8(windmill->rotationTarget * 4) * PLAYER_SPIN_DIAMETER + Q(windmill->x); + gPlayer.qWorldY = SIN_24_8(windmill->rotationTarget * 4) * PLAYER_SPIN_DIAMETER + Q(windmill->y); switch (windmill->initialTouchAngle) { case 1: @@ -187,8 +187,8 @@ static bool32 RotateWindmill(Sprite_SmallWindmill *windmill) } if (PLAYER_IS_ALIVE) { - gPlayer.x = COS_24_8(windmill->rotation * 4) * PLAYER_SPIN_DIAMETER + Q(windmill->x); - gPlayer.y = SIN_24_8(windmill->rotation * 4) * PLAYER_SPIN_DIAMETER + Q(windmill->y); + gPlayer.qWorldX = COS_24_8(windmill->rotation * 4) * PLAYER_SPIN_DIAMETER + Q(windmill->x); + gPlayer.qWorldY = SIN_24_8(windmill->rotation * 4) * PLAYER_SPIN_DIAMETER + Q(windmill->y); } return windmill->rotation == windmill->rotationTarget; @@ -199,8 +199,8 @@ static u32 GetPlayerTouchingAngle(Sprite_SmallWindmill *windmill) if (PLAYER_IS_ALIVE) { s16 x = windmill->x - gCamera.x; s16 y = windmill->y - gCamera.y; - s16 playerX = I(gPlayer.x) - gCamera.x; - s16 playerY = I(gPlayer.y) - gCamera.y; + s16 playerX = I(gPlayer.qWorldX) - gCamera.x; + s16 playerY = I(gPlayer.qWorldY) - gCamera.y; s16 dX = (x - playerX); s16 dY = (y - playerY); diff --git a/src/game/interactables_2/sky_canyon/whirlwind.c b/src/game/interactables_2/sky_canyon/whirlwind.c index 1c1439359..1f1ae3607 100644 --- a/src/game/interactables_2/sky_canyon/whirlwind.c +++ b/src/game/interactables_2/sky_canyon/whirlwind.c @@ -162,8 +162,8 @@ void sub_807C9C0(Sprite_IA86 *ia086) ia086->unk184 = Q(0.5); ia086->unk186 = gPlayer.speedAirY; ia086->unk180 = 0; - ia086->unk188 = Q(ia086->unk228.centerX) - gPlayer.x; - ia086->unk18C = Q(ia086->unk228.centerY) - gPlayer.y; + ia086->unk188 = Q(ia086->unk228.centerX) - gPlayer.qWorldX; + ia086->unk18C = Q(ia086->unk228.centerY) - gPlayer.qWorldY; ia086->unk190 = 0; ia086->unk194 = 0; @@ -186,7 +186,7 @@ void sub_807C9C0(Sprite_IA86 *ia086) r0 = 0x23C; r0 = Q(*(s32 *)((void *)ia086 + r0)); asm("" ::"r"(r0)); - r1 = p1->x; + r1 = p1->qWorldX; asm("" ::"r"(r1)); p = p1; asm("" ::: "r0"); @@ -202,8 +202,8 @@ void sub_807C9C0(Sprite_IA86 *ia086) r0 = 0x180; (*(s16 *)((void *)ia086 + r0)) = zero; - ia086->unk188 = p->x - Q(ia086->unk228.centerX); - ia086->unk18C = p->y - Q(ia086->unk228.centerY); + ia086->unk188 = p->qWorldX - Q(ia086->unk228.centerX); + ia086->unk18C = p->qWorldY - Q(ia086->unk228.centerY); ia086->unk190 = zero; ia086->unk194 = zero; @@ -228,8 +228,8 @@ bool32 sub_807CA64(Sprite_IA86 *ia086) ia086->unk186 += MIN((-ia086->unk186 >> 4), -Q(0.25)); } - gPlayer.y += ia086->unk186; - gPlayer.y = MIN(gPlayer.y, someY); + gPlayer.qWorldY += ia086->unk186; + gPlayer.qWorldY = MIN(gPlayer.qWorldY, someY); ia086->unk184 += Q(0.25); ia086->unk184 = MIN(ia086->unk184, +Q(3.0)); @@ -249,7 +249,7 @@ bool32 sub_807CA64(Sprite_IA86 *ia086) sub_807CC28(ia086); } - gPlayer.x = Q(ia086->unk228.centerX) + ia086->unk188 + ia086->unk190; + gPlayer.qWorldX = Q(ia086->unk228.centerX) + ia086->unk188 + ia086->unk190; return (returnState == 2); } @@ -258,7 +258,7 @@ bool32 sub_807CB78(Sprite_IA86 *ia086) { bool32 result = FALSE; - if (gPlayer.y > Q(ia086->unk228.posY + ia086->unk228.top)) { + if (gPlayer.qWorldY > Q(ia086->unk228.posY + ia086->unk228.top)) { ia086->unk186 -= 0x10; ia086->unk186 = MAX(ia086->unk186, -Q(3.0)); @@ -276,12 +276,12 @@ bool32 sub_807CB78(Sprite_IA86 *ia086) x = Q(ia086->unk228.centerX); x += ia086->unk188; x += ia086->unk190; - p->x = x; + p->qWorldX = x; y = Q(ia086->unk228.centerY); y += ia086->unk18C; y += ia086->unk194; - p->y = y; + p->qWorldY = y; } return result; @@ -492,8 +492,8 @@ bool32 sub_807CFB4(Sprite_IA86 *ia086) if (PLAYER_IS_ALIVE) { s16 x = ia086->unk228.centerX - gCamera.x; s16 y = ia086->unk228.centerY - gCamera.y; - s16 px = I(gPlayer.x) - gCamera.x; - s16 py = I(gPlayer.y) - gCamera.y; + s16 px = I(gPlayer.qWorldX) - gCamera.x; + s16 py = I(gPlayer.qWorldY) - gCamera.y; s32 r5, r4; u16 r3; s32 r2 = (y - ia086->unk228.height); @@ -557,7 +557,7 @@ void TaskDestructor_Interactable086(struct Task *t) void sub_807D130(Sprite_IA86 *ia086) { ia086->unk188 = 0; - ia086->unk18C = gPlayer.y - Q(ia086->unk228.centerY); + ia086->unk18C = gPlayer.qWorldY - Q(ia086->unk228.centerY); gCurTask->main = Task_807D268; } diff --git a/src/game/interactables_2/techno_base/arrow_platform.c b/src/game/interactables_2/techno_base/arrow_platform.c index 5f5b79bef..81532a889 100644 --- a/src/game/interactables_2/techno_base/arrow_platform.c +++ b/src/game/interactables_2/techno_base/arrow_platform.c @@ -181,8 +181,8 @@ static void sub_807A560(void) static void sub_807A688(Sprite_IA75 *ia75) { Sprite *s; - ia75->unk7C = gPlayer.x - (Q(ia75->x) + ia75->unk74); - ia75->unk80 = gPlayer.y - (Q(ia75->y) + ia75->unk78); + ia75->unk7C = gPlayer.qWorldX - (Q(ia75->x) + ia75->unk74); + ia75->unk80 = gPlayer.qWorldY - (Q(ia75->y) + ia75->unk78); gPlayer.transition = PLTRANS_TOUCH_GROUND; gPlayer.charState = CHARSTATE_IDLE; @@ -309,26 +309,26 @@ static u32 sub_807A99C(Sprite_IA75 *ia75) u32 temp = sub_800CCB8(&ia75->s2, ia75->x + I(ia75->unk74), ia75->y + I(ia75->unk78), &gPlayer); if (temp != 0) { if (temp & 0x10000) { - gPlayer.y += Q_8_8(temp); + gPlayer.qWorldY += Q_8_8(temp); gPlayer.speedAirY = 0; return 2; } if (temp & 0x40000) { - gPlayer.x += (s16)(temp & 0xFF00); + gPlayer.qWorldX += (s16)(temp & 0xFF00); gPlayer.speedAirX = 0; gPlayer.speedGroundX = 0; gPlayer.moveState |= MOVESTATE_20; return 1; } if (temp & 0x80000) { - gPlayer.x += (s16)(temp & 0xFF00); + gPlayer.qWorldX += (s16)(temp & 0xFF00); gPlayer.speedAirX = 0; gPlayer.speedGroundX = 0; gPlayer.moveState |= MOVESTATE_20; return 3; } if (temp & 0x20000) { - gPlayer.y += Q_8_8(temp); + gPlayer.qWorldY += Q_8_8(temp); gPlayer.speedAirY = 0; return 4; } @@ -383,8 +383,8 @@ static void sub_807AB04(struct Task *t) static void sub_807AB18(Sprite_IA75 *ia75) { gPlayer.moveState |= MOVESTATE_400000; - gPlayer.x = ia75->unk7C + Q(ia75->x) + ia75->unk74; - gPlayer.y = ia75->unk80 + Q(ia75->y) + ia75->unk78; + gPlayer.qWorldX = ia75->unk7C + Q(ia75->x) + ia75->unk74; + gPlayer.qWorldY = ia75->unk80 + Q(ia75->y) + ia75->unk78; sub_807A99C(ia75); } diff --git a/src/game/interactables_2/techno_base/bounce_block.c b/src/game/interactables_2/techno_base/bounce_block.c index 205c49bba..b820b02f9 100644 --- a/src/game/interactables_2/techno_base/bounce_block.c +++ b/src/game/interactables_2/techno_base/bounce_block.c @@ -113,11 +113,11 @@ static bool32 sub_8079AC4(Sprite_TecBaseNoteBlock *noteBlock) u16 temp3, temp4; if (!(gPlayer.moveState & MOVESTATE_DEAD)) { - temp1 = I(gPlayer.x); + temp1 = I(gPlayer.qWorldX); temp1 += 24; temp1 -= noteBlock->unk3C; - temp2 = I(gPlayer.y); + temp2 = I(gPlayer.qWorldY); temp2 += 16; temp2 -= noteBlock->unk40; @@ -133,25 +133,25 @@ static bool32 sub_8079AC4(Sprite_TecBaseNoteBlock *noteBlock) } if (temp & 0x10000) { - gPlayer.y += Q_8_8(temp); + gPlayer.qWorldY += Q_8_8(temp); gPlayer.speedAirY = gUnknown_080E001A[noteBlock->unk4C][1]; gPlayer.charState = CHARSTATE_SPIN_ATTACK; gPlayer.transition = PLTRANS_PT5; noteBlock->unk4D = 0xC0; } else if (temp & 0x40000) { - gPlayer.x += (s16)(temp & 0xFF00); + gPlayer.qWorldX += (s16)(temp & 0xFF00); gPlayer.speedAirX = gUnknown_080E001A[noteBlock->unk4C][0]; gPlayer.charState = CHARSTATE_SPIN_ATTACK; gPlayer.transition = PLTRANS_PT5; noteBlock->unk4D = 0x80; } else if (temp & 0x80000) { - gPlayer.x += (s16)(temp & 0xFF00); + gPlayer.qWorldX += (s16)(temp & 0xFF00); gPlayer.speedAirX = gUnknown_080E001A[noteBlock->unk4C][2]; gPlayer.charState = CHARSTATE_SPIN_ATTACK; gPlayer.transition = PLTRANS_PT5; noteBlock->unk4D = 0; } else { - gPlayer.y += Q_8_8(temp); + gPlayer.qWorldY += Q_8_8(temp); gPlayer.speedAirY = gUnknown_080E001A[noteBlock->unk4C][3]; gPlayer.charState = CHARSTATE_SPIN_ATTACK; gPlayer.transition = PLTRANS_PT5; diff --git a/src/game/interactables_2/techno_base/light_bridge.c b/src/game/interactables_2/techno_base/light_bridge.c index 8d94afd3d..28c156ad1 100644 --- a/src/game/interactables_2/techno_base/light_bridge.c +++ b/src/game/interactables_2/techno_base/light_bridge.c @@ -232,8 +232,8 @@ static bool32 IsPlayerWithinRange(Sprite_LightBridge *lightBridge) cameraY = gCamera.y; posY -= cameraY; - playerX = I(gPlayer.x) - gCamera.x; - playerY = I(gPlayer.y) - gCamera.y; + playerX = I(gPlayer.qWorldX) - gCamera.x; + playerY = I(gPlayer.qWorldY) - gCamera.y; a = ({ s32 temp1 = (u16)sWithinRangeDimensions[lightBridge->type].minX; diff --git a/src/game/interactables_2/techno_base/light_globe.c b/src/game/interactables_2/techno_base/light_globe.c index 1714ab644..f648ebbaf 100644 --- a/src/game/interactables_2/techno_base/light_globe.c +++ b/src/game/interactables_2/techno_base/light_globe.c @@ -103,9 +103,9 @@ static bool32 sub_807B1F0(Sprite_LightGlobe *globe) r2 -= gCamera.y; r2 += I(globe->unk46); - r0 = I(gPlayer.x); + r0 = I(gPlayer.qWorldX); r0 -= gCamera.x; - r1 = I(gPlayer.y); + r1 = I(gPlayer.qWorldY); r1 -= gCamera.y; r3_16 = r3; diff --git a/src/game/interactables_2/techno_base/spike_platform.c b/src/game/interactables_2/techno_base/spike_platform.c index 86afa48a8..f4f5d218b 100644 --- a/src/game/interactables_2/techno_base/spike_platform.c +++ b/src/game/interactables_2/techno_base/spike_platform.c @@ -166,22 +166,22 @@ static u32 sub_807AE60(Sprite_IA78 *ia78) u32 temp = sub_800CCB8(s, ia78->unk3C, ia78->unk40, &gPlayer); if (temp != 0) { if (temp & 0x10000) { - gPlayer.y += Q_8_8(temp); + gPlayer.qWorldY += Q_8_8(temp); gPlayer.speedAirY = 0; return 2; } if (temp & 0x40000) { - gPlayer.x += (s16)(temp & 0xFF00); + gPlayer.qWorldX += (s16)(temp & 0xFF00); gPlayer.speedAirX = 0; return 1; } if (temp & 0x80000) { - gPlayer.x += (s16)(temp & 0xFF00); + gPlayer.qWorldX += (s16)(temp & 0xFF00); gPlayer.speedAirX = 0; return 3; } if (temp & 0x20000) { - gPlayer.y += Q_8_8(temp); + gPlayer.qWorldY += Q_8_8(temp); gPlayer.speedAirY = 0; return 4; } diff --git a/src/game/multiplayer/finish.c b/src/game/multiplayer/finish.c index 2da11b3f3..f2098be39 100644 --- a/src/game/multiplayer/finish.c +++ b/src/game/multiplayer/finish.c @@ -161,7 +161,7 @@ void sub_8019F08(void) return; } - gUnknown_030054A8.unk0 = 0xFF; + gMusicManagerState.unk0 = 0xFF; gLoadedSaveGame->score += (s16)gRingCount; if (gCourseTime <= MAX_COURSE_TIME) { diff --git a/src/game/multiplayer/indicators.c b/src/game/multiplayer/indicators.c index 8e0c997c5..83db3c168 100644 --- a/src/game/multiplayer/indicators.c +++ b/src/game/multiplayer/indicators.c @@ -58,8 +58,8 @@ void CreateOpponentPositionIndicator(u8 sid) spr->graphics.anim = SA2_ANIM_INDICATOR_SONIC; spr->variant = 0; - transform->width = 0x100; - transform->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); transform->rotation = 0; } @@ -170,18 +170,18 @@ NONMATCH("asm/non_matching/game/multiplayer/indicators__Task_801951C.inc", void } if (opponentDistSq > 0x06000000) { - transform->width = 0x40; - transform->height = 0x40; + transform->qScaleX = Q(0.25); + transform->qScaleY = Q(0.25); } else if (opponentDistSq < 0x10000) { - transform->width = 0x1E0; - transform->height = 0x1E0; + transform->qScaleX = Q(1.875); + transform->qScaleY = Q(1.875); asm(""); // TEMP } else { // _080196C0 s32 dist = (0x06000000 - opponentDistSq) >> 16; s32 scale = Div(dist * 0x1A0, 0x5FF) + 0x40; - transform->width = scale; - transform->height = scale; + transform->qScaleX = scale; + transform->qScaleY = scale; } // _080196DC diff --git a/src/game/multiplayer/mp_player.c b/src/game/multiplayer/mp_player.c index f1b2358d7..1bf946a6c 100644 --- a/src/game/multiplayer/mp_player.c +++ b/src/game/multiplayer/mp_player.c @@ -119,7 +119,7 @@ void CreateMultiplayerPlayer(u8 id) s->x = 0; s->y = 0; - mpp->transform.height = 256; + mpp->transform.qScaleY = 256; s->graphics.anim = gPlayerCharacterIdleAnims[gMultiplayerCharacters[mpp->unk56]]; if (mpp->unk56 != SIO_MULTI_CNT->id) { @@ -409,13 +409,13 @@ NONMATCH("asm/non_matching/game/multiplayer/mp_player__Task_CreateMultiplayerPla s->frameFlags &= ~SPRITE_FLAG_MASK_ROT_SCALE; s->frameFlags = gUnknown_030054B8++ | SPRITE_FLAG_MASK_ROT_SCALE; if (mpp->unk54 & 2) { - transform->width = -256; + transform->qScaleX = -256; } else { - transform->width = +256; + transform->qScaleX = +256; } if (mpp->unk54 & 8) { - transform->width = -transform->width; + transform->qScaleX = -transform->qScaleX; } TransformSprite(s, transform); } else { @@ -539,10 +539,10 @@ void sub_8016D20(void) gPlayer.moveState |= MOVESTATE_IN_AIR; } - if (!GRAVITY_IS_INVERTED && I(gPlayer.y) > mpp->pos.y) { + if (!GRAVITY_IS_INVERTED && I(gPlayer.qWorldY) > mpp->pos.y) { mpp->unk60 = 30; return; - } else if (GRAVITY_IS_INVERTED && I(gPlayer.y) < mpp->pos.y) { + } else if (GRAVITY_IS_INVERTED && I(gPlayer.qWorldY) < mpp->pos.y) { mpp->unk60 = 30; return; } else if (s->frameFlags & SPRITE_FLAG_MASK_X_FLIP) { @@ -595,10 +595,10 @@ void sub_8016D20(void) gPlayer.moveState |= MOVESTATE_IN_AIR; } - if (!GRAVITY_IS_INVERTED && I(gPlayer.y) > mpp->pos.y) { + if (!GRAVITY_IS_INVERTED && I(gPlayer.qWorldY) > mpp->pos.y) { mpp->unk60 = 30; return; - } else if (GRAVITY_IS_INVERTED && I(gPlayer.y) < mpp->pos.y) { + } else if (GRAVITY_IS_INVERTED && I(gPlayer.qWorldY) < mpp->pos.y) { mpp->unk60 = 30; return; } else if (s->frameFlags & SPRITE_FLAG_MASK_X_FLIP) { @@ -729,10 +729,10 @@ void sub_801707C(void) s32 y; if (!GRAVITY_IS_INVERTED) { - result = sub_801E4E4(MAX(I(gPlayer.y), mpp->pos.y) + gPlayer.spriteOffsetY, I(gPlayer.x), gPlayer.layer, 8, &unusedByte, - sub_801EE64); + result = sub_801E4E4(MAX(I(gPlayer.qWorldY), mpp->pos.y) + gPlayer.spriteOffsetY, I(gPlayer.qWorldX), gPlayer.layer, 8, + &unusedByte, sub_801EE64); } else { - result = sub_801E4E4(MIN(I(gPlayer.y), mpp->pos.y) - gPlayer.spriteOffsetY, I(gPlayer.x), gPlayer.layer, -8, + result = sub_801E4E4(MIN(I(gPlayer.qWorldY), mpp->pos.y) - gPlayer.spriteOffsetY, I(gPlayer.qWorldX), gPlayer.layer, -8, &unusedByte, sub_801EE64); } @@ -780,7 +780,8 @@ void sub_801707C(void) if ((s->graphics.anim != SA2_ANIM_CHAR(SA2_CHAR_ANIM_22, CHARACTER_TAILS) && s->graphics.anim != SA2_ANIM_CHAR(SA2_CHAR_ANIM_21, CHARACTER_TAILS) && s->graphics.anim != SA2_ANIM_CHAR(SA2_CHAR_ANIM_20, CHARACTER_TAILS)) - || I(gPlayer.x) <= gCamera.minX || I(gPlayer.x) >= gCamera.maxX || SOME_INVERTED_GRAVITY_MACRO || moveStateVal != 0) { + || I(gPlayer.qWorldX) <= gCamera.minX || I(gPlayer.qWorldX) >= gCamera.maxX || SOME_INVERTED_GRAVITY_MACRO + || moveStateVal != 0) { gPlayer.moveState &= ~MOVESTATE_400000; mpp->unk5C &= ~4; gPlayer.charState = CHARSTATE_IDLE; @@ -801,8 +802,8 @@ void sub_801707C(void) // TODO: potential macro if (!invertedGravity) { y = Q(mpp->pos.y + (s->hitboxes[0].bottom) + 17); - result - = sub_801E4E4(I(gPlayer.y) + gPlayer.spriteOffsetY, I(gPlayer.x), gPlayer.layer, 8, &unusedByte, sub_801EE64); + result = sub_801E4E4(I(gPlayer.qWorldY) + gPlayer.spriteOffsetY, I(gPlayer.qWorldX), gPlayer.layer, 8, &unusedByte, + sub_801EE64); if (result < 0) { y += Q(result); @@ -813,8 +814,8 @@ void sub_801707C(void) } else { y = Q(mpp->pos.y + (s->hitboxes[0].top) - 17); - result - = sub_801E4E4(I(gPlayer.y) - gPlayer.spriteOffsetY, I(gPlayer.x), gPlayer.layer, -8, &unusedByte, sub_801EE64); + result = sub_801E4E4(I(gPlayer.qWorldY) - gPlayer.spriteOffsetY, I(gPlayer.qWorldX), gPlayer.layer, -8, &unusedByte, + sub_801EE64); if (result < 0) { y -= Q(result); @@ -823,8 +824,8 @@ void sub_801707C(void) mpp->unk5C &= ~4; } } - gPlayer.x = x; - gPlayer.y = y; + gPlayer.qWorldX = x; + gPlayer.qWorldY = y; if (mpp->unk5C & 4) { #ifndef NON_MATCHING // thanks pidgey @@ -963,7 +964,8 @@ void sub_8017670(void) || s->graphics.anim == SA2_ANIM_CHAR(SA2_CHAR_ANIM_20, CHARACTER_KNUCKLES) || s->graphics.anim == SA2_ANIM_CHAR(SA2_CHAR_ANIM_21, CHARACTER_KNUCKLES)) && !GRAVITY_IS_INVERTED == !(mpp->unk54 & 8)) { - if ((!GRAVITY_IS_INVERTED && I(gPlayer.y) > mpp->pos.y) || (GRAVITY_IS_INVERTED && I(gPlayer.y) < mpp->pos.y)) { + if ((!GRAVITY_IS_INVERTED && I(gPlayer.qWorldY) > mpp->pos.y) + || (GRAVITY_IS_INVERTED && I(gPlayer.qWorldY) < mpp->pos.y)) { gPlayer.moveState |= MOVESTATE_400000; sub_8023B5C(&gPlayer, 14); gPlayer.spriteOffsetX = 6; @@ -1010,7 +1012,8 @@ void sub_8017670(void) if ((s->graphics.anim != SA2_ANIM_CHAR(SA2_CHAR_ANIM_19, CHARACTER_KNUCKLES) && s->graphics.anim != SA2_ANIM_CHAR(SA2_CHAR_ANIM_20, CHARACTER_KNUCKLES) && s->graphics.anim != SA2_ANIM_CHAR(SA2_CHAR_ANIM_21, CHARACTER_KNUCKLES)) - || I(gPlayer.x) <= gCamera.minX || I(gPlayer.x) >= gCamera.maxX || SOME_INVERTED_GRAVITY_MACRO || moveStateVal != 0) { + || I(gPlayer.qWorldX) <= gCamera.minX || I(gPlayer.qWorldX) >= gCamera.maxX || SOME_INVERTED_GRAVITY_MACRO + || moveStateVal != 0) { gPlayer.moveState &= ~MOVESTATE_400000; mpp->unk5C &= ~4; gPlayer.charState = CHARSTATE_IDLE; @@ -1050,8 +1053,8 @@ void sub_8017670(void) mpp->unk5C &= ~4; } } - gPlayer.x = x; - gPlayer.y = y; + gPlayer.qWorldX = x; + gPlayer.qWorldY = y; } if ((mpp->unk5C & 4)) { @@ -1243,25 +1246,25 @@ void sub_8017F34(void) return; } - gPlayer.x += Q(mpp->unk44); + gPlayer.qWorldX += Q(mpp->unk44); if (!GRAVITY_IS_INVERTED) { - gPlayer.y += Q(mpp->unk48) + Q(1); + gPlayer.qWorldY += Q(mpp->unk48) + Q(1); } else { - gPlayer.y += Q(mpp->unk48) - Q(2); + gPlayer.qWorldY += Q(mpp->unk48) - Q(2); } if (mpp->unk48 < 0) { - result = sub_801F100(I(gPlayer.y) - gPlayer.spriteOffsetY, I(gPlayer.x), gPlayer.layer, -8, sub_801EC3C); + result = sub_801F100(I(gPlayer.qWorldY) - gPlayer.spriteOffsetY, I(gPlayer.qWorldX), gPlayer.layer, -8, sub_801EC3C); if (result < 0) { - gPlayer.y -= Q(result); + gPlayer.qWorldY -= Q(result); gPlayer.moveState &= ~MOVESTATE_8; gPlayer.moveState |= MOVESTATE_IN_AIR; mpp->unk60 = 30; } } else if (mpp->unk48 > 0) { - result = sub_801F100(I(gPlayer.y) + gPlayer.spriteOffsetY, I(gPlayer.x), gPlayer.layer, 8, sub_801EC3C); + result = sub_801F100(I(gPlayer.qWorldY) + gPlayer.spriteOffsetY, I(gPlayer.qWorldX), gPlayer.layer, 8, sub_801EC3C); if (result < 0) { - gPlayer.y += Q(result); + gPlayer.qWorldY += Q(result); gPlayer.moveState &= ~MOVESTATE_8; gPlayer.moveState |= MOVESTATE_IN_AIR; mpp->unk60 = 30; @@ -1269,15 +1272,15 @@ void sub_8017F34(void) } if (mpp->unk44 < 0) { - result = sub_801F100(I(gPlayer.x) - gPlayer.spriteOffsetX, I(gPlayer.y), gPlayer.layer, -8, sub_801EB44); + result = sub_801F100(I(gPlayer.qWorldX) - gPlayer.spriteOffsetX, I(gPlayer.qWorldY), gPlayer.layer, -8, sub_801EB44); if (result < 0) { - gPlayer.x -= Q(result); + gPlayer.qWorldX -= Q(result); } return; } else if (mpp->unk44 > 0) { - result = sub_801F100(I(gPlayer.x) + gPlayer.spriteOffsetX, I(gPlayer.y), gPlayer.layer, 8, sub_801EB44); + result = sub_801F100(I(gPlayer.qWorldX) + gPlayer.spriteOffsetX, I(gPlayer.qWorldY), gPlayer.layer, 8, sub_801EB44); if (result < 0) { - gPlayer.x += Q(result); + gPlayer.qWorldX += Q(result); } return; } @@ -1289,8 +1292,8 @@ void sub_8018120(void) Sprite *s = &mpp->s; if (gPlayer.moveState & MOVESTATE_8 && gPlayer.unk3C == s) { MultiplayerPlayer *otherMpp; - gPlayer.x += Q(mpp->unk44); - gPlayer.y += Q(mpp->unk48) + Q(1); + gPlayer.qWorldX += Q(mpp->unk44); + gPlayer.qWorldY += Q(mpp->unk48) + Q(1); otherMpp = TASK_DATA(gMultiplayerPlayerTasks[SIO_MULTI_CNT->id]); @@ -1389,14 +1392,14 @@ bool32 sub_8018300(void) } if (val2 & 2) { if (val2 & 1) { - if (mpp->pos.x < I(gPlayer.x)) { + if (mpp->pos.x < I(gPlayer.qWorldX)) { gPlayer.moveState &= ~MOVESTATE_FACING_LEFT; } else { gPlayer.moveState |= MOVESTATE_FACING_LEFT; } sub_800DE44(&gPlayer); } else { - if (mpp->pos.x < I(gPlayer.x)) { + if (mpp->pos.x < I(gPlayer.qWorldX)) { gPlayer.moveState |= MOVESTATE_FACING_LEFT; } else { gPlayer.moveState &= ~MOVESTATE_FACING_LEFT; diff --git a/src/game/multiplayer/unknown_task.c b/src/game/multiplayer/unknown_task.c index 0e515cf10..702f530cb 100644 --- a/src/game/multiplayer/unknown_task.c +++ b/src/game/multiplayer/unknown_task.c @@ -106,8 +106,8 @@ void sub_8018AD8(union MultiSioData *recv, u8 i) u32 prevMoveState = gPlayer.moveState & (MOVESTATE_IN_SCRIPTED | MOVESTATE_IGNORE_INPUT | MOVESTATE_400000); if (!(prevMoveState)) { InitializePlayer(&gPlayer); - gPlayer.x = QS(mpp->pos.x); - gPlayer.y = QS(mpp->pos.y - (s8)mpp->unk58[0]); + gPlayer.qWorldX = QS(mpp->pos.x); + gPlayer.qWorldY = QS(mpp->pos.y - (s8)mpp->unk58[0]); m4aMPlayTempoControl(&gMPlayInfo_BGM, 256); gPlayer.moveState = prevMoveState; SPRITE_FLAG_CLEAR(&gPlayer.spriteInfoBody->s, PRIORITY); @@ -121,8 +121,8 @@ void sub_8018AD8(union MultiSioData *recv, u8 i) gPlayer.moveState |= MOVESTATE_IN_AIR; mpp->unk60 = 30; gPlayer.timerInvulnerability = ZONE_TIME_TO_INT(0, 2); - gCamera.x = (I(gPlayer.x) + gCamera.shiftX) - (DISPLAY_WIDTH / 2); - gCamera.y = (I(gPlayer.y) + gCamera.shiftY) - (DISPLAY_HEIGHT / 2); + gCamera.x = (I(gPlayer.qWorldX) + gCamera.shiftX) - (DISPLAY_WIDTH / 2); + gCamera.y = (I(gPlayer.qWorldY) + gCamera.shiftY) - (DISPLAY_HEIGHT / 2); m4aSongNumStart(SE_218); } } diff --git a/src/game/mystery_item_box.c b/src/game/mystery_item_box.c index 4d3b5775b..a062d7a25 100644 --- a/src/game/mystery_item_box.c +++ b/src/game/mystery_item_box.c @@ -132,8 +132,8 @@ static void sub_808616C(void) transform = &itemBox->transform; transform->rotation = 0; - transform->width = 0x100; - transform->height = 0; + transform->qScaleX = Q(1); + transform->qScaleY = 0; transform->x = 0; transform->y = 0; gCurTask->main = sub_808623C; @@ -176,14 +176,14 @@ static void sub_808623C(void) transform->x = itemBox->x - gCamera.x; transform->y = itemBox->y - gCamera.y; - transform->height += 8; + transform->qScaleY += 8; - if (transform->height >= 0x100) { + if (transform->qScaleY >= 0x100) { MapEntity *me; Sprite_MysteryItemBox *itemBox2; itemBox->box.frameFlags &= ~SPRITE_FLAG_MASK_ROT_SCALE_ENABLE; itemBox->identifier.frameFlags &= ~SPRITE_FLAG_MASK_ROT_SCALE_ENABLE; - transform->height = 0x100; + transform->qScaleY = Q(1); itemBox->iconOffsetY = Q(0.0); gCurTask->main = sub_80865E4; @@ -229,14 +229,14 @@ static void sub_808636C(void) transform->x = itemBox->x - gCamera.x; transform->y = itemBox->y - gCamera.y; - transform->height -= 8; + transform->qScaleY -= 8; - if (transform->height < 1) { + if (transform->qScaleY < 1) { MapEntity *me; Sprite_MysteryItemBox *itemBox2; itemBox->box.frameFlags &= ~SPRITE_FLAG_MASK_ROT_SCALE_ENABLE; itemBox->identifier.frameFlags &= ~SPRITE_FLAG_MASK_ROT_SCALE_ENABLE; - transform->height = 0x100; + transform->qScaleY = Q(1); gCurTask->main = sub_808673C; sub_808673C_inline(); @@ -293,7 +293,7 @@ static void sub_8086504(Sprite_MysteryItemBox *itemBox) if (!IS_EXTRA_STAGE(gCurrentLevel)) { if (Div(gRingCount, 100) != Div(prevRingCount, 100) && gGameMode == GAME_MODE_SINGLE_PLAYER) { gNumLives = MIN(gNumLives + 1, 255u); - gUnknown_030054A8.unk3 = 0x10; + gMusicManagerState.unk3 = 0x10; } } @@ -408,8 +408,8 @@ static inline void sub_808679C_inline(void) transform = &itemBox->transform; transform->rotation = 0; - transform->width = 0x100; - transform->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); transform->x = 0; transform->y = 0; gCurTask->main = sub_808636C; @@ -425,8 +425,8 @@ static void sub_808679C(void) transform = &itemBox->transform; transform->rotation = 0; - transform->width = 0x100; - transform->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); transform->x = 0; transform->y = 0; gCurTask->main = sub_808636C; diff --git a/src/game/player_callbacks.c b/src/game/player_callbacks.c index f6abb290f..c1f9020ac 100644 --- a/src/game/player_callbacks.c +++ b/src/game/player_callbacks.c @@ -6,7 +6,7 @@ #include "game/amy_attack_heart_effect.h" #include "game/sa1_sa2_shared/globals.h" #include "game/sa1_sa2_shared/collision.h" -#include "game/stage/game_2.h" +#include "game/stage/grind_effect_2.h" #include "game/stage/dust_effect_braking.h" #include "game/stage/player_controls.h" #include "game/boost_effect.h" @@ -228,7 +228,7 @@ void Player_SonicAmy_WindupSkidAttack(Player *p) p->speedGroundX = +Q(4.0); } } else { - Player_SonicAmy_InitSkidAttackGfxTask(I(p->x), I(p->y), 0); + Player_SonicAmy_InitSkidAttackGfxTask(I(p->qWorldX), I(p->qWorldY), 0); } p->unk72 = 32; @@ -459,8 +459,8 @@ void Player_UpdateHomingPosition(s32 qX, s32 qY) s32 vecTargetX, vecTargetY; s32 sqTargetX, sqTargetY, sqDistance; - vecTargetX = I(gPlayer.x - qX); - vecTargetY = I(gPlayer.y - qY); + vecTargetX = I(gPlayer.qWorldX - qX); + vecTargetY = I(gPlayer.qWorldY - qY); sqTargetX = vecTargetX * vecTargetX; sqTargetY = vecTargetY * vecTargetY; sqDistance = sqTargetX + sqTargetY; // c^2 = a^2 + b^2 @@ -521,7 +521,7 @@ void Player_SonicAmy_WindupStopNSlam(Player *p) PLAYERFN_SET(Player_SonicAmy_StopNSlam); if (p->character == CHARACTER_SONIC) { - Player_Sonic_Bound(I(p->x), I(p->y)); + Player_Sonic_Bound(I(p->qWorldX), I(p->qWorldY)); } else if (p->character == CHARACTER_AMY) { CreateAmyAttackHeartEffect(AMY_HEART_PATTERN_STOP_N_SLAM); } @@ -679,8 +679,8 @@ void Player_Cream_Flying(Player *p) p->speedAirY += Q(PLAYER_FLYING_END_GRAVITY); } - if (p->y < Q(gCamera.minY)) { - p->y = Q(gCamera.minY); + if (p->qWorldY < Q(gCamera.minY)) { + p->qWorldY = Q(gCamera.minY); if (p->speedAirY < 0) p->speedAirY = 0; @@ -935,8 +935,8 @@ void Player_Tails_8012C2C(Player *p) p->speedAirY += Q(PLAYER_FLYING_END_GRAVITY); } - if (p->y < Q(gCamera.minY)) { - p->y = Q(gCamera.minY); + if (p->qWorldY < Q(gCamera.minY)) { + p->qWorldY = Q(gCamera.minY); if (p->speedAirY < 0) p->speedAirY = 0; @@ -978,7 +978,7 @@ void Player_Tails_InitTailSwipe(Player *p) p->moveState |= MOVESTATE_20000000; - sub_80129DC(I(p->x), I(p->y)); + sub_80129DC(I(p->qWorldX), I(p->qWorldY)); m4aSongNumStart(SE_TAILS_TAIL_SWIPE); @@ -1145,7 +1145,7 @@ void Player_Knuckles_InitSpiralAttack(Player *p) p->moveState |= MOVESTATE_20000000; - sub_8012DF8(I(p->x), I(p->y), 0); + sub_8012DF8(I(p->qWorldX), I(p->qWorldY), 0); p->unk72 = 32; @@ -1261,11 +1261,11 @@ void Player_Knuckles_Glide_MainUpdate(Player *p) u16 gravInv = GRAVITY_IS_INVERTED; if (gravInv) { s32 playerBottomX; - s32 playerBottomY = I(p->y); + s32 playerBottomY = I(p->qWorldY); playerBottomY -= 1; playerBottomY -= p->spriteOffsetY; - playerBottomX = I(p->x); + playerBottomX = I(p->qWorldX); playerBottomX -= 1; playerBottomX -= p->spriteOffsetX; @@ -1279,11 +1279,11 @@ void Player_Knuckles_Glide_MainUpdate(Player *p) } } else { s32 playerBottomX; - s32 playerBottomY = I(p->y); + s32 playerBottomY = I(p->qWorldY); playerBottomY += 1; playerBottomY += p->spriteOffsetY; - playerBottomX = I(p->x); + playerBottomX = I(p->qWorldX); playerBottomX -= 1; playerBottomX -= p->spriteOffsetX; @@ -1297,7 +1297,7 @@ void Player_Knuckles_Glide_MainUpdate(Player *p) } } - p->x -= Q(result); + p->qWorldX -= Q(result); } } else { p->moveState &= ~MOVESTATE_FACING_LEFT; @@ -1313,11 +1313,11 @@ void Player_Knuckles_Glide_MainUpdate(Player *p) } else if (result != 0) { if (!GRAVITY_IS_INVERTED) { s32 playerBottomX; - s32 playerBottomY = I(p->y); + s32 playerBottomY = I(p->qWorldY); playerBottomY += 1; playerBottomY += p->spriteOffsetY; - playerBottomX = I(p->x); + playerBottomX = I(p->qWorldX); playerBottomX += 1; playerBottomX += p->spriteOffsetX; @@ -1330,7 +1330,7 @@ void Player_Knuckles_Glide_MainUpdate(Player *p) return; } } - p->x += Q(result); + p->qWorldX += Q(result); } } @@ -1416,7 +1416,7 @@ void Player_Knuckles_GlideHardLandingUpdateAnim(Player *p) if (GRAVITY_IS_INVERTED) offsetY = -offsetY; - CreateBrakingDustEffect(I(p->x), I(p->y) + offsetY); + CreateBrakingDustEffect(I(p->qWorldX), I(p->qWorldY) + offsetY); } sub_8022838(p); @@ -1428,7 +1428,7 @@ void Player_Knuckles_GlideHardLandingUpdateAnim(Player *p) res = -res; } - p->y += Q(res); + p->qWorldY += Q(res); p->rotation = rot; } else if (!(p->moveState & MOVESTATE_8)) { PLAYERFN_SET(Player_Knuckles_FallAfterGlide); @@ -1470,7 +1470,7 @@ void sub_80135BC(Player *p) if (GRAVITY_IS_INVERTED) offsetY = -offsetY; - p->y += Q(offsetY); + p->qWorldY += Q(offsetY); } sub_8022318(p); @@ -1488,11 +1488,11 @@ s32 sub_8013644(Player *p) s32 pX; s32 pY; - pX = I(p->x); + pX = I(p->qWorldX); pX -= 2; pX -= p->spriteOffsetX; - pY = I(p->y); + pY = I(p->qWorldY); result = sub_801E4E4(pX, pY, p->layer, -8, &rot, sub_801ED24); @@ -1504,11 +1504,11 @@ s32 sub_8013644(Player *p) } else { s32 pX; s32 pY; - pX = I(p->x); + pX = I(p->qWorldX); pX += 2; pX += p->spriteOffsetX; - pY = I(p->y); + pY = I(p->qWorldY); result = sub_801E4E4(pX, pY, p->layer, +8, &rot, sub_801ED24); @@ -1548,9 +1548,9 @@ void Player_Knuckles_Climb_80136E8(Player *p) offsetY = -offsetY; } - p->y -= offsetY; + p->qWorldY -= offsetY; r2 = sub_8013644(p); - p->y += offsetY; + p->qWorldY += offsetY; if (r2 > 2) { Player_Knuckles_InitClimbPullUpEdge(p); @@ -1580,13 +1580,13 @@ void Player_Knuckles_Climb_80136E8(Player *p) offsetY = -offsetY; } - p->y -= offsetY; + p->qWorldY -= offsetY; r2 = sub_8029AC0(p, &rot, NULL); - p->y += offsetY; + p->qWorldY += offsetY; if (r2 < 0) { p->charState = CHARSTATE_KNUCKLES_CLIMB_B; - p->y -= Q(r2); + p->qWorldY -= Q(r2); } else { s32 speed; p->charState = CHARSTATE_KNUCKLES_CLIMB_B; @@ -1604,9 +1604,9 @@ void Player_Knuckles_Climb_80136E8(Player *p) offsetY = -offsetY; } - p->y += offsetY; + p->qWorldY += offsetY; r2 = sub_8013644(p); - p->y -= offsetY; + p->qWorldY -= offsetY; if (r2 > 0) { sub_8013CA0(p); @@ -1621,9 +1621,9 @@ void Player_Knuckles_Climb_80136E8(Player *p) if (r2 < 0) { if (GRAVITY_IS_INVERTED) { - p->y -= Q(r2); + p->qWorldY -= Q(r2); } else { - p->y += Q(r2); + p->qWorldY += Q(r2); } p->rotation = rot; @@ -1656,7 +1656,7 @@ void Player_Knuckles_Climb_80136E8(Player *p) if (!(p->heldInput & (DPAD_DOWN | DPAD_UP))) { r2 = sub_8029B0C(p, &rot, NULL); if (r2 < 0) { - p->y += Q(r2); + p->qWorldY += Q(r2); p->rotation = rot; p->speedGroundX = 0; @@ -1864,9 +1864,9 @@ void Player_Knuckles_InitClimbPullUpEdge(Player *p) p->charState = CHARSTATE_KNUCKLES_CLIMB_D; if (GRAVITY_IS_INVERTED) { - p->y += Q(p->spriteOffsetY); + p->qWorldY += Q(p->spriteOffsetY); } else { - p->y -= Q(p->spriteOffsetY); + p->qWorldY -= Q(p->spriteOffsetY); } PLAYERFN_SET(Player_Knuckles_ClimbPullUpEdge); @@ -1966,7 +1966,7 @@ void Player_Knuckles_WindupDrillClaw(Player *p) p->speedAirX = Q(0.0); p->speedAirY = Q(1.0); - sub_8012DF8(I(p->x), I(p->y), 1); + sub_8012DF8(I(p->qWorldX), I(p->qWorldY), 1); PLAYERFN_SET_AND_CALL(Player_Knuckles_DrillClaw, p); } @@ -2007,15 +2007,15 @@ void Player_Knuckles_ClimbPullUpEdge(Player *p) p->rotation = 0; if (GRAVITY_IS_INVERTED) { - p->y += Q(p->spriteOffsetY); + p->qWorldY += Q(p->spriteOffsetY); } else { - p->y -= Q(p->spriteOffsetY); + p->qWorldY -= Q(p->spriteOffsetY); } if (p->moveState & MOVESTATE_FACING_LEFT) { - p->x -= Q(16.0); + p->qWorldX -= Q(16.0); } else { - p->x += Q(16.0); + p->qWorldX += Q(16.0); } PLAYERFN_CALL(Player_TouchGround, p); diff --git a/src/game/sa1_sa2_shared/collision.c b/src/game/sa1_sa2_shared/collision.c index 58b3fb264..17c8b5c93 100644 --- a/src/game/sa1_sa2_shared/collision.c +++ b/src/game/sa1_sa2_shared/collision.c @@ -26,7 +26,7 @@ u32 CheckRectCollision_SpritePlayer(Sprite *s, s32 sx, s32 sy, Player *p, struct return result; } - if (RECT_COLLISION(sx, sy, &s->hitboxes[0], I(p->x), I(p->y), rectPlayer)) { + if (RECT_COLLISION(sx, sy, &s->hitboxes[0], I(p->qWorldX), I(p->qWorldY), rectPlayer)) { result |= COLL_FLAG_80000; } @@ -51,7 +51,7 @@ u32 sub_800C060(Sprite *s, s32 sx, s32 sy, Player *p) ip = TRUE; } - if (RECT_COLLISION_2(sx, sy, &s->hitboxes[0], p->x, p->y, (struct Rect8 *)rectPlayer) && (p->speedAirY >= 0)) { + if (RECT_COLLISION_2(sx, sy, &s->hitboxes[0], p->qWorldX, p->qWorldY, (struct Rect8 *)rectPlayer) && (p->speedAirY >= 0)) { #ifndef NON_MATCHING register s32 y asm("r1"); @@ -81,7 +81,7 @@ u32 sub_800C060(Sprite *s, s32 sx, s32 sy, Player *p) y -= rectPlayer[3]; } y = Q(y); - p->y = Q_24_8_FRAC(p->y) + (y); + p->qWorldY = Q_24_8_FRAC(p->qWorldY) + (y); } else if (ip && !(p->moveState & MOVESTATE_8)) { p->moveState &= ~MOVESTATE_20; p->moveState |= MOVESTATE_IN_AIR; @@ -107,7 +107,7 @@ bool32 sub_800C204(Sprite *s, s32 sx, s32 sy, s16 hbIndex, Player *p, s16 hbInde return FALSE; } - if ((HB_COLLISION(sx, sy, s->hitboxes[hbIndex], I(p->x), I(p->y), sprPlayer->hitboxes[hbIndexPlayer]))) { + if ((HB_COLLISION(sx, sy, s->hitboxes[hbIndex], I(p->qWorldX), I(p->qWorldY), sprPlayer->hitboxes[hbIndexPlayer]))) { return TRUE; } @@ -131,7 +131,7 @@ bool32 sub_800C320(Sprite *s, s32 sx, s32 sy, s16 hbIndex, Player *p) return FALSE; } - if ((HB_COLLISION(sx, sy, s->hitboxes[hbIndex], I(p->x), I(p->y), sprPlayer->hitboxes[1]))) { + if ((HB_COLLISION(sx, sy, s->hitboxes[hbIndex], I(p->qWorldX), I(p->qWorldY), sprPlayer->hitboxes[1]))) { Collision_AdjustPlayerSpeed(p); return TRUE; } @@ -191,7 +191,7 @@ NONMATCH("asm/non_matching/game/sa1_sa2_shared/collision__sub_800C4FC.inc", bool if (HITBOX_IS_ACTIVE(sprPlayer->hitboxes[1])) { // _0800C5A4 + 0xC - if (HB_COLLISION(sx, sy, s->hitboxes[hbIndex], I(gPlayer.x), I(gPlayer.y), sprPlayer->hitboxes[1])) { + if (HB_COLLISION(sx, sy, s->hitboxes[hbIndex], I(gPlayer.qWorldX), I(gPlayer.qWorldY), sprPlayer->hitboxes[1])) { // _0800C648 if (IS_MULTI_PLAYER) { struct UNK_3005510 *v = sub_8019224(); @@ -213,7 +213,7 @@ NONMATCH("asm/non_matching/game/sa1_sa2_shared/collision__sub_800C4FC.inc", bool // _0800C674: if (HITBOX_IS_ACTIVE(sprPlayer->hitboxes[0]) - && (HB_COLLISION(sx, sy, s->hitboxes[hbIndex], I(gPlayer.x), I(gPlayer.y), sprPlayer->hitboxes[0]))) { + && (HB_COLLISION(sx, sy, s->hitboxes[hbIndex], I(gPlayer.qWorldX), I(gPlayer.qWorldY), sprPlayer->hitboxes[0]))) { if (!(gPlayer.itemEffect & PLAYER_ITEM_EFFECT__INVINCIBILITY)) { sub_800CBA4(&gPlayer); } else { @@ -277,7 +277,7 @@ bool32 sub_800C84C(Sprite *s, s32 sx, s32 sy) return result; } - if ((HB_COLLISION(sx, sy, s->hitboxes[0], I(p->x), I(p->y), sprPlayer->hitboxes[0]))) { + if ((HB_COLLISION(sx, sy, s->hitboxes[0], I(p->qWorldX), I(p->qWorldY), sprPlayer->hitboxes[0]))) { sub_800CBA4(p); result = TRUE; } @@ -295,7 +295,7 @@ bool32 sub_800C944(Sprite *s, s32 sx, s32 sy) Sprite *sprPlayer = &psi->s; if (PLAYER_IS_ALIVE && HITBOX_IS_ACTIVE(sprPlayer->hitboxes[1]) && (HITBOX_IS_ACTIVE(s->hitboxes[0]))) { - if (HB_COLLISION(sx, sy, s->hitboxes[0], I(p->x), I(p->y), sprPlayer->hitboxes[1])) { + if (HB_COLLISION(sx, sy, s->hitboxes[0], I(p->qWorldX), I(p->qWorldY), sprPlayer->hitboxes[1])) { result = TRUE; } } @@ -309,7 +309,7 @@ bool32 sub_800CA20(Sprite *s, s32 sx, s32 sy, s16 hbIndex, Player *p) Sprite *sprPlayer = &psi->s; if (IS_ALIVE(p) && (HITBOX_IS_ACTIVE(s->hitboxes[hbIndex]) && HITBOX_IS_ACTIVE(sprPlayer->hitboxes[0]))) { - if (HB_COLLISION(sx, sy, s->hitboxes[hbIndex], I(p->x), I(p->y), sprPlayer->hitboxes[0])) { + if (HB_COLLISION(sx, sy, s->hitboxes[hbIndex], I(p->qWorldX), I(p->qWorldY), sprPlayer->hitboxes[0])) { sub_800CBA4(p); return TRUE; } @@ -387,7 +387,7 @@ bool32 sub_800CBA4(Player *p) rings = rings2; } - InitScatteringRings(I(p->x), I(p->y), rings); + InitScatteringRings(I(p->qWorldX), I(p->qWorldY), rings); if (IS_MULTI_PLAYER) { struct UNK_3005510 *unk = sub_8019224(); @@ -501,8 +501,8 @@ u32 sub_800CDBC(Sprite *s, s32 sx, s32 sy, Player *p) // TODO: Remove gotos u32 sub_800CE94(Sprite *s, s32 sx, s32 sy, struct Rect8 *inRect, Player *p) { - s32 px = I(p->x); - s32 py = I(p->y); + s32 px = I(p->qWorldX); + s32 py = I(p->qWorldY); u32 result = 0; s32 r1; s32 r3, r6; @@ -693,7 +693,7 @@ bool32 sub_800DD54(Player *p) rings = 10; } - InitScatteringRings(I(p->x), I(p->y), rings); + InitScatteringRings(I(p->qWorldX), I(p->qWorldY), rings); gRingCount -= rings; unk = sub_8019224(); @@ -755,7 +755,7 @@ bool32 sub_800DE44(Player *p) rings = 5; } - InitScatteringRings(I(p->x), I(p->y), rings); + InitScatteringRings(I(p->qWorldX), I(p->qWorldY), rings); gRingCount -= rings; unk = sub_8019224(); diff --git a/src/game/sa1_sa2_shared/demo_manager.c b/src/game/sa1_sa2_shared/demo_manager.c index 77180b853..cec3fc282 100644 --- a/src/game/sa1_sa2_shared/demo_manager.c +++ b/src/game/sa1_sa2_shared/demo_manager.c @@ -113,7 +113,7 @@ void Task_DemoManagerMain(void) gBldRegs.bldCnt = (BLDCNT_EFFECT_LIGHTEN | BLDCNT_TGT1_ALL); gBldRegs.bldY = 0; - gUnknown_030054A8.unk0 = 0xFF; + gMusicManagerState.unk0 = 0xFF; CreateMusicFadeoutTask(64); } else if (gCheckpointTime > (u32)ZONE_TIME_TO_INT(0, 24.5)) { dm->playerPressedStart = FALSE; @@ -123,7 +123,7 @@ void Task_DemoManagerMain(void) gBldRegs.bldCnt = (BLDCNT_EFFECT_LIGHTEN | BLDCNT_TGT1_ALL); gBldRegs.bldY = 0; - gUnknown_030054A8.unk0 = 0xFF; + gMusicManagerState.unk0 = 0xFF; CreateMusicFadeoutTask(64); } @@ -204,7 +204,7 @@ void CreateMusicFadeoutTask(u16 factor) DemoMusicFadeout *mf = TASK_DATA(t); mf->volume = 0x100; mf->unk2 = (s32)mf->volume / factor; - gUnknown_030054A8.unk0 = 0xFF; + gMusicManagerState.unk0 = 0xFF; } void Task_DemoManagerMusicFadeout(void) diff --git a/src/game/sa1_sa2_shared/globals.c b/src/game/sa1_sa2_shared/globals.c index 21cf83b27..65badfd08 100644 --- a/src/game/sa1_sa2_shared/globals.c +++ b/src/game/sa1_sa2_shared/globals.c @@ -38,7 +38,7 @@ u32 gCourseTime = 0; CheeseTarget ALIGNED(8) gCheeseTarget = {}; u32 gMPStageStartFrameCount = 0; -UNK_30054A8 ALIGNED(8) gUnknown_030054A8 = {}; +MusicManagerState ALIGNED(8) gMusicManagerState = {}; u8 gUnknown_030054B0 = 0; s8 ALIGNED(4) gUnknown_030054B4[MULTI_SIO_PLAYERS_MAX] = {}; u8 gUnknown_030054B8 = 0; diff --git a/src/game/sa1_sa2_shared/input_buffer.c b/src/game/sa1_sa2_shared/input_buffer.c index c4c7186e8..8e5d591bf 100644 --- a/src/game/sa1_sa2_shared/input_buffer.c +++ b/src/game/sa1_sa2_shared/input_buffer.c @@ -5,11 +5,11 @@ #include "constants/characters.h" -// TODO(Jace): gUnknown_080D5254 is used in sakit/music_manager.c, with a different type. +// TODO(Jace): gUnkMusicMgrData is used in sakit/music_manager.c, with a different type. // That doesn't make any sense... -// const u8 gUnknown_080D5254[] = { 0x04, 0x01, 0x00, 0xF0, 0x08, 0x10, 0xF0, 0x08, 0x00, +// const u8 gUnkMusicMgrData[] = { 0x04, 0x01, 0x00, 0xF0, 0x08, 0x10, 0xF0, 0x08, 0x00, // 0xF0, 0x08, 0x10, 0xF0, 0x01 }; -extern const u8 gUnknown_080D5254[]; +extern const u8 gUnkMusicMgrData[]; const u8 gUnknown_080D5262[] = { 0x04, // r6 0x01, // r8 @@ -31,7 +31,7 @@ const u8 gUnknown_080D52D2[] = { 0x04, 0x02, 0x10, 0xF0, 0x0F, 0x00, 0xF0, 0x0F, const u8 *gUnknown_08c87098_unused[64] = { 0 }; -const u8 *unk_8C87198[3] = { gUnknown_080D5254, gUnknown_080D5262, INPUTBUF_NULL_PTR }; +const u8 *unk_8C87198[3] = { gUnkMusicMgrData, gUnknown_080D5262, INPUTBUF_NULL_PTR }; const u8 *unk_8C871A4[3] = { gUnknown_080D5270, gUnknown_080D527E, INPUTBUF_NULL_PTR }; diff --git a/src/game/sa1_sa2_shared/interactables/044.c b/src/game/sa1_sa2_shared/interactables/044.c index 6262ed03c..533ef6d93 100644 --- a/src/game/sa1_sa2_shared/interactables/044.c +++ b/src/game/sa1_sa2_shared/interactables/044.c @@ -37,11 +37,11 @@ void Task_Interactable_044(void) screenY = TO_WORLD_POS(me->y, regionY); left = sLeft; - playerX = I(gPlayer.x); + playerX = I(gPlayer.qWorldX); if ((left <= playerX) && sRight >= playerX) { top = sTop; - playerY = I(gPlayer.y); + playerY = I(gPlayer.qWorldY); if ((top <= playerY) && sBottom >= playerY) { u32 moveState = gPlayer.moveState; diff --git a/src/game/sa1_sa2_shared/interactables/grind_rail.c b/src/game/sa1_sa2_shared/interactables/grind_rail.c index e3e90a908..2bfc14935 100644 --- a/src/game/sa1_sa2_shared/interactables/grind_rail.c +++ b/src/game/sa1_sa2_shared/interactables/grind_rail.c @@ -36,7 +36,7 @@ static void Task_GrindRail(void) { Player *p = &gPlayer; - s32 r7 = GRAVITY_IS_INVERTED ? I(p->y) - p->spriteOffsetY : I(p->y) + p->spriteOffsetY; + s32 r7 = GRAVITY_IS_INVERTED ? I(p->qWorldY) - p->spriteOffsetY : I(p->qWorldY) + p->spriteOffsetY; s16 x, y; @@ -56,8 +56,8 @@ static void Task_GrindRail(void) if (!(p->moveState & MOVESTATE_DEAD)) { // TODO: create a collision macro for entity data - if (((x + (me->d.sData[0] * TILE_WIDTH)) <= I(p->x) - && ((x + (me->d.sData[0] * TILE_WIDTH)) + (me->d.uData[2] * TILE_WIDTH) >= I(p->x))) + if (((x + (me->d.sData[0] * TILE_WIDTH)) <= I(p->qWorldX) + && ((x + (me->d.sData[0] * TILE_WIDTH)) + (me->d.uData[2] * TILE_WIDTH) >= I(p->qWorldX))) && (y + (me->d.sData[1] * TILE_WIDTH) <= r7 && y + (me->d.sData[1] * TILE_WIDTH) + (me->d.uData[3] * TILE_WIDTH) >= r7)) { bool32 r6 = FALSE; @@ -72,7 +72,7 @@ static void Task_GrindRail(void) if ((p->speedAirY >= 0) && r6 && !(kind & RAIL_KIND_80)) { if ((p->moveState & MOVESTATE_1000000)) { if ((!(kind & RAIL_KIND_1) && (p->moveState & MOVESTATE_FACING_LEFT) - && (I(p->x) < x + (me->d.sData[0] * TILE_WIDTH) + ((me->d.uData[2] * (TILE_WIDTH / 2))) + && (I(p->qWorldX) < x + (me->d.sData[0] * TILE_WIDTH) + ((me->d.uData[2] * (TILE_WIDTH / 2))) || ((p->heldInput & gPlayerControls.jump) && (kind & RAIL_KIND_2))))) { if ((kind & RAIL_KIND_2)) { p->transition = PLTRANS_GRIND_RAIL_END_AIR; @@ -82,7 +82,7 @@ static void Task_GrindRail(void) } *(u8 *)(TASK_DATA(gCurTask) + offsetof(Sprite_GrindRail, kind)) |= RAIL_KIND_80; } else if ((kind & RAIL_KIND_1) && !(p->moveState & MOVESTATE_FACING_LEFT) - && (I(p->x) > x + (me->d.sData[0] * TILE_WIDTH) + ((me->d.uData[2] * (TILE_WIDTH / 2))) + && (I(p->qWorldX) > x + (me->d.sData[0] * TILE_WIDTH) + ((me->d.uData[2] * (TILE_WIDTH / 2))) || ((p->heldInput & gPlayerControls.jump) && (kind & RAIL_KIND_2)))) { if ((kind & RAIL_KIND_2)) { p->transition = PLTRANS_GRIND_RAIL_END_AIR; @@ -92,9 +92,10 @@ static void Task_GrindRail(void) *(u8 *)(TASK_DATA(gCurTask) + offsetof(Sprite_GrindRail, kind)) |= RAIL_KIND_80; } } else if (((kind & RAIL_KIND_1) - && Q_24_8_TO_INT(p->x) < (x + (me->d.sData[0] * TILE_WIDTH)) + ((me->d.uData[2] * (TILE_WIDTH / 2)))) + && Q_24_8_TO_INT(p->qWorldX) < (x + (me->d.sData[0] * TILE_WIDTH)) + ((me->d.uData[2] * (TILE_WIDTH / 2)))) || (!(kind & RAIL_KIND_1) - && Q_24_8_TO_INT(p->x) > (x + (me->d.sData[0] * TILE_WIDTH)) + ((me->d.uData[2] * (TILE_WIDTH / 2))))) { + && Q_24_8_TO_INT(p->qWorldX) + > (x + (me->d.sData[0] * TILE_WIDTH)) + ((me->d.uData[2] * (TILE_WIDTH / 2))))) { p->transition = PLTRANS_GRINDING; p->unk6E = 0; @@ -140,13 +141,14 @@ static void Task_GrindRail_Air(void) y = TO_WORLD_POS(me->y, regionY); if (!(p->moveState & MOVESTATE_DEAD)) { - if ((x + (me->d.sData[0] * TILE_WIDTH) <= I(p->x) && (x + (me->d.sData[0] * TILE_WIDTH) + (me->d.uData[2] * TILE_WIDTH) >= I(p->x))) - && (y + (me->d.sData[1] * TILE_WIDTH) <= I(p->y) - && y + (me->d.sData[1] * TILE_WIDTH) + (me->d.uData[3] * TILE_WIDTH) >= I(p->y))) { + if ((x + (me->d.sData[0] * TILE_WIDTH) <= I(p->qWorldX) + && (x + (me->d.sData[0] * TILE_WIDTH) + (me->d.uData[2] * TILE_WIDTH) >= I(p->qWorldX))) + && (y + (me->d.sData[1] * TILE_WIDTH) <= I(p->qWorldY) + && y + (me->d.sData[1] * TILE_WIDTH) + (me->d.uData[3] * TILE_WIDTH) >= I(p->qWorldY))) { if ((p->moveState & MOVESTATE_1000000)) { if (((kind & RAIL_KIND_1) && (p->moveState & MOVESTATE_FACING_LEFT) - && (I(p->x) < x + (me->d.sData[0] * TILE_WIDTH) + ((me->d.uData[2] * TILE_WIDTH) >> 1) + && (I(p->qWorldX) < x + (me->d.sData[0] * TILE_WIDTH) + ((me->d.uData[2] * TILE_WIDTH) >> 1) || ((p->heldInput & gPlayerControls.jump) && (kind & RAIL_KIND_2))))) { if ((kind & RAIL_KIND_2)) { p->transition = PLTRANS_GRIND_RAIL_END_AIR; @@ -154,7 +156,7 @@ static void Task_GrindRail_Air(void) } else p->transition = PLTRANS_GRIND_RAIL_END_GROUND; } else if (!(kind & RAIL_KIND_1) && !(p->moveState & MOVESTATE_FACING_LEFT) - && (I(p->x) > x + (me->d.sData[0] * TILE_WIDTH) + ((me->d.uData[2] * TILE_WIDTH) >> 1) + && (I(p->qWorldX) > x + (me->d.sData[0] * TILE_WIDTH) + ((me->d.uData[2] * TILE_WIDTH) >> 1) || ((p->heldInput & gPlayerControls.jump) && (kind & RAIL_KIND_2)))) { if ((kind & RAIL_KIND_2)) { p->transition = PLTRANS_GRIND_RAIL_END_AIR; diff --git a/src/game/sa1_sa2_shared/interactables/pipe.c b/src/game/sa1_sa2_shared/interactables/pipe.c index 41059f386..c5f8e30f6 100644 --- a/src/game/sa1_sa2_shared/interactables/pipe.c +++ b/src/game/sa1_sa2_shared/interactables/pipe.c @@ -49,8 +49,8 @@ static void Task_Pipe_Start(void) screenX = TO_WORLD_POS(spriteX, regionX); screenY = TO_WORLD_POS(me->y, regionY); - if (!(gPlayer.moveState & MOVESTATE_DEAD) && (screenX <= I(gPlayer.x)) && ((screenX + 24) >= I(gPlayer.x)) && (screenY <= I(gPlayer.y)) - && ((screenY + 24) >= I(gPlayer.y)) && (!(gPlayer.moveState & MOVESTATE_80000))) { + if (!(gPlayer.moveState & MOVESTATE_DEAD) && (screenX <= I(gPlayer.qWorldX)) && ((screenX + 24) >= I(gPlayer.qWorldX)) + && (screenY <= I(gPlayer.qWorldY)) && ((screenY + 24) >= I(gPlayer.qWorldY)) && (!(gPlayer.moveState & MOVESTATE_80000))) { u8 flag; gPlayer.transition = PLTRANS_PIPE_A; @@ -59,8 +59,8 @@ static void Task_Pipe_Start(void) flag |= me->unk4 & 0x0F; gPlayer.unk6E = flag; - gPlayer.x = Q(screenX + 12); - gPlayer.y = Q(screenY + 12); + gPlayer.qWorldX = Q(screenX + 12); + gPlayer.qWorldY = Q(screenY + 12); Player_SetMovestate_IsInScriptedSequence(); @@ -93,8 +93,8 @@ static void Task_Pipe_End(void) screenX = TO_WORLD_POS(spriteX, regionX); screenY = TO_WORLD_POS(me->y, regionY); - if (!(gPlayer.moveState & MOVESTATE_DEAD) && (screenX <= I(gPlayer.x)) && ((screenX + 24) >= I(gPlayer.x)) && (screenY <= I(gPlayer.y)) - && ((screenY + 24) >= I(gPlayer.y)) && (gPlayer.moveState & MOVESTATE_80000)) { + if (!(gPlayer.moveState & MOVESTATE_DEAD) && (screenX <= I(gPlayer.qWorldX)) && ((screenX + 24) >= I(gPlayer.qWorldX)) + && (screenY <= I(gPlayer.qWorldY)) && ((screenY + 24) >= I(gPlayer.qWorldY)) && (gPlayer.moveState & MOVESTATE_80000)) { gPlayer.moveState &= ~(MOVESTATE_80000 | MOVESTATE_200 | MOVESTATE_IN_AIR); gPlayer.spriteInfoBody->s.frameFlags &= ~SPRITE_FLAG_MASK_PRIORITY; // priority bits diff --git a/src/game/sa1_sa2_shared/interactables/platform.c b/src/game/sa1_sa2_shared/interactables/platform.c index 9ec0846b4..384949b58 100644 --- a/src/game/sa1_sa2_shared/interactables/platform.c +++ b/src/game/sa1_sa2_shared/interactables/platform.c @@ -197,12 +197,12 @@ void Task_800E89C(void) s->y = posY - gCamera.y + I(platform->unk44); if ((p->moveState & MOVESTATE_8) && (p->unk3C == s)) { - p->x += deltaX; + p->qWorldX += deltaX; if (!GRAVITY_IS_INVERTED) { - p->y += deltaY + Q(1.0); + p->qWorldY += deltaY + Q(1.0); } else { - p->y += deltaY - Q(2.0); + p->qWorldY += deltaY - Q(2.0); } } @@ -213,7 +213,7 @@ void Task_800E89C(void) result = sub_800CCB8(s, x, y, p); if (result & 0x10000) { - p->y += Q_8_8(result); + p->qWorldY += Q_8_8(result); } } @@ -318,7 +318,7 @@ void Task_800EC58(void) result = sub_800CCB8(s, posX, posY, p); if (result & 0x10000) { - p->y += Q_8_8(result); + p->qWorldY += Q_8_8(result); gCurTask->main = Task_800EDF8; platform->unk3C = 30; } @@ -377,7 +377,7 @@ void Task_800EDF8(void) result = sub_800CCB8(s, posX, posY, p); if (result & 0x10000) { - p->y += Q_8_8(result); + p->qWorldY += Q_8_8(result); } if ((IS_MULTI_PLAYER) && ((s8)me->x == -3)) { @@ -462,8 +462,8 @@ void Task_800EFD0(void) gPlayer.moveState &= ~MOVESTATE_8; gPlayer.speedAirY = platform->unk4A; } else { - gPlayer.x += platform->unk48; - gPlayer.y += Q(1.0) + platform->unk4A; + gPlayer.qWorldX += platform->unk48; + gPlayer.qWorldY += Q(1.0) + platform->unk4A; } } } @@ -471,7 +471,7 @@ void Task_800EFD0(void) if (platform->unk3C < 32) { result = sub_800CCB8(s, posX, posY + I(platform->unk44), &gPlayer); if (result & 0x10000) { - gPlayer.y += Q_8_8(result); + gPlayer.qWorldY += Q_8_8(result); } } diff --git a/src/game/sa1_sa2_shared/interactables/platform_square.c b/src/game/sa1_sa2_shared/interactables/platform_square.c index 3369a7cae..463dbbc16 100644 --- a/src/game/sa1_sa2_shared/interactables/platform_square.c +++ b/src/game/sa1_sa2_shared/interactables/platform_square.c @@ -165,41 +165,42 @@ static void Task_Platform_Square(void) if ((p->moveState & MOVESTATE_8) && (p->unk3C == s)) { s32 res, temp, temp2; - p->x += deltaX; + p->qWorldX += deltaX; if (!GRAVITY_IS_INVERTED) { - p->y += deltaY + Q(1.0); + p->qWorldY += deltaY + Q(1.0); } else { - p->y += deltaY - Q(2.0); + p->qWorldY += deltaY - Q(2.0); } - res = sub_801F100(I(gPlayer.y) + gPlayer.spriteOffsetY, I(gPlayer.x) + gPlayer.spriteOffsetX, gPlayer.layer, +8, sub_801EC3C); + res = sub_801F100(I(gPlayer.qWorldY) + gPlayer.spriteOffsetY, I(gPlayer.qWorldX) + gPlayer.spriteOffsetX, gPlayer.layer, +8, + sub_801EC3C); if (res < 0) { - gPlayer.y += Q(res); + gPlayer.qWorldY += Q(res); p->moveState &= ~MOVESTATE_8; p->moveState |= MOVESTATE_IN_AIR; p->unk3C = NULL; } - temp = I(p->x) + 2; - res = sub_801F100(temp + p->spriteOffsetX, I(p->y), p->layer, +8, sub_801EB44); + temp = I(p->qWorldX) + 2; + res = sub_801F100(temp + p->spriteOffsetX, I(p->qWorldY), p->layer, +8, sub_801EB44); if (res < 0) { - p->x += Q(res); + p->qWorldX += Q(res); } - temp2 = I(p->x) - 2; - res = sub_801F100(temp2 - p->spriteOffsetX, I(p->y), p->layer, -8, sub_801EB44); + temp2 = I(p->qWorldX) - 2; + res = sub_801F100(temp2 - p->spriteOffsetX, I(p->qWorldY), p->layer, -8, sub_801EB44); if (res < 0) { - p->x -= Q(res); + p->qWorldX -= Q(res); } - res = sub_801F100(I(p->y) + p->spriteOffsetY, I(p->x) - p->spriteOffsetX, p->layer, +8, sub_801EC3C); + res = sub_801F100(I(p->qWorldY) + p->spriteOffsetY, I(p->qWorldX) - p->spriteOffsetX, p->layer, +8, sub_801EC3C); if (res < 0) { - p->y += Q(res); + p->qWorldY += Q(res); p->moveState &= ~MOVESTATE_8; p->moveState |= MOVESTATE_IN_AIR; @@ -223,7 +224,7 @@ static void Task_Platform_Square(void) p->transition = PLTRANS_PT4; } - p->y += Q_8_8(result); + p->qWorldY += Q_8_8(result); if (result & 0x20000) { if (p->speedAirY <= 0) @@ -236,7 +237,7 @@ static void Task_Platform_Square(void) p->speedAirY = 0; } - res = sub_801F100(I(p->y) + p->spriteOffsetY, I(p->x), p->layer, 8, sub_801EC3C); + res = sub_801F100(I(p->qWorldY) + p->spriteOffsetY, I(p->qWorldX), p->layer, 8, sub_801EC3C); if ((res < 0) && (deltaY > 0)) { Platform_Square_KillPlayer(); @@ -245,7 +246,7 @@ static void Task_Platform_Square(void) if (result & 0x10000) { if (GRAVITY_IS_INVERTED) { - p->y -= Q_8_8(result); + p->qWorldY -= Q_8_8(result); s->hitboxes[0].left += 16; s->hitboxes[0].right -= 16; @@ -254,18 +255,18 @@ static void Task_Platform_Square(void) s->hitboxes[0].left -= 16; s->hitboxes[0].right += 16; - p->y += Q_8_8(result); + p->qWorldY += Q_8_8(result); p->moveState = movStateCopy; if (otherRes & 0xC0000) { s32 tempXX = (s16)(otherRes & 0xFF00); s16 value = tempXX; if (value < 0) { - p->x += -Q(16.0) + value; + p->qWorldX += -Q(16.0) + value; } if (value > 0) { - p->x += +Q(16.0) + value; + p->qWorldX += +Q(16.0) + value; } p->speedAirX = 0; @@ -273,28 +274,28 @@ static void Task_Platform_Square(void) } if (otherRes & 0x10000) { - s32 newRes = sub_801F100(I(p->y) - p->spriteOffsetY, I(p->x), p->layer, -8, sub_801EC3C); + s32 newRes = sub_801F100(I(p->qWorldY) - p->spriteOffsetY, I(p->qWorldX), p->layer, -8, sub_801EC3C); if (newRes < 0) { if (deltaY < 0) { Platform_Square_KillPlayer(); } else { - p->y -= Q_8_8(result); + p->qWorldY -= Q_8_8(result); p->speedGroundX = 0; } } else { - p->y -= Q_8_8(result); + p->qWorldY -= Q_8_8(result); p->speedGroundX = 0; p->speedAirX = 0; p->speedAirY = 0; } } else { - p->y -= Q_8_8(result); + p->qWorldY -= Q_8_8(result); } } else { s32 newRes; p->speedAirY = 0; - newRes = sub_801F100(I(p->y) - p->spriteOffsetY, I(p->x), p->layer, -8, sub_801EC3C); + newRes = sub_801F100(I(p->qWorldY) - p->spriteOffsetY, I(p->qWorldX), p->layer, -8, sub_801EC3C); if ((newRes < 0) && (deltaY < 0)) { Platform_Square_KillPlayer(); @@ -306,20 +307,20 @@ static void Task_Platform_Square(void) if ((result & 0xC0000) && !(p->moveState & MOVESTATE_8) && !(p->unk3C == s)) { s32 tempXX = (s16)(result & 0xFF00); s16 tempX = tempXX; - p->x += tempX; + p->qWorldX += tempX; p->speedAirX = 0; p->speedGroundX = 0; if (result & 0x40000) { - s32 tempXVal = I(p->x) + 2; - if (sub_801F100(tempXVal + p->spriteOffsetX, I(p->y), p->layer, -8, sub_801EB44) < 0) { + s32 tempXVal = I(p->qWorldX) + 2; + if (sub_801F100(tempXVal + p->spriteOffsetX, I(p->qWorldY), p->layer, -8, sub_801EB44) < 0) { Platform_Square_KillPlayer(); } } if (result & 0x80000) { - s32 tempXVal = I(p->x) - 2; - if (sub_801F100(tempXVal - p->spriteOffsetX, I(p->y), p->layer, +8, sub_801EB44) < 0) { + s32 tempXVal = I(p->qWorldX) - 2; + if (sub_801F100(tempXVal - p->spriteOffsetX, I(p->qWorldY), p->layer, +8, sub_801EB44) < 0) { Platform_Square_KillPlayer(); } } diff --git a/src/game/sa1_sa2_shared/interactables/platform_thin.c b/src/game/sa1_sa2_shared/interactables/platform_thin.c index 049864799..676f34c8d 100644 --- a/src/game/sa1_sa2_shared/interactables/platform_thin.c +++ b/src/game/sa1_sa2_shared/interactables/platform_thin.c @@ -149,7 +149,7 @@ static void Task_PlatformThinMain(void) u32 temp2 = sub_800CCB8(s, x, y, player); if (temp2 & 0xC0000) { if (sub_80111F0(s, x, y, player) & 0xC0000) { - player->x += (s16)(temp2 & 0xFF00); + player->qWorldX += (s16)(temp2 & 0xFF00); player->speedAirX = 0; } } @@ -168,7 +168,7 @@ static void Task_PlatformThinMain(void) something = TRUE; break; } - player->y += (s16)(temp2 << 8); + player->qWorldY += (s16)(temp2 << 8); player->speedAirY = 0; break; case CHARACTER_SONIC: @@ -181,7 +181,7 @@ static void Task_PlatformThinMain(void) } } default: - player->y += (s16)(temp2 << 8); + player->qWorldY += (s16)(temp2 << 8); player->speedAirY = 0; break; } @@ -247,8 +247,8 @@ NONMATCH("asm/non_matching/game/sa1_sa2_shared/interactables/CreatePlatformBreak // Init transform transform->rotation = 0; - transform->width = 0x100; - transform->height = 0x100; + transform->qScaleX = Q(1); + transform->qScaleY = Q(1); transform->x = x; transform->y = y; @@ -343,12 +343,12 @@ static void Task_PlatformBreakParticlesMain(void) transform->x -= platform->unkF0 * 2; - width = transform->width + 8; + width = transform->qScaleX + 8; if (width > 0x200) { width = 0x200; } - transform->width = width; - transform->height = width; + transform->qScaleX = width; + transform->qScaleY = width; transform->rotation -= 0x2A; s->frameFlags &= ~0x1F; @@ -373,8 +373,8 @@ static void Task_PlatformBreakParticlesMain(void) transform->x += platform->unkF0; - transform->width = width; - transform->height = width; + transform->qScaleX = width; + transform->qScaleY = width; transform->rotation += 0x2A; s->frameFlags &= ~0x1F; @@ -398,8 +398,8 @@ static void Task_PlatformBreakParticlesMain(void) transform->y -= gCamera.y; transform->x += platform->unkF0 * 2; - transform->width = width; - transform->height = width; + transform->qScaleX = width; + transform->qScaleY = width; transform->rotation += 0xE; s->frameFlags &= ~0x1F; @@ -423,8 +423,8 @@ static void Task_PlatformBreakParticlesMain(void) transform->y -= gCamera.y; transform->x -= platform->unkF0; - transform->width = width; - transform->height = width; + transform->qScaleX = width; + transform->qScaleY = width; transform->rotation -= 0xE; s->frameFlags &= ~0x1F; diff --git a/src/game/sa1_sa2_shared/interactables/ramp.c b/src/game/sa1_sa2_shared/interactables/ramp.c index 3f0b325cb..41f2f5de2 100644 --- a/src/game/sa1_sa2_shared/interactables/ramp.c +++ b/src/game/sa1_sa2_shared/interactables/ramp.c @@ -106,14 +106,14 @@ static void Task_Ramp(void) if (((r1 & 0x80000) && (ramp->unk3C & 2) && (player->speedAirX > -1)) || ((r1 & 0x40000) && (!(ramp->unk3C & 2)) && (player->speedAirX < 1))) { - player->x += (s16)(r1 & 0xFF00); + player->qWorldX += (s16)(r1 & 0xFF00); player->speedAirX = 0; player->speedGroundX = 0; } else if (!(ramp->unk3C & 2)) { s32 hbLeft = screenX + s->hitboxes[0].left; s32 hbWidth = s->hitboxes[0].right - s->hitboxes[0].left; - s32 halfWidth = I(player->x) - hbLeft; + s32 halfWidth = I(player->qWorldX) - hbLeft; if (halfWidth > 0) { if (halfWidth > hbWidth) { if (!(player->moveState & MOVESTATE_IN_AIR) && (player->speedGroundX > Q(4))) { @@ -124,7 +124,7 @@ static void Task_Ramp(void) player->moveState &= ~MOVESTATE_8; player->moveState |= MOVESTATE_IN_AIR; } else { - s32 playerMiddleY = I(player->y) + player->spriteOffsetY - screenY; + s32 playerMiddleY = I(player->qWorldY) + player->spriteOffsetY - screenY; s32 temp6 = I(s->hitboxes[0].top * (Q(halfWidth) / hbWidth)); if (playerMiddleY >= temp6) { @@ -138,7 +138,7 @@ static void Task_Ramp(void) player->unk6E = ((ramp->unk3C & 1) * 3) + 2; } } else { - player->y += Q(temp6 - playerMiddleY); + player->qWorldY += Q(temp6 - playerMiddleY); player->rotation = 0; player->moveState |= MOVESTATE_8; @@ -156,12 +156,12 @@ static void Task_Ramp(void) } } else { if (var) { - if (((ramp->unk3C & 2) != 0 && I(player->x) < s->x) || ((ramp->unk3C & 2) == 0 && I(player->x) > s->x)) { + if (((ramp->unk3C & 2) != 0 && I(player->qWorldX) < s->x) || ((ramp->unk3C & 2) == 0 && I(player->qWorldX) > s->x)) { if (!(player->moveState & MOVESTATE_IN_AIR) && player->speedGroundX > Q(4)) { player->transition = PLTRANS_RAMP_AND_DASHRING; player->unk6E = (ramp->unk3C & 1) * 3; } - } else if (((ramp->unk3C & 2) != 0 && I(player->x) > s->x) || ((ramp->unk3C & 2) == 0 && I(player->x) < s->x)) { + } else if (((ramp->unk3C & 2) != 0 && I(player->qWorldX) > s->x) || ((ramp->unk3C & 2) == 0 && I(player->qWorldX) < s->x)) { player->moveState &= ~MOVESTATE_8; player->unk3C = NULL; } diff --git a/src/game/sa1_sa2_shared/interactables/slidy_ice.c b/src/game/sa1_sa2_shared/interactables/slidy_ice.c index 47901ac56..be7693ad9 100644 --- a/src/game/sa1_sa2_shared/interactables/slidy_ice.c +++ b/src/game/sa1_sa2_shared/interactables/slidy_ice.c @@ -37,10 +37,10 @@ void Task_SlidyIce(void) if (!(gPlayer.moveState & MOVESTATE_DEAD)) { s32 posX = (screenX + me->offsetX * TILE_WIDTH); - if ((posX <= I(gPlayer.x)) && ((posX + me->width * TILE_WIDTH) >= I(gPlayer.x))) { + if ((posX <= I(gPlayer.qWorldX)) && ((posX + me->width * TILE_WIDTH) >= I(gPlayer.qWorldX))) { s32 posY = screenY + me->offsetY * TILE_WIDTH; - if ((posY <= I(gPlayer.y)) && ((posY + me->height * TILE_WIDTH) >= I(gPlayer.y))) { + if ((posY <= I(gPlayer.qWorldY)) && ((posY + me->height * TILE_WIDTH) >= I(gPlayer.qWorldY))) { gPlayer.moveState |= MOVESTATE_ICE_SLIDE; } } diff --git a/src/game/sa1_sa2_shared/item_box.c b/src/game/sa1_sa2_shared/item_box.c index 9c8651c5a..7aa61de93 100644 --- a/src/game/sa1_sa2_shared/item_box.c +++ b/src/game/sa1_sa2_shared/item_box.c @@ -168,7 +168,7 @@ void sub_800B1AC(Entity_ItemBox *itembox) } \ gNumLives = newLives; \ \ - gUnknown_030054A8.unk3 = 16; \ + gMusicManagerState.unk3 = 16; \ } \ } \ \ @@ -195,7 +195,7 @@ void ApplyItemboxEffect(Entity_ItemBox *itembox) } gNumLives = newLives; - gUnknown_030054A8.unk3 = 16; + gMusicManagerState.unk3 = 16; } break; case ITEM__SHIELD: { @@ -228,7 +228,7 @@ void ApplyItemboxEffect(Entity_ItemBox *itembox) if (IS_SINGLE_PLAYER || !(gPlayer.itemEffect & PLAYER_ITEM_EFFECT__INVINCIBILITY)) { gPlayer.itemEffect |= PLAYER_ITEM_EFFECT__INVINCIBILITY; CreateItemTask_Invincibility(gPlayer.unk60); - gUnknown_030054A8.unk2 = 16; + gMusicManagerState.unk2 = 16; } } break; @@ -297,8 +297,8 @@ void ApplyItemboxEffect(Entity_ItemBox *itembox) continue; mpp = TASK_DATA(gMultiplayerPlayerTasks[playerId]); - boxToPlayerX = SQUARE(I(gPlayer.x) - mpp->pos.x); - boxToPlayerY = SQUARE(I(gPlayer.y) - mpp->pos.y); + boxToPlayerX = SQUARE(I(gPlayer.qWorldX) - mpp->pos.x); + boxToPlayerY = SQUARE(I(gPlayer.qWorldY) - mpp->pos.y); boxToPlayerMagnitude = boxToPlayerX + boxToPlayerY; if (smallestMagnitude < boxToPlayerMagnitude) { diff --git a/src/game/sa1_sa2_shared/magnetic_ring.c b/src/game/sa1_sa2_shared/magnetic_ring.c index 6f212aebe..43f93dcb2 100644 --- a/src/game/sa1_sa2_shared/magnetic_ring.c +++ b/src/game/sa1_sa2_shared/magnetic_ring.c @@ -14,10 +14,11 @@ #include "constants/zones.h" #define PLAYER_TOUCHING_RING_HB(p, hb, ringIntX, ringIntY) \ - ((((ringIntX - TILE_WIDTH) <= HB_LEFT(I(p.x), hb) && (ringIntX + TILE_WIDTH) >= HB_LEFT(I(p.x), hb)) \ - || ((ringIntX - TILE_WIDTH) >= HB_LEFT(I(p.x), hb) && HB_RIGHT(I(p.x), hb) >= (ringIntX - TILE_WIDTH))) \ - && ((((ringIntY - (TILE_WIDTH * 2)) <= HB_TOP(I(p.y), hb) && ringIntY >= HB_TOP(I(p.y), hb)) \ - || ((ringIntY - (TILE_WIDTH * 2)) >= HB_TOP(I(p.y), hb) && HB_BOTTOM(I(p.y), hb) >= (ringIntY - (TILE_WIDTH * 2)))))) + ((((ringIntX - TILE_WIDTH) <= HB_LEFT(I(p.qWorldX), hb) && (ringIntX + TILE_WIDTH) >= HB_LEFT(I(p.qWorldX), hb)) \ + || ((ringIntX - TILE_WIDTH) >= HB_LEFT(I(p.qWorldX), hb) && HB_RIGHT(I(p.qWorldX), hb) >= (ringIntX - TILE_WIDTH))) \ + && (( \ + ((ringIntY - (TILE_WIDTH * 2)) <= HB_TOP(I(p.qWorldY), hb) && ringIntY >= HB_TOP(I(p.qWorldY), hb)) \ + || ((ringIntY - (TILE_WIDTH * 2)) >= HB_TOP(I(p.qWorldY), hb) && HB_BOTTOM(I(p.qWorldY), hb) >= (ringIntY - (TILE_WIDTH * 2)))))) typedef struct { Sprite s; @@ -55,8 +56,8 @@ void Task_MagneticRing(void) { StageRing *ring = TASK_DATA(gCurTask); Player *p = &gPlayer; - s32 ringToPlayerX = I(p->x) - (u16)ring->s.x; - s32 ringToPlayerY = I(p->y) - (u16)ring->s.y; + s32 ringToPlayerX = I(p->qWorldX) - (u16)ring->s.x; + s32 ringToPlayerY = I(p->qWorldY) - (u16)ring->s.y; s16 sinVal = sub_8004418(ringToPlayerY, ringToPlayerX); s16 ringX, ringY; diff --git a/src/game/sa1_sa2_shared/music_manager.c b/src/game/sa1_sa2_shared/music_manager.c index d3d9f353a..8bc3d0512 100644 --- a/src/game/sa1_sa2_shared/music_manager.c +++ b/src/game/sa1_sa2_shared/music_manager.c @@ -10,8 +10,32 @@ #include "constants/songs.h" static void MusManager_UpdateBgmParams(void); -void sub_800BF74(u16 fadeoutSpeed); +void MusManager_Fadeout(u16 fadeoutSpeed); +#if (GAME == GAME_SA1) +const u16 gLevelSongs[] = { + MUS_NEO_GREEN_HILL__ACT_1, + MUS_NEO_GREEN_HILL__ACT_2, + MUS_SECRET_BASE__ACT_1, + MUS_SECRET_BASE__ACT_2, + MUS_CASINO_PARADISE__ACT_1, + MUS_CASINO_PARADISE__ACT_2, + MUS_ICE_MOUNTAIN__ACT_1, + MUS_ICE_MOUNTAIN__ACT_2, + MUS_ANGEL_ISLAND__ACT_1, + MUS_ANGEL_ISLAND__ACT_2, + MUS_EGG_ROCKET, + MUS_COSMIC_ANGEL, + MUS_X_ZONE, + MUS_EXTRA_BOSS, + + // MP Chao Gardens + MUS_NEO_GREEN_HILL__ACT_1, + MUS_SECRET_BASE__ACT_1, + MUS_CASINO_PARADISE__ACT_1, + MUS_COSMIC_ANGEL, +}; +#elif (GAME == GAME_SA2) const u16 gLevelSongs[] = { MUS_LEAF_FOREST__ACT_1, MUS_LEAF_FOREST__ACT_2, @@ -54,72 +78,113 @@ const u16 gLevelSongs[] = { MUS_BOSS, MUS_DUMMY, }; +#endif -const u16 gUnknown_080D5254[7] = { - SE_260, 0xF000, 0x1008, 0x8F0, 0xF000, 0x1008, 0x1F0, +#if (GAME == GAME_SA1) +const u16 gUnkMusicMgrData[7] = { 0x001D, 0x001E, 0x001F, 0x0020, 0x0031, 0x0032, 0x0019 }; +#elif (GAME == GAME_SA2) +const u16 gUnkMusicMgrData[7] = { SE_260, 0xF000, 0x1008, 0x8F0, 0xF000, 0x1008, 0x1F0 }; +#endif -}; +#if (GAME == GAME_SA1) +#define SET_UNK5(v) +#elif (GAME == GAME_SA2) +#define SET_UNK5(v) gMusicManagerState.unk5 = (v); +#endif void Task_StageMusicManager(void) { +#if (GAME == GAME_SA1) + // TODO: Integrate SA2 version of sound lib! + struct SongHeader *songHeader = gMPlayTable[0].info->songHeader; +#else struct MP2KSongHeader *songHeader = gMPlayTable[0].info->songHeader; +#endif - if ((gUnknown_030054A8.unk0 == 0) && PLAYER_IS_ALIVE) { - if ((gUnknown_030054A8.unk1 & 0xF0) == 0x30) { + if ((gMusicManagerState.unk0 == 0) && PLAYER_IS_ALIVE) { +#if (GAME == GAME_SA2) + if ((gMusicManagerState.unk1 & 0xF0) == 0x30) { MPlayStop(&gMPlayInfo_BGM); - gUnknown_030054A8.unk0 = 0xFF; - gUnknown_030054A8.unk1 &= 0x0F; - } else if (gUnknown_030054A8.unk6 != 0) { - sub_800BF74(gUnknown_030054A8.unk6); - - gUnknown_030054A8.unk0 = 0xFF; - gUnknown_030054A8.unk6 = 0; - gUnknown_030054A8.unk5 = 1; - } else if ((songHeader == gSongTable[MUS_DROWNING].header) && (gMPlayInfo_BGM.status & MUSICPLAYER_STATUS_TRACK) - && !(gMPlayInfo_BGM.status & MUSICPLAYER_STATUS_PAUSE)) { - gUnknown_030054A8.unk5 = 1; - gUnknown_030054A8.unk2 = 0; - gUnknown_030054A8.unk3 = 0; - } else if (gUnknown_030054A8.unk4 != 0) { - gUnknown_030054A8.unk4 = 0; - gUnknown_030054A8.unk5 = 1; + gMusicManagerState.unk0 = 0xFF; + gMusicManagerState.unk1 &= 0x0F; + } else if (gMusicManagerState.fadeoutSpeed != 0) { + MusManager_Fadeout(gMusicManagerState.fadeoutSpeed); + + gMusicManagerState.unk0 = 0xFF; + gMusicManagerState.fadeoutSpeed = 0; + SET_UNK5(1); + } else +#endif + if ((songHeader == gSongTable[MUS_DROWNING].header) && (gMPlayInfo_BGM.status & MUSICPLAYER_STATUS_TRACK) + && !(gMPlayInfo_BGM.status & MUSICPLAYER_STATUS_PAUSE)) { + SET_UNK5(1); + gMusicManagerState.unk2 = 0; + gMusicManagerState.unk3 = 0; + } else if (gMusicManagerState.unk4 != 0) { + gMusicManagerState.unk4 = 0; + SET_UNK5(1); m4aSongNumStart(MUS_DROWNING); } else if ((songHeader == gSongTable[MUS_INVINCIBILITY].header) && (gMPlayInfo_BGM.status & MUSICPLAYER_STATUS_TRACK) && !(gMPlayInfo_BGM.status & MUSICPLAYER_STATUS_PAUSE) && !(gPlayer.itemEffect & PLAYER_ITEM_EFFECT__INVINCIBILITY)) { - gUnknown_030054A8.unk5 = 1; + SET_UNK5(1); m4aSongNumStop(MUS_INVINCIBILITY); } else if ((songHeader != gSongTable[MUS_1_UP].header) && (songHeader != gSongTable[MUS_INVINCIBILITY].header) - && (gPlayer.itemEffect & PLAYER_ITEM_EFFECT__INVINCIBILITY) && (gUnknown_030054A8.unk2 == 0)) { - gUnknown_030054A8.unk2 = 0; - gUnknown_030054A8.unk5 = 1; + && (gPlayer.itemEffect & PLAYER_ITEM_EFFECT__INVINCIBILITY) && (gMusicManagerState.unk2 == 0)) { + gMusicManagerState.unk2 = 0; + SET_UNK5(1); m4aSongNumStart(MUS_INVINCIBILITY); MusManager_UpdateBgmParams(); - } else if (gUnknown_030054A8.unk2 != 0) { - gUnknown_030054A8.unk2 = 0; - gUnknown_030054A8.unk5 = 1; + } else if (gMusicManagerState.unk2 != 0) { + gMusicManagerState.unk2 = 0; + SET_UNK5(1); m4aSongNumStart(MUS_INVINCIBILITY); - } else if (gUnknown_030054A8.unk3 != 0) { - gUnknown_030054A8.unk3 = 0; - gUnknown_030054A8.unk5 = 1; + } else if (gMusicManagerState.unk3 != 0) { + gMusicManagerState.unk3 = 0; + SET_UNK5(1); m4aSongNumStart(MUS_1_UP); - } else if ((gUnknown_030054A8.unk1 & 0xF0) == 0x10) { - u32 unk1 = gUnknown_030054A8.unk1 &= 0x0F; + } else if ((gMusicManagerState.unk1 & 0xF0) == 0x10) { + u32 unk1 = (gMusicManagerState.unk1 &= 0x0F); +#if (GAME == GAME_SA1) + m4aSongNumStart(gUnkMusicMgrData[gMusicManagerState.unk1]); + gMusicManagerState.unk1 |= 0x20; +#else m4aSongNumStart(gLevelSongs[gCurrentLevel + unk1]); - } else if (((gMPlayInfo_BGM.status & MUSICPLAYER_STATUS_TRACK) == 0) || (gMPlayInfo_BGM.status & MUSICPLAYER_STATUS_PAUSE)) { - if ((gUnknown_030054A8.unk1 & 0xF0) == 0x20) { - m4aSongNumStart(gUnknown_080D5254[gUnknown_030054A8.unk1]); +#endif +#if (GAME == GAME_SA1) + } else if ((gMusicManagerState.unk1 & 0xF0) == 0x30) { + gMusicManagerState.unk1 &= 0xF; + m4aSongNumStop(gUnkMusicMgrData[gMusicManagerState.unk1]); + + m4aSongNumStart(gLevelSongs[gCurrentLevel]); + MusManager_UpdateBgmParams(); + if ((u8)(gMusicManagerState.unk1 - 4) > 1) { + gMusicManagerState.unk0 = 0xFF; + } + gMusicManagerState.unk1 = 0; +#endif + } else if (((gMPlayInfo_BGM.status & MUSICPLAYER_STATUS_TRACK) == 0) || (gMPlayInfo_BGM.status & MUSICPLAYER_STATUS_PAUSE)) { + if ((gMusicManagerState.unk1 & 0xF0) == 0x20) { +#if (GAME == GAME_SA1) + m4aSongNumStart(gUnkMusicMgrData[gMusicManagerState.unk1 & 0xF]); +#else + m4aSongNumStart(gUnkMusicMgrData[gMusicManagerState.unk1]); +#endif MusManager_UpdateBgmParams(); } else { - m4aSongNumStartOrContinue(gLevelSongs[gCurrentLevel + (gUnknown_030054A8.unk1 & 0x0F)]); - - if (gUnknown_030054A8.unk5 != 0) { - gUnknown_030054A8.unk5 = 0; +#if (GAME == GAME_SA1) + m4aSongNumStart(gLevelSongs[gCurrentLevel]); + MusManager_UpdateBgmParams(); +#elif (GAME == GAME_SA2) + m4aSongNumStartOrContinue(gLevelSongs[gCurrentLevel + (gMusicManagerState.unk1 & 0x0F)]); + if (gMusicManagerState.unk5 != 0) { + SET_UNK5(0) MusManager_UpdateBgmParams(); } +#endif } } } @@ -129,18 +194,24 @@ void CreateStageMusicManager(void) { TaskCreate(Task_StageMusicManager, 0, 0x4000, 0, NULL); - gUnknown_030054A8.unk0 = 0; - gUnknown_030054A8.unk1 = 0; - gUnknown_030054A8.unk2 = 0; - gUnknown_030054A8.unk3 = 0; - gUnknown_030054A8.unk4 = 0; - gUnknown_030054A8.unk5 = 0; - gUnknown_030054A8.unk6 = 0; + gMusicManagerState.unk0 = 0; + gMusicManagerState.unk1 = 0; + gMusicManagerState.unk2 = 0; + gMusicManagerState.unk3 = 0; + gMusicManagerState.unk4 = 0; +#if (GAME == GAME_SA2) + SET_UNK5(0) + gMusicManagerState.fadeoutSpeed = 0; +#endif } static void MusManager_UpdateBgmParams(void) { +#if (GAME == GAME_SA1) + struct MusicPlayerInfo *bgmInfo = &gMPlayInfo_BGM; +#else struct MP2KPlayerState *bgmInfo = &gMPlayInfo_BGM; +#endif m4aMPlayImmInit(bgmInfo); m4aMPlayVolumeControl(bgmInfo, 0xFF, 4); @@ -151,9 +222,14 @@ static void MusManager_UpdateBgmParams(void) } } -void sub_800BF74(u16 fadeoutSpeed) +#if (GAME == GAME_SA2) +void MusManager_Fadeout(u16 fadeoutSpeed) { +#if (GAME == GAME_SA1) + struct MusicPlayerInfo *bgmInfo = &gMPlayInfo_BGM; +#else struct MP2KPlayerState *bgmInfo = &gMPlayInfo_BGM; +#endif m4aMPlayFadeOutTemporarily(bgmInfo, fadeoutSpeed / 16); @@ -161,3 +237,4 @@ void sub_800BF74(u16 fadeoutSpeed) m4aMPlayTempoControl(bgmInfo, 0x200); } } +#endif diff --git a/src/game/sa1_sa2_shared/rings_manager.c b/src/game/sa1_sa2_shared/rings_manager.c index 4fbeb3f7c..3b36fd0ad 100644 --- a/src/game/sa1_sa2_shared/rings_manager.c +++ b/src/game/sa1_sa2_shared/rings_manager.c @@ -36,11 +36,11 @@ void TaskDestructor_8007F1C(struct Task *); && RECT_BOTTOM(mp->pos.y, rect) >= (ringIntY - (TILE_WIDTH * 2)))))) #define PLAYER_TOUCHING_RING(p, rect, ringIntX, ringIntY) \ - ((((ringIntX - TILE_WIDTH) <= RECT_LEFT(I((p)->x), rect) && (ringIntX + TILE_WIDTH) >= RECT_LEFT(I((p)->x), rect)) \ - || ((ringIntX - TILE_WIDTH) >= RECT_LEFT(I((p)->x), rect) && RECT_RIGHT(I((p)->x), rect) >= (ringIntX - TILE_WIDTH))) \ - && ((((ringIntY - (TILE_WIDTH * 2)) <= RECT_TOP(I((p)->y), rect) && ringIntY >= RECT_TOP(I((p)->y), rect)) \ - || ((ringIntY - (TILE_WIDTH * 2)) >= RECT_TOP(I((p)->y), rect) \ - && RECT_BOTTOM(I((p)->y), rect) >= (ringIntY - (TILE_WIDTH * 2)))))) + ((((ringIntX - TILE_WIDTH) <= RECT_LEFT(I((p)->qWorldX), rect) && (ringIntX + TILE_WIDTH) >= RECT_LEFT(I((p)->qWorldX), rect)) \ + || ((ringIntX - TILE_WIDTH) >= RECT_LEFT(I((p)->qWorldX), rect) && RECT_RIGHT(I((p)->qWorldX), rect) >= (ringIntX - TILE_WIDTH))) \ + && ((((ringIntY - (TILE_WIDTH * 2)) <= RECT_TOP(I((p)->qWorldY), rect) && ringIntY >= RECT_TOP(I((p)->qWorldY), rect)) \ + || ((ringIntY - (TILE_WIDTH * 2)) >= RECT_TOP(I((p)->qWorldY), rect) \ + && RECT_BOTTOM(I((p)->qWorldY), rect) >= (ringIntY - (TILE_WIDTH * 2)))))) const u8 *const gSpritePosData_rings[NUM_LEVEL_IDS] = { zone1_act1_rings, @@ -172,7 +172,7 @@ NONMATCH("asm/non_matching/game/stage/Task_RingsMgrMain.inc", void Task_RingsMgr } // _08007FE4 - SuperSonicGetPos(&gPlayer.x, &gPlayer.y); + SuperSonicGetPos(&gPlayer.qWorldX, &gPlayer.qWorldY); rect[0] = -10; rect[1] = -10; rect[2] = +10; @@ -190,10 +190,10 @@ NONMATCH("asm/non_matching/game/stage/Task_RingsMgrMain.inc", void Task_RingsMgr regions_x = (u16)*rings++; regions_y = (u16)*rings++; - sl = (Q_24_8_TO_INT(gPlayer.y) + rect[1]) >> 8; - while (((sl <= (((Q_24_8_TO_INT(gPlayer.y) + rect[3]) + 8)) >> 8)) && (sl < regions_y)) { - sb = ((Q_24_8_TO_INT(gPlayer.x) + rect[0] - 8) >> 8); - while ((sb <= ((Q_24_8_TO_INT(gPlayer.x) + rect[2] + 16) >> 8)) && sb < regions_x) { + sl = (Q_24_8_TO_INT(gPlayer.qWorldY) + rect[1]) >> 8; + while (((sl <= (((Q_24_8_TO_INT(gPlayer.qWorldY) + rect[3]) + 8)) >> 8)) && (sl < regions_y)) { + sb = ((Q_24_8_TO_INT(gPlayer.qWorldX) + rect[0] - 8) >> 8); + while ((sb <= ((Q_24_8_TO_INT(gPlayer.qWorldX) + rect[2] + 16) >> 8)) && sb < regions_x) { u32 offset = *(u32 *)((u8 *)rings + ((regions_x * sl) * sizeof(u32)) + (sb * sizeof(u32))); if (offset) { @@ -318,8 +318,9 @@ NONMATCH("asm/non_matching/game/stage/Task_RingsMgrMain.inc", void Task_RingsMgr if (((u32)(rx - gCamera.x) + TILE_WIDTH) > (DISPLAY_WIDTH + 2 * TILE_WIDTH) || (((ry - gCamera.y)) < 0) || (((ry - gCamera.y) - 2 * TILE_WIDTH) > DISPLAY_HEIGHT)) { meRing++; - } else if (((rx - 64) <= Q_24_8_TO_INT(gPlayer.x)) && ((rx + 64) >= Q_24_8_TO_INT(gPlayer.x)) - && ((ry - 72) <= Q_24_8_TO_INT(gPlayer.y)) && ((ry + 56 >= Q_24_8_TO_INT(gPlayer.y)))) { + } else if (((rx - 64) <= Q_24_8_TO_INT(gPlayer.qWorldX)) && ((rx + 64) >= Q_24_8_TO_INT(gPlayer.qWorldX)) + && ((ry - 72) <= Q_24_8_TO_INT(gPlayer.qWorldY)) + && ((ry + 56 >= Q_24_8_TO_INT(gPlayer.qWorldY)))) { CreateMagneticRing(rx, ry); meRing->x = (u8)MAP_ENTITY_STATE_INITIALIZED; meRing++; diff --git a/src/game/sound_test.c b/src/game/sound_test.c index b2736f2e9..a0180880d 100644 --- a/src/game/sound_test.c +++ b/src/game/sound_test.c @@ -363,10 +363,10 @@ static void SoundTestScreenCreateUI(struct Task *t) // Transforms static circle for (i = 0; i < 4; i++) { transforms[i].rotation = DEG_TO_SIN(90) * i; - transforms[i].width = 0x100; - transforms[i].height = 0x100; - transforms[i].x = 0x4C; - transforms[i].y = 0x5A; + transforms[i].qScaleX = Q(1); + transforms[i].qScaleY = Q(1); + transforms[i].x = 76; + transforms[i].y = 90; } transforms[1].x--; @@ -662,7 +662,7 @@ static void SoundTestScreenRenderUI(void) for (i = 0; i < 4; i++) { if (sprCream->graphics.anim != SA2_ANIM_SOUNDTEST_CREAM_BOW) { speakerConeEffects[i].rotation = DEG_TO_SIN(90) * i; - speakerConeEffects[i].height = speakerConeEffects[i].width = soundTestScreen->speakerSize + 0x100; + speakerConeEffects[i].qScaleY = speakerConeEffects[i].qScaleX = soundTestScreen->speakerSize + 0x100; } TransformSprite(&speakerConeElement[i], &speakerConeEffects[i]); diff --git a/src/game/special_stage/collectables.c b/src/game/special_stage/collectables.c index 33608a8e5..80ae54031 100644 --- a/src/game/special_stage/collectables.c +++ b/src/game/special_stage/collectables.c @@ -172,10 +172,10 @@ void sub_806DC98(void) const struct UNK_8C878E8 **unk78E8_vals = gUnknown_08C878E8[stage->zone]; struct SpecialStagePlayer *player = TASK_DATA(stage->playerTask); - s32 playerX = Q_16_16_TO_INT(player->x); - s32 playerY = Q_16_16_TO_INT(player->y); + s32 playerX = Q_16_16_TO_INT(player->q16WorldX); + s32 playerY = Q_16_16_TO_INT(player->q16WorldY); s32 val3 = player->unkB0 >> 4; - u32 cell = ((Q_16_16_TO_INT(player->x) >> 7) * SPECIAL_STAGE_ZONE_SIZE) + (Q_16_16_TO_INT(player->y) >> 7); + u32 cell = ((Q_16_16_TO_INT(player->q16WorldX) >> 7) * SPECIAL_STAGE_ZONE_SIZE) + (Q_16_16_TO_INT(player->q16WorldY) >> 7); const struct UNK_8C878E8 *object = unk78E8_vals[cell]; while (object->id != -1) { @@ -263,8 +263,8 @@ void sub_806DEA4(void) unkDEA4_1->unk0 = 0; } - stageZoneX = Q_16_16_TO_INT(player->x) >> 7; - stageZoneY = Q_16_16_TO_INT(player->y) >> 7; + stageZoneX = Q_16_16_TO_INT(player->q16WorldX) >> 7; + stageZoneY = Q_16_16_TO_INT(player->q16WorldY) >> 7; cell = (stageZoneX * 8) + stageZoneY; unk78E8_val = unk78E8_vals[cell]; @@ -438,8 +438,8 @@ static void AnimateRingsLost(struct SpecialStage *stage, s16 numLost) struct SpecialStageCollectables *collectables = TASK_DATA(stage->collectablesTask); struct SpecialStagePlayer *player = TASK_DATA(stage->playerTask); - s32 x = player->x; - s32 y = player->y; + s32 x = player->q16WorldX; + s32 y = player->q16WorldY; s32 unkB0 = player->unkB0; s16 temp; diff --git a/src/game/special_stage/guard_robo.c b/src/game/special_stage/guard_robo.c index 7ebe41789..a63c4d938 100644 --- a/src/game/special_stage/guard_robo.c +++ b/src/game/special_stage/guard_robo.c @@ -129,8 +129,8 @@ void sub_80710B0(void) s32 cos = COS(angle); s32 dX, dY; - dX = player->x - guardRobo->x; - dY = player->y - guardRobo->y; + dX = player->q16WorldX - guardRobo->x; + dY = player->q16WorldY - guardRobo->y; bearingToPlayer = (sin >> 8) * (dY >> 8) + (cos >> 6) * (dX >> 8); // required for match, probably wrong @@ -170,8 +170,8 @@ void sub_807120C(struct SpecialStageGuardRobo *guardRobo) s16 guardRoboX = Q_16_16_TO_INT(guardRobo->x); s16 guardRoboY = Q_16_16_TO_INT(guardRobo->y); - s16 playerX = Q_16_16_TO_INT(player->x); - s16 playerY = Q_16_16_TO_INT(player->y); + s16 playerX = Q_16_16_TO_INT(player->q16WorldX); + s16 playerY = Q_16_16_TO_INT(player->q16WorldY); s16 unkB0 = player->unkB0 >> 8; s16 state = player->state; diff --git a/src/game/special_stage/physics.c b/src/game/special_stage/physics.c index 0ab137c2c..948e8e7ad 100644 --- a/src/game/special_stage/physics.c +++ b/src/game/special_stage/physics.c @@ -108,12 +108,12 @@ static void Task_PhysicsMain(void) } sub_806FAA0(); - stage->cameraX = player->x; - stage->cameraY = player->y; + stage->cameraX = player->q16WorldX; + stage->cameraY = player->q16WorldY; stage->cameraBearing = player->bearing; - gBgScrollRegs[2][1] = -Q_16_16_TO_INT(player->y); - gBgScrollRegs[2][0] = -Q_16_16_TO_INT(player->x); + gBgScrollRegs[2][1] = -Q_16_16_TO_INT(player->q16WorldY); + gBgScrollRegs[2][0] = -Q_16_16_TO_INT(player->q16WorldX); } void HandleMovementControls(UNUSED u32 unused) @@ -197,8 +197,8 @@ void HandleMovementControls(UNUSED u32 unused) { s32 dX = (sin * speed) >> 10; s32 dY = (cos * speed) >> 10; - player->x -= dX; - player->y -= dY; + player->q16WorldX -= dX; + player->q16WorldY -= dY; } } @@ -290,8 +290,8 @@ void sub_806F154(void) HandleRotationControls(); HandleBoost2(); - player->x += player->unkD0; - player->y += player->unkD4; + player->q16WorldX += player->unkD0; + player->q16WorldY += player->unkD4; player->unkB8 += player->unkF4; if (player->unkB0 < 1) { @@ -344,8 +344,8 @@ static void PlayerStatePhysics_SlowToStop(void) { s32 temp2 = I(sin * speed) >> 2; s32 temp3 = I(cos * speed) >> 2; - player->x -= temp2; - player->y -= temp3; + player->q16WorldX -= temp2; + player->q16WorldY -= temp3; } if (speed == 0) { @@ -390,20 +390,20 @@ void sub_806F3C4(void) struct SpecialStagePhysics *physics = TASK_DATA(gCurTask); struct SpecialStagePlayer *player = TASK_DATA(physics->stage->playerTask); - if (player->x <= Q_16_16(MIN_SPECIAL_STAGE_PLAYER_X)) { - player->x = Q_16_16(MIN_SPECIAL_STAGE_PLAYER_X); + if (player->q16WorldX <= Q_16_16(MIN_SPECIAL_STAGE_PLAYER_X)) { + player->q16WorldX = Q_16_16(MIN_SPECIAL_STAGE_PLAYER_X); } - if (player->x >= Q_16_16(MAX_SPECIAL_STAGE_PLAYER_X)) { - player->x = Q_16_16(MAX_SPECIAL_STAGE_PLAYER_X); + if (player->q16WorldX >= Q_16_16(MAX_SPECIAL_STAGE_PLAYER_X)) { + player->q16WorldX = Q_16_16(MAX_SPECIAL_STAGE_PLAYER_X); } - if (player->y <= Q_16_16(MIN_SPECIAL_STAGE_PLAYER_Y)) { - player->y = Q_16_16(MIN_SPECIAL_STAGE_PLAYER_Y); + if (player->q16WorldY <= Q_16_16(MIN_SPECIAL_STAGE_PLAYER_Y)) { + player->q16WorldY = Q_16_16(MIN_SPECIAL_STAGE_PLAYER_Y); } - if (player->y >= Q_16_16(MAX_SPECIAL_STAGE_PLAYER_Y)) { - player->y = Q_16_16(MAX_SPECIAL_STAGE_PLAYER_Y); + if (player->q16WorldY >= Q_16_16(MAX_SPECIAL_STAGE_PLAYER_Y)) { + player->q16WorldY = Q_16_16(MAX_SPECIAL_STAGE_PLAYER_Y); } physics->animFrame++; @@ -429,8 +429,8 @@ void sub_806F468(void) struct SpecialStagePlayer *player = TASK_DATA(stage->playerTask); const struct UNK_8C87904 *worldElements = gUnknown_08C87904[stage->zone]; - s16 playerX = Q_16_16_TO_INT(player->x); - s16 playerY = Q_16_16_TO_INT(player->y); + s16 playerX = Q_16_16_TO_INT(player->q16WorldX); + s16 playerY = Q_16_16_TO_INT(player->q16WorldY); while (worldElements->type != -1) { if (playerX >= worldElements->x && playerX < (worldElements->x + worldElements->width)) { @@ -482,8 +482,8 @@ static void HandleBoost1(void) { s32 temp1 = (sin * speed) >> 10; s32 temp2 = (cos * speed) >> 10; - player->x -= temp1; - player->y -= temp2; + player->q16WorldX -= temp1; + player->q16WorldY -= temp2; } } @@ -510,8 +510,8 @@ void HandleBoost2(void) { s32 temp1 = (sin * c8) >> 10; s32 temp2 = (cos * c8) >> 10; - player->x -= temp1; - player->y -= temp2; + player->q16WorldX -= temp1; + player->q16WorldY -= temp2; } } @@ -533,8 +533,8 @@ static s16 CalcGuardRoboPointerAngle(struct SpecialStage *stage) u16 bearing = -player->bearing & 0x3FF; - f_dX = guardRobo->x - player->x; - f_dY = guardRobo->y - player->y; + f_dX = guardRobo->x - player->q16WorldX; + f_dY = guardRobo->y - player->q16WorldY; dX = f_dX >> 0x10; dY = f_dY >> 0x10; @@ -673,8 +673,8 @@ void sub_806F944(struct SpecialStage *stage) struct SpecialStagePlayer *player = TASK_DATA(stage->playerTask); struct SpecialStageGuardRobo *guardRobo = TASK_DATA(stage->guardRoboTask); - s32 playerX = player->x; - s32 playerY = player->y; + s32 playerX = player->q16WorldX; + s32 playerY = player->q16WorldY; s32 guardRoboX = guardRobo->x; s32 guardRoboY = guardRobo->y; @@ -726,20 +726,20 @@ void sub_806FAA0(void) struct SpecialStagePhysics *physics = TASK_DATA(gCurTask); struct SpecialStagePlayer *player = TASK_DATA(physics->stage->playerTask); - if (player->x < Q_16_16(MIN_SPECIAL_STAGE_PLAYER_X)) { - player->x = Q_16_16(MIN_SPECIAL_STAGE_PLAYER_X); + if (player->q16WorldX < Q_16_16(MIN_SPECIAL_STAGE_PLAYER_X)) { + player->q16WorldX = Q_16_16(MIN_SPECIAL_STAGE_PLAYER_X); } - if (player->x > Q_16_16(MAX_SPECIAL_STAGE_PLAYER_X)) { - player->x = Q_16_16(MAX_SPECIAL_STAGE_PLAYER_X); + if (player->q16WorldX > Q_16_16(MAX_SPECIAL_STAGE_PLAYER_X)) { + player->q16WorldX = Q_16_16(MAX_SPECIAL_STAGE_PLAYER_X); } - if (player->y < Q_16_16(MIN_SPECIAL_STAGE_PLAYER_Y)) { - player->y = Q_16_16(MIN_SPECIAL_STAGE_PLAYER_Y); + if (player->q16WorldY < Q_16_16(MIN_SPECIAL_STAGE_PLAYER_Y)) { + player->q16WorldY = Q_16_16(MIN_SPECIAL_STAGE_PLAYER_Y); } - if (player->y > Q_16_16(MAX_SPECIAL_STAGE_PLAYER_Y)) { - player->y = Q_16_16(MAX_SPECIAL_STAGE_PLAYER_Y); + if (player->q16WorldY > Q_16_16(MAX_SPECIAL_STAGE_PLAYER_Y)) { + player->q16WorldY = Q_16_16(MAX_SPECIAL_STAGE_PLAYER_Y); } } diff --git a/src/game/special_stage/player.c b/src/game/special_stage/player.c index 769b1504d..4b359227a 100644 --- a/src/game/special_stage/player.c +++ b/src/game/special_stage/player.c @@ -73,8 +73,8 @@ struct Task *CreateSpecialStagePlayer(struct SpecialStage *stage) player = TASK_DATA(t); player->unk0 = stage; player->unk4 = NULL; - player->x = Q_16_16(gUnknown_080DF9D8[lang][0]); - player->y = Q_16_16(gUnknown_080DF9D8[lang][1]); + player->q16WorldX = Q_16_16(gUnknown_080DF9D8[lang][0]); + player->q16WorldY = Q_16_16(gUnknown_080DF9D8[lang][1]); player->unkB0 = 0; player->bearing = gUnknown_080DF9D8[lang][2]; diff --git a/src/game/stage/boss_results_transition.c b/src/game/stage/boss_results_transition.c index ce4c38caf..de3e81a90 100644 --- a/src/game/stage/boss_results_transition.c +++ b/src/game/stage/boss_results_transition.c @@ -99,12 +99,12 @@ void Task_802EE78(void) u32 x, y; x = gUnknown_080D6DE4[sri->unk11][0]; - x -= I(gPlayer.x); + x -= I(gPlayer.qWorldX); y = gUnknown_080D6DE4[sri->unk11][1]; - y -= I(gPlayer.y); + y -= I(gPlayer.qWorldY); - gPlayer.x += Q(x); - gPlayer.y += Q(y); + gPlayer.qWorldX += Q(x); + gPlayer.qWorldY += Q(y); gCamera.x += x; gCamera.y += y; diff --git a/src/game/stage/camera.c b/src/game/stage/camera.c index 6268b5df0..32e5b2463 100644 --- a/src/game/stage/camera.c +++ b/src/game/stage/camera.c @@ -393,7 +393,7 @@ void InitCamera(u32 level) if (IS_BOSS_STAGE(gCurrentLevel)) { if (gCurrentLevel == LEVEL_INDEX(ZONE_FINAL, ACT_TRUE_AREA_53)) { - SuperSonicGetPos(&player->x, &player->y); + SuperSonicGetPos(&player->qWorldX, &player->qWorldY); gBossCameraClampYLower = gBossCameraYClamps[ZONE_FINAL + 1][0]; gBossCameraClampYUpper = gBossCameraYClamps[ZONE_FINAL + 1][1]; camera->x = 600; @@ -402,18 +402,18 @@ void InitCamera(u32 level) camera->y = 0; camera->unk64 = -4; } else { - camera->x = I(player->x); + camera->x = I(player->qWorldX); // TODO: Handle boss camera restrictions for large screen sizes // for now we use the original GBA values as otherwise the boss // goes off the screen (not sure why yet) - camera->unk10 = I(player->x) - (2 * 240); - camera->y = I(player->y) - ((DISPLAY_HEIGHT / 2) + 4); + camera->unk10 = I(player->qWorldX) - (2 * 240); + camera->y = I(player->qWorldY) - ((DISPLAY_HEIGHT / 2) + 4); camera->unk14 = camera->y; camera->unk64 = player->spriteOffsetY - 4; } } else { - camera->x = I(player->x) - (DISPLAY_WIDTH / 2); - camera->y = I(player->y) - ((DISPLAY_HEIGHT / 2) + 4); + camera->x = I(player->qWorldX) - (DISPLAY_WIDTH / 2); + camera->y = I(player->qWorldY) - ((DISPLAY_HEIGHT / 2) + 4); if (camera->x < 0) { camera->x = 0; @@ -442,8 +442,8 @@ void InitCamera(u32 level) camera->unk50 = 0; camera->unk52 = 0; camera->unk54 = 0; - camera->unk60 = 0; - camera->unk62 = 0; + camera->shakeOffsetX = 0; + camera->shakeOffsetY = 0; camera->movementTask = TaskCreate(Task_CallUpdateCamera, 0, 0xF00, 0, TaskDestructor_801E040); @@ -481,7 +481,7 @@ void UpdateCamera(void) } if (gCurrentLevel == LEVEL_INDEX(ZONE_FINAL, ACT_TRUE_AREA_53)) { - SuperSonicGetPos(&player->x, &player->y); + SuperSonicGetPos(&player->qWorldX, &player->qWorldY); } camera->unk10 += BOSS_CAM_FRAME_DELTA_PIXELS; @@ -493,12 +493,12 @@ void UpdateCamera(void) // So we need to emulate that behaviour on some specific // levels #if TAS_TESTING && TAS_TESTING_WIDESCREEN_HACK && DISPLAY_WIDTH > 240 - if (newX + (DISPLAY_WIDTH_FOR_BOSS_TAS + 1) < I(player->x)) { + if (newX + (DISPLAY_WIDTH_FOR_BOSS_TAS + 1) < I(player->qWorldX)) { #else - if (newX + ((DISPLAY_WIDTH / 2) + 1) < I(player->x)) { + if (newX + ((DISPLAY_WIDTH / 2) + 1) < I(player->qWorldX)) { #endif if ((camera->unk10 + (DISPLAY_HEIGHT / 2)) > newX) { - s32 playerScreenX = I(player->x); + s32 playerScreenX = I(player->qWorldX); #if TAS_TESTING && TAS_TESTING_WIDESCREEN_HACK && DISPLAY_WIDTH > 240 playerScreenX -= DISPLAY_WIDTH_FOR_BOSS_TAS; #else @@ -511,8 +511,8 @@ void UpdateCamera(void) } } else { camera->shiftX = 0; - if ((newX + 96) > I(player->x)) { - newX = I(player->x); + if ((newX + 96) > I(player->qWorldX)) { + newX = I(player->qWorldX); newX -= 96; if (newX < camera->unk10) { newX = camera->unk10; @@ -520,7 +520,7 @@ void UpdateCamera(void) } } - playerY = I(player->y); + playerY = I(player->qWorldY); delta = playerY - newY; if (gCurrentLevel == LEVEL_INDEX(ZONE_FINAL, ACT_TRUE_AREA_53)) { if (delta <= 48) { @@ -545,8 +545,8 @@ void UpdateCamera(void) newX = newX + camera->shiftX; newY = newY + camera->shiftY; - newX += camera->unk60; - newY += camera->unk62; + newX += camera->shakeOffsetX; + newY += camera->shakeOffsetY; } else { if (camera->unk40 != 0) { @@ -554,7 +554,7 @@ void UpdateCamera(void) } else { if (!(camera->unk50 & 1)) { s16 airSpeedX = player->speedAirX; - camera->unk10 = I(player->x) + camera->shiftX - (DISPLAY_WIDTH / 2); + camera->unk10 = I(player->qWorldX) + camera->shiftX - (DISPLAY_WIDTH / 2); camera->unk56 = (airSpeedX + (camera->unk56 * 15)) >> 4; camera->unk10 += (camera->unk56 >> 5); } @@ -580,7 +580,7 @@ void UpdateCamera(void) camera->unk64 = unk64; } - camera->unk14 = I(player->y) + camera->shiftY - (DISPLAY_HEIGHT / 2) + camera->unk4C + unk64; + camera->unk14 = I(player->qWorldY) + camera->shiftY - (DISPLAY_HEIGHT / 2) + camera->unk4C + unk64; } } @@ -626,8 +626,8 @@ void UpdateCamera(void) // maybe a macro, these values are already clamped newX = CLAMP(newX, camera->minX, camera->maxX - DISPLAY_WIDTH); newY = CLAMP(newY, camera->minY, camera->maxY - DISPLAY_HEIGHT); - newX = newX + camera->unk60; - newY = newY + camera->unk62; + newX = newX + camera->shakeOffsetX; + newY = newY + camera->shakeOffsetY; } camera->x = newX; diff --git a/src/game/stage/dust_effect_braking.c b/src/game/stage/dust_effect_braking.c index 219d2be50..3b5859650 100644 --- a/src/game/stage/dust_effect_braking.c +++ b/src/game/stage/dust_effect_braking.c @@ -52,7 +52,6 @@ struct Task *CreateBrakingDustEffect(s32 x, s32 y) s->variant = 0; s->frameFlags = (SPRITE_FLAG(PRIORITY, 2) | SPRITE_FLAG(X_FLIP, 1)); } else { - // _0801F668 s->graphics.dest = ((void *)OBJ_VRAM0 + 0x2300); s->graphics.anim = SA2_ANIM_SMALL_DUST_PARTICLE; s->variant = 0; diff --git a/src/game/stage/dust_effect_spindash.c b/src/game/stage/dust_effect_spindash.c index efde0a53f..f0dc468bd 100644 --- a/src/game/stage/dust_effect_spindash.c +++ b/src/game/stage/dust_effect_spindash.c @@ -27,7 +27,11 @@ struct Task *CreateSpindashDustEffect() Sprite *s = &sde->s; s->graphics.dest = VramMalloc(20); s->graphics.size = 0; - s->graphics.anim = SA2_ANIM_SPINDASH_DUST_EFFECT; +#if (GAME == GAME_SA1) + GET_SPRITE_ANIM(s) = SA1_ANIM_SPINDASH_DUST_EFFECT; +#elif (GAME == GAME_SA2) + GET_SPRITE_ANIM(s) = SA2_ANIM_SPINDASH_DUST_EFFECT; +#endif s->variant = 0; s->prevVariant = -1; s->oamFlags = SPRITE_OAM_ORDER(8); @@ -53,7 +57,11 @@ void Task_SpindashDustEffect(void) Sprite *s = &sde->s; if (p->spindashAccel > Q(2.0)) { - s->graphics.anim = SA2_ANIM_SPINDASH_DUST_EFFECT_BIG; +#if (GAME == GAME_SA1) + GET_SPRITE_ANIM(s) = SA1_ANIM_SPINDASH_DUST_EFFECT_BIG; +#elif (GAME == GAME_SA2) + GET_SPRITE_ANIM(s) = SA2_ANIM_SPINDASH_DUST_EFFECT_BIG; +#endif s->variant = 0; s->prevVariant = -1; gCurTask->main = Task_SpindashDustEffectBig; @@ -66,14 +74,17 @@ void Task_SpindashDustEffect(void) offY = -offY; } +#if (GAME == GAME_SA2) if (IS_MULTI_PLAYER) { struct Task *t = gMultiplayerPlayerTasks[SIO_MULTI_CNT->id]; MultiplayerPlayer *mpp = TASK_DATA(t); s->x = (mpp->pos.x - cam->x); s->y = ((mpp->pos.y + offY) - cam->y); - } else { - s->x = I(p->x) - cam->x; - s->y = (I(p->y) + offY) - cam->y; + } else +#endif + { + s->x = I(p->qWorldX) - cam->x; + s->y = (I(p->qWorldY) + offY) - cam->y; } if (!(p->moveState & MOVESTATE_FACING_LEFT)) { @@ -107,7 +118,11 @@ void Task_SpindashDustEffectBig(void) Sprite *s = &sde->s; if (p->spindashAccel <= Q(2.0)) { - s->graphics.anim = SA2_ANIM_SPINDASH_DUST_EFFECT; +#if (GAME == GAME_SA1) + GET_SPRITE_ANIM(s) = SA1_ANIM_SPINDASH_DUST_EFFECT; +#elif (GAME == GAME_SA2) + GET_SPRITE_ANIM(s) = SA2_ANIM_SPINDASH_DUST_EFFECT; +#endif s->variant = 0; s->prevVariant = -1; gCurTask->main = Task_SpindashDustEffect; @@ -120,14 +135,17 @@ void Task_SpindashDustEffectBig(void) offY = -offY; } +#if (GAME == GAME_SA2) if (IS_MULTI_PLAYER) { struct Task *t = gMultiplayerPlayerTasks[SIO_MULTI_CNT->id]; MultiplayerPlayer *mpp = TASK_DATA(t); s->x = (mpp->pos.x - cam->x); s->y = ((mpp->pos.y + offY) - cam->y); - } else { - s->x = I(p->x) - cam->x; - s->y = (I(p->y) + offY) - cam->y; + } else +#endif + { + s->x = I(p->qWorldX) - cam->x; + s->y = (I(p->qWorldY) + offY) - cam->y; } if (!(p->moveState & MOVESTATE_FACING_LEFT)) { @@ -151,4 +169,4 @@ void TaskDestructor_SpindashDustEffect(struct Task *t) { DustEffect *sde = TASK_DATA(t); VramFree(sde->s.graphics.dest); -} \ No newline at end of file +} diff --git a/src/game/stage/grind_effect_1.c b/src/game/stage/grind_effect_1.c index 4d5ec0d11..4016a8c0e 100644 --- a/src/game/stage/grind_effect_1.c +++ b/src/game/stage/grind_effect_1.c @@ -6,6 +6,7 @@ #include "task.h" #include "constants/animations.h" +#include "constants/anim_sizes.h" typedef struct { Sprite s; @@ -23,9 +24,15 @@ struct Task *CreateGrindEffect() GrindEffect *spark = TASK_DATA(t); Sprite *s = &spark->s; - s->graphics.dest = VramMalloc(20); +#if (GAME == GAME_SA1) + s->graphics.dest = ALLOC_TILES(SA1_ANIM_GRIND_EFFECT); + s->graphics.size = 0; + s->graphics.anim = SA1_ANIM_GRIND_EFFECT; +#elif (GAME == GAME_SA2) + s->graphics.dest = ALLOC_TILES(SA2_ANIM_GRIND_EFFECT); s->graphics.size = 0; s->graphics.anim = SA2_ANIM_GRIND_EFFECT; +#endif s->variant = 0; s->prevVariant = -1; s->oamFlags = SPRITE_OAM_ORDER(8); @@ -44,12 +51,16 @@ void Task_GrindEffect(void) if (p->spriteTask == NULL || !(p->moveState & MOVESTATE_1000000)) { TaskDestroy(gCurTask); return; - } else if ((p->anim == SA2_CHAR_ANIM_55) && (p->variant == 0)) { +#if (GAME == GAME_SA1) + } else if ((p->anim == SA1_CHAR_ANIM_GRINDING) && (p->variant == 1)) { +#elif (GAME == GAME_SA2) + } else if ((p->anim == SA2_CHAR_ANIM_GRINDING) && (p->variant == 0)) { +#endif GrindEffect *spark = TASK_DATA(gCurTask); Sprite *s = &spark->s; struct Camera *cam = &gCamera; - s->x = I(p->x) - cam->x; - s->y = (I(p->y) + p->spriteOffsetY) - cam->y; + s->x = I(p->qWorldX) - cam->x; + s->y = (I(p->qWorldY) + p->spriteOffsetY) - cam->y; if (!(p->moveState & MOVESTATE_FACING_LEFT)) { s->frameFlags |= SPRITE_FLAG_MASK_X_FLIP; diff --git a/src/game/stage/game_2.c b/src/game/stage/grind_effect_2.c similarity index 96% rename from src/game/stage/game_2.c rename to src/game/stage/grind_effect_2.c index f3a5443f6..c2d05c710 100644 --- a/src/game/stage/game_2.c +++ b/src/game/stage/grind_effect_2.c @@ -6,7 +6,7 @@ #include "game/sa1_sa2_shared/globals.h" -#include "game/stage/game_2.h" +#include "game/stage/grind_effect_2.h" #include "game/stage/player.h" #include "game/stage/camera.h" @@ -78,8 +78,8 @@ void Task_801F214(void) ts->x = mpp->pos.x; ts->y = mpp->pos.y; } else { - ts->x = I(gPlayer.x); - ts->y = I(gPlayer.y); + ts->x = I(gPlayer.qWorldX); + ts->y = I(gPlayer.qWorldY); } } break; @@ -190,8 +190,8 @@ void CreateGrindEffect2(void) x = I(yInverted * SIN_24_8(p->rotation * 4)); y = I(yInverted * COS_24_8(p->rotation * 4)); - x2 = I(p->x); - y2 = I(p->y); + x2 = I(p->qWorldX); + y2 = I(p->qWorldY); x2 -= x; y2 += y; diff --git a/src/game/stage/intro.c b/src/game/stage/intro.c index f9811904b..f78f1e748 100644 --- a/src/game/stage/intro.c +++ b/src/game/stage/intro.c @@ -856,8 +856,8 @@ static void StageIntroUpdateIcons(void) } transform->rotation = 0; - transform->width = sineVal; - transform->height = Q(1.0); + transform->qScaleX = sineVal; + transform->qScaleY = Q(1.0); transform->x = s->x; transform->y = s->y; diff --git a/src/game/stage/item_tasks.c b/src/game/stage/item_tasks.c index b2c3f218b..623871fcd 100644 --- a/src/game/stage/item_tasks.c +++ b/src/game/stage/item_tasks.c @@ -150,10 +150,10 @@ void Task_Item_Shield_Normal(void) bool32 b; s32 screenX, screenY; - screenX = I(gPlayer.x) - cam->x; + screenX = I(gPlayer.qWorldX) - cam->x; item->s.x = screenX + gPlayer.unk7C; - screenY = I(gPlayer.y) - cam->y; + screenY = I(gPlayer.qWorldY) - cam->y; item->s.y = screenY; item->s.frameFlags &= ~SPRITE_FLAG_MASK_PRIORITY; @@ -198,10 +198,10 @@ void Task_Item_Shield_Magnetic(void) if (!(gPlayer.itemEffect & PLAYER_ITEM_EFFECT__INVINCIBILITY)) { s32 screenX, screenY; - screenX = I(gPlayer.x) - cam->x; + screenX = I(gPlayer.qWorldX) - cam->x; item->s.x = screenX + gPlayer.unk7C; - screenY = I(gPlayer.y) - cam->y; + screenY = I(gPlayer.qWorldY) - cam->y; item->s.y = screenY; item->s.frameFlags &= ~SPRITE_FLAG_MASK_PRIORITY; @@ -241,9 +241,9 @@ void Task_802ABC8(void) u32 r2 = 0; if (IS_SINGLE_PLAYER) { - screenX = I(gPlayer.x) + gPlayer.unk7C; + screenX = I(gPlayer.qWorldX) + gPlayer.unk7C; - screenY = I(gPlayer.y); + screenY = I(gPlayer.qWorldY); r2 = gPlayer.spriteInfoBody->s.frameFlags & SPRITE_FLAG_MASK_PRIORITY; } @@ -286,8 +286,8 @@ void Task_Item_Invincibility(void) return; } else { // _0802ACE4 - x = I(gPlayer.x) + gPlayer.unk7C; - y = I(gPlayer.y); + x = I(gPlayer.qWorldX) + gPlayer.unk7C; + y = I(gPlayer.qWorldY); priority = gPlayer.spriteInfoBody->s.frameFlags; } // _0802AD02 diff --git a/src/game/stage/player.c b/src/game/stage/player.c index 8636f0b9e..ba4bade55 100644 --- a/src/game/stage/player.c +++ b/src/game/stage/player.c @@ -21,7 +21,7 @@ #include "game/stage/collision.h" #include "game/stage/dust_effect_braking.h" // CreateSpindashDustEffect #include "game/stage/dust_effect_spindash.h" // CreateSpindashDustEffect -#include "game/stage/game_2.h" +#include "game/stage/grind_effect_2.h" #include "game/stage/item_tasks.h" #include "game/stage/player.h" #include "game/stage/player_controls.h" @@ -189,7 +189,7 @@ void Player_InitAttack(Player *); #define PLAYERFN_UPDATE_POSITION(player) \ { \ - player->x += player->speedAirX; \ + player->qWorldX += player->speedAirX; \ \ if ((gStageFlags ^ gUnknown_0300544C) & STAGE_FLAG__GRAVITY_INVERTED) { \ player->speedAirY = -player->speedAirY; \ @@ -197,7 +197,7 @@ void Player_InitAttack(Player *); \ player->speedAirY = MIN(player->speedAirY, Q(PLAYER_AIR_SPEED_MAX)); \ \ - player->y = GRAVITY_IS_INVERTED ? player->y - player->speedAirY : player->y + player->speedAirY; \ + player->qWorldY = GRAVITY_IS_INVERTED ? player->qWorldY - player->speedAirY : player->qWorldY + player->speedAirY; \ } // TODO(Jace): This name is speculative right now, check for accuracy! @@ -296,7 +296,7 @@ const u16 sCharStateAnimInfo[][2] = { [CHARSTATE_SPRING_B] = { SA2_ANIM_CHAR(SA2_CHAR_ANIM_52, CHARACTER_SHARED_ANIM), 0 }, [CHARSTATE_SPRING_C] = { SA2_ANIM_CHAR(SA2_CHAR_ANIM_53, CHARACTER_SHARED_ANIM), 0 }, [CHARSTATE_RAMP_AND_DASHRING] = { SA2_ANIM_CHAR(SA2_CHAR_ANIM_54, CHARACTER_SHARED_ANIM), 0 }, - [CHARSTATE_GRINDING] = { SA2_ANIM_CHAR(SA2_CHAR_ANIM_55, CHARACTER_SHARED_ANIM), 0 }, + [CHARSTATE_GRINDING] = { SA2_ANIM_CHAR(SA2_CHAR_ANIM_GRINDING, CHARACTER_SHARED_ANIM), 0 }, [CHARSTATE_GRINDING_SONIC_AMY_JUMP_OFF] = { SA2_ANIM_CHAR(SA2_CHAR_ANIM_56, CHARACTER_SHARED_ANIM), 0 }, [CHARSTATE_GRAVITY_FLIP_UNUSED] = { SA2_ANIM_CHAR(SA2_CHAR_ANIM_57, CHARACTER_SHARED_ANIM), 0 }, [CHARSTATE_IN_WHIRLWIND] = { SA2_ANIM_CHAR(SA2_CHAR_ANIM_IN_WHIRLWIND, CHARACTER_SHARED_ANIM), 0 }, @@ -595,8 +595,8 @@ void AllocateCharacterStageGfx(Player *p, PlayerSpriteInfo *param2) s->graphics.anim = p->anim; s->variant = p->variant; s->prevVariant = -1; - s->x = I(p->x); - s->y = I(p->y); + s->x = I(p->qWorldX); + s->y = I(p->qWorldY); s->oamFlags = SPRITE_OAM_ORDER(16 + unk60); s->qAnimDelay = 0; s->animSpeed = SPRITE_ANIM_SPEED(1.0); @@ -619,8 +619,8 @@ void AllocateCharacterStageGfx(Player *p, PlayerSpriteInfo *param2) s->hitboxes[1].index = -1; param2->transform.rotation = 0; - param2->transform.width = +Q(1); - param2->transform.height = +Q(1); + param2->transform.qScaleX = +Q(1); + param2->transform.qScaleY = +Q(1); param2->transform.x = 0; param2->transform.y = 0; } @@ -646,8 +646,8 @@ void AllocateCharacterMidAirGfx(Player *p, PlayerSpriteInfo *param2) s->graphics.size = 0; s->prevVariant = -1; - s->x = I(p->x); - s->y = I(p->y); + s->x = I(p->qWorldX); + s->y = I(p->qWorldY); s->oamFlags = SPRITE_OAM_ORDER(17); s->qAnimDelay = 0; s->animSpeed = SPRITE_ANIM_SPEED(1.0); @@ -661,8 +661,8 @@ void AllocateCharacterMidAirGfx(Player *p, PlayerSpriteInfo *param2) s->frameFlags = (SPRITE_FLAG_MASK_18 | SPRITE_FLAG(PRIORITY, 2) | SPRITE_FLAG_MASK_ROT_SCALE_ENABLE | SPRITE_FLAG(ROT_SCALE, 4)); extraSprite->transform.rotation = 0; - extraSprite->transform.width = +Q(1); - extraSprite->transform.height = +Q(1); + extraSprite->transform.qScaleX = +Q(1); + extraSprite->transform.qScaleY = +Q(1); extraSprite->transform.x = 0; extraSprite->transform.y = 0; } @@ -678,8 +678,8 @@ void SetStageSpawnPos(u32 character, u32 level, u32 p2, Player *p) } else { p->checkPointX = 360 - (SIO_MULTI_CNT->id * 20); p->checkPointY = 177; - p->x = -1; - p->y = -1; + p->qWorldX = -1; + p->qWorldY = -1; } p->unk98 = 0; @@ -699,12 +699,12 @@ void InitializePlayer(Player *p) #endif s8 *character; - if ((gGameMode == GAME_MODE_MULTI_PLAYER_COLLECT_RINGS) && (((p->x & p->y) + 1) != 0)) { - p->x = Q(460); + if ((gGameMode == GAME_MODE_MULTI_PLAYER_COLLECT_RINGS) && (((p->qWorldX & p->qWorldY) + 1) != 0)) { + p->qWorldX = Q(460); } else { - p->x = Q(p->checkPointX); + p->qWorldX = Q(p->checkPointX); } - p->y = Q(p->checkPointY); + p->qWorldY = Q(p->checkPointY); p->callback = Player_TouchGround; @@ -898,8 +898,8 @@ s32 sub_802195C(Player *p, u8 *p1, s32 *out) if (out == NULL) out = &dummyInt; - playerX2 = I(p->x) - (2 + p->spriteOffsetX); - playerY2 = I(p->y) - (p->spriteOffsetY); + playerX2 = I(p->qWorldX) - (2 + p->spriteOffsetX); + playerY2 = I(p->qWorldY) - (p->spriteOffsetY); mask = p->layer; if (p->speedAirY < Q(3.0)) { @@ -908,8 +908,8 @@ s32 sub_802195C(Player *p, u8 *p1, s32 *out) r5 = sub_801E4E4(playerX2, playerY2, mask, -8, &anotherByte, sub_801ED24); - playerX = I(p->x) - (2 + p->spriteOffsetX); - playerY = I(p->y) + (p->spriteOffsetY); + playerX = I(p->qWorldX) - (2 + p->spriteOffsetX); + playerY = I(p->qWorldY) + (p->spriteOffsetY); mask = p->layer; if (p->speedAirY < Q(3.0)) { @@ -948,8 +948,8 @@ s32 sub_8021A34(Player *p, u8 *p1, s32 *out) if (out == NULL) out = &dummyInt; - playerX2 = I(p->x) + (2 + p->spriteOffsetX); - playerY2 = I(p->y) - (p->spriteOffsetY); + playerX2 = I(p->qWorldX) + (2 + p->spriteOffsetX); + playerY2 = I(p->qWorldY) - (p->spriteOffsetY); mask = p->layer; if (p->speedAirY < Q(3.0)) { @@ -958,8 +958,8 @@ s32 sub_8021A34(Player *p, u8 *p1, s32 *out) r5 = sub_801E4E4(playerX2, playerY2, mask, +8, &anotherByte, sub_801ED24); - playerX = I(p->x) + (2 + p->spriteOffsetX); - playerY = I(p->y) + (p->spriteOffsetY); + playerX = I(p->qWorldX) + (2 + p->spriteOffsetX); + playerY = I(p->qWorldY) + (p->spriteOffsetY); mask = p->layer; if (p->speedAirY < Q(3.0)) { @@ -998,8 +998,8 @@ s32 sub_8021B08(Player *p, u8 *p1, s32 *out) if (out == NULL) out = &dummyInt; - playerY2 = I(p->y) - (p->spriteOffsetY); - playerX2 = I(p->x) - (2 + p->spriteOffsetX); + playerY2 = I(p->qWorldY) - (p->spriteOffsetY); + playerX2 = I(p->qWorldX) - (2 + p->spriteOffsetX); mask = p->layer; if (p->speedAirY < Q(3.0)) { @@ -1008,8 +1008,8 @@ s32 sub_8021B08(Player *p, u8 *p1, s32 *out) r5 = sub_801E4E4(playerY2, playerX2, mask, -8, &anotherByte, sub_801EE64); - playerY = I(p->y) - (p->spriteOffsetY); - playerX = I(p->x) + (2 + p->spriteOffsetX); + playerY = I(p->qWorldY) - (p->spriteOffsetY); + playerX = I(p->qWorldX) + (2 + p->spriteOffsetX); mask = p->layer; if (p->speedAirY < Q(3.0)) { @@ -1063,8 +1063,8 @@ void sub_8021C4C(Player *p) u32 mask; u32 mask2 = p->layer; - playerX = I(p->x) - (3 + p->spriteOffsetX); - playerY = I(p->y); + playerX = I(p->qWorldX) - (3 + p->spriteOffsetX); + playerY = I(p->qWorldY); mask = mask2; if (p->speedAirY < Q(3.0)) { @@ -1075,12 +1075,12 @@ void sub_8021C4C(Player *p) result = sub_801E4E4(playerX, playerY, mask, -8, 0, sub_801ED24); if (result <= 0) { - p->x -= Q(result); + p->qWorldX -= Q(result); p->speedAirX = 0; } - playerX2 = I(p->x) + (3 + p->spriteOffsetX); - playerY2 = I(p->y); + playerX2 = I(p->qWorldX) + (3 + p->spriteOffsetX); + playerY2 = I(p->qWorldY); mask = mask2; if (p->speedAirY < Q(3.0)) { @@ -1090,7 +1090,7 @@ void sub_8021C4C(Player *p) result = sub_801E4E4(playerX2, playerY2, mask, +8, 0, sub_801ED24); if (result <= 0) { - p->x += Q(result); + p->qWorldX += Q(result); p->speedAirX = 0; } @@ -1115,7 +1115,7 @@ void sub_8021C4C(Player *p) result = -result; } - p->y += result << 8; + p->qWorldY += result << 8; sub_8021BE0(p); @@ -1159,8 +1159,8 @@ void sub_8021DB8(Player *p) u32 mask; u32 mask2 = p->layer; - playerX = I(p->x) - (3 + p->spriteOffsetX); - playerY = I(p->y); + playerX = I(p->qWorldX) - (3 + p->spriteOffsetX); + playerY = I(p->qWorldY); mask = mask2; if (p->speedAirY < Q(3.0)) { @@ -1171,12 +1171,12 @@ void sub_8021DB8(Player *p) result = sub_801E4E4(playerX, playerY, mask, -8, 0, sub_801ED24); if (result <= 0) { - p->x -= Q(result); + p->qWorldX -= Q(result); p->speedAirX = 0; } - playerX2 = I(p->x) + (3 + p->spriteOffsetX); - playerY2 = I(p->y); + playerX2 = I(p->qWorldX) + (3 + p->spriteOffsetX); + playerY2 = I(p->qWorldY); mask = mask2; if (p->speedAirY < Q(3.0)) { @@ -1186,7 +1186,7 @@ void sub_8021DB8(Player *p) result = sub_801E4E4(playerX2, playerY2, mask, +8, 0, sub_801ED24); if (result <= 0) { - p->x += Q(result); + p->qWorldX += Q(result); p->speedAirX = 0; } @@ -1202,7 +1202,7 @@ void sub_8021DB8(Player *p) result = -result; } - p->y -= result << 8; + p->qWorldY -= result << 8; if (((rotation + 32) & 0x40)) { s8 *pt = (s8 *)&rotation; @@ -1239,12 +1239,12 @@ void sub_8021EE4(Player *p) gravity = GRAVITY_IS_INVERTED; if (gravity) { - playerX = I(p->x) - (3 + p->spriteOffsetX); - playerY = I(p->y); + playerX = I(p->qWorldX) - (3 + p->spriteOffsetX); + playerY = I(p->qWorldY); result = sub_801E4E4(playerX, playerY, mask2, -8, NULL, sub_801ED24); } else { - playerX2 = I(p->x) - (3 + p->spriteOffsetX); - playerY2 = I(p->y); + playerX2 = I(p->qWorldX) - (3 + p->spriteOffsetX); + playerY2 = I(p->qWorldY); mask = mask2; if (p->speedAirY < Q(3.0)) { @@ -1254,7 +1254,7 @@ void sub_8021EE4(Player *p) } if (result <= 0) { - p->x -= Q(result); + p->qWorldX -= Q(result); p->speedAirX = 0; p->speedGroundX = p->speedAirY; } @@ -1271,7 +1271,7 @@ void sub_8021EE4(Player *p) result = -result; } - p->y -= Q(result); + p->qWorldY -= Q(result); if (p->speedAirY < 0) { p->speedAirY = 0; @@ -1288,7 +1288,7 @@ void sub_8021EE4(Player *p) result = -result; } - p->y += Q(result); + p->qWorldY += Q(result); p->rotation = rotation; sub_8021BE0(p); @@ -1314,12 +1314,12 @@ void sub_802203C(Player *p) gravity = GRAVITY_IS_INVERTED; if (gravity) { - playerX = I(p->x) + (3 + p->spriteOffsetX); - playerY = I(p->y); + playerX = I(p->qWorldX) + (3 + p->spriteOffsetX); + playerY = I(p->qWorldY); result = sub_801E4E4(playerX, playerY, mask2, +8, NULL, sub_801ED24); } else { - playerX2 = I(p->x) + (3 + p->spriteOffsetX); - playerY2 = I(p->y); + playerX2 = I(p->qWorldX) + (3 + p->spriteOffsetX); + playerY2 = I(p->qWorldY); mask = mask2; if (p->speedAirY < Q(3.0)) { @@ -1329,7 +1329,7 @@ void sub_802203C(Player *p) } if (result <= 0) { - p->x += Q(result); + p->qWorldX += Q(result); p->speedAirX = 0; p->speedGroundX = p->speedAirY; } @@ -1346,7 +1346,7 @@ void sub_802203C(Player *p) result = -result; } - p->y -= Q(result); + p->qWorldY -= Q(result); if (p->speedAirY < 0) { p->speedAirY = 0; @@ -1363,7 +1363,7 @@ void sub_802203C(Player *p) result = -result; } - p->y += Q(result); + p->qWorldY += Q(result); p->rotation = rotation; sub_8021BE0(p); @@ -1425,7 +1425,7 @@ void sub_8022218(Player *p) res = -res; } - p->y += Q(res); + p->qWorldY += Q(res); p->rotation = rotation; sub_8021BE0(p); @@ -1455,7 +1455,7 @@ void sub_8022284(Player *p) res = -res; } - p->y -= Q(res); + p->qWorldY -= Q(res); p->rotation = rotation; sub_8021BE0(p); @@ -1499,7 +1499,7 @@ void sub_8022318(Player *p) p->spriteOffsetX = 6; p->spriteOffsetY = 14; - p->y += Q(offsetY); + p->qWorldY += Q(offsetY); } p->moveState &= ~MOVESTATE_IN_AIR; @@ -1528,8 +1528,8 @@ void sub_80223BC(Player *p) u32 mask; u32 mask2 = p->layer; - playerX = I(p->x) - (3 + p->spriteOffsetX); - playerY = I(p->y); + playerX = I(p->qWorldX) - (3 + p->spriteOffsetX); + playerY = I(p->qWorldY); mask = mask2; if (p->speedAirY < Q(3.0)) { @@ -1539,14 +1539,14 @@ void sub_80223BC(Player *p) result = sub_801E4E4(playerX, playerY, mask, -8, NULL, sub_801ED24); if (result <= 0) { - p->x -= Q(result); + p->qWorldX -= Q(result); p->speedAirX = 0; // TODO: Find out which character(s) call this, to use the appropriate 'flags' p->w.sf.flags |= 0x20; } - playerX2 = I(p->x) + (3 + p->spriteOffsetX); - playerY2 = I(p->y); + playerX2 = I(p->qWorldX) + (3 + p->spriteOffsetX); + playerY2 = I(p->qWorldY); mask = mask2; if (p->speedAirY < Q(3.0)) { @@ -1555,7 +1555,7 @@ void sub_80223BC(Player *p) result = sub_801E4E4(playerX2, playerY2, mask, +8, NULL, sub_801ED24); if (result <= 0) { - p->x += Q(result); + p->qWorldX += Q(result); p->speedAirX = 0; p->w.sf.flags |= 0x20; } @@ -1572,7 +1572,7 @@ void sub_80223BC(Player *p) result = -result; } - p->y += Q(result); + p->qWorldY += Q(result); p->rotation = rotation; p->speedAirY = 0; @@ -1593,8 +1593,8 @@ void sub_80224DC(Player *p) u32 mask; u32 mask2 = p->layer; - playerX = I(p->x) - (3 + p->spriteOffsetX); - playerY = I(p->y); + playerX = I(p->qWorldX) - (3 + p->spriteOffsetX); + playerY = I(p->qWorldY); mask = mask2; if (p->speedAirY < Q(3.0)) { @@ -1604,14 +1604,14 @@ void sub_80224DC(Player *p) result = sub_801E4E4(playerX, playerY, mask, -8, NULL, sub_801ED24); if (result <= 0) { - p->x -= Q(result); + p->qWorldX -= Q(result); p->speedAirX = 0; // TODO: Find out which character(s) call this, to use the appropriate 'flags' p->w.sf.flags |= 0x20; } - playerX2 = I(p->x) + (3 + p->spriteOffsetX); - playerY2 = I(p->y); + playerX2 = I(p->qWorldX) + (3 + p->spriteOffsetX); + playerY2 = I(p->qWorldY); mask = mask2; if (p->speedAirY < Q(3.0)) { @@ -1620,7 +1620,7 @@ void sub_80224DC(Player *p) result = sub_801E4E4(playerX2, playerY2, mask, +8, NULL, sub_801ED24); if (result <= 0) { - p->x += Q(result); + p->qWorldX += Q(result); p->speedAirX = 0; p->w.sf.flags |= 0x20; } @@ -1637,7 +1637,7 @@ void sub_80224DC(Player *p) result = -result; } - p->y -= Q(result); + p->qWorldY -= Q(result); p->speedAirY = 0; } @@ -1655,8 +1655,8 @@ void sub_80225E8(Player *p) u32 mask; u8 *mask2 = &p->layer; - playerX = I(p->x) - (2 + p->spriteOffsetX); - playerY = I(p->y); + playerX = I(p->qWorldX) - (2 + p->spriteOffsetX); + playerY = I(p->qWorldY); mask = *mask2; if (p->speedAirY < Q(3.0)) { @@ -1665,7 +1665,7 @@ void sub_80225E8(Player *p) result = sub_801E4E4(playerX, playerY, mask, -8, NULL, sub_801ED24); if (result <= 0) { - p->x -= Q(result); + p->qWorldX -= Q(result); p->speedAirX = 0; // TODO: Find out which character(s) call this, to use the appropriate 'flags' p->w.sf.flags |= 0x20; @@ -1683,7 +1683,7 @@ void sub_80225E8(Player *p) if (GRAVITY_IS_INVERTED) { result = -result; } - p->y -= Q(result); + p->qWorldY -= Q(result); if (p->speedAirY < 0) { p->speedAirY = 0; @@ -1701,7 +1701,7 @@ void sub_80225E8(Player *p) result = -result; } - p->y += Q(result); + p->qWorldY += Q(result); p->rotation = rotation; p->speedAirY = 0; @@ -1723,8 +1723,8 @@ void sub_8022710(Player *p) u32 mask; u8 *mask2 = &p->layer; - playerX = I(p->x) + (2 + p->spriteOffsetX); - playerY = I(p->y); + playerX = I(p->qWorldX) + (2 + p->spriteOffsetX); + playerY = I(p->qWorldY); mask = *mask2; if (p->speedAirY < Q(3.0)) { @@ -1733,7 +1733,7 @@ void sub_8022710(Player *p) result = sub_801E4E4(playerX, playerY, mask, +8, NULL, sub_801ED24); if (result <= 0) { - p->x += Q(result); + p->qWorldX += Q(result); p->speedAirX = 0; // TODO: Find out which character(s) call this, to use the appropriate 'flags' p->w.sf.flags |= 0x20; @@ -1751,7 +1751,7 @@ void sub_8022710(Player *p) if (GRAVITY_IS_INVERTED) { result = -result; } - p->y -= Q(result); + p->qWorldY -= Q(result); if (p->speedAirY < 0) { p->speedAirY = 0; @@ -1769,7 +1769,7 @@ void sub_8022710(Player *p) result = -result; } - p->y += Q(result); + p->qWorldY += Q(result); p->rotation = rotation; p->speedAirY = 0; @@ -1822,14 +1822,14 @@ void sub_80228C0(Player *p) register s32 resultA asm("r6"); register u32 r1 asm("r1"); register u32 r0 asm("r0"); - register s32 playerX asm("r4") = p->x; - register s32 playerY asm("sl") = p->y; + register s32 playerX asm("r4") = p->qWorldX; + register s32 playerY asm("sl") = p->qWorldY; #else s32 resultA; u32 r1; u32 r0; - s32 playerX = p->x; - s32 playerY = p->y; + s32 playerX = p->qWorldX; + s32 playerY = p->qWorldY; #endif u32 mask = p->layer; s32 py = I(playerY); @@ -1896,7 +1896,7 @@ void sub_80228C0(Player *p) } r1 = r0; - p->y = playerY; + p->qWorldY = playerY; if (!(r1 & 0x1)) { vu8 *pRot = &p->rotation; @@ -1941,8 +1941,8 @@ void sub_80229EC(Player *p) s32 playerX; u32 mask; #endif - playerX = p->x; - playerY = (p->y); + playerX = p->qWorldX; + playerY = (p->qWorldY); mask = p->layer; py = I(playerY); @@ -2008,7 +2008,7 @@ void sub_80229EC(Player *p) } r1 = r0; - p->y = playerY; + p->qWorldY = playerY; if (!(r1 & 0x1)) { vu8 *pRot = &p->rotation; @@ -2053,8 +2053,8 @@ void sub_8022B18(Player *p) s32 playerY; u32 mask; #endif - playerX = p->x; - playerY = (p->y); + playerX = p->qWorldX; + playerY = (p->qWorldY); mask = p->layer; py = I(playerX); @@ -2120,7 +2120,7 @@ void sub_8022B18(Player *p) } r1 = r0; - p->x = playerX; + p->qWorldX = playerX; if (!(r1 & 0x1)) { vu8 *pRot = &p->rotation; @@ -2164,8 +2164,8 @@ void sub_8022C44(Player *p) s32 playerY; u32 mask; #endif - playerX = p->x; - playerY = (p->y); + playerX = p->qWorldX; + playerY = (p->qWorldY); mask = p->layer; py = I(playerX); @@ -2230,7 +2230,7 @@ void sub_8022C44(Player *p) } r1 = r0; - p->x = playerX; + p->qWorldX = playerX; if (!(r1 & 0x1)) { vu8 *pRot = &p->rotation; @@ -2266,7 +2266,7 @@ void sub_8022D6C(Player *p) // NOTE/TODO: Not in SA1, but likely in SA3, so assuming >= GAME_SA2! #if (GAME >= GAME_SA2) if ((gCurrentLevel == 0) && (gWater.isActive == TRUE)) { - s32 r5 = Q(p->y) >> 16; + s32 r5 = Q(p->qWorldY) >> 16; u32 mask = ~0x3; s32 offsetY = p->spriteOffsetY; s32 unk4 = gWater.currentWaterLevel; @@ -2277,7 +2277,7 @@ void sub_8022D6C(Player *p) && (ABS(p->speedGroundX) >= Q(6.0))) { sub_80228C0(p); - if (p->y >= Q(r5)) { + if (p->qWorldY >= Q(r5)) { if (!(p->moveState & MOVESTATE_20000)) { p->moveState |= MOVESTATE_20000; @@ -2287,7 +2287,7 @@ void sub_8022D6C(Player *p) } m4aSongNumStartOrContinue(SE_281); - p->y = (r0 << 8); + p->qWorldY = (r0 << 8); p->rotation = 0; p->moveState &= ~MOVESTATE_IN_AIR; } else { @@ -2487,8 +2487,8 @@ s32 sub_802302C(u8 param0, Player *p) s32 result; u32 temp; - s32 px = I(p->x); - s32 py = I(p->y); + s32 px = I(p->qWorldX); + s32 py = I(p->qWorldY); p->unk29 = param0; r3 = (s8)param0; @@ -2572,25 +2572,25 @@ void sub_8023128(Player *p) switch ((rot & 0xC0) >> 6) { case 0: { - p->y += r2; + p->qWorldY += r2; p->speedAirY = 0; } break; case 1: { - p->x -= r2; + p->qWorldX -= r2; p->speedAirX = 0; p->moveState |= MOVESTATE_20; p->speedGroundX = 0; } break; case 2: { - p->y -= r2; + p->qWorldY -= r2; p->speedAirY = 0; p->moveState |= MOVESTATE_IN_AIR; } break; case 3: { - p->x += r2; + p->qWorldX += r2; p->speedAirX = 0; p->moveState |= MOVESTATE_20; p->speedGroundX = 0; @@ -2628,12 +2628,12 @@ void sub_80231C0(Player *p) switch (((r5 + Q(0.125)) & 0xC0) >> 6) { case 0: { - p->y += r2; + p->qWorldY += r2; p->speedAirY = 0; } break; case 1: { - p->x -= r2; + p->qWorldX -= r2; p->speedAirX = 0; p->moveState &= ~MOVESTATE_4; @@ -2644,13 +2644,13 @@ void sub_80231C0(Player *p) } break; case 2: { - p->y -= r2; + p->qWorldY -= r2; p->speedAirY = 0; p->moveState |= MOVESTATE_IN_AIR; } break; case 3: { - p->x += r2; + p->qWorldX += r2; p->speedAirX = 0; p->moveState &= ~MOVESTATE_4; @@ -2693,8 +2693,8 @@ void sub_8023260(Player *p) void sub_80232D0(Player *p) { struct Camera *cam = &gCamera; - s32 qPX = p->x; - s32 qPY = p->y; + s32 qPX = p->qWorldX; + s32 qPY = p->qWorldY; s32 ix, iy; s32 ox, oy; @@ -2768,13 +2768,13 @@ void sub_80232D0(Player *p) if ((p->moveState & (MOVESTATE_80000000 | MOVESTATE_DEAD)) != MOVESTATE_DEAD) { s32 r2, r3; struct Camera *cam2 = &gCamera; - r3 = p->y; + r3 = p->qWorldY; if ((s32)p->moveState >= 0) { s32 r1; if (GRAVITY_IS_INVERTED) { - if (p->y > Q(gCamera.minY)) { + if (p->qWorldY > Q(gCamera.minY)) { goto lbl0; } else { r1 = 1; @@ -2784,7 +2784,7 @@ void sub_80232D0(Player *p) r1 = 1; - if (p->y < qMaxY) { + if (p->qWorldY < qMaxY) { lbl0: r1 = 0; } @@ -2844,8 +2844,8 @@ void sub_80232D0(Player *p) } } - p->x = qPX; - p->y = qPY; + p->qWorldX = qPX; + p->qWorldY = qPY; } } } @@ -2995,7 +2995,7 @@ void sub_8023748(Player *p) void sub_8023878(Player *p) { p->moveState &= ~MOVESTATE_1000; - if (gWater.isActive == TRUE && gWater.currentWaterLevel >= 0 && (I(p->y) - 4) >= gWater.currentWaterLevel) { + if (gWater.isActive == TRUE && gWater.currentWaterLevel >= 0 && (I(p->qWorldY) - 4) >= gWater.currentWaterLevel) { if (!(p->moveState & MOVESTATE_40)) { p->moveState |= MOVESTATE_40; p->moveState |= MOVESTATE_1000; @@ -3004,7 +3004,7 @@ void sub_8023878(Player *p) p->speedAirY = p->speedAirY >> 2; if ((p->character != 3 || p->unk61 != 9) && (s8)p->unk88 < 1) { p->unk88 = 10; - CreateWaterfallSurfaceHitEffect(I(p->x), gWater.currentWaterLevel); + CreateWaterfallSurfaceHitEffect(I(p->qWorldX), gWater.currentWaterLevel); m4aSongNumStart(SE_WATERFALL_SURFACE_HIT); } } @@ -3013,7 +3013,7 @@ void sub_8023878(Player *p) switch (p->secondsUntilDrown--) { case 11: if (p->unk60 == 0) { - gUnknown_030054A8.unk4 = 16; + gMusicManagerState.unk4 = 16; } break; case 12: @@ -3038,14 +3038,14 @@ void sub_8023878(Player *p) if (p->secondsUntilDrown < 0) { p->moveState |= MOVESTATE_DEAD; p->speedAirY = 0; - SpawnAirBubbles(p->x, p->y - Q(12), 0, 1); + SpawnAirBubbles(p->qWorldX, p->qWorldY - Q(12), 0, 1); SpawnBubblesAfterDrowning(p); } p->framesUntilDrownCountDecrement = 60; } if (!(gStageTime % 16u) && !(PseudoRandom32() & 0x300)) { s32 qDX = ((p->moveState & MOVESTATE_FACING_LEFT) ? -Q(4) : +Q(4)); - SpawnAirBubbles(p->x + qDX, p->y - Q(4), 0, 0); + SpawnAirBubbles(p->qWorldX + qDX, p->qWorldY - Q(4), 0, 0); } } else { if (p->moveState & MOVESTATE_40) { @@ -3055,7 +3055,7 @@ void sub_8023878(Player *p) if ((p->character != 3 || p->unk61 != 9) && p->unk88 < 1) { p->unk88 = 10; - CreateWaterfallSurfaceHitEffect(I(p->x), gWater.currentWaterLevel); + CreateWaterfallSurfaceHitEffect(I(p->qWorldX), gWater.currentWaterLevel); m4aSongNumStart(SE_WATERFALL_SURFACE_HIT); } } @@ -3112,19 +3112,19 @@ void sub_8023B5C(Player *p, s32 spriteOffsetY) switch ((rot >> 6)) { case 0: { - p->y -= Q(spriteOffsetY - p->spriteOffsetY); + p->qWorldY -= Q(spriteOffsetY - p->spriteOffsetY); } break; case 2: { - p->y += Q(spriteOffsetY - p->spriteOffsetY); + p->qWorldY += Q(spriteOffsetY - p->spriteOffsetY); } break; case 1: { - p->x += Q(spriteOffsetY - p->spriteOffsetY); + p->qWorldX += Q(spriteOffsetY - p->spriteOffsetY); } break; case 3: { - p->x -= Q(spriteOffsetY - p->spriteOffsetY); + p->qWorldX -= Q(spriteOffsetY - p->spriteOffsetY); } break; } } @@ -3172,7 +3172,7 @@ void Player_Debug_TestRingScatter(Player *p) sub_80232D0(p); if (gPressedKeys & B_BUTTON) { - InitScatteringRings(I(p->x), I(p->y), 1); + InitScatteringRings(I(p->qWorldX), I(p->qWorldY), 1); } } } @@ -3203,8 +3203,8 @@ void Task_PlayerHandleDeath(void) gSpecialRingCount = 0; InitializePlayer(&gPlayer); - gCamera.x = I(gPlayer.x) + gCamera.shiftX - (DISPLAY_WIDTH / 2); - gCamera.y = I(gPlayer.y) + gCamera.shiftY - (DISPLAY_HEIGHT / 2); + gCamera.x = I(gPlayer.qWorldX) + gCamera.shiftX - (DISPLAY_WIDTH / 2); + gCamera.y = I(gPlayer.qWorldY) + gCamera.shiftY - (DISPLAY_HEIGHT / 2); m4aMPlayTempoControl(&gMPlayInfo_BGM, 256); gPlayer.moveState = 0; gStageFlags &= ~STAGE_FLAG__GRAVITY_INVERTED; @@ -3216,8 +3216,8 @@ void Task_PlayerHandleDeath(void) gCamera.unk50 &= ~0x3; if (gPlayer.character == CHARACTER_CREAM && gCheese != NULL) { - gCheese->posX = gPlayer.x; - gCheese->posY = gPlayer.y; + gCheese->posX = gPlayer.qWorldX; + gCheese->posY = gPlayer.qWorldY; } gCurTask->main = Task_PlayerMain; @@ -3254,7 +3254,7 @@ void Task_PlayerDied(void) PlayerSpriteInfo *psi1 = gPlayer.spriteInfoBody; PlayerSpriteInfo *psi2 = gPlayer.spriteInfoLimbs; - if (DeadPlayerLeftScreen(&gPlayer, &gCamera, gPlayer.y)) { + if (DeadPlayerLeftScreen(&gPlayer, &gCamera, gPlayer.qWorldY)) { player_0_Task *gt = TASK_DATA(gCurTask); gt->unk4 = ZONE_TIME_TO_INT(0, 1); gPlayer.moveState |= MOVESTATE_100000; @@ -3581,7 +3581,7 @@ void sub_80246DC(Player *p) PLAYERFN_CHANGE_SHIFT_OFFSETS(p, 6, 9); } else { if ((p->speedAirY > 0) && (p->variant == 1) && ((((u16)anim - 10) == 0) || (((u16)anim - 10) == 1))) { - s32 newY = sub_801E6D4(I(p->y) + p->spriteOffsetY, I(p->x), p->layer, 8, NULL, sub_801EE64); + s32 newY = sub_801E6D4(I(p->qWorldY) + p->spriteOffsetY, I(p->qWorldX), p->layer, 8, NULL, sub_801EE64); if (gGameMode != GAME_MODE_MULTI_PLAYER_COLLECT_RINGS) { if (newY <= 32) { @@ -3740,30 +3740,30 @@ void sub_802486C(Player *p, PlayerSpriteInfo *p2) ({ \ s32 x, y; \ if (!(p->moveState & MOVESTATE_FACING_LEFT)) { \ - psi->transform.width = -Q(1.0); \ + psi->transform.qScaleX = -Q(1.0); \ } else { \ - psi->transform.width = +Q(1.0); \ + psi->transform.qScaleX = +Q(1.0); \ } \ if (GRAVITY_IS_INVERTED) { \ - psi->transform.width = -psi->transform.width; \ + psi->transform.qScaleX = -psi->transform.qScaleX; \ } \ \ - if (psi->transform.width < 0) { \ + if (psi->transform.qScaleX < 0) { \ psi->transform.x--; \ } \ \ if (GRAVITY_IS_INVERTED) { \ - psi->transform.height = Q(1.0); \ + psi->transform.qScaleY = Q(1.0); \ /* requires double clamp to match */ \ - psi->transform.rotation = CLAMP_SIN_PERIOD(CLAMP_SIN_PERIOD(-Q(1.0) - (psi->transform.rotation + psi->transform.height))); \ + psi->transform.rotation = CLAMP_SIN_PERIOD(CLAMP_SIN_PERIOD(-Q(1.0) - (psi->transform.rotation + psi->transform.qScaleY))); \ } else { \ - psi->transform.height = Q(1.0); \ + psi->transform.qScaleY = Q(1.0); \ } \ \ - x = I(psi->transform.width * p->unk80); \ - y = I(psi->transform.height * p->unk82); \ - psi->transform.width = x; \ - psi->transform.height = y; \ + x = I(psi->transform.qScaleX * p->unk80); \ + y = I(psi->transform.qScaleY * p->unk82); \ + psi->transform.qScaleX = x; \ + psi->transform.qScaleY = y; \ UpdateSpriteAnimation(s); \ }) @@ -3785,11 +3785,11 @@ void sub_8024B10(Player *p, PlayerSpriteInfo *inPsi) r2; }); - s->x = I(p->x) - camX; - s->y = I(p->y) - camY; + s->x = I(p->qWorldX) - camX; + s->y = I(p->qWorldY) - camY; - psi->transform.x = I(p->x) - camX; - psi->transform.y = I(p->y) - camY; + psi->transform.x = I(p->qWorldX) - camX; + psi->transform.y = I(p->qWorldY) - camY; if (p->charState == CHARSTATE_WALK_A || p->charState == CHARSTATE_GRINDING || p->charState == CHARSTATE_ICE_SLIDE || p->charState == CHARSTATE_WALK_B || (p->charState == CHARSTATE_CREAM_CHAO_ATTACK && p->character == CHARACTER_CREAM)) { @@ -3840,8 +3840,8 @@ void sub_8024B10(Player *p, PlayerSpriteInfo *inPsi) send = &gMultiSioSend.pat4; mpp = TASK_DATA(gMultiplayerPlayerTasks[SIO_MULTI_CNT->id]); send->unk0 = 0x5000; - send->x = I(p->x) + p->unk7C; - send->y = I(p->y); + send->x = I(p->qWorldX) + p->unk7C; + send->y = I(p->qWorldY); send->unk6 = s->graphics.anim; send->unkA = p->itemEffect; if (gGameMode == GAME_MODE_MULTI_PLAYER_COLLECT_RINGS) { @@ -3946,8 +3946,8 @@ void sub_8024F74(Player *p, PlayerSpriteInfo *inPsi) psi->transform.x = recv->x - camX; psi->transform.y = recv->y - camY; } else { - psi->transform.x = I(p->x) - camX; - psi->transform.y = I(p->y) - camY; + psi->transform.x = I(p->qWorldX) - camX; + psi->transform.y = I(p->qWorldY) - camY; } s->animSpeed = SPRITE_ANIM_SPEED(1.0); @@ -4591,7 +4591,7 @@ void Player_Spindash(Player *p) p->speedAirY += Q(PLAYER_GRAVITY); } - p->x += p->speedAirX; + p->qWorldX += p->speedAirX; if ((gStageFlags ^ gUnknown_0300544C) & STAGE_FLAG__GRAVITY_INVERTED) { p->speedAirY = -p->speedAirY; @@ -4599,7 +4599,7 @@ void Player_Spindash(Player *p) p->speedAirY = MIN(p->speedAirY, Q(PLAYER_AIR_SPEED_MAX)); - p->y = GRAVITY_IS_INVERTED ? p->y - p->speedAirY : p->y + p->speedAirY; + p->qWorldY = GRAVITY_IS_INVERTED ? p->qWorldY - p->speedAirY : p->qWorldY + p->speedAirY; { s32 rot = (s8)p->rotation; @@ -4642,7 +4642,7 @@ void Player_Spindash(Player *p) sub_8023260(p); sub_8023128(p); - p->x += p->speedAirX; + p->qWorldX += p->speedAirX; if ((gStageFlags ^ gUnknown_0300544C) & STAGE_FLAG__GRAVITY_INVERTED) { p->speedAirY = -p->speedAirY; @@ -4650,7 +4650,7 @@ void Player_Spindash(Player *p) p->speedAirY = MIN(p->speedAirY, Q(PLAYER_AIR_SPEED_MAX)); - p->y = GRAVITY_IS_INVERTED ? p->y - p->speedAirY : p->y + p->speedAirY; + p->qWorldY = GRAVITY_IS_INVERTED ? p->qWorldY - p->speedAirY : p->qWorldY + p->speedAirY; sub_8022D6C(p); @@ -4680,15 +4680,15 @@ void sub_802669C(Player *p) p->itemEffect |= PLAYER_ITEM_EFFECT__TELEPORT; if (GRAVITY_IS_INVERTED) { - newY = sub_801E6D4(I(p->y) - p->spriteOffsetY, I(p->x), p->layer, -8, NULL, sub_801EE64); + newY = sub_801E6D4(I(p->qWorldY) - p->spriteOffsetY, I(p->qWorldX), p->layer, -8, NULL, sub_801EE64); - newY = p->y - Q(newY); + newY = p->qWorldY - Q(newY); } else { - newY = sub_801E6D4(I(p->y) + p->spriteOffsetY, I(p->x), p->layer, 8, NULL, sub_801EE64); + newY = sub_801E6D4(I(p->qWorldY) + p->spriteOffsetY, I(p->qWorldX), p->layer, 8, NULL, sub_801EE64); - newY = p->y + Q(newY); + newY = p->qWorldY + Q(newY); } - p->y = newY; + p->qWorldY = newY; p->moveState &= ~MOVESTATE_IN_AIR; gPlayer.moveState |= MOVESTATE_IN_SCRIPTED; @@ -5165,7 +5165,7 @@ void Player_InitReachedGoal(Player *p) void Player_GoalSlowdown(Player *p) { - u32 playerX = I(p->x); + u32 playerX = I(p->qWorldX); u16 playerX2; playerX2 = playerX - gStageGoalX; @@ -5224,7 +5224,7 @@ void Player_GoalBrake(Player *p) m4aSongNumStop(SE_LONG_BRAKE); if (gStageGoalX != 0) { - u16 playerX = I(p->x) - gStageGoalX; + u16 playerX = I(p->qWorldX) - gStageGoalX; s32 r8 = 0; if (playerX <= 730) @@ -5237,7 +5237,7 @@ void Player_GoalBrake(Player *p) if (r8 != 0) { INCREMENT_SCORE(r8); - CreateStageGoalBonusPointsAnim(I(p->x), I(p->y), r8); + CreateStageGoalBonusPointsAnim(I(p->qWorldX), I(p->qWorldY), r8); } } } @@ -5380,7 +5380,7 @@ void Player_8027C5C(Player *p) { // TODO: Maybe this is actually to be considered the p's // x-position relative to a sprite region? - s32 playerX = I(p->x) - gCamera.x; + s32 playerX = I(p->qWorldX) - gCamera.x; if (playerX > (DISPLAY_WIDTH / 2)) { p->speedGroundX = Q(4.5); @@ -5411,9 +5411,9 @@ void Player_8027D3C(Player *p) s32 index = (0x40 + (r8 * 32)); cmpX = Q(*pCmpX + index); - if (p->x < cmpX) { + if (p->qWorldX < cmpX) { p->heldInput = DPAD_RIGHT; - } else if (p->x > cmpX) { + } else if (p->qWorldX > cmpX) { p->heldInput = DPAD_LEFT; } else { p->heldInput = 0; @@ -5437,14 +5437,14 @@ void Player_8027D3C(Player *p) PLAYERFN_UPDATE_UNK2A(p); - if (((p->x > cmpX) && (p->heldInput == DPAD_RIGHT)) // fmt - || ((p->x < cmpX) && (p->heldInput == DPAD_LEFT)) // - || (p->x == cmpX)) { + if (((p->qWorldX > cmpX) && (p->heldInput == DPAD_RIGHT)) // fmt + || ((p->qWorldX < cmpX) && (p->heldInput == DPAD_LEFT)) // + || (p->qWorldX == cmpX)) { p->isBoosting = FALSE; p->speedAirX = 0; p->speedAirY = 0; p->speedGroundX = 0; - p->x = cmpX; + p->qWorldX = cmpX; // TODO: Check correctness of MULTI_SIO_PLAYERS_MAX being here! if (r8 < MULTI_SIO_PLAYERS_MAX) { @@ -5652,10 +5652,10 @@ void Player_WindupDefaultTrick(Player *p) if (IS_SINGLE_PLAYER) { if (dir == TRICK_DIR_FORWARD && character == CHARACTER_SONIC) { - sub_8028640(I(p->x), I(p->y), 0); + sub_8028640(I(p->qWorldX), I(p->qWorldY), 0); } if (dir == TRICK_DIR_UP && character == CHARACTER_KNUCKLES) { - sub_8028640(I(p->x), I(p->y), 1); + sub_8028640(I(p->qWorldX), I(p->qWorldY), 1); } if (dir == TRICK_DIR_FORWARD && character == CHARACTER_AMY) { CreateHeartParticles(); @@ -6076,7 +6076,7 @@ bool32 Player_TryMidAirAction(Player *p) } else { p->moveState |= MOVESTATE_20000000; p->charState = CHARSTATE_SOME_ATTACK; - Player_SonicAmy_InitSkidAttackGfxTask(I(p->x), I(p->y), 1); + Player_SonicAmy_InitSkidAttackGfxTask(I(p->qWorldX), I(p->qWorldY), 1); song = SE_SONIC_INSTA_SHIELD; goto Player_TryMidAirAction_PlaySfx; } @@ -6508,8 +6508,8 @@ s32 sub_8029BB8(Player *p, u8 *p1, s32 *out) if (out == NULL) out = &dummyInt; - playerY2 = I(p->y) + p->spriteOffsetY; - playerX2 = I(p->x) - (2 + p->spriteOffsetX); + playerY2 = I(p->qWorldY) + p->spriteOffsetY; + playerX2 = I(p->qWorldX) - (2 + p->spriteOffsetX); mask = p->layer; if (p->speedAirY < 0) { @@ -6518,8 +6518,8 @@ s32 sub_8029BB8(Player *p, u8 *p1, s32 *out) r5 = sub_801E4E4(playerY2, playerX2, mask, 8, &anotherByte, sub_801EE64); - playerY = I(p->y) + p->spriteOffsetY; - playerX = I(p->x) + (2 + p->spriteOffsetX); + playerY = I(p->qWorldY) + p->spriteOffsetY; + playerX = I(p->qWorldX) + (2 + p->spriteOffsetX); mask = p->layer; if (p->speedAirY < 0) { @@ -6603,7 +6603,7 @@ void PlayerFn_Cmd_UpdateAirFallSpeed(Player *p) { PLAYERFN_UPDATE_AIR_FALL_SPEED bool32 sub_8029DE8(Player *p) { struct Camera *cam = &gCamera; - s32 playerY = p->y; + s32 playerY = p->qWorldY; if (!(p->moveState & MOVESTATE_80000000)) { if (GRAVITY_IS_INVERTED) { @@ -6622,7 +6622,7 @@ bool32 sub_8029DE8(Player *p) bool32 DeadPlayerLeftScreen_UnusedCopy(Player *p) { struct Camera *cam = &gCamera; - s32 playerY = p->y; + s32 playerY = p->qWorldY; if (!(p->moveState & MOVESTATE_80000000)) { if (GRAVITY_IS_INVERTED) { @@ -6686,7 +6686,7 @@ void sub_8029FA4(Player *p) u17 = -u17; } - CreateBrakingDustEffect(I(p->x), I(p->y) + u17); + CreateBrakingDustEffect(I(p->qWorldX), I(p->qWorldY) + u17); } } diff --git a/src/game/stage/player_super_sonic.c b/src/game/stage/player_super_sonic.c index 70400b9a4..992310d33 100644 --- a/src/game/stage/player_super_sonic.c +++ b/src/game/stage/player_super_sonic.c @@ -61,8 +61,8 @@ static void SuperSonicInitPlayer(void) { Player *p = &gPlayer; p->unk4 = 0; - p->x = 0; - p->y = 0; + p->qWorldX = 0; + p->qWorldY = 0; p->speedAirX = 0; p->speedAirY = 0; p->speedGroundX = 0; @@ -439,8 +439,8 @@ static void sub_802BE1C(struct SuperSonic *sonic) if (sonic->flags & SUPER_FLAG__4) { transform->rotation = (COS((sonic->unkC * 20) & ONE_CYCLE) >> 4) & ONE_CYCLE; - transform->width = Q(1.0); - transform->height = Q(1.0); + transform->qScaleX = Q(1.0); + transform->qScaleY = Q(1.0); transform->x = spr->x; transform->y = spr->y; TransformSprite(spr, transform); diff --git a/src/game/stage/results.c b/src/game/stage/results.c index 1adf9541f..0061deb6e 100644 --- a/src/game/stage/results.c +++ b/src/game/stage/results.c @@ -263,7 +263,7 @@ u16 CreateStageResults(u32 courseTime, u16 ringCount, u8 spRingCount) UpdateSpriteAnimation(s); } - gUnknown_030054A8.unk0 |= -1; + gMusicManagerState.unk0 |= -1; if (IS_FINAL_STAGE(gCurrentLevel)) { m4aSongNumStart(MUS_FINAL_CLEAR); diff --git a/src/game/stage/rings_scatter.c b/src/game/stage/rings_scatter.c index b9010621c..18bbb7dfd 100644 --- a/src/game/stage/rings_scatter.c +++ b/src/game/stage/rings_scatter.c @@ -21,10 +21,11 @@ #define MAX_SCATTERING_RINGS_COUNT_MP 16 #define PLAYER_TOUCHING_RING(p, rect, ringIntX, ringIntY) \ - ((((ringIntX - TILE_WIDTH) <= RECT_LEFT(I(p->x), rect) && (ringIntX + TILE_WIDTH) >= RECT_LEFT(I(p->x), rect)) \ - || ((ringIntX - TILE_WIDTH) >= RECT_LEFT(I(p->x), rect) && RECT_RIGHT(I(p->x), rect) >= (ringIntX - TILE_WIDTH))) \ - && ((((ringIntY - (TILE_WIDTH * 2)) <= RECT_TOP(I(p->y), rect) && ringIntY >= RECT_TOP(I(p->y), rect)) \ - || ((ringIntY - (TILE_WIDTH * 2)) >= RECT_TOP(I(p->y), rect) && RECT_BOTTOM(I(p->y), rect) >= (ringIntY - (TILE_WIDTH * 2)))))) + ((((ringIntX - TILE_WIDTH) <= RECT_LEFT(I(p->qWorldX), rect) && (ringIntX + TILE_WIDTH) >= RECT_LEFT(I(p->qWorldX), rect)) \ + || ((ringIntX - TILE_WIDTH) >= RECT_LEFT(I(p->qWorldX), rect) && RECT_RIGHT(I(p->qWorldX), rect) >= (ringIntX - TILE_WIDTH))) \ + && ((((ringIntY - (TILE_WIDTH * 2)) <= RECT_TOP(I(p->qWorldY), rect) && ringIntY >= RECT_TOP(I(p->qWorldY), rect)) \ + || ((ringIntY - (TILE_WIDTH * 2)) >= RECT_TOP(I(p->qWorldY), rect) \ + && RECT_BOTTOM(I(p->qWorldY), rect) >= (ringIntY - (TILE_WIDTH * 2)))))) typedef struct { /* 0x00 */ s32 x; @@ -208,13 +209,13 @@ typedef struct { /* 0x03 */ s8 bottom; } HitboxRect; -// TODO: Use improved version of these globally! -#define HB_ALT_LEFT(p, hb) (I((p)->x) + (hb)->left) +// TODO: Use improved version of these globaly! +#define HB_ALT_LEFT(p, hb) (I((p)->qWorldX) + (hb)->left) #define HB_ALT_WIDTH(hb) ((hb)->right - (hb)->left) -#define HB_ALT_RIGHT(p, hb) (I((p)->x) + HB_ALT_WIDTH(hb)) -#define HB_ALT_TOP(p, hb) (I((p)->y) + (hb)->top) +#define HB_ALT_RIGHT(p, hb) (I((p)->qWorldX) + HB_ALT_WIDTH(hb)) +#define HB_ALT_TOP(p, hb) (I((p)->qWorldY) + (hb)->top) #define HB_ALT_HEIGHT(hb) ((hb)->bottom - (hb)->top) -#define HB_ALT_BOTTOM(p, hb) (I((p)->y) + HB_ALT_HEIGHT(hb)) +#define HB_ALT_BOTTOM(p, hb) (I((p)->qWorldY) + HB_ALT_HEIGHT(hb)) void RingsScatterSingleplayer_FlippedGravity(void) { diff --git a/src/game/stage/screen_shake.c b/src/game/stage/screen_shake.c index 92f179ef0..c6d407040 100644 --- a/src/game/stage/screen_shake.c +++ b/src/game/stage/screen_shake.c @@ -53,10 +53,10 @@ void Task_ScreenShake(void) if (!(shake->flags & 0x20) || ((gStageTime % 2u) == 0)) { if (shake->flags & SCREENSHAKE_HORIZONTAL) { - cam->unk60 = r2; + cam->shakeOffsetX = r2; } if (shake->flags & SCREENSHAKE_VERTICAL) { - cam->unk62 = r2; + cam->shakeOffsetY = r2; } } @@ -92,10 +92,10 @@ static void TaskDestructor_ScreenShake(struct Task *t) struct Camera *cam = &gCamera; if (shake->flags & SCREENSHAKE_HORIZONTAL) { - cam->unk60 = 0; + cam->shakeOffsetX = 0; } if (shake->flags & SCREENSHAKE_VERTICAL) { - cam->unk62 = 0; + cam->shakeOffsetY = 0; } } \ No newline at end of file diff --git a/src/game/stage/stage.c b/src/game/stage/stage.c index 7103f14c1..57fa9681d 100644 --- a/src/game/stage/stage.c +++ b/src/game/stage/stage.c @@ -468,7 +468,7 @@ static inline void StageInit_SetMusic_inline(u16 level) if (gGameMode != GAME_MODE_MULTI_PLAYER_COLLECT_RINGS) { if (gSelectedCharacter == CHARACTER_SONIC && gLoadedSaveGame->unlockedLevels[CHARACTER_SONIC] <= gCurrentLevel && gCurrentLevel == LEVEL_INDEX(ZONE_5, ACT_BOSS)) { - gUnknown_030054A8.unk1 = 0x1E; + gMusicManagerState.unk1 = 0x1E; } else { m4aSongNumStart(gLevelSongs[level]); } diff --git a/src/game/stage/underwater_effects.c b/src/game/stage/underwater_effects.c index f1d4cc7f0..2c0c88e83 100644 --- a/src/game/stage/underwater_effects.c +++ b/src/game/stage/underwater_effects.c @@ -6,7 +6,7 @@ #include "game/sa1_sa2_shared/globals.h" -#include "game/stage/game_2.h" +#include "game/stage/grind_effect_2.h" #include "game/stage/player.h" #include "game/stage/camera.h" #include "game/stage/underwater_effects.h" @@ -42,14 +42,14 @@ static void Task_DrowningCountdown(void) r2 = ((ts->unk10 + 1) << 3); r2 = MIN(r2, 0x100); - transform->width = r2; - transform->height = r2; + transform->qScaleX = r2; + transform->qScaleY = r2; if (ts->unk14 & 0x1) - transform->width = -r2; + transform->qScaleX = -r2; if (ts->unk14 & 0x2) - transform->height = -transform->height; + transform->qScaleY = -transform->qScaleY; if ((transform->x < -32 || transform->x > DISPLAY_WIDTH + 32) || (transform->y < -32 || transform->y > DISPLAY_HEIGHT + 32) || (ts->unk10 > 0x80)) { @@ -78,8 +78,8 @@ struct Task *SpawnDrowningCountdownNum(Player *p, s32 countdown) SpriteTransform *transform; s32 temp; - ts->x = p->x - Q(cam->x); - ts->y = p->y - Q(cam->y); + ts->x = p->qWorldX - Q(cam->x); + ts->y = p->qWorldY - Q(cam->y); ts->unk8 = 0; ts->unkA = 0x120; ts->unk10 = 0; @@ -95,8 +95,8 @@ struct Task *SpawnDrowningCountdownNum(Player *p, s32 countdown) transform = &ts->transform; transform->rotation = 0; - transform->width = 0; - transform->height = 0; + transform->qScaleX = 0; + transform->qScaleY = 0; transform->x = 0; transform->y = 0; @@ -145,8 +145,8 @@ struct Task *SpawnAirBubbles(s32 p0, s32 p1, s32 p2, s32 p3) s->oamFlags = SPRITE_OAM_ORDER(9); transform->rotation = 0; - transform->width = 0; - transform->height = 0; + transform->qScaleX = 0; + transform->qScaleY = 0; transform->x = 0; transform->y = 0; @@ -169,7 +169,7 @@ bool32 RandomlySpawnAirBubbles(Player *p) if (!(p->moveState & MOVESTATE_FACING_LEFT)) randX = -randX; - SpawnAirBubbles(p->x - randX, p->y - randY, p->speedAirX, ((u32)PseudoRandom32() & 0x100) >> 8); + SpawnAirBubbles(p->qWorldX - randX, p->qWorldY - randY, p->speedAirX, ((u32)PseudoRandom32() & 0x100) >> 8); result = TRUE; } @@ -199,14 +199,14 @@ static void Task_SpawnAirBubbles(void) r2 = ((unk10 + 1) << 4); r2 = MIN(r2, 0x100); - transform->width = r2; - transform->height = r2; + transform->qScaleX = r2; + transform->qScaleY = r2; if (ts->unk14 & 0x1) - transform->width = -r2; + transform->qScaleX = -r2; if (ts->unk14 & 0x2) - transform->height = -transform->height; + transform->qScaleY = -transform->qScaleY; if ((transform->x < -32 || transform->x > DISPLAY_WIDTH + 32) || (transform->y < -32 || transform->y > DISPLAY_HEIGHT + 32) || (gWater.isActive != TRUE) || (gWater.currentWaterLevel < 0) || (I(r4) - 3 < gWater.currentWaterLevel) || (ts->unk10 > 0x1E0)) { @@ -250,7 +250,7 @@ static void Task_SpawnBubblesAfterDrowning(void) r3 = ((u32)PseudoRandom32() & 0x100) >> 8; - SpawnAirBubbles(p->x + r1, p->y + r2 - 0xC00, 0, r3); + SpawnAirBubbles(p->qWorldX + r1, p->qWorldY + r2 - 0xC00, 0, r3); } while (r4-- != 0); } } diff --git a/src/game/time_attack/results.c b/src/game/time_attack/results.c index f1b5f5b0f..c8bb9d093 100644 --- a/src/game/time_attack/results.c +++ b/src/game/time_attack/results.c @@ -237,8 +237,8 @@ u32 CreateTimeAttackResults(u32 finishTime) s->frameFlags = gUnknown_030054B8++ | 0x20; UpdateSpriteAnimation(s); - resultsCutScene->transform.width = 0; - resultsCutScene->transform.height = +Q(1); + resultsCutScene->transform.qScaleX = 0; + resultsCutScene->transform.qScaleY = +Q(1); resultsCutScene->transform.x = (DISPLAY_WIDTH / 2); resultsCutScene->transform.y = (DISPLAY_HEIGHT / 2) + 40; resultsCutScene->transform.rotation = 0; @@ -260,7 +260,7 @@ u32 CreateTimeAttackResults(u32 finishTime) s->frameFlags = 0; UpdateSpriteAnimation(s); - gUnknown_030054A8.unk0 = 0xFF; + gMusicManagerState.unk0 = 0xFF; if ((gCurrentLevel & ACT_BOSS) && !(gCurrentLevel & ACT_2)) { gPlayer.charState = CHARSTATE_ACT_CLEAR_TIME_ATTACK_OR_BOSS; @@ -327,7 +327,7 @@ static void AnimateResults(void) if (resultsCutScene->rank > 0) { // medal s = &resultsCutScene->base.sprScores[1]; - resultsCutScene->transform.width = COS_24_8(I((u16)resultsCutScene->medalSpin) * 4); + resultsCutScene->transform.qScaleX = COS_24_8(I((u16)resultsCutScene->medalSpin) * 4); resultsCutScene->medalSpin += resultsCutScene->medalSpinSpeed; if (resultsCutScene->medalSpin == 0) { @@ -338,8 +338,8 @@ static void AnimateResults(void) } } - if (resultsCutScene->transform.width == 0) { - resultsCutScene->transform.width = Q(0.0625); + if (resultsCutScene->transform.qScaleX == 0) { + resultsCutScene->transform.qScaleX = Q(0.0625); } TransformSprite(s, &resultsCutScene->transform); DisplaySprite(s); diff --git a/src/game/title_screen.c b/src/game/title_screen.c index 5414b17ad..0ac2e2f04 100644 --- a/src/game/title_screen.c +++ b/src/game/title_screen.c @@ -1682,7 +1682,7 @@ static void CreateLensFlareAnimation(void) s->frameFlags = i | (SPRITE_FLAG_MASK_ROT_SCALE_DOUBLE_SIZE | SPRITE_FLAG_MASK_ROT_SCALE_ENABLE); transform->rotation = 0; - transform->height = transform->width = posX * 2 + 0xB0; + transform->qScaleY = transform->qScaleX = posX * 2 + 0xB0; transform->x = lensFlare->posSequenceX[i]; transform->y = lensFlare->posSequenceY[i]; diff --git a/src/game/unknown_effect.c b/src/game/unknown_effect.c index bb92818ec..8adb9b167 100644 --- a/src/game/unknown_effect.c +++ b/src/game/unknown_effect.c @@ -22,8 +22,8 @@ u8 gUnknown_03005B7C = 0; void Task_UnknownEffect(void) { - s16 a = I(gPlayer.x) - gCamera.x; - s16 b = I(gPlayer.y) - gCamera.y; + s16 a = I(gPlayer.qWorldX) - gCamera.x; + s16 b = I(gPlayer.qWorldY) - gCamera.y; struct UnknownEffect87028 *effect = TASK_DATA(gCurTask); sub_80871C4(a, b, DISPLAY_HEIGHT - effect->unk0); @@ -36,8 +36,8 @@ void Task_UnknownEffect(void) void sub_8087088(void) { - s16 a = I(gPlayer.x) - gCamera.x; - s16 b = I(gPlayer.y) - gCamera.y; + s16 a = I(gPlayer.qWorldX) - gCamera.x; + s16 b = I(gPlayer.qWorldY) - gCamera.y; struct UnknownEffect87028 *effect = TASK_DATA(gCurTask); sub_80871C4(a, b, 0x6E); @@ -55,8 +55,8 @@ static const ALIGNED(4) s8 gUnknown_080E02DC[8][2] = { void sub_80870E8(void) { - s16 a = I(gPlayer.x) - gCamera.x; - s16 b = I(gPlayer.y) - gCamera.y; + s16 a = I(gPlayer.qWorldX) - gCamera.x; + s16 b = I(gPlayer.qWorldY) - gCamera.y; struct UnknownEffect87028 *effect = TASK_DATA(gCurTask); sub_80871C4(a + gUnknown_080E02DC[effect->unk0 & 7][0], b + gUnknown_080E02DC[effect->unk0 & 7][1], 160 - effect->unk0); diff --git a/src/game/water_effects.c b/src/game/water_effects.c index 327e1992a..3bbf39941 100644 --- a/src/game/water_effects.c +++ b/src/game/water_effects.c @@ -9,7 +9,7 @@ #include "game/stage/player.h" #include "game/stage/camera.h" -#include "game/stage/game_2.h" +#include "game/stage/grind_effect_2.h" #include "data/sprite_data.h" #include "game/water_effects.h" @@ -182,7 +182,7 @@ static void Task_StageWaterTask(void) u8 unk2_2; #endif - if ((gCurrentLevel == LEVEL_INDEX(ZONE_1, ACT_1)) && (I(gPlayer.x) > 6665) && (I(gPlayer.x) <= 10650)) { + if ((gCurrentLevel == LEVEL_INDEX(ZONE_1, ACT_1)) && (I(gPlayer.qWorldX) > 6665) && (I(gPlayer.qWorldX) <= 10650)) { water->isActive = TRUE; } else { water->isActive = FALSE; @@ -273,7 +273,7 @@ static void Task_RunOnWaterEffect(void) return; } - effect->x = I(p->x); + effect->x = I(p->qWorldX); effect->y = gWater.currentWaterLevel; s->x = effect->x - gCamera.x; diff --git a/src/sprite.c b/src/sprite.c index 47f50feca..0f49ddff6 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -322,14 +322,14 @@ NONMATCH("asm/non_matching/engine/TransformSprite.inc", void TransformSprite(Spr affine = (void *)&gOamBuffer[big.affineIndex * 4].all.affineParam; #if 0 - sub_80047A0(transform->rotation & ONE_CYCLE, transform->width, transform->height, + sub_80047A0(transform->rotation & ONE_CYCLE, transform->qScaleX, transform->qScaleY, big.affineIndex); #else big.qDirX = COS_24_8(transform->rotation & ONE_CYCLE); big.qDirY = SIN_24_8(transform->rotation & ONE_CYCLE); - big.unkC[0] = transform->width; - big.unkC[1] = transform->height; + big.unkC[0] = transform->qScaleX; + big.unkC[1] = transform->qScaleY; // __set_UnkC res = Div(0x10000, big.unkC[0]); @@ -350,11 +350,11 @@ NONMATCH("asm/non_matching/engine/TransformSprite.inc", void TransformSprite(Spr #endif // __post_Divs - if (transform->width < 0) - big.unkC[0] = -transform->width; + if (transform->qScaleX < 0) + big.unkC[0] = -transform->qScaleX; - if (transform->height < 0) - big.unkC[1] = -transform->height; + if (transform->qScaleY < 0) + big.unkC[1] = -transform->qScaleY; // _0800497A x16 = big.qDirX; @@ -386,7 +386,7 @@ NONMATCH("asm/non_matching/engine/TransformSprite.inc", void TransformSprite(Spr s32 r4; // __08004A04 - if (transform->width > 0) { + if (transform->qScaleX > 0) { // __08004A08 r4 = dimensions->offsetX; } else { @@ -395,7 +395,7 @@ NONMATCH("asm/non_matching/engine/TransformSprite.inc", void TransformSprite(Spr } // _08004A2E - if (transform->height > 0) { + if (transform->qScaleY > 0) { r3 = dimensions->offsetY; } else { // _08004A3E @@ -444,21 +444,21 @@ NONMATCH("asm/non_matching/engine/sub_8004E14.inc", void sub_8004E14(Sprite *spr us.qDirX = COS_24_8((transform->rotation + gUnknown_03001944) & ONE_CYCLE); us.qDirY = SIN_24_8((transform->rotation + gUnknown_03001944) & ONE_CYCLE); - us.unkC[0] = I(transform->width * gUnknown_030017F0); - us.unkC[1] = I(transform->height * gUnknown_03005394); + us.unkC[0] = I(transform->qScaleX * gUnknown_030017F0); + us.unkC[1] = I(transform->qScaleY * gUnknown_03005394); affine[0] = I(Div(Q(256), us.unkC[0]) * us.qDirX); affine[4] = I(Div(Q(256), us.unkC[0]) * us.qDirY); affine[8] = I(Div(Q(256), us.unkC[1]) * -us.qDirY); affine[12] = I(Div(Q(256), us.unkC[1]) * us.qDirX); - if (transform->width < 0) { - us.unkC[0] = I(-transform->width * gUnknown_030017F0); + if (transform->qScaleX < 0) { + us.unkC[0] = I(-transform->qScaleX * gUnknown_030017F0); } // _08004F48 - if (transform->height < 0) { - us.unkC[1] = I(-transform->height * gUnknown_03005394); + if (transform->qScaleY < 0) { + us.unkC[1] = I(-transform->qScaleY * gUnknown_03005394); } // _08004F6A @@ -484,7 +484,7 @@ NONMATCH("asm/non_matching/engine/sub_8004E14.inc", void sub_8004E14(Sprite *spr s16 offsetX, offsetY; s32 x, y; - if (transform->width > 0) { + if (transform->qScaleX > 0) { offsetX = sprDims->offsetX; width = sprDims->width; } else { @@ -493,7 +493,7 @@ NONMATCH("asm/non_matching/engine/sub_8004E14.inc", void sub_8004E14(Sprite *spr } // _0800515A - if (transform->height > 0) { + if (transform->qScaleY > 0) { offsetY = sprDims->offsetY; height = sprDims->height; } else {