Skip to content

Commit

Permalink
Small fixes (#125)
Browse files Browse the repository at this point in the history
* Fixup clang warnings

* [CI/CD] Apple Mac Silicon (arm64) builds

* Disable Raw Input for MacOSX as it makes input not work at all and is the default setting.

* Set CMAKE_C_FLAG -fcommon for BSD compile

* Remove va() call that had too few arguments

* Bump cmake_minimum_required to version 3.10
  • Loading branch information
taysta authored Feb 3, 2024
1 parent 97cd409 commit cf5f509
Show file tree
Hide file tree
Showing 73 changed files with 409 additions and 318 deletions.
95 changes: 84 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ jobs:

macos:
name: macOS ${{ matrix.arch }} ${{ matrix.build_type }} (${{ matrix.portable}})
runs-on: macos-12
runs-on: macos-13
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -237,9 +237,76 @@ jobs:
path: ${{ github.workspace }}/install/JediAcademy/TaystJK-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz
if-no-files-found: error

macos-m1:
name: macOS ${{ matrix.arch }} ${{ matrix.build_type }} (${{ matrix.portable}})
runs-on: macos-14
strategy:
fail-fast: false
matrix:
arch: [arm64]
build_type: [Debug, Release]
portable: [Non-Portable]

steps:
- uses: actions/checkout@v4
if: github.event_name == 'pull_request'
with:
fetch-depth: 0
fetch-tags: true
ref: ${{ github.event.pull_request.head.sha }}

- uses: actions/checkout@v4
if: github.event_name != 'pull_request'
with:
fetch-depth: 0
fetch-tags: true

- name: Create Build Environment
run: |
brew install zlib libjpeg libpng sdl2
cmake -E make_directory ${{ github.workspace }}/build
- name: Configure CMake
shell: bash
working-directory: ${{ github.workspace }}/build
run: |
OPTIONS="-DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/install"
if [ "${{ matrix.portable }}" == "Portable" ]; then
OPTIONS+=" -DUseInternalLibs=ON -DBuildPortableVersion=ON"
else
OPTIONS+=" -DUseInternalLibs=OFF -DBuildPortableVersion=OFF"
fi
cmake $GITHUB_WORKSPACE $OPTIONS
- name: Build
working-directory: ${{ github.workspace }}/build
shell: bash
run: cmake --build . -j $(getconf _NPROCESSORS_ONLN)

- name: Install
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}/build
shell: bash
run: cmake --install .

- name: Create TaystJK binary archive
if: ${{ matrix.build_type == 'Release' }}
working-directory: ${{ github.workspace }}/install/JediAcademy
shell: bash
run: |
chmod +x eternaljk.arm64.app/Contents/MacOS/eternaljk.arm64
tar -czvf TaystJK-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz *
- uses: actions/upload-artifact@v4
if: ${{ matrix.build_type == 'Release' }}
with:
name: TaystJK-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}
path: ${{ github.workspace }}/install/JediAcademy/TaystJK-macos-${{ matrix.arch }}-${{ matrix.build_type }}-${{ matrix.portable }}.tar.gz
if-no-files-found: error

create-latest:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs: [msvc, ubuntu, macos]
needs: [msvc, ubuntu, macos, macos-m1]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand All @@ -251,11 +318,12 @@ jobs:

