diff --git a/src/base/base.cgh b/src/base/base.cgh index 86dc647b..bfdbb35e 100644 --- a/src/base/base.cgh +++ b/src/base/base.cgh @@ -177,9 +177,9 @@ //- Zero initialization #if IsLanguageC - #define Zi { 0 } + #define Zi {0} #else - #define Zi { } + #define Zi {} #endif //- Inline diff --git a/src/pp/pp_res/sprite/tiles.ase b/src/pp/pp_res/sprite/tiles.ase index bb9158a3..5489fa79 100644 --- a/src/pp/pp_res/sprite/tiles.ase +++ b/src/pp/pp_res/sprite/tiles.ase @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:01d7077a1b43124b2931a66a9e5bafc4ee53edfd33b65fa14ced182d6a79d4e6 -size 501 +oid sha256:06990840a2070d57b8ee487704558a50442f184b6a73e9beeb0b2a083ef8c6e4 +size 482 diff --git a/src/pp/pp_sim/pp_sim_transcode.c b/src/pp/pp_sim/pp_sim_transcode.c index 9740576a..ed18e8ac 100644 --- a/src/pp/pp_sim/pp_sim_transcode.c +++ b/src/pp/pp_sim/pp_sim_transcode.c @@ -26,28 +26,32 @@ String S_PackWorld(Arena *arena, S_World *src_world) result.len += PushString(arena, Lit("{\n")).len; for (S_Ent *ent = S_FirstEnt(src_world); ent->valid; ent = S_NextEnt(ent)) { - result.len += StringF(arena, " 0x%F:\n", FmtHex(ent->key.v)).len; - result.len += PushString(arena, Lit(" {\n")).len; + // TODO: Pack bullets + if (!ent->is_bullet) { - result.len += StringF(arena, " props: \n").len; - result.len += StringF(arena, " {\n").len; + result.len += StringF(arena, " 0x%F:\n", FmtHex(ent->key.v)).len; + result.len += PushString(arena, Lit(" {\n")).len; { - if (ent->is_player) + result.len += StringF(arena, " props: \n").len; + result.len += StringF(arena, " {\n").len; { - result.len += PushString(arena, Lit(" player\n")).len; - } - if (ent->is_bullet) - { - result.len += PushString(arena, Lit(" bullet\n")).len; + if (ent->is_player) + { + result.len += PushString(arena, Lit(" player\n")).len; + } + if (ent->is_bullet) + { + result.len += PushString(arena, Lit(" bullet\n")).len; + } } + result.len += StringF(arena, " }\n").len; + result.len += StringF(arena, " pos: \"%F\"\n", FmtFloat2(ent->xf.og)).len; + result.len += StringF(arena, " rot: \"%F\"\n", FmtFloat2(RightFromXform(ent->xf))).len; + result.len += StringF(arena, " exists: \"%F\"\n", FmtFloat(ent->exists)).len; + result.len += StringF(arena, " look: \"%F\"\n", FmtFloat2(ent->look)).len; } - result.len += StringF(arena, " }\n").len; - result.len += StringF(arena, " pos: \"%F\"\n", FmtFloat2(ent->xf.og)).len; - result.len += StringF(arena, " rot: \"%F\"\n", FmtFloat2(RightFromXform(ent->xf))).len; - result.len += StringF(arena, " exists: \"%F\"\n", FmtFloat(ent->exists)).len; - result.len += StringF(arena, " look: \"%F\"\n", FmtFloat2(ent->look)).len; + result.len += PushString(arena, Lit(" }\n")).len; } - result.len += PushString(arena, Lit(" }\n")).len; } result.len += PushString(arena, Lit("}\n")).len; @@ -166,7 +170,10 @@ S_UnpackedWorld S_UnpackWorld(Arena *arena, String packed) tiles_base64.text = ArenaNext(scratch.arena, u8); for (CR_Item *tile_item = top_item->first; tile_item; tile_item = tile_item->next) { - tiles_base64.len += PushString(scratch.arena, tile_item->value).len; + if (tile_item->name.len == 0) + { + tiles_base64.len += PushString(scratch.arena, tile_item->value).len; + } } if (StringLenFromBase64Len(tiles_base64.len) == S_TilesCount) { diff --git a/src/pp/pp_vis/pp_vis_core.c b/src/pp/pp_vis/pp_vis_core.c index dd4fec65..96330aac 100644 --- a/src/pp/pp_vis/pp_vis_core.c +++ b/src/pp/pp_vis/pp_vis_core.c @@ -902,6 +902,7 @@ void V_TickForever(WaveLaneCtx *lane) frame->xf.world_to_ui = XformFromScale(VEC2(camera_scale, camera_scale)); frame->xf.world_to_ui = TranslateXform(frame->xf.world_to_ui, NegVec2(frame->camera_pos)); frame->xf.world_to_ui = WorldTranslateXform(frame->xf.world_to_ui, MulVec2(Vec2FromVec(frame->draw_dims), 0.5)); + frame->xf.world_to_ui.og = RoundVec2(frame->xf.world_to_ui.og); frame->xf.ui_to_world = InvertXform(frame->xf.world_to_ui); } } @@ -2816,7 +2817,7 @@ void V_TickForever(WaveLaneCtx *lane) - // if (0) + if (0) { for (S_Ent *bullet = S_FirstEnt(world); bullet->valid; bullet = S_NextEnt(bullet)) { diff --git a/src/pp/pp_vis/pp_vis_gpu.g b/src/pp/pp_vis/pp_vis_gpu.g index 48523a78..f36c4c91 100644 --- a/src/pp/pp_vis/pp_vis_gpu.g +++ b/src/pp/pp_vis/pp_vis_gpu.g @@ -83,8 +83,13 @@ ComputeShader2D(V_BackdropCS, 8, 8) { Vec4 result = Vec4(0.025, 0.025, 0.025, 1); Vec2 world_pos = mul(params.xf.ui_to_world, Vec3(ui_pos, 1)); + Vec2I32 tile_pos = S_TilePosFromWorldPos(world_pos); + Vec2I32 tile_pos_right = tile_pos; + tile_pos_right.x += 1; + S_TileKind tile = tiles.Load(Vec3I32(tile_pos, 0)); + S_TileKind tile_right = tiles.Load(Vec3I32(tile_pos_right, 0)); f32 half_thickness = 1; f32 half_bounds_size = S_WorldPitch * 0.5; @@ -124,19 +129,19 @@ ComputeShader2D(V_BackdropCS, 8, 8) result = colors[color_idx]; } // Grid outline - { - Vec2 grid_screen_p0 = mul(params.xf.world_to_ui, Vec3(floor(world_pos), 1)); - Vec2 grid_screen_p1 = mul(params.xf.world_to_ui, Vec3(ceil(world_pos), 1)); - f32 grid_dist = 100000; - grid_dist = min(grid_dist, abs(ui_pos.x - grid_screen_p0.x)); - grid_dist = min(grid_dist, abs(ui_pos.x - grid_screen_p1.x)); - grid_dist = min(grid_dist, abs(ui_pos.y - grid_screen_p0.y)); - grid_dist = min(grid_dist, abs(ui_pos.y - grid_screen_p1.y)); - if (grid_dist <= half_thickness) - { - result = grid_color; - } - } + // { + // Vec2 grid_screen_p0 = mul(params.xf.world_to_ui, Vec3(floor(world_pos), 1)); + // Vec2 grid_screen_p1 = mul(params.xf.world_to_ui, Vec3(ceil(world_pos), 1)); + // f32 grid_dist = 100000; + // grid_dist = min(grid_dist, abs(ui_pos.x - grid_screen_p0.x)); + // grid_dist = min(grid_dist, abs(ui_pos.x - grid_screen_p1.x)); + // grid_dist = min(grid_dist, abs(ui_pos.y - grid_screen_p0.y)); + // grid_dist = min(grid_dist, abs(ui_pos.y - grid_screen_p1.y)); + // if (grid_dist <= half_thickness) + // { + // result = grid_color; + // } + // } // Axis { Vec2 zero_screen = mul(params.xf.world_to_ui, Vec3(0, 0, 1)); @@ -181,7 +186,18 @@ ComputeShader2D(V_BackdropCS, 8, 8) } else if (tile == S_TileKind_Wall) { + // Distance to edge of wall in cells + f32 wall_dist = 0; result = Color_Black; + + + + + // result.rgb *= wall_dist; + if (wall_dist > 1) + { + result = Color_White; + } } diff --git a/src/pp/pp_vis/pp_vis_shared.cgh b/src/pp/pp_vis/pp_vis_shared.cgh index e12d6ae0..09181066 100644 --- a/src/pp/pp_vis/pp_vis_shared.cgh +++ b/src/pp/pp_vis/pp_vis_shared.cgh @@ -1,4 +1,4 @@ -#define V_CellsPerMeter 40.0 +#define V_CellsPerMeter 32.0 #define V_CellsPerSqMeter (V_CellsPerMeter * V_CellsPerMeter) // #define V_MaxParticles Kibi(128)