Skip to content

Commit

Permalink
code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
macabeus committed Jan 31, 2025
1 parent 0a2fb5e commit 8c3dbbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 2 additions & 1 deletion include/sprite.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,8 @@ extern u8 gNextFreeAffineIndex; // related to Sprite.frameFlags
#define SPRITE_FLAG_SET_VALUE(sprite, flagName, value) (sprite)->frameFlags |= SPRITE_FLAG(flagName, value)

#define SPRITE_FLAG_SHIFT_ROT_SCALE 0
#define SPRITE_FLAG_SHIFT_2 1
#define SPRITE_FLAG_SHIFT_3 3
#define SPRITE_FLAG_SHIFT_ROT_SCALE_ENABLE 5
#define SPRITE_FLAG_SHIFT_ROT_SCALE_DOUBLE_SIZE 6
#define SPRITE_FLAG_SHIFT_OBJ_MODE 7
Expand All @@ -425,7 +427,6 @@ extern u8 gNextFreeAffineIndex; // related to Sprite.frameFlags
#define SPRITE_FLAG_SHIFT_26 26
#define SPRITE_FLAG_SHIFT_30 30
#define SPRITE_FLAG_SHIFT_31 31
#define SPRITE_FLAG_SHIFT_106 106

#define SPRITE_FLAG_MASK_ROT_SCALE SPRITE_FLAG(ROT_SCALE, 0x1F)
#define SPRITE_FLAG_MASK_ROT_SCALE_ENABLE SPRITE_FLAG(ROT_SCALE_ENABLE, 1)
Expand Down
10 changes: 4 additions & 6 deletions src/game/enemies/marun.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ typedef struct {
/* 0x0A */ s8 direction;
/* 0x0C */ u16 region[2];
/* 0x10 */ u16 rotation;
/* 0x12 */ u16 timer;
/* 0x12 */ s16 timer;
/* 0x14 */ s32 speed;
/* 0x18 */ s32 unk18;
/* 0x1C */ Vec2_32 qUnk1C;
Expand Down Expand Up @@ -171,7 +171,7 @@ void Task_8063858(void)
sprite->anim = gUnknown_080D210C[2].anim;
sprite->variant = gUnknown_080D210C[2].variant;
sprite->prevVariant = 0xFF;
sprite->frameFlags |= SPRITE_FLAG_SHIFT_106;
sprite->frameFlags |= SPRITE_FLAG(ROT_SCALE_ENABLE, 1) | SPRITE_FLAG(ROT_SCALE_DOUBLE_SIZE, 1) | SPRITE_FLAG(3, 1) | SPRITE_FLAG(2, 1);

enemy->qPos.x -= Q(16);

Expand Down Expand Up @@ -225,9 +225,7 @@ void Task_806394C(void)
}

if ((gStageData.unk4 != 1 && gStageData.unk4 != 2 && gStageData.unk4 != 4)) {
s32 rangedTimer = (++enemy->timer) << 16;
s32 limit = ZONE_TIME_TO_INT(6553, 36);
if (rangedTimer > limit || res < 0) {
if (++enemy->timer > ZONE_TIME_TO_INT(0, 6) || res < 0) {
Sprite *s = &enemy->s;

s->anim = gUnknown_080D210C[3].anim;
Expand All @@ -240,7 +238,7 @@ void Task_806394C(void)
s->frameFlags = SPRITE_FLAG(PRIORITY, 1);

if (enemy->direction < 0) {
s->frameFlags = SPRITE_FLAG_SET(s, X_FLIP);
SPRITE_FLAG_SET(s, X_FLIP);
}

if (enemy->direction > 0) {
Expand Down

0 comments on commit 8c3dbbf

Please sign in to comment.