diff --git a/src/audio.cpp b/src/audio.cpp index d50cceb..1ad472e 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -2,9 +2,10 @@ // Copyright Neil McGill, goblinhack@gmail.com // -#include "my_main.hpp" #include +#include "my_main.hpp" + uint8_t audio_init_done; void audio_fini(void) diff --git a/src/c_plus_plus_serializer.hpp b/src/c_plus_plus_serializer.hpp index ec79848..cbecacc 100644 --- a/src/c_plus_plus_serializer.hpp +++ b/src/c_plus_plus_serializer.hpp @@ -3,7 +3,6 @@ #ifndef C_PLUS_PLUS_SERIALIZER #define C_PLUS_PLUS_SERIALIZER #include -// REMOVED #include #include #include diff --git a/src/config.hpp b/src/config.hpp index 16c0935..3c71b08 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -1,3 +1,2 @@ -// REMOVED #include "my_cfg.hpp" #define HAVE_LIBUNWIND #define MYVER "0.0.1" diff --git a/src/game_load.cpp b/src/game_load.cpp index f34d150..56b424e 100644 --- a/src/game_load.cpp +++ b/src/game_load.cpp @@ -7,7 +7,6 @@ #include "my_array_bounds_check.hpp" #include "my_sdl_proto.hpp" #include "my_serialize.hpp" -// REMOVED #include "my_ui.hpp" #include "my_wid_error.hpp" #include "my_wid_popup.hpp" diff --git a/src/game_seed.cpp b/src/game_seed.cpp index 0ad854e..999361d 100644 --- a/src/game_seed.cpp +++ b/src/game_seed.cpp @@ -3,7 +3,6 @@ // #include "my_game.hpp" -// REMOVED #include "my_level.hpp" #include "my_random.hpp" #include "my_random_name.hpp" diff --git a/src/main.cpp b/src/main.cpp index 927f98a..4cf14fc 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,6 +22,7 @@ #include "my_gfx.hpp" #include "my_main.hpp" #include "my_music.hpp" +#include "my_ptrcheck.hpp" #include "my_ramdisk.hpp" #include "my_random.hpp" #include "my_sdl_proto.hpp" diff --git a/src/music.cpp b/src/music.cpp index 4884535..d06a4e3 100644 --- a/src/music.cpp +++ b/src/music.cpp @@ -2,11 +2,12 @@ // Copyright Neil McGill, goblinhack@gmail.com // +#include + #include "my_file.hpp" #include "my_game.hpp" #include "my_music.hpp" #include "my_ptrcheck.hpp" -#include class music { diff --git a/src/my_callstack.hpp b/src/my_callstack.hpp index e9be411..e8c4109 100644 --- a/src/my_callstack.hpp +++ b/src/my_callstack.hpp @@ -6,7 +6,6 @@ #define _MY_CALLSTACK_HPP_ #include "my_main.hpp" -// REMOVED #include "my_sys.hpp" #include #define CAT(A, B) A##B diff --git a/src/my_cfg.hpp b/src/my_cfg.hpp index 6085243..d25d78f 100644 --- a/src/my_cfg.hpp +++ b/src/my_cfg.hpp @@ -6,7 +6,6 @@ #ifndef _MY_CONFIG_HPP_ #define _MY_CONFIG_HPP_ -// REMOVED #include "cfg.hpp" #define ENABLE_ASSERT // Abort on errors #define ENABLE_CRASH_HANDLER // Intercept SEGV and other faults diff --git a/src/my_font.hpp b/src/my_font.hpp index e533ed6..96d8d4b 100644 --- a/src/my_font.hpp +++ b/src/my_font.hpp @@ -6,7 +6,6 @@ #ifndef _MY_FONT_HPP_ #define _MY_FONT_HPP_ -// REMOVED #include "my_fwd.hpp" #include "my_tile.hpp" #include // do not remove diff --git a/src/my_game.hpp b/src/my_game.hpp index e34fbc3..885fed0 100644 --- a/src/my_game.hpp +++ b/src/my_game.hpp @@ -7,7 +7,6 @@ #define _MY_GAME_HPP_ #include -#include #include "my_fwd.hpp" #include "my_game_defs.hpp" diff --git a/src/my_hiscore.hpp b/src/my_hiscore.hpp index c0e05f0..b229c59 100644 --- a/src/my_hiscore.hpp +++ b/src/my_hiscore.hpp @@ -54,4 +54,4 @@ class HiScores const char *place_str(int score); }; -#endif // _MY_THING_HPP_ +#endif // _MY_HISCORE_HPP_ diff --git a/src/my_pixel.hpp b/src/my_pixel.hpp index b601c49..c4872b6 100644 --- a/src/my_pixel.hpp +++ b/src/my_pixel.hpp @@ -9,7 +9,6 @@ #include #include "my_color.hpp" -// REMOVED #include "my_sys.hpp" #define pixel_ANYw(s, y) ((y) * (s->pitch / s->format->BytesPerPixel)) #define pixel_32bpp(s, x, y) ((uint32_t *) s->pixels + (x) + pixel_ANYw(s, y)) diff --git a/src/my_ptrcheck.hpp b/src/my_ptrcheck.hpp index 9b19bda..105e930 100644 --- a/src/my_ptrcheck.hpp +++ b/src/my_ptrcheck.hpp @@ -3,6 +3,8 @@ #ifndef _MY__PTRCHECK_HPP__ #define _MY__PTRCHECK_HPP__ +#include "my_source_loc.hpp" + // // __FUNCTION__ is not a preprocessor directive so we can't convert it into a // string diff --git a/src/my_sound.hpp b/src/my_sound.hpp index a5b0ebc..0558f87 100644 --- a/src/my_sound.hpp +++ b/src/my_sound.hpp @@ -9,10 +9,6 @@ #ifndef _MY_SOUND_HPP_ #define _MY_SOUND_HPP_ -#include "my_ptrcheck.hpp" - -#include - class sound; using soundp = class sound *; @@ -25,26 +21,6 @@ bool sound_play(const std::string &alias); bool sound_play_channel(int chan, const std::string &alias); void sound_halt(void); -class sound -{ -public: - sound(std::string alias) : alias(alias) {} - - ~sound(void) - { - Mix_FreeChunk(chunk); - myfree(data); - } - - std::string alias; - Mix_Chunk *chunk = {}; - unsigned char *data = {}; - int len = {}; - float volume {}; -}; - -extern std::map< std::string, class sound * > all_sound; - enum { CHANNEL_MISC, CHANNEL_FOOTSTEPS, diff --git a/src/my_sprintf.hpp b/src/my_sprintf.hpp index b5fa06f..d509ec9 100644 --- a/src/my_sprintf.hpp +++ b/src/my_sprintf.hpp @@ -7,7 +7,6 @@ #define _MY_SPRINTF_HPP_ #include "my_main.hpp" -// REMOVED #include std::string string_sprintf(const char *format, ...) CHECK_FORMAT_STR(printf, 1, 2); std::string string_sprintf(const char *format, va_list args); diff --git a/src/precompiled.hpp b/src/precompiled.hpp index 85a5d35..e4d6568 100644 --- a/src/precompiled.hpp +++ b/src/precompiled.hpp @@ -1,5 +1,3 @@ -#include -#include #include #include #include @@ -33,6 +31,7 @@ #include "my_audio.hpp" #include "my_callstack.hpp" #include "my_command.hpp" +#include "my_cpp_template.hpp" #include "my_dir.hpp" #include "my_enum.hpp" #include "my_file.hpp" @@ -47,7 +46,6 @@ #include "my_sdl_proto.hpp" #include "my_sound.hpp" #include "my_thing.hpp" -#include "my_thing_id.hpp" #include "my_tp.hpp" #include "my_tps.hpp" #include "my_wid_console.hpp" diff --git a/src/sound.cpp b/src/sound.cpp index 99fa56c..f57bf37 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -2,10 +2,31 @@ // Copyright Neil McGill, goblinhack@gmail.com // +#include + #include "my_file.hpp" #include "my_game.hpp" +#include "my_ptrcheck.hpp" #include "my_sound.hpp" +class sound +{ +public: + sound(std::string alias) : alias(alias) {} + + ~sound(void) + { + Mix_FreeChunk(chunk); + myfree(data); + } + + std::string alias; + Mix_Chunk *chunk = {}; + unsigned char *data = {}; + int len = {}; + float volume {}; +}; + std::map< std::string, class sound * > all_sound; bool sound_init_done; diff --git a/src/tile_blit.cpp b/src/tile_blit.cpp index 559f419..c5d6492 100644 --- a/src/tile_blit.cpp +++ b/src/tile_blit.cpp @@ -3,7 +3,6 @@ // #include "my_color_defs.hpp" -// REMOVED #include "my_game.hpp" #include "my_random.hpp" #include "my_tile.hpp" diff --git a/src/tp.cpp b/src/tp.cpp index 4faf693..2d49151 100644 --- a/src/tp.cpp +++ b/src/tp.cpp @@ -5,7 +5,6 @@ #include #include "my_ptrcheck.hpp" -// REMOVED #include "my_string.hpp" #include "my_tp.hpp" #include "my_tps.hpp" #include "my_vector_bounds_check.hpp" diff --git a/src/wid.cpp b/src/wid.cpp index 1d8bd83..ed972d6 100644 --- a/src/wid.cpp +++ b/src/wid.cpp @@ -3,11 +3,11 @@ // #include "my_array_bounds_check.hpp" -#include "my_backtrace.hpp" #include "my_color_defs.hpp" #include "my_command.hpp" #include "my_font.hpp" #include "my_game.hpp" +#include "my_ptrcheck.hpp" #include "my_sdl_event.hpp" #include "my_sdl_proto.hpp" #include "my_sound.hpp" @@ -402,15 +402,6 @@ void *wid_get_void_context(Widp w) void wid_set_prev(Widp w, Widp prev) { - - IF_DEBUG3 - { - verify(MTYPE_WID, w); - if (prev) { - verify(MTYPE_WID, prev); - } - } - if (unlikely(! w)) { DIE("No wid"); } @@ -495,14 +486,11 @@ Widp wid_get_top_parent(Widp w) return w; } - IF_DEBUG3 { verify(MTYPE_WID, w); } - if (! w->parent) { return w; } while (w->parent) { - IF_DEBUG3 { verify(MTYPE_WID, w); } w = w->parent; } @@ -906,21 +894,13 @@ void wid_set_name(Widp w, std::string name) #endif } -void wid_set_debug(Widp w, uint8_t val) -{ - - IF_DEBUG3 { verify(MTYPE_WID, w); } - - w->debug = val; -} +void wid_set_debug(Widp w, uint8_t val) { w->debug = val; } void wid_set_text_max_len(Widp w, size_t max_len) { w->max_len = max_len; } void wid_set_text(Widp w, std::string text) { - IF_DEBUG3 { verify(MTYPE_WID, w); } - if (text == "") { w->text = ""; } else { @@ -943,108 +923,37 @@ void wid_set_text(Widp w, std::string text) } } -void wid_set_text(Widp w, int v) -{ - - verify(MTYPE_WID, w); - wid_set_text(w, std::to_string(v)); -} - -bool wid_get_received_input(Widp w) -{ - - verify(MTYPE_WID, w); - return (w->received_input); -} - -void wid_set_received_input(Widp w, uint8_t val) -{ - - verify(MTYPE_WID, w); - w->received_input = val; -} - -void wid_set_cursor(Widp w, uint32_t val) -{ - - verify(MTYPE_WID, w); - w->cursor = val; -} - -int wid_get_width(Widp w) -{ - - IF_DEBUG3 { verify(MTYPE_WID, w); } - return (wid_get_br_x(w) - wid_get_tl_x(w)) + 1; -} - -int wid_get_height(Widp w) -{ - - IF_DEBUG3 { verify(MTYPE_WID, w); } - return (wid_get_br_y(w) - wid_get_tl_y(w)) + 1; -} - -bool wid_get_focusable(Widp w) -{ +void wid_set_text(Widp w, int v) { wid_set_text(w, std::to_string(v)); } - verify(MTYPE_WID, w); - return (w->focus_order); -} +bool wid_get_received_input(Widp w) { return (w->received_input); } -void wid_set_focusable(Widp w, uint8_t val) -{ +void wid_set_received_input(Widp w, uint8_t val) { w->received_input = val; } - verify(MTYPE_WID, w); - w->focus_order = val; -} - -bool wid_get_show_cursor(Widp w) -{ - - IF_DEBUG3 { verify(MTYPE_WID, w); } - return (w->show_cursor); -} +void wid_set_cursor(Widp w, uint32_t val) { w->cursor = val; } -void wid_set_show_cursor(Widp w, uint8_t val) -{ +int wid_get_width(Widp w) { return (wid_get_br_x(w) - wid_get_tl_x(w)) + 1; } - IF_DEBUG3 { verify(MTYPE_WID, w); } - w->show_cursor = val; -} +int wid_get_height(Widp w) { return (wid_get_br_y(w) - wid_get_tl_y(w)) + 1; } -bool wid_get_do_not_raise(Widp w) -{ +bool wid_get_focusable(Widp w) { return (w->focus_order); } - IF_DEBUG3 { verify(MTYPE_WID, w); } - return (w->do_not_raise); -} +void wid_set_focusable(Widp w, uint8_t val) { w->focus_order = val; } -void wid_set_do_not_raise(Widp w, uint8_t val) -{ +bool wid_get_show_cursor(Widp w) { return (w->show_cursor); } - IF_DEBUG3 { verify(MTYPE_WID, w); } - w->do_not_raise = val; -} +void wid_set_show_cursor(Widp w, uint8_t val) { w->show_cursor = val; } -bool wid_get_do_not_lower(Widp w) -{ +bool wid_get_do_not_raise(Widp w) { return (w->do_not_raise); } - IF_DEBUG3 { verify(MTYPE_WID, w); } - return (w->do_not_lower); -} +void wid_set_do_not_raise(Widp w, uint8_t val) { w->do_not_raise = val; } -void wid_set_do_not_lower(Widp w, uint8_t val) -{ +bool wid_get_do_not_lower(Widp w) { return (w->do_not_lower); } - IF_DEBUG3 { verify(MTYPE_WID, w); } - w->do_not_lower = val; -} +void wid_set_do_not_lower(Widp w, uint8_t val) { w->do_not_lower = val; } bool wid_get_moveable(Widp w) { - IF_DEBUG3 { verify(MTYPE_WID, w); } if (w->moveable_set) { return (w->moveable); } @@ -1055,7 +964,6 @@ bool wid_get_moveable(Widp w) void wid_set_moveable(Widp w, uint8_t val) { - IF_DEBUG3 { verify(MTYPE_WID, w); } w->moveable = val; w->moveable_set = true; @@ -1066,7 +974,6 @@ void wid_set_moveable(Widp w, uint8_t val) bool wid_get_moveable_horiz(Widp w) { - IF_DEBUG3 { verify(MTYPE_WID, w); } if (w->moveable_horiz_set) { return (w->moveable_horiz); } @@ -1077,7 +984,6 @@ bool wid_get_moveable_horiz(Widp w) void wid_set_moveable_horiz(Widp w, uint8_t val) { - IF_DEBUG3 { verify(MTYPE_WID, w); } w->moveable_horiz = val; w->moveable_horiz_set = true; } @@ -1085,7 +991,6 @@ void wid_set_moveable_horiz(Widp w, uint8_t val) bool wid_get_moveable_vert(Widp w) { - IF_DEBUG3 { verify(MTYPE_WID, w); } if (w->moveable_vert_set) { return (w->moveable_vert); } @@ -1096,7 +1001,6 @@ bool wid_get_moveable_vert(Widp w) void wid_set_moveable_vert(Widp w, uint8_t val) { - IF_DEBUG3 { verify(MTYPE_WID, w); } w->moveable_vert = val; w->moveable_vert_set = true; } @@ -1104,7 +1008,6 @@ void wid_set_moveable_vert(Widp w, uint8_t val) bool wid_get_moveable_bounded(Widp w) { - IF_DEBUG3 { verify(MTYPE_WID, w); } if (w->moveable_bounded_set) { return (w->moveable_bounded); } @@ -1115,7 +1018,6 @@ bool wid_get_moveable_bounded(Widp w) void wid_set_moveable_bounded(Widp w, uint8_t val) { - IF_DEBUG3 { verify(MTYPE_WID, w); } w->moveable_bounded = val; w->moveable_bounded_set = true; } @@ -1123,7 +1025,6 @@ void wid_set_moveable_bounded(Widp w, uint8_t val) bool wid_get_moveable_no_user_scroll(Widp w) { - IF_DEBUG3 { verify(MTYPE_WID, w); } if (w->moveable_no_user_scroll_set) { return (w->moveable_no_user_scroll); } @@ -1134,73 +1035,27 @@ bool wid_get_moveable_no_user_scroll(Widp w) void wid_set_moveable_no_user_scroll(Widp w, uint8_t val) { - IF_DEBUG3 { verify(MTYPE_WID, w); } w->moveable_no_user_scroll = val; w->moveable_no_user_scroll_set = true; } -bool wid_get_text_lhs(Widp w) -{ - - IF_DEBUG3 { verify(MTYPE_WID, w); } - return (w->text_lhs); -} - -void wid_set_text_lhs(Widp w, uint8_t val) -{ - - IF_DEBUG3 { verify(MTYPE_WID, w); } - w->text_lhs = val; -} - -bool wid_get_text_rhs(Widp w) -{ - - IF_DEBUG3 { verify(MTYPE_WID, w); } - return (w->text_rhs); -} - -void wid_set_text_rhs(Widp w, uint8_t val) -{ - - IF_DEBUG3 { verify(MTYPE_WID, w); } - w->text_rhs = true; -} +bool wid_get_text_lhs(Widp w) { return (w->text_lhs); } -bool wid_get_text_centerx(Widp w) -{ +void wid_set_text_lhs(Widp w, uint8_t val) { w->text_lhs = val; } - IF_DEBUG3 { verify(MTYPE_WID, w); } - return (w->text_centerx); -} +bool wid_get_text_rhs(Widp w) { return (w->text_rhs); } -void wid_set_text_centerx(Widp w, uint8_t val) -{ +void wid_set_text_rhs(Widp w, uint8_t val) { w->text_rhs = true; } - IF_DEBUG3 { verify(MTYPE_WID, w); } - w->text_centerx = val; -} - -bool wid_get_text_top(Widp w) -{ - - IF_DEBUG3 { verify(MTYPE_WID, w); } - return (w->text_top); -} +bool wid_get_text_centerx(Widp w) { return (w->text_centerx); } -void wid_set_text_top(Widp w, uint8_t val) -{ +void wid_set_text_centerx(Widp w, uint8_t val) { w->text_centerx = val; } - IF_DEBUG3 { verify(MTYPE_WID, w); } - w->text_top = val; -} +bool wid_get_text_top(Widp w) { return (w->text_top); } -bool wid_get_text_bot(Widp w) -{ +void wid_set_text_top(Widp w, uint8_t val) { w->text_top = val; } - IF_DEBUG3 { verify(MTYPE_WID, w); } - return (w->text_bot); -} +bool wid_get_text_bot(Widp w) { return (w->text_bot); } void wid_set_text_bot(Widp w, uint8_t val) { w->text_bot = val; } @@ -1413,18 +1268,13 @@ void wid_set_on_tick_post_display(Widp w, on_tick_post_display_t fn) // // Remove this wid from any trees it is in. // -void wid_tree_detach(Widp w) -{ - IF_DEBUG3 { verify(MTYPE_WID, w); } - wid_tree_remove(w); -} +void wid_tree_detach(Widp w) { wid_tree_remove(w); } // // Add back to all trees. // void wid_tree_attach(Widp w) { - IF_DEBUG3 { verify(MTYPE_WID, w); } wid_key_map_location *root; if (w->in_tree_root) { @@ -1434,7 +1284,6 @@ void wid_tree_attach(Widp w) if (! w->parent) { root = &wid_top_level; } else { - IF_DEBUG3 { verify(MTYPE_WID, w->parent); } root = &w->parent->children_display_sorted; } @@ -1466,7 +1315,6 @@ static void wid_tree_insert(Widp w) if (! w->parent) { root = &wid_top_level; } else { - verify(MTYPE_WID, w->parent); root = &w->parent->children_display_sorted; } @@ -1603,8 +1451,6 @@ void wid_tree_remove(Widp w) { wid_key_map_location *root; - IF_DEBUG3 { verify(MTYPE_WID, w); } - root = w->in_tree_root; if (! root) { return; @@ -1830,7 +1676,6 @@ static void wid_destroy_immediate_internal(Widp w) static void wid_destroy_immediate(Widp w) { - verify(MTYPE_WID, w); WID_DBG(w, "destroy immediate"); // @@ -1839,7 +1684,6 @@ static void wid_destroy_immediate(Widp w) if (! w->parent) { wid_find_top_focus(); } else { - verify(MTYPE_WID, w->parent); } wid_tree_detach(w); @@ -2327,7 +2171,6 @@ Widp wid_new_horiz_scroll_bar(Widp parent, std::string name, Widp scrollbar_owne static void wid_raise_internal(Widp w) { - verify(MTYPE_WID, w); if (w->do_not_raise) { return; } @@ -2392,7 +2235,6 @@ void wid_raise(Widp w_in) static void wid_lower_internal(Widp w) { - verify(MTYPE_WID, w); if (w->do_not_lower) { return; @@ -3450,7 +3292,6 @@ Widp wid_find_at(int x, int y) return nullptr; } - verify(MTYPE_WID, w); if (wid_ignore_being_destroyed(w)) { return nullptr; } @@ -3878,7 +3719,6 @@ static Widp wid_joy_button_handler(int x, int y) // void wid_fake_joy_button(int x, int y) { - if (get(sdl.joy_buttons, SDL_JOY_BUTTON_A)) { wid_mouse_down(SDL_BUTTON_LEFT, x, y); return; @@ -4495,8 +4335,6 @@ static void wid_display(Widp w, uint8_t disable_scissor, uint8_t *updated_scisso Widp p {}; #endif - IF_DEBUG3 { verify(MTYPE_WID, w); } - #if 0 if (!w->parent) { wid_dump(w, 0); @@ -4946,11 +4784,8 @@ void wid_display_all(bool ok_to_handle_requests) auto wid_top_level_copy = wid_top_level; for (auto iter = wid_top_level_copy.begin(); iter != wid_top_level_copy.end(); ++iter) { auto w = iter->second; - verify(MTYPE_WID, w); - if (w->parent) { - verify(MTYPE_WID, w->parent); - } + if (w->parent) {} if (wid_is_hidden(w)) { continue; @@ -4960,7 +4795,6 @@ void wid_display_all(bool ok_to_handle_requests) auto last = wid_total_count; #endif wid_display(w, false /* disable_scissors */, 0 /* updated_scissors */, true); - verify(MTYPE_WID, w); #if 0 printf("%s %d\n", wid_name(w).c_str(), wid_total_count - last); #endif @@ -5030,8 +4864,6 @@ bool wid_is_hidden(Widp w) return false; } - IF_DEBUG3 { verify(MTYPE_WID, w); } - if (w->hidden) { return true; } diff --git a/src/wid_cfg_sound.cpp b/src/wid_cfg_sound.cpp index 13e9a0d..19d3a19 100644 --- a/src/wid_cfg_sound.cpp +++ b/src/wid_cfg_sound.cpp @@ -2,12 +2,13 @@ // Copyright Neil McGill, goblinhack@gmail.com // +#include + #include "my_game.hpp" #include "my_music.hpp" #include "my_sdl_proto.hpp" #include "my_ui.hpp" #include "my_wid_popup.hpp" -#include static WidPopup *wid_cfg_sound_window; static bool config_changed; diff --git a/src/wid_mouse.cpp b/src/wid_mouse.cpp index 9ba4564..dc724d2 100644 --- a/src/wid_mouse.cpp +++ b/src/wid_mouse.cpp @@ -2,17 +2,10 @@ // Copyright Neil McGill, goblinhack@gmail.com // -#include "my_array_bounds_check.hpp" -#include "my_backtrace.hpp" -#include "my_color_defs.hpp" -#include "my_command.hpp" -#include "my_font.hpp" #include "my_game.hpp" #include "my_sdl_event.hpp" #include "my_sdl_proto.hpp" #include "my_sound.hpp" -#include "my_sprintf.hpp" -#include "my_ui.hpp" #include "my_wid_console.hpp" int wid_mouse_visible = 1; @@ -114,7 +107,6 @@ void wid_mouse_over_end(void) static bool wid_mouse_over_begin(Widp w, uint32_t x, uint32_t y, int relx, int rely, int wheelx, int wheely) { - if (! wid_mouse_visible) { return false; } @@ -134,8 +126,7 @@ static bool wid_mouse_over_begin(Widp w, uint32_t x, uint32_t y, int relx, int r } if (! w->on_mouse_over_begin && ! w->on_mouse_down) { - if (get(w->cfg, WID_MODE_OVER).color_set[ WID_COLOR_BG ] - || get(w->cfg, WID_MODE_OVER).color_set[ WID_COLOR_TEXT_FG ]) { + if (w->cfg[ WID_MODE_OVER ].color_set[ WID_COLOR_BG ] || w->cfg[ WID_MODE_OVER ].color_set[ WID_COLOR_TEXT_FG ]) { // // Changes appearance on mouse over, so choose this wid even // if it has no over callback. @@ -145,7 +136,7 @@ static bool wid_mouse_over_begin(Widp w, uint32_t x, uint32_t y, int relx, int r // Can ignore. It doesn't really do anything when the mouse // is over. // - if (! wid_over && get(wid_on_screen_at, x, y)) { + if (! wid_over && wid_on_screen_at[ x ][ y ]) { // // But if we have nothing else, use this // @@ -193,7 +184,6 @@ void wid_set_on_mouse_over_end(Widp w, on_mouse_over_end_t fn) { w->on_mouse_ove bool wid_scroll_trough_mouse_down(Widp w, int x, int y, uint32_t button) { - int dx; int dy; @@ -496,7 +486,6 @@ static Widp wid_mouse_held_handler_at(Widp w, int x, int y, uint8_t strict) static Widp wid_mouse_up_handler_at(Widp w, int x, int y, uint8_t strict) { - if (unlikely(! w)) { return nullptr; } @@ -570,7 +559,6 @@ static Widp wid_mouse_up_handler_at(Widp w, int x, int y, uint8_t strict) static Widp wid_mouse_down_handler(int x, int y) { - Widp w {}; w = wid_mouse_down_handler_at(wid_focus, x, y, true /* strict */); @@ -618,7 +606,6 @@ static Widp wid_mouse_down_handler(int x, int y) static Widp wid_mouse_held_handler(int x, int y) { - Widp w {}; w = wid_mouse_held_handler_at(wid_focus, x, y, true /* strict */); @@ -670,13 +657,11 @@ static Widp wid_mouse_up_handler(int x, int y) w = wid_mouse_up_handler_at(wid_focus, x, y, true /* strict */); if (w) { - verify(MTYPE_WID, w); return w; } w = wid_mouse_up_handler_at(wid_over, x, y, true /* strict */); if (w) { - verify(MTYPE_WID, w); return w; } @@ -692,7 +677,6 @@ static Widp wid_mouse_up_handler(int x, int y) continue; } - verify(MTYPE_WID, w); return w; } @@ -708,7 +692,6 @@ static Widp wid_mouse_up_handler(int x, int y) continue; } - verify(MTYPE_WID, w); return w; } @@ -719,9 +702,8 @@ static Widp wid_mouse_motion_handler(int x, int y, int relx, int rely, int wheel { Widp w {}; - w = get(wid_on_screen_at, x, y); + w = wid_on_screen_at[ x ][ y ]; if (w) { - verify(MTYPE_WID, w); if (w->hidden) { return nullptr; } @@ -830,7 +812,6 @@ void wid_mouse_motion(int x, int y, int relx, int rely, int wheelx, int wheely) // if (w->on_mouse_motion) { if ((w->on_mouse_motion)(w, x, y, relx, rely, wheelx, wheely)) { - verify(MTYPE_WID, w); got_one = true; break; } @@ -935,7 +916,6 @@ void wid_mouse_down(uint32_t button, int x, int y) // Raise on mouse. // if ((w->on_mouse_down && (w->on_mouse_down)(w, x, y, button)) || wid_get_moveable(w)) { - verify(MTYPE_WID, w); sound_play("click"); wid_set_focus(w); @@ -992,7 +972,6 @@ void wid_mouse_held(uint32_t button, int x, int y) // Raise on mouse. // if ((w->on_mouse_held && (w->on_mouse_held)(w, x, y, button)) || wid_get_moveable(w)) { - verify(MTYPE_WID, w); wid_set_focus(w); wid_set_mode(w, WID_MODE_ACTIVE); @@ -1034,10 +1013,8 @@ void wid_mouse_up(uint32_t button, int x, int y) if (unlikely(! w)) { return; } - verify(MTYPE_WID, w); if ((w->on_mouse_up && (w->on_mouse_up)(w, x, y, button)) || wid_get_moveable(w)) { - verify(MTYPE_WID, w); sound_play("click"); wid_set_mode(w, WID_MODE_ACTIVE); @@ -1050,7 +1027,6 @@ void wid_mouse_up(uint32_t button, int x, int y) void wid_mouse_hide(int value) { - int visible = ! value; if (visible != wid_mouse_visible) { @@ -1066,7 +1042,6 @@ void wid_mouse_hide(int value) void wid_mouse_warp(Widp w) { - int tlx, tly, brx, bry; wid_get_abs_coords(w, &tlx, &tly, &brx, &bry); @@ -1079,7 +1054,6 @@ void wid_mouse_warp(Widp w) void wid_mouse_move(Widp w) { - int tlx, tly, brx, bry; wid_get_abs_coords(w, &tlx, &tly, &brx, &bry);