actually good camera shake

This commit is contained in:
jacob 2026-04-06 01:41:54 -05:00
parent ee4579bd2d
commit 38c9f960e3
7 changed files with 1418 additions and 259 deletions

View File

@ -24,7 +24,7 @@
//~ Settings //~ Settings
#define PROFILING_ENABLED 1 #define PROFILING_ENABLED 0
#define PROFILER_PRIORITY_ASYNC 10 #define PROFILER_PRIORITY_ASYNC 10

View File

@ -3226,7 +3226,7 @@ void P_StepFrame(P_Frame *frame)
bullet->is_bomb = is_bomb; bullet->is_bomb = is_bomb;
bullet->source = weapon->key; bullet->source = weapon->key;
bullet->damage_attribution = firer->source; bullet->damage_attribution_player = firer->source;
bullet->sim = weapon->sim; bullet->sim = weapon->sim;
} }
} }
@ -3260,7 +3260,7 @@ void P_StepFrame(P_Frame *frame)
{ {
P_Ent *weapon = P_EntFromKey(frame, bullet->source); P_Ent *weapon = P_EntFromKey(frame, bullet->source);
P_Ent *firer = P_EntFromKey(frame, weapon->source); P_Ent *firer = P_EntFromKey(frame, weapon->source);
P_Ent *damager = P_EntFromKey(frame, bullet->damage_attribution); P_Ent *damager = P_EntFromKey(frame, bullet->damage_attribution_player);
b32 is_first_bullet_tick = bullet->created_at_tick == frame->tick; b32 is_first_bullet_tick = bullet->created_at_tick == frame->tick;
@ -3555,9 +3555,10 @@ void P_StepFrame(P_Frame *frame)
{ {
if (damager->is_player) if (damager->is_player)
{ {
victim->damage_attribution = damager->key; victim->damage_attribution_player = damager->key;
victim->damage_attribution_dir = SubVec2(bullet->xf.t, p0);
} }
victim->health -= 0.25; victim->health -= 0.5;
} }
// Prune out of bounds bullet // Prune out of bounds bullet
@ -3600,7 +3601,7 @@ void P_StepFrame(P_Frame *frame)
// { // {
// P_Ent *weapon = P_EntFromKey(frame, bullet->source); // P_Ent *weapon = P_EntFromKey(frame, bullet->source);
// P_Ent *firer = P_EntFromKey(frame, weapon->source); // P_Ent *firer = P_EntFromKey(frame, weapon->source);
// P_Ent *damager = P_EntFromKey(frame, bullet->damage_attribution); // P_Ent *damager = P_EntFromKey(frame, bullet->damage_attribution_player);
@ -3736,7 +3737,7 @@ void P_StepFrame(P_Frame *frame)
// { // {
// if (damager->is_player) // if (damager->is_player)
// { // {
// victim->damage_attribution = damager->key; // victim->damage_attribution_player = damager->key;
// } // }
// victim->health -= 0.25; // victim->health -= 0.25;
// } // }
@ -3768,7 +3769,7 @@ void P_StepFrame(P_Frame *frame)
if (old_guy->health > 0) if (old_guy->health > 0)
{ {
P_Ent *player = P_EntFromKey(frame, guy->source); P_Ent *player = P_EntFromKey(frame, guy->source);
P_Ent *killer = P_EntFromKey(frame, guy->damage_attribution); P_Ent *killer = P_EntFromKey(frame, guy->damage_attribution_player);
// Update kill info // Update kill info
{ {
if (player->is_player) if (player->is_player)
@ -3788,6 +3789,7 @@ void P_StepFrame(P_Frame *frame)
P_Ent *death = P_PushTempEnt(scratch.arena, &ents_to_spawn); P_Ent *death = P_PushTempEnt(scratch.arena, &ents_to_spawn);
death->key = P_EntKeyFromU64(MixU64s(guy->key.v, P_DeathBasis + (u64)player->deaths)); death->key = P_EntKeyFromU64(MixU64s(guy->key.v, P_DeathBasis + (u64)player->deaths));
death->death_pos = guy->xf.t; death->death_pos = guy->xf.t;
death->death_dir = guy->damage_attribution_dir;
death->is_death = 1; death->is_death = 1;
death->death_victim = player->key; death->death_victim = player->key;
death->death_killer = killer->key; death->death_killer = killer->key;

View File

@ -159,6 +159,7 @@ Struct(P_NetworkedEntState)
b32 is_death; b32 is_death;
Vec2 death_pos; Vec2 death_pos;
Vec2 death_dir;
P_EntKey death_victim; P_EntKey death_victim;
P_EntKey death_killer; P_EntKey death_killer;
@ -182,7 +183,8 @@ Struct(P_NetworkedEntState)
//- Guy / Bullet //- Guy / Bullet
P_EntKey damage_attribution; P_EntKey damage_attribution_player;
Vec2 damage_attribution_dir;
//- Player //- Player

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,7 @@ Struct(V_WidgetTheme)
GC_FontKey ui_font; GC_FontKey ui_font;
GC_FontKey chat_font; GC_FontKey chat_font;
GC_FontKey icon_font; GC_FontKey icon_font;
GC_FontKey player_name_font; GC_FontKey game_font;
f32 ui_font_size; f32 ui_font_size;
f32 chat_font_size; f32 chat_font_size;

View File

@ -1233,13 +1233,14 @@ ComputeShader(V_CompositeCS)
// World bounds // World bounds
if (draw_grid || frame.is_editing) if (draw_grid || frame.is_editing)
{ {
const Vec4 bounds_color = LinearFromSrgb(Vec4(0.75, 0.75, 0, 1)); // const Vec4 bounds_color = LinearFromSrgb(Vec4(0.75, 0.75, 0, 1));
const Vec4 bounds_color = LinearFromSrgb(Vec4(1.35, 1.35, 0, 1));
f32 bounds_dist = 100000; f32 bounds_dist = 100000;
bounds_dist = min(bounds_dist, abs(screen_pos.x - world_bounds_screen_p0.x)); bounds_dist = min(bounds_dist, abs(screen_pos.x - world_bounds_screen_p0.x));
bounds_dist = min(bounds_dist, abs(screen_pos.x - world_bounds_screen_p1.x)); bounds_dist = min(bounds_dist, abs(screen_pos.x - world_bounds_screen_p1.x));
bounds_dist = min(bounds_dist, abs(screen_pos.y - world_bounds_screen_p0.y)); bounds_dist = min(bounds_dist, abs(screen_pos.y - world_bounds_screen_p0.y));
bounds_dist = min(bounds_dist, abs(screen_pos.y - world_bounds_screen_p1.y)); bounds_dist = min(bounds_dist, abs(screen_pos.y - world_bounds_screen_p1.y));
if (bounds_dist <= half_thickness) if (bounds_dist <= half_thickness * 2)
{ {
grid_color = bounds_color; grid_color = bounds_color;
} }

View File

@ -1462,16 +1462,9 @@ void UI_EndFrame(UI_Frame *frame, i32 vsync)
{ {
UI_Size size = box->desc.pref_semantic_dims[axis]; UI_Size size = box->desc.pref_semantic_dims[axis];
if (size.kind == UI_SizeKind_Pixel) if (size.kind == UI_SizeKind_Pixel)
{
if (TweakBool("RAAAAAAAAAAAAAH", 1))
{ {
box->solved_dims.v[axis] = size.v; box->solved_dims.v[axis] = size.v;
} }
else
{
box->solved_dims.v[axis] = CeilF32(size.v);
}
}
else if (size.kind == UI_SizeKind_Shrink) else if (size.kind == UI_SizeKind_Shrink)
{ {
if (AnyBit(box->desc.flags, UI_BoxFlag_DrawText)) if (AnyBit(box->desc.flags, UI_BoxFlag_DrawText))
@ -1485,26 +1478,12 @@ void UI_EndFrame(UI_Frame *frame, i32 vsync)
{ {
text_size = box->glyph_run.font_ascent + box->glyph_run.font_descent; text_size = box->glyph_run.font_ascent + box->glyph_run.font_descent;
} }
if (TweakBool("RAAAAAAAAAAAAAH", 1))
{
box->solved_dims.v[axis] = text_size + (size.v * 2); box->solved_dims.v[axis] = text_size + (size.v * 2);
} }
else
{
box->solved_dims.v[axis] = CeilF32(text_size + (size.v * 2));
}
}
else if (!SPR_IsSheetKeyNil(box->desc.sprite_sheet)) else if (!SPR_IsSheetKeyNil(box->desc.sprite_sheet))
{
if (TweakBool("RAAAAAAAAAAAAAH", 1))
{ {
box->solved_dims.v[axis] = box->sprite.tex_rect.p1.v[axis] - box->sprite.tex_rect.p0.v[axis] + (size.v * 2); box->solved_dims.v[axis] = box->sprite.tex_rect.p1.v[axis] - box->sprite.tex_rect.p0.v[axis] + (size.v * 2);
} }
else
{
box->solved_dims.v[axis] = CeilF32(box->sprite.tex_rect.p1.v[axis] - box->sprite.tex_rect.p0.v[axis] + (size.v * 2));
}
}
} }
} }
} }