summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornotyourav <65437533+notyourav@users.noreply.github.com>2022-03-02 12:44:54 -0800
committerGitHub <noreply@github.com>2022-03-02 12:44:54 -0800
commite57bf718fce2cc5b36da6ca60c12c1f4dfaa3074 (patch)
tree93d6d1a4855ebcf06b796498cf16ab45e25ba213 /src
parent4e10e89cca8484f2729d4adbc8d945bc0e46ad10 (diff)
parent640810a00577b9833c0452a9577205bc16be83c5 (diff)
Merge pull request #414 from hatal175/objectutils
Decompile a few functions in objectutils
Diffstat (limited to 'src')
-rw-r--r--src/object/bigIceBlock.c2
-rw-r--r--src/object/object68.c2
-rw-r--r--src/object/smallIceBlock.c4
-rw-r--r--src/objectUtils.c50
4 files changed, 46 insertions, 12 deletions
diff --git a/src/object/bigIceBlock.c b/src/object/bigIceBlock.c
index 916f83fa..b5580c12 100644
--- a/src/object/bigIceBlock.c
+++ b/src/object/bigIceBlock.c
@@ -91,7 +91,7 @@ void BigIceBlock_Action2(BigIceBlockEntity* this) {
if (super->type != 2) {
SetFlag(this->unk_86);
} else {
- sub_080A2A3C(super, 0x53, 0, this->unk_86);
+ CreateGroundItemWithFlags(super, 0x53, 0, this->unk_86);
}
}
super->action = 3;
diff --git a/src/object/object68.c b/src/object/object68.c
index b178b6ba..83913606 100644
--- a/src/object/object68.c
+++ b/src/object/object68.c
@@ -66,7 +66,7 @@ void sub_08094774(Object68Entity* this) {
}
break;
case 2:
- child = sub_080A2A20(&gPlayerEntity, 0x60, 0);
+ child = CreateGroundItem(&gPlayerEntity, 0x60, 0);
super->child = child;
if (child != NULL) {
child->actionDelay = 1;
diff --git a/src/object/smallIceBlock.c b/src/object/smallIceBlock.c
index e5c467cc..9e2cf781 100644
--- a/src/object/smallIceBlock.c
+++ b/src/object/smallIceBlock.c
@@ -138,10 +138,10 @@ void SmallIceBlock_Action3(SmallIceBlockEntity* this) {
}
sub_0805EC9C(super, 0x100, gUnk_08123748[super->actionDelay >> 5], 0);
if (super->type == 1) {
- sub_080A2A3C(super, 0x53, 0, this->unk_86);
+ CreateGroundItemWithFlags(super, 0x53, 0, this->unk_86);
SoundReq(SFX_SECRET);
} else if (super->type == 2) {
- sub_080A2A3C(super, 0x52, 0, this->unk_86);
+ CreateGroundItemWithFlags(super, 0x52, 0, this->unk_86);
SoundReq(SFX_SECRET);
}
super->action = 4;
diff --git a/src/objectUtils.c b/src/objectUtils.c
index 745bd0fd..f394b912 100644
--- a/src/objectUtils.c
+++ b/src/objectUtils.c
@@ -97,20 +97,20 @@ u32 LoadObjectSprite(Entity* this, s32 type, const ObjectDefinition* definition)
return 2;
}
-Entity* CreateObject(u32 subtype, u32 form, u32 parameter) {
+Entity* CreateObject(u32 subtype, u32 form, u32 type2) {
Entity* entity = GetEmptyEntity();
if (entity != NULL) {
entity->kind = OBJECT;
entity->id = subtype;
entity->type = form;
- entity->type2 = parameter;
+ entity->type2 = type2;
AppendEntityToList(entity, 6);
}
return entity;
}
-Entity* CreateObjectWithParent(Entity* parent, u32 subtype, u32 form, u32 parameter) {
- Entity* entity = CreateObject(subtype, form, parameter);
+Entity* CreateObjectWithParent(Entity* parent, u32 subtype, u32 form, u32 type2) {
+ Entity* entity = CreateObject(subtype, form, type2);
if (entity != NULL) {
entity->parent = parent;
CopyPosition(parent, entity);
@@ -150,23 +150,23 @@ void CreateWaterSplash(Entity* parent) {
CreateFx(parent, FX_WATER_SPLASH, 0);
}
-Entity* sub_080A2A20(Entity* parent, u32 form, u32 parameter) {
+Entity* CreateGroundItem(Entity* parent, u32 form, u32 subtype) {
Entity* ent;
- ent = CreateObjectWithParent(parent, GROUND_ITEM, form, parameter);
+ ent = CreateObjectWithParent(parent, GROUND_ITEM, form, subtype);
if (ent != NULL) {
ent->actionDelay = 5;
}
return ent;
}
-Entity* sub_080A2A3C(Entity* parent, u32 form, u32 subtype, u32 param_4) {
+Entity* CreateGroundItemWithFlags(Entity* parent, u32 form, u32 subtype, u32 flags) {
Entity* ent;
ent = CreateObjectWithParent(parent, GROUND_ITEM, form, subtype);
if (ent != NULL) {
ent->actionDelay = 5;
- ent->field_0x86.HWORD = param_4;
+ ent->field_0x86.HWORD = flags;
}
return ent;
}
@@ -180,3 +180,37 @@ Entity* CreateWaterTrace(Entity* parent) {
}
return ent;
}
+
+void CreateRandomWaterTrace(Entity* parent, int range) {
+ s32 sVar1, sVar2, sVar3;
+ Entity* ent;
+ u32 uVar3;
+
+ ent = CreateWaterTrace(parent);
+ if (ent != NULL) {
+ uVar3 = Random();
+ sVar1 = (int)uVar3 % (++range);
+ uVar3 >>= 8;
+ if ((uVar3 & 1) != 0) {
+ sVar1 = -sVar1;
+ }
+ ent->x.HALF.HI += sVar1;
+ uVar3 >>= 8;
+ sVar2 = (int)uVar3 % range;
+ uVar3 >>= 8;
+ if ((uVar3 & 1) != 0) {
+ sVar2 = -sVar2;
+ }
+ ent->y.HALF.HI += sVar2;
+ }
+}
+
+Entity* CreateLargeWaterTrace(Entity* parent) {
+ Entity* ent;
+
+ ent = CreateFx(parent, FX_RIPPLE_LARGE, 0);
+ if (ent != NULL) {
+ ent->spritePriority.b0 = 7;
+ }
+ return ent;
+}