Skip to content

Commit

Permalink
clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
yvt committed Dec 29, 2017
1 parent 4cb5c57 commit 28cd9a3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 34 deletions.
16 changes: 9 additions & 7 deletions Sources/Client/Client_Draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ namespace spades {

Player &player = GetCameraTargetPlayer();
int playerId = GetCameraTargetPlayerId();

clientPlayers[playerId]->Draw2D();

if (cg_hitIndicator && hitFeedbackIconState > 0.f && !cg_hideHud) {
Expand Down Expand Up @@ -639,13 +639,12 @@ namespace spades {
Vector2 pos = MakeVector2(textX, textY);
pos.x -= size.x;
textY += 20.0f;
font.DrawShadow(text, pos, 1.f, MakeVector4(1, 1, 1, 1),
MakeVector4(0, 0, 0, 0.5));
font.DrawShadow(text, pos, 1.f, MakeVector4(1, 1, 1, 1), MakeVector4(0, 0, 0, 0.5));
};

if (HasTargetPlayer(GetCameraMode())) {
addLine(_Tr("Client", "Following {0}",
world->GetPlayerPersistent(GetCameraTargetPlayerId()).name));
world->GetPlayerPersistent(GetCameraTargetPlayerId()).name));
}

textY += 10.0f;
Expand All @@ -655,17 +654,20 @@ namespace spades {
if (GetCameraTargetPlayer().IsAlive()) {
addLine(_Tr("Client", "[{0}] Cycle camera mode", TranslateKeyName(cg_keyJump)));
}
addLine(_Tr("Client", "[{0}/{1}] Next/previous player", TranslateKeyName(cg_keyAttack), TranslateKeyName(cg_keyAltAttack)));
addLine(_Tr("Client", "[{0}/{1}] Next/previous player",
TranslateKeyName(cg_keyAttack), TranslateKeyName(cg_keyAltAttack)));

if (GetWorld()->GetLocalPlayer()->IsSpectator()) {
addLine(_Tr("Client", "[{0}] Unfollow", TranslateKeyName(cg_keyReloadWeapon)));
}
} else {
addLine(_Tr("Client", "[{0}/{1}] Follow a player", TranslateKeyName(cg_keyAttack), TranslateKeyName(cg_keyAltAttack)));
addLine(_Tr("Client", "[{0}/{1}] Follow a player", TranslateKeyName(cg_keyAttack),
TranslateKeyName(cg_keyAltAttack)));
}

if (GetCameraMode() == ClientCameraMode::Free) {
addLine(_Tr("Client", "[{0}/{1}] Go up/down", TranslateKeyName(cg_keyJump), TranslateKeyName(cg_keyCrouch)));
addLine(_Tr("Client", "[{0}/{1}] Go up/down", TranslateKeyName(cg_keyJump),
TranslateKeyName(cg_keyCrouch)));
}

