Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cyxx committed May 7, 2018
1 parent fb1535f commit f33b57c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 29 deletions.
40 changes: 16 additions & 24 deletions opcodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2003,18 +2003,14 @@ int Game::op_updateFollowingObject(int argc, int32_t *argv) {
int32_t specx = argv[2];
int32_t specz = argv[3];

GameObject *o_follower;
if (followerObjKey == 0) {
o_follower = _currentObject;
} else if ((o_follower = getObjectByKey(followerObjKey)) == 0) {
return 0;
}
GameObject *o_followed;
if (followedObjKey == 0) {
o_followed = _currentObject;
} else if ((o_followed = getObjectByKey(followedObjKey)) == 0) {
return 0;
}
GameObject *o_follower = (followerObjKey == 0) ? _currentObject : getObjectByKey(followerObjKey);
if (!o_follower) {
return 0;
}
GameObject *o_followed = (followedObjKey == 0) ? _currentObject : getObjectByKey(followedObjKey);
if (!o_followed) {
return 0;
}

GameFollowingPoint *points = (_followingObjectsTable + o_follower->customData[11])->points;
int *count = &o_follower->customData[10];
Expand Down Expand Up @@ -2164,18 +2160,14 @@ int Game::op_setupFollowingObject(int argc, int32_t *argv) {
int16_t followedObjKey = argv[1];
int16_t key = argv[2];

GameObject *o_follower;
if (followerObjKey == 0) {
o_follower = _currentObject;
} else if ((o_follower = getObjectByKey(followerObjKey)) == 0) {
return 0;
}
GameObject *o_followed;
if (followedObjKey == 0) {
o_followed = _currentObject;
} else if ((o_followed = getObjectByKey(followedObjKey)) == 0) {
return 0;
}
GameObject *o_follower = (followerObjKey == 0) ? _currentObject : getObjectByKey(followerObjKey);
if (!o_follower) {
return 0;
}
GameObject *o_followed = (followedObjKey == 0) ? _currentObject : getObjectByKey(followedObjKey);
if (!o_followed) {
return 0;
}

GameFollowingPoint *points = _followingObjectsTable[o_follower->customData[11]].points;
const int xTo = o_followed->xPosParent + o_followed->xPos;
Expand Down
2 changes: 1 addition & 1 deletion raycast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ int Game::rayCastCameraCb2(GameObject * o, CellMap * cell, int ox, int oz) {
slot = cell->colSlot;
while (slot != 0) {
GameObject *obj = slot->o;
int flag = (obj != getObjectByKey(_cameraViewKey));
bool flag = (obj != getObjectByKey(_cameraViewKey));
flag = flag && (obj->flags[1] & 4) == 0;
flag = flag && (obj->specialData[1][23] != 57);
flag = flag && (obj->specialData[1][8] & _observerColMask);
Expand Down
5 changes: 1 addition & 4 deletions xmiplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,10 +453,7 @@ struct XmiPlayer_FluidSynth : XmiPlayer {
_currentTick += _tickDuration;
_samplesLeft = _samplesPerTick;
}
int count = _samplesLeft;
if (count > len) {
count = len;
}
const int count = MIN(_samplesLeft, len);
fluid_synth_write_s16(_fluidSynth, count, buffer, 0, 2, buffer, 1, 2);
buffer += count * 2;
_samplesLeft -= count;
Expand Down

0 comments on commit f33b57c

Please sign in to comment.