mirror of
https://github.com/zeldaret/ss
synced 2026-08-05 09:34:04 -04:00
ActorOnRail_Ext remove duplicate set of flag inlines, conform to check/set/unset
This commit is contained in:
@@ -123,18 +123,6 @@ public:
|
||||
return mSegmentTime;
|
||||
}
|
||||
|
||||
bool CheckFlag(u32 flag) const {
|
||||
return (mFlags & flag) != 0;
|
||||
}
|
||||
|
||||
void ClearFlag(u32 flag) {
|
||||
mFlags &= ~flag;
|
||||
}
|
||||
|
||||
void SetFlag(u32 flag) {
|
||||
mFlags |= flag;
|
||||
}
|
||||
|
||||
const mVec3_c &getPosition() const {
|
||||
return mPosition;
|
||||
}
|
||||
@@ -159,11 +147,11 @@ public:
|
||||
return (mFlags & flags) != 0;
|
||||
}
|
||||
|
||||
void offFlag(u32 flags) {
|
||||
void unsetFlag(u32 flags) {
|
||||
mFlags &= ~flags;
|
||||
}
|
||||
|
||||
void onFlag(u32 flags) {
|
||||
void setFlag(u32 flags) {
|
||||
mFlags |= flags;
|
||||
}
|
||||
|
||||
|
||||
@@ -285,10 +285,10 @@ void dAcODungeonShip_c::executeState_Transparency() {
|
||||
if (isWithinDist1 && field_0x868 == 0 && field_0x862 == 0 && tmp2) {
|
||||
if (field_0x856 > 0) {
|
||||
field_0x856 = 0xFF;
|
||||
mPath.SetFlag(0x40000000);
|
||||
mPath.setFlag(0x40000000);
|
||||
} else {
|
||||
field_0x856 = 1;
|
||||
mPath.ClearFlag(0x40000000);
|
||||
mPath.unsetFlag(0x40000000);
|
||||
}
|
||||
|
||||
u16 idx = fn_485_1900();
|
||||
@@ -302,7 +302,7 @@ void dAcODungeonShip_c::executeState_Transparency() {
|
||||
field_0x858 = 50.0f;
|
||||
}
|
||||
|
||||
if (mPath.CheckFlag(0x40000000) && field_0x858 > 0.0f) {
|
||||
if (mPath.checkFlag(0x40000000) && field_0x858 > 0.0f) {
|
||||
field_0x858 *= -1;
|
||||
}
|
||||
}
|
||||
@@ -433,26 +433,22 @@ void dAcODungeonShip_c::fn_485_1660() {
|
||||
}
|
||||
}
|
||||
|
||||
static u32 rot_7fff = 0x7FFF;
|
||||
static u32 rot_4000 = 0x4000;
|
||||
|
||||
void dAcODungeonShip_c::fn_485_1720() {
|
||||
mPath.setSpeed(mSpeed);
|
||||
mPath.execute();
|
||||
// TODO
|
||||
mPosition = mPath.getPosition();
|
||||
|
||||
mVec3_c tmp;
|
||||
mPath.getDirection(tmp);
|
||||
mRotation.y = cM::atan2s(tmp.x, tmp.z);
|
||||
if (mPath.CheckFlag(0x40000000)) {
|
||||
mRotation.y += rot_7fff;
|
||||
if (mPath.checkFlag(0x40000000)) {
|
||||
mRotation.y += 0x7FFF;
|
||||
}
|
||||
mRotation.y += rot_4000;
|
||||
mRotation.y += 0x4000;
|
||||
mAngle.y = mRotation.y;
|
||||
|
||||
int factor = 0x12C;
|
||||
f32 tmp2 = nw4r::math::SinIdx((field_0x850 * 800));
|
||||
f32 tmp2 = nw4r::math::SinIdx(field_0x850 * 800);
|
||||
tmp2 *= factor;
|
||||
field_0x84C = tmp2;
|
||||
}
|
||||
@@ -460,7 +456,7 @@ void dAcODungeonShip_c::fn_485_1720() {
|
||||
bool dAcODungeonShip_c::fn_485_1830(s32 pathSegmentIndex, s32 direction, s32 *out) {}
|
||||
|
||||
u16 dAcODungeonShip_c::fn_485_1900() {
|
||||
s32 sign = mPath.CheckFlag(0x40000000) ? -1 : 1;
|
||||
s32 sign = mPath.checkFlag(0x40000000) ? -1 : 1;
|
||||
s32 result;
|
||||
if (fn_485_1830(mPath.getSegmentIndex(), sign, &result)) {
|
||||
return result;
|
||||
|
||||
@@ -517,7 +517,7 @@ s32 ActorOnRail_Ext::execute() {
|
||||
mSegmentDistance = 0.0f;
|
||||
if (checkFlag(0x1)) {
|
||||
ret = 3;
|
||||
offFlag(0x40000000);
|
||||
unsetFlag(0x40000000);
|
||||
mSpeed *= -1.0f;
|
||||
}
|
||||
break;
|
||||
@@ -545,7 +545,7 @@ s32 ActorOnRail_Ext::execute() {
|
||||
mSegmentDistance = segmentLength;
|
||||
if (checkFlag(0x1)) {
|
||||
ret = 3;
|
||||
onFlag(0x40000000);
|
||||
setFlag(0x40000000);
|
||||
mSpeed *= -1.0f;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user