mapView->Draw();
Expand Down
23 changes: 12 additions & 11 deletions Sources/Client/Client_Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ namespace spades {

float rad = x * x + y * y;
if (rad > 0.f) {
if ((float)cg_mouseExpPower < 0.001f || isnan((float)cg_mouseExpPower)) {
if ((float)cg_mouseExpPower < 0.001f ||
isnan((float)cg_mouseExpPower)) {
SPLog("Invalid cg_mouseExpPower value, resetting to 1.0");
cg_mouseExpPower = 1.f;
}
Expand Down Expand Up @@ -313,8 +314,7 @@ namespace spades {
switch (cameraMode) {
case ClientCameraMode::None:
case ClientCameraMode::NotJoined:
case ClientCameraMode::FirstPersonLocal:
break;
case ClientCameraMode::FirstPersonLocal: break;
case ClientCameraMode::ThirdPersonLocal:
if (world->GetLocalPlayer()->IsAlive()) {
break;
Expand All @@ -325,37 +325,38 @@ namespace spades {
if (CheckKey(cg_keyAttack, name)) {
if (down) {
if (cameraMode == ClientCameraMode::Free ||
cameraMode == ClientCameraMode::ThirdPersonLocal) {
cameraMode == ClientCameraMode::ThirdPersonLocal) {
// Start with the local player
followedPlayerId = world->GetLocalPlayerIndex();
}
if (world->GetLocalPlayer()->IsSpectator() ||
time > lastAliveTime + 1.3f) {
time > lastAliveTime + 1.3f) {
FollowNextPlayer(false);
}
}
return;
} else if (CheckKey(cg_keyAltAttack, name)) {
if (down) {
if (cameraMode == ClientCameraMode::Free ||
cameraMode == ClientCameraMode::ThirdPersonLocal) {
cameraMode == ClientCameraMode::ThirdPersonLocal) {
// Start with the local player
followedPlayerId = world->GetLocalPlayerIndex();
}
if (world->GetLocalPlayer()->IsSpectator() ||
time > lastAliveTime + 1.3f) {
time > lastAliveTime + 1.3f) {
FollowNextPlayer(true);
}
}
return;
} else if (CheckKey(cg_keyJump, name) && cameraMode != ClientCameraMode::Free) {
} else if (CheckKey(cg_keyJump, name) &&
cameraMode != ClientCameraMode::Free) {
if (down && GetCameraTargetPlayer().IsAlive()) {
followCameraState.firstPerson = !followCameraState.firstPerson;
}
return;
} else if (CheckKey(cg_keyReloadWeapon, name) &&
world->GetLocalPlayer()->IsSpectator() &&
followCameraState.enabled) {
world->GetLocalPlayer()->IsSpectator() &&
followCameraState.enabled) {
if (down) {
// Unfollow
followCameraState.enabled = false;
Expand Down Expand Up @@ -439,7 +440,7 @@ namespace spades {
if (world->GetLocalPlayer()->IsToolWeapon() && weapInput.secondary &&
!lastVal && world->GetLocalPlayer()->IsReadyToUseTool() &&
!world->GetLocalPlayer()->GetWeapon()->IsReloading() &&
GetSprintState() == 0.0f) {
GetSprintState() == 0.0f) {
AudioParam params;
params.volume = 0.08f;
Handle<IAudioChunk> chunk =
Expand Down
18 changes: 6 additions & 12 deletions Sources/Client/Client_Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,13 @@ namespace spades {
switch (GetCameraMode()) {
case ClientCameraMode::None:
case ClientCameraMode::NotJoined:
case ClientCameraMode::Free:
SPUnreachable();
case ClientCameraMode::Free: SPUnreachable();
case ClientCameraMode::FirstPersonLocal:
case ClientCameraMode::ThirdPersonLocal:
SPAssert(world);
return world->GetLocalPlayerIndex();
case ClientCameraMode::FirstPersonFollow:
case ClientCameraMode::ThirdPersonFollow:
return followedPlayerId;
case ClientCameraMode::ThirdPersonFollow: return followedPlayerId;
}
SPUnreachable();
}
Expand All @@ -125,8 +123,7 @@ namespace spades {

float Client::GetAimDownZoomScale() {
Player &player = GetCameraTargetPlayer();
if (!player.IsToolWeapon() ||
!player.IsAlive()) {
if (!player.IsToolWeapon() || !player.IsAlive()) {
return 1.f;
}

Expand Down Expand Up @@ -177,8 +174,7 @@ namespace spades {
float vibYaw = 0.f;

switch (GetCameraMode()) {
case ClientCameraMode::None:
SPUnreachable();
case ClientCameraMode::None: SPUnreachable();

case ClientCameraMode::NotJoined:
def.viewOrigin = MakeVector3(256, 256, 4);
Expand Down Expand Up @@ -413,12 +409,10 @@ namespace spades {
grenVib = 1.f;
grenVib *= grenVib;

roll +=
coherentNoiseSamplers[0].Sample(time * 8.f) * 0.2f * grenVib;
roll += coherentNoiseSamplers[0].Sample(time * 8.f) * 0.2f * grenVib;
vibPitch +=
coherentNoiseSamplers[1].Sample(time * 12.f) * 0.1f * grenVib;
vibYaw +=
coherentNoiseSamplers[2].Sample(time * 11.f) * 0.1f * grenVib;
vibYaw += coherentNoiseSamplers[2].Sample(time * 11.f) * 0.1f * grenVib;
}
}
}
Expand Down
9 changes: 5 additions & 4 deletions Sources/Client/NetClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,9 @@ namespace spades {
if (reader.GetType() == PacketTypeWeaponReload) {
// Drop reload packets
} else if (reader.GetType() != PacketTypeWorldUpdate &&
reader.GetType() != PacketTypeExistingPlayer &&
reader.GetType() != PacketTypeCreatePlayer &&
tryMapLoadOnPacketType) {
reader.GetType() != PacketTypeExistingPlayer &&
reader.GetType() != PacketTypeCreatePlayer &&
tryMapLoadOnPacketType) {
status = NetClientStatusConnected;
statusString = _Tr("NetClient", "Connected");

Expand Down Expand Up @@ -776,7 +776,8 @@ namespace spades {
// Simple variant
SendVersion();
}
} return true;
}
return true;
default: return false;
}
}
Expand Down

0 comments on commit 28cd9a3

Please sign in to comment.