Skip to content

Commit

Permalink
Run tools/formatter.sh
Browse files Browse the repository at this point in the history
This ensures that everything uses the format rules specified in
.clang-format.

Unfortunately, in order to make sure that the clang-format Check
workflow succeeded, I had to make sure that my system had the same
version of clang-format that jidicula/clang-format-action uses. I’m not
sure what the best way to to run the script with an outdated version of
clang-format is, but here’s how I was able to do it:

1. Make sure that the Nix package manager (https://nix.dev) is
   installed.

2. Create a file named shell.nix. Put the following in it:

  let
    url = "https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-unstable.tar.gz";
    tarball = builtins.fetchTarball url;
    pkgs = import tarball { };
  in

  pkgs.mkShell {
    name = "shell-for-clang-format-18.1.13";
    packages = let
      customLlvmPackages = pkgs.llvmPackages_18.override {
        officialRelease = {
          version = "18.1.3";
          sha256 = "saQGbpYd95JuudwLcdG80GL8YhadH7TUY1FC0o0ithY=";
        };
      };
    in [
      customLlvmPackages.clang-tools
    ];
  }

3. Run “nix-shell”.

4. Change directory to the root of the Descent3 repo.

5. Run “tools/formatter.sh”.
  • Loading branch information
Jayman2000 committed Jun 30, 2024
1 parent 53ae5de commit 876243d
Show file tree
Hide file tree
Showing 705 changed files with 21,960 additions and 22,574 deletions.
2 changes: 1 addition & 1 deletion 2dlib/font.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion 2dlib/hardsurf.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down
32 changes: 16 additions & 16 deletions 2dlib/lib2d.h
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/* internal header to 2dlib
Expand Down
2 changes: 1 addition & 1 deletion 2dlib/memsurf.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion 2dlib/pen.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion 2dlib/pentext.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion 2dlib/screen.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion 2dlib/surface.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion 2dlib/viewport.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down
38 changes: 18 additions & 20 deletions AudioEncode/encoder.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/*
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <cstdint>
#include <stdio.h>
Expand All @@ -38,7 +38,7 @@ int32_t aenc_ReadSamp(void *data) {
}

bool aenc_Compress(char *input_filename, char *output_filename, int *input_levels, int *input_samples, int *input_rate,
int *input_channels, float *input_factor, float *input_volscale) {
int *input_channels, float *input_factor, float *input_volscale) {
FILE *in, *out;
int32_t result;

Expand Down Expand Up @@ -114,9 +114,7 @@ bool aenc_Compress(char *input_filename, char *output_filename, int *input_level
} else if (!levels_set) {
unsigned subbands = (2048 / samples_per_subband) >> 1;

for (levels = 0; subbands; subbands >>= 1, ++levels)
{

for (levels = 0; subbands; subbands >>= 1, ++levels) {
}
}

Expand Down
174 changes: 87 additions & 87 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
{
"version": 3,
"configurePresets": [
{
"name": "defaults",
"hidden": true,
"binaryDir": "${sourceDir}/builds/${presetName}"
},
{
"name": "win",
"inherits": "defaults",
"generator": "Ninja Multi-Config",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows-static-md"
},
"architecture": {
"strategy": "external",
"value": "x64"
},
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
},
{
"name": "mac",
"inherits": "defaults",
"generator": "Ninja Multi-Config",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
},
{
"name": "linux",
"inherits": "defaults",
"generator": "Ninja Multi-Config",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
}
],
"buildPresets": [
{
"name": "win",
"configurePreset": "win"
},
{
"name": "mac",
"configurePreset": "mac"
},
{
"name": "linux",
"configurePreset": "linux"
}
],
"testPresets": [
{
"name": "defaults",
"hidden": true,
"output": {
"outputOnFailure": true
}
},
{
"name": "win",
"inherits": "defaults",
"description": "Testing under Windows x64",
"configurePreset": "win"
},
{
"name": "mac",
"inherits": "defaults",
"description": "Testing under macOS",
"configurePreset": "mac"
},
{
"name": "linux",
"inherits": "defaults",
"description": "Testing under Linux",
"configurePreset": "linux"
}
]
"version": 3,
"configurePresets": [
{
"name": "defaults",
"hidden": true,
"binaryDir": "${sourceDir}/builds/${presetName}"
},
{
"name": "win",
"inherits": "defaults",
"generator": "Ninja Multi-Config",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"cacheVariables": {
"VCPKG_TARGET_TRIPLET": "x64-windows-static-md"
},
"architecture": {
"strategy": "external",
"value": "x64"
},
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
},
{
"name": "mac",
"inherits": "defaults",
"generator": "Ninja Multi-Config",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
},
{
"name": "linux",
"inherits": "defaults",
"generator": "Ninja Multi-Config",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
}
}
],
"buildPresets": [
{
"name": "win",
"configurePreset": "win"
},
{
"name": "mac",
"configurePreset": "mac"
},
{
"name": "linux",
"configurePreset": "linux"
}
],
"testPresets": [
{
"name": "defaults",
"hidden": true,
"output": {
"outputOnFailure": true
}
},
{
"name": "win",
"inherits": "defaults",
"description": "Testing under Windows x64",
"configurePreset": "win"
},
{
"name": "mac",
"inherits": "defaults",
"description": "Testing under macOS",
"configurePreset": "mac"
},
{
"name": "linux",
"inherits": "defaults",
"description": "Testing under Linux",
"configurePreset": "linux"
}
]
}
28 changes: 14 additions & 14 deletions Descent3/AIGoal.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -708,19 +708,19 @@ void GoalDoFrame(object *obj) {
if (!(cur_goal->flags & GF_HAS_PATH) || ai_info->path.num_paths == 0) {
GoalInitWanderAround(obj, cur_goal);
}
/*
else if ((cur_goal->flags & GF_HAS_PATH) && ai_info->path.num_paths != 0) {
vector *posp = &cur_goal->g_info.pos;
float dist = vm_VectorDistance(
&AIDynamicPath[ai_info->path.num_paths - 1].pos[ai_info->path.path_end_node[ai_info->path.num_paths - 1]],
posp);
if (dist > 5.0f) {
mprintf(0, "In wander path case for obj %d - %s....\n", OBJNUM(obj), Object_info[obj->id].name);
cur_goal->next_path_time = Gametime - 1.0f;
}
}
*/
/*
else if ((cur_goal->flags & GF_HAS_PATH) && ai_info->path.num_paths != 0) {
vector *posp = &cur_goal->g_info.pos;
float dist = vm_VectorDistance(
&AIDynamicPath[ai_info->path.num_paths - 1].pos[ai_info->path.path_end_node[ai_info->path.num_paths -
1]], posp);
if (dist > 5.0f) {
mprintf(0, "In wander path case for obj %d - %s....\n", OBJNUM(obj), Object_info[obj->id].name);
cur_goal->next_path_time = Gametime - 1.0f;
}
}
*/
}

if (OBJGOAL(cur_goal)) {
Expand Down
2 changes: 1 addition & 1 deletion Descent3/AIGoal.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion Descent3/AIMain.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Descent 3
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
Expand Down
Loading

0 comments on commit 876243d

Please sign in to comment.