From 62776720c37bb56cebeb2846dbd39dbb0929b54a Mon Sep 17 00:00:00 2001 From: jacob Date: Fri, 20 Feb 2026 18:49:29 -0600 Subject: [PATCH] bomb wip --- .gitattributes | 3 ++ .gitignore | 1 - src/gpu/gpu_core.h | 2 +- src/pp/pp.c | 86 ++++++++++++++++++++++++++++--------- src/pp/pp_res/guy/guy.ase | 2 +- src/pp/pp_res/misc/bomb.ase | 4 +- src/pp/pp_vis/pp_vis_core.c | 6 ++- src/pp/pp_vis/pp_vis_gpu.g | 6 +-- 8 files changed, 80 insertions(+), 30 deletions(-) diff --git a/.gitattributes b/.gitattributes index ccf6fcf9..49e060ad 100644 --- a/.gitattributes +++ b/.gitattributes @@ -14,6 +14,9 @@ ############################## #- Binary files +*.exe filter=lfs diff=lfs merge=lfs -text +*.dll filter=lfs diff=lfs merge=lfs -text +*.lib filter=lfs diff=lfs merge=lfs -text *.tga filter=lfs diff=lfs merge=lfs -text *.ase filter=lfs diff=lfs merge=lfs -text *.ttf filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index c20346e2..62ca2fb8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,6 @@ *.wpix *.tracy *.pdb -*.exe *.vs/* *.vscode/* *.log diff --git a/src/gpu/gpu_core.h b/src/gpu/gpu_core.h index bed18c93..6f5e96a6 100644 --- a/src/gpu/gpu_core.h +++ b/src/gpu/gpu_core.h @@ -242,7 +242,7 @@ Enum(G_Access) G_Access_IndexBuffer = (1 << 8), G_Access_IndirectArgument = (1 << 9), - G_Access_All = 0xFFFFFFFF // Represents all accesses relevant to the specified sync stage + G_Access_All = 0xFFFFFFFF // Represents all accesses relevant to the stage specified in the barrier }; Enum(G_Layout) diff --git a/src/pp/pp.c b/src/pp/pp.c index 645972d1..899f1afd 100644 --- a/src/pp/pp.c +++ b/src/pp/pp.c @@ -1502,11 +1502,26 @@ void P_UniqueSpaceEntriesFromRay(Arena *arena, P_SpaceEntryList *result, i32 spa Vec2 delta = SubVec2(ray_p1, ray_p0); Vec2 inv_delta = RecipVec2(delta); Vec2 step_dir = VEC2((delta.x > 0) - (delta.x < 0), (delta.y > 0) - (delta.y < 0)); - Vec2 t_delta = MulVec2Vec2(step_dir, inv_delta); + Vec2 t_delta = VEC2(AbsF32(inv_delta.x), AbsF32(inv_delta.y)); Vec2 t_max = SubVec2(Vec2FromVec(dda_start), ray_p0); t_max.x += step_dir.x > 0; t_max.y += step_dir.y > 0; + + + + t_max = MulVec2Vec2(t_max, inv_delta); + if (IsInf(inv_delta.x)) + { + t_max.x = inv_delta.x; + } + if (IsInf(inv_delta.y)) + { + t_max.y = inv_delta.y; + } + + + Vec2I32 dda_pos = dda_start; b32 done = 0; @@ -2892,26 +2907,12 @@ void P_StepFrame(P_Frame *frame) P_Space post_solve_ents_space = P_SpaceFromEnts(scratch.arena, frame); - ////////////////////////////// - //- Move bullets - - for (P_Ent *bullet = P_FirstEnt(frame); !P_IsEntNil(bullet); bullet = P_NextEnt(bullet)) - { - if (bullet->is_bullet) - { - Vec2 start = bullet->bullet_start; - Vec2 end = bullet->bullet_end; - Vec2 vel = SubVec2(end, start); - bullet->bullet_start = end; - bullet->bullet_end = AddVec2(end, vel); - bullet->xf.t = bullet->bullet_start; - bullet->xf.r = NormRot(vel); - } - } - ////////////////////////////// //- Fire bullets + + + // TODO: Remove this { @@ -2933,7 +2934,8 @@ void P_StepFrame(P_Frame *frame) f32 spread = Tau * 0.05; // f32 spread = Tau * 0.01; f32 bullet_speed = TweakFloat("Bullet speed", 100, 1, 100); - f32 bomb_speed = TweakFloat("Bomb speed", 2, 1, 100); + f32 bomb_speed = 10; + // f32 tweak_speed = TweakFloat("Bullet speed", 1, 1, 100); b32 can_fire = (firer->last_fire_ns + NsFromSeconds(1.0 / fire_rate)) <= frame->time_ns; @@ -3094,8 +3096,35 @@ void P_StepFrame(P_Frame *frame) P_SpawnEntsFromList(frame, bullets_to_spawn); } + + + + + + + + + + + + + + + + + + + + + + + + + + + ////////////////////////////// - //- Update bullet hits + //- Update bullets // TODO: Separate 'hits' from bullets, so that bullets can have multiple hits @@ -3107,6 +3136,23 @@ void P_StepFrame(P_Frame *frame) P_Ent *bullet_guy = P_EntFromKey(frame, bullet_weapon->source); P_Ent *bullet_damager = P_EntFromKey(frame, bullet->damage_attribution); + + + if (bullet->created_at_tick != frame->tick) + { + Vec2 start = bullet->bullet_start; + Vec2 end = bullet->bullet_end; + Vec2 vel = SubVec2(end, start); + bullet->bullet_start = end; + bullet->bullet_end = AddVec2(end, vel); + bullet->xf.t = bullet->bullet_start; + bullet->xf.r = NormRot(vel); + } + + + + + bullet->has_hit = 0; Struct(BulletPath) diff --git a/src/pp/pp_res/guy/guy.ase b/src/pp/pp_res/guy/guy.ase index 18030774..1048d65e 100644 --- a/src/pp/pp_res/guy/guy.ase +++ b/src/pp/pp_res/guy/guy.ase @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d82b61111d4989e75e91809b1d69085649fefa43cefd6ae9e27473512d65b2c9 +oid sha256:e0541266ade237e73791ae063d0a4aaad416cd8d7ad21e9cf9afcb31ce8ad38f size 4080 diff --git a/src/pp/pp_res/misc/bomb.ase b/src/pp/pp_res/misc/bomb.ase index 29700f61..0e0fc2f8 100644 --- a/src/pp/pp_res/misc/bomb.ase +++ b/src/pp/pp_res/misc/bomb.ase @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1fd5e7ce1be6b930c0c27c6939c8d721cd8e08a1f3faba2e001dc177d17d4348 -size 559 +oid sha256:775d6ad171dbcf743162846c0070b8991dfd68b8aff51ad09400e50ac01a21e2 +size 560 diff --git a/src/pp/pp_vis/pp_vis_core.c b/src/pp/pp_vis/pp_vis_core.c index ba2c0fe1..5bdc3c32 100644 --- a/src/pp/pp_vis/pp_vis_core.c +++ b/src/pp/pp_vis/pp_vis_core.c @@ -2717,8 +2717,9 @@ void V_TickForever(WaveLaneCtx *lane) ////////////////////////////// //- Push test emitter - if (frame->held_buttons[Button_F]) + // if (frame->held_buttons[Button_F]) // if (frame->held_buttons[Button_F] && !prev_frame->held_buttons[Button_F]) + if (0) { { V_Emitter emitter = Zi; @@ -2778,8 +2779,9 @@ void V_TickForever(WaveLaneCtx *lane) ////////////////////////////// //- Push test explosion - if (frame->held_buttons[Button_G]) + // if (frame->held_buttons[Button_G]) // if (frame->held_buttons[Button_G] && !prev_frame->held_buttons[Button_G]) + if (0) { // Fire { diff --git a/src/pp/pp_vis/pp_vis_gpu.g b/src/pp/pp_vis/pp_vis_gpu.g index 53db5044..28adeb3a 100644 --- a/src/pp/pp_vis/pp_vis_gpu.g +++ b/src/pp/pp_vis/pp_vis_gpu.g @@ -380,7 +380,8 @@ ImplComputeShader(V_SimParticlesCS) b32 done = 0; f32 t_diff = 0; - for (u32 iteration_idx = 0; iteration_idx < max_iterations && !done; ++iteration_idx) + u32 iteration_idx = 0; + for (; iteration_idx < max_iterations && !done; ++iteration_idx) { if (cell_pos.x == cell_p1.x && cell_pos.y == cell_p1.y) { @@ -516,7 +517,6 @@ ImplComputeShader(V_SimParticlesCS) } particle.cells_count += 1; - iteration_idx += 1; } } @@ -986,7 +986,7 @@ ImplComputeShader2D(V_BloomDownCS) Vec2 bloom_uv = bloom_pos / down_dims; Vec2 off_uv = 0.5 / down_dims; - f32 threshold = 0.25; + f32 threshold = 1; f32 knee = 0.75; Vec4 result = 0;