Skip to content

Commit

Permalink
Fix compass arrows not below objective (fixes #836)
Browse files Browse the repository at this point in the history
Also fix static missions with 0 exits
  • Loading branch information
cxong committed Mar 26, 2024
1 parent 7857576 commit 315c2ca
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
- name: Download DLLs on tags (Windows)
if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'windows-latest'
run: |
build/windows/get-sdl2-dlls.bat dll
build/windows/get-sdl2-dlls.bat dll 64
- name: Make package on tags
if: startsWith(github.ref, 'refs/tags/')
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ install:
- cd %APPVEYOR_BUILD_FOLDER%

before_build:
- .\build\windows\get-sdl2-dlls.bat dll "appveyor DownloadFile"
- .\build\windows\get-sdl2-dlls.bat dll 32 "appveyor DownloadFile"
- cmake -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 17 2022" -A Win32 .

build:
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ install:
- cd %APPVEYOR_BUILD_FOLDER%

before_build:
- .\build\windows\get-sdl2-dlls.bat dll "appveyor DownloadFile"
- .\build\windows\get-sdl2-dlls.bat dll 32 "appveyor DownloadFile"
- cmake -DCMAKE_TOOLCHAIN_FILE=c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 17 2022" -A Win32 .

build:
Expand Down
4 changes: 2 additions & 2 deletions src/cdogs/hud/player_hud.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,9 @@ static void DrawCompassArrow(
const struct vec2 compassV = svec2_subtract(
pos,
// Offset a little so the arrow points exactly at center of objective
svec2(playerPos.x - TILE_WIDTH / 2, playerPos.y - 20));
svec2(playerPos.x - TILE_WIDTH / 2, playerPos.y));
// Don't draw if objective is on screen
if (fabsf(compassV.x) < r.Size.x / 2 && fabsf(compassV.y) < r.Size.y / 2)
if (fabsf(compassV.x) < r.Size.x && fabsf(compassV.y) < r.Size.y)
{
return;
}
Expand Down
5 changes: 5 additions & 0 deletions src/cdogs/mission_static.c
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,11 @@ static void LoadStaticExit(
struct vec2i end;
LoadVec2i(&end, exitNode, "End");
exit.R.Size = svec2i_subtract(end, exit.R.Pos);
// Ignore empty exits
if (svec2i_is_zero(exit.R.Size))
{
return;
}
exit.Mission = mission + 1;
CArrayPushBack(&m->Exits, &exit);
}
Expand Down

0 comments on commit 315c2ca

Please sign in to comment.