Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 097080e

Browse files
authored
Rename ZONE_TIME_TO_INT() -> TIME() (#14)
* Rename ZONE_TIME_TO_INT() -> TIME()
1 parent c3b39a4 commit 097080e

25 files changed

Lines changed: 73 additions & 73 deletions

include/constants/zones.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@
8989
#define IS_EXTRA_STAGE(lvl) ((lvl) == LEVEL_INDEX(ZONE_FINAL, ACT_THE_MOON))
9090
#define IS_FINAL_OR_EXTRA_STAGE(lvl) ((IS_FINAL_STAGE(lvl)) || (IS_EXTRA_STAGE(lvl)))
9191

92-
#define ZONE_TIME_TO_INT(minutes, seconds) (int)(((minutes * 60.) + seconds) * GBA_FRAMES_PER_SECOND)
93-
#define TIMER_WARNING_BEGIN (ZONE_TIME_TO_INT(0, 20))
94-
#define MAX_COURSE_TIME (ZONE_TIME_TO_INT(10, 0))
92+
#define TIME(minutes, seconds) (int)(((minutes * 60.) + seconds) * GBA_FRAMES_PER_SECOND)
93+
#define TIMER_WARNING_BEGIN (TIME(0, 20))
94+
#define MAX_COURSE_TIME (TIME(10, 0))
9595

9696
#define SPECIAL_STAGE_REQUIRED_SP_RING_COUNT 7
9797

include/game/parameters/characters.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
#define PLAYER_MAX_FLOATING_SPEED (2.25)
2929

3030
// NOTE: Equal in SA1 and SA2!
31-
#define PLAYER_INVULNERABLE_DURATION ZONE_TIME_TO_INT(0, 2)
32-
#define PLAYER_INVINCIBLE_DURATION ZONE_TIME_TO_INT(0, 20)
33-
#define PLAYER_SPEED_UP_DURATION ZONE_TIME_TO_INT(0, 20)
31+
#define PLAYER_INVULNERABLE_DURATION TIME(0, 2)
32+
#define PLAYER_INVINCIBLE_DURATION TIME(0, 20)
33+
#define PLAYER_SPEED_UP_DURATION TIME(0, 20)
3434
#define PLAYER_SPEED_UP_MUSIC_TEMPO Q(2.0)
3535

3636
#define PLAYER_AIR_SPEED_MAX 15.0
@@ -39,13 +39,13 @@
3939
#define TRICK__STOP_N_SLAM__DROP_SPEED Q(0.21875)
4040

4141
/*** Cream ***/
42-
#define CREAM_FLYING_DURATION ZONE_TIME_TO_INT(0, 4)
42+
#define CREAM_FLYING_DURATION TIME(0, 4)
4343

4444
/*** Tails ***/
4545
// NOTE: Unlike Cream, Tails does fly for 8 seconds, but his initial value gets set to 4.
4646
// For some reason they lower his timer only every 2nd frame (in PlayerCB_8012C2C),
4747
// instead of using a bigger value from the get-go, even though they gave him a
4848
// 4-byte timer.
49-
#define TAILS_FLYING_DURATION (ZONE_TIME_TO_INT(0, 8) / 2)
49+
#define TAILS_FLYING_DURATION (TIME(0, 8) / 2)
5050

5151
#endif // GUARD_PARAMETERS_CHARACTERS_H

src/game/egg_rocket_transitions.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ NONMATCH("asm/non_matching/game/egg_rocket_trans__Task_80294A8.inc", void Task_8
357357

358358
if (gGameMode == GAME_MODE_SINGLE_PLAYER) {
359359
gStageFlags |= FLAGS_EXECUTE_HBLANK_COPY;
360-
gCourseTime = ZONE_TIME_TO_INT(5, 0);
360+
gCourseTime = TIME(5, 0);
361361
}
362362
}
363363

@@ -368,7 +368,7 @@ NONMATCH("asm/non_matching/game/egg_rocket_trans__Task_80294A8.inc", void Task_8
368368

369369
if (gGameMode == GAME_MODE_SINGLE_PLAYER) {
370370
gStageFlags |= FLAGS_EXECUTE_HBLANK_COPY;
371-
gCourseTime = ZONE_TIME_TO_INT(5, 0);
371+
gCourseTime = TIME(5, 0);
372372
}
373373
}
374374

@@ -399,7 +399,7 @@ void Task_80297E8(void)
399399
if (--shake->unkC == 0) {
400400
if (gGameMode == GAME_MODE_SINGLE_PLAYER) {
401401
gStageFlags |= STAGE_FLAG__TIMER_REVERSED;
402-
gCourseTime = ZONE_TIME_TO_INT(5, 0);
402+
gCourseTime = TIME(5, 0);
403403
}
404404

405405
gPlayer.moveState &= ~MOVESTATE_IGNORE_INPUT;
@@ -415,7 +415,7 @@ void CreateEggRocketLaunchScreenShakeEffect()
415415
struct Task *t = TaskCreate(Task_80298C0, sizeof(EggRocketScreenShake), 0x4000, 0, NULL);
416416
EggRocketScreenShake *shake = TASK_DATA(t);
417417

418-
shake->unkC = ZONE_TIME_TO_INT(0, 1);
418+
shake->unkC = TIME(0, 1);
419419

420420
CreateScreenShake(0x800, 8, 16, 10, SCREENSHAKE_VERTICAL);
421421

@@ -429,7 +429,7 @@ void Task_80298C0()
429429
EggRocketScreenShake *shake = TASK_DATA(gCurTask);
430430

431431
if (--shake->unkC == 0) {
432-
shake->unkC = ZONE_TIME_TO_INT(0, 5);
432+
shake->unkC = TIME(0, 5);
433433
CreateScreenShake(0x800, 8, 16, 300, (SCREENSHAKE_VERTICAL | SCREENSHAKE_RANDOM_VALUE));
434434
gCurTask->main = Task_80297E8;
435435
}

src/game/enemies/boss_3_egg_ball.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ void CreateEntity_EggBall(MapEntity *me, u16 regionX, u16 regionY, u8 id)
287287
t = TaskCreate(Task_PipeInitialDelay, sizeof(EggBall_Pipe), 0x2200U, 0U, TaskDestructor_8030754);
288288
strc = TASK_DATA(t);
289289
strc->unk44 = i;
290-
strc->delay = ZONE_TIME_TO_INT(0, 1.5);
290+
strc->delay = TIME(0, 1.5);
291291
strc->unk3C = unk3C = gUnknown_084ACDD2[i][0][0];
292292
strc->unk3E = unk3E = gUnknown_084ACDD2[i][0][1];
293293
strc->base.regionX = boss->base.regionX;

src/game/enemies/bosses_egg_mobile.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void Task_EggMobileAscent()
102102
UpdateSpriteAnimation(s2);
103103
DisplaySprite(s2);
104104

105-
if (eggMobile->stunDelay > ZONE_TIME_TO_INT(0, 0.75)) {
105+
if (eggMobile->stunDelay > TIME(0, 0.75)) {
106106
eggMobile->offsetY -= Q(1);
107107

108108
if (eggMobile->offsetY <= -Q(80)) {

src/game/enemies/bosses_misc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void Task_801623C()
234234

235235
if ((Coll_Player_Entity_Intersection(s, capsule->worldX, capsule->worldY, p) & 0x80000)
236236
|| (Coll_Player_Entity_Intersection(s2, capsule->worldX, capsule->worldY, p) & 0x80000)) {
237-
p->timerInvulnerability = ZONE_TIME_TO_INT(0, 2);
237+
p->timerInvulnerability = TIME(0, 2);
238238
if (I(p->qWorldX) < gCamera.x + (DISPLAY_WIDTH / 2)) {
239239
p->qSpeedAirX = -Q(2);
240240
sideX = (capsule->worldX + s->hitboxes[0].b.left) - p->spriteOffsetX;

src/game/enemies/fireball.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "constants/zones.h"
1010

1111
#define NUM_SPARKS 2
12-
#define FIREBALL_SPAWN_RATE ZONE_TIME_TO_INT(0, 4)
12+
#define FIREBALL_SPAWN_RATE TIME(0, 4)
1313

1414
typedef struct {
1515
/* 0x00 */ MapEntity *me;

src/game/enemies/mirror.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ void Task_MirrorShoot(void)
178178
}
179179
}
180180

181-
if (mirror->frames == ZONE_TIME_TO_INT(0, 1)) {
181+
if (mirror->frames == TIME(0, 1)) {
182182
s->variant = 0;
183183
gCurTask->main = Task_Mirror;
184184
}

src/game/enemies/mole.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void Task_Mole(void)
8282
return;
8383
}
8484

85-
if (++mole->frames >= ZONE_TIME_TO_INT(0, 1)) {
85+
if (++mole->frames >= TIME(0, 1)) {
8686
mole->frames = 0;
8787
s->variant = 1;
8888

@@ -118,7 +118,7 @@ void Task_Mole_8071640(void)
118118
return;
119119
}
120120

121-
if (++mole->frames >= ZONE_TIME_TO_INT(0, 1)) {
121+
if (++mole->frames >= TIME(0, 1)) {
122122
mole->frames = 0;
123123
s->variant = 0;
124124
gCurTask->main = Task_Mole;

src/game/game_over.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ void Task_GameOverScreenInit(void)
253253

254254
screen->frames = ++frames;
255255

256-
if (frames >= ZONE_TIME_TO_INT(0, 1)) {
256+
if (frames >= TIME(0, 1)) {
257257
screen->s.frameFlags = 0;
258258
screen->s2.frameFlags = 0;
259259
gCurTask->main = Task_8056100;
@@ -297,7 +297,7 @@ void Task_8056100(void)
297297

298298
screen->frames = ++frames;
299299

300-
if (frames >= ZONE_TIME_TO_INT(0, 1.5)) {
300+
if (frames >= TIME(0, 1.5)) {
301301
gCurTask->main = Task_805618C;
302302
}
303303

@@ -324,7 +324,7 @@ void Task_805618C(void)
324324

325325
screen->frames = ++frames;
326326

327-
if (frames >= ZONE_TIME_TO_INT(0, 2)) {
327+
if (frames >= TIME(0, 2)) {
328328
s->frameFlags = SPRITE_OAM_ORDER(2);
329329
s2->frameFlags = SPRITE_OAM_ORDER(2);
330330

@@ -678,7 +678,7 @@ NONMATCH("asm/non_matching/game/game_over__Task_805676C.inc", void Task_805676C(
678678
}
679679
}
680680

681-
if (unk24 >= ZONE_TIME_TO_INT(0, 20)) {
681+
if (unk24 >= TIME(0, 20)) {
682682
gCurTask->main = Task_DestroyGameOverD;
683683
}
684684

0 commit comments

Comments
 (0)