[teeworlds] Cosmetic patches

  • From: Sadler <Sad2004@xxxxxxx>
  • To: teeworlds@xxxxxxxxxxxxx
  • Date: Fri, 16 Jan 2009 18:55:31 +0600

Hi.

Here is small cosmetic patches for 0.5.0.

-------- Exit console command ----------

Very useful thing :)

CODE:

diff -ura teeworlds-0.5.0-src\src\engine\client\ec_client.c 
src\engine\client\ec_client.c
--- teeworlds-0.5.0-src\src\engine\client\ec_client.c   Tue Jan 13 20:36:10 2009
+++ src\engine\client\ec_client.c       Fri Jan 16 18:22:14 2009
@@ -1837,6 +1837,8 @@
 static void client_register_commands()
 {
        MACRO_REGISTER_COMMAND("quit", "", con_quit, 0x0);
+       MACRO_REGISTER_COMMAND("exit", "", con_quit, 0x0);
        MACRO_REGISTER_COMMAND("connect", "s", con_connect, 0x0);
        MACRO_REGISTER_COMMAND("disconnect", "", con_disconnect, 0x0);
        MACRO_REGISTER_COMMAND("ping", "", con_ping, 0x0);



-------- Editor improvments ----------

1) Map scroll by mouse wheel/button 3
2) Exit button in the "File" menu
3) Mouse now correctly works when user writes cl_editor 1 from console
4) Simple hotkeys for map scroll

CODE:

diff -ura teeworlds-0.5.0-src\src\game\editor\ed_editor.cpp 
src\game\editor\ed_editor.cpp
--- teeworlds-0.5.0-src\src\game\editor\ed_editor.cpp   Tue Jan 13 20:36:10 2009
+++ src\game\editor\ed_editor.cpp       Fri Jan 16 18:32:18 2009
@@ -1146,14 +1146,14 @@
                ui_set_hot_item(editor_id);
                                
                // do global operations like pan and zoom
-               if(ui_active_item() == 0 && ui_mouse_button(0))
+               if(ui_active_item() == 0 && (ui_mouse_button(0) || 
ui_mouse_button(2)) )
                {
                        start_wx = wx;
                        start_wy = wy;
                        start_mx = mx;
                        start_my = my;
                                        
-                       if(inp_key_pressed(KEY_LCTRL) || 
inp_key_pressed(KEY_RCTRL))
+                       if(inp_key_pressed(KEY_LCTRL) || 
inp_key_pressed(KEY_RCTRL) || ui_mouse_button(2))
                        {
                                if(inp_key_pressed(KEY_LSHIFT))
                                        operation = OP_PAN_EDITOR;
@@ -2394,6 +2394,7 @@
        static int save_as_button = 0;  
        static int open_button = 0;     
        static int append_button = 0;   
+       static int exit_button = 0;     
 
        RECT slot;
        ui_hsplit_t(&view, 2.0f, &slot, &view);
@@ -2434,6 +2435,16 @@
                editor.invoke_file_dialog(LISTDIRTYPE_SAVE, "Save Map", "Save", 
"maps/", "", callback_save_map);
                return 1;
        }
+
+       ui_hsplit_t(&view, 10.0f, &slot, &view);
+       ui_hsplit_t(&view, 12.0f, &slot, &view);
+       if(do_editor_button(&exit_button, "Exit", 0, &slot, 
draw_editor_button_menuitem, 0, "Exits from the editor"))
+       {               
+               config.cl_editor = 0;
+               return 1;
+       }
+
+
                
        return 0;
 }
@@ -2656,6 +2668,7 @@
 
 extern "C" void editor_update_and_render()
 {
+       inp_mouse_mode_relative();
        static int mouse_x = 0;
        static int mouse_y = 0;
 
@@ -2729,6 +2742,15 @@
        
        if(inp_key_down(KEY_F10))
                editor.show_mouse_pointer = false;
+
+       //hotkeys
+       int move_offset=10*editor.world_zoom;
+
+       if(inp_key_presses(KEY_LEFT)) editor.world_offset_x-=move_offset;
+       if(inp_key_presses(KEY_RIGHT)) editor.world_offset_x+=move_offset;
+       if(inp_key_presses(KEY_UP)) editor.world_offset_y-=move_offset;
+       if(inp_key_presses(KEY_DOWN)) editor.world_offset_y+=move_offset;
+       
        
        editor.render();





Other related posts: