Use negative values where appropriate

This commit is contained in:
Tal Hayon 2022-08-07 00:39:22 +03:00
parent 807d313e10
commit c45195c577
27 changed files with 61 additions and 72 deletions

View File

@ -274,7 +274,7 @@ void sub_08039140(CuccoAggrEntity* this) {
super->action = 6;
super->timer = Random();
super->direction = GetFacingDirection(super, &gPlayerEntity);
super->z.HALF.HI = 0xfffc;
super->z.HALF.HI = -4;
this->unk_78 = 0xb4;
sub_080390F8(this);
InitializeAnimation(super, 4);

View File

@ -146,7 +146,7 @@ void sub_080441E0(DustEntity* this) {
super->frameIndex = 1;
super->spritePriority.b0 = 7;
this->unk_75 = 0;
this->unk_76 = 0xffff;
this->unk_76 = -1;
} else {
super->frameIndex = 0;
super->speed = 0;

View File

@ -143,7 +143,7 @@ void sub_08040D30(Enemy50Entity* this) {
}
GenericConfused(super);
if (super->z.HALF.HI == 0) {
super->z.HALF.HI = 0xffff;
super->z.HALF.HI = -1;
}
if (super->confusedTime == 0) {
InitializeAnimation(super, (super->animationState ^ 1) + 1);

View File

@ -82,7 +82,7 @@ void sub_08039CE0(FlyingSkullEntity* this) {
if (super->timer == 0) {
sub_0803A100(this);
super->timer = 1;
super->z.HALF.HI = 0xffff;
super->z.HALF.HI = -1;
super->spriteOffsetX = 0;
SetTile(this->unk_0x74, COORD_TO_TILE(super), super->collisionLayer);
}

View File

@ -28,9 +28,9 @@ extern void (*const Ghini_Actions[])(GhiniEntity*);
extern void (*const Ghini_SubActions[])(GhiniEntity*);
extern const u8 gUnk_080D0970[];
extern const u8 gUnk_080D0974[];
extern const u8 gUnk_080D0978[];
extern const s8 gUnk_080D0978[];
extern const u8 gUnk_080D0980[];
extern const u8 gUnk_080D0984[];
extern const s8 gUnk_080D0984[];
void sub_0803F694(GhiniEntity*);
void sub_0803F630(GhiniEntity*);
@ -102,7 +102,7 @@ void Ghini_OnConfused(GhiniEntity* this) {
}
GenericConfused(super);
if (super->z.HALF.HI == 0) {
super->z.HALF.HI = 0xffff;
super->z.HALF.HI = -1;
}
if (super->confusedTime == 0) {
InitializeAnimation(super, (super->animationState ^ 1) + 1);
@ -361,11 +361,11 @@ void sub_0803F66C(GhiniEntity* this) {
}
void sub_0803F694(GhiniEntity* this) {
super->z.HALF.HI = gUnk_080D0984[(((u32)this->unk_7b++ << 0x18) >> 0x1b) & 3] << 0x18 >> 0x18;
super->z.HALF.HI = gUnk_080D0984[(this->unk_7b++ >> 3) & 3];
}
void sub_0803F6C0(GhiniEntity* this) {
super->frame &= 0xfe;
super->frame &= ~1;
gPlayerEntity.iframes = 0xc;
ModHealth(-4);
SoundReqClipped(&gPlayerEntity, SFX_PLY_VO6);
@ -373,9 +373,9 @@ void sub_0803F6C0(GhiniEntity* this) {
void sub_0803F6EC(GhiniEntity* this) {
if (gPlayerEntity.health != 0) {
gPlayerEntity.flags |= 0x80;
gPlayerEntity.zVelocity = 0x18000;
gPlayerEntity.z.HALF.HI = 0xfffe;
gPlayerEntity.flags |= ENT_COLLIDE;
gPlayerEntity.zVelocity = Q_16_16(1.5);
gPlayerEntity.z.HALF.HI = -2;
gPlayerEntity.direction = gPlayerEntity.animationState << 2;
gPlayerEntity.iframes = -0x3c;
gPlayerState.jump_status = 0x41;
@ -416,8 +416,8 @@ const u8 gUnk_080D0974[] = {
160,
128,
};
const u8 gUnk_080D0978[] = {
0, 254, 0, 2, 0, 252, 0, 4,
const s8 gUnk_080D0978[] = {
0, -2, 0, 2, 0, -4, 0, 4,
};
const u8 gUnk_080D0980[] = {
15,
@ -425,9 +425,9 @@ const u8 gUnk_080D0980[] = {
34,
45,
};
const u8 gUnk_080D0984[] = {
255,
254,
253,
254,
const s8 gUnk_080D0984[] = {
-1,
-2,
-3,
-2,
};

View File

@ -949,9 +949,9 @@ void sub_08047BF0(GyorgMaleEntity* this) {
tmp = CreateFx(super, FX_GIANT_EXPLOSION4, 0);
if (tmp) {
u32 rand = Random();
tmp->x.HALF.HI += (rand & 0x1E) + 0xFFF1;
tmp->x.HALF.HI += (rand & 0x1E) - 15;
rand >>= 8;
tmp->y.HALF.HI += (rand & 0x1E) + 0xFFF1;
tmp->y.HALF.HI += (rand & 0x1E) - 15;
tmp->spritePriority.b0 = 3;
tmp->collisionLayer = 1;
UpdateSpriteForCollisionLayer(tmp);

View File

@ -84,7 +84,7 @@ static void sub_08037D54(Entity* this) {
ptr = gUnk_080CF490 + (this->direction >> 2);
proj->x.HALF.HI += *ptr;
proj->y.HALF.HI += *(ptr + 1);
proj->z.HALF.HI = 0xfffd;
proj->z.HALF.HI = -3;
EnqueueSFX(SFX_124);
}
}

View File

@ -355,7 +355,7 @@ void sub_080244E8(Entity* this) {
case 1:
if (++this->z.HALF.HI >= -0x10) {
this->field_0x82.HALF.LO = 0;
this->field_0x78.HWORD = 0xfff0;
this->field_0x78.HWORD = -16;
if (sub_08024AD8(this)) {
this->field_0x80.HALF.LO++;
} else {

View File

@ -594,7 +594,7 @@ void sub_080A4DB8(u32 param_1) {
MemClear(&gBG2Buffer, 0x800);
MemClear(gUnk_0200AF00.elements, sizeof(gUnk_0200AF00.elements));
MemClear(&gFigurineMenu, sizeof(gFigurineMenu));
gFigurineMenu.unk2e = 0xffff;
gFigurineMenu.unk2e = -1;
gMenu.field_0x3 = gPauseMenuOptions.unk2[param_1];
ptr = &gUnk_08128AD8[gUnk_08128A38[param_1].unk0];
gScreen.lcd.displayControl = ptr->unk2 | 0x1940;

View File

@ -170,7 +170,7 @@ void Guard_Head(Entity* this) {
if (this->id == 0x15) {
if ((this->frameIndex & 0x40) != 0) {
pbVar5 = pbVar5 + 0x21;
pbVar3 = 0xffffffff;
pbVar3 = -1;
uVar4 = 0;
} else {
pbVar3 = (uVar2 + 0x19);

View File

@ -72,7 +72,7 @@ void sub_0806BA34(Entity* this, ScriptExecutionContext* context) {
}
void sub_0806BB1C(Entity* this, ScriptExecutionContext* context) {
s32 item = 0xffffffff;
s32 item = -1;
if (GetInventoryValue(ITEM_QST_BOOK1) == 1) {
item = ITEM_QST_BOOK1;
} else if (GetInventoryValue(ITEM_QST_BOOK2) == 1) {

View File

@ -160,17 +160,17 @@ void sub_08067EF0(Entity* this) {
}
}
if ((this->frameSpriteSettings & 2) != 0) {
this->frameSpriteSettings &= 0xfd;
this->frameSpriteSettings &= ~2;
fxEnt = CreateFx(this, FX_ROCK, 0);
if (fxEnt != NULL) {
PositionRelative(this, fxEnt, 0, 0xffe80000);
PositionRelative(this, fxEnt, 0, Q_16_16(-24));
}
}
if ((this->frameSpriteSettings & 4) != 0) {
this->frameSpriteSettings &= 0xfb;
fxEnt = CreateFx(this, FX_STARS2, 0x20);
if (fxEnt != NULL) {
PositionRelative(this, fxEnt, 0xffec0000, 0xfff60000);
PositionRelative(this, fxEnt, Q_16_16(-20), Q_16_16(-10));
}
}
if ((this->frameSpriteSettings & 8) != 0) {

View File

@ -49,8 +49,8 @@ void NPC58_Head(Entity* this) {
SetExtraSpriteFrame(this, 1, (s16)this->field_0x6a.HWORD);
SetExtraSpriteFrame(this, 2, (s16)this->field_0x6c.HWORD);
SetExtraSpriteFrame(this, 3, 10);
sub_0806FFBC(this, 0, 0xfffffff4, 0);
sub_0806FFBC(this, 1, 0xfffffffc, 0);
sub_0806FFBC(this, 0, -12, 0);
sub_0806FFBC(this, 1, -4, 0);
sub_0806FFBC(this, 2, 0xc, 0);
sub_0807000C(this);
}

View File

@ -18,7 +18,7 @@ void Phonograph(Entity* this) {
this->action++;
this->spriteSettings.draw = 1;
this->field_0x68.HWORD = 1;
this->field_0x6a.HWORD = 0xffff;
this->field_0x6a.HWORD = -1;
sub_0807DD64(this);
this->frameIndex = 0;
}

View File

@ -148,7 +148,7 @@ void sub_08064F28(Entity* this, ScriptExecutionContext* context) {
}
}
}
iVar4 = 0xffffffff;
iVar4 = -1;
} else {
if (CheckGlobalFlag(KAKERA_COMPLETE) == 0) {
iVar4 = 100 - gSave.unk117;

View File

@ -58,12 +58,7 @@ static const NPCDefinition* GetNPCDefinition(Entity* this) {
void NPCInit(Entity* this) {
static const Hitbox* const gNPCHitboxes[] = {
NULL,
&gHitbox_2,
&gHitbox_30,
&gHitbox_2,
&gHitbox_3,
&gHitbox_31,
NULL, &gHitbox_2, &gHitbox_30, &gHitbox_2, &gHitbox_3, &gHitbox_31,
};
u32 tmp;
u32 tmp2;
@ -227,15 +222,8 @@ static u32 sub_0806EF74(Entity* ent, u32 a2) {
u32 sub_0806EF88(Entity* ent) {
static u32 (*const gUnk_08114F0C[])(Entity*, u16*) = {
sub_0806EFAC,
sub_0806EFBC,
sub_0806EFCC,
sub_0806EFDC,
sub_0806F014,
sub_0806F02C,
sub_0806F048,
sub_0806F050,
sub_0806F064,
sub_0806EFAC, sub_0806EFBC, sub_0806EFCC, sub_0806EFDC, sub_0806F014,
sub_0806F02C, sub_0806F048, sub_0806F050, sub_0806F064,
};
u8* v1 = (u8*)&((u16*)ent->child)[ent->hitType];
return gUnk_08114F0C[*v1](ent, (u16*)v1);

View File

@ -109,7 +109,7 @@ void sub_08088BE0(BigBarrelEntity* this) {
Entity* ent;
if (CheckLocalFlag(0x15) == 0) {
sub_08088C78(this, 2, 0, 0xffffff88);
sub_08088C78(this, 2, 0, -120);
ent = sub_08088C78(this, 4, 0x15, 0);
if (ent != NULL) {
ent->x.HALF.HI = gRoomControls.origin_x + 0x48;
@ -118,15 +118,15 @@ void sub_08088BE0(BigBarrelEntity* this) {
}
if (CheckLocalFlag(0x16) == 0) {
sub_08088C78(this, 2, 1, 0x78);
sub_08088C78(this, 2, 1, 120);
ent = sub_08088C78(this, 4, 0x16, 0);
if (ent != NULL) {
ent->x.HALF.HI = gRoomControls.origin_x + 0x188;
ent->y.HALF.HI = gRoomControls.origin_y + 200;
}
}
sub_08088C78(this, 1, 0, 0xffffff88);
sub_08088C78(this, 1, 1, 0x78);
sub_08088C78(this, 1, 0, -120);
sub_08088C78(this, 1, 1, 120);
}
Entity* sub_08088C78(BigBarrelEntity* this, u32 type, u32 type2, u32 xOffset) {

View File

@ -201,7 +201,7 @@ void sub_080840A8(s32 param_1, s32 param_2) {
obj->zVelocity = gUnk_0811F840[Random() & 3];
obj->x.HALF.HI = gUnk_0811F850[Random() & 3] + param_1;
obj->y.HALF.HI = param_2 + 1;
obj->z.HALF.HI = 0xfff8;
obj->z.HALF.HI = -8;
ResolveCollisionLayer(obj);
obj = CreateFx(obj, FX_DASH, 0);
if (obj != NULL) {

View File

@ -323,11 +323,11 @@ void sub_08094660(GleerokParticleEntity* this) {
sub_08094708(this, iVar3, iVar4);
iVar3 = super->x.HALF.HI + spriteOffsetX + 0x30;
iVar4 = super->y.HALF.HI + spriteOffsetX + 0x30;
this->unk78 = 0xfffffff0;
this->unk78 = -16;
this->unk7c = 0;
sub_08094708(this, iVar3, iVar4);
this->unk78 = 0;
this->unk7c = 0xfffffff0;
this->unk7c = -16;
sub_08094708(this, iVar3, iVar4);
}
}

View File

@ -378,7 +378,7 @@ void KeyStealingTakkuri_Type4_Init(KeyStealingTakkuriEntity* this) {
super->action++;
super->collisionLayer = 1;
super->spriteRendering.b3 = 1;
super->z.HALF.HI = 0xfff0;
super->z.HALF.HI = -16;
sub_0807DD64(super);
InitAnimationForceUpdate(super, 1);
}
@ -396,7 +396,7 @@ void sub_0809E0A0(KeyStealingTakkuriEntity* this) {
super->child = obj;
super->subtimer = 0;
CopyPosition(&gPlayerEntity, obj);
obj->z.HALF.HI = 0xfff8;
obj->z.HALF.HI = -8;
}
}

View File

@ -347,7 +347,7 @@ void sub_08085A44(LilypadLargeEntity* this) {
if (GetRelativeCollisionTile(super, 0x10, 0x18) != 0x11) {
super->direction = 0x18;
} else {
if (GetRelativeCollisionTile(super, 0xfffffff0, 0x18) != 0x11) {
if (GetRelativeCollisionTile(super, -0x10, 0x18) != 0x11) {
super->direction = 8;
} else {
super->direction = 0x10;

View File

@ -23,7 +23,7 @@ void LitArea(Entity* this) {
this->flags |= ENT_PERSIST;
this->subtimer = gRoomControls.room;
this->timer = 2;
this->field_0x68.HWORD = 0xfffe;
this->field_0x68.HWORD = -2;
this->field_0x6a.HWORD = 0x80;
SetAffineInfo(this, 0x80, 0x80, 0);
} else {
@ -34,7 +34,7 @@ void LitArea(Entity* this) {
this->field_0x68.HWORD = 1;
}
if (0x88 < this->field_0x6a.HWORD) {
this->field_0x68.HWORD = 0xffff;
this->field_0x68.HWORD = -1;
}
SetAffineInfo(this, this->field_0x6a.HWORD, this->field_0x6a.HWORD, 0);
}

View File

@ -22,9 +22,10 @@ void StoneTablet(Entity* this) {
void StoneTablet_Init(Entity* this) {
// TODO recreate as TileData[]
static const u16 gUnk_081232EC[] = { 0x4022, 0xfffe, 0x4022, 0xffff, 0x4022, 0x0, 0x4022, 0x1, 0xffff };
static const u16 gUnk_081232FE[] = { 0x4065, 0xffbf, 0x4022, 0xffc0, 0x4066, 0xffc1, 0x4029,
0xffff, 0x4026, 0x0, 0x402a, 0x1, 0xffff };
static const u16 gUnk_081232EC[] = { 0x4022, -2, 0x4022, -1, 0x4022, 0, 0x4022, 1, 0xffff };
static const u16 gUnk_081232FE[] = {
0x4065, -65, 0x4022, -64, 0x4066, -63, 0x4029, -1, 0x4026, 0, 0x402a, 1, 0xffff
};
this->action = 1;
this->spriteSettings.draw = 1;
if (this->type == 3) {

View File

@ -34,7 +34,7 @@ void sub_080AB074(Entity* this) {
this->frameIndex = 0;
this->spritePriority.b0 = 3;
}
sub_0806FA90(this->parent, this, 0, 0xfffffff6 + -(s8)parent->field_0x7c.BYTES.byte3);
sub_0806FA90(this->parent, this, 0, -10 + -(s8)parent->field_0x7c.BYTES.byte3);
this->x.WORD += gSineTable[parent->field_0x7c.BYTES.byte0] * (parent->field_0x7c.BYTES.byte2 << 8);
this->y.WORD -= gSineTable[parent->field_0x7c.BYTES.byte0 + 0x40] * (parent->field_0x7c.BYTES.byte2 << 8);

View File

@ -34,7 +34,7 @@ void sub_080AB544(Entity* this) {
void CannonballProjectile_Init(Entity* this) {
this->action = 1;
this->direction = this->type << 3;
this->z.HALF.HI = 0xfffc;
this->z.HALF.HI = -4;
InitializeAnimation(this, this->type);
}

View File

@ -46,7 +46,7 @@ void sub_080A9A64(Entity* this) {
void StalfosProjectile_SubAction0(Entity* this) {
this->subAction = 2;
this->z.HALF.HI = 0xfffe;
this->z.HALF.HI = -2;
}
void StalfosProjectile_SubAction1(Entity* this) {

View File

@ -47,7 +47,7 @@ void sub_080ACA68(Entity* this) {
void V3TennisBallProjectile_Init(Entity* this) {
this->action = 1;
this->direction = 0x10;
this->z.HALF.HI = 0xfffc;
this->z.HALF.HI = -4;
this->child = NULL;
InitializeAnimation(this, 7);
SoundReq(SFX_199);