Skip to content

Commit

Permalink
Merge branch 'master' into DrawSwipeCrashFix
Browse files Browse the repository at this point in the history
  • Loading branch information
walt253 authored Nov 14, 2024
2 parents 3bca0cd + 7f2a442 commit 430354d
Show file tree
Hide file tree
Showing 153 changed files with 5,323 additions and 8,373 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ res/keeperfx_icon.ico
/deps/spng
/deps/astronomy
/deps/centijson
/deps/ffmpeg
/deps/*.tar.gz
25 changes: 17 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,11 @@ obj/bflib_network.o \
obj/bflib_planar.o \
obj/bflib_render.o \
obj/bflib_render_gpoly.o \
obj/bflib_render_gtblock.o \
obj/bflib_render_trig.o \
obj/bflib_semphr.o \
obj/bflib_server_tcp.o \
obj/bflib_sndlib.o \
obj/bflib_sound.o \
obj/bflib_sprfnt.o \
obj/bflib_sprite.o \
obj/bflib_string.o \
obj/bflib_tcpsp.o \
obj/bflib_threadcond.o \
Expand Down Expand Up @@ -197,7 +194,6 @@ obj/engine_render.o \
obj/engine_render_data.o \
obj/engine_textures.o \
obj/front_credits.o \
obj/front_credits_data.o \
obj/front_easter.o \
obj/front_fmvids.o \
obj/front_highscore.o \
Expand Down Expand Up @@ -307,7 +303,6 @@ obj/steam_api.o \
obj/tasks_list.o \
obj/thing_corpses.o \
obj/thing_creature.o \
obj/thing_creature_data.o \
obj/thing_data.o \
obj/thing_doors.o \
obj/thing_effects.o \
Expand All @@ -324,6 +319,7 @@ obj/vidfade.o \
obj/vidmode_data.o \
obj/vidmode.o \
obj/KeeperSpeechImp.o \
obj/spritesheet.o \
$(FTEST_OBJS) \
$(RES)

Expand All @@ -347,12 +343,16 @@ CU_OBJS = \
# include and library directories
LINKLIB = -mwindows \
-L"sdl/lib" -lSDL2 -lSDL2_mixer -lSDL2_net -lSDL2_image \
-L"deps/ffmpeg/libavformat" -lavformat \
-L"deps/ffmpeg/libavcodec" -lavcodec \
-L"deps/ffmpeg/libswresample" -lswresample \
-L"deps/ffmpeg/libavutil" -lavutil \
-L"deps/astronomy" -lastronomy \
-L"deps/enet" -lenet \
-L"deps/spng" -lspng \
-L"deps/centijson" -ljson \
-L"deps/zlib" -lminizip -lz \
-lwinmm -lmingw32 -limagehlp -lws2_32 -ldbghelp
-lwinmm -lmingw32 -limagehlp -lws2_32 -ldbghelp -lbcrypt
INCS = \
-I"deps/zlib/include" \
-I"deps/spng/include" \
Expand All @@ -362,6 +362,7 @@ INCS = \
-I"deps/centijson/include" \
-I"deps/centitoml" \
-I"deps/astronomy/include" \
-I"deps/ffmpeg" \
-I"obj" # To find ver_defs.h
CXXINCS = $(INCS)

Expand Down Expand Up @@ -399,7 +400,7 @@ endif
STLOGFLAGS = -DBFDEBUG_LEVEL=0
HVLOGFLAGS = -DBFDEBUG_LEVEL=10
# compiler warning generation flags
WARNFLAGS = -Wall -W -Wshadow -Wno-sign-compare -Wno-unused-parameter -Wno-strict-aliasing -Wno-unknown-pragmas
WARNFLAGS = -Wall -W -Wshadow -Wno-sign-compare -Wno-unused-parameter -Wno-strict-aliasing -Wno-unknown-pragmas -Werror
# disabled warnings: -Wextra -Wtype-limits
CXXFLAGS = $(CXXINCS) -c -std=gnu++1y -fmessage-length=0 $(WARNFLAGS) $(DEPFLAGS) $(OPTFLAGS) $(DBGFLAGS) $(FTEST_DBGFLAGS) $(INCFLAGS)
CFLAGS = $(INCS) -c -std=gnu11 -fmessage-length=0 $(WARNFLAGS) -Werror=implicit $(DEPFLAGS) $(FTEST_DBGFLAGS) $(OPTFLAGS) $(DBGFLAGS) $(INCFLAGS)
Expand Down Expand Up @@ -585,7 +586,7 @@ clean-libexterns: libexterns.mk
-$(RM) -rf deps/enet deps/zlib deps/spng deps/astronomy deps/centijson
-$(RM) libexterns

deps/enet deps/zlib deps/spng deps/astronomy deps/centijson:
deps/enet deps/zlib deps/spng deps/astronomy deps/centijson deps/ffmpeg:
$(MKDIR) $@

src/api.c: deps/centijson/include/json.h
Expand All @@ -594,6 +595,8 @@ src/custom_sprites.c: deps/zlib/include/zlib.h deps/spng/include/spng.h deps/cen
src/moonphase.c: deps/astronomy/include/astronomy.h
deps/centitoml/toml_api.c: deps/centijson/include/json.h
deps/centitoml/toml_conv.c: deps/centijson/include/json.h
src/bflib_fmvids.cpp: deps/ffmpeg/libavformat/avformat.h
obj/std/bflib_fmvids.o obj/hvlog/bflib_fmvids.o: CXXFLAGS += -Wno-error=deprecated-declarations

deps/enet-mingw32.tar.gz:
curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/initial/enet-mingw32.tar.gz"
Expand Down Expand Up @@ -625,6 +628,12 @@ deps/centijson-mingw32.tar.gz:
deps/centijson/include/json.h: deps/centijson-mingw32.tar.gz | deps/centijson
tar xzmf $< -C deps/centijson

deps/ffmpeg-mingw32.tar.gz:
curl -Lso $@ "https://github.com/dkfans/kfx-deps/releases/download/initial/ffmpeg-mingw32.tar.gz"

deps/ffmpeg/libavformat/avformat.h: deps/ffmpeg-mingw32.tar.gz | deps/ffmpeg
tar xzmf $< -C deps/ffmpeg

include tool_png2ico.mk
include tool_pngpal2raw.mk
include tool_png2bestpal.mk
Expand Down
2 changes: 1 addition & 1 deletion config/creatrs/imp.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ GrowUp = 0 NULL 0
; It is enough if one slab of given type exists anywhere next to the room slab, and all creatures inside get the bonus.
; The formula is 256 for 1 experience point every game turns while sleeping. See terrain.cfg for a list of slab names.
SleepExperience = HARD 0
; Determines the multiplier for BaseExperienceGain defined in magic.cfg for shots.
; Sets the multiplier for BaseExperienceGain defined in magic.cfg for shots. This value is applied for other creatures when they attack this creature kind.
ExperienceForHitting = 1
; Level at which the creature gains the ability to resurrect, at one lower xp level.
; Setting this parameter to 1 makes the creature "immortal" as long as it has a lair. 0 disable this ability.
Expand Down
8 changes: 2 additions & 6 deletions keeperfx_vs2010.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,11 @@
<ClCompile Include="src\bflib_planar.c" />
<ClCompile Include="src\bflib_render.c" />
<ClCompile Include="src\bflib_render_gpoly.c" />
<ClCompile Include="src\bflib_render_gtblock.c" />
<ClCompile Include="src\bflib_render_trig.c" />
<ClCompile Include="src\bflib_semphr.cpp" />
<ClCompile Include="src\bflib_server_tcp.cpp" />
<ClCompile Include="src\bflib_sndlib.c" />
<ClCompile Include="src\bflib_sound.c" />
<ClCompile Include="src\bflib_sprfnt.c" />
<ClCompile Include="src\bflib_sprite.c" />
<ClCompile Include="src\bflib_string.c" />
<ClCompile Include="src\bflib_tcpsp.c" />
<ClCompile Include="src\bflib_threadcond.cpp" />
Expand Down Expand Up @@ -147,7 +144,6 @@
<ClCompile Include="src\frontmenu_select_data.cpp" />
<ClCompile Include="src\frontmenu_specials.c" />
<ClCompile Include="src\front_credits.c" />
<ClCompile Include="src\front_credits_data.cpp" />
<ClCompile Include="src\front_easter.c" />
<ClCompile Include="src\front_fmvids.c" />
<ClCompile Include="src\front_highscore.c" />
Expand Down Expand Up @@ -236,11 +232,11 @@
<ClCompile Include="src\slab_data.c" />
<ClCompile Include="src\sounds.c" />
<ClCompile Include="src\spdigger_stack.c" />
<ClCompile Include="src\spritesheet.cpp" />
<ClCompile Include="src\steam_api.cpp" />
<ClCompile Include="src\tasks_list.c" />
<ClCompile Include="src\thing_corpses.c" />
<ClCompile Include="src\thing_creature.c" />
<ClCompile Include="src\thing_creature_data.cpp" />
<ClCompile Include="src\thing_data.c" />
<ClCompile Include="src\thing_doors.c" />
<ClCompile Include="src\thing_effects.c" />
Expand Down Expand Up @@ -301,7 +297,6 @@
<ClInclude Include="src\bflib_network.h" />
<ClInclude Include="src\bflib_planar.h" />
<ClInclude Include="src\bflib_render.h" />
<ClInclude Include="src\bflib_semphr.hpp" />
<ClInclude Include="src\bflib_server_tcp.hpp" />
<ClInclude Include="src\bflib_sndlib.h" />
<ClInclude Include="src\bflib_sound.h" />
Expand Down Expand Up @@ -428,6 +423,7 @@
<ClInclude Include="src\map_utils.h" />
<ClInclude Include="src\moonphase.h" />
<ClInclude Include="src\music_player.h" />
<ClInclude Include="src\mutex.hpp" />
<ClInclude Include="src\net_game.h" />
<ClInclude Include="src\net_sync.h" />
<ClInclude Include="src\packets.h" />
Expand Down
24 changes: 6 additions & 18 deletions keeperfx_vs2010.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@
<ClCompile Include="src\bflib_render_gpoly.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\bflib_render_gtblock.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\bflib_render_trig.c">
<Filter>Source Files</Filter>
</ClCompile>
Expand All @@ -114,9 +111,6 @@
<ClCompile Include="src\bflib_sprfnt.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\bflib_sprite.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\bflib_string.c">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -603,9 +597,6 @@
<ClCompile Include="src\bflib_network.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\bflib_semphr.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\bflib_server_tcp.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand All @@ -615,9 +606,6 @@
<ClCompile Include="src\config_magic_data.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\front_credits_data.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\front_lvlstats_data.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -660,9 +648,6 @@
<ClCompile Include="src\player_computer_data.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\thing_creature_data.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\vidmode_data.cpp">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down Expand Up @@ -747,6 +732,9 @@
<ClCompile Include="src\bflib_enet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\spritesheet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\actionpt.h">
Expand Down Expand Up @@ -872,9 +860,6 @@
<ClInclude Include="src\bflib_render.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\bflib_semphr.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\bflib_server_tcp.hpp">
<Filter>Header Files</Filter>
</ClInclude>
Expand Down Expand Up @@ -1406,6 +1391,9 @@
<ClInclude Include="src\bflib_enet.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\mutex.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="Makefile" />
Expand Down
2 changes: 1 addition & 1 deletion src/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ int api_init_server()
}
else
{
JUSTLOG("API server starting on port: %ld", api_port);
JUSTLOG("API server starting on port: %u", api_port);
}

if (SDLNet_Init() < 0)
Expand Down
29 changes: 18 additions & 11 deletions src/ariadne.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ static void edge_points8(long ntri_src, long ntri_dst, long *tipA_x, long *tipA_
}
else
{
ERRORLOG("edge not found %d->%d", ntri_src, ntri_dst);
ERRORLOG("edge not found %ld->%ld", ntri_src, ntri_dst);
}
}

Expand Down Expand Up @@ -580,7 +580,7 @@ long route_to_path(long ptfind_x, long ptfind_y, long ptstart_x, long ptstart_y,
if (reg2 == -1)
{
if (wp_num == ARID_PATH_WAYPOINTS_COUNT) {
ERRORLOG("Exceeded max path length (i:%d,L:%d) (%d,%d)->(%d,%d)",
ERRORLOG("Exceeded max path length (i:%ld,L:%ld) (%ld,%ld)->(%ld,%ld)",
wpi, wp_lim, ptfind_x, ptfind_y, ptstart_x, ptstart_y);
}
*total_len += LbSqrL((fov_AC.tipB.x - fov_AC.tipA.x) * (fov_AC.tipB.x - fov_AC.tipA.x)
Expand All @@ -599,7 +599,7 @@ long route_to_path(long ptfind_x, long ptfind_y, long ptstart_x, long ptstart_y,
if (reg1 == 1)
{
if (wp_num == ARID_PATH_WAYPOINTS_COUNT) {
ERRORLOG("Exceeded max path length (i:%d,R:%d) (%d,%d)->(%d,%d)",
ERRORLOG("Exceeded max path length (i:%ld,R:%ld) (%ld,%ld)->(%ld,%ld)",
wpi, wp_lim, ptfind_x, ptfind_y, ptstart_x, ptstart_y);
}
*total_len += LbSqrL((fov_AC.tipC.x - fov_AC.tipA.x) * (fov_AC.tipC.x - fov_AC.tipA.x)
Expand Down Expand Up @@ -1092,7 +1092,7 @@ long gate_route_to_coords(long trAx, long trAy, long trBx, long trBy, long *a5,
if ( reg1 || reg2 || reg3 || reg4 )
{
if (pt_num == 256) {
ERRORLOG("grtc:Exceeded max path length (i:%d,rl:%d)", wpi, a6);
ERRORLOG("grtc:Exceeded max path length (i:%d,rl:%ld)", wpi, a6);
}
gt->field_0 = fov1.tipB.x;
gt->field_4 = fov1.tipB.y;
Expand Down Expand Up @@ -1220,7 +1220,7 @@ long gate_route_to_coords(long trAx, long trAy, long trBx, long trBy, long *a5,
fov1.tipC.y = edge_y2;
}
if (pt_num == 256) {
ERRORLOG("grtc:Exceeded max path length (i:%d,rl:%d)", wpi, a6);
ERRORLOG("grtc:Exceeded max path length (i:%d,rl:%ld)", wpi, a6);
}
pt_num++;
gt->field_8 = trBx;
Expand Down Expand Up @@ -1351,7 +1351,7 @@ void tag_open_closed_init(void)

unsigned long nav_same_component(long ptAx, long ptAy, long ptBx, long ptBy)
{
NAVIDBG(19,"F=%d Connect %03d,%03d %03d,%03d", game.play_gameturn, ptAx, ptAy, ptBx, ptBy);
NAVIDBG(19,"F=%lu Connect %03ld,%03ld %03ld,%03ld", game.play_gameturn, ptAx, ptAy, ptBx, ptBy);
long tri1_id;
long tri2_id;
tri1_id = triangle_findSE8(ptAx, ptAy);
Expand Down Expand Up @@ -3396,7 +3396,7 @@ void path_init8_wide_f(struct Path *path, long start_x, long start_y, long end_x
if (subroute == -2)
{
tree_routelen = ma_triangle_route(tree_triA, tree_triB, &tree_routecost);
NAVIDBG(19,"%s: route=%d", func_name, tree_routelen);
NAVIDBG(19,"%s: route=%ld", func_name, tree_routelen);
if (tree_routelen != -1)
{
path->waypoints_num = route_to_path(start_x, start_y, end_x, end_y, tree_route, tree_routelen, path, &route_dist);
Expand All @@ -3408,10 +3408,17 @@ void path_init8_wide_f(struct Path *path, long start_x, long start_y, long end_x
route_through_gates(&ap_GPathway, path, subroute);
}
if (path->waypoints_num > 0) {
NAVIDBG(9,"%s: Finished with %3ld waypoints, start: (%d,%d), (%d,%d), (%d,%d), (%d,%d), (%d,%d), (%d,%d), (%d,%d), (%d,%d)", func_name,(long)path->waypoints_num,
(int)path->waypoints[0].x,(int)path->waypoints[0].y,(int)path->waypoints[1].x,(int)path->waypoints[1].y,(int)path->waypoints[2].x,(int)path->waypoints[2].y,
(int)path->waypoints[3].x,(int)path->waypoints[3].y,(int)path->waypoints[4].x,(int)path->waypoints[4].y,(int)path->waypoints[5].x,(int)path->waypoints[5].y,
(int)path->waypoints[6].x,(int)path->waypoints[6].y,(int)path->waypoints[7].x,(int)path->waypoints[7].y,(int)path->waypoints[8].x,(int)path->waypoints[8].y);
NAVIDBG(9,"%s: Finished with %3ld waypoints, start: (%d,%d), (%d,%d), (%d,%d), (%d,%d), (%d,%d), (%d,%d), (%d,%d), (%d,%d), (%d,%d)",
func_name,(long)path->waypoints_num,
(int)path->waypoints[0].x,(int)path->waypoints[0].y,
(int)path->waypoints[1].x,(int)path->waypoints[1].y,
(int)path->waypoints[2].x,(int)path->waypoints[2].y,
(int)path->waypoints[3].x,(int)path->waypoints[3].y,
(int)path->waypoints[4].x,(int)path->waypoints[4].y,
(int)path->waypoints[5].x,(int)path->waypoints[5].y,
(int)path->waypoints[6].x,(int)path->waypoints[6].y,
(int)path->waypoints[7].x,(int)path->waypoints[7].y,
(int)path->waypoints[8].x,(int)path->waypoints[8].y);
} else {
NAVIDBG(9,"%s: Finished with %3ld waypoints", func_name,(long)path->waypoints_num);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ariadne_tringls.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ long tri_new(void)
}
if (i > (TRIANLGLES_COUNT * 999 / 1000))
{
WARNLOG("TRIANGLES near limit: %d", i);
WARNLOG("TRIANGLES near limit: %ld", i);
}
ix_Triangles++;
} else
Expand Down
3 changes: 1 addition & 2 deletions src/bflib_basics.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ char *buf_sprintf(const char *format, ...)
va_list val;
va_start(val, format);
static char text[TEXT_BUFFER_LENGTH + 1];
vsprintf(text, format, val);
text[TEXT_BUFFER_LENGTH]='\0';
vsnprintf(text, sizeof(text), format, val);
va_end(val);
return text;
}
Expand Down
Loading

0 comments on commit 430354d

Please sign in to comment.