Skip to content

Commit

Permalink
Remove SyncPlayerToPlatform fake match (#667)
Browse files Browse the repository at this point in the history
* Remove SyncPlayerToPlatform fake match

* Remove shift operators
  • Loading branch information
KEKW555 authored Dec 26, 2023
1 parent bcf5a11 commit b03db98
Showing 1 changed file with 44 additions and 44 deletions.
88 changes: 44 additions & 44 deletions src/objectUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,50 +267,50 @@ void CreateSparkle(Entity* entity) {
}

void SyncPlayerToPlatform(Entity* this, bool32 param_2) {
s16 oldValue;
s32 diff;
u16 newValue;
FORCE_REGISTER(Entity * that, r4) = this;
FORCE_REGISTER(bool32 p2, r6) = param_2;
u16 dir = that->direction;

if ((dir & 0x80) == 0) {
switch (dir >> 3) {
case 0:
oldValue = that->y.HALF_U.HI;
LinearMoveUpdate(that);
newValue = that->y.HALF_U.HI;
diff = ((oldValue - newValue) << 0x10) >> 0x10;
if ((diff != 0) && (p2 != 0)) {
sub_080044AE(&gPlayerEntity, diff << 8, 0);
}
break;
case 1:
oldValue = that->x.HALF_U.HI;
LinearMoveUpdate(that);
diff = ((that->x.HALF_U.HI - oldValue) * 0x10000) >> 0x10;
if ((diff != 0) && (p2 != 0)) {
sub_080044AE(&gPlayerEntity, diff << 8, 8);
}
break;
case 2:
oldValue = that->y.HALF_U.HI;
LinearMoveUpdate(that);
diff = ((that->y.HALF_U.HI - oldValue) * 0x10000) >> 0x10;
if ((diff != 0) && (p2 != 0)) {
sub_080044AE(&gPlayerEntity, diff << 8, 0x10);
}
break;
case 3:
oldValue = that->x.HALF_U.HI;
LinearMoveUpdate(that);
newValue = that->x.HALF_U.HI;
diff = ((oldValue - newValue) << 0x10) >> 0x10;
if ((diff != 0) && (p2 != 0)) {
sub_080044AE(&gPlayerEntity, diff << 8, 0x18);
}
break;
}
s16 oldValue1, oldValue2;
s32 newValue1, newValue2, newValue3, newValue4;
s16 diff;

if ((this->direction & 0x80) != 0)
return;

switch (this->direction >> 3) {
case 0:
oldValue1 = this->y.HALF_U.HI;
LinearMoveUpdate(this);
newValue1 = this->y.HALF_U.HI;
diff = ((oldValue1 - newValue1));
if ((diff != 0) && (param_2 != 0)) {
sub_080044AE(&gPlayerEntity, diff << 8, 0);
}
break;
case 1:
oldValue2 = this->x.HALF_U.HI;
LinearMoveUpdate(this);
newValue2 = this->x.HALF_U.HI;
diff = (newValue2 - oldValue2);
if ((diff != 0) && (param_2 != 0)) {
sub_080044AE(&gPlayerEntity, diff << 8, 8);
}
break;
case 2:
oldValue2 = this->y.HALF_U.HI;
LinearMoveUpdate(this);
newValue3 = this->y.HALF_U.HI;
diff = (newValue3 - oldValue2);
if ((diff != 0) && (param_2 != 0)) {
sub_080044AE(&gPlayerEntity, diff << 8, 0x10);
}
break;
case 3:
oldValue1 = this->x.HALF_U.HI;
LinearMoveUpdate(this);
newValue4 = this->x.HALF_U.HI;
diff = ((oldValue1 - newValue4));
if ((diff != 0) && (param_2 != 0)) {
sub_080044AE(&gPlayerEntity, diff << 8, 0x18);
}
break;
}
}

Expand Down

0 comments on commit b03db98

Please sign in to comment.