- name: Create binary archives
run: |
7z a -r TaystJK-windows-x86.zip ./TaystJK-windows-x86-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*'
7z a -r TaystJK-windows-x86_64.zip ./TaystJK-windows-x86_64-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*'
mv ./TaystJK-linux-x86-Release-Non-Portable/* TaystJK-linux-x86.tar.gz
mv ./TaystJK-linux-x86_64-Release-Non-Portable/* TaystJK-linux-x86_64.tar.gz
mv ./TaystJK-macos-x86_64-Release-Non-Portable/* TaystJK-macos-x86_64.tar.gz
7z a -r TaystJK-windows-x86.zip ./TaystJK-windows-x86-Release-Non-Portable/*
7z a -r TaystJK-windows-x86_64.zip ./TaystJK-windows-x86_64-Release-Non-Portable/*
mv ./TaystJK-linux-x86-Release-Non-Portable/* ./TaystJK-linux-x86.tar.gz
mv ./TaystJK-linux-x86_64-Release-Non-Portable/* ./TaystJK-linux-x86_64.tar.gz
mv ./TaystJK-macos-x86_64-Release-Non-Portable/* ./TaystJK-macos-x86_64.tar.gz
mv ./TaystJK-macos-arm64-Release-Non-Portable/* ./TaystJK-macos-arm64.tar.gz
- name: Create latest build
uses: softprops/action-gh-release@v1
Expand All @@ -271,7 +339,7 @@ jobs:
create-prerelease:
if: github.event_name == 'push' && github.ref == 'refs/heads/beta'
needs: [msvc, ubuntu, macos]
needs: [msvc, ubuntu, macos, macos-m1]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
Expand All @@ -283,11 +351,12 @@ jobs:

- name: Create binary archives
run: |
7z a -r TaystJK-windows-x86.zip ./TaystJK-windows-x86-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*'
7z a -r TaystJK-windows-x86_64.zip ./TaystJK-windows-x86_64-Release-Non-Portable/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*'
7z a -r TaystJK-windows-x86.zip ./TaystJK-windows-x86-Release-Non-Portable/*
7z a -r TaystJK-windows-x86_64.zip ./TaystJK-windows-x86_64-Release-Non-Portable/*
mv ./TaystJK-linux-x86-Release-Non-Portable/* ./TaystJK-linux-x86.tar.gz
mv ./TaystJK-linux-x86_64-Release-Non-Portable/* ./TaystJK-linux-x86_64.tar.gz
mv ./TaystJK-macos-x86_64-Release-Non-Portable/* ./TaystJK-macos-x86_64.tar.gz
mv ./TaystJK-macos-arm64-Release-Non-Portable/* ./TaystJK-macos-arm64.tar.gz
- name: Create latest beta build
uses: softprops/action-gh-release@v1
Expand Down Expand Up @@ -329,6 +398,10 @@ jobs:
artifact_name: TaystJK-macos-x86_64.tar.gz
zip: false

- artifact_dir: TaystJK-macos-arm64-Release-Non-Portable
artifact_name: TaystJK-macos-arm64.tar.gz
zip: false

steps:
- uses: actions/checkout@v4
with:
Expand All @@ -340,7 +413,7 @@ jobs:
- name: Create archive
run: |
if [ "${{ matrix.zip }}" == "true" ]; then
7z a -r ${{ matrix.artifact_name }} ./${{ matrix.artifact_dir }}/* '-x!msvcp*.*' '-x!vcruntime*.*' '-x!concrt*.*'
7z a -r ${{ matrix.artifact_name }} ./${{ matrix.artifact_dir }}/*
else
mv ./${{ matrix.artifact_dir }}/* ${{ matrix.artifact_name }}
fi
Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#============================================================================

cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.10)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version")

set(InOpenJK ON)
Expand Down Expand Up @@ -112,6 +112,7 @@ else()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)$")
set(Architecture "arm64")
add_definitions(-DPNG_ARM_NEON_OPT=0)
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum OS X deployment version")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
set(Architecture "arm")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
Expand Down Expand Up @@ -257,6 +258,10 @@ elseif (("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" M
# enable support for multithreading
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")

if(CMAKE_SYSTEM_NAME MATCHES "BSD")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcommon")
endif()

if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-comment")
Expand Down
6 changes: 3 additions & 3 deletions codemp/botlib/l_script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ int PS_ReadWhiteSpace(script_t *script)
//============================================================================
int PS_ReadEscapeCharacter(script_t *script, char *ch)
{
int c, val, i;
int c, val; //, i;

//step over the leading '\\'
script->script_p++;
Expand All @@ -386,7 +386,7 @@ int PS_ReadEscapeCharacter(script_t *script, char *ch)
case 'x':
{
script->script_p++;
for (i = 0, val = 0; ; i++, script->script_p++)
for (val = 0; ; script->script_p++)
{
c = *script->script_p;
if (c >= '0' && c <= '9') c = c - '0';
Expand All @@ -407,7 +407,7 @@ int PS_ReadEscapeCharacter(script_t *script, char *ch)
default: //NOTE: decimal ASCII code, NOT octal
{
if (*script->script_p < '0' || *script->script_p > '9') ScriptError(script, "unknown escape char");
for (i = 0, val = 0; ; i++, script->script_p++)
for (val = 0; ; script->script_p++)
{
c = *script->script_p;
if (c >= '0' && c <= '9') c = c - '0';
Expand Down
6 changes: 3 additions & 3 deletions codemp/cgame/cg_players.c
Original file line number Diff line number Diff line change
Expand Up @@ -7979,7 +7979,7 @@ void CG_AddSaberBlade( centity_t *cent, centity_t *scent, refEntity_t *saber, in
// SFX Saber trail
saberTrail->duration = 0;

if (!saberTrail->base || !saberTrail->tip || !saberTrail->dualbase || !saberTrail->dualtip || !saberTrail->lastTime || !saberTrail->inAction) {
if (!saberTrail->lastTime || !saberTrail->inAction) {
VectorCopy(org_, saberTrail->base);
VectorMA(end, -1.5f, axis_[0], saberTrail->tip);
VectorCopy(saberTrail->base, saberTrail->dualbase);
Expand Down Expand Up @@ -10100,7 +10100,7 @@ void CG_CheckThirdPersonAlpha( centity_t *cent, refEntity_t *legs )
//[Kameleon] - Nerevar's Santa Hat feature. call somewhere in cg_players@void CG_Player
void CG_DrawCosmeticOnPlayer(centity_t* cent, int time, qhandle_t* gameModels, qhandle_t hatModel, refEntity_t parent, int position)
{
int newBolt;
int newBolt = 0;
mdxaBone_t matrix;
vec3_t boltOrg, bAngles;
refEntity_t re;
Expand Down Expand Up @@ -10186,7 +10186,7 @@ void CG_DrawCosmeticOnPlayer(centity_t* cent, int time, qhandle_t* gameModels, q

static void CG_DrawCosmeticOnPlayer2(centity_t* cent, int time, qhandle_t* gameModels, cosmeticItem_t *cosmetic, refEntity_t parent, int position)
{
int newBolt;
int newBolt = 0;
mdxaBone_t matrix;
vec3_t boltOrg, bAngles;
refEntity_t re;
Expand Down
10 changes: 2 additions & 8 deletions codemp/client/cl_cgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ static void CL_UpdateDiscordServerInfo(const char *info)

static void CL_ParsePlayerInfo(int start, int end)
{
int clientCount = 0, botCount = 0, redTeam = 0, blueTeam = 0, specTeam = 0;
#if defined(DISCORD) && !defined(_DEBUG)
int clientCount = 0, botCount = 0, redTeam = 0, blueTeam = 0, specTeam = 0;
int i = start;

while (i < end)
Expand Down Expand Up @@ -266,13 +267,6 @@ static void CL_ParsePlayerInfo(int start, int end)
i++;
}

gCLTotalClientNum = clientCount;

#ifdef _DEBUG
Com_DPrintf("%i clients\n", gCLTotalClientNum);
#endif

#if defined(DISCORD) && !defined(_DEBUG)
cl.discord.playerCount = clientCount;
cl.discord.redTeam = redTeam;
cl.discord.blueTeam = blueTeam;
Expand Down
4 changes: 2 additions & 2 deletions codemp/client/cl_console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ void Cmd_CompleteTxtName( char *args, int argNum ) {
Con_Init
================
*/
static char version[MAX_STRING_CHARS] = { 0 };

