mirror of
https://github.com/SAT-R/sa2.git
synced 2026-10-28 09:43:38 +00:00
Align speedup code with SA2
This commit is contained in:
1 parent
8e73a86efe
commit
d4a3a09914
2 files changed
+40
-28
No files matched your search
+16
-11
@@ -15,6 +15,9 @@
|
||||
#include "constants/songs.h"
|
||||
|
||||
#define INTRO_SPOTLIGHT_COUNT 2
|
||||
|
||||
#define EMERALD_START_X (DISPLAY_WIDTH / 2)
|
||||
#define EMERALD_START_Y -36
|
||||
typedef struct IntroSprite {
|
||||
Sprite s;
|
||||
u16 unk30;
|
||||
@@ -229,6 +232,7 @@ void CreateIntroAnimation(void)
|
||||
SA2_LABEL(gUnknown_03005390) = 0;
|
||||
PAUSE_GRAPHICS_QUEUE();
|
||||
sub_80535FC();
|
||||
|
||||
UiGfxStackInit();
|
||||
gDispCnt = (DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
|
||||
gBgCntRegs[0] = 0x9D86;
|
||||
@@ -252,14 +256,14 @@ void CreateIntroAnimation(void)
|
||||
s->graphics.dest = OBJ_VRAM0 + 0x20;
|
||||
s->graphics.anim = SA1_ANIM_INTRO_EMERALD;
|
||||
s->variant = 0;
|
||||
s->x = 0x78;
|
||||
s->y = 0xFFDC;
|
||||
s->oamFlags = 0xC0;
|
||||
s->x = EMERALD_START_X;
|
||||
s->y = EMERALD_START_Y;
|
||||
s->oamFlags = SPRITE_OAM_ORDER(3);
|
||||
s->graphics.size = 0;
|
||||
s->animCursor = 0;
|
||||
s->qAnimDelay = 0;
|
||||
s->prevVariant = -1;
|
||||
s->animSpeed = 0x10;
|
||||
s->animSpeed = SPRITE_ANIM_SPEED(1.0);
|
||||
s->palId = 0;
|
||||
s->hitboxes[0].index = -1;
|
||||
s->frameFlags = 0x1000;
|
||||
@@ -278,10 +282,10 @@ void CreateIntroAnimation(void)
|
||||
introSpr->qUnk40 = Q(2.25);
|
||||
chunkOffset = (i * (4 * TILE_SIZE_4BPP));
|
||||
s->graphics.dest = (chunkOffset + OBJ_VRAM0 + (31 * TILE_SIZE_4BPP));
|
||||
s->graphics.anim = 0x307;
|
||||
s->graphics.anim = SA1_ANIM_SUPER_SONIC_SPARKLE;
|
||||
s->variant = 0;
|
||||
s->x = (Div(SIN(i << 6), 650) + 120);
|
||||
s->y = -36;
|
||||
s->x = EMERALD_START_X + Div(SIN(i << 6), 650);
|
||||
s->y = EMERALD_START_Y;
|
||||
s->oamFlags = 0;
|
||||
s->graphics.size = 0;
|
||||
s->animCursor = 0;
|
||||
@@ -1655,7 +1659,7 @@ void sub_80656A4(void)
|
||||
Sprite *s = &introSpr->s;
|
||||
s16 temp_r0 = ++introSpr->unk30;
|
||||
|
||||
if ((introSpr->unk30) == 0x161) {
|
||||
if ((introSpr->unk30) == 353) {
|
||||
s->frameFlags = 0;
|
||||
}
|
||||
|
||||
@@ -1681,7 +1685,7 @@ void sub_806571C(void)
|
||||
Sprite *s = &introSpr->s;
|
||||
s16 temp_r0 = ++introSpr->unk30;
|
||||
|
||||
if ((introSpr->unk30) == 0x161) {
|
||||
if ((introSpr->unk30) == 353) {
|
||||
s->frameFlags = 0;
|
||||
}
|
||||
|
||||
@@ -1738,9 +1742,10 @@ void Task_IntroChaosEmeraldUpdate()
|
||||
Sprite *s = &introSpr->s;
|
||||
s16 unk30 = introSpr->unk30;
|
||||
|
||||
if ((u16)(unk30 - 90) > 0x8f) {
|
||||
if ((unk30 < 90) || (unk30 > 233)) {
|
||||
introSpr->qUnk3C += introSpr->qUnk40;
|
||||
}
|
||||
|
||||
if (unk30 < 90) {
|
||||
introSpr->qUnk40 -= Q(6. / 256.);
|
||||
if (introSpr->qUnk40 < Q(0)) {
|
||||
@@ -1748,7 +1753,7 @@ void Task_IntroChaosEmeraldUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
if (unk30 == 0xE9) {
|
||||
if (unk30 == 233) {
|
||||
introSpr->qUnk40 = Q(1.25);
|
||||
}
|
||||
|
||||
|
||||
+24
-17
@@ -1,44 +1,51 @@
|
||||
#ifdef _WIN32
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <xinput.h>
|
||||
#include "gba/io_reg.h"
|
||||
#include "gba/types.h"
|
||||
#include "platform/shared/input.h"
|
||||
|
||||
#define STICK_THRESHOLD 0.5f
|
||||
u16 GetXInputKeys()
|
||||
SharedKeys GetXInputKeys()
|
||||
{
|
||||
XINPUT_STATE state;
|
||||
ZeroMemory(&state, sizeof(XINPUT_STATE));
|
||||
|
||||
DWORD dwResult = XInputGetState(0, &state);
|
||||
u16 xinputKeys = 0;
|
||||
SharedKeys keys = 0;
|
||||
|
||||
if (dwResult == ERROR_SUCCESS) {
|
||||
/* A */ xinputKeys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_A) >> 12;
|
||||
/* B */ xinputKeys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_X) >> 13;
|
||||
/* Start */ xinputKeys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_START) >> 1;
|
||||
/* Select */ xinputKeys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_BACK) >> 3;
|
||||
/* L */ xinputKeys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER) << 1;
|
||||
/* R */ xinputKeys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER) >> 1;
|
||||
/* Up */ xinputKeys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP) << 6;
|
||||
/* Down */ xinputKeys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) << 6;
|
||||
/* Left */ xinputKeys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) << 3;
|
||||
/* Right */ xinputKeys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) << 1;
|
||||
/* A */ keys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_A) >> 12;
|
||||
/* B */ keys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_X) >> 13;
|
||||
/* Start */ keys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_START) >> 1;
|
||||
/* Select */ keys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_BACK) >> 3;
|
||||
/* L */ keys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER) << 1;
|
||||
/* R */ keys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER) >> 1;
|
||||
/* Up */ keys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP) << 6;
|
||||
/* Down */ keys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) << 6;
|
||||
/* Left */ keys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) << 3;
|
||||
/* Right */ keys |= (state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) << 1;
|
||||
|
||||
/* Control Stick */
|
||||
float xAxis = (float)state.Gamepad.sThumbLX / (float)SHRT_MAX;
|
||||
float yAxis = (float)state.Gamepad.sThumbLY / (float)SHRT_MAX;
|
||||
|
||||
if (xAxis < -STICK_THRESHOLD)
|
||||
xinputKeys |= DPAD_LEFT;
|
||||
keys |= DPAD_LEFT;
|
||||
else if (xAxis > STICK_THRESHOLD)
|
||||
xinputKeys |= DPAD_RIGHT;
|
||||
keys |= DPAD_RIGHT;
|
||||
if (yAxis < -STICK_THRESHOLD)
|
||||
xinputKeys |= DPAD_DOWN;
|
||||
keys |= DPAD_DOWN;
|
||||
else if (yAxis > STICK_THRESHOLD)
|
||||
xinputKeys |= DPAD_UP;
|
||||
keys |= DPAD_UP;
|
||||
|
||||
if (state.Gamepad.bRightTrigger > 170) {
|
||||
keys |= KEY_SPEEDUP;
|
||||
}
|
||||
}
|
||||
|
||||
return xinputKeys;
|
||||
return keys;
|
||||
}
|
||||
#endif // _WIN32
|
||||
Reference in new issue
Block a user