fp: Add dev fast build, remove tely_ui
This commit is contained in:
parent
becc839b26
commit
27d55b36d4
2
External/tely
vendored
2
External/tely
vendored
@ -1 +1 @@
|
||||
Subproject commit bbfb1a80bf3ec43437c5ae3135e44c1dba86eac1
|
||||
Subproject commit a1e15e336b6d9eac5538392d2c473c7b740364d5
|
@ -19,7 +19,7 @@ copy feely_pona_build.exe %code_dir% 1>nul
|
||||
popd
|
||||
|
||||
REM Run the build program
|
||||
%code_dir%\feely_pona_build.exe %* || exit /B 1
|
||||
%code_dir%\feely_pona_build.exe --dev-fast-build %* || exit /B 1
|
||||
|
||||
popd
|
||||
exit /B 1
|
||||
|
@ -209,7 +209,7 @@ static void FP_PlayReset(FP_Game *game, TELY_Platform *platform)
|
||||
FP_Game_DeleteEntity(game, game->play.root_entity->handle);
|
||||
|
||||
Dqn_VArray<FP_GameEntity> shallow_entities_copy = play->entities;
|
||||
*play = {};
|
||||
DQN_MEMSET(play, 0, sizeof(*play));
|
||||
|
||||
play->chunk_pool = &platform->chunk_pool;
|
||||
play->meters_to_pixels = 65.416f;
|
||||
@ -4032,6 +4032,10 @@ static void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *ren
|
||||
if (platform->core.ram_mb)
|
||||
Dqn_Str8Builder_AppendF(&builder, " | RAM %.1fGB", platform->core.ram_mb / 1024.0);
|
||||
|
||||
DQN_MSVC_WARNING_PUSH
|
||||
DQN_MSVC_WARNING_DISABLE(6272 6271)
|
||||
// warning C6272: Non-float passed as argument '6' when float is required in call to 'Dqn_Str8Builder_AppendF' Actual type: 'unsigned __int64'.
|
||||
// warning C6271: Extra argument passed to 'Dqn_Str8Builder_AppendF'.
|
||||
Dqn_Str8Builder_AppendF(&builder,
|
||||
" | Work %04.1fms/f (%04.1f%%) | %05.1f FPS | Frame %'I64u | Timer %.1fs",
|
||||
input->work_ms,
|
||||
@ -4039,6 +4043,7 @@ static void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *ren
|
||||
1000.0 / input->delta_ms,
|
||||
input->frame_counter,
|
||||
input->timer_s);
|
||||
DQN_MSVC_WARNING_POP
|
||||
|
||||
Dqn_Str8 text = Dqn_Str8Builder_Build(&builder, scratch.allocator);
|
||||
TELY_RFui_TextBackgroundF(rfui, "%.*s", DQN_STR_FMT(text));
|
||||
@ -4127,6 +4132,8 @@ static void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *ren
|
||||
|
||||
{
|
||||
Dqn_ArenaInfo arena_info = Dqn_Arena_Info(&platform->arena);
|
||||
DQN_MSVC_WARNING_PUSH
|
||||
DQN_MSVC_WARNING_DISABLE(6271) // warning C6271: Extra argument passed to 'TELY_RFui_TextF'.
|
||||
TELY_RFui_TextF(rfui,
|
||||
"Platform Arena[%I64u]: %_$$d/%_$$d (HWM %_$$d, COMMIT %_$$d)",
|
||||
platform->arena.blocks,
|
||||
@ -4134,6 +4141,7 @@ static void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *ren
|
||||
arena_info.capacity,
|
||||
arena_info.used_hwm,
|
||||
arena_info.commit);
|
||||
DQN_MSVC_WARNING_POP
|
||||
next_y += TELY_Asset_GetFont(assets, TELY_RFui_ActiveFont(rfui))->pixel_height;
|
||||
}
|
||||
|
||||
@ -4142,6 +4150,9 @@ static void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *ren
|
||||
next_y += TELY_Asset_GetFont(assets, TELY_RFui_ActiveFont(rfui))->pixel_height;
|
||||
Dqn_Arena *arena = item->arena;
|
||||
Dqn_ArenaInfo arena_info = Dqn_Arena_Info(arena);
|
||||
|
||||
DQN_MSVC_WARNING_PUSH
|
||||
DQN_MSVC_WARNING_DISABLE(6271) // warning C6271: Extra argument passed to 'TELY_RFui_TextF'.
|
||||
TELY_RFui_TextF(rfui,
|
||||
"%.*s[%I64u]: %_$$d/%_$$d (HWM %_$$d, COMMIT %_$$d)",
|
||||
DQN_STR_FMT(arena->label),
|
||||
@ -4150,6 +4161,7 @@ static void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *ren
|
||||
arena_info.capacity,
|
||||
arena_info.used_hwm,
|
||||
arena_info.commit);
|
||||
DQN_MSVC_WARNING_POP
|
||||
}
|
||||
}
|
||||
|
||||
@ -4240,6 +4252,7 @@ void TELY_DLL_FrameUpdate(void *user_data)
|
||||
FP_GameCameraM2x3 const camera_xforms = FP_Game_CameraModelViewM2x3(game->play.camera);
|
||||
Dqn_V2 world_mouse_p = Dqn_M2x3_MulV2(camera_xforms.view_model, input->mouse_p);
|
||||
for (FP_GameEntityIterator it = {}; FP_Game_DFSPreOrderWalkEntityTree(game, &it, game->play.root_entity); ) {
|
||||
DQN_ASSERT(it.entity);
|
||||
FP_GameEntity *entity = it.entity;
|
||||
if (entity->local_hit_box_size.x <= 0 || entity->local_hit_box_size.y <= 0)
|
||||
continue;
|
||||
|
@ -87,6 +87,7 @@ int main(int argc, char const **argv)
|
||||
|
||||
bool dry_run = false;
|
||||
bool target_web = false;
|
||||
bool dev_fast_build = false;
|
||||
for (Dqn_usize arg_index = 1; arg_index < argc; arg_index++) {
|
||||
Dqn_Str8 arg = Dqn_Str8_InitCStr8(argv[arg_index]);
|
||||
if (arg == DQN_STR8("--help")) {
|
||||
@ -96,6 +97,8 @@ int main(int argc, char const **argv)
|
||||
dry_run = true;
|
||||
} else if (arg == DQN_STR8("--web")) {
|
||||
target_web = true;
|
||||
} else if (arg == DQN_STR8("--dev-fast-build")) {
|
||||
dev_fast_build = true;
|
||||
} else {
|
||||
PRINT_HELP;
|
||||
return 0;
|
||||
@ -275,22 +278,9 @@ int main(int argc, char const **argv)
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: Feely Pona No DLL =====================================================================
|
||||
uint64_t feely_pona_no_dll_timings[2] = {};
|
||||
Dqn_CPPBuildContext feely_pona_no_dll_build_context = {};
|
||||
// NOTE: Feely Pona Link Flags =================================================================
|
||||
Dqn_Slice<Dqn_Str8> feely_pona_platform_link_flags = {};
|
||||
{
|
||||
feely_pona_no_dll_timings[0] = Dqn_OS_PerfCounterNow();
|
||||
DQN_DEFER { feely_pona_no_dll_timings[1] = Dqn_OS_PerfCounterNow(); };
|
||||
|
||||
Dqn_CPPBuildCompileFile build_file = {};
|
||||
build_file.input_file_path = Dqn_FsPath_ConvertF(scratch.arena, "%.*s/feely_pona_unity_nodll.h", DQN_STR_FMT(code_dir));
|
||||
build_file.flags = Dqn_Slice_InitCArrayCopy(scratch.arena, {DQN_STR8("/Tp")});
|
||||
feely_pona_no_dll_build_context.compiler = Dqn_CPPBuildCompiler_MSVC;
|
||||
feely_pona_no_dll_build_context.compile_files = Dqn_Slice_InitCArrayCopy(scratch.arena, {build_file});
|
||||
feely_pona_no_dll_build_context.include_dirs = Dqn_Slice_InitCArrayCopy(scratch.arena, {raylib_dir});
|
||||
feely_pona_no_dll_build_context.compile_flags = common_compile_flags;
|
||||
feely_pona_no_dll_build_context.build_dir = build_dir;
|
||||
|
||||
// NOTE: Link to raylib object files and windows libs ======================================
|
||||
Dqn_List<Dqn_Str8> link_flags = Dqn_List_InitSliceCopy(scratch.arena, 128, common_link_flags);
|
||||
{
|
||||
@ -302,7 +292,26 @@ int main(int argc, char const **argv)
|
||||
Dqn_List_Add(&link_flags, DQN_STR8("user32.lib"));
|
||||
Dqn_List_Add(&link_flags, DQN_STR8("shell32.lib"));
|
||||
}
|
||||
feely_pona_no_dll_build_context.link_flags = Dqn_List_ToSliceCopy(&link_flags, scratch.arena);
|
||||
feely_pona_platform_link_flags = Dqn_List_ToSliceCopy(&link_flags, scratch.arena);
|
||||
}
|
||||
|
||||
// NOTE: Feely Pona No DLL =====================================================================
|
||||
uint64_t feely_pona_no_dll_timings[2] = {};
|
||||
if (!dev_fast_build) {
|
||||
feely_pona_no_dll_timings[0] = Dqn_OS_PerfCounterNow();
|
||||
DQN_DEFER { feely_pona_no_dll_timings[1] = Dqn_OS_PerfCounterNow(); };
|
||||
|
||||
Dqn_CPPBuildCompileFile build_file = {};
|
||||
build_file.input_file_path = Dqn_FsPath_ConvertF(scratch.arena, "%.*s/feely_pona_unity_nodll.h", DQN_STR_FMT(code_dir));
|
||||
build_file.flags = Dqn_Slice_InitCArrayCopy(scratch.arena, {DQN_STR8("/Tp")});
|
||||
|
||||
Dqn_CPPBuildContext feely_pona_no_dll_build_context = {};
|
||||
feely_pona_no_dll_build_context.compiler = Dqn_CPPBuildCompiler_MSVC;
|
||||
feely_pona_no_dll_build_context.compile_files = Dqn_Slice_InitCArrayCopy(scratch.arena, {build_file});
|
||||
feely_pona_no_dll_build_context.include_dirs = Dqn_Slice_InitCArrayCopy(scratch.arena, {raylib_dir});
|
||||
feely_pona_no_dll_build_context.compile_flags = common_compile_flags;
|
||||
feely_pona_no_dll_build_context.build_dir = build_dir;
|
||||
feely_pona_no_dll_build_context.link_flags = feely_pona_platform_link_flags;
|
||||
|
||||
if (dry_run) {
|
||||
Dqn_Str8 cmd = Dqn_CPPBuild_ToCommandLine(feely_pona_no_dll_build_context, Dqn_CPPBuildMode_AlwaysRebuild, scratch.allocator);
|
||||
@ -325,13 +334,14 @@ int main(int argc, char const **argv)
|
||||
|
||||
Dqn_List<Dqn_Str8> compile_flags = Dqn_List_InitSliceCopy(scratch.arena, 128, common_compile_flags);
|
||||
Dqn_List_Add(&compile_flags, DQN_STR8("/LD"));
|
||||
Dqn_List_Add(&compile_flags, DQN_STR8("/analyze"));
|
||||
Dqn_List_Add(&compile_flags, DQN_STR8("/Fetely_dll_msvc"));
|
||||
|
||||
Dqn_CPPBuildContext build_context = {};
|
||||
build_context.compiler = Dqn_CPPBuildCompiler_MSVC;
|
||||
build_context.compile_files = Dqn_Slice_InitCArrayCopy(scratch.arena, {build_file});
|
||||
build_context.compile_flags = Dqn_List_ToSliceCopy(&compile_flags, scratch.arena);
|
||||
build_context.link_flags = feely_pona_no_dll_build_context.link_flags;
|
||||
build_context.link_flags = {};
|
||||
build_context.build_dir = build_dir;
|
||||
|
||||
if (dry_run) {
|
||||
@ -360,7 +370,7 @@ int main(int argc, char const **argv)
|
||||
build_context.compiler = Dqn_CPPBuildCompiler_MSVC;
|
||||
build_context.compile_files = Dqn_Slice_InitCArrayCopy(scratch.arena, {build_file});
|
||||
build_context.compile_flags = Dqn_List_ToSliceCopy(&compile_flags, scratch.arena);
|
||||
build_context.link_flags = feely_pona_no_dll_build_context.link_flags;
|
||||
build_context.link_flags = feely_pona_platform_link_flags;
|
||||
build_context.build_dir = build_dir;
|
||||
build_context.include_dirs = Dqn_Slice_InitCArrayCopy(scratch.arena, {raylib_dir});
|
||||
|
||||
@ -573,7 +583,6 @@ int main(int argc, char const **argv)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
build_timings[1] = Dqn_OS_PerfCounterNow();
|
||||
Dqn_Print_StdLnF(Dqn_PrintStd_Out, "\n-- Dqn_CPPBuild Timings (%.2fms)", Dqn_OS_PerfCounterMs(build_timings[0], build_timings[1]));
|
||||
Dqn_Print_StdLnF(Dqn_PrintStd_Out, " robocopy: %.2fms", Dqn_OS_PerfCounterMs(robocopy_timings[0], robocopy_timings[1]));
|
||||
|
@ -96,6 +96,9 @@ static bool FP_Game_DFSPreOrderWalkEntityTree(FP_Game *game, FP_GameEntityIterat
|
||||
it->entity_first_child = it->entity->first_child;
|
||||
}
|
||||
|
||||
if (!it->entity)
|
||||
return false;
|
||||
|
||||
if (it->entity_first_child) {
|
||||
it->entity = it->entity_first_child;
|
||||
it->entity_parent = it->entity->parent;
|
||||
@ -141,6 +144,9 @@ static bool FP_Game_DFSPostOrderWalkEntityTree(FP_Game *game, FP_GameEntityItera
|
||||
it->entity_first_child = it->entity->first_child;
|
||||
}
|
||||
|
||||
if (!it->entity)
|
||||
return false;
|
||||
|
||||
// NOTE: Descend to deepest leaf node
|
||||
if (it->entity_first_child && !ascending_tree) {
|
||||
while (it->entity_first_child) {
|
||||
@ -389,6 +395,7 @@ static void FP_Game_DeleteEntity(FP_Game *game, FP_GameEntityHandle handle)
|
||||
// NOTE: The iterator snaps a copy of all the internal n-ary tree pointers
|
||||
// so as we delete we do not accidentally invalidate any of the pointers.
|
||||
for (FP_GameEntityIterator it = {}; FP_Game_DFSPostOrderWalkEntityTree(game, &it, root); ) {
|
||||
DQN_ASSERT(it.entity);
|
||||
DQN_ASSERT(it.entity != root);
|
||||
FP_GameEntity *entity = it.entity;
|
||||
FP_Game_DetachEntityIntoFreeList(game, entity->handle);
|
||||
@ -541,185 +548,6 @@ static Dqn_V2 FP_Game_TilePosToWorldPos(FP_Game *game, Dqn_V2I tile_pos)
|
||||
return result;
|
||||
}
|
||||
|
||||
static Dqn_Slice<Dqn_V2I> FP_Game_AStarPathFind(FP_Game *game,
|
||||
Dqn_Arena *arena,
|
||||
TELY_Platform *platform,
|
||||
FP_GameEntityHandle entity,
|
||||
Dqn_V2I dest_tile)
|
||||
{
|
||||
Dqn_Profiler_ZoneScopeWithIndex("FP_Update: A*", FP_ProfileZone_FPUpdate_AStar);
|
||||
Dqn_usize tile_count_x = DQN_CAST(Dqn_usize)(platform->core.window_size.w / game->play.tile_size);
|
||||
Dqn_usize tile_count_y = DQN_CAST(Dqn_usize)(platform->core.window_size.h / game->play.tile_size);
|
||||
|
||||
Dqn_Slice<Dqn_V2I> result = {};
|
||||
if (dest_tile.x < 0 || dest_tile.x > tile_count_x ||
|
||||
dest_tile.y < 0 || dest_tile.y > tile_count_y)
|
||||
return result;
|
||||
|
||||
Dqn_DSMap<FP_GameAStarNode> astar_info = Dqn_DSMap_Init<FP_GameAStarNode>(128);
|
||||
DQN_DEFER { Dqn_DSMap_Deinit(&astar_info); };
|
||||
|
||||
// NOTE: Enumerate the entities that are collidable ============================================
|
||||
bool dest_tile_is_non_traversable = false;
|
||||
auto zone_enum_collidables = Dqn_Profiler_BeginZoneWithIndex(DQN_STR8("FP_Update: A* enumerate collidables"), FP_ProfileZone_FPUpdate_AStarEnumerateCollidables);
|
||||
for (FP_GameEntityIterator it = {}; FP_Game_DFSPreOrderWalkEntityTree(game, &it, game->play.root_entity); ) {
|
||||
FP_GameEntity const *walk_entity = it.entity;
|
||||
if (entity == walk_entity->handle)
|
||||
continue;
|
||||
|
||||
if ((walk_entity->flags & FP_GameEntityFlag_NonTraversable) == 0)
|
||||
continue;
|
||||
|
||||
// NOTE: Mark tiles that the entity is on as non-traversable
|
||||
Dqn_Rect bounding_box = FP_Game_CalcEntityWorldBoundingBox(game, walk_entity->handle);
|
||||
Dqn_RectMinMax min_max = Dqn_Rect_MinMax(bounding_box);
|
||||
Dqn_V2I min_tile = FP_Game_WorldPosToTilePos(game, min_max.min);
|
||||
Dqn_V2I max_tile = FP_Game_WorldPosToTilePos(game, min_max.max);
|
||||
|
||||
for (int32_t y = min_tile.y; y < max_tile.y; y++) {
|
||||
for (int32_t x = min_tile.x; x < max_tile.x; x++) {
|
||||
uint64_t tile_u64 = (DQN_CAST(uint64_t)y << 32) | (DQN_CAST(uint64_t)x << 0);
|
||||
FP_GameAStarNode *node = Dqn_DSMap_MakeKeyU64(&astar_info, tile_u64).value;
|
||||
node->non_traversable = true;
|
||||
node->tile = Dqn_V2I_InitNx2(x, y);
|
||||
|
||||
if (node->tile == dest_tile)
|
||||
dest_tile_is_non_traversable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Dqn_Profiler_EndZone(zone_enum_collidables);
|
||||
|
||||
// NOTE: Setup A* state ========================================================================
|
||||
Dqn_V2 entity_world_pos = FP_Game_CalcEntityWorldPos(game, entity);
|
||||
Dqn_V2I src_tile = FP_Game_WorldPosToTilePos(game, entity_world_pos);
|
||||
|
||||
Dqn_FArray<Dqn_V2I, 128> frontier = {};
|
||||
Dqn_FArray_Add(&frontier, src_tile);
|
||||
|
||||
// NOTE: Initialise the starting cost
|
||||
uint64_t src_tile_u64 = (DQN_CAST(uint64_t)src_tile.y << 32) | (DQN_CAST(uint64_t)src_tile.x << 0);
|
||||
Dqn_DSMap_MakeKeyU64(&astar_info, src_tile_u64).value->tile = src_tile;
|
||||
|
||||
// NOTE: Do the A* process =====================================================================
|
||||
Dqn_usize last_successful_manhattan_dist = DQN_USIZE_MAX;
|
||||
Dqn_V2I last_successful_tile = src_tile;
|
||||
|
||||
auto zone_astar_expand = Dqn_Profiler_BeginZoneWithIndex(DQN_STR8("FP_Update: A* expand"), FP_ProfileZone_FPUpdate_AStarExpand);
|
||||
while (frontier.size) {
|
||||
Dqn_Profiler_ZoneScopeWithIndex("FP_Update: A* neighbours", FP_ProfileZone_FPUpdate_AStarExploreNeighbours);
|
||||
Dqn_V2I curr_tile = Dqn_FArray_PopFront(&frontier, 1);
|
||||
if (curr_tile == dest_tile)
|
||||
break;
|
||||
|
||||
Dqn_FArray<Dqn_V2I, 4> neighbours = {};
|
||||
{
|
||||
Dqn_V2I left = Dqn_V2I_InitNx2(curr_tile.x - 1, curr_tile.y);
|
||||
Dqn_V2I right = Dqn_V2I_InitNx2(curr_tile.x + 1, curr_tile.y);
|
||||
Dqn_V2I top = Dqn_V2I_InitNx2(curr_tile.x, curr_tile.y - 1);
|
||||
Dqn_V2I bottom = Dqn_V2I_InitNx2(curr_tile.x, curr_tile.y + 1);
|
||||
|
||||
if (left.x >= 0)
|
||||
Dqn_FArray_Add(&neighbours, left);
|
||||
if (right.x <= tile_count_x)
|
||||
Dqn_FArray_Add(&neighbours, right);
|
||||
if (top.y >= 0)
|
||||
Dqn_FArray_Add(&neighbours, top);
|
||||
if (bottom.y <= tile_count_y)
|
||||
Dqn_FArray_Add(&neighbours, bottom);
|
||||
}
|
||||
|
||||
uint64_t const curr_tile_u64 = (DQN_CAST(uint64_t)curr_tile.y << 32) | (DQN_CAST(uint64_t)curr_tile.x << 0);
|
||||
Dqn_usize const curr_cost = Dqn_DSMap_FindKeyU64(&astar_info, curr_tile_u64).value->cost;
|
||||
for (Dqn_V2I next_tile : neighbours) {
|
||||
|
||||
// NOTE: Calculate cost to move to this neighbouring tile.
|
||||
Dqn_usize new_cost = curr_cost + 1;
|
||||
uint64_t next_tile_u64 = (DQN_CAST(uint64_t)next_tile.y << 32) | (DQN_CAST(uint64_t)next_tile.x << 0);
|
||||
Dqn_DSMapResult<FP_GameAStarNode> next_cost_result = Dqn_DSMap_MakeKeyU64(&astar_info, next_tile_u64);
|
||||
next_cost_result.value->tile = next_tile;
|
||||
|
||||
// NOTE: We got as close as possible, we know it's impossible to
|
||||
// reach, we will stop here.
|
||||
// TODO(doyle): Doesn't work in the general case, what if there's a
|
||||
// 2 consecutive blocks that are not traversable, we will never
|
||||
// realise that
|
||||
if (dest_tile == next_tile && dest_tile_is_non_traversable) {
|
||||
Dqn_FArray_Clear(&frontier);
|
||||
break;
|
||||
}
|
||||
|
||||
if (next_cost_result.value->non_traversable)
|
||||
continue;
|
||||
|
||||
// NOTE: If we have already visited this node before, we only keep the cost if it's cheaper
|
||||
if (next_cost_result.found && new_cost >= next_cost_result.value->cost)
|
||||
continue;
|
||||
|
||||
// NOTE: Update the node cost value and the heuristic (estimated cost to the end)
|
||||
Dqn_usize manhattan_dist = DQN_ABS(dest_tile.x - next_tile.x) + DQN_ABS(dest_tile.y - next_tile.y);
|
||||
next_cost_result.value->cost = new_cost;
|
||||
next_cost_result.value->came_from = curr_tile;
|
||||
next_cost_result.value->heuristic = new_cost + manhattan_dist;
|
||||
|
||||
// NOTE: Store the last node we visited that had the best cost.
|
||||
// We may end up with a partial path find that could only get
|
||||
// part-way to the solution which this variable will track for us.
|
||||
if (manhattan_dist < last_successful_manhattan_dist) {
|
||||
last_successful_manhattan_dist = manhattan_dist;
|
||||
last_successful_tile = next_tile;
|
||||
}
|
||||
|
||||
// TODO(doyle): Find the insert location into the frontier
|
||||
bool inserted = false;
|
||||
DQN_FOR_UINDEX(index, frontier.size) {
|
||||
Dqn_V2I frontier_tile = frontier.data[index];
|
||||
uint64_t frontier_tile_u64 = DQN_CAST(uint64_t)frontier_tile.y << 32 | DQN_CAST(uint64_t)frontier_tile.x << 0;
|
||||
Dqn_usize frontier_heuristic = Dqn_DSMap_FindKeyU64(&astar_info, frontier_tile_u64).value->heuristic;
|
||||
if (next_cost_result.value->heuristic >= frontier_heuristic)
|
||||
continue;
|
||||
|
||||
Dqn_FArray_Insert(&frontier, index, next_tile);
|
||||
inserted = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if (inserted)
|
||||
continue;
|
||||
|
||||
Dqn_FArray_Add(&frontier, next_tile);
|
||||
}
|
||||
}
|
||||
Dqn_Profiler_EndZone(zone_astar_expand);
|
||||
|
||||
#if 0
|
||||
TELY_Renderer *renderer = &platform->renderer;
|
||||
for (uint32_t old_index = 1 /*Sentinel*/; old_index < astar_info.occupied; old_index++) {
|
||||
Dqn_DSMapSlot<FP_GameAStarNode> const *slot = astar_info.slots + old_index;
|
||||
FP_GameAStarNode const *node = &slot->value;
|
||||
Dqn_V2 pos = FP_Game_TilePosToWorldPos(game, node->tile) + (game->play.tile_size * .5f);
|
||||
TELY_Render_CircleColourV4(renderer, pos, 4.f, TELY_RenderShapeMode_Fill, TELY_COLOUR_BLUE_CADET_V4);
|
||||
}
|
||||
#endif
|
||||
|
||||
Dqn_usize slice_size = 0;
|
||||
for (Dqn_V2I it = last_successful_tile; it != src_tile; slice_size++) {
|
||||
uint64_t key_u64 = (DQN_CAST(uint64_t)it.y << 32) | (DQN_CAST(uint64_t)it.x << 0);
|
||||
it = Dqn_DSMap_FindKeyU64(&astar_info, key_u64).value->came_from;
|
||||
}
|
||||
|
||||
result = Dqn_Slice_Alloc<Dqn_V2I>(arena, slice_size, Dqn_ZeroMem_No);
|
||||
slice_size = 0;
|
||||
for (Dqn_V2I it = last_successful_tile; it != src_tile; ) {
|
||||
result.data[slice_size++] = it;
|
||||
uint64_t key_u64 = (DQN_CAST(uint64_t)it.y << 32) | (DQN_CAST(uint64_t)it.x << 0);
|
||||
it = Dqn_DSMap_FindKeyU64(&astar_info, key_u64).value->came_from;
|
||||
}
|
||||
|
||||
DQN_ASSERT(result.size == slice_size);
|
||||
return result;
|
||||
}
|
||||
|
||||
static Dqn_V2 FP_Game_CalcWaypointWorldPos(FP_Game *game, FP_GameEntityHandle entity_handle, FP_GameWaypoint const *waypoint)
|
||||
{
|
||||
Dqn_V2 result = {};
|
||||
@ -797,6 +625,7 @@ FP_GameFindClosestEntityResult FP_Game_FindClosestEntityWithType(FP_Game *game,
|
||||
result.pos = Dqn_V2_InitNx1(DQN_F32_MAX);
|
||||
|
||||
for (FP_GameEntityIterator it = {}; FP_Game_DFSPostOrderWalkEntityTree(game, &it, game->play.root_entity); ) {
|
||||
DQN_ASSERT(it.entity);
|
||||
FP_GameEntity *it_entity = it.entity;
|
||||
if (it_entity->type != type)
|
||||
continue;
|
||||
@ -957,6 +786,7 @@ static FP_GameCanMoveToPositionResult FP_Game_CanEntityMoveToPosition(FP_Game *g
|
||||
|
||||
if ((entity->flags & FP_GameEntityFlag_NoClip) == 0) {
|
||||
for (FP_GameEntityIterator collider_it = {}; FP_Game_DFSPostOrderWalkEntityTree(game, &collider_it, game->play.root_entity);) {
|
||||
DQN_ASSERT(collider_it.entity);
|
||||
FP_GameEntity *collider = collider_it.entity;
|
||||
if (collider->handle == entity->handle)
|
||||
continue;
|
||||
|
@ -50,7 +50,6 @@ DQN_MSVC_WARNING_DISABLE(4505) // warning C4505: unreferenced function with inte
|
||||
#include "External/tely/tely_render.h"
|
||||
#include "External/tely/tely_audio.h"
|
||||
#include "External/tely/tely_platform.h"
|
||||
#include "External/tely/tely_ui.h"
|
||||
#include "External/tely/tely_rfui.h"
|
||||
|
||||
#include "External/tely/tely_tools.cpp"
|
||||
@ -58,7 +57,6 @@ DQN_MSVC_WARNING_DISABLE(4505) // warning C4505: unreferenced function with inte
|
||||
#include "External/tely/tely_audio.cpp"
|
||||
#include "External/tely/tely_render.cpp"
|
||||
#include "External/tely/tely_platform_input.cpp"
|
||||
#include "External/tely/tely_ui.cpp"
|
||||
#include "External/tely/tely_rfui.cpp"
|
||||
|
||||
// NOTE: feely_pona ================================================================================
|
||||
|
@ -67,7 +67,6 @@ DQN_GCC_WARNING_DISABLE(-Wunused-function)
|
||||
#include "External/tely/tely_render.h"
|
||||
#include "External/tely/tely_audio.h"
|
||||
#include "External/tely/tely_platform.h"
|
||||
#include "External/tely/tely_ui.h"
|
||||
#include "External/tely/tely_rfui.h"
|
||||
|
||||
#include "External/tely/tely_tools.cpp"
|
||||
@ -75,7 +74,6 @@ DQN_GCC_WARNING_DISABLE(-Wunused-function)
|
||||
#include "External/tely/tely_audio.cpp"
|
||||
#include "External/tely/tely_render.cpp"
|
||||
#include "External/tely/tely_platform_input.cpp"
|
||||
#include "External/tely/tely_ui.cpp"
|
||||
#include "External/tely/tely_rfui.cpp"
|
||||
|
||||
// NOTE: feely_pona ================================================================================
|
||||
|
BIN
project.rdbg
BIN
project.rdbg
Binary file not shown.
Loading…
Reference in New Issue
Block a user