void Con_Init (void) {
int i;

Expand Down Expand Up @@ -908,7 +908,7 @@ void Con_DrawSolidConsole( float frac ) {
time_t rawtime;
qboolean AM = qtrue;
char ts[24];
const int padding = (int) (0.5f + (con_scale && con_scale->value > 0.0f) ? 2*con_scale->value : 2.0f);
const int padding = (int)(0.5f + ((con_scale->value > 0.0f) ? (2.0f * con_scale->value) : 2.0f));

lines = (int) (cls.glconfig.vidHeight * frac);
if (lines <= 0)
Expand Down
8 changes: 4 additions & 4 deletions codemp/client/cl_discordrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,12 @@ void CL_DiscordUpdatePresence(void)
{ //send join information blank since it won't do anything in this case
discordPresence.partyId = PartyID(); // Server-IP zum abgleichen discordchat - send join request in discord chat
if (cl_discordRichPresence->integer > 1) {
discordPresence.partySize = cls.state == CA_ACTIVE ? 1 : NULL;
discordPresence.partyMax = cls.state == CA_ACTIVE ? ((cl.discord.maxPlayers - cl.discord.playerCount) + discordPresence.partySize) : NULL;
discordPresence.partySize = cls.state == CA_ACTIVE ? 1 : 0;
discordPresence.partyMax = cls.state == CA_ACTIVE ? ((cl.discord.maxPlayers - cl.discord.playerCount) + discordPresence.partySize) : 0;
}
else {
discordPresence.partySize = cls.state >= CA_LOADING ? cl.discord.playerCount : NULL;
discordPresence.partyMax = cls.state >= CA_LOADING ? cl.discord.maxPlayers : NULL;
discordPresence.partySize = cls.state >= CA_LOADING ? cl.discord.playerCount : 0;
discordPresence.partyMax = cls.state >= CA_LOADING ? cl.discord.maxPlayers : 0;
}
discordPresence.joinSecret = joinSecret(); // Server-IP zum discordJoin ausf�hren - serverip for discordjoin to execute
}
Expand Down
2 changes: 1 addition & 1 deletion codemp/client/cl_keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1647,7 +1647,7 @@ void CL_ParseBinding( int key, qboolean down, unsigned time )

// filter semicolons that aren't in quotes into magic chars, preserving semicolons that are in quotes
const char nonQuotedSemicolonMagicChar = '\x01';
bool inQuote = false;
// bool inQuote = false;
int quotes = 0;
while (*p) {
if (*p == '"') {
Expand Down
4 changes: 2 additions & 2 deletions codemp/client/cl_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,10 @@ typedef struct serverStatus_s
qboolean retrieved;
} serverStatus_t;

serverStatus_t cl_serverStatusList[MAX_SERVERSTATUSREQUESTS] = { 0 };
serverStatus_t cl_serverStatusList[MAX_SERVERSTATUSREQUESTS] = {{{0}}};
int serverStatusCount = 0;

IHeapAllocator *G2VertSpaceClient = 0;
IHeapAllocator *G2VertSpaceClient = nullptr;

extern void SV_BotFrame( int time );
void CL_CheckForResend( void );
Expand Down
2 changes: 1 addition & 1 deletion codemp/client/cl_tc_vis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static qboolean InPVS(const vec3_t p)
int cluster = CM_LeafCluster(leafnum);
int area = CM_LeafArea(leafnum);

if (g_pvsMask && (!g_pvsMask[cluster >> 3] & (1 << (cluster & 7))))
if (g_pvsMask && (!(g_pvsMask[cluster >> 3] & (1 << (cluster & 7)))))
return qfalse;
if (!CM_AreasConnected(g_pvsArea, area))
return qfalse;
Expand Down
4 changes: 2 additions & 2 deletions codemp/game/NPC_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ int NPC_FindNearestEnemy( gentity_t *ent )
int nearestEntID = -1;
float nearestDist = (float)WORLD_SIZE*(float)WORLD_SIZE;
float distance;
int numEnts, numChecks = 0;
int numEnts; //, numChecks = 0;
int i;

//Setup the bbox to search in
Expand All @@ -1298,7 +1298,7 @@ int NPC_FindNearestEnemy( gentity_t *ent )
if ( NPC_ValidEnemy( radEnt ) == qfalse )
continue;

numChecks++;
//numChecks++;
//Must be visible
if ( NPC_TargetVisible( radEnt ) == qfalse )
continue;
Expand Down
Loading

0 comments on commit cf5f509

Please sign in to comment.