diff --git a/src/pp/pp.c b/src/pp/pp.c index 98f54925..25c87aa6 100644 --- a/src/pp/pp.c +++ b/src/pp/pp.c @@ -1259,6 +1259,9 @@ P_Ent *P_NextEnt(P_Ent *e) return result; } +//////////////////////////////////////////////////////////// +//~ List helpers + P_Ent *P_PushTempEnt(Arena *arena, P_EntList *list) { P_EntListNode *n = PushStruct(arena, P_EntListNode); @@ -2584,6 +2587,7 @@ void P_StepFrame(P_Frame *frame) } } + // TODO: Truncate bullet trail if (!P_IsEntNil(victim)) { bullet->has_hit = 1; diff --git a/src/pp/pp_sim/pp_sim_core.c b/src/pp/pp_sim/pp_sim_core.c index 71368718..86f92370 100644 --- a/src/pp/pp_sim/pp_sim_core.c +++ b/src/pp/pp_sim/pp_sim_core.c @@ -589,7 +589,6 @@ void S_TickForever(WaveLaneCtx *lane) else if (MatchString(name, Lit("guy"))) { P_Ent *guy = P_PushTempEnt(frame_arena, &ents); - *guy = P_NilEnt; guy->key = msg->key; guy->xf = msg->xf; guy->is_guy = 1; @@ -598,22 +597,27 @@ void S_TickForever(WaveLaneCtx *lane) } else if (MatchString(name, Lit("dummy"))) { - P_Ent *guy = P_PushTempEnt(frame_arena, &ents); - *guy = P_NilEnt; - guy->key = P_RandKey(); + P_Ent *dummy = P_EntFromKey(world_frame, msg->key); + if (P_IsEntNil(dummy)) + { + dummy = P_PushTempEnt(frame_arena, &ents); + dummy->key = msg->key; + dummy->is_player = 1; + dummy->is_dummy = 1; + dummy->exists = 1; + P_SetEntString(dummy, Lit("Dummy")); + } + P_Ent *guy = P_EntFromKey(world_frame, dummy->guy); + if (P_IsEntNil(guy)) + { + guy = P_PushTempEnt(frame_arena, &ents); + guy->key = P_RandKey(); + guy->is_guy = 1; + guy->has_weapon = 1; + guy->exists = 1; + dummy->guy = guy->key; + } guy->xf = msg->xf; - guy->is_guy = 1; - guy->has_weapon = 1; - guy->exists = 1; - - P_Ent *dummy = P_PushTempEnt(frame_arena, &ents); - *dummy = P_NilEnt; - dummy->key = msg->key; - dummy->is_player = 1; - dummy->is_dummy = 1; - dummy->exists = 1; - dummy->guy = guy->key; - P_SetEntString(dummy, Lit("Dummy")); } P_SpawnEntsFromList(world_frame, ents); } break; diff --git a/src/pp/pp_vis/pp_vis_core.c b/src/pp/pp_vis/pp_vis_core.c index 0b9e1c8d..0d7fc2f8 100644 --- a/src/pp/pp_vis/pp_vis_core.c +++ b/src/pp/pp_vis/pp_vis_core.c @@ -4325,7 +4325,7 @@ void V_TickForever(WaveLaneCtx *lane) // } break; case V_CmdKind_reset_world: - case V_CmdKind_spawn: + case V_CmdKind_spawn_tp_player: { // Reset world Vec2 guy_pos = VEC2(5, 0); @@ -4346,11 +4346,23 @@ void V_TickForever(WaveLaneCtx *lane) } } break; + case V_CmdKind_spawn_tp_dummy: case V_CmdKind_spawn_dummy: { P_Msg *msg = P_PushMsg(P_MsgKind_EntEdit, Lit("dummy")); msg->key = P_RandKey(); msg->xf.t = frame->world_cursor; + if (kind == V_CmdKind_spawn_tp_dummy) + { + for (P_Ent *ent = P_FirstEnt(local_frame); !P_IsEntNil(ent); ent = P_NextEnt(ent)) + { + if (ent->is_dummy) + { + msg->key = ent->key; + break; + } + } + } } break; case V_CmdKind_delete: diff --git a/src/pp/pp_vis/pp_vis_core.h b/src/pp/pp_vis/pp_vis_core.h index 9e661577..a9017600 100644 --- a/src/pp/pp_vis/pp_vis_core.h +++ b/src/pp/pp_vis/pp_vis_core.h @@ -13,12 +13,13 @@ X(toggle_console, Toggle Developer Console, V_CmdDescFlag_None, V_HOTKEY( Button_GraveAccent ), ) \ X(toggle_fullscreen, Toggle Fullscreen Mode, V_CmdDescFlag_None, V_HOTKEY( Button_Enter, .alt = 1 ) ) \ X(toggle_window_topmost, Toggle Window Topmost, V_CmdDescFlag_None, V_HOTKEY( Button_F4 ), ) \ - X(spawn, Spawn/Teleport Player, V_CmdDescFlag_None, V_HOTKEY( Button_Q ), ) \ - X(spawn_dummy, Spawn Dummy, V_CmdDescFlag_None, V_HOTKEY( Button_T ), ) \ + X(spawn_tp_player, Spawn/Teleport Player, V_CmdDescFlag_None, V_HOTKEY( Button_Q ), ) \ + X(spawn_tp_dummy, Spawn/Teleport Dummy, V_CmdDescFlag_None, V_HOTKEY( Button_T ), ) \ + X(spawn_dummy, Spawn Dummy, V_CmdDescFlag_None, V_HOTKEY( Button_T, .ctrl = 1 ), ) \ X(delete, Delete entity at cursor, V_CmdDescFlag_None, V_HOTKEY( Button_M2 ), ) \ X(reset_world, Reset world, V_CmdDescFlag_None, V_HOTKEY( Button_R, .ctrl = 1, .alt = 1 ), ) \ X(clear_particles, Clear particles, V_CmdDescFlag_None, V_HOTKEY( Button_C ), ) \ - X(test, Test, V_CmdDescFlag_None, V_HOTKEY( Button_T, .ctrl = 1 ), ) \ + X(test, Test, V_CmdDescFlag_None, V_HOTKEY( Button_Y ), ) \ /* -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */ //////////////////////////////////////////////////////////// diff --git a/src/window/window_win32/window_win32.c b/src/window/window_win32/window_win32.c index 77e4ecac..a4ef973c 100644 --- a/src/window/window_win32/window_win32.c +++ b/src/window/window_win32/window_win32.c @@ -284,10 +284,6 @@ LRESULT CALLBACK WND_W32_WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM l event.button = WND_W32.vk_to_button[vk_code]; } WND_W32_PushEvent(window, event); - if (msg == WM_SYSKEYUP || msg == WM_SYSKEYDOWN) - { - result = DefWindowProcW(hwnd, msg, wparam, lparam); - } } break; //- Text