mirror of
https://github.com/SAT-R/sa2.git
synced 2026-10-28 09:43:38 +00:00
fix the rest of special stage, improvements to sdl rendering
This commit is contained in:
1 parent
804ced4e10
commit
fbe407a074
14 files changed
+118
-98
No files matched your search
@@ -10,7 +10,7 @@ include config.mk
|
||||
# bytes, so they don't need to be aligned. But this is a simple
|
||||
# work around which tells the compiler not to care. Once we are
|
||||
# compiling the songs to C, we can cast the pointers to integers
|
||||
# which means the linker will not
|
||||
# which means the linker will not notice
|
||||
export MACOSX_DEPLOYMENT_TARGET := 11
|
||||
|
||||
MAKEFLAGS += --no-print-directory
|
||||
@@ -223,7 +223,8 @@ CC1FLAGS ?= -Wimplicit -Wparentheses -Werror
|
||||
ifeq ($(PLATFORM),gba)
|
||||
CPPFLAGS += -D PLATFORM_GBA=1 -D PLATFORM_SDL=0 -D PLATFORM_WIN32=0 -D CPU_ARCH_X86=0 -D CPU_ARCH_ARM=1 -nostdinc -I tools/agbcc/include
|
||||
CC1FLAGS += -fhex-asm
|
||||
else
|
||||
else
|
||||
CC1FLAGS += -Wstrict-overflow=1
|
||||
ifeq ($(PLATFORM),sdl)
|
||||
CC1FLAGS += -Wno-parentheses-equality -Wno-unused-value
|
||||
CPPFLAGS += -D TITLE_BAR=$(BUILD_NAME).$(PLATFORM) -D PLATFORM_GBA=0 -D PLATFORM_SDL=1 -D PLATFORM_WIN32=0 $(shell sdl2-config --cflags)
|
||||
|
||||
@@ -27,7 +27,7 @@ It so far builds the following ROMs:
|
||||
|
||||
It can also build:
|
||||
* **sa2.sdl** `make sdl` (Linux/MacOS SDL 64bit port)
|
||||
* **sa2.sdl_win32.exe** `make sdl_win32` (Windows SDL 32bit port)
|
||||
* **sa2.sdl_win32.exe** `make sdl_win32` (Windows SDL 64bit port)
|
||||
* :construction: **sa2.win32.exe** `make win32` (Win32 native port, not functional)
|
||||
|
||||
## Current state
|
||||
|
||||
@@ -754,9 +754,9 @@
|
||||
#define SA2_ANIM_STAGE_INTRO_UNLOCKED_ICONS 1118
|
||||
|
||||
#define SA2_ANIM_ASCII 1119
|
||||
#define SA2_ANIM_ASCII_FIRST_CHAR '!' + 1
|
||||
#define SA2_ANIM_ASCII_FIRST_CHAR '!'
|
||||
#define SA2_ANIM_ASCII_YEN '\\'
|
||||
#define SA2_ANIM_ASCII_CHAR(c) ((c)-SA2_ANIM_ASCII_FIRST_CHAR)
|
||||
#define SA2_ANIM_ASCII_CHAR(c) ((c)-SA2_ANIM_ASCII_FIRST_CHAR + 1)
|
||||
#define SA2_ANIM_NUM_ASCII_CHARS 94
|
||||
|
||||
// Used in Time Attack and stage results screen (/ stage outro)
|
||||
|
||||
@@ -11,6 +11,6 @@ struct SpecialStagePhysics {
|
||||
}; /* size 8 */
|
||||
|
||||
struct Task *CreateSpecialStagePhysics(struct SpecialStage *);
|
||||
void sub_806F944(struct SpecialStage *stage);
|
||||
void HandleRoboPlayerCollision(struct SpecialStage *stage);
|
||||
|
||||
#endif
|
||||
@@ -45,8 +45,8 @@ struct SpecialStagePlayer {
|
||||
|
||||
s32 speed;
|
||||
u32 rotateSpeed;
|
||||
u32 unkD0;
|
||||
u32 unkD4;
|
||||
u32 q16SpeedX;
|
||||
u32 q16SpeedY;
|
||||
u32 acceleration;
|
||||
|
||||
s32 coastResistence;
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@
|
||||
#endif
|
||||
|
||||
#include "data/sprite_tables.h"
|
||||
void CreateSpecialStage(s16 selectedCharacter, s16 level);
|
||||
|
||||
void GameInit(void)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
@@ -26,7 +26,7 @@ struct UNK_806DEA4 {
|
||||
|
||||
static void AnimateRingsLost(struct SpecialStage *stage, s16);
|
||||
void sub_806DB48(void);
|
||||
void sub_806DC98(void);
|
||||
void HandleCollectableCollision(void);
|
||||
bool16 sub_806DE10(void);
|
||||
void sub_806E4FC(struct SpecialStage *stage);
|
||||
void sub_806E584(s16, struct SpecialStageCollectables_UNK874 *);
|
||||
@@ -140,7 +140,7 @@ void sub_806DB48(void)
|
||||
UpdateSpriteAnimation(&collectables->unk94);
|
||||
UpdateSpriteAnimation(&collectables->unkC4);
|
||||
|
||||
sub_806DC98();
|
||||
HandleCollectableCollision();
|
||||
|
||||
if (sub_806DE10() == FALSE && stage->state != 7) {
|
||||
stage->state = 6;
|
||||
@@ -165,7 +165,7 @@ void sub_806DB48(void)
|
||||
sub_806DEA4();
|
||||
}
|
||||
|
||||
void sub_806DC98(void)
|
||||
void HandleCollectableCollision(void)
|
||||
{
|
||||
struct SpecialStageCollectables *collectables = TASK_DATA(gCurTask);
|
||||
struct SpecialStage *stage = collectables->stage;
|
||||
|
||||
@@ -203,7 +203,7 @@ void sub_807120C(struct SpecialStageGuardRobo *guardRobo)
|
||||
if ((state > 3 && state < 6) || state == 9) {
|
||||
guardRobo->animFrame = guardRobo->unk54;
|
||||
guardRobo->state = 2;
|
||||
sub_806F944(stage);
|
||||
HandleRoboPlayerCollision(stage);
|
||||
player->state = 10;
|
||||
m4aSongNumStart(SE_275);
|
||||
} else if (stage->rings == 0 && player->unkB6 == 0) {
|
||||
|
||||
@@ -105,8 +105,7 @@ void CreateSpecialStage(s16 selectedCharacter, s16 level)
|
||||
stage->ringsTargetTens = Div(stage->ringsTarget, 10) - (stage->ringsTargetHundreds * 10);
|
||||
stage->ringsTargetUnits = Mod(stage->ringsTarget, 10);
|
||||
|
||||
stage->targetReached = 0;
|
||||
stage->targetReached = 0;
|
||||
stage->targetReached = FALSE;
|
||||
stage->pauseMenuCursor = 0;
|
||||
stage->unk5C7 = 0;
|
||||
stage->unk5C8 = 0;
|
||||
|
||||
@@ -98,10 +98,14 @@ static void Task_PhysicsMain(void)
|
||||
|
||||
sub_80047A0(arrowAngle, 256, 256, 30);
|
||||
|
||||
if (stage->paused == FALSE) {
|
||||
if (stage->paused == FALSE)
|
||||
UpdateSpriteAnimation(&player->roboArrow);
|
||||
}
|
||||
DisplaySprite(&player->roboArrow);
|
||||
|
||||
#if PORTABLE
|
||||
// Added so the arrow doesn't appear above the pause menu
|
||||
if (stage->paused == FALSE)
|
||||
#endif
|
||||
DisplaySprite(&player->roboArrow);
|
||||
}
|
||||
|
||||
sub_806FAA0();
|
||||
@@ -287,12 +291,12 @@ void sub_806F154(void)
|
||||
HandleRotationControls();
|
||||
HandleBoost2();
|
||||
|
||||
player->q16WorldX += player->unkD0;
|
||||
player->q16WorldY += player->unkD4;
|
||||
player->q16WorldX += player->q16SpeedX;
|
||||
player->q16WorldY += player->q16SpeedY;
|
||||
player->unkB8 += player->unkF4;
|
||||
|
||||
if (player->unkB0 < 1) {
|
||||
player->speed = 0x2000;
|
||||
player->speed = Q(32);
|
||||
player->unkB0 = 0;
|
||||
player->state = 1;
|
||||
}
|
||||
@@ -523,17 +527,17 @@ static s16 CalcGuardRoboPointerAngle(struct SpecialStage *stage)
|
||||
u32 temp1;
|
||||
u32 temp2;
|
||||
u16 temp3;
|
||||
s32 f_dX;
|
||||
s32 f_dY;
|
||||
s32 qDx;
|
||||
s32 qDy;
|
||||
s16 dX;
|
||||
s16 dY;
|
||||
|
||||
u16 angle = -player->bearing & ONE_CYCLE;
|
||||
|
||||
f_dX = guardRobo->x - player->q16WorldX;
|
||||
f_dY = guardRobo->y - player->q16WorldY;
|
||||
dX = f_dX >> 0x10;
|
||||
dY = f_dY >> 0x10;
|
||||
qDx = guardRobo->x - player->q16WorldX;
|
||||
qDy = guardRobo->y - player->q16WorldY;
|
||||
dX = qDx >> 0x10;
|
||||
dY = qDy >> 0x10;
|
||||
|
||||
if (dX > -16 && dX < 16 && dY > -16 && dY < 16) {
|
||||
temp1 = 12;
|
||||
@@ -559,33 +563,33 @@ static s16 CalcGuardRoboPointerAngle(struct SpecialStage *stage)
|
||||
player->roboArrow.graphics.anim = gUnknown_080DF794[temp2].anim;
|
||||
|
||||
temp3 = temp1;
|
||||
f_dX >>= temp3;
|
||||
f_dY >>= temp3;
|
||||
qDx >>= temp3;
|
||||
qDy >>= temp3;
|
||||
|
||||
sin = SIN(angle);
|
||||
cos = COS(angle);
|
||||
|
||||
{
|
||||
s32 sin5 = sin * f_dY;
|
||||
s32 sin6 = cos * f_dX;
|
||||
s32 sin3 = -sin * f_dX;
|
||||
s32 sin4 = cos * f_dY;
|
||||
s32 sin5 = sin * qDy;
|
||||
s32 sin6 = cos * qDx;
|
||||
s32 sin3 = -sin * qDx;
|
||||
s32 sin4 = cos * qDy;
|
||||
|
||||
f_dX = sin5 + sin6;
|
||||
f_dY = sin3 + sin4;
|
||||
qDx = sin5 + sin6;
|
||||
qDy = sin3 + sin4;
|
||||
}
|
||||
|
||||
for (i = 256; i > 0; i >>= 1) {
|
||||
sin = SIN(angle) >> 6;
|
||||
cos = COS(angle) >> 6;
|
||||
|
||||
if ((sin * f_dY + cos * f_dX) > 0) {
|
||||
if ((sin * qDy + cos * qDx) > 0) {
|
||||
angle = (angle + i) & ONE_CYCLE;
|
||||
} else {
|
||||
if ((sin * f_dY + cos * f_dX) >= 0) {
|
||||
s32 a = -sin * f_dX;
|
||||
s32 b = cos * f_dY;
|
||||
b = a + cos * f_dY;
|
||||
if ((sin * qDy + cos * qDx) >= 0) {
|
||||
s32 a = -sin * qDx;
|
||||
s32 b = cos * qDy;
|
||||
b = a + cos * qDy;
|
||||
if (b >= 0) {
|
||||
return (angle + 512) & ONE_CYCLE;
|
||||
}
|
||||
@@ -598,7 +602,7 @@ static s16 CalcGuardRoboPointerAngle(struct SpecialStage *stage)
|
||||
return angle;
|
||||
}
|
||||
|
||||
s16 sub_806F84C(s32 dX, s32 dY)
|
||||
s16 CalcRoboCollision(s32 dX, s32 dY)
|
||||
{
|
||||
u32 r2, r3;
|
||||
u16 r1, r3_2;
|
||||
@@ -617,7 +621,7 @@ s16 sub_806F84C(s32 dX, s32 dY)
|
||||
}
|
||||
|
||||
while (r4 > 0) {
|
||||
r4 *= 2;
|
||||
r4 <<= 1;
|
||||
i++;
|
||||
};
|
||||
|
||||
@@ -665,7 +669,7 @@ struct Task *CreateSpecialStagePhysics(struct SpecialStage *stage)
|
||||
return t;
|
||||
}
|
||||
|
||||
void sub_806F944(struct SpecialStage *stage)
|
||||
void HandleRoboPlayerCollision(struct SpecialStage *stage)
|
||||
{
|
||||
struct SpecialStagePlayer *player = TASK_DATA(stage->playerTask);
|
||||
struct SpecialStageGuardRobo *guardRobo = TASK_DATA(stage->guardRoboTask);
|
||||
@@ -675,9 +679,9 @@ void sub_806F944(struct SpecialStage *stage)
|
||||
s32 guardRoboX = guardRobo->x;
|
||||
s32 guardRoboY = guardRobo->y;
|
||||
|
||||
s16 result = sub_806F84C((playerX - guardRoboX) >> 4, (playerY - guardRoboY) >> 4);
|
||||
player->unkD0 = ((playerX - guardRoboX) * 32) / result;
|
||||
player->unkD4 = ((playerY - guardRoboY) * 32) / result;
|
||||
s16 result = CalcRoboCollision((playerX - guardRoboX) >> 4, (playerY - guardRoboY) >> 4);
|
||||
player->q16SpeedX = ((playerX - guardRoboX) * 32) / result;
|
||||
player->q16SpeedY = ((playerY - guardRoboY) * 32) / result;
|
||||
|
||||
player->unkB8 = 768;
|
||||
}
|
||||
|
||||
@@ -136,8 +136,8 @@ struct Task *CreateSpecialStagePlayer(struct SpecialStage *stage)
|
||||
if (stage->unk5B7 == FALSE) {
|
||||
player->speed = 0;
|
||||
player->rotateSpeed = 6;
|
||||
player->unkD0 = 0x10000;
|
||||
player->unkD4 = 0x10000;
|
||||
player->q16SpeedX = 0x10000;
|
||||
player->q16SpeedY = 0x10000;
|
||||
player->acceleration = 40;
|
||||
player->coastResistence = -43;
|
||||
player->deceleration = -350;
|
||||
@@ -158,8 +158,8 @@ struct Task *CreateSpecialStagePlayer(struct SpecialStage *stage)
|
||||
} else {
|
||||
player->speed = 0;
|
||||
player->rotateSpeed = 0;
|
||||
player->unkD0 = 0xC00;
|
||||
player->unkD4 = 0x7FFF;
|
||||
player->q16SpeedX = 0xC00;
|
||||
player->q16SpeedY = 0x7FFF;
|
||||
player->acceleration = 256;
|
||||
player->coastResistence = 0x800;
|
||||
}
|
||||
|
||||
+39
-35
@@ -11,9 +11,9 @@
|
||||
#include "constants/songs.h"
|
||||
#include "constants/text.h"
|
||||
|
||||
void sub_8070C58(void);
|
||||
void sub_806FFC8(void);
|
||||
void sub_8070D14(void);
|
||||
void RenderTime(void);
|
||||
void RenderRingCounters(void);
|
||||
void RenderMultiplier(void);
|
||||
void CreateStartText(struct SpecialStageUI *);
|
||||
void RenderStartText(struct SpecialStageUI *);
|
||||
void sub_8070DE0(struct SpecialStageUI *);
|
||||
@@ -30,7 +30,7 @@ void sub_80707A8(s16);
|
||||
static void RenderScoresAnim(void);
|
||||
void Task_ResultsScreenSequencePart2(void);
|
||||
void Task_ResultsScreenNewEmeraldSequencePart2(void);
|
||||
void sub_8070078(void);
|
||||
void UpdateRingCounters(void);
|
||||
void sub_8070BEC(struct Task *);
|
||||
static void CreateDisplays(struct SpecialStageUI *);
|
||||
void SpecialStageResultsScreenOnDestroy(struct Task *);
|
||||
@@ -82,9 +82,9 @@ void sub_806FB04(void)
|
||||
struct SpecialStageUI *ui = TASK_DATA(gCurTask);
|
||||
struct SpecialStage *stage = ui->stage;
|
||||
|
||||
sub_8070C58();
|
||||
sub_806FFC8();
|
||||
sub_8070D14();
|
||||
RenderTime();
|
||||
RenderRingCounters();
|
||||
RenderMultiplier();
|
||||
|
||||
if (ui->unk2A8 == 0) {
|
||||
if (stage->state == 4) {
|
||||
@@ -142,7 +142,7 @@ static void CreateStageTime(struct SpecialStageUI *ui)
|
||||
sub_806CA88(&unused, RENDER_TARGET_SCREEN, 0, 0x379, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
void sub_806FCF8(void)
|
||||
static void UpdateStageTime(void)
|
||||
{
|
||||
struct SpecialStageUI *ui = TASK_DATA(gCurTask);
|
||||
struct SpecialStage *stage = ui->stage;
|
||||
@@ -237,13 +237,13 @@ static void CreateRingCounter(struct SpecialStageUI *ui)
|
||||
sprite->variant, 0);
|
||||
}
|
||||
|
||||
void sub_806FFC8(void)
|
||||
void RenderRingCounters(void)
|
||||
{
|
||||
struct SpecialStageUI *ui = TASK_DATA(gCurTask);
|
||||
struct SpecialStage *stage = ui->stage;
|
||||
|
||||
if (stage->paused == FALSE) {
|
||||
sub_8070078();
|
||||
UpdateRingCounters();
|
||||
}
|
||||
|
||||
if (stage->ringsHundreds != 0) {
|
||||
@@ -268,7 +268,7 @@ void sub_806FFC8(void)
|
||||
DisplaySprite(&ui->ringsTargetUnitsDigit);
|
||||
}
|
||||
|
||||
void sub_8070078(void)
|
||||
void UpdateRingCounters(void)
|
||||
{
|
||||
struct SpecialStageUI *ui = TASK_DATA(gCurTask);
|
||||
struct SpecialStage *stage = ui->stage;
|
||||
@@ -348,8 +348,8 @@ static void SpecialStageResultsScreenCreateUI(struct SpecialStageResultsScreen *
|
||||
{
|
||||
const struct UNK_80DF670 *sprite;
|
||||
struct SpecialStage *stage = resultsScreen->stage;
|
||||
s16 a = 48, b = 48, c = 48;
|
||||
s16 d = 158, e = 158, f = 158;
|
||||
s16 a = (DISPLAY_WIDTH / 2) - 72, b = (DISPLAY_WIDTH / 2) - 72, c = (DISPLAY_WIDTH / 2) - 72;
|
||||
s16 d = (DISPLAY_WIDTH / 2) + 38, e = (DISPLAY_WIDTH / 2) + 38, f = (DISPLAY_WIDTH / 2) + 38;
|
||||
s16 i;
|
||||
|
||||
u8 chaosEmeralds = gLoadedSaveGame->chaosEmeralds[stage->character];
|
||||
@@ -359,16 +359,19 @@ static void SpecialStageResultsScreenCreateUI(struct SpecialStageResultsScreen *
|
||||
gUnknown_03005B58 = NULL;
|
||||
|
||||
if (stage->targetReached) {
|
||||
sub_806CA88(&resultsScreen->unk4, 1, 0x28, SA2_ANIM_SP_STAGE_NOTIFS, 0, DISPLAY_WIDTH + 16 + a, 32, 0, 1, 0);
|
||||
sub_806CA88(&resultsScreen->unk4, 1, 0x28, SA2_ANIM_SP_STAGE_NOTIFS, 0, DISPLAY_WIDTH + 16 + a, (DISPLAY_HEIGHT / 2) - 48, 0, 1, 0);
|
||||
sub_806CA88(&resultsScreen->unk34, 1, gUnknown_080DF880[character].size, gUnknown_080DF880[character].anim, 0,
|
||||
DISPLAY_WIDTH + 16 + a, 24, 0, gUnknown_080DF880[character].variant, 0);
|
||||
DISPLAY_WIDTH + 16 + a, (DISPLAY_HEIGHT / 2) - 56, 0, gUnknown_080DF880[character].variant, 0);
|
||||
} else {
|
||||
sub_806CA88(&resultsScreen->unk4, 1, 0x20, SA2_ANIM_SP_STAGE_NOTIFS, 0, DISPLAY_WIDTH + 16 + a, 32, 0, 0, 0);
|
||||
sub_806CA88(&resultsScreen->unk4, 1, 0x20, SA2_ANIM_SP_STAGE_NOTIFS, 0, DISPLAY_WIDTH + 16 + a, (DISPLAY_HEIGHT / 2) - 48, 0, 0, 0);
|
||||
}
|
||||
|
||||
sub_806CA88(&resultsScreen->unk1B4, 1, 0x16, SA2_ANIM_SP_STAGE_SCORE_BONUSES, 0, DISPLAY_WIDTH + 16 + a, 72, 0, 0, 0);
|
||||
sub_806CA88(&resultsScreen->unk1E4, 1, 0x16, SA2_ANIM_SP_STAGE_SCORE_BONUSES, 0, DISPLAY_WIDTH + 16 + b, 92, 0, 1, 0);
|
||||
sub_806CA88(&resultsScreen->unk214, 1, 0x16, SA2_ANIM_SP_STAGE_SCORE_BONUSES, 0, DISPLAY_WIDTH + 16 + c, 112, 0, 2, 0);
|
||||
sub_806CA88(&resultsScreen->unk1B4, 1, 0x16, SA2_ANIM_SP_STAGE_SCORE_BONUSES, 0, DISPLAY_WIDTH + 16 + a, (DISPLAY_HEIGHT / 2) - 8, 0, 0,
|
||||
0);
|
||||
sub_806CA88(&resultsScreen->unk1E4, 1, 0x16, SA2_ANIM_SP_STAGE_SCORE_BONUSES, 0, DISPLAY_WIDTH + 16 + b, (DISPLAY_HEIGHT / 2) + 12, 0,
|
||||
1, 0);
|
||||
sub_806CA88(&resultsScreen->unk214, 1, 0x16, SA2_ANIM_SP_STAGE_SCORE_BONUSES, 0, DISPLAY_WIDTH + 16 + c, (DISPLAY_HEIGHT / 2) + 32, 0,
|
||||
2, 0);
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
sub_806CA88(&resultsScreen->unk244[i], 1, sValueSprites[0].size, sValueSprites[0].anim, 0, d + SomeMacro807028C(i),
|
||||
@@ -392,7 +395,8 @@ static void SpecialStageResultsScreenCreateUI(struct SpecialStageResultsScreen *
|
||||
sprite = &sChaosEmeraldUnlockedSprites[7];
|
||||
}
|
||||
|
||||
sub_806CA88(&resultsScreen->chaosEmerald[i], 1, 9, sprite->anim, 0, i * 24 + DISPLAY_WIDTH + 52, 52, 0, sprite->variant, 0);
|
||||
sub_806CA88(&resultsScreen->chaosEmerald[i], 1, 9, sprite->anim, 0, i * 24 + DISPLAY_WIDTH + 52, (DISPLAY_HEIGHT / 2) - 28, 0,
|
||||
sprite->variant, 0);
|
||||
}
|
||||
|
||||
resultsScreen->animFrame = 0;
|
||||
@@ -447,11 +451,11 @@ void sub_807061C(s16 a)
|
||||
s = &resultsScreen->unk4;
|
||||
|
||||
if (stage->targetReached) {
|
||||
s->x = resultsScreen->unk516 + 76;
|
||||
s->x = resultsScreen->unk516 + (DISPLAY_WIDTH / 2) - 44;
|
||||
s = &resultsScreen->unk34;
|
||||
s->x = resultsScreen->unk516 + 4;
|
||||
s->x = resultsScreen->unk516 + (DISPLAY_WIDTH / 2) - 116;
|
||||
} else {
|
||||
s->x = resultsScreen->unk516 + 48;
|
||||
s->x = resultsScreen->unk516 + (DISPLAY_WIDTH / 2) - 72;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,7 +470,7 @@ void sub_8070680(s16 a)
|
||||
for (i = 0; i < 7; i++) {
|
||||
Sprite *s = &resultsScreen->chaosEmerald[i];
|
||||
s32 x = (i * 24);
|
||||
s32 base = resultsScreen->unk518 + 36;
|
||||
s32 base = resultsScreen->unk518 + (DISPLAY_WIDTH / 2) - 84;
|
||||
x += base;
|
||||
s->x = x;
|
||||
}
|
||||
@@ -482,14 +486,14 @@ void sub_80706D8(s16 a)
|
||||
|
||||
resultsScreen->unk51A = (11 - a) * 22;
|
||||
s = &resultsScreen->unk1B4;
|
||||
s->x = resultsScreen->unk51A + 48;
|
||||
s->x = resultsScreen->unk51A + (DISPLAY_WIDTH / 2) - 72;
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
s32 temp2, temp;
|
||||
|
||||
s = &resultsScreen->unk244[i];
|
||||
temp2 = (i * 8);
|
||||
temp = resultsScreen->unk51A + 158;
|
||||
temp = resultsScreen->unk51A + (DISPLAY_WIDTH / 2) + 38;
|
||||
s->x = temp2 + temp;
|
||||
}
|
||||
}
|
||||
@@ -502,14 +506,14 @@ void sub_8070740(s16 a)
|
||||
struct SpecialStageResultsScreen *resultsScreen = TASK_DATA(gCurTask);
|
||||
struct SpecialStage *stage = resultsScreen->stage;
|
||||
|
||||
resultsScreen->unk51C = (0xB - a) * 0x16;
|
||||
resultsScreen->unk51C = (11 - a) * 22;
|
||||
s = &resultsScreen->unk1E4;
|
||||
s->x = resultsScreen->unk51C + 0x30;
|
||||
s->x = resultsScreen->unk51C + (DISPLAY_WIDTH / 2) - 72;
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
s = &resultsScreen->unk334[i];
|
||||
temp2 = (i * 8);
|
||||
temp = resultsScreen->unk51C + 0x9E;
|
||||
temp = resultsScreen->unk51C + (DISPLAY_WIDTH / 2) + 38;
|
||||
s->x = temp2 + temp;
|
||||
}
|
||||
}
|
||||
@@ -522,14 +526,14 @@ void sub_80707A8(s16 xPos)
|
||||
struct SpecialStageResultsScreen *resultsScreen = TASK_DATA(gCurTask);
|
||||
struct SpecialStage *stage = resultsScreen->stage;
|
||||
|
||||
resultsScreen->unk51E = (0xB - xPos) * 0x16;
|
||||
resultsScreen->unk51E = (11 - xPos) * 22;
|
||||
s = &resultsScreen->unk214;
|
||||
s->x = resultsScreen->unk51E + 0x30;
|
||||
s->x = resultsScreen->unk51E + (DISPLAY_WIDTH / 2) - 72;
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
s = &resultsScreen->unk424[i];
|
||||
temp2 = (i * 8);
|
||||
temp = resultsScreen->unk51E + 0x9E;
|
||||
temp = resultsScreen->unk51E + (DISPLAY_WIDTH / 2) + 38;
|
||||
s->x = temp2 + temp;
|
||||
}
|
||||
}
|
||||
@@ -693,13 +697,13 @@ static void CreateDisplays(struct SpecialStageUI *ui)
|
||||
CreateMultiplierValue(ui);
|
||||
}
|
||||
|
||||
void sub_8070C58(void)
|
||||
void RenderTime(void)
|
||||
{
|
||||
struct SpecialStageUI *ui = TASK_DATA(gCurTask);
|
||||
struct SpecialStage *stage = ui->stage;
|
||||
|
||||
if (stage->paused == FALSE) {
|
||||
sub_806FCF8();
|
||||
UpdateStageTime();
|
||||
}
|
||||
|
||||
DisplaySprite(&ui->timeSymbol);
|
||||
@@ -722,7 +726,7 @@ static void CreateMultiplierValue(struct SpecialStageUI *ui)
|
||||
unkF840->variant, 0);
|
||||
}
|
||||
|
||||
void sub_8070D14(void)
|
||||
void RenderMultiplier(void)
|
||||
{
|
||||
struct SpecialStageUI *ui = TASK_DATA(gCurTask);
|
||||
struct SpecialStage *stage = ui->stage;
|
||||
|
||||
@@ -11,7 +11,7 @@ void *gUnknown_03005B58 = NULL;
|
||||
void *gUnknown_03005B5C = NULL;
|
||||
|
||||
// Copied from `options.c` so contains some of that submenu logic
|
||||
void sub_806CA88(Sprite *obj, s8 target, u32 size, u16 anim, u32 frameFlags, s16 xPos, s16 yPos, u16 oamOrder, u8 variant, u8 palId)
|
||||
void sub_806CA88(Sprite *obj, s8 target, u32 size, AnimId anim, u32 frameFlags, s16 xPos, s16 yPos, u16 oamOrder, u8 variant, u8 palId)
|
||||
{
|
||||
Sprite newObj;
|
||||
Sprite *s;
|
||||
|
||||
@@ -128,7 +128,7 @@ int main(int argc, char **argv)
|
||||
|
||||
ReadSaveFile("sa2.sav");
|
||||
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) {
|
||||
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK) < 0) {
|
||||
fprintf(stderr, "SDL could not initialize! SDL_Error: %s\n", SDL_GetError());
|
||||
return 1;
|
||||
}
|
||||
@@ -232,6 +232,8 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool newFrameRequested = FALSE;
|
||||
|
||||
// Every GBA frame we process the SDL events and render the number of times
|
||||
// SDL requires us to for vsync. When we need another frame we break out of
|
||||
// the loop via a return
|
||||
@@ -244,19 +246,27 @@ void VBlankIntrWait(void)
|
||||
|
||||
if (!paused || stepOneFrame) {
|
||||
double dt = fixedTimestep / timeScale; // TODO: Fix speedup
|
||||
double deltaTime = 0;
|
||||
|
||||
curGameTime = SDL_GetPerformanceCounter();
|
||||
if (stepOneFrame) {
|
||||
deltaTime = dt;
|
||||
// Hack to emulate the behaviour of threaded sdl
|
||||
// it will not add any new values to the accumulator
|
||||
// when a new frame was requested within a frame cycle
|
||||
if (!newFrameRequested) {
|
||||
double deltaTime = 0;
|
||||
|
||||
curGameTime = SDL_GetPerformanceCounter();
|
||||
if (stepOneFrame) {
|
||||
deltaTime = dt;
|
||||
} else {
|
||||
deltaTime = (double)((curGameTime - lastGameTime) / (double)SDL_GetPerformanceFrequency());
|
||||
if (deltaTime > (dt * 5))
|
||||
deltaTime = dt * 5;
|
||||
}
|
||||
lastGameTime = curGameTime;
|
||||
|
||||
accumulator += deltaTime;
|
||||
} else {
|
||||
deltaTime = (double)((curGameTime - lastGameTime) / (double)SDL_GetPerformanceFrequency());
|
||||
if (deltaTime > (dt * 5))
|
||||
deltaTime = dt * 5;
|
||||
newFrameRequested = FALSE;
|
||||
}
|
||||
lastGameTime = curGameTime;
|
||||
|
||||
accumulator += deltaTime;
|
||||
|
||||
while (accumulator >= dt) {
|
||||
REG_KEYINPUT = KEYS_MASK ^ Platform_GetKeyInput();
|
||||
@@ -276,7 +286,7 @@ void VBlankIntrWait(void)
|
||||
|
||||
accumulator -= dt;
|
||||
} else {
|
||||
// Get another frame
|
||||
newFrameRequested = TRUE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -298,6 +308,7 @@ void VBlankIntrWait(void)
|
||||
SDL_SetWindowSize(sdlWindow, DISPLAY_WIDTH * videoScale, DISPLAY_HEIGHT * videoScale);
|
||||
videoScaleChanged = false;
|
||||
}
|
||||
|
||||
SDL_RenderPresent(sdlRenderer);
|
||||
#if ENABLE_VRAM_VIEW
|
||||
SDL_RenderPresent(vramRenderer);
|
||||
@@ -1120,6 +1131,7 @@ static void RenderRotScaleBGScanline(int bgNum, uint16_t control, uint16_t x, ui
|
||||
|
||||
s32 currentX = getBgX(bgNum);
|
||||
s32 currentY = getBgY(bgNum);
|
||||
|
||||
// sign extend 28 bit number
|
||||
currentX = ((currentX & (1 << 27)) ? currentX | 0xF0000000 : currentX);
|
||||
currentY = ((currentY & (1 << 27)) ? currentY | 0xF0000000 : currentY);
|
||||
|
||||
Reference in new issue
Block a user